Skip to content

Add AI provider and binding CLI support - #11

Open
cnluzhang wants to merge 3 commits into
mainfrom
feat/ai-binding
Open

Add AI provider and binding CLI support#11
cnluzhang wants to merge 3 commits into
mainfrom
feat/ai-binding

Conversation

@cnluzhang

@cnluzhang cnluzhang commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add wdl ai commands for provider metadata, credentials, and model discovery, and map Wrangler [ai] bindings into WDL deploy manifests
  • align CLI output and documentation with provider replacement, credential preservation, named-environment behavior, catalog lifecycle, WebSocket policy, and destructive deletion semantics
  • redact malformed AI, secret, and token command arguments without removing unambiguous flags-before-command usage
  • ship a bounded Responses function-tool demo with strict tool validation and a fail-closed Worker-level bearer gate

Validation

  • npm run format:check
  • npm run lint
  • npm run typecheck
  • npm test (577 tests)
  • npm audit --audit-level=moderate
  • npm pack --dry-run
  • local WDL live integration on port 8080 (21/21 steps)
  • local AI demo deploy: unauthenticated request rejected with 401, case-insensitive Bearer scheme with multiple spaces accepted, and POST completed through the hermetic AI provider

Notes

The local WDL stack intentionally routes provider calls to its hermetic test provider, so this validates the CLI, Control, encrypted credential, runtime binding, and demo request path without making a real external-provider inference request.

Parse Wrangler [ai] bindings, add namespace-scoped provider, credential, and model commands, ship an agent-ready Responses tool-loop example, and document deployment, credential rotation, OpenAI-compatible inference, streaming, and WebSocket usage without exposing provider credentials.

Signed-off-by: Lu Zhang <lu@wdl.dev>
Report whether provider updates preserve credentials.
Document AI lifecycle, environment, WebSocket, and deletion semantics.
Add CLI integration coverage and harden the packaged agent demo.

Signed-off-by: Lu Zhang <lu@wdl.dev>
@cnluzhang
cnluzhang marked this pull request as ready for review August 15, 2026 04:58
@cnluzhang
cnluzhang requested a balanced review from Copilot August 15, 2026 04:59

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds namespace-scoped AI provider management and Wrangler AI binding support to the WDL CLI.

Changes:

  • Adds wdl ai provider, credential, and model commands.
  • Maps [ai] bindings into deployment manifests.
  • Adds bilingual documentation, tests, and an AI agent example.

Reviewed changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/unit/cli-wrangler-config.test.js Tests AI environment resolution.
tests/unit/cli-wrangler-bindings.test.js Tests AI binding parsing.
tests/unit/cli-deploy.test.js Tests AI manifest generation.
tests/unit/cli-ai.test.js Tests AI CLI commands.
tests/integration/cli-live.test.js Adds live AI resource coverage.
templates/AGENTS.md Adds AI guidance.
README.md Documents AI support.
README-zh.md Adds Chinese AI overview.
lib/wrangler/config.js Recognizes and strips AI config.
lib/wrangler/bindings.js Parses AI bindings.
lib/wrangler-pack.js Emits AI manifest bindings.
GUIDE.md Adds complete AI guidance.
GUIDE-zh.md Adds Chinese AI guidance.
examples/ai-agent-demo/wrangler.toml Configures the AI example.
examples/ai-agent-demo/src/index.js Implements the agent loop.
examples/ai-agent-demo/provider.openai.json Defines example provider metadata.
examples/ai-agent-demo/package.json Defines example dependencies.
docs/README.md Indexes AI documentation.
docs/README-zh.md Indexes Chinese AI documentation.
docs/env-overrides.md Documents AI environment behavior.
docs/env-overrides-zh.md Adds Chinese environment guidance.
docs/deploy.md Adds AI deployment guidance.
docs/deploy-zh.md Adds Chinese deployment guidance.
docs/ai.md Adds the AI feature reference.
docs/ai-zh.md Adds the Chinese AI reference.
commands/ai.js Implements wdl ai.
CHANGELOG.md Records the new feature.
bin/wdl.js Registers the AI command.
.claude/skills/wdl-deploy/SKILL.md Adds agent-facing AI instructions.
.claude/rules/examples.md Registers the AI example.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread examples/ai-agent-demo/src/index.js Outdated
Redact malformed AI, secret, and token arguments while retaining unambiguous option ordering.
Improve AI credential error guidance and surface named-environment binding omissions.
Protect the AI agent demo with a Worker bearer token and return tool failures to the model.
Document provider replacement, credential handling, file containment, and demo security behavior.

Signed-off-by: Lu Zhang <lu@wdl.dev>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 41 out of 42 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants