diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index e9cc044..f32f918 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -10,7 +10,7 @@ body: id: plugin-version attributes: label: Plugin version - description: "Run: npm list @renjfk/opencode-voice" + description: "Run: npm list @bojackduy/opencode-voice" placeholder: "0.1.2" validations: required: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4131ff2..5d1618d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ name: CI on: push: - branches: [main] + branches: [main, master] pull_request: permissions: @@ -19,6 +19,8 @@ jobs: with: node-version: 24 + - uses: oven-sh/setup-bun@v2 + - run: npm install - name: Check formatting @@ -27,6 +29,9 @@ jobs: - name: Lint run: npx oxlint . + - name: Typecheck + run: npx tsc --noEmit -p tsconfig.json + test: name: Test runs-on: ubuntu-latest @@ -38,10 +43,12 @@ jobs: with: node-version: 24 + - uses: oven-sh/setup-bun@v2 + - run: npm install - name: Run unit tests - run: npm test + run: bun test src build: name: Build @@ -54,6 +61,8 @@ jobs: with: node-version: 24 + - uses: oven-sh/setup-bun@v2 + - run: npm install - name: Verify package diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..4b29b3c --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,61 @@ +name: Publish npm package + +on: + push: + tags: + - "v*.*.*" + workflow_dispatch: + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: write + id-token: write + + steps: + - uses: actions/checkout@v4 + + - uses: oven-sh/setup-bun@v2 + + - name: Setup Node + uses: actions/setup-node@v6 + with: + node-version: "24" + registry-url: "https://registry.npmjs.org" + package-manager-cache: false + + - name: Install dependencies + run: npm install + + - name: Verify release version + id: package + run: | + name=$(jq -r .name package.json) + version=$(jq -r .version package.json) + tag_version="${GITHUB_REF_NAME#v}" + if [ "$tag_version" != "$version" ]; then + echo "::error::Git tag $GITHUB_REF_NAME != package.json version $version" + exit 1 + fi + if npm view "$name@$version" version &>/dev/null; then + echo "::error::$name@$version already published" + exit 1 + fi + echo "name=$name" >> "$GITHUB_OUTPUT" + echo "version=$version" >> "$GITHUB_OUTPUT" + + - name: Check, test & pack + run: npm run prepack && npm pack --dry-run + + - name: Publish to npm + run: npm publish --access public + + - name: Create GitHub release + if: github.ref_type == 'tag' + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "$GITHUB_REF_NAME" \ + --title "$GITHUB_REF_NAME" \ + --notes "Published ${{ steps.package.outputs.name }}@${{ steps.package.outputs.version }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index b71f039..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,118 +0,0 @@ -name: Publish Release - -on: - workflow_dispatch: - inputs: - release_tag: - description: "Release tag (e.g., v0.1.0)" - required: true - type: string - release_notes: - description: "Release notes content (markdown supported)" - required: true - type: string - prerelease: - description: "Mark as pre-release" - required: false - type: boolean - default: false - draft: - description: "Create as draft release" - required: false - type: boolean - default: false - -permissions: - contents: write - id-token: write - -jobs: - prepare: - name: Prepare Release - runs-on: ubuntu-latest - outputs: - version: ${{ steps.version.outputs.version }} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Create and push release tag - run: | - RELEASE_TAG="${{ github.event.inputs.release_tag }}" - - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - if ! git rev-parse "$RELEASE_TAG" >/dev/null 2>&1; then - echo "Creating new tag: $RELEASE_TAG" - git tag -a "$RELEASE_TAG" -m "Release $RELEASE_TAG" - git push origin "$RELEASE_TAG" - else - echo "Tag $RELEASE_TAG already exists" - fi - - - name: Extract version from tag - id: version - run: | - RELEASE_TAG="${{ github.event.inputs.release_tag }}" - VERSION=${RELEASE_TAG#v} - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Setting version to: $VERSION" - - - name: Save release notes - run: | - cat << 'EOF' > release_notes.md - ${{ github.event.inputs.release_notes }} - EOF - - - name: Upload release notes artifact - uses: actions/upload-artifact@v4 - with: - name: release-notes - path: release_notes.md - - publish: - name: Publish to npm - runs-on: ubuntu-latest - needs: prepare - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ github.event.inputs.release_tag }} - - - uses: actions/setup-node@v4 - with: - node-version: 24 - registry-url: https://registry.npmjs.org - - - run: npm install - - - name: Set package version - run: npm version "${{ needs.prepare.outputs.version }}" --no-git-tag-version - - - name: Verify package - run: npm pack --dry-run - - - name: Publish to npm - run: npm publish --access public - - - name: Download release notes - uses: actions/download-artifact@v4 - with: - name: release-notes - path: /tmp/release - - - name: Create GitHub Release - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - gh release create "${{ github.event.inputs.release_tag }}" \ - --title "${{ github.event.inputs.release_tag }}" \ - --notes-file /tmp/release/release_notes.md \ - ${{ github.event.inputs.draft == 'true' && '--draft' || '' }} \ - ${{ github.event.inputs.prerelease == 'true' && '--prerelease' || '' }} diff --git a/.gitignore b/.gitignore index 2d98f97..be7868b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,12 @@ node_modules/ *.tgz +.opencode/loopd/ +graphify-out/ + +# wrangler files +.wrangler +.dev.vars* +!.dev.vars.example +.env* +!.env.example +__pycache__/ diff --git a/.opencode/skills/opencode-voice-benchmark/SKILL.md b/.opencode/skills/opencode-voice-benchmark/SKILL.md index 8fa65af..8172e37 100644 --- a/.opencode/skills/opencode-voice-benchmark/SKILL.md +++ b/.opencode/skills/opencode-voice-benchmark/SKILL.md @@ -9,17 +9,17 @@ Use this skill to produce actual STT normalization benchmark numbers. Keep the b ## Steps -1. Read `lib/stt.js` and copy the exact `STT_SYSTEM_PROMPT` from the tool plus user prompt format. Do not rely on a stale prompt from memory or from this skill if the source file differs: +1. Read `src/llm/prompts.ts` and copy the exact `STT_NORMALIZE_PROMPT` (and `buildSttUser`) from the tool plus user prompt format. Do not rely on a stale prompt from memory or from this skill if the source file differs: ```js prompt = `Clean up this speech-to-text transcription:\n\n${rawText}`; ``` -2. Read `lib/llm-client.js` to confirm the request body fields and supported options. +2. Read `src/llm/client.ts` to confirm the request body fields and supported options. 3. Create a temporary benchmark script outside the repo. -Use this working script as the starting point and edit endpoints/models as needed. Before running it, replace `STT_SYSTEM_PROMPT` with the current prompt copied from `lib/stt.js`: +Use this working script as the starting point and edit endpoints/models as needed. Before running it, replace `STT_SYSTEM_PROMPT` with the current prompt copied from `src/llm/prompts.ts`: ```js import { performance } from "node:perf_hooks"; diff --git a/AGENTS.md b/AGENTS.md index 25cb349..99208a2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,37 +1,43 @@ # AGENTS.md - opencode-voice -Guidelines for AI agents working in this repository. Keep this file concise - -only document constraints and rules an agent would get wrong without being told. +Guidelines for AI agents working in this repository. Only constraints an agent +would get wrong without being told. ## Architecture -Single TUI plugin exported from `index.js` with logic split into `lib/`. +OpenCode v2 TUI plugin, strict TypeScript shipped as source (Bun runs it +inside OpenCode; no build step). `index.ts`/`tui.ts` re-export `src/entry.ts`. + +- `src/plugin.ts` is the composition root: builds every module and wires them. +- `src/stt/session.ts` and `src/tts/session.ts` are the only state machines. + Every async step checks its operation id; every path ends in `idle`. +- `src/ui/status.ts` renders one status line as a pure function of both + machines (`statusSegments`). +- `src/host.ts` is the only place that touches the host `Context`. +- Leaf modules (`src/audio`, `src/stt/{whisper,streaming,transcript,...}`, + `src/tts/{vieneu,piper,text}`, `src/llm`) take injectable `deps` and know + nothing about the host. ## Key invariants -- Single default export: `{ id, tui }`. No server-side plugin. -- LLM calls use the OpenAI chat completions API, not the Anthropic messages API. -- Configuration uses `options` (static) and `api.kv` (runtime). No dotfile I/O. -- No build step. Plain ESM JavaScript, shipped as-is. +- Single default export `{ id, setup }` (v2 only). +- Shared contracts live in `src/types.ts`. +- `solid-js` / `@opentui/solid` are host-provided: import them with literal + dynamic `import("...")` only (variable specifiers fail to resolve at runtime); + their types are in `src/host-modules.d.ts`. +- Settings use the old kv keys in storage key `"opencode-voice"`; keep them. +- Never log transcript or speech text. Stored provider keys go only to their + own provider; `x-opencode-session` only to opencode.ai hosts. ## Scripts ```bash -npm run test # node --test -npm run check # lint + fmt -npm run lint # oxlint . -npm run fmt # oxfmt --check . +npm test # bun test src +npm run check # oxlint + oxfmt --check + tsc --noEmit npm run fmt:fix # oxfmt --write . ``` -Verify changes: `npm run check` with zero errors. - -CI runs on every PR and push to main (lint, test, build). See -RELEASE_PROCESS.md for release steps. - -## Code style +Verify changes: `npm run check` and `npm test`, zero errors. Tests use fakes in +`src/testing/fakes.ts`; never spawn real audio, binaries or network in tests. -- **ESM only** - `import`/`export`, `"type": "module"` in package.json -- **No build step** - no TypeScript, no bundler -- **Formatting** - enforced by oxfmt -- **Linting** - enforced by oxlint +See RELEASE_PROCESS.md for releases. diff --git a/LICENSE b/LICENSE index da6fe81..b058197 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,686 @@ +opencode-voice (bojackduy fork) +Copyright (C) 2026 bojackduy + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This fork is based on renjfk/opencode-voice. The original upstream code +remains under its MIT license; the upstream copyright and permission +notice are preserved verbatim in the "Upstream attribution" section at +the end of this file, as the MIT license requires. + +-------------------------------------------------------------------------------- + + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. + +-------------------------------------------------------------------------------- +Upstream attribution (MIT, preserved as required by its license) +-------------------------------------------------------------------------------- + +This fork is based on renjfk/opencode-voice. The original code is: + MIT License Copyright (c) 2026 Soner Koksal diff --git a/MARKETING.md b/MARKETING.md new file mode 100644 index 0000000..7f30ffd --- /dev/null +++ b/MARKETING.md @@ -0,0 +1,94 @@ +# Marketing Content Calendar — opencode-voice + +**Status:** Draft v1 (2026-10-30). All posts are drafts; do not publish without approval. + +## Positioning (one-liner) + +Voice in and voice out for OpenCode: local-first STT + TTS, bilingual vi+en, +hands-free conversation mode. AGPL, free. + +## 30-day calendar + +| Day | Channel | Type | Topic | CTA | +| --- | -------------------- | ------------- | -------------------------------------------------- | --------------- | +| 1 | X/Twitter | Launch | "Stop typing prompts. Start talking." demo GIF | GitHub star | +| 2 | Reddit r/programming | Show | "I added voice in/out to my terminal AI assistant" | GitHub | +| 3 | Blog | Tutorial | "How I built local STT for a terminal AI tool" | Docs | +| 4 | X | Tip | Streaming dictation: live waveform + transcript | Try it | +| 5 | OpenCode Discord | Announce | v0.11.3 release, new TTS engines | Install | +| 6 | Reddit r/LocalLLaMA | Technical | Local whisper + Piper, no cloud | GitHub | +| 7 | Blog | Deep-dive | "LLM normalization for natural speech" | Docs | +| 8 | X | Demo | Hands-free conversation mode (video) | GitHub | +| 9 | LinkedIn | Professional | Accessibility angle: voice for devs | GitHub | +| 10 | Hacker News | Show HN | "Show HN: opencode-voice" | GitHub | +| 11 | X | Feature | Bilingual vi+en code-switching (VieNeu) | Try it | +| 12 | Reddit r/vietnamese | Community | Công cụ voice cho dev VN | GitHub | +| 13 | Blog | Comparison | "opencode-voice vs generic dictation" | Install | +| 14 | X | Behind-scenes | Streaming partials + silence detection | GitHub | +| 15 | YouTube | Short | 60s demo: speak → transcribe → speak back | GitHub | +| 16 | X | Tip | /tts-engine: switch Piper/Chatterbox/VieNeu | Try it | +| 17 | Reddit r/commandline | Show | Terminal-native voice workflow | GitHub | +| 18 | Blog | Tutorial | "Set up local TTS in 5 minutes" | Docs | +| 19 | X | Demo | Now-playing line: pause/rewind/speed | GitHub | +| 20 | OpenCode community | Update | Conversation mode walkthrough | Install | +| 21 | X | Metric | (only after real metrics exist) | — | +| 22 | Reddit r/programming | AMA-ish | "Building a voice plugin for an AI CLI" | GitHub | +| 23 | Blog | Case study | Real workflow: voice-coding a feature | GitHub | +| 24 | X | Tip | Insert-don't-send: why it matters | Try it | +| 25 | LinkedIn | Update | Week-4 progress + roadmap | GitHub | +| 26 | Hacker News | Comment | Engage on voice/AI dev threads | — | +| 27 | X | Demo | Mic selection + model picker | GitHub | +| 28 | Reddit r/LocalLLaMA | Update | New engine + bilingual support | GitHub | +| 29 | Blog | Roadmap | "What's next for opencode-voice" | GitHub | +| 30 | All | Recap | Month-1 recap + thank you | GitHub Sponsors | + +## Launch post drafts + +### X/Twitter (Day 1) + +> Stop typing prompts. Start talking. +> +> opencode-voice adds voice in + voice out to OpenCode: +> • Local whisper STT, inserts at cursor (never auto-sends) +> • Piper/Chatterbox/VieNeu TTS, code-aware +> • Bilingual vi+en code-switching +> • Hands-free conversation mode +> +> AGPL, free. Demo 👇 +> [demo.gif] +> github.com/bojackduy/opencode-voice + +### Hacker News (Day 10) — Show HN + +Title: Show HN: opencode-voice – voice in and voice out for OpenCode +Body: + +> I built a plugin that adds speech-to-text and text-to-speech to OpenCode (the terminal AI coding assistant). STT uses local whisper-cpp, TTS uses Piper/Chatterbox/VieNeu. Transcripts insert at the cursor as editable text (no auto-send). Responses are spoken aloud with LLM normalization that summarizes code, diagrams, and tables. Bilingual Vietnamese+English via VieNeu-TTS. Hands-free conversation mode included. +> +> Local-first: audio never leaves your machine unless you opt into a hosted endpoint. +> +> Repo: https://github.com/bojackduy/opencode-voice + +### Reddit r/programming (Day 2) + +Title: I added voice input/output to my terminal AI coding assistant +Body: (longer, problem-focused, link to repo + demo) + +### Reddit r/LocalLLaMA (Day 6) + +Title: Local-first STT+TTS for a terminal AI tool (whisper-cpp + Piper/VieNeu, no cloud) +Body: technical focus on local models, bilingual vi+en. + +## SEO keyword targets + +Primary: "opencode voice plugin", "voice to text opencode", "text to speech opencode" +Secondary: "local speech to text cli", "whisper opencode", "bilingual tts vietnamese english" +Long-tail: "hands free coding voice assistant terminal", "piper tts opencode plugin" + +## Assets needed (not yet created) + +- 60s demo video (screen + audio) — use scripts/record-with-audio.sh +- Vietnamese-language demo post for r/vietnamese +- GitHub Sponsors page setup + EOF + echo written; wc -l MARKETING.md diff --git a/POSITIONING.md b/POSITIONING.md new file mode 100644 index 0000000..96fe78d --- /dev/null +++ b/POSITIONING.md @@ -0,0 +1,106 @@ +# Product Positioning — opencode-voice + +**Status:** Draft v1 (auto-generated from codebase inspection, 2026-10-30) + +## Product description + +`opencode-voice` is a plugin for [OpenCode](https://opencode.ai/) that adds +speech-to-text (STT) and text-to-speech (TTS) to the terminal-based AI coding +assistant. It records voice prompts with local whisper transcription, transcribes +and normalizes them with an LLM, and inserts the result at the focused cursor +without auto-sending. It also speaks assistant responses aloud via Piper (or +Chatterbox / VieNeu-TTS), with per-sentence language routing and LLM +summarization of code-heavy replies. A hands-free conversation mode ties both +directions together. + +- Package: `@bojackduy/opencode-voice` (npm, public) +- License: AGPL-3.0-or-later +- Repo: https://github.com/bojackduy/opencode-voice +- Stars: 0 · Forks: 0 · Version: 0.11.3 + +## Primary audience + +Developers who use OpenCode as their AI coding assistant and want to: + +- Dictate prompts instead of typing (faster for long, multi-part requests) +- Listen to responses while keeping eyes on code (hands-busy, walking, reviewing) +- Use voice accessibility affordances in a terminal workflow + +Secondary: non-English (especially Vietnamese) developers who want bilingual +speech, since most TTS tools are English-only or need separate voice models. + +## User pain points + +1. Typing long, detailed prompts into a terminal composer is slow and breaks flow. +2. Reading long assistant responses pulls attention away from the code. +3. Most voice tools are GUI-first and don't integrate with terminal AI assistants. +4. Cloud STT/TTS raises privacy concerns for code that shouldn't leave the machine. +5. Bilingual (Vietnamese + English code-switching) speech is poorly supported by + existing tools. + +## Value proposition + +Voice in and voice out for OpenCode, fully local by default, bilingual, and +terminal-native. Speak a prompt; hear the answer — without leaving your editor +or sending audio to a cloud. + +## Differentiators + +1. **OpenCode-native.** Built as a first-class OpenCode plugin (v1 + v2 via + capability detection), not a generic dictation tool bolted on. +2. **Local-first.** whisper-cpp + sox for STT, Piper/Chatterbox/VieNeu for TTS. + Audio never leaves the machine unless you opt into a hosted endpoint. +3. **Insert, don't send.** Transcripts land at the focused cursor as editable + text. Nothing is submitted unless explicitly requested. +4. **Bilingual code-switching.** VieNeu-TTS handles Vietnamese + English in a + single utterance; per-sentence language routing picks the right voice. +5. **LLM normalization.** Homophones, camelCase splitting, code summarization, + diagram/table summarization — speech that sounds like a person, not a + compiler. +6. **Hands-free conversation mode.** Auto-silence finalize + auto-listen after + reply, with barge-in. +7. **Streaming dictation.** Live waveform + live transcript with pause/auto-end + toggles. + +## Competitors + +| Product | Relation | Gap we fill | +| ---------------------------- | -------- | ------------------------------------------------------ | +| GitHub Copilot Voice | Adjacent | GitHub-only, cloud, no terminal integration | +| Cursor voice mode | Adjacent | GUI IDE, cloud, English-focused | +| Superwhisper / MacWhisper | Adjacent | Generic dictation, no OpenCode integration, no TTS-out | +| OS dictation (macOS/Windows) | Adjacent | No LLM normalization, no TTS, no code awareness | +| OpenAI Realtime API | Infra | Cloud-only, paid, no terminal UX | + +**No direct competitor** exists for terminal-native, local-first, bilingual +voice in/out specifically for OpenCode. The closest substitutes are generic +dictation apps used alongside (not inside) the editor. + +## Suggested pricing / monetization (assumption) + +The project is AGPL and free. Realistic paths: + +- **GitHub Sponsors** for ongoing maintenance (primary, low-friction). +- **Optional paid hosted STT/TTS endpoint** for users who don't want to install + whisper-cpp / Piper locally (freemium tier). Not implemented yet. +- **Consulting / custom voice models** for teams. + +No paid tier exists today. Do not imply one in marketing. + +## Recommended marketing channels + +1. GitHub (README, topics, releases) — primary discovery for devs. +2. npm (keywords, README renders) — installation path. +3. Hacker News "Show HN" — developer tool audience. +4. Reddit: r/programming, r/LocalLLaMA, r/vietnamese (bilingual angle), r/commandline. +5. X/Twitter dev community — short demos. +6. OpenCode community / Discord — direct audience. +7. Vietnamese developer communities (Facebook groups, Zalo) — bilingual angle. +8. YouTube short demos — waveform + conversation mode. + +## Assumptions (labeled) + +- Audience size and growth targets are unknown; no analytics exist yet. +- No user testimonials or usage metrics exist; marketing must not fabricate them. +- Monetization is undecided; free/open-source is the current reality. +- Landing page does not exist yet; needs to be built. diff --git a/README.md b/README.md index b2ed2c4..eb44eef 100644 --- a/README.md +++ b/README.md @@ -1,472 +1,171 @@ -[![CI](https://github.com/renjfk/opencode-voice/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/renjfk/opencode-voice/actions/workflows/ci.yml) -[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) -[![npm](https://img.shields.io/npm/v/@renjfk/opencode-voice)](https://www.npmjs.com/package/@renjfk/opencode-voice) -[![Downloads](https://img.shields.io/npm/dm/@renjfk/opencode-voice)](https://www.npmjs.com/package/@renjfk/opencode-voice) - # opencode-voice -Speech-to-text and text-to-speech plugin for [OpenCode](https://opencode.ai/). - -Record voice prompts with local whisper transcription, hear assistant responses -spoken aloud via Piper TTS. Both directions use an LLM to normalize text for -natural speech (fixing homophones, splitting camelCase identifiers, summarizing -code-heavy responses, etc.). - -## Install - -Add to your `tui.json` (create at `~/.config/opencode/tui.json` if it doesn't -exist). You must configure at least `endpoint` and `model`: - -> [!NOTE] -> **Clobbering default keybinds.** This plugin uses `ctrl+r` for voice -> recording, but OpenCode assigns it to session rename by default. Session -> rename is not used frequently and is still accessible via `/rename`, so we -> clobber the factory default to let the plugin use `ctrl+r` properly. See -> the `keybinds` section in the config below. - -```json -{ - "$schema": "https://opencode.ai/tui.json", - "keybinds": { - "session_rename": "none" - }, - "plugin": [ - [ - "@renjfk/opencode-voice", - { - "endpoint": "https://api.anthropic.com/v1", - "model": "claude-haiku-4-5", - "apiKeyEnv": "ANTHROPIC_API_KEY" - } - ] - ] -} -``` - -### Refresh cached plugin after updates - -If OpenCode keeps using an older published version of the plugin after an -update, clear the cached package and restart OpenCode: - -```bash -rm -rf ~/.cache/opencode/packages/@renjfk/ -``` - -## Prerequisites - -### Speech-to-text - -The plugin uses [whisper.cpp](https://github.com/ggml-org/whisper.cpp) via a -`whisper-cli` binary and `sox` for microphone capture. Follow the subsection -for your OS to install the binary and verify your microphone, then run the -shared **Download model & smoke test** step at the end. - -#### macOS - -Install the `whisper-cpp` bottle (ships a `whisper-cli` with Metal enabled on -Apple Silicon) and `sox`: - -```bash -brew install whisper-cpp sox -``` - -Verify your microphone by recording a 3-second clip and playing it back. The -first `sox -d` invocation triggers a macOS microphone permission prompt — -grant it in **System Settings → Privacy & Security → Microphone**, then rerun. -Remove the temp file once you've heard yourself clearly: - -```bash -sox -d /tmp/mic-check.wav trim 0 3 # speak for 3 seconds -play /tmp/mic-check.wav # you should hear yourself -rm /tmp/mic-check.wav # delete after verification -``` - -#### Linux (including WSL2) - -Install `sox` with its PulseAudio driver (a separate package on Debian/Ubuntu), -the PulseAudio tools so the plugin can enumerate input devices via `pactl`, -and the build tools for whisper.cpp: - -```bash -sudo apt install sox libsox-fmt-pulse pulseaudio-utils build-essential cmake -``` - -On WSL2, make sure [WSLg](https://learn.microsoft.com/windows/wsl/tutorials/gui-apps) -is running — it bridges the Windows microphone into WSL as a PulseAudio source -(typically named `RDPSource`), which you can then pick with `/stt-mic`. - -**WSL2 audio troubleshooting.** There is no `/dev/snd` in WSL2 — that is -normal. Audio goes through WSLg's PulseAudio server at `/mnt/wslg/PulseServer`, -so ALSA-only tools like `arecord -l` will never list a device. If `/stt-mic` -finds no devices or `pactl info` fails with `Connection refused`, WSLg's -PulseAudio is stuck; fix it from Windows PowerShell: - -```powershell -wsl --shutdown # then reopen Ubuntu (closes all WSL sessions) -``` - -If the source list is still empty after a restart, check Windows -**Settings → Privacy & security → Microphone** and enable both "Microphone -access" and "Let desktop apps access your microphone" (WSLg captures audio via -a desktop RDP client), then run `wsl --update` for the latest WSLg. - -Verify your microphone by recording a 3-second clip and playing it back. -Remove the temp file once you've heard yourself clearly; skip building -whisper.cpp until this works, otherwise `/stt-mic` will have nothing to select: - -```bash -sox -d /tmp/mic-check.wav trim 0 3 # speak for 3 seconds -play /tmp/mic-check.wav # you should hear yourself -rm /tmp/mic-check.wav # delete after verification -``` - -`whisper-cli` is not packaged for Linux, so build whisper.cpp from source. -Pick **one** of the two builds below. - -**CPU build** — works on any machine, adequate for `tiny`/`base`/`small` -models: - -```bash -git clone https://github.com/ggml-org/whisper.cpp ~/opt/whisper.cpp -cmake -B ~/opt/whisper.cpp/build -S ~/opt/whisper.cpp \ - -DCMAKE_BUILD_TYPE=Release -DWHISPER_BUILD_TESTS=OFF -cmake --build ~/opt/whisper.cpp/build -j --target whisper-cli -sudo ln -sf ~/opt/whisper.cpp/build/bin/whisper-cli /usr/local/bin/whisper-cli -``` - -**CUDA build** — NVIDIA GPU, ~100× faster encode for `medium`/`large` models. -Check your GPU with `nvidia-smi` and your toolkit with `nvcc --version`, then -pick the arch code from the table: - -| GPU family | Arch | `CMAKE_CUDA_ARCHITECTURES` | Min. CUDA | -| ------------- | --------- | -------------------------- | --------- | -| RTX 20 / T4 | Turing | `75` | 10.0 | -| RTX 30 / A100 | Ampere | `86` | 11.0 | -| RTX 40 / L40 | Ada | `89` | 11.8 | -| H100 | Hopper | `90` | 12.0 | -| RTX 50 / B100 | Blackwell | `120` | 13.0 | - -```bash -git clone https://github.com/ggml-org/whisper.cpp ~/opt/whisper.cpp -cmake -B ~/opt/whisper.cpp/build -S ~/opt/whisper.cpp \ - -DCMAKE_BUILD_TYPE=Release \ - -DGGML_CUDA=ON \ - -DCMAKE_CUDA_ARCHITECTURES=89 \ - -DWHISPER_BUILD_TESTS=OFF -cmake --build ~/opt/whisper.cpp/build -j --target whisper-cli -sudo ln -sf ~/opt/whisper.cpp/build/bin/whisper-cli /usr/local/bin/whisper-cli -``` +> **Speak your prompts. Hear your answers.** A voice plugin for [OpenCode](https://opencode.ai/) v2. -If you have multiple CUDA toolkits installed (e.g. Blackwell requires CUDA 13 -while the default `nvcc` is 12), also pass `-DCMAKE_CUDA_COMPILER=/usr/local/cuda-13.3/bin/nvcc` -to point at the matching `nvcc`. CUDA runtime libraries are resolved via -ldconfig; no `LD_LIBRARY_PATH` is needed. +[![CI](https://github.com/bojackduy/opencode-voice/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/bojackduy/opencode-voice/actions/workflows/ci.yml) +[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](LICENSE) +[![npm](https://img.shields.io/npm/v/@bojackduy/opencode-voice)](https://www.npmjs.com/package/@bojackduy/opencode-voice) -At runtime the plugin records through sox's `pulseaudio` driver when `pactl` -is available, and falls back to sox's default device otherwise. +![Demo: voice workflow in OpenCode](assets/voice-demo-2.gif) -#### Download model & smoke test +## What it does -Download a whisper model to `~/.local/share/whisper-cpp/` (same path on both -OSes): +- **Dictate** into the focused text field — **live** (words appear while you speak) or **batch** (speak, then transcribe). +- **Mac or phone mic** — local sox capture, or a phone over USB/ssh (Termux) with automatic `adb forward`. +- **Clean-up** with any OpenCode model (fixes misheard words, punctuation), or exact whisper text. +- **Fix** — press Fix and say the correction ("fix, not fit"); the LLM merges it into the current text. +- **Read replies aloud** in natural Vietnamese and English with [VieNeu-TTS](https://github.com/pnnbao97/VieNeu-TTS); Piper takes over automatically if VieNeu is unavailable. Mac speakers or the phone. +- **One status line** above the prompt shows exactly what is happening, with clickable buttons: -```bash -mkdir -p ~/.local/share/whisper-cpp -curl -L -o ~/.local/share/whisper-cpp/ggml-large-v3-turbo-q5_0.bin \ - https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo-q5_0.bin ``` - -Smoke-test the install by transcribing a short recording: - -```bash -sox -d /tmp/smoke.wav trim 0 4 # say something for 4 seconds -whisper-cli -m ~/.local/share/whisper-cpp/ggml-large-v3-turbo-q5_0.bin \ - -f /tmp/smoke.wav -l auto -nt -rm /tmp/smoke.wav +● LIVE 0:07 ▃▅▄ [⏸ Pause] [■ Done] [✕ Cancel] │ ♪ 0:05/0:12 [«5] [⏸] [5»] [1.25x] [■] +[● Speak] [✎ Fix] [⏹ Auto-stop ✓] [⏎ Auto-send ✓] [Live] [turbo] │ [▶ Reply] [↺] [1x] [Read ✓] ``` -Check the first `system_info:` line in the output to confirm the expected -backend is active: - -| Install | Expect | -| ------------------------------ | ----------------------- | -| macOS Homebrew (Apple Silicon) | `METAL = 1` | -| Linux CUDA build | `CUDA : ARCHS = ` | -| CPU-only | `METAL = 0` / no `CUDA` | - -Reference `encode time` on a 4-second clip: CPU `medium` ≈ 15–30 s; CUDA -`medium` ≈ 100–200 ms; CUDA `large-v3-turbo` ≈ 100–300 ms. Apple Silicon -Metal timings are hardware-dependent but typically sub-second. If your GPU -build shows CPU-level timings, the GPU backend failed to load — on Linux, -re-check `nvidia-smi` and rebuild with the arch code from the table above. - -### Text-to-speech - -Install [Piper](https://github.com/rhasspy/piper): - -```bash -uv tool install piper-tts -``` - -Or with pip: - -```bash -pip install piper-tts -``` - -The plugin looks for `piper` on your `PATH` (`~/.local/bin` is typically on `PATH`). - -Download a voice model to `~/.local/share/piper-voices/`: - -```bash -mkdir -p ~/.local/share/piper-voices -curl -L -o ~/.local/share/piper-voices/en_US-ryan-high.onnx \ - https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/ryan/high/en_US-ryan-high.onnx -curl -L -o ~/.local/share/piper-voices/en_US-ryan-high.onnx.json \ - https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/ryan/high/en_US-ryan-high.onnx.json -``` - -### LLM endpoint +## Install -An OpenAI-compatible LLM endpoint is required for text normalization. For -speech-to-text it cleans up whisper output (punctuation, filler words, software -engineering homophones). For text-to-speech it converts markdown into natural -spoken text. +Prerequisites (macOS): `brew install sox whisper-cpp`, a ggml whisper model in +`~/.local/share/whisper-cpp/` (e.g. `ggml-large-v3-turbo-q5_0.bin`), and for +speech: Piper on `PATH` with voices in `~/.local/share/piper-voices/`, plus an +optional VieNeu-TTS Python venv. See [docs/technical.md](docs/technical.md). -Configure your endpoint in `tui.json` via plugin options. Any OpenAI-compatible -endpoint works (Anthropic, OpenAI, Ollama, vLLM, LM Studio, etc.). The `apiKeyEnv` -option is optional - omit it for unauthenticated endpoints like Ollama. +Add to `~/.config/opencode/cli.json` (OpenCode v2 reads plugins only from +`cli.json` → `plugins`; entries in `tui.jsonc` are ignored): ```json { - "plugin": [ - [ - "@renjfk/opencode-voice", - { - "endpoint": "https://api.anthropic.com/v1", - "model": "claude-haiku-4-5", - "apiKeyEnv": "ANTHROPIC_API_KEY" + "plugins": [ + { + "package": "@bojackduy/opencode-voice", + "options": { + "sttMode": "streaming", + "sttAutoSubmit": false, + "ttsEngine": "vieneu", + "ttsVieneuPython": "~/.local/share/opencode-voice/vieneu-venv/bin/python", + "ttsVieneuVoice": "Mai Anh" } - ] + } ] } ``` -For unauthenticated local endpoints (e.g. Ollama): +For a local checkout use `"package": "file:/path/to/opencode-voice"`. Restart +OpenCode after changing the config. -```json -{ - "plugin": [ - [ - "@renjfk/opencode-voice", - { - "endpoint": "http://localhost:11434/v1", - "model": "llama3.2" - } - ] - ] -} -``` +The clean-up / Fix LLM defaults to the session's current model; pick another +with `/voice-model`, or set `endpoint` + `model` + `apiKeyEnv` explicitly. -- `endpoint` _(required)_ - OpenAI-compatible base URL -- `model` _(required)_ - model name sent to `/chat/completions` -- `apiKeyEnv` _(optional)_ - environment variable containing the API key -- `maxTokens` _(optional)_ - maximum completion tokens for normalization calls -- `reasoningEffort` _(optional)_ - reasoning level for models that support it -- `chatTemplateKwargs` _(optional)_ - extra keyword arguments passed to the model's chat template (e.g. `{"enable_thinking": false}` for Qwen models to disable chain-of-thought) -- `retries` _(optional)_ - number of retry attempts for transient LLM failures -- `tmpDir` _(optional)_ - directory used for the temporary STT recording file (default `/tmp`) -- `sttLanguage` _(optional)_ - spoken language passed to local `whisper-cli -l` (default `auto`; any whisper.cpp language code, e.g. `en`, `zh`). Can be changed at runtime via `/stt-language` -- `trimSilence` _(optional)_ - whether to remove leading silence from recordings (default `true`). Set to `false` if your recordings are missing the first word or syllable +## Voice follows you across machines (voice node) -### Logging +Run OpenCode on any machine in your Tailscale network and speak/listen on +**whichever device you are using right now** — this Mac, a Linux box, or an +Android phone (Termux). Transcription (whisper) and speech (VieNeu/Piper) run +once, on the strongest machine (the _engine host_). -The plugin writes diagnostics through OpenCode's structured app logger. If this plugin is not working with your setup, check the OpenCode log file and, optionally, enable debug mode. See the [OpenCode Docs](https://opencode.ai/docs/troubleshooting/#logs) for details. - -Routine plugin diagnostics use `debug`; recoverable issues use `warn`; failed -child processes, API calls, or unexpected exceptions use `error`. - -### STT API transcription (optional) - -Instead of local `whisper-cli`, you can use an OpenAI-compatible speech-to-text -API (e.g. serving a Whisper model). This is useful when you want to run the -plugin on a machine without whisper-cpp installed. - -```json -{ - "plugin": [ - [ - "@renjfk/opencode-voice", - { - "sttEndpoint": "http://127.0.0.1:8000/v1", - "sttModel": "whisper-large-v3-turbo", - "sttApiKeyEnv": "MY_STT_API_KEY" - } - ] - ] -} ``` - -- `sttEndpoint` _(optional)_ - OpenAI-compatible base URL with `/audio/transcriptions` support -- `sttModel` _(optional)_ - whisper model name to pass to the API (default: `whisper-large-v3-turbo`). Can be changed at runtime via `/stt-model`, which fetches available whisper models from the endpoint's `/models` listing -- `sttApiKeyEnv` _(optional)_ - environment variable containing the API key - -OpenRouter note: when `sttEndpoint` points at `https://openrouter.ai/api/v1`, the plugin automatically uses OpenRouter's JSON/base64 transcription request format instead of multipart upload. - -### Custom prompts - -The LLM system prompts used for normalization can be fully replaced by pointing -to your own prompt files. This lets you fine-tune how transcriptions are cleaned -up or how responses are spoken. - -```json -{ - "plugin": [ - [ - "@renjfk/opencode-voice", - { - "sttPrompt": "~/.config/opencode/stt-prompt.md", - "ttsAutoPrompt": "~/.config/opencode/tts-auto-prompt.md", - "ttsManualPrompt": "~/.config/opencode/tts-manual-prompt.md" - } - ] - ] -} +OpenCode on duy ──┐ ┌── mic + speaker: Mac +OpenCode on Mac ──┼─ text ─▶ voice node ◀─┼── mic + speaker: duy-1 (Linux, PipeWire) +OpenCode on ... ──┘ (engine host: Mac) └── mic + speaker: Phone (Termux, USB or Tailscale) ``` -- `sttPrompt` _(optional)_ - system prompt for cleaning up whisper transcriptions -- `ttsAutoPrompt` _(optional)_ - system prompt for auto-speaking assistant responses -- `ttsManualPrompt` _(optional)_ - system prompt for manually reading responses aloud - -If a path is not set, the built-in default prompt is used. - -## Commands - -### Speech-to-text +- **Follow me**: audio goes to the device with the most recent keyboard, + mouse or touch activity (a phone only counts while Termux is on screen — + Android blocks the mic for background apps). Devices without a working + mic/speaker are skipped. Pin a device with the status-line button + (`[🎙 Mac]` / `[📌 Phone]`) or `/voice-device`. +- One dictation at a time across all machines ("Microphone is in use by + duy:opencode"); replies from any machine play on the same speaker. +- The node only listens on loopback and your Tailscale IP and only accepts + peers of your own tailnet account (`tailscale whois`). -| Command | Keybind | Description | -| --------------- | ---------- | -------------------------------------- | -| `/stt-record` | `ctrl+r` | Start/stop recording + transcribe | -| `/stt-submit` | `leader+r` | Stop recording, transcribe, and submit | -| `/stt-stop` | | Cancel recording | -| `/stt-model` | | Select whisper model | -| `/stt-language` | | Select transcription language | -| `/stt-mic` | | Select microphone | +Setup on the engine host (plugin option `"voiceNode": "host"` starts the node +automatically and restarts it if it dies): -`/stt-mic` lists CoreAudio input devices on macOS, and PulseAudio sources on -Linux (via `pactl`, monitor sources excluded). On systems without a supported -device listing, "System default" uses sox's default device (`sox -d`). - -`/stt-language` offers a curated list of common languages (plus auto-detect) -and only affects local `whisper-cli` transcription, not the STT API. Languages -outside the list can be set via the `sttLanguage` plugin option. - -### Text-to-speech - -The `leader` key in OpenCode is `ctrl+x`. So `leader+s` means press `ctrl+x` -then `s`. - -| Command | Keybind | Description | -| ------------ | ---------- | ------------------------ | -| `/tts-speak` | `leader+s` | Read last response aloud | -| `/tts-mode` | `leader+v` | Toggle auto TTS on/off | -| `/tts-stop` | `escape` | Stop playback | -| `/tts-voice` | | Select TTS voice | - -## How it works - -### STT pipeline - -1. `sox` records audio from your microphone (CoreAudio on macOS, PulseAudio on - Linux when `pactl` is available, sox default device otherwise) -2. `whisper-cli` transcribes locally using a ggml model, or an OpenAI-compatible - API endpoint if `sttEndpoint` is configured -3. LLM normalizes the transcription: fixes punctuation, removes filler words, - corrects software engineering homophones ("Jason" to "JSON", "bullion" to - "boolean", etc.) -4. Cleaned text is appended to the OpenCode prompt, or submitted immediately - when `/stt-submit` is used. If normalization fails (e.g. LLM endpoint - unreachable), the raw transcription is used as a fallback so you never lose - your input - -### TTS pipeline - -1. When the assistant finishes responding (or on manual trigger), the response - text is sent to the LLM for speech normalization -2. The LLM decides how to handle it: narrate simple answers, summarize - code-heavy responses, or briefly notify for confirmations -3. Piper synthesizes speech locally, piped through sox for playback - -### Auto TTS - -When enabled (`/tts-mode`), the plugin automatically speaks: - -- Assistant responses when a session goes idle after work -- Permission requests -- Questions that need your answer - -## Contributing - -opencode-voice is open to contributions and ideas! - -### Issue conventions - -**Format:** `type: brief description` - -- `feat:` new features or functionality -- `fix:` bug fixes -- `enhance:` improvements to existing features -- `chore:` maintenance tasks, dependencies, cleanup -- `docs:` documentation updates -- `build:` build system, CI/CD changes - -### Development - -```bash -npm run check # lint + fmt -npm run lint # oxlint -npm run fmt # oxfmt --check -npm run fmt:fix # oxfmt --write -``` - -### Test local plugin in OpenCode - -To test unpublished changes in the OpenCode TUI, point `~/.config/opencode/tui.json` -at the local repo path, not the npm package name: +`~/.config/opencode-voice/node.json` ```json { - "$schema": "https://opencode.ai/tui.json", - "plugin": ["/Users/your-user/opencode-voice"] + "devices": [ + { "id": "mac", "label": "Mac", "kind": "local" }, + { + "id": "phone", + "label": "Phone", + "kind": "termux", + "ssh": "phone-usb", + "adb": "SERIAL", + "adbForwardPort": 8022 + }, + { "id": "duy-1", "label": "duy-1", "kind": "linux", "ssh": "duy-1" } + ], + "vieneuVoice": "Mai Anh" } ``` -### Optional macOS Hammerspoon integration - -If you use macOS, [Hammerspoon](https://www.hammerspoon.org/), and -[Ghostty](https://ghostty.org/), see -[`examples/hammerspoon/ghostty-fn.lua`](examples/hammerspoon/ghostty-fn.lua) -for an optional global `Fn` key setup. - -Behavior: - -- Press `Fn` to send `ctrl+r` and start recording. -- Hold `Fn` for at least 0.5 seconds and release to send `leader+r`, which - stops recording, normalizes, and submits the prompt. - -Notes: - -- It assumes OpenCode is using the default leader key, `ctrl+x`. -- It assumes OpenCode is running in Ghostty terminal `1`. -- It is best used as a push-to-talk flow: hold `Fn` while speaking, then - release to submit. -- Adjust `APP_NAME`, `TARGET_TERMINAL`, and `LONG_PRESS_THRESHOLD_SECONDS` to - fit your setup. - -### Release process - -Manual releases via opencode; see [RELEASE_PROCESS.md](RELEASE_PROCESS.md). +`ssh` names are hosts in `~/.config/opencode-voice/ssh_config` (key-based, +non-interactive). Linux devices need PipeWire/PulseAudio (`pw-cat`, `pacat`); +the phone needs Termux with `openssh`, `sox`, `ffmpeg` and Termux:API. On the +other machines just add the plugin with `"voiceNode": "auto"` (the default): +it finds the node on the tailnet. See [docs/technical.md](docs/technical.md#voice-node). + +## Keys and commands + +| Key | Command | What it does | +| ------------------------- | ----------------------------------------- | ------------------------------------------------------------ | +| `[` | `/stt` | Start dictation; press again to finish (resumes when paused) | +| — | `/stt-fix` | Re-speak to correct the current text | +| — | `/stt-pause` | Pause / resume live dictation | +| `.` | `/voice-cancel` | Cancel everything in flight | +| `]` | `/tts-speak` | Read the last reply; press again to stop | +| `0` | `/tts-replay` | Replay the last reading | +| `-` / `=` | `/tts-rewind`, `/tts-forward` | Back / forward 5 s (also across parts) | +| — | `/tts-faster`, `/tts-slower`, `/tts-rate` | Reading speed 0.75x–2x, voice pitch kept (saved) | +| — | `/tts-pause`, `/tts-stop` | Pause / stop reading | + +Click `[1x]` on the status line to cycle the speed, `[«5]` / `[5»]` to skip, +`[Live]` to switch live/batch, and the engine button (`[turbo]`) to pick the +transcription engine and whisper model. + +Settings (persisted): `/stt-mode` (live/batch), `/stt-autosubmit`, +`/stt-auto-end` (finish after 2.5 s of silence), `/stt-normalize`, +`/stt-language`, `/stt-model`, `/stt-engine`, `/stt-mic`, `/tts-mode` +(auto-read replies), `/tts-engine`, `/tts-voice`, `/tts-output`, +`/voice-model`, `/voice-device` (follow me / pin a device), and `/voice-status` +for diagnostics. + +Override keys with `"keybinds": { "stt.record": "ctrl+r", "tts.speak-last": "none" }`. + +## Options + +| Option | Default | Meaning | +| -------------------------------------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | +| `sttMode` | `"batch"` | `"streaming"` (live) or `"batch"` | +| `sttAutoSubmit` | `false` | Send the prompt right after dictation | +| `sttLanguage` | `"auto"` | `"auto"`, `"vi"`, `"en"` | +| `sttModel` | auto | Path to a ggml whisper model | +| `sttCaptureCmd` | — | Phone mic argv, must print raw s16le mono PCM (e.g. `["ssh", "-p", "8022", "u0_a368@localhost", "$HOME/bin/capture.sh", "16000"]`) | +| `sttEndpoint`, `sttApiModel`, `sttApiKeyEnv` | — | Optional OpenAI-compatible transcription API | +| `audioSampleRate` | `16000` | Capture rate | +| `ttsEngine` | `"vieneu"` | `"vieneu"` or `"piper"` | +| `ttsVieneuPython`, `ttsVieneuVoice` | venv path, `"Mai Anh"` | VieNeu sidecar | +| `ttsPlayCmd` | — | Phone speaker argv, reads raw PCM on stdin | +| `endpoint`, `model`, `apiKeyEnv` | session model | LLM for clean-up and Fix | +| `sttPrompt`, `ttsPrompt` | built-in | Override the system prompts (text) | + +## Privacy + +Audio stays on your machine unless you configure an API transcriber or a +phone. Only the transcript is sent to the LLM for clean-up (turn it off with +`/stt-normalize`). Stored OpenCode keys are only sent to their own provider. +The diagnostic log (`~/.cache/opencode-voice/voice.log`, mode 0600) never +contains transcript text. + +## Changes in 2.0 + +Rewritten in TypeScript around two small state machines (dictation, speech) +and one status line. Conversation mode, live notes, Kokoro, Chatterbox, +and Gipformer were removed (reading speed and ±5 s skip are back since 2.0.2). OpenCode v1 is no longer +supported. Existing settings carry over. ## License -This project is licensed under the [MIT License](LICENSE). +AGPL-3.0-or-later diff --git a/RELEASE_PROCESS.md b/RELEASE_PROCESS.md index 8b1a064..4909f96 100644 --- a/RELEASE_PROCESS.md +++ b/RELEASE_PROCESS.md @@ -1,104 +1,36 @@ -# Manual release process +# Release process -This document describes the step-by-step manual release process for opencode-voice using AI assistance to analyze commits, generate release notes, and trigger the GitHub Actions workflow via opencode (with `gh` CLI integration). - -## Overview - -1. **AI-driven commit analysis** - analyze commit history since last release -2. **AI-generated release notes** following strict formatting conventions -3. **Preview and review** - release notes shown before any actions taken -4. **Human review and approval** for quality control -5. **Workflow dispatch** - trigger GitHub Actions via `gh` CLI -6. **Automated publish** - existing workflow handles npm publish and GitHub Release creation - -## Prerequisites - -- [opencode](https://opencode.ai/) installed -- [GitHub CLI (`gh`)](https://cli.github.com) installed and authenticated (`gh auth login`) -- Understanding of conventional commit patterns -- Trusted publishing configured on npmjs.com (no token required) - -## AI-assisted release process - -Use this prompt in opencode to handle the entire release process: - -### Master release prompt - -``` -I need to create a new release for opencode-voice. Please: - -STEP 1: ANALYZE COMMITS -- Use `gh` CLI or available tools to get the latest release tag -- Fetch all commits between that tag and current HEAD -- Analyze each commit for user-facing changes -- Resolve the GitHub username for each externally authored user-facing change from its commit or merged PR - -STEP 2: GENERATE RELEASE NOTES -Create structured release notes with this EXACT format: - -### Breaking Changes -[Only if breaking changes exist - triggers major version] -- Description focusing on user impact (abc1234 [by @external-author]) - -### New Features -- Feature description emphasizing user benefit (abc1234 [by @external-author]) - -### Improvements -- Improvement description with user impact (abc1234 [by @external-author]) - -### Bug Fixes -- Fix description focusing on resolved user issue (abc1234 [by @external-author]) - -REQUIREMENTS: -- Focus ONLY on user-facing changes and impact -- EXCLUDE: docs, build, ci, chore, refactor, test commits -- Use active voice, present tense -- Include commit short hashes and format externally authored changes as `abc1234 by @username` (GitHub renders both as links) -- Closely related changes may be collapsed into one bullet; retain a separate `commit by @username` attribution for each external author -- Semver version logic (major.minor.patch): - - PATCH: bug fixes, docs, build/CI changes only - - MINOR: new features, improvements, backwards compatible - - MAJOR: breaking changes -- Do not add a separate Contributors section; credit external authors inline and omit the repository owner -- Show this preview BEFORE any actions - -STEP 3: SHOW PREVIEW -Display the generated release notes and ask for approval before proceeding. - -STEP 4: TRIGGER WORKFLOW (after approval) -Use `gh workflow run` to trigger the "Publish Release" workflow: - -gh workflow run release.yml \ - -f release_tag="v[VERSION]" \ - -f release_notes="[generated content]" \ - -f draft=false \ - -f prerelease=false - -Please start with Step 1 - analyze the commits and show me the preview. -``` +Tag-push releases, same pattern as our other plugins (`opencode-prompt-left`, +`opencode-herdr`). ## How it works -opencode will: +1. Run one of the release scripts (they check, test, bump, tag, and push): + ```bash + bun run release:patch # 0.7.0 -> 0.7.1 + bun run release:minor # 0.7.0 -> 0.8.0 + bun run release:major # 0.7.0 -> 1.0.0 + ``` + Each script runs `npm run check && npm test`, then `npm version ` + (creates the `vX.Y.Z` tag), then pushes `master` + the tag to `fork`. +2. Pushing a `v*.*.*` tag triggers `.github/workflows/npm-publish.yml`: + verify tag == `package.json` version, run `prepack` + `npm pack --dry-run`, + `npm publish --access public` (OIDC trusted publishing, no token), then + create the GitHub Release. +3. The workflow can also be dispatched manually from the Actions tab. -1. **Analyze commits** since last release via `gh` CLI -2. **Generate release notes** with proper formatting, categorization, and inline external-author shoutouts -3. **Show preview** and ask for approval -4. **Trigger GitHub Actions workflow** with the release notes -5. **Workflow** sets the package version, publishes to npm with provenance, and creates a GitHub Release - -## Features +## Prerequisites -- **Automatic filtering** of technical commits (docs, tests, CI, etc.) -- **User-focused** release notes with clear impact descriptions -- **Semver versioning** - patch for fixes, minor for features, major for breaking changes -- **Inline contributor recognition** - externally authored changes credit their authors -- **Preview before action** - human approval required -- **npm provenance** - published packages include provenance attestation +- npm trusted publisher wired once on npmjs.com: package + `@bojackduy/opencode-voice` ↔ repo `bojackduy/opencode-voice`, workflow + `npm-publish.yml`. +- The tag must exactly match `package.json` `version`, and that version must + not already exist on the registry, or the workflow fails fast. ## Troubleshooting -- **gh CLI issues**: Run `gh auth status` to verify authentication -- **Workflow dispatch failed**: Check repository permissions for workflow dispatch -- **npm publish failed**: Verify trusted publishing is configured on npmjs.com -- **Invalid release notes**: Review format requirements and regenerate +- `Git tag vX != package.json version`: you moved the tag by hand — delete it + and re-run the release script. +- `already published`: bump again; npm versions are immutable. +- `401/404 on publish`: trusted publisher mapping missing or mismatched — + re-check the npmjs.com setup. diff --git a/assets/demo.cast b/assets/demo.cast new file mode 100644 index 0000000..b9ac729 --- /dev/null +++ b/assets/demo.cast @@ -0,0 +1,121 @@ +{"version":3,"term":{"cols":120,"rows":36},"timestamp":1793343078,"command":"tmux attach -t ocdemo2-9829","env":{"SHELL":"/bin/zsh"}} +[0.014, "o", "\u001b[?1049h\u001b[22;0;0t\u001b[H\u001b[2J\u001b[?1h\u001b=\u001b[?12l\u001b[?25h\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[?1006l\u001b[?1005l\u001b[?2004h\u001b[?2031h\u001b[?996n\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[?1006l\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[1;1H\u001b[1;36r\u001b[c\u001b[>c\u001b[>q\u001b[?2026$p\u001b]10;?\u001b\\\u001b]11;?\u001b\\\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007\u001b[?12l\u001b[?25h\u001b[1 q\u001b[?1006l\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[?1006h\u001b[?1000h\u001b[?1002h\u001b[?1003h"] +[0.003, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[4;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244m\u001b[1mData migration failed\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178m› Open MCP servers\u001b[38;2;255;255;255m \u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[5;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[6;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244mSchema validation failed\u001b[38;2;255;255;255m\u001b[19X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[19C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255"] +[0.000, "o", ";255;255m\u001b[48;2;30;30;46m\u001b[7;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244mCaused by: [object Object]\u001b[38;2;255;255;255m\u001b[17X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[17C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[8;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[9;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[60X\u001b[38;2;205;214;244m\u001b[1m\u001b[60C ▄ \u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b(B\u001b[m\u001b[38;2;255;255;255m"] +[0.000, "o", "\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m▀▀▀\u001b[48;2;30;30;46m █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[38;2;59;61;79m▀▀\u001b[38;2;147;153;178m▀\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X"] +[0.000, "o", "\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178mAsk anything… \"Fix broken tests\"\u001b[38;2;255;255;255m\u001b[40X\u001b[48;2;30;30;46m\u001b[40C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;203;166;247mBuild\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mauto\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mBeam Free\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mOpenCode Go\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;249;226;175m\u001b[1mmax\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m\u001b[32X\u001b[48;2;30;30;46m\u001b[32C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C╹\u001b[38;2;46;46;60m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;147;153;178m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m[trinhchanduybojack@gmail.com] - 5h\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mshift+tab \u001b[38;2;147;153;178magents\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mctrl+p \u001b[38;2;147;153;178mcommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[24X\u001b[38;2;205;214;244m\u001b[24C100%\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b"] +[0.000, "o", "[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[38;2;243;139;168m⊙ \u001b[38;2;205;214;244m9 MCP failed\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;147;153;178m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[36;1H \u001b[K\u001b]112\u0007\u001b[39m\u001b[49m\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b(B\u001b[m \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m\u001b[1m  % │\u001b[38;2;166;218;149m 󰍛 │\u001b[38;2;36;39;58m\u001b[48;2;237;135;150m \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│bold]\u001b[7m 󰖪 off \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007\u001b[18t\u001b[14t\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[2 q\u001b[?1006l\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[1;1H\u001b[1;36r\u001b[20;27H\u001b[?12l\u001b[?25h\u001b[1 q\u001b[?1006l\u001b[?1000l\u001b[?1"] +[0.000, "o", "002l\u001b[?1003l\u001b[?1006h\u001b[?1000h\u001b[?1002h\u001b[?1003h"] +[0.001, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[4;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244m\u001b[1mData migration failed\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178m› Open MCP servers\u001b[38;2;255;255;255m \u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[5;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[6;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244mSchema validation failed\u001b[38;2;255;255;255m\u001b[19X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[19C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255"] +[0.000, "o", ";255;255m\u001b[48;2;30;30;46m\u001b[7;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244mCaused by: [object Object]\u001b[38;2;255;255;255m\u001b[17X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[17C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[8;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[9;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[60X\u001b[38;2;205;214;244m\u001b[1m\u001b[60C ▄ \u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b(B\u001b[m\u001b[38;2;255;255;255m"] +[0.000, "o", "\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m▀▀▀\u001b[48;2;30;30;46m █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[38;2;59;61;79m▀▀\u001b[38;2;147;153;178m▀\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X"] +[0.000, "o", "\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178mAsk anything… \"Fix broken tests\"\u001b[38;2;255;255;255m\u001b[40X\u001b[48;2;30;30;46m\u001b[40C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;203;166;247mBuild\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mauto\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mBeam Free\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mOpenCode Go\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;249;226;175m\u001b[1mmax\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m\u001b[32X\u001b[48;2;30;30;46m\u001b[32C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C╹\u001b[38;2;46;46;60m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;147;153;178m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m[trinhchanduybojack@gmail.com] - 5h\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mshift+tab \u001b[38;2;147;153;178magents\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mctrl+p \u001b[38;2;147;153;178mcommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[24X\u001b[38;2;205;214;244m\u001b[24C100%\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b"] +[0.000, "o", "[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[38;2;243;139;168m⊙ \u001b[38;2;205;214;244m9 MCP failed\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;147;153;178m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[36;1H \u001b[K\u001b]112\u0007\u001b[39m\u001b[49m\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b(B\u001b[m \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m\u001b[1m  % │\u001b[38;2;166;218;149m 󰍛 │\u001b[38;2;36;39;58m\u001b[48;2;237;135;150m \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│bold]\u001b[7m 󰖪 off \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.031, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b(B\u001b[m \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m\u001b[1m  % │\u001b[38;2;166;218;149m 󰍛 │\u001b[38;2;245;189;230m 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│bold]\u001b[7m 󰖪 off \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.051, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b(B\u001b[m \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m\u001b[1m  % │\u001b[38;2;166;218;149m 󰍛 │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│bold]\u001b[7m 󰖪 off \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.001, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[4;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244m\u001b[1mData migration failed\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178m› Open MCP servers\u001b[38;2;255;255;255m \u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[5;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[6;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244mSchema validation failed\u001b[38;2;255;255;255m\u001b[19X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[19C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255"] +[0.000, "o", ";255;255m\u001b[48;2;30;30;46m\u001b[7;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244mCaused by: [object Object]\u001b[38;2;255;255;255m\u001b[17X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[17C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[8;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[9;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[60X\u001b[38;2;205;214;244m\u001b[1m\u001b[60C ▄ \u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b(B\u001b[m\u001b[38;2;255;255;255m"] +[0.000, "o", "\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m▀▀▀\u001b[48;2;30;30;46m █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[38;2;59;61;79m▀▀\u001b[38;2;147;153;178m▀\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X"] +[0.000, "o", "\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178mAsk anything… \"Fix broken tests\"\u001b[38;2;255;255;255m\u001b[40X\u001b[48;2;30;30;46m\u001b[40C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;203;166;247mBuild\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mauto\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mBeam Free\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mOpenCode Go\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;249;226;175m\u001b[1mmax\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m\u001b[32X\u001b[48;2;30;30;46m\u001b[32C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C╹\u001b[38;2;46;46;60m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;147;153;178m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m[trinhchanduybojack@gmail.com] - 5h\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mshift+tab \u001b[38;2;147;153;178magents\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mctrl+p \u001b[38;2;147;153;178mcommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[24X\u001b[38;2;205;214;244m\u001b[24C100%\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b"] +[0.001, "o", "[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[38;2;243;139;168m⊙ \u001b[38;2;205;214;244m9 MCP failed\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;147;153;178m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[36;1H \u001b[K\u001b]112\u0007\u001b[39m\u001b[49m\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b(B\u001b[m \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m\u001b[1m  % │\u001b[38;2;166;218;149m 󰍛 │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│bold]\u001b[7m 󰖪 off \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.014, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[4;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244m\u001b[1mData migration failed\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178m› Open MCP servers\u001b[38;2;255;255;255m \u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[5;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[6;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244mSchema validation failed\u001b[38;2;255;255;255m\u001b[19X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[19C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255"] +[0.000, "o", ";255;255m\u001b[48;2;30;30;46m\u001b[7;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;205;214;244mCaused by: [object Object]\u001b[38;2;255;255;255m\u001b[17X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[17C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[8;1H \u001b[70X\u001b[38;2;243;139;168m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[44X\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[9;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[60X\u001b[38;2;205;214;244m\u001b[1m\u001b[60C ▄ \u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b(B\u001b[m\u001b[38;2;255;255;255m"] +[0.000, "o", "\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m▀▀▀\u001b[48;2;30;30;46m █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[38;2;59;61;79m▀▀\u001b[38;2;147;153;178m▀\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X"] +[0.000, "o", "\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178mAsk anything… \"Fix broken tests\"\u001b[38;2;255;255;255m\u001b[40X\u001b[48;2;30;30;46m\u001b[40C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;203;166;247mBuild\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mauto\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mBeam Free\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mOpenCode Go\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;249;226;175m\u001b[1mmax\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m\u001b[32X\u001b[48;2;30;30;46m\u001b[32C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C╹\u001b[38;2;46;46;60m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;147;153;178m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m[trinhchanduybojack@gmail.com] - 5h\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mshift+tab \u001b[38;2;147;153;178magents\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mctrl+p \u001b[38;2;147;153;178mcommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[24X\u001b[38;2;205;214;244m\u001b[24C100%\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b"] +[0.000, "o", "[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[38;2;243;139;168m⊙ \u001b[38;2;205;214;244m9 MCP failed\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;147;153;178m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m\r\n \u001b[38;2;166;227;161m✓\u001b[38;2;147;153;178m Server\u001b[38;2;255;255;255m \u001b[38;2;243;139;168m● UI\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTheme\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTools\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;147;153;178m\u001b[25CTime to first draw: 1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[20;27H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.217, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b(B\u001b[m \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m\u001b[1m  % │\u001b[38;2;166;218;149m 󰍛 │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.749, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b(B\u001b[m \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m\u001b[1m  % │\u001b[38;2;166;218;149m 󰍛 24.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.944, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m  81.9% │\u001b[38;2;166;218;149m 󰍛 24.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.050, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[44X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[4;1H \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100m\u001b[1mData\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100m\u001b[1mmigration\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100m\u001b[1mfailed\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73m›\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mOpen\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mMCP\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mservers\u001b[38;2;255;255;255m \u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[5;1H \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[44X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[6;1H \u001b[70X\u001b[3"] +[0.000, "o", "8;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100mSchema\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mvalidation\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mfailed\u001b[38;2;255;255;255m\u001b[19X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[19C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[7;1H \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100mCaused\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mby:\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[object\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mObject]\u001b[38;2;255;255;255m\u001b[17X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[17C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[8;1H \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[44X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[9;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38"] +[0.000, "o", ";2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;147;153;178mSearch commands\u001b[38;2;255;255;255m\u001b[34X\u001b[38;2;147;153;178m\u001b[34Cesc\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;147;153;178m\u001b[1mSuggested\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m\u001b[47X\u001b[48;2;12;12;19m\u001b[47C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C┃\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[38;2;205;214;244mSwitch session\u001b[38;2;255;255;255m\u001b[30X\u001b[38;2;138;148;164m\u001b[30Cctrl+x l\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSwitch model\u001b[38;2;255;255;255m\u001b[32X\u001b[38;2;147;153;178m\u001b[32Cctrl+x m\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;"] +[0.000, "o", "2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mOpen settings\u001b[38;2;255;255;255m\u001b[43X\u001b[48;2;12;12;19m\u001b[43C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[48;2;36;37;52m \u001b[38;2;147;153;178m\u001b[1mLLM Council\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m\u001b[45X\u001b[48;2;19;19;25m\u001b[45C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73mAsk\u001b[38;2;255;255;255m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mLLM Council: Change model\u001b[38;2;147;153;178m Pick the model used by all\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m "] +[0.000, "o", "\u001b[48;2;36;37;52m \u001b[59X\u001b[48;2;19;19;25m\u001b[59C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;68;102mBuil\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[38;2;147;153;178m\u001b[1mSession\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m\u001b[49X\u001b[48;2;19;19;25m\u001b[49C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C╹\u001b[38;2;19;19;25m▀▀▀▀▀▀\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSwitch session\u001b[38;2;255;255;255m\u001b[30X\u001b[38;2;147;153;178m\u001b[30Cctrl+x l\u001b[38;2;255;255;255m \u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trin\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[59X\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m\u001b[59Ccommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[24X\u001b[38;2;84;88;"] +[0.000, "o", "100m\u001b[24C100%\u001b[38;2;255;255;255m \u001b[48;2;36;37;52m \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[38;2;100;57;69m⊙\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m9\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mMCP\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mfailed\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;61;63;73m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m\r\n \u001b[38;2;68;93;66m✓\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mServer\u001b[38;2;255;255;"] +[0.000, "o", "255m \u001b[38;2;100;57;69m●\u001b[38;2;255;255;255m \u001b[38;2;100;57;69mUI\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTheme\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTools\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;61;63;73m\u001b[25CTime\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mto\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mfirst\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mdraw:\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[12;35H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.006, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[24;1H \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trin\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[38;2;147;153;178m…\u001b[38;2;255;255;255m\u001b[55X\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m\u001b[55Ccommands\u001b[38;2;255;255;255m\u001b[K\u001b[12;35H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.017, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m\u001b[36;1H \u001b[38;2;68;93;66m✓\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mServer\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m○\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mUI\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTheme\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTools\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;61;63;73m\u001b[25CTime\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mto\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mfirst\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mdraw:\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[12;35H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[1.932, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;205;214;244mvoice\u001b[38;2;255;255;255m\u001b[44X\u001b[38;2;147;153;178m\u001b[44Cesc\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[14;1H \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C┃\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[38;2;205;214;244mTTS: select voice\u001b[38;2;138;148;164m Choose TTS voice\u001b[38;2;255;255;255m \u001b[38;2;138;148;164mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice notes: status\u001b[38;2;147;153;178m Show live-notes r\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice notes: stop\u001b[38;2;147;153;178m Stop live notes, fl\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopenco"] +[0.000, "o", "de-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: select LLM\u001b[38;2;147;153;178m Choose the LLM for\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice notes: start\u001b[38;2;147;153;178m Start continuous l\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice notes: cancel\u001b[38;2;147;153;178m Stop capturing im\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;25"] +[0.000, "o", "5m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73mAsk\u001b[38;2;255;255;255m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: stop conversation\u001b[38;2;147;153;178m Exit voice c\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: clear LLM selection\u001b[38;2;147;153;178m Clear the\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;68;102mBuil\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: cancel everything\u001b[38;2;147;153;178m S\u001b[38;2;255;255"] +[0.000, "o", ";255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x .\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C╹\u001b[38;2;19;19;25m▀▀▀▀▀▀\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: conversation mode\u001b[38;2;147;153;178m T\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x v\u001b[38;2;255;255;255m \u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[12;40H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.983, "o", "\u001b[?1004h\u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[2 q\u001b[?1006l\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[1;1H\u001b[1;36r\u001b[12;40H\u001b[?12l\u001b[?25h\u001b[1 q\u001b[?1006l\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[?1006h\u001b[?1000h\u001b[?1002h\u001b[?1003h"] +[0.003, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[44X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[4;1H \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100m\u001b[1mData\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100m\u001b[1mmigration\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100m\u001b[1mfailed\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73m›\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mOpen\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mMCP\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mservers\u001b[38;2;255;255;255m \u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[5;1H \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[44X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[6;1H \u001b[70X\u001b[3"] +[0.000, "o", "8;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100mSchema\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mvalidation\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mfailed\u001b[38;2;255;255;255m\u001b[19X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[19C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[7;1H \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;88;100mCaused\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mby:\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[object\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mObject]\u001b[38;2;255;255;255m\u001b[17X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[17C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[8;1H \u001b[70X\u001b[38;2;100;57;69m\u001b[70C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[44X\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m\u001b[44C┃\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[9;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38"] +[0.000, "o", ";2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;205;214;244mvoice\u001b[38;2;255;255;255m\u001b[44X\u001b[38;2;147;153;178m\u001b[44Cesc\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C┃\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[38;2;205;214;244mTTS: select voice\u001b[38;2;138;148;164m Choose TTS voice\u001b[38;2;255;255;255m \u001b[38;2;138;148;164mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice notes: status\u001b[38;2;147;153;178m Show live-notes r\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice note"] +[0.000, "o", "s: stop\u001b[38;2;147;153;178m Stop live notes, fl\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: select LLM\u001b[38;2;147;153;178m Choose the LLM for\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice notes: start\u001b[38;2;147;153;178m Start continuous l\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice notes: cancel\u001b[38;2;147;153;178m Stop capturing im\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[3"] +[0.000, "o", "8;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73mAsk\u001b[38;2;255;255;255m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: stop conversation\u001b[38;2;147;153;178m Exit voice c\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: clear LLM selection\u001b[38;2;147;153;178m Clear the\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;68;102mBuil\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;25"] +[0.000, "o", "5;255;255m \u001b[38;2;205;214;244mVoice: cancel everything\u001b[38;2;147;153;178m S\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x .\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C╹\u001b[38;2;19;19;25m▀▀▀▀▀▀\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: conversation mode\u001b[38;2;147;153;178m T\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x v\u001b[38;2;255;255;255m \u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trin\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[38;2;147;153;178m…\u001b[38;2;255;255;255m\u001b[55X\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m\u001b[55Ccommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[24X\u001b[38;2;84;88;100m\u001b[24C100%\u001b[38;2;255;255;255m \u001b[48;2;36;37;52m \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b"] +[0.000, "o", "[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[38;2;100;57;69m⊙\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m9\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mMCP\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mfailed\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;61;63;73m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m\r\n \u001b[38;2;68;93;66m✓\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mServer\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m○\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mUI\u001b[38;2;255;255;"] +[0.000, "o", "255m \u001b[38;2;61;63;73mTheme\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTools\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;61;63;73m\u001b[25CTime\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mto\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mfirst\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mdraw:\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b]112\u0007\u001b[39m\u001b[49m\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m  81.9% │\u001b[38;2;166;218;149m 󰍛 24.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[12;40H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.085, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[3;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[12;40H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.976, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m  81.9% │\u001b[38;2;166;218;149m 󰍛 20.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[12;40H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.467, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[60X\u001b[38;2;205;214;244m\u001b[1m\u001b[60C ▄ \u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[4"] +[0.000, "o", "0X\u001b[38;2;147;153;178m\u001b[40C█\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m▀▀▀\u001b[48;2;30;30;46m █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[38;2;59;61;79m▀▀\u001b[38;2;147;153;178m▀\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m"] +[0.000, "o", "\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178mAsk anything… \"Fix broken tests\"\u001b[38;2;255;255;255m\u001b[40X\u001b[48;2;30;30;46m\u001b[40C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;203;166;247mBuild\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mauto\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mBeam Free\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mOpenCode Go\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;249;226;175m\u001b[1mmax\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m\u001b[32X\u001b[48;2;30;30;46m\u001b[32C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C╹\u001b[38;2;46;46;60m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;147;153;178m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m[trinhchanduybojack@gmail.com] - 5h\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mshift+tab \u001b[38;2;147;153;178magents\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mctrl+p \u001b[38;2;147;153;178mcommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[24X\u001b[38;2;205;214;244m\u001b[24C100%\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[38;2;243;139;168m"] +[0.000, "o", "⊙ \u001b[38;2;205;214;244m9 MCP failed\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;147;153;178m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m\r\n \u001b[38;2;166;227;161m✓\u001b[38;2;147;153;178m Server\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m○ UI\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTheme\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTools\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;147;153;178m\u001b[25CTime to first draw: 1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[20;27H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.474, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m  82.0% │\u001b[38;2;166;218;149m 󰍛 20.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[20;27H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.592, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;147;153;178mSearch commands\u001b[38;2;255;255;255m\u001b[34X\u001b[38;2;147;153;178m\u001b[34Cesc\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;147;153;178m\u001b[1mSuggested\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;36;37;5"] +[0.000, "o", "2m\u001b[47X\u001b[48;2;12;12;19m\u001b[47C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C┃\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[38;2;205;214;244mSwitch session\u001b[38;2;255;255;255m\u001b[30X\u001b[38;2;138;148;164m\u001b[30Cctrl+x l\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSwitch model\u001b[38;2;255;255;255m\u001b[32X\u001b[38;2;147;153;178m\u001b[32Cctrl+x m\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mOpen settings\u001b[38;2;255;255;255m\u001b[43X\u001b[48;2;12;12;19m\u001b[43C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[48;2;36;37;52m \u001b[38;2;147;153;178m\u001b[1mLLM Council\u001b(B\u001b["] +[0.000, "o", "m\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m\u001b[45X\u001b[48;2;19;19;25m\u001b[45C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73mAsk\u001b[38;2;255;255;255m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mLLM Council: Change model\u001b[38;2;147;153;178m Pick the model used by all\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[48;2;36;37;52m \u001b[59X\u001b[48;2;19;19;25m\u001b[59C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;68;102mBuil\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[38;2;147;153;178m\u001b[1mSession\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m\u001b[49X\u001b[48;2;19;19;25m\u001b[49C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C"] +[0.000, "o", "╹\u001b[38;2;19;19;25m▀▀▀▀▀▀\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSwitch session\u001b[38;2;255;255;255m\u001b[30X\u001b[38;2;147;153;178m\u001b[30Cctrl+x l\u001b[38;2;255;255;255m \u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trin\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[59X\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m\u001b[59Ccommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[24X\u001b[38;2;84;88;100m\u001b[24C100%\u001b[38;2;255;255;255m \u001b[48;2;36;37;52m \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b"] +[0.000, "o", "[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[38;2;100;57;69m⊙\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m9\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mMCP\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mfailed\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;61;63;73m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m\r\n \u001b[38;2;68;93;66m✓\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mServer\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m○\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mUI\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTheme\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTools\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;61;63;73m\u001b[25CTime\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mto\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mfirst\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mdraw:\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[12;35H\u001b[?12l\u001b"] +[0.000, "o", "[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.011, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[24;1H \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trin\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[38;2;147;153;178m…\u001b[38;2;255;255;255m\u001b[55X\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m\u001b[55Ccommands\u001b[38;2;255;255;255m\u001b[K\u001b[12;35H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[1.946, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;205;214;244mstt\u001b[38;2;255;255;255m\u001b[46X\u001b[38;2;147;153;178m\u001b[46Cesc\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[14;1H \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C┃\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[38;2;205;214;244mSTT: select model\u001b[38;2;138;148;164m Choose whisper mode\u001b[38;2;255;255;255m \u001b[38;2;138;148;164mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSTT: cancel recording\u001b[38;2;147;153;178m Cancel current\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSTT: select microphone\u001b[38;2;147;153;178m Choose audio i\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode"] +[0.001, "o", "-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSTT: submit recording\u001b[38;2;147;153;178m Stop recording,\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSTT: select language\u001b[38;2;147;153;178m Choose transcrip\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSTT: record/transcribe\u001b[38;2;147;153;178m Tog\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x [\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255"] +[0.000, "o", "m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73mAsk\u001b[38;2;255;255;255m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSTT: toggle auto-submit\u001b[38;2;147;153;178m Toggle submit\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSTT: select dictation mode\u001b[38;2;147;153;178m Choose one\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;68;102mBuil\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSTT: pause / resume streaming dictati\u001b[38;2;255;255;255m \u001b[3"] +[0.000, "o", "8;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C╹\u001b[38;2;19;19;25m▀▀▀▀▀▀\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice notes: start\u001b[38;2;147;153;178m Start continuous l\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[12;38H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.243, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m  83.5% │\u001b[38;2;166;218;149m 󰍛 20.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[12;38H\u001b]12;rgb:cd/d6/f4\u0007"] +[2.270, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[60X\u001b[38;2;205;214;244m\u001b[1m\u001b[60C ▄ \u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[4"] +[0.000, "o", "0X\u001b[38;2;147;153;178m\u001b[40C█\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m▀▀▀\u001b[48;2;30;30;46m █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[38;2;59;61;79m▀▀\u001b[38;2;147;153;178m▀\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m"] +[0.000, "o", "\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178mAsk anything… \"Fix broken tests\"\u001b[38;2;255;255;255m\u001b[40X\u001b[48;2;30;30;46m\u001b[40C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;203;166;247mBuild\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mauto\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mBeam Free\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mOpenCode Go\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;249;226;175m\u001b[1mmax\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m\u001b[32X\u001b[48;2;30;30;46m\u001b[32C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C╹\u001b[38;2;46;46;60m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;147;153;178m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m[trinhchanduybojack@gmail.com] - 5h\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mshift+tab \u001b[38;2;147;153;178magents\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mctrl+p \u001b[38;2;147;153;178mcommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[24X\u001b[38;2;205;214;244m\u001b[24C100%\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[38;2;243;139;168m"] +[0.000, "o", "⊙ \u001b[38;2;205;214;244m9 MCP failed\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;147;153;178m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m\r\n \u001b[38;2;166;227;161m✓\u001b[38;2;147;153;178m Server\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m○ UI\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTheme\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTools\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;147;153;178m\u001b[25CTime to first draw: 1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[20;27H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[1.040, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;147;153;178mSearch commands\u001b[38;2;255;255;255m\u001b[34X\u001b[38;2;147;153;178m\u001b[34Cesc\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;147;153;178m\u001b[1mSuggested\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;36;37;5"] +[0.000, "o", "2m\u001b[47X\u001b[48;2;12;12;19m\u001b[47C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C┃\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[38;2;205;214;244mSwitch session\u001b[38;2;255;255;255m\u001b[30X\u001b[38;2;138;148;164m\u001b[30Cctrl+x l\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSwitch model\u001b[38;2;255;255;255m\u001b[32X\u001b[38;2;147;153;178m\u001b[32Cctrl+x m\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mOpen settings\u001b[38;2;255;255;255m\u001b[43X\u001b[48;2;12;12;19m\u001b[43C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[48;2;36;37;52m \u001b[38;2;147;153;178m\u001b[1mLLM Council\u001b(B\u001b["] +[0.000, "o", "m\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m\u001b[45X\u001b[48;2;19;19;25m\u001b[45C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73mAsk\u001b[38;2;255;255;255m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mLLM Council: Change model\u001b[38;2;147;153;178m Pick the model used by all\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[48;2;36;37;52m \u001b[59X\u001b[48;2;19;19;25m\u001b[59C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;68;102mBuil\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[38;2;147;153;178m\u001b[1mSession\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m\u001b[49X\u001b[48;2;19;19;25m\u001b[49C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C"] +[0.000, "o", "╹\u001b[38;2;19;19;25m▀▀▀▀▀▀\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSwitch session\u001b[38;2;255;255;255m\u001b[30X\u001b[38;2;147;153;178m\u001b[30Cctrl+x l\u001b[38;2;255;255;255m \u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trin\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[59X\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m\u001b[59Ccommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[24X\u001b[38;2;84;88;100m\u001b[24C100%\u001b[38;2;255;255;255m \u001b[48;2;36;37;52m \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b"] +[0.000, "o", "[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[38;2;100;57;69m⊙\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m9\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mMCP\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mfailed\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;61;63;73m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m\r\n \u001b[38;2;68;93;66m✓\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mServer\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m○\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mUI\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTheme\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTools\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;61;63;73m\u001b[25CTime\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mto\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mfirst\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mdraw:\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[12;35H\u001b[?12l\u001b"] +[0.000, "o", "[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.008, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[24;1H \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trin\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[38;2;147;153;178m…\u001b[38;2;255;255;255m\u001b[55X\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m\u001b[55Ccommands\u001b[38;2;255;255;255m\u001b[K\u001b[12;35H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[1.969, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;205;214;244mtts\u001b[38;2;255;255;255m\u001b[46X\u001b[38;2;147;153;178m\u001b[46Cesc\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[14;1H \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C┃\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[38;2;205;214;244mTTS: toggle\u001b[38;2;138;148;164m Toggle auto text-to-speec\u001b[38;2;255;255;255m \u001b[38;2;138;148;164mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mTTS: select voice\u001b[38;2;147;153;178m Choose TTS voice\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mTTS: stop playback\u001b[38;2;147;153;178m Stop current TTS p\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode"] +[0.000, "o", "-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mTTS: playback speed\u001b[38;2;147;153;178m Choose playback s\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mTTS: select engine\u001b[38;2;147;153;178m Choose TTS engine\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mTTS: rewind 5 seconds\u001b[38;2;147;153;178m Jump\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x -\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255"] +[0.000, "o", "m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73mAsk\u001b[38;2;255;255;255m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mTTS: replay from start\u001b[38;2;147;153;178m Res\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x 0\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mTTS: forward 5 seconds\u001b[38;2;147;153;178m Jum\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x =\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;68;102mBuil\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mTTS: speak last response\u001b[38;2;147;153;178m R\u001b[38;2;255;25"] +[0.000, "o", "5;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x ]\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C╹\u001b[38;2;19;19;25m▀▀▀▀▀▀\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mTTS: pause / resume playba\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x p\u001b[38;2;255;255;255m \u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[12;38H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[1.923, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m  82.0% │\u001b[38;2;166;218;149m 󰍛 20.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[12;38H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.587, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[60X\u001b[38;2;205;214;244m\u001b[1m\u001b[60C ▄ \u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[4"] +[0.000, "o", "0X\u001b[38;2;147;153;178m\u001b[40C█\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m▀▀▀\u001b[48;2;30;30;46m █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[38;2;59;61;79m▀▀\u001b[38;2;147;153;178m▀\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m"] +[0.000, "o", "\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178mAsk anything… \"Fix broken tests\"\u001b[38;2;255;255;255m\u001b[40X\u001b[48;2;30;30;46m\u001b[40C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;203;166;247mBuild\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mauto\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mBeam Free\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mOpenCode Go\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;249;226;175m\u001b[1mmax\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m\u001b[32X\u001b[48;2;30;30;46m\u001b[32C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C╹\u001b[38;2;46;46;60m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;147;153;178m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m[trinhchanduybojack@gmail.com] - 5h\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mshift+tab \u001b[38;2;147;153;178magents\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mctrl+p \u001b[38;2;147;153;178mcommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[24X\u001b[38;2;205;214;244m\u001b[24C100%\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[38;2;243;139;168m"] +[0.000, "o", "⊙ \u001b[38;2;205;214;244m9 MCP failed\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;147;153;178m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m\r\n \u001b[38;2;166;227;161m✓\u001b[38;2;147;153;178m Server\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m○ UI\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTheme\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTools\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;147;153;178m\u001b[25CTime to first draw: 1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[20;27H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[1.035, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;147;153;178mSearch commands\u001b[38;2;255;255;255m\u001b[34X\u001b[38;2;147;153;178m\u001b[34Cesc\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;147;153;178m\u001b[1mSuggested\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;36;37;5"] +[0.000, "o", "2m\u001b[47X\u001b[48;2;12;12;19m\u001b[47C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C┃\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[38;2;205;214;244mSwitch session\u001b[38;2;255;255;255m\u001b[30X\u001b[38;2;138;148;164m\u001b[30Cctrl+x l\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSwitch model\u001b[38;2;255;255;255m\u001b[32X\u001b[38;2;147;153;178m\u001b[32Cctrl+x m\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mOpen settings\u001b[38;2;255;255;255m\u001b[43X\u001b[48;2;12;12;19m\u001b[43C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[48;2;36;37;52m \u001b[38;2;147;153;178m\u001b[1mLLM Council\u001b(B\u001b["] +[0.000, "o", "m\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m\u001b[45X\u001b[48;2;19;19;25m\u001b[45C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73mAsk\u001b[38;2;255;255;255m \u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mLLM Council: Change model\u001b[38;2;147;153;178m Pick the model used by all\u001b[38;2;255;255;255m \u001b[48;2;19;19;25m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[48;2;36;37;52m \u001b[59X\u001b[48;2;19;19;25m\u001b[59C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;68;102mBuil\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[38;2;147;153;178m\u001b[1mSession\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m\u001b[49X\u001b[48;2;19;19;25m\u001b[49C \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C"] +[0.000, "o", "╹\u001b[38;2;19;19;25m▀▀▀▀▀▀\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mSwitch session\u001b[38;2;255;255;255m\u001b[30X\u001b[38;2;147;153;178m\u001b[30Cctrl+x l\u001b[38;2;255;255;255m \u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trin\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[59X\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m\u001b[59Ccommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[24X\u001b[38;2;84;88;100m\u001b[24C100%\u001b[38;2;255;255;255m \u001b[48;2;36;37;52m \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b"] +[0.000, "o", "[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[38;2;100;57;69m⊙\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m9\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mMCP\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mfailed\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;61;63;73m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m\r\n \u001b[38;2;68;93;66m✓\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mServer\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m○\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mUI\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTheme\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mTools\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;61;63;73m\u001b[25CTime\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mto\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mfirst\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mdraw:\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[12;35H\u001b[?12l\u001b"] +[0.000, "o", "[?25h\u001b[1 q\u001b(B\u001b[m"] +[0.013, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[24;1H \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trin\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[38;2;147;153;178m…\u001b[38;2;255;255;255m\u001b[55X\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m\u001b[55Ccommands\u001b[38;2;255;255;255m\u001b[K\u001b[12;35H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[1.414, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m\u001b[1m \u001b[49m\u001b[38;2;166;218;149m 󰘧 \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m0% │\u001b[38;2;166;218;149m 󰍛 20.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│bold]\u001b[7m 󰖪 off \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[12;35H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.145, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m  82.0% │\u001b[38;2;166;218;149m 󰍛 20.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[12;35H\u001b]12;rgb:cd/d6/f4\u0007"] +[0.417, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;205;214;244mconversation\u001b[38;2;255;255;255m\u001b[37X\u001b[38;2;147;153;178m\u001b[37Cesc\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[14;1H \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C┃\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[38;2;205;214;244mVoice: stop conversation\u001b[38;2;138;148;164m Exit voice c\u001b[38;2;255;255;255m \u001b[38;2;138;148;164mopencode-voice\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mVoice: conversation mode\u001b[38;2;147;153;178m T\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mopencode-voice · ctrl+x v\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m\u001b[29C \u001b[38;2;255;255;255m \u001b[38;2;205;214;244mAsk a side question\u001b[38;2;147;153;178m One-shot answer from the\u001b[38;2;255;255;255m \u001b[38;2;147"] +[0.000, "o", ";153;178mSession\u001b[38;2;255;255;255m \u001b[48;2;12;12;19m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[29X\u001b[48;2;36;37;52m\u001b[29C \u001b[59X\u001b[48;2;12;12;19m\u001b[59C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\u001b[19;1H \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[73X\u001b[48;2;12;12;19m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;61;63;73mAsk\u001b[38;2;255;255;255m \u001b[38;2;61;63;73manything…\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m\"Fix\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mbroken\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mtests\"\u001b[38;2;255;255;255m\u001b[40X\u001b[48;2;12;12;19m\u001b[40C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[73X\u001b[48;2;12;12;19m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[38;2;84;68;102mBuild\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mauto\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m"] +[0.000, "o", "·\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mBeam\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mFree\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mOpenCode\u001b[38;2;255;255;255m \u001b[38;2;61;63;73mGo\u001b[38;2;255;255;255m \u001b[38;2;61;63;73m·\u001b[38;2;255;255;255m \u001b[38;2;103;93;72m\u001b[1mmax\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m\u001b[32X\u001b[48;2;12;12;19m\u001b[32C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;84;68;102m\u001b[22C╹\u001b[38;2;19;19;25m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[22X\u001b[38;2;61;63;73m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m[trinhchanduybojack@gmail.com]\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m-\u001b[38;2;255;255;255m \u001b[38;2;84;88;100m5h\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mshift+tab\u001b[38;2;255;255;255m \u001b[38;2;61;63;73magents\u001b[38;2;255;255;255m \u001b[38;2;84;88;100mctrl+p\u001b[38;2;255"] +[0.000, "o", ";255;255m \u001b[38;2;61;63;73mcommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[24X\u001b[38;2;84;88;100m\u001b[24C100%\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m\r\n \u001b[K\u001b[12;47H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[1.385, "o", "\u001b[?25l\u001b]112\u0007\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode.exe \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  opencode-voice \u001b[39m\u001b[49m \u001b[38;2;166;218;149m\u001b[1m 󰘧 \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m  81.9% │\u001b[38;2;166;218;149m 󰍛 20.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[1 q\u001b[12;47H\u001b]12;rgb:cd/d6/f4\u0007"] +[1.126, "o", "\u001b[?25l\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[2;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[60X\u001b[38;2;205;214;244m\u001b[1m\u001b[60C ▄ \u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[4"] +[0.000, "o", "0X\u001b[38;2;147;153;178m\u001b[40C█\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█ █\u001b[48;2;59;61;79m▀▀▀\u001b[48;2;30;30;46m █\u001b[48;2;59;61;79m \u001b[48;2;30;30;46m█\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m█\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m \u001b[48;2;30;30;46m█ █\u001b[48;2;74;76;96m▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[40X\u001b[38;2;147;153;178m\u001b[40C▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[38;2;59;61;79m▀▀\u001b[38;2;147;153;178m▀\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m"] +[0.000, "o", "\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;147;153;178mAsk anything… \"Fix broken tests\"\u001b[38;2;255;255;255m\u001b[40X\u001b[48;2;30;30;46m\u001b[40C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[73X\u001b[48;2;30;30;46m\u001b[73C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C┃\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[38;2;203;166;247mBuild\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mauto\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mBeam Free\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mOpenCode Go\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m·\u001b[38;2;255;255;255m \u001b[38;2;249;226;175m\u001b[1mmax\u001b(B\u001b[m\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m\u001b[32X\u001b[48;2;30;30;46m\u001b[32C \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;203;166;247m\u001b[22C╹\u001b[38;2;46;46;60m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[22X\u001b[38;2;147;153;178m\u001b[22C…\u001b[38;2;255;255;255m \u001b[38;2;205;214;244m[trinhchanduybojack@gmail.com] - 5h\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mshift+tab \u001b[38;2;147;153;178magents\u001b[38;2;255;255;255m \u001b[38;2;205;214;244mctrl+p \u001b[38;2;147;153;178mcommands\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[24X\u001b[38;2;205;214;244m\u001b[24C100%\u001b[38;2;255;255;255m\u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\r\n \u001b[38;2;243;139;168m"] +[0.000, "o", "⊙ \u001b[38;2;205;214;244m9 MCP failed\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m/mcps\u001b[38;2;255;255;255m\u001b[91X\u001b[38;2;147;153;178m\u001b[91C2.2.2\u001b[38;2;255;255;255m \u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m\u001b[35;1H \u001b[K\u001b[39m\u001b[49m\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m\r\n \u001b[38;2;166;227;161m✓\u001b[38;2;147;153;178m Server\u001b[38;2;255;255;255m \u001b[38;2;147;153;178m○ UI\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTheme\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mTools\u001b[38;2;255;255;255m \u001b[38;2;147;153;178mExperiments\u001b[38;2;255;255;255m\u001b[25X\u001b[38;2;147;153;178m\u001b[25CTime to first draw: 1121.68ms\u001b[38;2;255;255;255m\u001b[K\u001b[20;27H\u001b[?12l\u001b[?25h\u001b[1 q\u001b(B\u001b[m"] +[1.044, "o", "\u001b[?25l\u001b[?12l\u001b[?25h\u001b[1 q"] +[0.001, "o", "\u001b[?25l\u001b]112\u0007\u001b[2;1H\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\r\n\u001b[K\u001b[?12l\u001b[?25h\u001b[1 q\u001b[2d\u001b[?12l\u001b[?25h\u001b[2 q\u001b[?1006l\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[?1006h\u001b[?1000h\u001b[?1002h"] +[0.024, "o", "\u001b[?25l\u001b[38;2;166;218;149m\u001b[48;2;36;39;58m\u001b[H  ocdemo2-9829 \u001b[38;2;110;115;141m│\u001b[38;2;238;153;160m  opencode \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m  \u001b[39m\u001b[49m \u001b[23X\u001b[38;2;166;218;149m\u001b[1m\u001b[23C 󰰕 \u001b(B\u001b[m \u001b[38;2;138;173;244m\u001b[48;2;36;39;58m\u001b[1m  81.9% │\u001b[38;2;166;218;149m 󰍛 20.0% │\u001b[38;2;245;189;230m 󰚥 100% \u001b(B\u001b[m\u001b[38;2;110;115;141m\u001b[48;2;36;39;58m│\u001b[38;2;198;160;246m 󰖩 on \u001b[38;2;110;115;141m│\u001b[38;2;138;173;244m 󰭦 2026-10-30 󰅐 13:51 \u001b(B\u001b[m\u001b[?12l\u001b[?25h\u001b[2;1H"] +[0.005, "o", "\u001b[1;36r\u001b(B\u001b[m\u001b[?1l\u001b>\u001b[H\u001b[2J\u001b[?12l\u001b[?25h\u001b[?1000l\u001b[?1002l\u001b[?1003l\u001b[?1006l\u001b[?1005l\u001b[?2004l\u001b[?1004l\u001b[?1049l\u001b[23;0;0t\u001b[?2031l"] +[0.000, "o", "[exited]\r\n"] +[0.001, "x", "0"] diff --git a/assets/demo.gif b/assets/demo.gif new file mode 100644 index 0000000..85ff66a Binary files /dev/null and b/assets/demo.gif differ diff --git a/assets/demo.mp4 b/assets/demo.mp4 new file mode 100644 index 0000000..8af46bc Binary files /dev/null and b/assets/demo.mp4 differ diff --git a/assets/voice-demo-2.cast b/assets/voice-demo-2.cast new file mode 100644 index 0000000..ba6d0e5 --- /dev/null +++ b/assets/voice-demo-2.cast @@ -0,0 +1,525 @@ +{"version":3,"term":{"cols":144,"rows":43,"type":"xterm-256color","version":"libghostty","theme":{"fg":"#cdd6f4","bg":"#1e1e2e","palette":"#45475a:#f38ba8:#a6e3a1:#f9e2af:#89b4fa:#f5c2e7:#94e2d5:#bac2de:#585b70:#f38ba8:#a6e3a1:#f9e2af:#89b4fa:#f5c2e7:#94e2d5:#a6adc8"}},"timestamp":1793352238,"env":{"SHELL":"/bin/zsh"}} +[0.064, "o", "\u001b[1m\u001b[7m%\u001b[27m\u001b[1m\u001b[0m \r \r"] +[0.000, "o", "\u001b]0;duytrinh@Spartans-MB-Pro---KJV436CGP0: ~/Code/opencode-voice\u0007"] +[0.034, "o", "\r\u001b[0m\u001b[27m\u001b[24m\u001b[J\r\n\u001b[1m\u001b[33m(4)\u001b[39m\u001b[0m \u001b[1m\u001b[36m~/Code/opencode-voice\u001b[39m\u001b[0m on \u001b[1m\u001b[35mmaster\u001b[39m\u001b[0m\r\n\u001b[1m\u001b[32m$\u001b[39m\u001b[0m \u001b[K"] +[0.000, "o", "\u001b[?1h\u001b=\u001b[?2004h"] +[0.028, "o", "o"] +[0.007, "o", "\b\u001b[1m\u001b[31mo\u001b[0m\u001b[39m"] +[0.000, "o", "\b\u001b[1m\u001b[31mo\u001b[0m\u001b[39m\u001b[90mpencode\u001b[39m\b\b\b\b\b\b\b"] +[0.080, "o", "\b\u001b[1m\u001b[31mo\u001b[1m\u001b[31mp\u001b[0m\u001b[39m"] +[0.027, "o", "\b\b\u001b[1m\u001b[31mo\u001b[1m\u001b[31mp\u001b[1m\u001b[31me\u001b[0m\u001b[39m"] +[0.111, "o", "\b\u001b[1m\u001b[31me\u001b[1m\u001b[31mn\u001b[0m\u001b[39m"] +[0.001, "o", "\b\b\b\b\u001b[0m\u001b[32mo\u001b[0m\u001b[32mp\u001b[0m\u001b[32me\u001b[0m\u001b[32mn\u001b[39m"] +[0.071, "o", "\b\u001b[32mn\u001b[32mc\u001b[39m"] +[0.003, "o", "\b\b\b\b\b\u001b[1m\u001b[31mo\u001b[1m\u001b[31mp\u001b[1m\u001b[31me\u001b[1m\u001b[31mn\u001b[1m\u001b[31mc\u001b[0m\u001b[39m"] +[0.081, "o", "\b\u001b[1m\u001b[31mc\u001b[1m\u001b[31mo\u001b[0m\u001b[39m"] +[0.100, "o", "\b\u001b[1m\u001b[31mo\u001b[1m\u001b[31md\u001b[0m\u001b[39m"] +[0.095, "o", "\b\u001b[1m\u001b[31md\u001b[1m\u001b[31me\u001b[0m\u001b[39m\u001b[8D\u001b[0m\u001b[32mo\u001b[0m\u001b[32mp\u001b[0m\u001b[32me\u001b[0m\u001b[32mn\u001b[0m\u001b[32mc\u001b[0m\u001b[32mo\u001b[0m\u001b[32md\u001b[0m\u001b[32me\u001b[39m"] +[0.085, "o", "\u001b[?2004l\r\r\u001b[A\u001b[A\u001b[0m\u001b[27m\u001b[24m\u001b[J\u001b[33m$\u001b[39m \u001b[32mopencode\u001b[39m\u001b[K\r\r\n"] +[0.159, "o", "\u001b[?2031h\u001b]10;?\u0007\u001b]11;?\u0007\u001b[>0q\u001b[?25l\u001b[s\u001b[6n\u001bP+q4d73\u001b\\\u001b[?1016$p\u001b[?2027$p\u001b[?2031$p\u001b[?1004$p\u001b[?2004$p\u001b[?2026$p\u001b[?u\u001b]99;i=opentui-notifications:p=?;\u001b\\\u001b]1337;Capabilities\u001b\\\u001b]7501;?\u001b\\\u001b_Gi=31337,s=1,v=1,a=q,t=d,f=24;AAAA\u001b\\\u001b[c\u001b[H\u001b]66;w=1; \u001b\\\u001b[6n\u001b[H\u001b]66;s=2; \u001b\\\u001b[6n\u001b[u"] +[0.000, "o", "\u001b[s\u001b[?1049h"] +[0.000, "o", "\u001b[?25l\u001b[>4;1m\u001b[?2027h\u001b[?2004h\u001b[?1000h\u001b[?1002h\u001b[?1003h\u001b[?1006h"] +[0.002, "r", "145x43"] +[0.019, "o", "\u001b[14t"] +[0.002, "o", "\u001b[?2027h\u001b[?2004h"] +[0.034, "o", "\u001b]7501;state=idle:app=opencode\u001b\\\u001b[?2027h\u001b[?2004h\u001b[?2027h\u001b[?2004h\u001b[?2027h\u001b[?2004h\u001b[?2027h\u001b[?2004h\u001b[?2027h\u001b[?2004h\u001b[?2027h\u001b[?2004h\u001b[?1004h\u001b[?2027h\u001b[?2004h\u001b[?1004h\u001b[?2027h\u001b[?2004h\u001b[?1004h\u001b[>4;0m\u001b[>5u\u001b[?2027h\u001b[?2004h\u001b[?1004h\u001b[?2027h\u001b[?2004h\u001b[?1004h\u001b[?2027h\u001b[?2004h\u001b[?1004h\u001b[?2027h\u001b[?2004h\u001b[?1004h\u001b[?2027h\u001b[?2004h\u001b[?1004h\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[4;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[12;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.001, "o", " \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[34;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b]22;default\u001b\\\u001b[?2026l"] +[0.006, "o", "\u001b]0;OpenCode\u0007"] +[0.004, "o", "\u001b[?2026h\u001b[?25l\u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;2H\u001b[38;2;166;227;161m\u001b[48;2;34;34;50m✓\u001b[0m\u001b[43;3H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m Server\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;12H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m○ UI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;18H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;25H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;32H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;80H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTime to first draw: 210.27ms\u001b[0m\u001b[43;108H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[?2026l"] +[0.116, "o", "\u001b[14t"] +[0.002, "o", "\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[4;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[12;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[34;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;2H\u001b[38;2;166;227;161m\u001b[48;2;34;34;50m✓\u001b[0m\u001b[43;3H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m Server\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;12H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m○ UI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;18H\u001b[38;2;147;153;178m\u001b[48;2"] +[0.000, "o", ";34;34;50mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;25H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;32H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;81H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTime to first draw: 210.27ms\u001b[0m\u001b[43;109H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[?2026l"] +[0.382, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[42;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠋\u001b[0m\u001b[42;66H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[42;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mLoading plugins…\u001b[0m\u001b[42;83H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[0m\u001b[?2026l"] +[0.462, "o", "\u001b[?2026h\u001b[?25l\u001b[42;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠴\u001b[0m\u001b[0m\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[2;92H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;93H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[2;143H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;92H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;93H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;95H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mlearn TUI ready — beautiful quiz + question\u001b[0m\u001b[3;138H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;140H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mx\u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;143H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;92H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;93H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[4;143H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[42;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠦\u001b[0m\u001b[0m\u001b[?2026l"] +[0.344, "o", "\u001b[?2026h\u001b[?25l\u001b[2;84H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;85H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[2;143H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;84H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;85H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;87H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mVoice v2 compat: ev\u001b[0m\u001b[3;107H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mnt \"question.asked\" remapped to\u001b[0m\u001b[3;143H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;84H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;85H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[4;87H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mv2 \"form.created\" | event \"question.asked\" has no \u001b[0m\u001b[4;143H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[5;84H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[5;85H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[5;87H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mv2 equivalent; best-effort mapping to \"form.\u001b[0m\u001b[5;131H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[5;143H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[6;84H\u001b[38;2;249;226;175m\u001b["] +[0.001, "o", "48;2;30;30;46m┃\u001b[0m\u001b[6;85H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[6;87H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mcreated\" (may over-trigger with multiple sessions)\u001b[0m\u001b[6;137H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[6;143H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[7;84H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[7;85H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[7;143H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[15;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m ▄ \u001b[0m\u001b[16;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[0m\u001b[16;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b[0m\u001b[17;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[17;55H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[17;57H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█ █\u001b[0m\u001b[17;60H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[17;62H\u001b[38;"] +[0.001, "o", "2;147;153;178m\u001b[48;2;30;30;46m█ █\u001b[0m\u001b[17;65H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m▀▀▀\u001b[0m\u001b[17;68H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m █\u001b[0m\u001b[17;70H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[17;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[17;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[17;75H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[17;78H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m █\u001b[0m\u001b[17;80H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[17;82H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█ █\u001b[0m\u001b[17;85H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[17;87H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█ █\u001b[0m\u001b[17;90H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m▀▀▀\u001b[0m\u001b[18;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[0m\u001b[18;70H\u001b[38;2;59;61;79m\u001b[48;2;30;30;46m▀▀\u001b[0m\u001b[18;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀\u001b[0m\u001b[18;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b[0m\u001b[21;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m"] +[0.002, "o", "┃\u001b[0m\u001b[21;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[22;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[22;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[22;39H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mAsk anything… \"Fix a TODO in the codebase\"\u001b[0m\u001b[22;81H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[23;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[25;37H\u001b[38;2;46;46;60m\u001b[48;2;30;30;46m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.002, "o", "▀▀▀▀\u001b[0m\u001b[26;36H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m~/Code...:master\u001b[0m\u001b[26;54H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[\u001b[0m\u001b[26;78H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mshift+tab \u001b[0m\u001b[26;88H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46magents\u001b[0m\u001b[26;96H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mctrl+p \u001b[0m\u001b[26;103H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mcommands\u001b[0m\u001b[27;54H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mtrinhchanduybojack@gma\u001b[0m\u001b[28;54H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mil.com] - 5h 100%\u001b[0m\u001b[41;139H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m2.2.2\u001b[0m\u001b[42;63H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠋\u001b[0m\u001b[42;65H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[42;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mFinishing startup…\u001b[0m\u001b[42;84H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[0m\u001b]12;#cdd6f4\u0007\u001b[1 q\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.033, "o", "\u001b[?2026h\u001b[?25l\u001b[15;54H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;74H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;59H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;64H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;69H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m \u001b[0m\u001b[16;79H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m \u001b[0m\u001b[16;84H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m ▄\u001b[0m\u001b[16;89H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m \u001b[0m\u001b[17;55H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀\u001b[0m\u001b[17;60H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀\u001b[0m\u001b[17;65H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀█\u001b[0m\u001b[17;70H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀▄\u001b[0m\u001b[17;75H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀\u001b[0m\u001b[17;80H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀\u001b[0m\u001b[17;85H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀\u001b[0m\u001b[17;90H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀█\u001b[0m"] +[0.000, "o", "\u001b[18;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;55H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[18;57H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;60H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[18;62H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;64H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;65H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m▀▀▀\u001b[0m\u001b[18;69H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;70H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[18;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;75H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[18;79H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;80H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[18;82H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;84H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;85H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[18;87H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;89H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;90H\u001b[38;2;205;214;244m\u001b[48;2;74;"] +[0.000, "o", "76;96m\u001b[1m▀▀▀\u001b[0m\u001b[19;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[0m\u001b[19;70H\u001b[38;2;59;61;79m\u001b[48;2;30;30;46m▀▀\u001b[0m\u001b[19;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀\u001b[0m\u001b[19;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b[0m\u001b[21;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[22;39H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[23;39H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mAsk anything… \"Fix a TODO in the codebase\"\u001b[0m\u001b[25;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[26;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[26;37H\u001b[38;2;46;46;60m\u001b[48;2;30;30;46m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[27;36H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m…/op...oic…\u001b[0m\u001b[27;49H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.\u001b[0m\u001b[27;75H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;78H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mshift+tab \u001b[0m\u001b[27;88H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46magents\u001b[0m\u001b[27;96H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mctrl+p \u001b[0m\u001b[27;103H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mcommands\u001b[0m\u001b[28;49H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mcom] - 5h 100%\u001b[0m\u001b[28;63H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.019, "o", "\u001b[?2026h\u001b[?25l\u001b[2;84H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;84H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;92H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;94H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60m\u001b[1mMCP server failed: postgres\u001b[0m\u001b[3;121H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;123H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m› Open MCP servers\u001b[0m\u001b[3;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;84H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;92H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[4;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[5;84H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[5;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[5;92H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[5;94H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mRun /mcps to view det\u001b[0m\u001b[5;1"] +[0.000, "o", "16H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mils.\u001b[0m\u001b[5;120H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[5;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[6;84H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[6;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[6;92H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[6;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[7;84H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;38H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m..\u001b[0m\u001b[27;41H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mde…\u001b[0m\u001b[27;44H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;46H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com]\u001b[0m\u001b[28;46H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m- 5h 100%\u001b[0m\u001b[28;55H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;3H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m⊙ \u001b[0m\u001b[41;5H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m1 MCP failed\u001b[0m\u001b[41;18H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m/mcps\u001b[0m\u001b[42;64H\u001b[38;2;147;153;"] +[0.000, "o", "178m\u001b[48;2;36;37;52m⠙\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;53;53;73m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;53;53;73m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;53;53;73m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;53;53;73m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;50;49;65m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;49;49;63m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;49;49;63m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;50;51;65m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;49;49;63m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;53;53;73m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[27;37H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m.\u001b[0m\u001b[27;40H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mc…\u001b[0m\u001b[27;42H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;44H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhc\u001b[0m\u001b[27;52H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46manduybojack@gmail.com] -\u001b[0m\u001b[28;44H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m5h 100%\u001b[0m\u001b[28;51H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;66;63;88m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;66;63;88m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;66;63;88m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;66;63;88m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;63;59;81m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;57;58;73m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;57;58;73m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;63;64;80m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;57;58;73m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;66;63;88m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[27;40H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m…\u001b[0m\u001b[27;41H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;43H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - \u001b[0m\u001b[28;43H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m5h 10\u001b[0m\u001b[28;49H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m%\u001b[0m\u001b[28;50H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.020, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;84;77;109m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;84;77;109m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;84;77;109m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;84;77;109m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;82;73;103m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;69;70;87m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;69;70;87m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;82;84;102m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;69;70;87m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;84;77;109m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[27;36H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m.\u001b[0m\u001b[27;39H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m…\u001b[0m\u001b[27;40H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;42H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - \u001b[0m\u001b[27;75H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[28;42H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m5h 10\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m%\u001b[0m\u001b[28;49H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.018, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;110;96;139m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;110;96;139m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;110;96;139m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;110;96;139m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;108;94;134m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;86;88;107m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;86;88;107m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;109;113;133m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;86;88;107m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;110;96;139m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[27;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;41H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - 5h\u001b[0m\u001b[28;41H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m100%\u001b[0m\u001b[28;45H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠹\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;134;114;167m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;134;114;167m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;134;114;167m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;134;114;167m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;133;113;164m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;102;106;126m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;102;105;125m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;134;139;162m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;102;105;125m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;134;114;167m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[27;36H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m…/…\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;157;132;194m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;157;132;194m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;157;132;194m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;157;132;194m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;157;131;192m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;117;122;143m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;117;122;143m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;158;165;190m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;117;122;143m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;157;132;194m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.018, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;177;147;217m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;177;147;217m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;177;147;217m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;177;147;217m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;177;146;215m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;130;135;158m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;130;135;158m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;178;186;213m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;130;135;158m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;177;147;217m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;193;158;235m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;193;158;235m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;193;158;235m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;193;158;235m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;193;158;235m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;140;146;170m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;140;146;170m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;194;203;232m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;140;146;170m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;193;158;235m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠸\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;202;165;245m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;202;165;245m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;202;165;245m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;202;165;245m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;202;165;246m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;146;152;177m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;146;152;177m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;204;213;243m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;146;152;177m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;202;165;245m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.018, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;45H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;50H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;52H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[25;63H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mGemini Web (browser tool bridge)\u001b[0m\u001b[26;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.043, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠼\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.083, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠴\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.078, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠦\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.079, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠧\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.083, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠇\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.042, "o", "\u001b[?2026h\u001b[?25l\u001b[43;12H\u001b[38;2;243;139;168m\u001b[48;2;34;34;50m● UI\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.050, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠏\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.064, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠋\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.081, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠙\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.080, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠹\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.080, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠸\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.081, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠼\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.079, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠴\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.079, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠦\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.081, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠧\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.081, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠇\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.081, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠏\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.078, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠋\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.070, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;52H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mGemini Web\u001b[0m\u001b[26;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m⠙\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.203, "o", "\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[2;91H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[2;92H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[2;143H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[2;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[3;91H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[3;92H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[3;94H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25m\u001b[1mMCP\u001b[0m\u001b[3;97H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[3;98H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25m\u001b[1mserver\u001b[0m\u001b[3;104H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[3;105H\u001b[38;2;84;88;1"] +[0.000, "o", "00m\u001b[48;2;19;19;25m\u001b[1mfailed:\u001b[0m\u001b[3;112H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[3;113H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25m\u001b[1mpostgres\u001b[0m\u001b[3;121H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[3;123H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25m›\u001b[0m\u001b[3;124H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[3;125H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mOpen\u001b[0m\u001b[3;129H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[3;130H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mMCP\u001b[0m\u001b[3;133H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[3;134H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mservers\u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[3;143H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[3;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[4;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[4;91H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[4;92H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[4;143H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[4;144H\u001b[38;2;255;255;255m\u001b[4"] +[0.000, "o", "8;2;12;12;19m \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[5;91H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[5;92H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[5;94H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mRun\u001b[0m\u001b[5;97H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[5;98H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25m/mcps\u001b[0m\u001b[5;103H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[5;104H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mto\u001b[0m\u001b[5;106H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[5;107H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mview\u001b[0m\u001b[5;111H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[5;112H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mdetails.\u001b[0m\u001b[5;120H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[5;143H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[5;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;91H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b["] +[0.000, "o", "0m\u001b[6;92H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[6;143H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[6;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[12;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[12;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[12;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSearch models\u001b[0m\u001b[13;61H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;97H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mesc\u001b[0m\u001b[13;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[14;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m "] +[0.000, "o", " \u001b[0m\u001b[14;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mFavorites\u001b[0m\u001b[15;57H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mDeepSeek Web\u001b[0m\u001b[16;60H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m DeepSeek Web (HTTP+SSE)\u001b[0m\u001b[16;84H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;99H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m*\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mGPT-6.1 Sol\u001b[0m\u001b[17;59H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenAI\u001b[0m\u001b[17;66H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;99H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m*\u001b[0m\u001b[17;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;46H\u001b[38;2;137;180;250m\u001b[48;2;52;57;72m▪\u001b[0m\u001b[18;47H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mGemini Web\u001b[0m\u001b[18;58H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Gemini Web (browser tool bridge)\u001b[0m\u001b[18;"] +[0.000, "o", "91H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;99H\u001b[38;2;137;180;250m\u001b[48;2;52;57;72m*\u001b[0m\u001b[18;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[19;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mChatGPT Web\u001b[0m\u001b[19;59H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m ChatGPT Web (browser tool bridge)\u001b[0m\u001b[19;93H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;99H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m*\u001b[0m\u001b[19;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[20;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36"] +[0.000, "o", ";37;52mMuse Spark 1.3 Contributor\u001b[0m\u001b[20;74H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenCode Go\u001b[0m\u001b[20;86H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;99H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m*\u001b[0m\u001b[20;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[21;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mAuto\u001b[0m\u001b[21;52H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m GitHub Copilot\u001b[0m\u001b[21;67H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;99H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m*\u001b[0m\u001b[21;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[22;36H\u001b[38;2;84;68;102m\u001b[48;2;12;1"] +[0.000, "o", "2;19m┃\u001b[0m\u001b[22;37H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[22;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;104H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[22;111H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[23;36H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[23;37H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[23;39H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mAsk\u001b[0m\u001b[23;42H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[23;43H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25ma\u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mRecent\u001b[0m\u001b[23;54H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;104H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[23;111H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[24;36H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[24;37H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[24;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBeam Free\u001b[0m\u001b[24;57H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenCode Go\u001b[0m\u001b[24;69H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;104H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[24;111H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[25;36H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[25;37H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;39H\u001b[38;2;84;68;102m\u001b[48;2;19;19;25mBuild\u001b[0m\u001b[25;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mDeepSeek V4.1 Flash Free\u001b[0m\u001b[25;72H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Default / OpenCode\u001b[0m\u001b[25;91H\u001b"] +[0.000, "o", "[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;104H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;111H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[26;36H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m╹\u001b[0m\u001b[26;37H\u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀\u001b[0m\u001b[26;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mMuse Spark 1.2 Contributor\u001b[0m\u001b[26;74H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenCode Go\u001b[0m\u001b[26;86H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;104H\u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀\u001b[0m\u001b[26;111H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;36H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m…/…\u001b[0m\u001b[27;39H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;41H\u001b[38;2;84;88;100"] +[0.000, "o", "m\u001b[48;2;12;12;19m[tr\u001b[0m\u001b[27;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mIceman Contributor Free\u001b[0m\u001b[27;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenCode Go\u001b[0m\u001b[27;83H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;104H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mommands\u001b[0m\u001b[27;111H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[28;41H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m100\u001b[0m\u001b[28;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mDeepSeek V4.1 Flash\u001b[0m\u001b[28;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenCode Go\u001b[0m\u001b[28;79H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[29;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[29;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[30;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[31;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mText\u001b[0m\u001b[31;96H\u001b[38;2;96;97;110m\u001b[48;2;36;37;52m · \u001b[0m\u001b[31;99H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m0\u001b[0m\u001b[31;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[31;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[32;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[32;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[33;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[33;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[34;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[34;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[34;48H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mconnect integration\u001b[0m\u001b[34;67H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m ctrl+a\u001b[0m\u001b[34;74H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[34;83H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60munfavorite\u001b[0m\u001b[34;93H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m ctrl+f\u001b[0m\u001b[34;100H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[34;104H\u001b[38;2;255;255;255m\u001b["] +[0.001, "o", "48;2;12;12;19m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[35;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[35;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;3H\u001b[38;2;100;57;69m\u001b[48;2;12;12;19m⊙\u001b[0m\u001b[41;4H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;5H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m1\u001b[0m\u001b[41;6H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;7H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mMCP\u001b[0m\u001b[41;10H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;11H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mfailed\u001b[0m\u001b[41;17H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;18H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m/mcps\u001b[0m\u001b[41;23H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;139H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m2.2.2\u001b[0m\u001b[41;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;"] +[0.000, "o", "19m \u001b[0m\u001b[42;63H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[42;64H\u001b[38;2;61;63;73m\u001b[48;2;15;15;21m⠸\u001b[0m\u001b[42;65H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[42;66H\u001b[38;2;61;63;73m\u001b[48;2;15;15;21mFinishing\u001b[0m\u001b[42;75H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[42;76H\u001b[38;2;61;63;73m\u001b[48;2;15;15;21mstartup…\u001b[0m\u001b[42;84H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[42;85H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;2H\u001b[38;2;68;93;66m\u001b[48;2;14;14;21m✓\u001b[0m\u001b[43;3H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;4H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mServer\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;12H\u001b[38;2;100;57;69m\u001b[48;2;14;14;21m●\u001b[0m\u001b[43;13H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;14H\u001b[38;2;100;57;69m\u001b[48;2;14;14;21mUI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;18H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255"] +[0.000, "o", "m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;25H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;32H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;81H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTime\u001b[0m\u001b[43;85H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;86H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mto\u001b[0m\u001b[43;88H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;89H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mfirst\u001b[0m\u001b[43;94H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;95H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mdraw:\u001b[0m\u001b[43;100H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;101H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21m210.27ms\u001b[0m\u001b[43;109H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.004, "o", "\u001b[?2026h\u001b[?25l\u001b[29;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m…\u001b[0m\u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.044, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;61;63;73m\u001b[48;2;15;15;21m⠼\u001b[0m\u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.065, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;61;63;73m\u001b[48;2;15;15;21m⠴\u001b[0m\u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.079, "o", "\u001b[?2026h\u001b[?25l\u001b[42;64H\u001b[38;2;61;63;73m\u001b[48;2;15;15;21m⠦\u001b[0m\u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.091, "o", "\u001b[?2026h\u001b[?25l\u001b[13;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mb\u001b[0m\u001b[13;49H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[15;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;46H\u001b[38;2;137;180;250m\u001b[48;2;52;57;72m▪\u001b[0m\u001b[15;47H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mGemini Web\u001b[0m\u001b[15;58H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Gemini Web (browser tool bridge)\u001b[0m\u001b[15;91H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;99H\u001b[38;2;137;180;250m\u001b[48;2;52;57;72m*\u001b[0m\u001b[15;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mChatGPT Web\u001b[0m\u001b[16;59H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m ChatGPT Web (browser tool bridge)\u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mAuto\u001b[0m\u001b[17;52H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m GitHub\u001b[0m\u001b[17;60H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mCopilot\u001b[0m\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;48H\u001b[38;2;205;"] +[0.001, "o", "214;244m\u001b[48;2;36;37;52mDeepSeek Web\u001b[0m\u001b[18;60H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m DeepSeek Web (HTTP+SSE)\u001b[0m\u001b[18;84H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;99H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m*\u001b[0m\u001b[18;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mMuse Spark 1.3 Contributor\u001b[0m\u001b[19;74H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenCode Go\u001b[0m\u001b[19;86H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBeam\u001b[0m\u001b[20;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mFree\u001b[0m\u001b[20;57H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenCode Go\u001b[0m\u001b[20;69H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;99H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBeam Free\u001b[0m\u001b[21;57H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Default / OpenCode\u001b[0m\u001b[21;99H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBig Pickle\u001b[0m\u001b[22;58H\u001b[38;2;14"] +[0.000, "o", "7;153;178m\u001b[48;2;36;37;52m Default / OpenCode\u001b[0m\u001b[23;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBody Builder (beta)\u001b[0m\u001b[23;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenRouter\u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mFlint 40B Free\u001b[0m\u001b[24;62H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Default / OpenCode\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mGPT OSS 20B\u001b[0m\u001b[25;59H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Nvidia\u001b[0m\u001b[25;66H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mGemma-4-31B-IT\u001b[0m\u001b[26;62H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Nvidia\u001b[0m\u001b[26;69H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mGem\u001b[0m\u001b[27;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m 4 31B IT\u001b[0m\u001b[27;62H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Google\u001b[0m\u001b[27;69H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mLFM2.5-2.6B (free)\u001b[0m\u001b[28;66H\u001b[38;2;147;153;178m"] +[0.000, "o", "\u001b[48;2;36;37;52m OpenRout\u001b[0m\u001b[28;76H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mr\u001b[0m\u001b[28;77H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[42;64H\u001b[38;2;61;63;73m\u001b[48;2;15;15;21m⠧\u001b[0m\u001b[0m\u001b[13;49H\u001b[?25h\u001b[?2026l"] +[0.033, "o", "\u001b[?2026h\u001b[?25l\u001b[42;63H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[0m\u001b[13;49H\u001b[?25h\u001b[?2026l"] +[0.061, "o", "\u001b[?2026h\u001b[?25l\u001b[13;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52me\u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mDeepSeek Web\u001b[0m\u001b[17;60H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m DeepSeek Web (HTTP+SSE)\u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mB\u001b[0m\u001b[18;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mam Free\u001b[0m\u001b[18;57H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenCode Go\u001b[0m\u001b[18;69H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;99H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBeam\u001b[0m\u001b[19;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mFree\u001b[0m\u001b[19;57H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Default / OpenCode\u001b[0m\u001b[19;76H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;99H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mody\u001b[0m\u001b[20;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBuilder (beta)\u001b[0m\u001b[20;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenRouter\u001b[0m\u001b[21;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mig Pickle\u001b[0m\u001b[21;58H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Default / OpenCode\u001b"] +[0.001, "o", "[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mFlint 40B Free\u001b[0m\u001b[22;62H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Default / OpenCode\u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mGemma 4 31B (fr\u001b[0m\u001b[23;64H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52me)\u001b[0m\u001b[23;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenRouter\u001b[0m\u001b[23;77H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mLFM2.5-2.6B (free)\u001b[0m\u001b[24;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenRout\u001b[0m\u001b[24;76H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mr\u001b[0m\u001b[24;77H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mXing4.0\u001b[0m\u001b[25;57H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m9\u001b[0m\u001b[25;59H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m A4B (free)\u001b[0m\u001b[25;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenRouter\u001b[0m\u001b[26;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m 26\u001b[0m\u001b[26;59H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m A4B (free)\u001b[0m\u001b[26;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenRouter\u001b[0m\u001b[27;48H\u001b[38;2;205;214;2"] +[0.000, "o", "44m\u001b[48;2;36;37;52mIce\u001b[0m\u001b[27;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mn Contributor Free\u001b[0m\u001b[27;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenCode Go\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBeam 1.0 501B A23B\u001b[0m\u001b[0m\u001b[13;50H\u001b[?25h\u001b[?2026l"] +[0.141, "o", "\u001b[?2026h\u001b[?25l\u001b[13;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ma\u001b[0m\u001b[15;46H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mB\u001b[0m\u001b[15;50H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mam Fre\u001b[0m\u001b[15;57H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Op\u001b[0m\u001b[15;61H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mnCode Go\u001b[0m\u001b[15;69H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;99H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBe\u001b[0m\u001b[16;51H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mm Free\u001b[0m\u001b[16;57H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Default /\u001b[0m\u001b[16;68H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode\u001b[0m\u001b[16;76H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;99H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBody Build\u001b[0m\u001b[17;59H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mr (beta)\u001b[0m\u001b[17;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenRouter\u001b[0m\u001b[17;78H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;99H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52"] +[0.000, "o", "m \u001b[0m\u001b[18;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m1.0 501B A23B\u001b[0m\u001b[18;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenRouter\u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mDaybreak Red\u001b[0m\u001b[19;60H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenAI\u001b[0m\u001b[19;67H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mDaybreak Blue\u001b[0m\u001b[20;61H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenAI\u001b[0m\u001b[20;68H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mClaude Fable Latest\u001b[0m\u001b[21;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenRout\u001b[0m\u001b[21;77H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mr\u001b[0m\u001b[22;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mFree\u001b[0m\u001b[23;52H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;79H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mText\u001b[0m\u001b[23;83H\u001b[38;2;96;97;110m\u001b[48;2;36;37;52m"] +[0.000, "o", " · \u001b[0m\u001b[23;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m1M\u001b[0m\u001b[23;88H\u001b[38;2;96;97;110m\u001b[48;2;36;37;52m · \u001b[0m\u001b[23;91H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mReasoning\u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[26;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mconnect integration\u001b[0m\u001b[26;67H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m ctrl+a\u001b[0m\u001b[26;74H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[26;85H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mfavorite\u001b[0m\u001b[26;93H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m ctrl+f\u001b[0m\u001b[26;100H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[27;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[28;44H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m%\u001b[0m\u001b[28;45H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.003, "o", " \u001b[0m\u001b[29;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[32;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[33;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[34;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[35;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[0m\u001b[13;51H\u001b[?25h\u001b[?2026l"] +[0.089, "o", "\u001b[?2026h\u001b[?25l\u001b[13;51H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mm\u001b[0m\u001b[17;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52meam\u001b[0m\u001b[17;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m1.0 501B A23B\u001b[0m\u001b[17;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m OpenRouter\u001b[0m\u001b[17;77H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mFree\u001b[0m\u001b[19;52H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;79H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mText\u001b[0m\u001b[19;83H\u001b[38;2;96;97;110m\u001b[48;2;36;37;52m · \u001b[0m\u001b[19;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m1M\u001b[0m\u001b[19;88H\u001b[38;2;96;97;110m\u001b[48;2;36;37;52m · \u001b[0m\u001b[19;91H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mReasoning\u001b[0m\u001b[20;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m "] +[0.001, "o", " \u001b[0m\u001b[22;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mconnect integration\u001b[0m\u001b[22;67H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m ctrl+a\u001b[0m\u001b[22;74H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[22;85H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mfavorite\u001b[0m\u001b[22;93H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m ctrl+f\u001b[0m\u001b[22;100H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;44H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;45H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mauto\u001b[0m\u001b[25;49H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;50H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25m·\u001b[0m\u001b[25;51H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;52H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mGemini\u001b[0m\u001b[25;58H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;59H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mWeb\u001b[0m\u001b[25;62H\u001b[38;2;255;2"] +[0.000, "o", "55;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;63H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mGemini\u001b[0m\u001b[25;69H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;70H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mWeb\u001b[0m\u001b[25;73H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;74H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25m(browser\u001b[0m\u001b[25;82H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;83H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mtool\u001b[0m\u001b[25;87H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[25;88H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mbridge)\u001b[0m\u001b[25;95H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[26;44H\u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[27;44H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19minhchanduybojack@gmail.com]\u001b[0m\u001b[27;71H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;72H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m-\u001b[0m\u001b[27;73H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;74H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m5h\u001b[0m\u001b[27;76H\u001b[38;2;"] +[0.000, "o", "255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;78H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mshift+tab\u001b[0m\u001b[27;87H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;88H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19magents\u001b[0m\u001b[27;94H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;96H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mctrl+p\u001b[0m\u001b[27;102H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;103H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mc\u001b[0m\u001b[0m\u001b[13;52H\u001b[?25h\u001b[?2026l"] +[0.116, "o", "\u001b[?2026h\u001b[?25l\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60musage\u001b[0m\u001b[23;53H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m ctrl+u\u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[0m\u001b[13;52H\u001b[?25h\u001b[?2026l"] +[0.049, "o", "\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;92H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[2;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;92H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;94H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60m\u001b[1mMCP server failed: postgres\u001b[0m\u001b[3;121H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;123H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m› Open MCP servers\u001b[0m\u001b[3;141H\u001b[38;2;255;255;"] +[0.000, "o", "255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[4;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;92H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[4;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[5;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[5;92H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[5;94H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mRun /mcps to view details.\u001b[0m\u001b[5;120H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[5;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[5;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[6;91H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[6;92H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[6;143H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[6;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[12;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[16;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;73H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m ▄ \u001b[0m\u001b[16;93H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[17;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█▀▀█ █▀▀█ █▀▀█ █▀▀▄\u001b[0m\u001b[17;73H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[17;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█▀▀▀ █▀▀█ █▀▀█ █▀▀█\u001b[0m\u001b[17;93H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[18;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;55H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[18;57H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█ █\u001b["] +[0.000, "o", "0m\u001b[18;60H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[18;62H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█ █\u001b[0m\u001b[18;65H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m▀▀▀\u001b[0m\u001b[18;68H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m █\u001b[0m\u001b[18;70H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[18;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;73H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[18;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;75H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[18;78H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m █\u001b[0m\u001b[18;80H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[18;82H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█ █\u001b[0m\u001b[18;85H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[18;87H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█ █\u001b[0m\u001b[18;90H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m▀▀▀\u001b[0m\u001b[18;93H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[19;54H\u001b[38;2;147;153;17"] +[0.000, "o", "8m\u001b[48;2;30;30;46m▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[0m\u001b[19;70H\u001b[38;2;59;61;79m\u001b[48;2;30;30;46m▀▀\u001b[0m\u001b[19;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀\u001b[0m\u001b[19;73H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[19;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b[0m\u001b[19;93H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[22;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[22;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[22;48H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m "] +[0.000, "o", " \u001b[0m\u001b[22;85H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[22;104H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[22;111H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[23;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[23;39H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mAsk anything… \"Fix a TODO in the codebase\"\u001b[0m\u001b[23;104H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[23;111H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[24;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;104H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;111H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[25;"] +[0.000, "o", "36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;39H\u001b[38;2;203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;45H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;49H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;50H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;51H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;52H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[25;61H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;62H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mOpenCode Go\u001b[0m\u001b[25;73H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;111H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[26;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[26;37H\u001b[38;2;46;46;60m\u001b[48;2;30;30;46m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[26;111H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;36H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m…/…\u001b[0m\u001b[27;39H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;41H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - 5h\u001b[0m\u001b[27;76H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;78H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mshift+tab \u001b[0m\u001b[27;88H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46magents\u001b[0m\u001b[27;94H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;96H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mctrl+p \u001b[0m\u001b[27;103H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mcommands\u001b[0m\u001b[27;111H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[28;41H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m100%\u001b[0m\u001b[28;45H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b"] +[0.000, "o", "[34;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;3H\u001b[38;2;243;139;168m\u001b[48;2;30;30;46m⊙ \u001b[0m\u001b[41;5H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m1 MCP failed\u001b[0m\u001b[41;17H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;18H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m/mcps\u001b[0m\u001b[41;23H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;139H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m2.2.2\u001b[0m\u001b[41;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;34"] +[0.000, "o", ";34;50m \u001b[0m\u001b[43;2H\u001b[38;2;166;227;161m\u001b[48;2;34;34;50m✓\u001b[0m\u001b[43;3H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m Server\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;12H\u001b[38;2;243;139;168m\u001b[48;2;34;34;50m● UI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;18H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;25H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;32H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;81H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTime to first draw: 210.27ms\u001b[0m\u001b[43;109H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.013, "o", "\u001b[?2026h\u001b[?25l\u001b[25;74H\u001b[38;2;50;50;65m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;76H\u001b[38;2;54;53;65m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[25;74H\u001b[38;2;59;59;75m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;76H\u001b[38;2;71;69;74m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[25;74H\u001b[38;2;71;72;89m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;76H\u001b[38;2;95;90;88m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[25;74H\u001b[38;2;85;87;105m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;76H\u001b[38;2;124;115;104m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.018, "o", "\u001b[?2026h\u001b[?25l\u001b[25;74H\u001b[38;2;100;103;123m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;76H\u001b[38;2;155;143;122m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[25;74H\u001b[38;2;115;119;141m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;76H\u001b[38;2;185;169;138m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[25;74H\u001b[38;2;139;145;169m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;76H\u001b[38;2;233;212;166m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[25;74H\u001b[38;2;146;152;177m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;76H\u001b[38;2;247;224;174m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.019, "o", "\u001b[?2026h\u001b[?25l\u001b[25;74H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;76H\u001b[38;2;249;226;175m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[2.249, "o", "\u001b[?2026h\u001b[?25l\u001b[2;91H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;91H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;91H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[5;91H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[6;91H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.504, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;52H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[26;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.105, "o", "\u001b[?2026h\u001b[?25l\u001b[22;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;39H\u001b[38;2;203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;52H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[26;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[23;39H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[2;106H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;107H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[2;143H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;106H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;107H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;109H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mLoading speech model… · 00:00\u001b[0m\u001b[3;138H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;140H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mx\u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;143H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;106H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;107H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[4;143H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[15;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m ▄ \u001b[0m\u001b[16;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█▀▀█\u001b[0m\u001b[16;59H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█▀▀█\u001b[0m\u001b[16;64H\u001b[38;2"] +[0.000, "o", ";147;153;178m\u001b[48;2;30;30;46m█▀▀█\u001b[0m\u001b[16;69H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█▀▀▄\u001b[0m\u001b[16;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█▀▀▀\u001b[0m\u001b[16;79H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█▀▀█\u001b[0m\u001b[16;84H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█▀▀█\u001b[0m\u001b[16;89H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█▀▀█\u001b[0m\u001b[17;55H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[17;60H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[17;65H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m▀▀▀\u001b[0m\u001b[17;70H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[17;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[17;75H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[17;80H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[17;85H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[17;90H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m▀▀▀\u001b[0m\u001b[18;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀▀▀\u001b[0m\u001b[18;60H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀▀\u001b[0m\u001b[18;64H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀▀▀\u001b[0m\u001b[18;69H\u001b[38;2;147;15"] +[0.000, "o", "3;178m\u001b[48;2;30;30;46m▀\u001b[0m\u001b[18;70H\u001b[38;2;59;61;79m\u001b[48;2;30;30;46m▀▀\u001b[0m\u001b[18;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀\u001b[0m\u001b[18;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀▀\u001b[0m\u001b[18;79H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀▀\u001b[0m\u001b[18;84H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀▀\u001b[0m\u001b[18;89H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀▀\u001b[0m\u001b[19;54H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[19;74H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[21;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[21;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[22;39H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mAsk anything… \"Fix a TODO in the codebase\"\u001b[0m\u001b[23;39H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;39H\u001b[38;2;203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[24;45H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[24;50H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[24;52H"] +[0.000, "o", "\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[24;62H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mOpenCode Go\u001b[0m\u001b[24;74H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[24;76H\u001b[38;2;249;226;175m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[25;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[25;37H\u001b[38;2;46;46;60m\u001b[48;2;30;30;46m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[26;36H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m…/…\u001b[0m\u001b[26;39H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[26;41H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - 5h\u001b[0m\u001b[26;76H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[26;78H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mshift+tab \u001b[0m\u001b[26;88H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46magents\u001b[0m\u001b[26;94H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[26;96H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mctrl+p \u001b[0m\u001b[26;103H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mcommands"] +[0.000, "o", "\u001b[0m\u001b[27;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;41H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m100%\u001b[0m\u001b[27;45H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;78H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;96H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[28;41H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;1H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[⏸]\u001b[0m\u001b[38;5H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ \u001b[0m\u001b[38;24H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mVoice live · Listening…\u001b[0m\u001b[38;48H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[auto-submit:ON]\u001b[0m\u001b[38;65H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[auto-end:ON]\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.994, "o", "\u001b[?2026h\u001b[?25l\u001b[43;12H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m⦿ UI\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.204, "o", "\u001b[?2026h\u001b[?25l\u001b[2;94H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;95H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;94H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;95H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;97H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60m● Streaming dictation — listening\u001b[0m\u001b[4;94H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;95H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.087, "o", "\u001b[?2026h\u001b[?25l\u001b[38;5H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂▂\u001b[0m\u001b[38;9H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂▂▂▂▂▃▃▂▄▂▃▃\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.242, "o", "\u001b[?2026h\u001b[?25l\u001b[38;5H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▅▃▅▃▄▃▄▃▄\u001b[0m\u001b[38;15H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▄\u001b[0m\u001b[38;19H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▄▂\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.246, "o", "\u001b[?2026h\u001b[?25l\u001b[38;5H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂\u001b[0m\u001b[38;7H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂▄▃▄▃\u001b[0m\u001b[38;13H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▃\u001b[0m\u001b[38;16H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▃▃▃▃▃\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.243, "o", "\u001b[?2026h\u001b[?25l\u001b[38;8H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂▁▂▁▁▁▁▂▂▁▁▁▁\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.080, "o", "\u001b[?2026h\u001b[?25l\u001b[38;10H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▁\u001b[0m\u001b[38;15H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▁\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.245, "o", "\u001b[?2026h\u001b[?25l\u001b[38;7H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▃▃▃▃▃▃▄▃▄▃▃▃▃▃\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.243, "o", "\u001b[?2026h\u001b[?25l\u001b[38;6H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▁▁▁▂▁▁▂▂▁▂▁▂▂▂▁\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.078, "o", "\u001b[?2026h\u001b[?25l\u001b[38;15H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▁\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.166, "o", "\u001b[?2026h\u001b[?25l\u001b[38;5H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▄▂▄▂▄▃▄▃▄▃▄▃▃\u001b[0m\u001b[38;19H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▁\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.166, "o", "\u001b[?2026h\u001b[?25l\u001b[43;12H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m○\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.074, "o", "\u001b[?2026h\u001b[?25l\u001b[38;5H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂\u001b[0m\u001b[38;7H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂\u001b[0m\u001b[38;9H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂\u001b[0m\u001b[38;11H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂\u001b[0m\u001b[38;13H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂▂▂▂▂\u001b[0m\u001b[38;19H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▂▂\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.133, "o", "\u001b[?2026h\u001b[?25l\u001b[38;37H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[Thank you.]\u001b[0m\u001b[38;49H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;50H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[auto-submit:ON]\u001b[0m\u001b[38;66H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;67H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[auto-end:ON]\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.110, "o", "\u001b[?2026h\u001b[?25l\u001b[38;6H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▄▃▄▄\u001b[0m\u001b[38;11H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▄\u001b[0m\u001b[38;13H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▄▃▃▃▃▃▃▃\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.245, "o", "\u001b[?2026h\u001b[?25l\u001b[38;6H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▃▂▃▃\u001b[0m\u001b[38;11H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▃\u001b[0m\u001b[38;13H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▃\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.241, "o", "\u001b[?2026h\u001b[?25l\u001b[38;5H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.406, "o", "\u001b[?2026h\u001b[?25l\u001b[2;94H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;94H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;94H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[1.037, "o", "\u001b[?2026h\u001b[?25l\u001b[38;38H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mHello, are you listening to wh\u001b[0m\u001b[38;69H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mt I am saying?]\u001b[0m\u001b[38;85H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[auto-submit:ON]\u001b[0m\u001b[38;102H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[auto-end:ON]\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[1.993, "o", "\u001b[?2026h\u001b[?25l\u001b[38;24H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m…ive · Hello, are you listening \u001b[0m\u001b[38;57H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mo what I\u001b[0m\u001b[38;66H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mam saying? [here\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[2.012, "o", "\u001b[?2026h\u001b[?25l\u001b[38;25H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mlive · He\u001b[0m\u001b[38;35H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mlo, are you listening to what I am saying? \u001b[0m\u001b[38;83H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.880, "o", "\u001b[?2026h\u001b[?25l\u001b[21;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[22;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;39H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[24;52H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[25;36H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.116, "o", "\u001b[?2026h\u001b[?25l\u001b[2;105H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;106H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[2;143H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;105H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;106H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;108H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mNo assistant response to speak\u001b[0m\u001b[3;138H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;140H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mx\u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;143H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;105H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;106H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[4;143H\u001b[38;2;249;226;175m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[21;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[22;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[23;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[24;39H\u001b[38;2;203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[24;52H\u001b[38;2;205"] +[0.000, "o", ";214;244m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[25;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[0.272, "o", "\u001b[?2026h\u001b[?25l\u001b[2;105H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;116H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;143H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;105H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;116H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;117H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;119H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mFinalizing… ·\u001b[0m\u001b[3;133H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60m00:00\u001b[0m\u001b[3;143H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;105H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;116H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;143H\u001b[38;2;148;226;213m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[0m\u001b[22;39H\u001b[?25h\u001b[?2026l"] +[2.888, "o", "\u001b[?2026h\u001b[?25l\u001b[2;102H\u001b[38;2;166;227;161m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[2;103H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[2;143H\u001b[38;2;166;227;161m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;102H\u001b[38;2;166;227;161m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[3;103H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;105H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mStreaming transcriptio\u001b[0m\u001b[3;128H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60m submitted\u001b[0m\u001b[3;143H\u001b[38;2;166;227;161m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;102H\u001b[38;2;166;227;161m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[4;103H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[4;143H\u001b[38;2;166;227;161m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[15;54H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;74H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;59H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;64H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;69H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m \u001b[0m\u001b[16;79H\u001b[38;2;205;214"] +[0.000, "o", ";244m\u001b[48;2;30;30;46m\u001b[1m \u001b[0m\u001b[16;84H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m ▄\u001b[0m\u001b[16;89H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m \u001b[0m\u001b[17;55H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀\u001b[0m\u001b[17;60H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀\u001b[0m\u001b[17;65H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀█\u001b[0m\u001b[17;70H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀▄\u001b[0m\u001b[17;75H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀\u001b[0m\u001b[17;80H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀\u001b[0m\u001b[17;85H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀\u001b[0m\u001b[17;90H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀█\u001b[0m\u001b[18;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;55H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[18;57H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;60H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m \u001b[0m\u001b[18;62H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;64H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;65H\u001b[38;2;147;153;178m\u001b[48;2;59;61;79m▀▀▀\u001b[0m\u001b[18;69H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;70H\u001b[38;2;147;153;"] +[0.000, "o", "178m\u001b[48;2;59;61;79m \u001b[0m\u001b[18;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m█\u001b[0m\u001b[18;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;75H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[18;79H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;80H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[18;82H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;84H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;85H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m \u001b[0m\u001b[18;87H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;89H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m█\u001b[0m\u001b[18;90H\u001b[38;2;205;214;244m\u001b[48;2;74;76;96m\u001b[1m▀▀▀\u001b[0m\u001b[19;54H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀▀▀▀ █▀▀▀ ▀▀▀▀ ▀\u001b[0m\u001b[19;70H\u001b[38;2;59;61;79m\u001b[48;2;30;30;46m▀▀\u001b[0m\u001b[19;72H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m▀\u001b[0m\u001b[19;74H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m\u001b[1m▀▀▀▀ ▀▀▀▀ ▀▀▀▀ ▀▀▀▀\u001b[0m\u001b[21;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.003, "o", " \u001b[0m\u001b[22;39H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[23;39H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mHello, are you listening to what I am saying here?\u001b[0m\u001b[24;39H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;45H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;50H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;52H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;62H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;74H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[24;76H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[25;37H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;39H\u001b[38;2;203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[25;44H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;45H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[25;49H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;50H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;51H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;52H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[25;61H\u001b[38;2;"] +[0.000, "o", "255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;62H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mOpenCode Go\u001b[0m\u001b[25;73H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;74H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[25;75H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[25;76H\u001b[38;2;249;226;175m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[25;79H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[26;36H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[26;37H\u001b[38;2;46;46;60m\u001b[48;2;30;30;46m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[27;36H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m…/…\u001b[0m\u001b[27;41H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - 5h\u001b[0m\u001b[27;78H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mshift+tab \u001b[0m\u001b[27;88H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46magents\u001b[0m\u001b[27;96H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mctrl+p \u001b[0m\u001b[27;103H\u001b[38;2;147;153;178m\u001b[48;2;30;3"] +[0.000, "o", "0;46mcommands\u001b[0m\u001b[28;41H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m100%\u001b[0m\u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;5H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;24H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;85H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;102H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[23;89H\u001b[?25h\u001b[?2026l"] +[0.002, "o", "\u001b]7501;state=working:app=opencode:title=TmV3IHNlc3Npb24gLSAyMDI2LTEwLTMwVDA5OjI0OjE5LjQ2OVo=\u001b\\\u001b]7501;state=working:id=ses_e73e02872ffeff4wtikuZ9dfyG:app=opencode:title=TmV3IHNlc3Npb24gLSAyMDI2LTEwLTMwVDA5OjI0OjE5LjQ2OVo=\u001b\\"] +[0.004, "o", "\u001b]0;OpenCode\u0007\u001b]7501;state=working:app=opencode:title=TmV3IHNlc3Npb24gLSAyMDI2LTEwLTMwVDA5OjI0OjE5LjUyMlo=\u001b\\\u001b]7501;state=working:id=ses_e73e02872ffeff4wtikuZ9dfyG:app=opencode:title=TmV3IHNlc3Npb24gLSAyMDI2LTEwLTMwVDA5OjI0OjE5LjUyMlo=\u001b\\\u001b[?2026h\u001b[?25l\u001b[1;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[2;3H\u001b[38;2;49;50;68m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[2;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[2;102H\u001b[38;2;166;227;161m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[2;143H\u001b[38;2;166;227;161m\u001b[48;2;46;46;60m┃\u001b[0m\u001b[3;3H\u001b[38;2;49;50;68m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[3;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[3;6H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mHello, are you listening to what I am saying here?\u001b[0m\u001b[3;56H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[3;102H\u001b[38;2;166;227;161m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[3;143H\u001b[38;2;166;227;161m\u001b[48;2;46;46;60m┃\u001b[0m\u001b[4;3H\u001b[38;2;49;50;68m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[4;4H\u001b[38;2;255"] +[0.004, "o", ";255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[4;102H\u001b[38;2;166;227;161m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[4;143H\u001b[38;2;166;227;161m\u001b[48;2;46;46;60m┃\u001b[0m\u001b[5;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[6;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[7;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[8;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[9;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[10;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[11;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[12;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[13;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[14;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[15;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[16;54H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;74H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[17;54H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[17;74H\u001b[38;2;255;255;255m\u001b"] +[0.008, "o", "[48;2;30;30;46m \u001b[0m\u001b[17;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[18;54H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[18;74H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[18;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[19;54H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[19;74H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[19;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[20;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[21;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[22;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[22;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[23;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[23;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[24;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[24;143H\u001b[38;2;49;5"] +[0.001, "o", "0;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[25;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[25;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[26;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[26;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[27;36H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;41H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;78H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;96H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[28;41H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[28;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[29;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[30;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[31;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[32;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[33;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[34;143H\u001b[3"] +[0.004, "o", "8;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[36;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[36;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[37;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[37;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[38;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[38;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[39;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;6H\u001b[38;2;203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[39;11H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;12H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[39;16H\u001b[38;2;255;255;255m\u001b[48;2;46"] +[0.002, "o", ";46;60m \u001b[0m\u001b[39;17H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[39;18H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;19H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[39;28H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;29H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mOpenCode Go\u001b[0m\u001b[39;40H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;41H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[39;42H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;43H\u001b[38;2;249;226;175m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[39;46H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[40;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[40;4H\u001b[38;2;46;46;60m\u001b[48;2;30;30;46m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[41;3H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m~/Code/opencode-voice:master\u001b[0m\u001b[41;69H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - 5h 100%\u001b[0m\u001b[41;111H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mshift+tab \u001b[0m\u001b[41;121H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46magents\u001b[0m\u001b[41;129H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mctrl+p \u001b[0m\u001b[41;136H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mcommands\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b]0;OpenCode\u0007"] +[0.275, "o", "\u001b[?2026h\u001b[?25l\u001b[2;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[3;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[4;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[41;3H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;4H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[41;12H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;13H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mesc \u001b[0m\u001b[41;17H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46minterrupt\u001b[0m\u001b[41;26H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.018, "o", "\u001b]0;OpenCode\u0007"] +[0.024, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;71;63;94m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;82;71;107m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.042, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;92;79;119m\u001b[48;2;30;30;46m⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.036, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;103;87;130m\u001b[48;2;30;30;46m⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.056, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;113;95;142m\u001b[48;2;30;30;46m⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.025, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;124;104;155m\u001b[48;2;30;30;46m⬝\u001b[0m\u001b[41;5H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;124;104;155m\u001b[48;2;30;30;46m⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.041, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;134;112;167m\u001b[48;2;30;30;46m⬝⬝\u001b[0m\u001b[41;6H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.078, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;126;105;157m\u001b[48;2;30;30;46m⬝⬝⬝\u001b[0m\u001b[41;7H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.058, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;118;99;148m\u001b[48;2;30;30;46m⬝⬝⬝⬝\u001b[0m\u001b[41;8H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.047, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;109;92;138m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝\u001b[0m\u001b[41;9H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.025, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;101;86;129m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[41;10H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.047, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;94;80;120m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[41;11H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.024, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;86;74;111m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.042, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;69;61;92m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[41;10H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.039, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;73;64;96m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝\u001b[0m\u001b[41;9H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.039, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;86;74;111m\u001b[48;2;30;30;46m⬝⬝⬝⬝\u001b[0m\u001b[41;8H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.047, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;97;83;124m\u001b[48;2;30;30;46m⬝⬝⬝\u001b[0m\u001b[41;7H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.047, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;109;92;138m\u001b[48;2;30;30;46m⬝⬝\u001b[0m\u001b[41;6H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.033, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;122;102;152m\u001b[48;2;30;30;46m⬝\u001b[0m\u001b[41;5H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;11H\u001b[38;2;122;102;152m\u001b[48;2;30;30;46m⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;10H\u001b[38;2;134;112;167m\u001b[48;2;30;30;46m⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.074, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;9H\u001b[38;2;131;109;163m\u001b[48;2;30;30;46m⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.038, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;129;108;161m\u001b[48;2;30;30;46m⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.029, "o", "\u001b]0;OC | Checking if audio is working\u0007"] +[0.000, "o", "\u001b]7501;state=working:app=opencode:title=Q2hlY2tpbmcgaWYgYXVkaW8gaXMgd29ya2luZw==\u001b\\"] +[0.000, "o", "\u001b]7501;state=working:id=ses_e73e02872ffeff4wtikuZ9dfyG:app=opencode:title=Q2hlY2tpbmcgaWYgYXVkaW8gaXMgd29ya2luZw==\u001b\\"] +[0.012, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;126;106;158m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.041, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;77;67;101m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;124;104;156m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.038, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;122;102;152m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;120;100;150m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.057, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;117;98;147m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.025, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;114;96;144m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[43;12H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m⦿\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.021, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;112;95;141m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.057, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;109;92;138m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.023, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;107;91;136m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;105;89;133m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;103;87;130m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;100;85;127m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;97;83;124m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;95;81;122m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;92;79;119m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;90;77;116m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.033, "o", "\u001b[?2026h\u001b[?25l\u001b[6;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46m⠋\u001b[0m\u001b[6;10H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46mThinking\u001b[0m\u001b[8;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;88;75;113m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.026, "o", "\u001b[?2026h\u001b[?25l\u001b[8;8H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mThe user is asking if I'm listening.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.018, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;86;74;111m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.020, "o", "\u001b[?2026h\u001b[?25l\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46m⠙\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;83;72;107m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.035, "o", "\u001b[?2026h\u001b[?25l\u001b[8;44H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m This is a simple conversational question. No\u001b[0m\u001b[41;4H\u001b[38;2;80;69;104m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.028, "o", "\u001b[?2026h\u001b[?25l\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46m⠹\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;78;68;102m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.047, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;75;66;99m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46m⠸\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;73;64;96m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.018, "o", "\u001b[?2026h\u001b[?25l\u001b[8;89H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m skills needed here - it's just a greeting/check-in\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;71;62;93m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.030, "o", "\u001b[?2026h\u001b[?25l\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46m⠼\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;69;60;91m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.029, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;66;58;88m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.019, "o", "\u001b[?2026h\u001b[?25l\u001b[8;140H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m.\u001b[0m\u001b[9;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[9;8H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mLet me respond naturally.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.015, "o", "\u001b[?2026h\u001b[?25l\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46m⠴\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.017, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;63;56;85m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.029, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;61;55;82m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.024, "o", "\u001b[?2026h\u001b[?25l\u001b[11;6H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mYes, I'm here and listening.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46m⠦\u001b[0m\u001b[41;4H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;71;63;94m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.040, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;82;71;107m\u001b[48;2;30;30;46m⬝⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.025, "o", "\u001b[?2026h\u001b[?25l\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46mThought: 637ms\u001b[0m\u001b[11;34H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m What can I help you with?\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.015, "o", "\u001b[?2026h\u001b[?25l\u001b[41;4H\u001b[38;2;103;88;131m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;5H\u001b[38;2;143;119;177m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;6H\u001b[38;2;213;175;235m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;7H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m■\u001b[0m\u001b[41;8H\u001b[38;2;92;79;119m\u001b[48;2;30;30;46m⬝⬝⬝⬝\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.177, "o", "\u001b]7501;state=clear:id=ses_e73e02872ffeff4wtikuZ9dfyG\u001b\\"] +[0.000, "o", "\u001b]7501;state=idle:app=opencode\u001b\\\u001b]0;OC | Checking if audio is working\u0007\u001b[?2026h\u001b[?25l\u001b[13;6H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46mBuild\u001b[0m\u001b[13;11H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m · Beam Free · 2.6s · 26.3 tok/s\u001b[0m\u001b[15;6H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m+ Tokens: 1 step · latest: 45,684 new · 832 cached · 46,516 total\u001b[0m\u001b[41;3H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m~/Code/opencode-voice:master\u001b[0m\u001b[41;69H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;75H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduyboj\u001b[0m\u001b[41;92H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mck@gmail.com] - 5h 100%\u001b[0m\u001b[41;115H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;117H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m46.5K (4%)\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.024, "o", "\u001b]0;OC | Checking if audio is working\u0007"] +[0.093, "o", "\u001b[?2026h\u001b[?25l\u001b[2;102H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[2;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[3;102H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[4;102H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[4;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[3.973, "o", "\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[1;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[1;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[2;3H\u001b[38;2;84;68;102m\u001b[48;2;15;15;21m┃\u001b[0m\u001b[2;4H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[2;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[2;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[2;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[3;3H\u001b[38;2;84;68;102m\u001b[48;2;15;15;21m┃\u001b[0m\u001b[3;4H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;6H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mHello,\u001b[0m\u001b[3;12H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;13H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mare\u001b[0m\u001b[3;16H\u001b[38;2;255;255;255m\u001b[48;2"] +[0.000, "o", ";15;15;21m \u001b[0m\u001b[3;17H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21myou\u001b[0m\u001b[3;20H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;21H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mlistening\u001b[0m\u001b[3;30H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;31H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mto\u001b[0m\u001b[3;33H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;34H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mwhat\u001b[0m\u001b[3;38H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;39H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mI\u001b[0m\u001b[3;40H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;41H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mam\u001b[0m\u001b[3;43H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;44H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21msaying\u001b[0m\u001b[3;50H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;51H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mhere?\u001b[0m\u001b[3;56H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[3;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[3;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[4;1H\u001b[38;2;255;255;255"] +[0.001, "o", "m\u001b[48;2;12;12;19m \u001b[0m\u001b[4;3H\u001b[38;2;84;68;102m\u001b[48;2;15;15;21m┃\u001b[0m\u001b[4;4H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[4;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[4;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[4;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[5;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[5;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;6H\u001b[38;2;14;14;21m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[6;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;8H\u001b[38;2;66;61;51m\u001b[48;2;12;12;19mThought:\u001b[0m\u001b[6;16H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;17H\u001b[38;2;66;61;51m\u001b[48;2;12;12;19m637ms\u001b[0m\u001b[6;22H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[6;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[6;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[7;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[7;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;6H\u001b[38;2;14;14;21m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[8;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;8H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mThe\u001b[0m\u001b[8;11H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;12H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19muser\u001b[0m\u001b[8;16H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;17H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mis\u001b[0m\u001b[8;19H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;20H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19masking\u001b[0m\u001b[8;26H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;27H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19"] +[0.000, "o", "mif\u001b[0m\u001b[8;29H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;30H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mI'm\u001b[0m\u001b[8;33H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;34H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mlistening.\u001b[0m\u001b[8;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;45H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mThis\u001b[0m\u001b[8;49H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;50H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mis\u001b[0m\u001b[8;52H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;53H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19ma\u001b[0m\u001b[8;54H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;55H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19msimple\u001b[0m\u001b[8;61H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;62H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mconversational\u001b[0m\u001b[8;76H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;77H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mquestion.\u001b[0m\u001b[8;86H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;87H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mNo\u001b[0m\u001b[8;89H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;90H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mskills\u001b[0m\u001b[8;96H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;97H\u001b[38;2"] +[0.000, "o", ";61;63;73m\u001b[48;2;12;12;19mneeded\u001b[0m\u001b[8;103H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;104H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mhere\u001b[0m\u001b[8;108H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;109H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m-\u001b[0m\u001b[8;110H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;111H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mit's\u001b[0m\u001b[8;115H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;116H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mjust\u001b[0m\u001b[8;120H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;121H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19ma\u001b[0m\u001b[8;122H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;123H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mgreeting/check-in.\u001b[0m\u001b[8;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[8;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;6H\u001b[38;2;14;14;21m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[9;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;8H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mLet\u001b[0m\u001b[9;11H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;12H\u001b[38;2;61;63;73m\u001b[48;2;"] +[0.000, "o", "12;12;19mme\u001b[0m\u001b[9;14H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;15H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mrespond\u001b[0m\u001b[9;22H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;23H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mnaturally.\u001b[0m\u001b[9;33H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[9;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[10;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[10;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;6H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mYes,\u001b[0m\u001b[11;10H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;11H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mI'm\u001b[0m\u001b[11;14H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;15H\u001b[38;2;84;88;100m\u001b[48;2;12;12;1"] +[0.000, "o", "9mhere\u001b[0m\u001b[11;19H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;20H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mand\u001b[0m\u001b[11;23H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;24H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mlistening.\u001b[0m\u001b[11;34H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;35H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mWhat\u001b[0m\u001b[11;39H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;40H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mcan\u001b[0m\u001b[11;43H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;44H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mI\u001b[0m\u001b[11;45H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;46H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mhelp\u001b[0m\u001b[11;50H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;51H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19myou\u001b[0m\u001b[11;54H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;55H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mwith?\u001b[0m\u001b[11;60H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[11;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[12;1H\u001b[38;2"] +[0.000, "o", ";255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[12;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[12;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[12;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[12;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;6H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19mBuild\u001b[0m\u001b[13;11H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;12H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m·\u001b[0m\u001b[13;13H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;14H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mBeam\u001b[0m\u001b[13;18H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;19H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mFree\u001b[0m\u001b[13;23H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;24H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m·\u001b[0m\u001b[13;25H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;26H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m2.6s\u001b[0m\u001b[13;30H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;31H\u001b[38;2;61;63;73m\u001b[48;2;12;12"] +[0.000, "o", ";19m·\u001b[0m\u001b[13;32H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;33H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m26.3\u001b[0m\u001b[13;37H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;38H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mtok/s\u001b[0m\u001b[13;43H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSearch commands\u001b[0m\u001b[13;63H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;97H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mesc\u001b[0m\u001b[13;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[13;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[14;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[14;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[14;143H\u001b[38"] +[0.000, "o", ";2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[14;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;6H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m+\u001b[0m\u001b[15;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;8H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mTokens:\u001b[0m\u001b[15;15H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;16H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m1\u001b[0m\u001b[15;17H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;18H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mstep\u001b[0m\u001b[15;22H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;23H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m·\u001b[0m\u001b[15;24H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;25H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mlatest:\u001b[0m\u001b[15;32H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;33H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m45,684\u001b[0m\u001b[15;39H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;40H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mnew\u001b[0m\u001b[15;43H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mSuggested\u001b[0m\u001b[15;57H\u001b[38;2;25"] +[0.000, "o", "5;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[15;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mSwitch session\u001b[0m\u001b[16;62H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;92H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mctrl+x l\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[16;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[16;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;45H\u001b[38;2"] +[0.000, "o", ";255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mNew session\u001b[0m\u001b[17;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x n\u001b[0m\u001b[17;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[17;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[17;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSwitch model\u001b[0m\u001b[18;60H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x m\u001b[0m\u001b[18;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[18;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m"] +[0.000, "o", "█\u001b[0m\u001b[18;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[19;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mOpen settings\u001b[0m\u001b[19;61H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[19;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[19;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[20;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[20;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[20;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[21;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mLLM Council\u001b[0m\u001b[21;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[21;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[21;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[22;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mLLM Council: Change model\u001b[0m\u001b[22;73H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Pick the model used by all\u001b[0m\u001b[22;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[22;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[22;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[23;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[23;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mSession\u001b[0m\u001b[24;55H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[24;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[24;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[25;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSwi"] +[0.000, "o", "tch session\u001b[0m\u001b[25;62H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x l\u001b[0m\u001b[25;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[25;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[25;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[26;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mNew session\u001b[0m\u001b[26;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x n\u001b[0m\u001b[26;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[26;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[26;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;"] +[0.000, "o", "2;12;12;19m \u001b[0m\u001b[27;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mClear session\u001b[0m\u001b[27;61H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[27;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[28;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mOpen session or project\u001b[0m\u001b[28;71H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+o\u001b[0m\u001b[28;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[28;143H\u001b[38;2;20"] +[0.000, "o", ";21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[28;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[29;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[29;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[29;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[29;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[30;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[30;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b["] +[0.000, "o", "0m\u001b[31;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[31;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[32;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[32;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[33;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[33;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[34;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[34;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[34;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;"] +[0.000, "o", "19m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[36;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[36;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[36;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[37;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[37;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[37;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[38;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[38;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m "] +[0.000, "o", " \u001b[0m\u001b[38;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[39;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[39;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;6H\u001b[38;2;84;68;102m\u001b[48;2;19;19;25mBuild\u001b[0m\u001b[39;11H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;12H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mauto\u001b[0m\u001b[39;16H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;17H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25m·\u001b[0m\u001b[39;18H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;19H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mBeam\u001b[0m\u001b[39;23H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;24H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mFree\u001b[0m\u001b[39;28H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;29H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mOpenCode\u001b[0m\u001b[39;37H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;38H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mGo\u001b[0m\u001b[39;40H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;41H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25m·\u001b[0m\u001b[39;42H\u001b[3"] +[0.000, "o", "8;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;43H\u001b[38;2;103;93;72m\u001b[48;2;19;19;25m\u001b[1mmax\u001b[0m\u001b[39;46H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[40;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m╹\u001b[0m\u001b[40;4H\u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[40;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;3H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m~/Code/opencode-voice:master\u001b[0m\u001b[41;31H\u001b[38;2;255;25"] +[0.000, "o", "5;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;75H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m[trinhchanduybojack@gmail.com]\u001b[0m\u001b[41;105H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;106H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m-\u001b[0m\u001b[41;107H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;108H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m5h\u001b[0m\u001b[41;110H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;111H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m100%\u001b[0m\u001b[41;115H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;117H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m46.5K\u001b[0m\u001b[41;122H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;123H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m(4%)\u001b[0m\u001b[41;127H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;129H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mctrl+p\u001b[0m\u001b[41;135H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;136H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mcommands\u001b[0m\u001b[41;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;2H\u001b[38;2;68;93;66m\u001b[48;2;14;14;21m✓\u001b[0m\u001b[43;3H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;4H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mServer\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;12H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21m⦿\u001b[0m\u001b[43;13H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;14H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mUI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;18H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;25H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;32H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;81H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTime\u001b[0m\u001b[43;85H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;86H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mto\u001b[0m\u001b[43;88H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;89H\u001b[38;2;61;63;7"] +[0.000, "o", "3m\u001b[48;2;14;14;21mfirst\u001b[0m\u001b[43;94H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;95H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mdraw:\u001b[0m\u001b[43;100H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;101H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21m210.27ms\u001b[0m\u001b[43;109H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.009, "o", "\u001b[?2026h\u001b[?25l\u001b[29;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m…\u001b[0m\u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.281, "o", "\u001b[?2026h\u001b[?25l\u001b[13;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt\u001b[0m\u001b[13;49H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[15;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mWindow title\u001b[0m\u001b[15;60H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;81H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mSettings · Terminal\u001b[0m\u001b[15;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSwitch theme\u001b[0m\u001b[16;60H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSystem\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Today)\u001b[0m\u001b[17;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens\u001b[0m\u001b[18;55H\u001b[38;2;205;214;244m\u001b[48;"] +[0.000, "o", "2;36;37;52mused (All Time)\u001b[0m\u001b[18;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mLeader \u001b[0m\u001b[19;56H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mimeout\u001b[0m\u001b[19;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSettings · Input\u001b[0m\u001b[20;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Last 7 Days)\u001b[0m\u001b[20;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[21;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTPS\u001b[0m\u001b[21;51H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSettings · Session\u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Last 24 Hours)\u001b[0m\u001b[22;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCo\u001b[0m\u001b[22;93H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52me Quota\u001b[0m\u001b[23;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Last 30 Days)\u001b[0m\u001b["] +[0.000, "o", "23;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[24;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Current Session)\u001b[0m\u001b[24;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens\u001b[0m\u001b[25;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mused (Current Session Tree)\u001b[0m\u001b[25;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mOpenCode Quota Token Report\u001b[0m\u001b[26;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mExit th\u001b[0m\u001b[27;56H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m app\u001b[0m\u001b[27;60H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSystem · ctrl+c, ctrl+d, ctrl+x q\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mIndicators\u001b[0m\u001b[28;58H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;85H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSettings · Tabs\u001b[0m\u001b[0m\u001b[13;49H\u001b[?25h\u001b[?2026l"] +[0.096, "o", "\u001b[?2026h\u001b[?25l\u001b[13;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt\u001b[0m\u001b[15;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mTTS: toggle\u001b[0m\u001b[15;59H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Toggle auto text-to-sp\u001b[0m\u001b[15;83H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mec\u001b[0m\u001b[15;85H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;86H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mopencod\u001b[0m\u001b[15;94H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m-voice\u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTTS: select voice\u001b[0m\u001b[16;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose TTS voice\u001b[0m\u001b[16;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[17;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: \u001b[0m\u001b[17;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtop playback\u001b[0m\u001b[17;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop current TTS p\u001b[0m\u001b[17;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[17;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[17;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[18;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: playback speed\u001b[0m\u001b[18;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose "] +[0.000, "o", "playback s\u001b[0m\u001b[18;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[18;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[18;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTTS: select engine\u001b[0m\u001b[19;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose TTS engine \u001b[0m\u001b[19;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mope\u001b[0m\u001b[19;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mcode-voice\u001b[0m\u001b[20;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: rewin\u001b[0m\u001b[20;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m5 seconds\u001b[0m\u001b[20;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Jump\u001b[0m\u001b[20;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[20;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x -\u001b[0m\u001b[21;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[21;51H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m: replay from start\u001b[0m\u001b[21;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Res\u001b[0m\u001b[21;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-vo\u001b[0m\u001b[21;87H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mce · ctrl+x 0\u001b[0m\u001b[22;49H"] +[0.000, "o", "\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: forward 5 \u001b[0m\u001b[22;64H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52meconds\u001b[0m\u001b[22;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Jum\u001b[0m\u001b[22;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[22;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x =\u001b[0m\u001b[23;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: \u001b[0m\u001b[23;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mpeak last response\u001b[0m\u001b[23;72H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m R\u001b[0m\u001b[23;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[23;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x ]\u001b[0m\u001b[24;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: pa\u001b[0m\u001b[24;58H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m / resume playba\u001b[0m\u001b[24;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[24;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x p\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: \u001b[0m\u001b[25;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52melect\u001b[0m\u001b[25;60H\u001b[38;2;205;214;244m\u001b["] +[0.000, "o", "48;2;36;37;52mmodel\u001b[0m\u001b[25;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose whisper mode\u001b[0m\u001b[25;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[25;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[25;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: cancel recordi\u001b[0m\u001b[26;68H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mg\u001b[0m\u001b[26;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Cancel current \u001b[0m\u001b[26;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[26;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[26;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Today)\u001b[0m\u001b[27;67H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: select microphone\u001b[0m\u001b[28;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose audio i\u001b[0m\u001b[28;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[0m\u001b[13;50H\u001b[?25h\u001b[?2026l"] +[0.393, "o", "\u001b[?2026h\u001b[?25l\u001b[13;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[25;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mr\u001b[0m\u001b[25;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mcord/transcribe\u001b[0m\u001b[25;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Tog\u001b[0m\u001b[25;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[25;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x [\u001b[0m\u001b[26;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtoggle\u001b[0m\u001b[26;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52maut\u001b[0m\u001b[26;64H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m-submit\u001b[0m\u001b[26;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Toggle submit\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: \u001b[0m\u001b[27;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mubmit\u001b[0m\u001b[27;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mrecording\u001b[0m\u001b[27;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop recording,\u001b[0m\u001b[27;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[27;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[27;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[0m\u001b[13;51H\u001b[?25h\u001b[?2026l"] +[0.258, "o", "\u001b[?2026h\u001b[?25l\u001b[13;51H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52me\u001b[0m\u001b[15;53H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mselect engine\u001b[0m\u001b[15;67H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mCho\u001b[0m\u001b[15;71H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mse TTS engin\u001b[0m\u001b[15;84H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mr\u001b[0m\u001b[16;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mwind\u001b[0m\u001b[16;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m5 seconds\u001b[0m\u001b[16;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Jump\u001b[0m\u001b[16;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[16;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x -\u001b[0m\u001b[17;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mforward 5 seconds\u001b[0m\u001b[17;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Jum\u001b[0m\u001b[17;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[17;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x =\u001b[0m\u001b[18;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mselect voic\u001b[0m\u001b[18;65H\u001b[38;2;147;153;178m\u001b[48"] +[0.000, "o", ";2;36;37;52m Choose TTS voice\u001b[0m\u001b[18;82H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mr\u001b[0m\u001b[19;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mplay\u001b[0m\u001b[19;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mfrom start\u001b[0m\u001b[19;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m R\u001b[0m\u001b[19;73H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52ms\u001b[0m\u001b[19;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[19;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x 0\u001b[0m\u001b[20;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mspeak last response\u001b[0m\u001b[20;72H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m R\u001b[0m\u001b[20;99H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m]\u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[21;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[21;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[21;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlect\u001b[0m\u001b[21;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mmicrophone\u001b[0m\u001b[21;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mChoose audio i\u001b[0m\u001b[21;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b"] +[0.000, "o", "[0m\u001b[21;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[21;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[22;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[22;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mselect dictation mode\u001b[0m\u001b[22;74H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose one\u001b[0m\u001b[22;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[22;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[23;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[23;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52melect model\u001b[0m\u001b[23;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose\u001b[0m\u001b[23;73H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mwhisper mode\u001b[0m\u001b[23;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[23;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[24;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[24;68H\u001b[38;2;205;"] +[0.000, "o", "214;244m\u001b[48;2;36;37;52mstreaming dictati\u001b[0m\u001b[24;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[24;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[25;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[25;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlect language\u001b[0m\u001b[25;68H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Cho\u001b[0m\u001b[25;73H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mse transcrip\u001b[0m\u001b[25;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[25;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[26;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[26;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mpause / resume playba\u001b[0m\u001b[26;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[26;78H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voic\u001b[0m\u001b[26;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x p\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[27;50H\u001b[38;2;205;214;244"] +[0.000, "o", "m\u001b[48;2;36;37;52mS\u001b[0m\u001b[27;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtoggle\u001b[0m\u001b[27;59H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Toggle auto text-t\u001b[0m\u001b[27;79H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-speec\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[28;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[28;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mplayback speed\u001b[0m\u001b[28;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose playback\u001b[0m\u001b[28;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52ms\u001b[0m\u001b[0m\u001b[13;52H\u001b[?25h\u001b[?2026l"] +[0.115, "o", "\u001b[?2026h\u001b[?25l\u001b[13;52H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mn\u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[17;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[17;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mselect language\u001b[0m\u001b[17;68H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose transcrip\u001b[0m\u001b[17;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[17;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[18;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[18;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mdictation mode\u001b[0m\u001b[18;74H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Cho\u001b[0m\u001b[18;79H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mse one\u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[19;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[19;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[19;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlect\u001b[0m\u001b[19;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mmicrophone\u001b[0m\u001b[19;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mChoose audio i\u001b[0m\u001b[19;85H\u001b[3"] +[0.000, "o", "8;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[19;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[21;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[21;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mforward 5 seconds\u001b[0m\u001b[21;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mJum\u001b[0m\u001b[21;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[21;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x =\u001b[0m\u001b[22;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mpause / resume streaming dictati\u001b[0m\u001b[23;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mubmi\u001b[0m\u001b[23;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mrecording\u001b[0m\u001b[23;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop reco\u001b[0m\u001b[23;80H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mding,\u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens \u001b[0m\u001b[24;58H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52md (Current Sessio\u001b[0m\u001b[24;76H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m)\u001b[0m\u001b[24;77H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52"] +[0.000, "o", "m \u001b[0m\u001b[24;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mO\u001b[0m\u001b[24;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mC\u001b[0m\u001b[24;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Quota\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mToken\u001b[0m\u001b[25;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m used\u001b[0m\u001b[25;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m(Current Session Tree)\u001b[0m\u001b[25;82H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mO\u001b[0m\u001b[25;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mC\u001b[0m\u001b[25;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Quota\u001b[0m\u001b[26;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;86H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b"] +[0.000, "o", "[0m\u001b[29;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[0m\u001b[13;53H\u001b[?25h\u001b[?2026l"] +[0.612, "o", "\u001b[?2026h\u001b[?25l\u001b[13;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSel\u001b[0m\u001b[13;52H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mct TTS engine\u001b[0m\u001b[15;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSearch\u001b[0m\u001b[15;54H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mPiper (d\u001b[0m\u001b[17;57H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mfau\u001b[0m\u001b[17;61H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt, local, vi+en separate voices)\u001b[0m\u001b[17;93H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mChatterbox (English, voic\u001b[0m\u001b[18;74H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m cloning)\u001b[0m\u001b[18;83H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;86H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;44H\u001b[38;2;137;180;250m\u001b[4"] +[0.000, "o", "8;2;36;37;52m┃\u001b[0m\u001b[19;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[19;46H\u001b[38;2;137;180;250m\u001b[48;2;52;57;72m▪\u001b[0m\u001b[19;47H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mVieNeu-TTS (bilingual vi+en code-switching)\u001b[0m\u001b[19;91H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[20;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b"] +[0.000, "o", "[25;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[26;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.447, "o", "\u001b[?2026h\u001b[?25l\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mChatterbox (English, voice cloning)\u001b[0m\u001b[18;83H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[19;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;46H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m▪\u001b[0m\u001b[19;47H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mVieNeu-TTS (bilingual vi+en code-switching)\u001b[0m\u001b[19;91H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.310, "o", "\u001b[?2026h\u001b[?25l\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[17;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mPiper (default, local, vi+en separate voices)\u001b[0m\u001b[17;93H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mChatterbox (English, voice cloning)\u001b[0m\u001b[18;83H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.694, "o", "\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[1;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[1;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[2;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[2;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[2;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[3;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[3;6H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mHello, are you listening to what I am saying here?\u001b[0m\u001b[3;56H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m "] +[0.000, "o", " \u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[3;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[4;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[4;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[4;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[4;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[5;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[5;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[6;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[6;7H\u001b[38;2;255;255;255m\u001b[48;2;30;3"] +[0.000, "o", "0;46m \u001b[0m\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46mThought: 637ms\u001b[0m\u001b[6;22H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[6;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[6;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[7;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[7;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[8;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[8;7H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[8;8H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mThe user is asking if I'm listening. This is a simple conversational question. No skills needed here - it's just a greeting/check-in.\u001b[0m\u001b[8;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[8;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b["] +[0.000, "o", "8;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[9;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[9;7H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[9;8H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mLet me respond naturally.\u001b[0m\u001b[9;33H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[9;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[9;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[10;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[10;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[11;6H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mYes, I'm here and listening. What can I help you with?\u001b[0m\u001b[11;60H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[11;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[11;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[12;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[12;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[12;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[13;6H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46mBuild\u001b[0m\u001b[13;11H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m · Beam Free · 2.6s · 26.3 tok/s\u001b[0m\u001b[13;43H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[13;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[13;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[14;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[14;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;6H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m+ Tokens: 1 step · latest: 45,684 new · 832 cached · 46,516 total\u001b[0m\u001b[15;71H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[15;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[16;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[17;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[17;144H\u001b[38;2;255;255;255m"] +[0.000, "o", "\u001b[48;2;30;30;46m \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[18;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[18;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[19;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[19;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[20;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[20;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[21;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[21;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[22;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[22;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[23;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[23;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[24;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[24;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[25;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[25;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[26;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[26;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[27;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[28;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b["] +[0.000, "o", "0m\u001b[28;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[29;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[29;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[30;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[30;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[31;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[31;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[32;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[32;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[33;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[33;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[34;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[34;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[34;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[36;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[36;4H\u001b[38;2;255;255;25"] +[0.001, "o", "5m\u001b[48;2;46;46;60m \u001b[0m\u001b[36;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[37;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[37;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[37;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[38;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[38;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[39;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[39;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;6H\u001b[38;2"] +[0.000, "o", ";203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[39;11H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;12H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[39;16H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;17H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[39;18H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;19H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[39;28H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;29H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mOpenCode Go\u001b[0m\u001b[39;40H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;41H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[39;42H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;43H\u001b[38;2;249;226;175m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[39;46H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[40;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[40;4H\u001b[38;2;46;46;60m\u001b[48;2;30;30;46m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[40;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;3H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m~/Code/opencode-voice:master\u001b[0m\u001b[41;31H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;75H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - 5h 100%\u001b[0m\u001b[41;115H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;117H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m46.5K (4%)\u001b[0m\u001b[41;127H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;129H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mctrl+p \u001b[0m\u001b[41;136H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mcommands\u001b[0m\u001b[41;144H\u001b[38;2;255;255;255m\u001b[48;2;30;3"] +[0.000, "o", "0;46m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;2H\u001b[38;2;166;227;161m\u001b[48;2;34;34;50m✓\u001b[0m\u001b[43;3H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m Server\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;12H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m⦿ UI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;18H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;25H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;32H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;81H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTime to first draw: 210.27ms\u001b[0m\u001b[43;109H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.956, "o", "\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[1;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[1;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[2;3H\u001b[38;2;84;68;102m\u001b[48;2;15;15;21m┃\u001b[0m\u001b[2;4H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[2;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[2;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[2;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[3;3H\u001b[38;2;84;68;102m\u001b[48;2;15;15;21m┃\u001b[0m\u001b[3;4H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;6H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mHello,\u001b[0m\u001b[3;12H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;13H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mare\u001b[0m\u001b[3;16H\u001b[38;2;255;255;255m\u001b[48;2"] +[0.000, "o", ";15;15;21m \u001b[0m\u001b[3;17H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21myou\u001b[0m\u001b[3;20H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;21H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mlistening\u001b[0m\u001b[3;30H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;31H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mto\u001b[0m\u001b[3;33H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;34H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mwhat\u001b[0m\u001b[3;38H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;39H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mI\u001b[0m\u001b[3;40H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;41H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mam\u001b[0m\u001b[3;43H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;44H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21msaying\u001b[0m\u001b[3;50H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;51H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mhere?\u001b[0m\u001b[3;56H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[3;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[3;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[4;1H\u001b[38;2;255;255;255"] +[0.001, "o", "m\u001b[48;2;12;12;19m \u001b[0m\u001b[4;3H\u001b[38;2;84;68;102m\u001b[48;2;15;15;21m┃\u001b[0m\u001b[4;4H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[4;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[4;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[4;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[5;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[5;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;6H\u001b[38;2;14;14;21m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[6;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;8H\u001b[38;2;66;61;51m\u001b[48;2;12;12;19mThought:\u001b[0m\u001b[6;16H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;17H\u001b[38;2;66;61;51m\u001b[48;2;12;12;19m637ms\u001b[0m\u001b[6;22H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[6;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[6;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[7;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[7;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;6H\u001b[38;2;14;14;21m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[8;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;8H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mThe\u001b[0m\u001b[8;11H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;12H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19muser\u001b[0m\u001b[8;16H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;17H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mis\u001b[0m\u001b[8;19H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;20H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19masking\u001b[0m\u001b[8;26H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;27H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19"] +[0.000, "o", "mif\u001b[0m\u001b[8;29H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;30H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mI'm\u001b[0m\u001b[8;33H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;34H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mlistening.\u001b[0m\u001b[8;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;45H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mThis\u001b[0m\u001b[8;49H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;50H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mis\u001b[0m\u001b[8;52H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;53H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19ma\u001b[0m\u001b[8;54H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;55H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19msimple\u001b[0m\u001b[8;61H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;62H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mconversational\u001b[0m\u001b[8;76H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;77H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mquestion.\u001b[0m\u001b[8;86H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;87H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mNo\u001b[0m\u001b[8;89H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;90H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mskills\u001b[0m\u001b[8;96H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;97H\u001b[38;2"] +[0.000, "o", ";61;63;73m\u001b[48;2;12;12;19mneeded\u001b[0m\u001b[8;103H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;104H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mhere\u001b[0m\u001b[8;108H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;109H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m-\u001b[0m\u001b[8;110H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;111H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mit's\u001b[0m\u001b[8;115H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;116H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mjust\u001b[0m\u001b[8;120H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;121H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19ma\u001b[0m\u001b[8;122H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;123H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mgreeting/check-in.\u001b[0m\u001b[8;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[8;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;6H\u001b[38;2;14;14;21m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[9;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;8H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mLet\u001b[0m\u001b[9;11H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;12H\u001b[38;2;61;63;73m\u001b[48;2;"] +[0.000, "o", "12;12;19mme\u001b[0m\u001b[9;14H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;15H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mrespond\u001b[0m\u001b[9;22H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;23H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mnaturally.\u001b[0m\u001b[9;33H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[9;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[10;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[10;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;6H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mYes,\u001b[0m\u001b[11;10H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;11H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mI'm\u001b[0m\u001b[11;14H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;15H\u001b[38;2;84;88;100m\u001b[48;2;12;12;1"] +[0.000, "o", "9mhere\u001b[0m\u001b[11;19H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;20H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mand\u001b[0m\u001b[11;23H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;24H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mlistening.\u001b[0m\u001b[11;34H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;35H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mWhat\u001b[0m\u001b[11;39H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;40H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mcan\u001b[0m\u001b[11;43H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;44H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mI\u001b[0m\u001b[11;45H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;46H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mhelp\u001b[0m\u001b[11;50H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;51H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19myou\u001b[0m\u001b[11;54H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;55H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mwith?\u001b[0m\u001b[11;60H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[11;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[12;1H\u001b[38;2"] +[0.000, "o", ";255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[12;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[12;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[12;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[12;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;6H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19mBuild\u001b[0m\u001b[13;11H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;12H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m·\u001b[0m\u001b[13;13H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;14H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mBeam\u001b[0m\u001b[13;18H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;19H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mFree\u001b[0m\u001b[13;23H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;24H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m·\u001b[0m\u001b[13;25H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;26H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m2.6s\u001b[0m\u001b[13;30H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;31H\u001b[38;2;61;63;73m\u001b[48;2;12;12"] +[0.000, "o", ";19m·\u001b[0m\u001b[13;32H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;33H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m26.3\u001b[0m\u001b[13;37H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;38H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mtok/s\u001b[0m\u001b[13;43H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSearch commands\u001b[0m\u001b[13;63H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;97H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mesc\u001b[0m\u001b[13;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[13;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[14;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[14;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[14;143H\u001b[38"] +[0.000, "o", ";2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[14;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;6H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m+\u001b[0m\u001b[15;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;8H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mTokens:\u001b[0m\u001b[15;15H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;16H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m1\u001b[0m\u001b[15;17H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;18H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mstep\u001b[0m\u001b[15;22H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;23H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m·\u001b[0m\u001b[15;24H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;25H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mlatest:\u001b[0m\u001b[15;32H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;33H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m45,684\u001b[0m\u001b[15;39H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;40H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mnew\u001b[0m\u001b[15;43H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mSuggested\u001b[0m\u001b[15;57H\u001b[38;2;25"] +[0.000, "o", "5;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[15;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mSwitch session\u001b[0m\u001b[16;62H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;92H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mctrl+x l\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[16;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[16;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;45H\u001b[38;2"] +[0.000, "o", ";255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mNew session\u001b[0m\u001b[17;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x n\u001b[0m\u001b[17;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[17;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[17;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSwitch model\u001b[0m\u001b[18;60H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x m\u001b[0m\u001b[18;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[18;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m"] +[0.000, "o", "█\u001b[0m\u001b[18;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[19;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mOpen settings\u001b[0m\u001b[19;61H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[19;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[19;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[20;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[20;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[20;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[21;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mLLM Council\u001b[0m\u001b[21;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[21;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[21;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[22;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mLLM Council: Change model\u001b[0m\u001b[22;73H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Pick the model used by all\u001b[0m\u001b[22;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[22;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[22;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[23;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[23;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mSession\u001b[0m\u001b[24;55H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[24;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[24;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[25;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSwi"] +[0.000, "o", "tch session\u001b[0m\u001b[25;62H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x l\u001b[0m\u001b[25;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[25;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[25;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[26;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mNew session\u001b[0m\u001b[26;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x n\u001b[0m\u001b[26;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[26;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[26;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;"] +[0.000, "o", "2;12;12;19m \u001b[0m\u001b[27;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mClear session\u001b[0m\u001b[27;61H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[27;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[28;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mOpen session or project\u001b[0m\u001b[28;71H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+o\u001b[0m\u001b[28;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[28;143H\u001b[38;2;20"] +[0.000, "o", ";21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[28;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[29;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[29;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[29;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[29;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[30;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[30;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b["] +[0.002, "o", "0m\u001b[31;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[31;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[32;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[32;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[33;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[33;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[34;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[34;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[34;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;"] +[0.000, "o", "19m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[36;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[36;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[36;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[37;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[37;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[37;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[38;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[38;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m "] +[0.001, "o", " \u001b[0m\u001b[38;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[39;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[39;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;6H\u001b[38;2;84;68;102m\u001b[48;2;19;19;25mBuild\u001b[0m\u001b[39;11H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;12H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mauto\u001b[0m\u001b[39;16H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;17H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25m·\u001b[0m\u001b[39;18H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;19H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mBeam\u001b[0m\u001b[39;23H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;24H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mFree\u001b[0m\u001b[39;28H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;29H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mOpenCode\u001b[0m\u001b[39;37H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;38H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mGo\u001b[0m\u001b[39;40H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;41H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25m·\u001b[0m\u001b[39;42H\u001b[3"] +[0.000, "o", "8;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;43H\u001b[38;2;103;93;72m\u001b[48;2;19;19;25m\u001b[1mmax\u001b[0m\u001b[39;46H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[40;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m╹\u001b[0m\u001b[40;4H\u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[40;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;3H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m~/Code/opencode-voice:master\u001b[0m\u001b[41;31H\u001b[38;2;255;25"] +[0.000, "o", "5;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;75H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m[trinhchanduybojack@gmail.com]\u001b[0m\u001b[41;105H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;106H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m-\u001b[0m\u001b[41;107H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;108H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m5h\u001b[0m\u001b[41;110H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;111H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m100%\u001b[0m\u001b[41;115H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;117H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m46.5K\u001b[0m\u001b[41;122H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;123H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m(4%)\u001b[0m\u001b[41;127H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;129H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mctrl+p\u001b[0m\u001b[41;135H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;136H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mcommands\u001b[0m\u001b[41;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;2H\u001b[38;2;68;93;66m\u001b[48;2;14;14;21m✓\u001b[0m\u001b[43;3H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;4H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mServer\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;12H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21m⦿\u001b[0m\u001b[43;13H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;14H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mUI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;18H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;25H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;32H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;81H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTime\u001b[0m\u001b[43;85H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;86H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mto\u001b[0m\u001b[43;88H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;89H\u001b[38;2;61;63;7"] +[0.000, "o", "3m\u001b[48;2;14;14;21mfirst\u001b[0m\u001b[43;94H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;95H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mdraw:\u001b[0m\u001b[43;100H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;101H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21m210.27ms\u001b[0m\u001b[43;109H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.009, "o", "\u001b[?2026h\u001b[?25l\u001b[29;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m…\u001b[0m\u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.389, "o", "\u001b[?2026h\u001b[?25l\u001b[13;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[13;49H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[15;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mSidebar\u001b[0m\u001b[15;55H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;82H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mSettings · Session\u001b[0m\u001b[15;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mScrollbar\u001b[0m\u001b[16;57H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSettings · Session\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession · \u001b[0m\u001b[18;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtheme\u001b[0m\u001b[18;92H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSyste\u001b[0m"] +[0.000, "o", "\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSwitch session\u001b[0m\u001b[19;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession · ctrl+x l\u001b[0m\u001b[20;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mShow sidebar\u001b[0m\u001b[20;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession · ctrl+x b\u001b[0m\u001b[21;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mFork session\u001b[0m\u001b[21;93H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession\u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mUsage statistics\u001b[0m\u001b[22;64H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mS\u001b[0m\u001b[22;96H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mstem\u001b[0m\u001b[23;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mClear session\u001b[0m\u001b[23;93H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession\u001b[0m\u001b[24;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mCopy session ID\u001b[0m\u001b[24;93H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession\u001b["] +[0.000, "o", "0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mView statu\u001b[0m\u001b[25;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;83H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSystem · \u001b[0m\u001b[25;99H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52ms\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[26;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlect terminal\u001b[0m\u001b[26;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession · \u001b[0m\u001b[26;99H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m↓\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mRen\u001b[0m\u001b[27;52H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mme se\u001b[0m\u001b[27;58H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52msion\u001b[0m\u001b[27;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession · ctrl+r\u001b[0m\u001b[28;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtt\u001b[0m\u001b[28;58H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mngs\u001b[0m\u001b[28;61H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSystem\u001b[0m\u001b[0m\u001b[13;49H\u001b[?25h\u001b[?2026l"] +[0.129, "o", "\u001b[?2026h\u001b[?25l\u001b[13;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[15;49H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mhow sidebar\u001b[0m\u001b[15;84H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mss\u001b[0m\u001b[15;87H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mon · ctrl+x b\u001b[0m\u001b[16;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mwitch session\u001b[0m\u001b[16;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mss\u001b[0m\u001b[16;87H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mon · ctrl+x l\u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mFork session\u001b[0m\u001b[18;93H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSes\u001b[0m\u001b[18;97H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mion\u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mCopy se\u001b[0m\u001b[19;56H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52msion transcript\u001b[0m\u001b[19;82H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;93H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession\u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mCopy\u001b[0m\u001b[20;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mession ID\u001b[0m\u001b[20;82H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;93H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession\u001b[0m\u001b[21;48H\u001b[38;2;205"] +[0.000, "o", ";214;244m\u001b[48;2;36;37;52mClear se\u001b[0m\u001b[21;57H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52msion\u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mRename session\u001b[0m\u001b[22;62H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession · ctrl+r\u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mExpo\u001b[0m\u001b[23;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt se\u001b[0m\u001b[23;58H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52msion transcript\u001b[0m\u001b[23;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession · ctrl+x x\u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT:\u001b[0m\u001b[24;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mubm\u001b[0m\u001b[24;58H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt recording\u001b[0m\u001b[24;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop recording,\u001b[0m\u001b[24;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-vo\u001b[0m\u001b[24;98H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mce\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mCompac\u001b[0m\u001b[25;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m se\u001b[0m\u001b[25;59H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52msion\u001b[0m\u001b[25;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSes\u001b[0"] +[0.001, "o", "m\u001b[25;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mion\u001b[0m\u001b[25;99H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mJump \u001b[0m\u001b[26;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mo message\u001b[0m\u001b[26;99H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mg\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mCopy la\u001b[0m\u001b[27;56H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt assistant message\u001b[0m\u001b[27;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession ·\u001b[0m\u001b[27;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x y\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mUndo\u001b[0m\u001b[28;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mprev\u001b[0m\u001b[28;58H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mou\u001b[0m\u001b[28;61H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m message\u001b[0m\u001b[28;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSession · ctrl+x u\u001b[0m\u001b[0m\u001b[13;50H\u001b[?25h\u001b[?2026l"] +[0.200, "o", "\u001b[?2026h\u001b[?25l\u001b[13;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt\u001b[0m\u001b[15;49H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mTT:\u001b[0m\u001b[15;53H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mpause / resume streaming dictati\u001b[0m\u001b[15;85H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;86H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mopencode-voice\u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTTS: stop playback\u001b[0m\u001b[16;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop current TT\u001b[0m\u001b[16;83H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m p\u001b[0m\u001b[16;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mVoice notes: start\u001b[0m\u001b[17;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Start continuous l\u001b[0m\u001b[17;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mV\u001b[0m\u001b[18;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mice notes: status\u001b[0m\u001b[18;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Show live-notes r\u001b[0m\u001b[18;86H\u001b[38;2;147;15"] +[0.000, "o", "3;178m\u001b[48;2;36;37;52mopencode-vo\u001b[0m\u001b[18;98H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mce\u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT:\u001b[0m\u001b[19;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mubm\u001b[0m\u001b[19;58H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt recording\u001b[0m\u001b[19;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop recording,\u001b[0m\u001b[19;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-vo\u001b[0m\u001b[19;98H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mce\u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT:\u001b[0m\u001b[20;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtoggle auto-submit\u001b[0m\u001b[20;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Toggle submit\u001b[0m\u001b[20;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-vo\u001b[0m\u001b[20;98H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mce\u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mVoice\u001b[0m\u001b[21;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mnotes: stop\u001b[0m\u001b[21;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop live notes, fl\u001b[0m\u001b[21;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-vo\u001b[0m\u001b[21;98H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mce\u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;5"] +[0.000, "o", "2mUsage statistics\u001b[0m\u001b[22;84H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSystem\u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: sel\u001b[0m\u001b[23;57H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mct dic\u001b[0m\u001b[23;64H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mation mode\u001b[0m\u001b[23;74H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose one\u001b[0m\u001b[23;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mAsk a side qu\u001b[0m\u001b[24;62H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mstion\u001b[0m\u001b[24;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m One-shot answer fr\u001b[0m\u001b[24;87H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mm the\u001b[0m\u001b[24;92H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;93H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSess\u001b[0m\u001b[24;98H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mon\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTTS: replay from start\u001b[0m\u001b[25;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Res\u001b[0m\u001b[25;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-vo\u001b[0m\u001b[25"] +[0.000, "o", ";87H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mce\u001b[0m\u001b[25;99H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m0\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mShow\u001b[0m\u001b[26;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mrelea\u001b[0m\u001b[26;59H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52me highlights\u001b[0m\u001b[26;82H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSystem\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTTS:\u001b[0m\u001b[27;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mselect voice\u001b[0m\u001b[27;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose TTS voice\u001b[0m\u001b[27;82H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTTS:\u001b[0m\u001b[28;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mselect engine\u001b[0m\u001b[28;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose TTS engin\u001b[0m\u001b[28;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[0m\u001b[13;51H\u001b[?25h\u001b[?2026l"] +[1.784, "o", "\u001b[?2026h\u001b[?25l\u001b[15;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: pause / resume streaming dictati\u001b[0m\u001b[15;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[15;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mTTS: stop playback\u001b[0m\u001b[16;66H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Stop current TTS p\u001b[0m\u001b[16;85H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;86H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mopencode-voice\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[0m\u001b[13;51H\u001b[?25h\u001b[?2026l"] +[0.349, "o", "\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[1;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[1;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[2;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[2;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[2;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[3;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[3;6H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mHello, are you listening to what I am saying here?\u001b[0m\u001b[3;56H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m "] +[0.000, "o", " \u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[3;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[4;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[4;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[4;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[4;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[5;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[5;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[6;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[6;7H\u001b[38;2;255;255;255m\u001b[48;2;30;3"] +[0.000, "o", "0;46m \u001b[0m\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46mThought: 637ms\u001b[0m\u001b[6;22H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[6;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[6;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[7;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[7;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[8;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[8;7H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[8;8H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mThe user is asking if I'm listening. This is a simple conversational question. No skills needed here - it's just a greeting/check-in.\u001b[0m\u001b[8;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[8;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b["] +[0.000, "o", "8;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[9;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[9;7H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[9;8H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mLet me respond naturally.\u001b[0m\u001b[9;33H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[9;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[9;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[10;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[10;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[11;6H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mYes, I'm here and listening. What can I help you with?\u001b[0m\u001b[11;60H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[11;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[11;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[12;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[12;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[12;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[13;6H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46mBuild\u001b[0m\u001b[13;11H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m · Beam Free · 2.6s · 26.3 tok/s\u001b[0m\u001b[13;43H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[13;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[13;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[14;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[14;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;6H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m+ Tokens: 1 step · latest: 45,684 new · 832 cached · 46,516 total\u001b[0m\u001b[15;71H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[15;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[16;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[17;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[17;144H\u001b[38;2;255;255;255m"] +[0.000, "o", "\u001b[48;2;30;30;46m \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[18;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[18;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[19;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[19;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[20;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[20;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[21;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[21;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[22;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[22;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[23;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[23;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[24;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[24;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[25;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[25;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[26;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[26;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[27;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[28;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b["] +[0.000, "o", "0m\u001b[28;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[29;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[29;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[30;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[30;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[31;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[31;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[32;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[32;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[33;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[33;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[34;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[34;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[34;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[36;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[36;4H\u001b[38;2;255;255;25"] +[0.000, "o", "5m\u001b[48;2;46;46;60m \u001b[0m\u001b[36;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[37;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[37;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[37;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[38;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[38;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[39;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[39;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;6H\u001b[38;2"] +[0.000, "o", ";203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[39;11H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;12H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[39;16H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;17H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[39;18H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;19H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[39;28H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;29H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mOpenCode Go\u001b[0m\u001b[39;40H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;41H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[39;42H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;43H\u001b[38;2;249;226;175m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[39;46H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[40;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[40;4H\u001b[38;2;46;46;60m\u001b[48;2;30;30;46m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[40;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;3H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m~/Code/opencode-voice:master\u001b[0m\u001b[41;31H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;75H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - 5h 100%\u001b[0m\u001b[41;115H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;117H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m46.5K (4%)\u001b[0m\u001b[41;127H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;129H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mctrl+p \u001b[0m\u001b[41;136H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mcommands\u001b[0m\u001b[41;144H\u001b[38;2;255;255;255m\u001b[48;2;30;3"] +[0.000, "o", "0;46m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;2H\u001b[38;2;166;227;161m\u001b[48;2;34;34;50m✓\u001b[0m\u001b[43;3H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m Server\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;12H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m⦿ UI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;18H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;25H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;32H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;81H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTime to first draw: 210.27ms\u001b[0m\u001b[43;109H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[2.530, "o", "\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[1;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[1;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[2;3H\u001b[38;2;84;68;102m\u001b[48;2;15;15;21m┃\u001b[0m\u001b[2;4H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[2;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[2;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[2;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[3;3H\u001b[38;2;84;68;102m\u001b[48;2;15;15;21m┃\u001b[0m\u001b[3;4H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;6H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mHello,\u001b[0m\u001b[3;12H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;13H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mare\u001b[0m\u001b[3;16H\u001b[38;2;255;255;255m\u001b[48;2"] +[0.001, "o", ";15;15;21m \u001b[0m\u001b[3;17H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21myou\u001b[0m\u001b[3;20H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;21H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mlistening\u001b[0m\u001b[3;30H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;31H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mto\u001b[0m\u001b[3;33H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;34H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mwhat\u001b[0m\u001b[3;38H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;39H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mI\u001b[0m\u001b[3;40H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;41H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mam\u001b[0m\u001b[3;43H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;44H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21msaying\u001b[0m\u001b[3;50H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;51H\u001b[38;2;84;88;100m\u001b[48;2;15;15;21mhere?\u001b[0m\u001b[3;56H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[3;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[3;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[4;1H\u001b[38;2;255;255;255"] +[0.000, "o", "m\u001b[48;2;12;12;19m \u001b[0m\u001b[4;3H\u001b[38;2;84;68;102m\u001b[48;2;15;15;21m┃\u001b[0m\u001b[4;4H\u001b[38;2;255;255;255m\u001b[48;2;15;15;21m \u001b[0m\u001b[4;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[4;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[4;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[5;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[5;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;6H\u001b[38;2;14;14;21m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[6;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;8H\u001b[38;2;66;61;51m\u001b[48;2;12;12;19mThought:\u001b[0m\u001b[6;16H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[6;17H\u001b[38;2;66;61;51m\u001b[48;2;12;12;19m637ms\u001b[0m\u001b[6;22H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[6;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[6;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[7;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[7;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;6H\u001b[38;2;14;14;21m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[8;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;8H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mThe\u001b[0m\u001b[8;11H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;12H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19muser\u001b[0m\u001b[8;16H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;17H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mis\u001b[0m\u001b[8;19H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;20H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19masking\u001b[0m\u001b[8;26H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;27H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19"] +[0.000, "o", "mif\u001b[0m\u001b[8;29H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;30H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mI'm\u001b[0m\u001b[8;33H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;34H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mlistening.\u001b[0m\u001b[8;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;45H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mThis\u001b[0m\u001b[8;49H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;50H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mis\u001b[0m\u001b[8;52H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;53H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19ma\u001b[0m\u001b[8;54H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;55H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19msimple\u001b[0m\u001b[8;61H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;62H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mconversational\u001b[0m\u001b[8;76H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;77H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mquestion.\u001b[0m\u001b[8;86H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;87H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mNo\u001b[0m\u001b[8;89H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;90H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mskills\u001b[0m\u001b[8;96H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;97H\u001b[38;2"] +[0.000, "o", ";61;63;73m\u001b[48;2;12;12;19mneeded\u001b[0m\u001b[8;103H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;104H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mhere\u001b[0m\u001b[8;108H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;109H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m-\u001b[0m\u001b[8;110H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;111H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mit's\u001b[0m\u001b[8;115H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;116H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mjust\u001b[0m\u001b[8;120H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;121H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19ma\u001b[0m\u001b[8;122H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;123H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mgreeting/check-in.\u001b[0m\u001b[8;141H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[8;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[8;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;6H\u001b[38;2;14;14;21m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[9;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;8H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mLet\u001b[0m\u001b[9;11H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;12H\u001b[38;2;61;63;73m\u001b[48;2;"] +[0.000, "o", "12;12;19mme\u001b[0m\u001b[9;14H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;15H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mrespond\u001b[0m\u001b[9;22H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;23H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mnaturally.\u001b[0m\u001b[9;33H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[9;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[9;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[10;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[10;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;6H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mYes,\u001b[0m\u001b[11;10H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;11H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mI'm\u001b[0m\u001b[11;14H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;15H\u001b[38;2;84;88;100m\u001b[48;2;12;12;1"] +[0.000, "o", "9mhere\u001b[0m\u001b[11;19H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;20H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mand\u001b[0m\u001b[11;23H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;24H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mlistening.\u001b[0m\u001b[11;34H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;35H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mWhat\u001b[0m\u001b[11;39H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;40H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mcan\u001b[0m\u001b[11;43H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;44H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mI\u001b[0m\u001b[11;45H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;46H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mhelp\u001b[0m\u001b[11;50H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;51H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19myou\u001b[0m\u001b[11;54H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;55H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mwith?\u001b[0m\u001b[11;60H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[11;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[11;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[12;1H\u001b[38;2"] +[0.000, "o", ";255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[12;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[12;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[12;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[12;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;6H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19mBuild\u001b[0m\u001b[13;11H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;12H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m·\u001b[0m\u001b[13;13H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;14H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mBeam\u001b[0m\u001b[13;18H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;19H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mFree\u001b[0m\u001b[13;23H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;24H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m·\u001b[0m\u001b[13;25H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;26H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m2.6s\u001b[0m\u001b[13;30H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;31H\u001b[38;2;61;63;73m\u001b[48;2;12;12"] +[0.000, "o", ";19m·\u001b[0m\u001b[13;32H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;33H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m26.3\u001b[0m\u001b[13;37H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;38H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mtok/s\u001b[0m\u001b[13;43H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSearch commands\u001b[0m\u001b[13;63H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;97H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mesc\u001b[0m\u001b[13;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[13;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[13;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[13;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[14;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[14;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[14;143H\u001b[38"] +[0.000, "o", ";2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[14;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;6H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m+\u001b[0m\u001b[15;7H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;8H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mTokens:\u001b[0m\u001b[15;15H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;16H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m1\u001b[0m\u001b[15;17H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;18H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mstep\u001b[0m\u001b[15;22H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;23H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m·\u001b[0m\u001b[15;24H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;25H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mlatest:\u001b[0m\u001b[15;32H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;33H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m45,684\u001b[0m\u001b[15;39H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;40H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mnew\u001b[0m\u001b[15;43H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mSuggested\u001b[0m\u001b[15;57H\u001b[38;2;25"] +[0.000, "o", "5;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[15;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[15;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mSwitch session\u001b[0m\u001b[16;62H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;92H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mctrl+x l\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[16;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[16;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;45H\u001b[38;2"] +[0.000, "o", ";255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mNew session\u001b[0m\u001b[17;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x n\u001b[0m\u001b[17;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[17;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[17;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSwitch model\u001b[0m\u001b[18;60H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x m\u001b[0m\u001b[18;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[18;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m"] +[0.000, "o", "█\u001b[0m\u001b[18;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[19;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mOpen settings\u001b[0m\u001b[19;61H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[19;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[19;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[20;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[20;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[20;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[21;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mLLM Council\u001b[0m\u001b[21;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[21;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[21;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[22;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mLLM Council: Change model\u001b[0m\u001b[22;73H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Pick the model used by all\u001b[0m\u001b[22;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[22;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[22;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[23;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[23;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m\u001b[1mSession\u001b[0m\u001b[24;55H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[24;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[24;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[25;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSwi"] +[0.000, "o", "tch session\u001b[0m\u001b[25;62H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x l\u001b[0m\u001b[25;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[25;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[25;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[26;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mNew session\u001b[0m\u001b[26;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+x n\u001b[0m\u001b[26;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[26;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[26;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;"] +[0.000, "o", "2;12;12;19m \u001b[0m\u001b[27;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mClear session\u001b[0m\u001b[27;61H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[27;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[28;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mOpen session or project\u001b[0m\u001b[28;71H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mctrl+o\u001b[0m\u001b[28;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[28;143H\u001b[38;2;20"] +[0.001, "o", ";21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[28;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[29;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[29;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[29;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[29;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[30;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[30;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b["] +[0.001, "o", "0m\u001b[31;104H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[31;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[32;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[32;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[33;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[33;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[34;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[34;143H\u001b[38;2;20;21;28m\u001b[48;2;19;19;25m█\u001b[0m\u001b[34;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;"] +[0.000, "o", "19m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[36;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[36;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[36;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[37;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[37;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[37;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[38;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[38;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m "] +[0.000, "o", " \u001b[0m\u001b[38;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[39;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m┃\u001b[0m\u001b[39;4H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;6H\u001b[38;2;84;68;102m\u001b[48;2;19;19;25mBuild\u001b[0m\u001b[39;11H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;12H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mauto\u001b[0m\u001b[39;16H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;17H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25m·\u001b[0m\u001b[39;18H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;19H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mBeam\u001b[0m\u001b[39;23H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;24H\u001b[38;2;84;88;100m\u001b[48;2;19;19;25mFree\u001b[0m\u001b[39;28H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;29H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mOpenCode\u001b[0m\u001b[39;37H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;38H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25mGo\u001b[0m\u001b[39;40H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;41H\u001b[38;2;61;63;73m\u001b[48;2;19;19;25m·\u001b[0m\u001b[39;42H\u001b[3"] +[0.000, "o", "8;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;43H\u001b[38;2;103;93;72m\u001b[48;2;19;19;25m\u001b[1mmax\u001b[0m\u001b[39;46H\u001b[38;2;255;255;255m\u001b[48;2;19;19;25m \u001b[0m\u001b[39;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[40;3H\u001b[38;2;84;68;102m\u001b[48;2;12;12;19m╹\u001b[0m\u001b[40;4H\u001b[38;2;19;19;25m\u001b[48;2;12;12;19m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[40;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;3H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m~/Code/opencode-voice:master\u001b[0m\u001b[41;31H\u001b[38;2;255;25"] +[0.000, "o", "5;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;75H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m[trinhchanduybojack@gmail.com]\u001b[0m\u001b[41;105H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;106H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m-\u001b[0m\u001b[41;107H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;108H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m5h\u001b[0m\u001b[41;110H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;111H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19m100%\u001b[0m\u001b[41;115H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;117H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m46.5K\u001b[0m\u001b[41;122H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;123H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19m(4%)\u001b[0m\u001b[41;127H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;129H\u001b[38;2;84;88;100m\u001b[48;2;12;12;19mctrl+p\u001b[0m\u001b[41;135H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[41;136H\u001b[38;2;61;63;73m\u001b[48;2;12;12;19mcommands\u001b[0m\u001b[41;144H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m "] +[0.000, "o", " \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;2H\u001b[38;2;68;93;66m\u001b[48;2;14;14;21m✓\u001b[0m\u001b[43;3H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;4H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mServer\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;12H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21m⦿\u001b[0m\u001b[43;13H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;14H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mUI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;18H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;25H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;32H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;81H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mTime\u001b[0m\u001b[43;85H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;86H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mto\u001b[0m\u001b[43;88H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;89H\u001b[38;2;61;63;7"] +[0.000, "o", "3m\u001b[48;2;14;14;21mfirst\u001b[0m\u001b[43;94H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;95H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21mdraw:\u001b[0m\u001b[43;100H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[43;101H\u001b[38;2;61;63;73m\u001b[48;2;14;14;21m210.27ms\u001b[0m\u001b[43;109H\u001b[38;2;255;255;255m\u001b[48;2;14;14;21m \u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.003, "o", "\u001b[?2026h\u001b[?25l\u001b[29;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m…\u001b[0m\u001b[0m\u001b[13;48H\u001b[?25h\u001b[?2026l"] +[0.742, "o", "\u001b[?2026h\u001b[?25l\u001b[13;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt\u001b[0m\u001b[13;49H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[15;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mWindow title\u001b[0m\u001b[15;60H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;81H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mSettings · Terminal\u001b[0m\u001b[15;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSwitch theme\u001b[0m\u001b[16;60H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSystem\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Today)\u001b[0m\u001b[17;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens\u001b[0m\u001b[18;55H\u001b[38;2;205;214;244m\u001b[48;"] +[0.000, "o", "2;36;37;52mused (All Time)\u001b[0m\u001b[18;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mLeader \u001b[0m\u001b[19;56H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mimeout\u001b[0m\u001b[19;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSettings · Input\u001b[0m\u001b[20;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Last 7 Days)\u001b[0m\u001b[20;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[21;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTPS\u001b[0m\u001b[21;51H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSettings · Session\u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Last 24 Hours)\u001b[0m\u001b[22;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCo\u001b[0m\u001b[22;93H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52me Quota\u001b[0m\u001b[23;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Last 30 Days)\u001b[0m\u001b["] +[0.000, "o", "23;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[24;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Current Session)\u001b[0m\u001b[24;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens\u001b[0m\u001b[25;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mused (Current Session Tree)\u001b[0m\u001b[25;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mOpenCode Quota Token Report\u001b[0m\u001b[26;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mExit th\u001b[0m\u001b[27;56H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m app\u001b[0m\u001b[27;60H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSystem · ctrl+c, ctrl+d, ctrl+x q\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mIndicators\u001b[0m\u001b[28;58H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;85H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSettings · Tabs\u001b[0m\u001b[0m\u001b[13;49H\u001b[?25h\u001b[?2026l"] +[0.116, "o", "\u001b[?2026h\u001b[?25l\u001b[13;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt\u001b[0m\u001b[15;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mTTS: toggle\u001b[0m\u001b[15;59H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Toggle auto text-to-sp\u001b[0m\u001b[15;83H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mec\u001b[0m\u001b[15;85H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;86H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mopencod\u001b[0m\u001b[15;94H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m-voice\u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTTS: select voice\u001b[0m\u001b[16;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose TTS voice\u001b[0m\u001b[16;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[17;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: \u001b[0m\u001b[17;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtop playback\u001b[0m\u001b[17;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop current TTS p\u001b[0m\u001b[17;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[17;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[17;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[18;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: playback speed\u001b[0m\u001b[18;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose "] +[0.000, "o", "playback s\u001b[0m\u001b[18;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[18;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[18;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTTS: select engine\u001b[0m\u001b[19;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose TTS engine \u001b[0m\u001b[19;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mope\u001b[0m\u001b[19;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mcode-voice\u001b[0m\u001b[20;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: rewin\u001b[0m\u001b[20;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m5 seconds\u001b[0m\u001b[20;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Jump\u001b[0m\u001b[20;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[20;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x -\u001b[0m\u001b[21;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[21;51H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m: replay from start\u001b[0m\u001b[21;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Res\u001b[0m\u001b[21;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-vo\u001b[0m\u001b[21;87H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mce · ctrl+x 0\u001b[0m\u001b[22;49H"] +[0.000, "o", "\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: forward 5 \u001b[0m\u001b[22;64H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52meconds\u001b[0m\u001b[22;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Jum\u001b[0m\u001b[22;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[22;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x =\u001b[0m\u001b[23;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: \u001b[0m\u001b[23;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mpeak last response\u001b[0m\u001b[23;72H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m R\u001b[0m\u001b[23;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[23;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x ]\u001b[0m\u001b[24;49H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTS: pa\u001b[0m\u001b[24;58H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m / resume playba\u001b[0m\u001b[24;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[24;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x p\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: \u001b[0m\u001b[25;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52melect\u001b[0m\u001b[25;60H\u001b[38;2;205;214;244m\u001b["] +[0.001, "o", "48;2;36;37;52mmodel\u001b[0m\u001b[25;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose whisper mode\u001b[0m\u001b[25;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[25;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[25;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: cancel recordi\u001b[0m\u001b[26;68H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mg\u001b[0m\u001b[26;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Cancel current \u001b[0m\u001b[26;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[26;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[26;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTokens used (Today)\u001b[0m\u001b[27;67H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOpenCode Quota\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: select microphone\u001b[0m\u001b[28;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose audio i\u001b[0m\u001b[28;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[0m\u001b[13;50H\u001b[?25h\u001b[?2026l"] +[0.226, "o", "\u001b[?2026h\u001b[?25l\u001b[13;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[25;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mr\u001b[0m\u001b[25;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mcord/transcribe\u001b[0m\u001b[25;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Tog\u001b[0m\u001b[25;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[25;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x [\u001b[0m\u001b[26;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtoggle\u001b[0m\u001b[26;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52maut\u001b[0m\u001b[26;64H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m-submit\u001b[0m\u001b[26;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Toggle submit\u001b[0m\u001b[27;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: \u001b[0m\u001b[27;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mubmit\u001b[0m\u001b[27;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mrecording\u001b[0m\u001b[27;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop recording,\u001b[0m\u001b[27;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mo\u001b[0m\u001b[27;90H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mc\u001b[0m\u001b[27;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-voice\u001b[0m\u001b[0m\u001b[13;51H\u001b[?25h\u001b[?2026l"] +[0.149, "o", "\u001b[?2026h\u001b[?25l\u001b[13;51H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m \u001b[0m\u001b[0m\u001b[13;52H\u001b[?25h\u001b[?2026l"] +[0.268, "o", "\u001b[?2026h\u001b[?25l\u001b[13;52H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mp\u001b[0m\u001b[15;53H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mselect voice\u001b[0m\u001b[15;65H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Choose TTS v\u001b[0m\u001b[15;79H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mice\u001b[0m\u001b[15;82H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mengine\u001b[0m\u001b[16;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Ch\u001b[0m\u001b[16;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mose \u001b[0m\u001b[16;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mTS engine \u001b[0m\u001b[19;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mpause / resume playba\u001b[0m\u001b[19;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[19;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x p\u001b[0m\u001b[20;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtoggle\u001b[0m\u001b[20;59H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Toggle auto text-to-sp\u001b[0m\u001b[20;83H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mec\u001b[0m\u001b[20;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[20;89H\u001b[38;2;147;153;178m\u001b"] +[0.000, "o", "[48;2;36;37;52mncode-voice\u001b[0m\u001b[21;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mwind\u001b[0m\u001b[21;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m5 seconds\u001b[0m\u001b[21;69H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Jump\u001b[0m\u001b[21;99H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m-\u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mImage \u001b[0m\u001b[23;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mreview\u001b[0m\u001b[23;62H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSettings · Input\u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mOpenCode Quota Tok\u001b[0m\u001b[24;67H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mn Report\u001b[0m\u001b[24;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mOp\u001b[0m\u001b[24;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mnCode Quota\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mPermissi\u001b[0m\u001b[25;57H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mns\u001b[0m\u001b[25;59H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b"] +[0.000, "o", "[0m\u001b[25;82H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSett\u001b[0m\u001b[25;87H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mngs · Session\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[26;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[26;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mspeak l\u001b[0m\u001b[26;61H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[26;63H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m response\u001b[0m\u001b[26;72H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m R\u001b[0m\u001b[26;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[26;78H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voic\u001b[0m\u001b[26;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x ]\u001b[0m\u001b[27;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mrecord/transcribe\u001b[0m\u001b[27;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m T\u001b[0m\u001b[27;73H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mg\u001b[0m\u001b[27;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[27;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x [\u001b[0m\u001b[28;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[28;50H\u001b[38;2;20"] +[0.000, "o", "5;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[28;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mr\u001b[0m\u001b[28;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mplay\u001b[0m\u001b[28;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mfrom start\u001b[0m\u001b[28;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mRes\u001b[0m\u001b[28;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[28;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x 0\u001b[0m\u001b[0m\u001b[13;53H\u001b[?25h\u001b[?2026l"] +[0.154, "o", "\u001b[?2026h\u001b[?25l\u001b[13;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ml\u001b[0m\u001b[15;54H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mtop playback\u001b[0m\u001b[15;66H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m St\u001b[0m\u001b[15;70H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mp current TTS p\u001b[0m\u001b[16;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mplayback spe\u001b[0m\u001b[16;66H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52md\u001b[0m\u001b[16;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Ch\u001b[0m\u001b[16;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mose playback s\u001b[0m\u001b[17;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mpause / resume playba\u001b[0m\u001b[17;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[17;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x p\u001b[0m\u001b[18;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mreplay from start\u001b[0m\u001b[18;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Res\u001b[0m\u001b[18;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[18;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x 0\u001b[0m\u001b[19;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mspeak\u001b[0m\u001b[19"] +[0.000, "o", ";59H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlast response\u001b[0m\u001b[19;72H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m R\u001b[0m\u001b[19;99H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m]\u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[20;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[20;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mselect model\u001b[0m\u001b[20;65H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose whisper mode\u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[21;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[21;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[21;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlect\u001b[0m\u001b[21;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlanguage\u001b[0m\u001b[21;68H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose transcrip\u001b[0m\u001b[21;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[21;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[22;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[22;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mt\u001b[0m\u001b[22;55H\u001b[38;2;205;214;244m\u001b[48;2;36"] +[0.000, "o", ";37;52mggle auto-submit\u001b[0m\u001b[22;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Toggl\u001b[0m\u001b[22;78H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m submit\u001b[0m\u001b[22;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[22;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[23;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mNotifications\u001b[0m\u001b[23;61H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;83H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSet\u001b[0m\u001b[23;87H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mings · Alerts\u001b[0m\u001b[24;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBridge recovery: r\u001b[0m\u001b[24;67H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mad back ChatGPT r\u001b[0m\u001b[24;85H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mBridge r\u001b[0m\u001b[24;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mcovery\u001b[0m\u001b[25;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBridge recovery: ask ChatGPT to fix \u001b[0m\u001b[25;84H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;85H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mBridge recovery\u001b[0m\u001b[26;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBridge recovery: recheck rejected Ch\u001b[0m\u001b[2"] +[0.000, "o", "6;84H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[26;85H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mBridge\u001b[0m\u001b[26;92H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mrecovery\u001b[0m\u001b[27;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[27;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[28;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[29;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[30;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[31;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[0m\u001b[13;54H\u001b[?25h\u001b[?2026l"] +[0.102, "o", "\u001b[?2026h\u001b[?25l\u001b[13;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ma\u001b[0m\u001b[20;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlanguage\u001b[0m\u001b[20;68H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose transcrip\u001b[0m\u001b[21;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtoggle\u001b[0m\u001b[21;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mauto-submit\u001b[0m\u001b[21;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Toggle subm\u001b[0m\u001b[21;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mt\u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mBridge recovery: ask ChatGPT to fix \u001b[0m\u001b[22;84H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;85H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mBridge r\u001b[0m\u001b[22;94H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mcovery\u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;83H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[25;44H\u001b[38;2;255;25"] +[0.000, "o", "5;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[26;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[27;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[28;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[0m\u001b[13;55H\u001b[?25h\u001b[?2026l"] +[0.055, "o", "\u001b[?2026h\u001b[?25l\u001b[13;55H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mc\u001b[0m\u001b[15;53H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mreplay from start\u001b[0m\u001b[15;70H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Res\u001b[0m\u001b[15;74H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[15;75H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mopencode-voic\u001b[0m\u001b[15;89H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m · ctrl+x 0\u001b[0m\u001b[16;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mause / resume playba\u001b[0m\u001b[16;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voic\u001b[0m\u001b[16;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m · ctrl+x p\u001b[0m\u001b[17;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlayback speed\u001b[0m\u001b[17;67H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose playback s\u001b[0m\u001b[17;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[17;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[18;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[18;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52ms\u001b[0m\u001b[18;55H\u001b[38;2;205;214"] +[0.000, "o", ";244m\u001b[48;2;36;37;52mlect\u001b[0m\u001b[18;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mlanguage\u001b[0m\u001b[18;68H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choo\u001b[0m\u001b[18;74H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52me transcrip\u001b[0m\u001b[18;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[18;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[19;54H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtop p\u001b[0m\u001b[19;61H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52myback\u001b[0m\u001b[19;66H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Stop current TTS p\u001b[0m\u001b[19;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[19;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[20;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtoggle\u001b[0m\u001b[20;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mauto-submit\u001b[0m\u001b[20;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Toggle subm\u001b[0m\u001b[20;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mt\u001b[0m\u001b[21;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m"] +[0.000, "o", "\u001b[21;86H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[0m\u001b[13;56H\u001b[?25h\u001b[?2026l"] +[0.126, "o", "\u001b[?2026h\u001b[?25l\u001b[13;56H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52me\u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mS\u001b[0m\u001b[16;50H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mT\u001b[0m\u001b[16;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mselect lang\u001b[0m\u001b[16;65H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mage\u001b[0m\u001b[16;68H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose transcrip\u001b[0m\u001b[16;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mop\u001b[0m\u001b[16;89H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mncode-voice\u001b[0m\u001b[18;53H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mtoggle\u001b[0m\u001b[18;60H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mauto-submit\u001b[0m\u001b[18;71H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Toggle subm\u001b[0m\u001b[18;84H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mt\u001b[0m\u001b[19;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;86H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m "] +[0.000, "o", "\u001b[0m\u001b[20;86H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[22;44H\u001b[38;2;255;255;255m\u001b[48;2;12;12;19m \u001b[0m\u001b[0m\u001b[13;57H\u001b[?25h\u001b[?2026l"] +[1.439, "o", "\u001b[?2026h\u001b[?25l\u001b[15;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mTTS: replay from start\u001b[0m\u001b[15;70H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Res\u001b[0m\u001b[15;74H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;75H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice · ctrl+x 0\u001b[0m\u001b[15;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mSTT: select language\u001b[0m\u001b[16;68H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Choose transcrip\u001b[0m\u001b[16;85H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[16;86H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mopencode-voice\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[0m\u001b[13;57H\u001b[?25h\u001b[?2026l"] +[0.245, "o", "\u001b[?2026h\u001b[?25l\u001b[16;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSTT: select language\u001b[0m\u001b[16;68H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52m Choose transcrip\u001b[0m\u001b[16;85H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;86H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mopencode-voice\u001b[0m\u001b[16;100H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[17;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72mTTS: playback speed\u001b[0m\u001b[17;67H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72m Choose playback s\u001b[0m\u001b[17;85H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[17;86H\u001b[38;2;138;148;164m\u001b[48;2;52;57;72mopencode-voice\u001b[0m\u001b[17;100H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[0m\u001b[13;57H\u001b[?25h\u001b[?2026l"] +[0.306, "o", "\u001b[?2026h\u001b[?25l\u001b[13;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mSelect playback speed\u001b[0m\u001b[15;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;48H\u001b[38;2;147;153;178m\u001b[48;2;36;37;52mSearch\u001b[0m\u001b[15;54H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[15;75H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;48H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[16;86H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m0.75x\u001b[0m\u001b[17;53H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;46H\u001b[38;2;137;180;250m\u001b[48;2;52;57;72m▪\u001b[0m\u001b[18;47H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72m1x\u001b[0m\u001b[18;50H\u001b[38;2;2"] +[0.000, "o", "55;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[19;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m1.25x\u001b[0m\u001b[20;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m1.5x\u001b[0m\u001b[21;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m1.75x\u001b[0m\u001b[21;53H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m2x\u001b[0m\u001b[22;50H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[23;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[24;44H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.715, "o", "\u001b[?2026h\u001b[?25l\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[17;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72m0.75x\u001b[0m\u001b[17;53H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;46H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m▪\u001b[0m\u001b[18;47H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m1x\u001b[0m\u001b[18;50H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.202, "o", "\u001b[?2026h\u001b[?25l\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m0.75x\u001b[0m\u001b[17;53H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[22;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72m2x\u001b[0m\u001b[22;50H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.393, "o", "\u001b[?2026h\u001b[?25l\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[17;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72m0.75x\u001b[0m\u001b[17;53H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[22;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[22;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m2x\u001b[0m\u001b[22;50H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.142, "o", "\u001b[?2026h\u001b[?25l\u001b[17;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[17;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m0.75x\u001b[0m\u001b[17;53H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;46H\u001b[38;2;137;180;250m\u001b[48;2;52;57;72m▪\u001b[0m\u001b[18;47H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72m1x\u001b[0m\u001b[18;50H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.234, "o", "\u001b[?2026h\u001b[?25l\u001b[18;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;46H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m▪\u001b[0m\u001b[18;47H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[18;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m1x\u001b[0m\u001b[18;50H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[19;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72m1.25x\u001b[0m\u001b[19;53H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.111, "o", "\u001b[?2026h\u001b[?25l\u001b[19;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[19;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m1.25x\u001b[0m\u001b[19;53H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[20;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72m1.5x\u001b[0m\u001b[20;52H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.159, "o", "\u001b[?2026h\u001b[?25l\u001b[20;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;45H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[20;48H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52m1.5x\u001b[0m\u001b[20;52H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[21;44H\u001b[38;2;137;180;250m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[21;45H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[21;48H\u001b[38;2;205;214;244m\u001b[48;2;52;57;72m1.75x\u001b[0m\u001b[21;53H\u001b[38;2;255;255;255m\u001b[48;2;52;57;72m \u001b[0m\u001b[0m\u001b[15;48H\u001b[?25h\u001b[?2026l"] +[0.758, "o", "\u001b[?2026h\u001b[?25l\u001b[1;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[1;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[1;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[2;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[2;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[2;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[2;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[3;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[3;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[3;6H\u001b[38;2;205;214;244m\u001b[48;2;36;37;52mHello, are you listening to what I am saying here?\u001b[0m\u001b[3;56H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m "] +[0.001, "o", " \u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[3;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[4;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;3H\u001b[38;2;203;166;247m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[4;4H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[4;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[4;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[5;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[5;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[5;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[6;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[6;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[6;7H\u001b[38;2;255;255;255m\u001b[48;2;30;3"] +[0.000, "o", "0;46m \u001b[0m\u001b[6;8H\u001b[38;2;161;148;123m\u001b[48;2;30;30;46mThought: 637ms\u001b[0m\u001b[6;22H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[6;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[6;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[7;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[7;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[7;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[8;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[8;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[8;7H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[8;8H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mThe user is asking if I'm listening. This is a simple conversational question. No skills needed here - it's just a greeting/check-in.\u001b[0m\u001b[8;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[8;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b["] +[0.000, "o", "8;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[9;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[9;6H\u001b[38;2;34;34;50m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[9;7H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[9;8H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mLet me respond naturally.\u001b[0m\u001b[9;33H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[9;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[9;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[10;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[10;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[10;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[11;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[11;6H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mYes, I'm here and listening. What can I help you with?\u001b[0m\u001b[11;60H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[11;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[11;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[12;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[12;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[12;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[13;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[13;6H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46mBuild\u001b[0m\u001b[13;11H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m · Beam Free · 2.6s · 26.3 tok/s\u001b[0m\u001b[13;43H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[13;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[13;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[14;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[14;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[14;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[15;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;6H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m+ Tokens: 1 step · latest: 45,684 new · 832 cached · 46,516 total\u001b[0m\u001b[15;71H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[15;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[15;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[16;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[16;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[16;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[17;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[17;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[17;144H\u001b[38;2;255;255;255m"] +[0.000, "o", "\u001b[48;2;30;30;46m \u001b[18;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[18;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[18;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[19;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[19;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[19;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[20;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[20;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[20;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[21;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[21;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[21;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[22;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[22;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[22;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[23;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[23;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[23;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[24;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[24;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[24;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[25;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[25;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[25;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[26;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[26;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[26;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[27;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[27;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[27;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[28;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[28;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b["] +[0.000, "o", "0m\u001b[28;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[29;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[29;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[29;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[30;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[30;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[30;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[31;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[31;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[31;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[32;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m "] +[0.000, "o", " \u001b[0m\u001b[32;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[32;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[33;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[33;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[33;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[34;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[34;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[34;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[35;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[36;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[36;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[36;4H\u001b[38;2;255;255;25"] +[0.000, "o", "5m\u001b[48;2;46;46;60m \u001b[0m\u001b[36;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[37;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[37;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[37;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[37;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[38;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[38;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[38;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[38;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[39;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[39;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[39;4H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;6H\u001b[38;2"] +[0.000, "o", ";203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[39;11H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;12H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mauto\u001b[0m\u001b[39;16H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;17H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[39;18H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;19H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[39;28H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;29H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mOpenCode Go\u001b[0m\u001b[39;40H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;41H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60m·\u001b[0m\u001b[39;42H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;43H\u001b[38;2;249;226;175m\u001b[48;2;46;46;60m\u001b[1mmax\u001b[0m\u001b[39;46H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[39;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[40;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[40;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[40;4H\u001b[38;2;46;46;60m\u001b[48;2;30;30;46m▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀"] +[0.000, "o", "▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀\u001b[0m\u001b[40;144H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[41;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;3H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m~/Code/opencode-voice:master\u001b[0m\u001b[41;31H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;75H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[trinhchanduybojack@gmail.com] - 5h 100%\u001b[0m\u001b[41;115H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;117H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46m46.5K (4%)\u001b[0m\u001b[41;127H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[41;129H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46mctrl+p \u001b[0m\u001b[41;136H\u001b[38;2;147;153;178m\u001b[48;2;30;30;46mcommands\u001b[0m\u001b[41;144H\u001b[38;2;255;255;255m\u001b[48;2;30;3"] +[0.000, "o", "0;46m \u001b[42;1H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[43;1H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;2H\u001b[38;2;166;227;161m\u001b[48;2;34;34;50m✓\u001b[0m\u001b[43;3H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m Server\u001b[0m\u001b[43;10H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;12H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m⦿ UI\u001b[0m\u001b[43;16H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;18H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTheme\u001b[0m\u001b[43;23H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;25H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTools\u001b[0m\u001b[43;30H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;32H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mExperiments\u001b[0m\u001b[43;43H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[43;81H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50mTime to first draw: 210.27ms\u001b[0m\u001b[43;109H\u001b[38;2;255;255;255m\u001b[48;2;34;34;50m \u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.534, "o", "\u001b[?2026h\u001b[?25l\u001b[43;12H\u001b[38;2;147;153;178m\u001b[48;2;34;34;50m○\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.334, "o", "\u001b[?2026h\u001b[?25l\u001b[36;3H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[37;3H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[38;3H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[39;3H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[39;6H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[39;19H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mBeam Free\u001b[0m\u001b[40;3H\u001b[38;2;49;50;68m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.091, "o", "\u001b[?2026h\u001b[?25l\u001b[2;112H\u001b[38;2;148;226;213m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[2;113H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[2;143H\u001b[38;2;148;226;213m\u001b[48;2;46;46;60m┃\u001b[0m\u001b[3;112H\u001b[38;2;148;226;213m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[3;113H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;115H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mNormalizing response...\u001b[0m\u001b[3;138H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;140H\u001b[38;2;147;153;178m\u001b[48;2;46;46;60mx\u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;143H\u001b[38;2;148;226;213m\u001b[48;2;46;46;60m┃\u001b[0m\u001b[4;112H\u001b[38;2;148;226;213m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[4;113H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[4;143H\u001b[38;2;148;226;213m\u001b[48;2;46;46;60m┃\u001b[0m\u001b[36;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[37;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[38;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[39;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m┃\u001b[0m\u001b[39;6H\u001b[38;2;203;166;247m\u001b[48;2;46;46;60mBuild\u001b[0m\u001b[39;19H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mB"] +[0.000, "o", "eam Free\u001b[0m\u001b[40;3H\u001b[38;2;203;166;247m\u001b[48;2;30;30;46m╹\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.319, "o", "\u001b[?2026h\u001b[?25l\u001b[2;112H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[2;124H\u001b[38;2;148;226;213m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[3;112H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[3;124H\u001b[38;2;148;226;213m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[3;125H\u001b[38;2;255;255;255m\u001b[48;2;46;46;60m \u001b[0m\u001b[3;127H\u001b[38;2;205;214;244m\u001b[48;2;46;46;60mSpeaking\u001b[0m\u001b[4;112H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[4;124H\u001b[38;2;148;226;213m\u001b[48;2;36;37;52m┃\u001b[0m\u001b[34;143H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[35;4H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m… Loading voice.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.498, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.499, "o", "\u001b[?2026h\u001b[?25l\u001b[35;21H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.502, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.501, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;21H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.498, "o", "\u001b[?2026h\u001b[?25l\u001b[2;124H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[2;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[2;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[3;124H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[3;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[3;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[4;124H\u001b[38;2;255;255;255m\u001b[48;2;36;37;52m \u001b[0m\u001b[4;141H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[4;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.016, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.486, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;21H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.501, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.502, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;21H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.502, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;21H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.501, "o", "\u001b[?2026h\u001b[?25l\u001b[35;21H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.503, "o", "\u001b[?2026h\u001b[?25l\u001b[35;21H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.499, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.503, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;21H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.501, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.501, "o", "\u001b[?2026h\u001b[?25l\u001b[35;20H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.410, "o", "\u001b[?2026h\u001b[?25l\u001b[35;3H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m[⏸]0:00 / 0:03 ░░░░░░░░░░░░░░░░░░░░[-5s][+5s][1x]\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.090, "o", "\u001b[?2026h\u001b[?25l\u001b[35;18H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m█\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.501, "o", "\u001b[?2026h\u001b[?25l\u001b[35;19H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m███\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.500, "o", "\u001b[?2026h\u001b[?25l\u001b[35;9H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m1\u001b[0m\u001b[35;22H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m███\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.501, "o", "\u001b[?2026h\u001b[?25l\u001b[35;25H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m███\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.490, "o", "\u001b[?2026h\u001b[?25l\u001b[35;9H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m2\u001b[0m\u001b[35;28H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m███\u001b[0m\u001b[35;50H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m.25x]\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.512, "o", "\u001b[?2026h\u001b[?25l\u001b[35;31H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m████\u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.105, "o", "\u001b[?2026h\u001b[?25l\u001b[35;35H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m█\u001b[0m\u001b[35;51H\u001b[38;2;205;214;244m\u001b[48;2;30;30;46m5x]\u001b[0m\u001b[35;54H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[0.328, "o", "\u001b[?2026h\u001b[?25l\u001b[34;143H\u001b[38;2;49;50;68m\u001b[48;2;46;46;60m█\u001b[0m\u001b[35;3H\u001b[38;2;255;255;255m\u001b[48;2;30;30;46m \u001b[0m\u001b[0m\u001b[37;6H\u001b[?25h\u001b[?2026l"] +[4.344, "o", "\u001b]0;\u0007"] +[0.000, "o", "\u001b[?25h\u001b[0m\u001b]22;\u001b\\\u001b[ + + + + + + + + + + +EOF +echo "written" \ No newline at end of file diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..338dac8 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,1269 @@ + + + + + + opencode-voice — Speak to OpenCode. Hear it answer. + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+
+
+

Voice in.
Voice out.

+

+ A voice plugin for OpenCode. Dictate prompts, check transcripts, and hear coding-agent + replies without leaving your terminal. +

+
+ +
+
+
+ + + +
+
+ OpenCode · voice workflowREAL SESSION · NO AUDIO +
+ Animated terminal capture: configure voice, dictate a prompt, receive an answer, and play speech. +
+ The real workflow, captured in the terminal.Dictate +
+
+
+
+

+ One continuous session. Your eyes stay on the code while speech moves through the same + prompt-and-response loop. +

+
+ +

Dictate the whole thought.

+

+ Local whisper.cpp turns speech into text. Streaming mode shows words as you speak, + with the unfinished tail marked separately. +

+ /stt-record · start recording +
+
+ +

Read it. Edit it. Then send.

+

+ By default, the transcript lands at your cursor as editable text. Submit it when + ready; auto-submit and conversation mode are optional. +

+ Transcript → prompt editor → you decide +
+
+ +

Let the reply speak.

+

+ Choose Piper, Chatterbox, or VieNeu for speech output. Pause, replay, seek, and change + playback speed from the terminal. +

+ Piper · Chatterbox · VieNeu +
+
+ +

Talk through a whole turn.

+

+ Conversation mode listens, waits for the completed agent reply, speaks it, then + listens again. Interrupt or pause whenever you need. +

+ listen → think → speak → listen +
+
+
+
+
+

Built for your terminal.

+

+ Voice controls live beside your OpenCode session. Choose the pieces that fit how you + work; you do not need to use every mode. +

+
+
+
+ +

Live dictation

+

+ Watch a live waveform and transcript. Pause recording, use auto-end, or submit when + you choose. +

+
+
+ +

Speech that handles code

+

+ Normalize code-heavy replies into speakable phrasing, then choose a local voice engine + for playback. +

+
+
+ +

Vietnamese + English

+

+ VieNeu-TTS supports Vietnamese and English code-switching in a single utterance. Pick + from 25 voices. +

+
+
+ +

Your phone can be the mic

+

+ Route capture and playback through your own SSH audio commands when the computer's mic + is not convenient. +

+
+
+
+
+
+
+

Keep your model setup.

+

+ Text normalization uses the endpoint and model you configure. The plugin does not + replace your coding model or require a specific provider. +

+
+
+
+ OpenAI +
+
+ Claude +
+
+ Gemini +
+
+ DeepSeek +
+
+ Meta AI +
+
+ OpenRouter +
+
+

+ Provider names are examples, not endorsements or partnership claims. Configure an + endpoint compatible with the plugin's OpenAI Chat Completions client; compatibility + varies by provider. +

+
+
+
+
+

Set up your voice.

+

+ Install the plugin in OpenCode, then configure a compatible text endpoint and your local + speech tools. Full OS-specific steps and both host versions are in the setup guide. +

+ Read the installation guide +
+
+
+
OpenCode v1 · partial config example
+
{
+  "plugin": [
+    ["@bojackduy/opencode-voice", {
+      "endpoint": "YOUR_OPENAI_COMPATIBLE_ENDPOINT",
+      "model": "YOUR_MODEL"
+    }]
+  ]
+}
+
+

+ Example only. Add the API key environment variable and local audio prerequisites from + the guide. +

+
+
+
+

Questions, answered.

+
+
+ Does it send my transcript automatically? +

+ Not by default. Dictation inserts editable text at your cursor. Auto-submit and + conversation mode can submit as part of their configured behavior. +

+
+
+ Does audio leave my machine? +

+ Default speech recognition and synthesis use local tools. Text normalization calls + your configured LLM endpoint; hosted speech recognition is optional. +

+
+
+ Can I use it hands-free? +

+ Conversation mode listens, waits for the completed agent turn, speaks the reply, and + listens again. You can pause or interrupt it. +

+
+
+ Does it support Vietnamese? +

+ VieNeu-TTS supports Vietnamese and English code-switching. Available language support + depends on the selected speech engine and voice. +

+
+
+ Which OpenCode hosts work? +

+ The plugin supports OpenCode v1 and v2. See the installation guide for the config + format and prerequisites for your host. +

+
+
+
+
+
+
+

Keep your hands in flow.

+

+ Open source voice tools for your OpenCode session. Read the setup, inspect the code, + make it yours. +

+
+ Open the GitHub project +
+
+
+ + + + diff --git a/docs/logo.html b/docs/logo.html new file mode 100644 index 0000000..49284ea --- /dev/null +++ b/docs/logo.html @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/docs/logo.png b/docs/logo.png new file mode 100644 index 0000000..9122bf8 Binary files /dev/null and b/docs/logo.png differ diff --git a/docs/logo.svg b/docs/logo.svg new file mode 100644 index 0000000..1c31687 --- /dev/null +++ b/docs/logo.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + + + +EOF +echo written; ls docs/ \ No newline at end of file diff --git a/docs/og.html b/docs/og.html new file mode 100644 index 0000000..3342005 --- /dev/null +++ b/docs/og.html @@ -0,0 +1,102 @@ + + + + + + + + +
+
opencode-voice
+
+ Voice in. Voice out. For OpenCode.
Local-first STT + TTS. Bilingual vi + en. Hands-free + conversation. +
+
▁▃▆█▆▃▁
+
+ local-first + bilingual + AGPL-3.0 + v1 + v2 +
+
+
+ + diff --git a/docs/og.png b/docs/og.png new file mode 100644 index 0000000..2a2dbf5 Binary files /dev/null and b/docs/og.png differ diff --git a/docs/robots.txt b/docs/robots.txt new file mode 100644 index 0000000..5df6c96 --- /dev/null +++ b/docs/robots.txt @@ -0,0 +1,4 @@ +User-agent: * +Allow: / + +Sitemap: https://bojackduy.github.io/opencode-voice/sitemap.xml \ No newline at end of file diff --git a/docs/screenshots/landing-desktop.png b/docs/screenshots/landing-desktop.png new file mode 100644 index 0000000..c6de548 Binary files /dev/null and b/docs/screenshots/landing-desktop.png differ diff --git a/docs/screenshots/landing-mobile.png b/docs/screenshots/landing-mobile.png new file mode 100644 index 0000000..d3c1890 Binary files /dev/null and b/docs/screenshots/landing-mobile.png differ diff --git a/docs/sitemap.xml b/docs/sitemap.xml new file mode 100644 index 0000000..b015940 --- /dev/null +++ b/docs/sitemap.xml @@ -0,0 +1,9 @@ + + + + https://bojackduy.github.io/opencode-voice/ + 2026-10-30 + weekly + 1.0 + + \ No newline at end of file diff --git a/docs/technical.md b/docs/technical.md new file mode 100644 index 0000000..a5ffa72 --- /dev/null +++ b/docs/technical.md @@ -0,0 +1,158 @@ +# opencode-voice — technical guide + +## Prerequisites + +### Speech-to-text + +macOS: + +```bash +brew install sox whisper-cpp +sox -d /tmp/mic-check.wav trim 0 3 && play /tmp/mic-check.wav && rm /tmp/mic-check.wav +``` + +The first `sox -d` triggers the macOS microphone permission prompt (System +Settings → Privacy & Security → Microphone). + +Linux / WSL2: `sudo apt install sox libsox-fmt-pulse pulseaudio-utils`, then +build whisper.cpp (`whisper-server` and `whisper-cli` targets) and put the +binaries on `PATH`. On WSL2 the Windows mic arrives through WSLg's PulseAudio; +`wsl --shutdown` fixes a stuck PulseAudio. + +Download a model (the plugin prefers large-v3-turbo): + +```bash +mkdir -p ~/.local/share/whisper-cpp +curl -L -o ~/.local/share/whisper-cpp/ggml-large-v3-turbo-q5_0.bin \ + https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-large-v3-turbo-q5_0.bin +``` + +### Text-to-speech + +Piper (fallback, and the engine for `/tts-engine piper`): + +```bash +uv tool install piper-tts +mkdir -p ~/.local/share/piper-voices && cd ~/.local/share/piper-voices +base=https://huggingface.co/rhasspy/piper-voices/resolve/main +for f in en/en_US/ryan/high/en_US-ryan-high vi/vi_VN/vais1000/medium/vi_VN-vais1000-medium; do + curl -LO "$base/$f.onnx"; curl -LO "$base/$f.onnx.json" +done +``` + +VieNeu-TTS (natural Vietnamese + English, default engine): + +```bash +python3 -m venv ~/.local/share/opencode-voice/vieneu-venv +~/.local/share/opencode-voice/vieneu-venv/bin/pip install vieneu +``` + +The plugin starts the VieNeu server itself (`src/tts/vieneu_server.py`) on the +first free port from 8000, in a private working directory. The first start +downloads and loads the model (about 10 s once cached). If it fails, the +reason is shown once and Piper reads for the next two minutes while VieNeu +retries in the background. + +### Phone mic and speaker (optional) + +With Termux + `openssh` on an Android phone, set + +```jsonc +"sttCaptureCmd": ["ssh", "-p", "8022", "u0_a368@localhost", "$HOME/bin/capture.sh", "16000"], +"ttsPlayCmd": ["ssh", "-p", "8022", "u0_a368@localhost", "$HOME/bin/playback.sh", "16000"] +``` + +`capture.sh RATE` must print raw signed 16-bit mono PCM at RATE to stdout; +`playback.sh RATE` must play the same format from stdin. When the ssh target +is `localhost`/`127.0.0.1`, the plugin runs `adb forward tcp:PORT tcp:PORT` +for the single attached physical device first. Pick the phone with `/stt-mic` +and `/tts-output`. If ssh exits with 255 the status says so and suggests +checking the cable, the forward, and `sshd` in Termux. + +## Voice node + +`src/node/` is a small daemon (`bun src/node/main.ts`, port 47800) that owns +engines, microphones and speakers. Plugins talk to it with HTTP (transcribe, +synth, info, home) and two WebSockets (`/v1/mic` streams the home device's +PCM, `/v1/player` drives one shared speaker: play/pause/seek/rate/stop). + +- **Devices** (`node.json`): `local` (sox on the node machine), `linux` + (ssh → `pw-cat --record --raw` / `pacat --playback --raw`), `termux` + (ssh → `termux-microphone-record` Opus decoded live by ffmpeg; `play`). + Remote processes are started under the names `ocv-mic` / `ocv-play` so stop + and kill hit exactly them; a dropped connection also stops the phone + recorder and removes its temp file. +- **Presence** (every 3 s): macOS `HIDIdleTime`; Linux keyboard/mouse + interrupt counters from `/proc/interrupts` plus `pactl` defaults (a box + whose sink is `auto_null` or without a source has no audio); Android + `dumpsys power`/`window` over adb (screen on, Termux focused) plus + `pidof sshd` (no sshd = the phone is skipped). The USB forward + (`adb forward tcp:8022 tcp:8022`) is checked on every probe and restored + when a replug or adb restart dropped it. +- **Home**: pinned device if usable, else the usable device with the most + recent human input, else the node machine. The speaker is chosen per clip. +- **Discovery**: `voiceNode: "auto"` tries `127.0.0.1:47800`, then every + online computer from `tailscale status --json`. +- **Security**: binds loopback + the Tailscale IP only; a peer must be in + 100.64.0.0/10 (or the tailnet IPv6 range) and `tailscale whois` must report + the same login as the node. Logs never contain transcript or speech text. + +Gotchas found on real devices: `pw-cat`/`pacat` choose their mode from +argv0, so the mode and `--raw` flags must be explicit; Android silences the +mic of background apps and with the screen off (the mic then streams pure +zeros, which the plugin reports); a phone hearing its own speaker is heavily +attenuated by echo cancellation. + +## LLM + +Clean-up (`/stt-normalize`), Fix and reply preparation use, in order: explicit +`endpoint` + `model` options, the `/voice-model` selection, or the session's +current model. Keys come from `apiKey`/`apiKeyEnv` for explicit endpoints; +for OpenCode providers from the provider's env vars or an `api`-type entry in +OpenCode's `auth.json` (OAuth tokens are never used, and a stored key is only +sent to its own provider). Calls time out (20 s clean-up, 30 s Fix, 15 s +replies) and fall back to the raw text. + +## How it works + +``` +key / button ─▶ stt/session.ts ──▶ audio/mic.ts (sox | ssh) + │ batch: PCM ─▶ stt/long.ts ─▶ whisper-server + │ live: stt/streaming.ts (1 s ticks over a 10 s window, + │ transcript.ts joins windows, final full decode) + ├─▶ llm (clean-up / Fix merge) + └─▶ stt/editor.ts (insert / live span / replace) ─▶ submit? + +reply ─▶ tts/session.ts ─▶ tts/text.ts (markdown → speech, vi/en parts) + └─▶ vieneu.ts (fallback piper.ts), next part prefetched ─▶ audio/player.ts +``` + +- Each machine has one operation id. Cancel, a newer start, or a stop bumps + it; late results are dropped, and every path ends in `idle` with a result + shown on the status line. +- Live dictation writes into the focused field in place. If you edit the + field meanwhile, the plugin stops touching it. +- Pause drops incoming audio but keeps the capture running, so a phone mic + never replays paused speech. +- The whisper server is shared by batch and live dictation and released after + 10 idle minutes; VieNeu stays warm while auto-read is on. +- Speed uses `sox tempo -s` locally and `ffmpeg atempo` for the phone, so the + voice keeps its pitch; changing speed or skipping respawns the player at the + current position. Skipping back past the start of a part continues in the + previous part. +- Auto-read speaks a reply once, only in the TUI showing that session, and + waits while you are dictating. + +## Logs + +`~/.cache/opencode-voice/voice.log` (mode 0600, rotated at 1 MB). It records +steps, timings and errors, never transcript or reply text. `/voice-status` +shows the current configuration. + +## Development + +```bash +npm install +npm test # bun test src (fakes only, no audio or network) +npm run check # lint + format + typecheck +``` diff --git a/index.js b/index.js deleted file mode 100644 index 3a324b1..0000000 --- a/index.js +++ /dev/null @@ -1,73 +0,0 @@ -// opencode-voice: Speech-to-text and text-to-speech for OpenCode. -// -// STT: Record voice via sox, transcribe with whisper-cpp, normalize with -// an OpenAI-compatible LLM, append to the TUI prompt. -// -// TTS: Auto-speak assistant responses (or read on demand) via Piper, -// with LLM normalization for natural speech. -// -// Prerequisites: -// STT: brew install whisper-cpp sox -// TTS: Piper binary on PATH, voice models at ~/.local/share/piper-voices/ -// -// Configuration via tui.json plugin options: -// ["opencode-voice", { "endpoint": "...", "model": "...", "apiKeyEnv": "..." }] -// -// Runtime state (model, mic, voice, tts mode) persisted via api.kv. -// -// Commands: -// /stt-record (ctrl+r) - start/stop recording + transcribe -// /stt-submit (leader+r)- stop recording + transcribe + submit -// /stt-stop - cancel recording -// /stt-model - select whisper model -// /stt-language - select transcription language -// /stt-mic - select microphone -// /tts-speak (leader+s)- read last response aloud -// /tts-mode (leader+v) - toggle auto TTS on/off -// /tts-stop (escape) - stop playback -// /tts-voice - select TTS voice - -import fs from "node:fs"; -import os from "node:os"; -import { registerSTT } from "./lib/stt.js"; -import { registerTTS } from "./lib/tts.js"; -import { createClient } from "./lib/llm-client.js"; -import { createLogger } from "./lib/logger.js"; - -function loadPromptFile(filePath, logger, name) { - if (!filePath) return null; - const resolved = filePath.replace(/^~(?=\/|$)/, os.homedir()); - try { - const prompt = fs.readFileSync(resolved, "utf-8").trim() || null; - logger?.log( - "plugin", - prompt ? `Loaded ${name} prompt: ${resolved}` : `Ignored empty ${name} prompt: ${resolved}`, - "debug", - ); - return prompt; - } catch (err) { - logger?.log("Plugin", `Failed to load ${name} prompt ${resolved}: ${err.message}`, "warn"); - return null; - } -} - -export default { - id: "opencode-voice", - tui: async (api, options) => { - const { kv } = api; - const logger = createLogger(api.client); - logger.log("plugin", "Initializing", "debug"); - const { complete } = createClient(options, logger); - - const prompts = { - stt: loadPromptFile(options?.sttPrompt, logger, "STT"), - ttsAuto: loadPromptFile(options?.ttsAutoPrompt, logger, "TTS auto"), - ttsManual: loadPromptFile(options?.ttsManualPrompt, logger, "TTS manual"), - }; - - const sttCommands = registerSTT(api, kv, complete, prompts, options, logger); - const ttsCommands = registerTTS(api, kv, complete, prompts, logger); - - api.command.register(() => [...sttCommands, ...ttsCommands]); - }, -}; diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..ad9e7f7 --- /dev/null +++ b/index.ts @@ -0,0 +1,3 @@ +// opencode-voice: speech-to-text and text-to-speech for OpenCode (v2 TUI). +// The plugin lives in src/; see README.md for setup and commands. +export { default } from "./src/entry.ts"; diff --git a/lib/llm-client.js b/lib/llm-client.js deleted file mode 100644 index f71b495..0000000 --- a/lib/llm-client.js +++ /dev/null @@ -1,165 +0,0 @@ -// OpenAI-compatible LLM client for text normalization. -// -// Works with any OpenAI-compatible endpoint: -// - Anthropic's OpenAI compatibility layer -// - OpenAI directly -// - Ollama, vLLM, LM Studio, etc. -// -// Configuration is passed from plugin options (tui.json): -// ["@renjfk/opencode-voice", { -// "endpoint": "https://api.anthropic.com/v1", -// "model": "claude-haiku-4-5", -// "apiKeyEnv": "ANTHROPIC_API_KEY", -// "maxTokens": 2048, -// "reasoningEffort": "low", -// "chatTemplateKwargs": {"enable_thinking": false}, -// "retries": 2 -// }] - -const DEFAULTS = { - maxTokens: 2048, - reasoningEffort: null, - chatTemplateKwargs: null, - retries: 2, -}; - -function normalizeRetries(value) { - const parsed = Number(value); - if (!Number.isFinite(parsed) || parsed < 0) return DEFAULTS.retries; - return Math.floor(parsed); -} - -function normalizeChatTemplateKwargs(value) { - if (!value) return null; - if (typeof value === "object") return value; - try { - const parsed = JSON.parse(value); - return typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null; - } catch { - return null; - } -} - -function shouldRetry(status) { - return status === 408 || status === 429 || status >= 500; -} - -function wait(ms) { - return new Promise((resolve) => setTimeout(resolve, ms)); -} - -/** - * Create an LLM completion function. - * - * @param {object} [pluginOptions] - Static config from tui.json plugin options - * @param {{ log?: (scope: string, message: string, level?: string) => void }} [logger] - * @returns {{ complete: (opts: { system?: string, prompt: string, config?: object }) => Promise<{ text: string | null, error?: string }> }} - */ -export function createClient(pluginOptions, logger) { - function getConfig() { - return { - endpoint: pluginOptions?.endpoint, - model: pluginOptions?.model, - apiKeyEnv: pluginOptions?.apiKeyEnv, - maxTokens: pluginOptions?.maxTokens ?? DEFAULTS.maxTokens, - reasoningEffort: pluginOptions?.reasoningEffort ?? DEFAULTS.reasoningEffort, - chatTemplateKwargs: normalizeChatTemplateKwargs( - pluginOptions?.chatTemplateKwargs ?? DEFAULTS.chatTemplateKwargs, - ), - retries: normalizeRetries(pluginOptions?.retries ?? DEFAULTS.retries), - }; - } - - /** - * Send a chat completion request to an OpenAI-compatible endpoint. - * - * @param {object} opts - * @param {string} [opts.system] - System prompt - * @param {string} opts.prompt - User message - * @param {object} [opts.config] - Per-call overrides (e.g. { maxTokens: 4096 }) - * @returns {Promise<{ text: string | null, error?: string }>} - */ - async function complete({ system, prompt, config: overrides }) { - const cfg = { ...getConfig(), ...overrides }; - if (!cfg.endpoint) { - logger?.log?.("LLM", "completion skipped: endpoint not configured", "warn"); - return { text: null, error: "LLM endpoint not configured" }; - } - if (!cfg.model) { - logger?.log?.("LLM", "completion skipped: model not configured", "warn"); - return { text: null, error: "LLM model not configured" }; - } - const apiKey = cfg.apiKeyEnv ? process.env[cfg.apiKeyEnv] : null; - - const endpoint = cfg.endpoint.replace(/\/+$/, "") + "/chat/completions"; - - const messages = []; - if (system) messages.push({ role: "system", content: system }); - messages.push({ role: "user", content: prompt }); - - const body = { - model: cfg.model, - max_tokens: cfg.maxTokens, - messages, - }; - if (cfg.reasoningEffort) body.reasoning_effort = cfg.reasoningEffort; - if (cfg.chatTemplateKwargs) body.chat_template_kwargs = cfg.chatTemplateKwargs; - - for (let attempt = 0; attempt <= cfg.retries; attempt++) { - try { - logger?.log?.( - "LLM", - `Completion request attempt=${attempt + 1} model=${cfg.model} maxTokens=${cfg.maxTokens} promptChars=${prompt.length}`, - "debug", - ); - const response = await fetch(endpoint, { - method: "POST", - headers: { - "Content-Type": "application/json", - ...(apiKey ? { Authorization: "Bearer " + apiKey } : {}), - }, - body: JSON.stringify(body), - }); - - if (!response.ok) { - logger?.log?.( - "LLM", - `Completion response status=${response.status}`, - shouldRetry(response.status) ? "warn" : "error", - ); - if (attempt < cfg.retries && shouldRetry(response.status)) { - await wait(250 * 2 ** attempt); - continue; - } - return { text: null, error: `LLM request failed (${response.status})` }; - } - - const data = await response.json(); - const text = data?.choices?.[0]?.message?.content || null; - if (text) { - logger?.log?.("LLM", `Completion succeeded chars=${text.length}`, "debug"); - return { text }; - } - - logger?.log?.("LLM", "Completion returned empty content", "warn"); - - if (attempt < cfg.retries) { - await wait(250 * 2 ** attempt); - continue; - } - return { text: null, error: "Empty LLM response" }; - } catch (err) { - logger?.log?.("LLM", `Completion error attempt=${attempt + 1}: ${err.message}`, "warn"); - if (attempt < cfg.retries) { - await wait(250 * 2 ** attempt); - continue; - } - return { text: null, error: `LLM error: ${err.message}` }; - } - } - - return { text: null, error: "LLM request failed after retries" }; - } - - return { complete }; -} diff --git a/lib/logger.js b/lib/logger.js deleted file mode 100644 index d7a1196..0000000 --- a/lib/logger.js +++ /dev/null @@ -1,18 +0,0 @@ -export function createLogger(client) { - async function log(scope, message, level = "debug") { - try { - await client?.app?.log?.({ - body: { - service: "opencode-voice", - level, - message, - extra: { scope }, - }, - }); - } catch { - // Logging should never interrupt voice features. - } - } - - return { log }; -} diff --git a/lib/session.js b/lib/session.js deleted file mode 100644 index aa23946..0000000 --- a/lib/session.js +++ /dev/null @@ -1,30 +0,0 @@ -// Shared session helpers for OpenCode TUI plugin. - -/** - * Get the title of a specific session by ID. Returns "" if unknown or on error. - */ -export async function getSessionTitle(client, sessionID) { - if (!sessionID) return ""; - try { - const result = await client.session.list(); - const session = result.data?.find((s) => s.id === sessionID); - return session?.title || ""; - } catch { - return ""; - } -} - -/** - * Get the title of the most recently updated session. Returns "" on error or - * when there are no sessions. - */ -export async function getActiveSessionTitle(client) { - try { - const result = await client.session.list(); - if (!result.data || result.data.length === 0) return ""; - const active = result.data.sort((a, b) => b.time.updated - a.time.updated)[0]; - return active?.title || ""; - } catch { - return ""; - } -} diff --git a/lib/stt.js b/lib/stt.js deleted file mode 100644 index 68ebf88..0000000 --- a/lib/stt.js +++ /dev/null @@ -1,822 +0,0 @@ -// Speech-to-text: sox recording, whisper-cpp or API transcription, LLM normalization. - -import fs from "node:fs"; -import path from "node:path"; -import os from "node:os"; -import { spawn, execSync } from "node:child_process"; -import { getActiveSessionTitle } from "./session.js"; - -let sttApiEndpoint = null; -let sttApiModel = null; -let sttApiKeyEnv = null; - -const WAV_FILENAME = "opencode-stt.wav"; -let tmpDir = "/tmp"; - -const MODELS_DIRS = [ - path.join(os.homedir(), ".local", "share", "whisper-cpp"), - "/opt/homebrew/share/whisper-cpp/models", - "/usr/local/share/whisper-cpp/models", -]; - -const MODELS = { - "large-v3-turbo-q5_0": { - label: "Large v3 Turbo Q5 (recommended)", - file: "ggml-large-v3-turbo-q5_0.bin", - }, - "large-v3-turbo-q8_0": { label: "Large v3 Turbo Q8", file: "ggml-large-v3-turbo-q8_0.bin" }, - "large-v3-turbo": { label: "Large v3 Turbo (full)", file: "ggml-large-v3-turbo.bin" }, - "medium-q5_0": { label: "Medium Q5 (multilingual, faster)", file: "ggml-medium-q5_0.bin" }, - "small.en": { label: "Small English", file: "ggml-small.en.bin" }, - small: { label: "Small Multilingual", file: "ggml-small.bin" }, - "base.en": { label: "Base English", file: "ggml-base.en.bin" }, - base: { label: "Base Multilingual", file: "ggml-base.bin" }, - "tiny.en": { label: "Tiny English (fastest)", file: "ggml-tiny.en.bin" }, - tiny: { label: "Tiny Multilingual (fastest)", file: "ggml-tiny.bin" }, -}; -const DEFAULT_MODEL = "large-v3-turbo-q5_0"; - -const DEFAULT_LANGUAGE = "auto"; -// Curated subset for the /stt-language picker; options.sttLanguage accepts any -// whisper.cpp language code. -const LANGUAGES = { - auto: { label: "Auto-detect" }, - en: { label: "English" }, - zh: { label: "Chinese" }, - yue: { label: "Cantonese" }, - ja: { label: "Japanese" }, - ko: { label: "Korean" }, - de: { label: "German" }, - fr: { label: "French" }, - es: { label: "Spanish" }, - pt: { label: "Portuguese" }, - ru: { label: "Russian" }, - it: { label: "Italian" }, -}; -let sttDefaultLanguage = DEFAULT_LANGUAGE; - -export function isOpenRouterEndpoint(endpoint) { - return /(^https?:\/\/)?([^/]+\.)?openrouter\.ai(\/|$)/i.test(endpoint || ""); -} - -function buildMultipartTranscriptionRequest(model, audioBuffer, apiKey) { - const blob = new Blob([audioBuffer], { type: "audio/wav" }); - const form = new FormData(); - form.append("file", blob, "audio.wav"); - form.append("model", model); - form.append("response_format", "json"); - - const headers = {}; - if (apiKey) headers["Authorization"] = "Bearer " + apiKey; - - return { - headers, - body: form, - }; -} - -export function buildOpenRouterTranscriptionRequest(model, audioBuffer, apiKey) { - const headers = { "Content-Type": "application/json" }; - if (apiKey) headers["Authorization"] = "Bearer " + apiKey; - - const payload = { - model, - input_audio: { - data: audioBuffer.toString("base64"), - format: "wav", - }, - }; - - return { - headers, - body: JSON.stringify(payload), - }; -} - -function getModelsDir() { - for (const dir of MODELS_DIRS) { - if (fs.existsSync(dir)) return dir; - } - return MODELS_DIRS[0]; -} - -// ---- Audio backend detection (coreaudio / pulseaudio / sox default) ---- - -function detectAudioBackend() { - if (process.platform === "darwin") return "coreaudio"; - try { - execSync("pactl --version", { stdio: "ignore", timeout: 3000 }); - return "pulseaudio"; - } catch { - return "default"; - } -} - -// ---- Audio server diagnostics ---- - -export function isWSL() { - return Boolean(process.env.WSL_DISTRO_NAME || process.env.WSL_INTEROP); -} - -// Unlike `pactl --version`, `pactl info` actually connects to the server. -function pulseServerHealth() { - try { - execSync("pactl info", { stdio: "ignore", timeout: 3000 }); - return { ok: true }; - } catch { - return { ok: false }; - } -} - -// User-facing hint for missing devices / recording failures. On WSL the audio -// server is WSLg's PulseAudio, which can wedge and needs a `wsl --shutdown`. -export function buildAudioHint({ backend, serverOk, isWsl }) { - if (backend !== "pulseaudio") return "No input devices found"; - if (serverOk) return "No input devices found - check your audio input source configuration"; - if (isWsl) { - return 'Audio server unreachable. On WSL, WSLg\'s PulseAudio may be stuck - run "wsl --shutdown" on Windows, then reopen Ubuntu'; - } - return "Audio server unreachable - check that PipeWire/PulseAudio is running"; -} - -// Appends a server-health hint to recording failure messages when the -// PulseAudio server is unreachable (e.g. wedged WSLg on WSL). -function audioFailureSuffix(backend) { - if (backend !== "pulseaudio") return ""; - if (pulseServerHealth().ok) return ""; - return `. ${buildAudioHint({ backend, serverOk: false, isWsl: isWSL() })}`; -} - -// Input device descriptors: name is the value passed to sox, label is shown in the UI. -export function parsePactlSources(jsonText) { - const data = JSON.parse(jsonText); - return (Array.isArray(data) ? data : []) - .filter((s) => s?.name && !s.name.endsWith(".monitor")) - .map((s) => ({ - name: s.name, - label: s.description ? `${s.description} (${s.name})` : s.name, - })); -} - -export function parsePactlSourcesShort(text) { - return text - .split("\n") - .map((line) => line.trim().split(/\s+/)[1]) - .filter((name) => name && !name.endsWith(".monitor")) - .map((name) => ({ name, label: name })); -} - -function listInputDevices(backend) { - if (backend === "coreaudio") { - try { - const json = execSync("system_profiler SPAudioDataType -json 2>/dev/null", { - encoding: "utf-8", - timeout: 5000, - }); - const data = JSON.parse(json); - return (data.SPAudioDataType?.[0]?._items || []) - .filter((d) => d.coreaudio_input_source != null) - .map((d) => { - const name = d.coreaudio_device_name || d._name; - return { name, label: name }; - }); - } catch { - return []; - } - } - if (backend === "pulseaudio") { - try { - const json = execSync("pactl -f json list sources 2>/dev/null", { - encoding: "utf-8", - timeout: 5000, - }); - return parsePactlSources(json); - } catch { - try { - const out = execSync("pactl list sources short 2>/dev/null", { - encoding: "utf-8", - timeout: 5000, - }); - return parsePactlSourcesShort(out); - } catch { - return []; - } - } - } - return []; -} - -export function buildRecordArgs(backend, mic) { - if (backend === "pulseaudio") return ["-t", "pulseaudio", mic || "default"]; - if (backend === "coreaudio" && mic) return ["-t", "coreaudio", mic]; - return ["-d"]; -} - -// ---- Recording state and control ---- - -let soxProc = null; -let soxStderr = ""; -let recording = false; -let processing = false; - -function forceKillSox(logger) { - if (soxProc) { - try { - process.kill(soxProc.pid, "SIGKILL"); - logger?.log("STT", `Killed sox pid=${soxProc.pid}`, "debug"); - } catch {} - soxProc = null; - } - try { - execSync("pkill -9 -f 'sox.*opencode-stt'", { stdio: "ignore" }); - } catch {} -} - -function startRecording(kv, backend, toast, logger, trimSilence = true) { - if (soxProc) { - logger?.log("STT", "Start recording skipped: sox already running", "debug"); - return; - } - - const wavFile = path.join(tmpDir, WAV_FILENAME); - forceKillSox(logger); - try { - fs.unlinkSync(wavFile); - } catch {} - - soxStderr = ""; - const mic = kv.get("stt.mic", "") || null; - const inputArgs = buildRecordArgs(backend, mic); - logger?.log( - "STT", - `Starting recording backend=${backend} mic=${mic || "system default"}`, - "debug", - ); - - const silenceArgs = trimSilence ? ["silence", "1", "0.1", "1%"] : []; - soxProc = spawn( - "sox", - [...inputArgs, "-r", "16000", "-c", "1", "-b", "16", wavFile, ...silenceArgs], - { - stdio: ["ignore", "ignore", "pipe"], - detached: false, - }, - ); - - soxProc.stderr.on("data", (chunk) => { - soxStderr += chunk.toString(); - }); - - soxProc.on("error", (err) => { - soxProc = null; - logger?.log("STT", `Recording failed: ${err.message}`, "error"); - if (recording) { - recording = false; - toast(`Recording failed: ${err.message}${audioFailureSuffix(backend)}`, "error"); - } - }); - - soxProc.on("exit", (code) => { - soxProc = null; - logger?.log( - "STT", - `sox exited code=${code} stderr=${soxStderr.trim()}`, - code === 0 || code === null ? "debug" : "warn", - ); - if (recording && code !== 0 && code !== null && !processing) { - recording = false; - const errLine = soxStderr.trim().split("\n").pop(); - toast( - `Recording error: ${errLine || `sox exited (code=${code})`}${audioFailureSuffix(backend)}`, - "error", - ); - } - }); - - recording = true; -} - -function stopRecording(logger) { - logger?.log("STT", "Stopping recording", "debug"); - if (soxProc) soxProc.kill("SIGINT"); -} - -async function waitForSoxExit(logger, timeoutMs = 2000) { - const start = Date.now(); - while (soxProc && Date.now() - start < timeoutMs) { - await new Promise((r) => setTimeout(r, 100)); - } - if (soxProc) { - logger?.log("STT", "sox did not stop before timeout", "warn"); - forceKillSox(logger); - } -} - -function getModelName(kv) { - const model = kv.get("stt.model", DEFAULT_MODEL); - return MODELS[model] ? model : DEFAULT_MODEL; -} - -function getModelPath(kv) { - return path.join(getModelsDir(), MODELS[getModelName(kv)].file); -} - -function getLanguage(kv) { - return kv.get("stt.language") || sttDefaultLanguage; -} - -export function buildWhisperArgs(modelPath, wavFile, language) { - return ["-m", modelPath, "-f", wavFile, "-l", language || DEFAULT_LANGUAGE, "-np", "-nt"]; -} - -function transcribe(kv, logger) { - const wavFile = path.join(tmpDir, WAV_FILENAME); - const mp = getModelPath(kv); - const lang = getLanguage(kv); - logger?.log("STT", `Local transcription requested model=${mp} language=${lang}`, "debug"); - if (!fs.existsSync(mp)) { - logger?.log("STT", `Whisper model missing: ${mp}`, "error"); - return Promise.resolve({ - error: `Model not found: ${getModelName(kv)}. Download from huggingface.co/ggerganov/whisper.cpp`, - }); - } - if (!fs.existsSync(wavFile)) { - logger?.log("STT", `Recording file missing: ${wavFile}`, "error"); - return Promise.resolve({ error: "No recording file - sox may have failed to capture audio" }); - } - if (fs.statSync(wavFile).size <= 44) { - logger?.log("STT", `Recording file empty: ${wavFile}`, "warn"); - return Promise.resolve({ error: "Recording is empty - no audio captured" }); - } - - return new Promise((resolve) => { - let stdout = ""; - let stderr = ""; - const proc = spawn("whisper-cli", buildWhisperArgs(mp, wavFile, lang), { - stdio: ["ignore", "pipe", "pipe"], - }); - logger?.log("STT", `Started whisper-cli pid=${proc.pid}`, "debug"); - - proc.stdout.on("data", (chunk) => { - stdout += chunk.toString(); - }); - proc.stderr.on("data", (chunk) => { - stderr += chunk.toString(); - }); - - const timer = setTimeout(() => { - proc.kill("SIGKILL"); - logger?.log("STT", "whisper-cli timed out after 60s", "error"); - resolve({ error: "Transcription timed out (60s)" }); - }, 60000); - - proc.on("error", (err) => { - clearTimeout(timer); - logger?.log("STT", `whisper-cli error: ${err.message}`, "error"); - resolve({ error: `Transcription failed: ${err.message}` }); - }); - - proc.on("exit", (code) => { - clearTimeout(timer); - // whisper-cli exits 0 even for an unknown language, printing the error to - // stderr instead; surface it rather than reporting "no speech detected". - const langError = stderr.match(/error: unknown language '([^']+)'/); - if (langError) { - logger?.log("STT", `whisper-cli rejected language: ${langError[1]}`, "error"); - resolve({ error: `Unknown whisper language: ${langError[1]}` }); - return; - } - if (code !== 0) { - logger?.log("STT", `whisper-cli exited code=${code} stderr=${stderr.trim()}`, "error"); - resolve({ error: stderr.trim().split("\n").pop() || `whisper-cli exited (code=${code})` }); - return; - } - logger?.log("STT", `Local transcription succeeded stdoutChars=${stdout.length}`, "debug"); - resolve({ - text: stdout - .replace(/\[.*?\]/g, "") - .replace(/\(.*?\)/g, "") - .replace(/\s+/g, " ") - .trim(), - }); - }); - }); -} - -const STT_SYSTEM_PROMPT = `You are a speech-to-text normalizer for a coding assistant CLI. - -Clean up raw whisper transcription into a clear, well-punctuated prompt. Rules: -- Fix punctuation, capitalization, and grammar -- Remove filler words (um, uh, like, you know, etc.) -- Keep technical terms, file names, and code references exact -- If the user is dictating code, format it appropriately -- Use the session context above to resolve ambiguous references (e.g. "that function", "the file", "it") -- Output ONLY the cleaned text, nothing else -- Do not add any commentary or explanation -- Keep the user's intent and meaning intact - -CRITICAL DOMAIN CORRECTIONS - Fix common STT homophone errors in software engineering contexts: -- "locks" -> "logs" (unless explicitly talking about mutexes/concurrency) -- "note" / "no" -> "node" -- "app and" -> "append" -- "sink" -> "sync" -- "a sink" -> "async" -- "doc" / "talker" -> "docker" -- "cash" -> "cache" -- "rap" -> "wrap" -- "Jason" -> "JSON" -- "get" -> "Git" -- "react" -> "React" -- "types creep" / "type script" -> "TypeScript" -- "bite" -> "byte" -- "string" -> "String" -- "int" -> "Int" -- "bullion" -> "boolean" - -Rely heavily on context to fix words that sound similar to programming terminology.`; - -async function normalizeTranscription(complete, rawText, sessionTitle, systemPrompt, logger) { - const contextLine = sessionTitle ? ` The user is currently working on: "${sessionTitle}"` : ""; - const system = `${systemPrompt}${contextLine}`; - - logger?.log("STT", `Normalizing transcription chars=${rawText.length}`, "debug"); - const result = await complete({ - system, - prompt: `Clean up this speech-to-text transcription:\n\n${rawText}`, - }); - return result; -} - -async function getApiModels(logger) { - if (!sttApiEndpoint) return []; - try { - const url = sttApiEndpoint.endsWith("/") - ? `${sttApiEndpoint}models` - : `${sttApiEndpoint}/models`; - const headers = {}; - if (sttApiKeyEnv && process.env[sttApiKeyEnv]) { - headers["Authorization"] = "Bearer " + process.env[sttApiKeyEnv]; - } - const resp = await fetch(url, { headers, signal: AbortSignal.timeout(5000) }); - logger?.log("STT", `Fetched STT API models status=${resp.status}`, resp.ok ? "debug" : "warn"); - if (!resp.ok) return []; - const data = await resp.json(); - return (data.data || []) - .filter((m) => m.id && /whisper/i.test(m.id)) - .map((m) => ({ value: m.id, label: m.id })); - } catch (err) { - logger?.log("STT", `Failed to fetch STT API models: ${err.message}`, "error"); - return []; - } -} - -async function transcribeApi(kv, logger) { - if (!sttApiEndpoint || !sttApiModel) { - logger?.log("STT", "STT API transcription skipped: API not configured", "warn"); - return { error: "STT API not configured" }; - } - const wavFile = path.join(tmpDir, WAV_FILENAME); - const model = kv.get("stt.api.model") || sttApiModel; - logger?.log("STT", `STT API transcription requested model=${model}`, "debug"); - - if (!fs.existsSync(wavFile)) { - logger?.log("STT", `Recording file missing: ${wavFile}`, "error"); - return { error: "No recording file - sox may have failed to capture audio" }; - } - if (fs.statSync(wavFile).size <= 44) { - logger?.log("STT", `Recording file empty: ${wavFile}`, "warn"); - return { error: "Recording is empty - no audio captured" }; - } - - try { - const audioBuffer = await fs.promises.readFile(wavFile); - const apiKey = sttApiKeyEnv ? process.env[sttApiKeyEnv] : null; - const useOpenRouterFormat = isOpenRouterEndpoint(sttApiEndpoint); - - const url = sttApiEndpoint.endsWith("/") - ? `${sttApiEndpoint}audio/transcriptions` - : `${sttApiEndpoint}/audio/transcriptions`; - - const request = useOpenRouterFormat - ? buildOpenRouterTranscriptionRequest(model, audioBuffer, apiKey) - : buildMultipartTranscriptionRequest(model, audioBuffer, apiKey); - - const resp = await fetch(url, { - method: "POST", - headers: request.headers, - body: request.body, - signal: AbortSignal.timeout(60000), - }); - logger?.log("STT", `STT API response status=${resp.status}`, resp.ok ? "debug" : "error"); - - if (!resp.ok) { - const responseBody = await resp.text(); - let msg = `STT API error ${resp.status}`; - try { - const err = JSON.parse(responseBody); - msg = err?.error?.message || msg; - } catch {} - return { error: msg }; - } - - let data; - try { - data = await resp.json(); - } catch (err) { - logger?.log("STT", `STT API returned invalid JSON: ${err.message}`, "error"); - return { error: `STT API returned invalid JSON: ${err.message}` }; - } - logger?.log("STT", `STT API transcription succeeded chars=${data.text?.length || 0}`, "debug"); - return { text: data.text?.trim() || "" }; - } catch (err) { - logger?.log("STT", `STT API request failed: ${err.message}`, "error"); - if (err.name === "TimeoutError" || err.name === "AbortError") { - return { error: "STT API request timed out (60s)" }; - } - return { error: `STT API request failed: ${err.message}` }; - } -} - -async function appendTranscription(client, text, submit) { - let appendResult = await client.tui.appendPrompt({ body: { text } }); - - if (appendResult?.error?.data?.message === "Expected object, got undefined") { - appendResult = await client.tui.appendPrompt({ text }); - } - - if (appendResult?.error) { - throw new Error( - `appendPrompt failed: ${appendResult.error.data?.message || appendResult.error.name}`, - ); - } - - if (submit) { - await client.tui.submitPrompt(); - } -} - -async function doTranscribePipeline( - kv, - complete, - client, - toast, - systemPrompt, - submit = false, - logger, -) { - processing = true; - try { - logger?.log("STT", `Pipeline started submit=${submit}`, "debug"); - stopRecording(logger); - await waitForSoxExit(logger); - - toast("Transcribing..."); - const result = sttApiEndpoint ? await transcribeApi(kv, logger) : await transcribe(kv, logger); - - if (result.error) { - logger?.log("STT", `Transcription failed: ${result.error}`, "error"); - toast(result.error, "error"); - return; - } - if (!result.text) { - logger?.log("STT", "Transcription produced no text", "warn"); - toast("No speech detected", "warning"); - return; - } - - toast("Normalizing..."); - const sessionTitle = await getActiveSessionTitle(client); - const llmResult = await normalizeTranscription( - complete, - result.text, - sessionTitle, - systemPrompt, - logger, - ); - - if (!llmResult.text) { - logger?.log("STT", `Normalization failed, using raw input: ${llmResult.error}`, "warn"); - toast(`Normalization failed, using raw input: ${llmResult.error}`, "warning"); - await appendTranscription(client, result.text, submit); - return; - } - - await appendTranscription(client, llmResult.text, submit); - logger?.log("STT", `Pipeline completed normalizedChars=${llmResult.text.length}`, "debug"); - toast(submit ? "Transcription submitted" : "Transcription added to prompt", "success"); - } catch (err) { - logger?.log("STT", `Pipeline error: ${err.message}`, "error"); - toast(`STT error: ${err.message}`, "error"); - } finally { - processing = false; - recording = false; - } -} - -// ---- Public API for TUI plugin ---- - -export function registerSTT(api, kv, complete, prompts, opts, logger) { - const client = api.client; - const systemPrompt = prompts?.stt || STT_SYSTEM_PROMPT; - const backend = detectAudioBackend(); - logger?.log("STT", `Audio backend=${backend}`, "debug"); - function toast(message, variant = "info") { - api.ui.toast({ message, variant, duration: 3000 }); - } - - if (opts?.sttEndpoint) { - sttApiEndpoint = opts.sttEndpoint; - sttApiModel = opts.sttModel || "whisper-large-v3-turbo"; - sttApiKeyEnv = opts.sttApiKeyEnv || null; - logger?.log( - "STT", - `Configured STT API endpoint=${sttApiEndpoint} model=${sttApiModel}`, - "debug", - ); - } - - if (opts?.sttLanguage) { - sttDefaultLanguage = opts.sttLanguage; - } - logger?.log("STT", `Default language=${sttDefaultLanguage}`, "debug"); - - tmpDir = opts?.tmpDir || "/tmp"; - try { - fs.mkdirSync(tmpDir, { recursive: true }); - } catch (err) { - logger?.log("STT", `Failed to create tmpDir ${tmpDir}: ${err.message}`, "warn"); - } - logger?.log("STT", `STT temp dir=${tmpDir}`, "debug"); - - return [ - { - title: sttApiEndpoint ? "STT: record/transcribe (API)" : "STT: record/transcribe", - value: "stt.record", - description: sttApiEndpoint - ? "Toggle recording; press again to stop and transcribe via API" - : "Toggle recording; press again to stop and transcribe", - keybind: "ctrl+r", - slash: { name: "stt-record" }, - onSelect() { - if (processing) { - toast("STT busy, please wait..."); - return; - } - if (recording) { - toast("Stopping, transcribing..."); - doTranscribePipeline(kv, complete, client, toast, systemPrompt, false, logger); - } else { - startRecording(kv, backend, toast, logger, opts?.trimSilence); - if (recording) toast("Recording... press again to transcribe"); - } - }, - }, - { - title: sttApiEndpoint ? "STT: submit recording (API)" : "STT: submit recording", - value: "stt.submit", - description: sttApiEndpoint - ? "Stop recording, transcribe via API, and submit prompt" - : "Stop recording, transcribe, and submit prompt", - keybind: "r", - slash: { name: "stt-submit" }, - onSelect() { - if (processing) { - toast("STT busy, please wait..."); - return; - } - if (!recording) { - toast("No recording in progress", "warning"); - return; - } - toast("Stopping, transcribing..."); - doTranscribePipeline(kv, complete, client, toast, systemPrompt, true, logger); - }, - }, - { - title: "STT: cancel recording", - value: "stt.stop", - description: "Cancel current recording", - slash: { name: "stt-stop" }, - onSelect() { - if (recording) { - recording = false; - forceKillSox(logger); - logger?.log("STT", "Recording cancelled", "debug"); - toast("Recording cancelled"); - } - }, - }, - { - title: sttApiEndpoint ? "STT: select model (API)" : "STT: select model", - value: "stt.model", - description: sttApiEndpoint ? "Choose whisper model via API" : "Choose whisper model", - slash: { name: "stt-model" }, - async onSelect() { - if (sttApiEndpoint) { - const current = kv.get("stt.api.model") || sttApiModel; - const apiModels = await getApiModels(logger); - const options = apiModels.length > 0 ? apiModels : [{ value: current, label: current }]; - api.ui.dialog.replace(() => - api.ui.DialogSelect({ - title: "Select whisper model (API)", - current, - options: options.map((m) => ({ - title: m.label, - value: m.value, - onSelect() { - kv.set("stt.api.model", m.value); - toast(`Whisper API model: ${m.label}`); - api.ui.dialog.clear(); - }, - })), - }), - ); - } else { - const current = getModelName(kv); - api.ui.dialog.replace(() => - api.ui.DialogSelect({ - title: "Select whisper model", - current, - options: Object.entries(MODELS).map(([key, v]) => ({ - title: v.label, - value: key, - onSelect() { - kv.set("stt.model", key); - toast(`Whisper model: ${v.label}`); - api.ui.dialog.clear(); - }, - })), - }), - ); - } - }, - }, - { - title: "STT: select language", - value: "stt.language", - description: "Choose transcription language (local whisper-cli only)", - slash: { name: "stt-language" }, - onSelect() { - const current = getLanguage(kv); - api.ui.dialog.replace(() => - api.ui.DialogSelect({ - title: "Select transcription language", - current, - options: Object.entries(LANGUAGES).map(([key, v]) => ({ - title: v.label, - value: key, - onSelect() { - kv.set("stt.language", key); - toast(`Whisper language: ${v.label}`); - api.ui.dialog.clear(); - }, - })), - }), - ); - }, - }, - { - title: "STT: select microphone", - value: "stt.mic", - description: "Choose audio input device", - slash: { name: "stt-mic" }, - onSelect() { - const current = kv.get("stt.mic", ""); - const devices = listInputDevices(backend); - if (devices.length === 0) { - const serverOk = backend !== "pulseaudio" || pulseServerHealth().ok; - const hint = buildAudioHint({ backend, serverOk, isWsl: isWSL() }); - logger?.log("STT", `No input devices: ${hint}`, "warn"); - toast(hint); - return; - } - api.ui.dialog.replace(() => - api.ui.DialogSelect({ - title: "Select microphone", - current, - options: [ - { - title: "System default", - value: "", - onSelect() { - kv.set("stt.mic", ""); - toast("Mic: system default"); - api.ui.dialog.clear(); - }, - }, - ...devices.map((d) => ({ - title: d.label, - value: d.name, - onSelect() { - kv.set("stt.mic", d.name); - toast(`Mic: ${d.label}`); - api.ui.dialog.clear(); - }, - })), - ], - }), - ); - }, - }, - ]; -} diff --git a/lib/tts.js b/lib/tts.js deleted file mode 100644 index c97967b..0000000 --- a/lib/tts.js +++ /dev/null @@ -1,405 +0,0 @@ -// Text-to-speech: LLM normalization, Piper synthesis, sox playback. - -import fs from "node:fs"; -import path from "node:path"; -import os from "node:os"; -import { spawn } from "node:child_process"; -import { getSessionTitle } from "./session.js"; - -const VOICES_DIR = path.join(os.homedir(), ".local", "share", "piper-voices"); - -const TTS_VOICES = { - ryan: { label: "Ryan (high)", file: "en_US-ryan-high.onnx" }, - bryce: { label: "Bryce (medium)", file: "en_US-bryce-medium.onnx" }, -}; -const DEFAULT_TTS_VOICE = "ryan"; - -const PIPER_RATE = 22050; -const PIPER_BITS = 16; -const PIPER_CHANNELS = 1; - -// ---- System prompts ---- - -const SYSTEM_AUTO = `You are a text-to-speech narrator for a coding assistant CLI. Your job is to convert the assistant's markdown output into natural spoken text that is useful and pleasant to listen to. - -You have three modes depending on the content complexity: - -1. NARRATE - For simple explanations, short answers, and conversational responses. Convert to natural spoken text, normalizing code references for speech. - - camelCase/PascalCase identifiers: split into words (parseConfig -> "parse config") - - File paths: use just the filename (src/utils/helpers.ts -> "helpers dot ts") - - Short code snippets in backticks: read them naturally - - Keep the narrative flow intact - -2. SUMMARIZE - For responses with significant code blocks, multiple file changes, or complex technical details. Provide a brief spoken summary of what was done and tell the user to check the screen. - - Mention what was changed and why - - Do not try to describe code blocks verbatim - - End with something like "check the details on your screen" or "take a look at the output for the specifics" - -3. NOTIFY - For very short confirmations, status updates, or acknowledgments. Keep it to one brief sentence. - -Choose the appropriate mode based on the content. Most responses with code blocks should use SUMMARIZE mode. Simple Q&A or short explanations use NARRATE. Build results, "done", confirmations use NOTIFY. - -Output ONLY the spoken text. Nothing else. No mode labels. No commentary.`; - -const SYSTEM_MANUAL = `You are a text-to-speech reader for a coding assistant. The user has explicitly requested this text be read aloud. Read the prose content faithfully and in detail. - -Rules: -- Read all prose text naturally and completely -- Code identifiers: split camelCase/PascalCase/snake_case into words (parseConfig -> "parse config", my_variable -> "my variable") -- File paths: read just the filename with extension (src/utils/helpers.ts -> "helpers dot ts") -- Line references: keep as is ("line 42") -- URLs: say "a link" or just the domain name -- Code blocks: skip entirely, just say "code block" or "code snippet" -- Error codes: expand naturally (ECONNREFUSED -> "connection refused") -- Shell commands: read them naturally (npm test -> "npm test") -- List items: read each item -- Remove markdown formatting but preserve all the informational content -- Do NOT summarize. Do NOT say "check the screen". Read everything that is prose. -- Output ONLY the spoken text`; - -// ---- Session helpers ---- - -async function getTurnAssistantText(client, api) { - const route = api.route.current; - if (route.name !== "session") return null; - - const sessionID = route.params.sessionID; - const stateMessages = api.state.session.messages(sessionID); - if (!stateMessages || stateMessages.length === 0) return null; - - const assistantIDs = []; - for (let i = stateMessages.length - 1; i >= 0; i--) { - if (stateMessages[i].role === "user") break; - if (stateMessages[i].role === "assistant") { - assistantIDs.unshift(stateMessages[i].id); - } - } - if (assistantIDs.length === 0) return null; - - const allText = []; - for (const msgID of assistantIDs) { - try { - const fullMsg = await client.session - .message({ sessionID, messageID: msgID }, { throwOnError: true }) - .then((r) => r.data); - - const textParts = (fullMsg?.parts || []).filter((p) => p.type === "text"); - const text = textParts - .map((p) => p.text || "") - .join("\n\n") - .trim(); - if (text) allText.push(text); - } catch { - // Skip messages that fail to fetch - } - } - - if (allText.length === 0) return null; - - return { - lastMessageID: assistantIDs[assistantIDs.length - 1], - text: allText.join("\n\n"), - }; -} - -// ---- Public API for TUI plugin ---- - -export function registerTTS(api, kv, complete, prompts, logger) { - const client = api.client; - const systemAuto = prompts?.ttsAuto || SYSTEM_AUTO; - const systemManual = prompts?.ttsManual || SYSTEM_MANUAL; - - function toast(message, variant = "info") { - api.ui.toast({ message, variant, duration: 3000 }); - } - - function getVoiceModel() { - const voice = kv.get("tts.voice", DEFAULT_TTS_VOICE); - const entry = TTS_VOICES[voice] || TTS_VOICES[DEFAULT_TTS_VOICE]; - return path.join(VOICES_DIR, entry.file); - } - - function piperOnPath() { - const pathDirs = (process.env.PATH || "").split(path.delimiter).filter(Boolean); - return pathDirs.some((dir) => fs.existsSync(path.join(dir, "piper"))); - } - - async function normalizeForSpeech(text, systemPrompt) { - logger?.log?.("TTS", `Normalizing speech chars=${text.length}`, "debug"); - return complete({ - system: systemPrompt, - prompt: `Convert for text-to-speech:\n\n${text}`, - config: { maxTokens: 4096 }, - }); - } - - // ---- Audio pipeline ---- - - let piperProc = null; - let playProc = null; - - function killProcs() { - if (piperProc) { - try { - piperProc.kill("SIGKILL"); - } catch {} - piperProc = null; - } - if (playProc) { - try { - playProc.kill("SIGKILL"); - } catch {} - playProc = null; - } - } - - function speak(text) { - if (!text) return Promise.resolve(); - const line = text.replace(/\n/g, " ").trim(); - if (!line) return Promise.resolve(); - - killProcs(); - - const voiceModel = getVoiceModel(); - logger?.log?.("TTS", `Speak requested chars=${line.length} voice=${voiceModel}`, "debug"); - if (!piperOnPath()) { - logger?.log?.("TTS", `Piper binary not found on PATH`, "warn"); - toast(`Piper binary not found on PATH`, "warning"); - return Promise.resolve(); - } - if (!fs.existsSync(voiceModel)) { - logger?.log?.("TTS", `Voice model not found: ${voiceModel}`, "warn"); - toast(`Voice model not found: ${voiceModel}`, "warning"); - return Promise.resolve(); - } - - return new Promise((resolve) => { - let piperStderr = ""; - let playStderr = ""; - playProc = spawn( - "play", - [ - "-t", - "raw", - "-r", - String(PIPER_RATE), - "-e", - "signed", - "-b", - String(PIPER_BITS), - "-c", - String(PIPER_CHANNELS), - "-q", - "-", - ], - { stdio: ["pipe", "ignore", "pipe"] }, - ); - - piperProc = spawn("piper", ["-m", voiceModel, "--output_raw"], { - stdio: ["pipe", "pipe", "pipe"], - }); - - piperProc.stderr.on("data", (chunk) => { - piperStderr += chunk.toString(); - }); - playProc.stderr.on("data", (chunk) => { - playStderr += chunk.toString(); - }); - - piperProc.stdout.on("data", (chunk) => { - if (playProc?.stdin && !playProc.stdin.destroyed) { - playProc.stdin.write(chunk); - } - }); - - piperProc.on("close", (code) => { - if (code !== 0 && code !== null) { - logger?.log?.("TTS", `piper exited code=${code} stderr=${piperStderr.trim()}`, "error"); - } - if (playProc?.stdin && !playProc.stdin.destroyed) { - playProc.stdin.end(); - } - }); - - playProc.on("close", (code) => { - if (code !== 0 && code !== null) { - logger?.log?.("TTS", `play exited code=${code} stderr=${playStderr.trim()}`, "error"); - } else { - logger?.log?.("TTS", "playback finished", "debug"); - } - piperProc = null; - playProc = null; - resolve(); - }); - - piperProc.on("error", (err) => { - logger?.log?.("TTS", `piper error: ${err.message}`, "error"); - killProcs(); - resolve(); - }); - playProc.on("error", (err) => { - logger?.log?.("TTS", `play error: ${err.message}`, "error"); - killProcs(); - resolve(); - }); - - if (piperProc?.stdin && !piperProc.stdin.destroyed) { - piperProc.stdin.write(line + "\n"); - piperProc.stdin.end(); - } - }); - } - - // ---- Session-prefixed announcements ---- - - async function speakWithSessionPrefix(sessionID, message, suffix) { - const sessionTitle = await getSessionTitle(client, sessionID); - const parts = []; - if (sessionTitle) parts.push(`Session: ${sessionTitle}.`); - parts.push(message); - if (suffix) parts.push(suffix); - await speak(parts.join(" ")); - } - - function stopSpeech() { - const wasPlaying = piperProc !== null || playProc !== null; - killProcs(); - return wasPlaying; - } - - // ---- Auto mode ---- - - let lastSpokenMessageID = null; - let wasBusy = false; - - api.event.on("session.status", (event) => { - if (event.properties?.status?.type === "busy") wasBusy = true; - }); - - api.event.on("session.idle", async (event) => { - if (kv.get("tts.mode", "off") !== "on") return; - if (!wasBusy) return; - wasBusy = false; - - const sessionID = event.properties?.sessionID; - const result = await getTurnAssistantText(client, api); - if (!result || !result.text) return; - - if (result.lastMessageID === lastSpokenMessageID) return; - lastSpokenMessageID = result.lastMessageID; - - toast("Normalizing response..."); - const llmResult = await normalizeForSpeech(result.text, systemAuto); - if (!llmResult.text) { - logger?.log?.("TTS", `Auto normalization failed: ${llmResult.error}`, "warn"); - toast(`TTS normalization failed: ${llmResult.error}`, "warning"); - return; - } - - logger?.log?.("TTS", `Auto normalization succeeded chars=${llmResult.text.length}`, "debug"); - await speakWithSessionPrefix(sessionID, llmResult.text, "Ready for your input."); - }); - - api.event.on("permission.asked", async (event) => { - if (kv.get("tts.mode", "off") !== "on") return; - await speakWithSessionPrefix( - event.properties?.sessionID, - "Permission requested. Please check your screen.", - ); - }); - - api.event.on("question.asked", async (event) => { - if (kv.get("tts.mode", "off") !== "on") return; - await speakWithSessionPrefix( - event.properties?.sessionID, - "A question needs your answer. Please check your screen.", - ); - }); - - // ---- Manual mode ---- - - async function speakLastResponse() { - const result = await getTurnAssistantText(client, api); - if (!result || !result.text) { - toast("No assistant response to speak", "warning"); - return; - } - - toast("Normalizing response..."); - const llmResult = await normalizeForSpeech(result.text, systemManual); - if (!llmResult.text) { - logger?.log?.("TTS", `Manual normalization failed: ${llmResult.error}`, "warn"); - toast(`TTS normalization failed: ${llmResult.error}`, "warning"); - return; - } - - logger?.log?.("TTS", `Manual normalization succeeded chars=${llmResult.text.length}`, "debug"); - toast("Speaking last response"); - await speak(llmResult.text); - } - - // ---- Commands ---- - - return [ - { - title: "TTS: speak last response", - value: "tts.speak-last", - description: "Read the last assistant response aloud (detailed)", - keybind: "s", - slash: { name: "tts-speak" }, - onSelect() { - speakLastResponse(); - }, - }, - { - title: "TTS: toggle", - value: "tts.mode", - description: "Toggle auto text-to-speech on/off", - keybind: "v", - slash: { name: "tts-mode" }, - onSelect() { - const current = kv.get("tts.mode", "off"); - const next = current === "on" ? "off" : "on"; - kv.set("tts.mode", next); - if (next === "off") stopSpeech(); - const voice = - TTS_VOICES[kv.get("tts.voice", DEFAULT_TTS_VOICE)] || TTS_VOICES[DEFAULT_TTS_VOICE]; - toast(next === "on" ? `TTS on (${voice.label})` : "TTS off"); - }, - }, - { - title: "TTS: stop playback", - value: "tts.stop", - description: "Stop current TTS playback", - keybind: "escape", - slash: { name: "tts-stop" }, - onSelect() { - if (stopSpeech()) toast("TTS stopped"); - }, - }, - { - title: "TTS: select voice", - value: "tts.voice", - description: "Choose TTS voice", - slash: { name: "tts-voice" }, - onSelect() { - const current = kv.get("tts.voice", DEFAULT_TTS_VOICE); - api.ui.dialog.replace(() => - api.ui.DialogSelect({ - title: "Select voice", - current, - options: Object.entries(TTS_VOICES).map(([key, v]) => ({ - title: v.label, - value: key, - onSelect() { - kv.set("tts.voice", key); - toast(`Voice: ${v.label}`); - api.ui.dialog.clear(); - }, - })), - }), - ); - }, - }, - ]; -} diff --git a/package-lock.json b/package-lock.json index 9d70b6f..d3db492 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,124 +1,178 @@ { - "name": "@renjfk/opencode-voice", - "version": "0.1.0", + "name": "@bojackduy/opencode-voice", + "version": "2.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@renjfk/opencode-voice", - "version": "0.1.0", - "license": "MIT", + "name": "@bojackduy/opencode-voice", + "version": "2.1.6", + "license": "AGPL-3.0-or-later", "devDependencies": { + "@types/bun": "^1.4.5", + "@types/node": "^26.6.6", "oxfmt": "0.50.0", - "oxlint": "1.65.0" + "oxlint": "1.65.0", + "typescript": "^7.0.2", + "wrangler": "^4.156.0" } }, - "node_modules/@oxfmt/binding-android-arm-eabi": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm-eabi/-/binding-android-arm-eabi-0.50.0.tgz", - "integrity": "sha512-ICXQVKrDvsWUtfx6EiVJxfWrajKTwTfRV8vz2XiMkxZeuCKJLgD4YAj6dE3BWvpqDlkVkie4VSTAtMUWO9LDXg==", + "node_modules/@cloudflare/kv-asset-handler": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.5.0.tgz", + "integrity": "sha512-jxQYkj8dSIzc0cD6cMMNdOc1UVjqSqu8BZdor5s8cGjW2I8BjODt/kWPVdY+u9zj3ms75Q5qaZgnxUad83+eAg==", + "dev": true, + "license": "MIT OR Apache-2.0", + "engines": { + "node": ">=22.0.0" + } + }, + "node_modules/@cloudflare/unenv-preset": { + "version": "2.16.2", + "resolved": "https://registry.npmjs.org/@cloudflare/unenv-preset/-/unenv-preset-2.16.2.tgz", + "integrity": "sha512-JBP1+Z7ZSNG/d4mRP+y8VC5dka3tZVMLEZRvS+rzQ4DGV1EoxRFQckcJTTkXbHSQiTj0DtNI01Zwb/V2fX0mvQ==", + "dev": true, + "license": "MIT OR Apache-2.0", + "peerDependencies": { + "unenv": "2.0.0-rc.24", + "workerd": ">1.20260305.0 <2.0.0-0" + }, + "peerDependenciesMeta": { + "workerd": { + "optional": true + } + } + }, + "node_modules/@cloudflare/workerd-darwin-64": { + "version": "1.20261023.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20261023.1.tgz", + "integrity": "sha512-lsEx0i7nR0PNG/erUFFHmQmiidEhLfDE5uQmAL9421/y4/ycuxDDOSaxu3VGGYFFPK5sduyUeMmjIlX4CwOBFg==", "cpu": [ - "arm" + "x64" ], "dev": true, - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "android" + "darwin" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16" } }, - "node_modules/@oxfmt/binding-android-arm64": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm64/-/binding-android-arm64-0.50.0.tgz", - "integrity": "sha512-quwjLQFkuW6OwLHeDeIXsTzOmipQFQbqsYN9HLk2B5I01IlAQZHP1UiLIg0O7pP+dUgPD2AD7SCYA3gs6NH5/g==", + "node_modules/@cloudflare/workerd-darwin-arm64": { + "version": "1.20261023.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20261023.1.tgz", + "integrity": "sha512-5e79fHgabdDD8EgmjOhJ1S+xMsf6DbC7fL7IgTBizMnzOp0P2isDn7pYmUxI9AJZE9FVQ4RUilH/I36YNg+GQQ==", "cpu": [ "arm64" ], "dev": true, - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "android" + "darwin" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16" } }, - "node_modules/@oxfmt/binding-darwin-arm64": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-arm64/-/binding-darwin-arm64-0.50.0.tgz", - "integrity": "sha512-ikU5umElcMi78/TNI334wtjr5WZ5F4nWa1aIDseAKKGL0W3ygxeYKkrIJ0fggWa8MOon66BmG3xCqmX1m9YAOw==", + "node_modules/@cloudflare/workerd-linux-64": { + "version": "1.20261023.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20261023.1.tgz", + "integrity": "sha512-VHQ6jKFSihjR2+x1buby8XTdBLLJztVnYiB7OLOTYO8aDXB+c1Rd2410PdgFuFYc4AgFEk6PCJLyCLL5L1KBnw==", "cpu": [ - "arm64" + "x64" ], "dev": true, - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "darwin" + "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16" } }, - "node_modules/@oxfmt/binding-darwin-x64": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-x64/-/binding-darwin-x64-0.50.0.tgz", - "integrity": "sha512-WT4MOYG4mv9IXrH0m60vHsJh+rRMPSOKTQmwDpwmgQ+DuW/i5dU4pqc0HDO5uclO5vjz5IFX5z/taW86LSVe/g==", + "node_modules/@cloudflare/workerd-linux-arm64": { + "version": "1.20261023.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20261023.1.tgz", + "integrity": "sha512-ilpRHzfDN8YFRM5CLRKuFw40x/LJBS89yVdhdQmxehlVDuBqjKpJB++zPFbTgKRRFaNupgnXc8RHktXAIhgCmQ==", "cpu": [ - "x64" + "arm64" ], "dev": true, - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "darwin" + "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16" } }, - "node_modules/@oxfmt/binding-freebsd-x64": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-freebsd-x64/-/binding-freebsd-x64-0.50.0.tgz", - "integrity": "sha512-gH0rycVXqV4juWkvLs2uPMtTyppDc7qEUVzXAxnQ7FpcSZNXqKowUgtjH8q67ngj416r8+4NnAlyR/D35zwwhQ==", + "node_modules/@cloudflare/workerd-windows-64": { + "version": "1.20261023.1", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20261023.1.tgz", + "integrity": "sha512-279WLVjNsMycAwr0EZNiNEf0l2SY6NUtsN80NwZzbTHzakmiN+WSx4w38muxPm+PAU0oSPPAPXKVD+H6Hya8xw==", "cpu": [ "x64" ], "dev": true, - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "freebsd" + "win32" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16" } }, - "node_modules/@oxfmt/binding-linux-arm-gnueabihf": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.50.0.tgz", - "integrity": "sha512-wL/k+o0hiTeRvi/gPzeC1L/yTHTXIeHDKWU09s2zTBmv7ma59wTm+fADNSGYxhJQDxyavQbwTf1QpW3Zj924tQ==", + "node_modules/@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", "cpu": [ - "arm" + "ppc64" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "linux" + "aix" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-linux-arm-musleabihf": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.50.0.tgz", - "integrity": "sha512-Y59FKqoUM3Gf00E395b4ixfWyJGwO2GzaZawF5MZoVWcb3f6CkWUXyao0jyOvoIxDMzMybcVRuXyG7ih/Nxweg==", + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", "cpu": [ "arm" ], @@ -126,278 +180,271 @@ "license": "MIT", "optional": true, "os": [ - "linux" + "android" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-linux-arm64-gnu": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.50.0.tgz", - "integrity": "sha512-OvXbfTjMignXWyJXg/NOFsiy996vFe8wb9tkxJaUq8ylq0XrzJg3ttavC5Tcmm6F8/GUs2r3XFJWWu9q/27uYw==", + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "glibc" + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" ], + "dev": true, "license": "MIT", "optional": true, "os": [ - "linux" + "android" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-linux-arm64-musl": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.50.0.tgz", - "integrity": "sha512-rqmvHZm7vMa3NLYa0khwkhReCmp9tqKnF23TFZ7S5cYJLvIE4b0k8famWE7kO897/DXznJe675n5SohFBggbxA==", + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", "cpu": [ "arm64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ - "linux" + "darwin" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-linux-ppc64-gnu": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.50.0.tgz", - "integrity": "sha512-49bAdYbMSde42tzPDtuHnBWzOgmoS0PT9THCjvMnDVYMQYiHzPc2Mv5rkpBHVQOXM+PHfafJlxgK0anXSWBVvw==", + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", "cpu": [ - "ppc64" + "x64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ - "linux" + "darwin" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-linux-riscv64-gnu": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.50.0.tgz", - "integrity": "sha512-VFT25/6kckkIM62KeWB2bi+xCEmC/zC+DcMaIpEfaio8ulkGDLSiTz11TyK0eqgTl3x5OklYEGDWohvAgOr8Bw==", + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", "cpu": [ - "riscv64" + "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ - "linux" + "freebsd" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-linux-riscv64-musl": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.50.0.tgz", - "integrity": "sha512-BBJMuNy6jjkXjUUINF5UTQqb/nvjmtJad43Gp7bab0AAURAdthhJvduR7rHpWInpWYiaMzYsdrmURNcrmpxdZA==", + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", "cpu": [ - "riscv64" + "x64" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ - "linux" + "freebsd" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-linux-s390x-gnu": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.50.0.tgz", - "integrity": "sha512-Xd4y+yjAYHKmryXhyUUwbyRD01iKfcvI74iE01L6p4F8SwjhZQXDshK+T8PcrPZLiFqH263P5xqJk94amjkjzQ==", + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", "cpu": [ - "s390x" + "arm" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-linux-x64-gnu": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.50.0.tgz", - "integrity": "sha512-Qp96rYJru7l++7mk4R+eh8qq9GFfFAMdmoN6VGoRHI8AA1XMnUIzH4u+zOcKZZwY+irHdsaBldDearwB4nOH7A==", + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", "cpu": [ - "x64" + "arm64" ], "dev": true, - "libc": [ - "glibc" - ], "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-linux-x64-musl": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-musl/-/binding-linux-x64-musl-0.50.0.tgz", - "integrity": "sha512-5XLGp+yd5w2Key5LMqJO+X3XVsJKgeeUKljy32+MBF/J/JZ5m8WHl6dI5eOQOr3ixopxPiXIyDAxn3slI3UXiQ==", + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", "cpu": [ - "x64" + "ia32" ], "dev": true, - "libc": [ - "musl" - ], "license": "MIT", "optional": true, "os": [ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-openharmony-arm64": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-openharmony-arm64/-/binding-openharmony-arm64-0.50.0.tgz", - "integrity": "sha512-QAxwzh7+GHugCD7WuERolVs8TKQwXNIAZXAHHTecbKVc9oWBkWzOiLauQuezXS57tVcof5zhi1IjZ8tOV0htTg==", + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", "cpu": [ - "arm64" + "loong64" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "openharmony" + "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-win32-arm64-msvc": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.50.0.tgz", - "integrity": "sha512-3nKN/kqClm9iCFWTwtJ9UpR5SGyExp5l3nw6uIiBt+3XitQtszin+vjHrL7JHfDksZ7Svigdaow2zqz/IKCfqw==", + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", "cpu": [ - "arm64" + "mips64el" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "win32" + "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-win32-ia32-msvc": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.50.0.tgz", - "integrity": "sha512-3r6XZ8+X6qlLbXaPW2NygfiAWSpKbkE36pAVzS83mY+cYY+pSMalJ+qnCgkr92tr+Iqv988XKQ1CpARTg9ITbQ==", + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", "cpu": [ - "ia32" + "ppc64" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "win32" + "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxfmt/binding-win32-x64-msvc": { - "version": "0.50.0", - "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.50.0.tgz", - "integrity": "sha512-BSE8D8KsvquMG9vU+Qt4qGuoOcZ36rxU5S6ZkHNguj+MlWkXWCBETnno3yJ9CfWvfCrbmieaN9LK6hdcdHNZ/w==", + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", "cpu": [ - "x64" + "riscv64" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "win32" + "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxlint/binding-android-arm-eabi": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.65.0.tgz", - "integrity": "sha512-jDVaGNURT5pEA9qcabh6WusIoBNybOMMDPCx+EFt+gxo6rVvoUf0+73Xy5x81+ZrxU+ewk5uRBYifjy5pgkcnA==", + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", "cpu": [ - "arm" + "s390x" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "android" + "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxlint/binding-android-arm64": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.65.0.tgz", - "integrity": "sha512-v0z80IWNA7c9RhUydq9YprBxCVZrQ6Ixls2tdxUC1F/1FFqSfa7xTX+EJf0mj6+BKRg2zWXqWfcbJUnETlLlIw==", + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", "cpu": [ - "arm64" + "x64" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "android" + "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxlint/binding-darwin-arm64": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.65.0.tgz", - "integrity": "sha512-pL/mG/5gMzBwp1gdc5+Cwi87F9j3XRnPxHGyVj5Zd+dCEV5YkKt0L70PB3EGmEEHxgn4H+jnMS3xLuXs6mZW/Q==", + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", "cpu": [ "arm64" ], @@ -405,16 +452,16 @@ "license": "MIT", "optional": true, "os": [ - "darwin" + "netbsd" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxlint/binding-darwin-x64": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.65.0.tgz", - "integrity": "sha512-jVTneaeuHtqTrKYnhrdH1buhnSorinvpy1sv43ayclfWx/e/DfdRWv+h1fopJcHQbYr5WMcZMmDvnfEBkPZ+1A==", + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", "cpu": [ "x64" ], @@ -422,37 +469,1291 @@ "license": "MIT", "optional": true, "os": [ - "darwin" + "netbsd" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxlint/binding-freebsd-x64": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.65.0.tgz", - "integrity": "sha512-8lJQ7B6RloYDUhwVdbSpwT2eKsCN5KP1Scn18ly1tytCuhXhbs0nkfKHT4jWWZBJqmynWuzd+78bF7wILrj6pw==", + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", "cpu": [ - "x64" + "arm64" ], "dev": true, "license": "MIT", "optional": true, "os": [ - "freebsd" + "openbsd" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=18" } }, - "node_modules/@oxlint/binding-linux-arm-gnueabihf": { + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" + } + }, + "node_modules/@oxfmt/binding-android-arm-eabi": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm-eabi/-/binding-android-arm-eabi-0.50.0.tgz", + "integrity": "sha512-ICXQVKrDvsWUtfx6EiVJxfWrajKTwTfRV8vz2XiMkxZeuCKJLgD4YAj6dE3BWvpqDlkVkie4VSTAtMUWO9LDXg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-android-arm64": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-android-arm64/-/binding-android-arm64-0.50.0.tgz", + "integrity": "sha512-quwjLQFkuW6OwLHeDeIXsTzOmipQFQbqsYN9HLk2B5I01IlAQZHP1UiLIg0O7pP+dUgPD2AD7SCYA3gs6NH5/g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-arm64": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-arm64/-/binding-darwin-arm64-0.50.0.tgz", + "integrity": "sha512-ikU5umElcMi78/TNI334wtjr5WZ5F4nWa1aIDseAKKGL0W3ygxeYKkrIJ0fggWa8MOon66BmG3xCqmX1m9YAOw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-darwin-x64": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-darwin-x64/-/binding-darwin-x64-0.50.0.tgz", + "integrity": "sha512-WT4MOYG4mv9IXrH0m60vHsJh+rRMPSOKTQmwDpwmgQ+DuW/i5dU4pqc0HDO5uclO5vjz5IFX5z/taW86LSVe/g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-freebsd-x64": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-freebsd-x64/-/binding-freebsd-x64-0.50.0.tgz", + "integrity": "sha512-gH0rycVXqV4juWkvLs2uPMtTyppDc7qEUVzXAxnQ7FpcSZNXqKowUgtjH8q67ngj416r8+4NnAlyR/D35zwwhQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-gnueabihf": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-0.50.0.tgz", + "integrity": "sha512-wL/k+o0hiTeRvi/gPzeC1L/yTHTXIeHDKWU09s2zTBmv7ma59wTm+fADNSGYxhJQDxyavQbwTf1QpW3Zj924tQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm-musleabihf": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-0.50.0.tgz", + "integrity": "sha512-Y59FKqoUM3Gf00E395b4ixfWyJGwO2GzaZawF5MZoVWcb3f6CkWUXyao0jyOvoIxDMzMybcVRuXyG7ih/Nxweg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-gnu": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-0.50.0.tgz", + "integrity": "sha512-OvXbfTjMignXWyJXg/NOFsiy996vFe8wb9tkxJaUq8ylq0XrzJg3ttavC5Tcmm6F8/GUs2r3XFJWWu9q/27uYw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-arm64-musl": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-arm64-musl/-/binding-linux-arm64-musl-0.50.0.tgz", + "integrity": "sha512-rqmvHZm7vMa3NLYa0khwkhReCmp9tqKnF23TFZ7S5cYJLvIE4b0k8famWE7kO897/DXznJe675n5SohFBggbxA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-ppc64-gnu": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-0.50.0.tgz", + "integrity": "sha512-49bAdYbMSde42tzPDtuHnBWzOgmoS0PT9THCjvMnDVYMQYiHzPc2Mv5rkpBHVQOXM+PHfafJlxgK0anXSWBVvw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-gnu": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-0.50.0.tgz", + "integrity": "sha512-VFT25/6kckkIM62KeWB2bi+xCEmC/zC+DcMaIpEfaio8ulkGDLSiTz11TyK0eqgTl3x5OklYEGDWohvAgOr8Bw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-riscv64-musl": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-0.50.0.tgz", + "integrity": "sha512-BBJMuNy6jjkXjUUINF5UTQqb/nvjmtJad43Gp7bab0AAURAdthhJvduR7rHpWInpWYiaMzYsdrmURNcrmpxdZA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-s390x-gnu": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-0.50.0.tgz", + "integrity": "sha512-Xd4y+yjAYHKmryXhyUUwbyRD01iKfcvI74iE01L6p4F8SwjhZQXDshK+T8PcrPZLiFqH263P5xqJk94amjkjzQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-gnu": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-gnu/-/binding-linux-x64-gnu-0.50.0.tgz", + "integrity": "sha512-Qp96rYJru7l++7mk4R+eh8qq9GFfFAMdmoN6VGoRHI8AA1XMnUIzH4u+zOcKZZwY+irHdsaBldDearwB4nOH7A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-linux-x64-musl": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-linux-x64-musl/-/binding-linux-x64-musl-0.50.0.tgz", + "integrity": "sha512-5XLGp+yd5w2Key5LMqJO+X3XVsJKgeeUKljy32+MBF/J/JZ5m8WHl6dI5eOQOr3ixopxPiXIyDAxn3slI3UXiQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-openharmony-arm64": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-openharmony-arm64/-/binding-openharmony-arm64-0.50.0.tgz", + "integrity": "sha512-QAxwzh7+GHugCD7WuERolVs8TKQwXNIAZXAHHTecbKVc9oWBkWzOiLauQuezXS57tVcof5zhi1IjZ8tOV0htTg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-arm64-msvc": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-0.50.0.tgz", + "integrity": "sha512-3nKN/kqClm9iCFWTwtJ9UpR5SGyExp5l3nw6uIiBt+3XitQtszin+vjHrL7JHfDksZ7Svigdaow2zqz/IKCfqw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-ia32-msvc": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-0.50.0.tgz", + "integrity": "sha512-3r6XZ8+X6qlLbXaPW2NygfiAWSpKbkE36pAVzS83mY+cYY+pSMalJ+qnCgkr92tr+Iqv988XKQ1CpARTg9ITbQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxfmt/binding-win32-x64-msvc": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/@oxfmt/binding-win32-x64-msvc/-/binding-win32-x64-msvc-0.50.0.tgz", + "integrity": "sha512-BSE8D8KsvquMG9vU+Qt4qGuoOcZ36rxU5S6ZkHNguj+MlWkXWCBETnno3yJ9CfWvfCrbmieaN9LK6hdcdHNZ/w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-android-arm-eabi": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm-eabi/-/binding-android-arm-eabi-1.65.0.tgz", + "integrity": "sha512-jDVaGNURT5pEA9qcabh6WusIoBNybOMMDPCx+EFt+gxo6rVvoUf0+73Xy5x81+ZrxU+ewk5uRBYifjy5pgkcnA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-android-arm64": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-android-arm64/-/binding-android-arm64-1.65.0.tgz", + "integrity": "sha512-v0z80IWNA7c9RhUydq9YprBxCVZrQ6Ixls2tdxUC1F/1FFqSfa7xTX+EJf0mj6+BKRg2zWXqWfcbJUnETlLlIw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-arm64": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-arm64/-/binding-darwin-arm64-1.65.0.tgz", + "integrity": "sha512-pL/mG/5gMzBwp1gdc5+Cwi87F9j3XRnPxHGyVj5Zd+dCEV5YkKt0L70PB3EGmEEHxgn4H+jnMS3xLuXs6mZW/Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-darwin-x64": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-darwin-x64/-/binding-darwin-x64-1.65.0.tgz", + "integrity": "sha512-jVTneaeuHtqTrKYnhrdH1buhnSorinvpy1sv43ayclfWx/e/DfdRWv+h1fopJcHQbYr5WMcZMmDvnfEBkPZ+1A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-freebsd-x64": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-freebsd-x64/-/binding-freebsd-x64-1.65.0.tgz", + "integrity": "sha512-8lJQ7B6RloYDUhwVdbSpwT2eKsCN5KP1Scn18ly1tytCuhXhbs0nkfKHT4jWWZBJqmynWuzd+78bF7wILrj6pw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-gnueabihf": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.65.0.tgz", + "integrity": "sha512-EgmZY+DeWhLLEnNl70/49j3ltA8I6X9kxMfexupWi2Vwfp6RonGsBaHtGoedLolaU37ne7eDUgoxa3CFB95GZA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm-musleabihf": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.65.0.tgz", + "integrity": "sha512-OJMWmAYRVBCPPxnYr3j5sXRwHPh1bAuMlTStGco1Z8q3HkvSH4h+A10E9MiRNYmLhUuli5a2P5wmfj8cagiF5Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-gnu": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.65.0.tgz", + "integrity": "sha512-D8uNi50LsYKgS0vGARZDRx05TBZeSxAVdLGddSEqQLSU7xsiqdImHPEw55xq8sKA5rCc/4au/5uS7FQALWdLCg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-arm64-musl": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.65.0.tgz", + "integrity": "sha512-IpbA8QGbwFehQhO+YaHwmoI81f93xvywpspf8HrdPCWOIeKwYfM1dhVhO4YKfZewTRRQEPY/JFjTOXTgkwhKrA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-ppc64-gnu": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.65.0.tgz", + "integrity": "sha512-ZSe8HgaZdgyHSv2+/pTG68z10+OarB18CkFKQOhRs3lmmP/p2vuigedK2e9d0ztoG2DU/duJzhxXBSjy/492HQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-gnu": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.65.0.tgz", + "integrity": "sha512-DcTERf++v6HyPHukKAr0JFTRqB+YeDEvqzRgNDMaz7jITPf+tlJIwRxodlAqoXMYhNVEZhXdQM5RAAYH8/oPuw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-riscv64-musl": { "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.65.0.tgz", - "integrity": "sha512-EgmZY+DeWhLLEnNl70/49j3ltA8I6X9kxMfexupWi2Vwfp6RonGsBaHtGoedLolaU37ne7eDUgoxa3CFB95GZA==", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.65.0.tgz", + "integrity": "sha512-xjhMwuFJwRh40NOBzol4gM5gqAa0xPCJU+GQLM6BydV8TbfkIA7JeyCFNhyfbE9Q/5EWcKYTx62R0cRcjP7DAA==", "cpu": [ - "arm" + "riscv64" ], "dev": true, + "libc": [ + "musl" + ], "license": "MIT", "optional": true, "os": [ @@ -462,14 +1763,17 @@ "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@oxlint/binding-linux-arm-musleabihf": { + "node_modules/@oxlint/binding-linux-s390x-gnu": { "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm-musleabihf/-/binding-linux-arm-musleabihf-1.65.0.tgz", - "integrity": "sha512-OJMWmAYRVBCPPxnYr3j5sXRwHPh1bAuMlTStGco1Z8q3HkvSH4h+A10E9MiRNYmLhUuli5a2P5wmfj8cagiF5Q==", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.65.0.tgz", + "integrity": "sha512-lrWSXb8JzboPWYBG6Kunt/eemvjo2oCFXktShsm3yMToY7HjzKLjxh7CljSvGnnZH9oohNFHOKc9xYpGKCPm6w==", "cpu": [ - "arm" + "s390x" ], "dev": true, + "libc": [ + "glibc" + ], "license": "MIT", "optional": true, "os": [ @@ -479,12 +1783,12 @@ "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/@oxlint/binding-linux-arm64-gnu": { + "node_modules/@oxlint/binding-linux-x64-gnu": { "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.65.0.tgz", - "integrity": "sha512-D8uNi50LsYKgS0vGARZDRx05TBZeSxAVdLGddSEqQLSU7xsiqdImHPEw55xq8sKA5rCc/4au/5uS7FQALWdLCg==", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.65.0.tgz", + "integrity": "sha512-A7xfghw250m4a1sPV+q44Mow2G5bhiC9FBvhAuIhJS6QovWnqzuL5AFQPEuwOB+PM4DhABkqxVa3Iwe3Y/nFlQ==", "cpu": [ - "arm64" + "x64" ], "dev": true, "libc": [ @@ -496,215 +1800,641 @@ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-linux-x64-musl": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.65.0.tgz", + "integrity": "sha512-reqOun1+pWO3fW6cv7bsa8hHG0TN3t/82qPdaoJo90FwugXiMjKhZMChmH5Z01cFNRHmxN4+543Fy8478cM/iA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-openharmony-arm64": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.65.0.tgz", + "integrity": "sha512-KQpqOb/juDBO0xyloDkVDhOVxDUgAfZ2OAAVq99TJScJDzT319xry1QzB9LQohV9QGnA7p6m/XATZkMXc84lwA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-arm64-msvc": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.65.0.tgz", + "integrity": "sha512-xfqcOc3nJFeAd1kDY4T9d3XeJIhr00twaaW0kOAzGPyUHkruXtNJv6zz1Ra9fRtSek5VpW2Yoj5AcwPIlT0ZiQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-ia32-msvc": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.65.0.tgz", + "integrity": "sha512-JV+pXm45p8sdgs3c7LOPAohW23optCNZETFOXUcjn6cS4PYZhEU/RI54Z5dHdMudab3nw7T48PZILthM+Q0COQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@oxlint/binding-win32-x64-msvc": { + "version": "1.65.0", + "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.65.0.tgz", + "integrity": "sha512-D7L/oBbskLss21bYrRbFuIs81AiSQV+wRzwck54dOkHIlq2qu1xjLz8u6jCqGH8Fltk8bB5DLBpVhE7v/fA8XQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.19.0 || >=22.12.0" + } + }, + "node_modules/@poppinss/colors": { + "version": "4.1.6", + "resolved": "https://registry.npmjs.org/@poppinss/colors/-/colors-4.1.6.tgz", + "integrity": "sha512-H9xkIdFswbS8n1d6vmRd8+c10t2Qe+rZITbbDHHkQixH5+2x1FDGmi/0K+WgWiqQFKPSlIYB7jlH6Kpfn6Fleg==", + "dev": true, + "license": "MIT", + "dependencies": { + "kleur": "^4.1.5" + } + }, + "node_modules/@poppinss/dumper": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/@poppinss/dumper/-/dumper-0.6.5.tgz", + "integrity": "sha512-NBdYIb90J7LfOI32dOewKI1r7wnkiH6m920puQ3qHUeZkxNkQiFnXVWoE6YtFSv6QOiPPf7ys6i+HWWecDz7sw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@sindresorhus/is": "^7.0.2", + "supports-color": "^10.0.0" + } + }, + "node_modules/@poppinss/exception": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@poppinss/exception/-/exception-1.2.3.tgz", + "integrity": "sha512-dCED+QRChTVatE9ibtoaxc+WkdzOSjYTKi/+uacHWIsfodVfpsueo3+DKpgU5Px8qXjgmXkSvhXvSCz3fnP9lw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@sindresorhus/is": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.2.0.tgz", + "integrity": "sha512-P1Cz1dWaFfR4IR+U13mqqiGsLFf1KbayybWwdd2vfctdV6hDpUkgCY0nKOLLTMSoRd/jJNjtbqzf13K8DCCXQw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@speed-highlight/core": { + "version": "1.2.24", + "resolved": "https://registry.npmjs.org/@speed-highlight/core/-/core-1.2.24.tgz", + "integrity": "sha512-qeW2e1l78afw8VhRPfPQ1Gjj+KU5XFQ/OFV5ti6eTa9bruO7mJyZtA4vw0ofqmA3tKCkROE9xLk3VZoeRc98nw==", + "dev": true, + "license": "CC0-1.0" + }, + "node_modules/@types/bun": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/@types/bun/-/bun-1.4.5.tgz", + "integrity": "sha512-DpgwNI9z0L1S0gtb45QLCWgwCUcMLnsHYMJHQvpNj7erGiCGBvpggltAIeARrtobNMKMuy0UP7i56tKKgwFs/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "bun-types": "1.4.5" + } + }, + "node_modules/@types/node": { + "version": "26.6.6", + "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz", + "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~8.9.0" + } + }, + "node_modules/@typescript/typescript-aix-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-aix-ppc64/-/typescript-aix-ppc64-7.0.2.tgz", + "integrity": "sha512-MTKKkWB7p/0E9xi1d1tHtZ5PiLkGEMIq88pK2CubZjOsLtYTLqhgIgi6zepFa+9GHZ6h05NMCkQxGKiPXMxXtQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-arm64/-/typescript-darwin-arm64-7.0.2.tgz", + "integrity": "sha512-gowzar9MwS/aRWp6f3a4KUqzRjAZjOsmGNCM6LcTgXum+dBfgsBVMN+AgvOCCbguXyick6LJhpBszxMebJ8syA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-darwin-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-darwin-x64/-/typescript-darwin-x64-7.0.2.tgz", + "integrity": "sha512-SZ9xZInqApNlNGc9s0W1VSsktYSOe9cFqNOIqmN1Gs8SmkjKZYFt017G4VwPxASInODuAdbTW7sXiFUf893RgA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-arm64/-/typescript-freebsd-arm64-7.0.2.tgz", + "integrity": "sha512-W5NH4y/J0plIIS5b2xvTEkU7JFxyqdMAOgf+Ilhl0vHQXKO5dZoxd+C/jEtq56c4F3wk71RB4BMRQ2XdI+bwYQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-freebsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-freebsd-x64/-/typescript-freebsd-x64-7.0.2.tgz", + "integrity": "sha512-UMGDx5sTpzNw3WiPebH7l90IWfJggEd+egHt/q6p7/Cm3zqoV7VxkGXt+3DxPIw8CcmvAB0j3sVVfbhX+M4Tpw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm/-/typescript-linux-arm-7.0.2.tgz", + "integrity": "sha512-gffT3xPz9sR7j/YJExkyPntrI0P2EP9XbOyWzth2/Gs0RstK+90RBcO0ncXoXy/beYll1SXw846Nf2zdnEz0QQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-arm64/-/typescript-linux-arm64-7.0.2.tgz", + "integrity": "sha512-Qh4eU4/y3yDjnfjjyPYihMj5/ODIlmt+Bzu17OI+fiSRDW57QmU5SiN63exPRNJPKUzcc1INa1NXdrJ+MqHjUQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-loong64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-loong64/-/typescript-linux-loong64-7.0.2.tgz", + "integrity": "sha512-uEHck9i8hoAzXPiYRib1O7miOnz23SxIeVl6F4LXox+qov1K35jHcEW6VHKvZI+pyvl7fZEP4MCU5LYvIq1GuQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-mips64el": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-mips64el/-/typescript-linux-mips64el-7.0.2.tgz", + "integrity": "sha512-R4KvAMnE43W5Qeqb0Ly56O3mWMWIAgsMyz36DCaycd5nbg/9kzm0liw3JocfRqyJY0KPmzFjbswozXyW0DnIYA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/@typescript/typescript-linux-ppc64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-ppc64/-/typescript-linux-ppc64-7.0.2.tgz", + "integrity": "sha512-DORx5b3sd/4S7eayxm4FQv+A7CrkUIGRaHiwI8oiHTAI1fAPWhF4J0vAlkC8biAlHSVVwxMQ3tjZ2/DVbnQiiA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-linux-arm64-musl": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.65.0.tgz", - "integrity": "sha512-IpbA8QGbwFehQhO+YaHwmoI81f93xvywpspf8HrdPCWOIeKwYfM1dhVhO4YKfZewTRRQEPY/JFjTOXTgkwhKrA==", + "node_modules/@typescript/typescript-linux-riscv64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-riscv64/-/typescript-linux-riscv64-7.0.2.tgz", + "integrity": "sha512-wf0jqEDOjrPRnKwYRyyJDRo11KMbvMFrU+q4zqKyChODBzvlkbhNQfKvLxQCcwTpdDaXSHZTVuh0JoCrKCUMHQ==", "cpu": [ - "arm64" + "riscv64" ], "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-linux-ppc64-gnu": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.65.0.tgz", - "integrity": "sha512-ZSe8HgaZdgyHSv2+/pTG68z10+OarB18CkFKQOhRs3lmmP/p2vuigedK2e9d0ztoG2DU/duJzhxXBSjy/492HQ==", + "node_modules/@typescript/typescript-linux-s390x": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-s390x/-/typescript-linux-s390x-7.0.2.tgz", + "integrity": "sha512-IkwJc3L7yhytWd/ewjyxNDfOmswCm9GWMJT/ue/dU4aZNbwZeYAetq42VyLmsmSjvoX7z74X6ZaYCtzAr0EuGw==", "cpu": [ - "ppc64" + "s390x" ], "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-linux-riscv64-gnu": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-gnu/-/binding-linux-riscv64-gnu-1.65.0.tgz", - "integrity": "sha512-DcTERf++v6HyPHukKAr0JFTRqB+YeDEvqzRgNDMaz7jITPf+tlJIwRxodlAqoXMYhNVEZhXdQM5RAAYH8/oPuw==", + "node_modules/@typescript/typescript-linux-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-linux-x64/-/typescript-linux-x64-7.0.2.tgz", + "integrity": "sha512-EYdf2cNg7rgCWJnxCdJ+F3V39O8ihb37eHAu1LK8oAFizgTQbPOK7zHHXbPt8rX24COqODXeI3sIf0fCXG7H/A==", "cpu": [ - "riscv64" + "x64" ], "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ "linux" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-linux-riscv64-musl": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-riscv64-musl/-/binding-linux-riscv64-musl-1.65.0.tgz", - "integrity": "sha512-xjhMwuFJwRh40NOBzol4gM5gqAa0xPCJU+GQLM6BydV8TbfkIA7JeyCFNhyfbE9Q/5EWcKYTx62R0cRcjP7DAA==", + "node_modules/@typescript/typescript-netbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-arm64/-/typescript-netbsd-arm64-7.0.2.tgz", + "integrity": "sha512-+polYF4MF04aPpO5FTkHran9yUQDSXqy5GiSDKpsll5jy3l3+g9QLhpf39T+ePtefhXLOGrLl0QIjkQP6VnelA==", "cpu": [ - "riscv64" + "arm64" ], "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "linux" + "netbsd" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-linux-s390x-gnu": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.65.0.tgz", - "integrity": "sha512-lrWSXb8JzboPWYBG6Kunt/eemvjo2oCFXktShsm3yMToY7HjzKLjxh7CljSvGnnZH9oohNFHOKc9xYpGKCPm6w==", + "node_modules/@typescript/typescript-netbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-netbsd-x64/-/typescript-netbsd-x64-7.0.2.tgz", + "integrity": "sha512-8YIT0EHM/3dq10ZOVF/A7pc/YSMtbcecct4rWtexrnSCHOPcpC2KTLXfTCR6vDpnSiY12heNb1GiN/wu+T/FyA==", "cpu": [ - "s390x" + "x64" ], "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "linux" + "netbsd" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-linux-x64-gnu": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.65.0.tgz", - "integrity": "sha512-A7xfghw250m4a1sPV+q44Mow2G5bhiC9FBvhAuIhJS6QovWnqzuL5AFQPEuwOB+PM4DhABkqxVa3Iwe3Y/nFlQ==", + "node_modules/@typescript/typescript-openbsd-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-arm64/-/typescript-openbsd-arm64-7.0.2.tgz", + "integrity": "sha512-APT8+ClYnuYm1u9+kgGXoMj2VzWzcymwh2gNSQVySHfkRDGOTVkoWLjCmOQSaO+PoqQ57B0flRp9SA+7GnnkzQ==", "cpu": [ - "x64" + "arm64" ], "dev": true, - "libc": [ - "glibc" - ], - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "linux" + "openbsd" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-linux-x64-musl": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-linux-x64-musl/-/binding-linux-x64-musl-1.65.0.tgz", - "integrity": "sha512-reqOun1+pWO3fW6cv7bsa8hHG0TN3t/82qPdaoJo90FwugXiMjKhZMChmH5Z01cFNRHmxN4+543Fy8478cM/iA==", + "node_modules/@typescript/typescript-openbsd-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-openbsd-x64/-/typescript-openbsd-x64-7.0.2.tgz", + "integrity": "sha512-yX7s+Q0Dln0Dt9tEzZsAjXXR/+ytBM7AlglaqyeMPxQszJ1JhlJdZ6jLA+IzldHtflX81em7lDao1xXu+aRRkg==", "cpu": [ "x64" ], "dev": true, - "libc": [ - "musl" - ], - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "linux" + "openbsd" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-openharmony-arm64": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-openharmony-arm64/-/binding-openharmony-arm64-1.65.0.tgz", - "integrity": "sha512-KQpqOb/juDBO0xyloDkVDhOVxDUgAfZ2OAAVq99TJScJDzT319xry1QzB9LQohV9QGnA7p6m/XATZkMXc84lwA==", + "node_modules/@typescript/typescript-sunos-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-sunos-x64/-/typescript-sunos-x64-7.0.2.tgz", + "integrity": "sha512-dLJDGaLZ1D4HPQn62u1n8mBDkJREwMsAkCdkwd4Ieqw+x3TUyTsqY0YiBCtE6H6OzzgGk3iuZ3vFWRS+E8/d1g==", "cpu": [ - "arm64" + "x64" ], "dev": true, - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ - "openharmony" + "sunos" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-win32-arm64-msvc": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.65.0.tgz", - "integrity": "sha512-xfqcOc3nJFeAd1kDY4T9d3XeJIhr00twaaW0kOAzGPyUHkruXtNJv6zz1Ra9fRtSek5VpW2Yoj5AcwPIlT0ZiQ==", + "node_modules/@typescript/typescript-win32-arm64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-arm64/-/typescript-win32-arm64-7.0.2.tgz", + "integrity": "sha512-Gyl1Vy6OsWesLzmq+EP0Fb7b4Nid5232AvcA2SFcdYreldpNtYFFofPjnt62y9hQy7VTaZp65ICJjuAQRaVcIQ==", "cpu": [ "arm64" ], "dev": true, - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ "win32" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-win32-ia32-msvc": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-ia32-msvc/-/binding-win32-ia32-msvc-1.65.0.tgz", - "integrity": "sha512-JV+pXm45p8sdgs3c7LOPAohW23optCNZETFOXUcjn6cS4PYZhEU/RI54Z5dHdMudab3nw7T48PZILthM+Q0COQ==", + "node_modules/@typescript/typescript-win32-x64": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/@typescript/typescript-win32-x64/-/typescript-win32-x64-7.0.2.tgz", + "integrity": "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g==", "cpu": [ - "ia32" + "x64" ], "dev": true, - "license": "MIT", + "license": "Apache-2.0", "optional": true, "os": [ "win32" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": ">=16.20.0" } }, - "node_modules/@oxlint/binding-win32-x64-msvc": { - "version": "1.65.0", - "resolved": "https://registry.npmjs.org/@oxlint/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.65.0.tgz", - "integrity": "sha512-D7L/oBbskLss21bYrRbFuIs81AiSQV+wRzwck54dOkHIlq2qu1xjLz8u6jCqGH8Fltk8bB5DLBpVhE7v/fA8XQ==", - "cpu": [ - "x64" - ], + "node_modules/blake3-wasm": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz", + "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", + "dev": true, + "license": "MIT" + }, + "node_modules/bun-types": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/bun-types/-/bun-types-1.4.5.tgz", + "integrity": "sha512-ECHn+9dhL3wv0G6u0+7dQvrnaimXiRDxxerYBmhTaLyJEEuvTPWk2Fye3XIf5Y++JIIiHKfQw4Z7V5D8KuiXbg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "undici-types": "*" + } + }, + "node_modules/cookie": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.1.1.tgz", + "integrity": "sha512-ei8Aos7ja0weRpFzJnEA9UHJ/7XQmqglbRwnf2ATjcB9Wq874VKH9kfjjirM6UhU2/E5fFYadylyhFldcqSidQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/error-stack-parser-es": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/error-stack-parser-es/-/error-stack-parser-es-1.0.5.tgz", + "integrity": "sha512-5qucVt2XcuGMcEGgWI7i+yZpmpByQ8J1lHhcL7PwqCwu9FPP3VUXzT4ltHe5i2z9dePwEHcDVOAfSnHsOlCXRA==", "dev": true, "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", "optional": true, "os": [ - "win32" + "darwin" ], "engines": { - "node": "^20.19.0 || >=22.12.0" + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/kleur": { + "version": "4.1.5", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-4.1.5.tgz", + "integrity": "sha512-o+NO+8WrRiQEE4/7nwRJhN1HWpVmJm511pBHUxPLtp0BUISzlBplORYSmTclCnJvQq2tKu/sgl3xVpkc7ZWuQQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/miniflare": { + "version": "5.20261023.3-beta", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-5.20261023.3-beta.tgz", + "integrity": "sha512-thdXzlktu5GE1o/BlmMAPeJ0Cu6Tu5LpMbRlyfRrpVvMRrhd6p52TMqcITCZZLVzt1UO92VGBkLDhLOpryUAyQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@cspotcode/source-map-support": "0.8.1", + "sharp": "0.35.5", + "undici": "7.30.1", + "workerd": "1.20261023.1", + "ws": "8.21.0", + "youch": "4.1.0-beta.10" + }, + "engines": { + "node": ">=22.0.0" } }, "node_modules/oxfmt": { @@ -800,6 +2530,96 @@ } } }, + "node_modules/path-to-regexp": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sharp": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, "node_modules/tinypool": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-2.1.0.tgz", @@ -809,6 +2629,180 @@ "engines": { "node": "^20.0.0 || >=22.0.0" } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/typescript": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz", + "integrity": "sha512-8FYau96o3NKOhbjKi/qNvG/W5jhzxkbdm5sj9AbZ/5T5sWqn3hJgLfGx27sRKZWTvyzCP8dLRBTf5tBTSRVUNA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc" + }, + "engines": { + "node": ">=16.20.0" + }, + "optionalDependencies": { + "@typescript/typescript-aix-ppc64": "7.0.2", + "@typescript/typescript-darwin-arm64": "7.0.2", + "@typescript/typescript-darwin-x64": "7.0.2", + "@typescript/typescript-freebsd-arm64": "7.0.2", + "@typescript/typescript-freebsd-x64": "7.0.2", + "@typescript/typescript-linux-arm": "7.0.2", + "@typescript/typescript-linux-arm64": "7.0.2", + "@typescript/typescript-linux-loong64": "7.0.2", + "@typescript/typescript-linux-mips64el": "7.0.2", + "@typescript/typescript-linux-ppc64": "7.0.2", + "@typescript/typescript-linux-riscv64": "7.0.2", + "@typescript/typescript-linux-s390x": "7.0.2", + "@typescript/typescript-linux-x64": "7.0.2", + "@typescript/typescript-netbsd-arm64": "7.0.2", + "@typescript/typescript-netbsd-x64": "7.0.2", + "@typescript/typescript-openbsd-arm64": "7.0.2", + "@typescript/typescript-openbsd-x64": "7.0.2", + "@typescript/typescript-sunos-x64": "7.0.2", + "@typescript/typescript-win32-arm64": "7.0.2", + "@typescript/typescript-win32-x64": "7.0.2" + } + }, + "node_modules/undici": { + "version": "7.30.1", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.30.1.tgz", + "integrity": "sha512-03KrMbjIFDWQR5RNPrSw3bd1r12JpyFQl9/yxjUbJtqkjmllqC5lFjZh6ujeuJCKr8EOQvRW872Oy/az+nLYxg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20.18.1" + } + }, + "node_modules/undici-types": { + "version": "8.9.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", + "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "dev": true, + "license": "MIT" + }, + "node_modules/unenv": { + "version": "2.0.0-rc.24", + "resolved": "https://registry.npmjs.org/unenv/-/unenv-2.0.0-rc.24.tgz", + "integrity": "sha512-i7qRCmY42zmCwnYlh9H2SvLEypEFGye5iRmEMKjcGi7zk9UquigRjFtTLz0TYqr0ZGLZhaMHl/foy1bZR+Cwlw==", + "dev": true, + "license": "MIT", + "dependencies": { + "pathe": "^2.0.3" + } + }, + "node_modules/workerd": { + "version": "1.20261023.1", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20261023.1.tgz", + "integrity": "sha512-NeofJFyaYNpqKpFRJW3ApuonaerPd6/JWlfTtLDYf2A6ygqrDEFnYgEXmc0hhOxqnJsSM+kXJN6VebPojzRrsg==", + "dev": true, + "hasInstallScript": true, + "license": "Apache-2.0", + "bin": { + "workerd": "bin/workerd" + }, + "engines": { + "node": ">=16" + }, + "optionalDependencies": { + "@cloudflare/workerd-darwin-64": "1.20261023.1", + "@cloudflare/workerd-darwin-arm64": "1.20261023.1", + "@cloudflare/workerd-linux-64": "1.20261023.1", + "@cloudflare/workerd-linux-arm64": "1.20261023.1", + "@cloudflare/workerd-windows-64": "1.20261023.1" + } + }, + "node_modules/wrangler": { + "version": "4.156.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-4.156.0.tgz", + "integrity": "sha512-kVLAShuLiNgE3jcrmXcymDf/iPKDPrSxACe5ueugW/33HeNB9E9CkKYchudCeBwgmsnl4k+1zt4NO7vqb/fRuQ==", + "dev": true, + "license": "MIT OR Apache-2.0", + "dependencies": { + "@cloudflare/kv-asset-handler": "0.5.0", + "@cloudflare/unenv-preset": "2.16.2", + "blake3-wasm": "2.1.5", + "esbuild": "0.28.2", + "miniflare": "5.20261023.3-beta", + "path-to-regexp": "6.3.0", + "unenv": "2.0.0-rc.24", + "workerd": "1.20261023.1" + }, + "bin": { + "cf-wrangler": "bin/cf-wrangler.js", + "wrangler": "bin/wrangler.js", + "wrangler2": "bin/wrangler.js" + }, + "engines": { + "node": ">=22.0.0" + }, + "optionalDependencies": { + "fsevents": "2.3.3" + }, + "peerDependencies": { + "@cloudflare/workers-types": "^5.20261023.1" + }, + "peerDependenciesMeta": { + "@cloudflare/workers-types": { + "optional": true + } + } + }, + "node_modules/ws": { + "version": "8.21.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz", + "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, + "node_modules/youch": { + "version": "4.1.0-beta.10", + "resolved": "https://registry.npmjs.org/youch/-/youch-4.1.0-beta.10.tgz", + "integrity": "sha512-rLfVLB4FgQneDr0dv1oddCVZmKjcJ6yX6mS4pU82Mq/Dt9a3cLZQ62pDBL4AUO+uVrCvtWz3ZFUL2HFAFJ/BXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/colors": "^4.1.5", + "@poppinss/dumper": "^0.6.4", + "@speed-highlight/core": "^1.2.7", + "cookie": "^1.0.2", + "youch-core": "^0.3.3" + } + }, + "node_modules/youch-core": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/youch-core/-/youch-core-0.3.3.tgz", + "integrity": "sha512-ho7XuGjLaJ2hWHoK8yFnsUGy2Y5uDpqSTq1FkHLK4/oqKtyUU1AFbOOxY4IpC9f0fTLjwYbslUz0Po5BpD1wrA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@poppinss/exception": "^1.2.2", + "error-stack-parser-es": "^1.0.5" + } } } } diff --git a/package.json b/package.json index 551b3a1..f9fe9df 100644 --- a/package.json +++ b/package.json @@ -1,47 +1,78 @@ { - "name": "@renjfk/opencode-voice", - "version": "0.1.0", - "description": "Speech-to-text and text-to-speech for OpenCode. Record voice prompts with whisper-cpp, hear responses via Piper TTS, with LLM normalization through any OpenAI-compatible endpoint.", + "name": "@bojackduy/opencode-voice", + "version": "2.1.6", + "description": "Voice for OpenCode: dictate prompts (live or batch, Mac or phone mic) with whisper, clean them up with an LLM, fix them by re-speaking, and hear replies in natural Vietnamese and English with VieNeu-TTS (Piper fallback).", "keywords": [ + "accessibility", + "bilingual", + "cli", + "dictation", + "local-first", "opencode", + "opencode-plugin", "piper", "plugin", "speech-to-text", "stt", + "terminal", "text-to-speech", "tts", + "vietnamese", "voice", + "voice-input", + "voice-output", "whisper" ], - "license": "MIT", + "homepage": "https://bojackduy.github.io/opencode-voice/", + "bugs": { + "url": "https://github.com/bojackduy/opencode-voice/issues" + }, + "license": "AGPL-3.0-or-later", "repository": { "type": "git", - "url": "git+https://github.com/renjfk/opencode-voice.git" + "url": "git+https://github.com/bojackduy/opencode-voice.git" }, "files": [ - "index.js", - "lib" + "index.ts", + "tui.ts", + "src", + "!src/**/*.test.ts", + "!src/testing" ], "type": "module", - "main": "index.js", + "main": "index.ts", "exports": { ".": { - "import": "./index.js" + "import": "./index.ts" }, "./tui": { - "import": "./index.js" + "import": "./tui.ts" } }, + "publishConfig": { + "access": "public", + "provenance": true + }, "scripts": { - "lint": "npx oxlint .", - "fmt": "npx oxfmt --check .", - "fmt:fix": "npx oxfmt --write .", - "test": "node --test", - "check": "npm run lint && npm run fmt", - "prepack": "npm run check" + "lint": "oxlint .", + "fmt": "oxfmt --check .", + "fmt:fix": "oxfmt --write .", + "test": "bun test src", + "check": "npm run lint && npm run fmt && npm run typecheck", + "typecheck": "tsc --noEmit -p tsconfig.json", + "prepack": "npm run check && npm test", + "release:patch": "npm run check && npm test && npm version patch -m \"chore: release %s\" && git push fork master && git push fork $(git describe --tags --abbrev=0)", + "release:minor": "npm run check && npm test && npm version minor -m \"chore: release %s\" && git push fork master && git push fork $(git describe --tags --abbrev=0)", + "release:major": "npm run check && npm test && npm version major -m \"chore: release %s\" && git push fork master && git push fork $(git describe --tags --abbrev=0)", + "deploy": "wrangler deploy", + "preview": "wrangler dev" }, "devDependencies": { + "@types/bun": "^1.4.5", + "@types/node": "^26.6.6", "oxfmt": "0.50.0", - "oxlint": "1.65.0" + "oxlint": "1.65.0", + "typescript": "^7.0.2", + "wrangler": "^4.156.0" } } diff --git a/scripts/demo-voice.exp b/scripts/demo-voice.exp new file mode 100755 index 0000000..ed87436 --- /dev/null +++ b/scripts/demo-voice.exp @@ -0,0 +1,27 @@ +#!/usr/bin/expect -f +# Run this locally (with a working mic + whisper model) to record a +# full voice demo. Then: agg assets/voice.cast assets/voice.gif +set timeout 20 +spawn opencode +sleep 7 +# Start STT recording (shows waveform UI) +send "\x10"; sleep 1.5 +send "stt record"; sleep 1.5 +send "\r"; sleep 6 +# Stop + transcribe +send "\x10"; sleep 1 +send "stt submit"; sleep 1 +send "\r"; sleep 4 +# Voice conversation mode +send "\x10"; sleep 1 +send "voice conversation"; sleep 1.5 +send "\r"; sleep 5 +send "\x10"; sleep 1 +send "voice conversation stop"; sleep 1 +send "\r"; sleep 2 +# TTS speak last response +send "\x10"; sleep 1 +send "tts speak"; sleep 1 +send "\r"; sleep 4 +send "\x03"; sleep 1 +expect eof diff --git a/scripts/record-demo.sh b/scripts/record-demo.sh new file mode 100755 index 0000000..ed5a3fd --- /dev/null +++ b/scripts/record-demo.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -u +SESSION="ocdemo2-$$" +CAST="$1" +WDIR="${2:-/tmp/scratchpad}" +tmux kill-session -t "$SESSION" 2>/dev/null || true +tmux new-session -d -s "$SESSION" -x 120 -y 36 -c "$WDIR" 'opencode' +sleep 7 +asciinema rec -c "tmux attach -t $SESSION" --window-size 120x36 --overwrite "$CAST" >/tmp/scratchpad/asciilog 2>&1 & +REC_PID=$! +sleep 2 +# Show voice commands +tmux send-keys -t "$SESSION" C-p +sleep 2 +tmux send-keys -t "$SESSION" "voice" +sleep 2.5 +tmux send-keys -t "$SESSION" Escape +sleep 1 +# Show STT commands +tmux send-keys -t "$SESSION" C-p +sleep 2 +tmux send-keys -t "$SESSION" "stt" +sleep 2.5 +tmux send-keys -t "$SESSION" Escape +sleep 1 +# Show TTS commands +tmux send-keys -t "$SESSION" C-p +sleep 2 +tmux send-keys -t "$SESSION" "tts" +sleep 2.5 +tmux send-keys -t "$SESSION" Escape +sleep 1 +# Show conversation command +tmux send-keys -t "$SESSION" C-p +sleep 2 +tmux send-keys -t "$SESSION" "conversation" +sleep 2.5 +tmux send-keys -t "$SESSION" Escape +sleep 1 +tmux send-keys -t "$SESSION" C-c +sleep 2 +tmux kill-session -t "$SESSION" 2>/dev/null || true +wait $REC_PID 2>/dev/null || true +echo "done" diff --git a/scripts/record-fullflow.sh b/scripts/record-fullflow.sh new file mode 100755 index 0000000..2529cdc --- /dev/null +++ b/scripts/record-fullflow.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +set -u +SESSION="full2-$$" +CAST="$1" +WDIR="${2:-/Users/duytrinh/Code/opencode-voice}" +tmux kill-session -t "$SESSION" 2>/dev/null || true +tmux new-session -d -s "$SESSION" -x 120 -y 36 -c "$WDIR" 'opencode' +sleep 8 +asciinema rec -c "tmux attach -t $SESSION" --window-size 120x36 --overwrite "$CAST" >/tmp/scratchpad/asciilog 2>&1 & +REC_PID=$! +sleep 2 + +run(){ tmux send-keys -t "$SESSION" "$1"; sleep "${2:-1.5}"; } + +# 1. TTS engine -> vienu (down twice) +run C-p 1.5; run "tts engine" 1.5; run Enter 2.5 +run Down 0.8; run Down 0.8; run Enter 2.5 +run Escape 1 + +# 2. TTS voice +run C-p 1.5; run "tts voice" 1.5; run Enter 2.5 +run Down 0.8; run Enter 2.5 +run Escape 1 + +# 3. STT mic +run C-p 1.5; run "stt mic" 1.5; run Enter 2.5 +run Down 0.8; run Enter 2.5 +run Escape 1 + +# 4. TTS rate +run C-p 1.5; run "tts rate" 1.5; run Enter 2.5 +run Down 0.8; run Enter 2.5 +run Escape 1 + +# 5. STT record (waveform) -> wait for user speech -> submit -> wait for agent reply +run C-p 1.5; run "stt record" 1.5; run Enter 7 +run C-p 1; run "stt submit" 1; run Enter 10 + +# 6. TTS speak (only after agent responded) +run C-p 1.5; run "tts speak" 1.5; run Enter 7 +run Escape 1 + +# 7. Voice conversation toggle +run C-p 1.5; run "voice conversation" 1.5; run Enter 6 +run C-p 1; run "voice conversation stop" 1; run Enter 3 +run Escape 1 + +run C-c 2 +tmux kill-session -t "$SESSION" 2>/dev/null || true +wait $REC_PID 2>/dev/null || true +echo done diff --git a/scripts/record-voice.sh b/scripts/record-voice.sh new file mode 100755 index 0000000..4b217c7 --- /dev/null +++ b/scripts/record-voice.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +set -u +SESSION="voice-$$" +CAST="$1" +WDIR="${2:-/Users/duytrinh/Code/opencode-voice}" +tmux kill-session -t "$SESSION" 2>/dev/null || true +tmux new-session -d -s "$SESSION" -x 120 -y 36 -c "$WDIR" 'opencode' +sleep 7 +asciinema rec -c "tmux attach -t $SESSION" --window-size 120x36 --overwrite "$CAST" >/tmp/scratchpad/asciilog 2>&1 & +REC_PID=$! +sleep 2 +# run expect inside tmux? Instead send via tmux send-keys reading expect file not possible. +# We'll just send a minimal sequence via tmux instead of expect. +tmux send-keys -t "$SESSION" C-p +sleep 2 +tmux send-keys -t "$SESSION" "stt record" +sleep 2 +tmux send-keys -t "$SESSION" Enter +sleep 6 +tmux send-keys -t "$SESSION" C-p +sleep 1 +tmux send-keys -t "$SESSION" "stt stop" +sleep 1 +tmux send-keys -t "$SESSION" Enter +sleep 3 +tmux send-keys -t "$SESSION" C-p +sleep 1 +tmux send-keys -t "$SESSION" "voice conversation" +sleep 1 +tmux send-keys -t "$SESSION" Enter +sleep 5 +tmux send-keys -t "$SESSION" C-p +sleep 1 +tmux send-keys -t "$SESSION" "voice conversation stop" +sleep 1 +tmux send-keys -t "$SESSION" Enter +sleep 3 +tmux send-keys -t "$SESSION" C-c +sleep 2 +tmux kill-session -t "$SESSION" 2>/dev/null || true +wait $REC_PID 2>/dev/null || true +echo done diff --git a/scripts/record-with-audio.sh b/scripts/record-with-audio.sh new file mode 100755 index 0000000..ced001b --- /dev/null +++ b/scripts/record-with-audio.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash +# Full-stack recorder: terminal (asciinema) + microphone (sox) -> MP4 with audio. +# Usage: scripts/record-with-audio.sh [project_dir] +# Speak during the STT recording phase; audio is muxed into the final MP4. +set -u +BASE="${1:-demo}" +DIR="${2:-/Users/duytrinh/Code/opencode-voice}" +OUTDIR="$(dirname "$0")/../assets" +mkdir -p "$OUTDIR" +CAST="$OUTDIR/$BASE.cast" +WAV="$OUTDIR/$BASE.wav" +MP4="$OUTDIR/$BASE.mp4" +GIF="$OUTDIR/$BASE.gif" + +SESSION="rec-$BASE-$$" +tmux kill-session -t "$SESSION" 2>/dev/null || true +tmux new-session -d -s "$SESSION" -x 120 -y 36 -c "$DIR" 'opencode' +sleep 7 + +# Start mic recording in background (sox). Stop with: kill $SOX_PID +sox -d -r 44100 -c 1 "$WAV" >/dev/null 2>&1 & +SOX_PID=$! + +asciinema rec -c "tmux attach -t $SESSION" --window-size 120x36 --overwrite "$CAST" >/dev/null 2>&1 & +REC_PID=$! +sleep 2 + +# Drive the UI; speak during the stt record step. +run(){ tmux send-keys -t "$SESSION" "$1"; sleep "${2:-1.5}"; } +run C-p 1.5; run "tts engine" 1.5; run Enter 2; run Down 0.7; run Down 0.7; run Enter 2; run Escape 1 +run C-p 1.5; run "tts voice" 1.5; run Enter 2; run Down 0.7; run Enter 2; run Escape 1 +run C-p 1.5; run "stt mic" 1.5; run Enter 2; run Down 0.7; run Enter 2; run Escape 1 +run C-p 1.5; run "stt record" 1.5; run Enter 6 # <-- SPEAK NOW +run C-p 1; run "stt submit" 1; run Enter 4 +run C-p 1.5; run "voice conversation" 1.5; run Enter 5 +run C-p 1; run "voice conversation stop" 1; run Enter 3 +run C-p 1.5; run "tts speak" 1.5; run Enter 4 +run Escape 1 +run C-c 2 + +# Stop recordings +kill $SOX_PID 2>/dev/null || true +tmux kill-session -t "$SESSION" 2>/dev/null || true +wait $REC_PID 2>/dev/null || true + +# Build GIF + MP4 (with audio) +agg "$CAST" "$GIF" --speed 2 --idle-time-limit 0.5 >/dev/null 2>&1 +ffmpeg -y -i "$GIF" -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "${MP4%.mp4}_silent.mp4" >/dev/null 2>&1 +ffmpeg -y -i "${MP4%.mp4}_silent.mp4" -i "$WAV" -c:v copy -c:a aac -b:a 128k -shortest -movflags faststart "$MP4" >/dev/null 2>&1 +rm -f "${MP4%.mp4}_silent.mp4" +echo "Done: $GIF $MP4 $WAV" diff --git a/src/audio/mic.test.ts b/src/audio/mic.test.ts new file mode 100644 index 0000000..2661fb2 --- /dev/null +++ b/src/audio/mic.test.ts @@ -0,0 +1,445 @@ +import { describe, expect, test } from "bun:test"; +import { EventEmitter } from "node:events"; +import { PassThrough } from "node:stream"; +import type { MicError } from "../types.ts"; +import { + listInputDevices, + openMic, + parsePactlSourcesShort, + PHONE_UNREACHABLE_HINT, +} from "./mic.ts"; +import type { MicDeps, ScheduleFn, SpawnFn } from "./mic.ts"; +import type { RunFn } from "./usb.ts"; + +class FakeChild extends EventEmitter { + pid = 4242; + stdin = new PassThrough(); + stdout = new PassThrough(); + stderr = new PassThrough(); + signals: string[] = []; + kill(sig: NodeJS.Signals = "SIGTERM"): boolean { + this.signals.push(sig); + return true; + } + close(code: number | null, sig: NodeJS.Signals | null = null): void { + this.emit("close", code, sig); + } +} + +function fakeSpawn(opts: { fail?: NodeJS.ErrnoException } = {}): { + spawn: SpawnFn; + calls: { cmd: string; args: readonly string[] }[]; + last: () => FakeChild; +} { + const calls: { cmd: string; args: readonly string[] }[] = []; + const children: FakeChild[] = []; + const spawn: SpawnFn = (cmd, args) => { + calls.push({ cmd, args }); + const c = new FakeChild(); + children.push(c); + queueMicrotask(() => { + if (opts.fail) c.emit("error", opts.fail); + else c.emit("spawn"); + }); + return c; + }; + return { + spawn, + calls, + last: () => { + const c = children[children.length - 1]; + if (!c) throw new Error("no child"); + return c; + }, + }; +} + +function fakeSchedule(): { schedule: ScheduleFn; advance: (ms: number) => void } { + let t = 0; + const timers: { at: number; fn: () => void; live: boolean }[] = []; + return { + schedule: (fn, ms) => { + const timer = { at: t + ms, fn, live: true }; + timers.push(timer); + return () => { + timer.live = false; + }; + }, + advance(ms) { + t += ms; + for (const timer of timers) { + if (timer.live && timer.at <= t) { + timer.live = false; + timer.fn(); + } + } + }, + }; +} + +const tick = (): Promise => new Promise((r) => setImmediate(r)); + +function setup(extra: Partial = {}) { + const sp = fakeSpawn(); + const clock = fakeSchedule(); + const deps: MicDeps = { spawn: sp.spawn, schedule: clock.schedule, platform: "darwin", ...extra }; + return { sp, clock, deps }; +} + +const SSH = ["ssh", "-p", "8022", "u0_a1@127.0.0.1", "$HOME/bin/capture.sh", "16000"]; + +describe("openMic local", () => { + test("spawns sox raw s16le at the rate and delivers data", async () => { + const { sp, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + expect(sp.calls[0]).toEqual({ + cmd: "sox", + args: ["-d", "-r", "16000", "-c", "1", "-b", "16", "-e", "signed-integer", "-t", "raw", "-"], + }); + expect(mic.format.sampleRate).toBe(16000); + const got: Buffer[] = []; + mic.onData((c) => got.push(c)); + sp.last().stdout.write(Buffer.from([1, 2, 3, 4])); + await tick(); + expect(Buffer.concat(got)).toEqual(Buffer.from([1, 2, 3, 4])); + }); + + test("coreaudio device and linux pulse args", async () => { + const a = setup(); + await openMic({ kind: "local", sampleRate: 16000, device: "MacBook Mic" }, a.deps); + expect(a.sp.calls[0]?.args.slice(0, 3)).toEqual(["-t", "coreaudio", "MacBook Mic"]); + const b = setup({ platform: "linux", hasPulse: async () => true }); + await openMic({ kind: "local", sampleRate: 16000 }, b.deps); + expect(b.sp.calls[0]?.args.slice(0, 3)).toEqual(["-t", "pulseaudio", "default"]); + const c = setup({ platform: "linux", hasPulse: async () => false }); + await openMic({ kind: "local", sampleRate: 16000, device: "hw:1" }, c.deps); + expect(c.sp.calls[0]?.args[0]).toBe("-d"); + }); + + test("ENOENT rejects SPAWN_FAILED with sox install hint", async () => { + const err = Object.assign(new Error("spawn sox ENOENT"), { code: "ENOENT" }); + const sp = fakeSpawn({ fail: err }); + const p = openMic( + { kind: "local", sampleRate: 16000 }, + { spawn: sp.spawn, platform: "darwin" }, + ); + await expect(p).rejects.toMatchObject({ + code: "SPAWN_FAILED", + message: "sox not found", + hint: "Install sox: brew install sox", + }); + }); + + test("synchronous spawn throw rejects SPAWN_FAILED", async () => { + const spawn: SpawnFn = () => { + throw new Error("boom"); + }; + await expect( + openMic({ kind: "local", sampleRate: 16000 }, { spawn, platform: "darwin" }), + ).rejects.toMatchObject({ code: "SPAWN_FAILED", message: "Could not start sox: boom" }); + }); + + test("unexpected exit emits EXITED with last stderr line", async () => { + const { sp, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + const errs: MicError[] = []; + mic.onError((e) => errs.push(e)); + sp.last().stderr.write("sox WARN x\nsox FAIL formats: can't open input device\n"); + await tick(); + sp.last().close(2); + expect(errs).toHaveLength(1); + expect(errs[0]?.code).toBe("EXITED"); + expect(errs[0]?.message).toBe( + "sox exited unexpectedly (code 2): sox FAIL formats: can't open input device", + ); + }); + + test("NO_AUDIO after the timeout kills the process, once", async () => { + const { sp, clock, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + const errs: MicError[] = []; + mic.onError((e) => errs.push(e)); + clock.advance(3999); + expect(errs).toHaveLength(0); + clock.advance(1); + expect(sp.last().signals).toEqual(["SIGKILL"]); + sp.last().close(null, "SIGKILL"); + expect(errs.map((e) => e.code)).toEqual(["NO_AUDIO"]); + expect(errs[0]?.message).toBe("No audio from the microphone in 4s"); + }); + + test("bytes before the timeout cancel NO_AUDIO", async () => { + const { sp, clock, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + const errs: MicError[] = []; + mic.onError((e) => errs.push(e)); + sp.last().stdout.write(Buffer.alloc(2)); + await tick(); + clock.advance(10_000); + expect(errs).toHaveLength(0); + expect(sp.last().signals).toEqual([]); + }); + + test("pause drops data but keeps draining, no SIGSTOP; resume delivers again", async () => { + const { sp, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + const got: Buffer[] = []; + mic.onData((c) => got.push(c)); + mic.pause(); + expect(mic.paused).toBe(true); + sp.last().stdout.write(Buffer.from([9, 9])); + await tick(); + expect(got).toHaveLength(0); + mic.resume(); + sp.last().stdout.write(Buffer.from([1, 1])); + await tick(); + expect(Buffer.concat(got)).toEqual(Buffer.from([1, 1])); + expect(sp.last().signals).toEqual([]); + }); + + test("stop sends SIGINT, flushes trailing data, resolves on close, no error", async () => { + const { sp, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + const errs: MicError[] = []; + const got: Buffer[] = []; + mic.onError((e) => errs.push(e)); + mic.onData((c) => got.push(c)); + let done = false; + const p = mic.stop().then(() => { + done = true; + }); + expect(sp.last().signals).toEqual(["SIGINT"]); + sp.last().stdout.write(Buffer.from([7, 7])); + await tick(); + expect(done).toBe(false); + sp.last().close(0); + await p; + expect(Buffer.concat(got)).toEqual(Buffer.from([7, 7])); + expect(errs).toHaveLength(0); + expect(mic.stop()).toBe(mic.stop()); + }); + + test("stop escalates to SIGKILL after 3s and resolves", async () => { + const { sp, clock, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + let done = false; + const p = mic.stop().then(() => { + done = true; + }); + clock.advance(2999); + await tick(); + expect(done).toBe(false); + clock.advance(1); + await p; + expect(sp.last().signals).toEqual(["SIGINT", "SIGKILL"]); + }); + + test("kill is idempotent, drops data, emits no error", async () => { + const { sp, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + const errs: MicError[] = []; + const got: Buffer[] = []; + mic.onError((e) => errs.push(e)); + mic.onData((c) => got.push(c)); + mic.kill(); + sp.last().stdout.write(Buffer.from([1, 1])); + await tick(); + sp.last().close(null, "SIGKILL"); + mic.kill(); + expect(got).toHaveLength(0); + expect(errs).toHaveLength(0); + expect(sp.last().signals).toEqual(["SIGKILL"]); + }); + + test("late onError subscriber receives an earlier error", async () => { + const { sp, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + sp.last().close(1); + const errs: MicError[] = []; + mic.onError((e) => errs.push(e)); + expect(errs.map((e) => e.code)).toEqual(["EXITED"]); + }); +}); + +describe("openMic remote", () => { + test("ssh exit 255 → CONNECTION with phone hint and stderr", async () => { + const { sp, deps } = setup(); + const mic = await openMic({ kind: "remote", sampleRate: 16000, command: SSH }, deps); + expect(sp.calls[0]).toEqual({ cmd: "ssh", args: SSH.slice(1) }); + const errs: MicError[] = []; + mic.onError((e) => errs.push(e)); + sp.last().stderr.write("ssh: connect to host 127.0.0.1 port 8022: Connection refused\n"); + await tick(); + sp.last().close(255); + expect(errs).toEqual([ + { + code: "CONNECTION", + message: + "Phone connection failed (ssh exit 255): ssh: connect to host 127.0.0.1 port 8022: Connection refused", + hint: PHONE_UNREACHABLE_HINT, + }, + ]); + }); + + test("remote non-255 exit is EXITED; NO_AUDIO uses 8s", async () => { + const a = setup(); + const mic = await openMic({ kind: "remote", sampleRate: 16000, command: SSH }, a.deps); + const errs: MicError[] = []; + mic.onError((e) => errs.push(e)); + a.sp.last().close(1); + expect(errs[0]?.code).toBe("EXITED"); + + const b = setup(); + const mic2 = await openMic({ kind: "remote", sampleRate: 16000, command: SSH }, b.deps); + const errs2: MicError[] = []; + mic2.onError((e) => errs2.push(e)); + b.clock.advance(4000); + expect(errs2).toHaveLength(0); + b.clock.advance(4000); + expect(errs2[0]?.code).toBe("NO_AUDIO"); + }); + + test("remote stop uses SIGTERM without error", async () => { + const { sp, deps } = setup(); + const mic = await openMic({ kind: "remote", sampleRate: 16000, command: SSH }, deps); + const errs: MicError[] = []; + mic.onError((e) => errs.push(e)); + const p = mic.stop(); + expect(sp.last().signals).toEqual(["SIGTERM"]); + sp.last().close(255); + await p; + expect(errs).toHaveLength(0); + }); + + test("usbAutoForward: forwards the loopback port before spawning", async () => { + const ports: number[] = []; + const { sp, deps } = setup({ + ensureUsbForward: async (port) => { + ports.push(port); + return { ok: true }; + }, + }); + await openMic({ kind: "remote", sampleRate: 16000, command: SSH, usbAutoForward: true }, deps); + expect(ports).toEqual([8022]); + expect(sp.calls).toHaveLength(1); + }); + + test("usbAutoForward failure rejects CONNECTION with its hint, no spawn", async () => { + const { sp, deps } = setup({ + ensureUsbForward: async () => ({ + ok: false, + message: "No Android phone attached over USB", + hint: "Plug in the phone with USB debugging enabled", + }), + }); + await expect( + openMic({ kind: "remote", sampleRate: 16000, command: SSH, usbAutoForward: true }, deps), + ).rejects.toMatchObject({ + code: "CONNECTION", + message: "No Android phone attached over USB", + hint: "Plug in the phone with USB debugging enabled", + }); + expect(sp.calls).toHaveLength(0); + }); + + test("usbAutoForward skipped for non-loopback hosts", async () => { + let called = false; + const { deps } = setup({ + ensureUsbForward: async () => { + called = true; + return { ok: true }; + }, + }); + await openMic( + { + kind: "remote", + sampleRate: 16000, + command: ["ssh", "-p", "8022", "u@100.1.2.3", "capture.sh"], + usbAutoForward: true, + }, + deps, + ); + expect(called).toBe(false); + }); + + test("missing command rejects SPAWN_FAILED", async () => { + const { deps } = setup(); + await expect(openMic({ kind: "remote", sampleRate: 16000 }, deps)).rejects.toMatchObject({ + code: "SPAWN_FAILED", + }); + }); +}); + +describe("listInputDevices", () => { + test("macOS: parses system_profiler input devices", async () => { + const json = JSON.stringify({ + SPAudioDataType: [ + { + _items: [ + { _name: "MacBook Pro Microphone", coreaudio_input_source: "spaudio_default" }, + { _name: "MacBook Pro Speakers", coreaudio_output_source: "x" }, + { _name: "x", coreaudio_device_name: "USB Mic", coreaudio_input_source: "y" }, + ], + }, + ], + }); + const run: RunFn = async () => ({ code: 0, stdout: json, stderr: "" }); + expect(await listInputDevices({ run, platform: "darwin" })).toEqual([ + "MacBook Pro Microphone", + "USB Mic", + ]); + }); + + test("linux: pactl json, falls back to short; [] on failure", async () => { + const json = JSON.stringify([{ name: "alsa_input.usb" }, { name: "alsa_output.monitor" }]); + const ok: RunFn = async () => ({ code: 0, stdout: json, stderr: "" }); + expect(await listInputDevices({ run: ok, platform: "linux" })).toEqual(["alsa_input.usb"]); + const fallback: RunFn = async (_c, args) => + args[0] === "-f" + ? { code: 1, stdout: "", stderr: "" } + : { code: 0, stdout: "1\tmic.a\tx\n2\tout.monitor\tx\n", stderr: "" }; + expect(await listInputDevices({ run: fallback, platform: "linux" })).toEqual(["mic.a"]); + const bad: RunFn = async () => ({ code: 0, stdout: "not json", stderr: "" }); + expect(await listInputDevices({ run: bad, platform: "darwin" })).toEqual([]); + expect(parsePactlSourcesShort("")).toEqual([]); + }); +}); + +describe("blocked microphone", () => { + test("3 s of pure digital silence reports NO_AUDIO with the device hint", async () => { + const { sp, deps } = setup(); + const mic = await openMic( + { + kind: "remote", + command: SSH, + sampleRate: 16000, + label: "Phone", + zeroHint: "open Termux on the phone", + }, + deps, + ); + const errs: string[] = []; + mic.onError((e) => errs.push(`${e.code}|${e.message}|${e.hint}`)); + for (let i = 0; i < 5; i++) sp.last().stdout.write(Buffer.alloc(16000)); // 2.5 s of zeros + await tick(); + expect(errs).toEqual([]); + sp.last().stdout.write(Buffer.alloc(16000)); // 3 s + await tick(); + expect(errs).toEqual([ + "NO_AUDIO|Phone sends only silence (microphone blocked or muted)|open Termux on the phone", + ]); + }); + + test("any real sample means the mic works: no false alarm later", async () => { + const { sp, deps } = setup(); + const mic = await openMic({ kind: "local", sampleRate: 16000 }, deps); + const errs: string[] = []; + mic.onError((e) => errs.push(e.code)); + const b = Buffer.alloc(3200); + b.writeInt16LE(5, 100); + sp.last().stdout.write(b); + for (let i = 0; i < 10; i++) sp.last().stdout.write(Buffer.alloc(16000)); + await tick(); + expect(errs).toEqual([]); + }); +}); diff --git a/src/audio/mic.ts b/src/audio/mic.ts new file mode 100644 index 0000000..33bfbfd --- /dev/null +++ b/src/audio/mic.ts @@ -0,0 +1,547 @@ +// Microphone capture: local sox or a remote command (ssh to a phone), both +// producing raw s16le mono PCM on stdout. + +import { spawn as nodeSpawn } from "node:child_process"; +import type { Logger, MicConfig, MicError, MicStream } from "../types.ts"; +import { defaultRun, ensureUsbForward, loopbackSshPort } from "./usb.ts"; +import type { RunFn, UsbForwardResult } from "./usb.ts"; + +// ---------------------------------------------------------------- process seam + +/** The subset of a Node ChildProcess this module uses. */ +export interface ChildProc { + readonly pid?: number | undefined; + readonly stdin: NodeJS.WritableStream | null; + readonly stdout: NodeJS.ReadableStream | null; + readonly stderr: NodeJS.ReadableStream | null; + kill(signal?: NodeJS.Signals): boolean; + on(event: "spawn", listener: () => void): unknown; + on(event: "error", listener: (err: Error) => void): unknown; + on( + event: "close", + listener: (code: number | null, signal: NodeJS.Signals | null) => void, + ): unknown; +} + +export type StdioKind = "pipe" | "ignore"; +export type SpawnFn = ( + cmd: string, + args: readonly string[], + opts: { stdio: [StdioKind, StdioKind, StdioKind] }, +) => ChildProc; + +export const defaultSpawn: SpawnFn = (cmd, args, opts) => nodeSpawn(cmd, [...args], opts); + +/** Run fn after ms; returns a cancel function. */ +export type ScheduleFn = (fn: () => void, ms: number) => () => void; + +export const defaultSchedule: ScheduleFn = (fn, ms) => { + const t = setTimeout(fn, ms); + t.unref?.(); + return () => clearTimeout(t); +}; + +function errnoCode(err: unknown): string | undefined { + if (err && typeof err === "object" && "code" in err) { + const c = (err as { code: unknown }).code; + return typeof c === "string" ? c : undefined; + } + return undefined; +} + +function lastLine(s: string): string { + return s.trim().split("\n").pop()?.trim() ?? ""; +} + +// ---------------------------------------------------------------- mic + +export interface MicDeps { + readonly spawn?: SpawnFn; + readonly schedule?: ScheduleFn; + readonly run?: RunFn; + readonly platform?: NodeJS.Platform; + readonly env?: Readonly>; + /** Linux: is PulseAudio/PipeWire-pulse available? Default probes `pactl --version`. */ + readonly hasPulse?: () => Promise; + readonly ensureUsbForward?: (port: number) => Promise; + readonly noAudioTimeoutMs?: number; + readonly stopTimeoutMs?: number; + readonly logger?: Logger; +} + +export const PHONE_UNREACHABLE_HINT = + "Phone not reachable: check USB cable / adb forward tcp:8022 tcp:8022 and that sshd runs in Termux"; + +const SOX_MISSING_HINT = "Install sox: brew install sox"; + +class MicFailure extends Error implements MicError { + constructor( + readonly code: MicError["code"], + message: string, + readonly hint?: string, + ) { + super(message); + this.name = "MicError"; + } +} + +type LocalBackend = "coreaudio" | "pulseaudio" | "default"; + +async function localBackend(deps: MicDeps): Promise { + const platform = deps.platform ?? process.platform; + if (platform === "darwin") return "coreaudio"; + const hasPulse = + deps.hasPulse ?? + (async () => (await (deps.run ?? defaultRun)("pactl", ["--version"], 3000)).code === 0); + return (await hasPulse()) ? "pulseaudio" : "default"; +} + +/** sox input args for the backend (ported from lib/stt/audio.js buildRecordArgs). */ +export function soxInputArgs(backend: LocalBackend, device: string | undefined): string[] { + if (backend === "pulseaudio") return ["-t", "pulseaudio", device || "default"]; + if (backend === "coreaudio" && device) return ["-t", "coreaudio", device]; + return ["-d"]; +} + +function localHint(backend: LocalBackend, env: MicDeps["env"]): string { + if (backend === "pulseaudio") { + const wsl = Boolean(env?.WSL_DISTRO_NAME || env?.WSL_INTEROP); + return wsl + ? 'Audio server unreachable on WSL: run "wsl --shutdown" on Windows, then reopen Ubuntu' + : "Check that PipeWire/PulseAudio is running and the input source is set"; + } + return "Check the input device and that your terminal has microphone permission"; +} + +/** Open a capture stream. Rejects with a MicError when it cannot start. */ +export async function openMic(cfg: MicConfig, deps: MicDeps = {}): Promise { + const spawn = deps.spawn ?? defaultSpawn; + const schedule = deps.schedule ?? defaultSchedule; + const env = deps.env ?? process.env; + const remote = cfg.kind === "remote"; + + let cmd: string; + let args: readonly string[]; + let label: string; + let hint: string; + if (remote) { + const command = cfg.command; + const bin = command?.[0]; + if (!command || bin === undefined) { + throw new MicFailure( + "SPAWN_FAILED", + "Remote mic has no capture command", + "Set the remote capture command, or switch the mic to local", + ); + } + if (cfg.usbAutoForward) { + const port = loopbackSshPort(command); + if (port !== null) { + const fwd = await ( + deps.ensureUsbForward ?? ((p) => ensureUsbForward(p, { run: deps.run })) + )(port); + if (!fwd.ok) throw new MicFailure("CONNECTION", fwd.message, fwd.hint); + } + } + cmd = bin; + args = command.slice(1); + label = `${cfg.label ?? "Phone"} capture`; + hint = cfg.label + ? `Check the microphone on ${cfg.label}` + : "Check the capture script on the phone"; + } else { + const backend = await localBackend(deps); + cmd = "sox"; + args = [ + ...soxInputArgs(backend, cfg.device), + "-r", + String(cfg.sampleRate), + "-c", + "1", + "-b", + "16", + "-e", + "signed-integer", + "-t", + "raw", + "-", + ]; + label = "sox"; + hint = localHint(backend, env); + } + + let child: ChildProc; + try { + child = spawn(cmd, args, { stdio: ["ignore", "pipe", "pipe"] }); + } catch (err) { + throw spawnFailure(cmd, err, remote); + } + // Wait for the OS to confirm the spawn: ENOENT arrives as an async event. + await new Promise((resolve, reject) => { + let settled = false; + const done = (err?: unknown): void => { + if (settled) return; + settled = true; + if (err === undefined) resolve(); + else reject(spawnFailure(cmd, err, remote)); + }; + child.on("spawn", () => done()); + child.on("error", (err) => done(err)); + }); + + deps.logger?.log("mic", `capture started kind=${cfg.kind} pid=${child.pid ?? "?"}`, "debug"); + const killCommand = cfg.killCommand; + const cleanup = + remote && killCommand && killCommand[0] !== undefined + ? (): void => { + const [kbin, ...kargs] = killCommand; + void (deps.run ?? defaultRun)(kbin as string, kargs, 5000).catch(() => {}); + } + : null; + const stopCommand = cfg.stopCommand; + const gracefulStop = + remote && stopCommand && stopCommand[0] !== undefined + ? (): void => { + const [sbin, ...sargs] = stopCommand; + void (deps.run ?? defaultRun)(sbin as string, sargs, 8000).catch(() => {}); + } + : null; + return createStream(child, { + remote, + gracefulStop, + zeroHint: + cfg.zeroHint ?? + (remote + ? `Unmute the microphone on ${cfg.label ?? "the device"}` + : "Check that the input is not muted and the terminal has microphone permission"), + label, + hint, + device: cfg.label ?? "the phone", + unreachableHint: cfg.unreachableHint ?? PHONE_UNREACHABLE_HINT, + cleanup, + sampleRate: cfg.sampleRate, + schedule, + noAudioTimeoutMs: deps.noAudioTimeoutMs ?? (remote ? 8000 : 4000), + stopTimeoutMs: deps.stopTimeoutMs ?? (gracefulStop ? 6000 : 3000), + logger: deps.logger, + }); +} + +function spawnFailure(cmd: string, err: unknown, remote: boolean): MicFailure { + if (errnoCode(err) === "ENOENT") { + return new MicFailure( + "SPAWN_FAILED", + `${cmd} not found`, + remote ? `Install ${cmd} or fix the remote capture command` : SOX_MISSING_HINT, + ); + } + const msg = err instanceof Error ? err.message : String(err); + return new MicFailure( + "SPAWN_FAILED", + `Could not start ${cmd}: ${msg}`, + remote ? "Check the remote capture command" : SOX_MISSING_HINT, + ); +} + +interface StreamOpts { + readonly remote: boolean; + readonly label: string; + readonly hint: string; + readonly sampleRate: number; + readonly schedule: ScheduleFn; + readonly noAudioTimeoutMs: number; + readonly stopTimeoutMs: number; + readonly logger: Logger | undefined; + readonly device: string; + readonly unreachableHint: string; + /** Remote cleanup after stop/kill (runs once). */ + readonly cleanup: (() => void) | null; + /** Ask the device to finish and flush; the process then exits by itself. */ + readonly gracefulStop: (() => void) | null; + /** What to do when the device only streams zeros. */ + readonly zeroHint: string; +} + +function createStream(child: ChildProc, o: StreamOpts): MicStream { + let cleaned = false; + const cleanupOnce = (): void => { + if (cleaned || !o.cleanup) return; + cleaned = true; + o.cleanup(); + }; + const dataCbs = new Set<(chunk: Buffer) => void>(); + const errorCbs = new Set<(err: MicError) => void>(); + let paused = false; + let gotBytes = false; + let closed = false; + /** Set by stop()/kill()/our own NO_AUDIO kill: exit is not an error. */ + let expected = false; + /** kill() drops everything; stop() still flushes trailing output. */ + let dropAll = false; + let error: MicError | null = null; + let stderrTail = ""; + let cancelNoAudio: (() => void) | null = null; + const closeWaiters: (() => void)[] = []; + + function emitError(err: MicError): void { + if (error) return; + error = err; + o.logger?.log("mic", `capture error ${err.code}: ${err.message}`, "warn"); + for (const cb of errorCbs) { + try { + cb(err); + } catch {} + } + } + + // A device that streams pure digital silence is being blocked (Android + // silences background apps' microphones; a muted input does the same). + let zeroBytes = 0; + let sawSignal = false; + const ZERO_LIMIT = o.sampleRate * 2 * 3; // 3 s + function checkZeros(buf: Buffer): void { + if (sawSignal || error) return; + for (let i = 0; i + 1 < buf.length; i += 2) { + if (buf.readInt16LE(i) !== 0) { + sawSignal = true; + return; + } + } + zeroBytes += buf.length; + if (zeroBytes >= ZERO_LIMIT) { + const who = o.remote ? o.device.replace(/^the p/, "P") : "The microphone"; + emitError({ + code: "NO_AUDIO", + message: `${who} sends only silence (microphone blocked or muted)`, + hint: o.zeroHint, + }); + } + } + + function signal(sig: NodeJS.Signals): void { + if (closed) return; + try { + child.kill(sig); + } catch {} + } + + child.stdout?.on("data", (chunk: Buffer | string) => { + const buf = typeof chunk === "string" ? Buffer.from(chunk) : chunk; + if (buf.length === 0) return; + if (!gotBytes) { + gotBytes = true; + cancelNoAudio?.(); + cancelNoAudio = null; + } + checkZeros(buf); + // Paused audio is drained and dropped: the process keeps running so a + // remote pipe never buffers paused speech and replays it on resume. + if (paused || dropAll) return; + for (const cb of dataCbs) { + try { + cb(buf); + } catch {} + } + }); + child.stdout?.on("error", () => {}); + child.stderr?.on("data", (chunk: Buffer | string) => { + stderrTail = (stderrTail + chunk.toString()).slice(-400); + }); + + child.on("error", (err) => { + if (expected || closed) return; + emitError({ + code: "EXITED", + message: `${o.label} failed: ${err.message}`, + hint: o.hint, + }); + }); + + child.on("close", (code, sig) => { + closed = true; + cancelNoAudio?.(); + cancelNoAudio = null; + o.logger?.log("mic", `capture closed code=${code} signal=${sig} expected=${expected}`, "debug"); + if (!expected) { + const detail = lastLine(stderrTail); + const suffix = detail ? `: ${detail}` : ""; + if (o.remote && code === 255) { + emitError({ + code: "CONNECTION", + message: `${o.device === "the phone" ? "Phone" : o.device} connection failed (ssh exit 255)${suffix}`, + hint: o.unreachableHint, + }); + } else { + const how = code !== null ? `code ${code}` : `signal ${sig ?? "?"}`; + emitError({ + code: "EXITED", + message: `${o.label} exited unexpectedly (${how})${suffix}`, + hint: o.hint, + }); + } + } + for (const w of closeWaiters.splice(0)) w(); + }); + + cancelNoAudio = o.schedule(() => { + cancelNoAudio = null; + if (gotBytes || closed || expected) return; + expected = true; + dropAll = true; + signal("SIGKILL"); + const secs = Math.round(o.noAudioTimeoutMs / 1000); + emitError({ + code: "NO_AUDIO", + message: o.remote + ? `No audio from ${o.device} in ${secs}s` + : `No audio from the microphone in ${secs}s`, + hint: o.remote ? `Check that the microphone on ${o.device} is free` : o.hint, + }); + cleanupOnce(); + }, o.noAudioTimeoutMs); + + let stopping: Promise | null = null; + + return { + format: { sampleRate: o.sampleRate }, + get paused() { + return paused; + }, + onData(cb) { + dataCbs.add(cb); + return () => dataCbs.delete(cb); + }, + onError(cb) { + errorCbs.add(cb); + // Late subscribers still learn about an error that already happened. + if (error) { + const e = error; + try { + cb(e); + } catch {} + } + return () => errorCbs.delete(cb); + }, + pause() { + paused = true; + }, + resume() { + paused = false; + }, + stop() { + if (stopping) return stopping; + expected = true; + cancelNoAudio?.(); + cancelNoAudio = null; + if (closed) { + stopping = Promise.resolve(); + return stopping; + } + stopping = new Promise((resolve) => { + let cancelTimer: (() => void) | null = null; + let done = false; + const finish = (): void => { + if (done) return; + done = true; + cancelTimer?.(); + resolve(); + }; + closeWaiters.push(finish); + cancelTimer = o.schedule(() => { + dropAll = true; + signal("SIGKILL"); + cleanupOnce(); + finish(); + }, o.stopTimeoutMs); + if (o.gracefulStop) { + // The device drains its buffered tail and the stream closes itself; + // the timer above hard-kills it if that never happens. + o.gracefulStop(); + return; + } + // Local sox flushes and exits cleanly on SIGINT; for ssh, SIGTERM. + signal(o.remote ? "SIGTERM" : "SIGINT"); + cleanupOnce(); + }); + return stopping; + }, + kill() { + expected = true; + dropAll = true; + cancelNoAudio?.(); + cancelNoAudio = null; + signal("SIGKILL"); + cleanupOnce(); + }, + }; +} + +// ---------------------------------------------------------------- devices + +export interface ListDevicesDeps { + readonly run?: RunFn; + readonly platform?: NodeJS.Platform; +} + +function isRecord(v: unknown): v is Record { + return typeof v === "object" && v !== null && !Array.isArray(v); +} + +/** Parse `system_profiler SPAudioDataType -json` into input device names. */ +export function parseCoreAudioDevices(json: string): string[] { + const data: unknown = JSON.parse(json); + if (!isRecord(data)) return []; + const groups = data.SPAudioDataType; + if (!Array.isArray(groups)) return []; + const first: unknown = groups[0]; + if (!isRecord(first) || !Array.isArray(first._items)) return []; + const names: string[] = []; + for (const d of first._items as unknown[]) { + if (!isRecord(d) || d.coreaudio_input_source == null) continue; + const name = d.coreaudio_device_name ?? d._name; + if (typeof name === "string" && name) names.push(name); + } + return names; +} + +/** Parse `pactl -f json list sources`, skipping monitor sources. */ +export function parsePactlSources(json: string): string[] { + const data: unknown = JSON.parse(json); + if (!Array.isArray(data)) return []; + const names: string[] = []; + for (const s of data as unknown[]) { + if (!isRecord(s) || typeof s.name !== "string") continue; + if (s.name && !s.name.endsWith(".monitor")) names.push(s.name); + } + return names; +} + +/** Parse `pactl list sources short`, skipping monitor sources. */ +export function parsePactlSourcesShort(text: string): string[] { + return text + .split("\n") + .map((line) => line.trim().split(/\s+/)[1]) + .filter((name): name is string => !!name && !name.endsWith(".monitor")); +} + +/** Local input device names usable as MicConfig.device. [] on failure. */ +export async function listInputDevices(deps: ListDevicesDeps = {}): Promise { + const run = deps.run ?? defaultRun; + const platform = deps.platform ?? process.platform; + try { + if (platform === "darwin") { + const r = await run("system_profiler", ["SPAudioDataType", "-json"], 5000); + return r.code === 0 ? parseCoreAudioDevices(r.stdout) : []; + } + const j = await run("pactl", ["-f", "json", "list", "sources"], 5000); + if (j.code === 0) { + try { + return parsePactlSources(j.stdout); + } catch {} + } + const s = await run("pactl", ["list", "sources", "short"], 5000); + return s.code === 0 ? parsePactlSourcesShort(s.stdout) : []; + } catch { + return []; + } +} diff --git a/src/audio/player.test.ts b/src/audio/player.test.ts new file mode 100644 index 0000000..650c749 --- /dev/null +++ b/src/audio/player.test.ts @@ -0,0 +1,402 @@ +import { describe, expect, test } from "bun:test"; +import { EventEmitter } from "node:events"; +import { PassThrough } from "node:stream"; +import type { PlayEnd, PlayerOutput } from "../types.ts"; +import type { SpawnFn } from "./mic.ts"; +import { createPlayer, remoteKillArgv, remoteRate } from "./player.ts"; +import type { PlayerDeps } from "./player.ts"; +import { wrapPcm } from "./wav.ts"; + +class FakeChild extends EventEmitter { + pid = 7; + stdin = new PassThrough(); + stdout = new PassThrough(); + stderr = new PassThrough(); + signals: string[] = []; + received: Buffer[] = []; + constructor( + readonly cmd: string, + readonly args: readonly string[], + ) { + super(); + this.stdin.on("data", (c: Buffer) => this.received.push(c)); + } + kill(sig: NodeJS.Signals = "SIGTERM"): boolean { + this.signals.push(sig); + return true; + } + close(code: number | null, sig: NodeJS.Signals | null = null): void { + this.emit("close", code, sig); + } +} + +const tick = (): Promise => new Promise((r) => setImmediate(r)); + +// 2 seconds of silence at 16 kHz. +const WAV = wrapPcm(Buffer.alloc(64000), 16000); +const REMOTE = ["ssh", "-i", "k", "-p", "8022", "u@127.0.0.1", "$HOME/bin/playback.sh", "24000"]; + +function harness(output: PlayerOutput, extra: Partial = {}) { + const children: FakeChild[] = []; + let t = 1000; + const kills: (readonly string[])[] = []; + const killResolvers: (() => void)[] = []; + const spawn: SpawnFn = (cmd, args) => { + const c = new FakeChild(cmd, args); + children.push(c); + return c; + }; + const deps: PlayerDeps = { + spawn, + now: () => t, + remoteKill: (command) => + new Promise((resolve) => { + kills.push(command); + killResolvers.push(resolve); + }), + ...extra, + }; + let out = output; + const player = createPlayer(() => out, deps); + return { + player, + children, + kills, + resolveKills: () => killResolvers.splice(0).forEach((r) => r()), + advance: (ms: number) => { + t += ms; + }, + setOutput: (o: PlayerOutput) => { + out = o; + }, + byCmd: (cmd: string) => children.filter((c) => c.cmd === cmd), + }; +} + +function track(p: Promise): { result: PlayEnd | Error | null } { + const box: { result: PlayEnd | Error | null } = { result: null }; + p.then( + (r) => { + box.result = r; + }, + (e: Error) => { + box.result = e; + }, + ); + return box; +} + +describe("player local", () => { + test("plays via sox on stdin and resolves ended on natural close", async () => { + const h = harness({ kind: "local" }); + const p = h.player.play(WAV); + const sox = h.children[0]; + expect(sox?.cmd).toBe("sox"); + expect(sox?.args).toEqual(["-q", "--buffer", "1024", "-t", "wav", "-", "-d"]); + await tick(); + expect(Buffer.concat(sox?.received ?? []).equals(WAV)).toBe(true); + expect(h.player.status()).toBe("playing"); + expect(h.player.durationSec()).toBe(2); + h.advance(500); + expect(h.player.positionSec()).toBeCloseTo(0.5, 6); + sox?.close(0); + expect(await p).toBe("ended"); + expect(h.player.status()).toBe("idle"); + }); + + test("pause SIGSTOPs and freezes position; resume SIGCONTs", () => { + const h = harness({ kind: "local" }); + void h.player.play(WAV); + h.advance(700); + expect(h.player.pause()).toBe(true); + expect(h.player.pause()).toBe(false); + h.advance(5000); + expect(h.player.positionSec()).toBeCloseTo(0.7, 6); + expect(h.player.resume()).toBe(true); + h.advance(300); + expect(h.player.positionSec()).toBeCloseTo(1.0, 6); + expect(h.children[0]?.signals).toEqual(["SIGSTOP", "SIGCONT"]); + expect(h.children).toHaveLength(1); + }); + + test("play supersedes: previous resolves stopped, its stale close is ignored", async () => { + const h = harness({ kind: "local" }); + const first = h.player.play(WAV); + const second = track(h.player.play(WAV)); + expect(await first).toBe("stopped"); + expect(h.children[0]?.signals).toContain("SIGKILL"); + h.children[0]?.close(null, "SIGKILL"); + await tick(); + expect(second.result).toBeNull(); + expect(h.player.status()).toBe("playing"); + h.children[1]?.close(0); + await tick(); + expect(second.result).toBe("ended"); + }); + + test("stop resolves stopped, late close does not change state", async () => { + const h = harness({ kind: "local" }); + const p = h.player.play(WAV); + h.player.stop(); + expect(await p).toBe("stopped"); + expect(h.player.status()).toBe("idle"); + h.children[0]?.close(0); + expect(h.player.status()).toBe("idle"); + expect(h.kills).toHaveLength(0); + }); + + test("spawn ENOENT rejects with install hint", async () => { + const h = harness({ kind: "local" }); + const p = h.player.play(WAV); + h.children[0]?.emit("error", Object.assign(new Error("spawn sox ENOENT"), { code: "ENOENT" })); + h.children[0]?.close(-2); + await expect(p).rejects.toThrow("sox not found: install it with brew install sox"); + }); + + test("non-zero exit rejects with stderr tail", async () => { + const h = harness({ kind: "local" }); + const p = h.player.play(WAV); + h.children[0]?.stderr.write("sox FAIL sox: no default audio device\n"); + await tick(); + h.children[0]?.close(1); + await expect(p).rejects.toThrow( + "Playback failed (sox exit 1): sox FAIL sox: no default audio device", + ); + }); + + test("invalid WAV rejects; dispose refuses further plays", async () => { + const h = harness({ kind: "local" }); + await expect(h.player.play(Buffer.from("nope"))).rejects.toThrow("not a valid WAV"); + const p = h.player.play(WAV); + h.player.dispose(); + expect(await p).toBe("stopped"); + expect(await h.player.play(WAV)).toBe("stopped"); + expect(h.children).toHaveLength(1); + expect(h.player.resume()).toBe(false); + }); +}); + +describe("player remote", () => { + test("pipes ffmpeg s16le at the command's rate into the remote command", async () => { + const h = harness({ kind: "remote", command: REMOTE }); + void h.player.play(WAV); + const [ssh] = h.byCmd("ssh"); + const [ff] = h.byCmd("ffmpeg"); + expect(ssh?.args).toEqual(REMOTE.slice(1)); + expect(ff?.args).toContain("24000"); + expect(ff?.args).not.toContain("-ss"); + await tick(); + expect(Buffer.concat(ff?.received ?? []).equals(WAV)).toBe(true); + ff?.stdout.end(Buffer.from([1, 2, 3, 4])); + await tick(); + expect(Buffer.concat(ssh?.received ?? [])).toEqual(Buffer.from([1, 2, 3, 4])); + }); + + test("pause kills both ends; killed close keeps it paused; resume respawns at offset after kill", async () => { + const h = harness({ kind: "remote", command: REMOTE }); + const p = track(h.player.play(WAV)); + h.advance(1250); + expect(h.player.pause()).toBe(true); + const [ssh1] = h.byCmd("ssh"); + const [ff1] = h.byCmd("ffmpeg"); + expect(ssh1?.signals).toContain("SIGKILL"); + expect(ff1?.signals).toContain("SIGKILL"); + expect(h.kills).toEqual([REMOTE]); + + // The killed ssh's close arrives: must not end the utterance. + ssh1?.close(null, "SIGKILL"); + await tick(); + expect(p.result).toBeNull(); + expect(h.player.status()).toBe("paused"); + expect(h.player.positionSec()).toBeCloseTo(1.25, 6); + + // Resume waits for the remote kill before respawning. + expect(h.player.resume()).toBe(true); + await tick(); + expect(h.byCmd("ssh")).toHaveLength(1); + h.resolveKills(); + await tick(); + expect(h.byCmd("ssh")).toHaveLength(2); + const ff2 = h.byCmd("ffmpeg")[1]; + expect(ff2?.args.slice(3, 5)).toEqual(["-ss", "1.250"]); + h.advance(250); + expect(h.player.positionSec()).toBeCloseTo(1.5, 6); + + h.byCmd("ssh")[1]?.close(0); + await tick(); + expect(p.result).toBe("ended"); + }); + + test("pause again before the kill settles cancels the pending respawn", async () => { + const h = harness({ kind: "remote", command: REMOTE }); + void h.player.play(WAV); + h.player.pause(); + h.player.resume(); + expect(h.player.pause()).toBe(true); + h.resolveKills(); + await tick(); + expect(h.byCmd("ssh")).toHaveLength(1); + expect(h.player.status()).toBe("paused"); + }); + + test("new play over remote playback kills remote audio first (no overlap)", async () => { + const h = harness({ kind: "remote", command: REMOTE }); + const first = h.player.play(WAV); + const second = track(h.player.play(WAV)); + expect(await first).toBe("stopped"); + expect(h.kills).toHaveLength(1); + expect(h.byCmd("ssh")).toHaveLength(1); + h.resolveKills(); + await tick(); + expect(h.byCmd("ssh")).toHaveLength(2); + h.byCmd("ssh")[0]?.close(null, "SIGKILL"); + await tick(); + expect(second.result).toBeNull(); + }); + + test("play after natural end does not run a remote kill", async () => { + const h = harness({ kind: "remote", command: REMOTE }); + const p = h.player.play(WAV); + h.byCmd("ssh")[0]?.close(0); + expect(await p).toBe("ended"); + void h.player.play(WAV); + expect(h.kills).toHaveLength(0); + expect(h.byCmd("ssh")).toHaveLength(2); + }); + + test("stop kills local and remote", async () => { + const h = harness({ kind: "remote", command: REMOTE }); + const p = h.player.play(WAV); + h.player.stop(); + expect(await p).toBe("stopped"); + expect(h.byCmd("ssh")[0]?.signals).toContain("SIGKILL"); + expect(h.kills).toEqual([REMOTE]); + }); + + test("output is read per spawn (switch speaker live)", () => { + const h = harness({ kind: "local" }); + void h.player.play(WAV); + h.setOutput({ kind: "remote", command: REMOTE }); + void h.player.play(WAV); + expect(h.children.map((c) => c.cmd)).toEqual(["sox", "ssh", "ffmpeg"]); + }); +}); + +describe("helpers", () => { + test("remoteKillArgv reuses the ssh target", () => { + expect(remoteKillArgv(REMOTE)).toEqual([ + "ssh", + "-T", + "-o", + "BatchMode=yes", + "-o", + "ConnectTimeout=3", + "-i", + "k", + "-p", + "8022", + "u@127.0.0.1", + "killall play 2>/dev/null; killall mpv 2>/dev/null; pkill -f '[p]layback.sh' 2>/dev/null; true", + ]); + expect(remoteKillArgv(["paplay"])).toBeNull(); + }); + + test("remoteRate parses the last arg, else fallback", () => { + expect(remoteRate(REMOTE, 16000)).toBe(24000); + expect(remoteRate(["ssh", "h", "play.sh"], 16000)).toBe(16000); + expect(remoteRate(["ssh", "h", "1"], 22050)).toBe(22050); + }); +}); + +describe("speed and seek", () => { + test("speed respawns sox at the current position with tempo, position advances faster", async () => { + const h = harness({ kind: "local" }); + void h.player.play(WAV); + h.advance(500); + h.player.setRate(1.5); + const sox = h.byCmd("sox"); + expect(sox.length).toBe(2); + expect(sox[0]?.signals).toContain("SIGKILL"); + expect(sox[1]?.args.join(" ")).toContain("trim 0.500 tempo -s 1.5"); + h.advance(400); + expect(h.player.positionSec()).toBeCloseTo(1.1, 5); + expect(h.player.rate()).toBe(1.5); + }); + + test("the killed process's close never ends the clip after a speed change", async () => { + const h = harness({ kind: "local" }); + const t = track(h.player.play(WAV)); + h.player.setRate(2); + h.byCmd("sox")[0]?.close(null, "SIGKILL"); + await tick(); + expect(t.result).toBeNull(); + expect(h.player.status()).toBe("playing"); + }); + + test("speed change while paused applies on resume, from the paused position", () => { + const h = harness({ kind: "local" }); + void h.player.play(WAV); + h.advance(800); + h.player.pause(); + h.player.setRate(0.75); + expect(h.player.status()).toBe("paused"); + expect(h.byCmd("sox").length).toBe(1); + h.player.resume(); + const sox = h.byCmd("sox"); + expect(sox.length).toBe(2); + expect(sox[1]?.args.join(" ")).toContain("trim 0.800 tempo -s 0.75"); + }); + + test("seek forward/back clamps at 0 and keeps playing", () => { + const h = harness({ kind: "local" }); + void h.player.play(WAV); + h.advance(1000); + expect(h.player.seek(h.player.positionSec() - 5)).toBe(true); + expect(h.byCmd("sox")[1]?.args.includes("trim")).toBe(false); // clamped to 0 + expect(h.player.positionSec()).toBe(0); + h.player.seek(1.25); + expect(h.byCmd("sox")[2]?.args.join(" ")).toContain("trim 1.250"); + }); + + test("seek past the end finishes the clip as ended", async () => { + const h = harness({ kind: "local" }); + const t = track(h.player.play(WAV)); + h.player.seek(10); + await tick(); + expect(t.result).toBe("ended"); + expect(h.player.status()).toBe("idle"); + }); + + test("seek while paused stays paused and resumes at the new spot", () => { + const h = harness({ kind: "local" }); + void h.player.play(WAV); + h.player.pause(); + h.player.seek(1.5); + expect(h.player.status()).toBe("paused"); + expect(h.player.positionSec()).toBe(1.5); + h.player.resume(); + expect(h.byCmd("sox")[1]?.args.join(" ")).toContain("trim 1.500"); + }); + + test("remote: speed uses ffmpeg atempo and silences the phone before respawning", async () => { + const h = harness({ kind: "remote", command: REMOTE }); + void h.player.play(WAV); + h.player.setRate(1.25); + expect(h.kills.length).toBe(1); + expect(h.byCmd("ffmpeg").length).toBe(1); // waits for the remote kill + h.resolveKills(); + await tick(); + const ff = h.byCmd("ffmpeg"); + expect(ff.length).toBe(2); + expect(ff[1]?.args.join(" ")).toContain("-af atempo=1.25"); + }); + + test("rate is clamped and kept across clips; nothing loaded = seek false", () => { + const h = harness({ kind: "local" }); + expect(h.player.seek(1)).toBe(false); + h.player.setRate(9); + expect(h.player.rate()).toBe(2); + void h.player.play(WAV); + expect(h.byCmd("sox")[0]?.args.join(" ")).toContain("tempo -s 2"); + }); +}); diff --git a/src/audio/player.ts b/src/audio/player.ts new file mode 100644 index 0000000..027c7d3 --- /dev/null +++ b/src/audio/player.ts @@ -0,0 +1,438 @@ +// WAV playback on local speakers (sox) or a remote command (ssh to a phone). +// +// One owned process at a time. Every action that replaces or kills the +// process bumps `gen`; a process's close event only counts when its token +// still equals `gen`, so a killed/stale process can never end the current +// utterance. Position is clock-based (elapsed wall time x speed). + +import { clampRate } from "../types.ts"; +import type { Logger, PlayEnd, Player, PlayerOutput, PlayerStatus } from "../types.ts"; +import { defaultSpawn } from "./mic.ts"; +import type { ChildProc, SpawnFn } from "./mic.ts"; +import { defaultRun, parseSshArgv } from "./usb.ts"; +import type { RunFn } from "./usb.ts"; +import { wavDurationSec } from "./wav.ts"; + +export interface PlayerDeps { + readonly spawn?: SpawnFn; + readonly now?: () => number; + readonly run?: RunFn; + /** + * Silence the remote player (audio already streamed to the phone keeps + * playing after the local ssh dies). Must not reject. Default: ssh to the + * same host and kill the phone-side player. + */ + readonly remoteKill?: (command: readonly string[]) => Promise; + /** Remote PCM rate when the command's last arg is not a rate. Default 16000. */ + readonly remoteSampleRate?: number; + readonly logger?: Logger; +} + +const REMOTE_KILL_SCRIPT = + "killall play 2>/dev/null; killall mpv 2>/dev/null; pkill -f '[p]layback.sh' 2>/dev/null; true"; + +/** argv that kills the phone-side player via the same ssh target, or null if not ssh. */ +export function remoteKillArgv(command: readonly string[]): string[] | null { + const t = parseSshArgv(command); + const bin = command[0]; + if (!t || bin === undefined) return null; + return [ + bin, + "-T", + "-o", + "BatchMode=yes", + "-o", + "ConnectTimeout=3", + ...command.slice(1, t.destIndex + 1), + REMOTE_KILL_SCRIPT, + ]; +} + +/** Rate the remote expects: the command's last arg (e.g. playback.sh 16000) when numeric. */ +export function remoteRate(command: readonly string[], fallback: number): number { + const n = Number(command[command.length - 1]); + return Number.isInteger(n) && n >= 8000 && n <= 192000 ? n : fallback; +} + +export function localPlayArgs(offsetSec: number, speed = 1): string[] { + // Small buffer so SIGSTOP lands close to the audible position. + const argv = ["-q", "--buffer", "1024", "-t", "wav", "-", "-d"]; + if (offsetSec > 0) argv.push("trim", offsetSec.toFixed(3)); + // tempo -s: speech-tuned time stretch that keeps the voice's pitch. + if (speed !== 1) argv.push("tempo", "-s", String(speed)); + return argv; +} + +export function ffmpegArgs(offsetSec: number, rate: number, speed = 1): string[] { + return [ + "-hide_banner", + "-loglevel", + "error", + ...(offsetSec > 0 ? ["-ss", offsetSec.toFixed(3)] : []), + "-i", + "pipe:0", + ...(speed !== 1 ? ["-af", `atempo=${speed}`] : []), + "-f", + "s16le", + "-acodec", + "pcm_s16le", + "-ar", + String(rate), + "-ac", + "1", + "pipe:1", + ]; +} + +interface Owned { + readonly kind: "local" | "remote"; + readonly child: ChildProc; + ff: ChildProc | null; +} + +interface Pending { + readonly resolve: (end: PlayEnd) => void; + readonly reject: (err: Error) => void; +} + +function lastLine(s: string): string { + return s.trim().split("\n").pop()?.trim() ?? ""; +} + +function errnoCode(err: unknown): string | undefined { + if (err && typeof err === "object" && "code" in err) { + const c = (err as { code: unknown }).code; + return typeof c === "string" ? c : undefined; + } + return undefined; +} + +function hardKill(p: ChildProc | null): void { + if (!p) return; + try { + p.kill("SIGKILL"); + } catch {} +} + +export function createPlayer(getOutput: () => PlayerOutput, deps: PlayerDeps = {}): Player { + const spawn = deps.spawn ?? defaultSpawn; + const now = deps.now ?? (() => Date.now()); + const run = deps.run ?? defaultRun; + const log = (msg: string, level: "debug" | "warn" = "debug"): void => + deps.logger?.log("player", msg, level); + const remoteKill = + deps.remoteKill ?? + (async (command: readonly string[]): Promise => { + const argv = remoteKillArgv(command); + const bin = argv?.[0]; + if (!argv || bin === undefined) return; + const r = await run(bin, argv.slice(1), 4000); + if (r.code !== 0) log(`remote kill exit=${r.code}`, "warn"); + }); + + let wav: Buffer | null = null; + let totalSec = 0; + let status: PlayerStatus = "idle"; + let baseSec = 0; + let anchorMs = 0; + let speed = 1; + let gen = 0; + let proc: Owned | null = null; + let pending: Pending | null = null; + let disposed = false; + /** Remote audio may still be sounding on the phone (needs a remote kill). */ + let remoteLive: readonly string[] | null = null; + /** Explicit silence command for the live remote output, if it gave one. */ + let remoteKillCmd: readonly string[] | null = null; + /** In-flight remote kill; any respawn waits for it. Never rejects. */ + let killing: Promise | null = null; + + function positionSec(): number { + if (status === "playing" && proc) { + return Math.min(totalSec, baseSec + (Math.max(0, now() - anchorMs) / 1000) * speed); + } + return Math.min(totalSec, baseSec); + } + + function settle(result: PlayEnd | Error): void { + const p = pending; + pending = null; + if (!p) return; + if (result instanceof Error) p.reject(result); + else p.resolve(result); + } + + function killRemote(): void { + const command = remoteLive; + const explicit = remoteKillCmd; + remoteLive = null; + remoteKillCmd = null; + if (!command) return; + const p = ( + explicit && explicit[0] !== undefined + ? run(explicit[0], explicit.slice(1), 5000).then((r) => { + if (r.code !== 0) log(`remote kill exit=${r.code}`, "warn"); + }) + : remoteKill(command) + ).catch(() => {}); + const chained = killing ? Promise.all([killing, p]).then(() => {}) : p; + killing = chained; + void chained.then(() => { + if (killing === chained) killing = null; + }); + } + + function killLocal(): void { + const owned = proc; + proc = null; + if (!owned) return; + hardKill(owned.ff); + hardKill(owned.child); + } + + function stop(): void { + gen += 1; + if (status !== "idle") baseSec = positionSec(); + killLocal(); + killRemote(); + status = "idle"; + settle("stopped"); + } + + /** Spawn at offset once any in-flight remote kill finished, if still current. */ + function startAt(offsetSec: number): void { + gen += 1; + const token = gen; + status = "playing"; + baseSec = offsetSec; + const wait = killing; + if (!wait) { + spawnAt(offsetSec, token); + return; + } + void wait.then(() => { + if (token === gen && status === "playing" && !proc) spawnAt(offsetSec, token); + }); + } + + function onEnd(token: number, err: Error | null): void { + if (token !== gen) return; // stale: killed/superseded process + const owned = proc; + proc = null; + if (owned?.kind === "remote") remoteLive = null; + status = "idle"; + baseSec = totalSec; + if (err) log(`playback failed: ${err.message}`, "warn"); + settle(err ?? "ended"); + } + + function spawnAt(offsetSec: number, token: number): void { + const audio = wav; + if (!audio) return; + const out = getOutput(); + let stderrTail = ""; + let failed: Error | null = null; + const binOf = (out.kind === "remote" ? out.command[0] : "sox") ?? "remote command"; + + const spawnErr = (bin: string, err: unknown): Error => { + if (errnoCode(err) === "ENOENT") { + return new Error( + bin === "sox" + ? "sox not found: install it with brew install sox" + : `${bin} not found: install it or fix the playback command`, + ); + } + return new Error( + `Could not start ${bin}: ${err instanceof Error ? err.message : String(err)}`, + ); + }; + + let child: ChildProc; + let ff: ChildProc | null = null; + try { + if (out.kind === "remote") { + const [bin, ...rest] = out.command; + if (bin === undefined) throw new Error("empty remote playback command"); + child = spawn(bin, rest, { stdio: ["pipe", "ignore", "pipe"] }); + } else { + child = spawn("sox", localPlayArgs(offsetSec, speed), { + stdio: ["pipe", "ignore", "pipe"], + }); + } + } catch (err) { + queueMicrotask(() => onEnd(token, spawnErr(binOf, err))); + return; + } + + anchorMs = now(); + baseSec = offsetSec; + const owned: Owned = { kind: out.kind, child, ff: null }; + proc = owned; + if (out.kind === "remote") { + remoteLive = out.command; + remoteKillCmd = out.kill ?? null; + } + log( + `spawn kind=${out.kind} offset=${offsetSec.toFixed(2)} speed=${speed} bytes=${audio.length}`, + ); + + child.stderr?.on("data", (c: Buffer | string) => { + stderrTail = (stderrTail + c.toString()).slice(-400); + }); + child.stdin?.on("error", () => {}); // EPIPE when the player dies early + child.on("error", (err) => { + failed ??= spawnErr(binOf, err); + }); + child.on("close", (code, sig) => { + if (token === gen) hardKill(ff); + if (!failed && code !== 0 && code !== null) { + const detail = lastLine(stderrTail); + failed = new Error(`Playback failed (${binOf} exit ${code})${detail ? `: ${detail}` : ""}`); + } + if (!failed && code === null && sig !== null && token === gen) { + failed = new Error(`Playback interrupted (${sig})`); + } + onEnd(token, failed); + }); + + if (out.kind === "local") { + child.stdin?.end(audio); + return; + } + + // Remote: convert to raw s16le at the remote's rate, seeking with -ss. + const rate = out.rate ?? remoteRate(out.command, deps.remoteSampleRate ?? 16000); + try { + ff = spawn("ffmpeg", ffmpegArgs(offsetSec, rate, speed), { + stdio: ["pipe", "pipe", "pipe"], + }); + } catch (err) { + failed = spawnErr("ffmpeg", err); + hardKill(child); + return; + } + owned.ff = ff; + const stdin = child.stdin; + ff.on("error", (err) => { + failed ??= spawnErr("ffmpeg", err); + try { + stdin?.end(); + } catch {} + }); + ff.stdin?.on("error", () => {}); + ff.stderr?.resume(); + if (ff.stdout && stdin) ff.stdout.pipe(stdin); + else stdin?.end(); + ff.stdin?.end(audio); + } + + /** + * Restart output at `offsetSec` with the current speed, keeping the state: + * playing respawns now, paused drops the frozen process so resume + * respawns at the new offset (a SIGSTOPped sox cannot change speed/offset). + */ + function restartAt(offsetSec: number): void { + if (status === "playing") { + killLocal(); + killRemote(); + startAt(offsetSec); + return; + } + gen += 1; + killLocal(); + killRemote(); + baseSec = offsetSec; + } + + return { + seek(sec) { + if (disposed || !wav || status === "idle") return false; + if (!(sec < totalSec)) { + // Past the end: finish this clip so the caller moves on. + gen += 1; + killLocal(); + killRemote(); + status = "idle"; + baseSec = totalSec; + settle("ended"); + return true; + } + restartAt(Math.max(0, sec)); + return true; + }, + + setRate(next) { + const r = clampRate(next); + if (r === speed) return; + const at = positionSec(); + speed = r; + if (!disposed && wav && status !== "idle") restartAt(at); + }, + + rate: () => speed, + + play(input) { + if (disposed) return Promise.resolve("stopped"); + const dur = wavDurationSec(input); + if (dur === null) return Promise.reject(new Error("Cannot play: audio is not a valid WAV")); + // Supersede: previous promise resolves "stopped", phone gets silenced. + settle("stopped"); + killLocal(); + killRemote(); + wav = input; + totalSec = dur; + const promise = new Promise((resolve, reject) => { + pending = { resolve, reject }; + }); + startAt(0); + return promise; + }, + + pause() { + if (disposed || status !== "playing") return false; + baseSec = positionSec(); + status = "paused"; + const owned = proc; + if (owned?.kind === "local") { + try { + owned.child.kill("SIGSTOP"); + } catch {} + return true; + } + // Remote (or still waiting to respawn): SIGSTOP on ssh does not pause + // the phone, so kill both ends and respawn at the offset on resume. + gen += 1; + killLocal(); + killRemote(); + return true; + }, + + resume() { + if (disposed || status !== "paused") return false; + const owned = proc; + if (owned?.kind === "local") { + status = "playing"; + anchorMs = now(); + try { + owned.child.kill("SIGCONT"); + } catch {} + return true; + } + startAt(baseSec); + return true; + }, + + stop, + + status: () => status, + positionSec, + durationSec: () => totalSec, + + dispose() { + if (disposed) return; + stop(); + disposed = true; + wav = null; + }, + }; +} diff --git a/src/audio/usb.test.ts b/src/audio/usb.test.ts new file mode 100644 index 0000000..2c4bfa2 --- /dev/null +++ b/src/audio/usb.test.ts @@ -0,0 +1,124 @@ +import { describe, expect, test } from "bun:test"; +import { ensureUsbForward, loopbackSshPort, parseSshArgv } from "./usb.ts"; +import type { RunFn, RunResult } from "./usb.ts"; + +function fakeRun(results: Record): { + run: RunFn; + calls: { cmd: string; args: readonly string[]; timeoutMs: number }[]; +} { + const calls: { cmd: string; args: readonly string[]; timeoutMs: number }[] = []; + const run: RunFn = async (cmd, args, timeoutMs) => { + calls.push({ cmd, args, timeoutMs }); + const key = args[0] === "-s" ? "forward" : (args[0] ?? ""); + return results[key] ?? { code: 0, stdout: "", stderr: "" }; + }; + return { run, calls }; +} + +const ok = (stdout = ""): RunResult => ({ code: 0, stdout, stderr: "" }); + +describe("loopbackSshPort", () => { + test("ssh to 127.0.0.1 / localhost returns -p port", () => { + expect(loopbackSshPort(["ssh", "-p", "8022", "u0_a1@127.0.0.1", "capture.sh"])).toBe(8022); + expect(loopbackSshPort(["/usr/bin/ssh", "-T", "-p8022", "localhost", "x"])).toBe(8022); + expect(loopbackSshPort(["ssh", "-Tp", "2222", "me@localhost"])).toBe(2222); + expect(loopbackSshPort(["ssh", "-o", "Port=9000", "127.0.0.1"])).toBe(9000); + expect(loopbackSshPort(["ssh", "ssh://u@127.0.0.1:7000", "x"])).toBe(7000); + }); + + test("default port 22, option values are not taken as the host", () => { + expect( + loopbackSshPort(["ssh", "-i", "~/.ssh/k", "-o", "StrictHostKeyChecking=no", "u@127.0.0.1"]), + ).toBe(22); + }); + + test("non-loopback or non-ssh returns null", () => { + expect(loopbackSshPort(["ssh", "-p", "8022", "u@100.1.2.3", "x"])).toBeNull(); + expect(loopbackSshPort(["arecord", "-p", "8022", "localhost"])).toBeNull(); + expect(loopbackSshPort([])).toBeNull(); + expect(loopbackSshPort(["ssh", "-p", "8022"])).toBeNull(); + }); + + test("parseSshArgv reports destination index", () => { + const t = parseSshArgv(["ssh", "-i", "k", "-p", "8022", "u@h", "cmd", "16000"]); + expect(t).toEqual({ destIndex: 5, host: "h", port: 8022 }); + }); +}); + +describe("ensureUsbForward", () => { + test("picks the physical device, skips emulators, forwards the port", async () => { + const { run, calls } = fakeRun({ + devices: ok("List of devices attached\nemulator-5554\tdevice\nR58M123ABC\tdevice\n\n"), + }); + expect(await ensureUsbForward(8022, { run })).toEqual({ ok: true }); + expect(calls[1]?.args).toEqual(["-s", "R58M123ABC", "forward", "tcp:8022", "tcp:8022"]); + expect(calls.every((c) => c.cmd === "adb" && c.timeoutMs === 10_000)).toBe(true); + }); + + test("is idempotent: a second call forwards again without error", async () => { + const { run, calls } = fakeRun({ devices: ok("List of devices attached\nABC\tdevice\n") }); + await ensureUsbForward(8022, { run }); + expect(await ensureUsbForward(8022, { run })).toEqual({ ok: true }); + expect(calls.filter((c) => c.args[0] === "-s")).toHaveLength(2); + }); + + test("forward failure reports stderr and the manual command", async () => { + const { run } = fakeRun({ + devices: ok("List of devices attached\nABC\tdevice\n"), + forward: { + code: 1, + stdout: "", + stderr: "adb: error: cannot bind listener: Address in use\n", + }, + }); + const r = await ensureUsbForward(8022, { run }); + expect(r).toEqual({ + ok: false, + message: "adb forward tcp:8022 failed: adb: error: cannot bind listener: Address in use", + hint: "Replug the USB cable, then run: adb forward tcp:8022 tcp:8022", + }); + }); + + test("only emulators → no phone", async () => { + const { run } = fakeRun({ devices: ok("List of devices attached\nemulator-5554\tdevice\n") }); + const r = await ensureUsbForward(8022, { run }); + expect(r.ok).toBe(false); + if (!r.ok) expect(r.message).toBe("Only emulators attached, no USB phone"); + }); + + test("no device / unauthorized / multiple", async () => { + const none = await ensureUsbForward(1, { run: fakeRun({ devices: ok("List\n") }).run }); + expect(none.ok === false && none.message).toBe("No Android phone attached over USB"); + const unauth = await ensureUsbForward(1, { + run: fakeRun({ devices: ok("List\nABC\tunauthorized\n") }).run, + }); + expect(unauth.ok === false && unauth.hint).toBe( + "Unlock the phone and accept the USB debugging prompt", + ); + const multi = await ensureUsbForward(1, { + run: fakeRun({ devices: ok("List\nA\tdevice\nB\tdevice\n") }).run, + }); + expect(multi.ok === false && multi.message).toBe("Multiple Android devices attached (A, B)"); + }); + + test("explicit serial must be attached", async () => { + const { run, calls } = fakeRun({ devices: ok("List\nA\tdevice\nB\tdevice\n") }); + expect(await ensureUsbForward(8022, { run, serial: "B" })).toEqual({ ok: true }); + expect(calls[1]?.args[1]).toBe("B"); + const r = await ensureUsbForward(8022, { run, serial: "Z" }); + expect(r.ok).toBe(false); + }); + + test("adb missing / adb devices failing", async () => { + const missing = await ensureUsbForward(1, { + run: fakeRun({ + devices: { code: null, stdout: "", stderr: "", error: { code: "ENOENT", message: "x" } }, + }).run, + }); + expect(missing.ok === false && missing.message).toBe("adb not found on PATH"); + const failing = await ensureUsbForward(1, { + run: fakeRun({ devices: { code: 1, stdout: "", stderr: "daemon not running\n" } }).run, + }); + expect(failing.ok === false && failing.message).toBe("adb devices failed: daemon not running"); + }); +}); diff --git a/src/audio/usb.ts b/src/audio/usb.ts new file mode 100644 index 0000000..7141189 --- /dev/null +++ b/src/audio/usb.ts @@ -0,0 +1,212 @@ +// USB (adb) forward for phone-over-USB ssh. A remote command that targets +// localhost through ssh -p P needs `adb forward tcp:P tcp:P` to reach the +// phone's sshd. All execution is argv-based (no shell) and bounded. + +import { execFile } from "node:child_process"; + +export interface RunResult { + /** Exit code; null when the process could not run or was killed. */ + readonly code: number | null; + readonly stdout: string; + readonly stderr: string; + /** Set when the binary could not run (ENOENT, timeout, ...). */ + readonly error?: { readonly code?: string; readonly message: string }; +} + +export type RunFn = (cmd: string, args: readonly string[], timeoutMs: number) => Promise; + +export const defaultRun: RunFn = (cmd, args, timeoutMs) => + new Promise((resolve) => { + execFile(cmd, [...args], { timeout: timeoutMs, encoding: "utf8" }, (err, stdout, stderr) => { + if (!err) { + resolve({ code: 0, stdout, stderr }); + } else if (typeof err.code === "number") { + resolve({ code: err.code, stdout, stderr }); + } else { + resolve({ code: null, stdout, stderr, error: { code: err.code, message: err.message } }); + } + }); + }); + +export interface SshTarget { + /** Index of the destination argument in argv. */ + readonly destIndex: number; + readonly host: string; + readonly port: number; +} + +// ssh options that consume a value (from ssh(1)). +const SSH_VALUE_OPTS = new Set("BbcDEeFIiJLlmOoPpQRSWw"); + +function basename(p: string): string { + const i = p.lastIndexOf("/"); + return i >= 0 ? p.slice(i + 1) : p; +} + +/** Parse an ssh argv: destination index, host (no user), port. null if not ssh. */ +export function parseSshArgv(argv: readonly string[]): SshTarget | null { + const bin = argv[0]; + if (bin === undefined || basename(bin) !== "ssh") return null; + let port: number | null = null; + for (let i = 1; i < argv.length; i++) { + const tok = argv[i]; + if (tok === undefined) break; + if (tok === "--") { + const dest = argv[i + 1]; + return dest === undefined ? null : target(i + 1, dest, port); + } + if (tok.startsWith("-") && tok.length > 1) { + // Combined flags like -Tp8022 or -T -p 8022. + for (let j = 1; j < tok.length; j++) { + const ch = tok.charAt(j); + if (!SSH_VALUE_OPTS.has(ch)) continue; + let value = tok.slice(j + 1); + if (value === "") { + i += 1; + value = argv[i] ?? ""; + } + if (ch === "p") port = toPort(value) ?? port; + if (ch === "o") { + const m = /^port[=\s]\s*(\d+)$/i.exec(value.trim()); + if (m?.[1] !== undefined && port === null) port = toPort(m[1]); + } + break; + } + continue; + } + return target(i, tok, port); + } + return null; +} + +function toPort(v: string): number | null { + const n = Number(v); + return Number.isInteger(n) && n > 0 && n < 65536 ? n : null; +} + +function target(destIndex: number, dest: string, port: number | null): SshTarget { + let host = dest; + let urlPort: number | null = null; + if (host.startsWith("ssh://")) { + host = host.slice(6); + const m = /:(\d+)$/.exec(host); + if (m?.[1] !== undefined) { + urlPort = toPort(m[1]); + host = host.slice(0, m.index); + } + } + const at = host.lastIndexOf("@"); + if (at >= 0) host = host.slice(at + 1); + return { destIndex, host, port: port ?? urlPort ?? 22 }; +} + +const LOOPBACK = new Set(["localhost", "127.0.0.1", "::1", "[::1]"]); + +/** Port of an ssh command that targets this machine (localhost/127.0.0.1), else null. */ +export function loopbackSshPort(argv: readonly string[]): number | null { + const t = parseSshArgv(argv); + if (!t || !LOOPBACK.has(t.host.toLowerCase())) return null; + return t.port; +} + +export type UsbForwardResult = { ok: true } | { ok: false; message: string; hint: string }; + +export interface UsbDeps { + readonly run?: RunFn; + readonly timeoutMs?: number; + /** Explicit device serial; otherwise the single attached physical device. */ + readonly serial?: string; +} + +const ADB_MISSING: UsbForwardResult = { + ok: false, + message: "adb not found on PATH", + hint: "Install Android platform-tools: brew install android-platform-tools", +}; + +function lastLine(s: string): string { + return s.trim().split("\n").pop()?.trim() ?? ""; +} + +/** Ensure `adb -s forward tcp:P tcp:P`. Re-running is harmless (adb replaces it). */ +export async function ensureUsbForward( + port: number, + deps: UsbDeps = {}, +): Promise { + const run = deps.run ?? defaultRun; + const timeoutMs = deps.timeoutMs ?? 10_000; + const spec = `tcp:${port}`; + + const listed = await run("adb", ["devices"], timeoutMs); + if (listed.error?.code === "ENOENT") return ADB_MISSING; + if (listed.code !== 0) { + const why = lastLine(listed.stderr) || listed.error?.message || `exit ${listed.code}`; + return { + ok: false, + message: `adb devices failed: ${why}`, + hint: "Restart adb: adb kill-server && adb start-server", + }; + } + + const ready: string[] = []; + const unauthorized: string[] = []; + let emulators = 0; + for (const line of listed.stdout.split("\n")) { + const m = /^(\S+)\s+(\S+)$/.exec(line.trim()); + if (!m?.[1] || !m[2]) continue; + const [, serial, state] = m; + if (serial.startsWith("emulator-")) { + emulators += 1; + continue; + } + if (state === "device") ready.push(serial); + else if (state === "unauthorized") unauthorized.push(serial); + } + + let serial: string; + if (deps.serial) { + if (!ready.includes(deps.serial)) { + return { + ok: false, + message: `Android device ${deps.serial} is not attached`, + hint: "Plug in the phone or fix the configured device serial", + }; + } + serial = deps.serial; + } else if (ready.length === 1 && ready[0] !== undefined) { + serial = ready[0]; + } else if (ready.length > 1) { + return { + ok: false, + message: `Multiple Android devices attached (${ready.join(", ")})`, + hint: "Unplug the extra devices so only the phone is attached", + }; + } else if (unauthorized.length > 0) { + return { + ok: false, + message: "Phone is attached but USB debugging is not authorized", + hint: "Unlock the phone and accept the USB debugging prompt", + }; + } else { + return { + ok: false, + message: + emulators > 0 + ? "Only emulators attached, no USB phone" + : "No Android phone attached over USB", + hint: "Plug in the phone with USB debugging enabled", + }; + } + + const fwd = await run("adb", ["-s", serial, "forward", spec, spec], timeoutMs); + if (fwd.error?.code === "ENOENT") return ADB_MISSING; + if (fwd.code !== 0) { + const why = lastLine(fwd.stderr) || fwd.error?.message || `exit ${fwd.code}`; + return { + ok: false, + message: `adb forward ${spec} failed: ${why}`, + hint: `Replug the USB cable, then run: adb forward ${spec} ${spec}`, + }; + } + return { ok: true }; +} diff --git a/src/audio/wav.test.ts b/src/audio/wav.test.ts new file mode 100644 index 0000000..f646158 --- /dev/null +++ b/src/audio/wav.test.ts @@ -0,0 +1,68 @@ +import { describe, expect, test } from "bun:test"; +import { parseWav, pcmRms, wavDurationSec, wrapPcm } from "./wav.ts"; + +function pcmOf(samples: number[]): Buffer { + const b = Buffer.alloc(samples.length * 2); + samples.forEach((s, i) => b.writeInt16LE(s, i * 2)); + return b; +} + +describe("wav", () => { + test("wrapPcm round-trips through parseWav", () => { + const pcm = pcmOf([1, -2, 3, 32767]); + const wav = wrapPcm(pcm, 16000); + expect(wav.length).toBe(44 + pcm.length); + const info = parseWav(wav); + expect(info).not.toBeNull(); + expect(info?.sampleRate).toBe(16000); + expect(info?.channels).toBe(1); + expect(info?.bits).toBe(16); + expect(info?.data.equals(pcm)).toBe(true); + }); + + test("tolerates a data size larger than the buffer (streamed 0xFFFFFFFF)", () => { + const pcm = Buffer.alloc(3200); + const wav = wrapPcm(pcm, 16000); + wav.writeUInt32LE(0xffffffff, 40); + wav.writeUInt32LE(0xffffffff, 4); + const info = parseWav(wav); + expect(info?.data.length).toBe(3200); + expect(wavDurationSec(wav)).toBeCloseTo(0.1, 6); + }); + + test("walks extra chunks (LIST, odd-sized pad) before data", () => { + const pcm = pcmOf([5, 6]); + const base = wrapPcm(pcm, 22050); + const list = Buffer.alloc(8 + 3 + 1); + list.write("LIST", 0, "ascii"); + list.writeUInt32LE(3, 4); + const wav = Buffer.concat([base.subarray(0, 36), list, base.subarray(36)]); + const info = parseWav(wav); + expect(info?.sampleRate).toBe(22050); + expect(info?.data.equals(pcm)).toBe(true); + }); + + test("rejects non-WAV, missing fmt, and truncated input", () => { + expect(parseWav(Buffer.from("hello world, not a wav"))).toBeNull(); + expect(parseWav(Buffer.alloc(4))).toBeNull(); + const noFmt = Buffer.alloc(20); + noFmt.write("RIFF", 0, "ascii"); + noFmt.write("WAVE", 8, "ascii"); + noFmt.write("data", 12, "ascii"); + noFmt.writeUInt32LE(0, 16); + expect(parseWav(noFmt)).toBeNull(); + expect(wavDurationSec(Buffer.from("nope"))).toBeNull(); + }); + + test("wavDurationSec uses real data length", () => { + expect(wavDurationSec(wrapPcm(Buffer.alloc(32000), 16000))).toBe(1); + }); + + test("pcmRms", () => { + expect(pcmRms(Buffer.alloc(0))).toBe(0); + expect(pcmRms(Buffer.alloc(1))).toBe(0); + expect(pcmRms(pcmOf([0, 0, 0]))).toBe(0); + expect(pcmRms(pcmOf([-32768, -32768]))).toBe(1); + expect(pcmRms(pcmOf([16384, -16384]))).toBeCloseTo(0.5, 6); + }); +}); diff --git a/src/audio/wav.ts b/src/audio/wav.ts new file mode 100644 index 0000000..3c3764d --- /dev/null +++ b/src/audio/wav.ts @@ -0,0 +1,85 @@ +// WAV / PCM helpers. Raw PCM is always s16le mono (see src/types.ts). + +export interface WavInfo { + readonly sampleRate: number; + readonly channels: number; + readonly bits: number; + /** PCM payload. Clamped to the buffer when the header claims more. */ + readonly data: Buffer; +} + +/** Wrap s16le mono PCM in a 44-byte PCM WAV header. */ +export function wrapPcm(pcm: Buffer, sampleRate: number): Buffer { + const channels = 1; + const bits = 16; + const blockAlign = channels * (bits / 8); + const header = Buffer.alloc(44); + header.write("RIFF", 0, "ascii"); + header.writeUInt32LE(36 + pcm.length, 4); + header.write("WAVE", 8, "ascii"); + header.write("fmt ", 12, "ascii"); + header.writeUInt32LE(16, 16); + header.writeUInt16LE(1, 20); // PCM + header.writeUInt16LE(channels, 22); + header.writeUInt32LE(sampleRate, 24); + header.writeUInt32LE(sampleRate * blockAlign, 28); + header.writeUInt16LE(blockAlign, 32); + header.writeUInt16LE(bits, 34); + header.write("data", 36, "ascii"); + header.writeUInt32LE(pcm.length, 40); + return Buffer.concat([header, pcm]); +} + +/** + * Walk RIFF chunks to find `fmt ` and `data`. Tolerates a data size larger + * than the buffer (streamed WAVs write 0xFFFFFFFF or a stale size). + */ +export function parseWav(buf: Buffer): WavInfo | null { + if (buf.length < 12) return null; + if (buf.toString("ascii", 0, 4) !== "RIFF" || buf.toString("ascii", 8, 12) !== "WAVE") { + return null; + } + let fmt: { sampleRate: number; channels: number; bits: number } | null = null; + let offset = 12; + while (offset + 8 <= buf.length) { + const id = buf.toString("ascii", offset, offset + 4); + const size = buf.readUInt32LE(offset + 4); + const body = offset + 8; + if (id === "fmt ") { + if (size < 16 || body + 16 > buf.length) return null; + const channels = buf.readUInt16LE(body + 2); + const sampleRate = buf.readUInt32LE(body + 4); + const bits = buf.readUInt16LE(body + 14); + if (channels === 0 || sampleRate === 0 || bits === 0) return null; + fmt = { sampleRate, channels, bits }; + } else if (id === "data") { + if (!fmt) return null; + const end = Math.min(buf.length, body + size); + return { ...fmt, data: buf.subarray(body, end) }; + } + // Chunks are word-aligned: odd sizes carry one pad byte. + offset = body + size + (size % 2); + } + return null; +} + +/** Duration in seconds from the real data length, or null when unreadable. */ +export function wavDurationSec(buf: Buffer): number | null { + const info = parseWav(buf); + if (!info) return null; + const bytesPerSec = info.sampleRate * info.channels * (info.bits / 8); + if (!(bytesPerSec > 0)) return null; + return info.data.length / bytesPerSec; +} + +/** RMS (0..1) of s16le samples. 0 for empty input; a trailing odd byte is ignored. */ +export function pcmRms(pcm: Buffer): number { + const usable = pcm.length - (pcm.length % 2); + if (usable <= 0) return 0; + let sum = 0; + for (let i = 0; i < usable; i += 2) { + const n = pcm.readInt16LE(i) / 32768; + sum += n * n; + } + return Math.sqrt(sum / (usable / 2)); +} diff --git a/src/commands.ts b/src/commands.ts new file mode 100644 index 0000000..8cc2791 --- /dev/null +++ b/src/commands.ts @@ -0,0 +1,162 @@ +// Palette / slash / keybind commands. Ids keep the JS plugin's names so +// existing `keybinds` overrides still apply. +import type { KeymapCommand, SelectOption } from "./host.ts"; +import type { NormalizeMode, SttMode, TtsEngine } from "./config.ts"; +import type { SttLanguage } from "./types.ts"; + +export interface CommandActions { + sttToggle(): void; + sttCorrect(): void; + sttPause(): void; + cancelAll(): void; + ttsToggle(): void; + ttsPause(): void; + ttsStop(): void; + ttsReplay(): void; + ttsBack(): void; + ttsForward(): void; + ttsFaster(): void; + ttsSlower(): void; + pickRate(): Promise; + toggleAutoSubmit(): void; + toggleAutoEnd(): void; + toggleTtsAuto(): void; + pickSttMode(): Promise; + pickNormalize(): Promise; + pickLanguage(): Promise; + pickWhisperModel(): Promise; + pickSttEngine(): Promise; + pickMic(): Promise; + pickDevice(): Promise; + pickTtsEngine(): Promise; + pickVoice(): Promise; + pickTtsOutput(): Promise; + pickVoiceModel(): Promise; + showStatus(): void; +} + +const DEFAULT_BINDS: Record = { + "stt.record": "[", + "tts.speak-last": "]", + "voice.cancel": ".", + "tts.replay": "0", + "tts.rewind": "-", + "tts.forward": "=", +}; + +export function buildCommands( + a: CommandActions, + overrides: Readonly>, +): KeymapCommand[] { + const bind = (id: string): false | string => { + const v = overrides[id] ?? DEFAULT_BINDS[id]; + return v && v !== "none" ? v : false; + }; + const cmd = ( + id: string, + title: string, + slash: string, + run: () => void | Promise, + description?: string, + ): KeymapCommand => ({ + id, + title, + group: "Voice", + palette: true, + slash: { name: slash }, + bind: bind(id), + ...(description ? { description } : {}), + run: () => { + void Promise.resolve(run()).catch(() => {}); + }, + }); + return [ + cmd("stt.record", "Voice: speak (start / finish dictation)", "stt", a.sttToggle), + cmd("stt.correct", "Voice: fix — re-speak to correct the text", "stt-fix", a.sttCorrect), + cmd("stt.pause", "Voice: pause / resume live dictation", "stt-pause", a.sttPause), + cmd("voice.cancel", "Voice: cancel everything", "voice-cancel", a.cancelAll), + cmd("tts.speak-last", "Voice: read the last reply (or stop)", "tts-speak", a.ttsToggle), + cmd("tts.pause", "Voice: pause / resume reading", "tts-pause", a.ttsPause), + cmd("tts.stop", "Voice: stop reading", "tts-stop", a.ttsStop), + cmd("tts.replay", "Voice: replay the last reading", "tts-replay", a.ttsReplay), + cmd("tts.rewind", "Voice: back 5 seconds", "tts-rewind", a.ttsBack), + cmd("tts.forward", "Voice: forward 5 seconds", "tts-forward", a.ttsForward), + cmd("tts.faster", "Voice: read faster", "tts-faster", a.ttsFaster), + cmd("tts.slower", "Voice: read slower", "tts-slower", a.ttsSlower), + cmd("tts.rate", "Voice: reading speed", "tts-rate", a.pickRate), + cmd( + "stt.autosubmit", + "Voice: toggle auto-submit after dictation", + "stt-autosubmit", + a.toggleAutoSubmit, + ), + cmd("stt.autoend", "Voice: toggle auto-finish on silence", "stt-auto-end", a.toggleAutoEnd), + cmd("tts.mode", "Voice: toggle auto-read replies", "tts-mode", a.toggleTtsAuto), + cmd("stt.mode", "Voice: dictation mode (live / batch)", "stt-mode", a.pickSttMode), + cmd("stt.normalize", "Voice: LLM clean-up of dictation", "stt-normalize", a.pickNormalize), + cmd("stt.language", "Voice: dictation language", "stt-language", a.pickLanguage), + cmd("stt.model", "Voice: whisper model", "stt-model", a.pickWhisperModel), + cmd("stt.engine", "Voice: transcription engine (local / API)", "stt-engine", a.pickSttEngine), + cmd("stt.mic", "Voice: microphone (Mac / phone)", "stt-mic", a.pickMic), + cmd( + "voice.device", + "Voice: speak and listen on (follow me / pick a device)", + "voice-device", + a.pickDevice, + ), + cmd("tts.engine", "Voice: speech engine (VieNeu / Piper)", "tts-engine", a.pickTtsEngine), + cmd("tts.voice", "Voice: VieNeu voice", "tts-voice", a.pickVoice), + cmd("tts.output", "Voice: speaker (Mac / phone)", "tts-output", a.pickTtsOutput), + cmd("voice.model", "Voice: LLM model for clean-up and fix", "voice-model", a.pickVoiceModel), + cmd("voice.status", "Voice: status and diagnostics", "voice-status", a.showStatus), + ]; +} + +// Static option lists used by the pickers. + +export const STT_MODE_OPTIONS: readonly SelectOption[] = [ + { title: "Live", value: "streaming", description: "Text appears while you speak" }, + { title: "Batch", value: "batch", description: "Speak, then the whole recording is transcribed" }, +]; + +export const NORMALIZE_OPTIONS: readonly SelectOption[] = [ + { + title: "Batch only", + value: "batch", + description: "Clean up batch dictation; live text stays as heard", + }, + { + title: "Always", + value: "all", + description: "Also clean up live dictation (adds a short wait)", + }, + { title: "Off", value: "off", description: "Insert exactly what whisper heard" }, +]; + +export const LANGUAGE_OPTIONS: readonly SelectOption[] = [ + { + title: "Auto", + value: "auto", + description: "Detect per recording (Vietnamese / English mixed)", + }, + { title: "Tiếng Việt", value: "vi" }, + { title: "English", value: "en" }, +]; + +export const TTS_ENGINE_OPTIONS: readonly SelectOption[] = [ + { + title: "VieNeu", + value: "vieneu", + description: "Natural Vietnamese + English voice (falls back to Piper)", + }, + { title: "Piper", value: "piper", description: "Fast, lightweight, more robotic" }, +]; + +export const RATE_OPTIONS: readonly SelectOption[] = [ + { title: "0.75x", value: 0.75 }, + { title: "1x (normal)", value: 1 }, + { title: "1.25x", value: 1.25 }, + { title: "1.5x", value: 1.5 }, + { title: "1.75x", value: 1.75 }, + { title: "2x", value: 2 }, +]; diff --git a/src/config.test.ts b/src/config.test.ts new file mode 100644 index 0000000..df15e03 --- /dev/null +++ b/src/config.test.ts @@ -0,0 +1,46 @@ +import { expect, test } from "bun:test"; +import { createSettings, memoryKv, parseOptions } from "./config.ts"; + +test("parseOptions keeps the JS plugin's option names and defaults", () => { + const o = parseOptions({ + sttMode: "streaming", + sttAutoSubmit: true, + ttsEngine: "kokoro", + sttCaptureCmd: ["ssh", "-p", "8022", "u@localhost", "capture.sh", "16000"], + audioSampleRate: 16000, + keybinds: { "stt.record": "ctrl+r", bad: 1 }, + }); + expect(o.sttMode).toBe("streaming"); + expect(o.sttAutoSubmit).toBe(true); + expect(o.ttsEngine).toBe("vieneu"); // dropped engines map to VieNeu + expect(o.sttCaptureCmd?.[0]).toBe("ssh"); + expect(o.keybinds).toEqual({ "stt.record": "ctrl+r" }); + expect(parseOptions(undefined).audioSampleRate).toBe(16000); + expect(parseOptions({ audioSampleRate: 5 }).audioSampleRate).toBe(16000); +}); + +test("settings read old kv values and fall back to options", () => { + const kv = memoryKv({ + "stt.mode": "batch", + "tts.mode": "on", + "tts.engine": "chatterbox", + "stt.mic": "remote", + }); + const s = createSettings(kv, parseOptions({ sttMode: "streaming", ttsPlayCmd: ["ssh"] })); + expect(s.sttMode()).toBe("batch"); + expect(s.ttsAuto()).toBe(true); + expect(s.ttsEngine()).toBe("vieneu"); + expect(s.mic()).toBe("remote"); + expect(s.ttsOutput()).toBe("local"); + s.setTtsOutput("remote"); + expect(s.ttsOutput()).toBe("remote"); + s.setVoiceModel({ providerID: "openai", modelID: "gpt" }); + expect(s.voiceModel()).toEqual({ providerID: "openai", modelID: "gpt" }); + s.setVoiceModel(null); + expect(s.voiceModel()).toBeNull(); +}); + +test("phone speaker setting is ignored without ttsPlayCmd", () => { + const s = createSettings(memoryKv({ "tts.output": "remote" }), parseOptions({})); + expect(s.ttsOutput()).toBe("local"); +}); diff --git a/src/config.ts b/src/config.ts new file mode 100644 index 0000000..d9b363c --- /dev/null +++ b/src/config.ts @@ -0,0 +1,199 @@ +// Static plugin options (tui.jsonc / cli.json) and persistent runtime +// settings (host storage). Settings keep the old kv key names so existing +// choices survive the rewrite. +import os from "node:os"; +import path from "node:path"; +import type { SttLanguage } from "./types.ts"; + +// ------------------------------------------------------------------ options + +export interface Options { + readonly sttMode: SttMode; + readonly sttAutoSubmit: boolean; + readonly sttLanguage: SttLanguage; + readonly sttModel: string | null; + /** Remote mic argv (ssh ... capture.sh RATE). */ + readonly sttCaptureCmd: readonly string[] | null; + readonly sttEndpoint: string | null; + readonly sttApiModel: string | null; + readonly sttApiKeyEnv: string | null; + readonly sttPrompt: string | null; + readonly audioSampleRate: number; + readonly ttsEngine: TtsEngine; + readonly ttsVieneuPython: string; + readonly ttsVieneuVoice: string; + /** Remote speaker argv (ssh ... playback.sh RATE). */ + readonly ttsPlayCmd: readonly string[] | null; + readonly ttsPrompt: string | null; + readonly keybinds: Readonly>; + /** + * Voice node: "auto" (this machine, else one on the tailnet, else local + * engines), "host" (run the node on this machine), "off", or a URL. + */ + readonly voiceNode: string; + /** Raw options, for the LLM resolver (endpoint/model/apiKeyEnv...). */ + readonly raw: Readonly>; +} + +export type SttMode = "batch" | "streaming"; +export type TtsEngine = "vieneu" | "piper"; +export type NormalizeMode = "off" | "batch" | "all"; + +function str(v: unknown): string | null { + return typeof v === "string" && v.trim() ? v.trim() : null; +} + +function argv(v: unknown): readonly string[] | null { + if (Array.isArray(v) && v.length > 0 && v.every((x) => typeof x === "string")) { + return v as string[]; + } + if (typeof v === "string" && v.trim()) return ["sh", "-c", v]; + return null; +} + +export function expandHome(p: string): string { + return p.replace(/^~(?=\/|$)/, os.homedir()); +} + +export function parseOptions(raw: Readonly> | undefined): Options { + const o = raw ?? {}; + const rate = Number(o.audioSampleRate); + const lang = str(o.sttLanguage); + const keybinds: Record = {}; + if (o.keybinds && typeof o.keybinds === "object") { + for (const [k, v] of Object.entries(o.keybinds as Record)) { + if (typeof v === "string") keybinds[k] = v; + } + } + return { + sttMode: o.sttMode === "batch" ? "batch" : o.sttMode === "streaming" ? "streaming" : "batch", + sttAutoSubmit: o.sttAutoSubmit === true, + sttLanguage: lang === "vi" || lang === "en" ? lang : "auto", + sttModel: str(o.sttModel) ? expandHome(str(o.sttModel) as string) : null, + sttCaptureCmd: argv(o.sttCaptureCmd), + sttEndpoint: str(o.sttEndpoint), + sttApiModel: str(o.sttApiModel) ?? str(o.sttModel), + sttApiKeyEnv: str(o.sttApiKeyEnv), + sttPrompt: str(o.sttPrompt), + audioSampleRate: Number.isFinite(rate) && rate >= 8000 && rate <= 48000 ? rate : 16000, + ttsEngine: o.ttsEngine === "piper" ? "piper" : "vieneu", + ttsVieneuPython: expandHome( + str(o.ttsVieneuPython) ?? + path.join(os.homedir(), ".local/share/opencode-voice/vieneu-venv/bin/python"), + ), + ttsVieneuVoice: str(o.ttsVieneuVoice) ?? "", + ttsPlayCmd: argv(o.ttsPlayCmd), + ttsPrompt: str(o.ttsManualPrompt) ?? str(o.ttsPrompt), + keybinds, + voiceNode: str(o.voiceNode) ?? "auto", + raw: o, + }; +} + +// ----------------------------------------------------------------- settings + +/** Minimal synchronous key/value view over host storage. */ +export interface KvStore { + get(key: string): unknown; + set(key: string, value: unknown): void; +} + +export interface Settings { + sttMode(): SttMode; + setSttMode(v: SttMode): void; + autoSubmit(): boolean; + setAutoSubmit(v: boolean): void; + autoEnd(): boolean; + setAutoEnd(v: boolean): void; + normalize(): NormalizeMode; + setNormalize(v: NormalizeMode): void; + language(): SttLanguage; + setLanguage(v: SttLanguage): void; + whisperModel(): string | null; + setWhisperModel(v: string): void; + sttEngine(): "local" | "api"; + setSttEngine(v: "local" | "api"): void; + /** "" = default local device, "remote" = phone, else a device name. */ + mic(): string; + setMic(v: string): void; + ttsAuto(): boolean; + setTtsAuto(v: boolean): void; + ttsEngine(): TtsEngine; + setTtsEngine(v: TtsEngine): void; + vieneuVoice(): string; + setVieneuVoice(v: string): void; + ttsOutput(): "local" | "remote"; + setTtsOutput(v: "local" | "remote"): void; + ttsRate(): number; + setTtsRate(v: number): void; + voiceModel(): { providerID: string; modelID: string } | null; + setVoiceModel(v: { providerID: string; modelID: string } | null): void; +} + +export function createSettings(kv: KvStore, opts: Options): Settings { + const s = (k: string): string | null => { + const v = kv.get(k); + return typeof v === "string" ? v : null; + }; + const b = (k: string): boolean | null => { + const v = kv.get(k); + return typeof v === "boolean" ? v : null; + }; + return { + sttMode: () => { + const v = s("stt.mode"); + return v === "batch" || v === "streaming" ? v : opts.sttMode; + }, + setSttMode: (v) => kv.set("stt.mode", v), + autoSubmit: () => b("stt.autoSubmit") ?? opts.sttAutoSubmit, + setAutoSubmit: (v) => kv.set("stt.autoSubmit", v), + autoEnd: () => b("stt.autoEndOfSpeech") ?? false, + setAutoEnd: (v) => kv.set("stt.autoEndOfSpeech", v), + normalize: () => { + const v = s("stt.normalize"); + return v === "off" || v === "batch" || v === "all" ? v : "batch"; + }, + setNormalize: (v) => kv.set("stt.normalize", v), + language: () => { + const v = s("stt.language"); + return v === "vi" || v === "en" || v === "auto" ? v : opts.sttLanguage; + }, + setLanguage: (v) => kv.set("stt.language", v), + whisperModel: () => s("stt.model") || opts.sttModel, + setWhisperModel: (v) => kv.set("stt.model", v), + sttEngine: () => (s("stt.engine") === "api" && opts.sttEndpoint ? "api" : "local"), + setSttEngine: (v) => kv.set("stt.engine", v), + mic: () => s("stt.mic") ?? (opts.sttCaptureCmd ? "" : ""), + setMic: (v) => kv.set("stt.mic", v), + ttsAuto: () => s("tts.mode") === "on", + setTtsAuto: (v) => kv.set("tts.mode", v ? "on" : "off"), + ttsEngine: () => { + const v = s("tts.engine"); + return v === "piper" || v === "vieneu" ? v : opts.ttsEngine; + }, + setTtsEngine: (v) => kv.set("tts.engine", v), + vieneuVoice: () => s("tts.vieneuVoice") || opts.ttsVieneuVoice, + setVieneuVoice: (v) => kv.set("tts.vieneuVoice", v), + ttsOutput: () => (s("tts.output") === "remote" && opts.ttsPlayCmd ? "remote" : "local"), + setTtsOutput: (v) => kv.set("tts.output", v), + ttsRate: () => { + const v = Number(kv.get("tts.rate")); + return Number.isFinite(v) && v >= 0.5 && v <= 2 ? v : 1; + }, + setTtsRate: (v) => kv.set("tts.rate", v), + voiceModel: () => { + const p = s("voice.providerID"); + const m = s("voice.modelID"); + return p && m ? { providerID: p, modelID: m } : null; + }, + setVoiceModel: (v) => { + kv.set("voice.providerID", v?.providerID ?? ""); + kv.set("voice.modelID", v?.modelID ?? ""); + }, + }; +} + +export function memoryKv(initial: Record = {}): KvStore { + const m = new Map(Object.entries(initial)); + return { get: (k) => m.get(k), set: (k, v) => void m.set(k, v) }; +} diff --git a/src/entry.ts b/src/entry.ts new file mode 100644 index 0000000..9ac40af --- /dev/null +++ b/src/entry.ts @@ -0,0 +1,13 @@ +// OpenCode v2 TUI plugin definition. +import { setupPlugin } from "./plugin.ts"; +import type { HostContext } from "./host.ts"; + +const plugin = { + id: "opencode-voice", + async setup(ctx: HostContext): Promise<() => Promise> { + const handle = await setupPlugin(ctx); + return () => handle.dispose(); + }, +}; + +export default plugin; diff --git a/src/host-modules.d.ts b/src/host-modules.d.ts new file mode 100644 index 0000000..a9c5299 --- /dev/null +++ b/src/host-modules.d.ts @@ -0,0 +1,10 @@ +// Modules provided by the OpenCode host at runtime (not installed here). +// Only the members the status line uses are declared. +declare module "solid-js" { + export function createSignal(value: T): [() => T, (value: T) => void]; +} +declare module "@opentui/solid" { + export function createElement(tag: string): unknown; + export function setProp(node: unknown, name: string, value: unknown): void; + export function insert(parent: unknown, accessor: () => unknown): void; +} diff --git a/src/host.ts b/src/host.ts new file mode 100644 index 0000000..044025e --- /dev/null +++ b/src/host.ts @@ -0,0 +1,415 @@ +// Typed facade over the OpenCode v2 TUI plugin Context. Only the surface the +// plugin uses is declared here (mirrors @opencode/plugin/tui context.d.ts), +// so the rest of the code never touches `any`. +import type { KvStore } from "./config.ts"; +import { errorMessage } from "./types.ts"; + +// ------------------------------------------------------------ host types + +export type ToastVariant = "info" | "success" | "warning" | "error"; + +export interface SelectOption { + readonly title: string; + readonly value: V; + readonly description?: string; + readonly category?: string; + readonly disabled?: boolean; +} + +export interface KeymapCommand { + readonly id?: string; + readonly title?: string; + readonly description?: string; + readonly group?: string; + readonly bind?: false | string; + readonly palette?: true; + readonly slash?: { readonly name: string; readonly aliases?: string[] }; + readonly run: (input?: string) => void | false | Promise; +} + +export type Route = { readonly type: string; readonly sessionID?: string }; + +/** The opentui textarea that owns keyboard focus (the composer, a dialog field...). */ +export interface FocusedTextarea { + readonly plainText: string; + cursorOffset: number; + readonly isDestroyed?: boolean; + insertText(text: string): void; + deleteRange(startLine: number, startCol: number, endLine: number, endCol: number): void; + submit(): boolean; + readonly editBuffer?: { offsetToPosition?(offset: number): { row: number; col: number } | null }; +} + +export interface HostContext { + readonly options?: Readonly>; + readonly location?: unknown; + readonly app?: { readonly version: string }; + readonly renderer: { readonly currentFocusedRenderable?: unknown }; + readonly theme?: unknown; + readonly client: { + readonly session: { + create(input: Record): Promise<{ id: string }>; + prompt(input: { sessionID: string; text: string }): Promise; + }; + }; + readonly data: { + on(type: string, handler: (event: { data?: Record }) => void): () => void; + readonly session: { + list(): Array<{ id: string; title?: string }>; + get?(sessionID: string): { id: string; title?: string } | undefined; + readonly message: { list(sessionID: string): unknown[] }; + }; + readonly location: { + readonly provider: { list(): unknown[] | undefined }; + readonly model: { list(): unknown[] | undefined }; + }; + }; + readonly keymap: { + layer( + input: () => { + mode?: string; + commands?: readonly KeymapCommand[]; + bindings?: readonly string[]; + }, + ): void; + }; + readonly storage: { + store( + key: string, + options: { initial: V }, + ): readonly [V, (mutation: (draft: V) => void) => Promise]; + }; + readonly ui: { + readonly toast: { + show(o: { message: string; variant?: ToastVariant; duration?: number; title?: string }): void; + }; + readonly dialog: { + alert(o: { title: string; message: string }): Promise; + select(o: { + title: string; + placeholder?: string; + options: readonly SelectOption[]; + current?: V; + }): Promise; + }; + readonly router: { + current(): Route; + navigate(d: { type: "session"; sessionID: string }): void; + }; + readonly model?: { current(): { providerID: string; modelID: string } | undefined }; + slot(claim: { render: (input: unknown) => unknown } & Record): () => void; + }; +} + +// --------------------------------------------------------------- facade + +export interface Host { + toast(message: string, variant?: ToastVariant, durationMs?: number): void; + readonly kv: KvStore; + select( + title: string, + options: readonly SelectOption[], + current?: V, + ): Promise; + alert(title: string, message: string): void; + currentSessionID(): string | null; + /** Session id for gateway headers: current, last seen, or most recent. */ + anySessionID(): string | null; + sessionTitle(sessionID: string): string | null; + /** Text of the latest assistant message in a session ("" if none). */ + lastAssistantText(sessionID: string): string; + /** Last few user/assistant turns, compact, for LLM context. */ + recentTurns(sessionID: string, maxChars?: number): string; + onSessionIdle(handler: (sessionID: string) => void): () => void; + sessionModel(): { providerID: string; modelID: string } | null; + providers(): unknown[]; + models(): unknown[]; + focused(): FocusedTextarea | null; + /** Submit text as a prompt without a composer (creates a session if needed). */ + promptSession(text: string): Promise; + registerCommands(commands: readonly KeymapCommand[]): void; + slot(target: "session.composer.top" | "home.footer", render: () => unknown): () => void; + readonly theme: unknown; + dispose(): void; +} + +export function isFocusedTextarea(v: unknown): v is FocusedTextarea { + if (!v || typeof v !== "object") return false; + const o = v as Record; + return ( + typeof o.insertText === "function" && + typeof o.plainText === "string" && + typeof o.deleteRange === "function" && + typeof o.submit === "function" + ); +} + +/** Text of a v2 SessionMessageInfo, or null when it is not that role. */ +export function messageText(msg: unknown, role: "assistant" | "user"): string | null { + if (!msg || typeof msg !== "object") return null; + const m = msg as Record; + const kind = m.type ?? m.role; + if (kind !== role) return null; + if (Array.isArray(m.content)) { + return m.content + .map((c) => + c && typeof c === "object" && (c as Record).type === "text" + ? String((c as Record).text ?? "") + : "", + ) + .filter(Boolean) + .join("\n") + .trim(); + } + if (typeof m.text === "string") return m.text.trim(); + return ""; +} + +export function createHost(ctx: HostContext): Host { + const disposers: Array<() => void> = []; + + // Same storage key and shape as the JS plugin, so settings carry over. + let store: { values?: Record } | null = null; + let update: ((m: (d: { values: Record }) => void) => Promise) | null = + null; + const mem = new Map(); + // Values written by this process but not yet confirmed by the store. + const pending = new Map(); + try { + const pair = ctx.storage.store<{ values: Record }>("opencode-voice", { + initial: { values: {} }, + }); + store = pair[0]; + update = pair[1]; + } catch { + store = null; + } + const kv: KvStore = { + get(key) { + if (pending.has(key)) return pending.get(key); + // Read the live store each time: it is synced across TUI instances. + const live = store?.values; + if (live && Object.prototype.hasOwnProperty.call(live, key)) return live[key]; + return mem.get(key); + }, + set(key, value) { + mem.set(key, value); + if (!update) return; + pending.set(key, value); + void update((draft) => { + draft.values = { ...draft.values, [key]: value }; + }) + .catch(() => {}) + .finally(() => { + if (pending.get(key) === value) pending.delete(key); + }); + }, + }; + + const toast: Host["toast"] = (message, variant = "info", durationMs) => { + try { + ctx.ui.toast.show({ message, variant, ...(durationMs ? { duration: durationMs } : {}) }); + } catch {} + }; + + let lastSeenSession: string | null = null; + const currentSessionID = (): string | null => { + try { + const r = ctx.ui.router.current(); + const id = r.type === "session" && r.sessionID ? r.sessionID : null; + if (id) lastSeenSession = id; + return id; + } catch { + return null; + } + }; + const anySessionID = (): string | null => { + const cur = currentSessionID(); + if (cur) return cur; + if (lastSeenSession) return lastSeenSession; + try { + return ctx.data.session.list()[0]?.id ?? null; + } catch { + return null; + } + }; + + const messages = (sessionID: string): unknown[] => { + try { + return ctx.data.session.message.list(sessionID) ?? []; + } catch { + return []; + } + }; + + return { + toast, + kv, + async select(title, options, current) { + try { + return await ctx.ui.dialog.select({ + title, + options, + ...(current !== undefined ? { current } : {}), + }); + } catch (err) { + toast(`Picker failed: ${errorMessage(err)}`, "error"); + return undefined; + } + }, + alert(title, message) { + void ctx.ui.dialog.alert({ title, message }).catch(() => {}); + }, + currentSessionID, + anySessionID, + sessionTitle(sessionID) { + try { + const s = + ctx.data.session.get?.(sessionID) ?? + ctx.data.session.list().find((x) => x.id === sessionID); + return s?.title?.trim() || null; + } catch { + return null; + } + }, + lastAssistantText(sessionID) { + const list = messages(sessionID); + for (let i = list.length - 1; i >= 0; i--) { + const t = messageText(list[i], "assistant"); + if (t !== null && t) return t; + if (messageText(list[i], "user") !== null) return ""; + } + return ""; + }, + recentTurns(sessionID, maxChars = 1500) { + const list = messages(sessionID); + const out: string[] = []; + let used = 0; + for (let i = list.length - 1; i >= 0 && out.length < 4; i--) { + const a = messageText(list[i], "assistant"); + const u = a === null ? messageText(list[i], "user") : null; + const text = (a ?? u ?? "").replace(/\s+/g, " ").trim(); + if (!text) continue; + const line = `${a !== null ? "assistant" : "user"}: ${text.slice(0, 400)}`; + if (used + line.length > maxChars) break; + used += line.length; + out.unshift(line); + } + return out.join("\n"); + }, + onSessionIdle(handler) { + // Hosts differ in which "turn finished" event they emit; listen to all + // and let the caller dedupe. A short delay lets the message store + // receive the final text first. + const fire = (id: unknown): void => { + if (typeof id !== "string") return; + setTimeout(() => handler(id), 400); + }; + const offs: Array<() => void> = []; + const sub = (type: string, pick: (d: Record) => unknown): void => { + try { + offs.push(ctx.data.on(type, (event) => fire(pick(event?.data ?? {})))); + } catch {} + }; + sub("session.idle", (d) => d.sessionID); + sub("session.execution.succeeded", (d) => d.sessionID); + sub("session.status", (d) => { + const st = d.status as { type?: unknown } | undefined; + return st?.type === "idle" ? d.sessionID : undefined; + }); + const off = (): void => { + for (const o of offs.splice(0)) { + try { + o(); + } catch {} + } + }; + disposers.push(off); + return off; + }, + sessionModel() { + try { + const m = ctx.ui.model?.current(); + return m?.providerID && m.modelID ? { providerID: m.providerID, modelID: m.modelID } : null; + } catch { + return null; + } + }, + providers() { + try { + return ctx.data.location.provider.list() ?? []; + } catch { + return []; + } + }, + models() { + try { + return ctx.data.location.model.list() ?? []; + } catch { + return []; + } + }, + focused() { + const f = ctx.renderer.currentFocusedRenderable; + return isFocusedTextarea(f) && !f.isDestroyed ? f : null; + }, + async promptSession(text) { + let sessionID = currentSessionID(); + if (!sessionID) { + const created = await ctx.client.session.create( + ctx.location ? { location: ctx.location } : {}, + ); + sessionID = created.id; + ctx.ui.router.navigate({ type: "session", sessionID }); + } + await ctx.client.session.prompt({ sessionID, text }); + }, + registerCommands(commands) { + const bindings = commands + .filter((c) => typeof c.bind === "string" && c.bind && c.id) + .map((c) => c.id as string); + const register = (): void => { + try { + ctx.keymap.layer(() => ({ mode: "global", commands, bindings })); + } catch (err) { + toast(`Voice: keymap registration failed: ${errorMessage(err)}`, "error"); + } + }; + // keymap.layer must run inside a component owner: claim an empty app slot. + let done = false; + try { + const off = ctx.ui.slot({ + append: "app", + render: () => { + if (!done) { + done = true; + register(); + } + return null; + }, + }); + disposers.push(off); + } catch { + register(); + } + }, + slot(target, render) { + try { + const off = ctx.ui.slot({ before: target, render: () => render() }); + disposers.push(off); + return off; + } catch (err) { + toast(`Voice: status line unavailable: ${errorMessage(err)}`, "warning"); + return () => {}; + } + }, + theme: ctx.theme, + dispose() { + for (const d of disposers.splice(0)) { + try { + d(); + } catch {} + } + }, + }; +} diff --git a/src/llm/client.test.ts b/src/llm/client.test.ts new file mode 100644 index 0000000..89e9e81 --- /dev/null +++ b/src/llm/client.test.ts @@ -0,0 +1,288 @@ +import { describe, expect, test } from "bun:test"; +import { isAbortError } from "../types.ts"; +import { createLlm, requestUrl, stripThink, type FetchFn } from "./client.ts"; +import type { LlmConfig } from "./config.ts"; + +interface Call { + url: string; + init: RequestInit; + body: Record; + headers: Record; +} + +function json(status: number, body: unknown): Response { + return new Response(JSON.stringify(body), { + status, + headers: { "Content-Type": "application/json" }, + }); +} + +const chat = (content: unknown) => json(200, { choices: [{ message: { content } }] }); + +function mockFetch(responses: Array) { + const calls: Call[] = []; + const fetch: FetchFn = (url, init) => { + calls.push({ + url, + init, + body: JSON.parse(String(init.body)) as Record, + headers: init.headers as Record, + }); + const next = responses.shift(); + if (next === undefined) throw new Error("unexpected fetch"); + if (next === "hang") { + return new Promise((_, reject) => { + const signal = init.signal; + signal?.addEventListener("abort", () => reject(signal.reason), { once: true }); + }); + } + if (next instanceof Error) return Promise.reject(next); + return Promise.resolve(next); + }; + return { fetch, calls }; +} + +const base: LlmConfig = { + endpoint: "https://llm.test/v1", + model: "m1", + apiKey: "secret", + sendSessionHeader: false, + label: "llm.test/m1", +}; + +const noSleep = () => Promise.resolve(); +const req = { system: "SYS", user: "hello" }; + +describe("request shape", () => { + test("chat completions body, auth header, trimmed text", async () => { + const { fetch, calls } = mockFetch([chat(" Hi there. ")]); + const llm = createLlm(() => base, { fetch }); + expect(await llm.complete({ ...req, maxTokens: 100 })).toBe("Hi there."); + expect(calls[0]?.url).toBe("https://llm.test/v1/chat/completions"); + expect(calls[0]?.body).toEqual({ + model: "m1", + max_tokens: 100, + messages: [ + { role: "system", content: "SYS" }, + { role: "user", content: "hello" }, + ], + }); + expect(calls[0]?.headers.Authorization).toBe("Bearer secret"); + }); + + test("no Authorization header without a key", async () => { + const { fetch, calls } = mockFetch([chat("ok")]); + const { apiKey: _drop, ...noKey } = base; + await createLlm(() => noKey, { fetch }).complete(req); + expect(calls[0]?.headers.Authorization).toBeUndefined(); + }); + + test("responses API shape and output parsing", async () => { + const { fetch, calls } = mockFetch([ + json(200, { + output: [ + { type: "reasoning", content: [{ type: "text", text: "thinking" }] }, + { type: "message", content: [{ type: "output_text", text: "Answer." }] }, + ], + }), + ]); + const llm = createLlm(() => ({ ...base, useResponsesApi: true }), { fetch }); + expect(await llm.complete({ ...req, maxTokens: 64 })).toBe("Answer."); + expect(calls[0]?.url).toBe("https://llm.test/v1/responses"); + expect(calls[0]?.body).toEqual({ + model: "m1", + instructions: "SYS", + input: "hello", + max_output_tokens: 64, + }); + }); + + test("responses output_text shortcut", async () => { + const { fetch } = mockFetch([json(200, { output_text: "Short." })]); + const llm = createLlm(() => ({ ...base, endpoint: "https://llm.test/v1/responses" }), { + fetch, + }); + expect(await llm.complete(req)).toBe("Short."); + }); + + test("chat content as parts array", async () => { + const { fetch } = mockFetch([ + chat([ + { type: "text", text: "A" }, + { type: "text", text: "B" }, + ]), + ]); + expect(await createLlm(() => base, { fetch }).complete(req)).toBe("AB"); + }); + + test("requestUrl keeps full paths", () => { + expect(requestUrl({ endpoint: "https://x/v1/" })).toBe("https://x/v1/chat/completions"); + expect(requestUrl({ endpoint: "https://x/v1/chat/completions" })).toBe( + "https://x/v1/chat/completions", + ); + expect(requestUrl({ endpoint: "https://x/v1/responses" })).toBe("https://x/v1/responses"); + expect(requestUrl({ endpoint: "https://x/v1", useResponsesApi: true })).toBe( + "https://x/v1/responses", + ); + }); +}); + +describe("session header", () => { + test("sent when config allows it (opencode.ai)", async () => { + const { fetch, calls } = mockFetch([chat("ok")]); + const llm = createLlm(() => ({ ...base, sendSessionHeader: true }), { fetch }); + await llm.complete({ ...req, sessionID: "ses_1" }); + expect(calls[0]?.headers["x-opencode-session"]).toBe("ses_1"); + }); + + test("never sent to other endpoints", async () => { + const { fetch, calls } = mockFetch([chat("ok")]); + await createLlm(() => base, { fetch }).complete({ ...req, sessionID: "ses_1" }); + expect(calls[0]?.headers["x-opencode-session"]).toBeUndefined(); + }); +}); + +describe("think stripping", () => { + test("strips think blocks from the answer", async () => { + const { fetch } = mockFetch([chat("step 1\nstep 2\nFinal.")]); + expect(await createLlm(() => base, { fetch }).complete(req)).toBe("Final."); + }); + + test("stripThink variants", () => { + expect(stripThink("a x b")).toBe("a b"); + expect(stripThink("reasoning without openAnswer")).toBe("Answer"); + expect(stripThink("Answertruncated reasoning")).toBe("Answer"); + expect(stripThink("only reasoning")).toBe(""); + }); + + test("reply that is only reasoning counts as empty", async () => { + const { fetch, calls } = mockFetch([chat("hmm")]); + await expect(createLlm(() => base, { fetch }).complete(req)).rejects.toThrow(/empty reply/); + expect(calls.length).toBe(1); + }); +}); + +describe("retries and errors", () => { + test("no retry on empty response", async () => { + const { fetch, calls } = mockFetch([chat(""), chat("late")]); + await expect(createLlm(() => base, { fetch, sleep: noSleep }).complete(req)).rejects.toThrow( + /empty reply/, + ); + expect(calls.length).toBe(1); + }); + + test("one retry on 503 then success", async () => { + const { fetch, calls } = mockFetch([json(503, { error: "busy" }), chat("ok")]); + expect(await createLlm(() => base, { fetch, sleep: noSleep }).complete(req)).toBe("ok"); + expect(calls.length).toBe(2); + }); + + test("only one retry: second 503 fails", async () => { + const { fetch, calls } = mockFetch([json(503, {}), json(502, { error: "down" }), chat("x")]); + await expect(createLlm(() => base, { fetch, sleep: noSleep }).complete(req)).rejects.toThrow( + /\(502\)/, + ); + expect(calls.length).toBe(2); + }); + + test("one retry on network error", async () => { + const { fetch, calls } = mockFetch([new TypeError("fetch failed"), chat("ok")]); + expect(await createLlm(() => base, { fetch, sleep: noSleep }).complete(req)).toBe("ok"); + expect(calls.length).toBe(2); + }); + + test("two network errors fail with a one-line message", async () => { + const { fetch } = mockFetch([new TypeError("fetch failed"), new TypeError("fetch failed")]); + await expect(createLlm(() => base, { fetch, sleep: noSleep }).complete(req)).rejects.toThrow( + /request failed: fetch failed; check the endpoint/, + ); + }); + + test("4xx fails immediately with server detail", async () => { + const { fetch, calls } = mockFetch([json(400, { error: "bad model" }), chat("x")]); + await expect(createLlm(() => base, { fetch, sleep: noSleep }).complete(req)).rejects.toThrow( + /\(400\): \{"error":"bad model"\}/, + ); + expect(calls.length).toBe(1); + }); + + test("429 is not retried", async () => { + const { fetch, calls } = mockFetch([json(429, {}), chat("x")]); + await expect(createLlm(() => base, { fetch, sleep: noSleep }).complete(req)).rejects.toThrow( + /\(429\)/, + ); + expect(calls.length).toBe(1); + }); + + test("invalid JSON body", async () => { + const { fetch } = mockFetch([new Response("not json", { status: 200 })]); + await expect(createLlm(() => base, { fetch }).complete(req)).rejects.toThrow(/invalid JSON/); + }); + + test("unconfigured throws and describes itself", async () => { + const llm = createLlm(() => null, { fetch: mockFetch([]).fetch }); + expect(llm.configured).toBe(false); + expect(llm.describe()).toBe("unconfigured"); + await expect(llm.complete(req)).rejects.toThrow(/not configured.*\/voice-model/); + }); + + test("config is read per call", async () => { + let cfg: LlmConfig | null = null; + const { fetch, calls } = mockFetch([chat("a"), chat("b")]); + const llm = createLlm(() => cfg, { fetch }); + expect(llm.configured).toBe(false); + cfg = base; + expect(llm.configured).toBe(true); + expect(llm.describe()).toBe("llm.test/m1"); + await llm.complete(req); + cfg = { ...base, model: "m2", endpoint: "https://other.test/v1" }; + await llm.complete(req); + expect(calls[1]?.url).toBe("https://other.test/v1/chat/completions"); + expect(calls[1]?.body.model).toBe("m2"); + }); +}); + +describe("timeout and abort", () => { + test("times out with a TimeoutError", async () => { + const { fetch } = mockFetch(["hang"]); + const err: unknown = await createLlm(() => base, { fetch, timeoutMs: 20 }) + .complete(req) + .catch((e: unknown) => e); + expect(err).toBeInstanceOf(Error); + expect((err as Error).name).toBe("TimeoutError"); + expect((err as Error).message).toMatch(/timed out/); + expect(isAbortError(err)).toBe(true); + }); + + test("caller abort rejects with the caller's reason, no retry", async () => { + const { fetch, calls } = mockFetch(["hang", chat("x")]); + const ctrl = new AbortController(); + const p = createLlm(() => base, { fetch, sleep: noSleep }).complete({ + ...req, + signal: ctrl.signal, + }); + ctrl.abort(); + const err: unknown = await p.catch((e: unknown) => e); + expect(isAbortError(err)).toBe(true); + expect((err as Error).name).toBe("AbortError"); + expect(calls.length).toBe(1); + }); + + test("already-aborted signal never fetches", async () => { + const { fetch, calls } = mockFetch([chat("x")]); + const ctrl = new AbortController(); + ctrl.abort(); + await expect( + createLlm(() => base, { fetch }).complete({ ...req, signal: ctrl.signal }), + ).rejects.toThrow(); + expect(calls.length).toBe(0); + }); + + test("passes a combined signal to fetch", async () => { + const { fetch, calls } = mockFetch([chat("ok")]); + const ctrl = new AbortController(); + await createLlm(() => base, { fetch }).complete({ ...req, signal: ctrl.signal }); + expect(calls[0]?.init.signal).toBeInstanceOf(AbortSignal); + expect(calls[0]?.init.signal).not.toBe(ctrl.signal); + }); +}); diff --git a/src/llm/client.ts b/src/llm/client.ts new file mode 100644 index 0000000..d303d0e --- /dev/null +++ b/src/llm/client.ts @@ -0,0 +1,214 @@ +// OpenAI-compatible completion client (chat completions, or the Responses +// API when configured). Config is read per call so a /voice-model change or a +// session model switch applies to the next request. + +import type { CompleteRequest, Llm, Logger } from "../types.ts"; +import { errorMessage } from "../types.ts"; +import type { LlmConfig } from "./config.ts"; + +export type FetchFn = (url: string, init: RequestInit) => Promise; + +export interface LlmDeps { + fetch?: FetchFn; + logger?: Logger; + /** Total budget per complete() call, retries included. */ + timeoutMs?: number; + /** Delay before the single retry; resolves early when the signal aborts. */ + sleep?: (ms: number, signal: AbortSignal) => Promise; +} + +const DEFAULT_TIMEOUT_MS = 45_000; +const DEFAULT_MAX_TOKENS = 2048; +const RETRY_DELAY_MS = 300; + +type Rec = Record; + +function isRecord(value: unknown): value is Rec { + return typeof value === "object" && value !== null && !Array.isArray(value); +} + +function defaultSleep(ms: number, signal: AbortSignal): Promise { + return new Promise((resolve) => { + const timer = setTimeout(done, ms); + function done() { + clearTimeout(timer); + signal.removeEventListener("abort", done); + resolve(); + } + signal.addEventListener("abort", done, { once: true }); + }); +} + +export function requestUrl(cfg: Pick): string { + const base = cfg.endpoint.replace(/\/+$/, ""); + if (base.endsWith("/chat/completions") || base.endsWith("/responses")) return base; + return `${base}/${cfg.useResponsesApi ? "responses" : "chat/completions"}`; +} + +/** Drops reasoning blocks some models emit inline in the answer. */ +export function stripThink(text: string): string { + let out = text.replace(/[\s\S]*?<\/think>/gi, ""); + // Template without an opening tag: "reasoning...answer". + const close = out.toLowerCase().lastIndexOf(""); + if (close !== -1) out = out.slice(close + "".length); + // Unclosed (truncated) reasoning: nothing after it is the answer. + const open = out.toLowerCase().indexOf(""); + if (open !== -1) out = out.slice(0, open); + return out.trim(); +} + +function partsText(content: unknown): string | undefined { + if (typeof content === "string") return content; + if (!Array.isArray(content)) return undefined; + const texts = content + .map((part) => (isRecord(part) && typeof part.text === "string" ? part.text : "")) + .filter(Boolean); + return texts.length > 0 ? texts.join("") : undefined; +} + +function chatText(data: unknown): string | undefined { + if (!isRecord(data) || !Array.isArray(data.choices)) return undefined; + const first: unknown = data.choices[0]; + if (!isRecord(first) || !isRecord(first.message)) return undefined; + return partsText(first.message.content); +} + +function responsesText(data: unknown): string | undefined { + if (!isRecord(data)) return undefined; + if (typeof data.output_text === "string" && data.output_text.trim()) return data.output_text; + if (Array.isArray(data.output)) { + for (const item of data.output) { + if (!isRecord(item) || item.type === "reasoning") continue; + const text = partsText(item.content); + if (text?.trim()) return text; + } + } + // Some gateways answer /responses in chat shape. + return chatText(data); +} + +function timeoutError(ms: number): Error { + const err = new Error( + `Voice LLM timed out after ${Math.round(ms / 1000)}s; try again or pick a faster model with /voice-model`, + ); + err.name = "TimeoutError"; + return err; +} + +export function createLlm(getConfig: () => LlmConfig | null, deps: LlmDeps = {}): Llm { + const doFetch: FetchFn = deps.fetch ?? ((url, init) => fetch(url, init)); + const timeoutMs = deps.timeoutMs ?? DEFAULT_TIMEOUT_MS; + const sleep = deps.sleep ?? defaultSleep; + const log = (message: string, level: "debug" | "warn" | "error" = "debug") => + deps.logger?.log("LLM", message, level); + + async function complete(req: CompleteRequest): Promise { + const cfg = getConfig(); + if (!cfg) { + throw new Error( + "Voice LLM is not configured; pick a model with /voice-model or set endpoint and model options", + ); + } + req.signal?.throwIfAborted(); + + const url = requestUrl(cfg); + const responses = url.endsWith("/responses"); + const maxTokens = req.maxTokens ?? DEFAULT_MAX_TOKENS; + const body = responses + ? { + model: cfg.model, + instructions: req.system, + input: req.user, + max_output_tokens: maxTokens, + } + : { + model: cfg.model, + max_tokens: maxTokens, + messages: [ + { role: "system", content: req.system }, + { role: "user", content: req.user }, + ], + }; + const headers: Record = { "Content-Type": "application/json" }; + if (cfg.apiKey) headers.Authorization = `Bearer ${cfg.apiKey}`; + // Session id goes only to the opencode.ai gateway, never to third parties. + if (cfg.sendSessionHeader && req.sessionID) headers["x-opencode-session"] = req.sessionID; + + const timeout = AbortSignal.timeout(timeoutMs); + const signal = req.signal ? AbortSignal.any([req.signal, timeout]) : timeout; + const init: RequestInit = { method: "POST", headers, body: JSON.stringify(body), signal }; + const aborted = (): unknown => { + if (req.signal?.aborted) return req.signal.reason; + return timeoutError(timeoutMs); + }; + + log( + `request model=${cfg.label} mode=${responses ? "responses" : "chat"} userChars=${req.user.length}`, + ); + const started = Date.now(); + let data: unknown; + for (let attempt = 1; ; attempt++) { + if (signal.aborted) throw aborted(); + let res: Response; + try { + res = await doFetch(url, init); + } catch (err) { + if (signal.aborted) throw aborted(); + if (attempt === 1) { + log(`network error, retrying once: ${errorMessage(err)}`, "warn"); + await sleep(RETRY_DELAY_MS, signal); + continue; + } + throw new Error( + `Voice LLM request failed: ${errorMessage(err)}; check the endpoint and your network`, + ); + } + if (res.status >= 500 && attempt === 1) { + log(`status=${res.status}, retrying once`, "warn"); + await res.body?.cancel().catch(() => {}); + await sleep(RETRY_DELAY_MS, signal); + continue; + } + if (!res.ok) { + let detail = ""; + try { + detail = (await res.text()).trim().replace(/\s+/g, " ").slice(0, 160); + } catch { + // body unreadable: status alone + } + log(`status=${res.status} bodyChars=${detail.length}`, "error"); + throw new Error( + `Voice LLM request failed (${res.status})${detail ? `: ${detail}` : ""}; check the model and key`, + ); + } + try { + data = await res.json(); + } catch (err) { + if (signal.aborted) throw aborted(); + throw new Error( + `Voice LLM returned invalid JSON (${errorMessage(err)}); check the endpoint`, + ); + } + break; + } + + const raw = (responses ? responsesText(data) : chatText(data)) ?? ""; + const text = stripThink(raw); + log(`done ms=${Date.now() - started} chars=${text.length} rawChars=${raw.length}`); + if (!text) { + // No retry: an empty answer is usually reasoning eating the token budget. + throw new Error( + "Voice LLM returned an empty reply; try again or pick another model with /voice-model", + ); + } + return text; + } + + return { + complete, + describe: () => getConfig()?.label ?? "unconfigured", + get configured() { + return getConfig() !== null; + }, + }; +} diff --git a/src/llm/config.test.ts b/src/llm/config.test.ts new file mode 100644 index 0000000..b68abff --- /dev/null +++ b/src/llm/config.test.ts @@ -0,0 +1,299 @@ +import { describe, expect, test } from "bun:test"; +import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { join } from "node:path"; +import { authFilePath, isOpencodeHost, resolveLlmConfig, type ResolveLlmInput } from "./config.ts"; + +const providers = [ + { + id: "openrouter", + env: ["OPENROUTER_API_KEY"], + settings: { baseURL: "https://openrouter.ai/api/v1" }, + }, + { id: "opencode", env: [], settings: { baseURL: "https://opencode.ai/zen/v1" } }, + { id: "anthropic", env: ["ANTHROPIC_API_KEY"], settings: {} }, + { id: "nourl", env: [], settings: {} }, +]; +const models = [ + { id: "fast", modelID: "upstream/fast", providerID: "openrouter" }, + { id: "go", providerID: "opencode" }, + { + id: "haiku", + providerID: "anthropic", + api: { id: "claude-haiku", url: "https://api.anthropic.com/v1" }, + }, +]; + +const auth = { + openrouter: { type: "api", key: "stored-or" }, + opencode: { type: "api", key: "stored-oc" }, + anthropic: { type: "oauth", access: "oauth-access", refresh: "oauth-refresh" }, +}; + +function input(over: Partial = {}): ResolveLlmInput { + return { + options: {}, + selection: null, + sessionModel: null, + providers, + models, + env: {}, + readAuth: () => auth, + ...over, + }; +} + +describe("precedence", () => { + test("explicit endpoint + model win over selection and session", () => { + const cfg = resolveLlmConfig( + input({ + options: { endpoint: "https://llm.example/v1", model: "m1" }, + selection: { providerID: "openrouter", modelID: "fast" }, + sessionModel: { providerID: "opencode", modelID: "go" }, + }), + ); + expect(cfg).toEqual({ + endpoint: "https://llm.example/v1", + model: "m1", + sendSessionHeader: false, + label: "llm.example/m1", + }); + }); + + test("voice selection wins over session model", () => { + const cfg = resolveLlmConfig( + input({ + selection: { providerID: "openrouter", modelID: "fast" }, + sessionModel: { providerID: "opencode", modelID: "go" }, + }), + ); + expect(cfg?.endpoint).toBe("https://openrouter.ai/api/v1"); + expect(cfg?.model).toBe("upstream/fast"); + expect(cfg?.label).toBe("openrouter/upstream/fast"); + }); + + test("falls back to the session model", () => { + const cfg = resolveLlmConfig( + input({ sessionModel: { providerID: "opencode", modelID: "go" } }), + ); + expect(cfg?.endpoint).toBe("https://opencode.ai/zen/v1"); + expect(cfg?.model).toBe("go"); + expect(cfg?.sendSessionHeader).toBe(true); + }); + + test("selection whose provider has no endpoint falls through to the session model", () => { + const cfg = resolveLlmConfig( + input({ + selection: { providerID: "nourl", modelID: "x" }, + sessionModel: { providerID: "opencode", modelID: "go" }, + }), + ); + expect(cfg?.endpoint).toBe("https://opencode.ai/zen/v1"); + }); + + test("uses model api url and api id when provider has no baseURL", () => { + const cfg = resolveLlmConfig( + input({ + selection: { providerID: "anthropic", modelID: "haiku" }, + env: { ANTHROPIC_API_KEY: "env-key" }, + }), + ); + expect(cfg?.endpoint).toBe("https://api.anthropic.com/v1"); + expect(cfg?.model).toBe("claude-haiku"); + expect(cfg?.apiKey).toBe("env-key"); + }); + + test("accepts v1-shaped providers with embedded models and options.baseURL", () => { + const cfg = resolveLlmConfig( + input({ + providers: [ + { + id: "p1", + env: [], + options: { baseURL: "https://p1.test/v1" }, + models: { a: { id: "a", modelID: "up-a" } }, + }, + ], + models: undefined, + selection: { providerID: "p1", modelID: "a" }, + }), + ); + expect(cfg?.endpoint).toBe("https://p1.test/v1"); + expect(cfg?.model).toBe("up-a"); + }); + + test("explicit model with provider endpoint", () => { + const cfg = resolveLlmConfig( + input({ + options: { model: "other" }, + sessionModel: { providerID: "openrouter", modelID: "fast" }, + }), + ); + expect(cfg?.model).toBe("other"); + expect(cfg?.endpoint).toBe("https://openrouter.ai/api/v1"); + expect(cfg?.apiKey).toBe("stored-or"); + }); + + test("returns null when nothing is usable", () => { + expect(resolveLlmConfig(input())).toBeNull(); + expect(resolveLlmConfig(input({ options: { endpoint: "https://x.test/v1" } }))).toBeNull(); + expect(resolveLlmConfig(input({ options: { model: "m" } }))).toBeNull(); + expect( + resolveLlmConfig(input({ selection: { providerID: "missing", modelID: "m" } })), + ).toBeNull(); + expect( + resolveLlmConfig(input({ selection: { providerID: "nourl", modelID: "m" } })), + ).toBeNull(); + }); + + test("useResponsesApi option passes through", () => { + const cfg = resolveLlmConfig( + input({ options: { endpoint: "https://x.test/v1", model: "m", useResponsesApi: true } }), + ); + expect(cfg?.useResponsesApi).toBe(true); + }); +}); + +describe("key security", () => { + test("explicit endpoint never gets a stored or provider key", () => { + let authReads = 0; + const cfg = resolveLlmConfig( + input({ + options: { endpoint: "https://evil.example/v1" }, + selection: { providerID: "openrouter", modelID: "fast" }, + env: { OPENROUTER_API_KEY: "env-or" }, + readAuth: () => { + authReads++; + return auth; + }, + }), + ); + expect(cfg?.endpoint).toBe("https://evil.example/v1"); + expect(cfg?.model).toBe("upstream/fast"); + expect(cfg?.apiKey).toBeUndefined(); + expect(authReads).toBe(0); + }); + + test("explicit apiKeyEnv / apiKey are used for explicit endpoints", () => { + const base = { endpoint: "https://x.test/v1", model: "m" }; + expect( + resolveLlmConfig(input({ options: { ...base, apiKeyEnv: "MY_KEY" }, env: { MY_KEY: "k1" } })) + ?.apiKey, + ).toBe("k1"); + expect(resolveLlmConfig(input({ options: { ...base, apiKey: "k2" } }))?.apiKey).toBe("k2"); + }); + + test("explicit key wins over provider key", () => { + const cfg = resolveLlmConfig( + input({ + options: { apiKey: "mine" }, + selection: { providerID: "openrouter", modelID: "fast" }, + }), + ); + expect(cfg?.apiKey).toBe("mine"); + }); + + test("provider env key wins over stored key", () => { + const cfg = resolveLlmConfig( + input({ + selection: { providerID: "openrouter", modelID: "fast" }, + env: { OPENROUTER_API_KEY: "env-or" }, + }), + ); + expect(cfg?.apiKey).toBe("env-or"); + }); + + test("stored api key used only for its own provider endpoint", () => { + const cfg = resolveLlmConfig( + input({ sessionModel: { providerID: "opencode", modelID: "go" } }), + ); + expect(cfg?.apiKey).toBe("stored-oc"); + }); + + test("OAuth tokens are never used", () => { + const cfg = resolveLlmConfig( + input({ selection: { providerID: "anthropic", modelID: "haiku" } }), + ); + expect(cfg?.endpoint).toBe("https://api.anthropic.com/v1"); + expect(cfg?.apiKey).toBeUndefined(); + }); + + test("stored key looked up by integrationID too", () => { + const cfg = resolveLlmConfig( + input({ + providers: [ + { + id: "zen", + integrationID: "opencode", + settings: { baseURL: "https://opencode.ai/zen/v1" }, + }, + ], + selection: { providerID: "zen", modelID: "m" }, + }), + ); + expect(cfg?.apiKey).toBe("stored-oc"); + }); + + test("unreadable auth store yields no key", () => { + const cfg = resolveLlmConfig( + input({ sessionModel: { providerID: "opencode", modelID: "go" }, readAuth: () => null }), + ); + expect(cfg?.apiKey).toBeUndefined(); + }); +}); + +describe("session header host", () => { + test("only opencode.ai hosts", () => { + expect(isOpencodeHost("https://opencode.ai/zen/v1")).toBe(true); + expect(isOpencodeHost("https://api.opencode.ai/v1")).toBe(true); + expect(isOpencodeHost("https://OPENCODE.AI/zen")).toBe(true); + expect(isOpencodeHost("https://opencode.ai.evil.com/v1")).toBe(false); + expect(isOpencodeHost("https://evilopencode.ai/v1")).toBe(false); + expect(isOpencodeHost("https://openrouter.ai/api/v1")).toBe(false); + expect(isOpencodeHost("not a url")).toBe(false); + }); + + test("explicit non-opencode endpoint disables the header", () => { + const cfg = resolveLlmConfig(input({ options: { endpoint: "https://x.test/v1", model: "m" } })); + expect(cfg?.sendSessionHeader).toBe(false); + }); +}); + +describe("authFilePath", () => { + test("honors XDG_DATA_HOME", () => { + expect(authFilePath({ XDG_DATA_HOME: "/xdg", HOME: "/home/u" })).toBe( + "/xdg/opencode/auth.json", + ); + }); + test("defaults to ~/.local/share", () => { + expect(authFilePath({ HOME: "/home/u" })).toBe("/home/u/.local/share/opencode/auth.json"); + }); + test("ignores relative XDG_DATA_HOME", () => { + expect(authFilePath({ XDG_DATA_HOME: "rel", HOME: "/home/u" })).toBe( + "/home/u/.local/share/opencode/auth.json", + ); + }); + test("default reader reads /opencode/auth.json", () => { + const dir = mkdtempSync(join(tmpdir(), "voice-llm-")); + try { + mkdirSync(join(dir, "opencode")); + writeFileSync( + join(dir, "opencode", "auth.json"), + JSON.stringify({ opencode: { type: "api", key: "xdg-key" } }), + ); + const resolve = (xdg: string) => + resolveLlmConfig({ + options: {}, + selection: null, + sessionModel: { providerID: "opencode", modelID: "go" }, + providers, + models, + env: { XDG_DATA_HOME: xdg, HOME: "/nonexistent-home" }, + }); + expect(resolve(dir)?.apiKey).toBe("xdg-key"); + expect(resolve(join(dir, "missing"))?.apiKey).toBeUndefined(); + } finally { + rmSync(dir, { recursive: true, force: true }); + } + }); +}); diff --git a/src/llm/config.ts b/src/llm/config.ts new file mode 100644 index 0000000..2fcd9e6 --- /dev/null +++ b/src/llm/config.ts @@ -0,0 +1,195 @@ +// Resolves which OpenAI-compatible endpoint/model/key the voice LLM uses. +// +// Precedence: explicit plugin options (endpoint/model) -> voice selection +// (/voice-model) -> the session's current model. Provider base URL and key +// come from OpenCode's provider list and its auth store. +// +// Key rules (security): +// - Explicit `apiKey` / `apiKeyEnv` options always win. +// - A provider key (its env vars, then auth.json) is used ONLY when the +// endpoint itself came from that same provider. An explicit `endpoint` +// never receives a provider/stored key. +// - From auth.json only `type: "api"` keys are used; OAuth tokens never. + +import { readFileSync } from "node:fs"; +import { homedir } from "node:os"; +import { isAbsolute, join } from "node:path"; + +export interface LlmConfig { + endpoint: string; + model: string; + apiKey?: string; + useResponsesApi?: boolean; + /** True only for opencode.ai hosts (session-scoped gateway). */ + sendSessionHeader: boolean; + /** "provider/model" for display. */ + label: string; +} + +export interface ModelRef { + providerID: string; + modelID: string; +} + +type Env = Record; + +export interface ResolveLlmInput { + options: Record; + selection: ModelRef | null; + sessionModel: ModelRef | null; + /** `ctx.data.location.provider.list()` (or v1-shaped providers with `models`). */ + providers: unknown[]; + /** `ctx.data.location.model.list()`; optional when providers embed `models`. */ + models?: unknown[]; + env?: Env; + readAuth?: () => unknown; +} + +type Rec = Record; + +function isRecord(value: unknown): value is Rec { + return typeof value === "object" && value !== null && !Array.isArray(value); +} + +function str(value: unknown): string | undefined { + return typeof value === "string" && value.trim() ? value.trim() : undefined; +} + +/** OpenCode's auth store path; honors XDG_DATA_HOME like OpenCode itself. */ +export function authFilePath(env: Env = process.env): string { + const xdg = env.XDG_DATA_HOME?.trim(); + const base = + xdg && isAbsolute(xdg) ? xdg : join(env.HOME?.trim() || homedir(), ".local", "share"); + return join(base, "opencode", "auth.json"); +} + +function readAuthFile(path: string): unknown { + try { + return JSON.parse(readFileSync(path, "utf8")); + } catch { + return null; + } +} + +export function isOpencodeHost(endpoint: string): boolean { + try { + const host = new URL(endpoint).hostname.toLowerCase(); + return host === "opencode.ai" || host.endsWith(".opencode.ai"); + } catch { + return false; + } +} + +function hostLabel(endpoint: string): string { + try { + return new URL(endpoint).hostname; + } catch { + return "custom"; + } +} + +function findModel( + provider: Rec, + providerID: string, + modelID: string, + models: unknown[], +): Rec | undefined { + const fromList = models.find( + (m): m is Rec => isRecord(m) && m.providerID === providerID && m.id === modelID, + ); + if (fromList) return fromList; + const own = provider.models; + if (Array.isArray(own)) return own.find((m): m is Rec => isRecord(m) && m.id === modelID); + if (isRecord(own)) { + const m = own[modelID]; + return isRecord(m) ? m : undefined; + } + return undefined; +} + +interface ProviderTarget { + providerID: string; + /** Upstream model id to send in the request body. */ + model: string; + endpoint?: string; + /** Lazily resolved: env var first, then an auth.json `api` key. */ + key: () => string | undefined; +} + +function resolveRef( + ref: ModelRef, + input: ResolveLlmInput, + env: Env, + readAuth: () => unknown, +): ProviderTarget | null { + const provider = input.providers.find((p): p is Rec => isRecord(p) && p.id === ref.providerID); + if (!provider) return null; + const model = findModel(provider, ref.providerID, ref.modelID, input.models ?? []); + const api = isRecord(model?.api) ? model.api : undefined; + const settings = isRecord(provider.settings) ? provider.settings : undefined; + const options = isRecord(provider.options) ? provider.options : undefined; + return { + providerID: ref.providerID, + model: str(model?.modelID) ?? str(api?.id) ?? str(model?.id) ?? ref.modelID, + endpoint: str(settings?.baseURL) ?? str(options?.baseURL) ?? str(api?.url), + key: () => { + const envNames = Array.isArray(provider.env) ? provider.env : []; + for (const name of envNames) { + const value = typeof name === "string" ? str(env[name]) : undefined; + if (value) return value; + } + const auth = readAuth(); + if (!isRecord(auth)) return undefined; + for (const id of [str(provider.id), str(provider.integrationID)]) { + const entry = id ? auth[id] : undefined; + // OAuth access/refresh tokens are never forwarded. + if (isRecord(entry) && entry.type === "api") { + const key = str(entry.key); + if (key) return key; + } + } + return undefined; + }, + }; +} + +export function resolveLlmConfig(input: ResolveLlmInput): LlmConfig | null { + const env = input.env ?? process.env; + const readAuth = input.readAuth ?? (() => readAuthFile(authFilePath(env))); + const { options } = input; + + const optEndpoint = str(options.endpoint); + const optModel = str(options.model); + const keyEnv = str(options.apiKeyEnv); + const explicitKey = str(options.apiKey) ?? (keyEnv ? str(env[keyEnv]) : undefined); + const useResponsesApi = options.useResponsesApi === true ? true : undefined; + + const build = (endpoint: string, model: string, apiKey: string | undefined, owner: string) => ({ + endpoint, + model, + ...(apiKey ? { apiKey } : {}), + ...(useResponsesApi ? { useResponsesApi } : {}), + sendSessionHeader: isOpencodeHost(endpoint), + label: `${owner}/${model}`, + }); + + if (optEndpoint && optModel) + return build(optEndpoint, optModel, explicitKey, hostLabel(optEndpoint)); + + const refs = [input.selection, input.sessionModel].filter( + (ref): ref is ModelRef => ref !== null && !!ref.providerID && !!ref.modelID, + ); + const targets = refs.map((ref) => resolveRef(ref, input, env, readAuth)); + + if (optEndpoint) { + // Explicit endpoint, model from the selection: never a provider key. + const first = refs[0]; + const model = targets[0]?.model ?? first?.modelID; + return model ? build(optEndpoint, model, explicitKey, hostLabel(optEndpoint)) : null; + } + + const target = targets.find((t) => t?.endpoint); + if (!target?.endpoint) return null; + const model = optModel ?? target.model; + return build(target.endpoint, model, explicitKey ?? target.key(), target.providerID); +} diff --git a/src/llm/prompts.test.ts b/src/llm/prompts.test.ts new file mode 100644 index 0000000..5804e6e --- /dev/null +++ b/src/llm/prompts.test.ts @@ -0,0 +1,83 @@ +import { describe, expect, test } from "bun:test"; +import { + buildCorrectionUser, + buildSttUser, + cleanNormalizerOutput, + needsContext, +} from "./prompts.ts"; + +describe("needsContext", () => { + test("sentence-initial capitals are not a signal", () => { + expect(needsContext("Add tests for the async user service")).toBe(false); + expect(needsContext("Run the build. Check the logs")).toBe(false); + expect(needsContext("Chạy lại build giúp tôi")).toBe(false); + }); + + test("capitalized name mid-sentence is a signal", () => { + expect(needsContext("ask Cristina about the deploy")).toBe(true); + expect(needsContext("Send it to (Cristina)")).toBe(true); + }); + + test("English pronouns and demonstratives", () => { + expect(needsContext("fix that function")).toBe(true); + expect(needsContext("This is broken")).toBe(true); + expect(needsContext("rename them")).toBe(true); + }); + + test("Vietnamese pronouns with diacritics match as whole words", () => { + expect(needsContext("sửa cái đó đi")).toBe(true); + expect(needsContext("hỏi chị về việc deploy")).toBe(true); + // "chịu" contains "chị" but is a different word. + expect(needsContext("chịu khó chạy lại")).toBe(false); + }); + + test("lowercase accented words are not capitals", () => { + expect(needsContext("chạy lại để kiểm tra")).toBe(false); + }); + + test("short or empty input", () => { + expect(needsContext("")).toBe(false); + expect(needsContext("ok")).toBe(false); + }); +}); + +describe("builders", () => { + test("buildSttUser without context", () => { + expect(buildSttUser("raw text", {})).toBe( + "Clean up this speech-to-text transcription:\n\nraw text", + ); + }); + + test("buildSttUser with title and recent turns", () => { + expect(buildSttUser("raw", { sessionTitle: "Fix login", recent: "user: hi" })).toBe( + '\n[session: "Fix login"]\nuser: hi\n\nClean up this speech-to-text transcription:\n\nraw', + ); + }); + + test("buildCorrectionUser", () => { + const out = buildCorrectionUser("fit the bug", "I mean fix", { sessionTitle: "T" }); + expect(out).toContain('[session: "T"]'); + expect(out).toContain("CURRENT: fit the bug\nCORRECTION: I mean fix"); + }); +}); + +describe("cleanNormalizerOutput", () => { + test("strips an echoed task wrapper", () => { + expect( + cleanNormalizerOutput( + "reply with one short sentence", + "Clean up this speech-to-text transcription: Reply with one short sentence.", + ), + ).toBe("Reply with one short sentence."); + }); + test("strips added quotes and labels", () => { + expect(cleanNormalizerOutput("hello there", '"Hello there."')).toBe("Hello there."); + expect(cleanNormalizerOutput("hello there", "Output: Hello there.")).toBe("Hello there."); + }); + test("falls back to raw when the model answers instead of cleaning", () => { + const answer = + "Sure! Here is a detailed explanation of how to fix the failing test in your parser module, step by step..."; + expect(cleanNormalizerOutput("fix the test", answer)).toBe("fix the test"); + expect(cleanNormalizerOutput("fix the test", " ")).toBe("fix the test"); + }); +}); diff --git a/src/llm/prompts.ts b/src/llm/prompts.ts new file mode 100644 index 0000000..e02a833 --- /dev/null +++ b/src/llm/prompts.ts @@ -0,0 +1,154 @@ +// System prompts and user-message builders for the voice LLM calls. + +export const STT_NORMALIZE_PROMPT = `You are a DETERMINISTIC speech-to-text normalizer for a coding assistant CLI. You are NOT a chatbot. You NEVER answer, explain, greet back, or introduce yourself. + +Task: Return ONLY what the user meant to say, cleaned up for use as their message. Fix what the speech recognizer misheard, not just punctuation. No reply. No extra sentences. + +Strict rules: +- Output is the user's utterance, cleaned. It is NOT a response to the user. +- Keep the language the user spoke (Vietnamese, English, or a mix). Never translate. +- Fix punctuation, capitalization, grammar. +- Remove filler words (um, uh, like, you know, ừm, à, etc.). +- Keep technical terms, file names, and code references exact. +- If the user is dictating code, format it appropriately. +- INTERPRET misheard words: speech recognition often produces acoustically-close-but-wrong words ("they face" for "database", "bait" for "page"). Replace a word or short phrase ONLY when ALL of these hold: (1) it sounds similar to the replacement, (2) the conversation context or the domain lists below support the replacement, (3) the sentence makes clearly more sense with it. Otherwise leave the original words untouched. +- Use the conversation context to resolve ambiguous names, pronouns, references, AND misheard content words (that function, the file, it) - never copy unrelated facts from the context into the output. +- Output ONLY the cleaned text, nothing else. No quotes, no prefixes, no suffixes. +- Do NOT add greetings, introductions, offers to help, questions, or commentary. +- Do NOT expand short inputs. Keep output length close to input length (within ~30%); do not add paragraphs or new requests the user did not make. +- If input is a short greeting/noise like "hey", "hello", "hi", "hey there", output exactly that greeting capitalized with a period (e.g., "hey" -> "Hey."). + +Examples (follow exactly): +Input: "hey" +Output: Hey. + +Input: "umm add tests for the a sink user service" +Output: Add tests for the async user service. + +Input: "check the locks for the doc container" +Output: Check the logs for the Docker container. + +Input: "craft a notion bait tracking our work items" +Output: Craft a Notion page tracking our work items. + +Input: "check the notion they face for the next phase target" +Output: Check the Notion database for the next phase target. + +If you cannot normalize, return the input trimmed. + +DOMAIN CORRECTIONS - common STT homophone errors in software engineering contexts: +- "locks" -> "logs" (unless explicitly talking about mutexes/concurrency) +- "note" / "no" -> "node" +- "app and" -> "append" +- "sink" -> "sync"; "a sink" -> "async" +- "doc" / "talker" -> "Docker" +- "cash" -> "cache" +- "rap" -> "wrap" +- "Jason" -> "JSON" +- "get" -> "Git" (when talking about version control) +- "types creep" / "type script" -> "TypeScript" +- "bite" -> "byte" +- "bullion" -> "boolean" +- "bait" / "paid" -> "page" (in Notion contexts) +- "they face" / "data base" -> "database" +- keep "commit", "master", "notion" as-is`; + +export const CORRECTION_PROMPT = `You repair voice-dictated text with a spoken correction. You are NOT a chatbot. Never answer, explain, or greet. +Input gives CURRENT (the text now in the composer) and CORRECTION (what the user just said, e.g. "I mean fix not fit", "xóa câu cuối", or just the corrected phrase). +Output ONLY the corrected full text: CURRENT with the correction applied, everything else unchanged. Always keep the language of CURRENT, even when the correction is spoken in a different language. Keep names, casing, punctuation, and line breaks. No quotes, no labels, no commentary.`; + +export const TTS_NORMALIZE_PROMPT = `You turn a coding assistant's markdown reply into natural spoken text for text-to-speech. You are NOT a chatbot. Never answer, add opinions, or address the reply's content to anyone. + +Rules: +- Keep the reply's language: Vietnamese stays Vietnamese, English stays English. Never translate. +- Keep English technical terms, commands, identifiers, and proper nouns in English inside Vietnamese sentences. Prefer putting them at the start or end of their clause. +- Remove all markdown syntax (headings, bullets, bold, links) but keep the information. +- Identifiers: split camelCase/PascalCase/snake_case into words (parseConfig -> "parse config"). +- File paths: say only the file name (src/utils/helpers.ts -> "helpers dot ts"). +- URLs: say "a link" or just the domain. +- Code blocks and long code: never read code. Say in one sentence what the code does or changed. +- Tables: never read cell by cell. Say what the table lists plus the 2-3 most important rows. +- Diagrams: describe the flow in one or two sentences and say the word "diagram" once. +- Short replies and confirmations: one brief sentence. +- Long technical replies: a short spoken summary of what was done and why, then "check the screen for details". +- Do not spell acronyms letter by letter unless needed. +- Output ONLY the spoken text. No labels, no quotes, no commentary.`; + +export interface SttContext { + readonly sessionTitle?: string; + /** Recent conversation turns; pass only when needsContext(raw) is true. */ + readonly recent?: string; +} + +function knowledgeBlock(context: SttContext | undefined): string { + if (!context) return ""; + const parts: string[] = []; + const title = context.sessionTitle?.trim(); + if (title) parts.push(`[session: "${title}"]`); + const recent = context.recent?.trim(); + if (recent) parts.push(recent); + return parts.length > 0 ? `\n${parts.join("\n")}\n\n` : ""; +} + +/** User message for STT normalization. Includes whatever context is passed. */ +export function buildSttUser(raw: string, context: SttContext): string { + const knowledge = knowledgeBlock(context); + const task = `Clean up this speech-to-text transcription:\n\n${raw}`; + return knowledge ? `${knowledge}${task}` : task; +} + +/** User message for a correction merge (pair with CORRECTION_PROMPT). */ +export function buildCorrectionUser( + current: string, + correction: string, + context?: SttContext, +): string { + return ( + knowledgeBlock(context) + + `Apply the spoken correction to the current text. Keep the CURRENT text's language.\n\nCURRENT: ${current}\nCORRECTION: ${correction}` + ); +} + +// Pronouns and demonstratives (en + vi). Matched as whole words; JS `\b` is +// ASCII-only, so letter lookarounds are used to handle Vietnamese diacritics. +const PRONOUNS = + /(? CAPITALIZED.test(w.replace(/^[^\p{L}]+/u, "")))) return true; + } + return false; +} + +const ECHO_PREFIXES = [ + /^\s*clean up this speech-to-text transcription\s*:?\s*/i, + /^\s*(?:cleaned(?: text| transcription)?|output|result)\s*:\s*/i, +]; + +/** + * Guard against normalizers that echo the task wrapper, add quotes, or + * answer instead of cleaning. Falls back to the raw text when the output + * is clearly not a cleaned version of it. + */ +export function cleanNormalizerOutput(raw: string, out: string): string { + let t = out.trim(); + for (const re of ECHO_PREFIXES) t = t.replace(re, ""); + t = t.replace(/^|<\/task>$/g, "").trim(); + if (/^["“].*["”]$/s.test(t) && !/^["“]/.test(raw.trim())) t = t.slice(1, -1).trim(); + if (!t) return raw.trim(); + // "Keep output length close to input": a much longer output is an answer. + if (t.length > raw.length * 2 + 40) return raw.trim(); + return t; +} diff --git a/src/log.ts b/src/log.ts new file mode 100644 index 0000000..f84209d --- /dev/null +++ b/src/log.ts @@ -0,0 +1,56 @@ +// Private diagnostic log. Never contains transcript or speech text: callers +// log lengths, ids and error messages only. +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import type { LogLevel, Logger } from "./types.ts"; + +const MAX_BYTES = 1_000_000; + +export function defaultLogPath(env: Record = process.env): string { + const base = env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache"); + return path.join(base, "opencode-voice", "voice.log"); +} + +export function createFileLogger(file = defaultLogPath(), minLevel: LogLevel = "debug"): Logger { + const order: Record = { debug: 0, info: 1, warn: 2, error: 3 }; + let ready = false; + function ensure(): boolean { + if (ready) return true; + try { + fs.mkdirSync(path.dirname(file), { recursive: true, mode: 0o700 }); + try { + if (fs.statSync(file).size > MAX_BYTES) fs.renameSync(file, `${file}.1`); + } catch {} + // O_NOFOLLOW: refuse a pre-planted symlink at the log path. + const fd = fs.openSync( + file, + fs.constants.O_WRONLY | + fs.constants.O_CREAT | + fs.constants.O_APPEND | + fs.constants.O_NOFOLLOW, + 0o600, + ); + fs.closeSync(fd); + ready = true; + } catch { + ready = false; + } + return ready; + } + return { + log(scope, message, level = "debug") { + if (order[level] < order[minLevel]) return; + if (!ensure()) return; + try { + fs.appendFileSync( + file, + `${new Date().toISOString()} pid=${process.pid} ${level} [${scope}] ${message}\n`, + { mode: 0o600 }, + ); + } catch {} + }, + }; +} + +export const nullLogger: Logger = { log() {} }; diff --git a/src/node/client.ts b/src/node/client.ts new file mode 100644 index 0000000..a62d07f --- /dev/null +++ b/src/node/client.ts @@ -0,0 +1,597 @@ +// Client side of the voice node: MicStream / Player / Transcriber / Synth +// implementations that talk to a node over HTTP + WebSocket, plus discovery +// (local or on the tailnet) and starting the node daemon on the engine host. +import { spawn } from "node:child_process"; +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { wavDurationSec } from "../audio/wav.ts"; +import type { + Logger, + MicError, + MicStream, + PlayEnd, + Player, + PlayerStatus, + SpeechLang, + SpeechSegment, + Synth, + Transcriber, + TranscribeOptions, +} from "../types.ts"; +import { SynthError, clampRate, errorMessage } from "../types.ts"; +import { stateDir } from "./config.ts"; +import type { DeviceStatus } from "./hub.ts"; +export type { DeviceStatus }; + +export const DEFAULT_NODE_PORT = 47800; + +export interface NodeInfo { + readonly protocol: number; + readonly host: string; + readonly devices: DeviceStatus[]; + readonly home: DeviceStatus; + readonly pinned: string | null; + readonly micOwner: string | null; + readonly models: string[]; + readonly defaultModel: string | null; +} + +type FetchFn = (url: string, init?: RequestInit) => Promise; + +export interface ClientDeps { + readonly fetch?: FetchFn; + readonly WebSocket?: typeof WebSocket; + readonly now?: () => number; + readonly logger?: Logger; + /** Name shown to other clients ("duy:opencode"). */ + readonly clientName?: string; +} + +function wsUrl(base: string, p: string, client: string): string { + const u = new URL(p, base); + u.protocol = u.protocol === "https:" ? "wss:" : "ws:"; + u.searchParams.set("client", client); + return u.toString(); +} + +export async function fetchInfo( + base: string, + deps: ClientDeps = {}, + timeoutMs = 1500, +): Promise { + try { + const r = await (deps.fetch ?? fetch)(new URL("/v1/info", base).toString(), { + signal: AbortSignal.timeout(timeoutMs), + }); + if (!r.ok) return null; + const info = (await r.json()) as NodeInfo; + return info.protocol === 1 ? info : null; + } catch { + return null; + } +} + +// ------------------------------------------------------------------ mic + +class RemoteMicError extends Error implements MicError { + constructor( + readonly code: MicError["code"], + message: string, + readonly hint?: string, + ) { + super(message); + } +} + +function toMicCode(code: unknown): MicError["code"] { + return code === "CONNECTION" || + code === "EXITED" || + code === "NO_AUDIO" || + code === "SPAWN_FAILED" + ? code + : "CONNECTION"; +} + +/** Open the node's home microphone. Resolves once the device streams. */ +export function openRemoteMic( + base: string, + deps: ClientDeps = {}, +): Promise { + const WS = deps.WebSocket ?? WebSocket; + return new Promise((resolve, reject) => { + let ws: WebSocket; + try { + ws = new WS(wsUrl(base, "/v1/mic", deps.clientName ?? "opencode")); + } catch (err) { + reject( + new RemoteMicError( + "CONNECTION", + `Voice node unreachable: ${errorMessage(err)}`, + "Check that the node runs on the engine host", + ), + ); + return; + } + ws.binaryType = "arraybuffer"; + const dataCbs = new Set<(c: Buffer) => void>(); + const errCbs = new Set<(e: MicError) => void>(); + let opened = false; + let paused = false; + let error: MicError | null = null; + let endWaiters: Array<() => void> = []; + let closed = false; + let stopping = false; + let rate = 16000; + let device = ""; + + const emitError = (e: MicError): void => { + if (error) return; + error = e; + for (const cb of errCbs) { + try { + cb(e); + } catch {} + } + }; + const finishWaiters = (): void => { + for (const w of endWaiters.splice(0)) w(); + }; + + const stream = { + get format() { + return { sampleRate: rate }; + }, + get device() { + return device; + }, + get paused() { + return paused; + }, + onData(cb: (c: Buffer) => void) { + dataCbs.add(cb); + return () => dataCbs.delete(cb); + }, + onError(cb: (e: MicError) => void) { + errCbs.add(cb); + if (error) cb(error); + return () => errCbs.delete(cb); + }, + pause() { + paused = true; + if (ws.readyState === 1) ws.send('{"op":"pause"}'); + }, + resume() { + paused = false; + if (ws.readyState === 1) ws.send('{"op":"resume"}'); + }, + stop() { + if (closed) return Promise.resolve(); + stopping = true; + return new Promise((res) => { + endWaiters.push(res); + const t = setTimeout(() => { + try { + ws.close(); + } catch {} + finishWaiters(); + }, 9000); + t.unref?.(); + endWaiters.push(() => clearTimeout(t)); + if (ws.readyState === 1) ws.send('{"op":"stop"}'); + }); + }, + kill() { + closed = true; + try { + ws.close(); + } catch {} + finishWaiters(); + }, + }; + + ws.onmessage = (ev: MessageEvent) => { + const d = ev.data as unknown; + if (typeof d === "string") { + let m: { + t?: string; + code?: unknown; + message?: string; + hint?: string; + rate?: number; + device?: { label?: string }; + }; + try { + m = JSON.parse(d) as typeof m; + } catch { + return; + } + if (m.t === "open") { + opened = true; + rate = typeof m.rate === "number" ? m.rate : rate; + device = m.device?.label ?? ""; + deps.logger?.log("node-client", `mic open on ${device}`); + resolve(stream); + } else if (m.t === "error") { + const e = new RemoteMicError( + toMicCode(m.code === "BUSY" ? "CONNECTION" : m.code), + m.message ?? "Microphone failed", + m.hint, + ); + if (!opened) reject(e); + else emitError(e); + } else if (m.t === "end") { + finishWaiters(); + } + return; + } + if (paused || closed) return; + const buf = Buffer.from(d instanceof ArrayBuffer ? new Uint8Array(d) : (d as Uint8Array)); + for (const cb of dataCbs) { + try { + cb(buf); + } catch {} + } + }; + ws.onerror = () => { + if (!opened) + reject( + new RemoteMicError( + "CONNECTION", + "Voice node unreachable", + "Check that the node runs on the engine host and Tailscale is up", + ), + ); + }; + ws.onclose = () => { + const wasClosed = closed; + closed = true; + finishWaiters(); + if (opened && !wasClosed && !stopping && !error) { + // Dropped without a stop: the node or the network went away. + emitError( + new RemoteMicError( + "CONNECTION", + "Lost the connection to the voice node", + "Check Tailscale on both machines", + ), + ); + } + if (!opened) + reject( + new RemoteMicError( + "CONNECTION", + "Voice node closed the microphone", + "Check the node log on the engine host", + ), + ); + }; + }); +} + +// ------------------------------------------------------------------ player + +interface Pending { + resolve: (e: PlayEnd) => void; + reject: (e: Error) => void; +} + +/** The node's shared speaker, mirrored locally so reads stay synchronous. */ +export function createRemotePlayer(base: string, deps: ClientDeps = {}): Player { + const WS = deps.WebSocket ?? WebSocket; + const now = deps.now ?? (() => Date.now()); + let ws: WebSocket | null = null; + let queue: Array = []; + let nextId = 1; + const pending = new Map(); + let st: { status: PlayerStatus; pos: number; dur: number; rate: number; at: number } = { + status: "idle", + pos: 0, + dur: 0, + rate: 1, + at: now(), + }; + let disposed = false; + + function settleAll(e: PlayEnd): void { + for (const p of pending.values()) p.resolve(e); + pending.clear(); + } + + function connect(): WebSocket { + if (ws && ws.readyState <= 1) return ws; + const sock = new WS(wsUrl(base, "/v1/player", deps.clientName ?? "opencode")); + sock.binaryType = "arraybuffer"; + sock.onopen = () => { + const q = queue; + queue = []; + for (const m of q) sock.send(m); + }; + sock.onmessage = (ev: MessageEvent) => { + if (typeof ev.data !== "string") return; + let m: { + t?: string; + id?: number; + result?: string; + message?: string; + status?: PlayerStatus; + pos?: number; + dur?: number; + rate?: number; + state?: Record; + }; + try { + m = JSON.parse(ev.data) as typeof m; + } catch { + return; + } + if (m.t === "started") { + if (m.id !== starting) return; + starting = null; + } else if (starting !== null) { + // Until the node confirms the new clip, its states describe the old one. + if (m.t === "state" || m.t === "ack") return; + } + const s = (m.t === "ack" || m.t === "started" ? m.state : m) as typeof m | undefined; + if (s && (m.t === "state" || m.t === "ack" || m.t === "started") && s.status) { + st = { + status: s.status, + pos: s.pos ?? 0, + dur: s.dur ?? st.dur, + rate: s.rate ?? st.rate, + at: now(), + }; + } + if (m.t === "end" && typeof m.id === "number") { + const p = pending.get(m.id); + pending.delete(m.id); + if (!p) return; + if (m.result === "error") + p.reject(new Error(m.message ?? "Playback failed on the voice node")); + else p.resolve(m.result === "ended" ? "ended" : "stopped"); + } + }; + sock.onclose = () => { + if (ws === sock) ws = null; + starting = null; + st = { ...st, status: "idle", at: now() }; + settleAll("stopped"); + }; + ws = sock; + return sock; + } + + function send(m: string | Uint8Array): void { + const sock = connect(); + if (sock.readyState === 1) sock.send(m); + else queue.push(m); + } + + /** Play id sent but not yet confirmed by "started". */ + let starting: number | null = null; + + function position(): number { + if (st.status !== "playing") return Math.min(st.pos, st.dur || st.pos); + return Math.min(st.dur, st.pos + ((now() - st.at) / 1000) * st.rate); + } + + return { + play(wav) { + if (disposed) return Promise.resolve("stopped"); + const dur = wavDurationSec(wav); + if (dur === null) return Promise.reject(new Error("Cannot play: audio is not a valid WAV")); + const id = nextId++; + starting = id; + st = { ...st, status: "playing", pos: 0, dur, at: now() }; + const p = new Promise((resolve, reject) => pending.set(id, { resolve, reject })); + send(JSON.stringify({ op: "play", id })); + send(new Uint8Array(wav)); + return p; + }, + pause() { + if (st.status !== "playing") return false; + st = { ...st, status: "paused", pos: position(), at: now() }; + send('{"op":"pause"}'); + return true; + }, + resume() { + if (st.status !== "paused") return false; + st = { ...st, status: "playing", at: now() }; + send('{"op":"resume"}'); + return true; + }, + stop() { + st = { ...st, status: "idle", at: now() }; + send('{"op":"stop"}'); + }, + status: () => st.status, + positionSec: position, + durationSec: () => st.dur, + seek(sec) { + if (st.status === "idle") return false; + st = { ...st, pos: Math.max(0, Math.min(sec, st.dur)), at: now() }; + // JSON has no Infinity (it becomes null): "past the end" must stay a number. + send( + JSON.stringify({ op: "seek", sec: Number.isFinite(sec) ? sec : Number.MAX_SAFE_INTEGER }), + ); + return true; + }, + setRate(rate) { + const r = clampRate(rate); + st = { ...st, pos: position(), rate: r, at: now() }; + send(JSON.stringify({ op: "rate", rate: r })); + }, + rate: () => st.rate, + dispose() { + disposed = true; + settleAll("stopped"); + try { + ws?.close(); + } catch {} + ws = null; + }, + }; +} + +// ------------------------------------------------------------ engines + +export function createRemoteTranscriber( + base: string, + model: () => string | null, + deps: ClientDeps = {}, +): Transcriber { + const f = deps.fetch ?? fetch; + return { + async transcribe(wav: Buffer, opts: TranscribeOptions) { + const u = new URL("/v1/transcribe", base); + u.searchParams.set("lang", opts.language); + const m = model(); + if (m) u.searchParams.set("model", m); + if (opts.prompt) u.searchParams.set("prompt", opts.prompt); + const r = await f(u.toString(), { + method: "POST", + body: new Uint8Array(wav), + headers: { "content-type": "audio/wav" }, + ...(opts.signal ? { signal: opts.signal } : {}), + }); + const body = (await r.json().catch(() => ({}))) as { text?: unknown; message?: unknown }; + if (!r.ok) + throw new Error( + typeof body.message === "string" + ? body.message + : `Voice node transcription failed (HTTP ${r.status})`, + ); + return typeof body.text === "string" ? body.text : ""; + }, + async warm() { + const u = new URL("/v1/warm", base); + u.searchParams.set("what", "stt"); + const m = model(); + if (m) u.searchParams.set("model", m); + await f(u.toString(), { method: "POST", signal: AbortSignal.timeout(3000) }).catch(() => {}); + }, + describe: () => `whisper on ${new URL(base).hostname}`, + async dispose() {}, + }; +} + +export function createRemoteSynth( + base: string, + name: "vieneu" | "piper", + voice: () => string, + deps: ClientDeps = {}, +): Synth { + const f = deps.fetch ?? fetch; + return { + name, + async synthesize(seg: SpeechSegment, signal?: AbortSignal) { + let r: Response; + try { + r = await f(new URL("/v1/synth", base).toString(), { + method: "POST", + headers: { "content-type": "application/json" }, + body: JSON.stringify({ engine: name, lang: seg.lang, text: seg.text, voice: voice() }), + ...(signal ? { signal } : {}), + }); + } catch (err) { + if (signal?.aborted) throw new SynthError("aborted", "ABORTED"); + throw new SynthError(`voice node unreachable (${errorMessage(err)})`, "UNAVAILABLE"); + } + if (r.ok) return Buffer.from(await r.arrayBuffer()); + const body = (await r.json().catch(() => ({}))) as { code?: unknown; message?: unknown }; + const message = typeof body.message === "string" ? body.message : `HTTP ${r.status}`; + const code = + body.code === "UNAVAILABLE" || r.status === 503 + ? "UNAVAILABLE" + : body.code === "ABORTED" + ? "ABORTED" + : "FAILED"; + throw new SynthError(message, code); + }, + supports: (_lang: SpeechLang) => true, + warm() { + if (name !== "vieneu") return; + void f(new URL("/v1/warm?what=tts", base).toString(), { + method: "POST", + signal: AbortSignal.timeout(3000), + }).catch(() => {}); + }, + async dispose() {}, + }; +} + +// ----------------------------------------------------------- discovery + +export type NodeMode = "off" | "auto" | "host" | string; + +export interface DiscoverDeps extends ClientDeps { + /** `tailscale status --json` output, or null when unavailable. */ + readonly tailscaleStatus?: () => Promise; + readonly startDaemon?: () => void; + readonly sleep?: (ms: number) => Promise; +} + +/** Online tailnet peers that could run a node (computers, not phones). */ +export function tailnetCandidates(statusJson: string): string[] { + try { + const s = JSON.parse(statusJson) as { + Peer?: Record; + }; + const out: string[] = []; + for (const p of Object.values(s.Peer ?? {})) { + if (!p.Online || !/^(macOS|linux|windows)$/i.test(p.OS ?? "")) continue; + const ip = p.TailscaleIPs?.find((x) => x.includes(".")); + if (ip) out.push(ip); + } + return out; + } catch { + return []; + } +} + +/** + * Find the voice node to use. "off" → none; a URL → that node; "host" → + * this machine (starting the daemon if needed); "auto" → this machine, else + * the first node that answers on the tailnet, else none (local engines). + */ +export async function discoverNode( + mode: NodeMode, + deps: DiscoverDeps = {}, +): Promise { + if (mode === "off") return null; + if (/^https?:\/\//.test(mode)) return mode.replace(/\/+$/, ""); + const local = `http://127.0.0.1:${DEFAULT_NODE_PORT}`; + if (await fetchInfo(local, deps, 800)) return local; + if (mode === "host") { + deps.startDaemon?.(); + const sleep = deps.sleep ?? ((ms: number) => new Promise((r) => setTimeout(r, ms))); + for (let i = 0; i < 40; i++) { + await sleep(250); + if (await fetchInfo(local, deps, 800)) return local; + } + return null; + } + const status = await deps.tailscaleStatus?.(); + if (!status) return null; + const candidates = tailnetCandidates(status).map((ip) => `http://${ip}:${DEFAULT_NODE_PORT}`); + const found = await Promise.all( + candidates.map(async (u) => ((await fetchInfo(u, deps, 1200)) ? u : null)), + ); + return found.find((u) => u !== null) ?? null; +} + +/** Start `bun src/node/main.ts` detached (survives OpenCode exiting). */ +export function startNodeDaemon(logger?: Logger): void { + const main = fileURLToPath(new URL("./main.ts", import.meta.url)); + const dir = stateDir(); + fs.mkdirSync(dir, { recursive: true, mode: 0o700 }); + const out = fs.openSync(path.join(dir, "node.out"), "a", 0o600); + const bun = typeof Bun !== "undefined" ? Bun.which("bun") : null; + // Inside OpenCode (a compiled Bun binary) BUN_BE_BUN=1 turns it into the bun CLI. + const cmd = bun ?? process.execPath; + const env = bun ? process.env : { ...process.env, BUN_BE_BUN: "1" }; + const child = spawn(cmd, [main], { detached: true, stdio: ["ignore", out, out], env }); + child.unref(); + fs.closeSync(out); + logger?.log("node-client", `started voice node pid=${child.pid ?? "?"} via ${cmd}`, "info"); +} diff --git a/src/node/config.ts b/src/node/config.ts new file mode 100644 index 0000000..b6022dc --- /dev/null +++ b/src/node/config.ts @@ -0,0 +1,86 @@ +// Voice node configuration: ~/.config/opencode-voice/node.json +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import type { DeviceConfig, DeviceKind } from "./devices.ts"; + +export interface NodeConfig { + readonly port: number; + readonly sampleRate: number; + readonly sshConfig: string; + readonly devices: readonly DeviceConfig[]; + readonly whisperModel: string | null; + readonly vieneuPython: string; + readonly vieneuVoice: string; +} + +export function configDir(env: Record = process.env): string { + return path.join(env.XDG_CONFIG_HOME || path.join(os.homedir(), ".config"), "opencode-voice"); +} + +export function stateDir(env: Record = process.env): string { + return path.join(env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache"), "opencode-voice"); +} + +const expand = (p: string): string => p.replace(/^~(?=\/|$)/, os.homedir()); + +function str(v: unknown): string | null { + return typeof v === "string" && v.trim() ? v.trim() : null; +} + +export function parseNodeConfig(raw: unknown, dir = configDir()): NodeConfig { + const o = raw && typeof raw === "object" ? (raw as Record) : {}; + const devices: DeviceConfig[] = []; + const seen = new Set(); + if (Array.isArray(o.devices)) { + for (const d of o.devices) { + if (!d || typeof d !== "object") continue; + const r = d as Record; + const id = str(r.id); + const kind = r.kind; + if (!id || seen.has(id) || (kind !== "local" && kind !== "linux" && kind !== "termux")) + continue; + seen.add(id); + const port = Number(r.adbForwardPort); + devices.push({ + id, + label: str(r.label) ?? id, + kind: kind as DeviceKind, + ...(str(r.ssh) ? { ssh: str(r.ssh) as string } : {}), + ...(str(r.adb) ? { adb: str(r.adb) as string } : {}), + ...(Number.isInteger(port) && port > 0 ? { adbForwardPort: port } : {}), + }); + } + } + if (!devices.some((d) => d.kind === "local")) { + devices.unshift({ + id: "local", + label: os.hostname().split(".")[0] || "this machine", + kind: "local", + }); + } + const port = Number(o.port); + const rate = Number(o.sampleRate); + return { + port: Number.isInteger(port) && port > 1024 ? port : 47800, + sampleRate: Number.isInteger(rate) && rate >= 8000 && rate <= 48000 ? rate : 16000, + sshConfig: expand(str(o.sshConfig) ?? path.join(dir, "ssh_config")), + devices, + whisperModel: str(o.whisperModel) ? expand(str(o.whisperModel) as string) : null, + vieneuPython: expand( + str(o.vieneuPython) ?? + path.join(os.homedir(), ".local/share/opencode-voice/vieneu-venv/bin/python"), + ), + vieneuVoice: str(o.vieneuVoice) ?? "Mai Anh", + }; +} + +export function loadNodeConfig(dir = configDir()): NodeConfig { + let raw: unknown = {}; + try { + raw = JSON.parse(fs.readFileSync(path.join(dir, "node.json"), "utf8")); + } catch { + // missing or invalid: defaults (this machine only) + } + return parseNodeConfig(raw, dir); +} diff --git a/src/node/devices.ts b/src/node/devices.ts new file mode 100644 index 0000000..0eb03b7 --- /dev/null +++ b/src/node/devices.ts @@ -0,0 +1,227 @@ +// Audio devices the voice node can listen and speak through: this Mac, Linux +// boxes over ssh (PipeWire/Pulse), and an Android phone running Termux (over +// adb-forwarded or tailnet ssh). Every device yields a MicConfig, a +// PlayerOutput and a presence probe ("how long since a human touched it"). +import type { MicConfig, PlayerOutput } from "../types.ts"; + +export type DeviceKind = "local" | "linux" | "termux"; + +export interface DeviceConfig { + readonly id: string; + readonly label: string; + readonly kind: DeviceKind; + /** ssh destination (a Host alias in the node's ssh_config). */ + readonly ssh?: string; + /** Android serial for adb (presence + port forward); "auto" = only device. */ + readonly adb?: string; + /** adb forward port for a Termux sshd reached via 127.0.0.1. */ + readonly adbForwardPort?: number; +} + +export interface CommandContext { + /** Path of the ssh_config the node uses. */ + readonly sshConfig: string; + readonly sampleRate: number; +} + +/** Process tags: remote processes are started under these names so they can be killed exactly. */ +export const MIC_TAG = "ocv-mic"; +export const PLAY_TAG = "ocv-play"; + +function shq(s: string): string { + return `'${s.replace(/'/g, `'\\''`)}'`; +} + +export function sshArgv(ctx: CommandContext, dest: string, script: string): string[] { + // `bash -c` so the script runs the same whatever the login shell is (fish, zsh...). + return ["ssh", "-F", ctx.sshConfig, "-T", dest, `bash -c ${shq(script)}`]; +} + +const LINUX_ENV = "export XDG_RUNTIME_DIR=${XDG_RUNTIME_DIR:-/run/user/$(id -u)};"; + +/** Termux: Termux:API records Opus/OGG continuously; the growing file is decoded live. */ +export function termuxCaptureScript(rate: number): string { + return [ + "set -u", + `f="$TMPDIR/${MIC_TAG}-$$.ogg"`, + "termux-microphone-record -q >/dev/null 2>&1", + `pkill -f '^${MIC_TAG}' 2>/dev/null`, + 'rm -f "$f"', + 'termux-microphone-record -f "$f" -e opus -l 0 >/dev/null 2>&1 || { echo "termux-microphone-record failed (is Termux:API installed?)" >&2; exit 3; }', + 'for i in $(seq 60); do [ -s "$f" ] && break; sleep 0.1; done', + '[ -s "$f" ] || { echo "microphone produced no data (mic busy or permission denied)" >&2; termux-microphone-record -q >/dev/null 2>&1; exit 4; }', + // When the decoder ends (stop, or the ssh client went away and its next + // write failed), end the tail too, so the pipeline and this script exit. + `( exec -a ${MIC_TAG}-tail tail -c +1 -f "$f" ) | ( ( exec -a ${MIC_TAG} ffmpeg -hide_banner -loglevel error -f ogg -i - -f s16le -ar ${rate} -ac 1 - ); pkill -f '^${MIC_TAG}-tail' )`, + // Always leave the phone clean: recorder off, temp file gone. + "termux-microphone-record -q >/dev/null 2>&1", + 'rm -f "$f"', + ].join("\n"); +} + +export function micConfigFor(d: DeviceConfig, ctx: CommandContext): MicConfig { + const rate = ctx.sampleRate; + if (d.kind === "local") return { kind: "local", sampleRate: rate, label: d.label }; + const dest = d.ssh ?? d.id; + if (d.kind === "linux") { + return { + kind: "remote", + sampleRate: rate, + label: d.label, + command: sshArgv( + ctx, + dest, + // pw-cat/pacat pick their mode from argv0, which `exec -a` replaces: + // the mode flag must be explicit. --raw: without it pw-cat writes a + // Sun AU container (big-endian samples) to stdout. + `${LINUX_ENV} exec -a ${MIC_TAG} pw-cat --record --raw --rate ${rate} --channels 1 --format s16 -`, + ), + killCommand: sshArgv(ctx, dest, `pkill -f '^${MIC_TAG}' ; true`), + // SIGINT makes pw-record flush and exit. + stopCommand: sshArgv(ctx, dest, `pkill -INT -f '^${MIC_TAG}' ; true`), + unreachableHint: `${d.label} not reachable over ssh: check Tailscale and that the machine is awake`, + }; + } + return { + kind: "remote", + sampleRate: rate, + label: d.label, + command: sshArgv(ctx, dest, termuxCaptureScript(rate)), + killCommand: sshArgv( + ctx, + dest, + `termux-microphone-record -q >/dev/null 2>&1; pkill -f '^${MIC_TAG}' ; true`, + ), + // Stop the recorder (finalizes the file), let the decoder drain the + // ~1 s the stream lags behind, then end the input so ffmpeg exits. + stopCommand: sshArgv( + ctx, + dest, + `termux-microphone-record -q >/dev/null 2>&1; sleep 1.5; pkill -f '^${MIC_TAG}-tail' ; true`, + ), + usbAutoForward: d.adbForwardPort !== undefined, + zeroHint: + "Android blocks the mic for background apps: open Termux on the phone and keep it on screen while you speak", + unreachableHint: `${d.label} not reachable: open Termux on the phone and run sshd${ + d.adbForwardPort !== undefined ? " (USB: check the cable / adb)" : "" + }`, + }; +} + +export function playerOutputFor(d: DeviceConfig, ctx: CommandContext): PlayerOutput { + if (d.kind === "local") return { kind: "local" }; + const dest = d.ssh ?? d.id; + const rate = ctx.sampleRate; + // Anchored: only processes started under the tag (not this shell's own cmdline). + const kill = sshArgv(ctx, dest, `pkill -f '^${PLAY_TAG}' ; true`); + if (d.kind === "linux") { + return { + kind: "remote", + rate, + kill, + command: sshArgv( + ctx, + dest, + `${LINUX_ENV} exec -a ${PLAY_TAG} pacat --playback --raw --format=s16le --rate=${rate} --channels=1 --latency-msec=100`, + ), + }; + } + return { + kind: "remote", + rate, + kill, + command: sshArgv( + ctx, + dest, + `exec -a ${PLAY_TAG} play -q -t raw -r ${rate} -c 1 -b 16 -e signed-integer -`, + ), + }; +} + +// ------------------------------------------------------------- presence + +/** Result of one presence probe: seconds since last human input, or offline. */ +export type Presence = + | { readonly online: true; readonly idleSec: number; readonly caps?: AudioCaps } + | { readonly online: false }; + +/** macOS `ioreg -c IOHIDSystem` → seconds since the last keyboard/mouse event. */ +export function parseMacIdle(ioreg: string): number | null { + const m = /"HIDIdleTime"\s*=\s*(\d+)/.exec(ioreg); + return m ? Number(m[1]) / 1e9 : null; +} + +/** + * Android `dumpsys power` → seconds since the user last touched the screen, + * or Infinity when the screen is off (nobody is using it). + */ +export function parseAndroidIdle(dumpsys: string): number | null { + const wake = /mWakefulness=(\w+)/.exec(dumpsys)?.[1]; + if (!wake) return null; + if (wake !== "Awake") return Number.POSITIVE_INFINITY; + // Android silences the mic of background apps: the phone only counts as + // "in use for voice" while Termux is on screen. + const focus = /mCurrentFocus=Window\{[^}]*\}/.exec(dumpsys)?.[0]; + if (focus !== undefined && !/com\.termux/.test(focus)) return Number.POSITIVE_INFINITY; + const ago = /mLastInteractivePowerHintTime=\d+ \((\d+) ms ago\)/.exec(dumpsys)?.[1]; + const wakeAgo = /mLastWakeTime=\d+ \((\d+) ms ago\)/.exec(dumpsys)?.[1]; + const ms = Math.min( + ago !== undefined ? Number(ago) : Number.POSITIVE_INFINITY, + wakeAgo !== undefined ? Number(wakeAgo) : Number.POSITIVE_INFINITY, + ); + return ms / 1000; +} + +/** Sum of keyboard/mouse/touchpad interrupt counts from /proc/interrupts. */ +export function inputInterruptCount(procInterrupts: string): number | null { + let total = 0; + let found = false; + for (const line of procInterrupts.split("\n")) { + if (!/i8042|hid|elan|syna|touchpad|keyboard|mouse/i.test(line)) continue; + if (/xhci|ehci|uhci|nvme|ahci/i.test(line)) continue; + const cols = line.trim().split(/\s+/).slice(1); + for (const c of cols) { + if (!/^\d+$/.test(c)) break; + total += Number(c); + found = true; + } + } + return found ? total : null; +} + +export const LINUX_PRESENCE_SCRIPT = [ + LINUX_ENV, + "cat /proc/interrupts;", + 'echo "@@audio src=$(pactl get-default-source 2>/dev/null) sink=$(pactl get-default-sink 2>/dev/null) inputs=$(pactl list short sources 2>/dev/null | grep -vc monitor)"', +].join(" "); + +export interface AudioCaps { + readonly mic: boolean; + readonly speaker: boolean; +} + +/** Parse the "@@audio" line of LINUX_PRESENCE_SCRIPT. */ +export function parseLinuxAudio(out: string): AudioCaps { + const line = out.split("\n").find((l) => l.startsWith("@@audio")) ?? ""; + const src = /src=(\S*)/.exec(line)?.[1] ?? ""; + const sink = /sink=(\S*)/.exec(line)?.[1] ?? ""; + const inputs = Number(/inputs=(\d+)/.exec(line)?.[1] ?? "0"); + return { + mic: inputs > 0 && src !== "" && !src.startsWith("@") && !/auto_null/.test(src), + speaker: sink !== "" && !sink.startsWith("@") && !/auto_null/.test(sink), + }; +} +export const MAC_PRESENCE_ARGV = ["ioreg", "-c", "IOHIDSystem", "-d", "4"]; +export const ANDROID_PRESENCE_SCRIPT = + "dumpsys power | grep -E 'mWakefulness=|mLastInteractivePowerHintTime=|mLastWakeTime='; dumpsys window | grep mCurrentFocus; pidof sshd >/dev/null && echo sshd=up || echo sshd=down"; + +/** Termux sshd state from ANDROID_PRESENCE_SCRIPT output; null when not reported. */ +export function parseAndroidSshd(out: string): boolean | null { + const m = /^sshd=(up|down)$/m.exec(out); + return m ? m[1] === "up" : null; +} + +/** True when `adb forward --list` already maps tcp:P to tcp:P. */ +export function hasAdbForward(list: string, port: number): boolean { + return list.split("\n").some((l) => l.trim().endsWith(`tcp:${port} tcp:${port}`)); +} diff --git a/src/node/hub.ts b/src/node/hub.ts new file mode 100644 index 0000000..c62f931 --- /dev/null +++ b/src/node/hub.ts @@ -0,0 +1,433 @@ +// Voice node core (runs on the engine host). Knows every audio device, keeps +// track of which one a human is using right now ("home"), and serves: +// - one microphone session at a time from the home device, +// - one shared player that speaks on the home device, +// - transcription (whisper) and speech synthesis (VieNeu / Piper). +// Network transport lives in server.ts; this file has no sockets. +import type { + Logger, + MicConfig, + MicStream, + Player, + PlayerOutput, + SpeechSegment, + Synth, + Transcriber, +} from "../types.ts"; +import { errorMessage } from "../types.ts"; +import { + ANDROID_PRESENCE_SCRIPT, + hasAdbForward, + parseAndroidSshd, + LINUX_PRESENCE_SCRIPT, + MAC_PRESENCE_ARGV, + inputInterruptCount, + micConfigFor, + parseAndroidIdle, + parseLinuxAudio, + parseMacIdle, + playerOutputFor, + sshArgv, + type CommandContext, + type DeviceConfig, + type Presence, +} from "./devices.ts"; + +export interface RunResult { + readonly code: number | null; + readonly stdout: string; + readonly stderr: string; +} +export type RunFn = (cmd: string, args: readonly string[], timeoutMs: number) => Promise; + +export interface DeviceStatus { + readonly id: string; + readonly label: string; + readonly kind: DeviceConfig["kind"]; + readonly online: boolean; + /** Seconds since last human input; null when unknown. */ + readonly idleSec: number | null; + /** Has a working microphone / speaker (false = never chosen as home). */ + readonly mic: boolean; + readonly speaker: boolean; +} + +export interface HubDeps { + readonly devices: readonly DeviceConfig[]; + readonly ctx: CommandContext; + readonly run: RunFn; + readonly openMic: (cfg: MicConfig) => Promise; + readonly createPlayer: (getOutput: () => PlayerOutput) => Player; + readonly transcriber: (model: string | null) => Transcriber; + readonly synth: (name: "vieneu" | "piper") => Synth; + /** VieNeu voice for the next request (set inside the VieNeu queue). */ + readonly setVieneuVoice?: (voice: string) => void; + /** Load/save the pinned home across restarts. */ + readonly loadPin?: () => string | null; + readonly savePin?: (id: string | null) => void; + readonly now?: () => number; + readonly logger?: Logger; +} + +export interface MicLease { + readonly mic: MicStream; + readonly device: DeviceStatus; +} + +export class HubError extends Error { + constructor( + message: string, + readonly code: "BUSY" | "NO_DEVICE" | "MIC" | "BAD_REQUEST", + readonly hint?: string, + ) { + super(message); + this.name = "HubError"; + } +} + +export interface Hub { + /** Poll every device once (also runs on a timer via start()). */ + refresh(): Promise; + start(intervalMs?: number): void; + devices(): DeviceStatus[]; + /** The device a human is using right now (pinned wins). */ + home(): DeviceStatus; + pinned(): string | null; + pin(id: string | null): void; + /** Open the home microphone. One session at a time. */ + openMic(owner: string): Promise; + micOwner(): string | null; + readonly player: Player; + /** Device the player last spoke on. */ + playerDevice(): string | null; + transcribe( + wav: Buffer, + opts: { + language: "auto" | "vi" | "en"; + model: string | null; + prompt?: string; + signal?: AbortSignal; + }, + ): Promise; + synthesize( + engine: "vieneu" | "piper", + seg: SpeechSegment, + signal?: AbortSignal, + voice?: string, + ): Promise; + warm(what: "stt" | "tts", model?: string | null): void; + dispose(): Promise; +} + +const PRESENCE_TIMEOUT_MS = 4000; +/** + * A device that keeps failing is probed less often: every failed ssh login + * counts against the box's sshd (OpenSSH PerSourcePenalties), and probing a + * misconfigured host every 3 s would lock this machine out of it entirely. + */ +const PROBE_BACKOFF_BASE_MS = 3000; +const PROBE_BACKOFF_MAX_MS = 5 * 60_000; + +export function createHub(deps: HubDeps): Hub { + const now = deps.now ?? (() => Date.now()); + const log = (m: string, level: "debug" | "info" | "warn" = "debug"): void => + deps.logger?.log("node", m, level); + if (deps.devices.length === 0) throw new Error("voice node: no audio devices configured"); + const status = new Map(); + /** Linux: interrupt counter + when it last changed. */ + const counters = new Map(); + let pinnedId: string | null = deps.loadPin?.() ?? null; + let micOwnerName: string | null = null; + let timer: ReturnType | null = null; + let refreshing: Promise | null = null; + /** Per device: consecutive failed probes and when to probe again. */ + const backoff = new Map(); + let playDevice: DeviceConfig = deps.devices[0] as DeviceConfig; + + /** Last state per device + check, so transitions are logged once. */ + const notes = new Map(); + function note(id: string, what: string, ok: boolean, downMsg: string): void { + const key = `${id}:${what}`; + const prev = notes.get(key); + notes.set(key, ok); + if (prev === ok) return; + if (!ok) log(`${id}: ${downMsg}`, "warn"); + else if (prev === false) log(`${id}: ${what} ok again`, "info"); + } + + /** + * The USB forward to the phone's sshd vanishes when the cable is replugged + * or the adb server restarts; ssh then gets "connection refused". Restore it. + */ + async function keepAdbForward(d: DeviceConfig, serial: string[]): Promise { + const port = d.adbForwardPort as number; + const list = await deps.run("adb", [...serial, "forward", "--list"], PRESENCE_TIMEOUT_MS); + if (list.code === 0 && hasAdbForward(list.stdout, port)) { + note(d.id, "adb forward", true, ""); + return true; + } + const spec = `tcp:${port}`; + const r = await deps.run("adb", [...serial, "forward", spec, spec], PRESENCE_TIMEOUT_MS); + const ok = r.code === 0; + if (ok) log(`${d.id}: restored adb forward ${spec}`, "info"); + note( + d.id, + "adb forward", + ok, + `adb forward ${spec} failed: ${r.stderr.trim() || `exit ${r.code}`}`, + ); + return ok; + } + + async function probe(d: DeviceConfig): Promise { + try { + if (d.kind === "local") { + const r = await deps.run( + MAC_PRESENCE_ARGV[0] as string, + MAC_PRESENCE_ARGV.slice(1), + PRESENCE_TIMEOUT_MS, + ); + const idle = r.code === 0 ? parseMacIdle(r.stdout) : null; + return { online: true, idleSec: idle ?? Number.POSITIVE_INFINITY }; + } + if (d.kind === "termux") { + // Presence through adb (USB): screen, focus, and whether sshd runs. + const serial = d.adb && d.adb !== "auto" ? ["-s", d.adb] : []; + const r = await deps.run( + "adb", + [...serial, "shell", ANDROID_PRESENCE_SCRIPT], + PRESENCE_TIMEOUT_MS, + ); + const idle = r.code === 0 ? parseAndroidIdle(r.stdout) : null; + if (idle === null) return { online: false }; + let ok = parseAndroidSshd(r.stdout) !== false; + note(d.id, "sshd", ok, "Termux sshd not running — skipping the phone until it runs"); + if (ok && d.adbForwardPort !== undefined) ok = await keepAdbForward(d, serial); + return { online: true, idleSec: idle, caps: { mic: ok, speaker: ok } }; + } + const [cmd, ...args] = sshArgv(deps.ctx, d.ssh ?? d.id, LINUX_PRESENCE_SCRIPT); + const r = await deps.run(cmd as string, args, PRESENCE_TIMEOUT_MS); + if (r.code !== 0) { + const why = r.stderr.trim().split("\n").pop() ?? ""; + log(`presence ${d.id}: ssh exit ${r.code}${why ? `: ${why}` : ""}`); + return { online: false }; + } + const caps = parseLinuxAudio(r.stdout); + const count = inputInterruptCount(r.stdout); + const t = now(); + const prev = counters.get(d.id); + if (count === null) return { online: true, idleSec: Number.POSITIVE_INFINITY, caps }; + if (!prev) { + // First sample: no change seen yet. + counters.set(d.id, { count, changedAt: Number.NEGATIVE_INFINITY }); + } else if (count !== prev.count) { + counters.set(d.id, { count, changedAt: t }); + } + const changedAt = counters.get(d.id)?.changedAt ?? Number.NEGATIVE_INFINITY; + return { + online: true, + idleSec: Number.isFinite(changedAt) ? (t - changedAt) / 1000 : Number.POSITIVE_INFINITY, + caps, + }; + } catch (err) { + log(`presence ${d.id} failed: ${errorMessage(err)}`, "warn"); + return { online: false }; + } + } + + function statusOf(d: DeviceConfig): DeviceStatus { + const p = status.get(d.id); + // Unknown yet: assume the local machine is online (it is where the node runs). + const online = p ? p.online : d.kind === "local"; + const idle = + p && p.online && Number.isFinite(p.idleSec) ? Math.round(p.idleSec * 10) / 10 : null; + const caps = p && p.online ? p.caps : undefined; + return { + id: d.id, + label: d.label, + kind: d.kind, + online, + idleSec: idle, + mic: caps ? caps.mic : true, + speaker: caps ? caps.speaker : true, + }; + } + + /** Online and able to both listen and speak. */ + function usable(d: DeviceConfig): boolean { + const st = statusOf(d); + return st.online && st.mic && st.speaker; + } + + function homeDevice(): DeviceConfig { + const online = deps.devices.filter(usable); + if (pinnedId) { + const p = online.find((d) => d.id === pinnedId); + if (p) return p; + } + let best: DeviceConfig | null = null; + let bestIdle = Number.POSITIVE_INFINITY; + for (const d of online) { + const p = status.get(d.id); + const idle = p && p.online ? p.idleSec : Number.POSITIVE_INFINITY; + if (idle < bestIdle) { + best = d; + bestIdle = idle; + } + } + return ( + best ?? + online.find((d) => d.kind === "local") ?? + online[0] ?? + (deps.devices[0] as DeviceConfig) + ); + } + + const player = deps.createPlayer(() => playerOutputFor(playDevice, deps.ctx)); + // Pick the speaker when a clip starts (not mid-clip). + const rawPlay = player.play.bind(player); + player.play = (wav: Buffer) => { + const d = homeDevice(); + if (d.id !== playDevice.id) log(`speaker → ${d.id}`, "info"); + playDevice = d; + return rawPlay(wav); + }; + + let vieneuQueue: Promise = Promise.resolve(); + + const hub: Hub = { + async refresh() { + if (refreshing) return refreshing; + refreshing = (async () => { + const t = now(); + const due = deps.devices.filter((d) => (backoff.get(d.id)?.nextAt ?? 0) <= t); + const results = await Promise.all(due.map(async (d) => [d, await probe(d)] as const)); + for (const [d, p] of results) { + status.set(d.id, p); + const prev = backoff.get(d.id); + if (p.online || d.kind === "local") { + if (prev) log(`${d.id}: online again`, "info"); + backoff.delete(d.id); + continue; + } + const failures = (prev?.failures ?? 0) + 1; + const wait = Math.min(PROBE_BACKOFF_MAX_MS, PROBE_BACKOFF_BASE_MS * 2 ** (failures - 1)); + backoff.set(d.id, { failures, nextAt: now() + wait }); + if (failures === 1 || wait === PROBE_BACKOFF_MAX_MS) + log( + `${d.id}: offline (probe failed ${failures}x), next probe in ${Math.round(wait / 1000)}s`, + failures === 1 ? "info" : "debug", + ); + } + })().finally(() => { + refreshing = null; + }); + return refreshing; + }, + start(intervalMs = 3000) { + if (timer) return; + void hub.refresh(); + timer = setInterval(() => void hub.refresh(), intervalMs); + timer.unref?.(); + }, + devices: () => deps.devices.map(statusOf), + home: () => statusOf(homeDevice()), + pinned: () => pinnedId, + pin(id) { + const dev = id === null ? null : deps.devices.find((d) => d.id === id); + if (id !== null && !dev) throw new HubError(`Unknown device "${id}"`, "BAD_REQUEST"); + if (dev && !usable(dev)) { + const st = statusOf(dev); + throw new HubError( + st.online + ? `${dev.label} has no working microphone or speaker` + : `${dev.label} is offline`, + "NO_DEVICE", + ); + } + pinnedId = id; + deps.savePin?.(id); + log(`home pinned → ${id ?? "auto"}`, "info"); + }, + async openMic(owner) { + if (micOwnerName) { + throw new HubError( + `Microphone is in use by ${micOwnerName}`, + "BUSY", + "Finish or cancel that dictation first", + ); + } + micOwnerName = owner; + const d = homeDevice(); + try { + const mic = await deps.openMic(micConfigFor(d, deps.ctx)); + let released = false; + const release = (): void => { + if (released) return; + released = true; + if (micOwnerName === owner) micOwnerName = null; + }; + mic.onError(() => release()); + const lease: MicStream = { + format: mic.format, + get paused() { + return mic.paused; + }, + onData: (cb) => mic.onData(cb), + onError: (cb) => mic.onError(cb), + pause: () => mic.pause(), + resume: () => mic.resume(), + // Release the lock whenever the session ends, however it ends. + stop: () => mic.stop().finally(release), + kill: () => { + mic.kill(); + release(); + }, + }; + log(`mic open device=${d.id} owner=${owner}`, "info"); + return { mic: lease, device: statusOf(d) }; + } catch (err) { + if (micOwnerName === owner) micOwnerName = null; + const e = err as { message?: string; hint?: string }; + throw new HubError(e.message ?? errorMessage(err), "MIC", e.hint); + } + }, + micOwner: () => micOwnerName, + player, + playerDevice: () => playDevice.id, + transcribe(wav, opts) { + return deps.transcriber(opts.model).transcribe(wav, { + language: opts.language, + ...(opts.prompt ? { prompt: opts.prompt } : {}), + ...(opts.signal ? { signal: opts.signal } : {}), + }); + }, + synthesize(engine, seg, signal, voice) { + const s = deps.synth(engine); + if (engine === "piper") return s.synthesize(seg, signal); + // VieNeu serves one stream at a time: queue requests from all clients, + // each with its own voice. + const run = (): Promise => { + if (voice) deps.setVieneuVoice?.(voice); + return s.synthesize(seg, signal); + }; + const job = vieneuQueue.then(run, run); + vieneuQueue = job.catch(() => {}); + return job; + }, + warm(what, model) { + if (what === "stt") + void deps + .transcriber(model ?? null) + .warm() + .catch(() => {}); + else deps.synth("vieneu").warm(); + }, + async dispose() { + if (timer) clearInterval(timer); + timer = null; + player.dispose(); + }, + }; + return hub; +} diff --git a/src/node/main.ts b/src/node/main.ts new file mode 100644 index 0000000..6ed5493 --- /dev/null +++ b/src/node/main.ts @@ -0,0 +1,168 @@ +// Voice node daemon: `bun src/node/main.ts` +// Runs on the engine host (the strongest machine). Started on demand by the +// plugin there; keeps running after OpenCode exits so other machines can use it. +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { openMic } from "../audio/mic.ts"; +import { createPlayer } from "../audio/player.ts"; +import { defaultRun } from "../audio/usb.ts"; +import { createFileLogger } from "../log.ts"; +import { + createWhisperTranscriber, + defaultWhisperModel, + findWhisperModels, +} from "../stt/whisper.ts"; +import { createPiperSynth, defaultPiperVoice } from "../tts/piper.ts"; +import { createVieneuSynth } from "../tts/vieneu.ts"; +import type { Synth, Transcriber } from "../types.ts"; +import { errorMessage } from "../types.ts"; +import { configDir, loadNodeConfig, stateDir } from "./config.ts"; +import { createHub } from "./hub.ts"; +import { PROTOCOL, startServer } from "./server.ts"; + +const VERSION = "1"; + +async function tailnet(): Promise<{ ip: string | null; login: string | null }> { + const r = await defaultRun("tailscale", ["status", "--json"], 5000); + if (r.code !== 0) return { ip: null, login: null }; + try { + const s = JSON.parse(r.stdout) as { + Self?: { TailscaleIPs?: string[]; UserID?: number }; + User?: Record; + }; + const ip = s.Self?.TailscaleIPs?.find((x) => x.includes(".")) ?? null; + const login = + s.Self?.UserID !== undefined ? (s.User?.[String(s.Self.UserID)]?.LoginName ?? null) : null; + return { ip, login }; + } catch { + return { ip: null, login: null }; + } +} + +export async function main(): Promise { + const logger = createFileLogger(path.join(stateDir(), "node.log")); + const cfg = loadNodeConfig(); + fs.mkdirSync(stateDir(), { recursive: true, mode: 0o700 }); + const pinFile = path.join(stateDir(), "node-pin.json"); + + const transcribers = new Map(); + const models = (): string[] => findWhisperModels(); + const transcriber = (model: string | null): Transcriber => { + const available = models(); + const pick = + (model && available.includes(model) ? model : null) ?? + cfg.whisperModel ?? + defaultWhisperModel(); + if (!pick) + throw new Error( + "No whisper model on the voice node — download one to ~/.local/share/whisper-cpp", + ); + let t = transcribers.get(pick); + if (!t) { + t = createWhisperTranscriber({ modelPath: pick, logger }); + transcribers.set(pick, t); + } + return t; + }; + + let vieneuVoice = cfg.vieneuVoice; + const synths = new Map(); + const synth = (name: "vieneu" | "piper"): Synth => { + let s = synths.get(name); + if (!s) { + s = + name === "vieneu" + ? createVieneuSynth({ python: cfg.vieneuPython, voice: () => vieneuVoice, logger }) + : createPiperSynth({ voiceFor: (lang) => defaultPiperVoice(lang), logger }); + synths.set(name, s); + } + return s; + }; + + const hub = createHub({ + devices: cfg.devices, + ctx: { sshConfig: cfg.sshConfig, sampleRate: cfg.sampleRate }, + run: defaultRun, + openMic: (mc) => openMic(mc, { logger }), + createPlayer: (getOutput) => createPlayer(getOutput, { logger }), + transcriber, + synth, + setVieneuVoice: (v) => { + vieneuVoice = v; + }, + loadPin: () => { + try { + const v = (JSON.parse(fs.readFileSync(pinFile, "utf8")) as { id?: unknown }).id; + return typeof v === "string" ? v : null; + } catch { + return null; + } + }, + savePin: (id) => fs.writeFileSync(pinFile, JSON.stringify({ id }), { mode: 0o600 }), + logger, + }); + hub.start(3000); + + const net = await tailnet(); + const whoisCache = new Map(); + const authorize = async (ip: string): Promise => { + if (!net.login) return false; + const hit = whoisCache.get(ip); + if (hit && Date.now() - hit.at < 10 * 60_000) return hit.ok; + const r = await defaultRun("tailscale", ["whois", "--json", ip], 4000); + let ok = false; + try { + const w = JSON.parse(r.stdout) as { UserProfile?: { LoginName?: string } }; + ok = w.UserProfile?.LoginName === net.login; + } catch {} + whoisCache.set(ip, { ok, at: Date.now() }); + logger.log("node", `whois ${ip} → ${ok ? "allowed" : "denied"}`, ok ? "debug" : "warn"); + return ok; + }; + + const hostnames = ["127.0.0.1", ...(net.ip ? [net.ip] : [])]; + const server = startServer({ + hub, + hostnames, + port: cfg.port, + authorize, + logger, + info: () => ({ + version: VERSION, + protocol: PROTOCOL, + host: os.hostname().split(".")[0], + pid: process.pid, + devices: hub.devices(), + home: hub.home(), + pinned: hub.pinned(), + micOwner: hub.micOwner(), + models: models(), + defaultModel: cfg.whisperModel ?? defaultWhisperModel(), + engines: { stt: "whisper", tts: ["vieneu", "piper"] }, + }), + }); + fs.writeFileSync(path.join(stateDir(), "node.pid"), String(process.pid), { mode: 0o600 }); + logger.log( + "node", + `started pid=${process.pid} config=${configDir()} devices=${cfg.devices.map((d) => d.id).join(",")}`, + "info", + ); + + const shutdown = async (): Promise => { + server.stop(); + await hub.dispose(); + await Promise.all([...transcribers.values()].map((t) => t.dispose().catch(() => {}))); + await Promise.all([...synths.values()].map((s) => s.dispose().catch(() => {}))); + process.exit(0); + }; + process.on("SIGTERM", () => void shutdown()); + process.on("SIGINT", () => void shutdown()); +} + +if (import.meta.main) { + main().catch((err: unknown) => { + process.stderr.write(`voice node failed: ${errorMessage(err)}\n`); + process.exit(1); + }); +} diff --git a/src/node/node.test.ts b/src/node/node.test.ts new file mode 100644 index 0000000..3d42c5e --- /dev/null +++ b/src/node/node.test.ts @@ -0,0 +1,454 @@ +import { describe, expect, test } from "bun:test"; +import { fakeMic, fakePlayer } from "../testing/fakes.ts"; +import type { MicConfig, PlayerOutput } from "../types.ts"; +import { parseNodeConfig } from "./config.ts"; +import { + inputInterruptCount, + micConfigFor, + parseAndroidIdle, + parseLinuxAudio, + parseMacIdle, + playerOutputFor, + sshArgv, + termuxCaptureScript, + type DeviceConfig, +} from "./devices.ts"; +import { createHub, HubError, type RunResult } from "./hub.ts"; +import { isLoopback, isTailnetIp } from "./server.ts"; +import { tailnetCandidates } from "./client.ts"; + +const CTX = { sshConfig: "/cfg/ssh_config", sampleRate: 16000 }; +const MAC: DeviceConfig = { id: "mac", label: "Mac", kind: "local" }; +const PHONE: DeviceConfig = { + id: "phone", + label: "Phone", + kind: "termux", + ssh: "phone-usb", + adb: "S1", + adbForwardPort: 8022, +}; +const BOX: DeviceConfig = { id: "box", label: "box", kind: "linux", ssh: "box" }; +const DEAF: DeviceConfig = { id: "deaf", label: "deaf", kind: "linux", ssh: "deaf" }; + +describe("device commands", () => { + test("ssh argv runs the script with bash whatever the login shell", () => { + const a = sshArgv(CTX, "box", "echo 'hi'"); + expect(a.slice(0, 5)).toEqual(["ssh", "-F", "/cfg/ssh_config", "-T", "box"]); + expect(a[5]).toBe(`bash -c 'echo '\\''hi'\\'''`); + }); + + test("linux mic uses tagged pw-record, graceful SIGINT stop and exact kill", () => { + const m = micConfigFor(BOX, CTX); + expect(m.kind).toBe("remote"); + expect(m.label).toBe("box"); + expect(m.command?.join(" ")).toContain( + "exec -a ocv-mic pw-cat --record --raw --rate 16000 --channels 1 --format s16 -", + ); + expect(m.stopCommand?.join(" ")).toContain("pkill -INT -f '\\''^ocv-mic'\\''"); + expect(m.killCommand?.join(" ")).toContain("pkill -f '\\''^ocv-mic'\\''"); + expect(m.unreachableHint).toContain("Tailscale"); + }); + + test("termux mic streams the live Opus recording and always cleans up", () => { + const m = micConfigFor(PHONE, CTX); + expect(m.usbAutoForward).toBe(true); + const script = termuxCaptureScript(16000); + expect(script).toContain('termux-microphone-record -f "$f" -e opus -l 0'); + expect(script).toContain("exec -a ocv-mic-tail tail -c +1 -f"); + expect(script).toContain("-f s16le -ar 16000 -ac 1 -"); + expect(script.trim().split("\n").at(-1)).toBe('rm -f "$f"'); + expect(m.stopCommand?.join(" ")).toContain("termux-microphone-record -q"); + }); + + test("player outputs carry rate and an exact kill", () => { + const box = playerOutputFor(BOX, CTX) as Extract; + expect(box.rate).toBe(16000); + expect(box.command.join(" ")).toContain( + "exec -a ocv-play pacat --playback --raw --format=s16le --rate=16000 --channels=1", + ); + expect(box.kill?.join(" ")).toContain("^ocv-play"); + const ph = playerOutputFor(PHONE, CTX) as Extract; + expect(ph.command.join(" ")).toContain("exec -a ocv-play play -q -t raw -r 16000"); + expect(playerOutputFor(MAC, CTX)).toEqual({ kind: "local" }); + }); +}); + +describe("presence parsers", () => { + test("mac HIDIdleTime is nanoseconds", () => { + expect(parseMacIdle(' | "HIDIdleTime" = 2500000000\n')).toBe(2.5); + expect(parseMacIdle("nothing")).toBeNull(); + }); + + test("android: awake uses the last touch, screen off is never home", () => { + const awake = + "mWakefulness=Awake\n mLastWakeTime=1 (900000 ms ago)\n mLastInteractivePowerHintTime=2 (4000 ms ago)\n"; + expect(parseAndroidIdle(awake)).toBe(4); + expect(parseAndroidIdle("mWakefulness=Asleep\n")).toBe(Number.POSITIVE_INFINITY); + // Using another app on the phone: its mic is blocked for Termux, so it is not "home". + expect( + parseAndroidIdle(`${awake} mCurrentFocus=Window{2 u0 com.binance.dev/x.Activity}\n`), + ).toBe(Number.POSITIVE_INFINITY); + expect( + parseAndroidIdle( + `${awake} mCurrentFocus=Window{27 u0 com.termux/com.termux.app.TermuxActivity}\n`, + ), + ).toBe(4); + expect(parseAndroidIdle("")).toBeNull(); + }); + + test("linux input interrupts are summed across CPUs; storage controllers ignored", () => { + const irq = [ + " CPU0 CPU1", + " 1: 10 5 IO-APIC 1-edge i8042", + " 12: 100 20 IO-APIC 12-edge i8042", + " 16: 9999 9999 PCI-MSI xhci_hcd", + " 95: 3 0 IR-IO-APIC 95-fasteoi ELAN1203:00", + ].join("\n"); + expect(inputInterruptCount(irq)).toBe(138); + expect(inputInterruptCount(" 0: 5 IO-APIC timer")).toBeNull(); + }); + + test("linux audio caps: auto_null and missing default source mean no audio", () => { + expect(parseLinuxAudio("@@audio src=alsa_input.x sink=alsa_output.x inputs=1")).toEqual({ + mic: true, + speaker: true, + }); + expect(parseLinuxAudio("@@audio src=@DEFAULT_SOURCE@ sink=auto_null inputs=0")).toEqual({ + mic: false, + speaker: false, + }); + expect(parseLinuxAudio("no line")).toEqual({ mic: false, speaker: false }); + }); +}); + +/** Scriptable presence: per device, what the probe returns. */ +function hubHarness(devices: DeviceConfig[] = [MAC, PHONE, BOX, DEAF]) { + let t = 1_000_000; + const presence: Record RunResult> = { + mac: () => ({ code: 0, stdout: '"HIDIdleTime" = 30000000000', stderr: "" }), + phone: () => ({ code: 0, stdout: "mWakefulness=Asleep", stderr: "" }), + box: () => ({ code: 0, stdout: "1: 10 i8042\n@@audio src=a sink=b inputs=1", stderr: "" }), + deaf: () => ({ + code: 0, + stdout: "1: 10 i8042\n@@audio src=@DEFAULT_SOURCE@ sink=auto_null inputs=0", + stderr: "", + }), + }; + const adbCalls: string[] = []; + let forwards = ""; + const opened: MicConfig[] = []; + const mics: ReturnType[] = []; + let lastOutput: PlayerOutput | null = null; + const player = fakePlayer(); + let pinStore: string | null = null; + const hub = createHub({ + devices, + ctx: CTX, + run: async (cmd, args) => { + const joined = [cmd, ...args].join(" "); + if (cmd === "ioreg") return presence.mac?.() ?? { code: 1, stdout: "", stderr: "" }; + if (cmd === "adb" && args.includes("forward")) { + adbCalls.push(args.join(" ")); + if (args.includes("--list")) return { code: 0, stdout: forwards, stderr: "" }; + forwards = "S1 tcp:8022 tcp:8022\n"; + return { code: 0, stdout: "", stderr: "" }; + } + if (cmd === "adb") return presence.phone?.() ?? { code: 1, stdout: "", stderr: "" }; + for (const id of ["box", "deaf"]) + if (joined.includes(` ${id} `)) + return presence[id]?.() ?? { code: 255, stdout: "", stderr: "" }; + return { code: 1, stdout: "", stderr: "" }; + }, + openMic: async (cfg) => { + opened.push(cfg); + const m = fakeMic(); + mics.push(m); + return m; + }, + createPlayer: (getOutput) => { + const realPlay = player.play.bind(player); + player.play = (wav) => { + lastOutput = getOutput(); + return realPlay(wav); + }; + return player; + }, + transcriber: () => ({ + transcribe: async () => "hi", + warm: async () => {}, + describe: () => "t", + dispose: async () => {}, + }), + synth: () => ({ + name: "piper", + synthesize: async () => Buffer.from("x"), + supports: () => true, + warm() {}, + dispose: async () => {}, + }), + loadPin: () => pinStore, + savePin: (id) => void (pinStore = id), + now: () => t, + }); + return { + hub, + presence, + opened, + mics, + player, + lastOutput: () => lastOutput, + advance: (ms: number) => void (t += ms), + pinStore: () => pinStore, + adbCalls, + dropForward: () => void (forwards = ""), + }; +} + +describe("hub: follow me", () => { + test("the device touched last is home; a deaf box is never chosen", async () => { + const h = hubHarness(); + await h.hub.refresh(); // first linux sample: no change seen yet + expect(h.hub.home().id).toBe("mac"); // mac idle 30s, phone asleep + h.presence.phone = () => ({ + code: 0, + stdout: "mWakefulness=Awake\nmLastInteractivePowerHintTime=1 (2000 ms ago)", + stderr: "", + }); + await h.hub.refresh(); + expect(h.hub.home().id).toBe("phone"); + // Someone types on box: its interrupt counter moves. + h.advance(1000); + h.presence.box = () => ({ + code: 0, + stdout: "1: 99 i8042\n@@audio src=a sink=b inputs=1", + stderr: "", + }); + h.presence.deaf = () => ({ + code: 0, + stdout: "1: 999 i8042\n@@audio src=@x sink=auto_null inputs=0", + stderr: "", + }); + await h.hub.refresh(); + expect(h.hub.home().id).toBe("box"); + const deaf = h.hub.devices().find((d) => d.id === "deaf"); + expect(deaf).toMatchObject({ online: true, mic: false, speaker: false }); + }); + + test("phone without sshd is skipped; a lost USB forward is restored", async () => { + const h = hubHarness([MAC, PHONE]); + const awake = "mWakefulness=Awake\nmLastInteractivePowerHintTime=1 (2000 ms ago)\n"; + h.presence.phone = () => ({ code: 0, stdout: `${awake}sshd=down\n`, stderr: "" }); + await h.hub.refresh(); + // Touched most recently, but ssh would be refused: audio stays on the Mac. + expect(h.hub.home().id).toBe("mac"); + expect(h.hub.devices().find((d) => d.id === "phone")).toMatchObject({ + mic: false, + speaker: false, + }); + expect(h.adbCalls).toEqual([]); // no forward work while sshd is down + + h.presence.phone = () => ({ code: 0, stdout: `${awake}sshd=up\n`, stderr: "" }); + await h.hub.refresh(); // forward missing (cable replugged): restored + expect(h.adbCalls).toEqual(["-s S1 forward --list", "-s S1 forward tcp:8022 tcp:8022"]); + expect(h.hub.home().id).toBe("phone"); + + h.adbCalls.length = 0; + await h.hub.refresh(); // still there: only listed + expect(h.adbCalls).toEqual(["-s S1 forward --list"]); + + h.dropForward(); + h.adbCalls.length = 0; + await h.hub.refresh(); + expect(h.adbCalls.at(-1)).toBe("-s S1 forward tcp:8022 tcp:8022"); + }); + + test("a device that keeps failing is probed less and less often", async () => { + const h = hubHarness([MAC, BOX]); + let probes = 0; + h.presence.box = () => { + probes += 1; + return { code: 255, stdout: "", stderr: "Permission denied (publickey,password)." }; + }; + const tick = async (ms: number) => { + h.advance(ms); + await h.hub.refresh(); + }; + await h.hub.refresh(); // fail 1 → wait 3 s + await tick(1000); // not due + expect(probes).toBe(1); + await tick(2000); // fail 2 → wait 6 s + await tick(3000); // not due + expect(probes).toBe(2); + await tick(3000); // fail 3 → wait 12 s + expect(probes).toBe(3); + for (let i = 0; i < 400; i++) await tick(3000); // 20 min of 3 s ticks + // 3+6+12+...+192 s, then every 300 s: far from 400 probes. + expect(probes).toBeLessThan(12); + // Back online: probed every tick again. + h.presence.box = () => { + probes += 1; + return { code: 0, stdout: "1: 10 i8042\n@@audio src=a sink=b inputs=1", stderr: "" }; + }; + await tick(300_000); + const before = probes; + await tick(3000); + await tick(3000); + expect(probes).toBe(before + 2); + expect(h.hub.devices().find((d) => d.id === "box")?.online).toBe(true); + }); + + test("offline devices drop out; with nothing else the local machine stays home", async () => { + const h = hubHarness([MAC, BOX]); + h.presence.box = () => ({ code: 255, stdout: "", stderr: "" }); + h.presence.mac = () => ({ code: 0, stdout: '"HIDIdleTime" = 900000000000', stderr: "" }); + await h.hub.refresh(); + expect(h.hub.devices().find((d) => d.id === "box")?.online).toBe(false); + expect(h.hub.home().id).toBe("mac"); + }); + + test("pin wins over idle time, persists, and refuses unusable devices", async () => { + const h = hubHarness(); + await h.hub.refresh(); + h.hub.pin("box"); + expect(h.hub.home().id).toBe("box"); + expect(h.pinStore()).toBe("box"); + expect(() => h.hub.pin("deaf")).toThrow(HubError); + expect(() => h.hub.pin("nope")).toThrow("Unknown device"); + h.hub.pin(null); + expect(h.hub.home().id).toBe("mac"); + }); +}); + +describe("hub: shared mic and speaker", () => { + test("mic opens on home; one session at a time; lock released on stop, kill and error", async () => { + const h = hubHarness(); + await h.hub.refresh(); + h.hub.pin("box"); + const a = await h.hub.openMic("duy:opencode"); + expect(a.device.id).toBe("box"); + expect(h.opened[0]?.label).toBe("box"); + expect(h.hub.micOwner()).toBe("duy:opencode"); + await expect(h.hub.openMic("mac:opencode")).rejects.toThrow("in use by duy:opencode"); + await a.mic.stop(); + expect(h.hub.micOwner()).toBeNull(); + const b = await h.hub.openMic("mac:opencode"); + b.mic.kill(); + expect(h.hub.micOwner()).toBeNull(); + await h.hub.openMic("x"); + h.mics.at(-1)?.fail({ code: "EXITED", message: "gone" }); + expect(h.hub.micOwner()).toBeNull(); + }); + + test("mic open failure releases the lock and reports the hint", async () => { + const h = hubHarness(); + const failing = createHub({ + devices: [MAC], + ctx: CTX, + run: async () => ({ code: 0, stdout: "", stderr: "" }), + openMic: async () => { + throw Object.assign(new Error("Phone not reachable"), { hint: "run sshd" }); + }, + createPlayer: () => h.player, + transcriber: () => { + throw new Error("unused"); + }, + synth: () => { + throw new Error("unused"); + }, + }); + const err = await failing.openMic("a").catch((e: unknown) => e as HubError); + expect(err).toBeInstanceOf(HubError); + expect((err as HubError).hint).toBe("run sshd"); + expect(failing.micOwner()).toBeNull(); + }); + + test("the speaker follows home at the start of each clip", async () => { + const h = hubHarness(); + await h.hub.refresh(); + void h.hub.player.play(Buffer.from("a")); + expect(h.lastOutput()).toEqual({ kind: "local" }); + h.hub.pin("phone"); + void h.hub.player.play(Buffer.from("b")); + expect(h.lastOutput()?.kind).toBe("remote"); + expect(h.hub.playerDevice()).toBe("phone"); + }); + + test("VieNeu requests from several clients run one at a time, each with its voice", async () => { + const order: string[] = []; + let voice = ""; + let release: () => void = () => {}; + const gate = new Promise((r) => (release = r)); + const hub = createHub({ + devices: [MAC], + ctx: CTX, + run: async () => ({ code: 0, stdout: "", stderr: "" }), + openMic: async () => fakeMic(), + createPlayer: () => fakePlayer(), + transcriber: () => { + throw new Error("unused"); + }, + synth: () => ({ + name: "vieneu", + async synthesize(seg) { + order.push(`start ${seg.text} as ${voice}`); + if (seg.text === "one") await gate; + order.push(`end ${seg.text}`); + return Buffer.from(seg.text); + }, + supports: () => true, + warm() {}, + dispose: async () => {}, + }), + setVieneuVoice: (v) => void (voice = v), + }); + const p1 = hub.synthesize("vieneu", { lang: "vi", text: "one" }, undefined, "Mai Anh"); + const p2 = hub.synthesize("vieneu", { lang: "vi", text: "two" }, undefined, "Ngọc"); + await new Promise((r) => setImmediate(r)); + expect(order).toEqual(["start one as Mai Anh"]); + release(); + await Promise.all([p1, p2]); + expect(order).toEqual(["start one as Mai Anh", "end one", "start two as Ngọc", "end two"]); + }); +}); + +describe("network helpers", () => { + test("only loopback and Tailscale ranges pass the address check", () => { + expect(isLoopback("127.0.0.1")).toBe(true); + expect(isLoopback("::ffff:127.0.0.1")).toBe(true); + expect(isTailnetIp("100.67.7.5")).toBe(true); + expect(isTailnetIp("::ffff:100.85.35.10")).toBe(true); + expect(isTailnetIp("100.63.0.1")).toBe(false); // outside 100.64/10 + expect(isTailnetIp("192.168.1.6")).toBe(false); + expect(isTailnetIp("fd7a:115c:a1e0::1")).toBe(true); + }); + + test("tailnet candidates: online computers only", () => { + const status = JSON.stringify({ + Peer: { + a: { Online: true, OS: "macOS", TailscaleIPs: ["100.75.30.92", "fd7a::1"] }, + b: { Online: true, OS: "android", TailscaleIPs: ["100.107.124.2"] }, + c: { Online: false, OS: "linux", TailscaleIPs: ["100.108.47.10"] }, + d: { Online: true, OS: "linux", TailscaleIPs: ["100.67.7.5"] }, + }, + }); + expect(tailnetCandidates(status).sort()).toEqual(["100.67.7.5", "100.75.30.92"]); + expect(tailnetCandidates("not json")).toEqual([]); + }); + + test("node config: devices validated, local added, defaults", () => { + const c = parseNodeConfig( + { + devices: [ + { id: "phone", kind: "termux", ssh: "phone-usb", adbForwardPort: 8022 }, + { id: "phone", kind: "linux" }, // duplicate id + { id: "x", kind: "windows" }, // unsupported + ], + }, + "/cfg", + ); + expect(c.devices.map((d) => d.id)).toEqual(["local", "phone"]); + expect(c.port).toBe(47800); + expect(c.sshConfig).toBe("/cfg/ssh_config"); + expect(c.devices[1]).toMatchObject({ adbForwardPort: 8022, label: "phone" }); + }); +}); diff --git a/src/node/server.ts b/src/node/server.ts new file mode 100644 index 0000000..a6684fa --- /dev/null +++ b/src/node/server.ts @@ -0,0 +1,305 @@ +// HTTP + WebSocket front of the voice node (Bun.serve). +// +// GET /v1/info devices, home, engines, models +// POST /v1/home {id|null} pin the audio device (null = follow me) +// POST /v1/transcribe?lang&model&prompt body: WAV → {text} +// POST /v1/synth {engine,lang,text,voice} → audio/wav +// POST /v1/warm?what=stt|tts&model +// WS /v1/mic?client=name home mic as binary PCM frames +// WS /v1/player?client=name shared speaker on the home device +// +// Only loopback and same-owner Tailscale peers are accepted. +import type { Server, ServerWebSocket } from "bun"; +import type { Logger, PlayEnd, SpeechLang } from "../types.ts"; +import { SynthError, clampRate, errorMessage, isAbortError } from "../types.ts"; +import { HubError, type Hub, type MicLease } from "./hub.ts"; + +export const NODE_PORT = 47800; +export const PROTOCOL = 1; + +export interface ServerDeps { + readonly hub: Hub; + readonly hostnames: readonly string[]; + readonly port?: number; + /** Is this peer allowed? (loopback is always allowed) */ + readonly authorize: (ip: string) => Promise; + readonly info: () => Record; + readonly logger?: Logger; +} + +interface MicData { + kind: "mic"; + client: string; + lease: MicLease | null; + closed: boolean; +} +interface PlayerData { + kind: "player"; + client: string; + /** Next binary frame is the WAV for this play id. */ + awaiting: number | null; +} +type WsData = MicData | PlayerData; + +function json(body: unknown, status = 200): Response { + return new Response(JSON.stringify(body), { + status, + headers: { "content-type": "application/json" }, + }); +} + +export function isLoopback(ip: string): boolean { + return ip === "127.0.0.1" || ip === "::1" || ip === "::ffff:127.0.0.1"; +} + +/** 100.64.0.0/10 (CGNAT range Tailscale uses) or its fd7a:115c:a1e0::/48 IPv6. */ +export function isTailnetIp(ip: string): boolean { + const v4 = ip.replace(/^::ffff:/, ""); + const m = /^100\.(\d+)\.\d+\.\d+$/.exec(v4); + if (m) { + const b = Number(m[1]); + return b >= 64 && b <= 127; + } + return /^fd7a:115c:a1e0:/i.test(ip); +} + +export function startServer(deps: ServerDeps): { stop(): void; port: number } { + const { hub } = deps; + const port = deps.port ?? 47800; + const log = (m: string, level: "debug" | "info" | "warn" = "debug"): void => + deps.logger?.log("node", m, level); + const players = new Set>(); + + function playerState(): Record { + const p = hub.player; + return { + t: "state", + status: p.status(), + pos: Math.round(p.positionSec() * 1000) / 1000, + dur: Math.round(p.durationSec() * 1000) / 1000, + rate: p.rate(), + device: hub.playerDevice(), + }; + } + function broadcastState(): void { + const msg = JSON.stringify(playerState()); + for (const ws of players) ws.send(msg); + } + + async function handle(req: Request, server: Server): Promise { + const ip = server.requestIP(req)?.address ?? ""; + if (!isLoopback(ip) && !(isTailnetIp(ip) && (await deps.authorize(ip)))) { + log(`rejected ${ip}`, "warn"); + return json({ error: "forbidden" }, 403); + } + const url = new URL(req.url); + const client = (url.searchParams.get("client") ?? ip).slice(0, 60); + try { + switch (url.pathname) { + case "/v1/info": + return json({ protocol: PROTOCOL, ...deps.info() }); + case "/v1/home": { + if (req.method !== "POST") return json({ error: "POST only" }, 405); + const body = (await req.json()) as { id?: unknown }; + hub.pin(typeof body.id === "string" ? body.id : null); + return json({ home: hub.home(), pinned: hub.pinned() }); + } + case "/v1/transcribe": { + const wav = Buffer.from(await req.arrayBuffer()); + const lang = url.searchParams.get("lang"); + const text = await hub.transcribe(wav, { + language: lang === "vi" || lang === "en" ? lang : "auto", + model: url.searchParams.get("model"), + ...(url.searchParams.get("prompt") + ? { prompt: url.searchParams.get("prompt") as string } + : {}), + signal: req.signal, + }); + return json({ text }); + } + case "/v1/synth": { + const b = (await req.json()) as { + engine?: unknown; + lang?: unknown; + text?: unknown; + voice?: unknown; + }; + const engine = b.engine === "piper" ? "piper" : "vieneu"; + const lang: SpeechLang = b.lang === "en" ? "en" : "vi"; + if (typeof b.text !== "string" || !b.text.trim()) + return json({ code: "FAILED", message: "empty text" }, 400); + const wav = await hub.synthesize( + engine, + { lang, text: b.text }, + req.signal, + typeof b.voice === "string" ? b.voice : undefined, + ); + return new Response(new Uint8Array(wav), { headers: { "content-type": "audio/wav" } }); + } + case "/v1/warm": + hub.warm( + url.searchParams.get("what") === "tts" ? "tts" : "stt", + url.searchParams.get("model"), + ); + return json({ ok: true }); + case "/v1/mic": + if (server.upgrade(req, { data: { kind: "mic", client, lease: null, closed: false } })) + return undefined; + return json({ error: "websocket expected" }, 400); + case "/v1/player": + if (server.upgrade(req, { data: { kind: "player", client, awaiting: null } })) + return undefined; + return json({ error: "websocket expected" }, 400); + default: + return json({ error: "not found" }, 404); + } + } catch (err) { + if (err instanceof SynthError) { + return json( + { code: err.code, message: err.message }, + err.code === "UNAVAILABLE" ? 503 : 500, + ); + } + if (err instanceof HubError) { + return json({ code: err.code, message: err.message, hint: err.hint }, 409); + } + if (isAbortError(err)) return json({ code: "ABORTED", message: "aborted" }, 499); + log(`request ${url.pathname} failed: ${errorMessage(err)}`, "warn"); + return json({ code: "FAILED", message: errorMessage(err) }, 500); + } + } + + async function openMic(ws: ServerWebSocket): Promise { + try { + const lease = await hub.openMic(ws.data.client); + if (ws.data.closed) { + lease.mic.kill(); + return; + } + ws.data.lease = lease; + ws.send( + JSON.stringify({ t: "open", device: lease.device, rate: lease.mic.format.sampleRate }), + ); + lease.mic.onData((chunk) => { + if (!ws.data.closed) ws.send(chunk); + }); + lease.mic.onError((e) => { + if (ws.data.closed) return; + ws.send(JSON.stringify({ t: "error", code: e.code, message: e.message, hint: e.hint })); + }); + } catch (err) { + const e = err instanceof HubError ? err : new HubError(errorMessage(err), "MIC"); + ws.send(JSON.stringify({ t: "error", code: e.code, message: e.message, hint: e.hint })); + ws.close(1011, "mic failed"); + } + } + + function onPlayerMessage(ws: ServerWebSocket, msg: string | Buffer): void { + if (typeof msg !== "string") { + const id = ws.data.awaiting; + ws.data.awaiting = null; + if (id === null) return; + const wav = Buffer.from(msg); + hub.player.play(wav).then( + (end: PlayEnd) => { + ws.send(JSON.stringify({ t: "end", id, result: end })); + broadcastState(); + }, + (err: unknown) => { + ws.send(JSON.stringify({ t: "end", id, result: "error", message: errorMessage(err) })); + broadcastState(); + }, + ); + // Tagged with the play id: the client ignores states sent before this + // (they describe the previous clip). + ws.send(JSON.stringify({ t: "started", id, state: playerState() })); + broadcastState(); + return; + } + let op: { op?: unknown; id?: unknown; sec?: unknown; rate?: unknown }; + try { + op = JSON.parse(msg) as typeof op; + } catch { + return; + } + const p = hub.player; + let ok = true; + switch (op.op) { + case "play": + ws.data.awaiting = typeof op.id === "number" ? op.id : null; + return; + case "pause": + ok = p.pause(); + break; + case "resume": + ok = p.resume(); + break; + case "stop": + p.stop(); + break; + case "seek": + ok = typeof op.sec === "number" ? p.seek(op.sec) : false; + break; + case "rate": + if (typeof op.rate === "number") p.setRate(clampRate(op.rate)); + break; + case "state": + break; + default: + return; + } + ws.send(JSON.stringify({ t: "ack", op: op.op, ok, state: playerState() })); + broadcastState(); + } + + const handlers = { + fetch: handle, + websocket: { + open(ws: ServerWebSocket) { + if (ws.data.kind === "mic") void openMic(ws as ServerWebSocket); + else { + players.add(ws); + ws.send(JSON.stringify(playerState())); + } + }, + message(ws: ServerWebSocket, msg: string | Buffer) { + if (ws.data.kind === "player") { + onPlayerMessage(ws as ServerWebSocket, msg); + return; + } + const data = ws.data; + if (typeof msg !== "string" || !data.lease) return; + const lease = data.lease; + if (msg === '{"op":"pause"}') lease.mic.pause(); + else if (msg === '{"op":"resume"}') lease.mic.resume(); + else if (msg === '{"op":"stop"}') { + void lease.mic.stop().then(() => { + if (!data.closed) { + ws.send(JSON.stringify({ t: "end" })); + ws.close(1000, "stopped"); + } + }); + } + }, + close(ws: ServerWebSocket) { + if (ws.data.kind === "player") { + players.delete(ws); + return; + } + ws.data.closed = true; + ws.data.lease?.mic.kill(); + }, + }, + }; + + const servers = deps.hostnames.map((hostname) => + Bun.serve({ hostname, port, ...handlers, idleTimeout: 120 }), + ); + log(`listening on ${deps.hostnames.map((h) => `${h}:${port}`).join(", ")}`, "info"); + return { + port, + stop() { + for (const s of servers) s.stop(true); + }, + }; +} diff --git a/src/node/wire.test.ts b/src/node/wire.test.ts new file mode 100644 index 0000000..0da4756 --- /dev/null +++ b/src/node/wire.test.ts @@ -0,0 +1,263 @@ +// Real HTTP/WebSocket round trips: server.ts ↔ client.ts over loopback. +import { afterAll, beforeAll, describe, expect, test } from "bun:test"; +import { wrapPcm } from "../audio/wav.ts"; +import { fakeMic, fakePlayer, type FakeMic } from "../testing/fakes.ts"; +import { SynthError } from "../types.ts"; +import { + createRemotePlayer, + createRemoteSynth, + createRemoteTranscriber, + fetchInfo, + openRemoteMic, +} from "./client.ts"; +import { HubError, type DeviceStatus, type Hub } from "./hub.ts"; +import { startServer } from "./server.ts"; + +const PORT = 47911; +const BASE = `http://127.0.0.1:${PORT}`; +const DEV: DeviceStatus = { + id: "phone", + label: "Phone", + kind: "termux", + online: true, + idleSec: 1, + mic: true, + speaker: true, +}; + +const state = { + mics: [] as FakeMic[], + micOwner: null as string | null, + pinned: null as string | null, + transcribed: [] as Array<{ bytes: number; language: string }>, + synthFail: null as SynthError | null, + busy: false, +}; +const player = fakePlayer(); + +const hub: Hub = { + refresh: async () => {}, + start() {}, + devices: () => [DEV], + home: () => DEV, + pinned: () => state.pinned, + pin(id) { + if (id === "deaf") throw new HubError("deaf has no working microphone or speaker", "NO_DEVICE"); + state.pinned = id; + }, + async openMic(owner) { + if (state.busy) + throw new HubError("Microphone is in use by other", "BUSY", "Finish that first"); + state.micOwner = owner; + const m = fakeMic(); + state.mics.push(m); + return { mic: m, device: DEV }; + }, + micOwner: () => state.micOwner, + player, + playerDevice: () => "phone", + async transcribe(wav, opts) { + state.transcribed.push({ bytes: wav.length, language: opts.language }); + return "xin chào"; + }, + async synthesize() { + if (state.synthFail) throw state.synthFail; + return wrapPcm(Buffer.alloc(32000), 16000); + }, + warm() {}, + dispose: async () => {}, +}; + +let server: { stop(): void }; +beforeAll(() => { + server = startServer({ + hub, + hostnames: ["127.0.0.1"], + port: PORT, + authorize: async () => false, + info: () => ({ + host: "Mac", + devices: hub.devices(), + home: hub.home(), + pinned: hub.pinned(), + micOwner: null, + models: ["m"], + defaultModel: "m", + }), + }); +}); +afterAll(() => server.stop()); + +const until = async (cond: () => boolean, ms = 2000): Promise => { + const end = Date.now() + ms; + while (!cond()) { + if (Date.now() > end) throw new Error("timeout"); + await new Promise((r) => setTimeout(r, 10)); + } +}; + +describe("wire", () => { + test("info and home pin", async () => { + const info = await fetchInfo(BASE); + expect(info?.host).toBe("Mac"); + expect(info?.home.label).toBe("Phone"); + const r = await fetch(`${BASE}/v1/home`, { + method: "POST", + body: JSON.stringify({ id: "phone" }), + }); + expect(r.status).toBe(200); + expect(state.pinned).toBe("phone"); + const bad = await fetch(`${BASE}/v1/home`, { + method: "POST", + body: JSON.stringify({ id: "deaf" }), + }); + expect(bad.status).toBe(409); + expect(((await bad.json()) as { message: string }).message).toContain("no working microphone"); + }); + + test("mic: PCM streams to the client, pause/stop travel back, device label arrives", async () => { + const mic = await openRemoteMic(BASE, { clientName: "duy:opencode" }); + expect(mic.device).toBe("Phone"); + expect(state.micOwner).toBe("duy:opencode"); + const got: Buffer[] = []; + mic.onData((c) => got.push(c)); + const remote = state.mics.at(-1) as FakeMic; + remote.push(Buffer.alloc(640, 1)); + await until(() => got.length === 1); + expect(got[0]?.length).toBe(640); + mic.pause(); + await until(() => remote.paused); + mic.resume(); + await until(() => !remote.paused); + await mic.stop(); + expect(remote.stops).toBe(1); + }); + + test("mic: remote errors reach the client with their hint; busy is refused", async () => { + const mic = await openRemoteMic(BASE); + const errs: string[] = []; + mic.onError((e) => errs.push(`${e.code}:${e.message}:${e.hint}`)); + state.mics + .at(-1) + ?.fail({ code: "CONNECTION", message: "Phone connection failed", hint: "run sshd" }); + await until(() => errs.length === 1); + expect(errs[0]).toBe("CONNECTION:Phone connection failed:run sshd"); + mic.kill(); + state.busy = true; + const err = await openRemoteMic(BASE).catch((e: Error & { hint?: string }) => e); + state.busy = false; + expect((err as Error).message).toContain("in use by other"); + expect((err as { hint?: string }).hint).toBe("Finish that first"); + }); + + test("mic: closing the client socket kills the device stream", async () => { + const mic = await openRemoteMic(BASE); + const remote = state.mics.at(-1) as FakeMic; + mic.kill(); + await until(() => remote.kills === 1); + }); + + test("player: play/pause/seek/rate/stop over the socket, end reported", async () => { + const p = createRemotePlayer(BASE); + const wav = wrapPcm(Buffer.alloc(32000 * 2), 16000); + const ended = p.play(wav); + await until(() => player.plays.length === 1); + expect(player.plays[0]?.length).toBe(wav.length); + expect(p.status()).toBe("playing"); + expect(p.durationSec()).toBe(2); + expect(p.pause()).toBe(true); + await until(() => player.status() === "paused"); + expect(p.resume()).toBe(true); + await until(() => player.status() === "playing"); + p.seek(1.5); + await until(() => player.seeks.at(-1) === 1.5); + p.setRate(1.5); + await until(() => player.rateValue === 1.5); + expect(p.rate()).toBe(1.5); + player.finish("ended"); + expect(await ended).toBe("ended"); + const second = p.play(wav); + await until(() => player.plays.length === 2); + p.stop(); + expect(await second).toBe("stopped"); + p.dispose(); + }); + + test("player: seek past the end finishes the clip (rewind into the previous part)", async () => { + // The TTS session rewinds across parts with seek(Infinity); JSON turns + // Infinity into null, which the node used to ignore. + const p = createRemotePlayer(BASE); + const ended = p.play(wrapPcm(Buffer.alloc(32000 * 2), 16000)); + await until(() => player.plays.length === 3); + expect(p.seek(Number.POSITIVE_INFINITY)).toBe(true); + expect(await ended).toBe("ended"); + p.dispose(); + }); + + test("player: the previous clip's final state never overwrites the next clip's position", async () => { + // Real network timing: the node sends "end", and its state broadcast for + // the finished clip (pos = its end) arrives separately — after the TTS + // loop already started the next clip. + let plays = 0; + const stub = Bun.serve({ + port: 0, + hostname: "127.0.0.1", + fetch: (req, srv) => (srv.upgrade(req) ? undefined : new Response("no", { status: 400 })), + websocket: { + message(ws, msg) { + if (typeof msg === "string") { + const op = JSON.parse(msg) as { op: string; id?: number }; + if (op.op === "play") plays = op.id ?? 0; + return; + } + const id = plays; + if (id === 1) { + setTimeout(() => { + ws.send(JSON.stringify({ t: "end", id, result: "ended" })); + setTimeout( + () => + ws.send(JSON.stringify({ t: "state", status: "idle", pos: 2, dur: 2, rate: 1 })), + 20, + ); + }, 10); + } + }, + }, + }); + const p = createRemotePlayer(`http://127.0.0.1:${stub.port}`); + const wav = wrapPcm(Buffer.alloc(32000 * 2), 16000); + await p.play(wav); + void p.play(wav); // like the TTS loop: next clip right after "end" + await new Promise((r) => setTimeout(r, 60)); + expect(p.positionSec()).toBeLessThan(1); + expect(p.status()).toBe("playing"); + p.dispose(); + stub.stop(true); + }); + + test("transcribe and synth over HTTP, synth errors keep their code", async () => { + const t = createRemoteTranscriber(BASE, () => "m"); + expect(await t.transcribe(wrapPcm(Buffer.alloc(3200), 16000), { language: "vi" })).toBe( + "xin chào", + ); + expect(state.transcribed.at(-1)?.language).toBe("vi"); + const s = createRemoteSynth(BASE, "vieneu", () => "Mai Anh"); + const wav = await s.synthesize({ lang: "vi", text: "chào" }); + expect(wav.subarray(0, 4).toString()).toBe("RIFF"); + state.synthFail = new SynthError("VieNeu unavailable (exited) — using Piper", "UNAVAILABLE"); + const err = await s.synthesize({ lang: "vi", text: "x" }).catch((e: SynthError) => e); + state.synthFail = null; + expect(err).toBeInstanceOf(SynthError); + expect((err as SynthError).code).toBe("UNAVAILABLE"); + }); + + test("node down: client errors say so instead of hanging", async () => { + const down = "http://127.0.0.1:47999"; + expect(await fetchInfo(down, {}, 500)).toBeNull(); + const err = await openRemoteMic(down).catch((e: Error) => e); + expect((err as Error).message).toMatch(/Voice node/); + const s = createRemoteSynth(down, "vieneu", () => "x"); + const se = await s.synthesize({ lang: "vi", text: "x" }).catch((e: SynthError) => e); + expect((se as SynthError).code).toBe("UNAVAILABLE"); + }); +}); diff --git a/src/plugin.test.ts b/src/plugin.test.ts new file mode 100644 index 0000000..807bd93 --- /dev/null +++ b/src/plugin.test.ts @@ -0,0 +1,10 @@ +import { expect, test } from "bun:test"; +import { nextRate } from "./plugin.ts"; + +test("faster / slower step through the presets and stop at the ends", () => { + expect(nextRate(1, 1)).toBe(1.25); + expect(nextRate(1, -1)).toBe(0.75); + expect(nextRate(2, 1)).toBe(2); + expect(nextRate(0.75, -1)).toBe(0.75); + expect(nextRate(1.1, 1)).toBe(1.25); +}); diff --git a/src/plugin.ts b/src/plugin.ts new file mode 100644 index 0000000..bee8dd1 --- /dev/null +++ b/src/plugin.ts @@ -0,0 +1,796 @@ +// Composition root: builds every module from the host context, wires the two +// state machines to the status line and commands, and tears it all down. +import { createHost, type HostContext, type SelectOption } from "./host.ts"; +import { createSettings, parseOptions, type Options, type Settings } from "./config.ts"; +import { createFileLogger, defaultLogPath } from "./log.ts"; +import { createLlm } from "./llm/client.ts"; +import { resolveLlmConfig } from "./llm/config.ts"; +import { + CORRECTION_PROMPT, + STT_NORMALIZE_PROMPT, + TTS_NORMALIZE_PROMPT, + buildCorrectionUser, + buildSttUser, + cleanNormalizerOutput, + needsContext, +} from "./llm/prompts.ts"; +import { listInputDevices, openMic } from "./audio/mic.ts"; +import { createPlayer } from "./audio/player.ts"; +import { pcmRms, wavDurationSec, wrapPcm } from "./audio/wav.ts"; +import { + createWhisperTranscriber, + defaultWhisperModel, + findWhisperModels, + shortModelName, +} from "./stt/whisper.ts"; +import { createApiTranscriber } from "./stt/api-transcriber.ts"; +import { transcribeLong } from "./stt/long.ts"; +import { cleanTranscript, isLikelyHallucination } from "./stt/filter.ts"; +import { createStreamingSession } from "./stt/streaming.ts"; +import { createSttMachine, type SttMachine } from "./stt/session.ts"; +import { createTtsMachine, type TtsMachine } from "./tts/session.ts"; +import { mergeForEngine, prepareSpeech, splitSegments } from "./tts/text.ts"; +import { createVieneuSynth } from "./tts/vieneu.ts"; +import { createPiperSynth, defaultPiperVoice } from "./tts/piper.ts"; +import { mountStatus, type Action, type StatusMount } from "./ui/status.ts"; +import { + createRemotePlayer, + createRemoteSynth, + createRemoteTranscriber, + discoverNode, + fetchInfo, + openRemoteMic, + startNodeDaemon, + type NodeInfo, +} from "./node/client.ts"; +import { VIENEU_VOICES } from "./tts/vieneu.ts"; +import { defaultRun } from "./audio/usb.ts"; +import os from "node:os"; +import { + LANGUAGE_OPTIONS, + NORMALIZE_OPTIONS, + RATE_OPTIONS, + STT_MODE_OPTIONS, + TTS_ENGINE_OPTIONS, + buildCommands, + type CommandActions, +} from "./commands.ts"; +import type { Logger, PlayEnd, Player, Synth, SynthName, Transcriber } from "./types.ts"; +import { PLAYBACK_RATES, errorMessage } from "./types.ts"; + +const IDLE_RELEASE_MS = 10 * 60_000; + +/** Next preset speed up (+1) or down (-1), stopping at the ends. */ +export function nextRate(cur: number, dir: 1 | -1): number { + const rates = [...PLAYBACK_RATES]; + if (dir > 0) return rates.find((r) => r > cur + 0.001) ?? (rates[rates.length - 1] as number); + return [...rates].reverse().find((r) => r < cur - 0.001) ?? (rates[0] as number); +} + +export interface PluginHandle { + readonly stt: SttMachine; + readonly tts: TtsMachine; + readonly settings: Settings; + readonly options: Options; + dispose(): Promise; +} + +export async function setupPlugin( + ctx: HostContext, + logger: Logger = createFileLogger(), +): Promise { + const host = createHost(ctx); + const options = parseOptions(ctx.options); + const settings = createSettings(host.kv, options); + logger.log("plugin", `setup host=${ctx.app?.version ?? "?"}`, "info"); + + const llm = createLlm( + () => + resolveLlmConfig({ + options: { ...options.raw }, + selection: settings.voiceModel(), + sessionModel: host.sessionModel(), + providers: host.providers(), + models: host.models(), + }), + { logger }, + ); + + // ------------------------------------------------ voice node (engine host) + + // A node (on the strongest machine) owns engines, microphones and speakers + // of every device; it routes audio to whichever device you are using. + let nodeUrl: string | null = null; + let nodeInfo: NodeInfo | null = null; + const clientName = `${os.hostname().split(".")[0]}:opencode`; + const nodeReady: Promise = discoverNode(options.voiceNode, { + tailscaleStatus: async () => { + const r = await defaultRun("tailscale", ["status", "--json"], 4000); + return r.code === 0 ? r.stdout : null; + }, + startDaemon: () => startNodeDaemon(logger), + }) + .catch(() => null) + .then((u) => { + nodeUrl = u; + logger.log("plugin", `voice node: ${u ?? "none (local engines)"}`, "info"); + if (u) void refreshNode(); + return u; + }); + let lastRestart = 0; + async function refreshNode(): Promise { + if (!nodeUrl) return; + const info = await fetchInfo(nodeUrl, {}, 2000); + if (!info && options.voiceNode === "host" && Date.now() - lastRestart > 30_000) { + // This machine is the engine host: bring the node back if it died. + lastRestart = Date.now(); + logger.log("plugin", "voice node not answering — restarting it", "warn"); + startNodeDaemon(logger); + } + const before = nodeInfo ? `${nodeInfo.home.id}|${nodeInfo.pinned}` : ""; + nodeInfo = info; + const after = info ? `${info.home.id}|${info.pinned}` : ""; + if (before !== after) status?.refresh(); + } + const nodePoll = setInterval(() => void refreshNode(), 4000); + nodePoll.unref?.(); + + // ------------------------------------------------ engines (lazy, released when idle) + + let remoteTrans: Transcriber | null = null; + async function realTranscriber(): Promise { + const u = await nodeReady; + if (u) { + remoteTrans ??= createRemoteTranscriber(u, () => settings.whisperModel(), { + logger, + clientName, + }); + return remoteTrans; + } + return localTranscriber(); + } + /** Resolves the real engine (node or local) at call time. */ + const transcriber = (): Transcriber => ({ + transcribe: async (wav, opts) => (await realTranscriber()).transcribe(wav, opts), + warm: async () => (await realTranscriber()).warm(), + describe: () => (nodeUrl ? `whisper on ${nodeInfo?.host ?? "node"}` : "local whisper"), + dispose: async () => {}, + }); + + let trans: { key: string; t: Transcriber; usedAt: number } | null = null; + function localTranscriber(): Transcriber { + const api = settings.sttEngine() === "api" && options.sttEndpoint && options.sttApiModel; + const model = settings.whisperModel() ?? defaultWhisperModel(); + const key = api ? `api:${options.sttEndpoint}:${options.sttApiModel}` : `local:${model ?? ""}`; + if (trans && trans.key === key) { + trans.usedAt = Date.now(); + return trans.t; + } + const old = trans; + trans = null; + void old?.t.dispose().catch(() => {}); + let t: Transcriber; + if (api) { + const apiKey = options.sttApiKeyEnv ? process.env[options.sttApiKeyEnv] : undefined; + t = createApiTranscriber({ + endpoint: options.sttEndpoint as string, + model: options.sttApiModel as string, + ...(apiKey ? { apiKey } : {}), + logger, + }); + } else { + if (!model) + throw new Error( + "No whisper model found — download a ggml model, then pick it with /stt-model", + ); + t = createWhisperTranscriber({ modelPath: model, logger }); + } + trans = { key, t, usedAt: Date.now() }; + return t; + } + + const remoteSynths = new Map(); + const synth = (name: SynthName): Synth => ({ + name, + supports: () => true, + synthesize: async (seg, signal) => { + const u = await nodeReady; + if (!u) return localSynth(name).synthesize(seg, signal); + let r = remoteSynths.get(name); + if (!r) { + r = createRemoteSynth(u, name, () => settings.vieneuVoice(), { logger, clientName }); + remoteSynths.set(name, r); + } + return r.synthesize(seg, signal); + }, + warm: () => { + void nodeReady.then((u) => { + if (u) createRemoteSynth(u, name, () => settings.vieneuVoice()).warm(); + else localSynth(name).warm(); + }); + }, + dispose: async () => {}, + }); + + const synths = new Map(); + function localSynth(name: SynthName): Synth { + const hit = synths.get(name); + if (hit) { + hit.usedAt = Date.now(); + return hit.s; + } + const s = + name === "vieneu" + ? createVieneuSynth({ + python: options.ttsVieneuPython, + voice: () => settings.vieneuVoice(), + logger, + }) + : createPiperSynth({ voiceFor: (lang) => defaultPiperVoice(lang), logger }); + synths.set(name, { s, usedAt: Date.now() }); + return s; + } + + const localPlayer = createPlayer( + () => + settings.ttsOutput() === "remote" && options.ttsPlayCmd + ? { kind: "remote", command: options.ttsPlayCmd } + : { kind: "local" }, + { logger }, + ); + // Delegates to the node's shared speaker once discovery finished. + let activePlayer: Player = localPlayer; + let wantedRate = localPlayer.rate(); + void nodeReady.then((u) => { + if (!u) return; + activePlayer = createRemotePlayer(u, { logger, clientName }); + activePlayer.setRate(wantedRate); + }); + const player: Player = { + play: (wav): Promise => activePlayer.play(wav), + pause: () => activePlayer.pause(), + resume: () => activePlayer.resume(), + stop: () => activePlayer.stop(), + status: () => activePlayer.status(), + positionSec: () => activePlayer.positionSec(), + durationSec: () => activePlayer.durationSec(), + seek: (sec) => activePlayer.seek(sec), + setRate: (r) => { + wantedRate = r; + activePlayer.setRate(r); + }, + rate: () => activePlayer.rate(), + dispose: () => { + localPlayer.dispose(); + if (activePlayer !== localPlayer) activePlayer.dispose(); + }, + }; + + // ------------------------------------------------------- machines + + let stt: SttMachine | null = null; + const tts = createTtsMachine({ + host, + settings, + logger, + llm, + normalizePrompt: options.ttsPrompt ?? TTS_NORMALIZE_PROMPT, + prepareSpeech, + splitSegments: (text) => splitSegments(text), + mergeForEngine, + synth, + player, + clipDuration: (wav) => wavDurationSec(wav) ?? 0, + isRecording: () => stt?.isBusy() === true, + }); + + stt = createSttMachine({ + host, + settings, + options, + logger, + openMic: async (cfg) => { + const u = await nodeReady; + return u ? openRemoteMic(u, { logger, clientName }) : openMic(cfg, { logger }); + }, + // With a node, the node picks the device; local settings do not apply. + micConfig: () => (nodeUrl ? { kind: "local", sampleRate: options.audioSampleRate } : undefined), + micLabel: () => (nodeUrl ? (nodeInfo?.home.label ?? "voice node") : undefined), + transcriber, + transcribeFile: (t, wav, opts) => transcribeLong(t, wav, opts, { logger }), + createStreaming: (input) => + createStreamingSession({ + mic: input.mic, + transcriber: input.transcriber, + language: input.language, + onPartial: input.onPartial, + onError: input.onError, + logger, + }), + wrapPcm, + pcmRms, + cleanTranscript, + isHallucination: isLikelyHallucination, + llm, + prompts: { + normalize: options.sttPrompt ?? STT_NORMALIZE_PROMPT, + correction: CORRECTION_PROMPT, + buildSttUser, + buildCorrectionUser, + needsContext, + cleanOutput: cleanNormalizerOutput, + }, + onRecordingStart: () => { + // The mic must not hear the reply being read: pause it, or stop it when + // it is still preparing / between parts (nothing to pause yet). + if (tts.isBusy() && !tts.pause()) tts.stop(); + }, + }); + const sttM = stt; + + // ------------------------------------------------------- actions + + const toggleAutoSubmit = (): void => { + const next = !settings.autoSubmit(); + settings.setAutoSubmit(next); + status?.refresh(); + host.toast( + next + ? "Auto-submit on: dictation is sent right away" + : "Auto-submit off: dictation is inserted", + "info", + 2500, + ); + }; + + async function pick( + title: string, + opts: readonly SelectOption[], + current: V, + apply: (v: V) => void, + ): Promise { + const v = await host.select(title, opts, current); + if (v === undefined) return; + apply(v); + status?.refresh(); + } + + const actions: CommandActions = { + sttToggle: () => sttM.toggle(), + sttCorrect: () => sttM.correct(), + sttPause: () => { + if (!sttM.pause()) host.toast("Pause works during live dictation only", "info", 2500); + }, + cancelAll: () => { + const a = sttM.cancel(); + const b = tts.stop(); + if (!a && !b) host.toast("Nothing to cancel", "info", 1500); + }, + ttsToggle: () => tts.toggle(), + ttsPause: () => { + if (!tts.pause()) host.toast("Nothing is being read", "info", 1500); + }, + ttsStop: () => void tts.stop(), + ttsReplay: () => { + if (!tts.replay()) host.toast("Nothing to replay yet", "info", 1500); + }, + ttsBack: () => { + if (!tts.seekBy(-5)) host.toast("Nothing is being read", "info", 1500); + }, + ttsForward: () => { + if (!tts.seekBy(5)) host.toast("Nothing is being read", "info", 1500); + }, + ttsFaster: () => { + const r = nextRate(tts.view().rate, +1); + tts.setRate(r); + host.toast(`Reading speed ${r}x`, "info", 1200); + }, + ttsSlower: () => { + const r = nextRate(tts.view().rate, -1); + tts.setRate(r); + host.toast(`Reading speed ${r}x`, "info", 1200); + }, + pickRate: () => pick("Reading speed", RATE_OPTIONS, tts.view().rate, (v) => tts.setRate(v)), + toggleAutoSubmit, + toggleAutoEnd: () => { + const next = !settings.autoEnd(); + settings.setAutoEnd(next); + status?.refresh(); + host.toast( + next ? "Auto-finish on: 2.5s of silence finishes dictation" : "Auto-finish off", + "info", + 2500, + ); + }, + toggleTtsAuto: () => { + const next = !settings.ttsAuto(); + settings.setTtsAuto(next); + host.toast(next ? "Auto-read on: replies are read aloud" : "Auto-read off", "info", 2500); + if (next && settings.ttsEngine() === "vieneu") synth("vieneu").warm(); + }, + pickSttMode: () => + pick("Dictation mode", STT_MODE_OPTIONS, settings.sttMode(), (v) => settings.setSttMode(v)), + pickNormalize: () => + pick("LLM clean-up of dictation", NORMALIZE_OPTIONS, settings.normalize(), (v) => + settings.setNormalize(v), + ), + pickLanguage: () => + pick("Dictation language", LANGUAGE_OPTIONS, settings.language(), (v) => + settings.setLanguage(v), + ), + pickWhisperModel: async () => { + const models = nodeUrl ? (nodeInfo?.models ?? []) : findWhisperModels(); + if (models.length === 0) { + host.toast("No whisper models found in ~/.local/share/whisper-cpp", "warning"); + return; + } + const opts = models.map((p) => ({ + title: p.split("/").pop() ?? p, + value: p, + description: p, + })); + await pick( + "Whisper model", + opts, + settings.whisperModel() ?? defaultWhisperModel() ?? "", + (v) => { + settings.setWhisperModel(v); + host.toast(`Transcription: whisper ${shortModelName(v)}`, "info", 2000); + }, + ); + }, + pickSttEngine: async () => { + const apiReady = Boolean(options.sttEndpoint && options.sttApiModel); + const model = settings.whisperModel() ?? defaultWhisperModel(); + const engine = await host.select( + "Transcription engine", + [ + { + title: "Local whisper", + value: "local" as const, + description: model + ? `${shortModelName(model)} — runs on this Mac; next: pick the model` + : "No model found in ~/.local/share/whisper-cpp", + }, + { + title: apiReady ? `API (${options.sttApiModel})` : "API (not configured)", + value: "api" as const, + description: apiReady + ? `OpenAI-compatible: ${options.sttEndpoint}` + : "Add sttEndpoint + sttApiModel (+ sttApiKeyEnv) to the plugin options", + }, + ], + settings.sttEngine(), + ); + if (engine === undefined) return; + if (engine === "api") { + if (!apiReady) { + host.toast( + "API transcription needs sttEndpoint + sttApiModel in the plugin options", + "warning", + 5000, + ); + return; + } + settings.setSttEngine("api"); + host.toast(`Transcription: API (${options.sttApiModel})`, "info", 2000); + status?.refresh(); + return; + } + settings.setSttEngine("local"); + status?.refresh(); + await actions.pickWhisperModel(); + }, + pickDevice: async () => { + const u = await nodeReady; + if (!u) { + host.toast( + 'No voice node: set voiceNode in the plugin options ("host" on the engine machine)', + "info", + 4000, + ); + return; + } + const info = (await fetchInfo(u, {}, 2000)) ?? nodeInfo; + if (!info) { + host.toast("Voice node not reachable", "warning"); + return; + } + const idle = (sec: number | null): string => + sec === null + ? "idle unknown" + : sec < 60 + ? `used ${Math.round(sec)}s ago` + : `used ${Math.round(sec / 60)}m ago`; + const opts: SelectOption[] = [ + { + title: `Follow me (now: ${info.pinned ? "—" : info.home.label})`, + value: "", + description: "Mic and speaker of the device you touched last", + }, + ...info.devices.map((d) => ({ + title: d.label, + value: d.id, + description: !d.online + ? `${d.kind} · offline` + : !d.mic || !d.speaker + ? `${d.kind} · no ${!d.mic && !d.speaker ? "audio device" : !d.mic ? "microphone" : "speaker"}` + : `${d.kind} · ${idle(d.idleSec)}`, + ...(d.online && d.mic && d.speaker ? {} : { disabled: true }), + })), + ]; + const v = await host.select("Speak and listen on", opts, info.pinned ?? ""); + if (v === undefined) return; + try { + const r = await fetch(new URL("/v1/home", u).toString(), { + method: "POST", + body: JSON.stringify({ id: v || null }), + signal: AbortSignal.timeout(3000), + }); + if (!r.ok) { + const b = (await r.json().catch(() => ({}))) as { message?: string }; + host.toast(b.message ?? `Could not switch (HTTP ${r.status})`, "warning"); + return; + } + await refreshNode(); + host.toast( + v + ? `Audio pinned to ${info.devices.find((d) => d.id === v)?.label ?? v}` + : "Audio follows you", + "info", + 2000, + ); + status?.refresh(); + } catch (err) { + host.toast(`Could not switch: ${errorMessage(err)}`, "error"); + } + }, + pickMic: async () => { + if (nodeUrl) return actions.pickDevice(); + const devices = await listInputDevices().catch(() => [] as string[]); + const opts: SelectOption[] = [ + { title: "Mac — default input", value: "" }, + ...devices.map((d) => ({ title: d, value: d })), + ]; + if (options.sttCaptureCmd) + opts.push({ + title: "Phone (USB / ssh)", + value: "remote", + description: "Uses sttCaptureCmd", + }); + await pick("Microphone", opts, settings.mic(), (v) => settings.setMic(v)); + }, + pickTtsEngine: () => + pick("Speech engine", TTS_ENGINE_OPTIONS, settings.ttsEngine(), (v) => { + settings.setTtsEngine(v); + if (v === "vieneu") synth("vieneu").warm(); + }), + pickVoice: async () => { + const s = localSynth("vieneu") as Synth & { voices?: () => Promise }; + const voices = nodeUrl + ? [...VIENEU_VOICES] + : await (s.voices?.() ?? Promise.resolve([] as string[])).catch(() => [] as string[]); + if (voices.length === 0) { + host.toast("Could not list VieNeu voices (is the VieNeu sidecar running?)", "warning"); + return; + } + await pick( + "VieNeu voice", + voices.map((v) => ({ title: v, value: v })), + settings.vieneuVoice(), + (v) => settings.setVieneuVoice(v), + ); + }, + pickTtsOutput: async () => { + if (nodeUrl) return actions.pickDevice(); + if (!options.ttsPlayCmd) { + host.toast("Phone speaker needs ttsPlayCmd in the plugin options", "info", 4000); + return; + } + await pick( + "Speaker", + [ + { title: "Mac speakers", value: "local" as const }, + { title: "Phone (USB / ssh)", value: "remote" as const }, + ], + settings.ttsOutput(), + (v) => settings.setTtsOutput(v), + ); + }, + pickVoiceModel: async () => { + const opts: SelectOption[] = [{ title: "Same as the session model", value: "" }]; + for (const m of host.models()) { + if (!m || typeof m !== "object") continue; + const r = m as Record; + const prov = r.providerID ?? (r.provider as Record | undefined)?.id; + const id = r.id ?? r.modelID; + if (typeof prov === "string" && typeof id === "string") { + opts.push({ title: `${prov}/${id}`, value: `${prov}\u0000${id}`, category: prov }); + } + } + const cur = settings.voiceModel(); + await pick( + "LLM for clean-up and fix", + opts, + cur ? `${cur.providerID}\u0000${cur.modelID}` : "", + (v) => { + const [p, id] = v.split("\u0000"); + settings.setVoiceModel(p && id ? { providerID: p, modelID: id } : null); + }, + ); + }, + showStatus: () => { + const lines = [ + `Dictation: ${settings.sttMode() === "streaming" ? "live" : "batch"}, language ${settings.language()}, clean-up ${settings.normalize()}`, + nodeUrl + ? `Voice node: ${nodeInfo?.host ?? "?"} (${nodeUrl}) — audio on ${nodeInfo?.home.label ?? "?"}${nodeInfo?.pinned ? " (pinned)" : " (follows you)"}; devices: ${(nodeInfo?.devices ?? []).map((d) => `${d.label}${d.online ? "" : " offline"}`).join(", ")}` + : `Mic: ${settings.mic() === "remote" ? "phone" : settings.mic() || "Mac default"} (no voice node)`, + `Transcription: ${settings.sttEngine() === "api" ? `API ${options.sttApiModel}` : `whisper ${(settings.whisperModel() ?? defaultWhisperModel() ?? "none").split("/").pop()}`}`, + `LLM: ${llm.describe()}`, + `Auto-submit: ${settings.autoSubmit() ? "on" : "off"}, auto-finish: ${settings.autoEnd() ? "on" : "off"}`, + `Speech: ${settings.ttsEngine()}${settings.ttsEngine() === "vieneu" ? ` (${settings.vieneuVoice() || "default voice"})` : ""}, speaker ${settings.ttsOutput() === "remote" ? "phone" : "Mac"}, auto-read ${settings.ttsAuto() ? "on" : "off"}, speed ${tts.view().rate}x`, + ...(() => { + const v = tts.view(); + return v.phase.kind === "playing" || v.phase.kind === "paused" + ? [ + `Reading: part ${v.phase.part}/${v.phase.parts}, ${v.positionSec.toFixed(1)}s of ${v.durationSec.toFixed(1)}s${v.durationFinal ? "" : " (still synthesizing)"}`, + ] + : []; + })(), + `Log: ${defaultLogPath()}`, + ]; + host.alert("Voice status", lines.join("\n")); + }, + }; + + const sttEngineLabel = (): string => { + if (nodeUrl && !nodeInfo) return "⚠ node offline"; + if (settings.sttEngine() === "api" && !nodeUrl) return "API"; + const m = nodeUrl + ? settings.whisperModel() && nodeInfo?.models.includes(settings.whisperModel() as string) + ? settings.whisperModel() + : (nodeInfo?.defaultModel ?? null) + : (settings.whisperModel() ?? defaultWhisperModel()); + return m ? shortModelName(m) : "no model"; + }; + + const onAction = (a: Action): void => { + switch (a) { + case "stt.toggle": + return actions.sttToggle(); + case "stt.finish": + return sttM.finish(); + case "stt.correct": + return actions.sttCorrect(); + case "stt.pause": + return actions.sttPause(); + case "stt.cancel": + void sttM.cancel(); + return; + case "stt.autoEnd": + actions.toggleAutoEnd(); + return; + case "stt.autoSubmit": + toggleAutoSubmit(); + return; + case "stt.mode": { + const next = settings.sttMode() === "streaming" ? "batch" : "streaming"; + settings.setSttMode(next); + host.toast(next === "streaming" ? "Live dictation" : "Batch dictation", "info", 1500); + status?.refresh(); + return; + } + case "voice.device": + void actions.pickDevice(); + return; + case "stt.engine": + void actions.pickSttEngine(); + return; + case "tts.toggle": + return actions.ttsToggle(); + case "tts.pause": + return actions.ttsPause(); + case "tts.stop": + return actions.ttsStop(); + case "tts.replay": + return actions.ttsReplay(); + case "tts.back": + return actions.ttsBack(); + case "tts.forward": + return actions.ttsForward(); + case "tts.rate": + tts.cycleRate(); + status?.refresh(); + return; + case "tts.auto": + actions.toggleTtsAuto(); + status?.refresh(); + return; + } + }; + + // ------------------------------------------------------- UI + commands + + let status: StatusMount | null = null; + try { + status = await mountStatus({ + slot: (target, render) => host.slot(target, render), + read: () => ({ + stt: sttM.view(), + tts: tts.view(), + autoSubmit: settings.autoSubmit(), + autoEnd: settings.autoEnd(), + sttMode: settings.sttMode(), + sttEngine: sttEngineLabel(), + audioDevice: + nodeUrl && nodeInfo + ? { label: nodeInfo.home.label, pinned: nodeInfo.pinned !== null } + : null, + ttsAuto: settings.ttsAuto(), + now: Date.now(), + }), + onAction, + theme: host.theme, + onError: (m) => host.toast(`Voice status line failed: ${m}`, "error"), + }); + } catch (err) { + logger.log("plugin", `status line unavailable: ${errorMessage(err)}`, "error"); + host.toast(`Voice status line unavailable: ${errorMessage(err)}`, "warning"); + } + const offStt = sttM.onChange(() => status?.refresh()); + const offTts = tts.onChange(() => status?.refresh()); + + host.registerCommands(buildCommands(actions, options.keybinds)); + + // Release heavy sidecars after a quiet period. + const reaper = setInterval(() => { + const now = Date.now(); + if (trans && !sttM.isBusy() && now - trans.usedAt > IDLE_RELEASE_MS) { + const t = trans.t; + trans = null; + void t.dispose().catch(() => {}); + logger.log("plugin", "released idle transcriber"); + } + for (const [name, entry] of synths) { + if ( + !tts.isBusy() && + now - entry.usedAt > IDLE_RELEASE_MS && + !(name === "vieneu" && settings.ttsAuto()) + ) { + synths.delete(name); + void entry.s.dispose().catch(() => {}); + logger.log("plugin", `released idle ${name}`); + } + } + }, 60_000); + reaper.unref?.(); + + if (settings.ttsAuto() && settings.ttsEngine() === "vieneu") { + setTimeout(() => synth("vieneu").warm(), 3000).unref?.(); + } + + return { + stt: sttM, + tts, + settings, + options, + async dispose() { + clearInterval(reaper); + clearInterval(nodePoll); + offStt(); + offTts(); + sttM.dispose(); + tts.dispose(); + status?.dispose(); + player.dispose(); + const pending: Promise[] = []; + if (trans) pending.push(trans.t.dispose().catch(() => {})); + for (const { s } of synths.values()) pending.push(s.dispose().catch(() => {})); + trans = null; + synths.clear(); + host.dispose(); + await Promise.all(pending); + logger.log("plugin", "disposed", "info"); + }, + }; +} diff --git a/src/stt/api-transcriber.test.ts b/src/stt/api-transcriber.test.ts new file mode 100644 index 0000000..a4ac3b0 --- /dev/null +++ b/src/stt/api-transcriber.test.ts @@ -0,0 +1,166 @@ +import { describe, expect, test } from "bun:test"; +import { isAbortError } from "../types.ts"; +import { + type ApiTranscriberDeps, + buildApiRequest, + createApiTranscriber, + isOpenRouterEndpoint, +} from "./api-transcriber.ts"; +import { pcmToWav } from "./long.ts"; + +const wav = pcmToWav(Buffer.alloc(16000 * 2), 16000); + +function deps(respond: (url: string, init: RequestInit | undefined) => Promise): { + d: Partial; + calls: Array<{ url: string; init?: RequestInit }>; + timers: Array<() => void>; +} { + const calls: Array<{ url: string; init?: RequestInit }> = []; + const timers: Array<() => void> = []; + return { + calls, + timers, + d: { + fetch: (url, init) => { + calls.push(init ? { url, init } : { url }); + return respond(url, init); + }, + setTimeout: (cb) => { + timers.push(cb); + return timers.length; + }, + clearTimeout: () => {}, + }, + }; +} + +describe("isOpenRouterEndpoint", () => { + test("detects openrouter hosts only", () => { + expect(isOpenRouterEndpoint("https://openrouter.ai/api/v1")).toBe(true); + expect(isOpenRouterEndpoint("https://api.openai.com/v1")).toBe(false); + expect(isOpenRouterEndpoint("http://localhost:8000/v1")).toBe(false); + }); +}); + +describe("buildApiRequest", () => { + test("OpenAI-compatible multipart", () => { + const r = buildApiRequest("https://api.openai.com/v1/", "whisper-1", "sk-x", wav, "vi", "hint"); + expect(r.url).toBe("https://api.openai.com/v1/audio/transcriptions"); + expect(r.headers).toEqual({ Authorization: "Bearer sk-x" }); + if (!(r.body instanceof FormData)) throw new Error("expected form"); + expect(r.body.get("model")).toBe("whisper-1"); + expect(r.body.get("response_format")).toBe("json"); + expect(r.body.get("language")).toBe("vi"); + expect(r.body.get("prompt")).toBe("hint"); + expect(r.body.get("file")).toBeInstanceOf(Blob); + }); + + test("auto language and no key omit those fields", () => { + const r = buildApiRequest("http://localhost:8000/v1", "m", undefined, wav, "auto", undefined); + expect(r.headers).toEqual({}); + if (!(r.body instanceof FormData)) throw new Error("expected form"); + expect(r.body.get("language")).toBeNull(); + expect(r.body.get("prompt")).toBeNull(); + }); + + test("OpenRouter base64 JSON", () => { + const r = buildApiRequest( + "https://openrouter.ai/api/v1", + "openai/whisper-1", + "k", + wav, + "en", + undefined, + ); + expect(r.url).toBe("https://openrouter.ai/api/v1/audio/transcriptions"); + expect(r.headers).toEqual({ Authorization: "Bearer k", "Content-Type": "application/json" }); + expect(typeof r.body).toBe("string"); + expect(JSON.parse(String(r.body))).toEqual({ + model: "openai/whisper-1", + input_audio: { data: wav.toString("base64"), format: "wav" }, + language: "en", + }); + }); +}); + +describe("createApiTranscriber", () => { + test("posts and returns cleaned text", async () => { + const h = deps(async () => Response.json({ text: " hello [BLANK_AUDIO] " })); + const t = createApiTranscriber({ + endpoint: "https://x/v1", + model: "m", + apiKey: "k", + deps: h.d, + }); + expect(await t.transcribe(wav, { language: "en" })).toBe("hello"); + expect(h.calls[0]?.url).toBe("https://x/v1/audio/transcriptions"); + expect(h.calls[0]?.init?.method).toBe("POST"); + expect(t.describe()).toBe("api m"); + await t.warm(); + await t.dispose(); + }); + + test("not configured", async () => { + const h = deps(async () => Response.json({})); + const t = createApiTranscriber({ endpoint: "", model: "", deps: h.d }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow("STT API not configured"); + expect(h.calls).toHaveLength(0); + }); + + test("HTTP error surfaces provider message", async () => { + const h = deps(async () => Response.json({ error: { message: "bad key" } }, { status: 401 })); + const t = createApiTranscriber({ endpoint: "https://x/v1", model: "m", deps: h.d }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow( + "STT API error 401: bad key — check the API key and model", + ); + }); + + test("HTTP error without JSON body", async () => { + const h = deps(async () => new Response("gateway down", { status: 502 })); + const t = createApiTranscriber({ endpoint: "https://x/v1", model: "m", deps: h.d }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow("STT API error 502 —"); + }); + + test("invalid JSON", async () => { + const h = deps(async () => new Response("", { status: 200 })); + const t = createApiTranscriber({ endpoint: "https://x/v1", model: "m", deps: h.d }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow("invalid JSON"); + }); + + test("network failure", async () => { + const h = deps(async () => { + throw new Error("ENOTFOUND"); + }); + const t = createApiTranscriber({ endpoint: "https://x/v1", model: "m", deps: h.d }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow( + "STT API request failed: ENOTFOUND", + ); + }); + + test("abort", async () => { + const h = deps( + (_u, init) => + new Promise((_r, reject) => { + init?.signal?.addEventListener("abort", () => reject(new Error("aborted"))); + }), + ); + const t = createApiTranscriber({ endpoint: "https://x/v1", model: "m", deps: h.d }); + const ctl = new AbortController(); + const p = t.transcribe(wav, { language: "en", signal: ctl.signal }); + ctl.abort(); + expect(isAbortError(await p.catch((e: unknown) => e))).toBe(true); + }); + + test("timeout", async () => { + const h = deps( + (_u, init) => + new Promise((_r, reject) => { + init?.signal?.addEventListener("abort", () => reject(new Error("aborted"))); + }), + ); + const t = createApiTranscriber({ endpoint: "https://x/v1", model: "m", deps: h.d }); + const p = t.transcribe(wav, { language: "en" }); + h.timers.at(-1)?.(); + await expect(p).rejects.toThrow("STT API timed out after 60s"); + }); +}); diff --git a/src/stt/api-transcriber.ts b/src/stt/api-transcriber.ts new file mode 100644 index 0000000..39627db --- /dev/null +++ b/src/stt/api-transcriber.ts @@ -0,0 +1,169 @@ +// Remote transcription over an OpenAI-compatible /audio/transcriptions +// endpoint. OpenRouter takes base64 JSON (input_audio) instead of multipart. + +import type { Logger, Transcriber } from "../types.ts"; +import { errorMessage } from "../types.ts"; +import { cleanTranscript } from "./filter.ts"; +import { abortError, wavDurationSec } from "./long.ts"; + +export interface ApiTranscriberDeps { + fetch(url: string, init?: RequestInit): Promise; + setTimeout(cb: () => void, ms: number): unknown; + clearTimeout(handle: unknown): void; +} + +const realDeps: ApiTranscriberDeps = { + fetch: (url, init) => fetch(url, init), + setTimeout: (cb, ms) => setTimeout(cb, ms), + clearTimeout: (h) => clearTimeout(h as ReturnType), +}; + +export interface ApiTranscriberOptions { + readonly endpoint: string; + readonly model: string; + readonly apiKey?: string; + readonly logger?: Logger; + readonly deps?: Partial; +} + +export function isOpenRouterEndpoint(endpoint: string): boolean { + return /(^https?:\/\/)?([^/]+\.)?openrouter\.ai(\/|$)/i.test(endpoint); +} + +export interface ApiRequest { + readonly url: string; + readonly headers: Record; + readonly body: FormData | string; +} + +/** Build the HTTP request for one transcription. Pure. */ +export function buildApiRequest( + endpoint: string, + model: string, + apiKey: string | undefined, + wav: Buffer, + language: string, + prompt: string | undefined, +): ApiRequest { + const url = `${endpoint.replace(/\/+$/, "")}/audio/transcriptions`; + const headers: Record = {}; + if (apiKey) headers["Authorization"] = `Bearer ${apiKey}`; + const lang = language === "auto" ? undefined : language; + if (isOpenRouterEndpoint(endpoint)) { + headers["Content-Type"] = "application/json"; + const payload: Record = { + model, + input_audio: { data: wav.toString("base64"), format: "wav" }, + }; + if (lang) payload["language"] = lang; + if (prompt) payload["prompt"] = prompt; + return { url, headers, body: JSON.stringify(payload) }; + } + const form = new FormData(); + form.append("file", new Blob([new Uint8Array(wav)], { type: "audio/wav" }), "audio.wav"); + form.append("model", model); + form.append("response_format", "json"); + if (lang) form.append("language", lang); + if (prompt) form.append("prompt", prompt); + return { url, headers, body: form }; +} + +function errorDetail(body: string): string { + try { + const parsed: unknown = JSON.parse(body); + if (typeof parsed === "object" && parsed !== null && "error" in parsed) { + const err = parsed.error; + if (typeof err === "string") return err; + if (typeof err === "object" && err !== null && "message" in err) { + if (typeof err.message === "string") return err.message; + } + } + } catch { + // not JSON + } + return ""; +} + +export function createApiTranscriber(opts: ApiTranscriberOptions): Transcriber { + const deps: ApiTranscriberDeps = { ...realDeps, ...opts.deps }; + const log = (msg: string, level: "debug" | "warn" = "debug"): void => + opts.logger?.log("STT", msg, level); + + return { + async transcribe(wav, o) { + if (!opts.endpoint || !opts.model) { + throw new Error("STT API not configured — set the STT API endpoint and model"); + } + if (o.signal?.aborted) throw abortError(); + const req = buildApiRequest( + opts.endpoint, + opts.model, + opts.apiKey, + wav, + o.language, + o.prompt, + ); + const budget = Math.max(60_000, 20_000 + Math.ceil(2 * wavDurationSec(wav) * 1000)); + const ctl = new AbortController(); + let timedOut = false; + const timer = deps.setTimeout(() => { + timedOut = true; + ctl.abort(); + }, budget); + const onAbort = (): void => ctl.abort(); + o.signal?.addEventListener("abort", onAbort, { once: true }); + log(`STT API request model=${opts.model} bytes=${wav.length}`); + try { + let resp: Response; + try { + resp = await deps.fetch(req.url, { + method: "POST", + headers: req.headers, + body: req.body, + signal: ctl.signal, + }); + } catch (err) { + if (o.signal?.aborted) throw abortError(); + if (timedOut) { + throw new Error( + `STT API timed out after ${Math.round(budget / 1000)}s — retry or check the endpoint`, + ); + } + throw new Error( + `STT API request failed: ${errorMessage(err)} — check the endpoint and network`, + ); + } + if (!resp.ok) { + const detail = errorDetail(await resp.text().catch(() => "")); + log(`STT API status=${resp.status}`, "warn"); + throw new Error( + `STT API error ${resp.status}${detail ? `: ${detail}` : ""} — check the API key and model`, + ); + } + let data: unknown; + try { + data = await resp.json(); + } catch { + throw new Error("STT API returned invalid JSON — check the endpoint URL"); + } + const text = + typeof data === "object" && + data !== null && + "text" in data && + typeof data.text === "string" + ? data.text + : ""; + log(`STT API ok chars=${text.length}`); + return cleanTranscript(text); + } finally { + deps.clearTimeout(timer); + o.signal?.removeEventListener("abort", onAbort); + } + }, + async warm() {}, + describe() { + return `api ${opts.model}`; + }, + async dispose() {}, + }; +} diff --git a/src/stt/editor.test.ts b/src/stt/editor.test.ts new file mode 100644 index 0000000..db5c65a --- /dev/null +++ b/src/stt/editor.test.ts @@ -0,0 +1,67 @@ +import { describe, expect, test } from "bun:test"; +import { fakeTextarea } from "../testing/fakes.ts"; +import { createLiveSpan, insertAtCursor, replaceAll } from "./editor.ts"; + +describe("insertAtCursor", () => { + test("adds a separating space after a word", () => { + const t = fakeTextarea("hello"); + insertAtCursor(t, "world"); + expect(t.plainText).toBe("hello world"); + }); + test("no extra space at start or after whitespace", () => { + const a = fakeTextarea(""); + insertAtCursor(a, "hi"); + expect(a.plainText).toBe("hi"); + const b = fakeTextarea("hi "); + insertAtCursor(b, "there"); + expect(b.plainText).toBe("hi there"); + }); +}); + +describe("live span", () => { + test("rewrites its own range in place, keeping surrounding text", () => { + const t = fakeTextarea("before after", 6); // cursor after "before" + const s = createLiveSpan(t); + expect(s.set("xin")).toBe(true); + expect(t.plainText).toBe("before xin after"); + expect(s.set("xin chào các bạn")).toBe(true); + expect(t.plainText).toBe("before xin chào các bạn after"); + expect(s.set("xin chào")).toBe(true); + expect(t.plainText).toBe("before xin chào after"); + }); + + test("works across multiple lines", () => { + const t = fakeTextarea("line one\nline two", 8); + const s = createLiveSpan(t); + s.set("A"); + s.set("ABC\nDEF"); + s.set("Z"); + expect(t.plainText).toBe("line one Z\nline two"); + }); + + test("detaches when the user edits, and never overwrites their text", () => { + const t = fakeTextarea("", 0); + const s = createLiveSpan(t); + s.set("hello"); + t.cursorOffset = t.plainText.length; + t.insertText("!!"); // user typed + expect(s.set("hello world")).toBe(false); + expect(s.detached).toBe(true); + expect(t.plainText).toBe("hello!!"); + }); + + test("remove deletes only the owned text", () => { + const t = fakeTextarea("keep", 4); + const s = createLiveSpan(t); + s.set("dictated words"); + s.remove(); + expect(t.plainText).toBe("keep"); + }); + + test("replaceAll swaps the whole field", () => { + const t = fakeTextarea("fit the test"); + replaceAll(t, "fix the test"); + expect(t.plainText).toBe("fix the test"); + expect(t.cursorOffset).toBe(12); + }); +}); diff --git a/src/stt/editor.ts b/src/stt/editor.ts new file mode 100644 index 0000000..07c7dd2 --- /dev/null +++ b/src/stt/editor.ts @@ -0,0 +1,110 @@ +// Writes dictation into the focused text field (composer, dialog input...). +// A LiveSpan owns one range of text that streaming dictation rewrites in +// place; any user edit around it detaches the span so we never overwrite +// what the user typed. +import type { FocusedTextarea } from "../host.ts"; + +export interface LiveSpan { + /** Rewrite the owned range. False once detached (user edited / field gone). */ + set(text: string): boolean; + readonly detached: boolean; + /** Text currently owned in the field. */ + readonly written: string; + /** Delete the owned range (cancel). */ + remove(): void; +} + +function needsLeadingSpace(before: string, text: string): boolean { + if (!text || /^\s/.test(text)) return false; + const last = before.slice(-1); + return last !== "" && !/\s/.test(last); +} + +function position(t: FocusedTextarea, offset: number): { row: number; col: number } { + try { + const p = t.editBuffer?.offsetToPosition?.(offset); + if (p && Number.isFinite(p.row) && Number.isFinite(p.col)) return p; + } catch {} + const before = t.plainText.slice(0, offset); + const lines = before.split("\n"); + return { row: lines.length - 1, col: (lines.at(-1) ?? "").length }; +} + +/** Replace [start, end) of the field with text; cursor ends after it. */ +function replaceRange(t: FocusedTextarea, start: number, end: number, text: string): void { + if (end > start) { + const a = position(t, start); + const b = position(t, end); + t.deleteRange(a.row, a.col, b.row, b.col); + } + t.cursorOffset = start; + if (text) t.insertText(text); +} + +/** Insert at the cursor with a separating space when needed. */ +export function insertAtCursor(t: FocusedTextarea, text: string): void { + const before = t.plainText.slice(0, t.cursorOffset); + t.insertText(needsLeadingSpace(before, text) ? ` ${text}` : text); +} + +export function replaceAll(t: FocusedTextarea, text: string): void { + replaceRange(t, 0, t.plainText.length, text); +} + +export function createLiveSpan(t: FocusedTextarea, onDetach?: (why: string) => void): LiveSpan { + const anchor = Math.max(0, Math.min(t.cursorOffset, t.plainText.length)); + const before = t.plainText.slice(0, anchor); + const after = t.plainText.slice(anchor); + const pad = needsLeadingSpace(before, "x") ? " " : ""; + let written = ""; + let detached = false; + + const intact = (): boolean => { + if (t.isDestroyed) return false; + try { + return t.plainText === before + written + after; + } catch { + return false; + } + }; + + return { + get detached() { + return detached; + }, + get written() { + return written; + }, + set(text) { + if (detached) return false; + if (!intact()) { + detached = true; + try { + const actual = t.plainText; + const expected = before + written + after; + onDetach?.( + `field changed: expected=${expected.length} actual=${actual.length} nfcEqual=${actual.normalize("NFC") === expected.normalize("NFC")} destroyed=${t.isDestroyed === true}`, + ); + } catch {} + return false; + } + const next = text ? pad + text : ""; + if (next === written) return true; + try { + replaceRange(t, anchor, anchor + written.length, next); + written = next; + return true; + } catch { + detached = true; + return false; + } + }, + remove() { + if (detached || !written || !intact()) return; + try { + replaceRange(t, anchor, anchor + written.length, ""); + written = ""; + } catch {} + }, + }; +} diff --git a/src/stt/filter.test.ts b/src/stt/filter.test.ts new file mode 100644 index 0000000..3e2c284 --- /dev/null +++ b/src/stt/filter.test.ts @@ -0,0 +1,46 @@ +import { describe, expect, test } from "bun:test"; +import { cleanTranscript, isLikelyHallucination } from "./filter.ts"; + +describe("cleanTranscript", () => { + test("strips whisper annotations and collapses whitespace", () => { + expect(cleanTranscript(" [BLANK_AUDIO] hello\n\n world ")).toBe("hello world"); + expect(cleanTranscript("(music) fix the bug [Music] ♪ now ♫")).toBe("fix the bug now"); + expect(cleanTranscript("[00:00.000 --> 00:02.000] xin chào (laughs)")).toBe("xin chào"); + }); + + test("empty and annotation-only input becomes empty", () => { + expect(cleanTranscript("")).toBe(""); + expect(cleanTranscript(" [BLANK_AUDIO] ")).toBe(""); + }); +}); + +describe("isLikelyHallucination", () => { + test.each([ + "", + " ", + "you", + "You.", + "Thank you.", + "thank you", + "Thanks for watching!", + "Thank you for watching, see you", + "Please subscribe", + "Hãy subscribe cho kênh Ghiền Mì Gõ để không bỏ lỡ", + "Đăng ký kênh", + "Cảm ơn các bạn đã xem video", + "subscribe to the channel", + ])("drops %p", (text) => { + expect(isLikelyHallucination(text)).toBe(true); + }); + + test.each([ + "can you fix the test", + "thank you, now run the build", + "you should rename this function", + "thank you so much for the review, let's merge", + "sửa lỗi trong file index", + "watch the logs please", + ])("keeps real dictation %p", (text) => { + expect(isLikelyHallucination(text)).toBe(false); + }); +}); diff --git a/src/stt/filter.ts b/src/stt/filter.ts new file mode 100644 index 0000000..2629f2d --- /dev/null +++ b/src/stt/filter.ts @@ -0,0 +1,64 @@ +// Transcript cleanup and whisper-hallucination detection. + +/** + * Remove whisper annotations and normalize spacing. Strips anything in + * [brackets] or (parens) - [BLANK_AUDIO], [Music], (music), (laughs), + * timestamp prefixes - plus music notes, then collapses whitespace. + */ +export function cleanTranscript(text: string): string { + return text + .replace(/\[[^\]]*\]/g, " ") + .replace(/\([^)]*\)/g, " ") + .replace(/[♪♫♬]/g, " ") + .replace(/\s+/g, " ") + .trim(); +} + +// Phrases whisper "hears" on silence/noise (YouTube outros, EN + VI). +// Entries are pre-normalized (lowercase, no diacritics, đ -> d). +const KNOWN_HALLUCINATIONS = [ + "hay subscribe cho kenh ghien mi go", + "hay subscribe cho kenh", + "subscribe cho kenh ghien mi go", + "dang ky kenh", + "cam on cac ban da xem", + "alo alo nghe toi noi gi khong", + "alo alo nghe toi noi gi", + "thank you", + "thank you for watching", + "thanks for watching", + "please subscribe", + "subscribe to my channel", + "like and subscribe", + "you", +]; + +function normalize(text: string): string { + return text + .normalize("NFD") + .replace(/[̀-ͯ]/g, "") + .replace(/[đĐ]/g, "d") + .toLowerCase() + .replace(/[^\p{L}\p{N}\s]/gu, " ") + .replace(/\s+/g, " ") + .trim(); +} + +/** + * True when the transcript is empty or looks like a whisper hallucination. + * Short entries ("you", "thank you") only match the WHOLE transcript; + * substring matching applies to entries of 3+ words only, so real dictation + * like "can you fix the test" survives. + */ +export function isLikelyHallucination(text: string): boolean { + const t = normalize(text); + if (!t) return true; + const hit = KNOWN_HALLUCINATIONS.some( + (k) => t === k || (k.split(" ").length >= 3 && t.includes(k)), + ); + if (hit) return true; + if (/subscribe/.test(t) && /(kenh|channel|ghien)/.test(t)) return true; + // Very short outputs on silence that mention outro words. + if (t.split(" ").length <= 3 && /subscribe|kenh|watching/.test(t)) return true; + return false; +} diff --git a/src/stt/long.test.ts b/src/stt/long.test.ts new file mode 100644 index 0000000..6656076 --- /dev/null +++ b/src/stt/long.test.ts @@ -0,0 +1,187 @@ +import { describe, expect, test } from "bun:test"; +import type { Logger, TranscribeOptions, Transcriber } from "../types.ts"; +import { isAbortError } from "../types.ts"; +import { + abortError, + parseWav, + pcmToWav, + planSplits, + transcribeLong, + wavDurationSec, +} from "./long.ts"; + +const SR = 16000; + +/** Loud tone everywhere except silent gaps at the given second offsets. */ +function speechWithGaps(totalSec: number, gaps: Array<[number, number]>): Buffer { + const n = totalSec * SR; + const pcm = Buffer.alloc(n * 2); + for (let i = 0; i < n; i++) { + const sec = i / SR; + const silent = gaps.some(([a, b]) => sec >= a && sec < b); + pcm.writeInt16LE(silent ? 0 : Math.round(8000 * Math.sin(i / 5)), i * 2); + } + return pcm; +} + +function fakeTranscriber(fn: (wav: Buffer, call: number) => Promise): { + t: Transcriber; + calls: Buffer[]; +} { + const calls: Buffer[] = []; + const t: Transcriber = { + transcribe: (wav: Buffer, _o: TranscribeOptions) => { + calls.push(wav); + return fn(wav, calls.length); + }, + warm: async () => {}, + describe: () => "fake", + dispose: async () => {}, + }; + return { t, calls }; +} + +const opts: TranscribeOptions = { language: "en" }; + +describe("wav helpers", () => { + test("round trip and duration", () => { + const wav = pcmToWav(Buffer.alloc(SR * 2 * 3), SR); + const info = parseWav(wav); + expect(info).toEqual({ + sampleRate: SR, + channels: 1, + bitsPerSample: 16, + dataOffset: 44, + dataLength: SR * 2 * 3, + }); + expect(wavDurationSec(wav)).toBe(3); + }); + + test("skips extra chunks before data and clamps oversized data length", () => { + const base = pcmToWav(Buffer.alloc(SR * 2), SR); + const list = Buffer.alloc(12); + list.write("LIST", 0, "ascii"); + list.writeUInt32LE(4, 4); + list.write("INFO", 8, "ascii"); + const wav = Buffer.concat([base.subarray(0, 36), list, base.subarray(36)]); + wav.writeUInt32LE(0xffffffff, 36 + 12 + 4); + const info = parseWav(wav); + expect(info?.dataOffset).toBe(56); + expect(info?.dataLength).toBe(SR * 2); + }); + + test("non-wav returns null / 0", () => { + expect(parseWav(Buffer.from("not a wav file at all"))).toBeNull(); + expect(wavDurationSec(Buffer.alloc(4))).toBe(0); + }); +}); + +describe("planSplits", () => { + test("cuts inside the quiet gap near each boundary", () => { + const pcm = speechWithGaps(70, [ + [25, 26], + [52, 53], + ]); + const spans = planSplits(pcm, SR, 30); + expect(spans).toHaveLength(3); + const cuts = spans.slice(0, -1).map(([, end]) => end / SR); + expect(cuts[0]).toBeGreaterThanOrEqual(25); + expect(cuts[0]).toBeLessThanOrEqual(26); + expect(cuts[1]).toBeGreaterThanOrEqual(52); + expect(cuts[1]).toBeLessThanOrEqual(53); + // contiguous, covering everything + expect(spans[0]?.[0]).toBe(0); + expect(spans.at(-1)?.[1]).toBe(70 * SR); + for (let i = 1; i < spans.length; i++) expect(spans[i]?.[0]).toBe(spans[i - 1]?.[1] ?? -1); + for (const [a, b] of spans) expect((b - a) / SR).toBeLessThanOrEqual(30); + }); + + test("a sliver tail merges into the previous span", () => { + // Quiet gap right before the boundary -> cut ~30.75s, 0.25s tail. + const pcm = speechWithGaps(31, [[30.5, 30.8]]); + const spans = planSplits(pcm, SR, 30.8); + expect(spans).toHaveLength(1); + expect(spans[0]).toEqual([0, 31 * SR]); + }); +}); + +describe("transcribeLong", () => { + test("short audio goes straight through, cleaned and filtered", async () => { + const { t, calls } = fakeTranscriber(async () => " [BLANK_AUDIO] can you fix the test "); + const wav = pcmToWav(speechWithGaps(5, []), SR); + expect(await transcribeLong(t, wav, opts)).toBe("can you fix the test"); + expect(calls).toHaveLength(1); + expect(calls[0]).toBe(wav); + }); + + test("short hallucination returns empty", async () => { + const { t } = fakeTranscriber(async () => "Thank you."); + expect(await transcribeLong(t, pcmToWav(speechWithGaps(2, []), SR), opts)).toBe(""); + }); + + test("header-only wav throws an actionable error", async () => { + const { t, calls } = fakeTranscriber(async () => "x"); + await expect(transcribeLong(t, pcmToWav(Buffer.alloc(0), SR), opts)).rejects.toThrow( + "Recording is empty", + ); + expect(calls).toHaveLength(0); + }); + + test("long audio is split into valid wav chunks and joined", async () => { + const { t, calls } = fakeTranscriber(async (_w, n) => `part ${n}`); + const wav = pcmToWav(speechWithGaps(70, [[25, 26]]), SR); + expect(await transcribeLong(t, wav, opts)).toBe("part 1 part 2 part 3"); + expect(calls).toHaveLength(3); + const total = calls.reduce((s, c) => s + wavDurationSec(c), 0); + expect(total).toBeCloseTo(70, 5); + for (const c of calls) expect(parseWav(c)?.sampleRate).toBe(SR); + }); + + test("one failing chunk is tolerated and logged", async () => { + const logs: string[] = []; + const logger: Logger = { log: (_s, m) => logs.push(m) }; + const { t } = fakeTranscriber(async (_w, n) => { + if (n === 2) throw new Error("whisper-cli failed: boom"); + return n === 3 ? "Thank you." : `part ${n}`; + }); + const wav = pcmToWav(speechWithGaps(70, []), SR); + expect(await transcribeLong(t, wav, opts, { logger })).toBe("part 1"); + expect(logs.some((l) => l.includes("chunk 2/3 failed"))).toBe(true); + expect(logs.some((l) => l.includes("kept 1/3"))).toBe(true); + }); + + test("all chunks failing throws with the first error", async () => { + const { t } = fakeTranscriber(async (_w, n) => { + throw new Error(`fail ${n}`); + }); + const wav = pcmToWav(speechWithGaps(65, []), SR); + await expect(transcribeLong(t, wav, opts)).rejects.toThrow( + "Transcription failed for all 3 parts: fail 1", + ); + }); + + test("all chunks empty is not an error", async () => { + const { t } = fakeTranscriber(async () => ""); + expect(await transcribeLong(t, pcmToWav(speechWithGaps(65, []), SR), opts)).toBe(""); + }); + + test("abort stops at once and rethrows", async () => { + const ctl = new AbortController(); + const { t, calls } = fakeTranscriber(async () => { + ctl.abort(); + throw abortError(); + }); + const wav = pcmToWav(speechWithGaps(70, []), SR); + const err = await transcribeLong(t, wav, { language: "en", signal: ctl.signal }).catch( + (e: unknown) => e, + ); + expect(isAbortError(err)).toBe(true); + expect(calls).toHaveLength(1); + }); + + test("custom maxChunkSec", async () => { + const { t, calls } = fakeTranscriber(async () => "x"); + await transcribeLong(t, pcmToWav(speechWithGaps(20, []), SR), opts, { maxChunkSec: 10 }); + expect(calls).toHaveLength(2); + }); +}); diff --git a/src/stt/long.ts b/src/stt/long.ts new file mode 100644 index 0000000..0539950 --- /dev/null +++ b/src/stt/long.ts @@ -0,0 +1,209 @@ +// Long batch recordings: split PCM at quiet points, transcribe each chunk, +// keep the survivors. One bad chunk costs only itself. + +import type { Logger, TranscribeOptions, Transcriber } from "../types.ts"; +import { errorMessage, isAbortError } from "../types.ts"; +import { cleanTranscript, isLikelyHallucination } from "./filter.ts"; + +// ---------------------------------------------------------------- wav helpers +// Private minimal WAV parse/write (src/audio/wav.ts is owned elsewhere). + +export interface WavInfo { + readonly sampleRate: number; + readonly channels: number; + readonly bitsPerSample: number; + readonly dataOffset: number; + readonly dataLength: number; +} + +/** Parse a RIFF/WAVE header by walking chunks. Returns null when not a WAV. */ +export function parseWav(wav: Buffer): WavInfo | null { + if (wav.length < 12) return null; + if (wav.toString("ascii", 0, 4) !== "RIFF" || wav.toString("ascii", 8, 12) !== "WAVE") { + return null; + } + let sampleRate = 0; + let channels = 0; + let bitsPerSample = 0; + let off = 12; + while (off + 8 <= wav.length) { + const id = wav.toString("ascii", off, off + 4); + const size = wav.readUInt32LE(off + 4); + const body = off + 8; + if (id === "fmt " && body + 16 <= wav.length) { + channels = wav.readUInt16LE(body + 2); + sampleRate = wav.readUInt32LE(body + 4); + bitsPerSample = wav.readUInt16LE(body + 14); + } else if (id === "data") { + if (!(sampleRate > 0)) return null; + // Streaming writers leave 0 / 0xFFFFFFFF: clamp to what is present. + const dataLength = Math.min(size, wav.length - body); + return { sampleRate, channels, bitsPerSample, dataOffset: body, dataLength }; + } + off = body + size + (size % 2); + } + return null; +} + +/** Duration in seconds; 0 when unparseable. */ +export function wavDurationSec(wav: Buffer): number { + const info = parseWav(wav); + if (!info) return 0; + const bytesPerSec = info.sampleRate * info.channels * (info.bitsPerSample / 8); + return bytesPerSec > 0 ? info.dataLength / bytesPerSec : 0; +} + +/** Wrap s16le mono PCM in a 44-byte WAV header. */ +export function pcmToWav(pcm: Buffer, sampleRate: number): Buffer { + const h = Buffer.alloc(44); + h.write("RIFF", 0, "ascii"); + h.writeUInt32LE(36 + pcm.length, 4); + h.write("WAVE", 8, "ascii"); + h.write("fmt ", 12, "ascii"); + h.writeUInt32LE(16, 16); + h.writeUInt16LE(1, 20); + h.writeUInt16LE(1, 22); + h.writeUInt32LE(sampleRate, 24); + h.writeUInt32LE(sampleRate * 2, 28); + h.writeUInt16LE(2, 32); + h.writeUInt16LE(16, 34); + h.write("data", 36, "ascii"); + h.writeUInt32LE(pcm.length, 40); + return Buffer.concat([h, pcm]); +} + +export function abortError(): Error { + const err = new Error("Transcription aborted"); + err.name = "AbortError"; + return err; +} + +// ---------------------------------------------------------------- planning + +const FRAME_SEC = 0.3; +const STEP_SEC = 0.05; +const SEARCH_SEC = 10; +const MIN_TAIL_SEC = 0.5; + +function rms(pcm: Buffer, startSample: number, count: number): number { + let sum = 0; + for (let i = 0; i < count; i++) { + const v = pcm.readInt16LE((startSample + i) * 2); + sum += v * v; + } + return count > 0 ? Math.sqrt(sum / count) : 0; +} + +/** + * Cut sample ranges of at most ~maxSec, each cut at the centre of the quietest + * 300ms frame in the last SEARCH_SEC (or second half) before the boundary. + * Returns [start, end) sample indices covering the whole buffer. + */ +export function planSplits( + pcm: Buffer, + sampleRate: number, + maxSec: number, +): Array<[number, number]> { + const total = Math.floor(pcm.length / 2); + const maxS = Math.max(1, Math.floor(maxSec * sampleRate)); + const frame = Math.max(1, Math.floor(FRAME_SEC * sampleRate)); + const step = Math.max(1, Math.floor(STEP_SEC * sampleRate)); + const searchS = Math.floor(SEARCH_SEC * sampleRate); + const spans: Array<[number, number]> = []; + let at = 0; + while (total - at > maxS) { + const target = at + maxS; + const winStart = Math.max(at + Math.floor(maxS / 2), target - searchS); + let bestCut = target; + let bestRms = Infinity; + // Scan backward from the boundary; an earlier frame must be clearly + // (10%) quieter to win, so uniform audio cuts near the max length + // instead of drifting early and multiplying chunks. + for (let s = target - frame; s >= winStart; s -= step) { + const r = rms(pcm, s, frame); + if (r < bestRms * 0.9) { + bestRms = r; + bestCut = s + Math.floor(frame / 2); + } + } + spans.push([at, bestCut]); + at = bestCut; + } + spans.push([at, total]); + // A sliver of a tail joins the previous chunk instead of going alone. + const last = spans[spans.length - 1]; + const prev = spans[spans.length - 2]; + if (last && prev && last[1] - last[0] < MIN_TAIL_SEC * sampleRate) { + prev[1] = last[1]; + spans.pop(); + } + return spans; +} + +// ---------------------------------------------------------------- transcribe + +export interface LongConfig { + /** Max seconds per chunk (default 30). */ + readonly maxChunkSec?: number; + readonly logger?: Logger; +} + +function filtered(text: string): string { + const cleaned = cleanTranscript(text); + return isLikelyHallucination(cleaned) ? "" : cleaned; +} + +/** + * Transcribe a WAV of any length. Output is cleaned and hallucination- + * filtered ("" = no speech). Long audio is split at quiet points and chunks + * run sequentially; a failing chunk is logged and skipped. Throws only when + * every chunk fails, on abort, or when the recording holds no samples. + */ +export async function transcribeLong( + t: Transcriber, + wav: Buffer, + opts: TranscribeOptions, + cfg: LongConfig = {}, +): Promise { + const maxSec = cfg.maxChunkSec ?? 30; + const log = (msg: string, level: "debug" | "warn" = "debug"): void => + cfg.logger?.log("STT", msg, level); + const info = parseWav(wav); + if (info && info.dataLength === 0) { + throw new Error("Recording is empty — no audio was captured; check the microphone"); + } + const durSec = wavDurationSec(wav); + if (!info || info.channels !== 1 || info.bitsPerSample !== 16 || durSec <= maxSec) { + return filtered(await t.transcribe(wav, opts)); + } + + const pcm = wav.subarray(info.dataOffset, info.dataOffset + info.dataLength); + const spans = planSplits(pcm, info.sampleRate, maxSec); + log(`long turn ${durSec.toFixed(0)}s split into ${spans.length} chunks`); + const parts: string[] = []; + let failures = 0; + let firstError: unknown = null; + for (let i = 0; i < spans.length; i++) { + if (opts.signal?.aborted) throw abortError(); + const span = spans[i]; + if (!span) continue; + const chunk = pcmToWav(pcm.subarray(span[0] * 2, span[1] * 2), info.sampleRate); + try { + const text = filtered(await t.transcribe(chunk, opts)); + if (text) parts.push(text); + else log(`chunk ${i + 1}/${spans.length} empty or hallucination, dropped`); + } catch (err) { + if (isAbortError(err) || opts.signal?.aborted) throw err; + failures += 1; + firstError ??= err; + log(`chunk ${i + 1}/${spans.length} failed: ${errorMessage(err)}`, "warn"); + } + } + log(`chunked transcription kept ${parts.length}/${spans.length} chunks`); + if (failures === spans.length) { + throw new Error( + `Transcription failed for all ${spans.length} parts: ${errorMessage(firstError)}`, + ); + } + return parts.join(" "); +} diff --git a/src/stt/session.test.ts b/src/stt/session.test.ts new file mode 100644 index 0000000..cdef30a --- /dev/null +++ b/src/stt/session.test.ts @@ -0,0 +1,521 @@ +import { describe, expect, test } from "bun:test"; +import { createSettings, memoryKv, parseOptions } from "../config.ts"; +import { pcmRms, wrapPcm } from "../audio/wav.ts"; +import { + fakeLlm, + fakeMic, + fakeTextarea, + fakeTranscriber, + flush, + manualClock, + pcm, + type FakeMic, +} from "../testing/fakes.ts"; +import type { MicError, StreamingPartial } from "../types.ts"; +import { createSttMachine, type StreamingFactoryInput, type StreamingHandle } from "./session.ts"; + +interface FakeStream extends Omit { + paused: boolean; + input: StreamingFactoryInput; + finishWith: string | Error; + silence: number; + cancelled: number; + emit(p: StreamingPartial): void; +} + +function harness( + o: { + mode?: "batch" | "streaming"; + autoSubmit?: boolean; + autoEnd?: boolean; + normalize?: "off" | "batch" | "all"; + llm?: ReturnType; + results?: Array>; + field?: ReturnType | null; + micFails?: MicError; + options?: Record; + } = {}, +) { + const options = parseOptions({ + sttMode: o.mode ?? "batch", + sttAutoSubmit: o.autoSubmit ?? false, + ...o.options, + }); + const settings = createSettings(memoryKv(), options); + if (o.autoEnd) settings.setAutoEnd(true); + settings.setNormalize(o.normalize ?? "batch"); + const clock = manualClock(); + const toasts: Array<{ m: string; v: string }> = []; + const alerts: Array<{ t: string; m: string }> = []; + const prompts: string[] = []; + const field = o.field === undefined ? fakeTextarea("") : o.field; + const mics: FakeMic[] = []; + const streams: FakeStream[] = []; + const t = fakeTranscriber(o.results ?? ["hello world"]); + const llm = o.llm ?? fakeLlm("Hello world."); + let recordingStarts = 0; + const machine = createSttMachine({ + host: { + focused: () => field, + toast: (m, v = "info") => void toasts.push({ m, v }), + promptSession: async (text) => void prompts.push(text), + alert: (title, m) => void alerts.push({ t: title, m }), + currentSessionID: () => "ses_1", + anySessionID: () => "ses_1", + sessionTitle: () => "Fix tests", + recentTurns: () => "user: hi", + }, + settings, + options, + logger: { log() {} }, + openMic: async () => { + if (o.micFails) throw Object.assign(new Error(o.micFails.message), o.micFails); + const m = fakeMic(); + mics.push(m); + return m; + }, + transcriber: () => t, + transcribeFile: (tr, wav, opts) => tr.transcribe(wav, opts), + createStreaming: (input) => { + const s: FakeStream = { + input, + finishWith: "final text", + silence: 0, + cancelled: 0, + paused: false, + start() {}, + pause() { + s.paused = true; + }, + resume() { + s.paused = false; + }, + level: () => 0.1, + silenceMs: () => s.silence, + async finish() { + if (s.finishWith instanceof Error) throw s.finishWith; + return s.finishWith; + }, + cancel() { + s.cancelled += 1; + }, + emit(p) { + input.onPartial(p); + }, + }; + streams.push(s); + return s as StreamingHandle; + }, + wrapPcm, + pcmRms, + cleanTranscript: (x) => x.trim(), + isHallucination: (x) => x === "you", + llm, + prompts: { + normalize: "NORM", + correction: "FIX", + buildSttUser: (raw) => `RAW:${raw}`, + buildCorrectionUser: (cur, spoken) => `CUR:${cur}|SPOKEN:${spoken}`, + needsContext: () => false, + cleanOutput: (_raw, out) => out, + }, + onRecordingStart: () => void (recordingStarts += 1), + clock, + }); + return { + machine, + settings, + clock, + toasts, + alerts, + prompts, + field, + mics, + streams, + t, + llm, + recordingStarts: () => recordingStarts, + }; +} + +describe("batch dictation", () => { + test("speak → done → transcribe → normalize → insert, then idle", async () => { + const h = harness(); + h.machine.toggle(); + expect(h.machine.view().phase.kind).toBe("starting"); + await flush(); + expect(h.machine.view().phase.kind).toBe("recording"); + expect(h.recordingStarts()).toBe(1); + h.mics[0]?.push(pcm(1000)); + h.machine.toggle(); + expect(h.machine.view().phase.kind).toBe("transcribing"); + await flush(); + expect(h.field?.plainText).toBe("Hello world."); + expect(h.machine.view().phase.kind).toBe("idle"); + expect(h.machine.view().last?.kind).toBe("ok"); + expect(h.llm.requests[0]?.user).toBe("RAW:hello world"); + }); + + test("auto-submit submits the focused field", async () => { + const h = harness({ autoSubmit: true }); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.toggle(); + await flush(); + expect(h.field?.submits).toBe(1); + expect(h.machine.view().last?.message).toBe("Sent"); + }); + + test("silence is reported as no speech, never transcribed", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(2000, 0)); + h.machine.toggle(); + await flush(); + expect(h.t.calls).toBe(0); + expect(h.machine.view().last?.message).toBe("No speech detected"); + expect(h.machine.view().phase.kind).toBe("idle"); + }); + + test("auto-end finishes after 2.5s of silence following speech", async () => { + const h = harness({ autoEnd: true }); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(800)); + h.mics[0]?.push(pcm(200, 0)); + h.clock.advance(2400); + expect(h.machine.view().phase.kind).toBe("recording"); + h.clock.advance(400); + expect(h.machine.view().phase.kind).toBe("transcribing"); + await flush(); + expect(h.field?.plainText).toBe("Hello world."); + }); + + test("normalize failure inserts the raw text with a warning", async () => { + const h = harness({ llm: fakeLlm(new Error("HTTP 500")) }); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.toggle(); + await flush(); + expect(h.field?.plainText).toBe("hello world"); + expect(h.machine.view().last?.kind).toBe("warning"); + }); + + test("normalize off skips the LLM", async () => { + const h = harness({ normalize: "off" }); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.toggle(); + await flush(); + expect(h.llm.requests.length).toBe(0); + expect(h.field?.plainText).toBe("hello world"); + }); + + test("hallucination is dropped", async () => { + const h = harness({ results: ["you"] }); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.toggle(); + await flush(); + expect(h.field?.plainText).toBe(""); + expect(h.machine.view().last?.message).toBe("No speech detected"); + }); + + test("cancel during transcription drops the late result and frees the machine", async () => { + let release: (v: string) => void = () => {}; + const h = harness({ results: [new Promise((r) => (release = r))] }); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.toggle(); + await flush(); + expect(h.machine.cancel()).toBe(true); + expect(h.machine.view().phase.kind).toBe("idle"); + // A new recording can start immediately. + h.machine.toggle(); + await flush(); + expect(h.machine.view().phase.kind).toBe("recording"); + release("stale words"); + await flush(); + expect(h.field?.plainText).toBe(""); + expect(h.machine.view().phase.kind).toBe("recording"); + }); + + test("mic open failure shows message + hint and returns to idle", async () => { + const h = harness({ + micFails: { code: "CONNECTION", message: "Phone not reachable", hint: "run adb forward" }, + }); + h.machine.toggle(); + await flush(); + expect(h.machine.view().phase.kind).toBe("idle"); + expect(h.toasts.at(-1)?.m).toBe("Phone not reachable — run adb forward"); + expect(h.toasts.at(-1)?.v).toBe("error"); + }); + + test("mic dying mid-recording still transcribes what was captured", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(1500)); + h.mics[0]?.fail({ code: "EXITED", message: "Capture exited" }); + await flush(); + expect(h.field?.plainText).toBe("Hello world."); + }); + + test("no focused field: auto-submit sends to the session, otherwise a dialog keeps the text", async () => { + const a = harness({ field: null, autoSubmit: true }); + a.machine.toggle(); + await flush(); + a.mics[0]?.push(pcm(1000)); + a.machine.toggle(); + await flush(); + expect(a.prompts).toEqual(["Hello world."]); + + const b = harness({ field: null }); + b.machine.toggle(); + await flush(); + b.mics[0]?.push(pcm(1000)); + b.machine.toggle(); + await flush(); + expect(b.alerts[0]?.m).toBe("Hello world."); + }); + + test("pressing speak while processing does not start a second recording", async () => { + let release: (v: string) => void = () => {}; + const h = harness({ results: [new Promise((r) => (release = r))] }); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.toggle(); + h.machine.toggle(); + await flush(); + expect(h.mics.length).toBe(1); + release("x"); + await flush(); + }); +}); + +describe("streaming dictation", () => { + test("partials are written live and replaced by the final text", async () => { + const h = harness({ mode: "streaming", field: fakeTextarea("note:") }); + h.machine.toggle(); + await flush(); + expect(h.machine.view().phase.kind).toBe("live"); + h.streams[0]?.emit({ stable: "xin", tentative: "chào" }); + expect(h.field?.plainText).toBe("note: xin chào"); + h.machine.toggle(); + await flush(); + expect(h.field?.plainText).toBe("note: final text"); + expect(h.machine.view().phase.kind).toBe("idle"); + expect(h.llm.requests.length).toBe(0); // normalize "batch" skips live + }); + + test("normalize all cleans live dictation too", async () => { + const h = harness({ mode: "streaming", normalize: "all", llm: fakeLlm("Final text.") }); + h.machine.toggle(); + await flush(); + h.machine.toggle(); + await flush(); + expect(h.field?.plainText).toBe("Final text."); + }); + + test("pause toggles and the second speak press on a paused session resumes", async () => { + const h = harness({ mode: "streaming" }); + h.machine.toggle(); + await flush(); + expect(h.machine.pause()).toBe(true); + const p = h.machine.view().phase; + expect(p.kind === "live" && p.paused).toBe(true); + h.machine.toggle(); + const q = h.machine.view().phase; + expect(q.kind === "live" && q.paused).toBe(false); + }); + + test("auto-end never fires while paused", async () => { + const h = harness({ mode: "streaming", autoEnd: true }); + h.machine.toggle(); + await flush(); + h.streams[0]?.emit({ stable: "hello", tentative: "" }); + h.machine.pause(); + if (h.streams[0]) h.streams[0].silence = 10_000; + h.clock.advance(5000); + expect(h.machine.view().phase.kind).toBe("live"); + h.machine.pause(); // resume + h.clock.advance(300); + expect(h.machine.view().phase.kind).toBe("transcribing"); + }); + + test("cancel removes the live text and cancels the session", async () => { + const h = harness({ mode: "streaming", field: fakeTextarea("keep") }); + h.machine.toggle(); + await flush(); + h.streams[0]?.emit({ stable: "some words", tentative: "" }); + h.machine.cancel(); + expect(h.field?.plainText).toBe("keep"); + expect(h.streams[0]?.cancelled).toBe(1); + }); + + test("a streaming error finishes with the audio captured so far", async () => { + const h = harness({ mode: "streaming" }); + h.machine.toggle(); + await flush(); + h.streams[0]?.input.onError(new Error("Phone not reachable")); + await flush(); + expect(h.field?.plainText).toBe("final text"); + expect(h.toasts.some((x) => x.v === "warning" && x.m.includes("Phone not reachable"))).toBe( + true, + ); + }); + + test("user edit during dictation keeps both texts, no duplicate insert", async () => { + const field = fakeTextarea(""); + const h = harness({ mode: "streaming", field }); + h.machine.toggle(); + await flush(); + h.streams[0]?.emit({ stable: "hello", tentative: "" }); + field.insertText(" mine"); + h.streams[0]?.emit({ stable: "hello there", tentative: "" }); + h.machine.toggle(); + await flush(); + expect(field.plainText).toBe("hello mine"); + }); +}); + +describe("correction (Fix)", () => { + test("merges the spoken correction into the current text with the LLM", async () => { + const field = fakeTextarea("please fit the test"); + const h = harness({ field, results: ["fix not fit"], llm: fakeLlm("please fix the test") }); + h.machine.correct(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.correct(); + await flush(); + expect(h.llm.requests[0]?.user).toBe("CUR:please fit the test|SPOKEN:fix not fit"); + expect(field.plainText).toBe("please fix the test"); + expect(field.submits).toBe(0); // corrections never submit + }); + + test("LLM failure leaves the text unchanged", async () => { + const field = fakeTextarea("please fit the test"); + const h = harness({ field, results: ["fix"], llm: fakeLlm(new Error("timeout")) }); + h.machine.correct(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.correct(); + await flush(); + expect(field.plainText).toBe("please fit the test"); + expect(h.machine.view().last?.kind).toBe("error"); + }); + + test("empty field: the correction is just inserted", async () => { + const field = fakeTextarea(""); + const h = harness({ field, results: ["new text"] }); + h.machine.correct(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.correct(); + await flush(); + expect(field.plainText).toBe("new text"); + }); + + test("Fix while dictating is refused with a hint (no stuck state)", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.machine.correct(); + expect(h.toasts.at(-1)?.m).toContain("Finish the current recording"); + h.machine.cancel(); + h.machine.correct(); + await flush(); + expect(h.machine.view().phase.kind).toBe("recording"); + }); +}); + +test("phone mic without sttCaptureCmd fails fast with a hint", async () => { + const h = harness(); + h.settings.setMic("remote"); + h.machine.toggle(); + await flush(); + expect(h.machine.view().phase.kind).toBe("idle"); + expect(h.toasts.at(-1)?.m).toContain("sttCaptureCmd"); +}); + +test("Done on a paused live session finishes instead of resuming", async () => { + const h = harness({ mode: "streaming" }); + h.machine.toggle(); + await flush(); + h.machine.pause(); + h.machine.finish(); + expect(h.machine.view().phase.kind).toBe("transcribing"); + await flush(); + expect(h.field?.plainText).toBe("final text"); +}); + +test("auto-submit without a focused field frees the machine before the prompt resolves", async () => { + const h = harness({ field: null, autoSubmit: true }); + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.toggle(); + await flush(); + expect(h.machine.view().phase.kind).toBe("idle"); + expect(h.prompts).toEqual(["Hello world."]); +}); + +test("composer destroyed mid-dictation: transcript is not lost", async () => { + const field = fakeTextarea(""); + const h = harness({ mode: "streaming", field }); + h.machine.toggle(); + await flush(); + h.streams[0]?.emit({ stable: "hello", tentative: "" }); + (field as unknown as { isDestroyed: boolean }).isDestroyed = true; + h.machine.toggle(); + await flush(); + // host.focused() still returns the (destroyed) fake; real host filters it. + expect(h.machine.view().last?.message).not.toBe("Kept live text"); +}); + +test("whisper never receives the LLM system prompt override", async () => { + const h = harness({ options: { sttPrompt: "LONG SYSTEM PROMPT" } }); + let seenPrompt: string | undefined = "unset"; + const orig = h.t.transcribe.bind(h.t); + h.t.transcribe = (wav, opts) => { + seenPrompt = opts.prompt; + return orig(wav, opts); + }; + h.machine.toggle(); + await flush(); + h.mics[0]?.push(pcm(1000)); + h.machine.toggle(); + await flush(); + expect(seenPrompt).toBeUndefined(); +}); + +test("auto-end works on a noisy mic: silence is judged against the mic's noise floor", async () => { + const h = harness({ autoEnd: true }); + h.machine.toggle(); + await flush(); + const m = h.mics[0]; + // Phone-like mic: background noise ~0.02 (above the laptop speech threshold). + for (let i = 0; i < 10; i++) m?.push(pcm(100, 650)); + m?.push(pcm(800, 6000)); // speech + for (let i = 0; i < 4; i++) m?.push(pcm(100, 650)); // back to background noise + h.clock.advance(2400); + expect(h.machine.view().phase.kind).toBe("recording"); + h.clock.advance(400); + expect(h.machine.view().phase.kind).toBe("transcribing"); +}); + +test("noise alone never counts as speech, so it never auto-submits", async () => { + const h = harness({ autoEnd: true }); + h.machine.toggle(); + await flush(); + for (let i = 0; i < 30; i++) h.mics[0]?.push(pcm(100, 650)); + h.clock.advance(6000); + expect(h.machine.view().phase.kind).toBe("recording"); +}); diff --git a/src/stt/session.ts b/src/stt/session.ts new file mode 100644 index 0000000..7a54b62 --- /dev/null +++ b/src/stt/session.ts @@ -0,0 +1,739 @@ +// STT state machine: one owner for batch dictation, streaming dictation and +// correction (Fix). Every operation gets an id; any async step that finishes +// after a newer operation (or a cancel) started is ignored. Every path ends +// in `idle` with a visible result, so nothing can stay stuck "busy". +import type { FocusedTextarea, Host } from "../host.ts"; +import type { Options, Settings, SttMode } from "../config.ts"; +import type { + Llm, + Logger, + MicConfig, + MicError, + MicStream, + SttLanguage, + StreamingPartial, + TranscribeOptions, + Transcriber, +} from "../types.ts"; +import { errorMessage, isAbortError } from "../types.ts"; +import { createLiveSpan, insertAtCursor, replaceAll, type LiveSpan } from "./editor.ts"; + +export type Purpose = "dictate" | "correct"; + +export type SttPhase = + | { readonly kind: "idle" } + | { + readonly kind: "starting"; + readonly purpose: Purpose; + readonly mode: SttMode; + readonly since: number; + } + | { readonly kind: "recording"; readonly purpose: Purpose; readonly since: number } + | { + readonly kind: "live"; + readonly purpose: Purpose; + readonly since: number; + readonly paused: boolean; + } + | { readonly kind: "transcribing"; readonly purpose: Purpose; readonly since: number } + | { readonly kind: "normalizing"; readonly purpose: Purpose; readonly since: number }; + +export type ResultKind = "ok" | "empty" | "warning" | "error" | "cancelled"; + +export interface SttResult { + readonly kind: ResultKind; + readonly message: string; + readonly at: number; +} + +export interface SttView { + readonly phase: SttPhase; + /** 0..1 input level for the meter. */ + readonly level: number; + /** Live transcript when it cannot be shown in a text field. */ + readonly partial: string; + readonly micLabel: string; + readonly last: SttResult | null; +} + +/** Subset of the streaming session (src/stt/streaming.ts) the machine uses. */ +export interface StreamingHandle { + start(): void; + pause(): void; + resume(): void; + readonly paused: boolean; + level(): number; + silenceMs(): number; + finish(): Promise; + cancel(): void; +} + +export interface StreamingFactoryInput { + mic: MicStream; + transcriber: Transcriber; + language: SttLanguage; + onPartial(p: StreamingPartial): void; + onError(err: Error): void; +} + +export interface SttDeps { + host: Pick< + Host, + | "focused" + | "toast" + | "promptSession" + | "alert" + | "currentSessionID" + | "anySessionID" + | "sessionTitle" + | "recentTurns" + >; + settings: Settings; + options: Options; + logger: Logger; + openMic(cfg: MicConfig): Promise; + transcriber(): Transcriber; + transcribeFile(t: Transcriber, wav: Buffer, opts: TranscribeOptions): Promise; + createStreaming(input: StreamingFactoryInput): StreamingHandle; + wrapPcm(pcm: Buffer, sampleRate: number): Buffer; + pcmRms(pcm: Buffer): number; + cleanTranscript(text: string): string; + isHallucination(text: string): boolean; + llm: Llm; + prompts: { + normalize: string; + correction: string; + buildSttUser(raw: string, ctx: { sessionTitle?: string; recent?: string }): string; + buildCorrectionUser( + current: string, + spoken: string, + ctx?: { sessionTitle?: string; recent?: string }, + ): string; + needsContext(raw: string): boolean; + cleanOutput(raw: string, out: string): string; + }; + /** Override where audio comes from (e.g. a voice node decides the device). */ + micConfig?: () => MicConfig | string | undefined; + /** Override the mic name shown while opening ("Phone", "Mac"...). */ + micLabel?: () => string | undefined; + /** Called when the mic opens (e.g. pause TTS so the mic does not hear it). */ + onRecordingStart?(): void; + clock?: { + now(): number; + setInterval(fn: () => void, ms: number): unknown; + clearInterval(h: unknown): void; + }; +} + +export interface SttMachine { + /** Speak button: start, or finish the current recording. */ + toggle(): void; + /** Fix button: start a correction, or finish it. */ + correct(): void; + /** Done button: finish the current recording (even when paused). */ + finish(): void; + /** Pause/resume live (streaming) dictation. False when not applicable. */ + pause(): boolean; + /** Cancel whatever is in flight. False when idle. */ + cancel(): boolean; + view(): SttView; + isBusy(): boolean; + onChange(cb: () => void): () => void; + dispose(): void; +} + +export const AUTO_END_SILENCE_MS = 2500; +/** Minimum level counted as speech on a quiet mic. */ +const VOICE_RMS = 0.012; +const MIN_AUDIO_SEC = 0.4; +const MAX_BATCH_SEC = 600; +const NORMALIZE_TIMEOUT_MS = 20_000; +const MERGE_TIMEOUT_MS = 30_000; + +export function createSttMachine(deps: SttDeps): SttMachine { + const clock = deps.clock ?? { + now: () => Date.now(), + setInterval: (fn: () => void, ms: number) => setInterval(fn, ms), + clearInterval: (h: unknown) => clearInterval(h as ReturnType), + }; + const { host, settings, options, logger } = deps; + + let phase: SttPhase = { kind: "idle" }; + let last: SttResult | null = null; + let op = 0; + let disposed = false; + const listeners = new Set<() => void>(); + + // Per-operation resources (reset by end()). + let mic: MicStream | null = null; + let stream: StreamingHandle | null = null; + let span: LiveSpan | null = null; + let abort: AbortController | null = null; + let chunks: Buffer[] = []; + let bytes = 0; + let level = 0; + let partial = ""; + let heardVoice = false; + let silentSince = 0; + /** Background noise of this mic (slow-rising minimum of chunk levels). */ + let noiseFloor = Number.POSITIVE_INFINITY; + let ticker: unknown = null; + let target: FocusedTextarea | null = null; + let finishing = false; + let lastInserted = ""; + + const emit = (): void => { + for (const cb of listeners) { + try { + cb(); + } catch {} + } + }; + + const setPhase = (next: SttPhase): void => { + phase = next; + emit(); + }; + + const result = (kind: ResultKind, message: string): void => { + last = { kind, message, at: clock.now() }; + if (kind === "error") host.toast(message, "error", 6000); + else if (kind === "warning") host.toast(message, "warning", 5000); + logger.log("stt", `result ${kind}: ${message.length > 80 ? message.slice(0, 80) : message}`); + }; + + const gatewaySession = (): string | null => host.anySessionID(); + + const micLabel = (): string => { + const override = deps.micLabel?.(); + if (override !== undefined) return override; + const m = settings.mic(); + return m === "remote" ? "phone" : m || "mac"; + }; + + function micConfig(): MicConfig | string { + const override = deps.micConfig?.(); + if (override !== undefined) return override; + const m = settings.mic(); + if (m === "remote") { + if (!options.sttCaptureCmd) + return "Phone mic selected but sttCaptureCmd is not configured — pick a mic with /stt-mic"; + return { + kind: "remote", + command: options.sttCaptureCmd, + sampleRate: options.audioSampleRate, + usbAutoForward: true, + }; + } + return { kind: "local", sampleRate: options.audioSampleRate, ...(m ? { device: m } : {}) }; + } + + function stopTicker(): void { + if (ticker !== null) clock.clearInterval(ticker); + ticker = null; + } + + /** Tear down per-operation resources and go idle. */ + function end(): void { + stopTicker(); + try { + mic?.kill(); + } catch {} + mic = null; + stream = null; + span = null; + abort = null; + chunks = []; + bytes = 0; + level = 0; + partial = ""; + heardVoice = false; + silentSince = 0; + noiseFloor = Number.POSITIVE_INFINITY; + target = null; + finishing = false; + setPhase({ kind: "idle" }); + } + + const purposeOf = (): Purpose => ("purpose" in phase ? phase.purpose : "dictate"); + + // ------------------------------------------------------------- start + + function start(purpose: Purpose): void { + if (disposed) return; + const cfg = micConfig(); + if (typeof cfg === "string") { + result("error", cfg); + emit(); + return; + } + const mode = settings.sttMode(); + const myOp = ++op; + abort = new AbortController(); + target = host.focused(); + setPhase({ kind: "starting", purpose, mode, since: clock.now() }); + try { + deps.onRecordingStart?.(); + } catch {} + logger.log("stt", `start purpose=${purpose} mode=${mode} mic=${cfg.kind}`); + + let transcriber: Transcriber; + try { + transcriber = deps.transcriber(); + } catch (err) { + end(); + result("error", errorMessage(err)); + return; + } + // Warm the engine while the mic opens so the first result is fast. + void transcriber.warm().catch((err: unknown) => { + logger.log("stt", `warm failed: ${errorMessage(err)}`, "warn"); + }); + + deps.openMic(cfg).then( + (m) => { + if (myOp !== op || disposed) { + m.kill(); + return; + } + mic = m; + m.onError((e) => onMicError(myOp, e)); + if (mode === "streaming") beginLive(myOp, purpose, m, transcriber); + else beginBatch(myOp, purpose, m); + }, + (err: unknown) => { + if (myOp !== op) return; + end(); + const e = err as Partial; + result( + "error", + e?.hint ? `${e.message ?? "Mic failed"} — ${e.hint}` : `Mic failed: ${errorMessage(err)}`, + ); + }, + ); + } + + /** + * Speech vs silence relative to this mic's own noise floor: phone and + * remote mics sit far above a laptop mic's noise, so a fixed threshold + * never sees "silence" there (auto-finish then never fires). + */ + function trackSilence(rms: number): void { + const now = clock.now(); + // Follow drops at once, rise slowly (so speech does not lift the floor). + noiseFloor = rms < noiseFloor ? rms : noiseFloor + (rms - noiseFloor) * 0.002; + // Capped: if the very first chunk is already speech, the "floor" is speech. + const floor = Number.isFinite(noiseFloor) ? Math.min(noiseFloor, VOICE_RMS * 2) : 0; + const voice = Math.max(VOICE_RMS, floor * 3); + const quiet = Math.max(VOICE_RMS * 0.75, floor * 1.8); + if (rms >= voice) { + heardVoice = true; + silentSince = 0; + } else if (rms < quiet && heardVoice && !silentSince) { + silentSince = now; + } + // In between quiet and voice: neither; the silence clock keeps its state. + } + + function beginBatch(myOp: number, purpose: Purpose, m: MicStream): void { + chunks = []; + bytes = 0; + m.onData((chunk) => { + if (myOp !== op) return; + chunks.push(chunk); + bytes += chunk.length; + level = deps.pcmRms(chunk); + trackSilence(level); + }); + setPhase({ kind: "recording", purpose, since: clock.now() }); + ticker = clock.setInterval(() => { + if (myOp !== op || phase.kind !== "recording") return; + const sec = bytes / 2 / m.format.sampleRate; + if (sec >= MAX_BATCH_SEC) { + result("warning", "Recording reached 10 minutes — transcribing"); + finish(); + return; + } + if (settings.autoEnd() && silentSince && clock.now() - silentSince >= AUTO_END_SILENCE_MS) { + logger.log("stt", "auto-end (batch)"); + finish(); + return; + } + emit(); // timer + level meter + }, 200); + } + + function beginLive(myOp: number, purpose: Purpose, m: MicStream, transcriber: Transcriber): void { + span = target + ? createLiveSpan(target, (why) => logger.log("stt", `live span detached: ${why}`, "warn")) + : null; + const s = deps.createStreaming({ + mic: m, + transcriber, + language: settings.language(), + onPartial: (p) => { + if (myOp !== op || finishing) return; + const text = `${p.stable} ${p.tentative}`.replace(/\s+/g, " ").trim(); + partial = text; + // Corrections are merged at the end; only dictation writes live. + if (purpose === "dictate" && span && !span.detached) span.set(text); + emit(); + }, + onError: (err) => { + if (myOp !== op || finishing) return; + result("warning", `${errorMessage(err)} — finishing with the audio captured so far`); + finish(); + }, + }); + stream = s; + s.start(); + setPhase({ kind: "live", purpose, since: clock.now(), paused: false }); + ticker = clock.setInterval(() => { + if (myOp !== op || phase.kind !== "live") return; + level = s.paused ? 0 : s.level(); + if (settings.autoEnd() && !s.paused && partial && s.silenceMs() >= AUTO_END_SILENCE_MS) { + logger.log("stt", "auto-end (streaming)"); + finish(); + return; + } + emit(); + }, 200); + } + + function onMicError(myOp: number, e: MicError): void { + if (myOp !== op || finishing) return; + const msg = e.hint ? `${e.message} — ${e.hint}` : e.message; + if (phase.kind === "recording") { + const sec = bytes / 2 / options.audioSampleRate; + if (sec >= 1) { + result("warning", `${msg}. Transcribing the ${sec.toFixed(0)}s captured`); + finish(); + } else { + end(); + result("error", msg); + } + } + // Streaming: the session reports mic errors through onError. + } + + // ------------------------------------------------------------ finish + + function finish(): void { + if (finishing) return; + if (phase.kind !== "recording" && phase.kind !== "live") return; + finishing = true; + const myOp = op; + const purpose = phase.purpose; + const since = clock.now(); + stopTicker(); + level = 0; + setPhase({ kind: "transcribing", purpose, since }); + if (stream) void finishLive(myOp, purpose, stream); + else void finishBatch(myOp, purpose); + } + + async function finishBatch(myOp: number, purpose: Purpose): Promise { + const m = mic; + try { + await m?.stop(); + } catch {} + if (myOp !== op) return; + mic = null; + const pcm = Buffer.concat(chunks); + chunks = []; + const sec = pcm.length / 2 / options.audioSampleRate; + if (sec < MIN_AUDIO_SEC || !heardVoice) { + end(); + result("empty", sec < MIN_AUDIO_SEC ? "Recording too short" : "No speech detected"); + return; + } + let raw: string; + try { + const wav = deps.wrapPcm(pcm, options.audioSampleRate); + raw = await deps.transcribeFile(deps.transcriber(), wav, { + language: settings.language(), + signal: abort?.signal ?? new AbortController().signal, + }); + } catch (err) { + if (myOp !== op) return; + end(); + if (isAbortError(err)) result("cancelled", "Cancelled"); + else result("error", `Transcription failed: ${errorMessage(err)}`); + return; + } + if (myOp !== op) return; + await deliver(myOp, purpose, raw, settings.normalize() !== "off"); + } + + async function finishLive(myOp: number, purpose: Purpose, s: StreamingHandle): Promise { + let raw = ""; + try { + raw = await s.finish(); + } catch (err) { + if (myOp !== op) return; + raw = partial; + logger.log("stt", `stream finish failed: ${errorMessage(err)}`, "warn"); + } + if (myOp !== op) return; + mic = null; + await deliver(myOp, purpose, raw, settings.normalize() === "all"); + } + + // ----------------------------------------------------------- deliver + + async function deliver( + myOp: number, + purpose: Purpose, + rawIn: string, + normalize: boolean, + ): Promise { + const raw = deps.cleanTranscript(rawIn); + if (!raw || deps.isHallucination(raw)) { + span?.remove(); + end(); + result("empty", "No speech detected"); + return; + } + const sessionID = host.currentSessionID(); + + if (purpose === "correct") { + await deliverCorrection(myOp, raw, sessionID); + return; + } + + let text = raw; + let note = ""; + if (normalize && deps.llm.configured) { + setPhase({ kind: "normalizing", purpose, since: clock.now() }); + try { + const context = + deps.prompts.needsContext(raw) && sessionID + ? { + ...(host.sessionTitle(sessionID) + ? { sessionTitle: host.sessionTitle(sessionID) as string } + : {}), + recent: host.recentTurns(sessionID), + } + : {}; + text = await deps.llm.complete({ + system: deps.prompts.normalize, + user: deps.prompts.buildSttUser(raw, context), + maxTokens: 2048, + signal: anySignal(abort?.signal, NORMALIZE_TIMEOUT_MS), + ...(gatewaySession() ? { sessionID: gatewaySession() as string } : {}), + }); + text = deps.prompts.cleanOutput(raw, text); + } catch (err) { + if (myOp !== op) return; + if (abort?.signal.aborted) return; // cancel already handled + text = raw; + note = ` (raw: normalize failed — ${errorMessage(err)})`; + logger.log("stt", `normalize failed: ${errorMessage(err)}`, "warn"); + } + if (myOp !== op) return; + } + + const submit = settings.autoSubmit(); + const outcome = await put(text, submit); + if (myOp !== op) return; + lastInserted = text; + end(); + result(note ? "warning" : "ok", `${outcome}${note}`); + } + + /** Write final text to the field (live span, focused field, or fallback). */ + async function put(text: string, submit: boolean): Promise { + let field: FocusedTextarea | null = null; + const targetGone = !target || target.isDestroyed === true; + if (span && !span.detached && span.set(text)) { + field = target; + } else if (span && span.detached && span.written && !targetGone) { + // User edited during dictation: their text and the live words stay. + host.toast( + "You edited the text during dictation — kept the live transcript as is", + "warning", + ); + return "Kept live text"; + } else { + // No live span, or the field it wrote into is gone (navigated away). + field = host.focused(); + if (field) insertAtCursor(field, text); + } + if (field) { + if (submit) { + return field.submit() === false ? "Inserted (submit refused — press Enter)" : "Sent"; + } + return `Inserted ${text.length} chars`; + } + if (submit) { + // A prompt call can resolve only when the agent finishes: send in the + // background so dictation (and auto-read) are free right away. + void host.promptSession(text).catch((err: unknown) => { + host.alert("Voice transcript — not sent", text); + host.toast(`Not sent: ${errorMessage(err)}`, "error", 6000); + }); + return "Sent"; + } + host.alert("Voice transcript — no text field focused", text); + return "No text field focused — transcript shown in a dialog"; + } + + async function deliverCorrection( + myOp: number, + spoken: string, + sessionID: string | null, + ): Promise { + const field = target && !target.isDestroyed ? target : host.focused(); + const current = field?.plainText ?? ""; + if (!field || !current.trim()) { + const outcome = await put(spoken, false); + if (myOp !== op) return; + end(); + result("ok", `${outcome} (nothing to correct)`); + return; + } + if (!deps.llm.configured) { + // No LLM: replace the last dictation when it is still at the end. + if (lastInserted && current.trimEnd().endsWith(lastInserted)) { + const at = current.lastIndexOf(lastInserted); + replaceAll(field, current.slice(0, at) + spoken + current.slice(at + lastInserted.length)); + lastInserted = spoken; + end(); + result("ok", "Replaced the last dictation (no LLM configured for smart merge)"); + } else { + insertAtCursor(field, spoken); + end(); + result( + "warning", + "No LLM configured — correction inserted as text. Pick one with /voice-model", + ); + } + return; + } + setPhase({ kind: "normalizing", purpose: "correct", since: clock.now() }); + let merged: string; + try { + const recent = sessionID ? host.recentTurns(sessionID, 800) : ""; + merged = await deps.llm.complete({ + system: deps.prompts.correction, + user: deps.prompts.buildCorrectionUser(current, spoken, recent ? { recent } : {}), + maxTokens: 4096, + signal: anySignal(abort?.signal, MERGE_TIMEOUT_MS), + ...(gatewaySession() ? { sessionID: gatewaySession() as string } : {}), + }); + } catch (err) { + if (myOp !== op || abort?.signal.aborted) return; + end(); + result("error", `Correction failed: ${errorMessage(err)} — your text is unchanged`); + return; + } + if (myOp !== op) return; + if (field.isDestroyed || field.plainText !== current) { + end(); + host.alert("Voice correction — text changed meanwhile, not applied", merged); + result("warning", "Text changed while correcting — suggestion shown in a dialog"); + return; + } + replaceAll(field, merged); + lastInserted = ""; + end(); + result("ok", "Corrected"); + } + + // ----------------------------------------------------------- public + + return { + toggle() { + switch (phase.kind) { + case "idle": + start("dictate"); + return; + case "starting": + this.cancel(); + return; + case "recording": + case "live": + if (phase.kind === "live" && phase.paused) { + this.pause(); // second press on a paused session resumes it + return; + } + finish(); + return; + case "transcribing": + case "normalizing": + host.toast("Still processing the last recording — press Cancel to drop it", "info", 2500); + return; + } + }, + correct() { + if (phase.kind === "idle") { + start("correct"); + return; + } + if ((phase.kind === "recording" || phase.kind === "live") && phase.purpose === "correct") { + finish(); + return; + } + host.toast("Finish the current recording first, then press Fix", "info", 2500); + }, + finish() { + if (phase.kind === "recording" || phase.kind === "live") finish(); + }, + pause() { + if (phase.kind !== "live" || !stream || finishing) return false; + if (stream.paused) stream.resume(); + else stream.pause(); + level = 0; + setPhase({ ...phase, paused: stream.paused }); + return true; + }, + cancel() { + if (phase.kind === "idle") return false; + const purpose = purposeOf(); + op += 1; + try { + abort?.abort(); + } catch {} + try { + stream?.cancel(); + } catch {} + if (purpose === "dictate") span?.remove(); + end(); + result("cancelled", "Cancelled"); + return true; + }, + view() { + return { + phase, + level, + partial: span && !span.detached ? "" : partial, + micLabel: micLabel(), + last, + }; + }, + isBusy: () => phase.kind !== "idle", + onChange(cb) { + listeners.add(cb); + return () => listeners.delete(cb); + }, + dispose() { + disposed = true; + if (phase.kind !== "idle") { + op += 1; + try { + abort?.abort(); + } catch {} + try { + stream?.cancel(); + } catch {} + end(); + } + listeners.clear(); + }, + }; +} + +function anySignal(signal: AbortSignal | undefined, timeoutMs: number): AbortSignal { + const t = AbortSignal.timeout(timeoutMs); + return signal ? AbortSignal.any([signal, t]) : t; +} diff --git a/src/stt/streaming.test.ts b/src/stt/streaming.test.ts new file mode 100644 index 0000000..069fb2b --- /dev/null +++ b/src/stt/streaming.test.ts @@ -0,0 +1,515 @@ +import { describe, expect, test } from "bun:test"; +import type { + MicError, + MicStream, + StreamingPartial, + TranscribeOptions, + Transcriber, +} from "../types.ts"; +import { createStreamingSession, type StreamingClock } from "./streaming.ts"; +import { normalizeWord, splitWords } from "./transcript.ts"; + +const RATE = 16000; +const BYTES_PER_MS = (RATE * 2) / 1000; + +function flush(): Promise { + return new Promise((resolve) => setImmediate(resolve)); +} + +async function flushAll(): Promise { + for (let i = 0; i < 5; i++) await flush(); +} + +function fakeClock() { + let now = 0; + let seq = 0; + const timers = new Map void }>(); + const clock: StreamingClock = { + now: () => now, + setTimeout(cb, ms) { + seq += 1; + timers.set(seq, { at: now + ms, cb }); + return seq; + }, + clearTimeout(handle) { + if (typeof handle === "number") timers.delete(handle); + }, + }; + return { + clock, + async advance(ms: number): Promise { + const target = now + ms; + for (;;) { + let nextId: number | null = null; + let nextAt = Infinity; + for (const [id, t] of timers) { + if (t.at <= target && t.at < nextAt) { + nextAt = t.at; + nextId = id; + } + } + if (nextId === null) break; + const t = timers.get(nextId); + timers.delete(nextId); + now = nextAt; + t?.cb(); + await flushAll(); + } + now = target; + await flushAll(); + }, + }; +} + +function pcm(ms: number, amplitude: number): Buffer { + const samples = Math.round(ms * (RATE / 1000)); + const buf = Buffer.alloc(samples * 2); + const v = Math.round(amplitude * 32767); + for (let i = 0; i < samples; i++) buf.writeInt16LE(i % 2 === 0 ? v : -v, i * 2); + return buf; +} + +function fakeMic() { + const dataCbs = new Set<(c: Buffer) => void>(); + const errCbs = new Set<(e: MicError) => void>(); + const state = { paused: false, stopped: false, killed: false, pauses: 0, resumes: 0 }; + const mic: MicStream = { + onData(cb) { + dataCbs.add(cb); + return () => dataCbs.delete(cb); + }, + onError(cb) { + errCbs.add(cb); + return () => errCbs.delete(cb); + }, + pause() { + state.paused = true; + state.pauses += 1; + }, + resume() { + state.paused = false; + state.resumes += 1; + }, + get paused() { + return state.paused; + }, + async stop() { + state.stopped = true; + }, + kill() { + state.killed = true; + }, + format: { sampleRate: RATE }, + }; + return { + mic, + state, + /** Deliver audio (dropped while paused, like a real MicStream). */ + push(ms: number, amplitude = 0.3): void { + if (state.paused) return; + const chunk = pcm(ms, amplitude); + for (const cb of dataCbs) cb(chunk); + }, + /** Deliver audio even while paused (misbehaving mic). */ + pushRaw(ms: number, amplitude = 0.3): void { + const chunk = pcm(ms, amplitude); + for (const cb of dataCbs) cb(chunk); + }, + error(e: MicError): void { + for (const cb of errCbs) cb(e); + }, + }; +} + +interface Call { + readonly index: number; + readonly durMs: number; + readonly signal: AbortSignal | undefined; +} + +function fakeTranscriber(handler: (call: Call) => Promise | string) { + const calls: Call[] = []; + const transcriber: Transcriber = { + async transcribe(wav: Buffer, opts: TranscribeOptions) { + expect(wav.subarray(0, 4).toString("ascii")).toBe("RIFF"); + expect(wav.readUInt32LE(24)).toBe(RATE); + const call = { + index: calls.length, + durMs: (wav.length - 44) / BYTES_PER_MS, + signal: opts.signal, + }; + calls.push(call); + return handler(call); + }, + warm: async () => {}, + describe: () => "fake", + dispose: async () => {}, + }; + return { transcriber, calls }; +} + +function scripted(lines: readonly string[]) { + return (call: Call): string => { + const line = lines[call.index]; + if (line === undefined) throw new Error(`unexpected call ${call.index}`); + return line; + }; +} + +function deferred() { + let resolve: (v: T) => void = () => {}; + let reject: (e: Error) => void = () => {}; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, resolve, reject }; +} + +function setup( + handler: (call: Call) => Promise | string, + extra: { + windowMs?: number; + fullFinalMaxSec?: number; + maxSpoolSec?: number; + } = {}, +) { + const clk = fakeClock(); + const m = fakeMic(); + const t = fakeTranscriber(handler); + const partials: StreamingPartial[] = []; + const errors: Error[] = []; + const session = createStreamingSession({ + mic: m.mic, + transcriber: t.transcriber, + language: "en", + clock: clk.clock, + onPartial: (p) => partials.push(p), + onError: (e) => errors.push(e), + ...extra, + }); + /** One second of speech, then one cadence. */ + async function step(ms = 1000, amplitude = 0.3): Promise { + m.push(ms, amplitude); + await clk.advance(ms); + } + return { clk, m, t, partials, errors, session, step }; +} + +function hasRepeatedPhrase(text: string, n = 3): boolean { + const words = splitWords(text).map(normalizeWord); + const seen = new Set(); + for (let i = 0; i + n <= words.length; i++) { + const key = words.slice(i, i + n).join(" "); + if (seen.has(key)) return true; + seen.add(key); + } + return false; +} + +describe("ticks and partials", () => { + test("emits partials only when they change", async () => { + const s = setup( + scripted(["hello world", "hello world how", "hello world how", "hello world how"]), + ); + s.session.start(); + for (let i = 0; i < 4; i++) await s.step(); + expect(s.t.calls.length).toBe(4); + expect(s.partials).toEqual([ + { stable: "", tentative: "hello world" }, + { stable: "hello world", tentative: "how" }, + { stable: "hello world how", tentative: "" }, + ]); + }); + + test("each tick decodes at most windowMs of audio", async () => { + const s = setup(() => "", { windowMs: 3000 }); + s.session.start(); + for (let i = 0; i < 5; i++) await s.step(); + expect(s.t.calls.map((c) => c.durMs)).toEqual([1000, 2000, 3000, 3000, 3000]); + }); + + test("no tick without new audio", async () => { + const s = setup(() => "x"); + s.session.start(); + await s.clk.advance(3000); + expect(s.t.calls.length).toBe(0); + await s.step(); + await s.clk.advance(3000); + expect(s.t.calls.length).toBe(1); + }); + + test("never overlaps requests: ticks skip while one is in flight", async () => { + const d = deferred(); + const s = setup((call) => (call.index === 0 ? d.promise : "a b")); + s.session.start(); + for (let i = 0; i < 5; i++) await s.step(); + expect(s.t.calls.length).toBe(1); + d.resolve("a"); + await flushAll(); + expect(s.partials).toEqual([{ stable: "", tentative: "a" }]); + await s.step(); + expect(s.t.calls.length).toBe(2); + }); + + test("regression: rolling window never duplicates the hypothesis", async () => { + const s = setup( + scripted([ + "the quick brown fox jumps over the lazy dog", + "uick brown fox jumps over the lazy dog and runs", + "brown fox jumps over the lazy dog and ran away", + "Fox jumped over the lazy dog and ran away fast today", + ]), + { windowMs: 3000 }, + ); + s.session.start(); + for (let i = 0; i < 4; i++) await s.step(); + const last = s.partials.at(-1); + const text = `${last?.stable ?? ""} ${last?.tentative ?? ""}`.trim(); + expect(hasRepeatedPhrase(text)).toBe(false); + expect(text).toBe("the quick brown fox jumps over the lazy dog and ran away fast today"); + }); + + test("revised tentative is replaced", async () => { + const s = setup(scripted(["a b c d", "a b c d e", "a b c d f g"])); + s.session.start(); + for (let i = 0; i < 3; i++) await s.step(); + expect(s.partials.at(-1)).toEqual({ stable: "a b c d", tentative: "f g" }); + }); +}); + +describe("tick errors", () => { + test("two consecutive failures are tolerated, the third ends the session", async () => { + const s = setup((call) => { + if (call.index === 2) return "ok"; + throw new Error("server 500"); + }); + s.session.start(); + for (let i = 0; i < 5; i++) await s.step(); + // calls 0,1 fail, 2 succeeds (resets), 3,4 fail: still alive. + expect(s.errors.length).toBe(0); + await s.step(); + expect(s.errors.length).toBe(1); + expect(s.errors[0]?.message).toContain("failed 3 times in a row (server 500)"); + expect(s.errors[0]?.message).not.toContain("\n"); + const callsAtFailure = s.t.calls.length; + for (let i = 0; i < 3; i++) await s.step(); + expect(s.t.calls.length).toBe(callsAtFailure); + expect(s.errors.length).toBe(1); + }); +}); + +describe("pause / level / silence", () => { + test("pause stops inference and freezes silence at 0", async () => { + const s = setup(() => "words"); + s.session.start(); + await s.step(); + await s.step(); + expect(s.t.calls.length).toBe(2); + expect(s.session.level()).toBeGreaterThan(0.2); + + s.session.pause(); + expect(s.session.paused).toBe(true); + expect(s.m.state.paused).toBe(true); + s.m.pushRaw(500); // a mic that leaks audio while paused is ignored too + for (let i = 0; i < 5; i++) await s.step(); + expect(s.t.calls.length).toBe(2); + expect(s.session.silenceMs()).toBe(0); + expect(s.session.level()).toBe(0); + + s.session.resume(); + expect(s.m.state.resumes).toBe(1); + expect(s.session.paused).toBe(false); + expect(s.session.silenceMs()).toBe(0); + await s.step(1000, 0); // silent audio after resume + expect(s.t.calls.length).toBe(3); + expect(s.session.silenceMs()).toBe(1000); + // The window after resume contains no paused audio: 2s before + 1s after. + expect(s.t.calls[2]?.durMs).toBe(3000); + }); + + test("silenceMs: 0 before audio, grace for unvoiced start, then time since voice", async () => { + const s = setup(() => ""); + s.session.start(); + await s.clk.advance(2000); + expect(s.session.silenceMs()).toBe(0); + s.m.push(100, 0); // unvoiced audio starts at t=2000 + await s.clk.advance(500); + expect(s.session.silenceMs()).toBe(0); + await s.clk.advance(1000); + expect(s.session.silenceMs()).toBe(1500); + s.m.push(100, 0.3); // voiced at t=3500 + expect(s.session.silenceMs()).toBe(0); + await s.clk.advance(2500); + expect(s.session.silenceMs()).toBe(2500); + expect(s.session.level()).toBeGreaterThan(0.2); + }); +}); + +test("silenceMs on a noisy mic: background noise above the laptop threshold still counts as silence", async () => { + const s = setup(() => ""); + s.session.start(); + for (let i = 0; i < 10; i++) s.m.push(100, 0.02); // phone-like noise floor + s.m.push(300, 0.3); // speech + await s.clk.advance(100); + for (let i = 0; i < 20; i++) s.m.push(100, 0.02); // noise again + await s.clk.advance(2400); + expect(s.session.silenceMs()).toBeGreaterThanOrEqual(2400); +}); + +describe("finish", () => { + test("full-utterance final decode wins even when shorter than the live text", async () => { + const s = setup((call) => + call.index < 2 ? (["a b c", "a b c d e"][call.index] ?? "") : "clean", + ); + s.session.start(); + await s.step(); + await s.step(); + s.m.push(300); + const text = await s.session.finish(); + expect(text).toBe("clean"); + expect(s.m.state.stopped).toBe(true); + expect(s.t.calls.at(-1)?.durMs).toBe(2300); + }); + + test("falls back to the live transcript when the final decode throws", async () => { + const s = setup((call) => { + if (call.index === 0) return "hello there"; + if (call.index === 1) return "hello there friend"; + throw new Error("boom"); + }); + s.session.start(); + await s.step(); + await s.step(); + expect(await s.session.finish()).toBe("hello there friend"); + expect(s.errors.length).toBe(0); + }); + + test("falls back to the live transcript when the final decode is empty", async () => { + const s = setup((call) => (call.index === 0 ? "only words" : " ")); + s.session.start(); + await s.step(); + expect(await s.session.finish()).toBe("only words"); + }); + + test("final decode timeout falls back to the live transcript", async () => { + const s = setup((call) => (call.index === 0 ? "live" : new Promise(() => {}))); + s.session.start(); + await s.step(); + const done = s.session.finish(); + await flushAll(); + await s.clk.advance(60_000); + expect(await done).toBe("live"); + }); + + test("returns empty when nothing was captured", async () => { + const s = setup(() => "never"); + s.session.start(); + expect(await s.session.finish()).toBe(""); + expect(s.t.calls.length).toBe(0); + }); + + test("long session decodes only the tail after the last stable window", async () => { + const s = setup( + scripted([ + "one two", + "one two three", + "two three four", + "three four five", + "four five six", + "four five six seven", + ]), + { windowMs: 2000, fullFinalMaxSec: 3 }, + ); + s.session.start(); + for (let i = 0; i < 5; i++) await s.step(); + expect(s.partials.at(-1)).toEqual({ stable: "one two three four five", tentative: "six" }); + s.m.push(500); + const text = await s.session.finish(); + // Stable last advanced in the [3000, 5000] window: tail = 3000..5500. + expect(s.t.calls.at(-1)?.durMs).toBe(2500); + expect(text).toBe("one two three four five six seven"); + }); + + test("spool overflow disables the full decode and uses the tail", async () => { + const s = setup(scripted(["a b", "a b c", "b c d", "b c d e"]), { + windowMs: 2000, + maxSpoolSec: 2, + }); + s.session.start(); + for (let i = 0; i < 3; i++) await s.step(); + const text = await s.session.finish(); + // 3s captured but only 2s retained: tail from the retained start. + expect(s.t.calls.at(-1)?.durMs).toBe(2000); + expect(text).toBe("a b c d e"); + }); + + test("aborts the in-flight tick, stops the mic, and is idempotent", async () => { + const tick = deferred(); + const s = setup((call) => (call.index === 0 ? tick.promise : "final words")); + s.session.start(); + await s.step(); + const first = s.session.finish(); + const second = s.session.finish(); + expect(first).toBe(second); + expect(s.t.calls[0]?.signal?.aborted).toBe(true); + expect(await first).toBe("final words"); + expect(s.m.state.stopped).toBe(true); + tick.resolve("late"); + await flushAll(); + expect(s.partials.length).toBe(0); + // Finished sessions stay quiet. + s.m.error({ code: "EXITED", message: "gone" }); + expect(s.errors.length).toBe(0); + }); +}); + +describe("cancel and mic errors", () => { + test("cancel kills the mic and suppresses every later callback", async () => { + const tick = deferred(); + const s = setup(() => tick.promise); + s.session.start(); + await s.step(); + s.session.cancel(); + expect(s.m.state.killed).toBe(true); + expect(s.t.calls[0]?.signal?.aborted).toBe(true); + tick.resolve("late words"); + await flushAll(); + s.m.error({ code: "EXITED", message: "gone" }); + await s.step(); + expect(s.partials.length).toBe(0); + expect(s.errors.length).toBe(0); + expect(s.t.calls.length).toBe(1); + expect(await s.session.finish()).toBe(""); + }); + + test("cancel during the final decode makes finish return empty", async () => { + const final = deferred(); + const s = setup((call) => (call.index === 0 ? "live" : final.promise)); + s.session.start(); + await s.step(); + const done = s.session.finish(); + await flushAll(); + s.session.cancel(); + expect(s.t.calls[1]?.signal?.aborted).toBe(true); + final.resolve("final"); + expect(await done).toBe(""); + }); + + test("mic error reports once and stops ticks", async () => { + const s = setup(() => "x"); + s.session.start(); + await s.step(); + s.m.error({ + code: "EXITED", + message: "Mic stopped unexpectedly.", + hint: "Check the mic and retry.", + }); + s.m.error({ code: "EXITED", message: "again" }); + expect(s.errors.map((e) => e.message)).toEqual([ + "Mic stopped unexpectedly. Check the mic and retry.", + ]); + for (let i = 0; i < 3; i++) await s.step(); + expect(s.t.calls.length).toBe(1); + }); +}); diff --git a/src/stt/streaming.ts b/src/stt/streaming.ts new file mode 100644 index 0000000..95e7a2a --- /dev/null +++ b/src/stt/streaming.ts @@ -0,0 +1,479 @@ +// Streaming dictation session over an already-open MicStream. +// +// Audio lane: every mic chunk goes into a PCM spool from t=0 (capped at +// maxSpoolSec; beyond the cap the oldest audio is dropped and the full- +// utterance final decode is no longer possible). Level and silence are +// computed from the same audio. +// +// Recognition lane: every cadenceMs a tick transcribes the last windowMs of +// audio and folds the hypothesis into the transcript tracker. At most one +// request is in flight; a tick that fires while one is running is skipped. +// Two consecutive tick failures are tolerated, the third ends the session +// with onError. +// +// finish(): stops ticks, aborts the in-flight tick, stops the mic, then runs +// one final decode. Short utterances (<= fullFinalMaxSec, spool complete) are +// decoded whole and that result always wins when non-empty. Longer ones +// decode only the audio from the window where stable text last advanced and +// join it onto the tracker. Any final failure falls back to the tracker text. + +import type { + Logger, + MicError, + MicStream, + StreamingPartial, + SttLanguage, + Transcriber, +} from "../types.ts"; +import { errorMessage } from "../types.ts"; +import { createTranscriptTracker } from "./transcript.ts"; + +export interface StreamingClock { + now(): number; + setTimeout(cb: () => void, ms: number): unknown; + clearTimeout(handle: unknown): void; +} + +export interface StreamingSessionOptions { + readonly mic: MicStream; + readonly transcriber: Transcriber; + readonly language: SttLanguage; + readonly cadenceMs?: number; + readonly windowMs?: number; + readonly fullFinalMaxSec?: number; + readonly maxSpoolSec?: number; + /** RMS (0..1) at or above which a 20ms frame counts as voiced. */ + readonly voiceRms?: number; + readonly onPartial: (p: StreamingPartial) => void; + readonly onError: (err: Error) => void; + readonly logger?: Logger; + readonly clock?: StreamingClock; +} + +export interface StreamingSession { + start(): void; + pause(): void; + resume(): void; + readonly paused: boolean; + /** RMS (0..1) of the last ~100ms of audio; 0 while paused. */ + level(): number; + /** + * ms since the last voiced audio while live. 0 while paused, before any + * audio arrived, and during the first second of unvoiced audio. + */ + silenceMs(): number; + /** Final transcript, trimmed ("" when nothing was said or on cancel). */ + finish(): Promise; + cancel(): void; +} + +const MAX_TICK_ERRORS = 3; +const LEVEL_WINDOW_MS = 100; +const VOICE_FRAME_MS = 20; +const SILENCE_GRACE_MS = 1000; +const FINAL_TIMEOUT_MIN_MS = 60_000; +const SCOPE = "STT"; + +const realClock: StreamingClock = { + now: () => Date.now(), + setTimeout: (cb, ms) => setTimeout(cb, ms), + clearTimeout: (handle) => clearTimeout(handle as ReturnType), +}; + +export function createStreamingSession(opts: StreamingSessionOptions): StreamingSession { + const { mic, transcriber, language, logger } = opts; + const clock = opts.clock ?? realClock; + const cadenceMs = opts.cadenceMs ?? 1000; + const windowMs = opts.windowMs ?? 10_000; + const fullFinalMaxMs = (opts.fullFinalMaxSec ?? 90) * 1000; + const voiceRms = opts.voiceRms ?? 0.01; + const sampleRate = mic.format.sampleRate; + const bytesPerMs = (sampleRate * 2) / 1000; + const windowBytes = alignDown(Math.round(windowMs * bytesPerMs)); + const spool = createSpool(alignDown(Math.round((opts.maxSpoolSec ?? 600) * 1000 * bytesPerMs))); + const tracker = createTranscriptTracker(); + + let started = false; + let paused = false; + let finishing = false; + let disposed = false; + let failed = false; + let errorEmitted = false; + let timer: unknown = null; + let tickController: AbortController | null = null; + let finalController: AbortController | null = null; + let finishPromise: Promise | null = null; + let tickErrors = 0; + let lastTickEnd = 0; + /** Start byte of the window in which stable text last advanced. */ + let stableStartByte: number | null = null; + let lastEmitted: StreamingPartial = { stable: "", tentative: "" }; + let firstAudioAt: number | null = null; + let lastVoiceAt: number | null = null; + /** Background noise of this mic: slow-rising minimum of frame levels. */ + let noiseFloor = Number.POSITIVE_INFINITY; + const unsubscribers: Array<() => void> = []; + + const toMs = (bytes: number): number => bytes / bytesPerMs; + const live = (): boolean => started && !disposed && !finishing && !failed; + + function log(message: string, level: "debug" | "info" | "warn" | "error" = "debug"): void { + logger?.log(SCOPE, message, level); + } + + function emitError(err: Error): void { + if (disposed || finishing || errorEmitted) return; + errorEmitted = true; + try { + opts.onError(err); + } catch (cbErr) { + log(`onError callback threw: ${errorMessage(cbErr)}`, "warn"); + } + } + + function emitPartial(p: StreamingPartial): void { + if (p.stable === lastEmitted.stable && p.tentative === lastEmitted.tentative) return; + lastEmitted = p; + try { + opts.onPartial(p); + } catch (cbErr) { + log(`onPartial callback threw: ${errorMessage(cbErr)}`, "warn"); + } + } + + function clearTimer(): void { + if (timer !== null) { + clock.clearTimeout(timer); + timer = null; + } + } + + function schedule(): void { + clearTimer(); + timer = clock.setTimeout(() => { + timer = null; + if (!live() || paused) return; + schedule(); + void tick(); + }, cadenceMs); + } + + function abortTick(): void { + const controller = tickController; + tickController = null; + controller?.abort(); + } + + function onData(chunk: Buffer): void { + if (disposed || paused || chunk.length === 0) return; + const before = spool.total; + spool.push(chunk); + const now = clock.now(); + if (firstAudioAt === null) firstAudioAt = now; + const pcm = spool.slice(alignUp(before), alignDown(spool.total)); + const level = rms(pcm); + noiseFloor = level < noiseFloor ? level : noiseFloor + (level - noiseFloor) * 0.002; + // Relative to this mic's noise (phone mics sit far above laptop noise); + // the cap keeps a session that starts with speech from calling it noise. + const floor = Number.isFinite(noiseFloor) ? Math.min(noiseFloor, voiceRms * 2) : 0; + const threshold = Math.max(voiceRms, floor * 3); + if (isVoiced(pcm, Math.max(2, alignDown(Math.round(VOICE_FRAME_MS * bytesPerMs))), threshold)) { + lastVoiceAt = now; + } + } + + function onMicError(err: MicError): void { + if (disposed || finishing) return; + failed = true; + clearTimer(); + abortTick(); + emitError(new Error(err.hint ? `${err.message} ${err.hint}` : err.message)); + } + + async function tick(): Promise { + if (!live() || paused || tickController !== null) return; + const end = alignDown(spool.total); + if (end <= lastTickEnd) return; // no new audio since the last tick + const start = Math.max(alignUp(spool.start), end - windowBytes); + lastTickEnd = end; + const window = { startMs: toMs(start), endMs: toMs(end) }; + const controller = new AbortController(); + tickController = controller; + try { + const text = await transcriber.transcribe(pcmToWav(spool.slice(start, end), sampleRate), { + language, + signal: controller.signal, + }); + if (!live() || controller.signal.aborted) return; + tickErrors = 0; + const before = tracker.current().stable; + const partial = tracker.push(text, window); + if (partial.stable !== before) stableStartByte = start; + emitPartial(partial); + } catch (err) { + if (!live() || controller.signal.aborted) return; + tickErrors += 1; + log(`stream tick failed (${tickErrors}/${MAX_TICK_ERRORS}): ${errorMessage(err)}`, "warn"); + if (tickErrors >= MAX_TICK_ERRORS) { + failed = true; + clearTimer(); + emitError( + new Error( + `Live transcription failed ${MAX_TICK_ERRORS} times in a row (${firstLine(errorMessage(err))}). Check the STT engine, then try again.`, + ), + ); + } + } finally { + if (tickController === controller) tickController = null; + } + } + + async function decodeFinal(pcm: Buffer): Promise { + const controller = new AbortController(); + finalController = controller; + const timeoutMs = Math.max(FINAL_TIMEOUT_MIN_MS, 3 * toMs(pcm.length)); + let handle: unknown = null; + const timeout = new Promise((_, reject) => { + handle = clock.setTimeout(() => { + controller.abort(); + reject(new Error(`final transcription timed out after ${Math.round(timeoutMs)}ms`)); + }, timeoutMs); + }); + try { + return await Promise.race([ + transcriber.transcribe(pcmToWav(pcm, sampleRate), { language, signal: controller.signal }), + timeout, + ]); + } finally { + if (handle !== null) clock.clearTimeout(handle); + if (finalController === controller) finalController = null; + } + } + + async function finalText(): Promise { + const fallback = (): string => tracker.text().trim(); + const end = alignDown(spool.total); + const begin = alignUp(spool.start); + if (end <= begin) return fallback(); + + if (spool.complete && toMs(end) <= fullFinalMaxMs) { + try { + const text = (await decodeFinal(spool.slice(0, end))).trim(); + log(`final full decode ${Math.round(toMs(end))}ms -> ${text.length} chars`); + if (text) return text; + } catch (err) { + if (disposed) return ""; + log(`final full decode failed, using live transcript: ${errorMessage(err)}`, "warn"); + } + return fallback(); + } + + // Long or truncated session: decode from the window where stable last + // advanced (it contains stable's tail for anchoring) to the end. + const tailStart = Math.max(begin, stableStartByte ?? 0); + if (tailStart >= end) return fallback(); + try { + const text = (await decodeFinal(spool.slice(tailStart, end))).trim(); + log(`final tail decode ${Math.round(toMs(end - tailStart))}ms -> ${text.length} chars`); + if (text) tracker.push(text, { startMs: toMs(tailStart), endMs: toMs(end) }); + } catch (err) { + if (disposed) return ""; + log(`final tail decode failed, using live transcript: ${errorMessage(err)}`, "warn"); + } + return fallback(); + } + + async function runFinish(): Promise { + try { + await mic.stop(); + } catch (err) { + log(`mic stop failed: ${errorMessage(err)}`, "warn"); + } + unsubscribeAll(); + if (disposed) return ""; + const text = await finalText(); + if (disposed) return ""; + disposed = true; + return text; + } + + function unsubscribeAll(): void { + for (const off of unsubscribers.splice(0)) off(); + } + + return { + start() { + if (started || disposed || finishing) return; + started = true; + unsubscribers.push(mic.onData(onData), mic.onError(onMicError)); + if (!paused) schedule(); + }, + pause() { + if (paused || disposed || finishing) return; + paused = true; + mic.pause(); + clearTimer(); + }, + resume() { + if (!paused || disposed || finishing) return; + paused = false; + mic.resume(); + if (firstAudioAt !== null) lastVoiceAt = clock.now(); + if (live()) schedule(); + }, + get paused() { + return paused; + }, + level() { + if (paused || disposed) return 0; + const end = alignDown(spool.total); + const bytes = alignDown(Math.round(LEVEL_WINDOW_MS * bytesPerMs)); + return rms(spool.slice(Math.max(alignUp(spool.start), end - bytes), end)); + }, + silenceMs() { + if (paused || disposed || finishing || firstAudioAt === null) return 0; + const now = clock.now(); + if (lastVoiceAt === null) { + const elapsed = now - firstAudioAt; + return elapsed > SILENCE_GRACE_MS ? elapsed : 0; + } + return Math.max(0, now - lastVoiceAt); + }, + finish() { + if (finishPromise) return finishPromise; + if (disposed) return Promise.resolve(""); + finishing = true; + clearTimer(); + abortTick(); + finishPromise = runFinish(); + return finishPromise; + }, + cancel() { + if (disposed) return; + disposed = true; + clearTimer(); + abortTick(); + finalController?.abort(); + unsubscribeAll(); + mic.kill(); + }, + }; +} + +// ---------------------------------------------------------------- helpers + +function alignDown(n: number): number { + return n - (n % 2); +} + +function alignUp(n: number): number { + return n + (n % 2); +} + +function firstLine(text: string): string { + return text.split("\n", 1)[0] ?? ""; +} + +interface Spool { + push(chunk: Buffer): void; + /** Absolute bytes received since start. */ + readonly total: number; + /** Absolute offset of the oldest retained byte. */ + readonly start: number; + /** False once audio was dropped for the cap. */ + readonly complete: boolean; + /** Copy of retained bytes in [from, to) (absolute offsets, clamped). */ + slice(from: number, to: number): Buffer; +} + +function createSpool(maxBytes: number): Spool { + const chunks: Buffer[] = []; + let size = 0; + let dropped = 0; + + return { + push(chunk) { + chunks.push(Buffer.from(chunk)); + size += chunk.length; + while (size > maxBytes) { + const head = chunks[0]; + if (head === undefined) break; + const over = size - maxBytes; + if (head.length <= over) { + chunks.shift(); + size -= head.length; + dropped += head.length; + } else { + chunks[0] = head.subarray(over); + size -= over; + dropped += over; + } + } + }, + get total() { + return dropped + size; + }, + get start() { + return dropped; + }, + get complete() { + return dropped === 0; + }, + slice(from, to) { + const lo = Math.max(from, dropped) - dropped; + const hi = Math.min(to, dropped + size) - dropped; + if (hi <= lo) return Buffer.alloc(0); + const out = Buffer.alloc(hi - lo); + let offset = 0; + for (const chunk of chunks) { + const cStart = offset; + const cEnd = offset + chunk.length; + offset = cEnd; + if (cEnd <= lo) continue; + if (cStart >= hi) break; + const s = Math.max(lo, cStart); + const e = Math.min(hi, cEnd); + chunk.copy(out, s - lo, s - cStart, e - cStart); + } + return out; + }, + }; +} + +/** RMS of s16le samples, normalized to 0..1. */ +function rms(pcm: Buffer): number { + const n = Math.floor(pcm.length / 2); + if (n === 0) return 0; + let sum = 0; + for (let i = 0; i < n; i++) { + const v = pcm.readInt16LE(i * 2) / 32768; + sum += v * v; + } + return Math.sqrt(sum / n); +} + +function isVoiced(pcm: Buffer, frameBytes: number, threshold: number): boolean { + for (let off = 0; off < pcm.length; off += frameBytes) { + if (rms(pcm.subarray(off, Math.min(pcm.length, off + frameBytes))) >= threshold) return true; + } + return false; +} + +/** 16-bit mono PCM WAV (44-byte header). */ +function pcmToWav(pcm: Buffer, sampleRate: number): Buffer { + const header = Buffer.alloc(44); + header.write("RIFF", 0, "ascii"); + header.writeUInt32LE(36 + pcm.length, 4); + header.write("WAVE", 8, "ascii"); + header.write("fmt ", 12, "ascii"); + header.writeUInt32LE(16, 16); + header.writeUInt16LE(1, 20); // PCM + header.writeUInt16LE(1, 22); // mono + header.writeUInt32LE(sampleRate, 24); + header.writeUInt32LE(sampleRate * 2, 28); + header.writeUInt16LE(2, 32); + header.writeUInt16LE(16, 34); + header.write("data", 36, "ascii"); + header.writeUInt32LE(pcm.length, 40); + return Buffer.concat([header, pcm]); +} diff --git a/src/stt/transcript.test.ts b/src/stt/transcript.test.ts new file mode 100644 index 0000000..e6bbe08 --- /dev/null +++ b/src/stt/transcript.test.ts @@ -0,0 +1,167 @@ +import { describe, expect, test } from "bun:test"; +import { + createTranscriptTracker, + findAnchor, + joinHypothesis, + locateStableEnd, + normalizeWord, + sameWord, + splitWords, +} from "./transcript.ts"; + +const w = (s: string): string[] => splitWords(s); +const win = (startMs: number, endMs: number) => ({ startMs, endMs }); + +/** True when any run of `n` consecutive words appears twice in `text`. */ +function hasRepeatedPhrase(text: string, n = 3): boolean { + const words = splitWords(text).map(normalizeWord); + const seen = new Set(); + for (let i = 0; i + n <= words.length; i++) { + const key = words.slice(i, i + n).join(" "); + if (seen.has(key)) return true; + seen.add(key); + } + return false; +} + +describe("word helpers", () => { + test("normalizeWord strips case, punctuation, diacritics and đ", () => { + expect(normalizeWord("Đường,")).toBe("duong"); + expect(normalizeWord("Việt.")).toBe("viet"); + expect(normalizeWord("Hello!")).toBe("hello"); + }); + + test("sameWord: punctuation-only tokens must match exactly", () => { + expect(sameWord("--", "…")).toBe(false); + expect(sameWord("--", "--")).toBe(true); + expect(sameWord("Tiếng", "tieng")).toBe(true); + }); + + test("splitWords handles empty and extra whitespace", () => { + expect(splitWords(" ")).toEqual([]); + expect(splitWords(" a b\nc ")).toEqual(["a", "b", "c"]); + }); +}); + +describe("findAnchor", () => { + test("skips cut leading words", () => { + const a = findAnchor(w("the quick brown fox"), 0, w("uick brown fox jumps")); + expect(a).toEqual({ skip: 1, end: 4, length: 2 }); + }); + + test("never anchors entirely inside stable", () => { + // Run "a b" ends at 2, before stable end (4): rejected. + expect(findAnchor(w("a b c d"), 4, w("a b x y"))).toBeNull(); + }); + + test("does not skip more than 3 words", () => { + expect(findAnchor(w("p q r s"), 0, w("1 2 3 4 r s"))).toBeNull(); + expect(findAnchor(w("p q r s"), 0, w("1 2 3 r s"))).toEqual({ skip: 3, end: 4, length: 2 }); + }); +}); + +describe("locateStableEnd", () => { + test("finds stable's last words in the hypothesis", () => { + expect(locateStableEnd(w("a b c d"), w("x c d e f"))).toBe(3); + }); + + test("tolerates a reworded last stable word", () => { + expect(locateStableEnd(w("a b c d"), w("b c D2 e"))).toBe(3); + }); + + test("null when nothing matches", () => { + expect(locateStableEnd(w("a b"), w("x y z"))).toBeNull(); + }); +}); + +describe("joinHypothesis", () => { + test("empty hypothesis changes nothing", () => { + const r = joinHypothesis(w("a b"), w("c"), [], true); + expect(r).toEqual({ stable: w("a b"), tentative: w("c") }); + }); + + test("revised last tentative word is replaced, not appended", () => { + const r = joinHypothesis(w("a b c"), w("d e"), w("b c d x y"), true); + expect(r).toEqual({ stable: w("a b c d"), tentative: w("x y") }); + }); + + test("whole tentative revised: anchor ends at stable end", () => { + const r = joinHypothesis(w("a b c"), w("d e"), w("a b c q r"), true); + expect(r).toEqual({ stable: w("a b c"), tentative: w("q r") }); + }); + + test("no anchor with time overlap replaces the tail instead of appending", () => { + // Mid-window revision breaks every anchor run; stable "z" located in H. + // The tentative "q" is revised too, so no run reaches past stable's end. + const r = joinHypothesis(w("v x y z"), w("q"), w("x Y2 z Q2 n"), true); + expect(r.stable).toEqual(w("v x y z")); + expect(r.tentative).toEqual(w("Q2 n")); + }); + + test("no anchor and stable not found: tentative replaced by hypothesis", () => { + const r = joinHypothesis(w("a b"), w("c"), w("x y z"), true); + expect(r).toEqual({ stable: w("a b"), tentative: w("x y z") }); + }); + + test("no anchor after a time gap appends and commits the old tail", () => { + const r = joinHypothesis(w("a b"), w("c"), w("x y z"), false); + expect(r).toEqual({ stable: w("a b c"), tentative: w("x y z") }); + }); +}); + +describe("createTranscriptTracker", () => { + test("first hypothesis is tentative, re-observation makes it stable", () => { + const t = createTranscriptTracker(); + expect(t.push("hello world", win(0, 1000))).toEqual({ stable: "", tentative: "hello world" }); + expect(t.push("hello world how", win(0, 2000))).toEqual({ + stable: "hello world", + tentative: "how", + }); + expect(t.text()).toBe("hello world how"); + }); + + test("regression: rolling window starting mid-utterance never duplicates", () => { + const t = createTranscriptTracker(); + t.push("the quick brown fox jumps over the lazy dog", win(0, 10_000)); + // Window rolled 1s: first word cut ("quick" -> "uick"). Old join: k=0 -> append. + t.push("uick brown fox jumps over the lazy dog and runs", win(1000, 11_000)); + // Last tentative word revised ("runs" -> "ran"). Old join: k=0 -> append. + t.push("brown fox jumps over the lazy dog and ran away", win(2000, 12_000)); + // First word reworded and two more words. + t.push("Fox jumped over the lazy dog and ran away fast today", win(3000, 13_000)); + const text = t.text(); + expect(hasRepeatedPhrase(text)).toBe(false); + expect(text).toBe("the quick brown fox jumps over the lazy dog and ran away fast today"); + // Repeating the same window keeps it stable without duplication. + t.push("Fox jumped over the lazy dog and ran away fast today", win(3000, 13_000)); + expect(t.text()).toBe(text); + expect(t.current()).toEqual({ stable: text, tentative: "" }); + }); + + test("regression: Vietnamese tone shifts between windows still anchor", () => { + const t = createTranscriptTracker(); + t.push("tôi muốn đi chợ mua rau", win(0, 10_000)); + t.push("muon di cho mua rau và thịt", win(1000, 11_000)); + expect(t.text()).toBe("tôi muốn đi chợ mua rau và thịt"); + }); + + test("stable never shrinks", () => { + const t = createTranscriptTracker(); + t.push("a b c", win(0, 3000)); + t.push("a b c d", win(0, 4000)); + const before = t.current().stable; + t.push("totally different words", win(1000, 5000)); + expect(t.current().stable.startsWith(before)).toBe(true); + }); + + test("reset clears everything", () => { + const t = createTranscriptTracker(); + t.push("a b", win(0, 1000)); + t.push("a b c", win(0, 2000)); + t.reset(); + expect(t.current()).toEqual({ stable: "", tentative: "" }); + expect(t.text()).toBe(""); + // After reset the next push is a first observation again. + expect(t.push("x y", win(0, 1000))).toEqual({ stable: "", tentative: "x y" }); + }); +}); diff --git a/src/stt/transcript.ts b/src/stt/transcript.ts new file mode 100644 index 0000000..4074c8e --- /dev/null +++ b/src/stt/transcript.ts @@ -0,0 +1,215 @@ +// Stable/tentative transcript assembly for rolling-window streaming STT. +// +// Every tick re-transcribes the last ~10s of audio, so each hypothesis +// restates words already shown. The tracker joins each hypothesis onto the +// assembled transcript (stable + tentative) by word overlap: +// +// stable - words confirmed by two observations; never rewritten. +// tentative - the unconfirmed tail; replaced on every update. +// +// Join rule (per hypothesis H, assembled A = stable + tentative): +// 1. Anchor: a contiguous run H[s..s+k) == A[e-k..e) where s <= 3 (the +// window may start mid-word, so the first hypothesis words can be cut or +// reworded) and e >= stable.length (the anchor may end anywhere inside +// the tentative region; tentative words after e are replaced). Longest +// run wins. Result: stable = A[0..e), tentative = H[s+k..]. +// 2. No anchor and the window does not overlap the previous one: genuinely +// new speech after a gap, so commit A and append H as tentative. +// 3. No anchor but the windows overlap: H restates audio we already have. +// Never append it. Keep stable, and REPLACE tentative with the part of H +// after where stable's last words occur in H (all of H when not found). +// +// Comparison is word level, case/punctuation/diacritic-insensitive (whisper +// shifts Vietnamese tone marks between windows). Original words are kept for +// display. Memory is O(transcript words). + +import type { StreamingPartial } from "../types.ts"; + +export interface TranscriptWindow { + /** Absolute start of the decoded audio, ms since session start. */ + readonly startMs: number; + /** Absolute end of the decoded audio, ms since session start. */ + readonly endMs: number; +} + +export interface TranscriptTracker { + push(hypothesis: string, window: TranscriptWindow): StreamingPartial; + current(): StreamingPartial; + /** stable + tentative, single-spaced. */ + text(): string; + reset(): void; +} + +export interface Anchor { + /** Leading hypothesis words skipped before the run. */ + readonly skip: number; + /** Exclusive end index of the run in the assembled words. */ + readonly end: number; + /** Run length in words. */ + readonly length: number; +} + +export interface JoinResult { + readonly stable: readonly string[]; + readonly tentative: readonly string[]; +} + +export const MAX_ANCHOR_SKIP = 3; +/** Longest stable suffix searched for when locating stable's end in a hypothesis. */ +const MAX_SUFFIX_WORDS = 8; +/** Trailing stable words that may be reworded when locating stable's end. */ +const MAX_SUFFIX_DROP = 2; + +export function normalizeWord(word: string): string { + // Vietnamese đ does not decompose under NFD; map it explicitly. + return word + .toLowerCase() + .normalize("NFD") + .replace(/[̀-ͯ]/g, "") + .replace(/đ/g, "d") + .replace(/[^\p{L}\p{N}]/gu, ""); +} + +export function splitWords(text: string): string[] { + return text + .trim() + .split(/\s+/) + .filter((w) => w.length > 0); +} + +export function sameWord(a: string, b: string): boolean { + const na = normalizeWord(a); + if (na !== normalizeWord(b)) return false; + // Pure punctuation tokens only match when identical. + return na !== "" || a === b; +} + +/** Number of equal words starting at a[ai] and b[bi]. */ +export function matchRun( + a: readonly string[], + ai: number, + b: readonly string[], + bi: number, +): number { + let n = 0; + for (;;) { + const x = a[ai + n]; + const y = b[bi + n]; + if (x === undefined || y === undefined || !sameWord(x, y)) return n; + n += 1; + } +} + +/** + * Longest run of hypothesis words (after skipping at most `maxSkip` leading + * words) that matches assembled words and ends at or after `stableLength`. + * Ties prefer fewer skipped words, then the later end (less duplication). + */ +export function findAnchor( + assembled: readonly string[], + stableLength: number, + hypothesis: readonly string[], + maxSkip: number = MAX_ANCHOR_SKIP, +): Anchor | null { + let best: Anchor | null = null; + for (let skip = 0; skip <= maxSkip && skip < hypothesis.length; skip++) { + const available = hypothesis.length - skip; + // Single-word anchors only when nothing longer is possible. + const minLength = Math.max(1, Math.min(2, available, assembled.length)); + const firstStart = Math.max(0, stableLength - available); + for (let start = firstStart; start < assembled.length; start++) { + const length = matchRun(assembled, start, hypothesis, skip); + if (length < minLength) continue; + const end = start + length; + if (end < stableLength) continue; + if ( + best === null || + length > best.length || + (length === best.length && skip === best.skip && end > best.end) + ) { + best = { skip, end, length }; + } + } + } + return best; +} + +/** + * Index in `hypothesis` just after the end of `stable`, found by locating + * stable's last words (longest suffix first, last occurrence). Allows the + * final 1-2 stable words to be reworded. Null when not found. + */ +export function locateStableEnd( + stable: readonly string[], + hypothesis: readonly string[], +): number | null { + for (let drop = 0; drop <= MAX_SUFFIX_DROP; drop++) { + const endIdx = stable.length - drop; + const minR = drop === 0 ? 1 : 2; + for (let r = Math.min(MAX_SUFFIX_WORDS, endIdx); r >= minR; r--) { + for (let h = hypothesis.length - r; h >= 0; h--) { + if (matchRun(stable, endIdx - r, hypothesis, h) >= r) { + return Math.min(hypothesis.length, h + r + drop); + } + } + } + } + return null; +} + +/** Pure join step; see the file header for the rules. */ +export function joinHypothesis( + stable: readonly string[], + tentative: readonly string[], + hypothesis: readonly string[], + overlapsPrevious: boolean, +): JoinResult { + // Silence or a failed decode confirms nothing and revises nothing. + if (hypothesis.length === 0) return { stable, tentative }; + const assembled = [...stable, ...tentative]; + // A single observation confirms nothing. + if (assembled.length === 0) return { stable, tentative: hypothesis }; + + const anchor = findAnchor(assembled, stable.length, hypothesis); + if (anchor) { + return { + stable: assembled.slice(0, anchor.end), + tentative: hypothesis.slice(anchor.skip + anchor.length), + }; + } + // New speech after a gap: the old tail can never be re-observed, commit it. + if (!overlapsPrevious) return { stable: assembled, tentative: hypothesis }; + if (stable.length === 0) return { stable, tentative: hypothesis }; + const at = locateStableEnd(stable, hypothesis); + return { stable, tentative: hypothesis.slice(at ?? 0) }; +} + +export function createTranscriptTracker(): TranscriptTracker { + let stable: readonly string[] = []; + let tentative: readonly string[] = []; + let lastWindow: TranscriptWindow | null = null; + + function current(): StreamingPartial { + return { stable: stable.join(" "), tentative: tentative.join(" ") }; + } + + return { + push(hypothesis, window) { + const overlaps = lastWindow !== null && window.startMs < lastWindow.endMs; + const next = joinHypothesis(stable, tentative, splitWords(hypothesis), overlaps); + stable = next.stable; + tentative = next.tentative; + lastWindow = { startMs: window.startMs, endMs: window.endMs }; + return current(); + }, + current, + text() { + return [...stable, ...tentative].join(" "); + }, + reset() { + stable = []; + tentative = []; + lastWindow = null; + }, + }; +} diff --git a/src/stt/whisper.test.ts b/src/stt/whisper.test.ts new file mode 100644 index 0000000..702c4b8 --- /dev/null +++ b/src/stt/whisper.test.ts @@ -0,0 +1,561 @@ +import { afterEach, describe, expect, test } from "bun:test"; +import { EventEmitter } from "node:events"; +import { isAbortError } from "../types.ts"; +import { pcmToWav } from "./long.ts"; +import { + type ChildLike, + type WhisperDeps, + buildServerArgs, + createWhisperTranscriber, + defaultWhisperModel, + findWhisperModels, + resetWhisperServersForTests, + whisperTimeoutMs, +} from "./whisper.ts"; +import { shortModelName } from "./whisper.ts"; + +class FakeChild extends EventEmitter implements ChildLike { + readonly stdout = new EventEmitter(); + readonly stderr = new EventEmitter(); + killed: string[] = []; + constructor( + readonly cmd: string, + readonly args: readonly string[], + ) { + super(); + } + kill(signal?: NodeJS.Signals): boolean { + this.killed.push(signal ?? "SIGTERM"); + return true; + } + /** Simulate the process dying. */ + die(code: number | null = 1, stderr = ""): void { + if (stderr) this.stderr.emit("data", Buffer.from(stderr)); + this.emit("exit", code); + } +} + +const wav = pcmToWav(Buffer.alloc(16000 * 2), 16000); // 1s silence +const tick = (): Promise => new Promise((r) => setTimeout(r, 0)); + +interface Harness { + deps: Partial; + children: FakeChild[]; + busy: Set; + requests: Array<{ url: string; init: RequestInit | undefined }>; + inference: (url: string, init: RequestInit | undefined) => Promise; + health: (port: number) => Promise; + timers: Array<() => void>; + clock: { t: number }; + paths: Set; + written: string[]; + removed: string[]; +} + +function portOf(url: string): number { + return Number(new URL(url).port); +} + +function harness(): Harness { + const h: Harness = { + deps: {}, + children: [], + busy: new Set(), + requests: [], + inference: async () => Response.json({ text: " hello [BLANK_AUDIO] world " }), + health: async (port) => { + const live = h.children.some( + (c) => + c.cmd === "whisper-server" && + c.args.includes(String(port)) && + c.listenerCount("exit") > 0, + ); + if (!live) throw new Error("ECONNREFUSED"); + return new Response("ok", { status: 200 }); + }, + timers: [], + clock: { t: 0 }, + paths: new Set(["whisper-server"]), + written: [], + removed: [], + }; + h.deps = { + spawn: (cmd, args) => { + const c = new FakeChild(cmd, args); + h.children.push(c); + return c; + }, + fetch: async (url, init) => { + h.requests.push({ url, init }); + if (url.endsWith("/health")) return h.health(portOf(url)); + return h.inference(url, init); + }, + isPortFree: async (port) => !h.busy.has(port), + onPath: (cmd) => h.paths.has(cmd), + existsSync: () => true, + writeFile: async (p) => { + h.written.push(p); + }, + rm: async (p) => { + h.removed.push(p); + }, + tmpdir: () => "/tmp", + now: () => h.clock.t, + sleep: async (ms) => { + h.clock.t += ms; + await tick(); + }, + setTimeout: (cb) => { + h.timers.push(cb); + return h.timers.length; + }, + clearTimeout: () => {}, + }; + return h; +} + +const servers = (h: Harness): FakeChild[] => h.children.filter((c) => c.cmd === "whisper-server"); +const portArg = (c: FakeChild): string | undefined => c.args[c.args.indexOf("--port") + 1]; + +afterEach(() => resetWhisperServersForTests()); + +describe("whisper-server sidecar", () => { + test("concurrent warm/transcribe share one start", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-a.bin", deps: h.deps }); + const results = await Promise.all([ + t.warm(), + t.transcribe(wav, { language: "en" }), + t.transcribe(wav, { language: "vi" }), + ]); + expect(servers(h)).toHaveLength(1); + expect(results[1]).toBe("hello world"); + expect(results[2]).toBe("hello world"); + }); + + test("server args", () => { + expect(buildServerArgs("/m/x.bin", 8178, 4)).toEqual([ + "-m", + "/m/x.bin", + "--host", + "127.0.0.1", + "--port", + "8178", + "-t", + "4", + ]); + }); + + test("port scan starts from a fixed base every time", async () => { + const h = harness(); + h.busy.add(8178); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-b.bin", deps: h.deps }); + await t.transcribe(wav, { language: "en" }); + const first = servers(h)[0]; + expect(first && portArg(first)).toBe("8179"); + const inf = h.requests.find((r) => r.url.endsWith("/inference")); + expect(inf?.url).toBe("http://127.0.0.1:8179/inference"); + + // Crash; base is free again -> restart goes back to 8178, not 8180. + h.busy.clear(); + first?.die(1); + await t.transcribe(wav, { language: "en" }); + const second = servers(h)[1]; + expect(second && portArg(second)).toBe("8178"); + }); + + test("restarts after a crash between calls", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-c.bin", deps: h.deps }); + await t.transcribe(wav, { language: "en" }); + servers(h)[0]?.die(139); + expect(await t.transcribe(wav, { language: "en" })).toBe("hello world"); + expect(servers(h)).toHaveLength(2); + }); + + test("server dying mid-request restarts once and retries", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-d.bin", deps: h.deps }); + await t.warm(); + let calls = 0; + h.inference = async () => { + calls += 1; + if (calls === 1) { + servers(h)[0]?.die(139); + throw new Error("socket closed"); + } + return Response.json({ text: "ok" }); + }; + expect(await t.transcribe(wav, { language: "en" })).toBe("ok"); + expect(servers(h)).toHaveLength(2); + }); + + test("network error with live server is not retried", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-d2.bin", deps: h.deps }); + h.inference = async () => { + throw new Error("socket closed"); + }; + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow( + "Whisper request failed: socket closed", + ); + expect(servers(h)).toHaveLength(1); + }); + + test("request shape: multipart fields", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-e.bin", deps: h.deps }); + await t.transcribe(wav, { language: "vi", prompt: "OpenCode, TypeScript" }); + const inf = h.requests.find((r) => r.url.endsWith("/inference")); + expect(inf?.init?.method).toBe("POST"); + const body = inf?.init?.body; + expect(body).toBeInstanceOf(FormData); + if (!(body instanceof FormData)) return; + expect(body.get("response_format")).toBe("json"); + expect(body.get("temperature")).toBe("0"); + expect(body.get("language")).toBe("vi"); + expect(body.get("prompt")).toBe("OpenCode, TypeScript"); + expect(body.get("file")).toBeInstanceOf(Blob); + }); + + test("auto language is sent as auto and prompt omitted", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-e2.bin", deps: h.deps }); + await t.transcribe(wav, { language: "auto" }); + const body = h.requests.find((r) => r.url.endsWith("/inference"))?.init?.body; + if (!(body instanceof FormData)) throw new Error("expected form"); + expect(body.get("language")).toBe("auto"); + expect(body.get("prompt")).toBeNull(); + }); + + test("abort cancels the in-flight request", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-f.bin", deps: h.deps }); + await t.warm(); + let seen: AbortSignal | undefined; + h.inference = (_url, init) => + new Promise((_resolve, reject) => { + seen = init?.signal ?? undefined; + seen?.addEventListener("abort", () => reject(new Error("aborted"))); + }); + const ctl = new AbortController(); + const p = t.transcribe(wav, { language: "en", signal: ctl.signal }); + await tick(); + ctl.abort(); + const err = await p.catch((e: unknown) => e); + expect(isAbortError(err)).toBe(true); + expect(seen?.aborted).toBe(true); + }); + + test("already-aborted signal rejects without spawning", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-f2.bin", deps: h.deps }); + const ctl = new AbortController(); + ctl.abort(); + const err = await t.transcribe(wav, { language: "en", signal: ctl.signal }).catch((e) => e); + expect(isAbortError(err)).toBe(true); + expect(h.children).toHaveLength(0); + }); + + test("request timeout scales with audio and reports a hint", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-g.bin", deps: h.deps }); + await t.warm(); + h.inference = (_url, init) => + new Promise((_resolve, reject) => { + init?.signal?.addEventListener("abort", () => reject(new Error("aborted"))); + }); + const p = t.transcribe(wav, { language: "en" }); + await tick(); + h.timers.at(-1)?.(); + await expect(p).rejects.toThrow("Whisper timed out after 22s"); + expect(whisperTimeoutMs(wav)).toBe(22_000); + }); + + test("non-200 inference response surfaces status", async () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-g2.bin", deps: h.deps }); + h.inference = async () => new Response("boom", { status: 500 }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow( + "whisper-server responded 500", + ); + }); + + test("missing model gives an actionable error", async () => { + const h = harness(); + const t = createWhisperTranscriber({ + modelPath: "/m/ggml-missing.bin", + deps: { ...h.deps, existsSync: () => false }, + }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow( + "Whisper model not found: /m/ggml-missing.bin — pick one with /stt-model", + ); + }); + + test("no whisper binary installed", async () => { + const h = harness(); + h.paths.clear(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-h.bin", deps: h.deps }); + await expect(t.warm()).rejects.toThrow("whisper.cpp is not installed"); + }); + + test("early exit with a real error fails without scanning on", async () => { + const h = harness(); + h.health = async () => { + throw new Error("ECONNREFUSED"); + }; + const t = createWhisperTranscriber({ modelPath: "/m/ggml-i.bin", deps: h.deps }); + const p = t.warm(); + await tick(); + servers(h)[0]?.die(1, "whisper_init: failed to load model\n"); + await expect(p).rejects.toThrow( + "whisper-server failed to start: whisper_init: failed to load model", + ); + expect(servers(h)).toHaveLength(1); + }); + + test("lost bind race advances to the next port", async () => { + const h = harness(); + let first = true; + h.deps.spawn = (cmd, args) => { + const c = new FakeChild(cmd, args); + h.children.push(c); + if (first) { + first = false; + queueMicrotask(() => c.die(1, "error: bind failed: address already in use\n")); + } + return c; + }; + h.health = async (port) => { + if (port === 8178) throw new Error("ECONNREFUSED"); + return new Response("ok"); + }; + const t = createWhisperTranscriber({ modelPath: "/m/ggml-j.bin", deps: h.deps }); + await t.warm(); + expect(servers(h).map(portArg)).toEqual(["8178", "8179"]); + }); + + test("start timeout kills the process", async () => { + const h = harness(); + h.health = async () => new Response("loading", { status: 503 }); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-k.bin", deps: h.deps }); + await expect(t.warm()).rejects.toThrow("did not start within 60s"); + expect(servers(h)[0]?.killed).toEqual(["SIGTERM"]); + }); + + test("all ports busy", async () => { + const h = harness(); + for (let p = 8178; p < 8188; p++) h.busy.add(p); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-l.bin", deps: h.deps }); + await expect(t.warm()).rejects.toThrow("No free port for whisper-server in 8178-8187"); + }); + + test("refcounted registry shares one server per model", async () => { + const h = harness(); + const a = createWhisperTranscriber({ modelPath: "/m/ggml-m.bin", deps: h.deps }); + const b = createWhisperTranscriber({ modelPath: "/m/ggml-m.bin", deps: h.deps }); + await a.warm(); + await b.transcribe(wav, { language: "en" }); + expect(servers(h)).toHaveLength(1); + await a.dispose(); + await a.dispose(); // idempotent + expect(servers(h)[0]?.killed).toEqual([]); + await b.dispose(); + expect(servers(h)[0]?.killed).toEqual(["SIGTERM"]); + await expect(a.transcribe(wav, { language: "en" })).rejects.toThrow("disposed"); + + const c = createWhisperTranscriber({ modelPath: "/m/ggml-m.bin", deps: h.deps }); + await c.warm(); + expect(servers(h)).toHaveLength(2); + }); + + test("dispose during startup leaves no orphan", async () => { + const h = harness(); + h.health = async () => new Response("loading", { status: 503 }); + h.deps.sleep = () => tick(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-n.bin", deps: h.deps }); + const p = t.warm(); + await tick(); + await t.dispose(); + await expect(p).rejects.toThrow("disposed"); + expect(servers(h)[0]?.killed.length).toBeGreaterThan(0); + }); + + test("describe", () => { + const h = harness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-large-v3-turbo.bin", deps: h.deps }); + expect(t.describe()).toBe("whisper large-v3-turbo"); + }); +}); + +describe("whisper-cli fallback", () => { + function cliHarness(): Harness { + const h = harness(); + h.paths = new Set(["whisper-cli"]); + return h; + } + + test("parses stdout and cleans up the temp file", async () => { + const h = cliHarness(); + h.deps.spawn = (cmd, args) => { + const c = new FakeChild(cmd, args); + h.children.push(c); + queueMicrotask(() => { + c.stdout.emit("data", Buffer.from(" [BLANK_AUDIO]\n xin chào")); + c.stdout.emit("data", Buffer.from(" thế giới (music)\n")); + c.die(0); + }); + return c; + }; + const t = createWhisperTranscriber({ modelPath: "/m/ggml-o.bin", threads: 4, deps: h.deps }); + const out = await t.transcribe(wav, { language: "vi", prompt: "hint" }); + expect(out).toBe("xin chào thế giới"); + const c = h.children[0]; + expect(c?.cmd).toBe("whisper-cli"); + const file = h.written[0]; + expect(c?.args).toEqual([ + "-m", + "/m/ggml-o.bin", + "-f", + file ?? "", + "-l", + "vi", + "-np", + "-nt", + "-t", + "4", + "--prompt", + "hint", + ]); + expect(h.removed).toEqual([file ?? ""]); + }); + + test("nonzero exit surfaces last stderr line", async () => { + const h = cliHarness(); + h.deps.spawn = (cmd, args) => { + const c = new FakeChild(cmd, args); + queueMicrotask(() => + c.die(11, "failed to read the frames of the audio data\nerror: 1 input file(s) failed\n"), + ); + return c; + }; + const t = createWhisperTranscriber({ modelPath: "/m/ggml-p.bin", deps: h.deps }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow( + "whisper-cli failed: error: 1 input file(s) failed", + ); + expect(h.removed).toHaveLength(1); + }); + + test("unknown language on exit 0", async () => { + const h = cliHarness(); + h.deps.spawn = (cmd, args) => { + const c = new FakeChild(cmd, args); + queueMicrotask(() => c.die(0, "error: unknown language 'xx'\n")); + return c; + }; + const t = createWhisperTranscriber({ modelPath: "/m/ggml-q.bin", deps: h.deps }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow( + "Unknown whisper language: xx", + ); + }); + + test("abort kills whisper-cli", async () => { + const h = cliHarness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-r.bin", deps: h.deps }); + const ctl = new AbortController(); + const p = t.transcribe(wav, { language: "en", signal: ctl.signal }); + await tick(); + ctl.abort(); + const err = await p.catch((e: unknown) => e); + expect(isAbortError(err)).toBe(true); + expect(h.children[0]?.killed).toEqual(["SIGKILL"]); + expect(h.removed).toHaveLength(1); + }); + + test("timeout kills whisper-cli", async () => { + const h = cliHarness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-s.bin", deps: h.deps }); + const p = t.transcribe(wav, { language: "en" }); + await tick(); + h.timers.at(-1)?.(); + await expect(p).rejects.toThrow("Whisper timed out"); + expect(h.children[0]?.killed).toEqual(["SIGKILL"]); + }); + + test("spawn error event", async () => { + const h = cliHarness(); + h.deps.spawn = (cmd, args) => { + const c = new FakeChild(cmd, args); + queueMicrotask(() => c.emit("error", new Error("ENOENT"))); + return c; + }; + const t = createWhisperTranscriber({ modelPath: "/m/ggml-t.bin", deps: h.deps }); + await expect(t.transcribe(wav, { language: "en" })).rejects.toThrow( + "whisper-cli failed: ENOENT", + ); + }); + + test("warm is a no-op in cli mode", async () => { + const h = cliHarness(); + const t = createWhisperTranscriber({ modelPath: "/m/ggml-u.bin", deps: h.deps }); + await t.warm(); + expect(h.children).toHaveLength(0); + }); +}); + +describe("model discovery", () => { + const files: Record> = { + "/home/u/.local/share/whisper-cpp": { + "ggml-base.en.bin": 142, + "ggml-large-v3-turbo-q5_0.bin": 548, + "ggml-silero-v5.1.2.bin": 1, + "notes.txt": 1, + }, + "/opt/homebrew/share/whisper-cpp/models": { + "ggml-medium.bin": 1500, + "for-tests-ggml-tiny.bin": 1, + }, + }; + const deps = { + homedir: () => "/home/u", + existsSync: (p: string) => p in files, + readdirSync: (d: string) => Object.keys(files[d] ?? {}), + statSync: (p: string) => { + const dir = p.slice(0, p.lastIndexOf("/")); + const name = p.slice(p.lastIndexOf("/") + 1); + return { size: files[dir]?.[name] ?? 0, isFile: () => true }; + }, + }; + + test("finds ggml models, largest first, skipping VAD/test files", () => { + expect(findWhisperModels(deps)).toEqual([ + "/opt/homebrew/share/whisper-cpp/models/ggml-medium.bin", + "/home/u/.local/share/whisper-cpp/ggml-large-v3-turbo-q5_0.bin", + "/home/u/.local/share/whisper-cpp/ggml-base.en.bin", + ]); + }); + + test("default prefers large-v3-turbo", () => { + expect(defaultWhisperModel(deps)).toBe( + "/home/u/.local/share/whisper-cpp/ggml-large-v3-turbo-q5_0.bin", + ); + }); + + test("default falls back to the largest, then null", () => { + const noTurbo = { + ...deps, + existsSync: (p: string) => p === "/opt/homebrew/share/whisper-cpp/models", + }; + expect(defaultWhisperModel(noTurbo)).toBe( + "/opt/homebrew/share/whisper-cpp/models/ggml-medium.bin", + ); + expect(defaultWhisperModel({ ...deps, existsSync: () => false })).toBeNull(); + }); +}); + +test("shortModelName gives a compact status label", () => { + expect(shortModelName("/x/ggml-large-v3-turbo-q5_0.bin")).toBe("turbo"); + expect(shortModelName("/x/ggml-medium.bin")).toBe("medium"); + expect(shortModelName("/x/ggml-small.en-q5_1.bin")).toBe("small en"); + expect(shortModelName("ggml-large-v3.bin")).toBe("large-v3"); +}); diff --git a/src/stt/whisper.ts b/src/stt/whisper.ts new file mode 100644 index 0000000..483cb5d --- /dev/null +++ b/src/stt/whisper.ts @@ -0,0 +1,594 @@ +// Local whisper.cpp transcription. Prefers a persistent whisper-server +// sidecar (model loaded once, shared per modelPath between batch and +// streaming via a refcounted registry); falls back to one-shot whisper-cli +// when whisper-server is not installed. + +import { spawn as nodeSpawn } from "node:child_process"; +import fs from "node:fs"; +import net from "node:net"; +import os from "node:os"; +import path from "node:path"; +import type { Logger, TranscribeOptions, Transcriber } from "../types.ts"; +import { errorMessage } from "../types.ts"; +import { cleanTranscript } from "./filter.ts"; +import { abortError, wavDurationSec } from "./long.ts"; + +export const WHISPER_HOST = "127.0.0.1"; +export const WHISPER_BASE_PORT = 8178; +export const WHISPER_PORT_SCAN = 10; +const START_TIMEOUT_MS = 60_000; +const POLL_MS = 250; + +// ---------------------------------------------------------------- deps + +interface DataSource { + on(event: "data", cb: (chunk: Buffer) => void): unknown; +} + +/** The subset of ChildProcess used here (lets tests pass a fake). */ +export interface ChildLike { + readonly stdout: DataSource | null; + readonly stderr: DataSource | null; + kill(signal?: NodeJS.Signals): boolean; + once(event: "exit", cb: (code: number | null) => void): unknown; + once(event: "error", cb: (err: Error) => void): unknown; +} + +export interface WhisperDeps { + spawn(cmd: string, args: readonly string[]): ChildLike; + fetch(url: string, init?: RequestInit): Promise; + isPortFree(port: number): Promise; + onPath(cmd: string): boolean; + existsSync(p: string): boolean; + writeFile(p: string, data: Buffer): Promise; + rm(p: string): Promise; + tmpdir(): string; + now(): number; + sleep(ms: number): Promise; + setTimeout(cb: () => void, ms: number): unknown; + clearTimeout(handle: unknown): void; +} + +function onPathReal(cmd: string): boolean { + const dirs = (process.env.PATH ?? "").split(path.delimiter).filter(Boolean); + return dirs.some((d) => fs.existsSync(path.join(d, cmd))); +} + +function isPortFreeReal(port: number): Promise { + return new Promise((resolve) => { + const srv = net.createServer(); + srv.once("error", () => resolve(false)); + srv.listen(port, WHISPER_HOST, () => srv.close(() => resolve(true))); + }); +} + +const realDeps: WhisperDeps = { + spawn: (cmd, args) => nodeSpawn(cmd, [...args], { stdio: ["ignore", "pipe", "pipe"] }), + fetch: (url, init) => fetch(url, init), + isPortFree: isPortFreeReal, + onPath: onPathReal, + existsSync: (p) => fs.existsSync(p), + writeFile: (p, data) => fs.promises.writeFile(p, data), + rm: (p) => fs.promises.rm(p, { force: true }), + tmpdir: () => os.tmpdir(), + now: () => Date.now(), + sleep: (ms) => new Promise((r) => setTimeout(r, ms)), + setTimeout: (cb, ms) => setTimeout(cb, ms), + clearTimeout: (h) => clearTimeout(h as ReturnType), +}; + +// ---------------------------------------------------------------- errors + +function modelMissing(modelPath: string): Error { + return new Error(`Whisper model not found: ${modelPath} — pick one with /stt-model`); +} + +function timeoutError(ms: number): Error { + return new Error( + `Whisper timed out after ${Math.round(ms / 1000)}s — try a smaller model with /stt-model`, + ); +} + +function lastLine(text: string): string { + return text.trim().split("\n").pop()?.trim() ?? ""; +} + +function isAddressInUse(stderr: string): boolean { + return /address already in use|EADDRINUSE|failed to bind|bind.*fail/i.test(stderr); +} + +/** Audio-scaled request budget: 20s + 2x the audio duration. */ +export function whisperTimeoutMs(wav: Buffer): number { + return 20_000 + Math.ceil(2 * wavDurationSec(wav) * 1000); +} + +// ---------------------------------------------------------------- registry + +interface ServerEntry { + readonly modelPath: string; + readonly threads: number | undefined; + readonly deps: WhisperDeps; + readonly logger: Logger | undefined; + refs: number; + proc: ChildLike | null; + port: number | null; + ready: boolean; + starting: Promise | null; + disposed: boolean; +} + +const registry = new Map(); + +/** Test helper: kill and forget every shared server. */ +export function resetWhisperServersForTests(): void { + for (const e of registry.values()) killEntry(e); + registry.clear(); +} + +function killEntry(e: ServerEntry): void { + e.disposed = true; + e.ready = false; + const proc = e.proc; + e.proc = null; + e.port = null; + if (proc) { + try { + proc.kill("SIGTERM"); + } catch { + // already gone + } + } +} + +function log(e: ServerEntry, msg: string, level: "debug" | "info" | "warn" = "debug"): void { + e.logger?.log("STT", msg, level); +} + +export function buildServerArgs(modelPath: string, port: number, threads?: number): string[] { + const args = ["-m", modelPath, "--host", WHISPER_HOST, "--port", String(port)]; + if (threads) args.push("-t", String(threads)); + return args; +} + +type Probe = "ready" | "loading" | "down"; + +async function probe(e: ServerEntry, port: number): Promise { + try { + const resp = await e.deps.fetch(`http://${WHISPER_HOST}:${port}/health`, { + signal: AbortSignal.timeout(1500), + }); + // 404: build predates /health. The port was free before our spawn and + // our process is still alive, so the responder is ours. + if (resp.ok || resp.status === 404) return "ready"; + return "loading"; + } catch { + return "down"; + } +} + +type StartResult = { ok: true } | { ok: false; inUse: true }; + +async function startOnPort(e: ServerEntry, port: number): Promise { + const args = buildServerArgs(e.modelPath, port, e.threads); + log(e, `starting whisper-server port=${port}`); + let proc: ChildLike; + try { + proc = e.deps.spawn("whisper-server", args); + } catch (err) { + throw new Error( + `Could not start whisper-server: ${errorMessage(err)} — reinstall whisper.cpp and retry`, + ); + } + let exited = false; + let exitCode: number | null = null; + let stderr = ""; + proc.stderr?.on("data", (c) => { + stderr = (stderr + c.toString()).slice(-4000); + }); + const onGone = (): void => { + exited = true; + if (e.proc !== proc) return; + if (e.ready) log(e, `whisper-server exited code=${exitCode}`, "warn"); + e.proc = null; + e.port = null; + e.ready = false; + }; + proc.once("exit", (code) => { + exitCode = code; + onGone(); + }); + proc.once("error", (err) => { + stderr += `\n${err.message}`; + onGone(); + }); + e.proc = proc; + e.port = port; + e.ready = false; + + const deadline = e.deps.now() + START_TIMEOUT_MS; + while (!exited && !e.disposed && e.deps.now() < deadline) { + const state = await probe(e, port); + if (exited || e.disposed) break; + if (state === "ready") { + e.ready = true; + log(e, `whisper-server ready port=${port}`); + return { ok: true }; + } + await e.deps.sleep(POLL_MS); + } + if (e.disposed) { + // Disposed mid-start: never leave an orphan server behind. + try { + proc.kill("SIGTERM"); + } catch { + // already gone + } + throw new Error("Whisper transcriber was disposed"); + } + if (exited) { + if (isAddressInUse(stderr)) { + log(e, `whisper-server port ${port} lost bind race, trying next`, "warn"); + return { ok: false, inUse: true }; + } + const why = lastLine(stderr) || `exit code ${exitCode}`; + log(e, `whisper-server exited before ready: ${why}`, "warn"); + throw new Error( + `whisper-server failed to start: ${why} — check the model or pick another with /stt-model`, + ); + } + if (e.proc === proc) killEntryProc(e); + throw new Error( + `whisper-server did not start within ${START_TIMEOUT_MS / 1000}s — try a smaller model with /stt-model`, + ); +} + +function killEntryProc(e: ServerEntry): void { + const proc = e.proc; + e.proc = null; + e.port = null; + e.ready = false; + try { + proc?.kill("SIGTERM"); + } catch { + // already gone + } +} + +async function startServer(e: ServerEntry): Promise { + // Always scan from the FIXED base so ports never drift across restarts. + for (let i = 0; i < WHISPER_PORT_SCAN; i++) { + const port = WHISPER_BASE_PORT + i; + if (e.disposed) throw new Error("Whisper transcriber was disposed"); + if (!(await e.deps.isPortFree(port))) { + log(e, `port ${port} busy, trying next`); + continue; + } + const r = await startOnPort(e, port); + if (r.ok) return port; + } + const last = WHISPER_BASE_PORT + WHISPER_PORT_SCAN - 1; + throw new Error( + `No free port for whisper-server in ${WHISPER_BASE_PORT}-${last} — close other whisper-server processes and retry`, + ); +} + +/** Running server port; concurrent callers share one start. */ +function ensureServer(e: ServerEntry): Promise { + if (e.proc && e.ready && e.port !== null) return Promise.resolve(e.port); + if (!e.starting) { + e.starting = startServer(e).finally(() => { + e.starting = null; + }); + } + return e.starting; +} + +function raceAbort(p: Promise, signal: AbortSignal | undefined): Promise { + if (!signal) return p; + if (signal.aborted) return Promise.reject(abortError()); + return new Promise((resolve, reject) => { + const onAbort = (): void => reject(abortError()); + signal.addEventListener("abort", onAbort, { once: true }); + p.then( + (v) => { + signal.removeEventListener("abort", onAbort); + resolve(v); + }, + (err: unknown) => { + signal.removeEventListener("abort", onAbort); + reject(err); + }, + ); + }); +} + +// ---------------------------------------------------------------- transcriber + +export interface WhisperTranscriberOptions { + readonly modelPath: string; + readonly threads?: number; + readonly logger?: Logger; + readonly deps?: Partial; +} + +let tmpCounter = 0; + +export function createWhisperTranscriber(opts: WhisperTranscriberOptions): Transcriber { + const deps: WhisperDeps = { ...realDeps, ...opts.deps }; + const { modelPath } = opts; + let entry = registry.get(modelPath); + if (!entry) { + entry = { + modelPath, + threads: opts.threads, + deps, + logger: opts.logger, + refs: 0, + proc: null, + port: null, + ready: false, + starting: null, + disposed: false, + }; + registry.set(modelPath, entry); + } + entry.refs += 1; + const e = entry; + let released = false; + + function mode(): "server" | "cli" { + if (released) throw new Error("Whisper transcriber was disposed"); + if (!deps.existsSync(modelPath)) throw modelMissing(modelPath); + if (deps.onPath("whisper-server")) return "server"; + if (deps.onPath("whisper-cli")) return "cli"; + throw new Error( + "whisper.cpp is not installed — install whisper-cpp (e.g. brew install whisper-cpp) and retry", + ); + } + + async function viaServer(wav: Buffer, o: TranscribeOptions, retried: boolean): Promise { + const port = await raceAbort(ensureServer(e), o.signal); + const form = new FormData(); + form.append("file", new Blob([new Uint8Array(wav)], { type: "audio/wav" }), "audio.wav"); + form.append("response_format", "json"); + form.append("temperature", "0"); + form.append("language", o.language); + if (o.prompt) form.append("prompt", o.prompt); + + const budget = whisperTimeoutMs(wav); + const ctl = new AbortController(); + let timedOut = false; + const timer = deps.setTimeout(() => { + timedOut = true; + ctl.abort(); + }, budget); + const onAbort = (): void => ctl.abort(); + o.signal?.addEventListener("abort", onAbort, { once: true }); + try { + const resp = await deps.fetch(`http://${WHISPER_HOST}:${port}/inference`, { + method: "POST", + body: form, + signal: ctl.signal, + }); + if (!resp.ok) { + throw new Error( + `whisper-server responded ${resp.status} — retry, or pick another model with /stt-model`, + ); + } + const data: unknown = await resp.json(); + const text = + typeof data === "object" && data !== null && "text" in data && typeof data.text === "string" + ? data.text + : ""; + return cleanTranscript(text); + } catch (err) { + if (o.signal?.aborted) throw abortError(); + if (timedOut) throw timeoutError(budget); + if (err instanceof Error && err.message.startsWith("whisper-server responded")) throw err; + // Server died mid-request: restart it once and retry. + if (!retried && e.proc === null && !e.disposed) { + log(e, "whisper-server gone during request, restarting once", "warn"); + return viaServer(wav, o, true); + } + throw new Error( + `Whisper request failed: ${errorMessage(err)} — retry, or restart OpenCode if it persists`, + ); + } finally { + deps.clearTimeout(timer); + o.signal?.removeEventListener("abort", onAbort); + } + } + + async function viaCli(wav: Buffer, o: TranscribeOptions): Promise { + if (o.signal?.aborted) throw abortError(); + tmpCounter += 1; + const file = path.join( + deps.tmpdir(), + `opencode-voice-whisper-${process.pid}-${tmpCounter}.wav`, + ); + await deps.writeFile(file, wav); + try { + return await runCli(file, wav, o); + } finally { + await deps.rm(file).catch(() => undefined); + } + } + + function runCli(file: string, wav: Buffer, o: TranscribeOptions): Promise { + const args = ["-m", modelPath, "-f", file, "-l", o.language, "-np", "-nt"]; + if (opts.threads) args.push("-t", String(opts.threads)); + if (o.prompt) args.push("--prompt", o.prompt); + const budget = whisperTimeoutMs(wav); + return new Promise((resolve, reject) => { + let proc: ChildLike; + try { + proc = deps.spawn("whisper-cli", args); + } catch (err) { + reject( + new Error(`Could not start whisper-cli: ${errorMessage(err)} — reinstall whisper.cpp`), + ); + return; + } + let stdout = ""; + let stderr = ""; + let done = false; + const finish = (fn: () => void): void => { + if (done) return; + done = true; + deps.clearTimeout(timer); + o.signal?.removeEventListener("abort", onAbort); + fn(); + }; + const kill = (): void => { + try { + proc.kill("SIGKILL"); + } catch { + // already gone + } + }; + const timer = deps.setTimeout(() => { + kill(); + finish(() => reject(timeoutError(budget))); + }, budget); + const onAbort = (): void => { + kill(); + finish(() => reject(abortError())); + }; + o.signal?.addEventListener("abort", onAbort, { once: true }); + proc.stdout?.on("data", (c) => { + stdout += c.toString(); + }); + proc.stderr?.on("data", (c) => { + stderr = (stderr + c.toString()).slice(-4000); + }); + proc.once("error", (err) => { + finish(() => + reject(new Error(`whisper-cli failed: ${err.message} — reinstall whisper.cpp`)), + ); + }); + proc.once("exit", (code) => { + finish(() => { + // whisper-cli exits 0 on an unknown language; surface it. + const lang = stderr.match(/error: unknown language '([^']+)'/); + if (lang) { + reject( + new Error(`Unknown whisper language: ${lang[1]} — pick another with /stt-language`), + ); + return; + } + if (code !== 0) { + const why = lastLine(stderr) || `exit code ${code}`; + log(e, `whisper-cli exited code=${code}`, "warn"); + reject(new Error(`whisper-cli failed: ${why} — check the recording and the model`)); + return; + } + resolve(cleanTranscript(stdout)); + }); + }); + }); + } + + return { + async transcribe(wav, o) { + if (o.signal?.aborted) throw abortError(); + const m = mode(); + log(e, `transcribe mode=${m} bytes=${wav.length}`); + return m === "server" ? viaServer(wav, o, false) : viaCli(wav, o); + }, + async warm() { + if (mode() === "server") await ensureServer(e); + }, + describe() { + const name = path + .basename(modelPath) + .replace(/^ggml-/, "") + .replace(/\.bin$/, ""); + return `whisper ${name}`; + }, + async dispose() { + if (released) return; + released = true; + e.refs -= 1; + if (e.refs <= 0) { + if (registry.get(modelPath) === e) registry.delete(modelPath); + killEntry(e); + } + }, + }; +} + +// ---------------------------------------------------------------- models + +export interface ModelScanDeps { + homedir(): string; + existsSync(p: string): boolean; + readdirSync(dir: string): string[]; + statSync(p: string): { size: number; isFile(): boolean }; +} + +const realScanDeps: ModelScanDeps = { + homedir: () => os.homedir(), + existsSync: (p) => fs.existsSync(p), + readdirSync: (d) => fs.readdirSync(d), + statSync: (p) => fs.statSync(p), +}; + +export function whisperModelDirs(home: string): string[] { + return [ + path.join(home, ".local", "share", "whisper-cpp"), + path.join(home, ".local", "share", "whisper-cpp", "models"), + "/opt/homebrew/share/whisper-cpp/models", + "/opt/homebrew/share/whisper-cpp", + "/usr/local/share/whisper-cpp/models", + "/usr/local/share/whisper-cpp", + path.join(home, ".cache", "whisper"), + ]; +} + +/** ggml whisper models found on disk, largest first. VAD models excluded. */ +export function findWhisperModels(deps: Partial = {}): string[] { + const d: ModelScanDeps = { ...realScanDeps, ...deps }; + const found = new Map(); + for (const dir of whisperModelDirs(d.homedir())) { + if (!d.existsSync(dir)) continue; + let names: string[]; + try { + names = d.readdirSync(dir); + } catch { + continue; + } + for (const name of names) { + if (!/^ggml-.*\.bin$/.test(name) || /silero|vad/i.test(name)) continue; + const p = path.join(dir, name); + try { + const st = d.statSync(p); + if (st.isFile()) found.set(p, st.size); + } catch { + // unreadable entry: skip + } + } + } + return [...found.entries()] + .sort((a, b) => b[1] - a[1] || a[0].localeCompare(b[0])) + .map(([p]) => p); +} + +/** Prefer large-v3-turbo when present, else the largest model, else null. */ +export function defaultWhisperModel(deps: Partial = {}): string | null { + const models = findWhisperModels(deps); + return models.find((p) => path.basename(p).includes("large-v3-turbo")) ?? models[0] ?? null; +} + +/** + * Short label for a ggml model file, for the status line: + * ggml-large-v3-turbo-q5_0.bin → "turbo", ggml-medium.bin → "medium". + */ +export function shortModelName(modelPath: string): string { + const base = (modelPath.split("/").pop() ?? modelPath) + .replace(/^ggml-/, "") + .replace(/\.bin$/, "") + .replace(/-q\d(_\d)?$/, "") + .replace(/\.en$/, " en"); + if (/turbo/.test(base)) return base.includes(" en") ? "turbo en" : "turbo"; + return base || "whisper"; +} diff --git a/src/testing/fakes.ts b/src/testing/fakes.ts new file mode 100644 index 0000000..26cf911 --- /dev/null +++ b/src/testing/fakes.ts @@ -0,0 +1,293 @@ +// Test doubles shared by the state-machine tests. +import type { FocusedTextarea } from "../host.ts"; +import type { + Llm, + MicError, + MicStream, + Player, + PlayEnd, + SpeechSegment, + Synth, + SynthName, + Transcriber, +} from "../types.ts"; + +/** In-memory model of the opentui textarea surface we use. */ +export function fakeTextarea( + initial = "", + cursor = initial.length, +): FocusedTextarea & { submits: number } { + let text = initial; + let cur = cursor; + const offset = (row: number, col: number): number => { + const lines = text.split("\n"); + let o = 0; + for (let i = 0; i < row; i++) o += (lines[i] ?? "").length + 1; + return o + col; + }; + return { + submits: 0, + get plainText() { + return text; + }, + get cursorOffset() { + return cur; + }, + set cursorOffset(v: number) { + cur = Math.max(0, Math.min(v, text.length)); + }, + insertText(t: string) { + text = text.slice(0, cur) + t + text.slice(cur); + cur += t.length; + }, + deleteRange(sr: number, sc: number, er: number, ec: number) { + const a = offset(sr, sc); + const b = offset(er, ec); + text = text.slice(0, a) + text.slice(b); + cur = a; + }, + submit() { + this.submits += 1; + return true; + }, + }; +} + +export interface FakeMic extends MicStream { + push(chunk: Buffer): void; + fail(err: MicError): void; + stops: number; + kills: number; +} + +export function fakeMic(sampleRate = 16000): FakeMic { + const data = new Set<(c: Buffer) => void>(); + const errs = new Set<(e: MicError) => void>(); + let paused = false; + const mic: FakeMic = { + stops: 0, + kills: 0, + format: { sampleRate }, + onData(cb) { + data.add(cb); + return () => data.delete(cb); + }, + onError(cb) { + errs.add(cb); + return () => errs.delete(cb); + }, + pause() { + paused = true; + }, + resume() { + paused = false; + }, + get paused() { + return paused; + }, + async stop() { + mic.stops += 1; + }, + kill() { + mic.kills += 1; + }, + push(chunk) { + if (paused) return; + for (const cb of data) cb(chunk); + }, + fail(err) { + for (const cb of errs) cb(err); + }, + }; + return mic; +} + +/** PCM chunk of `ms` with a constant amplitude (0 = silence). */ +export function pcm(ms: number, amplitude = 3000, sampleRate = 16000): Buffer { + const n = Math.floor((sampleRate * ms) / 1000); + const b = Buffer.alloc(n * 2); + for (let i = 0; i < n; i++) b.writeInt16LE(i % 2 ? amplitude : -amplitude, i * 2); + return b; +} + +export interface FakeTranscriber extends Transcriber { + calls: number; + next: Array>; + disposed: number; +} + +export function fakeTranscriber( + results: Array> = [], +): FakeTranscriber { + const t: FakeTranscriber = { + calls: 0, + disposed: 0, + next: [...results], + async transcribe(_wav, opts) { + t.calls += 1; + const r = t.next.shift() ?? ""; + if (r instanceof Error) throw r; + const v = await r; + if (opts.signal?.aborted) { + const e = new Error("aborted"); + e.name = "AbortError"; + throw e; + } + return v; + }, + async warm() {}, + describe: () => "fake", + async dispose() { + t.disposed += 1; + }, + }; + return t; +} + +export interface FakeLlm extends Llm { + requests: Array<{ system: string; user: string }>; + reply: string | Error | ((user: string) => string | Promise); +} + +export function fakeLlm(reply: FakeLlm["reply"] = "", configured = true): FakeLlm { + const l: FakeLlm = { + configured, + requests: [], + reply, + describe: () => "fake/llm", + async complete(req) { + l.requests.push({ system: req.system, user: req.user }); + if (l.reply instanceof Error) throw l.reply; + const out = typeof l.reply === "function" ? await l.reply(req.user) : l.reply; + if (req.signal?.aborted) { + const e = new Error("aborted"); + e.name = "AbortError"; + throw e; + } + return out; + }, + }; + return l; +} + +/** Manual clock: intervals fire only when advance() is called. */ +export function manualClock(start = 1_000_000) { + let now = start; + let nextId = 1; + const timers = new Map void; ms: number; at: number }>(); + return { + now: () => now, + setInterval(fn: () => void, ms: number): unknown { + const id = nextId++; + timers.set(id, { fn, ms, at: now + ms }); + return id; + }, + clearInterval(h: unknown) { + timers.delete(h as number); + }, + advance(ms: number) { + const end = now + ms; + for (;;) { + let due: { id: number; t: { fn: () => void; ms: number; at: number } } | null = null; + for (const [id, t] of timers) if (t.at <= end && (!due || t.at < due.t.at)) due = { id, t }; + if (!due) break; + now = due.t.at; + due.t.at += due.t.ms; + due.t.fn(); + } + now = end; + }, + pending: () => timers.size, + }; +} + +export const flush = async (n = 6): Promise => { + for (let i = 0; i < n; i++) await new Promise((r) => setImmediate(r)); +}; + +export interface FakePlayer extends Player { + plays: Buffer[]; + seeks: number[]; + rateValue: number; + pos: number; + finish(end?: PlayEnd): void; +} + +export function fakePlayer(): FakePlayer { + let resolve: ((e: PlayEnd) => void) | null = null; + let status: "idle" | "playing" | "paused" = "idle"; + const p: FakePlayer = { + plays: [], + play(wav) { + resolve?.("stopped"); + p.plays.push(wav); + p.pos = 0; // like the real players: a new clip starts at 0 + status = "playing"; + return new Promise((r) => { + resolve = r; + }); + }, + pause() { + if (status !== "playing") return false; + status = "paused"; + return true; + }, + resume() { + if (status !== "paused") return false; + status = "playing"; + return true; + }, + stop() { + status = "idle"; + const r = resolve; + resolve = null; + r?.("stopped"); + }, + status: () => status, + seeks: [], + rateValue: 1, + positionSec: () => p.pos, + pos: 1, + durationSec: () => 2, + seek(sec) { + if (status === "idle") return false; + p.seeks.push(sec); + if (sec >= 2) { + p.finish("ended"); + return true; + } + p.pos = Math.max(0, sec); + return true; + }, + setRate(r) { + p.rateValue = r; + }, + rate: () => p.rateValue, + dispose() {}, + finish(end = "ended") { + status = "idle"; + const r = resolve; + resolve = null; + r?.(end); + }, + }; + return p; +} + +export function fakeSynth( + name: SynthName, + impl?: (seg: SpeechSegment) => Promise, +): Synth & { calls: SpeechSegment[] } { + const s = { + name, + calls: [] as SpeechSegment[], + async synthesize(seg: SpeechSegment) { + s.calls.push(seg); + return impl ? impl(seg) : Buffer.from(`${name}:${seg.text}`); + }, + supports: () => true, + warm() {}, + async dispose() {}, + }; + return s; +} diff --git a/src/tts/piper.test.ts b/src/tts/piper.test.ts new file mode 100644 index 0000000..8eb4e7f --- /dev/null +++ b/src/tts/piper.test.ts @@ -0,0 +1,250 @@ +import { describe, expect, test } from "bun:test"; +import { EventEmitter } from "node:events"; + +import { SynthError } from "../types.ts"; +import { + createPiperSynth, + defaultPiperVoice, + findPiperVoices, + pcmToWav, + type PiperDeps, +} from "./piper.ts"; + +class FakeStdin extends EventEmitter { + written = ""; + ended = false; + write(data: string): boolean { + this.written += data; + return true; + } + end(): void { + this.ended = true; + } +} + +class FakePiper extends EventEmitter { + stdin = new FakeStdin(); + stdout = new EventEmitter(); + stderr = new EventEmitter(); + signals: string[] = []; + kill(signal?: NodeJS.Signals): boolean { + this.signals.push(signal ?? "SIGTERM"); + return true; + } +} + +const VI = "/voices/vi_VN-vais1000-medium.onnx"; +const EN = "/voices/en_US-ryan-high.onnx"; + +function setup(behave: (child: FakePiper) => void, extra: Partial = {}) { + const spawned: { cmd: string; args: readonly string[]; child: FakePiper }[] = []; + const synth = createPiperSynth({ + voiceFor: (lang) => (lang === "vi" ? VI : lang === "en" ? EN : null), + deps: { + spawn: (cmd, args) => { + const child = new FakePiper(); + spawned.push({ cmd, args, child }); + setImmediate(() => behave(child)); + return child; + }, + exists: (f) => f === VI || f === EN, + readFile: (f) => { + if (f === `${VI}.json`) return JSON.stringify({ audio: { sample_rate: 16000 } }); + throw new Error("ENOENT"); + }, + ...extra, + }, + }); + return { synth, spawned }; +} + +async function rejection(p: Promise): Promise { + try { + await p; + } catch (err) { + if (err instanceof SynthError) return err; + throw err; + } + throw new Error("expected rejection"); +} + +const ok = (child: FakePiper): void => { + child.stdout.emit("data", Buffer.alloc(320, 1)); + child.emit("close", 0, null); +}; + +describe("createPiperSynth", () => { + test("spawns piper with the language voice and returns a WAV at the voice rate", async () => { + const { synth, spawned } = setup(ok); + const wav = await synth.synthesize({ lang: "vi", text: "Xin chào\ncác bạn" }); + expect(spawned[0]?.cmd).toBe("piper"); + expect(spawned[0]?.args).toEqual(["-m", VI, "--output-raw"]); + expect(spawned[0]?.child.stdin.written).toBe("Xin chào các bạn\n"); + expect(spawned[0]?.child.stdin.ended).toBe(true); + expect(wav.subarray(0, 4).toString()).toBe("RIFF"); + expect(wav.readUInt32LE(24)).toBe(16000); + expect(wav.length).toBe(44 + 320); + }); + + test("falls back to 22050 Hz when the voice config is missing", async () => { + const { synth } = setup(ok); + const wav = await synth.synthesize({ lang: "en", text: "Hello" }); + expect(wav.readUInt32LE(24)).toBe(22050); + }); + + test("abort kills piper and rejects ABORTED", async () => { + const { synth, spawned } = setup(() => {}); + const ac = new AbortController(); + const p = synth.synthesize({ lang: "en", text: "Hello" }, ac.signal); + await new Promise((r) => setImmediate(r)); + ac.abort(); + const err = await rejection(p); + expect(err.code).toBe("ABORTED"); + expect(spawned[0]?.child.signals).toEqual(["SIGKILL"]); + }); + + test("already-aborted signal does not spawn", async () => { + const { synth, spawned } = setup(ok); + const ac = new AbortController(); + ac.abort(); + expect((await rejection(synth.synthesize({ lang: "en", text: "x" }, ac.signal))).code).toBe( + "ABORTED", + ); + expect(spawned.length).toBe(0); + }); + + test("no voice configured for the language -> UNAVAILABLE", async () => { + const synth = createPiperSynth({ voiceFor: () => null, deps: { voicesDir: "/voices" } }); + const err = await rejection(synth.synthesize({ lang: "vi", text: "x" })); + expect(err.code).toBe("UNAVAILABLE"); + expect(err.message).toBe("No Piper voice for vi — add one to /voices"); + expect(synth.supports("vi")).toBe(false); + }); + + test("voice file missing -> UNAVAILABLE naming the path", async () => { + const { synth, spawned } = setup(ok, { exists: () => false }); + const err = await rejection(synth.synthesize({ lang: "en", text: "x" })); + expect(err.code).toBe("UNAVAILABLE"); + expect(err.message).toContain(EN); + expect(spawned.length).toBe(0); + }); + + test("piper missing on PATH -> UNAVAILABLE", async () => { + const { synth } = setup((child) => { + const err = Object.assign(new Error("spawn piper ENOENT"), { code: "ENOENT" }); + child.emit("error", err); + }); + const err = await rejection(synth.synthesize({ lang: "en", text: "x" })); + expect(err.code).toBe("UNAVAILABLE"); + expect(err.message).toBe("Piper not found on PATH — install piper-tts"); + }); + + test("spawn throwing -> UNAVAILABLE", async () => { + const synth = createPiperSynth({ + voiceFor: () => EN, + deps: { + exists: () => true, + spawn: () => { + throw new Error("EMFILE"); + }, + }, + }); + expect((await rejection(synth.synthesize({ lang: "en", text: "x" }))).message).toBe( + "Piper could not start (EMFILE)", + ); + }); + + test("non-zero exit -> FAILED with stderr tail", async () => { + const { synth } = setup((child) => { + child.stderr.emit("data", "Traceback\nRuntimeError: bad model\n"); + child.emit("close", 1, null); + }); + const err = await rejection(synth.synthesize({ lang: "en", text: "x" })); + expect(err.code).toBe("FAILED"); + expect(err.message).toBe("Piper failed (code=1): Traceback | RuntimeError: bad model"); + }); + + test("no audio -> FAILED", async () => { + const { synth } = setup((child) => child.emit("close", 0, null)); + expect((await rejection(synth.synthesize({ lang: "en", text: "x" }))).message).toBe( + "Piper produced no audio", + ); + }); + + test("dispose kills running piper; the pending call resolves ABORTED", async () => { + const { synth, spawned } = setup(() => {}); + const p = synth.synthesize({ lang: "en", text: "x" }); + await new Promise((r) => setImmediate(r)); + await synth.dispose(); + const child = spawned[0]?.child; + expect(child?.signals).toEqual(["SIGKILL"]); + child?.emit("close", null, "SIGKILL"); + expect((await rejection(p)).code).toBe("ABORTED"); + }); + + test("never logs speech text", async () => { + const logs: string[] = []; + const synth = createPiperSynth({ + voiceFor: () => EN, + logger: { log: (_s, m) => logs.push(m) }, + deps: { + exists: () => true, + readFile: () => "{}", + spawn: () => { + const child = new FakePiper(); + setImmediate(() => ok(child)); + return child; + }, + }, + }); + await synth.synthesize({ lang: "en", text: "secret words" }); + expect(logs.join("\n")).not.toContain("secret"); + }); +}); + +describe("voices", () => { + const files = [ + "en_US-ryan-high.onnx", + "en_US-ryan-high.onnx.json", + "vi_VN-vivos-x_low.onnx", + "vi_VN-vais1000-medium.onnx", + "de_DE-thorsten-low.onnx", + ]; + const deps = { voicesDir: "/v", readdir: () => files }; + + test("findPiperVoices lists onnx models with language", () => { + expect(findPiperVoices(deps)).toEqual([ + { path: "/v/de_DE-thorsten-low.onnx", lang: null, name: "de_DE-thorsten-low" }, + { path: "/v/en_US-ryan-high.onnx", lang: "en", name: "en_US-ryan-high" }, + { path: "/v/vi_VN-vais1000-medium.onnx", lang: "vi", name: "vi_VN-vais1000-medium" }, + { path: "/v/vi_VN-vivos-x_low.onnx", lang: "vi", name: "vi_VN-vivos-x_low" }, + ]); + }); + + test("missing voices dir -> empty list, no default", () => { + const missing = { + voicesDir: "/nope", + readdir: (): string[] => { + throw new Error("ENOENT"); + }, + }; + expect(findPiperVoices(missing)).toEqual([]); + expect(defaultPiperVoice("vi", missing)).toBeNull(); + }); + + test("defaultPiperVoice prefers known voices, else any for the language", () => { + expect(defaultPiperVoice("vi", deps)).toBe("/v/vi_VN-vais1000-medium.onnx"); + expect(defaultPiperVoice("en", deps)).toBe("/v/en_US-ryan-high.onnx"); + expect( + defaultPiperVoice("en", { voicesDir: "/v", readdir: () => ["en_GB-alan-low.onnx"] }), + ).toBe("/v/en_GB-alan-low.onnx"); + }); +}); + +test("pcmToWav writes a 44-byte PCM header", () => { + const wav = pcmToWav(Buffer.alloc(10), 24000); + expect(wav.toString("ascii", 0, 4)).toBe("RIFF"); + expect(wav.toString("ascii", 8, 12)).toBe("WAVE"); + expect(wav.readUInt32LE(40)).toBe(10); + expect(wav.readUInt32LE(28)).toBe(48000); +}); diff --git a/src/tts/piper.ts b/src/tts/piper.ts new file mode 100644 index 0000000..b7e0f45 --- /dev/null +++ b/src/tts/piper.ts @@ -0,0 +1,274 @@ +// Piper engine: offline fallback TTS, one voice model per language. +// Ported from the Piper parts of lib/tts.js (synthPiperToPcm, getVoiceModel, +// getVoiceRate, resolveVoiceOrWarn) and lib/tts-engines/piper.js. + +import { spawn as nodeSpawn, type SpawnOptions } from "node:child_process"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; + +import { + SynthError, + errorMessage, + type Logger, + type SpeechLang, + type SpeechSegment, + type Synth, +} from "../types.ts"; + +export const PIPER_VOICES_DIR = path.join(os.homedir(), ".local", "share", "piper-voices"); +const DEFAULT_RATE = 22050; +/** Preferred voice per language when several are installed. */ +const PREFERRED: Record = { + vi: ["vi_VN-vais1000-medium", "vi_VN-vivos-x_low"], + en: ["en_US-ryan-high", "en_US-bryce-medium"], +}; + +// ---------------------------------------------------------------- deps + +interface Stream { + on(event: "data", cb: (chunk: Buffer) => void): unknown; +} + +export interface PiperChild { + readonly stdin: { + write(data: string): unknown; + end(): unknown; + on(event: "error", cb: (err: Error) => void): unknown; + } | null; + readonly stdout: Stream | null; + readonly stderr: Stream | null; + on(event: "close" | "error", listener: (...args: unknown[]) => void): unknown; + kill(signal?: NodeJS.Signals): boolean; +} + +export interface PiperDeps { + spawn(cmd: string, args: readonly string[], opts: SpawnOptions): PiperChild; + exists(file: string): boolean; + readFile(file: string): string; + readdir(dir: string): string[]; + voicesDir: string; +} + +const defaultDeps: PiperDeps = { + spawn: (cmd, args, opts) => nodeSpawn(cmd, args, opts), + exists: (file) => fs.existsSync(file), + readFile: (file) => fs.readFileSync(file, "utf8"), + readdir: (dir) => fs.readdirSync(dir), + voicesDir: PIPER_VOICES_DIR, +}; + +// ---------------------------------------------------------------- voices + +export interface PiperVoice { + readonly path: string; + readonly lang: SpeechLang | null; + readonly name: string; +} + +function langOf(name: string): SpeechLang | null { + const prefix = name.split(/[_-]/)[0]?.toLowerCase(); + return prefix === "vi" || prefix === "en" ? prefix : null; +} + +/** Installed *.onnx voices in the Piper voices dir, sorted by name. */ +export function findPiperVoices(deps?: Partial): PiperVoice[] { + const d = { ...defaultDeps, ...deps }; + let files: string[]; + try { + files = d.readdir(d.voicesDir); + } catch { + return []; + } + return files + .filter((f) => f.endsWith(".onnx")) + .sort() + .map((f) => { + const name = f.slice(0, -".onnx".length); + return { path: path.join(d.voicesDir, f), lang: langOf(name), name }; + }); +} + +/** Preferred installed voice for lang, else any installed one, else null. */ +export function defaultPiperVoice(lang: SpeechLang, deps?: Partial): string | null { + const voices = findPiperVoices(deps).filter((v) => v.lang === lang); + for (const name of PREFERRED[lang]) { + const hit = voices.find((v) => v.name === name); + if (hit) return hit.path; + } + return voices[0]?.path ?? null; +} + +// ---------------------------------------------------------------- wav + +export function pcmToWav(pcm: Buffer, sampleRate: number): Buffer { + const header = Buffer.alloc(44); + header.write("RIFF", 0, "ascii"); + header.writeUInt32LE(36 + pcm.length, 4); + header.write("WAVE", 8, "ascii"); + header.write("fmt ", 12, "ascii"); + header.writeUInt32LE(16, 16); + header.writeUInt16LE(1, 20); // PCM + header.writeUInt16LE(1, 22); // mono + header.writeUInt32LE(sampleRate, 24); + header.writeUInt32LE(sampleRate * 2, 28); + header.writeUInt16LE(2, 32); + header.writeUInt16LE(16, 34); + header.write("data", 36, "ascii"); + header.writeUInt32LE(pcm.length, 40); + return Buffer.concat([header, pcm]); +} + +function voiceRate(voice: string, d: PiperDeps): number { + try { + const cfg: unknown = JSON.parse(d.readFile(`${voice}.json`)); + if (typeof cfg === "object" && cfg !== null && "audio" in cfg) { + const audio = cfg.audio; + if (typeof audio === "object" && audio !== null && "sample_rate" in audio) { + const rate = audio.sample_rate; + if (typeof rate === "number" && rate > 0) return rate; + } + } + } catch { + // missing or broken config: Piper's common rate + } + return DEFAULT_RATE; +} + +// ---------------------------------------------------------------- engine + +export interface PiperOptions { + /** Voice model path for a language, or null when none is configured. */ + readonly voiceFor: (lang: SpeechLang) => string | null; + readonly logger?: Logger; + readonly deps?: Partial; +} + +export function createPiperSynth(opts: PiperOptions): Synth { + const d: PiperDeps = { ...defaultDeps, ...opts.deps }; + const running = new Set(); + const log = (message: string, level: "debug" | "warn" | "error" = "debug"): void => + opts.logger?.log("TTS", message, level); + + function run(voice: string, text: string, signal?: AbortSignal): Promise { + return new Promise((resolve, reject) => { + let child: PiperChild; + try { + child = d.spawn("piper", ["-m", voice, "--output-raw"], { + stdio: ["pipe", "pipe", "pipe"], + }); + } catch (err) { + reject(new SynthError(`Piper could not start (${errorMessage(err)})`, "UNAVAILABLE")); + return; + } + running.add(child); + const chunks: Buffer[] = []; + let stderr = ""; + let settled = false; + const finish = (fn: () => void): void => { + if (settled) return; + settled = true; + running.delete(child); + signal?.removeEventListener("abort", onAbort); + fn(); + }; + const onAbort = (): void => { + try { + child.kill("SIGKILL"); + } catch { + // already gone + } + finish(() => reject(new SynthError("Piper synthesis stopped", "ABORTED"))); + }; + signal?.addEventListener("abort", onAbort, { once: true }); + child.stdout?.on("data", (chunk) => chunks.push(chunk)); + child.stderr?.on("data", (chunk) => { + stderr = (stderr + String(chunk)).slice(-2000); + }); + child.on("error", (err) => { + const code = err instanceof Error && "code" in err ? err.code : undefined; + const message = + code === "ENOENT" + ? "Piper not found on PATH — install piper-tts" + : `Piper could not start (${errorMessage(err)})`; + finish(() => reject(new SynthError(message, "UNAVAILABLE"))); + }); + child.on("close", (code, sig) => { + if (code === null && typeof sig === "string") { + // Killed (dispose or external): treat as a stop, not a failure. + finish(() => reject(new SynthError("Piper synthesis stopped", "ABORTED"))); + return; + } + if (typeof code === "number" && code !== 0) { + const tail = stderr.trim().split(/\r?\n/).slice(-2).join(" | ").slice(-240); + log(`piper exited code=${code}`, "warn"); + finish(() => + reject( + new SynthError(`Piper failed (code=${code})${tail ? `: ${tail}` : ""}`, "FAILED"), + ), + ); + return; + } + const pcm = Buffer.concat(chunks); + if (pcm.length === 0) { + finish(() => reject(new SynthError("Piper produced no audio", "FAILED"))); + return; + } + finish(() => resolve(pcmToWav(pcm, voiceRate(voice, d)))); + }); + if (signal?.aborted) { + onAbort(); + return; + } + child.stdin?.on("error", () => { + // piper died before reading stdin; reported by close/error + }); + try { + child.stdin?.write(`${text.replace(/\s+/g, " ").trim()}\n`); + child.stdin?.end(); + } catch { + // reported by close/error + } + }); + } + + return { + name: "piper", + + supports(lang: SpeechLang): boolean { + return opts.voiceFor(lang) !== null; + }, + + async synthesize(seg: SpeechSegment, signal?: AbortSignal): Promise { + if (signal?.aborted) throw new SynthError("Piper synthesis stopped", "ABORTED"); + const voice = opts.voiceFor(seg.lang); + if (!voice) { + throw new SynthError( + `No Piper voice for ${seg.lang} — add one to ${d.voicesDir}`, + "UNAVAILABLE", + ); + } + if (!d.exists(voice)) { + throw new SynthError( + `Piper voice not found: ${voice} — check the voice setting`, + "UNAVAILABLE", + ); + } + log(`piper synth lang=${seg.lang} chars=${seg.text.length}`); + return run(voice, seg.text, signal); + }, + + warm(): void {}, + + async dispose(): Promise { + for (const child of running) { + try { + child.kill("SIGKILL"); + } catch { + // already gone + } + } + running.clear(); + }, + }; +} diff --git a/src/tts/session.test.ts b/src/tts/session.test.ts new file mode 100644 index 0000000..d483097 --- /dev/null +++ b/src/tts/session.test.ts @@ -0,0 +1,366 @@ +import { describe, expect, test } from "bun:test"; +import { createSettings, memoryKv, parseOptions } from "../config.ts"; +import { fakeLlm, fakePlayer, fakeSynth, flush } from "../testing/fakes.ts"; +import { SynthError, type SpeechSegment, type SynthName } from "../types.ts"; +import { createTtsMachine, needsLlmSpeech } from "./session.ts"; + +function harness( + o: { + vieneu?: (seg: SpeechSegment) => Promise; + reply?: string; + llm?: ReturnType; + recording?: boolean; + engine?: "vieneu" | "piper"; + } = {}, +) { + const kv = memoryKv(); + const settings = createSettings(kv, parseOptions({ ttsEngine: o.engine ?? "vieneu" })); + const toasts: string[] = []; + const idle: Array<(id: string) => void> = []; + const player = fakePlayer(); + const vieneu = fakeSynth("vieneu", o.vieneu); + const piper = fakeSynth("piper"); + let reply = o.reply ?? "Xin chào. Hello world."; + const machine = createTtsMachine({ + host: { + toast: (m) => void toasts.push(m), + currentSessionID: () => "ses_1", + anySessionID: () => "ses_1", + lastAssistantText: () => reply, + onSessionIdle: (h) => { + idle.push(h); + return () => {}; + }, + kv, + }, + settings, + logger: { log() {} }, + llm: o.llm ?? fakeLlm("", false), + normalizePrompt: "N", + prepareSpeech: (t) => t, + // One segment per sentence, language by diacritics, for predictable tests. + splitSegments: (t) => + t + .split(/(?<=\.)\s+/) + .filter(Boolean) + .map((s) => ({ lang: /[à-ỹđ]/i.test(s) ? "vi" : "en", text: s }) as SpeechSegment), + mergeForEngine: (segs) => segs, + synth: (n: SynthName) => (n === "vieneu" ? vieneu : piper), + player, + clipDuration: () => 2, + isRecording: () => o.recording === true, + }); + return { + machine, + settings, + toasts, + player, + vieneu, + piper, + kv, + fireIdle: (id = "ses_1") => idle.forEach((h) => h(id)), + setReply: (r: string) => void (reply = r), + }; +} + +describe("tts machine", () => { + test("reads parts in order and returns to idle", async () => { + const h = harness(); + h.machine.toggle(); + expect(h.machine.view().phase.kind).toBe("preparing"); + await flush(); + expect(h.machine.view().phase.kind).toBe("playing"); + expect(h.player.plays.map(String)).toEqual(["vieneu:Xin chào."]); + h.player.finish(); + await flush(); + expect(h.player.plays.map(String)).toEqual(["vieneu:Xin chào.", "vieneu:Hello world."]); + h.player.finish(); + await flush(); + expect(h.machine.view().phase.kind).toBe("idle"); + expect(h.machine.view().canReplay).toBe(true); + }); + + test("prefetches the next part while the current one plays", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + expect(h.vieneu.calls.length).toBe(2); + }); + + test("toggle while busy stops immediately", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.machine.toggle(); + expect(h.machine.view().phase.kind).toBe("idle"); + await flush(); + expect(h.player.plays.length).toBe(1); + }); + + test("VieNeu failure falls back to Piper per language, one notice", async () => { + const h = harness({ + vieneu: async () => { + throw new SynthError("VieNeu unavailable (exited) — using Piper", "UNAVAILABLE"); + }, + }); + h.machine.toggle(); + await flush(); + expect(String(h.player.plays[0])).toBe("piper:Xin chào."); + expect(h.toasts.filter((t) => t.includes("using Piper")).length).toBe(1); + h.player.finish(); + await flush(); + expect(String(h.player.plays[1])).toBe("piper:Hello world."); + expect(h.toasts.filter((t) => t.includes("using Piper")).length).toBe(1); + expect(h.machine.view().engine).toBe("piper"); + }); + + test("a new speech supersedes the old one; the stale part never plays", async () => { + let release: (b: Buffer) => void = () => {}; + let first = true; + const h = harness({ + vieneu: (seg) => { + if (first) { + first = false; + return new Promise((r) => (release = r)); + } + return Promise.resolve(Buffer.from(`v:${seg.text}`)); + }, + }); + h.machine.speakText("Old one."); + await flush(); + h.machine.speakText("New one."); + await flush(); + release(Buffer.from("stale")); + await flush(); + expect(h.player.plays.map(String)).toEqual(["v:New one."]); + }); + + test("pause and resume", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + expect(h.machine.pause()).toBe(true); + expect(h.machine.view().phase.kind).toBe("paused"); + expect(h.machine.pause()).toBe(true); + expect(h.machine.view().phase.kind).toBe("playing"); + }); + + test("replay plays the last reading again", async () => { + const h = harness({ reply: "One." }); + h.machine.toggle(); + await flush(); + h.player.finish(); + await flush(); + expect(h.machine.replay()).toBe(true); + expect(h.player.plays.map(String)).toEqual(["vieneu:One.", "vieneu:One."]); + }); + + test("auto-read speaks each reply once, skips other sessions, waits while dictating", async () => { + const h = harness({ reply: "Done." }); + h.fireIdle(); + expect(h.player.plays.length).toBe(0); // auto-read off + h.settings.setTtsAuto(true); + h.fireIdle("ses_other"); + await flush(); + expect(h.player.plays.length).toBe(0); + h.fireIdle(); + await flush(); + expect(h.player.plays.length).toBe(1); + h.player.finish(); + await flush(); + h.fireIdle(); // same reply again (e.g. another TUI or a duplicate event) + await flush(); + expect(h.player.plays.length).toBe(1); + + const r = harness({ reply: "Busy.", recording: true }); + r.settings.setTtsAuto(true); + r.fireIdle(); + await flush(); + expect(r.player.plays.length).toBe(0); + expect(r.toasts.at(-1)).toContain("press Reply"); + }); + + test("normalization uses the LLM and falls back locally on failure", async () => { + const ok = harness({ reply: "**Hi** see `src/a.ts`.", llm: fakeLlm("Hi there.") }); + ok.machine.toggle(); + await flush(); + expect(String(ok.player.plays[0])).toBe("vieneu:Hi there."); + + const bad = harness({ reply: "Run `x`.", llm: fakeLlm(new Error("down")) }); + bad.machine.toggle(); + await flush(); + expect(String(bad.player.plays[0])).toBe("vieneu:Run `x`."); + + const plain = harness({ reply: "Xong rồi.", llm: fakeLlm("SHOULD NOT BE USED") }); + plain.machine.toggle(); + await flush(); + expect(String(plain.player.plays[0])).toBe("vieneu:Xong rồi."); + }); + + test("player failure ends in idle with an error toast", async () => { + const h = harness({ reply: "One." }); + h.player.play = () => Promise.reject(new Error("sox not found")); + h.machine.toggle(); + await flush(); + expect(h.machine.view().phase.kind).toBe("idle"); + expect(h.toasts.at(-1)).toContain("sox not found"); + }); + + test("no reply: friendly message, stays idle", async () => { + const h = harness({ reply: "" }); + h.machine.toggle(); + expect(h.machine.view().phase.kind).toBe("idle"); + expect(h.toasts.at(-1)).toContain("No assistant reply"); + }); +}); + +test("needsLlmSpeech only flags code, markup, paths and links", () => { + expect(needsLlmSpeech("Xong rồi, tôi đã sửa lỗi.")).toBe(false); + expect(needsLlmSpeech("Done. All tests pass.")).toBe(false); + expect(needsLlmSpeech("Edit `parseConfig` in src/helpers.ts")).toBe(true); + expect(needsLlmSpeech("```ts\nx\n```")).toBe(true); + expect(needsLlmSpeech("See https://example.com")).toBe(true); + expect(needsLlmSpeech("| a | b |")).toBe(true); +}); + +test("stopping mid-reply keeps the heard parts replayable", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.machine.stop(); + await flush(); + expect(h.machine.view().canReplay).toBe(true); +}); + +test("auto-read retries once when the reply text lands after the idle event", async () => { + const h = harness({ reply: "" }); + h.settings.setTtsAuto(true); + h.fireIdle(); + await flush(); + expect(h.player.plays.length).toBe(0); + h.setReply("Late reply."); + await new Promise((r) => setTimeout(r, 1600)); + await flush(); + expect(h.player.plays.length).toBe(1); +}); + +describe("speed and seeking", () => { + test("saved speed is applied to the player at start and changes are saved", () => { + const h = harness(); + expect(h.player.rate()).toBe(1); + h.machine.setRate(1.5); + expect(h.player.rateValue).toBe(1.5); + expect(h.settings.ttsRate()).toBe(1.5); + expect(h.machine.view().rate).toBe(1.5); + expect(h.machine.cycleRate()).toBe(1.75); + h.machine.setRate(2); + expect(h.machine.cycleRate()).toBe(0.75); // wraps + h.machine.setRate(9); + expect(h.machine.view().rate).toBe(2); // clamped + }); + + test("seek within a part moves the player", async () => { + const h = harness(); + expect(h.machine.seekBy(5)).toBe(false); // nothing playing + h.machine.toggle(); + await flush(); + h.player.pos = 1; + expect(h.machine.seekBy(0.5)).toBe(true); + expect(h.player.seeks).toEqual([1.5]); + h.machine.seekBy(-5); + expect(h.player.seeks.at(-1)).toBe(0); // first part: clamp at 0 + }); + + test("position and duration cover the whole reply, not one part", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.player.pos = 0.5; + expect(h.machine.view()).toMatchObject({ + positionSec: 0.5, + durationSec: 4, + durationFinal: true, + }); + h.player.finish(); // part 1 (2 s) done + await flush(); + h.player.pos = 0.5; + expect(h.machine.view()).toMatchObject({ positionSec: 2.5, durationSec: 4 }); + }); + + test("duration is marked unfinished while later parts are synthesizing", async () => { + let release: () => void = () => {}; + const h = harness({ + vieneu: (seg) => + seg.text === "Hello world." + ? new Promise((r) => (release = () => r(Buffer.from(`vieneu:${seg.text}`)))) + : Promise.resolve(Buffer.from(`vieneu:${seg.text}`)), + }); + h.machine.toggle(); + await flush(); + expect(h.machine.view()).toMatchObject({ durationSec: 2, durationFinal: false }); + release(); + await flush(); + expect(h.machine.view()).toMatchObject({ durationSec: 4, durationFinal: true }); + }); + + test("forward across a part boundary lands at the right offset in the next part", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.player.pos = 1; // 1 s into part 1 → +1.5 s = 0.5 s into part 2 + h.machine.seekBy(1.5); + await flush(); + expect(h.player.plays.map(String)).toEqual(["vieneu:Xin chào.", "vieneu:Hello world."]); + expect(h.player.seeks.at(-1)).toBe(0.5); + expect(h.machine.view().phase).toMatchObject({ kind: "playing", part: 2 }); + }); + + test("forward past the end of the reply finishes it", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.player.pos = 1; + h.machine.seekBy(5); + await flush(); + expect(h.player.plays.map(String)).toEqual(["vieneu:Xin chào."]); + expect(h.machine.view().phase.kind).toBe("idle"); + }); + + test("rewind past the start of a part jumps back into the previous part", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.player.finish(); // part 1 done + await flush(); + expect(h.machine.view().phase).toMatchObject({ part: 2 }); + h.player.pos = 1; // 1s into part 2; parts are 2s long + h.machine.seekBy(-1.5); + await flush(); + // Back to part 1 at 2 - 0.5 = 1.5s. + expect(h.player.plays.map(String)).toEqual([ + "vieneu:Xin chào.", + "vieneu:Hello world.", + "vieneu:Xin chào.", + ]); + expect(h.player.seeks.at(-1)).toBe(1.5); + expect(h.machine.view().phase).toMatchObject({ kind: "playing", part: 1 }); + // And it keeps going in order afterwards. + h.player.finish(); + await flush(); + expect(String(h.player.plays.at(-1))).toBe("vieneu:Hello world."); + }); + + test("rewinding while paused stays paused", async () => { + const h = harness(); + h.machine.toggle(); + await flush(); + h.player.finish(); + await flush(); + h.machine.pause(); + h.player.pos = 0.2; + h.machine.seekBy(-1); + await flush(); + expect(h.machine.view().phase).toMatchObject({ kind: "paused", part: 1 }); + expect(h.player.status()).toBe("paused"); + }); +}); diff --git a/src/tts/session.ts b/src/tts/session.ts new file mode 100644 index 0000000..4045460 --- /dev/null +++ b/src/tts/session.ts @@ -0,0 +1,490 @@ +// TTS state machine: prepare text → synthesize part by part (VieNeu, Piper +// fallback) ahead of playback → play the clips in order. Position, duration +// and seeking are on the timeline of the whole reply; parts are an internal +// detail (logged, and shown in /voice-status). +// One operation id guards every async step; stop/new speech invalidates the +// old one so stale audio can never play or clear the status line. +import type { Host } from "../host.ts"; +import type { Settings } from "../config.ts"; +import type { Llm, Logger, Player, SpeechSegment, Synth, SynthName } from "../types.ts"; +import { PLAYBACK_RATES, SynthError, clampRate, errorMessage, isAbortError } from "../types.ts"; + +export type TtsPhase = + | { readonly kind: "idle" } + | { + readonly kind: "preparing"; + readonly step: "normalizing" | "synthesizing"; + readonly since: number; + } + | { readonly kind: "playing"; readonly part: number; readonly parts: number } + | { readonly kind: "paused"; readonly part: number; readonly parts: number }; + +export interface TtsView { + readonly phase: TtsPhase; + /** Position in the whole reply. */ + readonly positionSec: number; + /** Duration of the parts synthesized so far. */ + readonly durationSec: number; + /** False while later parts are still being synthesized (duration grows). */ + readonly durationFinal: boolean; + readonly engine: SynthName | null; + readonly canReplay: boolean; + /** Playback speed, e.g. 1.25. */ + readonly rate: number; +} + +export interface TtsDeps { + host: Pick< + Host, + "toast" | "currentSessionID" | "anySessionID" | "lastAssistantText" | "onSessionIdle" | "kv" + >; + settings: Settings; + logger: Logger; + llm: Llm; + normalizePrompt: string; + prepareSpeech(markdown: string): string; + splitSegments(text: string): SpeechSegment[]; + mergeForEngine(segs: SpeechSegment[], engineHandlesMixed: boolean): SpeechSegment[]; + synth(name: SynthName): Synth; + player: Player; + /** Duration of a WAV clip in seconds (for seeking across clips). */ + clipDuration(wav: Buffer): number; + /** True while the user is dictating: auto-read must not talk over them. */ + isRecording(): boolean; + clock?: { now(): number }; +} + +export interface TtsMachine { + /** Reply button: read the latest reply, or stop when busy. */ + toggle(): void; + speakReply(): void; + speakText(text: string, opts?: { normalize?: boolean }): void; + /** Pause/resume playback. False when nothing is playing. */ + pause(): boolean; + stop(): boolean; + replay(): boolean; + /** Jump by `deltaSec` (negative = back). False when nothing is playing. */ + seekBy(deltaSec: number): boolean; + /** Set the speed (saved). Applies right away. */ + setRate(rate: number): void; + /** Next preset speed, wrapping: 0.75 → 1 → 1.25 → 1.5 → 1.75 → 2 → 0.75. */ + cycleRate(): number; + view(): TtsView; + isBusy(): boolean; + onChange(cb: () => void): () => void; + dispose(): void; +} + +const NORMALIZE_TIMEOUT_MS = 15_000; +const NORMALIZE_MAX_CHARS = 6000; +const FALLBACK_NOTICE_MS = 120_000; + +export function createTtsMachine(deps: TtsDeps): TtsMachine { + const { host, settings, logger, player } = deps; + const now = deps.clock?.now ?? (() => Date.now()); + let phase: TtsPhase = { kind: "idle" }; + let op = 0; + let abort: AbortController | null = null; + let engine: SynthName | null = null; + let lastWavs: Buffer[] = []; + let lastFallbackNotice = 0; + let disposed = false; + const listeners = new Set<() => void>(); + player.setRate(settings.ttsRate()); + + const emit = (): void => { + for (const cb of listeners) { + try { + cb(); + } catch {} + } + }; + const setPhase = (p: TtsPhase): void => { + phase = p; + emit(); + }; + + function stopInternal(): boolean { + const wasBusy = phase.kind !== "idle"; + op += 1; + try { + abort?.abort(); + } catch {} + abort = null; + jump = null; + current = null; + player.stop(); + engine = null; + if (wasBusy) setPhase({ kind: "idle" }); + return wasBusy; + } + + /** Synthesize one segment; VieNeu failures fall back to Piper per language. */ + async function synthesize(seg: SpeechSegment, signal: AbortSignal): Promise { + const primary = settings.ttsEngine(); + if (primary === "vieneu") { + try { + const wav = await deps.synth("vieneu").synthesize(seg, signal); + engine = "vieneu"; + return [wav]; + } catch (err) { + if (signal.aborted || isAbortError(err)) throw err; + const reason = err instanceof SynthError ? err.message : errorMessage(err); + logger.log("tts", `vieneu failed: ${reason}`, "warn"); + if (now() - lastFallbackNotice > FALLBACK_NOTICE_MS) { + lastFallbackNotice = now(); + host.toast( + reason.includes("Piper") ? reason : `VieNeu unavailable (${reason}) — using Piper`, + "warning", + 5000, + ); + } + } + } + // Piper speaks one language per voice: re-split mixed text. + const piper = deps.synth("piper"); + const out: Buffer[] = []; + for (const part of deps.splitSegments(seg.text)) { + out.push(await piper.synthesize(part, signal)); + } + engine = "piper"; + return out; + } + + async function run(myOp: number, text: string, normalize: boolean): Promise { + const signal = abort?.signal ?? new AbortController().signal; + let speech = deps.prepareSpeech(text); + if ( + normalize && + deps.llm.configured && + text.length <= NORMALIZE_MAX_CHARS && + needsLlmSpeech(text) + ) { + setPhase({ kind: "preparing", step: "normalizing", since: now() }); + try { + const out = await deps.llm.complete({ + system: deps.normalizePrompt, + user: text, + maxTokens: 4096, + signal: AbortSignal.any([signal, AbortSignal.timeout(NORMALIZE_TIMEOUT_MS)]), + ...(host.anySessionID() ? { sessionID: host.anySessionID() as string } : {}), + }); + if (out.trim()) speech = deps.prepareSpeech(out); + } catch (err) { + if (myOp !== op) return; + logger.log("tts", `normalize failed, reading locally: ${errorMessage(err)}`, "warn"); + } + if (myOp !== op) return; + } + const segs = deps.mergeForEngine(deps.splitSegments(speech), settings.ttsEngine() === "vieneu"); + if (segs.length === 0) { + setPhase({ kind: "idle" }); + host.toast("Nothing speakable in that reply", "info", 2500); + return; + } + setPhase({ kind: "preparing", step: "synthesizing", since: now() }); + logger.log("tts", `speak parts=${segs.length} chars=${speech.length}`); + const list = newPlaylist(segs.length); + // Producer: synthesize every part ahead of playback, in order. + void (async () => { + try { + for (const seg of segs) { + if (myOp !== op) return; + const wavs = await synthesize(seg, signal); + if (myOp !== op) return; + list.add(wavs); + } + } catch (err) { + list.fail(err); + return; + } + list.done(); + })(); + await playList(myOp, list); + } + + // ------------------------------------------------------------ playlist + + interface Playlist { + readonly clips: Buffer[]; + /** Duration of each clip in seconds. */ + readonly durs: number[]; + /** Expected number of parts while synthesis runs (for the "2/3" label). */ + readonly expected: number; + finished: boolean; + error: unknown; + add(wavs: Buffer[]): void; + done(): void; + fail(err: unknown): void; + /** Resolves when clip `idx` exists or synthesis ended. */ + wait(idx: number): Promise; + } + + function newPlaylist(expected: number, clips: Buffer[] = [], finished = false): Playlist { + let wake: (() => void) | null = null; + const notify = (): void => { + const w = wake; + wake = null; + w?.(); + }; + const pl: Playlist = { + clips, + durs: clips.map((c) => deps.clipDuration(c)), + expected, + finished, + error: null, + add(wavs) { + pl.clips.push(...wavs); + pl.durs.push(...wavs.map((w) => deps.clipDuration(w))); + notify(); + }, + done() { + pl.finished = true; + notify(); + }, + fail(err) { + pl.error = err; + pl.finished = true; + notify(); + }, + wait(idx) { + if (idx < pl.clips.length || pl.finished) return Promise.resolve(); + return new Promise((r) => { + wake = r; + }); + }, + }; + return pl; + } + + /** Start of clip `idx` on the whole-reply timeline. */ + const startOf = (list: Playlist, idx: number): number => + list.durs.slice(0, idx).reduce((a, b) => a + b, 0); + const totalOf = (list: Playlist): number => startOf(list, list.durs.length); + const fmt = (sec: number): string => sec.toFixed(2); + + /** Where playback must continue after a seek crossed a clip boundary. */ + let jump: { idx: number; offset: number } | null = null; + let current: { list: Playlist; idx: number } | null = null; + + async function playList(myOp: number, list: Playlist): Promise { + let idx = 0; + let offset = 0; + try { + for (;;) { + if (idx >= list.clips.length && !list.finished) { + await list.wait(idx); + if (myOp !== op) return; + } + const wav = list.clips[idx]; + if (!wav) { + if (list.error && !isAbortError(list.error)) throw list.error; + break; // all parts played + } + current = { list, idx }; + const parts = Math.max(list.expected, list.clips.length); + const pausedBefore = phase.kind === "paused"; + // Load the clip before announcing it, so the status line never shows + // the previous clip's position under the new part number. + const ended = player.play(wav); + if (offset > 0) player.seek(offset); + if (pausedBefore) player.pause(); // keep a paused session paused across a jump + setPhase({ kind: pausedBefore ? "paused" : "playing", part: idx + 1, parts }); + logger.log( + "tts", + `part ${idx + 1}/${parts} start offset=${fmt(offset)} dur=${fmt(list.durs[idx] ?? 0)} at=${fmt(startOf(list, idx) + offset)}/${fmt(totalOf(list))}${list.finished ? "" : "+"}`, + ); + offset = 0; + const end = await ended; + if (myOp !== op) return; + if (jump) { + ({ idx, offset } = jump); + jump = null; + continue; + } + if (end === "stopped") break; + idx += 1; + } + } catch (err) { + if (myOp !== op) return; + if (!isAbortError(err)) { + host.toast(`Speech failed: ${errorMessage(err)}`, "error", 6000); + logger.log("tts", `speech failed: ${errorMessage(err)}`, "error"); + } + } finally { + // Whatever was synthesized stays replayable, also after a stop. + if (list.clips.length) lastWavs = [...list.clips]; + if (myOp === op) { + current = null; + setPhase({ kind: "idle" }); + } else { + emit(); // canReplay changed + } + } + } + + function speak(text: string, normalize: boolean): void { + if (disposed) return; + stopInternal(); + const myOp = op; + abort = new AbortController(); + setPhase({ kind: "preparing", step: "normalizing", since: now() }); + void run(myOp, text, normalize).catch((err: unknown) => { + if (myOp !== op) return; + host.toast(`Speech failed: ${errorMessage(err)}`, "error"); + setPhase({ kind: "idle" }); + }); + } + + function speakReply(): void { + const sessionID = host.currentSessionID(); + const text = sessionID ? host.lastAssistantText(sessionID) : ""; + if (!text) { + host.toast("No assistant reply to read in this session", "info", 2500); + return; + } + speak(text, true); + } + + // Auto-read: only the TUI showing that session speaks, once per reply + // (the dedupe key lives in shared storage, so other TUIs skip it). + const retried = new Set(); + function autoRead(sessionID: string, isRetry = false): void { + if (disposed || !settings.ttsAuto()) return; + if (isRetry && !host.lastAssistantText(sessionID)) return; + if (host.currentSessionID() !== sessionID) return; + const text = host.lastAssistantText(sessionID); + if (!text) { + // The final message can reach the store after the idle event. + if (!retried.has(sessionID)) { + retried.add(sessionID); + setTimeout(() => { + retried.delete(sessionID); + autoRead(sessionID, true); + }, 1500).unref?.(); + } + return; + } + const key = `${sessionID}:${text.length}:${hash(text)}`; + if (host.kv.get("tts.lastSpoken") === key) return; + logger.log("tts", `auto-read session reply chars=${text.length}`); + host.kv.set("tts.lastSpoken", key); + if (deps.isRecording()) { + host.toast("Reply ready — press Reply to hear it", "info", 3000); + return; + } + speak(text, true); + } + host.onSessionIdle((sessionID) => autoRead(sessionID)); + + return { + toggle() { + if (phase.kind === "idle") speakReply(); + else stopInternal(); + }, + speakReply, + speakText(text, opts) { + speak(text, opts?.normalize ?? false); + }, + pause() { + if (phase.kind === "playing" && player.pause()) { + setPhase({ kind: "paused", part: phase.part, parts: phase.parts }); + return true; + } + if (phase.kind === "paused" && player.resume()) { + setPhase({ kind: "playing", part: phase.part, parts: phase.parts }); + return true; + } + return false; + }, + stop: stopInternal, + replay() { + if (lastWavs.length === 0) return false; + const wavs = lastWavs; + stopInternal(); + const myOp = op; + void playList(myOp, newPlaylist(wavs.length, [...wavs], true)); + return true; + }, + seekBy(deltaSec) { + if ((phase.kind !== "playing" && phase.kind !== "paused") || !current) return false; + const { list, idx } = current; + const from = startOf(list, idx) + player.positionSec(); + const total = totalOf(list); + const target = Math.max(0, from + deltaSec); + // Find the part that holds `target` on the whole-reply timeline. + let i = 0; + let start = 0; + while (i < list.durs.length && target >= start + (list.durs[i] as number)) { + start += list.durs[i] as number; + i += 1; + } + const offset = target - start; + logger.log( + "tts", + `seek ${deltaSec > 0 ? "+" : ""}${deltaSec}s: part ${idx + 1} at=${fmt(from)} → ${i < list.durs.length ? `part ${i + 1} offset=${fmt(offset)}` : list.finished ? "end" : `part ${i + 1} (not synthesized yet) from start`} at=${fmt(Math.min(target, total))}/${fmt(total)}${list.finished ? "" : "+"}`, + ); + if (i === idx) return player.seek(offset); + if (i >= list.durs.length && list.finished) { + // Past the end of the reply: finish the current part and stop there. + jump = { idx: list.durs.length, offset: 0 }; + return player.seek(Number.POSITIVE_INFINITY); + } + // Another part (or the next one still being synthesized, from its start). + jump = { idx: i, offset: i < list.durs.length ? offset : 0 }; + return player.seek(Number.POSITIVE_INFINITY); // ends this clip; the loop jumps + }, + setRate(rate) { + const r = clampRate(rate); + settings.setTtsRate(r); + player.setRate(r); + emit(); + }, + cycleRate() { + const cur = player.rate(); + const next = PLAYBACK_RATES.find((r) => r > cur + 0.001) ?? PLAYBACK_RATES[0]; + this.setRate(next); + return next; + }, + view() { + return { + phase, + positionSec: current ? startOf(current.list, current.idx) + player.positionSec() : 0, + durationSec: current ? totalOf(current.list) : 0, + durationFinal: current ? current.list.finished : true, + engine, + canReplay: lastWavs.length > 0, + rate: player.rate(), + }; + }, + isBusy: () => phase.kind !== "idle", + onChange(cb) { + listeners.add(cb); + return () => listeners.delete(cb); + }, + dispose() { + disposed = true; + stopInternal(); + listeners.clear(); + }, + }; +} + +/** + * Plain prose reads fine after local cleanup; the LLM pass (seconds of + * latency) is only worth it for code, markup, paths and links. + */ +export function needsLlmSpeech(text: string): boolean { + return /```|`[^`\n]+`|^\s*\|.*\||^#{1,6}\s|\*\*|https?:\/\/|[\w-]+\/[\w./-]+|\b\w+\.(?:ts|js|py|json|md|go|rs|swift|tsx|jsx|yml|yaml|sh)\b|[{}<>=]/m.test( + text, + ); +} + +function hash(s: string): string { + let h = 2166136261; + for (let i = 0; i < s.length; i++) { + h ^= s.charCodeAt(i); + h = Math.imul(h, 16777619); + } + return (h >>> 0).toString(36); +} diff --git a/src/tts/text.test.ts b/src/tts/text.test.ts new file mode 100644 index 0000000..fb8ca26 --- /dev/null +++ b/src/tts/text.test.ts @@ -0,0 +1,167 @@ +import { describe, expect, test } from "bun:test"; + +import { + detectLang, + mergeForEngine, + prepareSpeech, + splitSegments, + summarizeMermaid, + summarizeTable, +} from "./text.ts"; + +describe("prepareSpeech", () => { + test("empty input", () => { + expect(prepareSpeech("")).toBe(""); + }); + + test("fenced code becomes 'code snippet', inline code is split into words", () => { + const out = prepareSpeech( + "Run this:\n\n```bash\nrm -rf node_modules\n```\n\nThen call `getVoiceModel`.", + ); + expect(out).toContain("code snippet"); + expect(out).not.toContain("rm -rf"); + expect(out).not.toContain("`"); + expect(out).toContain("get Voice Model"); + }); + + test("an unterminated fence hides the rest", () => { + expect(prepareSpeech("Look:\n```js\nconst x = 1;")).toBe("Look: code snippet."); + }); + + test("links keep their label, URLs become the domain, images keep alt text", () => { + const out = prepareSpeech( + "See [the docs](https://x.dev/a). Visit https://github.com/foo/bar. ![logo](a.png)", + ); + expect(out).toContain("See the docs."); + expect(out).toContain("github dot com."); + expect(out).toContain("logo"); + expect(out).not.toContain("http"); + expect(out).not.toContain("]("); + }); + + test("paths read their last segment, files say 'dot'", () => { + const out = prepareSpeech("Edit /usr/local/bin/piper and src/tts/text.ts, then ~/notes."); + expect(out).toContain("piper"); + expect(out).not.toContain("/usr"); + expect(out).toContain("text dot ts,"); + expect(out).toContain("notes."); + }); + + test("headings, bullets, emphasis and html are stripped; items become sentences", () => { + const out = prepareSpeech("## Kết quả\n\n- **Đã sửa** lỗi\n- _done_
item\n\n> quoted"); + expect(out).toBe("Kết quả. Đã sửa lỗi. done item. quoted."); + }); + + test("tables and mermaid diagrams become short summaries", () => { + const md = + "| Name | Status |\n|---|---|\n| a | ok |\n| b | fail |\n\n```mermaid\ngraph TD\nA[Start] --> B[End]\n```"; + const out = prepareSpeech(md); + expect(out).toContain("Table with columns Name, Status. 2 rows: a, ok; b, fail."); + expect(out).toContain("Diagram, graph: Start, End."); + expect(out).not.toContain("|"); + }); + + test("unfenced mermaid is summarized", () => { + const out = prepareSpeech("flowchart LR\nA[One] --> B[Two]\n\nAfter."); + expect(out).toBe("Diagram, flowchart: One, Two. After."); + }); + + test("summaries", () => { + expect(summarizeTable("|---|")).toBe("Table."); + expect(summarizeMermaid("sequenceDiagram\nA->>B: hi")).toBe("Diagram."); + const many = ["| h |", "|---|", "| 1 |", "| 2 |", "| 3 |", "| 4 |"].join("\n"); + expect(summarizeTable(many)).toBe("Table with columns h. 4 rows: 1; 2; 3. And 1 more."); + }); +}); + +describe("detectLang", () => { + test("vi by diacritics ratio, en otherwise", () => { + expect(detectLang("Xin chào các bạn")).toBe("vi"); + expect(detectLang("Hello world, this is fine")).toBe("en"); + expect(detectLang("")).toBe("en"); + expect(detectLang("Mình dùng React và TypeScript")).toBe("vi"); + }); +}); + +describe("splitSegments", () => { + test("groups adjacent sentences by language", () => { + const segs = splitSegments( + "Xin chào các bạn. Hôm nay trời đẹp. This is English. And more English. Tạm biệt nhé.", + ); + expect(segs).toEqual([ + { lang: "vi", text: "Xin chào các bạn. Hôm nay trời đẹp." }, + { lang: "en", text: "This is English. And more English." }, + { lang: "vi", text: "Tạm biệt nhé." }, + ]); + }); + + test("chunks long groups at sentence boundaries within maxChars", () => { + const sentence = "This is a fairly ordinary English sentence for testing."; + const segs = splitSegments(Array(10).fill(sentence).join(" "), { maxChars: 120 }); + expect(segs.length).toBeGreaterThan(1); + for (const s of segs) { + expect(s.text.length).toBeLessThanOrEqual(120); + expect(s.text.endsWith(".")).toBe(true); + expect(s.lang).toBe("en"); + } + expect(segs.map((s) => s.text).join(" ")).toBe(Array(10).fill(sentence).join(" ")); + }); + + test("a sentence longer than maxChars splits at commas, then words", () => { + const long = Array(12).fill("một hai ba bốn năm").join(", ") + "."; + const segs = splitSegments(long, { maxChars: 60 }); + for (const s of segs) expect(s.text.length).toBeLessThanOrEqual(60); + expect(segs[0]?.text.endsWith(",")).toBe(true); + expect(segs.map((s) => s.text).join(" ")).toBe(long); + const words = Array(40).fill("word").join(" "); + for (const s of splitSegments(words, { maxChars: 50 })) { + expect(s.text.length).toBeLessThanOrEqual(50); + } + }); + + test("a single unbreakable token is hard-cut", () => { + const segs = splitSegments("x".repeat(100), { maxChars: 40 }); + expect(segs.map((s) => s.text.length)).toEqual([40, 40, 20]); + }); + + test("default max is 240 and empty input gives nothing", () => { + expect(splitSegments(" ")).toEqual([]); + const segs = splitSegments(Array(30).fill("Short sentence here.").join(" ")); + for (const s of segs) expect(s.text.length).toBeLessThanOrEqual(240); + }); +}); + +describe("mergeForEngine", () => { + const segs = splitSegments( + "Xin chào các bạn. This is English. Tạm biệt nhé, hẹn gặp lại các bạn vào ngày mai.", + ); + + test("piper keeps per-language groups", () => { + expect(mergeForEngine(segs, false)).toEqual(segs); + expect(segs.length).toBe(3); + }); + + test("vieneu merges mixed segments up to maxChars with majority language", () => { + const merged = mergeForEngine(segs, true); + expect(merged).toEqual([ + { + lang: "vi", + text: "Xin chào các bạn. This is English. Tạm biệt nhé, hẹn gặp lại các bạn vào ngày mai.", + }, + ]); + }); + + test("vieneu merge respects maxChars", () => { + const merged = mergeForEngine( + [ + { lang: "en", text: "a".repeat(30) }, + { lang: "vi", text: "b".repeat(30) }, + { lang: "vi", text: "c".repeat(30) }, + ], + true, + { maxChars: 61 }, + ); + expect(merged.map((s) => s.text.length)).toEqual([61, 30]); + expect(merged[0]?.lang).toBe("en"); // tie -> first segment's language + }); +}); diff --git a/src/tts/text.ts b/src/tts/text.ts new file mode 100644 index 0000000..f1ee8d4 --- /dev/null +++ b/src/tts/text.ts @@ -0,0 +1,296 @@ +// Text preparation for TTS: markdown -> speakable text, sentence/language +// segmentation, and chunking. Pure functions, no I/O. +// +// Ported from lib/tts.js (sanitizeSpokenText, localSpeechCleanup, +// summarizeMarkdownTable, summarizeMermaidForSpeech) and lib/tts/lang.js. + +import type { SpeechLang, SpeechSegment } from "../types.ts"; + +export const MAX_SEGMENT_CHARS = 240; + +// ---------------------------------------------------------------- markdown + +const MERMAID_FENCE_RE = /```mermaid[^\S\n]*\r?\n?([\s\S]*?)```/gi; +const MERMAID_DECL_RE = + /^(graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt|pie|mindmap|journey|gitGraph)\b/i; +const MERMAID_LINE_RE = /-->|---|==>|-\.->|\[|\]|\(|\)/; +const MERMAID_DECL_MAX_LEN = 32; +const MERMAID_LABEL_CAP = 6; +const TABLE_BLOCK_RE = /((?:^[ \t]*\|.*\|[ \t]*$\n?){2,})/gm; +const TABLE_ROW_CAP = 3; +const TABLE_TEXT_CAP = 320; + +function splitTableCells(row: string): string[] { + return row + .trim() + .replace(/^\||\|$/g, "") + .split("|") + .map((cell) => cell.trim()); +} + +function isTableSeparator(line: string): boolean { + const cells = splitTableCells(line); + return cells.length > 0 && cells.every((cell) => /^:?-+:?$/.test(cell)); +} + +/** A literal table read is noise: say the columns and the first few rows. */ +export function summarizeTable(block: string): string { + const lines = block + .split("\n") + .map((line) => line.trim()) + .filter((line) => line.startsWith("|")); + const headerLine = lines.find((line) => !isTableSeparator(line)); + if (headerLine === undefined) return "Table."; + const headers = splitTableCells(headerLine).filter(Boolean); + const rows = lines + .slice(lines.indexOf(headerLine) + 1) + .filter((line) => !isTableSeparator(line)) + .map((line) => splitTableCells(line).filter(Boolean)) + .filter((cells) => cells.length > 0); + if (headers.length === 0 && rows.length === 0) return "Table."; + const shown = rows.slice(0, TABLE_ROW_CAP).map((cells) => cells.join(", ")); + let out = headers.length > 0 ? `Table with columns ${headers.join(", ")}.` : "Table."; + if (rows.length > 0) { + out += ` ${rows.length} row${rows.length === 1 ? "" : "s"}: ${shown.join("; ")}.`; + if (rows.length > shown.length) out += ` And ${rows.length - shown.length} more.`; + } + return out.length > TABLE_TEXT_CAP ? `${out.slice(0, TABLE_TEXT_CAP - 1)}…` : out; +} + +export function summarizeMermaid(code: string): string { + const firstLine = + code + .split("\n") + .map((line) => line.trim()) + .find(Boolean) ?? ""; + const kind = /^(graph|flowchart)\b/i.exec(firstLine)?.[1]?.toLowerCase() ?? ""; + const labels = [...code.matchAll(/\[([^[\]]+)\]/g)] + .map((m) => (m[1] ?? "").trim()) + .filter(Boolean) + .slice(0, MERMAID_LABEL_CAP); + const what = kind ? `Diagram, ${kind}` : "Diagram"; + return labels.length > 0 ? `${what}: ${labels.join(", ")}.` : `${what}.`; +} + +function replaceUnfencedMermaid(text: string): string { + const lines = text.split("\n"); + const kept: string[] = []; + for (let i = 0; i < lines.length; i++) { + const line = lines[i] ?? ""; + if (MERMAID_DECL_RE.test(line.trim()) && line.trim().length <= MERMAID_DECL_MAX_LEN) { + let j = i + 1; + while (j < lines.length && (lines[j] ?? "").trim() === "") j++; + const body: string[] = []; + let diagram = true; + for (; j < lines.length; j++) { + const next = lines[j] ?? ""; + if (next.trim() === "") break; + if (!MERMAID_LINE_RE.test(next)) { + diagram = false; + break; + } + body.push(next); + } + if (diagram && body.length > 0) { + kept.push(summarizeMermaid([line, ...body].join("\n"))); + i = j - 1; + continue; + } + } + kept.push(line); + } + return kept.join("\n"); +} + +function splitIdentifier(token: string): string { + return token + .replace(/([a-z0-9])([A-Z])/g, "$1 $2") + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2") + .replace(/[_-]+/g, " "); +} + +/** One whitespace-free token -> how it should be read aloud. */ +function speakToken(tok: string): string { + const m = /^(.*?)([.,;:!?)]*)$/.exec(tok); + const core = m?.[1] ?? tok; + const tail = m?.[2] ?? ""; + if (/^https?:\/\//i.test(core)) { + const domain = core.replace(/^https?:\/\/([^/?#]+).*$/i, "$1"); + return `${domain.replace(/\./g, " dot ")}${tail}`; + } + // Paths (/a/b, ~/a, ./a, a/b/c): only the last segment is worth hearing. + const isPath = /^(~|\.{1,2})?\//.test(core) || /\/.*\//.test(core); + const base = isPath || core.includes("/") ? core.slice(core.lastIndexOf("/") + 1) : core; + if (/^\w[\w.-]*\.[a-z0-9]{1,4}$/i.test(base)) { + const dot = base.lastIndexOf("."); + return `${splitIdentifier(base.slice(0, dot))} dot ${base.slice(dot + 1)}${tail}`; + } + return `${splitIdentifier(isPath ? base : core)}${tail}`; +} + +/** Headings and list items become their own sentences for better prosody. */ +function terminateLine(line: string): string { + const trimmed = line.trimEnd(); + if (!trimmed || /[.!?…:;,]$/.test(trimmed)) return trimmed; + return `${trimmed}.`; +} + +/** + * Deterministic markdown -> spoken text. Code blocks become "code snippet", + * inline code / identifiers are split into words, links keep their label, + * URLs become their domain, paths their last segment, tables and diagrams a + * short summary. + */ +export function prepareSpeech(markdown: string): string { + if (!markdown) return ""; + let out = markdown.replace(/\r\n?/g, "\n"); + out = out.replace(MERMAID_FENCE_RE, (_m, code: string) => `\n${summarizeMermaid(code)}\n`); + out = replaceUnfencedMermaid(out); + out = out.replace(TABLE_BLOCK_RE, (block: string) => `\n${summarizeTable(block)}\n`); + out = out.replace(/```[\s\S]*?```/g, " code snippet. "); + // An unterminated fence (truncated message) hides everything after it. + out = out.replace(/```[\s\S]*$/, " code snippet. "); + out = out.replace(/`([^`]+)`/g, (_m, code: string) => ` ${splitIdentifier(code)} `); + out = out.replace(/!\[([^\]]*)\]\([^)]+\)/g, "$1"); + out = out.replace(/\[([^\]]+)\]\(([^)]+)\)/g, "$1"); + out = out.replace(/<[^>]+>/g, " "); + out = out.replace(/^[ \t]*([-*_])(?:[ \t]*\1){2,}[ \t]*$/gm, ""); + const lines = out.split("\n"); + out = lines + .map((line, i) => { + const heading = /^\s*#{1,6}\s+(.*)$/.exec(line); + if (heading) return terminateLine(heading[1] ?? ""); + const bullet = /^[>\s]*[-*+]\s+(.*)$/.exec(line); + if (bullet) return terminateLine(bullet[1] ?? ""); + const quoted = line.replace(/^\s*>\s?/, ""); + const paragraphEnd = i === lines.length - 1 || (lines[i + 1] ?? "").trim() === ""; + return paragraphEnd || /^\s*\d+[.)]\s+\S/.test(quoted) ? terminateLine(quoted) : quoted; + }) + .join("\n"); + out = out.replace(/(\*\*|__)(.*?)\1/g, "$2"); + out = out.replace(/(^|\W)\*([^*\n]+)\*(?=\W|$)/g, "$1$2"); + out = out + .split(/(\s+)/) + .map((tok) => (!tok || /^\s+$/.test(tok) ? tok : speakToken(tok))) + .join(""); + return out + .replace(/\s+/g, " ") + .replace(/\s+([.,;:!?])/g, "$1") + .replace(/([.!?])(?:\s*\.)+/g, "$1") + .trim(); +} + +// ---------------------------------------------------------------- language + +const VI_CHAR_RE = /[àáảãạăắằẳẵặâấầẩẫậèéẻẽẹêếềểễệìíỉĩịòóỏõọôốồổỗộơớờởỡợùúủũụưứừửữựỳýỷỹỵđ]/i; +const VI_WORD_THRESHOLD = 0.15; + +/** "vi" when at least 15% of words carry Vietnamese diacritics, else "en". */ +export function detectLang(text: string): SpeechLang { + const words = text.split(/\s+/).filter(Boolean); + if (words.length === 0) return "en"; + const vi = words.filter((w) => VI_CHAR_RE.test(w)).length; + return vi / words.length >= VI_WORD_THRESHOLD ? "vi" : "en"; +} + +// ---------------------------------------------------------------- segments + +function splitSentences(text: string): string[] { + const flat = text.replace(/\s+/g, " ").trim(); + if (!flat) return []; + return flat + .split(/(?<=[.!?…])\s+(?=[\p{Lu}\p{N}"“'‘([])/u) + .map((s) => s.trim()) + .filter(Boolean); +} + +/** Split one over-long piece at `sep` boundaries, else words, else hard cut. */ +function splitLong(piece: string, maxChars: number): string[] { + if (piece.length <= maxChars) return [piece]; + for (const sep of [/(?<=[,;:])\s+/, /\s+/]) { + const parts = piece.split(sep).filter(Boolean); + if (parts.length < 2) continue; + return packParts( + parts.flatMap((p) => splitLong(p, maxChars)), + maxChars, + ); + } + const out: string[] = []; + for (let i = 0; i < piece.length; i += maxChars) out.push(piece.slice(i, i + maxChars)); + return out; +} + +/** Greedily join parts with spaces while staying within maxChars. */ +function packParts(parts: readonly string[], maxChars: number): string[] { + const out: string[] = []; + let current = ""; + for (const part of parts) { + if (current && current.length + 1 + part.length > maxChars) { + out.push(current); + current = ""; + } + current = current ? `${current} ${part}` : part; + } + if (current) out.push(current); + return out; +} + +/** + * Sentences grouped by language (adjacent same-language sentences join), + * then every group chunked to <= maxChars at sentence, then comma, then word + * boundaries. + */ +export function splitSegments(text: string, opts?: { maxChars?: number }): SpeechSegment[] { + const maxChars = Math.max(20, opts?.maxChars ?? MAX_SEGMENT_CHARS); + const groups: { lang: SpeechLang; sentences: string[] }[] = []; + for (const sentence of splitSentences(text)) { + const lang = detectLang(sentence); + const last = groups.at(-1); + if (last && last.lang === lang) last.sentences.push(sentence); + else groups.push({ lang, sentences: [sentence] }); + } + const out: SpeechSegment[] = []; + for (const group of groups) { + const pieces = group.sentences.flatMap((s) => splitLong(s, maxChars)); + for (const chunk of packParts(pieces, maxChars)) out.push({ lang: group.lang, text: chunk }); + } + return out; +} + +/** + * VieNeu code-switches vi+en in one pass, so for it adjacent segments merge + * up to maxChars regardless of language (lang = character majority). Piper + * needs one voice per language, so its per-language segments stay as-is. + */ +export function mergeForEngine( + segs: readonly SpeechSegment[], + engineHandlesMixed: boolean, + opts?: { maxChars?: number }, +): SpeechSegment[] { + if (!engineHandlesMixed) return [...segs]; + const maxChars = opts?.maxChars ?? MAX_SEGMENT_CHARS; + const out: SpeechSegment[] = []; + let parts: SpeechSegment[] = []; + let length = 0; + const flush = (): void => { + if (parts.length === 0) return; + let vi = 0; + let en = 0; + for (const p of parts) { + if (p.lang === "vi") vi += p.text.length; + else en += p.text.length; + } + const lang: SpeechLang = vi === en ? (parts[0]?.lang ?? "vi") : vi > en ? "vi" : "en"; + out.push({ lang, text: parts.map((p) => p.text).join(" ") }); + parts = []; + length = 0; + }; + for (const seg of segs) { + if (!seg.text) continue; + if (parts.length > 0 && length + 1 + seg.text.length > maxChars) flush(); + length += (parts.length > 0 ? 1 : 0) + seg.text.length; + parts.push(seg); + } + flush(); + return out; +} diff --git a/src/tts/vieneu.test.ts b/src/tts/vieneu.test.ts new file mode 100644 index 0000000..dc55a82 --- /dev/null +++ b/src/tts/vieneu.test.ts @@ -0,0 +1,695 @@ +import { describe, expect, test } from "bun:test"; +import { EventEmitter } from "node:events"; +import { spawnSync, type SpawnOptions } from "node:child_process"; +import { fileURLToPath } from "node:url"; + +import { SynthError } from "../types.ts"; +import { + VIENEU_VOICES, + createVieneuSynth, + fixStreamedWav, + stderrTail, + type VieneuFetchInit, + type VieneuOptions, +} from "./vieneu.ts"; + +const HEALTH = { status: "ok", backend: "onnx", max_streams: 1, sample_rate: 24000 }; +const WAV = Buffer.from("RIFF....WAVEfake"); + +class FakeChild extends EventEmitter { + pid = 4242; + stderr = new EventEmitter(); + signals: string[] = []; + kill(signal?: NodeJS.Signals): boolean { + this.signals.push(signal ?? "SIGTERM"); + return true; + } + exit(code: number | null, signal: string | null = null): void { + this.emit("exit", code, signal); + } +} + +type PortState = "vieneu" | "other" | "down"; +type SpeechHandler = (body: Record, init: VieneuFetchInit) => Promise; + +const tick = (): Promise => new Promise((r) => setImmediate(r)); + +function harness(over: Partial = {}) { + let clock = 0; + const ports = new Map(); + const probes: number[] = []; + const spawns: { cmd: string; args: readonly string[]; opts: SpawnOptions; child: FakeChild }[] = + []; + const sleeps: number[] = []; + const scheduled: { fn: () => void; ms: number; cancelled: boolean }[] = []; + const bodies: Record[] = []; + const logs: string[] = []; + let voice = "Mai Anh"; + const state = { + /** Cross-process start lock: true = another process holds it. */ + lockedByOther: false, + locks: 0, + /** Called on every spawn; default: the sidecar becomes healthy at once. */ + onSpawn: (_child: FakeChild, port: number): void => { + ports.set(port, "vieneu"); + }, + speech: (async () => new Response(WAV)) as SpeechHandler, + }; + + const synth = createVieneuSynth({ + python: "/venv/bin/python", + voice: () => voice, + logger: { log: (_s, m) => logs.push(m) }, + deps: { + now: () => clock, + sleep: async (ms, signal) => { + sleeps.push(ms); + if (signal?.aborted) throw new SynthError("aborted", "ABORTED"); + clock += ms; + await tick(); + if (signal?.aborted) throw new SynthError("aborted", "ABORTED"); + }, + schedule: (fn, ms) => { + const entry = { fn, ms, cancelled: false }; + scheduled.push(entry); + return () => { + entry.cancelled = true; + }; + }, + workDir: () => "/tmp/private-vieneu", + acquireStartLock: () => { + if (state.lockedByOther) return null; + state.locks += 1; + return () => { + state.locks -= 1; + }; + }, + spawn: (cmd, args, opts) => { + const child = new FakeChild(); + spawns.push({ cmd, args, opts, child }); + state.onSpawn(child, Number(opts.env?.["PORT"])); + return child; + }, + fetch: async (url, init) => { + const u = new URL(url); + const port = Number(u.port); + const st = ports.get(port) ?? "down"; + if (u.pathname === "/health") { + probes.push(port); + if (st === "down") throw new Error("ECONNREFUSED"); + if (st === "other") return Response.json({ status: "ok", app: "something else" }); + return Response.json(HEALTH); + } + if (st !== "vieneu") throw new Error("ECONNREFUSED"); + if (u.pathname === "/v1/voices") { + return Response.json({ object: "list", data: [{ id: "Mai Anh" }, { id: "Custom" }] }); + } + const body = JSON.parse(init.body ?? "{}") as Record; + bodies.push(body); + return state.speech(body, init); + }, + }, + ...over, + }); + + return { + synth, + ports, + probes, + spawns, + sleeps, + scheduled, + bodies, + logs, + state, + setVoice: (v: string) => { + voice = v; + }, + advance: (ms: number) => { + clock += ms; + }, + seg: { lang: "vi" as const, text: "Xin chào" }, + }; +} + +async function rejection(p: Promise): Promise { + try { + await p; + } catch (err) { + if (err instanceof SynthError) return err; + throw err; + } + throw new Error("expected rejection"); +} + +describe("createVieneuSynth", () => { + test("spawns the bundled server with a private cwd and HOST/PORT, then synthesizes", async () => { + const h = harness(); + const wav = await h.synth.synthesize(h.seg); + expect(wav.equals(WAV)).toBe(true); + expect(h.spawns.length).toBe(1); + const sp = h.spawns[0]; + expect(sp?.cmd).toBe("/venv/bin/python"); + expect(sp?.args.length).toBe(1); + expect(sp?.args[0]).toEndWith("src/tts/vieneu_server.py"); + expect(sp?.opts.cwd).toBe("/tmp/private-vieneu"); + expect(sp?.opts.env?.["HOST"]).toBe("127.0.0.1"); + expect(sp?.opts.env?.["PORT"]).toBe("8000"); + expect(h.bodies[0]).toEqual({ + model: "vieneu-v3-turbo", + input: "Xin chào", + voice: "Mai Anh", + response_format: "wav", + }); + expect(h.synth.supports("vi")).toBe(true); + expect(h.synth.supports("en")).toBe(true); + }); + + test("port scan walks a fixed base: 8000, 8001, 8002, 8003 (no skipped ports)", async () => { + const h = harness(); + h.ports.set(8000, "other"); + h.ports.set(8001, "other"); + h.ports.set(8002, "other"); + await h.synth.synthesize(h.seg); + expect(h.probes.slice(0, 4)).toEqual([8000, 8001, 8002, 8003]); + expect(h.spawns[0]?.opts.env?.["PORT"]).toBe("8003"); + }); + + test("all ports taken -> UNAVAILABLE naming the range", async () => { + const h = harness(); + for (const p of [8000, 8001, 8002, 8003]) h.ports.set(p, "other"); + const err = await rejection(h.synth.synthesize(h.seg)); + expect(err.code).toBe("UNAVAILABLE"); + expect(err.message).toBe("VieNeu unavailable (no free port in 8000-8003) — using Piper"); + expect(h.spawns.length).toBe(0); + }); + + test("a sidecar that fails to bind its port moves the scan on", async () => { + const h = harness(); + h.state.onSpawn = (child, port) => { + if (port === 8000) { + setImmediate(() => { + child.stderr.emit("data", "ERROR: [Errno 48] address already in use\n"); + child.exit(1); + }); + } else h.ports.set(port, "vieneu"); + }; + await h.synth.synthesize(h.seg); + expect(h.spawns.map((s) => s.opts.env?.["PORT"])).toEqual(["8000", "8001"]); + }); + + test("adopts a pre-existing sidecar only after verifying it is VieNeu", async () => { + const h = harness(); + h.ports.set(8000, "other"); // answers /health, but not VieNeu's shape + h.ports.set(8001, "vieneu"); + await h.synth.synthesize(h.seg); + expect(h.spawns.length).toBe(0); + expect(h.probes).toEqual([8000, 8001]); + expect(h.bodies.length).toBe(1); + await h.synth.dispose(); // nothing owned, nothing killed + }); + + test("an adopted sidecar that disappears is forgotten; the next call starts one", async () => { + const h = harness(); + h.ports.set(8000, "vieneu"); + await h.synth.synthesize(h.seg); + h.ports.set(8000, "down"); + const err = await rejection(h.synth.synthesize(h.seg)); + expect(err.code).toBe("FAILED"); + await h.synth.synthesize(h.seg); + expect(h.spawns.length).toBe(1); + }); + + test("concurrent callers share one start", async () => { + let ready: (() => void) | null = null; + const h = harness(); + h.state.onSpawn = (_c, port) => { + ready = () => h.ports.set(port, "vieneu"); + }; + h.synth.warm(); + const a = h.synth.synthesize(h.seg); + const b = h.synth.synthesize({ lang: "en", text: "Hello" }); + for (let i = 0; i < 5; i++) await tick(); + expect(h.spawns.length).toBe(1); + (ready as (() => void) | null)?.(); + await Promise.all([a, b]); + expect(h.spawns.length).toBe(1); + expect(h.bodies.length).toBe(2); + }); + + test("failed start: stderr tail in message, immediate UNAVAILABLE during cooldown, one background retry", async () => { + const h = harness(); + h.state.onSpawn = (child) => { + setImmediate(() => { + child.stderr.emit( + "data", + "Traceback (most recent call last):\n File x\nImportError: libfoo missing\n", + ); + child.exit(1); + }); + }; + const first = await rejection(h.synth.synthesize(h.seg)); + expect(first.code).toBe("UNAVAILABLE"); + expect(first.message).toStartWith("VieNeu unavailable (sidecar exited (code=1): "); + expect(first.message).toContain("ImportError: libfoo missing"); + expect(first.message).toEndWith(") — using Piper"); + + // Cooldown: no new start, fails fast. + const second = await rejection(h.synth.synthesize(h.seg)); + expect(second.code).toBe("UNAVAILABLE"); + expect(second.message).toBe(first.message); + h.synth.warm(); + expect(h.spawns.length).toBe(1); + + const retry = h.scheduled.find((s) => s.ms === 120_000 && !s.cancelled); + expect(retry).toBeDefined(); + + // Background retry succeeds after the cooldown. + let ready: (() => void) | null = null; + h.state.onSpawn = (_c, port) => { + ready = () => h.ports.set(port, "vieneu"); + }; + h.advance(120_000); + retry?.fn(); + await tick(); + expect(h.spawns.length).toBe(2); + // While the background retry runs, speech still falls back immediately. + expect((await rejection(h.synth.synthesize(h.seg))).code).toBe("UNAVAILABLE"); + (ready as (() => void) | null)?.(); + for (let i = 0; i < 5; i++) await tick(); + const wav = await h.synth.synthesize(h.seg); + expect(wav.equals(WAV)).toBe(true); + expect(h.spawns.length).toBe(2); + }); + + test("a failed background retry renews the cooldown without scheduling another", async () => { + const h = harness(); + h.state.onSpawn = (child) => setImmediate(() => child.exit(1)); + await rejection(h.synth.synthesize(h.seg)); + expect(h.scheduled.filter((s) => s.ms === 120_000).length).toBe(1); + h.advance(120_000); + h.scheduled[0]?.fn(); + for (let i = 0; i < 5; i++) await tick(); + expect(h.spawns.length).toBe(2); + expect(h.scheduled.filter((s) => s.ms === 120_000).length).toBe(1); + expect((await rejection(h.synth.synthesize(h.seg))).code).toBe("UNAVAILABLE"); + expect(h.spawns.length).toBe(2); + // After the renewed cooldown the call does not wait: it falls back at + // once (UNAVAILABLE) and the start is retried in the background. + h.advance(120_000); + expect((await rejection(h.synth.synthesize(h.seg))).code).toBe("UNAVAILABLE"); + for (let i = 0; i < 5; i++) await tick(); + expect(h.spawns.length).toBe(3); + // Once a retry succeeds, VieNeu is used again. + h.state.onSpawn = (_c, port) => void h.ports.set(port, "vieneu"); + h.advance(120_000); + await rejection(h.synth.synthesize(h.seg)); // kicks off the retry + for (let i = 0; i < 5; i++) await tick(); + expect((await h.synth.synthesize(h.seg)).length).toBeGreaterThan(0); + }); + + test("start times out after 180s and the process is killed", async () => { + const h = harness(); + h.state.onSpawn = (child) => { + setImmediate(() => child.stderr.emit("data", "loading model...\n")); + }; + const err = await rejection(h.synth.synthesize(h.seg)); + expect(err.code).toBe("UNAVAILABLE"); + expect(err.message).toBe( + "VieNeu unavailable (did not start within 180s: loading model...) — using Piper", + ); + expect(h.spawns[0]?.child.signals).toEqual(["SIGTERM"]); + // A SIGKILL follow-up is scheduled in case SIGTERM is ignored. + const killer = h.scheduled.find((s) => s.ms === 3000); + killer?.fn(); + expect(h.spawns[0]?.child.signals).toEqual(["SIGTERM", "SIGKILL"]); + }); + + test("spawn throwing -> UNAVAILABLE", async () => { + const h = harness({ + deps: { + spawn: () => { + throw new Error("EACCES"); + }, + fetch: async () => { + throw new Error("ECONNREFUSED"); + }, + schedule: () => () => {}, + }, + }); + const err = await rejection(h.synth.synthesize(h.seg)); + expect(err.message).toBe( + "VieNeu unavailable (cannot run /venv/bin/python: EACCES) — using Piper", + ); + }); + + test("async spawn error (python missing) -> UNAVAILABLE", async () => { + const h = harness(); + h.state.onSpawn = (child) => { + setImmediate(() => child.emit("error", new Error("spawn /venv/bin/python ENOENT"))); + }; + const err = await rejection(h.synth.synthesize(h.seg)); + expect(err.message).toContain("cannot run /venv/bin/python: spawn /venv/bin/python ENOENT"); + }); + + test("voice is read per request; changing it mid-start neither resets nor respawns", async () => { + let ready: (() => void) | null = null; + const h = harness(); + h.state.onSpawn = (_c, port) => { + ready = () => h.ports.set(port, "vieneu"); + }; + const p = h.synth.synthesize(h.seg); + await tick(); + h.setVoice("Ngọc Huyền"); + (ready as (() => void) | null)?.(); + await p; + h.setVoice("Adam"); + await h.synth.synthesize(h.seg); + expect(h.bodies.map((b) => b["voice"])).toEqual(["Ngọc Huyền", "Adam"]); + expect(h.spawns.length).toBe(1); + expect(h.spawns[0]?.child.signals).toEqual([]); + }); + + test("abort cancels the HTTP request without touching the sidecar", async () => { + const h = harness(); + let seen: AbortSignal | undefined; + h.state.speech = (_b, init) => + new Promise((_resolve, reject) => { + seen = init.signal; + init.signal?.addEventListener("abort", () => reject(new DOMException("x", "AbortError"))); + }); + const ac = new AbortController(); + const p = h.synth.synthesize(h.seg, ac.signal); + for (let i = 0; i < 5; i++) await tick(); + ac.abort(); + const err = await rejection(p); + expect(err.code).toBe("ABORTED"); + expect(seen?.aborted).toBe(true); + expect(h.spawns[0]?.child.signals).toEqual([]); + h.state.speech = async () => new Response(WAV); + await h.synth.synthesize(h.seg); + expect(h.spawns.length).toBe(1); + }); + + test("abort while waiting for start rejects ABORTED; the start continues", async () => { + let ready: (() => void) | null = null; + const h = harness(); + h.state.onSpawn = (_c, port) => { + ready = () => h.ports.set(port, "vieneu"); + }; + const ac = new AbortController(); + const p = h.synth.synthesize(h.seg, ac.signal); + await tick(); + ac.abort(); + expect((await rejection(p)).code).toBe("ABORTED"); + (ready as (() => void) | null)?.(); + await h.synth.synthesize(h.seg); + expect(h.spawns.length).toBe(1); + }); + + test("already-aborted signal rejects without starting anything", async () => { + const h = harness(); + const ac = new AbortController(); + ac.abort(); + expect((await rejection(h.synth.synthesize(h.seg, ac.signal))).code).toBe("ABORTED"); + expect(h.spawns.length).toBe(0); + }); + + test("429 is retried with backoff and never disposes the sidecar", async () => { + const h = harness(); + let calls = 0; + h.state.speech = async () => { + calls++; + return calls < 3 + ? Response.json({ error: { message: "server busy: queue full" } }, { status: 429 }) + : new Response(WAV); + }; + await h.synth.synthesize(h.seg); + expect(calls).toBe(3); + expect(h.sleeps.filter((ms) => ms === 500 || ms === 1000)).toEqual([500, 1000]); + expect(h.spawns[0]?.child.signals).toEqual([]); + }); + + test("busy on every try -> FAILED, sidecar kept for the next call", async () => { + const h = harness(); + h.state.speech = async () => + Response.json({ error: { message: "server busy" } }, { status: 503 }); + const err = await rejection(h.synth.synthesize(h.seg)); + expect(err.code).toBe("FAILED"); + expect(err.message).toBe("VieNeu busy after 3 tries (HTTP 503: server busy)"); + expect(h.bodies.length).toBe(3); + h.state.speech = async () => new Response(WAV); + await h.synth.synthesize(h.seg); + expect(h.spawns.length).toBe(1); + expect(h.spawns[0]?.child.signals).toEqual([]); + }); + + test("abort during busy backoff -> ABORTED", async () => { + const h = harness(); + const ac = new AbortController(); + h.state.speech = async () => { + ac.abort(); + return new Response("busy", { status: 429 }); + }; + expect((await rejection(h.synth.synthesize(h.seg, ac.signal))).code).toBe("ABORTED"); + }); + + test("object error bodies render as text", async () => { + const h = harness(); + h.state.speech = async () => + Response.json({ error: { message: "unknown voice 'X'", type: "invalid" } }, { status: 400 }); + const err = await rejection(h.synth.synthesize(h.seg)); + expect(err.message).toBe("VieNeu failed (HTTP 400: unknown voice 'X')"); + }); + + test("empty audio -> FAILED", async () => { + const h = harness(); + h.state.speech = async () => new Response(new Uint8Array(0)); + expect((await rejection(h.synth.synthesize(h.seg))).message).toBe("VieNeu returned no audio"); + }); + + test("an owned sidecar exiting after ready starts a cooldown and a background retry", async () => { + const h = harness(); + await h.synth.synthesize(h.seg); + h.spawns[0]?.child.stderr.emit("data", "Killed\n"); + h.spawns[0]?.child.exit(null, "SIGKILL"); + const err = await rejection(h.synth.synthesize(h.seg)); + expect(err.message).toBe( + "VieNeu unavailable (sidecar exited (signal=SIGKILL): Killed) — using Piper", + ); + expect(h.scheduled.some((s) => s.ms === 120_000)).toBe(true); + }); + + test("dispose kills owned processes (including one still starting) and cancels the retry", async () => { + const h = harness(); + h.state.onSpawn = () => {}; + const p = h.synth.synthesize(h.seg); + await tick(); + await h.synth.dispose(); + expect(h.spawns[0]?.child.signals).toEqual(["SIGTERM"]); + expect((await rejection(p)).code).toBe("UNAVAILABLE"); + expect((await rejection(h.synth.synthesize(h.seg))).code).toBe("UNAVAILABLE"); + expect(h.scheduled.filter((s) => s.ms === 120_000 && !s.cancelled).length).toBe(0); + }); + + test("dispose kills a ready owned sidecar", async () => { + const h = harness(); + await h.synth.synthesize(h.seg); + await h.synth.dispose(); + expect(h.spawns[0]?.child.signals).toEqual(["SIGTERM"]); + }); + + test("voices(): static list before start, server list after", async () => { + const h = harness(); + expect(await h.synth.voices()).toEqual([...VIENEU_VOICES]); + await h.synth.synthesize(h.seg); + expect(await h.synth.voices()).toEqual(["Mai Anh", "Custom"]); + }); + + test("never logs speech text", async () => { + const h = harness(); + await h.synth.synthesize({ lang: "vi", text: "bí mật riêng tư" }); + expect(h.logs.join("\n")).not.toContain("bí mật"); + }); + + test("stderrTail keeps the last lines on one line, bounded", () => { + expect(stderrTail("a\n\nb\nc\nd\n")).toBe("b | c | d"); + expect(stderrTail("")).toBe(""); + expect(stderrTail("x".repeat(500), 10)).toBe(`…${"x".repeat(10)}`); + }); +}); + +describe("fixStreamedWav", () => { + test("replaces 0xFFFFFFFF placeholder sizes with real ones", () => { + const header = Buffer.alloc(44); + header.write("RIFF", 0, "ascii"); + header.writeUInt32LE(0xffffffff, 4); + header.write("WAVEfmt ", 8, "ascii"); + header.writeUInt32LE(16, 16); + header.write("data", 36, "ascii"); + header.writeUInt32LE(0xffffffff, 40); + const wav = fixStreamedWav(Buffer.concat([header, Buffer.alloc(100)])); + expect(wav.readUInt32LE(4)).toBe(136); + expect(wav.readUInt32LE(40)).toBe(100); + }); + + test("leaves non-WAV data alone", () => { + expect(fixStreamedWav(Buffer.from("not a wav")).toString()).toBe("not a wav"); + }); + + test("synthesize returns the fixed WAV", async () => { + const h = harness(); + const streamed = Buffer.alloc(54); + streamed.write("RIFF", 0, "ascii"); + streamed.writeUInt32LE(0xffffffff, 4); + streamed.write("WAVEfmt ", 8, "ascii"); + streamed.writeUInt32LE(16, 16); + streamed.write("data", 36, "ascii"); + streamed.writeUInt32LE(0xffffffff, 40); + h.state.speech = async () => new Response(streamed); + const wav = await h.synth.synthesize(h.seg); + expect(wav.readUInt32LE(40)).toBe(10); + }); +}); + +// The sidecar bootstrap is Python; exercise its pure helpers when python3 exists. +const python3 = Bun.which("python3"); +describe.skipIf(!python3)("vieneu_server.py", () => { + const script = fileURLToPath(new URL("./vieneu_server.py", import.meta.url)); + const run = (program: string) => + spawnSync(python3 ?? "python3", ["-I", "-B", "-c", program, script], { encoding: "utf8" }); + const load = ` +import importlib.util, sys +spec = importlib.util.spec_from_file_location("bootstrap", sys.argv[1]) +m = importlib.util.module_from_spec(spec) +spec.loader.exec_module(m) +`; + + test("materializes symlinked model files without touching the source", () => { + const r = run(`${load} +import pathlib, tempfile +with tempfile.TemporaryDirectory() as tmp: + root = pathlib.Path(tmp) + (root / "blob").write_bytes(b"weights") + (root / "source").mkdir() + (root / "source" / "w.data").symlink_to(root / "blob") + out = m.materialize(root / "source", ["w.data", "missing.json"], root / "out") + assert (out / "w.data").read_bytes() == b"weights" + assert not (out / "w.data").is_symlink() + assert (root / "source" / "w.data").is_symlink() + try: + m.materialize(root / "source", ["../x"], root / "out") + raise SystemExit("accepted a path") + except ValueError: + pass +`); + expect(r.stderr).toBe(""); + expect(r.status).toBe(0); + }); + + test("closing a disconnected body always releases the stream slot once", () => { + const r = run(`${load} +class Engine: + def __init__(self): self.released = 0 + def release(self): self.released += 1 + +def chunks(engine): + try: + yield 1 + yield 2 + finally: + engine.release() + +def body(c): + yield b"header" + for x in c: + yield bytes([x]) + +# Disconnect after the header: inner generator never started. +e = Engine(); c = m.SlotChunks(e, chunks(e)); b = m.ClosingBody(body(c), c) +next(b); b.close(); b.close() +assert e.released == 1, e.released +assert list(b) == [] + +# Disconnect mid-stream: inner generator suspended. +e = Engine(); c = m.SlotChunks(e, chunks(e)); b = m.ClosingBody(body(c), c) +next(b); next(b); b.close() +assert e.released == 1, e.released + +# Normal completion, then close: no double release. +e = Engine(); c = m.SlotChunks(e, chunks(e)); b = m.ClosingBody(body(c), c) +assert list(b) == [b"header", b"\\x01", b"\\x02"] +b.close() +assert e.released == 1, e.released +`); + expect(r.stderr).toBe(""); + expect(r.status).toBe(0); + }); + + test("environment HOST/PORT are honored, defaulting to loopback:8000", () => { + const r = run(`${load} +import os +os.environ.pop("HOST", None); os.environ.pop("PORT", None) +assert m.server_address() == ("127.0.0.1", 8000) +os.environ["HOST"] = "127.0.0.1"; os.environ["PORT"] = "8003" +assert m.server_address() == ("127.0.0.1", 8003) +`); + expect(r.stderr).toBe(""); + expect(r.status).toBe(0); + }); +}); + +describe("cross-process start lock", () => { + test("waits for another OpenCode's VieNeu and shares it instead of spawning", async () => { + const h = harness(); + h.state.lockedByOther = true; + const p = h.synth.synthesize(h.seg); + await tick(); + await tick(); + expect(h.spawns.length).toBe(0); + h.ports.set(8000, "vieneu"); // the other process's server becomes healthy + expect((await p).length).toBeGreaterThan(0); + expect(h.spawns.length).toBe(0); + expect(h.logs.some((l) => l.includes("waiting to share"))).toBe(true); + expect(h.logs.some((l) => l.includes("adopted existing sidecar on port 8000"))).toBe(true); + }); + + test("spawns once the other process gave up and released the lock", async () => { + const h = harness(); + h.state.lockedByOther = true; + const p = h.synth.synthesize(h.seg); + await tick(); + h.state.lockedByOther = false; + await p; + expect(h.spawns.length).toBe(1); + expect(h.state.locks).toBe(0); // released after start + }); + + test("lock is released when the spawn fails", async () => { + const h = harness(); + h.state.onSpawn = (child) => setImmediate(() => child.exit(1)); + await rejection(h.synth.synthesize(h.seg)); + expect(h.state.locks).toBe(0); + }); +}); + +describe("fileStartLock", () => { + test("second acquire is refused while held, then allowed after release", async () => { + const { mkdtempSync } = await import("node:fs"); + const os = await import("node:os"); + const path = await import("node:path"); + const { fileStartLock } = await import("./vieneu.ts"); + const file = path.join(mkdtempSync(path.join(os.tmpdir(), "ocv-lock-")), "start.lock"); + const acquire = fileStartLock(file); + const release = acquire(); + expect(release).not.toBeNull(); + // Same pid counts as stale (a crashed earlier start in this process). + const { writeFileSync } = await import("node:fs"); + writeFileSync(file, JSON.stringify({ pid: process.ppid, at: Date.now() })); + expect(acquire()).toBeNull(); // live other process (our parent) holds it + writeFileSync(file, JSON.stringify({ pid: 999999, at: Date.now() })); + const again = acquire(); // dead pid: stale, stolen + expect(again).not.toBeNull(); + again?.(); + }); +}); diff --git a/src/tts/vieneu.ts b/src/tts/vieneu.ts new file mode 100644 index 0000000..fea9d8b --- /dev/null +++ b/src/tts/vieneu.ts @@ -0,0 +1,661 @@ +// VieNeu-TTS engine: a managed Python sidecar serving an OpenAI-compatible +// POST /v1/audio/speech (see https://github.com/pnnbao97/VieNeu-TTS). +// VieNeu speaks Vietnamese with English code-switching in one pass. +// +// Ported from lib/sidecars/vieneu-server.js + lib/tts-engines/vieneu.js with +// these fixes: fixed-base port scan, start timeout + failure cooldown with one +// background retry, voice read per request (no client reset), AbortSignal on +// every request, 429/503 retried with backoff instead of disposing, private +// working directory for the sidecar, adopted sidecars verified as VieNeu. + +import { spawn as nodeSpawn, type SpawnOptions } from "node:child_process"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +import { + SynthError, + errorMessage, + type Logger, + type SpeechLang, + type SpeechSegment, + type Synth, +} from "../types.ts"; + +export const DEFAULT_VIENEU_VOICE = "Mai Anh"; + +/** Preset voices shipped with VieNeu 3.x (used when the server is not up). */ +export const VIENEU_VOICES: readonly string[] = [ + "Adam bựa", + "Trúc Ly", + "Thiện Minh", + "Mai Anh", + "Hải Đăng", + "Thùy Dung", + "Thiền Tâm Đức", + "Ngọc Huyền", + "Quang Sơn", + "Ngọc Trân", + "Minh Đức", + "Phạm Tuyên", + "Thái Sơn", + "Xuân Vĩnh", + "Thanh Bình", + "Ngọc Linh", + "Đoan Trang", + "Thục Đoan", + "Minh Triết", + "Mỹ Duyên", + "Quỳnh Anh", + "Đức Trí", + "Kim Thanh", + "Adam", + "Quốc Tuấn", +]; + +const SERVER_SCRIPT = fileURLToPath(new URL("./vieneu_server.py", import.meta.url)); +const MODEL_ID = "vieneu-v3-turbo"; +const BUSY_TRIES = 3; +const KILL_GRACE_MS = 3000; +const STDERR_KEEP = 4000; + +// ---------------------------------------------------------------- deps + +export interface VieneuChild { + readonly pid?: number | undefined; + readonly stderr: { on(event: "data", cb: (chunk: Buffer | string) => void): unknown } | null; + on(event: "exit" | "error", listener: (...args: unknown[]) => void): unknown; + kill(signal?: NodeJS.Signals): boolean; +} + +export interface VieneuFetchInit { + method?: string; + headers?: Record; + body?: string; + signal?: AbortSignal; +} + +export interface VieneuResponse { + readonly ok: boolean; + readonly status: number; + json(): Promise; + arrayBuffer(): Promise; +} + +export interface VieneuDeps { + spawn(cmd: string, args: readonly string[], opts: SpawnOptions): VieneuChild; + fetch(url: string, init: VieneuFetchInit): Promise; + now(): number; + /** Resolves after ms; rejects when signal aborts. */ + sleep(ms: number, signal?: AbortSignal): Promise; + /** Run fn after ms (must not keep the process alive). Returns cancel. */ + schedule(fn: () => void, ms: number): () => void; + /** Private, empty working directory for the sidecar process. */ + workDir(): string; + /** + * Cross-process start lock: only one OpenCode instance spawns VieNeu at a + * time; the others wait and share its server. Returns a release function, + * or null while another live process holds the lock. + */ + acquireStartLock(): (() => void) | null; +} + +const LOCK_STALE_MS = 200_000; + +function pidAlive(pid: number): boolean { + try { + process.kill(pid, 0); + return true; + } catch (err) { + return (err as NodeJS.ErrnoException).code === "EPERM"; + } +} + +export function fileStartLock( + file: string, + now: () => number = Date.now, +): () => (() => void) | null { + return () => { + for (let attempt = 0; attempt < 2; attempt++) { + try { + const fd = fs.openSync(file, "wx", 0o600); + fs.writeSync(fd, JSON.stringify({ pid: process.pid, at: now() })); + fs.closeSync(fd); + return () => { + try { + const held = JSON.parse(fs.readFileSync(file, "utf8")) as { pid?: unknown }; + if (held.pid === process.pid) fs.unlinkSync(file); + } catch { + // already gone + } + }; + } catch (err) { + if ((err as NodeJS.ErrnoException).code !== "EEXIST") return () => {}; + let holder: { pid?: unknown; at?: unknown } = {}; + try { + holder = JSON.parse(fs.readFileSync(file, "utf8")) as typeof holder; + } catch { + // unreadable: treat as stale + } + const pid = typeof holder.pid === "number" ? holder.pid : 0; + const at = typeof holder.at === "number" ? holder.at : 0; + const live = pid > 0 && pid !== process.pid && pidAlive(pid) && now() - at < LOCK_STALE_MS; + if (live) return null; + try { + fs.unlinkSync(file); + } catch { + // raced with another remover + } + } + } + return null; + }; +} + +function defaultSleep(ms: number, signal?: AbortSignal): Promise { + return new Promise((resolve, reject) => { + if (signal?.aborted) { + reject(new SynthError("aborted", "ABORTED")); + return; + } + const onAbort = (): void => { + clearTimeout(timer); + reject(new SynthError("aborted", "ABORTED")); + }; + const timer = setTimeout(() => { + signal?.removeEventListener("abort", onAbort); + resolve(); + }, ms); + signal?.addEventListener("abort", onAbort, { once: true }); + }); +} + +const defaultDeps: VieneuDeps = { + spawn: (cmd, args, opts) => nodeSpawn(cmd, args, opts), + fetch: (url, init) => fetch(url, init), + now: () => Date.now(), + sleep: defaultSleep, + schedule: (fn, ms) => { + const timer = setTimeout(fn, ms); + timer.unref?.(); + return () => clearTimeout(timer); + }, + workDir: defaultWorkDir, + acquireStartLock: () => fileStartLock(path.join(defaultWorkDir(), "start.lock"))(), +}; + +function defaultWorkDir(): string { + const dir = path.join(os.tmpdir(), "opencode-voice-vieneu"); + fs.mkdirSync(dir, { recursive: true, mode: 0o700 }); + return dir; +} + +// ---------------------------------------------------------------- options + +export interface VieneuOptions { + /** Python interpreter of the VieNeu venv. */ + readonly python: string; + /** Read at every request, so a voice change applies to the next segment. */ + readonly voice: () => string; + readonly logger?: Logger; + readonly host?: string; + readonly basePort?: number; + readonly portScanMax?: number; + readonly startTimeoutMs?: number; + readonly cooldownMs?: number; + readonly pollMs?: number; + readonly synthTimeoutMs?: number; + readonly busyBackoffMs?: number; + readonly deps?: Partial; +} + +export type VieneuSynth = Synth & { voices(): Promise }; + +interface Server { + readonly port: number; + /** null when adopted: a VieNeu sidecar we did not spawn. Never killed. */ + readonly proc: VieneuChild | null; +} + +class StartFailure extends Error { + constructor( + message: string, + readonly portInUse = false, + ) { + super(message); + } +} + +// ---------------------------------------------------------------- helpers + +function isRecord(v: unknown): v is Record { + return typeof v === "object" && v !== null; +} + +/** /health of apps.openai_speech: { status: "ok", max_streams, sample_rate, ... }. */ +function isVieneuHealth(body: unknown): boolean { + return ( + isRecord(body) && + body["status"] === "ok" && + typeof body["max_streams"] === "number" && + typeof body["sample_rate"] === "number" + ); +} + +/** Last few non-empty stderr lines, one line, bounded. */ +export function stderrTail(stderr: string, maxChars = 240): string { + const lines = stderr + .split(/\r?\n/) + .map((l) => l.trim()) + .filter(Boolean) + .slice(-3); + const tail = lines.join(" | "); + return tail.length > maxChars ? `…${tail.slice(-maxChars)}` : tail; +} + +function withTail(message: string, stderr: string): string { + const tail = stderrTail(stderr); + return tail ? `${message}: ${tail}` : message; +} + +/** OpenAI-style error bodies are objects; never render "[object Object]". */ +function errorBodyText(body: unknown): string | null { + if (!isRecord(body)) return null; + const err = body["error"]; + if (typeof err === "string" && err) return err; + if (isRecord(err) && typeof err["message"] === "string") return err["message"]; + if (typeof body["detail"] === "string") return body["detail"]; + return null; +} + +/** + * The server streams WAV with placeholder sizes (0xFFFFFFFF). The body is + * fully buffered here, so write the real RIFF and data sizes. + */ +export function fixStreamedWav(wav: Buffer): Buffer { + if (wav.length < 12 || wav.toString("ascii", 0, 4) !== "RIFF") return wav; + let offset = 12; + while (offset + 8 <= wav.length) { + const id = wav.toString("ascii", offset, offset + 4); + if (id === "data") { + wav.writeUInt32LE(wav.length - 8, 4); + wav.writeUInt32LE(wav.length - offset - 8, offset + 4); + return wav; + } + offset += 8 + wav.readUInt32LE(offset + 4); + } + return wav; +} + +function aborted(): SynthError { + return new SynthError("VieNeu synthesis stopped", "ABORTED"); +} + +/** Reject with ABORTED as soon as signal aborts; p keeps running. */ +function abortable(p: Promise, signal?: AbortSignal): Promise { + if (!signal) return p; + if (signal.aborted) return Promise.reject(aborted()); + return new Promise((resolve, reject) => { + const onAbort = (): void => reject(aborted()); + signal.addEventListener("abort", onAbort, { once: true }); + p.then( + (v) => { + signal.removeEventListener("abort", onAbort); + resolve(v); + }, + (e: unknown) => { + signal.removeEventListener("abort", onAbort); + reject(e); + }, + ); + }); +} + +// ---------------------------------------------------------------- engine + +export function createVieneuSynth(opts: VieneuOptions): VieneuSynth { + const deps: VieneuDeps = { ...defaultDeps, ...opts.deps }; + const host = opts.host ?? "127.0.0.1"; + const basePort = opts.basePort ?? 8000; + const portScanMax = Math.max(1, Math.floor(opts.portScanMax ?? 4)); + const startTimeoutMs = opts.startTimeoutMs ?? 180_000; + const cooldownMs = opts.cooldownMs ?? 120_000; + const pollMs = opts.pollMs ?? 1000; + const synthTimeoutMs = opts.synthTimeoutMs ?? 120_000; + const busyBackoffMs = opts.busyBackoffMs ?? 500; + const log = (message: string, level: "debug" | "info" | "warn" | "error" = "debug"): void => + opts.logger?.log("TTS", message, level); + + let server: Server | null = null; + let starting: Promise | null = null; + let failure: { reason: string; until: number } | null = null; + let cancelRetry: (() => void) | null = null; + let disposed = false; + const lifetime = new AbortController(); + /** Spawned processes that have not exited yet (killed on dispose). */ + const alive = new Set(); + + const baseUrl = (port: number): string => `http://${host}:${port}`; + const unavailable = (reason: string): SynthError => + new SynthError(`VieNeu unavailable (${reason}) — using Piper`, "UNAVAILABLE"); + + function kill(child: VieneuChild): void { + try { + child.kill("SIGTERM"); + } catch { + // already gone + } + deps.schedule(() => { + if (!alive.has(child)) return; + try { + child.kill("SIGKILL"); + } catch { + // already gone + } + }, KILL_GRACE_MS); + } + + function markFailed(reason: string, scheduleRetry: boolean): void { + failure = { reason, until: deps.now() + cooldownMs }; + log(`VieNeu start failed: ${reason}`, "warn"); + cancelRetry?.(); + cancelRetry = null; + if (!scheduleRetry || disposed) return; + cancelRetry = deps.schedule(() => { + cancelRetry = null; + if (disposed || server) return; + log("VieNeu background retry", "info"); + ensureServer(true).catch(() => {}); + }, cooldownMs); + } + + async function probe(port: number): Promise<"vieneu" | "other" | "down"> { + let resp: VieneuResponse; + try { + resp = await deps.fetch(`${baseUrl(port)}/health`, { signal: AbortSignal.timeout(2000) }); + } catch { + return "down"; + } + if (!resp.ok) return "other"; + try { + return isVieneuHealth(await resp.json()) ? "vieneu" : "other"; + } catch { + return "other"; + } + } + + async function spawnOn(port: number, deadline: number): Promise { + let child: VieneuChild; + try { + child = deps.spawn(opts.python, [SERVER_SCRIPT], { + cwd: deps.workDir(), + stdio: ["ignore", "ignore", "pipe"], + env: { ...process.env, HOST: host, PORT: String(port) }, + }); + } catch (err) { + throw new StartFailure(`cannot run ${opts.python}: ${errorMessage(err)}`); + } + alive.add(child); + log(`VieNeu sidecar spawned pid=${child.pid ?? "?"} port=${port}`); + let stderr = ""; + let exited: string | null = null; + child.stderr?.on("data", (chunk) => { + stderr = (stderr + String(chunk)).slice(-STDERR_KEEP); + }); + child.on("exit", (code, signal) => { + alive.delete(child); + const how = typeof code === "number" ? `code=${code}` : `signal=${String(signal)}`; + exited ??= `sidecar exited (${how})`; + if (server?.proc !== child) return; + server = null; + if (!disposed) markFailed(withTail(exited, stderr), true); + }); + child.on("error", (err) => { + alive.delete(child); + exited ??= `cannot run ${opts.python}: ${errorMessage(err)}`; + }); + + for (;;) { + if (disposed) { + kill(child); + throw new StartFailure("stopped"); + } + if (exited !== null) { + throw new StartFailure( + withTail(exited, stderr), + /address already in use|errno 48|errno 98/i.test(stderr), + ); + } + if (deps.now() >= deadline) { + kill(child); + throw new StartFailure( + withTail(`did not start within ${Math.round(startTimeoutMs / 1000)}s`, stderr), + ); + } + if ((await probe(port)) === "vieneu" && exited === null) return { port, proc: child }; + try { + await deps.sleep(pollMs, lifetime.signal); + } catch { + // disposed; handled at the top of the loop + } + } + } + + async function findShared(): Promise { + for (let i = 0; i < portScanMax; i++) { + if ((await probe(basePort + i)) === "vieneu") return basePort + i; + } + return null; + } + + async function start(): Promise { + const deadline = deps.now() + startTimeoutMs; + let waiting = false; + for (;;) { + const shared = await findShared(); + if (disposed) throw new StartFailure("stopped"); + if (shared !== null) { + log(`VieNeu adopted existing sidecar on port ${shared}`, "info"); + return { port: shared, proc: null }; + } + const release = deps.acquireStartLock(); + if (release) { + try { + return await spawnScan(deadline); + } finally { + release(); + } + } + // Another OpenCode is starting VieNeu: share it instead of spawning a + // second copy (each one loads the model into memory). + if (!waiting) log("another OpenCode is starting VieNeu — waiting to share it", "info"); + waiting = true; + if (deps.now() >= deadline) { + throw new StartFailure("another OpenCode is still starting VieNeu"); + } + try { + await deps.sleep(pollMs, lifetime.signal); + } catch { + // disposed; handled at the top of the loop + } + } + } + + async function spawnScan(deadline: number): Promise { + for (let i = 0; i < portScanMax; i++) { + const port = basePort + i; + const state = await probe(port); + if (disposed) throw new StartFailure("stopped"); + if (state === "vieneu") { + log(`VieNeu adopted existing sidecar on port ${port}`, "info"); + return { port, proc: null }; + } + if (state === "other") { + log(`port ${port} is used by another program`, "warn"); + continue; + } + try { + return await spawnOn(port, deadline); + } catch (err) { + if (err instanceof StartFailure && err.portInUse) { + log(`port ${port} is taken`, "warn"); + continue; + } + throw err; + } + } + throw new StartFailure(`no free port in ${basePort}-${basePort + portScanMax - 1}`); + } + + function ensureServer(background = false): Promise { + if (server) return Promise.resolve(server); + if (starting) return starting; + const p = start().then( + (s) => { + if (disposed) { + if (s.proc) kill(s.proc); + throw unavailable("stopped"); + } + server = s; + failure = null; + log(`VieNeu ready at ${baseUrl(s.port)}`, "info"); + return s; + }, + (err: unknown) => { + const reason = errorMessage(err); + if (!disposed) markFailed(reason, !background); + throw unavailable(reason); + }, + ); + starting = p; + p.then( + () => { + if (starting === p) starting = null; + }, + () => { + if (starting === p) starting = null; + }, + ); + return p; + } + + async function request(s: Server, text: string, signal?: AbortSignal): Promise { + for (let attempt = 1; ; attempt++) { + const timeout = AbortSignal.timeout(synthTimeoutMs); + const sig = signal ? AbortSignal.any([signal, timeout]) : timeout; + let resp: VieneuResponse; + let wav: Buffer | null = null; + try { + resp = await deps.fetch(`${baseUrl(s.port)}/v1/audio/speech`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ + model: MODEL_ID, + input: text, + voice: opts.voice() || DEFAULT_VIENEU_VOICE, + response_format: "wav", + }), + signal: sig, + }); + if (resp.ok) wav = Buffer.from(await resp.arrayBuffer()); + } catch (err) { + if (signal?.aborted) throw aborted(); + if (timeout.aborted) { + throw new SynthError( + `VieNeu timed out after ${Math.round(synthTimeoutMs / 1000)}s — try a shorter text`, + "FAILED", + ); + } + // An adopted sidecar went away: forget it so the next call starts one. + // An owned one is forgotten by its exit handler. + if (server === s && s.proc === null) server = null; + throw new SynthError(`VieNeu request failed (${errorMessage(err)})`, "FAILED"); + } + if (wav) { + if (wav.length === 0) throw new SynthError("VieNeu returned no audio", "FAILED"); + return fixStreamedWav(wav); + } + if ((resp.status === 429 || resp.status === 503) && attempt < BUSY_TRIES) { + log(`VieNeu busy (HTTP ${resp.status}), retry ${attempt}/${BUSY_TRIES - 1}`, "warn"); + try { + await deps.sleep(busyBackoffMs * 2 ** (attempt - 1), signal); + } catch { + throw aborted(); + } + if (signal?.aborted) throw aborted(); + continue; + } + let detail: string | null = null; + try { + detail = errorBodyText(await resp.json()); + } catch { + // keep the status-only message + } + const busy = resp.status === 429 || resp.status === 503; + const what = busy ? `busy after ${BUSY_TRIES} tries` : "failed"; + throw new SynthError( + `VieNeu ${what} (HTTP ${resp.status}${detail ? `: ${detail}` : ""})`, + "FAILED", + ); + } + } + + return { + name: "vieneu", + + supports(lang: SpeechLang): boolean { + return lang === "vi" || lang === "en"; + }, + + async synthesize(seg: SpeechSegment, signal?: AbortSignal): Promise { + if (signal?.aborted) throw aborted(); + if (disposed) throw unavailable("stopped"); + // Fail fast during the cooldown and while the background retry runs, + // so speech falls back to Piper instead of waiting on a slow start. + if (failure && (deps.now() < failure.until || starting)) throw unavailable(failure.reason); + if (failure && !server) { + // It failed before: retry in the background so this reply is read by + // Piper now instead of waiting up to the whole start timeout again. + ensureServer(true).catch(() => {}); + throw unavailable(failure.reason); + } + const s = await abortable(ensureServer(), signal); + return request(s, seg.text, signal); + }, + + warm(): void { + if (disposed || server || starting) return; + if (failure && deps.now() < failure.until) return; + ensureServer().catch(() => {}); + }, + + async voices(): Promise { + const s = server; + if (!s) return [...VIENEU_VOICES]; + try { + const resp = await deps.fetch(`${baseUrl(s.port)}/v1/voices`, { + signal: AbortSignal.timeout(3000), + }); + if (!resp.ok) return [...VIENEU_VOICES]; + const body = await resp.json(); + const data = isRecord(body) && Array.isArray(body["data"]) ? body["data"] : []; + const names = data + .map((v: unknown) => (isRecord(v) && typeof v["id"] === "string" ? v["id"] : null)) + .filter((v): v is string => v !== null); + return names.length > 0 ? names : [...VIENEU_VOICES]; + } catch { + return [...VIENEU_VOICES]; + } + }, + + async dispose(): Promise { + disposed = true; + lifetime.abort(); + cancelRetry?.(); + cancelRetry = null; + server = null; + for (const child of alive) kill(child); + }, + }; +} diff --git a/src/tts/vieneu_server.py b/src/tts/vieneu_server.py new file mode 100644 index 0000000..d5b5b14 --- /dev/null +++ b/src/tts/vieneu_server.py @@ -0,0 +1,194 @@ +"""Start the VieNeu OpenAI-compatible speech server for opencode-voice. + +The plugin spawns this with an explicit private working directory and the +HOST/PORT environment variables. It never adds the working directory to +sys.path, so a user's project cannot shadow installed packages. + +Two fixes are applied to the stock app: + +* ONNX Runtime >= 1.31 rejects model files whose external data is reached + through Hugging Face cache symlinks, so model files are materialized as real + files (hard link, else copy) in one temporary directory per fetch. +* When a client disconnects mid-stream (the plugin stops speech), Starlette + abandons the sync body generator without closing it, so the stream slot is + never released and every later request gets 429 "server busy". The body is + wrapped so it is always closed and the slot always released. +""" + +import os +import shutil +import signal +import sys +import tempfile +import threading +from pathlib import Path + + +def server_address(): + host = os.environ.get("HOST", "127.0.0.1") + port = int(os.environ.get("PORT", "8000")) + return host, port + + +def materialize(source, files, destination): + destination = Path(destination) + destination.mkdir(parents=True, exist_ok=True) + for name in files: + if Path(name).name != name: + raise ValueError("Model filenames must not contain directories") + src = Path(source) / name + if not src.is_file(): + continue + dst = destination / name + try: + os.link(src.resolve(), dst) + except OSError: + shutil.copyfile(src, dst) + return destination + + +class SlotChunks: + """Speech chunk iterator that releases its stream slot exactly once. + + The stock generator releases the slot in a ``finally`` block, which never + runs when the generator is closed before it started. + """ + + def __init__(self, engine, inner): + self.engine = engine + self.inner = inner + self.started = False + + def __iter__(self): + return self + + def __next__(self): + self.started = True + return next(self.inner) + + def close(self): + # A started generator releases in its own finally (run by close() if + # suspended, already run if finished); an unstarted one never will. + self.inner.close() + if not self.started: + self.engine.release() + + +class ClosingBody: + """Sync body iterator whose close() waits for the in-flight next().""" + + def __init__(self, body, chunks): + self.body = body + self.chunks = chunks + self.lock = threading.Lock() + self.closed = False + + def __iter__(self): + return self + + def __next__(self): + with self.lock: + if self.closed: + raise StopIteration + return next(self.body) + + def close(self): + with self.lock: + if self.closed: + return + self.closed = True + try: + self.body.close() + finally: + if self.chunks is not None: + self.chunks.close() + + +def patch_streaming(module): + """Make apps.openai_speech release stream slots on client disconnect.""" + original_chunks = getattr(module, "_speech_chunks", None) + base = getattr(module, "StreamingResponse", None) + if original_chunks is None or base is None: + return False + import anyio + + # speech() is synchronous: it builds the chunks and then the response in + # the same thread, so a thread-local hands one to the other. + pending = threading.local() + + def speech_chunks(engine, req, rid): + chunks = SlotChunks(engine, original_chunks(engine, req, rid)) + pending.chunks = chunks + return chunks + + class ClosingStreamingResponse(base): + def __init__(self, content, *args, **kwargs): + chunks = getattr(pending, "chunks", None) + pending.chunks = None + self._closing_body = None + if hasattr(content, "__next__"): + content = ClosingBody(content, chunks) + self._closing_body = content + super().__init__(content, *args, **kwargs) + + async def __call__(self, scope, receive, send): + try: + await super().__call__(scope, receive, send) + finally: + if self._closing_body is not None: + with anyio.CancelScope(shield=True): + await anyio.to_thread.run_sync(self._closing_body.close) + + module._speech_chunks = speech_chunks + module.StreamingResponse = ClosingStreamingResponse + return True + + +def run_stock_app(host, port): + """Older VieNeu without the ONNX lite engine: run its app module as-is.""" + env = dict(os.environ, HOST=host, PORT=str(port)) + os.execve(sys.executable, [sys.executable, "-m", "apps.openai_speech"], env) + + +def main(): + # Python puts this script's directory first on sys.path; it holds only + # plugin sources, never packages, so drop it to keep imports clean. + script_dir = os.path.dirname(os.path.abspath(__file__)) + sys.path[:] = [p for p in sys.path if os.path.abspath(p or ".") != script_dir] + + host, port = server_address() + try: + from vieneu._v3_turbo_engine.onnx_runtime_lite import OnnxV3LiteEngine + except ModuleNotFoundError as error: + if not (error.name or "").startswith("vieneu"): + raise + run_stock_app(host, port) + return + + import uvicorn + + original = OnnxV3LiteEngine._fetch + + def terminate(_signal, _frame): + raise SystemExit(0) + + signal.signal(signal.SIGTERM, terminate) + with tempfile.TemporaryDirectory(prefix="opencode-vieneu-") as temp: + counter = 0 + + def fetch(repo, files, subfolder): + nonlocal counter + source = original(repo, files, subfolder) + counter += 1 + return materialize(source, files, Path(temp) / str(counter)) + + OnnxV3LiteEngine._fetch = staticmethod(fetch) + import apps.openai_speech as speech_app + + if not patch_streaming(speech_app): + print("opencode-voice: stream slot patch not applied", file=sys.stderr) + uvicorn.run(speech_app.app, host=host, port=port, workers=1, log_level="warning") + + +if __name__ == "__main__": + main() diff --git a/src/types.ts b/src/types.ts new file mode 100644 index 0000000..84b9427 --- /dev/null +++ b/src/types.ts @@ -0,0 +1,224 @@ +// Shared contracts between modules. Leaf modules (audio, stt engines, tts +// engines, llm) implement these; the session state machines consume them. +// Keep this file free of runtime code except tiny helpers. + +// ---------------------------------------------------------------- logging + +export type LogLevel = "debug" | "info" | "warn" | "error"; +export interface Logger { + log(scope: string, message: string, level?: LogLevel): void; +} + +// ---------------------------------------------------------------- audio + +/** Raw PCM is always signed 16-bit little-endian, mono. */ +export interface PcmFormat { + readonly sampleRate: number; +} + +export type MicKind = "local" | "remote"; + +export interface MicConfig { + readonly kind: MicKind; + /** Local input device name for sox/coreaudio; undefined = system default. */ + readonly device?: string; + /** + * Remote capture argv (e.g. ssh ... capture.sh 16000). Must write raw + * s16le mono PCM at `sampleRate` to stdout. Required when kind=remote. + */ + readonly command?: readonly string[]; + readonly sampleRate: number; + /** Run `adb forward` before a remote ssh capture to 127.0.0.1/localhost. */ + readonly usbAutoForward?: boolean; + /** Device name for messages ("Phone", "duy-1"). */ + readonly label?: string; + /** What to check when the remote device cannot be reached. */ + readonly unreachableHint?: string; + /** + * Remote cleanup argv run (best effort) after stop/kill, e.g. an ssh call + * that stops the recorder on the device. A dropped ssh session alone does + * not always stop it. + */ + readonly killCommand?: readonly string[]; + /** + * Graceful stop argv: makes the device finish recording and flush what is + * still in flight; the capture process then exits on its own. Without it, + * stop() signals the local process (losing the device's buffered tail). + */ + readonly stopCommand?: readonly string[]; + /** Hint shown when the device streams pure digital silence. */ + readonly zeroHint?: string; +} + +export type MicErrorCode = + | "SPAWN_FAILED" // binary missing / spawn threw + | "CONNECTION" // remote command could not connect (ssh exit 255 etc.) + | "EXITED" // capture process exited unexpectedly + | "NO_AUDIO"; // no bytes arrived within the startup window + +export interface MicError { + readonly code: MicErrorCode; + /** One-line, user-facing, says what happened. */ + readonly message: string; + /** One-line, user-facing, says what to do. */ + readonly hint?: string; +} + +export interface MicStream { + /** Subscribe to PCM chunks. Returns unsubscribe. */ + onData(cb: (chunk: Buffer) => void): () => void; + /** Subscribe to fatal errors (emitted at most once). Returns unsubscribe. */ + onError(cb: (err: MicError) => void): () => void; + /** + * Drop incoming audio until resume(). The process keeps running and its + * output keeps being drained, so remote buffers never replay paused speech. + */ + pause(): void; + resume(): void; + readonly paused: boolean; + /** Graceful stop: flushes remaining output, resolves when the process exited. */ + stop(): Promise; + /** Immediate kill, no flush. Idempotent. */ + kill(): void; + readonly format: PcmFormat; +} + +export type PlayerOutput = + | { readonly kind: "local" } + | { + readonly kind: "remote"; + readonly command: readonly string[]; + /** Raw PCM rate the command expects (default: its last numeric arg). */ + readonly rate?: number; + /** argv that silences the device (default: derived from the ssh target). */ + readonly kill?: readonly string[]; + }; + +export type PlayerStatus = "idle" | "playing" | "paused"; +export type PlayEnd = "ended" | "stopped"; + +export interface Player { + /** + * Play a WAV buffer from the start. Supersedes anything playing (that + * promise resolves "stopped"). Resolves "ended" on natural finish. + */ + play(wav: Buffer): Promise; + pause(): boolean; + resume(): boolean; + stop(): void; + status(): PlayerStatus; + positionSec(): number; + durationSec(): number; + /** + * Jump to an absolute position in the current clip (clamped at 0). A + * position at or past the end finishes the clip ("ended"). Keeps the + * paused state. False when nothing is loaded. + */ + seek(sec: number): boolean; + /** Playback speed (pitch kept). Applies immediately, also while paused. */ + setRate(rate: number): void; + rate(): number; + dispose(): void; +} + +export const PLAYBACK_RATES = [0.75, 1, 1.25, 1.5, 1.75, 2] as const; +export const RATE_MIN = 0.5; +export const RATE_MAX = 2; + +export function clampRate(rate: number): number { + if (!Number.isFinite(rate)) return 1; + return Math.round(Math.min(RATE_MAX, Math.max(RATE_MIN, rate)) * 100) / 100; +} + +// ---------------------------------------------------------------- stt + +export type SttLanguage = "auto" | "vi" | "en"; + +export interface TranscribeOptions { + readonly language: SttLanguage; + readonly signal?: AbortSignal; + /** Optional decoder prompt (vocabulary hint). */ + readonly prompt?: string; +} + +export interface Transcriber { + /** WAV (16-bit mono) in, plain text out. Throws on failure / abort. */ + transcribe(wav: Buffer, opts: TranscribeOptions): Promise; + /** Start any sidecar early so the first transcription is fast. */ + warm(): Promise; + /** Short human label, e.g. "whisper large-v3-turbo". */ + describe(): string; + dispose(): Promise; +} + +export interface StreamingPartial { + /** Text that will not change anymore. */ + readonly stable: string; + /** Latest guess for the tail; may be revised. */ + readonly tentative: string; +} + +// ---------------------------------------------------------------- tts + +export type SpeechLang = "vi" | "en"; + +export interface SpeechSegment { + readonly lang: SpeechLang; + readonly text: string; +} + +export type SynthName = "vieneu" | "piper"; + +export interface Synth { + readonly name: SynthName; + /** Returns a playable WAV. Throws SynthError on failure / abort. */ + synthesize(seg: SpeechSegment, signal?: AbortSignal): Promise; + /** True when the engine can say this language well. */ + supports(lang: SpeechLang): boolean; + /** Start a sidecar early (no-op when not applicable). */ + warm(): void; + dispose(): Promise; +} + +export class SynthError extends Error { + constructor( + message: string, + readonly code: "UNAVAILABLE" | "FAILED" | "ABORTED", + ) { + super(message); + this.name = "SynthError"; + } +} + +// ---------------------------------------------------------------- llm + +export interface CompleteRequest { + readonly system: string; + readonly user: string; + readonly maxTokens?: number; + readonly signal?: AbortSignal; + /** OpenCode session id for session-scoped gateways. */ + readonly sessionID?: string; +} + +export interface Llm { + /** Resolves trimmed text. Throws on HTTP/network error, abort, or empty. */ + complete(req: CompleteRequest): Promise; + /** Short label "provider/model" or "unconfigured". */ + describe(): string; + readonly configured: boolean; +} + +// ---------------------------------------------------------------- utils + +export function errorMessage(err: unknown): string { + if (err instanceof Error) return err.message; + return String(err); +} + +export function isAbortError(err: unknown): boolean { + return ( + (err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError")) || + (err instanceof SynthError && err.code === "ABORTED") + ); +} diff --git a/src/ui/status.test.ts b/src/ui/status.test.ts new file mode 100644 index 0000000..071a66c --- /dev/null +++ b/src/ui/status.test.ts @@ -0,0 +1,237 @@ +import { describe, expect, test } from "bun:test"; +import type { SttView } from "../stt/session.ts"; +import type { TtsView } from "../tts/session.ts"; +import { + formatClock, + isAnimating, + meter, + mountStatus, + paletteFrom, + statusSegments, + type StatusInput, +} from "./status.ts"; + +const idleStt: SttView = { + phase: { kind: "idle" }, + level: 0, + partial: "", + micLabel: "mac", + last: null, +}; +const idleTts: TtsView = { + phase: { kind: "idle" }, + positionSec: 0, + durationSec: 0, + durationFinal: true, + engine: null, + canReplay: false, + rate: 1, +}; +const base: StatusInput = { + stt: idleStt, + tts: idleTts, + autoSubmit: true, + autoEnd: false, + sttMode: "streaming", + sttEngine: "turbo", + ttsAuto: false, + now: 10_000, +}; +const texts = (i: StatusInput) => + statusSegments(i) + .map((s) => s.text) + .join(" "); + +describe("status segments", () => { + test("idle shows the main buttons", () => { + expect(texts(base)).toBe( + "[● Speak] [✎ Fix] [⏹ Auto-stop ✗] [⏎ Auto-send ✓] [Live] [turbo] │ [▶ Reply] [1x] [Read ✗]", + ); + }); + + test("auto-stop button reflects the setting and toggles it", () => { + const seg = statusSegments({ ...base, autoEnd: true }).find((s) => + s.text.includes("Auto-stop"), + ); + expect(seg?.text).toBe("[⏹ Auto-stop ✓]"); + expect(seg?.action).toBe("stt.autoEnd"); + }); + + test("recording shows timer, meter, done and cancel", () => { + const s = texts({ + ...base, + stt: { + ...idleStt, + level: 0.05, + phase: { kind: "recording", purpose: "dictate", since: 3_000 }, + }, + }); + expect(s).toContain("● REC 0:07"); + expect(s).toContain("[■ Done]"); + expect(s).toContain("[✕ Cancel]"); + }); + + test("live paused shows resume", () => { + const s = texts({ + ...base, + stt: { ...idleStt, phase: { kind: "live", purpose: "dictate", since: 0, paused: true } }, + }); + expect(s).toContain("⏸ PAUSED"); + expect(s).toContain("[▶ Resume]"); + }); + + test("live partial is shown when it cannot be typed into a field", () => { + const s = texts({ + ...base, + stt: { + ...idleStt, + partial: "xin chào", + phase: { kind: "live", purpose: "dictate", since: 0, paused: false }, + }, + }); + expect(s).toContain("“xin chào”"); + }); + + test("result is shown for a few seconds after finishing", () => { + const withResult = { + ...base, + stt: { ...idleStt, last: { kind: "ok" as const, message: "Inserted 12 chars", at: 9_000 } }, + }; + expect(texts(withResult)).toContain("✓ Inserted 12 chars"); + expect(texts({ ...withResult, now: 20_000 })).not.toContain("Inserted"); + expect(isAnimating(withResult)).toBe(true); + expect(isAnimating({ ...withResult, now: 20_000 })).toBe(false); + }); + + test("correction and processing labels", () => { + expect( + texts({ + ...base, + stt: { ...idleStt, phase: { kind: "recording", purpose: "correct", since: 10_000 } }, + }), + ).toContain("● FIX"); + expect( + texts({ + ...base, + stt: { ...idleStt, phase: { kind: "normalizing", purpose: "correct", since: 8_000 } }, + }), + ).toContain("Merging fix 0:02"); + expect( + texts({ + ...base, + stt: { ...idleStt, phase: { kind: "transcribing", purpose: "dictate", since: 9_000 } }, + }), + ).toContain("Transcribing 0:01"); + }); + + test("tts playing shows whole-reply time (no part number) and controls", () => { + const tts = { + phase: { kind: "playing", part: 2, parts: 3 } as const, + positionSec: 5, + durationSec: 12, + durationFinal: false, + engine: null, + canReplay: true, + rate: 1, + }; + // "+" while later parts are still being synthesized. + expect(texts({ ...base, tts })).toContain("♪ 0:05/0:12+ [«5]"); + expect(texts({ ...base, tts: { ...tts, durationFinal: true } })).toContain("♪ 0:05/0:12 [«5]"); + }); + + test("tts playing shows the piper engine and speed", () => { + const s = texts({ + ...base, + tts: { + phase: { kind: "playing", part: 2, parts: 3 }, + positionSec: 5, + durationSec: 12, + durationFinal: true, + engine: "piper", + canReplay: true, + rate: 1.25, + }, + }); + expect(s).toContain("♪ 0:05/0:12 piper"); + expect(s).toContain("[«5] [⏸] [5»] [1.25x] [■]"); + }); + + test("helpers", () => { + expect(formatClock(65_000)).toBe("1:05"); + expect(meter(0)).toHaveLength(3); + expect(paletteFrom({ error: "#ff0000", primary: { base: "#00f" } }).danger).toBe("#ff0000"); + expect(paletteFrom({ primary: { base: "#00f" } }).accent).toBe("#00f"); + expect(paletteFrom(null).text).toBe("#cdd6f4"); + }); +}); + +test("mountStatus renders into both slots and re-renders on refresh", async () => { + const created: Array<{ tag: string; props: Record; children: unknown }> = []; + let accessor: (() => unknown) | null = null; + let setV: ((v: number) => void) | null = null; + const renders: Array<() => unknown> = []; + let current = base; + const actions: string[] = []; + const mount = await mountStatus({ + slot: (_t, render) => { + renders.push(render); + return () => {}; + }, + read: () => current, + onAction: (a) => void actions.push(a), + theme: null, + onError: () => {}, + load: async () => ({ + solid: { + createSignal(v: T): [() => T, (v: T) => void] { + let x = v; + setV = (n) => void (x = n as unknown as T); + return [() => x, (n: T) => void (x = n)]; + }, + }, + tui: { + createElement(tag: string) { + const n = { tag, props: {} as Record, children: null as unknown }; + created.push(n); + return n; + }, + setProp(node: unknown, name: string, value: unknown) { + (node as { props: Record }).props[name] = value; + }, + insert(_parent: unknown, fn: () => unknown) { + accessor = fn; + }, + }, + }), + }); + expect(renders.length).toBe(2); + renders[0]?.(); + const nodes = (accessor as unknown as () => Array<{ props: Record }>)(); + expect(nodes[0]?.props.content).toBe("[● Speak]"); + expect(nodes[1]?.props.content).toBe("[✎ Fix]"); // spacing comes from the gap + // Narrow terminals: the row wraps instead of cutting buttons off. + const box = created.find((n) => n.tag === "box"); + expect(box?.props).toMatchObject({ flexWrap: "wrap", columnGap: 1 }); + expect(box?.props.height).toBeUndefined(); + const click = nodes[0]?.props.onMouseUp as () => void; + click(); + click(); // double fire is debounced + expect(actions).toEqual(["stt.toggle"]); + current = { + ...base, + stt: { + ...idleStt, + phase: { kind: "starting", purpose: "dictate", mode: "batch", since: 10_000 }, + }, + }; + mount.refresh(); + const again = (accessor as unknown as () => Array<{ props: Record }>)(); + expect(String(again[0]?.props.content)).toContain("Opening mac mic"); + expect(setV).not.toBeNull(); + mount.dispose(); +}); + +test("engine button opens the engine picker", () => { + const seg = statusSegments(base).find((x) => x.text === "[turbo]"); + expect(seg?.action).toBe("stt.engine"); +}); diff --git a/src/ui/status.ts b/src/ui/status.ts new file mode 100644 index 0000000..58389f2 --- /dev/null +++ b/src/ui/status.ts @@ -0,0 +1,368 @@ +// One status line above the composer (and on the home footer). It is a pure +// function of the two state machines, re-rendered on every state change and +// on a short tick while something is running (timers, level meter). +import type { SttView } from "../stt/session.ts"; +import type { TtsView } from "../tts/session.ts"; + +export type Action = + | "stt.toggle" + | "stt.finish" + | "stt.correct" + | "stt.pause" + | "stt.cancel" + | "stt.autoSubmit" + | "stt.autoEnd" + | "stt.mode" + | "stt.engine" + | "voice.device" + | "tts.toggle" + | "tts.pause" + | "tts.stop" + | "tts.replay" + | "tts.auto" + | "tts.back" + | "tts.forward" + | "tts.rate"; + +export type Tone = "text" | "muted" | "accent" | "danger" | "success" | "warning"; + +export interface Segment { + readonly text: string; + readonly tone: Tone; + readonly action?: Action; +} + +export interface StatusInput { + readonly stt: SttView; + readonly tts: TtsView; + readonly autoSubmit: boolean; + /** Finish dictation after 2.5 s of silence. */ + readonly autoEnd: boolean; + readonly sttMode: "batch" | "streaming"; + /** Short transcription engine label, e.g. "turbo" or "API". */ + readonly sttEngine: string; + /** Where audio goes when a voice node is used ("Phone"), else null. */ + readonly audioDevice?: { readonly label: string; readonly pinned: boolean } | null; + readonly ttsAuto: boolean; + readonly now: number; +} + +export const RESULT_SHOW_MS = 4000; +const BARS = "▁▂▃▄▅▆▇█"; + +export function formatClock(ms: number): string { + const s = Math.max(0, Math.floor(ms / 1000)); + return `${Math.floor(s / 60)}:${String(s % 60).padStart(2, "0")}`; +} + +export function formatRate(rate: number): string { + return `${Number(rate.toFixed(2))}x`; +} + +export function meter(level: number): string { + // Speech RMS sits around 0.01-0.2; map log-ish onto 4 bars. + const v = Math.max(0, Math.min(1, Math.sqrt(Math.max(0, level) * 5))); + const idx = Math.round(v * (BARS.length - 1)); + const ch = BARS[idx] ?? BARS[0]; + const lo = BARS[Math.max(0, idx - 2)] ?? BARS[0]; + return `${lo}${ch}${BARS[Math.max(0, idx - 1)] ?? lo}`; +} + +function tail(text: string, max = 48): string { + const t = text.replace(/\s+/g, " ").trim(); + return t.length > max ? `…${t.slice(-max)}` : t; +} + +const btn = (label: string, action: Action, tone: Tone = "accent"): Segment => ({ + text: `[${label}]`, + tone, + action, +}); +const txt = (text: string, tone: Tone = "text"): Segment => ({ text, tone }); + +export function sttSegments(i: StatusInput): Segment[] { + const { phase, last } = i.stt; + const secs = (since: number): string => formatClock(i.now - since); + switch (phase.kind) { + case "idle": { + const out: Segment[] = []; + if (last && i.now - last.at < RESULT_SHOW_MS) { + const tone: Tone = + last.kind === "ok" + ? "success" + : last.kind === "error" + ? "danger" + : last.kind === "cancelled" + ? "muted" + : "warning"; + const mark = last.kind === "ok" ? "✓ " : last.kind === "error" ? "✕ " : ""; + out.push(txt(`${mark}${tail(last.message, 60)}`, tone)); + } + out.push(btn("● Speak", "stt.toggle")); + out.push(btn("✎ Fix", "stt.correct")); + out.push( + btn( + i.autoEnd ? "⏹ Auto-stop ✓" : "⏹ Auto-stop ✗", + "stt.autoEnd", + i.autoEnd ? "success" : "muted", + ), + ); + out.push( + btn( + i.autoSubmit ? "⏎ Auto-send ✓" : "⏎ Auto-send ✗", + "stt.autoSubmit", + i.autoSubmit ? "success" : "muted", + ), + ); + out.push(btn(i.sttMode === "streaming" ? "Live" : "Batch", "stt.mode", "muted")); + out.push(btn(i.sttEngine, "stt.engine", "muted")); + if (i.audioDevice) { + out.push( + btn( + `${i.audioDevice.pinned ? "📌" : "🎙"} ${i.audioDevice.label}`, + "voice.device", + "accent", + ), + ); + } + return out; + } + case "starting": + return [ + txt(`◌ Opening ${i.stt.micLabel} mic…`, "warning"), + btn("✕ Cancel", "stt.cancel", "muted"), + ]; + case "recording": + return [ + txt( + `● ${phase.purpose === "correct" ? "FIX" : "REC"} ${secs(phase.since)} ${meter(i.stt.level)}`, + "danger", + ), + btn("■ Done", "stt.finish", "danger"), + btn("✕ Cancel", "stt.cancel", "muted"), + ]; + case "live": { + const label = phase.purpose === "correct" ? "FIX" : "LIVE"; + const head = phase.paused + ? txt(`⏸ PAUSED ${secs(phase.since)}`, "warning") + : txt(`● ${label} ${secs(phase.since)} ${meter(i.stt.level)}`, "danger"); + const out = [ + head, + btn(phase.paused ? "▶ Resume" : "⏸ Pause", "stt.pause", "accent"), + btn("■ Done", "stt.finish", "danger"), + btn("✕ Cancel", "stt.cancel", "muted"), + ]; + if (i.stt.partial) out.push(txt(`“${tail(i.stt.partial)}”`, "muted")); + return out; + } + case "transcribing": + return [ + txt(`… Transcribing ${secs(phase.since)}`, "warning"), + btn("✕ Cancel", "stt.cancel", "muted"), + ]; + case "normalizing": + return [ + txt( + `… ${phase.purpose === "correct" ? "Merging fix" : "Polishing"} ${secs(phase.since)}`, + "warning", + ), + btn("✕ Cancel", "stt.cancel", "muted"), + ]; + } +} + +export function ttsSegments(i: StatusInput): Segment[] { + const { phase } = i.tts; + switch (phase.kind) { + case "idle": { + const out: Segment[] = [btn("▶ Reply", "tts.toggle")]; + if (i.tts.canReplay) out.push(btn("↺", "tts.replay", "muted")); + out.push(btn(formatRate(i.tts.rate), "tts.rate", i.tts.rate === 1 ? "muted" : "accent")); + out.push(btn(i.ttsAuto ? "Read ✓" : "Read ✗", "tts.auto", i.ttsAuto ? "success" : "muted")); + return out; + } + case "preparing": + return [ + txt( + `… ${phase.step === "normalizing" ? "Preparing reply" : "Synthesizing"} ${formatClock(i.now - phase.since)}`, + "warning", + ), + btn("■ Stop", "tts.stop", "danger"), + ]; + case "playing": + case "paused": { + // Whole-reply time; "+" while later parts are still being synthesized. + const pos = `${formatClock(i.tts.positionSec * 1000)}/${formatClock(i.tts.durationSec * 1000)}${i.tts.durationFinal ? "" : "+"}`; + const eng = i.tts.engine === "piper" ? " piper" : ""; + return [ + txt( + `${phase.kind === "paused" ? "⏸" : "♪"} ${pos}${eng}`, + phase.kind === "paused" ? "warning" : "accent", + ), + btn("«5", "tts.back"), + btn(phase.kind === "paused" ? "▶" : "⏸", "tts.pause"), + btn("5»", "tts.forward"), + btn(formatRate(i.tts.rate), "tts.rate", i.tts.rate === 1 ? "muted" : "accent"), + btn("■", "tts.stop", "danger"), + ]; + } + } +} + +export function statusSegments(i: StatusInput): Segment[] { + return [...sttSegments(i), txt("│", "muted"), ...ttsSegments(i)]; +} + +export function isAnimating(i: StatusInput): boolean { + return ( + i.stt.phase.kind !== "idle" || + i.tts.phase.kind !== "idle" || + (i.stt.last !== null && i.now - i.stt.last.at < RESULT_SHOW_MS + 500) + ); +} + +// ------------------------------------------------------------- renderer + +export interface Palette { + readonly [tone: string]: string; +} + +export function paletteFrom(theme: unknown): Record { + const pick = (keys: string[], fallback: string): string => { + if (!theme || typeof theme !== "object") return fallback; + const t = theme as Record; + for (const k of keys) { + const v = t[k]; + if (typeof v === "string" && v) return v; + if (v && typeof v === "object") { + const o = v as Record; + for (const sub of ["base", "default", "fg"]) { + if (typeof o[sub] === "string") return o[sub] as string; + } + } + } + return fallback; + }; + return { + text: pick(["text"], "#cdd6f4"), + muted: pick(["textMuted", "muted"], "#7f849c"), + accent: pick(["primary", "accent"], "#89b4fa"), + danger: pick(["error"], "#f38ba8"), + success: pick(["success"], "#a6e3a1"), + warning: pick(["warning"], "#f9e2af"), + }; +} + +interface SolidRuntime { + createSignal(v: T): [() => T, (v: T) => void]; +} +interface OpentuiRuntime { + createElement(tag: string): unknown; + setProp(node: unknown, name: string, value: unknown): void; + insert(parent: unknown, accessor: () => unknown): void; +} + +export interface StatusMount { + /** Re-render now (call on every state change). */ + refresh(): void; + dispose(): void; +} + +export async function mountStatus(input: { + slot: (target: "session.composer.top" | "home.footer", render: () => unknown) => () => void; + read: () => StatusInput; + onAction: (a: Action) => void; + theme: unknown; + onError: (message: string) => void; + load?: () => Promise<{ solid: SolidRuntime; tui: OpentuiRuntime }>; +}): Promise { + const load = + input.load ?? + (async () => { + // Host-provided modules: literal specifiers so the host loader maps them. + const [solid, tui] = await Promise.all([import("solid-js"), import("@opentui/solid")]); + return { solid: solid as unknown as SolidRuntime, tui: tui as unknown as OpentuiRuntime }; + }); + const { solid, tui } = await load(); + const [version, setVersion] = solid.createSignal(0); + let v = 0; + const palette = paletteFrom(input.theme); + const lastPress = new Map(); + let errorShown = false; + + const press = (a: Action): void => { + const t = Date.now(); + if (t - (lastPress.get(a) ?? 0) < 350) return; // mouse up can fire twice + lastPress.set(a, t); + input.onAction(a); + }; + + const render = (): unknown => { + try { + const box = tui.createElement("box"); + tui.setProp(box, "flexDirection", "row"); + // Narrow terminals (phone): buttons wrap onto more lines instead of + // being cut off. The gap (not a leading space) keeps wrapped lines flush. + tui.setProp(box, "flexWrap", "wrap"); + tui.setProp(box, "columnGap", 1); + tui.setProp(box, "flexShrink", 0); + tui.setProp(box, "width", "100%"); + tui.insert(box, () => { + version(); + return statusSegments(input.read()).map((seg) => { + const node = tui.createElement("text"); + tui.setProp(node, "content", seg.text); + tui.setProp(node, "fg", palette[seg.tone]); + tui.setProp(node, "flexShrink", 0); + if (seg.action) { + const action = seg.action; + tui.setProp(node, "onMouseUp", () => press(action)); + } + return node; + }); + }); + return box; + } catch (err) { + if (!errorShown) { + errorShown = true; + input.onError(err instanceof Error ? err.message : String(err)); + } + return null; + } + }; + + const offs = [input.slot("session.composer.top", render), input.slot("home.footer", render)]; + let timer: ReturnType | null = null; + + const refresh = (): void => { + v += 1; + setVersion(v); + const animate = isAnimating(input.read()); + if (animate && !timer) { + timer = setInterval(() => { + v += 1; + setVersion(v); + if (!isAnimating(input.read()) && timer) { + clearInterval(timer); + timer = null; + v += 1; + setVersion(v); + } + }, 250); + timer.unref?.(); + } + }; + + return { + refresh, + dispose() { + if (timer) clearInterval(timer); + timer = null; + for (const off of offs) { + try { + off(); + } catch {} + } + }, + }; +} diff --git a/test/llm-client.test.js b/test/llm-client.test.js deleted file mode 100644 index b70d108..0000000 --- a/test/llm-client.test.js +++ /dev/null @@ -1,266 +0,0 @@ -import assert from "node:assert/strict"; -import test from "node:test"; - -import { createClient } from "../lib/llm-client.js"; - -function createJsonResponse(status, data) { - return { - ok: status >= 200 && status < 300, - status, - async json() { - return data; - }, - }; -} - -test("returns error when endpoint is not configured", async () => { - const client = createClient({ model: "test-model" }); - const result = await client.complete({ prompt: "Test" }); - - assert.deepEqual(result, { - text: null, - error: "LLM endpoint not configured", - }); -}); - -test("returns error when model is not configured", async () => { - const client = createClient({ endpoint: "https://example.test/v1" }); - const result = await client.complete({ prompt: "Test" }); - - assert.deepEqual(result, { - text: null, - error: "LLM model not configured", - }); -}); - -test("sends chat completions requests with reasoning_effort when configured", async () => { - const previousKey = process.env.TEST_LLM_API_KEY; - const previousFetch = globalThis.fetch; - const requests = []; - process.env.TEST_LLM_API_KEY = "secret"; - - globalThis.fetch = async (url, options) => { - requests.push({ url, options }); - return createJsonResponse(200, { - choices: [{ message: { content: "normalized text" } }], - }); - }; - - try { - const client = createClient({ - endpoint: "https://example.test/v1/", - model: "gpt-test", - apiKeyEnv: "TEST_LLM_API_KEY", - maxTokens: 321, - reasoningEffort: "low", - retries: 0, - }); - - const result = await client.complete({ - system: "System prompt", - prompt: "User prompt", - }); - - assert.equal(result.text, "normalized text"); - assert.equal(requests.length, 1); - assert.equal(requests[0].url, "https://example.test/v1/chat/completions"); - assert.equal(requests[0].options.method, "POST"); - assert.deepEqual(JSON.parse(requests[0].options.body), { - model: "gpt-test", - max_tokens: 321, - reasoning_effort: "low", - messages: [ - { role: "system", content: "System prompt" }, - { role: "user", content: "User prompt" }, - ], - }); - } finally { - globalThis.fetch = previousFetch; - if (previousKey === undefined) { - delete process.env.TEST_LLM_API_KEY; - } else { - process.env.TEST_LLM_API_KEY = previousKey; - } - } -}); - -test("sends chat_template_kwargs when configured", async () => { - const previousKey = process.env.TEST_LLM_API_KEY; - const previousFetch = globalThis.fetch; - const requests = []; - process.env.TEST_LLM_API_KEY = "secret"; - - globalThis.fetch = async (url, options) => { - requests.push({ url, options }); - return createJsonResponse(200, { - choices: [{ message: { content: "text" } }], - }); - }; - - try { - const client = createClient({ - endpoint: "https://example.test/v1", - model: "qwen-test", - apiKeyEnv: "TEST_LLM_API_KEY", - chatTemplateKwargs: { enable_thinking: false }, - retries: 0, - }); - - const result = await client.complete({ prompt: "Test" }); - assert.equal(result.text, "text"); - const body = JSON.parse(requests[0].options.body); - assert.deepEqual(body.chat_template_kwargs, { enable_thinking: false }); - assert.equal(body.reasoning_effort, undefined); - } finally { - globalThis.fetch = previousFetch; - if (previousKey === undefined) { - delete process.env.TEST_LLM_API_KEY; - } else { - process.env.TEST_LLM_API_KEY = previousKey; - } - } -}); - -test("does not send chat_template_kwargs when not configured", async () => { - const previousKey = process.env.TEST_LLM_API_KEY; - const previousFetch = globalThis.fetch; - const requests = []; - process.env.TEST_LLM_API_KEY = "secret"; - - globalThis.fetch = async (url, options) => { - requests.push({ url, options }); - return createJsonResponse(200, { - choices: [{ message: { content: "text" } }], - }); - }; - - try { - const client = createClient({ - endpoint: "https://example.test/v1", - model: "test-model", - apiKeyEnv: "TEST_LLM_API_KEY", - retries: 0, - }); - - const result = await client.complete({ prompt: "Test" }); - assert.equal(result.text, "text"); - const body = JSON.parse(requests[0].options.body); - assert.equal(body.chat_template_kwargs, undefined); - } finally { - globalThis.fetch = previousFetch; - if (previousKey === undefined) { - delete process.env.TEST_LLM_API_KEY; - } else { - process.env.TEST_LLM_API_KEY = previousKey; - } - } -}); - -test("sends requests without Authorization header when no apiKeyEnv", async () => { - const previousFetch = globalThis.fetch; - const requests = []; - - globalThis.fetch = async (url, options) => { - requests.push({ url, options }); - return createJsonResponse(200, { - choices: [{ message: { content: "text" } }], - }); - }; - - try { - const client = createClient({ - endpoint: "https://example.test/v1", - model: "test-model", - retries: 0, - }); - - const result = await client.complete({ prompt: "Test" }); - assert.equal(result.text, "text"); - assert.equal(requests[0].options.headers.Authorization, undefined); - } finally { - globalThis.fetch = previousFetch; - } -}); - -test("returns error when LLM fails after retries", async () => { - const previousKey = process.env.TEST_LLM_API_KEY; - const previousFetch = globalThis.fetch; - const previousSetTimeout = globalThis.setTimeout; - process.env.TEST_LLM_API_KEY = "secret"; - - globalThis.fetch = async () => { - return createJsonResponse(500, { error: "internal error" }); - }; - - globalThis.setTimeout = (fn) => { - fn(); - return 0; - }; - - try { - const client = createClient({ - endpoint: "https://example.test/v1", - model: "test-model", - apiKeyEnv: "TEST_LLM_API_KEY", - retries: 1, - }); - - const result = await client.complete({ prompt: "Test" }); - - assert.equal(result.text, null); - assert.match(result.error, /LLM request failed/); - } finally { - globalThis.fetch = previousFetch; - globalThis.setTimeout = previousSetTimeout; - if (previousKey === undefined) { - delete process.env.TEST_LLM_API_KEY; - } else { - process.env.TEST_LLM_API_KEY = previousKey; - } - } -}); - -test("retries transient failures and eventually returns the response text", async () => { - const previousKey = process.env.TEST_LLM_API_KEY; - const previousFetch = globalThis.fetch; - const previousSetTimeout = globalThis.setTimeout; - let attempts = 0; - process.env.TEST_LLM_API_KEY = "secret"; - - globalThis.fetch = async () => { - attempts += 1; - if (attempts < 3) { - return createJsonResponse(429, { error: { message: "rate limited" } }); - } - return createJsonResponse(200, { - choices: [{ message: { content: "recovered text" } }], - }); - }; - - globalThis.setTimeout = (fn) => { - fn(); - return 0; - }; - - try { - const client = createClient({ - endpoint: "https://example.test/v1", - model: "test-model", - apiKeyEnv: "TEST_LLM_API_KEY", - retries: 2, - }); - - const result = await client.complete({ prompt: "Retry this" }); - - assert.deepEqual(result, { text: "recovered text" }); - assert.equal(attempts, 3); - } finally { - globalThis.fetch = previousFetch; - globalThis.setTimeout = previousSetTimeout; - if (previousKey === undefined) { - delete process.env.TEST_LLM_API_KEY; - } else { - process.env.TEST_LLM_API_KEY = previousKey; - } - } -}); diff --git a/test/stt.test.js b/test/stt.test.js deleted file mode 100644 index 5418a59..0000000 --- a/test/stt.test.js +++ /dev/null @@ -1,134 +0,0 @@ -import assert from "node:assert/strict"; -import test from "node:test"; - -import { - buildAudioHint, - buildOpenRouterTranscriptionRequest, - buildRecordArgs, - buildWhisperArgs, - isOpenRouterEndpoint, - isWSL, - parsePactlSources, - parsePactlSourcesShort, -} from "../lib/stt.js"; - -test("detects OpenRouter STT endpoints", () => { - assert.equal(isOpenRouterEndpoint("https://openrouter.ai/api/v1"), true); - assert.equal(isOpenRouterEndpoint("https://openrouter.ai/api/v1/"), true); - assert.equal(isOpenRouterEndpoint("https://api.openai.com/v1"), false); -}); - -test("builds OpenRouter STT requests as JSON with base64 audio", () => { - const audioBuffer = Buffer.from("RIFFfakewav", "utf8"); - const request = buildOpenRouterTranscriptionRequest( - "openai/whisper-large-v3-turbo", - audioBuffer, - "secret", - ); - - assert.deepEqual(request.headers, { - "Content-Type": "application/json", - Authorization: "Bearer secret", - }); - - const body = JSON.parse(request.body); - assert.deepEqual(body, { - model: "openai/whisper-large-v3-turbo", - input_audio: { - data: audioBuffer.toString("base64"), - format: "wav", - }, - }); -}); - -test("parses pactl JSON sources and filters out monitors", () => { - const json = JSON.stringify([ - { name: "RDPSink.monitor", description: "Monitor of RDP Sink" }, - { name: "RDPSource", description: "RDP Source" }, - { name: "alsa_input.usb-mic" }, - ]); - assert.deepEqual(parsePactlSources(json), [ - { name: "RDPSource", label: "RDP Source (RDPSource)" }, - { name: "alsa_input.usb-mic", label: "alsa_input.usb-mic" }, - ]); -}); - -test("parses pactl short sources and filters out monitors", () => { - const short = [ - "1\tRDPSink.monitor\tmodule-rdp-sink.c\ts16le 2ch 44100Hz\tSUSPENDED", - "2\tRDPSource\tmodule-rdp-source.c\ts16le 1ch 44100Hz\tSUSPENDED", - "", - ].join("\n"); - assert.deepEqual(parsePactlSourcesShort(short), [{ name: "RDPSource", label: "RDPSource" }]); -}); - -test("builds sox record args per audio backend", () => { - assert.deepEqual(buildRecordArgs("pulseaudio", "RDPSource"), ["-t", "pulseaudio", "RDPSource"]); - assert.deepEqual(buildRecordArgs("pulseaudio", null), ["-t", "pulseaudio", "default"]); - assert.deepEqual(buildRecordArgs("coreaudio", "USB Microphone"), [ - "-t", - "coreaudio", - "USB Microphone", - ]); - assert.deepEqual(buildRecordArgs("coreaudio", null), ["-d"]); - assert.deepEqual(buildRecordArgs("default", null), ["-d"]); -}); - -test("builds audio hints per backend and server state", () => { - assert.match( - buildAudioHint({ backend: "pulseaudio", serverOk: false, isWsl: true }), - /wsl --shutdown/, - ); - assert.match( - buildAudioHint({ backend: "pulseaudio", serverOk: false, isWsl: false }), - /PipeWire\/PulseAudio/, - ); - assert.match( - buildAudioHint({ backend: "pulseaudio", serverOk: true, isWsl: false }), - /input source configuration/, - ); - assert.equal( - buildAudioHint({ backend: "coreaudio", serverOk: false, isWsl: false }), - "No input devices found", - ); -}); - -test("detects WSL via environment variables", () => { - const savedDistro = process.env.WSL_DISTRO_NAME; - const savedInterop = process.env.WSL_INTEROP; - try { - delete process.env.WSL_DISTRO_NAME; - delete process.env.WSL_INTEROP; - assert.equal(isWSL(), false); - process.env.WSL_DISTRO_NAME = "Ubuntu"; - assert.equal(isWSL(), true); - } finally { - if (savedDistro === undefined) delete process.env.WSL_DISTRO_NAME; - else process.env.WSL_DISTRO_NAME = savedDistro; - if (savedInterop === undefined) delete process.env.WSL_INTEROP; - else process.env.WSL_INTEROP = savedInterop; - } -}); - -test("builds whisper-cli args with language", () => { - assert.deepEqual(buildWhisperArgs("/models/ggml.bin", "/tmp/a.wav", "zh"), [ - "-m", - "/models/ggml.bin", - "-f", - "/tmp/a.wav", - "-l", - "zh", - "-np", - "-nt", - ]); - assert.deepEqual(buildWhisperArgs("/models/ggml.bin", "/tmp/a.wav", null), [ - "-m", - "/models/ggml.bin", - "-f", - "/tmp/a.wav", - "-l", - "auto", - "-np", - "-nt", - ]); -}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..71083b5 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "target": "ES2023", + "module": "ESNext", + "moduleResolution": "bundler", + "lib": ["ES2023"], + "types": ["bun", "node"], + "strict": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + "noFallthroughCasesInSwitch": true, + "exactOptionalPropertyTypes": false, + "allowImportingTsExtensions": true, + "verbatimModuleSyntax": true, + "noEmit": true, + "skipLibCheck": true, + "isolatedModules": true + }, + "include": ["index.ts", "tui.ts", "src/**/*.ts", "src/**/*.d.ts"] +} diff --git a/tui.ts b/tui.ts new file mode 100644 index 0000000..7a17d85 --- /dev/null +++ b/tui.ts @@ -0,0 +1,2 @@ +// OpenCode v2 probes a package directory for a `tui` file entrypoint. +export { default } from "./src/entry.ts"; diff --git a/wrangler.jsonc b/wrangler.jsonc new file mode 100644 index 0000000..be865fd --- /dev/null +++ b/wrangler.jsonc @@ -0,0 +1,11 @@ +{ + "$schema": "node_modules/wrangler/config-schema.json", + "name": "bojackduy-opencode-voice", + "compatibility_date": "2026-10-23", + "observability": { + "enabled": true, + }, + "assets": { + "directory": "docs", + }, +}