Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0a06c813bc | ||
|
|
c4fb117b93 |
@@ -149,7 +149,6 @@ jobs:
|
||||
SCRIPTS: ${{ runner.temp }}/agents-scripts
|
||||
OLLAMA_URL: ${{ secrets.OLLAMA_URL }}
|
||||
OLLAMA_CLOUD_API_KEY: ${{ secrets.OLLAMA_CLOUD_API_KEY }}
|
||||
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
|
||||
NAME: ${{ steps.prep.outputs.name }}
|
||||
SKILLS: ${{ steps.prep.outputs.skills }} # JSON array of skills this agent may load
|
||||
run: bash "$SCRIPTS/install-opencode.sh"
|
||||
@@ -213,7 +212,6 @@ jobs:
|
||||
env:
|
||||
SCRIPTS: ${{ runner.temp }}/agents-scripts
|
||||
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
|
||||
# SELF_TOKEN = the RUNNING agent's OWN token (TOKEN_PM for @pm, TOKEN_OPS for @ops, …).
|
||||
# Only this agent's token is placed in its process env, so no agent can act as another.
|
||||
# Powers the gitea-api / gitea-admin skills — each agent calls Gitea as itself. Every
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
"desc": "Senior dev — complex, multi-file implementation (GLM-5.2 via Ollama Cloud, text-only)."
|
||||
},
|
||||
"lead": {
|
||||
"model": "xai/grok-4.5",
|
||||
"model": "anthropic/claude-opus-4-8",
|
||||
"vision": true,
|
||||
"mode": "pr",
|
||||
"skills": [
|
||||
|
||||
@@ -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 XAI_API_KEY
|
||||
# NAME SKILLS GITHUB_PATH HOME
|
||||
# Required env (provided by the workflow step): OLLAMA_URL OLLAMA_CLOUD_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,18 +42,15 @@ 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. `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.
|
||||
# provider. Built-in providers (e.g. `anthropic/claude-opus-4-8` for @lead) 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")
|
||||
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" '{
|
||||
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" '{
|
||||
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},
|
||||
xai: {npm:"@ai-sdk/openai-compatible", options:{baseURL:"https://api.x.ai/v1", apiKey:$xkey}, models:$xai}
|
||||
"ollama-cloud": {npm:"@ai-sdk/openai-compatible", options:{baseURL:"https://ollama.com/v1", apiKey:$ckey}, models:$cloud}
|
||||
},
|
||||
permission: $perm,
|
||||
mcp: $mcp
|
||||
|
||||
@@ -334,7 +334,14 @@ if [ -n "$(git status --porcelain)" ]; then
|
||||
git add -A
|
||||
git commit -m "@$NAME: issue #$NUM"
|
||||
fi
|
||||
git push origin "HEAD:$BRANCH" || true
|
||||
if git push origin "HEAD:$BRANCH"; then
|
||||
:
|
||||
else
|
||||
status=$?
|
||||
echo "git push failed for $BRANCH (exit $status)"
|
||||
post "$(printf '⚠️ Push to branch `%s` failed (git exit %s). The PR will not open until the push succeeds. Please check the Actions log.%s' "$BRANCH" "$status" "$activity")"
|
||||
exit 0
|
||||
fi
|
||||
git fetch -q origin 2>/dev/null || true
|
||||
|
||||
prbody=$(printf '%s\n\n---\nResolves #%s' "$prdesc" "$NUM")
|
||||
@@ -360,14 +367,21 @@ url=$(printf '%s' "$resp" | jq -r '.html_url // empty' 2>/dev/null)
|
||||
prnum=$(printf '%s' "$resp" | jq -r '.number // empty' 2>/dev/null)
|
||||
if [ -z "$url" ]; then
|
||||
title="@$NAME: $TITLE"
|
||||
resp=$(curl -sS -X POST "${hdr[@]}" "$API/pulls" \
|
||||
resp_body=/tmp/pr_create_resp.json
|
||||
http_status=$(curl -sS -o "$resp_body" -w '%{http_code}' -X POST "${hdr[@]}" "$API/pulls" \
|
||||
-d "$(jq -nc --arg t "$title" --arg h "$br" --arg b "$prbody" \
|
||||
'{title:$t, head:$h, base:"main", body:$b}')")
|
||||
echo "PR create ($br): $resp"
|
||||
resp=$(cat "$resp_body" 2>/dev/null || true)
|
||||
echo "PR create ($br): HTTP $http_status — $resp"
|
||||
url=$(printf '%s' "$resp" | jq -r '.html_url // empty' 2>/dev/null)
|
||||
prnum=$(printf '%s' "$resp" | jq -r '.number // empty' 2>/dev/null)
|
||||
fi
|
||||
[ -z "$url" ] && { echo "PR open/lookup failed for $br — posting reply on issue instead"; post "$(printf '%s%s' "$reply" "$activity")"; exit 0; }
|
||||
if [ -z "$url" ]; then
|
||||
err_msg=$(printf '%s' "$resp" | jq -r 'if type=="object" and .message then .message else "(no error message in response)" end' 2>/dev/null)
|
||||
echo "PR open/lookup failed for $br — HTTP $http_status — response: $resp"
|
||||
post "$(printf '⚠️ Failed to open PR for branch `%s`.\n\nHTTP status: %s\nGitea message: %s%s' "$br" "$http_status" "$err_msg" "$activity")"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Posts to the PR thread when we have a PR number, else to the origin issue ($NUM).
|
||||
prpost() {
|
||||
|
||||
Reference in New Issue
Block a user