|
|
|
@@ -1,8 +1,8 @@
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
# Install opencode + provider config (+ Playwright MCP for browser agents).
|
|
|
|
|
#
|
|
|
|
|
# Required env (provided by the workflow step): OLLAMA_URL OLLAMA_CLOUD_API_KEY NAME SKILLS
|
|
|
|
|
# GITHUB_PATH HOME
|
|
|
|
|
# Required env (provided by the workflow step): OLLAMA_URL OLLAMA_CLOUD_API_KEY XAI_API_KEY
|
|
|
|
|
# NAME SKILLS GITHUB_PATH HOME
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
# PIN the opencode version: an unpinned `latest` means a breaking release (CLI flags, or the
|
|
|
|
@@ -42,15 +42,18 @@ PERM=$(jq -nc --argjson s "$SKILLS" '
|
|
|
|
|
# The provider `models:` maps are DERIVED from agents.json (the single source of truth, shared with
|
|
|
|
|
# route.sh) so every model an agent is routed to is always declared in the provider config.
|
|
|
|
|
# `ollama-cloud/` prefix models go to the cloud provider; `ollama/` prefix models go to the local
|
|
|
|
|
# provider. Built-in providers (e.g. `anthropic/claude-opus-4-8` for @lead) are not derived here.
|
|
|
|
|
# provider. `xai/` prefix models go to the xAI provider (OpenAI-compatible, https://api.x.ai/v1).
|
|
|
|
|
# Built-in providers (e.g. `anthropic/claude-opus-4-8` for @ops) are not derived here.
|
|
|
|
|
# See issue #31.
|
|
|
|
|
AGENTS_JSON="${SCRIPTS:-$(dirname -- "$0")}/agents.json"
|
|
|
|
|
CLOUD_MODELS=$(jq -r '[.[] | .model | select(startswith("ollama-cloud/")) | sub("^ollama-cloud/";"")] | map({(.):{}}) | add // {}' "$AGENTS_JSON")
|
|
|
|
|
LOCAL_MODELS=$(jq -r '[.[] | .model | select(startswith("ollama/")) | sub("^ollama/";"")] | map({(.):{}}) | add // {"ornith:35b":{}}' "$AGENTS_JSON")
|
|
|
|
|
jq -n --argjson mcp "$MCP" --argjson perm "$PERM" --argjson cloud "$CLOUD_MODELS" --argjson local "$LOCAL_MODELS" --arg url "$OLLAMA_URL" --arg ckey "$OLLAMA_CLOUD_API_KEY" '{
|
|
|
|
|
XAI_MODELS=$(jq -r '[.[] | .model | select(startswith("xai/")) | sub("^xai/";"")] | map({(.):{}}) | add // {}' "$AGENTS_JSON")
|
|
|
|
|
jq -n --argjson mcp "$MCP" --argjson perm "$PERM" --argjson cloud "$CLOUD_MODELS" --argjson local "$LOCAL_MODELS" --argjson xai "$XAI_MODELS" --arg url "$OLLAMA_URL" --arg ckey "$OLLAMA_CLOUD_API_KEY" --arg xkey "$XAI_API_KEY" '{
|
|
|
|
|
provider: {
|
|
|
|
|
ollama: {npm:"@ai-sdk/openai-compatible", options:{baseURL:($url+"/v1")}, models:$local},
|
|
|
|
|
"ollama-cloud": {npm:"@ai-sdk/openai-compatible", options:{baseURL:"https://ollama.com/v1", apiKey:$ckey}, models:$cloud}
|
|
|
|
|
"ollama-cloud": {npm:"@ai-sdk/openai-compatible", options:{baseURL:"https://ollama.com/v1", apiKey:$ckey}, models:$cloud},
|
|
|
|
|
xai: {npm:"@ai-sdk/openai-compatible", options:{baseURL:"https://api.x.ai/v1", apiKey:$xkey}, models:$xai}
|
|
|
|
|
},
|
|
|
|
|
permission: $perm,
|
|
|
|
|
mcp: $mcp
|
|
|
|
|