-
Notifications
You must be signed in to change notification settings - Fork 143
add console, simulate, and agent dev commands #810
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
theomonnom
wants to merge
13
commits into
theo/console-webrtc
Choose a base branch
from
theo/console-v2
base: theo/console-webrtc
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ad4ce38
add console, simulate, agent dev commands with TUI and protobuf IPC
theomonnom e47f79f
improve agent detection error messages and consistency
theomonnom 5f2cf6f
improve error messages, entrypoint detection, and IPC safety
theomonnom f2a132f
add console build docs and PortAudio submodule check
theomonnom 78a6094
add blank line after user/agent messages in console TUI
theomonnom 8be6798
remove duplicate -lc++ linker flags, cgo handles C++ linking automati…
theomonnom 3df43a6
fix console TUI rendering, add startup spinner and handoff support
theomonnom 61a5803
remove local replace directives, use published server-sdk-go
theomonnom d10d751
update server-sdk-go to include complete AgentSimulationClient
theomonnom e90f904
update server-sdk-go to merged main with SimulationAdmin grant
theomonnom 661d54a
Fix agent watcher exitCh race on restart
theomonnom b69df70
Remove default num-simulations, let server decide
theomonnom 3637354
Show 'Generating scenarios' without count when num-simulations not sp…
theomonnom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,170 @@ | ||
| # Copyright 2023 LiveKit, Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
||
| name: Build binaries | ||
|
|
||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| output_dir: | ||
| type: string | ||
| default: bin | ||
| upload_release: | ||
| type: boolean | ||
| default: false | ||
|
|
||
| jobs: | ||
| build: | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| - os: macos-latest | ||
| suffix: darwin_arm64 | ||
| - os: ubuntu-latest | ||
| suffix: linux_amd64 | ||
| zig_target: x86_64-linux-gnu.2.28 | ||
| alsa_arch: amd64 | ||
| alsa_triple: x86_64-linux-gnu | ||
| - os: ubuntu-latest | ||
| suffix: linux_arm64 | ||
| zig_target: aarch64-linux-gnu.2.28 | ||
| alsa_arch: arm64 | ||
| alsa_triple: aarch64-linux-gnu | ||
| goarch: arm64 | ||
| - os: ubuntu-latest | ||
| suffix: linux_arm | ||
| zig_target: arm-linux-gnueabihf.2.28 | ||
| alsa_arch: armhf | ||
| alsa_triple: arm-linux-gnueabihf | ||
| goarch: arm | ||
| goarm: "7" | ||
| - os: ubuntu-latest | ||
| suffix: windows_amd64 | ||
| zig_target: x86_64-windows-gnu | ||
| goos: windows | ||
| goarch: amd64 | ||
| - os: ubuntu-latest | ||
| suffix: windows_arm64 | ||
| zig_target: aarch64-windows-gnu | ||
| goos: windows | ||
| goarch: arm64 | ||
| - os: ubuntu-latest | ||
| suffix: windows_arm | ||
| goos: windows | ||
| goarch: arm | ||
| goarm: "7" | ||
| runs-on: ${{ matrix.os }} | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| lfs: 'true' | ||
| submodules: true | ||
|
|
||
| - run: git lfs pull | ||
|
|
||
| - name: Set up Go | ||
| uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: "1.25" | ||
|
|
||
| - name: Install Zig | ||
| if: matrix.zig_target | ||
| uses: mlugg/setup-zig@v2 | ||
| with: | ||
| version: 0.14.1 | ||
|
|
||
| - name: Install ALSA headers | ||
| if: matrix.alsa_arch | ||
| run: | | ||
| sudo dpkg --add-architecture ${{ matrix.alsa_arch }} | ||
| if [ "${{ matrix.alsa_arch }}" != "amd64" ]; then | ||
| CODENAME=$(lsb_release -cs) | ||
| # Restrict existing sources to amd64 to avoid 404s for foreign arch | ||
| for f in /etc/apt/sources.list.d/*.sources; do | ||
| grep -q '^Architectures:' "$f" || sudo sed -i '/^Types:/a Architectures: amd64 i386' "$f" | ||
| done | ||
| # Add ports.ubuntu.com for the foreign architecture | ||
| printf 'Types: deb\nURIs: http://ports.ubuntu.com/ubuntu-ports\nSuites: %s %s-updates\nComponents: main universe\nArchitectures: %s\nSigned-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n' \ | ||
| "$CODENAME" "$CODENAME" "${{ matrix.alsa_arch }}" | sudo tee /etc/apt/sources.list.d/ports.sources | ||
| fi | ||
| sudo apt-get update | ||
| sudo apt-get install -y libasound2-dev:${{ matrix.alsa_arch }} | ||
|
|
||
| - name: Generate Windows import libraries | ||
| if: matrix.goos == 'windows' && matrix.zig_target | ||
| run: | | ||
| ZIG_LIB=$(zig env | jq -r '.lib_dir') | ||
| echo "ZIG_LIB=${ZIG_LIB}" >> "$GITHUB_ENV" | ||
| LIB_DIR="${ZIG_LIB}/libc/mingw/lib-common" | ||
| # Zig bundles MinGW .def files but lld needs .a import libraries. | ||
| # Go's compiled objects embed COFF /DEFAULTLIB directives (e.g. dbghelp, | ||
| # bcrypt) that lld resolves directly, bypassing Zig's lazy .def→.a | ||
| # generation. Pre-generate all import libraries so lld can find them. | ||
| MACHINE=${{ matrix.goarch == 'amd64' && 'i386:x86-64' || 'arm64' }} | ||
| for def in "${LIB_DIR}"/*.def; do | ||
| lib=$(basename "$def" .def) | ||
| [ -f "${LIB_DIR}/lib${lib}.a" ] && continue | ||
| zig dlltool -d "$def" -l "${LIB_DIR}/lib${lib}.a" -m "$MACHINE" 2>/dev/null || true | ||
| done | ||
|
|
||
| - name: Build | ||
| env: | ||
| CGO_ENABLED: ${{ (matrix.goos && !matrix.zig_target) && '0' || '1' }} | ||
| CC: ${{ matrix.zig_target && format('zig cc -target {0}', matrix.zig_target) || '' }} | ||
| CXX: ${{ matrix.zig_target && format('zig c++ -target {0}', matrix.zig_target) || '' }} | ||
| # Zig uses its own sysroot; point it at the system ALSA headers and libraries | ||
| CGO_CFLAGS: ${{ matrix.alsa_triple && format('-isystem /usr/include -isystem /usr/include/{0}', matrix.alsa_triple) || '' }} | ||
| CGO_LDFLAGS: ${{ matrix.alsa_triple && format('-L/usr/lib/{0}', matrix.alsa_triple) || '' }} | ||
| # -fms-extensions: enable __try/__except (SEH) used by WebRTC | ||
| # -DNTDDI_VERSION: target Windows 10 base to skip WinRT includes absent from MinGW | ||
| CGO_CXXFLAGS: ${{ matrix.goos == 'windows' && '-fms-extensions -DNTDDI_VERSION=0x0A000000' || '' }} | ||
| GOOS: ${{ matrix.goos || '' }} | ||
| GOARCH: ${{ matrix.goarch || '' }} | ||
| GOARM: ${{ matrix.goarm || '' }} | ||
| shell: bash | ||
| run: | | ||
| EXT=""; if [ "${GOOS:-}" = "windows" ]; then EXT=".exe"; fi | ||
| TAGS="" | ||
| if [ "$CGO_ENABLED" = "1" ]; then TAGS="-tags console"; fi | ||
| # Force external linking for Windows so Go uses zig cc (CC) as the linker, | ||
| # and add Zig's MinGW lib path so lld can find the generated import libraries. | ||
| EXTLD="" | ||
| if [ "${GOOS:-}" = "windows" ] && [ "$CGO_ENABLED" = "1" ]; then | ||
| EXTLD="-linkmode=external -extldflags '-L${ZIG_LIB}/libc/mingw/lib-common'" | ||
| fi | ||
| go build $TAGS -ldflags "-w -s $EXTLD" -o "${{ inputs.output_dir }}/lk${EXT}" ./cmd/lk | ||
|
|
||
| - name: Verify binary | ||
| if: "!matrix.goos && !matrix.goarch" | ||
| run: ${{ inputs.output_dir }}/lk --help > /dev/null | ||
|
|
||
| - name: Package and upload | ||
| if: inputs.upload_release | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| shell: bash | ||
| run: | | ||
| TAG="${GITHUB_REF#refs/tags/}" | ||
| VERSION="${TAG#v}" | ||
| NAME="lk_${VERSION}_${{ matrix.suffix }}" | ||
| cp LICENSE ${{ inputs.output_dir }}/ | ||
| cp -r autocomplete ${{ inputs.output_dir }}/ | ||
| if [[ "${{ matrix.suffix }}" == windows_* ]]; then | ||
| cd ${{ inputs.output_dir }} && zip -r "../${NAME}.zip" lk.exe LICENSE autocomplete && cd .. | ||
| gh release upload "$TAG" "${NAME}.zip" --clobber | ||
| else | ||
| tar -czf "${NAME}.tar.gz" -C ${{ inputs.output_dir }} lk LICENSE autocomplete | ||
| gh release upload "$TAG" "${NAME}.tar.gz" --clobber | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # typed: false | ||
| # frozen_string_literal: true | ||
|
|
||
| # This formula is meant for a custom Homebrew tap (e.g. livekit/homebrew-livekit). | ||
| # It installs a prebuilt binary with console support (PortAudio + WebRTC AEC). | ||
| # Usage: brew install livekit/livekit/lk | ||
| class Lk < Formula | ||
| desc "Command-line interface to LiveKit (with console support)" | ||
| homepage "https://livekit.io" | ||
| license "Apache-2.0" | ||
| version "VERSION" | ||
|
|
||
| on_macos do | ||
| if Hardware::CPU.arm? | ||
| url "https://github.com/livekit/livekit-cli/releases/download/vVERSION/lk_VERSION_darwin_arm64.tar.gz" | ||
| sha256 "SHA256_DARWIN_ARM64" | ||
| end | ||
| end | ||
|
|
||
| on_linux do | ||
| if Hardware::CPU.arm? && Hardware::CPU.is_64_bit? | ||
| url "https://github.com/livekit/livekit-cli/releases/download/vVERSION/lk_VERSION_linux_arm64.tar.gz" | ||
| sha256 "SHA256_LINUX_ARM64" | ||
| elsif Hardware::CPU.arm? | ||
| url "https://github.com/livekit/livekit-cli/releases/download/vVERSION/lk_VERSION_linux_arm.tar.gz" | ||
| sha256 "SHA256_LINUX_ARM" | ||
| else | ||
| url "https://github.com/livekit/livekit-cli/releases/download/vVERSION/lk_VERSION_linux_amd64.tar.gz" | ||
| sha256 "SHA256_LINUX_AMD64" | ||
| end | ||
| end | ||
|
|
||
| def install | ||
| bin.install "lk" | ||
| bin.install_symlink "lk" => "livekit-cli" | ||
|
|
||
| bash_completion.install "autocomplete/bash_autocomplete" => "lk" | ||
| fish_completion.install "autocomplete/fish_autocomplete" => "lk.fish" | ||
| zsh_completion.install "autocomplete/zsh_autocomplete" => "_lk" | ||
| end | ||
|
|
||
| test do | ||
| output = shell_output("#{bin}/lk token create --list --api-key key --api-secret secret") | ||
| assert_match "valid for (mins): 5", output | ||
| assert_match "lk version #{version}", shell_output("#{bin}/lk --version") | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure we are unable to distribute prebuilt binaries through homebrew's core package repository?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah homebrew has to build it from source.. and sign it with apple distribution keys