feat: add agora convoai playground dev frontend command#50
Open
plutoless wants to merge 18 commits into
Open
Conversation
Implements the version-007 Agora AccessToken2 builder producing a single token carrying both an RTC service (join + publish privileges) and an RTM service (login privilege), with a golden-vector test verified against the AgoraIO/Tools reference implementation. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds the `agora convoai playground` command group with all required flags (--channel, --port, --uid, --agent-uid, --ttl, --no-open) and a stub RunE body; later tasks will fill in the server/token logic. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…adiness Add pure helper functions (validateChannelName, resolveUID, resolveAgentUID, parseTTLSeconds, featureEnabled) plus resolvePlaygroundSession which resolves the active project, enforces an app certificate, and gates on the convoai feature being enabled before returning a populated playgroundSession. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…uard Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…down Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… startup output The "convoai playground" case added to render.go's pretty switch is dead code: printPlaygroundStartup only calls renderResult in JSON mode, where renderResult returns early via emitEnvelope before reaching the switch. Deleted the case and added a comment to convoai.go explaining why printPlaygroundStartup owns pretty rendering inline (the multi-line wire block doesn't fit printBlock's shape). JSON envelope unaffected: renderResult's JSON guard emits the envelope with data before the switch, so removing the pretty case doesn't affect JSON output. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…pe file - Vite: deleteOriginFile: true so large JS/CSS become .gz-only in webassets (1.5 MB embedded vs 7.3 MB before) - Go: replace http.FileServer with gzip-aware newStaticHandler that serves raw files directly or .gz siblings with Content-Encoding: gzip; nil assets still returns 404 - Remove duplicate "Waiting for agent to join…" inline div (kept in StatusBar) - Delete unused frontend/src/types/conversation.ts Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ntegration test - Add playground-build and playground-check Makefile targets matching the docs-commands pattern - Wire playground-check into the lint aggregate target alongside docs-commands-check - Add TestConvoaiPlaygroundServesEmbeddedApp: verifies real embedded assets are served (not the placeholder) and /api/get_config returns a 007 token - Re-stamp webassets/SOURCE_HASH (prior task deleted frontend/src/types/conversation.ts without updating the hash) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Adds
agora convoai playground --channel <name>: a local dev harness that serves an embedded web frontend so a developer can talk to a Conversational AI agent they run separately (e.g. a Python script on the Agora Agents SDK). Point your agent at the same App ID and--channel, open the browser, and converse — with a live transcript, audio meters, and connection status.internal/agoratokenimplements Agora's AccessToken2 (007) builder (RTC + RTM services in one combined token), stdlib crypto only, verified byte-for-byte against Agora's official reference builder.127.0.0.1only, serves the embedded SPA +GET /api/get_config(mirrors the quickstart's{code,data}contract). Loopback Host-header guard, same-origin (no CORS), graceful SIGINT/SIGTERM shutdown, auto-incrementing port (default 8787).agora-agent-uikit+agora-agent-client-toolkit(join, mic, agent audio,AgoraVoiceAItranscript/metrics/state),go:embed-ed and gzip-served (binary embeds only the ~1.5 MB compressed bundle).agora project feature enable convoaiif Conversational AI isn't enabled (never auto-enables). Prints a "wire your agent" block (App ID + channel + reserved agent uid) and never prints the certificate.frontend/;make playground-buildregenerates the committedwebassets/; a pure-GoSOURCE_HASHdrift guard (make playground-check) is wired intomake lint.go buildneeds no Node.Notes / trade-offs
agora-rtc-sdk-ngandagora-rtmare bundled (no reliable RTM UMD CDN build; RTC SDK's named ESM exports don't map cleanly to a UMD global). CDN-externalizing the RTC SDK remains a possible future size optimization.Test Plan
go test ./...(token-builder golden-vector + decode tests,/api/get_confighandler tests incl. loopback guard, embedded-app integration test, frontendconversationunit test)make snapshot-error-codes,make docs-commands-check,make playground-checkall passgo build ./.../go vet ./...cleanagora convoai playground --channel <name>against a convoai-ready project, start a Python agent on the same channel, confirm audio + live transcript both ways🤖 Generated with Claude Code