|
|
|
@@ -2,7 +2,7 @@
|
|
|
|
|
# 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
|
|
|
|
|
# AGENTS GITHUB_PATH HOME
|
|
|
|
|
set -eu
|
|
|
|
|
|
|
|
|
|
curl -fsSL https://opencode.ai/install | bash
|
|
|
|
@@ -27,11 +27,17 @@ esac
|
|
|
|
|
SKILLS="${SKILLS:-[]}"
|
|
|
|
|
PERM=$(jq -nc --argjson s "$SKILLS" '
|
|
|
|
|
{skill: ( {"*":"deny"} + (reduce $s[] as $k ({}; . + {($k):"allow"})) )}')
|
|
|
|
|
# Two ollama providers: local self-hosted (ornith) + Ollama Cloud (gemma4/kimi-k2.7-code/glm-5.2/minimax-m3).
|
|
|
|
|
jq -n --argjson mcp "$MCP" --argjson perm "$PERM" --arg url "$OLLAMA_URL" --arg ckey "$OLLAMA_CLOUD_API_KEY" '{
|
|
|
|
|
# Derive the Ollama Cloud `models:` map from the agent registry itself — single source of truth,
|
|
|
|
|
# so the provider config and the agent→model mapping in route.sh can't drift. Registry model IDs
|
|
|
|
|
# are prefixed `ollama-cloud/...`; the provider's are the unprefixed IDs. `// {}` keeps it valid
|
|
|
|
|
# JSON when no agent uses an ollama-cloud model (e.g. a repo where every agent is anthropic/*).
|
|
|
|
|
AGENTS="${AGENTS:-{}}"
|
|
|
|
|
CMODELS=$(printf '%s' "$AGENTS" | jq -c '([.[].model | select(startswith("ollama-cloud/")) | sub("^ollama-cloud/";"")] | unique | map({(.):{}}) | add) // {}')
|
|
|
|
|
# Two ollama providers: local self-hosted (ornith) + Ollama Cloud (derived above).
|
|
|
|
|
jq -n --argjson mcp "$MCP" --argjson perm "$PERM" --argjson cmodels "$CMODELS" --arg url "$OLLAMA_URL" --arg ckey "$OLLAMA_CLOUD_API_KEY" '{
|
|
|
|
|
provider: {
|
|
|
|
|
ollama: {npm:"@ai-sdk/openai-compatible", options:{baseURL:($url+"/v1")}, models:{"ornith:35b":{}}},
|
|
|
|
|
"ollama-cloud": {npm:"@ai-sdk/openai-compatible", options:{baseURL:"https://ollama.com/v1", apiKey:$ckey}, models:{"glm-5.2:cloud":{},"gemma4:cloud":{},"kimi-k2.7-code:cloud":{},"minimax-m3:cloud":{}}}
|
|
|
|
|
"ollama-cloud": {npm:"@ai-sdk/openai-compatible", options:{baseURL:"https://ollama.com/v1", apiKey:$ckey}, models:$cmodels}
|
|
|
|
|
},
|
|
|
|
|
permission: $perm,
|
|
|
|
|
mcp: $mcp
|
|
|
|
|