ada-agent 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +262 -256
- package/docs/architecture.md +38 -14
- package/docs/cloudflare.md +81 -0
- package/docs/connectors.md +2 -1
- package/docs/integrations.md +4 -1
- package/package.json +4 -2
- package/skills/aesthetic-direction/SKILL.md +24 -24
- package/skills/color-palette/SKILL.md +24 -24
- package/skills/component-library/SKILL.md +23 -23
- package/skills/dark-mode/SKILL.md +24 -24
- package/skills/dashboard-ui/SKILL.md +23 -23
- package/skills/design-system/SKILL.md +24 -24
- package/skills/design-tokens/SKILL.md +24 -24
- package/skills/empty-states/SKILL.md +23 -23
- package/skills/hero-section/SKILL.md +23 -23
- package/skills/micro-interactions/SKILL.md +23 -23
- package/skills/motion-design/SKILL.md +23 -23
- package/skills/page-transitions/SKILL.md +23 -23
- package/skills/pricing-page/SKILL.md +23 -23
- package/skills/scroll-animation/SKILL.md +23 -23
- package/skills/skeleton-loader/SKILL.md +23 -23
- package/skills/tailwind-theme/SKILL.md +24 -24
- package/skills/typography/SKILL.md +24 -24
- package/skills/ui-polish/SKILL.md +24 -24
- package/skills/ui-review/SKILL.md +24 -24
- package/skills/web-fonts/SKILL.md +24 -24
- package/src/client/autostart.ts +93 -0
- package/src/client/catalog.json +1 -0
- package/src/client/cli.ts +23 -1
- package/src/client/models-dev.ts +57 -3
- package/src/selfcheck.ts +404 -364
- package/src/server/config.ts +7 -0
- package/src/server/providers/openai-compat.ts +4 -2
- package/src/server/providers/registry.ts +1 -0
- package/src/server/router.ts +5 -1
- package/src/shared/types.ts +1 -0
package/src/server/config.ts
CHANGED
|
@@ -27,6 +27,13 @@ export const PROVIDERS: Record<ProviderName, ProviderDef> = {
|
|
|
27
27
|
// token (exchanged from a GitHub OAuth token at /copilot_internal/v2/token — that exchange is not
|
|
28
28
|
// implemented here; it needs a Copilot subscription). Required headers are added in the adapter.
|
|
29
29
|
copilot: { baseURL: process.env.COPILOT_BASE_URL ?? "https://api.githubcopilot.com", keyEnv: "COPILOT_API_KEY" },
|
|
30
|
+
// Cloudflare Workers AI / AI Gateway — OpenAI-compatible. Workers AI: set CLOUDFLARE_ACCOUNT_ID +
|
|
31
|
+
// CLOUDFLARE_API_TOKEN (default URL). AI Gateway: point CLOUDFLARE_BASE_URL at the gateway URL.
|
|
32
|
+
// Model ids are `@cf/<vendor>/<model>` (e.g. @cf/moonshotai/kimi-k2.7-code) — sent through as-is.
|
|
33
|
+
cloudflare: {
|
|
34
|
+
baseURL: process.env.CLOUDFLARE_BASE_URL ?? `https://api.cloudflare.com/client/v4/accounts/${process.env.CLOUDFLARE_ACCOUNT_ID ?? ""}/ai/v1`,
|
|
35
|
+
keyEnv: "CLOUDFLARE_API_TOKEN",
|
|
36
|
+
},
|
|
30
37
|
ollama: { baseURL: process.env.OLLAMA_BASE_URL ?? "http://localhost:11434/v1", keyEnv: "" },
|
|
31
38
|
};
|
|
32
39
|
|
|
@@ -20,8 +20,10 @@ function authHeaders(provider: ProviderName): Record<string, string> {
|
|
|
20
20
|
export const openAICompatAdapter: Adapter = {
|
|
21
21
|
async chat({ provider, body, res }: ChatRequest): Promise<void> {
|
|
22
22
|
const def = PROVIDERS[provider];
|
|
23
|
-
//
|
|
24
|
-
|
|
23
|
+
// Strip a leading "<provider>/" the router used only to disambiguate (copilot/groq/together) — the
|
|
24
|
+
// endpoint wants the bare id. (Cloudflare's "@cf/…" ids aren't "cloudflare/…", so they pass through.)
|
|
25
|
+
const prefix = `${provider}/`;
|
|
26
|
+
const outBody = typeof body.model === "string" && body.model.startsWith(prefix) ? { ...body, model: body.model.slice(prefix.length) } : body;
|
|
25
27
|
let upstream: Awaited<ReturnType<typeof fetch>>;
|
|
26
28
|
try {
|
|
27
29
|
upstream = await fetch(`${def.baseURL}/chat/completions`, {
|
|
@@ -23,6 +23,7 @@ const ADAPTERS: Record<ProviderName, Adapter> = {
|
|
|
23
23
|
xai: openAICompatAdapter,
|
|
24
24
|
dashscope: openAICompatAdapter, // Alibaba Qwen via DashScope's OpenAI-compatible endpoint
|
|
25
25
|
copilot: openAICompatAdapter, // GitHub Copilot's OpenAI-compatible endpoint (+ custom headers in the adapter)
|
|
26
|
+
cloudflare: openAICompatAdapter, // Cloudflare Workers AI / AI Gateway (OpenAI-compatible)
|
|
26
27
|
ollama: openAICompatAdapter,
|
|
27
28
|
};
|
|
28
29
|
|
package/src/server/router.ts
CHANGED
|
@@ -11,8 +11,12 @@ export function route(model: string, explicit?: string): ProviderName {
|
|
|
11
11
|
|
|
12
12
|
// "vendor/model" → OpenRouter's namespacing convention. Checked before base-name prefixes
|
|
13
13
|
// so e.g. "mistralai/…" routes to OpenRouter, not the Mistral API.
|
|
14
|
-
//
|
|
14
|
+
// Prefixed ids that must beat the OpenRouter "/" rule below:
|
|
15
|
+
if (m.startsWith("@cf/")) return "cloudflare"; // Cloudflare Workers AI model ids
|
|
15
16
|
if (m.startsWith("copilot/")) return "copilot";
|
|
17
|
+
// `groq/…` / `together/…` disambiguate shared model names (llama-3.3, gemma2…) that no prefix can.
|
|
18
|
+
if (m.startsWith("groq/")) return "groq";
|
|
19
|
+
if (m.startsWith("together/")) return "together";
|
|
16
20
|
if (m.includes("/")) return "openrouter";
|
|
17
21
|
// "model:tag" → a local Ollama model (e.g. gemma4:latest).
|
|
18
22
|
if (m.includes(":")) return "ollama";
|