Add device-authorized hosted agent skills - #2
Merged
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
This PR adds three distinct agent skills and the authenticated CLI boundary used by the two hosted skills:
youtube-directis self-contained and performs stateless YouTube search and extraction directly from the user's machine. It requires no video2ctx account, hosted API, API key, or separately installed CLI.video2ctx-apicovers stateless reads through the supported video2ctx hosted API, including managed caching, account information, and usage.video2ctx-monitoringis the stateful exception for monitors, schedules, notifications, and delivery preferences.@video2ctx/cli@0.1.0provides browser device login,whoami, auth status, logout, credential storage, and authenticated hosted-API transport for the two hosted skills. It is now published publicly and versioned independently from the skills.The hosted skills follow the separate CLI + skill model: they teach agents how to use
video2ctx, while authentication and transport remain in the CLI. They do not bundle a private copy of it.Why
The direct and hosted surfaces solve different problems:
youtube-directfor unauthenticated, local, stateless YouTube access.video2ctx-apifor production-supported hosted endpoints, managed caching, account boundaries, and usage tracking.video2ctx-monitoringfor recurring, stateful monitoring workflows.For hosted access, device authorization avoids asking an agent to handle a long-lived API key while retaining API keys as an explicit alternative for automation and existing integrations.
Better Auth integration
No separate Better Auth device-auth package was installed. The repository already depended on
better-auth@1.6.26and@better-auth/api-key@1.6.26.This PR activates plugins included with the existing core
better-authpackage:deviceAuthorization()implements the server-side OAuth device-code flow.deviceAuthorizationClient()lets the web application approve or deny a device request.bearer()accepts the resulting Better Auth session token throughAuthorization: Bearer <token>.@better-auth/api-keyremains the existing implementation foraty_...API keys; it was not introduced for CLI device login.Application-owned work around Better Auth includes:
video2ctx-cliwithdata:read account:accessdeviceCodeD1 migration/devicebrowser approval experienceCLI sessions may read supported data, account information, usage, and monitoring resources. Browser-only operations remain blocked, including API-key management, billing, connected accounts, account deletion, and administration.
Suggested review order
The diff contains many generated and mechanical files, so a practical review sequence is:
.agents/skills/README.md.agents/skills/*/SKILL.mdreference/agents/platform-internals.mdplatform/src/lib/auth.tsplatform/src/middlewares/authentication.tsplatform/migrations/0013_device_authorization.sqlpackages/video2ctx-cli/src/packages/video2ctx-cli/package.jsonpackages/video2ctx-cli/README.mdweb/app/device/web/lib/device-authorization.tsplatform/test/auth-worker.integration.test.tsplatform/test/e2e/auth-device.spec.tsplatform/scripts/start-auth-e2e-worker.mjs.agents/skills/youtube-direct/scripts/youtube.mjsdocs/api-reference/openapi.jsonValidation
All current PR checks pass.
all-things-youtube: build, tests, CLI behavior, and skill-bundle staleness check@video2ctx/cli: 13 unit tests, build, help/version smoke tests, andnpm pack --dry-runwhoami, usage, monitor listing, logout, credential removal, and action-button contrastPreview-backed release test
The complete pending preview migration sequence (
0006through0013) was applied to the shared Cloudflare preview D1 database. ThedeviceCodetable is present.Because the platform's D1, KV, R2, queues, workflows, Durable Objects, and containers are not all safely isolated in an automatic branch deployment, the branch was run locally while connected to the remote preview D1 and KV resources. The web approval page and Worker ran locally, and the YouTube processor ran in Docker.
The registry-published
@video2ctx/cli@0.1.0was then installed anonymously into a clean temporary prefix and tested against that stack. It:0.1.0from the installedvideo2ctxbinarythinktank.himanshu@gmail.comauth status,whoami, usage, monitor-list, and provider-list requestsThis is a real preview-resource smoke test, but not a public HTTPS deployment test of the platform Worker.
Rollout state and required follow-up
State checked on 2026-08-17:
@video2ctx/cli@0.1.0is public on npm and its clean registry installation is verified.0013_device_authorization.sqlare applied and the flow is verified.0013_device_authorization.sqlremains pending; production was not modified.Recommended remaining rollout order:
0013_device_authorization.sqlimmediately before deploying the platform code that uses it.whoami, logout, and revocation.The npm package is available now, but its default production login flow depends on the server and web changes in this PR being deployed.