Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions local-plugins/opencode-qwen-auth/dist/src/plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions my-sin-coding-agents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"$schema": "https://github.com/Delqhi/upgraded-opencode-stack/blob/main/schemas/team-config.schema.json",
"team_id": "team-coding-agents",
"name": "Team Coding Agents (6 dedicated repos)",
"description": "6 dedicated A2A Coder Agents with individual GitHub repos — split from monolithic OpenSIN-Code for isolated deployments, independent versioning, and crash-storm protection. Established after BUG-OCI-001 (OCI VM disk-full incident, 2026-04-16).",
"manager": "A2A-SIN-Zeus",
"primary_model": "google/antigravity-claude-sonnet-4-6",
"fallback_models": [
"openai/gpt-5.4",
"google/antigravity-gemini-3.1-pro",
"qwen/coder-model"
],
"established": "2026-04-17",
"bug_references": [
"BUG-OCI-001"
],
"members": {
"A2A-SIN-Code-Backend": {
"github": "https://github.com/OpenSIN-AI/A2A-SIN-Code-Backend",
"port": 7863,
"purpose": "Backend specialists — Server, OracleCloud, APIs",
"specialization": "backend-api-server"
},
"A2A-SIN-Code-Command": {
"github": "https://github.com/OpenSIN-AI/A2A-SIN-Code-Command",
"port": 7861,
"purpose": "Command/CLI agents — shell, automation, scripting",
"specialization": "cli-automation"
},
"A2A-SIN-Code-Frontend": {
"github": "https://github.com/OpenSIN-AI/A2A-SIN-Code-Frontend",
"port": 7865,
"purpose": "Frontend specialists — UI/UX, React, CSS",
"specialization": "frontend-ui-ux"
},
"A2A-SIN-Code-Fullstack": {
"github": "https://github.com/OpenSIN-AI/A2A-SIN-Code-Fullstack",
"port": 7864,
"purpose": "Fullstack specialists — end-to-end implementations",
"specialization": "fullstack-end-to-end"
},
"A2A-SIN-Code-Plugin": {
"github": "https://github.com/OpenSIN-AI/A2A-SIN-Code-Plugin",
"port": 7860,
"purpose": "Plugin developers — MCPs, integrations, auth",
"specialization": "plugins-mcps-integrations"
},
"A2A-SIN-Code-Tool": {
"github": "https://github.com/OpenSIN-AI/A2A-SIN-Code-Tool",
"port": 7862,
"purpose": "Tool builders — CLI utilities, external integrations",
"specialization": "cli-utilities-external-tools"
}
}
}
12 changes: 12 additions & 0 deletions opencode.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,18 @@
],
"enabled": true
},
"sin-box-storage": {
"type": "local",
"command": [
"python3",
"/Users/jeremy/dev/A2A-SIN-Box-Storage/scripts/mcp-box-storage.py"
],
"environment": {
"BOX_STORAGE_URL": "http://room-09-box-storage:3000",
"BOX_STORAGE_API_KEY": "${BOX_STORAGE_API_KEY}"
},
"enabled": true
},
"webauto-nodriver": {
"type": "local",
"command": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ function latestGeneratedImage() {
}

function runImage(prompt, fileName) {
const message = `\\generate-image ${prompt}; file name should be ${fileName}; save it at .opencode/generated-images`;
const message = `/generate-image ${prompt}; file name should be ${fileName}; save it at .opencode/generated-images`;
execFileSync("opencode", ["run", message, "--model=google/antigravity-gemini-3-flash", "--format", "json"], {
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"]
Expand Down
71 changes: 71 additions & 0 deletions templates/governance/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Governance Contract Templates

> **Canonical templates for sovereign repo governance across the OpenSIN fleet.**
> Version: 2026.04.17 | Issue: upgraded-opencode-stack#26

## Overview

This directory contains **concrete template instances** that any A2A repo can copy to bootstrap its governance stack. The corresponding JSON Schemas live in the parent `templates/` directory.

## Files

| File | Purpose | Copy To |
|------|---------|---------|
| `repo-governance.template.json` | Branch protection, merge rules, fail-closed semantics | `governance/repo-governance.json` |
| `pr-watcher.template.json` | PR review automation, credential scanning, escalation | `governance/pr-watcher.json` |
| `platform-registry.template.json` | Platform intake registry with fail-closed rules | `platforms/registry.json` |

## Usage

### For New Repos (via Factory)

The factory (`create-sin-a2a-agent.mjs`) reads `Template-SIN-Agent/required-files.manifest.json` and copies these templates automatically during repo generation, substituting `{{REPO_SLUG}}` with the actual agent slug.

### For Existing Repos (via Backfill)

```bash
# Copy and customize for your repo
cp templates/governance/repo-governance.template.json governance/repo-governance.json
cp templates/governance/pr-watcher.template.json governance/pr-watcher.json
cp templates/governance/platform-registry.template.json platforms/registry.json

# Replace placeholder with actual repo slug
sed -i '' 's/{{REPO_SLUG}}/your-agent-slug/g' governance/*.json platforms/*.json
```

### Validation

Validate your governance files against the schemas:

```bash
# Using ajv-cli or similar JSON Schema validator
ajv validate -s templates/repo-governance.schema.json -d governance/repo-governance.json
ajv validate -s templates/pr-watcher.schema.json -d governance/pr-watcher.json
ajv validate -s templates/platform-registry.schema.json -d platforms/registry.json
```

## Schema Reference

| Schema | Location |
|--------|----------|
| `repo-governance.schema.json` | `templates/repo-governance.schema.json` |
| `pr-watcher.schema.json` | `templates/pr-watcher.schema.json` |
| `platform-registry.schema.json` | `templates/platform-registry.schema.json` |
| `work-item.schema.json` | `templates/work-item.schema.json` |

## Template Variables

All templates use `{{REPO_SLUG}}` as the primary substitution variable. The factory replaces this with the agent's actual slug during generation.

## Relationship to Template-SIN-Agent

These templates are the **source of truth** for governance file content. `Template-SIN-Agent` contains its own copies (in `governance/`, `platforms/`) but those are generated FROM these templates. When updating governance contracts, update HERE first, then propagate to Template-SIN-Agent.

## Fail-Closed Rules

All governance contracts follow fail-closed semantics:
- Unknown check results → **block** (not pass)
- Missing required files → **block merge**
- Credential leaks → **block merge immediately**
- Unregistered platforms → **blocked** (no implicit access)
- CI runner timeout → **block** (not skip)
33 changes: 33 additions & 0 deletions templates/governance/platform-registry.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$comment": "Concrete template instance — copy this file to platforms/registry.json in any A2A repo and replace {{REPO_SLUG}}.",
"$schema": "https://opencode.local/templates/platform-registry.schema.json",
"version": "2026.04.17",
"platforms": [
{
"id": "github-issues",
"name": "GitHub Issues",
"category": "issue-tracker",
"enabled": true,
"status": "active",
"intakeMode": "webhook",
"webhookPath": "/webhooks/github",
"signatureRequired": true,
"authRef": "env:GITHUB_WEBHOOK_SECRET",
"baseUrl": "https://api.github.com",
"eventTypes": ["issues.opened", "issues.edited", "issues.labeled"],
"normalizer": "n8n-workflows/inbound-intake.json",
"dedupeKeyTemplate": "github:{{REPO_SLUG}}:issue:{{externalId}}",
"defaultRepo": "OpenSIN-AI/{{REPO_SLUG}}",
"defaultLabels": ["inbound", "github"],
"watcherRequired": true,
"watcherConfigRef": "governance/pr-watcher.json",
"riskLevel": "low",
"automationPolicy": "issue_plus_pr",
"allowedActions": ["create_issue", "update_issue", "create_branch", "create_pr"],
"forbiddenActions": ["force_push", "delete_branch_main"],
"evidenceRequired": false,
"retentionDays": 365,
"notes": "Default platform for all A2A repos. GitHub Issues are the canonical intake surface."
}
]
}
33 changes: 33 additions & 0 deletions templates/governance/pr-watcher.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"$comment": "Concrete template instance — copy this file to governance/pr-watcher.json in any A2A repo and replace {{REPO_SLUG}}.",
"$schema": "https://opencode.local/templates/pr-watcher.schema.json",
"enabled": true,
"repo": "OpenSIN-AI/{{REPO_SLUG}}",
"prSource": "all",
"ignoreAuthors": [],
"ignoreBots": false,
"noisePrefixes": ["chore(deps):", "ci:"],
"noiseSubstrings": ["bump version", "auto-generated"],
"watcherScript": "scripts/watch-pr-feedback.sh",
"followupCommand": "gh pr review --approve",
"stateDir": ".pr-watcher-state",
"summaryFile": ".pr-watcher-state/summary.json",
"logFile": ".pr-watcher-state/watcher.log",
"reviewPolicy": {
"autoReviewEnabled": true,
"autoReviewModel": "opencode run --format json",
"credentialScanEnabled": true,
"credentialPatterns": [
"GOOGLE_API_KEY", "OPENAI_API_KEY", "A2A_FLEET_TOKEN",
"sk-", "ghp_", "gho_", "Bearer ", "password", "secret"
],
"requiredFilesCheckEnabled": true,
"requiredFilesManifest": "required-files.manifest.json"
},
"escalation": {
"staleAfterHours": 48,
"abandonedAfterDays": 7,
"telegramBot": "sin-telegrambot",
"telegramChannel": "fleet-alerts"
}
}
31 changes: 31 additions & 0 deletions templates/governance/repo-governance.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"$comment": "Concrete template instance — copy this file to governance/repo-governance.json in any A2A repo and replace {{REPO_SLUG}}.",
"$schema": "https://opencode.local/templates/repo-governance.schema.json",
"repo": "{{REPO_SLUG}}",
"issueFirstRequired": true,
"prWatcherRequired": true,
"strictDispatchMatrixRequired": false,
"platformRegistryRef": "platforms/registry.json",
"prWatcherConfigRef": "governance/pr-watcher.json",
"coderDispatchMatrixRef": null,
"workItemSchemaRef": "https://opencode.local/templates/work-item.schema.json",
"defaultLabels": ["inbound", "a2a"],
"automationFlow": [
"1. External platform sends work via webhook/poller",
"2. n8n normalizes payload to work_item schema",
"3. GitHub issue created/updated in target repo",
"4. Agent picks up issue, creates branch + PR",
"5. PR Watcher validates: required files, credential scan, build check",
"6. On approval: squash merge, auto-delete branch",
"7. Post-merge verification: build, agent card, fleet validator"
],
"failClosedRules": [
"Unregistered platforms are blocked — no implicit access",
"Missing webhook auth blocks intake",
"Missing critical required files blocks merge",
"Credential leak in PR diff blocks merge immediately",
"Unknown check result blocks merge (fail-closed default)",
"CI runner timeout blocks merge"
],
"trackingIssue": null
}