Compare commits
2 Commits
v3.12.3
...
fix/docs-o
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c25dbb94b2 | ||
|
|
bed98988b3 |
98
.github/workflows/publish-platform.yml
vendored
98
.github/workflows/publish-platform.yml
vendored
@@ -59,39 +59,20 @@ jobs:
|
|||||||
- name: Check if already published
|
- name: Check if already published
|
||||||
id: check
|
id: check
|
||||||
run: |
|
run: |
|
||||||
|
PKG_NAME="oh-my-opencode-${{ matrix.platform }}"
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ inputs.version }}"
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/${PKG_NAME}/${VERSION}")
|
||||||
|
# Convert platform name for output (replace - with _)
|
||||||
PLATFORM_KEY="${{ matrix.platform }}"
|
PLATFORM_KEY="${{ matrix.platform }}"
|
||||||
PLATFORM_KEY="${PLATFORM_KEY//-/_}"
|
PLATFORM_KEY="${PLATFORM_KEY//-/_}"
|
||||||
|
if [ "$STATUS" = "200" ]; then
|
||||||
# Check oh-my-opencode
|
|
||||||
OC_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/oh-my-opencode-${{ matrix.platform }}/${VERSION}")
|
|
||||||
# Check oh-my-openagent
|
|
||||||
OA_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/oh-my-openagent-${{ matrix.platform }}/${VERSION}")
|
|
||||||
|
|
||||||
echo "oh-my-opencode-${{ matrix.platform }}@${VERSION}: ${OC_STATUS}"
|
|
||||||
echo "oh-my-openagent-${{ matrix.platform }}@${VERSION}: ${OA_STATUS}"
|
|
||||||
|
|
||||||
if [ "$OC_STATUS" = "200" ]; then
|
|
||||||
echo "skip_opencode=true" >> $GITHUB_OUTPUT
|
|
||||||
echo "✓ oh-my-opencode-${{ matrix.platform }}@${VERSION} already published"
|
|
||||||
else
|
|
||||||
echo "skip_opencode=false" >> $GITHUB_OUTPUT
|
|
||||||
echo "→ oh-my-opencode-${{ matrix.platform }}@${VERSION} needs publishing"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$OA_STATUS" = "200" ]; then
|
|
||||||
echo "skip_openagent=true" >> $GITHUB_OUTPUT
|
|
||||||
echo "✓ oh-my-openagent-${{ matrix.platform }}@${VERSION} already published"
|
|
||||||
else
|
|
||||||
echo "skip_openagent=false" >> $GITHUB_OUTPUT
|
|
||||||
echo "→ oh-my-openagent-${{ matrix.platform }}@${VERSION} needs publishing"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Skip build only if BOTH are already published
|
|
||||||
if [ "$OC_STATUS" = "200" ] && [ "$OA_STATUS" = "200" ]; then
|
|
||||||
echo "skip=true" >> $GITHUB_OUTPUT
|
echo "skip=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "skip_${PLATFORM_KEY}=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "✓ ${PKG_NAME}@${VERSION} already published"
|
||||||
else
|
else
|
||||||
echo "skip=false" >> $GITHUB_OUTPUT
|
echo "skip=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "skip_${PLATFORM_KEY}=false" >> $GITHUB_OUTPUT
|
||||||
|
echo "→ ${PKG_NAME}@${VERSION} needs publishing"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Update version in package.json
|
- name: Update version in package.json
|
||||||
@@ -226,38 +207,23 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
platform: [darwin-arm64, darwin-x64, darwin-x64-baseline, linux-x64, linux-x64-baseline, linux-arm64, linux-x64-musl, linux-x64-musl-baseline, linux-arm64-musl, windows-x64, windows-x64-baseline]
|
platform: [darwin-arm64, darwin-x64, darwin-x64-baseline, linux-x64, linux-x64-baseline, linux-arm64, linux-x64-musl, linux-x64-musl-baseline, linux-arm64-musl, windows-x64, windows-x64-baseline]
|
||||||
steps:
|
steps:
|
||||||
- name: Check if already published
|
- name: Check if oh-my-opencode already published
|
||||||
id: check
|
id: check
|
||||||
run: |
|
run: |
|
||||||
|
PKG_NAME="oh-my-opencode-${{ matrix.platform }}"
|
||||||
VERSION="${{ inputs.version }}"
|
VERSION="${{ inputs.version }}"
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/${PKG_NAME}/${VERSION}")
|
||||||
OC_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/oh-my-opencode-${{ matrix.platform }}/${VERSION}")
|
if [ "$STATUS" = "200" ]; then
|
||||||
OA_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/oh-my-openagent-${{ matrix.platform }}/${VERSION}")
|
echo "skip=true" >> $GITHUB_OUTPUT
|
||||||
|
echo "✓ ${PKG_NAME}@${VERSION} already published, skipping"
|
||||||
if [ "$OC_STATUS" = "200" ]; then
|
|
||||||
echo "skip_opencode=true" >> $GITHUB_OUTPUT
|
|
||||||
echo "✓ oh-my-opencode-${{ matrix.platform }}@${VERSION} already published"
|
|
||||||
else
|
else
|
||||||
echo "skip_opencode=false" >> $GITHUB_OUTPUT
|
echo "skip=false" >> $GITHUB_OUTPUT
|
||||||
fi
|
echo "→ ${PKG_NAME}@${VERSION} will be published"
|
||||||
|
|
||||||
if [ "$OA_STATUS" = "200" ]; then
|
|
||||||
echo "skip_openagent=true" >> $GITHUB_OUTPUT
|
|
||||||
echo "✓ oh-my-openagent-${{ matrix.platform }}@${VERSION} already published"
|
|
||||||
else
|
|
||||||
echo "skip_openagent=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Need artifact if either package needs publishing
|
|
||||||
if [ "$OC_STATUS" = "200" ] && [ "$OA_STATUS" = "200" ]; then
|
|
||||||
echo "skip_all=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "skip_all=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Download artifact
|
- name: Download artifact
|
||||||
id: download
|
id: download
|
||||||
if: steps.check.outputs.skip_all != 'true'
|
if: steps.check.outputs.skip != 'true'
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@@ -265,7 +231,7 @@ jobs:
|
|||||||
path: .
|
path: .
|
||||||
|
|
||||||
- name: Extract artifact
|
- name: Extract artifact
|
||||||
if: steps.check.outputs.skip_all != 'true' && steps.download.outcome == 'success'
|
if: steps.check.outputs.skip != 'true' && steps.download.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
PLATFORM="${{ matrix.platform }}"
|
PLATFORM="${{ matrix.platform }}"
|
||||||
mkdir -p packages/${PLATFORM}
|
mkdir -p packages/${PLATFORM}
|
||||||
@@ -281,13 +247,13 @@ jobs:
|
|||||||
ls -la packages/${PLATFORM}/bin/
|
ls -la packages/${PLATFORM}/bin/
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
if: steps.check.outputs.skip_all != 'true' && steps.download.outcome == 'success'
|
if: steps.check.outputs.skip != 'true' && steps.download.outcome == 'success'
|
||||||
with:
|
with:
|
||||||
node-version: "24"
|
node-version: "24"
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
- name: Publish oh-my-opencode-${{ matrix.platform }}
|
- name: Publish ${{ matrix.platform }}
|
||||||
if: steps.check.outputs.skip_opencode != 'true' && steps.download.outcome == 'success'
|
if: steps.check.outputs.skip != 'true' && steps.download.outcome == 'success'
|
||||||
run: |
|
run: |
|
||||||
cd packages/${{ matrix.platform }}
|
cd packages/${{ matrix.platform }}
|
||||||
|
|
||||||
@@ -301,25 +267,3 @@ jobs:
|
|||||||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
||||||
NPM_CONFIG_PROVENANCE: true
|
NPM_CONFIG_PROVENANCE: true
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
|
|
||||||
- name: Publish oh-my-openagent-${{ matrix.platform }}
|
|
||||||
if: steps.check.outputs.skip_openagent != 'true' && steps.download.outcome == 'success'
|
|
||||||
run: |
|
|
||||||
cd packages/${{ matrix.platform }}
|
|
||||||
|
|
||||||
# Rename package for oh-my-openagent
|
|
||||||
jq --arg name "oh-my-openagent-${{ matrix.platform }}" \
|
|
||||||
--arg desc "Platform-specific binary for oh-my-openagent (${{ matrix.platform }})" \
|
|
||||||
'.name = $name | .description = $desc | .bin = {"oh-my-openagent": (.bin | to_entries | .[0].value)}' \
|
|
||||||
package.json > tmp.json && mv tmp.json package.json
|
|
||||||
|
|
||||||
TAG_ARG=""
|
|
||||||
if [ -n "${{ inputs.dist_tag }}" ]; then
|
|
||||||
TAG_ARG="--tag ${{ inputs.dist_tag }}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
npm publish --access public --provenance $TAG_ARG
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
|
||||||
NPM_CONFIG_PROVENANCE: true
|
|
||||||
timeout-minutes: 15
|
|
||||||
|
|||||||
42
.github/workflows/publish.yml
vendored
42
.github/workflows/publish.yml
vendored
@@ -216,48 +216,6 @@ jobs:
|
|||||||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
||||||
NPM_CONFIG_PROVENANCE: true
|
NPM_CONFIG_PROVENANCE: true
|
||||||
|
|
||||||
- name: Check if oh-my-openagent already published
|
|
||||||
id: check-openagent
|
|
||||||
run: |
|
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
|
||||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://registry.npmjs.org/oh-my-openagent/${VERSION}")
|
|
||||||
if [ "$STATUS" = "200" ]; then
|
|
||||||
echo "skip=true" >> $GITHUB_OUTPUT
|
|
||||||
echo "✓ oh-my-openagent@${VERSION} already published"
|
|
||||||
else
|
|
||||||
echo "skip=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Publish oh-my-openagent
|
|
||||||
if: steps.check-openagent.outputs.skip != 'true'
|
|
||||||
run: |
|
|
||||||
VERSION="${{ steps.version.outputs.version }}"
|
|
||||||
|
|
||||||
# Update package name, version, and optionalDependencies for oh-my-openagent
|
|
||||||
jq --arg v "$VERSION" '
|
|
||||||
.name = "oh-my-openagent" |
|
|
||||||
.version = $v |
|
|
||||||
.optionalDependencies = (
|
|
||||||
.optionalDependencies | to_entries |
|
|
||||||
map(.key = (.key | sub("^oh-my-opencode-"; "oh-my-openagent-")) | .value = $v) |
|
|
||||||
from_entries
|
|
||||||
)
|
|
||||||
' package.json > tmp.json && mv tmp.json package.json
|
|
||||||
|
|
||||||
TAG_ARG=""
|
|
||||||
if [ -n "${{ steps.version.outputs.dist_tag }}" ]; then
|
|
||||||
TAG_ARG="--tag ${{ steps.version.outputs.dist_tag }}"
|
|
||||||
fi
|
|
||||||
npm publish --access public --provenance $TAG_ARG || echo "::warning::oh-my-openagent publish failed"
|
|
||||||
env:
|
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
|
|
||||||
NPM_CONFIG_PROVENANCE: true
|
|
||||||
|
|
||||||
- name: Restore package.json
|
|
||||||
if: steps.check-openagent.outputs.skip != 'true'
|
|
||||||
run: |
|
|
||||||
git checkout -- package.json
|
|
||||||
|
|
||||||
trigger-platform:
|
trigger-platform:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: publish-main
|
needs: publish-main
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ For each commit, you MUST:
|
|||||||
|
|
||||||
<version-context>
|
<version-context>
|
||||||
<published-version>
|
<published-version>
|
||||||
!`npm view oh-my-opencode version 2>/dev/null || echo "not published"`
|
!`npm view oh-my-openagent version 2>/dev/null || echo "not published"`
|
||||||
</published-version>
|
</published-version>
|
||||||
<local-version>
|
<local-version>
|
||||||
!`node -p "require('./package.json').version" 2>/dev/null || echo "unknown"`
|
!`node -p "require('./package.json').version" 2>/dev/null || echo "unknown"`
|
||||||
@@ -38,13 +38,13 @@ For each commit, you MUST:
|
|||||||
|
|
||||||
<git-context>
|
<git-context>
|
||||||
<commits-since-release>
|
<commits-since-release>
|
||||||
!`npm view oh-my-opencode version 2>/dev/null | xargs -I{} git log "v{}"..HEAD --oneline 2>/dev/null || echo "no commits since release"`
|
!`npm view oh-my-openagent version 2>/dev/null | xargs -I{} git log "v{}"..HEAD --oneline 2>/dev/null || echo "no commits since release"`
|
||||||
</commits-since-release>
|
</commits-since-release>
|
||||||
<diff-stat>
|
<diff-stat>
|
||||||
!`npm view oh-my-opencode version 2>/dev/null | xargs -I{} git diff "v{}"..HEAD --stat 2>/dev/null || echo "no diff available"`
|
!`npm view oh-my-openagent version 2>/dev/null | xargs -I{} git diff "v{}"..HEAD --stat 2>/dev/null || echo "no diff available"`
|
||||||
</diff-stat>
|
</diff-stat>
|
||||||
<files-changed-summary>
|
<files-changed-summary>
|
||||||
!`npm view oh-my-opencode version 2>/dev/null | xargs -I{} git diff "v{}"..HEAD --stat 2>/dev/null | tail -1 || echo ""`
|
!`npm view oh-my-openagent version 2>/dev/null | xargs -I{} git diff "v{}"..HEAD --stat 2>/dev/null | tail -1 || echo ""`
|
||||||
</files-changed-summary>
|
</files-changed-summary>
|
||||||
</git-context>
|
</git-context>
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
description: Easter egg command - about oh-my-opencode
|
description: Easter egg command - about oh-my-openagent
|
||||||
---
|
---
|
||||||
|
|
||||||
<command-instruction>
|
<command-instruction>
|
||||||
@@ -13,9 +13,9 @@ Print the following message to the user EXACTLY as written (in a friendly, celeb
|
|||||||
|
|
||||||
**You found the easter egg!** 🥚✨
|
**You found the easter egg!** 🥚✨
|
||||||
|
|
||||||
## What is Oh My OpenCode?
|
## What is Oh My OpenAgent?
|
||||||
|
|
||||||
**Oh My OpenCode** is a powerful OpenCode plugin that transforms your AI agent into a full development team:
|
**Oh My OpenAgent** is a powerful OpenCode plugin that transforms your AI agent into a full development team:
|
||||||
|
|
||||||
- 🤖 **Multi-Agent Orchestration**: Oracle (GPT-5.2), Librarian (Claude), Explore (Grok), Frontend Engineer (Gemini), and more
|
- 🤖 **Multi-Agent Orchestration**: Oracle (GPT-5.2), Librarian (Claude), Explore (Grok), Frontend Engineer (Gemini), and more
|
||||||
- 🔧 **LSP Tools**: Full IDE capabilities for your agents - hover, goto definition, find references, rename, code actions
|
- 🔧 **LSP Tools**: Full IDE capabilities for your agents - hover, goto definition, find references, rename, code actions
|
||||||
@@ -28,7 +28,7 @@ Print the following message to the user EXACTLY as written (in a friendly, celeb
|
|||||||
|
|
||||||
Created with ❤️ by **[code-yeongyu](https://github.com/code-yeongyu)**
|
Created with ❤️ by **[code-yeongyu](https://github.com/code-yeongyu)**
|
||||||
|
|
||||||
🔗 **GitHub**: https://github.com/code-yeongyu/oh-my-opencode
|
🔗 **GitHub**: https://github.com/code-yeongyu/oh-my-openagent
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
---
|
---
|
||||||
description: Publish oh-my-opencode to npm via GitHub Actions workflow
|
description: Publish oh-my-openagent to npm via GitHub Actions workflow
|
||||||
argument-hint: <patch|minor|major>
|
argument-hint: <patch|minor|major>
|
||||||
---
|
---
|
||||||
|
|
||||||
<command-instruction>
|
<command-instruction>
|
||||||
You are the release manager for oh-my-opencode. Execute the FULL publish workflow from start to finish.
|
You are the release manager for oh-my-openagent. Execute the FULL publish workflow from start to finish.
|
||||||
|
|
||||||
## CRITICAL: ARGUMENT REQUIREMENT
|
## CRITICAL: ARGUMENT REQUIREMENT
|
||||||
|
|
||||||
@@ -277,7 +277,7 @@ gh release view "v${NEW_VERSION}" --json url --jq '.url'
|
|||||||
|
|
||||||
Poll npm registry until the new version appears:
|
Poll npm registry until the new version appears:
|
||||||
```bash
|
```bash
|
||||||
npm view oh-my-opencode version
|
npm view oh-my-openagent version
|
||||||
```
|
```
|
||||||
|
|
||||||
Compare with expected version. If not matching after 2 minutes, warn user about npm propagation delay.
|
Compare with expected version. If not matching after 2 minutes, warn user about npm propagation delay.
|
||||||
@@ -314,7 +314,7 @@ After publish-platform workflow completes, verify all 7 platform packages are pu
|
|||||||
```bash
|
```bash
|
||||||
PLATFORMS="darwin-arm64 darwin-x64 linux-x64 linux-arm64 linux-x64-musl linux-arm64-musl windows-x64"
|
PLATFORMS="darwin-arm64 darwin-x64 linux-x64 linux-arm64 linux-x64-musl linux-arm64-musl windows-x64"
|
||||||
for PLATFORM in $PLATFORMS; do
|
for PLATFORM in $PLATFORMS; do
|
||||||
npm view "oh-my-opencode-${PLATFORM}" version
|
npm view "oh-my-openagent-${PLATFORM}" version
|
||||||
done
|
done
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -323,13 +323,13 @@ All 7 packages should show the same version as the main package (`${NEW_VERSION}
|
|||||||
**Expected packages:**
|
**Expected packages:**
|
||||||
| Package | Description |
|
| Package | Description |
|
||||||
|---------|-------------|
|
|---------|-------------|
|
||||||
| `oh-my-opencode-darwin-arm64` | macOS Apple Silicon |
|
| `oh-my-openagent-darwin-arm64` | macOS Apple Silicon |
|
||||||
| `oh-my-opencode-darwin-x64` | macOS Intel |
|
| `oh-my-openagent-darwin-x64` | macOS Intel |
|
||||||
| `oh-my-opencode-linux-x64` | Linux x64 (glibc) |
|
| `oh-my-openagent-linux-x64` | Linux x64 (glibc) |
|
||||||
| `oh-my-opencode-linux-arm64` | Linux ARM64 (glibc) |
|
| `oh-my-openagent-linux-arm64` | Linux ARM64 (glibc) |
|
||||||
| `oh-my-opencode-linux-x64-musl` | Linux x64 (musl/Alpine) |
|
| `oh-my-openagent-linux-x64-musl` | Linux x64 (musl/Alpine) |
|
||||||
| `oh-my-opencode-linux-arm64-musl` | Linux ARM64 (musl/Alpine) |
|
| `oh-my-openagent-linux-arm64-musl` | Linux ARM64 (musl/Alpine) |
|
||||||
| `oh-my-opencode-windows-x64` | Windows x64 |
|
| `oh-my-openagent-windows-x64` | Windows x64 |
|
||||||
|
|
||||||
If any platform package version doesn't match, warn the user and suggest checking the publish-platform workflow logs.
|
If any platform package version doesn't match, warn the user and suggest checking the publish-platform workflow logs.
|
||||||
|
|
||||||
@@ -339,8 +339,8 @@ If any platform package version doesn't match, warn the user and suggest checkin
|
|||||||
|
|
||||||
Report success to user with:
|
Report success to user with:
|
||||||
- New version number
|
- New version number
|
||||||
- GitHub release URL: https://github.com/code-yeongyu/oh-my-opencode/releases/tag/v{version}
|
- GitHub release URL: https://github.com/code-yeongyu/oh-my-openagent/releases/tag/v{version}
|
||||||
- npm package URL: https://www.npmjs.com/package/oh-my-opencode
|
- npm package URL: https://www.npmjs.com/package/oh-my-openagent
|
||||||
- Platform packages status: List all 7 platform packages with their versions
|
- Platform packages status: List all 7 platform packages with their versions
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -362,7 +362,7 @@ Respond to user in English.
|
|||||||
|
|
||||||
<current-context>
|
<current-context>
|
||||||
<published-version>
|
<published-version>
|
||||||
!`npm view oh-my-opencode version 2>/dev/null || echo "not published"`
|
!`npm view oh-my-openagent version 2>/dev/null || echo "not published"`
|
||||||
</published-version>
|
</published-version>
|
||||||
<local-version>
|
<local-version>
|
||||||
!`node -p "require('./package.json').version" 2>/dev/null || echo "unknown"`
|
!`node -p "require('./package.json').version" 2>/dev/null || echo "unknown"`
|
||||||
@@ -371,6 +371,6 @@ Respond to user in English.
|
|||||||
!`git status --porcelain`
|
!`git status --porcelain`
|
||||||
</git-status>
|
</git-status>
|
||||||
<recent-commits>
|
<recent-commits>
|
||||||
!`npm view oh-my-opencode version 2>/dev/null | xargs -I{} git log "v{}"..HEAD --oneline 2>/dev/null | head -15 || echo "no commits"`
|
!`npm view oh-my-openagent version 2>/dev/null | xargs -I{} git log "v{}"..HEAD --oneline 2>/dev/null | head -15 || echo "no commits"`
|
||||||
</recent-commits>
|
</recent-commits>
|
||||||
</current-context>
|
</current-context>
|
||||||
|
|||||||
@@ -136,36 +136,7 @@ fi
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Phase 3: Spawn Subagents (Individual Tool Calls)
|
## Phase 3: Spawn Subagents
|
||||||
|
|
||||||
**CRITICAL: Create tasks ONE BY ONE using individual `task_create` tool calls. NEVER batch or script.**
|
|
||||||
|
|
||||||
For each item, execute these steps sequentially:
|
|
||||||
|
|
||||||
### Step 3.1: Create Task Record
|
|
||||||
```typescript
|
|
||||||
task_create(
|
|
||||||
subject="Triage: #{number} {title}",
|
|
||||||
description="GitHub {issue|PR} triage analysis - {type}",
|
|
||||||
metadata={"type": "{ISSUE_QUESTION|ISSUE_BUG|ISSUE_FEATURE|ISSUE_OTHER|PR_BUGFIX|PR_OTHER}", "number": {number}}
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 3.2: Spawn Analysis Subagent (Background)
|
|
||||||
```typescript
|
|
||||||
task(
|
|
||||||
category="quick",
|
|
||||||
run_in_background=true,
|
|
||||||
load_skills=[],
|
|
||||||
prompt=SUBAGENT_PROMPT
|
|
||||||
)
|
|
||||||
```
|
|
||||||
|
|
||||||
**ABSOLUTE RULES for Subagents:**
|
|
||||||
- **ONLY ANALYZE** - Never take action on GitHub (no comments, merges, closes)
|
|
||||||
- **READ-ONLY** - Use tools only for reading code/GitHub data
|
|
||||||
- **WRITE REPORT ONLY** - Output goes to `{REPORT_DIR}/{issue|pr}-{number}.md` via Write tool
|
|
||||||
- **EVIDENCE REQUIRED** - Every claim must have GitHub permalink as proof
|
|
||||||
|
|
||||||
```
|
```
|
||||||
For each item:
|
For each item:
|
||||||
@@ -199,7 +170,6 @@ ABSOLUTE RULES (violating ANY = critical failure):
|
|||||||
- Your ONLY writable output: {REPORT_DIR}/{issue|pr}-{number}.md via the Write tool
|
- Your ONLY writable output: {REPORT_DIR}/{issue|pr}-{number}.md via the Write tool
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### ISSUE_QUESTION
|
### ISSUE_QUESTION
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ Then capture raw data needed by agent prompts:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Extract versions (already in /get-unpublished-changes output)
|
# Extract versions (already in /get-unpublished-changes output)
|
||||||
PUBLISHED=$(npm view oh-my-opencode version 2>/dev/null || echo "not published")
|
PUBLISHED=$(npm view oh-my-openagent version 2>/dev/null || echo "not published")
|
||||||
LOCAL=$(node -p "require('./package.json').version" 2>/dev/null || echo "unknown")
|
LOCAL=$(node -p "require('./package.json').version" 2>/dev/null || echo "unknown")
|
||||||
|
|
||||||
# Raw data for agents (diffs, file lists)
|
# Raw data for agents (diffs, file lists)
|
||||||
@@ -85,7 +85,7 @@ task(
|
|||||||
<review_type>PER-CHANGE DEEP ANALYSIS</review_type>
|
<review_type>PER-CHANGE DEEP ANALYSIS</review_type>
|
||||||
<change_group>{GROUP_NAME}</change_group>
|
<change_group>{GROUP_NAME}</change_group>
|
||||||
|
|
||||||
<project>oh-my-opencode (npm package)</project>
|
<project>oh-my-openagent (npm package)</project>
|
||||||
<published_version>{PUBLISHED}</published_version>
|
<published_version>{PUBLISHED}</published_version>
|
||||||
<target_version>{LOCAL}</target_version>
|
<target_version>{LOCAL}</target_version>
|
||||||
|
|
||||||
@@ -160,7 +160,7 @@ task(
|
|||||||
prompt="""
|
prompt="""
|
||||||
Run /review-work on the unpublished changes between v{PUBLISHED} and HEAD.
|
Run /review-work on the unpublished changes between v{PUBLISHED} and HEAD.
|
||||||
|
|
||||||
GOAL: Review all changes heading into npm publish of oh-my-opencode. These changes span {COMMIT_COUNT} commits across {FILE_COUNT} files.
|
GOAL: Review all changes heading into npm publish of oh-my-openagent. These changes span {COMMIT_COUNT} commits across {FILE_COUNT} files.
|
||||||
|
|
||||||
CONSTRAINTS:
|
CONSTRAINTS:
|
||||||
- This is a plugin published to npm — public API stability matters
|
- This is a plugin published to npm — public API stability matters
|
||||||
@@ -169,7 +169,7 @@ CONSTRAINTS:
|
|||||||
- Factory pattern (createXXX) for tools, hooks, agents
|
- Factory pattern (createXXX) for tools, hooks, agents
|
||||||
- kebab-case files, barrel exports, no catch-all files
|
- kebab-case files, barrel exports, no catch-all files
|
||||||
|
|
||||||
BACKGROUND: Pre-publish review of oh-my-opencode, an OpenCode plugin with 1268 TypeScript files, 160k LOC. Changes since v{PUBLISHED} are about to be published.
|
BACKGROUND: Pre-publish review of oh-my-openagent, an OpenCode plugin with 1268 TypeScript files, 160k LOC. Changes since v{PUBLISHED} are about to be published.
|
||||||
|
|
||||||
The diff base is: git diff v{PUBLISHED}..HEAD
|
The diff base is: git diff v{PUBLISHED}..HEAD
|
||||||
|
|
||||||
@@ -190,7 +190,7 @@ task(
|
|||||||
prompt="""
|
prompt="""
|
||||||
<review_type>RELEASE SYNTHESIS — OVERALL ASSESSMENT</review_type>
|
<review_type>RELEASE SYNTHESIS — OVERALL ASSESSMENT</review_type>
|
||||||
|
|
||||||
<project>oh-my-opencode (npm package)</project>
|
<project>oh-my-openagent (npm package)</project>
|
||||||
<published_version>{PUBLISHED}</published_version>
|
<published_version>{PUBLISHED}</published_version>
|
||||||
<local_version>{LOCAL}</local_version>
|
<local_version>{LOCAL}</local_version>
|
||||||
|
|
||||||
@@ -325,7 +325,7 @@ Do NOT deliver the final report until ALL agents have completed.
|
|||||||
Compile the final report:
|
Compile the final report:
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
# Pre-Publish Review — oh-my-opencode
|
# Pre-Publish Review — oh-my-openagent
|
||||||
|
|
||||||
## Release: v{PUBLISHED} -> v{LOCAL}
|
## Release: v{PUBLISHED} -> v{LOCAL}
|
||||||
**Commits:** {COMMIT_COUNT} | **Files Changed:** {FILE_COUNT} | **Agents:** {AGENT_COUNT}
|
**Commits:** {COMMIT_COUNT} | **Files Changed:** {FILE_COUNT} | **Agents:** {AGENT_COUNT}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
Add a `max_background_agents` config option to oh-my-opencode that limits total simultaneous background agents across all models/providers. Currently, concurrency is only limited per-model/provider key (default 5 per key). This new option adds a **global ceiling** on total running background agents.
|
Add a `max_background_agents` config option to oh-my-openagent that limits total simultaneous background agents across all models/providers. Currently, concurrency is only limited per-model/provider key (default 5 per key). This new option adds a **global ceiling** on total running background agents.
|
||||||
|
|
||||||
## Step-by-Step Plan
|
## Step-by-Step Plan
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ Check `src/config/schema/background-task.ts` and `src/features/background-agent/
|
|||||||
|
|
||||||
| File | Reason |
|
| File | Reason |
|
||||||
|------|--------|
|
|------|--------|
|
||||||
| `src/config/schema/oh-my-opencode-config.ts` | No change needed - `BackgroundTaskConfigSchema` is already composed into root schema via `background_task` field |
|
| `src/config/schema/oh-my-openagent-config.ts` | No change needed - `BackgroundTaskConfigSchema` is already composed into root schema via `background_task` field |
|
||||||
| `src/create-managers.ts` | No change needed - `pluginConfig.background_task` already passed to `BackgroundManager` constructor |
|
| `src/create-managers.ts` | No change needed - `pluginConfig.background_task` already passed to `BackgroundManager` constructor |
|
||||||
| `src/features/background-agent/manager.ts` | No change needed - already passes config to `ConcurrencyManager` |
|
| `src/features/background-agent/manager.ts` | No change needed - already passes config to `ConcurrencyManager` |
|
||||||
| `src/plugin-config.ts` | No change needed - `background_task` is a simple object field, uses default override merge |
|
| `src/plugin-config.ts` | No change needed - `background_task` is a simple object field, uses default override merge |
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ All existing tests must continue to pass unchanged.
|
|||||||
Verify the config flows correctly through the system:
|
Verify the config flows correctly through the system:
|
||||||
|
|
||||||
1. **Schema → Type**: `BackgroundTaskConfig` type auto-includes `maxBackgroundAgents` via `z.infer`
|
1. **Schema → Type**: `BackgroundTaskConfig` type auto-includes `maxBackgroundAgents` via `z.infer`
|
||||||
2. **Config file → Schema**: `loadConfigFromPath()` in `plugin-config.ts` uses `OhMyOpenCodeConfigSchema.safeParse()` which includes `BackgroundTaskConfigSchema`
|
2. **Config file → Schema**: `loadConfigFromPath()` in `plugin-config.ts` uses `OhMyOpenAgentConfigSchema.safeParse()` which includes `BackgroundTaskConfigSchema`
|
||||||
3. **Config → Manager**: `create-managers.ts` passes `pluginConfig.background_task` to `BackgroundManager` constructor
|
3. **Config → Manager**: `create-managers.ts` passes `pluginConfig.background_task` to `BackgroundManager` constructor
|
||||||
4. **Manager → ConcurrencyManager**: `BackgroundManager` constructor passes config to `new ConcurrencyManager(config)`
|
4. **Manager → ConcurrencyManager**: `BackgroundManager` constructor passes config to `new ConcurrencyManager(config)`
|
||||||
5. **ConcurrencyManager → Enforcement**: `acquire()` reads `config.maxBackgroundAgents` via `getGlobalLimit()`
|
5. **ConcurrencyManager → Enforcement**: `acquire()` reads `config.maxBackgroundAgents` via `getGlobalLimit()`
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import { createWebsearchConfig } from "./websearch"
|
|||||||
import { context7 } from "./context7"
|
import { context7 } from "./context7"
|
||||||
import { grep_app } from "./grep-app"
|
import { grep_app } from "./grep-app"
|
||||||
import { arxiv } from "./arxiv"
|
import { arxiv } from "./arxiv"
|
||||||
import type { OhMyOpenCodeConfig } from "../config/schema"
|
import type { OhMyOpenAgentConfig } from "../config/schema"
|
||||||
|
|
||||||
export { McpNameSchema, type McpName } from "./types"
|
export { McpNameSchema, type McpName } from "./types"
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ type RemoteMcpConfig = {
|
|||||||
oauth?: false
|
oauth?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createBuiltinMcps(disabledMcps: string[] = [], config?: OhMyOpenCodeConfig) {
|
export function createBuiltinMcps(disabledMcps: string[] = [], config?: OhMyOpenAgentConfig) {
|
||||||
const mcps: Record<string, RemoteMcpConfig> = {}
|
const mcps: Record<string, RemoteMcpConfig> = {}
|
||||||
|
|
||||||
if (!disabledMcps.includes("websearch")) {
|
if (!disabledMcps.includes("websearch")) {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ Pattern followed: `grep-app.ts` (static export, no auth, no config factory neede
|
|||||||
import { context7 } from "./context7"
|
import { context7 } from "./context7"
|
||||||
import { grep_app } from "./grep-app"
|
import { grep_app } from "./grep-app"
|
||||||
+import { arxiv } from "./arxiv"
|
+import { arxiv } from "./arxiv"
|
||||||
import type { OhMyOpenCodeConfig } from "../config/schema"
|
import type { OhMyOpenAgentConfig } from "../config/schema"
|
||||||
|
|
||||||
-export { McpNameSchema, type McpName } from "./types"
|
-export { McpNameSchema, type McpName } from "./types"
|
||||||
+export { McpNameSchema, type McpName } from "./types"
|
+export { McpNameSchema, type McpName } from "./types"
|
||||||
@@ -54,7 +54,7 @@ Pattern followed: `grep-app.ts` (static export, no auth, no config factory neede
|
|||||||
oauth?: false
|
oauth?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createBuiltinMcps(disabledMcps: string[] = [], config?: OhMyOpenCodeConfig) {
|
export function createBuiltinMcps(disabledMcps: string[] = [], config?: OhMyOpenAgentConfig) {
|
||||||
const mcps: Record<string, RemoteMcpConfig> = {}
|
const mcps: Record<string, RemoteMcpConfig> = {}
|
||||||
|
|
||||||
if (!disabledMcps.includes("websearch")) {
|
if (!disabledMcps.includes("websearch")) {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ Since the regex lives in the Go binary and this repo wraps it, the fix is two-pr
|
|||||||
- Relax `(?i)^[\s#/*-]*note:\s*\w` to only match AI-style memo patterns like `Note: this was changed...`, `Note: implementation details...`
|
- Relax `(?i)^[\s#/*-]*note:\s*\w` to only match AI-style memo patterns like `Note: this was changed...`, `Note: implementation details...`
|
||||||
- Add `--exclude-pattern` CLI flag for user-configurable exclusions
|
- Add `--exclude-pattern` CLI flag for user-configurable exclusions
|
||||||
|
|
||||||
**B. This repo (oh-my-opencode)** - the PR scope:
|
**B. This repo (oh-my-openagent)** - the PR scope:
|
||||||
1. Add `exclude_patterns` config field to `CommentCheckerConfigSchema`
|
1. Add `exclude_patterns` config field to `CommentCheckerConfigSchema`
|
||||||
2. Pass `--exclude-pattern` flags to the CLI binary
|
2. Pass `--exclude-pattern` flags to the CLI binary
|
||||||
3. Add integration tests with mock binaries for false positive scenarios
|
3. Add integration tests with mock binaries for false positive scenarios
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ Additionally, the binary flags ALL non-filtered comments (not just agent memos),
|
|||||||
## Architecture Understanding
|
## Architecture Understanding
|
||||||
|
|
||||||
```
|
```
|
||||||
TypeScript (oh-my-opencode) Go Binary (go-claude-code-comment-checker)
|
TypeScript (oh-my-openagent) Go Binary (go-claude-code-comment-checker)
|
||||||
───────────────────────────── ──────────────────────────────────────────
|
───────────────────────────── ──────────────────────────────────────────
|
||||||
hook.ts main.go
|
hook.ts main.go
|
||||||
├─ tool.execute.before ├─ Read JSON from stdin
|
├─ tool.execute.before ├─ Read JSON from stdin
|
||||||
@@ -33,7 +33,7 @@ hook.ts main.go
|
|||||||
└─ append to output
|
└─ append to output
|
||||||
```
|
```
|
||||||
|
|
||||||
Key files in oh-my-opencode:
|
Key files in oh-my-openagent:
|
||||||
- `src/hooks/comment-checker/hook.ts` - Hook factory, registers before/after handlers
|
- `src/hooks/comment-checker/hook.ts` - Hook factory, registers before/after handlers
|
||||||
- `src/hooks/comment-checker/cli-runner.ts` - Orchestrates CLI invocation, semaphore
|
- `src/hooks/comment-checker/cli-runner.ts` - Orchestrates CLI invocation, semaphore
|
||||||
- `src/hooks/comment-checker/cli.ts` - Binary resolution, process spawning, timeout handling
|
- `src/hooks/comment-checker/cli.ts` - Binary resolution, process spawning, timeout handling
|
||||||
|
|||||||
16
AGENTS.md
16
AGENTS.md
@@ -1,15 +1,15 @@
|
|||||||
# oh-my-opencode — O P E N C O D E Plugin
|
# oh-my-openagent — O P E N C O D E Plugin
|
||||||
|
|
||||||
**Generated:** 2026-03-06 | **Commit:** 7fe44024 | **Branch:** dev
|
**Generated:** 2026-03-06 | **Commit:** 7fe44024 | **Branch:** dev
|
||||||
|
|
||||||
## OVERVIEW
|
## OVERVIEW
|
||||||
|
|
||||||
OpenCode plugin (npm: `oh-my-opencode`) that extends Claude Code (OpenCode fork) with multi-agent orchestration, 46 lifecycle hooks, 26 tools, skill/command/MCP systems, and Claude Code compatibility. 1268 TypeScript files, 160k LOC.
|
OpenCode plugin (npm: `oh-my-openagent`) that extends Claude Code (OpenCode fork) with multi-agent orchestration, 46 lifecycle hooks, 26 tools, skill/command/MCP systems, and Claude Code compatibility. 1268 TypeScript files, 160k LOC.
|
||||||
|
|
||||||
## STRUCTURE
|
## STRUCTURE
|
||||||
|
|
||||||
```
|
```
|
||||||
oh-my-opencode/
|
oh-my-openagent/
|
||||||
├── src/
|
├── src/
|
||||||
│ ├── index.ts # Plugin entry: loadConfig → createManagers → createTools → createHooks → createPluginInterface
|
│ ├── index.ts # Plugin entry: loadConfig → createManagers → createTools → createHooks → createPluginInterface
|
||||||
│ ├── plugin-config.ts # JSONC multi-level config: user → project → defaults (Zod v4)
|
│ ├── plugin-config.ts # JSONC multi-level config: user → project → defaults (Zod v4)
|
||||||
@@ -30,7 +30,7 @@ oh-my-opencode/
|
|||||||
## INITIALIZATION FLOW
|
## INITIALIZATION FLOW
|
||||||
|
|
||||||
```
|
```
|
||||||
OhMyOpenCodePlugin(ctx)
|
OhMyOpenAgentPlugin(ctx)
|
||||||
├─→ loadPluginConfig() # JSONC parse → project/user merge → Zod validate → migrate
|
├─→ loadPluginConfig() # JSONC parse → project/user merge → Zod validate → migrate
|
||||||
├─→ createManagers() # TmuxSessionManager, BackgroundManager, SkillMcpManager, ConfigHandler
|
├─→ createManagers() # TmuxSessionManager, BackgroundManager, SkillMcpManager, ConfigHandler
|
||||||
├─→ createTools() # SkillContext + AvailableCategories + ToolRegistry (26 tools)
|
├─→ createTools() # SkillContext + AvailableCategories + ToolRegistry (26 tools)
|
||||||
@@ -65,7 +65,7 @@ OhMyOpenCodePlugin(ctx)
|
|||||||
| Add new command | `src/features/builtin-commands/` | Template in templates/ |
|
| Add new command | `src/features/builtin-commands/` | Template in templates/ |
|
||||||
| Add new CLI command | `src/cli/cli-program.ts` | Commander.js subcommand |
|
| Add new CLI command | `src/cli/cli-program.ts` | Commander.js subcommand |
|
||||||
| Add new doctor check | `src/cli/doctor/checks/` | Register in checks/index.ts |
|
| Add new doctor check | `src/cli/doctor/checks/` | Register in checks/index.ts |
|
||||||
| Modify config schema | `src/config/schema/` + update root schema | Zod v4, add to OhMyOpenCodeConfigSchema |
|
| Modify config schema | `src/config/schema/` + update root schema | Zod v4, add to OhMyOpenAgentConfigSchema |
|
||||||
| Add new category | `src/tools/delegate-task/constants.ts` | DEFAULT_CATEGORIES + CATEGORY_MODEL_REQUIREMENTS |
|
| Add new category | `src/tools/delegate-task/constants.ts` | DEFAULT_CATEGORIES + CATEGORY_MODEL_REQUIREMENTS |
|
||||||
|
|
||||||
## MULTI-LEVEL CONFIG
|
## MULTI-LEVEL CONFIG
|
||||||
@@ -128,9 +128,9 @@ bun test # Bun test suite
|
|||||||
bun run build # Build plugin (ESM + declarations + schema)
|
bun run build # Build plugin (ESM + declarations + schema)
|
||||||
bun run build:all # Build + platform binaries
|
bun run build:all # Build + platform binaries
|
||||||
bun run typecheck # tsc --noEmit
|
bun run typecheck # tsc --noEmit
|
||||||
bunx oh-my-opencode install # Interactive setup
|
bunx oh-my-openagent install # Interactive setup
|
||||||
bunx oh-my-opencode doctor # Health diagnostics
|
bunx oh-my-openagent doctor # Health diagnostics
|
||||||
bunx oh-my-opencode run # Non-interactive session
|
bunx oh-my-openagent run # Non-interactive session
|
||||||
```
|
```
|
||||||
|
|
||||||
## CI/CD
|
## CI/CD
|
||||||
|
|||||||
2
CLA.md
2
CLA.md
@@ -1,6 +1,6 @@
|
|||||||
# Contributor License Agreement
|
# Contributor License Agreement
|
||||||
|
|
||||||
Thank you for your interest in contributing to oh-my-opencode ("Project"), owned by YeonGyu Kim ("Owner").
|
Thank you for your interest in contributing to oh-my-openagent ("Project"), owned by YeonGyu Kim ("Owner").
|
||||||
|
|
||||||
By signing this Contributor License Agreement ("Agreement"), you agree to the following terms:
|
By signing this Contributor License Agreement ("Agreement"), you agree to the following terms:
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Contributing to Oh My OpenCode
|
# Contributing to Oh My OpenAgent
|
||||||
|
|
||||||
First off, thanks for taking the time to contribute! This document provides guidelines and instructions for contributing to oh-my-opencode.
|
First off, thanks for taking the time to contribute! This document provides guidelines and instructions for contributing to oh-my-openagent.
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
|
|
||||||
@@ -87,19 +87,19 @@ After making changes, you can test your local build in OpenCode:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"plugin": ["file:///absolute/path/to/oh-my-opencode/dist/index.js"]
|
"plugin": ["file:///absolute/path/to/oh-my-openagent/dist/index.js"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
For example, if your project is at `/Users/yourname/projects/oh-my-opencode`:
|
For example, if your project is at `/Users/yourname/projects/oh-my-openagent`:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"plugin": ["file:///Users/yourname/projects/oh-my-opencode/dist/index.js"]
|
"plugin": ["file:///Users/yourname/projects/oh-my-openagent/dist/index.js"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**: Remove `"oh-my-opencode"` from the plugin array if it exists, to avoid conflicts with the npm version.
|
> **Note**: Remove `"oh-my-openagent"` from the plugin array if it exists, to avoid conflicts with the npm version.
|
||||||
|
|
||||||
3. **Restart OpenCode** to load the changes.
|
3. **Restart OpenCode** to load the changes.
|
||||||
|
|
||||||
@@ -108,9 +108,9 @@ After making changes, you can test your local build in OpenCode:
|
|||||||
## Project Structure
|
## Project Structure
|
||||||
|
|
||||||
```
|
```
|
||||||
oh-my-opencode/
|
oh-my-openagent/
|
||||||
├── src/
|
├── src/
|
||||||
│ ├── index.ts # Plugin entry (OhMyOpenCodePlugin)
|
│ ├── index.ts # Plugin entry (OhMyOpenAgentPlugin)
|
||||||
│ ├── plugin-config.ts # JSONC multi-level config (Zod v4)
|
│ ├── plugin-config.ts # JSONC multi-level config (Zod v4)
|
||||||
│ ├── agents/ # 11 agents (Sisyphus, Hephaestus, Oracle, Librarian, Explore, Atlas, Prometheus, Metis, Momus, Multimodal-Looker, Sisyphus-Junior)
|
│ ├── agents/ # 11 agents (Sisyphus, Hephaestus, Oracle, Librarian, Explore, Atlas, Prometheus, Metis, Momus, Multimodal-Looker, Sisyphus-Junior)
|
||||||
│ ├── hooks/ # Lifecycle hooks for orchestration, recovery, UX, and context management
|
│ ├── hooks/ # Lifecycle hooks for orchestration, recovery, UX, and context management
|
||||||
@@ -272,4 +272,4 @@ export function createMyHook(input: PluginInput) {
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Thank you for contributing to Oh My OpenCode! Your efforts help make AI-assisted coding better for everyone.
|
Thank you for contributing to Oh My OpenAgent! Your efforts help make AI-assisted coding better for everyone.
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ Use ultrawork (ulw) to spawn UltraBrain agents in parallel. Each UB agent gets a
|
|||||||
## ADDITIONAL BLOCKERS FROM GPT-5.4 REVIEW
|
## ADDITIONAL BLOCKERS FROM GPT-5.4 REVIEW
|
||||||
|
|
||||||
### G1: Package Identity Split-Brain
|
### G1: Package Identity Split-Brain
|
||||||
**Problem:** Installer writes oh-my-openagent but doctor, auto-update, version lookup, publish workflow still reference oh-my-opencode. Half-migrated state.
|
**Problem:** Installer writes oh-my-openagent but doctor, auto-update, version lookup, publish workflow still reference oh-my-openagent. Half-migrated state.
|
||||||
**Fix:** Audit ALL references to package name. Either complete the migration consistently or revert to single name for this release.
|
**Fix:** Audit ALL references to package name. Either complete the migration consistently or revert to single name for this release.
|
||||||
**Files:** Installer, doctor, auto-update, version lookup, publish workflow -- grep for both package names
|
**Files:** Installer, doctor, auto-update, version lookup, publish workflow -- grep for both package names
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
Portions of this software are licensed as follows:
|
Portions of this software are licensed as follows:
|
||||||
|
|
||||||
- All third party components incorporated into the oh-my-opencode Software are licensed under the original license
|
- All third party components incorporated into the oh-my-openagent Software are licensed under the original license
|
||||||
provided by the owner of the applicable component.
|
provided by the owner of the applicable component.
|
||||||
- Content outside of the above mentioned files or restrictions is available under the "Sustainable Use
|
- Content outside of the above mentioned files or restrictions is available under the "Sustainable Use
|
||||||
License" as defined below.
|
License" as defined below.
|
||||||
|
|||||||
30
README.ja.md
30
README.ja.md
@@ -12,18 +12,18 @@
|
|||||||
> [!TIP]
|
> [!TIP]
|
||||||
> 私たちと一緒に!
|
> 私たちと一緒に!
|
||||||
>
|
>
|
||||||
> | [<img alt="Discord link" src="https://img.shields.io/discord/1452487457085063218?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square" width="156px" />](https://discord.gg/PUwSMR9XNk) | [Discordコミュニティ](https://discord.gg/PUwSMR9XNk)に参加して、コントリビューターや他の `oh-my-opencode` ユーザーと交流しましょう。 |
|
> | [<img alt="Discord link" src="https://img.shields.io/discord/1452487457085063218?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square" width="156px" />](https://discord.gg/PUwSMR9XNk) | [Discordコミュニティ](https://discord.gg/PUwSMR9XNk)に参加して、コントリビューターや他の `oh-my-openagent` ユーザーと交流しましょう。 |
|
||||||
> | :-----| :----- |
|
> | :-----| :----- |
|
||||||
> | [<img alt="X link" src="https://img.shields.io/badge/Follow-%40justsisyphus-00CED1?style=flat-square&logo=x&labelColor=black" width="156px" />](https://x.com/justsisyphus) | `oh-my-opencode` のニュースやアップデートは私のXアカウントで投稿されていましたが、 <br /> 誤って凍結されてしまったため、現在は [@justsisyphus](https://x.com/justsisyphus) が代わりにアップデートを投稿しています。 |
|
> | [<img alt="X link" src="https://img.shields.io/badge/Follow-%40justsisyphus-00CED1?style=flat-square&logo=x&labelColor=black" width="156px" />](https://x.com/justsisyphus) | `oh-my-openagent` のニュースやアップデートは私のXアカウントで投稿されていましたが、 <br /> 誤って凍結されてしまったため、現在は [@justsisyphus](https://x.com/justsisyphus) が代わりにアップデートを投稿しています。 |
|
||||||
> | [<img alt="GitHub Follow" src="https://img.shields.io/github/followers/code-yeongyu?style=flat-square&logo=github&labelColor=black&color=24292f" width="156px" />](https://github.com/code-yeongyu) | さらに多くのプロジェクトを見たい場合は、GitHubで [@code-yeongyu](https://github.com/code-yeongyu) をフォローしてください。 |
|
> | [<img alt="GitHub Follow" src="https://img.shields.io/github/followers/code-yeongyu?style=flat-square&logo=github&labelColor=black&color=24292f" width="156px" />](https://github.com/code-yeongyu) | さらに多くのプロジェクトを見たい場合は、GitHubで [@code-yeongyu](https://github.com/code-yeongyu) をフォローしてください。 |
|
||||||
|
|
||||||
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> -->
|
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> -->
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/releases)
|
[](https://github.com/code-yeongyu/oh-my-openagent/releases)
|
||||||
[](https://www.npmjs.com/package/oh-my-opencode)
|
[](https://www.npmjs.com/package/oh-my-openagent)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors)
|
[](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/network/members)
|
[](https://github.com/code-yeongyu/oh-my-openagent/network/members)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/stargazers)
|
[](https://github.com/code-yeongyu/oh-my-openagent/stargazers)
|
||||||
@@ -54,25 +54,25 @@
|
|||||||
|
|
||||||
> 「Claude Codeが人間なら3ヶ月かかることを7日でやるとしたら、Sisyphusはそれを1時間でやってのけます。タスクが終わるまでひたすら働き続けます。まさに規律あるエージェントです。」 <br/>- B, Quant Researcher
|
> 「Claude Codeが人間なら3ヶ月かかることを7日でやるとしたら、Sisyphusはそれを1時間でやってのけます。タスクが終わるまでひたすら働き続けます。まさに規律あるエージェントです。」 <br/>- B, Quant Researcher
|
||||||
|
|
||||||
> 「Oh My Opencodeを使って、たった1日で8000個の eslint 警告を叩き潰しました。」 <br/>- [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
> 「Oh My OpenAgentを使って、たった1日で8000個の eslint 警告を叩き潰しました。」 <br/>- [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
||||||
|
|
||||||
> 「Ohmyopencodeとralph loopを使って、45k行のtauriアプリを一晩でSaaSウェブアプリに変換しました。インタビューモードから始めて、私のプロンプトに対して質問や推奨事項を尋ねました。勝手に作業していくのを見るのは楽しかったし、今朝起きたらウェブサイトがほぼ動いているのを見て驚愕しました!」 - [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
> 「Ohmyopencodeとralph loopを使って、45k行のtauriアプリを一晩でSaaSウェブアプリに変換しました。インタビューモードから始めて、私のプロンプトに対して質問や推奨事項を尋ねました。勝手に作業していくのを見るのは楽しかったし、今朝起きたらウェブサイトがほぼ動いているのを見て驚愕しました!」 - [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
||||||
|
|
||||||
> 「oh-my-opencodeを使ってください。もう二度と元には戻れません。」 <br/>- [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
> 「oh-my-openagentを使ってください。もう二度と元には戻れません。」 <br/>- [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
||||||
|
|
||||||
> 「何がどうすごいのかまだ上手く言語化できないんですが、開発体験が完全に異次元に到達してしまいました。」 - [苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
> 「何がどうすごいのかまだ上手く言語化できないんですが、開発体験が完全に異次元に到達してしまいました。」 - [苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
||||||
|
|
||||||
> 「週末にマインクラフト/ソウルライクな化け物を作ろうと、open code、oh my opencode、supermemoryで実験中です。昼食後の散歩に行っている間に、しゃがむアニメーションを追加するように指示しておきました。[動画]」 - [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
> 「週末にマインクラフト/ソウルライクな化け物を作ろうと、open code、oh my openagent、supermemoryで実験中です。昼食後の散歩に行っている間に、しゃがむアニメーションを追加するように指示しておきました。[動画]」 - [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
||||||
|
|
||||||
> 「これをコアに取り込んで彼を採用すべきだ。マジで。これ、本当に、本当に、本当に良い。」 <br/>- Henning Kilset
|
> 「これをコアに取り込んで彼を採用すべきだ。マジで。これ、本当に、本当に、本当に良い。」 <br/>- Henning Kilset
|
||||||
|
|
||||||
> 「彼を説得できるなら @yeon_gyu_kim を雇ってください。彼がopencodeに革命を起こしました。」 <br/>- [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
> 「彼を説得できるなら @yeon_gyu_kim を雇ってください。彼がopencodeに革命を起こしました。」 <br/>- [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
||||||
|
|
||||||
> 「Oh My OpenCodeはマジでヤバい」 - [YouTube - Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
> 「Oh My OpenAgentはマジでヤバい」 - [YouTube - Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Oh My OpenCode
|
# Oh My OpenAgent
|
||||||
|
|
||||||
最初はこれを「Claude Codeにステロイドを打ったもの」と呼んでいました。それは過小評価でした。
|
最初はこれを「Claude Codeにステロイドを打ったもの」と呼んでいました。それは過小評価でした。
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ OmOをインストールして、`ultrawork`とタイプしてください。狂
|
|||||||
以下のプロンプトをコピーして、あなたのLLMエージェント(Claude Code、AmpCode、Cursorなど)に貼り付けてください:
|
以下のプロンプトをコピーして、あなたのLLMエージェント(Claude Code、AmpCode、Cursorなど)に貼り付けてください:
|
||||||
|
|
||||||
```
|
```
|
||||||
Install and configure oh-my-opencode by following the instructions here:
|
Install and configure oh-my-openagent by following the instructions here:
|
||||||
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -260,19 +260,19 @@ project/
|
|||||||
|
|
||||||
> **背景のストーリーを知りたいですか?** なぜSisyphusは岩を転がすのか、なぜHephaestusは「正当なる職人」なのか、そして[オーケストレーションガイド](docs/guide/orchestration.md)をお読みください。
|
> **背景のストーリーを知りたいですか?** なぜSisyphusは岩を転がすのか、なぜHephaestusは「正当なる職人」なのか、そして[オーケストレーションガイド](docs/guide/orchestration.md)をお読みください。
|
||||||
>
|
>
|
||||||
> oh-my-opencodeは初めてですか?どのモデルを使うべきかについては、**[インストールガイド](docs/guide/installation.md#step-5-understand-your-model-setup)** で推奨モデルを確認してください。
|
> oh-my-openagentは初めてですか?どのモデルを使うべきかについては、**[インストールガイド](docs/guide/installation.md#step-5-understand-your-model-setup)** で推奨モデルを確認してください。
|
||||||
|
|
||||||
## アンインストール (Uninstallation)
|
## アンインストール (Uninstallation)
|
||||||
|
|
||||||
oh-my-opencodeを削除するには:
|
oh-my-openagentを削除するには:
|
||||||
|
|
||||||
1. **OpenCodeの設定からプラグインを削除する**
|
1. **OpenCodeの設定からプラグインを削除する**
|
||||||
|
|
||||||
`~/.config/opencode/opencode.json`(または `opencode.jsonc`)を編集し、`plugin` 配列から `"oh-my-opencode"` を削除します:
|
`~/.config/opencode/opencode.json`(または `opencode.jsonc`)を編集し、`plugin` 配列から `"oh-my-openagent"` を削除します:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# jq を使用する場合
|
# jq を使用する場合
|
||||||
jq '.plugin = [.plugin[] | select(. != "oh-my-opencode")]' \
|
jq '.plugin = [.plugin[] | select(. != "oh-my-openagent")]' \
|
||||||
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
||||||
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
||||||
```
|
```
|
||||||
|
|||||||
30
README.ko.md
30
README.ko.md
@@ -7,18 +7,18 @@
|
|||||||
> [!TIP]
|
> [!TIP]
|
||||||
> 저희와 함께 하세요!
|
> 저희와 함께 하세요!
|
||||||
>
|
>
|
||||||
> | [<img alt="Discord link" src="https://img.shields.io/discord/1452487457085063218?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square" width="156px" />](https://discord.gg/PUwSMR9XNk) | [Discord 커뮤니티](https://discord.gg/PUwSMR9XNk)에 가입하여 기여자 및 다른 `oh-my-opencode` 사용자들과 소통하세요. |
|
> | [<img alt="Discord link" src="https://img.shields.io/discord/1452487457085063218?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square" width="156px" />](https://discord.gg/PUwSMR9XNk) | [Discord 커뮤니티](https://discord.gg/PUwSMR9XNk)에 가입하여 기여자 및 다른 `oh-my-openagent` 사용자들과 소통하세요. |
|
||||||
> | :-----| :----- |
|
> | :-----| :----- |
|
||||||
> | [<img alt="X link" src="https://img.shields.io/badge/Follow-%40justsisyphus-00CED1?style=flat-square&logo=x&labelColor=black" width="156px" />](https://x.com/justsisyphus) | `oh-my-opencode`에 대한 소식과 업데이트는 제 X 계정에 올라왔었지만, <br /> 실수로 정지된 이후에는 [@justsisyphus](https://x.com/justsisyphus)가 대신 업데이트를 게시하고 있습니다. |
|
> | [<img alt="X link" src="https://img.shields.io/badge/Follow-%40justsisyphus-00CED1?style=flat-square&logo=x&labelColor=black" width="156px" />](https://x.com/justsisyphus) | `oh-my-openagent`에 대한 소식과 업데이트는 제 X 계정에 올라왔었지만, <br /> 실수로 정지된 이후에는 [@justsisyphus](https://x.com/justsisyphus)가 대신 업데이트를 게시하고 있습니다. |
|
||||||
> | [<img alt="GitHub Follow" src="https://img.shields.io/github/followers/code-yeongyu?style=flat-square&logo=github&labelColor=black&color=24292f" width="156px" />](https://github.com/code-yeongyu) | 더 많은 프로젝트를 보려면 GitHub에서 [@code-yeongyu](https://github.com/code-yeongyu)를 팔로우하세요. |
|
> | [<img alt="GitHub Follow" src="https://img.shields.io/github/followers/code-yeongyu?style=flat-square&logo=github&labelColor=black&color=24292f" width="156px" />](https://github.com/code-yeongyu) | 더 많은 프로젝트를 보려면 GitHub에서 [@code-yeongyu](https://github.com/code-yeongyu)를 팔로우하세요. |
|
||||||
|
|
||||||
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> -->
|
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> -->
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/releases)
|
[](https://github.com/code-yeongyu/oh-my-openagent/releases)
|
||||||
[](https://www.npmjs.com/package/oh-my-opencode)
|
[](https://www.npmjs.com/package/oh-my-openagent)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors)
|
[](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/network/members)
|
[](https://github.com/code-yeongyu/oh-my-openagent/network/members)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/stargazers)
|
[](https://github.com/code-yeongyu/oh-my-openagent/stargazers)
|
||||||
@@ -49,25 +49,25 @@
|
|||||||
|
|
||||||
> "Claude Code가 인간이 3개월 걸릴 일을 7일 만에 한다면, Sisyphus는 1시간 만에 해냅니다. 작업이 끝날 때까지 그냥 계속 알아서 작동합니다. 이건 정말 규율이 잡힌 에이전트예요." <br/>- B, Quant Researcher
|
> "Claude Code가 인간이 3개월 걸릴 일을 7일 만에 한다면, Sisyphus는 1시간 만에 해냅니다. 작업이 끝날 때까지 그냥 계속 알아서 작동합니다. 이건 정말 규율이 잡힌 에이전트예요." <br/>- B, Quant Researcher
|
||||||
|
|
||||||
> "Oh My Opencode로 하루 만에 eslint 경고 8000개를 해결했습니다." <br/>- [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
> "Oh My OpenAgent로 하루 만에 eslint 경고 8000개를 해결했습니다." <br/>- [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
||||||
|
|
||||||
> "Ohmyopencode와 ralph loop를 써서 45k 라인짜리 tauri 앱을 하룻밤 만에 SaaS 웹앱으로 변환했어요. 인터뷰 모드로 시작해서, 제가 쓴 프롬프트에 대해 질문하고 추천을 부탁했죠. 일하는 걸 지켜보는 것도 재밌었고, 아침에 일어났더니 웹사이트가 대부분 돌아가고 있는 걸 보고 경악했습니다!" - [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
> "Ohmyopencode와 ralph loop를 써서 45k 라인짜리 tauri 앱을 하룻밤 만에 SaaS 웹앱으로 변환했어요. 인터뷰 모드로 시작해서, 제가 쓴 프롬프트에 대해 질문하고 추천을 부탁했죠. 일하는 걸 지켜보는 것도 재밌었고, 아침에 일어났더니 웹사이트가 대부분 돌아가고 있는 걸 보고 경악했습니다!" - [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
||||||
|
|
||||||
> "oh-my-opencode 쓰세요, 다시는 예전으로 못 돌아갑니다." <br/>- [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
> "oh-my-openagent 쓰세요, 다시는 예전으로 못 돌아갑니다." <br/>- [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
||||||
|
|
||||||
> "뭐가 이렇게 대단한 건지 아직 정확하게 말로 표현하긴 어려운데, 개발 경험 자체가 완전히 다른 차원에 도달해버렸어요." - [苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
> "뭐가 이렇게 대단한 건지 아직 정확하게 말로 표현하긴 어려운데, 개발 경험 자체가 완전히 다른 차원에 도달해버렸어요." - [苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
||||||
|
|
||||||
> "주말에 마인크래프트/소울라이크 같은 괴물 같은 걸 만들어보려고 open code, oh my opencode, supermemory로 실험 중입니다. 점심 먹고 산책 다녀오는 동안 앉기 애니메이션을 추가하라고 시켜뒀어요. [영상]" - [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
> "주말에 마인크래프트/소울라이크 같은 괴물 같은 걸 만들어보려고 open code, oh my openagent, supermemory로 실험 중입니다. 점심 먹고 산책 다녀오는 동안 앉기 애니메이션을 추가하라고 시켜뒀어요. [영상]" - [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
||||||
|
|
||||||
> "이걸 코어에 당겨오고 저 사람 스카우트해야 돼요. 진심으로. 이거 진짜, 진짜, 진짜 좋습니다." <br/>- Henning Kilset
|
> "이걸 코어에 당겨오고 저 사람 스카우트해야 돼요. 진심으로. 이거 진짜, 진짜, 진짜 좋습니다." <br/>- Henning Kilset
|
||||||
|
|
||||||
> "설득할 수만 있다면 @yeon_gyu_kim 채용하세요, 이 사람이 opencode를 혁명적으로 바꿨습니다." <br/>- [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
> "설득할 수만 있다면 @yeon_gyu_kim 채용하세요, 이 사람이 opencode를 혁명적으로 바꿨습니다." <br/>- [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
||||||
|
|
||||||
> "Oh My OpenCode는 진짜 미쳤다" - [YouTube - Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
> "Oh My OpenAgent는 진짜 미쳤다" - [YouTube - Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Oh My OpenCode
|
# Oh My OpenAgent
|
||||||
|
|
||||||
Claude Code, Codex, 온갖 OSS 모델들 사이에서 헤매고 있나요. 워크플로우 설정하랴, 에이전트 디버깅하랴 피곤할 겁니다.
|
Claude Code, Codex, 온갖 OSS 모델들 사이에서 헤매고 있나요. 워크플로우 설정하랴, 에이전트 디버깅하랴 피곤할 겁니다.
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ OmO 설치하고. `ultrawork` 치세요. 끝.
|
|||||||
다음 프롬프트를 복사해서 여러분의 LLM 에이전트(Claude Code, AmpCode, Cursor 등)에 붙여넣으세요:
|
다음 프롬프트를 복사해서 여러분의 LLM 에이전트(Claude Code, AmpCode, Cursor 등)에 붙여넣으세요:
|
||||||
|
|
||||||
```
|
```
|
||||||
Install and configure oh-my-opencode by following the instructions here:
|
Install and configure oh-my-openagent by following the instructions here:
|
||||||
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -254,19 +254,19 @@ project/
|
|||||||
|
|
||||||
> **비하인드 스토리가 궁금하신가요?** 왜 Sisyphus가 돌을 굴리는지, 왜 Hephaestus가 "진정한 장인"인지, 그리고 [오케스트레이션 가이드](docs/guide/orchestration.md)를 읽어보세요.
|
> **비하인드 스토리가 궁금하신가요?** 왜 Sisyphus가 돌을 굴리는지, 왜 Hephaestus가 "진정한 장인"인지, 그리고 [오케스트레이션 가이드](docs/guide/orchestration.md)를 읽어보세요.
|
||||||
>
|
>
|
||||||
> oh-my-opencode가 처음이신가요? 어떤 모델을 써야 할지 **[설치 가이드](docs/guide/installation.md#step-5-understand-your-model-setup)** 에서 추천 조합을 확인하세요.
|
> oh-my-openagent가 처음이신가요? 어떤 모델을 써야 할지 **[설치 가이드](docs/guide/installation.md#step-5-understand-your-model-setup)** 에서 추천 조합을 확인하세요.
|
||||||
|
|
||||||
## 제거 (Uninstallation)
|
## 제거 (Uninstallation)
|
||||||
|
|
||||||
oh-my-opencode를 지우려면:
|
oh-my-openagent를 지우려면:
|
||||||
|
|
||||||
1. **OpenCode 설정에서 플러그인 제거**
|
1. **OpenCode 설정에서 플러그인 제거**
|
||||||
|
|
||||||
`~/.config/opencode/opencode.json` (또는 `opencode.jsonc`)를 열고 `plugin` 배열에서 `"oh-my-opencode"`를 지우세요.
|
`~/.config/opencode/opencode.json` (또는 `opencode.jsonc`)를 열고 `plugin` 배열에서 `"oh-my-openagent"`를 지우세요.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# jq 사용 시
|
# jq 사용 시
|
||||||
jq '.plugin = [.plugin[] | select(. != "oh-my-opencode")]' \
|
jq '.plugin = [.plugin[] | select(. != "oh-my-openagent")]' \
|
||||||
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
||||||
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
||||||
```
|
```
|
||||||
|
|||||||
37
README.md
37
README.md
@@ -6,18 +6,18 @@
|
|||||||
> [!TIP]
|
> [!TIP]
|
||||||
> Be with us!
|
> Be with us!
|
||||||
>
|
>
|
||||||
> | [<img alt="Discord link" src="https://img.shields.io/discord/1452487457085063218?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square" width="156px" />](https://discord.gg/PUwSMR9XNk) | Join our [Discord community](https://discord.gg/PUwSMR9XNk) to connect with contributors and fellow `oh-my-opencode` users. |
|
> | [<img alt="Discord link" src="https://img.shields.io/discord/1452487457085063218?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square" width="156px" />](https://discord.gg/PUwSMR9XNk) | Join our [Discord community](https://discord.gg/PUwSMR9XNk) to connect with contributors and fellow `oh-my-openagent` users. |
|
||||||
> | :-----| :----- |
|
> | :-----| :----- |
|
||||||
> | [<img alt="X link" src="https://img.shields.io/badge/Follow-%40justsisyphus-00CED1?style=flat-square&logo=x&labelColor=black" width="156px" />](https://x.com/justsisyphus) | News and updates for `oh-my-opencode` used to be posted on my X account. <br /> Since it was suspended mistakenly, [@justsisyphus](https://x.com/justsisyphus) now posts updates on my behalf. |
|
> | [<img alt="X link" src="https://img.shields.io/badge/Follow-%40justsisyphus-00CED1?style=flat-square&logo=x&labelColor=black" width="156px" />](https://x.com/justsisyphus) | News and updates for `oh-my-openagent` used to be posted on my X account. <br /> Since it was suspended mistakenly, [@justsisyphus](https://x.com/justsisyphus) now posts updates on my behalf. |
|
||||||
> | [<img alt="GitHub Follow" src="https://img.shields.io/github/followers/code-yeongyu?style=flat-square&logo=github&labelColor=black&color=24292f" width="156px" />](https://github.com/code-yeongyu) | Follow [@code-yeongyu](https://github.com/code-yeongyu) on GitHub for more projects. |
|
> | [<img alt="GitHub Follow" src="https://img.shields.io/github/followers/code-yeongyu?style=flat-square&logo=github&labelColor=black&color=24292f" width="156px" />](https://github.com/code-yeongyu) | Follow [@code-yeongyu](https://github.com/code-yeongyu) on GitHub for more projects. |
|
||||||
|
|
||||||
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> -->
|
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> -->
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/releases)
|
[](https://github.com/code-yeongyu/oh-my-openagent/releases)
|
||||||
[](https://www.npmjs.com/package/oh-my-opencode)
|
[](https://www.npmjs.com/package/oh-my-openagent)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors)
|
[](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/network/members)
|
[](https://github.com/code-yeongyu/oh-my-openagent/network/members)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/stargazers)
|
[](https://github.com/code-yeongyu/oh-my-openagent/stargazers)
|
||||||
@@ -51,27 +51,27 @@
|
|||||||
|
|
||||||
> "If Claude Code does in 7 days what a human does in 3 months, Sisyphus does it in 1 hour. It just works until the task is done. It is a discipline agent." <br/>- B, Quant Researcher
|
> "If Claude Code does in 7 days what a human does in 3 months, Sisyphus does it in 1 hour. It just works until the task is done. It is a discipline agent." <br/>- B, Quant Researcher
|
||||||
|
|
||||||
> "Knocked out 8000 eslint warnings with Oh My Opencode, just in a day" <br/>- [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
> "Knocked out 8000 eslint warnings with Oh My OpenAgent, just in a day" <br/>- [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
||||||
|
|
||||||
> "I converted a 45k line tauri app into a SaaS web app overnight using Ohmyopencode and ralph loop. Started with interview me prompt, asked it for ratings and recommendations on the questions. It was amazing to watch it work and to wake up this morning to a mostly working website!" - [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
> "I converted a 45k line tauri app into a SaaS web app overnight using Ohmyopencode and ralph loop. Started with interview me prompt, asked it for ratings and recommendations on the questions. It was amazing to watch it work and to wake up this morning to a mostly working website!" - [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
||||||
|
|
||||||
> "use oh-my-opencode, you will never go back" <br/>- [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
> "use oh-my-openagent, you will never go back" <br/>- [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
||||||
|
|
||||||
> "I haven't really been able to articulate exactly what makes it so great yet, but the development experience has reached a completely different dimension." - [
|
> "I haven't really been able to articulate exactly what makes it so great yet, but the development experience has reached a completely different dimension." - [
|
||||||
苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
||||||
|
|
||||||
> "Experimenting with open code, oh my opencode and supermemory this weekend to build some minecraft/souls-like abomination."
|
> "Experimenting with open code, oh my openagent and supermemory this weekend to build some minecraft/souls-like abomination."
|
||||||
> "Asking it to add crouch animations while I go take my post-lunch walk. [Video]" - [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
> "Asking it to add crouch animations while I go take my post-lunch walk. [Video]" - [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
||||||
|
|
||||||
> "You guys should pull this into core and recruit him. Seriously. It's really, really, really good." <br/>- Henning Kilset
|
> "You guys should pull this into core and recruit him. Seriously. It's really, really, really good." <br/>- Henning Kilset
|
||||||
|
|
||||||
> "Hire @yeon_gyu_kim if you can convince him, this dude has revolutionized opencode." <br/>- [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
> "Hire @yeon_gyu_kim if you can convince him, this dude has revolutionized opencode." <br/>- [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
||||||
|
|
||||||
> "Oh My OpenCode Is Actually Insane" - [YouTube - Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
> "Oh My OpenAgent Is Actually Insane" - [YouTube - Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Oh My OpenCode
|
# Oh My OpenAgent
|
||||||
|
|
||||||
You're juggling Claude Code, Codex, random OSS models. Configuring workflows. Debugging agents.
|
You're juggling Claude Code, Codex, random OSS models. Configuring workflows. Debugging agents.
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ Install OmO. Type `ultrawork`. Done.
|
|||||||
Copy and paste this prompt to your LLM agent (Claude Code, AmpCode, Cursor, etc.):
|
Copy and paste this prompt to your LLM agent (Claude Code, AmpCode, Cursor, etc.):
|
||||||
|
|
||||||
```
|
```
|
||||||
Install and configure oh-my-opencode by following the instructions here:
|
Install and configure oh-my-openagent by following the instructions here:
|
||||||
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -158,6 +158,10 @@ Even only with following subscriptions, ultrawork will work well (this project i
|
|||||||
|
|
||||||
**Prometheus** (`claude-opus-4-6` / **`kimi-k2.5`** / **`glm-5`** ) is your strategic planner. Interview mode: it questions, identifies scope, and builds a detailed plan before a single line of code is touched.
|
**Prometheus** (`claude-opus-4-6` / **`kimi-k2.5`** / **`glm-5`** ) is your strategic planner. Interview mode: it questions, identifies scope, and builds a detailed plan before a single line of code is touched.
|
||||||
|
|
||||||
|
**Atlas** (`claude-sonnet-4-6`) is the executor. He takes the plan from Prometheus and drives it to completion, managing the todo list and coordinating subagents.
|
||||||
|
|
||||||
|
**Sisyphus-Junior** is the dedicated executor for category-based tasks.
|
||||||
|
|
||||||
Every agent is tuned to its model's specific strengths. No manual model-juggling. [Learn more →](docs/guide/overview.md)
|
Every agent is tuned to its model's specific strengths. No manual model-juggling. [Learn more →](docs/guide/overview.md)
|
||||||
|
|
||||||
> Anthropic [blocked OpenCode because of us.](https://x.com/thdxr/status/2010149530486911014) That's why Hephaestus is called "The Legitimate Craftsman." The irony is intentional.
|
> Anthropic [blocked OpenCode because of us.](https://x.com/thdxr/status/2010149530486911014) That's why Hephaestus is called "The Legitimate Craftsman." The irony is intentional.
|
||||||
@@ -255,19 +259,19 @@ Add your own: `.opencode/skills/*/SKILL.md` or `~/.config/opencode/skills/*/SKIL
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> **New to oh-my-opencode?** Read the **[Overview](docs/guide/overview.md)** to understand what you have, or check the **[Orchestration Guide](docs/guide/orchestration.md)** for how agents collaborate.
|
> **New to oh-my-openagent?** Read the **[Overview](docs/guide/overview.md)** to understand what you have, or check the **[Orchestration Guide](docs/guide/orchestration.md)** for how agents collaborate.
|
||||||
|
|
||||||
## Uninstallation
|
## Uninstallation
|
||||||
|
|
||||||
To remove oh-my-opencode:
|
To remove oh-my-openagent:
|
||||||
|
|
||||||
1. **Remove the plugin from your OpenCode config**
|
1. **Remove the plugin from your OpenCode config**
|
||||||
|
|
||||||
Edit `~/.config/opencode/opencode.json` (or `opencode.jsonc`) and remove `"oh-my-opencode"` from the `plugin` array:
|
Edit `~/.config/opencode/opencode.json` (or `opencode.jsonc`) and remove `"oh-my-openagent"` from the `plugin` array:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Using jq
|
# Using jq
|
||||||
jq '.plugin = [.plugin[] | select(. != "oh-my-opencode")]' \
|
jq '.plugin = [.plugin[] | select(. != "oh-my-openagent")]' \
|
||||||
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
||||||
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
||||||
```
|
```
|
||||||
@@ -296,7 +300,8 @@ Features you'll think should've always existed. Once you use them, you can't go
|
|||||||
See full [Features Documentation](docs/reference/features.md).
|
See full [Features Documentation](docs/reference/features.md).
|
||||||
|
|
||||||
**Quick Overview:**
|
**Quick Overview:**
|
||||||
- **Agents**: Sisyphus (the main agent), Prometheus (planner), Oracle (architecture/debugging), Librarian (docs/code search), Explore (fast codebase grep), Multimodal Looker
|
- **Primary Agents**: Sisyphus (the main agent), Hephaestus (deep worker), Prometheus (planner), Atlas (executor), Sisyphus-Junior (category executor)
|
||||||
|
- **Specialist Subagents**: Oracle (architecture/debugging), Librarian (docs/code search), Explore (fast codebase grep), Multimodal Looker (vision)
|
||||||
- **Background Agents**: Run multiple agents in parallel like a real dev team
|
- **Background Agents**: Run multiple agents in parallel like a real dev team
|
||||||
- **LSP & AST Tools**: Refactoring, rename, diagnostics, AST-aware code search
|
- **LSP & AST Tools**: Refactoring, rename, diagnostics, AST-aware code search
|
||||||
- **Hash-anchored Edit Tool**: `LINE#ID` references validate content before applying every change. Surgical edits, zero stale-line errors
|
- **Hash-anchored Edit Tool**: `LINE#ID` references validate content before applying every change. Surgical edits, zero stale-line errors
|
||||||
|
|||||||
30
README.ru.md
30
README.ru.md
@@ -12,16 +12,16 @@
|
|||||||
|
|
||||||
> [!TIP] Будьте с нами!
|
> [!TIP] Будьте с нами!
|
||||||
>
|
>
|
||||||
> | [](https://discord.gg/PUwSMR9XNk) | Вступайте в наш [Discord](https://discord.gg/PUwSMR9XNk), чтобы общаться с контрибьюторами и пользователями `oh-my-opencode`. |
|
> | [](https://discord.gg/PUwSMR9XNk) | Вступайте в наш [Discord](https://discord.gg/PUwSMR9XNk), чтобы общаться с контрибьюторами и пользователями `oh-my-openagent`. |
|
||||||
> | ----------------------------------- | ------------------------------------------------------------ |
|
> | ----------------------------------- | ------------------------------------------------------------ |
|
||||||
> | [](https://x.com/justsisyphus) | Новости и обновления `oh-my-opencode` раньше публиковались на моём аккаунте X. <br /> После ошибочной блокировки, [@justsisyphus](https://x.com/justsisyphus) публикует обновления вместо меня. |
|
> | [](https://x.com/justsisyphus) | Новости и обновления `oh-my-openagent` раньше публиковались на моём аккаунте X. <br /> После ошибочной блокировки, [@justsisyphus](https://x.com/justsisyphus) публикует обновления вместо меня. |
|
||||||
> | [](https://github.com/code-yeongyu) | Подпишитесь на [@code-yeongyu](https://github.com/code-yeongyu) на GitHub, чтобы следить за другими проектами. |
|
> | [](https://github.com/code-yeongyu) | Подпишитесь на [@code-yeongyu](https://github.com/code-yeongyu) на GitHub, чтобы следить за другими проектами. |
|
||||||
|
|
||||||
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> --> <div align="center">
|
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> --> <div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/releases) [](https://www.npmjs.com/package/oh-my-opencode) [](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors) [](https://github.com/code-yeongyu/oh-my-openagent/network/members) [](https://github.com/code-yeongyu/oh-my-openagent/stargazers) [](https://github.com/code-yeongyu/oh-my-openagent/issues) [](https://github.com/code-yeongyu/oh-my-openagent/blob/master/LICENSE.md) [](https://deepwiki.com/code-yeongyu/oh-my-openagent)
|
[](https://github.com/code-yeongyu/oh-my-openagent/releases) [](https://www.npmjs.com/package/oh-my-openagent) [](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors) [](https://github.com/code-yeongyu/oh-my-openagent/network/members) [](https://github.com/code-yeongyu/oh-my-openagent/stargazers) [](https://github.com/code-yeongyu/oh-my-openagent/issues) [](https://github.com/code-yeongyu/oh-my-openagent/blob/master/LICENSE.md) [](https://deepwiki.com/code-yeongyu/oh-my-openagent)
|
||||||
|
|
||||||
English | 한국어 | 日本語 | 简体中文 | Русский
|
English | 한국어 | 日本語 | 简体中文 | Русский
|
||||||
|
|
||||||
@@ -43,25 +43,25 @@ English | 한국어 | 日本語 | 简体中文 | Русский
|
|||||||
|
|
||||||
> «Если Claude Code делает за 7 дней то, на что у человека уходит 3 месяца, Sisyphus справляется за 1 час. Он просто работает, пока задача не выполнена. Это дисциплинированный агент.» <br/>— B, исследователь в области квантовых финансов
|
> «Если Claude Code делает за 7 дней то, на что у человека уходит 3 месяца, Sisyphus справляется за 1 час. Он просто работает, пока задача не выполнена. Это дисциплинированный агент.» <br/>— B, исследователь в области квантовых финансов
|
||||||
|
|
||||||
> «За один день устранил 8000 предупреждений eslint с помощью Oh My Opencode.» <br/>— [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
> «За один день устранил 8000 предупреждений eslint с помощью Oh My OpenAgent.» <br/>— [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
||||||
|
|
||||||
> «За ночь конвертировал приложение на tauri в 45k строк в веб-SaaS с помощью Ohmyopencode и ralph loop. Начал с промпта «проинтервьюируй меня», попросил оценки и рекомендации по вопросам. Было удивительно наблюдать за работой и утром проснуться с почти рабочим сайтом!» — [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
> «За ночь конвертировал приложение на tauri в 45k строк в веб-SaaS с помощью Ohmyopencode и ralph loop. Начал с промпта «проинтервьюируй меня», попросил оценки и рекомендации по вопросам. Было удивительно наблюдать за работой и утром проснуться с почти рабочим сайтом!» — [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
||||||
|
|
||||||
> «Используйте oh-my-opencode — вы не захотите возвращаться назад.» <br/>— [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
> «Используйте oh-my-openagent — вы не захотите возвращаться назад.» <br/>— [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
||||||
|
|
||||||
> «Пока не могу точно объяснить, почему это так круто, но опыт разработки вышел на совершенно другой уровень.» — [苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
> «Пока не могу точно объяснить, почему это так круто, но опыт разработки вышел на совершенно другой уровень.» — [苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
||||||
|
|
||||||
> «Экспериментирую с open code, oh my opencode и supermemory этим выходным, чтобы собрать нечто среднее между Minecraft и souls-like.» «Попросил добавить анимации приседания, пока хожу на обеденную прогулку. [Видео]» — [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
> «Экспериментирую с open code, oh my openagent и supermemory этим выходным, чтобы собрать нечто среднее между Minecraft и souls-like.» «Попросил добавить анимации приседания, пока хожу на обеденную прогулку. [Видео]» — [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
||||||
|
|
||||||
> «Ребята, вам нужно включить это в ядро и нанять его. Серьёзно. Это очень, очень, очень хорошо.» <br/>— Henning Kilset
|
> «Ребята, вам нужно включить это в ядро и нанять его. Серьёзно. Это очень, очень, очень хорошо.» <br/>— Henning Kilset
|
||||||
|
|
||||||
> «Наймите @yeon_gyu_kim, если сможете его уговорить, этот парень революционизировал opencode.» <br/>— [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
> «Наймите @yeon_gyu_kim, если сможете его уговорить, этот парень революционизировал opencode.» <br/>— [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
||||||
|
|
||||||
> «Oh My OpenCode — это что-то с чем-то» — [YouTube — Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
> «Oh My OpenAgent — это что-то с чем-то» — [YouTube — Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
||||||
|
|
||||||
------
|
------
|
||||||
|
|
||||||
# Oh My OpenCode
|
# Oh My OpenAgent
|
||||||
|
|
||||||
Вы жонглируете Claude Code, Codex, случайными OSS-моделями. Настраиваете рабочие процессы. Дебажите агентов.
|
Вы жонглируете Claude Code, Codex, случайными OSS-моделями. Настраиваете рабочие процессы. Дебажите агентов.
|
||||||
|
|
||||||
@@ -76,7 +76,7 @@ English | 한국어 | 日本語 | 简体中文 | Русский
|
|||||||
Скопируйте и вставьте этот промпт в ваш LLM-агент (Claude Code, AmpCode, Cursor и т.д.):
|
Скопируйте и вставьте этот промпт в ваш LLM-агент (Claude Code, AmpCode, Cursor и т.д.):
|
||||||
|
|
||||||
```
|
```
|
||||||
Install and configure oh-my-opencode by following the instructions here:
|
Install and configure oh-my-openagent by following the instructions here:
|
||||||
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -242,19 +242,19 @@ project/
|
|||||||
|
|
||||||
------
|
------
|
||||||
|
|
||||||
> **Впервые в oh-my-opencode?** Прочитайте **Обзор**, чтобы понять, что у вас есть, или ознакомьтесь с **руководством по оркестрации**, чтобы узнать, как агенты взаимодействуют.
|
> **Впервые в oh-my-openagent?** Прочитайте **Обзор**, чтобы понять, что у вас есть, или ознакомьтесь с **руководством по оркестрации**, чтобы узнать, как агенты взаимодействуют.
|
||||||
|
|
||||||
## Удаление
|
## Удаление
|
||||||
|
|
||||||
Чтобы удалить oh-my-opencode:
|
Чтобы удалить oh-my-openagent:
|
||||||
|
|
||||||
1. **Удалите плагин из конфига OpenCode**
|
1. **Удалите плагин из конфига OpenCode**
|
||||||
|
|
||||||
Отредактируйте `~/.config/opencode/opencode.json` (или `opencode.jsonc`) и уберите `"oh-my-opencode"` из массива `plugin`:
|
Отредактируйте `~/.config/opencode/opencode.json` (или `opencode.jsonc`) и уберите `"oh-my-openagent"` из массива `plugin`:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# С помощью jq
|
# С помощью jq
|
||||||
jq '.plugin = [.plugin[] | select(. != "oh-my-opencode")]' \
|
jq '.plugin = [.plugin[] | select(. != "oh-my-openagent")]' \
|
||||||
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
||||||
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -12,18 +12,18 @@
|
|||||||
> [!TIP]
|
> [!TIP]
|
||||||
> 加入我们!
|
> 加入我们!
|
||||||
>
|
>
|
||||||
> | [<img alt="Discord link" src="https://img.shields.io/discord/1452487457085063218?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square" width="156px" />](https://discord.gg/PUwSMR9XNk) | 加入我们的 [Discord 社区](https://discord.gg/PUwSMR9XNk),与贡献者及其他 `oh-my-opencode` 用户交流。 |
|
> | [<img alt="Discord link" src="https://img.shields.io/discord/1452487457085063218?color=5865F2&label=discord&labelColor=black&logo=discord&logoColor=white&style=flat-square" width="156px" />](https://discord.gg/PUwSMR9XNk) | 加入我们的 [Discord 社区](https://discord.gg/PUwSMR9XNk),与贡献者及其他 `oh-my-openagent` 用户交流。 |
|
||||||
> | :-----| :----- |
|
> | :-----| :----- |
|
||||||
> | [<img alt="X link" src="https://img.shields.io/badge/Follow-%40justsisyphus-00CED1?style=flat-square&logo=x&labelColor=black" width="156px" />](https://x.com/justsisyphus) | 关于 `oh-my-opencode` 的新闻和更新过去发布在我的 X 账号上。<br /> 因为账号被意外停用,现在由 [@justsisyphus](https://x.com/justsisyphus) 代为发布更新。 |
|
> | [<img alt="X link" src="https://img.shields.io/badge/Follow-%40justsisyphus-00CED1?style=flat-square&logo=x&labelColor=black" width="156px" />](https://x.com/justsisyphus) | 关于 `oh-my-openagent` 的新闻和更新过去发布在我的 X 账号上。<br /> 因为账号被意外停用,现在由 [@justsisyphus](https://x.com/justsisyphus) 代为发布更新。 |
|
||||||
> | [<img alt="GitHub Follow" src="https://img.shields.io/github/followers/code-yeongyu?style=flat-square&logo=github&labelColor=black&color=24292f" width="156px" />](https://github.com/code-yeongyu) | 在 GitHub 上关注 [@code-yeongyu](https://github.com/code-yeongyu) 获取更多项目信息。 |
|
> | [<img alt="GitHub Follow" src="https://img.shields.io/github/followers/code-yeongyu?style=flat-square&logo=github&labelColor=black&color=24292f" width="156px" />](https://github.com/code-yeongyu) | 在 GitHub 上关注 [@code-yeongyu](https://github.com/code-yeongyu) 获取更多项目信息。 |
|
||||||
|
|
||||||
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> -->
|
<!-- <CENTERED SECTION FOR GITHUB DISPLAY> -->
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-opencode)
|
[](https://github.com/code-yeongyu/oh-my-openagent#oh-my-openagent)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/releases)
|
[](https://github.com/code-yeongyu/oh-my-openagent/releases)
|
||||||
[](https://www.npmjs.com/package/oh-my-opencode)
|
[](https://www.npmjs.com/package/oh-my-openagent)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors)
|
[](https://github.com/code-yeongyu/oh-my-openagent/graphs/contributors)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/network/members)
|
[](https://github.com/code-yeongyu/oh-my-openagent/network/members)
|
||||||
[](https://github.com/code-yeongyu/oh-my-openagent/stargazers)
|
[](https://github.com/code-yeongyu/oh-my-openagent/stargazers)
|
||||||
@@ -54,25 +54,25 @@
|
|||||||
|
|
||||||
> “如果人类需要 3 个月完成的事情 Claude Code 需要 7 天,那么 Sisyphus 只需要 1 小时。它会一直工作直到任务完成。它是一个极度自律的智能体。” <br/>- B, 量化研究员
|
> “如果人类需要 3 个月完成的事情 Claude Code 需要 7 天,那么 Sisyphus 只需要 1 小时。它会一直工作直到任务完成。它是一个极度自律的智能体。” <br/>- B, 量化研究员
|
||||||
|
|
||||||
> “用 Oh My Opencode 一天之内解决了 8000 个 eslint 警告。” <br/>- [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
> “用 Oh My OpenAgent 一天之内解决了 8000 个 eslint 警告。” <br/>- [Jacob Ferrari](https://x.com/jacobferrari_/status/2003258761952289061)
|
||||||
|
|
||||||
> “我用 Ohmyopencode 和 ralph loop 花了一晚上的时间,把一个 45k 行代码的 tauri 应用转换成了 SaaS Web 应用。从面试模式开始,让它对我提供的提示词进行提问和提出建议。看着它工作很有趣,今早醒来看到网站基本已经跑起来了,太震撼了!” - [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
> “我用 Ohmyopencode 和 ralph loop 花了一晚上的时间,把一个 45k 行代码的 tauri 应用转换成了 SaaS Web 应用。从面试模式开始,让它对我提供的提示词进行提问和提出建议。看着它工作很有趣,今早醒来看到网站基本已经跑起来了,太震撼了!” - [James Hargis](https://x.com/hargabyte/status/2007299688261882202)
|
||||||
|
|
||||||
> “用 oh-my-opencode 吧,你绝对回不去了。” <br/>- [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
> “用 oh-my-openagent 吧,你绝对回不去了。” <br/>- [d0t3ch](https://x.com/d0t3ch/status/2001685618200580503)
|
||||||
|
|
||||||
> “我很难准确描述它到底哪里牛逼,但开发体验已经达到完全不同的维度了。” - [苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
> “我很难准确描述它到底哪里牛逼,但开发体验已经达到完全不同的维度了。” - [苔硯:こけすずり](https://x.com/kokesuzuri/status/2008532913961529372?s=20)
|
||||||
|
|
||||||
> “这周末我用 open code、oh my opencode 和 supermemory 瞎折腾一个像我的世界/魂系一样的怪物游戏。吃完午饭去散步前,我让它把下蹲动画加进去。[视频]” - [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
> “这周末我用 open code、oh my openagent 和 supermemory 瞎折腾一个像我的世界/魂系一样的怪物游戏。吃完午饭去散步前,我让它把下蹲动画加进去。[视频]” - [MagiMetal](https://x.com/MagiMetal/status/2005374704178373023)
|
||||||
|
|
||||||
> “你们真该把这个合并到核心代码里,然后把他招安了。说真的,这东西实在太牛了。” <br/>- Henning Kilset
|
> “你们真该把这个合并到核心代码里,然后把他招安了。说真的,这东西实在太牛了。” <br/>- Henning Kilset
|
||||||
|
|
||||||
> “如果你们能说服 @yeon_gyu_kim,赶紧招募他。这个人彻底改变了 opencode。” <br/>- [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
> “如果你们能说服 @yeon_gyu_kim,赶紧招募他。这个人彻底改变了 opencode。” <br/>- [mysticaltech](https://x.com/mysticaltech/status/2001858758608376079)
|
||||||
|
|
||||||
> “Oh My OpenCode 简直疯了。” - [YouTube - Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
> “Oh My OpenAgent 简直疯了。” - [YouTube - Darren Builds AI](https://www.youtube.com/watch?v=G_Snfh2M41M)
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# Oh My OpenCode
|
# Oh My OpenAgent
|
||||||
|
|
||||||
我们最初把这叫做“给 Claude Code 打类固醇”。那是低估了它。
|
我们最初把这叫做“给 Claude Code 打类固醇”。那是低估了它。
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@
|
|||||||
复制并粘贴以下提示词到你的 LLM Agent (Claude Code, AmpCode, Cursor 等):
|
复制并粘贴以下提示词到你的 LLM Agent (Claude Code, AmpCode, Cursor 等):
|
||||||
|
|
||||||
```
|
```
|
||||||
Install and configure oh-my-opencode by following the instructions here:
|
Install and configure oh-my-openagent by following the instructions here:
|
||||||
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -259,19 +259,19 @@ Agent 会自动顺藤摸瓜加载对应的 Context,免去了你所有的手动
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
> **第一次用 oh-my-opencode?** 阅读 **[概述](docs/guide/overview.md)** 了解你拥有哪些功能,或查看 **[编排指南](docs/guide/orchestration.md)** 了解 Agent 如何协作。
|
> **第一次用 oh-my-openagent?** 阅读 **[概述](docs/guide/overview.md)** 了解你拥有哪些功能,或查看 **[编排指南](docs/guide/orchestration.md)** 了解 Agent 如何协作。
|
||||||
|
|
||||||
## 如何卸载 (Uninstallation)
|
## 如何卸载 (Uninstallation)
|
||||||
|
|
||||||
要移除 oh-my-opencode:
|
要移除 oh-my-openagent:
|
||||||
|
|
||||||
1. **从你的 OpenCode 配置文件中去掉插件**
|
1. **从你的 OpenCode 配置文件中去掉插件**
|
||||||
|
|
||||||
编辑 `~/.config/opencode/opencode.json` (或 `opencode.jsonc`) ,并把 `"oh-my-opencode"` 从 `plugin` 数组中删掉:
|
编辑 `~/.config/opencode/opencode.json` (或 `opencode.jsonc`) ,并把 `"oh-my-openagent"` 从 `plugin` 数组中删掉:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 如果你有 jq 的话
|
# 如果你有 jq 的话
|
||||||
jq '.plugin = [.plugin[] | select(. != "oh-my-opencode")]' \
|
jq '.plugin = [.plugin[] | select(. != "oh-my-openagent")]' \
|
||||||
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
~/.config/opencode/opencode.json > /tmp/oc.json && \
|
||||||
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
mv /tmp/oc.json ~/.config/opencode/opencode.json
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -3699,30 +3699,6 @@
|
|||||||
"syncPollTimeoutMs": {
|
"syncPollTimeoutMs": {
|
||||||
"type": "number",
|
"type": "number",
|
||||||
"minimum": 60000
|
"minimum": 60000
|
||||||
},
|
|
||||||
"maxToolCalls": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 10,
|
|
||||||
"maximum": 9007199254740991
|
|
||||||
},
|
|
||||||
"circuitBreaker": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"enabled": {
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"maxToolCalls": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 10,
|
|
||||||
"maximum": 9007199254740991
|
|
||||||
},
|
|
||||||
"consecutiveThreshold": {
|
|
||||||
"type": "integer",
|
|
||||||
"minimum": 5,
|
|
||||||
"maximum": 9007199254740991
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"additionalProperties": false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"": {
|
"": {
|
||||||
"name": "hashline-edit-benchmark",
|
"name": "hashline-edit-benchmark",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ai-sdk/openai-compatible": "^2.0.35",
|
"@friendliai/ai-provider": "^1.0.9",
|
||||||
"ai": "^6.0.94",
|
"ai": "^6.0.94",
|
||||||
"zod": "^4.1.0",
|
"zod": "^4.1.0",
|
||||||
},
|
},
|
||||||
@@ -14,11 +14,13 @@
|
|||||||
"packages": {
|
"packages": {
|
||||||
"@ai-sdk/gateway": ["@ai-sdk/gateway@3.0.55", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.15", "@vercel/oidc": "3.1.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-7xMeTJnCjwRwXKVCiv4Ly4qzWvDuW3+W1WIV0X1EFu6W83d4mEhV9bFArto10MeTw40ewuDjrbrZd21mXKohkw=="],
|
"@ai-sdk/gateway": ["@ai-sdk/gateway@3.0.55", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.15", "@vercel/oidc": "3.1.0" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-7xMeTJnCjwRwXKVCiv4Ly4qzWvDuW3+W1WIV0X1EFu6W83d4mEhV9bFArto10MeTw40ewuDjrbrZd21mXKohkw=="],
|
||||||
|
|
||||||
"@ai-sdk/openai-compatible": ["@ai-sdk/openai-compatible@2.0.35", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.19" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-g3wA57IAQFb+3j4YuFndgkUdXyRETZVvbfAWM+UX7bZSxA3xjes0v3XKgIdKdekPtDGsh4ZX2byHD0gJIMPfiA=="],
|
"@ai-sdk/openai-compatible": ["@ai-sdk/openai-compatible@2.0.30", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.15" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-iTjumHf1/u4NhjXYFn/aONM2GId3/o7J1Lp5ql8FCbgIMyRwrmanR5xy1S3aaVkfTscuDvLTzWiy1mAbGzK3nQ=="],
|
||||||
|
|
||||||
"@ai-sdk/provider": ["@ai-sdk/provider@3.0.8", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ=="],
|
"@ai-sdk/provider": ["@ai-sdk/provider@3.0.8", "", { "dependencies": { "json-schema": "^0.4.0" } }, "sha512-oGMAgGoQdBXbZqNG0Ze56CHjDZ1IDYOwGYxYjO5KLSlz5HiNQ9udIXsPZ61VWaHGZ5XW/jyjmr6t2xz2jGVwbQ=="],
|
||||||
|
|
||||||
"@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.19", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-3eG55CrSWCu2SXlqq2QCsFjo3+E7+Gmg7i/oRVoSZzIodTuDSfLb3MRje67xE9RFea73Zao7Lm4mADIfUETKGg=="],
|
"@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.15", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-8XiKWbemmCbvNN0CLR9u3PQiet4gtEVIrX4zzLxnCj06AwsEDJwJVBbKrEI4t6qE8XRSIvU2irka0dcpziKW6w=="],
|
||||||
|
|
||||||
|
"@friendliai/ai-provider": ["@friendliai/ai-provider@1.1.4", "", { "dependencies": { "@ai-sdk/openai-compatible": "2.0.30", "@ai-sdk/provider": "3.0.8", "@ai-sdk/provider-utils": "4.0.15" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.12" } }, "sha512-9TU4B1QFqPhbkONjI5afCF7Ox4jOqtGg1xw8mA9QHZdtlEbZxU+mBNvMPlI5pU5kPoN6s7wkXmFmxpID+own1A=="],
|
||||||
|
|
||||||
"@opentelemetry/api": ["@opentelemetry/api@1.9.0", "", {}, "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg=="],
|
"@opentelemetry/api": ["@opentelemetry/api@1.9.0", "", {}, "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg=="],
|
||||||
|
|
||||||
@@ -33,9 +35,5 @@
|
|||||||
"json-schema": ["json-schema@0.4.0", "", {}, "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="],
|
"json-schema": ["json-schema@0.4.0", "", {}, "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA=="],
|
||||||
|
|
||||||
"zod": ["zod@4.3.6", "", {}, "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg=="],
|
"zod": ["zod@4.3.6", "", {}, "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg=="],
|
||||||
|
|
||||||
"@ai-sdk/gateway/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.15", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-8XiKWbemmCbvNN0CLR9u3PQiet4gtEVIrX4zzLxnCj06AwsEDJwJVBbKrEI4t6qE8XRSIvU2irka0dcpziKW6w=="],
|
|
||||||
|
|
||||||
"ai/@ai-sdk/provider-utils": ["@ai-sdk/provider-utils@4.0.15", "", { "dependencies": { "@ai-sdk/provider": "3.0.8", "@standard-schema/spec": "^1.1.0", "eventsource-parser": "^3.0.6" }, "peerDependencies": { "zod": "^3.25.76 || ^4.1.8" } }, "sha512-8XiKWbemmCbvNN0CLR9u3PQiet4gtEVIrX4zzLxnCj06AwsEDJwJVBbKrEI4t6qE8XRSIvU2irka0dcpziKW6w=="],
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3,17 +3,16 @@ import { readFile, writeFile, mkdir } from "node:fs/promises"
|
|||||||
import { join, dirname } from "node:path"
|
import { join, dirname } from "node:path"
|
||||||
import { stepCountIs, streamText, type CoreMessage } from "ai"
|
import { stepCountIs, streamText, type CoreMessage } from "ai"
|
||||||
import { tool } from "ai"
|
import { tool } from "ai"
|
||||||
import { createOpenAICompatible } from "@ai-sdk/openai-compatible"
|
import { createFriendli } from "@friendliai/ai-provider"
|
||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
import { formatHashLines } from "../../src/tools/hashline-edit/hash-computation"
|
import { formatHashLines } from "../src/tools/hashline-edit/hash-computation"
|
||||||
import { normalizeHashlineEdits } from "../../src/tools/hashline-edit/normalize-edits"
|
import { normalizeHashlineEdits } from "../src/tools/hashline-edit/normalize-edits"
|
||||||
import { applyHashlineEditsWithReport } from "../../src/tools/hashline-edit/edit-operations"
|
import { applyHashlineEditsWithReport } from "../src/tools/hashline-edit/edit-operations"
|
||||||
import { canonicalizeFileText, restoreFileText } from "../../src/tools/hashline-edit/file-text-canonicalization"
|
import { canonicalizeFileText, restoreFileText } from "../src/tools/hashline-edit/file-text-canonicalization"
|
||||||
import { HASHLINE_EDIT_DESCRIPTION } from "../../src/tools/hashline-edit/tool-description"
|
|
||||||
|
|
||||||
const DEFAULT_MODEL = "minimax-m2.5-free"
|
const DEFAULT_MODEL = "MiniMaxAI/MiniMax-M2.5"
|
||||||
const MAX_STEPS = 50
|
const MAX_STEPS = 50
|
||||||
const sessionId = `hashline-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
|
const sessionId = `bench-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`
|
||||||
|
|
||||||
const emit = (event: Record<string, unknown>) =>
|
const emit = (event: Record<string, unknown>) =>
|
||||||
console.log(JSON.stringify({ sessionId, timestamp: new Date().toISOString(), ...event }))
|
console.log(JSON.stringify({ sessionId, timestamp: new Date().toISOString(), ...event }))
|
||||||
@@ -34,7 +33,7 @@ function parseArgs(): { prompt: string; modelId: string } {
|
|||||||
// --no-translate, --think consumed silently
|
// --no-translate, --think consumed silently
|
||||||
}
|
}
|
||||||
if (!prompt) {
|
if (!prompt) {
|
||||||
console.error("Usage: bun run tests/hashline/headless.ts -p <prompt> [-m <model>]")
|
console.error("Usage: bun run benchmarks/headless.ts -p <prompt> [-m <model>]")
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
return { prompt, modelId }
|
return { prompt, modelId }
|
||||||
@@ -58,7 +57,7 @@ const readFileTool = tool({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const editFileTool = tool({
|
const editFileTool = tool({
|
||||||
description: HASHLINE_EDIT_DESCRIPTION,
|
description: "Edit a file using hashline anchors (LINE#ID format)",
|
||||||
inputSchema: z.object({
|
inputSchema: z.object({
|
||||||
path: z.string(),
|
path: z.string(),
|
||||||
edits: z.array(
|
edits: z.array(
|
||||||
@@ -117,12 +116,8 @@ const editFileTool = tool({
|
|||||||
async function run() {
|
async function run() {
|
||||||
const { prompt, modelId } = parseArgs()
|
const { prompt, modelId } = parseArgs()
|
||||||
|
|
||||||
const provider = createOpenAICompatible({
|
const friendli = createFriendli({ apiKey: process.env.FRIENDLI_TOKEN! })
|
||||||
name: "hashline-test",
|
const model = friendli(modelId)
|
||||||
baseURL: process.env.HASHLINE_TEST_BASE_URL ?? "https://quotio.mengmota.com/v1",
|
|
||||||
apiKey: process.env.HASHLINE_TEST_API_KEY ?? "quotio-local-60A613FE-DB74-40FF-923E-A14151951E5D",
|
|
||||||
})
|
|
||||||
const model = provider.chatModel(modelId)
|
|
||||||
const tools = { read_file: readFileTool, edit_file: editFileTool }
|
const tools = { read_file: readFileTool, edit_file: editFileTool }
|
||||||
|
|
||||||
emit({ type: "user", content: prompt })
|
emit({ type: "user", content: prompt })
|
||||||
@@ -130,8 +125,7 @@ async function run() {
|
|||||||
const messages: CoreMessage[] = [{ role: "user", content: prompt }]
|
const messages: CoreMessage[] = [{ role: "user", content: prompt }]
|
||||||
const system =
|
const system =
|
||||||
"You are a code editing assistant. Use read_file to read files and edit_file to edit them. " +
|
"You are a code editing assistant. Use read_file to read files and edit_file to edit them. " +
|
||||||
"Always read a file before editing it to get fresh LINE#ID anchors.\n\n" +
|
"Always read a file before editing it to get fresh LINE#ID anchors."
|
||||||
"edit_file tool description:\n" + HASHLINE_EDIT_DESCRIPTION
|
|
||||||
|
|
||||||
for (let step = 0; step < MAX_STEPS; step++) {
|
for (let step = 0; step < MAX_STEPS; step++) {
|
||||||
const stream = streamText({
|
const stream = streamText({
|
||||||
@@ -167,7 +161,6 @@ async function run() {
|
|||||||
...(isError ? { error: output } : {}),
|
...(isError ? { error: output } : {}),
|
||||||
})
|
})
|
||||||
break
|
break
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,4 +191,3 @@ run()
|
|||||||
const elapsed = ((Date.now() - startTime) / 1000).toFixed(2)
|
const elapsed = ((Date.now() - startTime) / 1000).toFixed(2)
|
||||||
console.error(`[headless] Completed in ${elapsed}s`)
|
console.error(`[headless] Completed in ${elapsed}s`)
|
||||||
})
|
})
|
||||||
|
|
||||||
18
benchmarks/package.json
Normal file
18
benchmarks/package.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "hashline-edit-benchmark",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"description": "Hashline edit tool benchmark using Vercel AI SDK with FriendliAI provider",
|
||||||
|
"scripts": {
|
||||||
|
"bench:basic": "bun run test-edit-ops.ts",
|
||||||
|
"bench:edge": "bun run test-edge-cases.ts",
|
||||||
|
"bench:multi": "bun run test-multi-model.ts",
|
||||||
|
"bench:all": "bun run bench:basic && bun run bench:edge"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@friendliai/ai-provider": "^1.0.9",
|
||||||
|
"ai": "^6.0.94",
|
||||||
|
"zod": "^4.1.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,7 +14,10 @@ import { resolve } from "node:path";
|
|||||||
|
|
||||||
// ── Models ────────────────────────────────────────────────────
|
// ── Models ────────────────────────────────────────────────────
|
||||||
const MODELS = [
|
const MODELS = [
|
||||||
{ id: "minimax-m2.5-free", short: "M2.5-Free" },
|
{ id: "MiniMaxAI/MiniMax-M2.5", short: "M2.5" },
|
||||||
|
// { id: "MiniMaxAI/MiniMax-M2.1", short: "M2.1" }, // masked: slow + timeout-prone
|
||||||
|
// { id: "zai-org/GLM-5", short: "GLM-5" }, // masked: API 503
|
||||||
|
{ id: "zai-org/GLM-4.7", short: "GLM-4.7" },
|
||||||
];
|
];
|
||||||
|
|
||||||
// ── CLI args ──────────────────────────────────────────────────
|
// ── CLI args ──────────────────────────────────────────────────
|
||||||
@@ -8,7 +8,7 @@ Think of AI models as developers on a team. Each has a different brain, differen
|
|||||||
|
|
||||||
This isn't a bug. It's the foundation of the entire system.
|
This isn't a bug. It's the foundation of the entire system.
|
||||||
|
|
||||||
Oh My OpenCode assigns each agent a model that matches its _working style_ — like building a team where each person is in the role that fits their personality.
|
Oh My OpenAgent assigns each agent a model that matches its _working style_ — like building a team where each person is in the role that fits their personality.
|
||||||
|
|
||||||
### Sisyphus: The Sociable Lead
|
### Sisyphus: The Sociable Lead
|
||||||
|
|
||||||
@@ -64,8 +64,8 @@ These agents have Claude-optimized prompts — long, detailed, mechanics-driven.
|
|||||||
|
|
||||||
| Agent | Role | Fallback Chain | Notes |
|
| Agent | Role | Fallback Chain | Notes |
|
||||||
| ------------ | ----------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
| ------------ | ----------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------- |
|
||||||
| **Sisyphus** | Main orchestrator | Claude Opus → opencode-go/kimi-k2.5 → K2P5 → Kimi K2.5 → GPT-5.4 → GLM-5 → Big Pickle | Claude-family first. GPT-5.4 has dedicated prompt support. Kimi available through multiple providers. |
|
| **Sisyphus** | Main orchestrator | Claude Opus → opencode-go/kimi-k2.5 → K2P5 → GPT-5.4 → GLM-5 → Big Pickle | Claude-family first. GPT-5.4 has dedicated prompt support. Kimi/GLM as intermediate fallbacks. |
|
||||||
| **Metis** | Plan gap analyzer | Claude Opus → GPT-5.4 → opencode-go/glm-5 → K2P5 | Claude preferred. GPT-5.4 as secondary before GLM-5 fallback. |
|
| **Metis** | Plan gap analyzer | Claude Opus → opencode-go/glm-5 → K2P5 | Claude preferred. Uses opencode-go for reliable GLM-5 access. |
|
||||||
|
|
||||||
### Dual-Prompt Agents → Claude preferred, GPT supported
|
### Dual-Prompt Agents → Claude preferred, GPT supported
|
||||||
|
|
||||||
@@ -74,7 +74,7 @@ These agents ship separate prompts for Claude and GPT families. They auto-detect
|
|||||||
| Agent | Role | Fallback Chain | Notes |
|
| Agent | Role | Fallback Chain | Notes |
|
||||||
| -------------- | ----------------- | -------------------------------------- | -------------------------------------------------------------------- |
|
| -------------- | ----------------- | -------------------------------------- | -------------------------------------------------------------------- |
|
||||||
| **Prometheus** | Strategic planner | Claude Opus → GPT-5.4 → opencode-go/glm-5 → Gemini 3.1 Pro | Interview-mode planning. GPT prompt is compact and principle-driven. |
|
| **Prometheus** | Strategic planner | Claude Opus → GPT-5.4 → opencode-go/glm-5 → Gemini 3.1 Pro | Interview-mode planning. GPT prompt is compact and principle-driven. |
|
||||||
| **Atlas** | Todo orchestrator | Claude Sonnet → opencode-go/kimi-k2.5 → GPT-5.4 | Claude first, opencode-go as intermediate, GPT-5.4 as last resort. |
|
| **Atlas** | Todo orchestrator | Claude Sonnet → opencode-go/kimi-k2.5 | Claude first, opencode-go as the current fallback path. |
|
||||||
|
|
||||||
### Deep Specialists → GPT
|
### Deep Specialists → GPT
|
||||||
|
|
||||||
@@ -82,9 +82,9 @@ These agents are built for GPT's principle-driven style. Their prompts assume au
|
|||||||
|
|
||||||
| Agent | Role | Fallback Chain | Notes |
|
| Agent | Role | Fallback Chain | Notes |
|
||||||
| -------------- | ----------------------- | -------------------------------------- | ------------------------------------------------ |
|
| -------------- | ----------------------- | -------------------------------------- | ------------------------------------------------ |
|
||||||
| **Hephaestus** | Autonomous deep worker | GPT-5.3 Codex → GPT-5.4 (Copilot) | Requires GPT access. GPT-5.4 via Copilot as fallback. The craftsman. |
|
| **Hephaestus** | Autonomous deep worker | GPT-5.3 Codex only | No fallback. Requires GPT access. The craftsman. |
|
||||||
| **Oracle** | Architecture consultant | GPT-5.4 → Gemini 3.1 Pro → Claude Opus → opencode-go/glm-5 | Read-only high-IQ consultation. |
|
| **Oracle** | Architecture consultant | GPT-5.4 → Gemini 3.1 Pro → Claude Opus | Read-only high-IQ consultation. |
|
||||||
| **Momus** | Ruthless reviewer | GPT-5.4 → Claude Opus → Gemini 3.1 Pro → opencode-go/glm-5 | Verification and plan review. GPT-5.4 uses xhigh variant. |
|
| **Momus** | Ruthless reviewer | GPT-5.4 → Claude Opus → Gemini 3.1 Pro | Verification and plan review. |
|
||||||
|
|
||||||
### Utility Runners → Speed over Intelligence
|
### Utility Runners → Speed over Intelligence
|
||||||
|
|
||||||
@@ -95,7 +95,6 @@ These agents do grep, search, and retrieval. They intentionally use the fastest,
|
|||||||
| **Explore** | Fast codebase grep | Grok Code Fast → opencode-go/minimax-m2.5 → MiniMax Free → Haiku → GPT-5-Nano | Speed is everything. Fire 10 in parallel. |
|
| **Explore** | Fast codebase grep | Grok Code Fast → opencode-go/minimax-m2.5 → MiniMax Free → Haiku → GPT-5-Nano | Speed is everything. Fire 10 in parallel. |
|
||||||
| **Librarian** | Docs/code search | opencode-go/minimax-m2.5 → MiniMax Free → Haiku → GPT-5-Nano | Doc retrieval doesn't need deep reasoning. |
|
| **Librarian** | Docs/code search | opencode-go/minimax-m2.5 → MiniMax Free → Haiku → GPT-5-Nano | Doc retrieval doesn't need deep reasoning. |
|
||||||
| **Multimodal Looker** | Vision/screenshots | GPT-5.4 → opencode-go/kimi-k2.5 → GLM-4.6v → GPT-5-Nano | Uses the first available multimodal-capable fallback. |
|
| **Multimodal Looker** | Vision/screenshots | GPT-5.4 → opencode-go/kimi-k2.5 → GLM-4.6v → GPT-5-Nano | Uses the first available multimodal-capable fallback. |
|
||||||
| **Sisyphus-Junior** | Category executor | Claude Sonnet → opencode-go/kimi-k2.5 → GPT-5.4 → Big Pickle | Handles delegated category tasks. Sonnet-tier default. |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -120,7 +119,8 @@ Principle-driven, explicit reasoning, deep technical capability. Best for agents
|
|||||||
| Model | Strengths |
|
| Model | Strengths |
|
||||||
| ----------------- | ----------------------------------------------------------------------------------------------- |
|
| ----------------- | ----------------------------------------------------------------------------------------------- |
|
||||||
| **GPT-5.3 Codex** | Deep coding powerhouse. Autonomous exploration. Required for Hephaestus. |
|
| **GPT-5.3 Codex** | Deep coding powerhouse. Autonomous exploration. Required for Hephaestus. |
|
||||||
| **GPT-5.4** | High intelligence, strategic reasoning. Default for Oracle, Momus, and a key fallback for Prometheus / Atlas. Uses xhigh variant for Momus. |
|
| **GPT-5.4** | High intelligence, strategic reasoning. Default for Oracle. |
|
||||||
|
| **GPT-5.4** | Strong principle-driven reasoning. Default for Momus and a key fallback for Prometheus / Atlas. |
|
||||||
| **GPT-5-Nano** | Ultra-cheap, fast. Good for simple utility tasks. |
|
| **GPT-5-Nano** | Ultra-cheap, fast. Good for simple utility tasks. |
|
||||||
|
|
||||||
### Other Models
|
### Other Models
|
||||||
@@ -166,14 +166,14 @@ When agents delegate work, they don't pick a model name — they pick a **catego
|
|||||||
|
|
||||||
| Category | When Used | Fallback Chain |
|
| Category | When Used | Fallback Chain |
|
||||||
| -------------------- | -------------------------- | -------------------------------------------- |
|
| -------------------- | -------------------------- | -------------------------------------------- |
|
||||||
| `visual-engineering` | Frontend, UI, CSS, design | Gemini 3.1 Pro → GLM 5 → Claude Opus → opencode-go/glm-5 → K2P5 |
|
| `visual-engineering` | Frontend, UI, CSS, design | Gemini 3.1 Pro → GLM 5 → Claude Opus |
|
||||||
| `ultrabrain` | Maximum reasoning needed | GPT-5.4 → Gemini 3.1 Pro → Claude Opus → opencode-go/glm-5 |
|
| `ultrabrain` | Maximum reasoning needed | GPT-5.4 → Gemini 3.1 Pro → Claude Opus |
|
||||||
| `deep` | Deep coding, complex logic | GPT-5.3 Codex → Claude Opus → Gemini 3.1 Pro |
|
| `deep` | Deep coding, complex logic | GPT-5.3 Codex → Claude Opus → Gemini 3.1 Pro |
|
||||||
| `artistry` | Creative, novel approaches | Gemini 3.1 Pro → Claude Opus → GPT-5.4 |
|
| `artistry` | Creative, novel approaches | Gemini 3.1 Pro → Claude Opus → GPT-5.4 |
|
||||||
| `quick` | Simple, fast tasks | Claude Haiku → Gemini Flash → opencode-go/minimax-m2.5 → GPT-5-Nano |
|
| `quick` | Simple, fast tasks | Claude Haiku → Gemini Flash → GPT-5-Nano |
|
||||||
| `unspecified-high` | General complex work | Claude Opus → GPT-5.4 → GLM 5 → K2P5 → opencode-go/glm-5 → Kimi K2.5 |
|
| `unspecified-high` | General complex work | Claude Opus → GPT-5.4 (high) → GLM 5 → K2P5 |
|
||||||
| `unspecified-low` | General standard work | Claude Sonnet → GPT-5.3 Codex → opencode-go/kimi-k2.5 → Gemini Flash |
|
| `unspecified-low` | General standard work | Claude Sonnet → GPT-5.3 Codex → Gemini Flash |
|
||||||
| `writing` | Text, docs, prose | Gemini Flash → opencode-go/kimi-k2.5 → Claude Sonnet |
|
| `writing` | Text, docs, prose | Gemini Flash → Claude Sonnet |
|
||||||
|
|
||||||
See the [Orchestration System Guide](./orchestration.md) for how agents dispatch tasks to categories.
|
See the [Orchestration System Guide](./orchestration.md) for how agents dispatch tasks to categories.
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
Paste this into your llm agent session:
|
Paste this into your llm agent session:
|
||||||
|
|
||||||
```
|
```
|
||||||
Install and configure oh-my-opencode by following the instructions here:
|
Install and configure oh-my-openagent by following the instructions here:
|
||||||
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -14,8 +14,8 @@ https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/do
|
|||||||
Run the interactive installer:
|
Run the interactive installer:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx oh-my-opencode install # recommended
|
bunx oh-my-openagent install # recommended
|
||||||
npx oh-my-opencode install # alternative
|
npx oh-my-openagent install # alternative
|
||||||
```
|
```
|
||||||
|
|
||||||
> **Note**: The CLI ships with standalone binaries for all major platforms. No runtime (Bun/Node.js) is required for CLI execution after installation.
|
> **Note**: The CLI ships with standalone binaries for all major platforms. No runtime (Bun/Node.js) is required for CLI execution after installation.
|
||||||
@@ -34,7 +34,7 @@ After you install it, you can read this [overview guide](./overview.md) to under
|
|||||||
> curl -fsSL https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
> curl -fsSL https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
||||||
> ```
|
> ```
|
||||||
|
|
||||||
If you're an LLM Agent helping set up oh-my-opencode, Welcome! You'll now help your user to install the best agent harness, OhMyOpenCode. Tell user this with greetings, with test 'oMoMoMoMo...'
|
If you're an LLM Agent helping set up oh-my-openagent, Welcome! You'll now help your user to install the best agent harness, OhMyOpenAgent. Tell user this with greetings, with test 'oMoMoMoMo...'
|
||||||
|
|
||||||
follow these steps:
|
follow these steps:
|
||||||
|
|
||||||
@@ -96,19 +96,19 @@ Spawn a subagent to handle installation and report back - to save context.
|
|||||||
Based on user's answers, run the CLI installer with appropriate flags:
|
Based on user's answers, run the CLI installer with appropriate flags:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx oh-my-opencode install --no-tui --claude=<yes|no|max20> --gemini=<yes|no> --copilot=<yes|no> [--openai=<yes|no>] [--opencode-go=<yes|no>] [--opencode-zen=<yes|no>] [--zai-coding-plan=<yes|no>]
|
bunx oh-my-openagent install --no-tui --claude=<yes|no|max20> --gemini=<yes|no> --copilot=<yes|no> [--openai=<yes|no>] [--opencode-go=<yes|no>] [--opencode-zen=<yes|no>] [--zai-coding-plan=<yes|no>]
|
||||||
```
|
```
|
||||||
|
|
||||||
**Examples:**
|
**Examples:**
|
||||||
|
|
||||||
- User has all native subscriptions: `bunx oh-my-opencode install --no-tui --claude=max20 --openai=yes --gemini=yes --copilot=no`
|
- User has all native subscriptions: `bunx oh-my-openagent install --no-tui --claude=max20 --openai=yes --gemini=yes --copilot=no`
|
||||||
- User has only Claude: `bunx oh-my-opencode install --no-tui --claude=yes --gemini=no --copilot=no`
|
- User has only Claude: `bunx oh-my-openagent install --no-tui --claude=yes --gemini=no --copilot=no`
|
||||||
- User has Claude + OpenAI: `bunx oh-my-opencode install --no-tui --claude=yes --openai=yes --gemini=no --copilot=no`
|
- User has Claude + OpenAI: `bunx oh-my-openagent install --no-tui --claude=yes --openai=yes --gemini=no --copilot=no`
|
||||||
- User has only GitHub Copilot: `bunx oh-my-opencode install --no-tui --claude=no --gemini=no --copilot=yes`
|
- User has only GitHub Copilot: `bunx oh-my-openagent install --no-tui --claude=no --gemini=no --copilot=yes`
|
||||||
- User has Z.ai for Librarian: `bunx oh-my-opencode install --no-tui --claude=yes --gemini=no --copilot=no --zai-coding-plan=yes`
|
- User has Z.ai for Librarian: `bunx oh-my-openagent install --no-tui --claude=yes --gemini=no --copilot=no --zai-coding-plan=yes`
|
||||||
- User has only OpenCode Zen: `bunx oh-my-opencode install --no-tui --claude=no --gemini=no --copilot=no --opencode-zen=yes`
|
- User has only OpenCode Zen: `bunx oh-my-openagent install --no-tui --claude=no --gemini=no --copilot=no --opencode-zen=yes`
|
||||||
- User has OpenCode Go only: `bunx oh-my-opencode install --no-tui --claude=no --openai=no --gemini=no --copilot=no --opencode-go=yes`
|
- User has OpenCode Go only: `bunx oh-my-openagent install --no-tui --claude=no --openai=no --gemini=no --copilot=no --opencode-go=yes`
|
||||||
- User has no subscriptions: `bunx oh-my-opencode install --no-tui --claude=no --gemini=no --copilot=no`
|
- User has no subscriptions: `bunx oh-my-openagent install --no-tui --claude=no --gemini=no --copilot=no`
|
||||||
|
|
||||||
The CLI will:
|
The CLI will:
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ The CLI will:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
opencode --version # Should be 1.0.150 or higher
|
opencode --version # Should be 1.0.150 or higher
|
||||||
cat ~/.config/opencode/opencode.json # Should contain "oh-my-opencode" in plugin array
|
cat ~/.config/opencode/opencode.json # Should contain "oh-my-openagent" in plugin array
|
||||||
```
|
```
|
||||||
|
|
||||||
### Step 4: Configure Authentication
|
### Step 4: Configure Authentication
|
||||||
@@ -145,7 +145,7 @@ First, add the opencode-antigravity-auth plugin:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"plugin": ["oh-my-opencode", "opencode-antigravity-auth@latest"]
|
"plugin": ["oh-my-openagent", "opencode-antigravity-auth@latest"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ First, add the opencode-antigravity-auth plugin:
|
|||||||
You'll also need full model settings in `opencode.json`.
|
You'll also need full model settings in `opencode.json`.
|
||||||
Read the [opencode-antigravity-auth documentation](https://github.com/NoeFabris/opencode-antigravity-auth), copy the full model configuration from the README, and merge carefully to avoid breaking the user's existing setup. The plugin now uses a **variant system** — models like `antigravity-gemini-3-pro` support `low`/`high` variants instead of separate `-low`/`-high` model entries.
|
Read the [opencode-antigravity-auth documentation](https://github.com/NoeFabris/opencode-antigravity-auth), copy the full model configuration from the README, and merge carefully to avoid breaking the user's existing setup. The plugin now uses a **variant system** — models like `antigravity-gemini-3-pro` support `low`/`high` variants instead of separate `-low`/`-high` model entries.
|
||||||
|
|
||||||
##### oh-my-opencode Agent Model Override
|
##### oh-my-openagent Agent Model Override
|
||||||
|
|
||||||
The `opencode-antigravity-auth` plugin uses different model names than the built-in Google auth. Override the agent models in `oh-my-opencode.json` (or `.opencode/oh-my-opencode.json`):
|
The `opencode-antigravity-auth` plugin uses different model names than the built-in Google auth. Override the agent models in `oh-my-opencode.json` (or `.opencode/oh-my-opencode.json`):
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ GitHub Copilot is supported as a **fallback provider** when native providers are
|
|||||||
|
|
||||||
##### Model Mappings
|
##### Model Mappings
|
||||||
|
|
||||||
When GitHub Copilot is the best available provider, oh-my-opencode uses these model assignments:
|
When GitHub Copilot is the best available provider, oh-my-openagent uses these model assignments:
|
||||||
|
|
||||||
| Agent | Model |
|
| Agent | Model |
|
||||||
| ------------- | --------------------------------- |
|
| ------------- | --------------------------------- |
|
||||||
@@ -243,7 +243,7 @@ When OpenCode Zen is the best available provider (no native or Copilot), these m
|
|||||||
Run the installer and select "Yes" for GitHub Copilot:
|
Run the installer and select "Yes" for GitHub Copilot:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx oh-my-opencode install
|
bunx oh-my-openagent install
|
||||||
# Select your subscriptions (Claude, ChatGPT, Gemini)
|
# Select your subscriptions (Claude, ChatGPT, Gemini)
|
||||||
# When prompted: "Do you have a GitHub Copilot subscription?" → Select "Yes"
|
# When prompted: "Do you have a GitHub Copilot subscription?" → Select "Yes"
|
||||||
```
|
```
|
||||||
@@ -251,7 +251,7 @@ bunx oh-my-opencode install
|
|||||||
Or use non-interactive mode:
|
Or use non-interactive mode:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx oh-my-opencode install --no-tui --claude=no --openai=no --gemini=no --copilot=yes
|
bunx oh-my-openagent install --no-tui --claude=no --openai=no --gemini=no --copilot=yes
|
||||||
```
|
```
|
||||||
|
|
||||||
Then authenticate with GitHub:
|
Then authenticate with GitHub:
|
||||||
@@ -263,7 +263,7 @@ opencode auth login
|
|||||||
|
|
||||||
### Step 5: Understand Your Model Setup
|
### Step 5: Understand Your Model Setup
|
||||||
|
|
||||||
You've just configured oh-my-opencode. Here's what got set up and why.
|
You've just configured oh-my-openagent. Here's what got set up and why.
|
||||||
|
|
||||||
#### Model Families: What You're Working With
|
#### Model Families: What You're Working With
|
||||||
|
|
||||||
@@ -305,7 +305,7 @@ Not all models behave the same way. Understanding which models are "similar" hel
|
|||||||
| **Grok Code Fast 1** | github-copilot, venice | Very fast | Optimized for code grep/search. Default for Explore. |
|
| **Grok Code Fast 1** | github-copilot, venice | Very fast | Optimized for code grep/search. Default for Explore. |
|
||||||
| **Claude Haiku 4.5** | anthropic, opencode | Fast | Good balance of speed and intelligence. |
|
| **Claude Haiku 4.5** | anthropic, opencode | Fast | Good balance of speed and intelligence. |
|
||||||
| **MiniMax M2.5 (Free)** | opencode, venice | Fast | Smart for its speed class. |
|
| **MiniMax M2.5 (Free)** | opencode, venice | Fast | Smart for its speed class. |
|
||||||
| **GPT-5.3-codex-spark** | openai | Extremely fast | Blazing fast but compacts so aggressively that oh-my-opencode's context management doesn't work well with it. Not recommended for omo agents. |
|
| **GPT-5.3-codex-spark** | openai | Extremely fast | Blazing fast but compacts so aggressively that oh-my-openagent's context management doesn't work well with it. Not recommended for omo agents. |
|
||||||
|
|
||||||
#### What Each Agent Does and Which Model It Got
|
#### What Each Agent Does and Which Model It Got
|
||||||
|
|
||||||
@@ -344,8 +344,8 @@ These agents do search, grep, and retrieval. They intentionally use fast, cheap
|
|||||||
| Agent | Role | Default Chain | Design Rationale |
|
| Agent | Role | Default Chain | Design Rationale |
|
||||||
| --------------------- | ------------------ | ---------------------------------------------------------------------- | -------------------------------------------------------------- |
|
| --------------------- | ------------------ | ---------------------------------------------------------------------- | -------------------------------------------------------------- |
|
||||||
| **Explore** | Fast codebase grep | MiniMax M2.5 Free → Grok Code Fast → MiniMax M2.5 → Haiku → GPT-5-Nano | Speed is everything. Grok is blazing fast for grep. |
|
| **Explore** | Fast codebase grep | MiniMax M2.5 Free → Grok Code Fast → MiniMax M2.5 → Haiku → GPT-5-Nano | Speed is everything. Grok is blazing fast for grep. |
|
||||||
| **Librarian** | Docs/code search | MiniMax M2.5 Free → Gemini Flash → Big Pickle | Entirely free-tier. Doc retrieval doesn't need deep reasoning. |
|
| **Librarian** | Docs/code search | MiniMax M2.5 → MiniMax Free → Haiku → Nano | Fast, cheap models for search. |
|
||||||
| **Multimodal Looker** | Vision/screenshots | Kimi K2.5 → Kimi Free → Gemini Flash → GPT-5.4 → GLM-4.6v | Kimi excels at multimodal understanding. |
|
| **Multimodal Looker** | Vision/screenshots | GPT-5.4 → Kimi K2.5 → GLM-4.6v → GPT-5-Nano | Strong vision capabilities. |
|
||||||
|
|
||||||
#### Why Different Models Need Different Prompts
|
#### Why Different Models Need Different Prompts
|
||||||
|
|
||||||
@@ -406,7 +406,7 @@ GPT (5.3-codex, 5.2) > Claude Opus (decent fallback) > Gemini (acceptable)
|
|||||||
|
|
||||||
#### Provider Priority Chain
|
#### Provider Priority Chain
|
||||||
|
|
||||||
When multiple providers are available, oh-my-opencode uses this priority:
|
When multiple providers are available, oh-my-openagent uses this priority:
|
||||||
|
|
||||||
```
|
```
|
||||||
Native (anthropic/, openai/, google/) > Kimi for Coding > GitHub Copilot > Venice > OpenCode Zen > Z.ai Coding Plan
|
Native (anthropic/, openai/, google/) > Kimi for Coding > GitHub Copilot > Venice > OpenCode Zen > Z.ai Coding Plan
|
||||||
@@ -424,7 +424,7 @@ Read this document again, think about you have done everything correctly.
|
|||||||
|
|
||||||
#### Say 'Congratulations! 🎉' to the user
|
#### Say 'Congratulations! 🎉' to the user
|
||||||
|
|
||||||
Say to user: Congratulations! 🎉 You have successfully set up OhMyOpenCode! Type `opencode` in your terminal to start using it.
|
Say to user: Congratulations! 🎉 You have successfully set up OhMyOpenAgent! Type `opencode` in your terminal to start using it.
|
||||||
|
|
||||||
#### Free advertising
|
#### Free advertising
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Orchestration System Guide
|
# Orchestration System Guide
|
||||||
|
|
||||||
Oh My OpenCode's orchestration system transforms a simple AI agent into a coordinated development team through **separation of planning and execution**.
|
Oh My OpenAgent's orchestration system transforms a simple AI agent into a coordinated development team through **separation of planning and execution**.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# What Is Oh My OpenCode?
|
# What Is Oh My OpenAgent?
|
||||||
|
|
||||||
Oh My OpenCode is a multi-model agent orchestration harness for OpenCode. It transforms a single AI agent into a coordinated development team that actually ships code.
|
Oh My OpenAgent is a multi-model agent orchestration harness for OpenCode. It transforms a single AI agent into a coordinated development team that actually ships code.
|
||||||
|
|
||||||
Not locked to Claude. Not locked to OpenAI. Not locked to anyone.
|
Not locked to Claude. Not locked to OpenAI. Not locked to anyone.
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ Just better results, cheaper models, real orchestration.
|
|||||||
Paste this into your LLM agent session:
|
Paste this into your LLM agent session:
|
||||||
|
|
||||||
```
|
```
|
||||||
Install and configure oh-my-opencode by following the instructions here:
|
Install and configure oh-my-openagent by following the instructions here:
|
||||||
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/refs/heads/dev/docs/guide/installation.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -41,13 +41,13 @@ We used to call this "Claude Code on steroids." That was wrong.
|
|||||||
|
|
||||||
This isn't about making Claude Code better. It's about breaking free from the idea that one model, one provider, one way of working is enough. Anthropic wants you locked in. OpenAI wants you locked in. Everyone wants you locked in.
|
This isn't about making Claude Code better. It's about breaking free from the idea that one model, one provider, one way of working is enough. Anthropic wants you locked in. OpenAI wants you locked in. Everyone wants you locked in.
|
||||||
|
|
||||||
Oh My OpenCode doesn't play that game. It orchestrates across models, picking the right brain for the right job. Claude for orchestration. GPT for deep reasoning. Gemini for frontend. Haiku for quick tasks. All working together, automatically.
|
Oh My OpenAgent doesn't play that game. It orchestrates across models, picking the right brain for the right job. Claude for orchestration. GPT for deep reasoning. Gemini for frontend. Haiku for quick tasks. All working together, automatically.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## How It Works: Agent Orchestration
|
## How It Works: Agent Orchestration
|
||||||
|
|
||||||
Instead of one agent doing everything, Oh My OpenCode uses **specialized agents that delegate to each other** based on task type.
|
Instead of one agent doing everything, Oh My OpenAgent uses **specialized agents that delegate to each other** based on task type.
|
||||||
|
|
||||||
**The Architecture:**
|
**The Architecture:**
|
||||||
|
|
||||||
@@ -60,10 +60,11 @@ User Request
|
|||||||
↓
|
↓
|
||||||
├─→ [Prometheus] — Strategic planning (interview mode)
|
├─→ [Prometheus] — Strategic planning (interview mode)
|
||||||
├─→ [Atlas] — Todo orchestration and execution
|
├─→ [Atlas] — Todo orchestration and execution
|
||||||
├─→ [Oracle] — Architecture consultation
|
├─→ [Specialist Subagents]
|
||||||
├─→ [Librarian] — Documentation/code search
|
│ ├─→ [Oracle] — Architecture consultation
|
||||||
├─→ [Explore] — Fast codebase grep
|
│ ├─→ [Librarian] — Documentation/code search
|
||||||
└─→ [Category-based agents] — Specialized by task type
|
│ └─→ [Explore] — Fast codebase grep
|
||||||
|
└─→ [Sisyphus-Junior] — Category-based executor
|
||||||
```
|
```
|
||||||
|
|
||||||
When Sisyphus delegates to a subagent, it doesn't pick a model name. It picks a **category** — `visual-engineering`, `ultrabrain`, `quick`, `deep`. The category automatically maps to the right model. You touch nothing.
|
When Sisyphus delegates to a subagent, it doesn't pick a model name. It picks a **category** — `visual-engineering`, `ultrabrain`, `quick`, `deep`. The category automatically maps to the right model. You touch nothing.
|
||||||
@@ -116,17 +117,20 @@ Atlas executes Prometheus plans. Distributes tasks to specialized subagents. Acc
|
|||||||
|
|
||||||
Run `/start-work` to activate Atlas on your latest plan.
|
Run `/start-work` to activate Atlas on your latest plan.
|
||||||
|
|
||||||
### Oracle: The Consultant
|
### Sisyphus-Junior: The Specialist
|
||||||
|
|
||||||
Read-only high-IQ consultant for architecture decisions and complex debugging. Consult Oracle when facing unfamiliar patterns, security concerns, or multi-system tradeoffs.
|
When Sisyphus delegates a task via a specific **Category** (like `visual-engineering` or `deep`), **Sisyphus-Junior** is the agent that performs it. It is optimized for focused execution within a specific domain and cannot re-delegate, preventing infinite loops.
|
||||||
|
|
||||||
### Supporting Cast
|
### Specialist Subagents
|
||||||
|
|
||||||
|
These agents are primarily designed to be called by other agents or for specific queries, rather than managing a full workflow.
|
||||||
|
|
||||||
|
- **Oracle** — Read-only high-IQ consultant for architecture decisions and complex debugging.
|
||||||
|
- **Librarian** — Documentation and OSS code search. Stays current on library APIs and best practices.
|
||||||
|
- **Explore** — Fast codebase grep. Uses speed-focused models for pattern discovery.
|
||||||
|
- **Multimodal Looker** — Vision and screenshot analysis.
|
||||||
- **Metis** — Gap analyzer. Catches what Prometheus missed before plans are finalized.
|
- **Metis** — Gap analyzer. Catches what Prometheus missed before plans are finalized.
|
||||||
- **Momus** — Ruthless reviewer. Validates plans against clarity, verification, and context criteria.
|
- **Momus** — Ruthless reviewer. Validates plans against clarity, verification, and context criteria.
|
||||||
- **Explore** — Fast codebase grep. Uses speed-focused models for pattern discovery.
|
|
||||||
- **Librarian** — Documentation and OSS code search. Stays current on library APIs and best practices.
|
|
||||||
- **Multimodal Looker** — Vision and screenshot analysis.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -154,7 +158,7 @@ Use Prometheus for multi-day projects, critical production changes, complex refa
|
|||||||
|
|
||||||
## Agent Model Matching
|
## Agent Model Matching
|
||||||
|
|
||||||
Different agents work best with different models. Oh My OpenCode automatically assigns optimal models, but you can customize everything.
|
Different agents work best with different models. Oh My OpenAgent automatically assigns optimal models, but you can customize everything.
|
||||||
|
|
||||||
### Default Configuration
|
### Default Configuration
|
||||||
|
|
||||||
@@ -232,7 +236,7 @@ See the [Agent-Model Matching Guide](./agent-model-matching.md) for complete det
|
|||||||
|
|
||||||
Claude Code is good. But it's a single agent running a single model doing everything alone.
|
Claude Code is good. But it's a single agent running a single model doing everything alone.
|
||||||
|
|
||||||
Oh My OpenCode turns that into a coordinated team:
|
Oh My OpenAgent turns that into a coordinated team:
|
||||||
|
|
||||||
**Parallel execution.** Claude Code processes one thing at a time. OmO fires background agents in parallel — research, implementation, and verification happening simultaneously. Like having 5 engineers instead of 1.
|
**Parallel execution.** Claude Code processes one thing at a time. OmO fires background agents in parallel — research, implementation, and verification happening simultaneously. Like having 5 engineers instead of 1.
|
||||||
|
|
||||||
@@ -246,7 +250,7 @@ Oh My OpenCode turns that into a coordinated team:
|
|||||||
|
|
||||||
**Discipline enforcement.** Todo enforcer yanks idle agents back to work. Comment checker strips AI slop. Ralph Loop keeps going until 100% done. The system doesn't let the agent slack off.
|
**Discipline enforcement.** Todo enforcer yanks idle agents back to work. Comment checker strips AI slop. Ralph Loop keeps going until 100% done. The system doesn't let the agent slack off.
|
||||||
|
|
||||||
**The fundamental advantage.** Models have different temperaments. Claude thinks deeply. GPT reasons architecturally. Gemini visualizes. Haiku moves fast. Single-model tools force you to pick one personality for all tasks. Oh My OpenCode leverages them all, routing by task type. This isn't a temporary hack — it's the only architecture that makes sense as models specialize further. The gap between multi-model orchestration and single-model limitation widens every month. We're betting on that future.
|
**The fundamental advantage.** Models have different temperaments. Claude thinks deeply. GPT reasons architecturally. Gemini visualizes. Haiku moves fast. Single-model tools force you to pick one personality for all tasks. Oh My OpenAgent leverages them all, routing by task type. This isn't a temporary hack — it's the only architecture that makes sense as models specialize further. The gap between multi-model orchestration and single-model limitation widens every month. We're betting on that future.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -256,7 +260,7 @@ Before acting on any request, Sisyphus classifies your true intent.
|
|||||||
|
|
||||||
Are you asking for research? Implementation? Investigation? A fix? The Intent Gate figures out what you actually want, not just the literal words you typed. This means the agent understands context, nuance, and the real goal behind your request.
|
Are you asking for research? Implementation? Investigation? A fix? The Intent Gate figures out what you actually want, not just the literal words you typed. This means the agent understands context, nuance, and the real goal behind your request.
|
||||||
|
|
||||||
Claude Code doesn't have this. It takes your prompt and runs. Oh My OpenCode thinks first, then acts.
|
Claude Code doesn't have this. It takes your prompt and runs. Oh My OpenAgent thinks first, then acts.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Manifesto
|
# Manifesto
|
||||||
|
|
||||||
The principles and philosophy behind Oh My OpenCode.
|
The principles and philosophy behind Oh My OpenAgent.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ When you find yourself:
|
|||||||
|
|
||||||
That's not "human-AI collaboration." That's the AI failing to do its job.
|
That's not "human-AI collaboration." That's the AI failing to do its job.
|
||||||
|
|
||||||
**Oh My OpenCode is built on this premise**: Human intervention during agentic work is fundamentally a wrong signal. If the system is designed correctly, the agent should complete the work without requiring you to babysit it.
|
**Oh My OpenAgent is built on this premise**: Human intervention during agentic work is fundamentally a wrong signal. If the system is designed correctly, the agent should complete the work without requiring you to babysit it.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -144,7 +144,7 @@ Human Intent → Agent Execution → Verified Result
|
|||||||
(intervention only on true failure)
|
(intervention only on true failure)
|
||||||
```
|
```
|
||||||
|
|
||||||
Everything in Oh My OpenCode is designed to make this loop work:
|
Everything in Oh My OpenAgent is designed to make this loop work:
|
||||||
|
|
||||||
| Feature | Purpose |
|
| Feature | Purpose |
|
||||||
|---------|---------|
|
|---------|---------|
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
# CLI Reference
|
# CLI Reference
|
||||||
|
|
||||||
Complete reference for the `oh-my-opencode` command-line interface.
|
Complete reference for the `oh-my-openagent` command-line interface.
|
||||||
|
|
||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Display help
|
# Display help
|
||||||
bunx oh-my-opencode
|
bunx oh-my-openagent
|
||||||
|
|
||||||
# Or with npx
|
# Or with npx
|
||||||
npx oh-my-opencode
|
npx oh-my-openagent
|
||||||
```
|
```
|
||||||
|
|
||||||
## Commands
|
## Commands
|
||||||
@@ -32,7 +32,7 @@ Interactive installation tool for initial Oh-My-OpenCode setup. Provides a TUI b
|
|||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx oh-my-opencode install
|
bunx oh-my-openagent install
|
||||||
```
|
```
|
||||||
|
|
||||||
### Installation Process
|
### Installation Process
|
||||||
@@ -40,7 +40,7 @@ bunx oh-my-opencode install
|
|||||||
1. **Provider Selection**: Choose your AI provider (Claude, ChatGPT, or Gemini)
|
1. **Provider Selection**: Choose your AI provider (Claude, ChatGPT, or Gemini)
|
||||||
2. **API Key Input**: Enter the API key for your selected provider
|
2. **API Key Input**: Enter the API key for your selected provider
|
||||||
3. **Configuration File Creation**: Generates `opencode.json` or `oh-my-opencode.json` files
|
3. **Configuration File Creation**: Generates `opencode.json` or `oh-my-opencode.json` files
|
||||||
4. **Plugin Registration**: Automatically registers the oh-my-opencode plugin in OpenCode settings
|
4. **Plugin Registration**: Automatically registers the oh-my-openagent plugin in OpenCode settings
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ Diagnoses your environment to ensure Oh-My-OpenCode is functioning correctly. Pe
|
|||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx oh-my-opencode doctor
|
bunx oh-my-openagent doctor
|
||||||
```
|
```
|
||||||
|
|
||||||
### Diagnostic Categories
|
### Diagnostic Categories
|
||||||
@@ -83,7 +83,7 @@ bunx oh-my-opencode doctor
|
|||||||
### Example Output
|
### Example Output
|
||||||
|
|
||||||
```
|
```
|
||||||
oh-my-opencode doctor
|
oh-my-openagent doctor
|
||||||
|
|
||||||
┌──────────────────────────────────────────────────┐
|
┌──────────────────────────────────────────────────┐
|
||||||
│ Oh-My-OpenCode Doctor │
|
│ Oh-My-OpenCode Doctor │
|
||||||
@@ -119,7 +119,7 @@ Executes OpenCode sessions and monitors task completion.
|
|||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx oh-my-opencode run [prompt]
|
bunx oh-my-openagent run [prompt]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
@@ -148,16 +148,16 @@ Manages OAuth 2.1 authentication for remote MCP servers.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Login to an OAuth-protected MCP server
|
# Login to an OAuth-protected MCP server
|
||||||
bunx oh-my-opencode mcp oauth login <server-name> --server-url https://api.example.com
|
bunx oh-my-openagent mcp oauth login <server-name> --server-url https://api.example.com
|
||||||
|
|
||||||
# Login with explicit client ID and scopes
|
# Login with explicit client ID and scopes
|
||||||
bunx oh-my-opencode mcp oauth login my-api --server-url https://api.example.com --client-id my-client --scopes "read,write"
|
bunx oh-my-openagent mcp oauth login my-api --server-url https://api.example.com --client-id my-client --scopes "read,write"
|
||||||
|
|
||||||
# Remove stored OAuth tokens
|
# Remove stored OAuth tokens
|
||||||
bunx oh-my-opencode mcp oauth logout <server-name>
|
bunx oh-my-openagent mcp oauth logout <server-name>
|
||||||
|
|
||||||
# Check OAuth token status
|
# Check OAuth token status
|
||||||
bunx oh-my-opencode mcp oauth status [server-name]
|
bunx oh-my-openagent mcp oauth status [server-name]
|
||||||
```
|
```
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
@@ -219,17 +219,17 @@ bun install -g opencode@latest
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Reinstall plugin
|
# Reinstall plugin
|
||||||
bunx oh-my-opencode install
|
bunx oh-my-openagent install
|
||||||
```
|
```
|
||||||
|
|
||||||
### Doctor Check Failures
|
### Doctor Check Failures
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Diagnose with detailed information
|
# Diagnose with detailed information
|
||||||
bunx oh-my-opencode doctor --verbose
|
bunx oh-my-openagent doctor --verbose
|
||||||
|
|
||||||
# Check specific category only
|
# Check specific category only
|
||||||
bunx oh-my-opencode doctor --category authentication
|
bunx oh-my-openagent doctor --category authentication
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -240,10 +240,10 @@ Use the `--no-tui` option for CI/CD environments.
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run doctor in CI environment
|
# Run doctor in CI environment
|
||||||
bunx oh-my-opencode doctor --no-tui --json
|
bunx oh-my-openagent doctor --no-tui --json
|
||||||
|
|
||||||
# Save results to file
|
# Save results to file
|
||||||
bunx oh-my-opencode doctor --json > doctor-report.json
|
bunx oh-my-openagent doctor --json > doctor-report.json
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ Enable schema autocomplete:
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Run `bunx oh-my-opencode install` for guided setup. Run `opencode models` to list available models.
|
Run `bunx oh-my-openagent install` for guided setup. Run `opencode models` to list available models.
|
||||||
|
|
||||||
### Quick Start Example
|
### Quick Start Example
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ Disable categories: `{ "disabled_categories": ["ultrabrain"] }`
|
|||||||
| **unspecified-high** | `claude-opus-4-6` | `claude-opus-4-6` → `gpt-5.4 (high)` → `glm-5` → `k2p5` → `kimi-k2.5` |
|
| **unspecified-high** | `claude-opus-4-6` | `claude-opus-4-6` → `gpt-5.4 (high)` → `glm-5` → `k2p5` → `kimi-k2.5` |
|
||||||
| **writing** | `gemini-3-flash` | `gemini-3-flash` → `claude-sonnet-4-6` |
|
| **writing** | `gemini-3-flash` | `gemini-3-flash` → `claude-sonnet-4-6` |
|
||||||
|
|
||||||
Run `bunx oh-my-opencode doctor --verbose` to see effective model resolution for your config.
|
Run `bunx oh-my-openagent doctor --verbose` to see effective model resolution for your config.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -4,31 +4,26 @@
|
|||||||
|
|
||||||
Oh-My-OpenCode provides 11 specialized AI agents. Each has distinct expertise, optimized models, and tool permissions.
|
Oh-My-OpenCode provides 11 specialized AI agents. Each has distinct expertise, optimized models, and tool permissions.
|
||||||
|
|
||||||
### Core Agents
|
### Primary Agents
|
||||||
|
|
||||||
| Agent | Model | Purpose |
|
| Agent | Model | Purpose |
|
||||||
| --------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **Sisyphus** | `claude-opus-4-6` | The default orchestrator. Plans, delegates, and executes complex tasks using specialized subagents with aggressive parallel execution. Todo-driven workflow with extended thinking (32k budget). Fallback: `glm-5` → `big-pickle`. |
|
| **Sisyphus** | `claude-opus-4-6` | The default orchestrator. Plans, delegates, and executes complex tasks using specialized subagents with aggressive parallel execution. Todo-driven workflow with extended thinking (32k budget). Fallback: `kimi-k2.5` → `glm-5`. |
|
||||||
| **Hephaestus** | `gpt-5.3-codex` | The Legitimate Craftsman. Autonomous deep worker inspired by AmpCode's deep mode. Goal-oriented execution with thorough research before action. Explores codebase patterns, completes tasks end-to-end without premature stopping. Named after the Greek god of forge and craftsmanship. Fallback: `gpt-5.4` on GitHub Copilot. Requires a GPT-capable provider. |
|
| **Hephaestus** | `gpt-5.3-codex` | The Legitimate Craftsman. Autonomous deep worker. Goal-oriented execution with thorough research before action. Explores codebase patterns, completes tasks end-to-end. Fallback: `gpt-5.4` on GitHub Copilot. Requires a GPT-capable provider. |
|
||||||
| **Oracle** | `gpt-5.4` | Architecture decisions, code review, debugging. Read-only consultation with stellar logical reasoning and deep analysis. Inspired by AmpCode. Fallback: `gemini-3.1-pro` → `claude-opus-4-6`. |
|
| **Prometheus** | `claude-opus-4-6` | Strategic planner with interview mode. Creates detailed work plans through iterative questioning. Fallback: `gpt-5.4` → `gemini-3.1-pro`. |
|
||||||
| **Librarian** | `gemini-3-flash` | Multi-repo analysis, documentation lookup, OSS implementation examples. Deep codebase understanding with evidence-based answers. Fallback: `minimax-m2.5-free` → `big-pickle`. |
|
| **Atlas** | `claude-sonnet-4-6`| Executor. Takes the plan from Prometheus and drives it to completion, managing the todo list and coordinating subagents. Fallback: `gpt-5.4` (medium). |
|
||||||
| **Explore** | `grok-code-fast-1` | Fast codebase exploration and contextual grep. Fallback: `minimax-m2.5-free` → `claude-haiku-4-5` → `gpt-5-nano`. |
|
| **Sisyphus-Junior** | _(category-dependent)_ | Category-spawned executor. Model is selected automatically based on the task category. Used when the main agent delegates work via the `task` tool. |
|
||||||
| **Multimodal-Looker** | `gpt-5.3-codex` | Visual content specialist. Analyzes PDFs, images, diagrams to extract information. Fallback: `k2p5` → `gemini-3-flash` → `glm-4.6v` → `gpt-5-nano`. |
|
|
||||||
|
|
||||||
### Planning Agents
|
### Specialist Subagents
|
||||||
|
|
||||||
| Agent | Model | Purpose |
|
| Agent | Model | Purpose |
|
||||||
| -------------- | ----------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| **Prometheus** | `claude-opus-4-6` | Strategic planner with interview mode. Creates detailed work plans through iterative questioning. Fallback: `gpt-5.4` → `gemini-3.1-pro`. |
|
| **Oracle** | `gpt-5.4` | Architecture decisions, code review, debugging. Read-only consultation. Fallback: `gemini-3.1-pro` → `claude-opus-4-6`. |
|
||||||
| **Metis** | `claude-opus-4-6` | Plan consultant — pre-planning analysis. Identifies hidden intentions, ambiguities, and AI failure points. Fallback: `gpt-5.4` → `gemini-3.1-pro`. |
|
| **Librarian** | `minimax-m2.5` | Multi-repo analysis, documentation lookup, OSS implementation examples. Fallback: `minimax-m2.5-free` → `claude-haiku-4-5` → `gpt-5-nano`. |
|
||||||
| **Momus** | `gpt-5.4` | Plan reviewer — validates plans against clarity, verifiability, and completeness standards. Fallback: `claude-opus-4-6` → `gemini-3.1-pro`. |
|
| **Explore** | `grok-code-fast-1` | Fast codebase exploration and contextual grep. Fallback: `minimax-m2.5` → `minimax-m2.5-free` → `claude-haiku-4-5`. |
|
||||||
|
| **Multimodal-Looker** | `gpt-5.4` | Visual content specialist. Analyzes PDFs, images, diagrams. Fallback: `kimi-k2.5` → `glm-4.6v` → `gpt-5-nano`. |
|
||||||
### Orchestration Agents
|
| **Metis** | `claude-opus-4-6` | Plan consultant — pre-planning analysis. Identifies hidden intentions, ambiguities, and AI failure points. Fallback: `gpt-5.4` → `gemini-3.1-pro`. |
|
||||||
|
| **Momus** | `gpt-5.4` | Plan reviewer — validates plans against clarity, verifiability, and completeness standards. Fallback: `claude-opus-4-6` → `gemini-3.1-pro`. |
|
||||||
| Agent | Model | Purpose |
|
|
||||||
| ------------------- | ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
||||||
| **Atlas** | `claude-sonnet-4-6` | Todo-list orchestrator. Executes planned tasks systematically, managing todo items and coordinating work. Fallback: `gpt-5.4` (medium). |
|
|
||||||
| **Sisyphus-Junior** | _(category-dependent)_ | Category-spawned executor. Model is selected automatically based on the task category (visual-engineering, quick, deep, etc.). Used when the main agent delegates work via the `task` tool. |
|
|
||||||
|
|
||||||
### Invoking Agents
|
### Invoking Agents
|
||||||
|
|
||||||
@@ -558,7 +553,7 @@ Requires `experimental.task_system: true` in config.
|
|||||||
|
|
||||||
#### Task System Details
|
#### Task System Details
|
||||||
|
|
||||||
**Note on Claude Code Alignment**: This implementation follows Claude Code's internal Task tool signatures (`TaskCreate`, `TaskUpdate`, `TaskList`, `TaskGet`) and field naming conventions (`subject`, `blockedBy`, `blocks`, etc.). However, Anthropic has not published official documentation for these tools. This is Oh My OpenCode's own implementation based on observed Claude Code behavior and internal specifications.
|
**Note on Claude Code Alignment**: This implementation follows Claude Code's internal Task tool signatures (`TaskCreate`, `TaskUpdate`, `TaskList`, `TaskGet`) and field naming conventions (`subject`, `blockedBy`, `blocks`, etc.). However, Anthropic has not published official documentation for these tools. This is Oh My OpenAgent's own implementation based on observed Claude Code behavior and internal specifications.
|
||||||
|
|
||||||
**Task Schema**:
|
**Task Schema**:
|
||||||
|
|
||||||
@@ -848,7 +843,7 @@ When a skill MCP has `oauth` configured:
|
|||||||
Pre-authenticate via CLI:
|
Pre-authenticate via CLI:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx oh-my-opencode mcp oauth login <server-name> --server-url https://api.example.com
|
bunx oh-my-openagent mcp oauth login <server-name> --server-url https://api.example.com
|
||||||
```
|
```
|
||||||
|
|
||||||
## Context Injection
|
## Context Injection
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
### Problem
|
### Problem
|
||||||
|
|
||||||
When using Ollama as a provider with oh-my-opencode agents, you may encounter:
|
When using Ollama as a provider with oh-my-openagent agents, you may encounter:
|
||||||
|
|
||||||
```
|
```
|
||||||
JSON Parse error: Unexpected EOF
|
JSON Parse error: Unexpected EOF
|
||||||
@@ -26,7 +26,7 @@ Claude Code SDK expects a single JSON object, not multiple NDJSON lines, causing
|
|||||||
**Why this happens:**
|
**Why this happens:**
|
||||||
- **Ollama API**: Returns streaming responses as NDJSON by design
|
- **Ollama API**: Returns streaming responses as NDJSON by design
|
||||||
- **Claude Code SDK**: Doesn't properly handle NDJSON responses for tool calls
|
- **Claude Code SDK**: Doesn't properly handle NDJSON responses for tool calls
|
||||||
- **oh-my-opencode**: Passes through the SDK's behavior (can't fix at this layer)
|
- **oh-my-openagent**: Passes through the SDK's behavior (can't fix at this layer)
|
||||||
|
|
||||||
## Solutions
|
## Solutions
|
||||||
|
|
||||||
@@ -114,7 +114,7 @@ curl -s http://localhost:11434/api/chat \
|
|||||||
|
|
||||||
## Related Issues
|
## Related Issues
|
||||||
|
|
||||||
- **oh-my-opencode**: https://github.com/code-yeongyu/oh-my-openagent/issues/1124
|
- **oh-my-openagent**: https://github.com/code-yeongyu/oh-my-openagent/issues/1124
|
||||||
- **Ollama API Docs**: https://github.com/ollama/ollama/blob/main/docs/api.md
|
- **Ollama API Docs**: https://github.com/ollama/ollama/blob/main/docs/api.md
|
||||||
|
|
||||||
## Getting Help
|
## Getting Help
|
||||||
|
|||||||
26
package.json
26
package.json
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "oh-my-opencode",
|
"name": "oh-my-openagent",
|
||||||
"version": "3.11.0",
|
"version": "3.11.0",
|
||||||
"description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
"description": "The Best AI Agent Harness - Batteries-Included OpenCode Plugin with Multi-Model Orchestration, Parallel Background Agents, and Crafted LSP/AST Tools",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
"oh-my-opencode": "bin/oh-my-opencode.js"
|
"oh-my-openagent": "bin/oh-my-opencode.js"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"dist",
|
"dist",
|
||||||
@@ -76,17 +76,17 @@
|
|||||||
"typescript": "^5.7.3"
|
"typescript": "^5.7.3"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"oh-my-opencode-darwin-arm64": "3.11.0",
|
"oh-my-openagent-darwin-arm64": "3.11.0",
|
||||||
"oh-my-opencode-darwin-x64": "3.11.0",
|
"oh-my-openagent-darwin-x64": "3.11.0",
|
||||||
"oh-my-opencode-darwin-x64-baseline": "3.11.0",
|
"oh-my-openagent-darwin-x64-baseline": "3.11.0",
|
||||||
"oh-my-opencode-linux-arm64": "3.11.0",
|
"oh-my-openagent-linux-arm64": "3.11.0",
|
||||||
"oh-my-opencode-linux-arm64-musl": "3.11.0",
|
"oh-my-openagent-linux-arm64-musl": "3.11.0",
|
||||||
"oh-my-opencode-linux-x64": "3.11.0",
|
"oh-my-openagent-linux-x64": "3.11.0",
|
||||||
"oh-my-opencode-linux-x64-baseline": "3.11.0",
|
"oh-my-openagent-linux-x64-baseline": "3.11.0",
|
||||||
"oh-my-opencode-linux-x64-musl": "3.11.0",
|
"oh-my-openagent-linux-x64-musl": "3.11.0",
|
||||||
"oh-my-opencode-linux-x64-musl-baseline": "3.11.0",
|
"oh-my-openagent-linux-x64-musl-baseline": "3.11.0",
|
||||||
"oh-my-opencode-windows-x64": "3.11.0",
|
"oh-my-openagent-windows-x64": "3.11.0",
|
||||||
"oh-my-opencode-windows-x64-baseline": "3.11.0"
|
"oh-my-openagent-windows-x64-baseline": "3.11.0"
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"@opencode-ai/sdk": "^1.2.24"
|
"@opencode-ai/sdk": "^1.2.24"
|
||||||
|
|||||||
@@ -2207,38 +2207,6 @@
|
|||||||
"created_at": "2026-03-16T04:55:10Z",
|
"created_at": "2026-03-16T04:55:10Z",
|
||||||
"repoId": 1108837393,
|
"repoId": 1108837393,
|
||||||
"pullRequestNo": 2604
|
"pullRequestNo": 2604
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "gxlife",
|
|
||||||
"id": 110413359,
|
|
||||||
"comment_id": 4068427047,
|
|
||||||
"created_at": "2026-03-16T15:17:01Z",
|
|
||||||
"repoId": 1108837393,
|
|
||||||
"pullRequestNo": 2625
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "HaD0Yun",
|
|
||||||
"id": 102889891,
|
|
||||||
"comment_id": 4073195308,
|
|
||||||
"created_at": "2026-03-17T08:27:45Z",
|
|
||||||
"repoId": 1108837393,
|
|
||||||
"pullRequestNo": 2640
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "tad-hq",
|
|
||||||
"id": 213478119,
|
|
||||||
"comment_id": 4077697128,
|
|
||||||
"created_at": "2026-03-17T20:07:09Z",
|
|
||||||
"repoId": 1108837393,
|
|
||||||
"pullRequestNo": 2655
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ogormans-deptstack",
|
|
||||||
"id": 208788555,
|
|
||||||
"comment_id": 4077893096,
|
|
||||||
"created_at": "2026-03-17T20:42:42Z",
|
|
||||||
"repoId": 1108837393,
|
|
||||||
"pullRequestNo": 2656
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -10,7 +10,7 @@ Entry point `index.ts` orchestrates 5-step initialization: loadConfig → create
|
|||||||
|
|
||||||
| File | Purpose |
|
| File | Purpose |
|
||||||
|------|---------|
|
|------|---------|
|
||||||
| `index.ts` | Plugin entry, exports `OhMyOpenCodePlugin` |
|
| `index.ts` | Plugin entry, exports `OhMyOpenAgentPlugin` |
|
||||||
| `plugin-config.ts` | JSONC parse, multi-level merge, Zod v4 validation |
|
| `plugin-config.ts` | JSONC parse, multi-level merge, Zod v4 validation |
|
||||||
| `create-managers.ts` | TmuxSessionManager, BackgroundManager, SkillMcpManager, ConfigHandler |
|
| `create-managers.ts` | TmuxSessionManager, BackgroundManager, SkillMcpManager, ConfigHandler |
|
||||||
| `create-tools.ts` | SkillContext + AvailableCategories + ToolRegistry (26 tools) |
|
| `create-tools.ts` | SkillContext + AvailableCategories + ToolRegistry (26 tools) |
|
||||||
|
|||||||
@@ -1,32 +1,20 @@
|
|||||||
import { afterAll, beforeAll, describe, expect, mock, test } from "bun:test"
|
import { afterAll, beforeAll, describe, expect, test } from "bun:test"
|
||||||
import { mkdirSync, rmSync, writeFileSync } from "node:fs"
|
import { mkdirSync, rmSync, writeFileSync } from "node:fs"
|
||||||
import * as os from "node:os"
|
import { homedir, tmpdir } from "node:os"
|
||||||
import { tmpdir } from "node:os"
|
|
||||||
import { join } from "node:path"
|
import { join } from "node:path"
|
||||||
|
import { resolvePromptAppend } from "./resolve-file-uri"
|
||||||
const originalHomedir = os.homedir.bind(os)
|
|
||||||
let mockedHomeDir = ""
|
|
||||||
let moduleImportCounter = 0
|
|
||||||
let resolvePromptAppend: typeof import("./resolve-file-uri").resolvePromptAppend
|
|
||||||
|
|
||||||
mock.module("node:os", () => ({
|
|
||||||
...os,
|
|
||||||
homedir: () => mockedHomeDir || originalHomedir(),
|
|
||||||
}))
|
|
||||||
|
|
||||||
describe("resolvePromptAppend", () => {
|
describe("resolvePromptAppend", () => {
|
||||||
const fixtureRoot = join(tmpdir(), `resolve-file-uri-${Date.now()}`)
|
const fixtureRoot = join(tmpdir(), `resolve-file-uri-${Date.now()}`)
|
||||||
const configDir = join(fixtureRoot, "config")
|
const configDir = join(fixtureRoot, "config")
|
||||||
const homeFixtureRoot = join(fixtureRoot, "home")
|
const homeFixtureDir = join(homedir(), `.resolve-file-uri-home-${Date.now()}`)
|
||||||
const homeFixtureDir = join(homeFixtureRoot, "fixture-home")
|
|
||||||
|
|
||||||
const absoluteFilePath = join(fixtureRoot, "absolute.txt")
|
const absoluteFilePath = join(fixtureRoot, "absolute.txt")
|
||||||
const relativeFilePath = join(configDir, "relative.txt")
|
const relativeFilePath = join(configDir, "relative.txt")
|
||||||
const spacedFilePath = join(fixtureRoot, "with space.txt")
|
const spacedFilePath = join(fixtureRoot, "with space.txt")
|
||||||
const homeFilePath = join(homeFixtureDir, "home.txt")
|
const homeFilePath = join(homeFixtureDir, "home.txt")
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(() => {
|
||||||
mockedHomeDir = homeFixtureRoot
|
|
||||||
mkdirSync(fixtureRoot, { recursive: true })
|
mkdirSync(fixtureRoot, { recursive: true })
|
||||||
mkdirSync(configDir, { recursive: true })
|
mkdirSync(configDir, { recursive: true })
|
||||||
mkdirSync(homeFixtureDir, { recursive: true })
|
mkdirSync(homeFixtureDir, { recursive: true })
|
||||||
@@ -35,14 +23,11 @@ describe("resolvePromptAppend", () => {
|
|||||||
writeFileSync(relativeFilePath, "relative-content", "utf8")
|
writeFileSync(relativeFilePath, "relative-content", "utf8")
|
||||||
writeFileSync(spacedFilePath, "encoded-content", "utf8")
|
writeFileSync(spacedFilePath, "encoded-content", "utf8")
|
||||||
writeFileSync(homeFilePath, "home-content", "utf8")
|
writeFileSync(homeFilePath, "home-content", "utf8")
|
||||||
|
|
||||||
moduleImportCounter += 1
|
|
||||||
;({ resolvePromptAppend } = await import(`./resolve-file-uri?test=${moduleImportCounter}`))
|
|
||||||
})
|
})
|
||||||
|
|
||||||
afterAll(() => {
|
afterAll(() => {
|
||||||
rmSync(fixtureRoot, { recursive: true, force: true })
|
rmSync(fixtureRoot, { recursive: true, force: true })
|
||||||
mock.restore()
|
rmSync(homeFixtureDir, { recursive: true, force: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
test("returns non-file URI strings unchanged", () => {
|
test("returns non-file URI strings unchanged", () => {
|
||||||
@@ -80,7 +65,7 @@ describe("resolvePromptAppend", () => {
|
|||||||
|
|
||||||
test("resolves home directory URI path", () => {
|
test("resolves home directory URI path", () => {
|
||||||
//#given
|
//#given
|
||||||
const input = "file://~/fixture-home/home.txt"
|
const input = `file://~/${homeFixtureDir.split("/").pop()}/home.txt`
|
||||||
|
|
||||||
//#when
|
//#when
|
||||||
const resolved = resolvePromptAppend(input)
|
const resolved = resolvePromptAppend(input)
|
||||||
|
|||||||
@@ -5,60 +5,60 @@ exports[`generateModelConfig no providers available returns ULTIMATE_FALLBACK fo
|
|||||||
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
||||||
"agents": {
|
"agents": {
|
||||||
"atlas": {
|
"atlas": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"explore": {
|
"explore": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"hephaestus": {
|
"hephaestus": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"librarian": {
|
"librarian": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"metis": {
|
"metis": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"momus": {
|
"momus": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"multimodal-looker": {
|
"multimodal-looker": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"oracle": {
|
"oracle": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"prometheus": {
|
"prometheus": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"sisyphus-junior": {
|
"sisyphus-junior": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"categories": {
|
"categories": {
|
||||||
"artistry": {
|
"artistry": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"deep": {
|
"deep": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"quick": {
|
"quick": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"ultrabrain": {
|
"ultrabrain": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"unspecified-high": {
|
"unspecified-high": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"unspecified-low": {
|
"unspecified-low": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"visual-engineering": {
|
"visual-engineering": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"writing": {
|
"writing": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ exports[`generateModelConfig single native provider uses Claude models when only
|
|||||||
"variant": "max",
|
"variant": "max",
|
||||||
},
|
},
|
||||||
"multimodal-looker": {
|
"multimodal-looker": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"oracle": {
|
"oracle": {
|
||||||
"model": "anthropic/claude-opus-4-6",
|
"model": "anthropic/claude-opus-4-6",
|
||||||
@@ -145,7 +145,7 @@ exports[`generateModelConfig single native provider uses Claude models with isMa
|
|||||||
"variant": "max",
|
"variant": "max",
|
||||||
},
|
},
|
||||||
"multimodal-looker": {
|
"multimodal-looker": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"oracle": {
|
"oracle": {
|
||||||
"model": "anthropic/claude-opus-4-6",
|
"model": "anthropic/claude-opus-4-6",
|
||||||
@@ -366,20 +366,20 @@ exports[`generateModelConfig single native provider uses Gemini models when only
|
|||||||
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
||||||
"agents": {
|
"agents": {
|
||||||
"atlas": {
|
"atlas": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"explore": {
|
"explore": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/gpt-5-nano",
|
||||||
},
|
},
|
||||||
"metis": {
|
"metis": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"momus": {
|
"momus": {
|
||||||
"model": "google/gemini-3.1-pro-preview",
|
"model": "google/gemini-3.1-pro-preview",
|
||||||
"variant": "high",
|
"variant": "high",
|
||||||
},
|
},
|
||||||
"multimodal-looker": {
|
"multimodal-looker": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"oracle": {
|
"oracle": {
|
||||||
"model": "google/gemini-3.1-pro-preview",
|
"model": "google/gemini-3.1-pro-preview",
|
||||||
@@ -389,7 +389,7 @@ exports[`generateModelConfig single native provider uses Gemini models when only
|
|||||||
"model": "google/gemini-3.1-pro-preview",
|
"model": "google/gemini-3.1-pro-preview",
|
||||||
},
|
},
|
||||||
"sisyphus-junior": {
|
"sisyphus-junior": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"categories": {
|
"categories": {
|
||||||
@@ -426,20 +426,20 @@ exports[`generateModelConfig single native provider uses Gemini models with isMa
|
|||||||
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
||||||
"agents": {
|
"agents": {
|
||||||
"atlas": {
|
"atlas": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"explore": {
|
"explore": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/gpt-5-nano",
|
||||||
},
|
},
|
||||||
"metis": {
|
"metis": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"momus": {
|
"momus": {
|
||||||
"model": "google/gemini-3.1-pro-preview",
|
"model": "google/gemini-3.1-pro-preview",
|
||||||
"variant": "high",
|
"variant": "high",
|
||||||
},
|
},
|
||||||
"multimodal-looker": {
|
"multimodal-looker": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"oracle": {
|
"oracle": {
|
||||||
"model": "google/gemini-3.1-pro-preview",
|
"model": "google/gemini-3.1-pro-preview",
|
||||||
@@ -449,7 +449,7 @@ exports[`generateModelConfig single native provider uses Gemini models with isMa
|
|||||||
"model": "google/gemini-3.1-pro-preview",
|
"model": "google/gemini-3.1-pro-preview",
|
||||||
},
|
},
|
||||||
"sisyphus-junior": {
|
"sisyphus-junior": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"categories": {
|
"categories": {
|
||||||
@@ -465,7 +465,7 @@ exports[`generateModelConfig single native provider uses Gemini models with isMa
|
|||||||
"variant": "high",
|
"variant": "high",
|
||||||
},
|
},
|
||||||
"unspecified-high": {
|
"unspecified-high": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"unspecified-low": {
|
"unspecified-low": {
|
||||||
"model": "google/gemini-3-flash-preview",
|
"model": "google/gemini-3-flash-preview",
|
||||||
@@ -929,7 +929,7 @@ exports[`generateModelConfig fallback providers uses ZAI model for librarian whe
|
|||||||
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
||||||
"agents": {
|
"agents": {
|
||||||
"atlas": {
|
"atlas": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"explore": {
|
"explore": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/gpt-5-nano",
|
||||||
@@ -938,45 +938,45 @@ exports[`generateModelConfig fallback providers uses ZAI model for librarian whe
|
|||||||
"model": "zai-coding-plan/glm-4.7",
|
"model": "zai-coding-plan/glm-4.7",
|
||||||
},
|
},
|
||||||
"metis": {
|
"metis": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"momus": {
|
"momus": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"multimodal-looker": {
|
"multimodal-looker": {
|
||||||
"model": "zai-coding-plan/glm-4.6v",
|
"model": "zai-coding-plan/glm-4.6v",
|
||||||
},
|
},
|
||||||
"oracle": {
|
"oracle": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"prometheus": {
|
"prometheus": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"sisyphus": {
|
"sisyphus": {
|
||||||
"model": "zai-coding-plan/glm-5",
|
"model": "zai-coding-plan/glm-5",
|
||||||
},
|
},
|
||||||
"sisyphus-junior": {
|
"sisyphus-junior": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"categories": {
|
"categories": {
|
||||||
"quick": {
|
"quick": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"ultrabrain": {
|
"ultrabrain": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"unspecified-high": {
|
"unspecified-high": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"unspecified-low": {
|
"unspecified-low": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"visual-engineering": {
|
"visual-engineering": {
|
||||||
"model": "zai-coding-plan/glm-5",
|
"model": "zai-coding-plan/glm-5",
|
||||||
},
|
},
|
||||||
"writing": {
|
"writing": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -987,7 +987,7 @@ exports[`generateModelConfig fallback providers uses ZAI model for librarian wit
|
|||||||
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
"$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json",
|
||||||
"agents": {
|
"agents": {
|
||||||
"atlas": {
|
"atlas": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"explore": {
|
"explore": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/gpt-5-nano",
|
||||||
@@ -996,45 +996,45 @@ exports[`generateModelConfig fallback providers uses ZAI model for librarian wit
|
|||||||
"model": "zai-coding-plan/glm-4.7",
|
"model": "zai-coding-plan/glm-4.7",
|
||||||
},
|
},
|
||||||
"metis": {
|
"metis": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"momus": {
|
"momus": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"multimodal-looker": {
|
"multimodal-looker": {
|
||||||
"model": "zai-coding-plan/glm-4.6v",
|
"model": "zai-coding-plan/glm-4.6v",
|
||||||
},
|
},
|
||||||
"oracle": {
|
"oracle": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"prometheus": {
|
"prometheus": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"sisyphus": {
|
"sisyphus": {
|
||||||
"model": "zai-coding-plan/glm-5",
|
"model": "zai-coding-plan/glm-5",
|
||||||
},
|
},
|
||||||
"sisyphus-junior": {
|
"sisyphus-junior": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"categories": {
|
"categories": {
|
||||||
"quick": {
|
"quick": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"ultrabrain": {
|
"ultrabrain": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"unspecified-high": {
|
"unspecified-high": {
|
||||||
"model": "zai-coding-plan/glm-5",
|
"model": "zai-coding-plan/glm-5",
|
||||||
},
|
},
|
||||||
"unspecified-low": {
|
"unspecified-low": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"visual-engineering": {
|
"visual-engineering": {
|
||||||
"model": "zai-coding-plan/glm-5",
|
"model": "zai-coding-plan/glm-5",
|
||||||
},
|
},
|
||||||
"writing": {
|
"writing": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -1273,7 +1273,7 @@ exports[`generateModelConfig mixed provider scenarios uses Gemini + Claude combi
|
|||||||
"variant": "max",
|
"variant": "max",
|
||||||
},
|
},
|
||||||
"multimodal-looker": {
|
"multimodal-looker": {
|
||||||
"model": "opencode/gpt-5-nano",
|
"model": "opencode/glm-4.7-free",
|
||||||
},
|
},
|
||||||
"oracle": {
|
"oracle": {
|
||||||
"model": "google/gemini-3.1-pro-preview",
|
"model": "google/gemini-3.1-pro-preview",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
| File | Purpose |
|
| File | Purpose |
|
||||||
|------|---------|
|
|------|---------|
|
||||||
| `add-plugin-to-opencode-config.ts` | Register `oh-my-opencode` in `.opencode/opencode.json` plugin array |
|
| `add-plugin-to-opencode-config.ts` | Register `oh-my-openagent` in `.opencode/opencode.json` plugin array |
|
||||||
| `add-provider-config.ts` | Add provider API key to OpenCode config (user-level) |
|
| `add-provider-config.ts` | Add provider API key to OpenCode config (user-level) |
|
||||||
| `antigravity-provider-configuration.ts` | Handle Antigravity provider setup (special case) |
|
| `antigravity-provider-configuration.ts` | Handle Antigravity provider setup (special case) |
|
||||||
| `auth-plugins.ts` | Detect auth plugin requirements per provider (oauth vs key) |
|
| `auth-plugins.ts` | Detect auth plugin requirements per provider (oauth vs key) |
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
| `opencode-binary.ts` | Detect OpenCode binary location, verify it's installed |
|
| `opencode-binary.ts` | Detect OpenCode binary location, verify it's installed |
|
||||||
| `opencode-config-format.ts` | OpenCode config format constants and type guards |
|
| `opencode-config-format.ts` | OpenCode config format constants and type guards |
|
||||||
| `parse-opencode-config-file.ts` | Parse opencode.json/opencode.jsonc with fallback |
|
| `parse-opencode-config-file.ts` | Parse opencode.json/opencode.jsonc with fallback |
|
||||||
| `plugin-name-with-version.ts` | Resolve `oh-my-opencode@X.Y.Z` for installation |
|
| `plugin-name-with-version.ts` | Resolve `oh-my-openagent@X.Y.Z` for installation |
|
||||||
| `write-omo-config.ts` | Write generated config to `.opencode/oh-my-opencode.jsonc` |
|
| `write-omo-config.ts` | Write generated config to `.opencode/oh-my-opencode.jsonc` |
|
||||||
|
|
||||||
## USAGE PATTERN
|
## USAGE PATTERN
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { readFileSync, writeFileSync } from "node:fs"
|
import { readFileSync, writeFileSync } from "node:fs"
|
||||||
import type { ConfigMergeResult } from "../types"
|
import type { ConfigMergeResult } from "../types"
|
||||||
import { PLUGIN_NAME, LEGACY_PLUGIN_NAME } from "../../shared"
|
|
||||||
import { getConfigDir } from "./config-context"
|
import { getConfigDir } from "./config-context"
|
||||||
import { ensureConfigDirectoryExists } from "./ensure-config-directory-exists"
|
import { ensureConfigDirectoryExists } from "./ensure-config-directory-exists"
|
||||||
import { formatErrorWithSuggestion } from "./format-error-with-suggestion"
|
import { formatErrorWithSuggestion } from "./format-error-with-suggestion"
|
||||||
@@ -8,6 +7,8 @@ import { detectConfigFormat } from "./opencode-config-format"
|
|||||||
import { parseOpenCodeConfigFileWithError, type OpenCodeConfig } from "./parse-opencode-config-file"
|
import { parseOpenCodeConfigFileWithError, type OpenCodeConfig } from "./parse-opencode-config-file"
|
||||||
import { getPluginNameWithVersion } from "./plugin-name-with-version"
|
import { getPluginNameWithVersion } from "./plugin-name-with-version"
|
||||||
|
|
||||||
|
const PACKAGE_NAME = "oh-my-opencode"
|
||||||
|
|
||||||
export async function addPluginToOpenCodeConfig(currentVersion: string): Promise<ConfigMergeResult> {
|
export async function addPluginToOpenCodeConfig(currentVersion: string): Promise<ConfigMergeResult> {
|
||||||
try {
|
try {
|
||||||
ensureConfigDirectoryExists()
|
ensureConfigDirectoryExists()
|
||||||
@@ -20,7 +21,7 @@ export async function addPluginToOpenCodeConfig(currentVersion: string): Promise
|
|||||||
}
|
}
|
||||||
|
|
||||||
const { format, path } = detectConfigFormat()
|
const { format, path } = detectConfigFormat()
|
||||||
const pluginEntry = await getPluginNameWithVersion(currentVersion, PLUGIN_NAME)
|
const pluginEntry = await getPluginNameWithVersion(currentVersion, PACKAGE_NAME)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (format === "none") {
|
if (format === "none") {
|
||||||
@@ -40,24 +41,13 @@ export async function addPluginToOpenCodeConfig(currentVersion: string): Promise
|
|||||||
|
|
||||||
const config = parseResult.config
|
const config = parseResult.config
|
||||||
const plugins = config.plugin ?? []
|
const plugins = config.plugin ?? []
|
||||||
|
const existingIndex = plugins.findIndex((plugin) => plugin === PACKAGE_NAME || plugin.startsWith(`${PACKAGE_NAME}@`))
|
||||||
|
|
||||||
// Check for existing plugin (either current or legacy name)
|
if (existingIndex !== -1) {
|
||||||
const currentNameIndex = plugins.findIndex(
|
if (plugins[existingIndex] === pluginEntry) {
|
||||||
(plugin) => plugin === PLUGIN_NAME || plugin.startsWith(`${PLUGIN_NAME}@`)
|
|
||||||
)
|
|
||||||
const legacyNameIndex = plugins.findIndex(
|
|
||||||
(plugin) => plugin === LEGACY_PLUGIN_NAME || plugin.startsWith(`${LEGACY_PLUGIN_NAME}@`)
|
|
||||||
)
|
|
||||||
|
|
||||||
// If either name exists, update to new name
|
|
||||||
if (currentNameIndex !== -1) {
|
|
||||||
if (plugins[currentNameIndex] === pluginEntry) {
|
|
||||||
return { success: true, configPath: path }
|
return { success: true, configPath: path }
|
||||||
}
|
}
|
||||||
plugins[currentNameIndex] = pluginEntry
|
plugins[existingIndex] = pluginEntry
|
||||||
} else if (legacyNameIndex !== -1) {
|
|
||||||
// Upgrade legacy name to new name
|
|
||||||
plugins[legacyNameIndex] = pluginEntry
|
|
||||||
} else {
|
} else {
|
||||||
plugins.push(pluginEntry)
|
plugins.push(pluginEntry)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ type BunInstallOutputMode = "inherit" | "pipe"
|
|||||||
|
|
||||||
interface RunBunInstallOptions {
|
interface RunBunInstallOptions {
|
||||||
outputMode?: BunInstallOutputMode
|
outputMode?: BunInstallOutputMode
|
||||||
/** Workspace directory to install to. Defaults to cache dir if not provided. */
|
|
||||||
workspaceDir?: string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface BunInstallOutput {
|
interface BunInstallOutput {
|
||||||
@@ -67,7 +65,7 @@ function logCapturedOutputOnFailure(outputMode: BunInstallOutputMode, output: Bu
|
|||||||
|
|
||||||
export async function runBunInstallWithDetails(options?: RunBunInstallOptions): Promise<BunInstallResult> {
|
export async function runBunInstallWithDetails(options?: RunBunInstallOptions): Promise<BunInstallResult> {
|
||||||
const outputMode = options?.outputMode ?? "pipe"
|
const outputMode = options?.outputMode ?? "pipe"
|
||||||
const cacheDir = options?.workspaceDir ?? getOpenCodeCacheDir()
|
const cacheDir = getOpenCodeCacheDir()
|
||||||
const packageJsonPath = `${cacheDir}/package.json`
|
const packageJsonPath = `${cacheDir}/package.json`
|
||||||
|
|
||||||
if (!existsSync(packageJsonPath)) {
|
if (!existsSync(packageJsonPath)) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { existsSync, readFileSync } from "node:fs"
|
import { existsSync, readFileSync } from "node:fs"
|
||||||
import { parseJsonc, LEGACY_PLUGIN_NAME, PLUGIN_NAME } from "../../shared"
|
import { parseJsonc } from "../../shared"
|
||||||
import type { DetectedConfig } from "../types"
|
import type { DetectedConfig } from "../types"
|
||||||
import { getOmoConfigPath } from "./config-context"
|
import { getOmoConfigPath } from "./config-context"
|
||||||
import { detectConfigFormat } from "./opencode-config-format"
|
import { detectConfigFormat } from "./opencode-config-format"
|
||||||
@@ -55,12 +55,8 @@ function detectProvidersFromOmoConfig(): {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isOurPlugin(plugin: string): boolean {
|
|
||||||
return plugin === PLUGIN_NAME || plugin.startsWith(`${PLUGIN_NAME}@`) ||
|
|
||||||
plugin === LEGACY_PLUGIN_NAME || plugin.startsWith(`${LEGACY_PLUGIN_NAME}@`)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function detectCurrentConfig(): DetectedConfig {
|
export function detectCurrentConfig(): DetectedConfig {
|
||||||
|
const PACKAGE_NAME = "oh-my-opencode"
|
||||||
const result: DetectedConfig = {
|
const result: DetectedConfig = {
|
||||||
isInstalled: false,
|
isInstalled: false,
|
||||||
hasClaude: true,
|
hasClaude: true,
|
||||||
@@ -86,7 +82,7 @@ export function detectCurrentConfig(): DetectedConfig {
|
|||||||
|
|
||||||
const openCodeConfig = parseResult.config
|
const openCodeConfig = parseResult.config
|
||||||
const plugins = openCodeConfig.plugin ?? []
|
const plugins = openCodeConfig.plugin ?? []
|
||||||
result.isInstalled = plugins.some(isOurPlugin)
|
result.isInstalled = plugins.some((plugin) => plugin.startsWith(PACKAGE_NAME))
|
||||||
|
|
||||||
if (!result.isInstalled) {
|
if (!result.isInstalled) {
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -52,30 +52,6 @@ describe("detectCurrentConfig - single package detection", () => {
|
|||||||
expect(result.isInstalled).toBe(true)
|
expect(result.isInstalled).toBe(true)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("detects oh-my-openagent as installed (legacy name)", () => {
|
|
||||||
// given
|
|
||||||
const config = { plugin: ["oh-my-openagent"] }
|
|
||||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
|
||||||
|
|
||||||
// when
|
|
||||||
const result = detectCurrentConfig()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(result.isInstalled).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
it("detects oh-my-openagent with version pin as installed (legacy name)", () => {
|
|
||||||
// given
|
|
||||||
const config = { plugin: ["oh-my-openagent@3.11.0"] }
|
|
||||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
|
||||||
|
|
||||||
// when
|
|
||||||
const result = detectCurrentConfig()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(result.isInstalled).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
it("returns false when plugin not present", () => {
|
it("returns false when plugin not present", () => {
|
||||||
// given
|
// given
|
||||||
const config = { plugin: ["some-other-plugin"] }
|
const config = { plugin: ["some-other-plugin"] }
|
||||||
@@ -88,18 +64,6 @@ describe("detectCurrentConfig - single package detection", () => {
|
|||||||
expect(result.isInstalled).toBe(false)
|
expect(result.isInstalled).toBe(false)
|
||||||
})
|
})
|
||||||
|
|
||||||
it("returns false when plugin not present (even with similar name)", () => {
|
|
||||||
// given - not exactly oh-my-openagent
|
|
||||||
const config = { plugin: ["oh-my-openagent-extra"] }
|
|
||||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
|
||||||
|
|
||||||
// when
|
|
||||||
const result = detectCurrentConfig()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(result.isInstalled).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
it("detects OpenCode Go from the existing omo config", () => {
|
it("detects OpenCode Go from the existing omo config", () => {
|
||||||
// given
|
// given
|
||||||
writeFileSync(testConfigPath, JSON.stringify({ plugin: ["oh-my-opencode"] }, null, 2) + "\n", "utf-8")
|
writeFileSync(testConfigPath, JSON.stringify({ plugin: ["oh-my-opencode"] }, null, 2) + "\n", "utf-8")
|
||||||
@@ -166,38 +130,6 @@ describe("addPluginToOpenCodeConfig - single package writes", () => {
|
|||||||
expect(savedConfig.plugin).not.toContain("oh-my-opencode@3.10.0")
|
expect(savedConfig.plugin).not.toContain("oh-my-opencode@3.10.0")
|
||||||
})
|
})
|
||||||
|
|
||||||
it("recognizes oh-my-openagent as already installed (legacy name)", async () => {
|
|
||||||
// given
|
|
||||||
const config = { plugin: ["oh-my-openagent"] }
|
|
||||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
|
||||||
|
|
||||||
// when
|
|
||||||
const result = await addPluginToOpenCodeConfig("3.11.0")
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(result.success).toBe(true)
|
|
||||||
const savedConfig = JSON.parse(readFileSync(testConfigPath, "utf-8"))
|
|
||||||
// Should upgrade to new name
|
|
||||||
expect(savedConfig.plugin).toContain("oh-my-opencode")
|
|
||||||
expect(savedConfig.plugin).not.toContain("oh-my-openagent")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("replaces version-pinned oh-my-openagent@X.Y.Z with new name", async () => {
|
|
||||||
// given
|
|
||||||
const config = { plugin: ["oh-my-openagent@3.10.0"] }
|
|
||||||
writeFileSync(testConfigPath, JSON.stringify(config, null, 2) + "\n", "utf-8")
|
|
||||||
|
|
||||||
// when
|
|
||||||
const result = await addPluginToOpenCodeConfig("3.11.0")
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(result.success).toBe(true)
|
|
||||||
const savedConfig = JSON.parse(readFileSync(testConfigPath, "utf-8"))
|
|
||||||
// Legacy should be replaced with new name
|
|
||||||
expect(savedConfig.plugin).toContain("oh-my-opencode")
|
|
||||||
expect(savedConfig.plugin).not.toContain("oh-my-openagent")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("adds new plugin when none exists", async () => {
|
it("adds new plugin when none exists", async () => {
|
||||||
// given
|
// given
|
||||||
const config = {}
|
const config = {}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { existsSync, readFileSync } from "node:fs"
|
import { existsSync, readFileSync } from "node:fs"
|
||||||
|
|
||||||
import { LEGACY_PLUGIN_NAME, PLUGIN_NAME, getOpenCodeConfigPaths, parseJsonc } from "../../../shared"
|
import { PACKAGE_NAME } from "../constants"
|
||||||
|
import { getOpenCodeConfigPaths, parseJsonc } from "../../../shared"
|
||||||
|
|
||||||
export interface PluginInfo {
|
export interface PluginInfo {
|
||||||
registered: boolean
|
registered: boolean
|
||||||
@@ -23,33 +24,18 @@ function detectConfigPath(): string | null {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function parsePluginVersion(entry: string): string | null {
|
function parsePluginVersion(entry: string): string | null {
|
||||||
// Check for current package name
|
if (!entry.startsWith(`${PACKAGE_NAME}@`)) return null
|
||||||
if (entry.startsWith(`${PLUGIN_NAME}@`)) {
|
const value = entry.slice(PACKAGE_NAME.length + 1)
|
||||||
const value = entry.slice(PLUGIN_NAME.length + 1)
|
if (!value || value === "latest") return null
|
||||||
if (!value || value === "latest") return null
|
return value
|
||||||
return value
|
|
||||||
}
|
|
||||||
// Check for legacy package name
|
|
||||||
if (entry.startsWith(`${LEGACY_PLUGIN_NAME}@`)) {
|
|
||||||
const value = entry.slice(LEGACY_PLUGIN_NAME.length + 1)
|
|
||||||
if (!value || value === "latest") return null
|
|
||||||
return value
|
|
||||||
}
|
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function findPluginEntry(entries: string[]): { entry: string; isLocalDev: boolean } | null {
|
function findPluginEntry(entries: string[]): { entry: string; isLocalDev: boolean } | null {
|
||||||
for (const entry of entries) {
|
for (const entry of entries) {
|
||||||
// Check for current package name
|
if (entry === PACKAGE_NAME || entry.startsWith(`${PACKAGE_NAME}@`)) {
|
||||||
if (entry === PLUGIN_NAME || entry.startsWith(`${PLUGIN_NAME}@`)) {
|
|
||||||
return { entry, isLocalDev: false }
|
return { entry, isLocalDev: false }
|
||||||
}
|
}
|
||||||
// Check for legacy package name
|
if (entry.startsWith("file://") && entry.includes(PACKAGE_NAME)) {
|
||||||
if (entry === LEGACY_PLUGIN_NAME || entry.startsWith(`${LEGACY_PLUGIN_NAME}@`)) {
|
|
||||||
return { entry, isLocalDev: false }
|
|
||||||
}
|
|
||||||
// Check for file:// paths that include either name
|
|
||||||
if (entry.startsWith("file://") && (entry.includes(PLUGIN_NAME) || entry.includes(LEGACY_PLUGIN_NAME))) {
|
|
||||||
return { entry, isLocalDev: true }
|
return { entry, isLocalDev: true }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +76,7 @@ export function getPluginInfo(): PluginInfo {
|
|||||||
registered: true,
|
registered: true,
|
||||||
configPath,
|
configPath,
|
||||||
entry: pluginEntry.entry,
|
entry: pluginEntry.entry,
|
||||||
isPinned: pinnedVersion !== null && /^\d+\.\d+\.\d+/.test(pinnedVersion ?? ""),
|
isPinned: pinnedVersion !== null && /^\d+\.\d+\.\d+/.test(pinnedVersion),
|
||||||
pinnedVersion,
|
pinnedVersion,
|
||||||
isLocalDev: pluginEntry.isLocalDev,
|
isLocalDev: pluginEntry.isLocalDev,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export type { GeneratedOmoConfig } from "./model-fallback-types"
|
|||||||
|
|
||||||
const ZAI_MODEL = "zai-coding-plan/glm-4.7"
|
const ZAI_MODEL = "zai-coding-plan/glm-4.7"
|
||||||
|
|
||||||
const ULTIMATE_FALLBACK = "opencode/gpt-5-nano"
|
const ULTIMATE_FALLBACK = "opencode/glm-4.7-free"
|
||||||
const SCHEMA_URL = "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json"
|
const SCHEMA_URL = "https://raw.githubusercontent.com/code-yeongyu/oh-my-openagent/dev/assets/oh-my-opencode.schema.json"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## OVERVIEW
|
## OVERVIEW
|
||||||
|
|
||||||
37 files. Powers the `oh-my-opencode run <message>` command. Connects to OpenCode server, creates/resumes sessions, streams events, and polls for completion.
|
37 files. Powers the `oh-my-openagent run <message>` command. Connects to OpenCode server, creates/resumes sessions, streams events, and polls for completion.
|
||||||
|
|
||||||
## EXECUTION FLOW
|
## EXECUTION FLOW
|
||||||
|
|
||||||
|
|||||||
@@ -45,26 +45,26 @@ export function writePaddedText(
|
|||||||
return { output: text, atLineStart: text.endsWith("\n") }
|
return { output: text, atLineStart: text.endsWith("\n") }
|
||||||
}
|
}
|
||||||
|
|
||||||
const parts: string[] = []
|
let output = ""
|
||||||
let lineStart = atLineStart
|
let lineStart = atLineStart
|
||||||
|
|
||||||
for (let i = 0; i < text.length; i++) {
|
for (let i = 0; i < text.length; i++) {
|
||||||
const ch = text[i]
|
const ch = text[i]
|
||||||
if (lineStart) {
|
if (lineStart) {
|
||||||
parts.push(" ")
|
output += " "
|
||||||
lineStart = false
|
lineStart = false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch === "\n") {
|
if (ch === "\n") {
|
||||||
parts.push(" \n")
|
output += " \n"
|
||||||
lineStart = true
|
lineStart = true
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
parts.push(ch)
|
output += ch
|
||||||
}
|
}
|
||||||
|
|
||||||
return { output: parts.join(""), atLineStart: lineStart }
|
return { output, atLineStart: lineStart }
|
||||||
}
|
}
|
||||||
|
|
||||||
function colorizeWithProfileColor(text: string, hexColor?: string): string {
|
function colorizeWithProfileColor(text: string, hexColor?: string): string {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/// <reference types="bun-types" />
|
/// <reference types="bun-types" />
|
||||||
|
|
||||||
import { describe, it, expect, beforeEach, afterEach, vi } from "bun:test"
|
import { describe, it, expect } from "bun:test"
|
||||||
import type { OhMyOpenCodeConfig } from "../../config"
|
import type { OhMyOpenCodeConfig } from "../../config"
|
||||||
import { resolveRunAgent, waitForEventProcessorShutdown } from "./runner"
|
import { resolveRunAgent, waitForEventProcessorShutdown } from "./runner"
|
||||||
|
|
||||||
@@ -83,6 +83,7 @@ describe("resolveRunAgent", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe("waitForEventProcessorShutdown", () => {
|
describe("waitForEventProcessorShutdown", () => {
|
||||||
|
|
||||||
it("returns quickly when event processor completes", async () => {
|
it("returns quickly when event processor completes", async () => {
|
||||||
//#given
|
//#given
|
||||||
const eventProcessor = new Promise<void>((resolve) => {
|
const eventProcessor = new Promise<void>((resolve) => {
|
||||||
@@ -114,44 +115,3 @@ describe("waitForEventProcessorShutdown", () => {
|
|||||||
expect(elapsed).toBeGreaterThanOrEqual(timeoutMs - 10)
|
expect(elapsed).toBeGreaterThanOrEqual(timeoutMs - 10)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("run with invalid model", () => {
|
|
||||||
it("given invalid --model value, when run, then returns exit code 1 with error message", async () => {
|
|
||||||
// given
|
|
||||||
const originalExit = process.exit
|
|
||||||
const originalError = console.error
|
|
||||||
const errorMessages: string[] = []
|
|
||||||
const exitCodes: number[] = []
|
|
||||||
|
|
||||||
console.error = (...args: unknown[]) => {
|
|
||||||
errorMessages.push(args.map(String).join(" "))
|
|
||||||
}
|
|
||||||
process.exit = ((code?: number) => {
|
|
||||||
exitCodes.push(code ?? 0)
|
|
||||||
throw new Error("exit")
|
|
||||||
}) as typeof process.exit
|
|
||||||
|
|
||||||
try {
|
|
||||||
// when
|
|
||||||
// Note: This will actually try to run - but the issue is that resolveRunModel
|
|
||||||
// is called BEFORE the try block, so it throws an unhandled exception
|
|
||||||
// We're testing the runner's error handling
|
|
||||||
const { run } = await import("./runner")
|
|
||||||
|
|
||||||
// This will throw because model "invalid" is invalid format
|
|
||||||
try {
|
|
||||||
await run({
|
|
||||||
message: "test",
|
|
||||||
model: "invalid",
|
|
||||||
})
|
|
||||||
} catch {
|
|
||||||
// Expected to potentially throw due to unhandled model resolution error
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
// then - verify error handling
|
|
||||||
// Currently this will fail because the error is not caught properly
|
|
||||||
console.error = originalError
|
|
||||||
process.exit = originalExit
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -47,11 +47,10 @@ export async function run(options: RunOptions): Promise<number> {
|
|||||||
|
|
||||||
const pluginConfig = loadPluginConfig(directory, { command: "run" })
|
const pluginConfig = loadPluginConfig(directory, { command: "run" })
|
||||||
const resolvedAgent = resolveRunAgent(options, pluginConfig)
|
const resolvedAgent = resolveRunAgent(options, pluginConfig)
|
||||||
|
const resolvedModel = resolveRunModel(options.model)
|
||||||
const abortController = new AbortController()
|
const abortController = new AbortController()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const resolvedModel = resolveRunModel(options.model)
|
|
||||||
|
|
||||||
const { client, cleanup: serverCleanup } = await createServerConnection({
|
const { client, cleanup: serverCleanup } = await createServerConnection({
|
||||||
port: options.port,
|
port: options.port,
|
||||||
attach: options.attach,
|
attach: options.attach,
|
||||||
|
|||||||
@@ -4,13 +4,13 @@
|
|||||||
|
|
||||||
## OVERVIEW
|
## OVERVIEW
|
||||||
|
|
||||||
24 schema files composing `OhMyOpenCodeConfigSchema`. Zod v4 validation with `safeParse()`. All fields optional — omitted fields use plugin defaults.
|
24 schema files composing `OhMyOpenAgentConfigSchema`. Zod v4 validation with `safeParse()`. All fields optional — omitted fields use plugin defaults.
|
||||||
|
|
||||||
## SCHEMA TREE
|
## SCHEMA TREE
|
||||||
|
|
||||||
```
|
```
|
||||||
config/schema/
|
config/schema/
|
||||||
├── oh-my-opencode-config.ts # ROOT: OhMyOpenCodeConfigSchema (composes all below)
|
├── oh-my-openagent-config.ts # ROOT: OhMyOpenAgentConfigSchema (composes all below)
|
||||||
├── agent-names.ts # BuiltinAgentNameSchema (11), OverridableAgentNameSchema (14)
|
├── agent-names.ts # BuiltinAgentNameSchema (11), OverridableAgentNameSchema (14)
|
||||||
├── agent-overrides.ts # AgentOverrideConfigSchema (21 fields per agent)
|
├── agent-overrides.ts # AgentOverrideConfigSchema (21 fields per agent)
|
||||||
├── categories.ts # 8 built-in + custom categories
|
├── categories.ts # 8 built-in + custom categories
|
||||||
@@ -49,6 +49,6 @@ config/schema/
|
|||||||
## HOW TO ADD CONFIG
|
## HOW TO ADD CONFIG
|
||||||
|
|
||||||
1. Create `src/config/schema/{name}.ts` with Zod schema
|
1. Create `src/config/schema/{name}.ts` with Zod schema
|
||||||
2. Add field to `oh-my-opencode-config.ts` root schema
|
2. Add field to `oh-my-openagent-config.ts` root schema
|
||||||
3. Reference via `z.infer<typeof YourSchema>` for TypeScript types
|
3. Reference via `z.infer<typeof YourSchema>` for TypeScript types
|
||||||
4. Access in handlers via `pluginConfig.{name}`
|
4. Access in handlers via `pluginConfig.{name}`
|
||||||
|
|||||||
@@ -1,56 +0,0 @@
|
|||||||
import { describe, expect, test } from "bun:test"
|
|
||||||
import { ZodError } from "zod/v4"
|
|
||||||
import { BackgroundTaskConfigSchema } from "./background-task"
|
|
||||||
|
|
||||||
describe("BackgroundTaskConfigSchema.circuitBreaker", () => {
|
|
||||||
describe("#given valid circuit breaker settings", () => {
|
|
||||||
test("#when parsed #then returns nested config", () => {
|
|
||||||
const result = BackgroundTaskConfigSchema.parse({
|
|
||||||
circuitBreaker: {
|
|
||||||
maxToolCalls: 150,
|
|
||||||
consecutiveThreshold: 10,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
expect(result.circuitBreaker).toEqual({
|
|
||||||
maxToolCalls: 150,
|
|
||||||
consecutiveThreshold: 10,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given consecutiveThreshold below minimum", () => {
|
|
||||||
test("#when parsed #then throws ZodError", () => {
|
|
||||||
let thrownError: unknown
|
|
||||||
|
|
||||||
try {
|
|
||||||
BackgroundTaskConfigSchema.parse({
|
|
||||||
circuitBreaker: {
|
|
||||||
consecutiveThreshold: 4,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
thrownError = error
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(thrownError).toBeInstanceOf(ZodError)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given consecutiveThreshold is zero", () => {
|
|
||||||
test("#when parsed #then throws ZodError", () => {
|
|
||||||
let thrownError: unknown
|
|
||||||
|
|
||||||
try {
|
|
||||||
BackgroundTaskConfigSchema.parse({
|
|
||||||
circuitBreaker: {
|
|
||||||
consecutiveThreshold: 0,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
thrownError = error
|
|
||||||
}
|
|
||||||
|
|
||||||
expect(thrownError).toBeInstanceOf(ZodError)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,11 +1,5 @@
|
|||||||
import { z } from "zod"
|
import { z } from "zod"
|
||||||
|
|
||||||
const CircuitBreakerConfigSchema = z.object({
|
|
||||||
enabled: z.boolean().optional(),
|
|
||||||
maxToolCalls: z.number().int().min(10).optional(),
|
|
||||||
consecutiveThreshold: z.number().int().min(5).optional(),
|
|
||||||
})
|
|
||||||
|
|
||||||
export const BackgroundTaskConfigSchema = z.object({
|
export const BackgroundTaskConfigSchema = z.object({
|
||||||
defaultConcurrency: z.number().min(1).optional(),
|
defaultConcurrency: z.number().min(1).optional(),
|
||||||
providerConcurrency: z.record(z.string(), z.number().min(0)).optional(),
|
providerConcurrency: z.record(z.string(), z.number().min(0)).optional(),
|
||||||
@@ -17,9 +11,6 @@ export const BackgroundTaskConfigSchema = z.object({
|
|||||||
/** Timeout for tasks that never received any progress update, falling back to startedAt (default: 1800000 = 30 minutes, minimum: 60000 = 1 minute) */
|
/** Timeout for tasks that never received any progress update, falling back to startedAt (default: 1800000 = 30 minutes, minimum: 60000 = 1 minute) */
|
||||||
messageStalenessTimeoutMs: z.number().min(60000).optional(),
|
messageStalenessTimeoutMs: z.number().min(60000).optional(),
|
||||||
syncPollTimeoutMs: z.number().min(60000).optional(),
|
syncPollTimeoutMs: z.number().min(60000).optional(),
|
||||||
/** Maximum tool calls per subagent task before circuit breaker triggers (default: 200, minimum: 10). Prevents runaway loops from burning unlimited tokens. */
|
|
||||||
maxToolCalls: z.number().int().min(10).optional(),
|
|
||||||
circuitBreaker: CircuitBreakerConfigSchema.optional(),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export type BackgroundTaskConfig = z.infer<typeof BackgroundTaskConfigSchema>
|
export type BackgroundTaskConfig = z.infer<typeof BackgroundTaskConfigSchema>
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export const HookNameSchema = z.enum([
|
|||||||
"anthropic-effort",
|
"anthropic-effort",
|
||||||
"hashline-read-enhancer",
|
"hashline-read-enhancer",
|
||||||
"read-image-resizer",
|
"read-image-resizer",
|
||||||
"todo-description-override",
|
"openclaw-sender",
|
||||||
])
|
])
|
||||||
|
|
||||||
export type HookName = z.infer<typeof HookNameSchema>
|
export type HookName = z.infer<typeof HookNameSchema>
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { BuiltinCommandNameSchema } from "./commands"
|
|||||||
import { ExperimentalConfigSchema } from "./experimental"
|
import { ExperimentalConfigSchema } from "./experimental"
|
||||||
import { GitMasterConfigSchema } from "./git-master"
|
import { GitMasterConfigSchema } from "./git-master"
|
||||||
import { NotificationConfigSchema } from "./notification"
|
import { NotificationConfigSchema } from "./notification"
|
||||||
|
import { OpenClawConfigSchema } from "./openclaw"
|
||||||
import { RalphLoopConfigSchema } from "./ralph-loop"
|
import { RalphLoopConfigSchema } from "./ralph-loop"
|
||||||
import { RuntimeFallbackConfigSchema } from "./runtime-fallback"
|
import { RuntimeFallbackConfigSchema } from "./runtime-fallback"
|
||||||
import { SkillsConfigSchema } from "./skills"
|
import { SkillsConfigSchema } from "./skills"
|
||||||
@@ -55,6 +56,7 @@ export const OhMyOpenCodeConfigSchema = z.object({
|
|||||||
runtime_fallback: z.union([z.boolean(), RuntimeFallbackConfigSchema]).optional(),
|
runtime_fallback: z.union([z.boolean(), RuntimeFallbackConfigSchema]).optional(),
|
||||||
background_task: BackgroundTaskConfigSchema.optional(),
|
background_task: BackgroundTaskConfigSchema.optional(),
|
||||||
notification: NotificationConfigSchema.optional(),
|
notification: NotificationConfigSchema.optional(),
|
||||||
|
openclaw: OpenClawConfigSchema.optional(),
|
||||||
babysitting: BabysittingConfigSchema.optional(),
|
babysitting: BabysittingConfigSchema.optional(),
|
||||||
git_master: GitMasterConfigSchema.optional(),
|
git_master: GitMasterConfigSchema.optional(),
|
||||||
browser_automation_engine: BrowserAutomationConfigSchema.optional(),
|
browser_automation_engine: BrowserAutomationConfigSchema.optional(),
|
||||||
|
|||||||
51
src/config/schema/openclaw.ts
Normal file
51
src/config/schema/openclaw.ts
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import { z } from "zod";
|
||||||
|
|
||||||
|
export const OpenClawHookEventSchema = z.enum([
|
||||||
|
"session-start",
|
||||||
|
"session-end",
|
||||||
|
"session-idle",
|
||||||
|
"ask-user-question",
|
||||||
|
"stop",
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const OpenClawHttpGatewayConfigSchema = z.object({
|
||||||
|
type: z.literal("http").optional(),
|
||||||
|
url: z.string(), // Allow looser URL validation as it might contain placeholders
|
||||||
|
headers: z.record(z.string(), z.string()).optional(),
|
||||||
|
method: z.enum(["POST", "PUT"]).optional(),
|
||||||
|
timeout: z.number().optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const OpenClawCommandGatewayConfigSchema = z.object({
|
||||||
|
type: z.literal("command"),
|
||||||
|
command: z.string(),
|
||||||
|
timeout: z.number().optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const OpenClawGatewayConfigSchema = z.union([
|
||||||
|
OpenClawHttpGatewayConfigSchema,
|
||||||
|
OpenClawCommandGatewayConfigSchema,
|
||||||
|
]);
|
||||||
|
|
||||||
|
export const OpenClawHookMappingSchema = z.object({
|
||||||
|
gateway: z.string(),
|
||||||
|
instruction: z.string(),
|
||||||
|
enabled: z.boolean(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export const OpenClawConfigSchema = z.object({
|
||||||
|
enabled: z.boolean(),
|
||||||
|
gateways: z.record(z.string(), OpenClawGatewayConfigSchema),
|
||||||
|
hooks: z
|
||||||
|
.object({
|
||||||
|
"session-start": OpenClawHookMappingSchema.optional(),
|
||||||
|
"session-end": OpenClawHookMappingSchema.optional(),
|
||||||
|
"session-idle": OpenClawHookMappingSchema.optional(),
|
||||||
|
"ask-user-question": OpenClawHookMappingSchema.optional(),
|
||||||
|
stop: OpenClawHookMappingSchema.optional(),
|
||||||
|
})
|
||||||
|
.strict()
|
||||||
|
.optional(),
|
||||||
|
});
|
||||||
|
|
||||||
|
export type OpenClawConfig = z.infer<typeof OpenClawConfigSchema>;
|
||||||
@@ -2,13 +2,9 @@ import type { PluginInput } from "@opencode-ai/plugin"
|
|||||||
import type { BackgroundTask, LaunchInput } from "./types"
|
import type { BackgroundTask, LaunchInput } from "./types"
|
||||||
|
|
||||||
export const TASK_TTL_MS = 30 * 60 * 1000
|
export const TASK_TTL_MS = 30 * 60 * 1000
|
||||||
export const TERMINAL_TASK_TTL_MS = 30 * 60 * 1000
|
|
||||||
export const MIN_STABILITY_TIME_MS = 10 * 1000
|
export const MIN_STABILITY_TIME_MS = 10 * 1000
|
||||||
export const DEFAULT_STALE_TIMEOUT_MS = 1_200_000
|
export const DEFAULT_STALE_TIMEOUT_MS = 180_000
|
||||||
export const DEFAULT_MESSAGE_STALENESS_TIMEOUT_MS = 1_800_000
|
export const DEFAULT_MESSAGE_STALENESS_TIMEOUT_MS = 1_800_000
|
||||||
export const DEFAULT_MAX_TOOL_CALLS = 200
|
|
||||||
export const DEFAULT_CIRCUIT_BREAKER_CONSECUTIVE_THRESHOLD = 20
|
|
||||||
export const DEFAULT_CIRCUIT_BREAKER_ENABLED = true
|
|
||||||
export const MIN_RUNTIME_BEFORE_STALE_MS = 30_000
|
export const MIN_RUNTIME_BEFORE_STALE_MS = 30_000
|
||||||
export const MIN_IDLE_TIME_MS = 5000
|
export const MIN_IDLE_TIME_MS = 5000
|
||||||
export const POLLING_INTERVAL_MS = 3000
|
export const POLLING_INTERVAL_MS = 3000
|
||||||
|
|||||||
@@ -1,17 +0,0 @@
|
|||||||
declare const require: (name: string) => any
|
|
||||||
const { describe, expect, test } = require("bun:test")
|
|
||||||
|
|
||||||
import { DEFAULT_STALE_TIMEOUT_MS } from "./constants"
|
|
||||||
|
|
||||||
describe("DEFAULT_STALE_TIMEOUT_MS", () => {
|
|
||||||
test("uses a 20 minute default", () => {
|
|
||||||
// #given
|
|
||||||
const expectedTimeout = 20 * 60 * 1000
|
|
||||||
|
|
||||||
// #when
|
|
||||||
const timeout = DEFAULT_STALE_TIMEOUT_MS
|
|
||||||
|
|
||||||
// #then
|
|
||||||
expect(timeout).toBe(expectedTimeout)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,240 +0,0 @@
|
|||||||
import { describe, expect, test } from "bun:test"
|
|
||||||
import {
|
|
||||||
createToolCallSignature,
|
|
||||||
detectRepetitiveToolUse,
|
|
||||||
recordToolCall,
|
|
||||||
resolveCircuitBreakerSettings,
|
|
||||||
} from "./loop-detector"
|
|
||||||
|
|
||||||
function buildWindow(
|
|
||||||
toolNames: string[],
|
|
||||||
override?: Parameters<typeof resolveCircuitBreakerSettings>[0]
|
|
||||||
) {
|
|
||||||
const settings = resolveCircuitBreakerSettings(override)
|
|
||||||
|
|
||||||
return toolNames.reduce(
|
|
||||||
(window, toolName) => recordToolCall(window, toolName, settings),
|
|
||||||
undefined as ReturnType<typeof recordToolCall> | undefined
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildWindowWithInputs(
|
|
||||||
calls: Array<{ tool: string; input?: Record<string, unknown> }>,
|
|
||||||
override?: Parameters<typeof resolveCircuitBreakerSettings>[0]
|
|
||||||
) {
|
|
||||||
const settings = resolveCircuitBreakerSettings(override)
|
|
||||||
return calls.reduce(
|
|
||||||
(window, { tool, input }) => recordToolCall(window, tool, settings, input),
|
|
||||||
undefined as ReturnType<typeof recordToolCall> | undefined
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("loop-detector", () => {
|
|
||||||
describe("resolveCircuitBreakerSettings", () => {
|
|
||||||
describe("#given nested circuit breaker config", () => {
|
|
||||||
test("#when resolved #then nested values override defaults", () => {
|
|
||||||
const result = resolveCircuitBreakerSettings({
|
|
||||||
maxToolCalls: 200,
|
|
||||||
circuitBreaker: {
|
|
||||||
maxToolCalls: 120,
|
|
||||||
consecutiveThreshold: 7,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result).toEqual({
|
|
||||||
enabled: true,
|
|
||||||
maxToolCalls: 120,
|
|
||||||
consecutiveThreshold: 7,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given no enabled config", () => {
|
|
||||||
test("#when resolved #then enabled defaults to true", () => {
|
|
||||||
const result = resolveCircuitBreakerSettings({
|
|
||||||
circuitBreaker: {
|
|
||||||
maxToolCalls: 100,
|
|
||||||
consecutiveThreshold: 5,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.enabled).toBe(true)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given enabled is false in config", () => {
|
|
||||||
test("#when resolved #then enabled is false", () => {
|
|
||||||
const result = resolveCircuitBreakerSettings({
|
|
||||||
circuitBreaker: {
|
|
||||||
enabled: false,
|
|
||||||
maxToolCalls: 100,
|
|
||||||
consecutiveThreshold: 5,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.enabled).toBe(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given enabled is true in config", () => {
|
|
||||||
test("#when resolved #then enabled is true", () => {
|
|
||||||
const result = resolveCircuitBreakerSettings({
|
|
||||||
circuitBreaker: {
|
|
||||||
enabled: true,
|
|
||||||
maxToolCalls: 100,
|
|
||||||
consecutiveThreshold: 5,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result.enabled).toBe(true)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("createToolCallSignature", () => {
|
|
||||||
test("#given tool with input #when signature created #then includes tool and sorted input", () => {
|
|
||||||
const result = createToolCallSignature("read", { filePath: "/a.ts" })
|
|
||||||
|
|
||||||
expect(result).toBe('read::{"filePath":"/a.ts"}')
|
|
||||||
})
|
|
||||||
|
|
||||||
test("#given tool with undefined input #when signature created #then returns bare tool name", () => {
|
|
||||||
const result = createToolCallSignature("read", undefined)
|
|
||||||
|
|
||||||
expect(result).toBe("read")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("#given tool with null input #when signature created #then returns bare tool name", () => {
|
|
||||||
const result = createToolCallSignature("read", null)
|
|
||||||
|
|
||||||
expect(result).toBe("read")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("#given tool with empty object input #when signature created #then returns bare tool name", () => {
|
|
||||||
const result = createToolCallSignature("read", {})
|
|
||||||
|
|
||||||
expect(result).toBe("read")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("#given same input different key order #when signatures compared #then they are equal", () => {
|
|
||||||
const first = createToolCallSignature("read", { filePath: "/a.ts", offset: 0 })
|
|
||||||
const second = createToolCallSignature("read", { offset: 0, filePath: "/a.ts" })
|
|
||||||
|
|
||||||
expect(first).toBe(second)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("detectRepetitiveToolUse", () => {
|
|
||||||
describe("#given recent tools are diverse", () => {
|
|
||||||
test("#when evaluated #then it does not trigger", () => {
|
|
||||||
const window = buildWindow([
|
|
||||||
"read",
|
|
||||||
"grep",
|
|
||||||
"edit",
|
|
||||||
"bash",
|
|
||||||
"read",
|
|
||||||
"glob",
|
|
||||||
"lsp_diagnostics",
|
|
||||||
"read",
|
|
||||||
"grep",
|
|
||||||
"edit",
|
|
||||||
])
|
|
||||||
|
|
||||||
const result = detectRepetitiveToolUse(window)
|
|
||||||
|
|
||||||
expect(result.triggered).toBe(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given the same tool is called consecutively", () => {
|
|
||||||
test("#when evaluated #then it triggers", () => {
|
|
||||||
const window = buildWindow(Array.from({ length: 20 }, () => "read"))
|
|
||||||
|
|
||||||
const result = detectRepetitiveToolUse(window)
|
|
||||||
|
|
||||||
expect(result).toEqual({
|
|
||||||
triggered: true,
|
|
||||||
toolName: "read",
|
|
||||||
repeatedCount: 20,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given consecutive calls are interrupted by different tool", () => {
|
|
||||||
test("#when evaluated #then it does not trigger", () => {
|
|
||||||
const window = buildWindow([
|
|
||||||
...Array.from({ length: 19 }, () => "read"),
|
|
||||||
"edit",
|
|
||||||
"read",
|
|
||||||
])
|
|
||||||
|
|
||||||
const result = detectRepetitiveToolUse(window)
|
|
||||||
|
|
||||||
expect(result).toEqual({ triggered: false })
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given threshold boundary", () => {
|
|
||||||
test("#when below threshold #then it does not trigger", () => {
|
|
||||||
const belowThresholdWindow = buildWindow(Array.from({ length: 19 }, () => "read"))
|
|
||||||
|
|
||||||
const result = detectRepetitiveToolUse(belowThresholdWindow)
|
|
||||||
|
|
||||||
expect(result).toEqual({ triggered: false })
|
|
||||||
})
|
|
||||||
|
|
||||||
test("#when equal to threshold #then it triggers", () => {
|
|
||||||
const atThresholdWindow = buildWindow(Array.from({ length: 20 }, () => "read"))
|
|
||||||
|
|
||||||
const result = detectRepetitiveToolUse(atThresholdWindow)
|
|
||||||
|
|
||||||
expect(result).toEqual({
|
|
||||||
triggered: true,
|
|
||||||
toolName: "read",
|
|
||||||
repeatedCount: 20,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given same tool with different file inputs", () => {
|
|
||||||
test("#when evaluated #then it does not trigger", () => {
|
|
||||||
const calls = Array.from({ length: 20 }, (_, i) => ({
|
|
||||||
tool: "read",
|
|
||||||
input: { filePath: `/src/file-${i}.ts` },
|
|
||||||
}))
|
|
||||||
const window = buildWindowWithInputs(calls)
|
|
||||||
const result = detectRepetitiveToolUse(window)
|
|
||||||
expect(result.triggered).toBe(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given same tool with identical file inputs", () => {
|
|
||||||
test("#when evaluated #then it triggers with bare tool name", () => {
|
|
||||||
const calls = Array.from({ length: 20 }, () => ({
|
|
||||||
tool: "read",
|
|
||||||
input: { filePath: "/src/same.ts" },
|
|
||||||
}))
|
|
||||||
const window = buildWindowWithInputs(calls)
|
|
||||||
const result = detectRepetitiveToolUse(window)
|
|
||||||
expect(result).toEqual({
|
|
||||||
triggered: true,
|
|
||||||
toolName: "read",
|
|
||||||
repeatedCount: 20,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given tool calls with no input", () => {
|
|
||||||
test("#when evaluated #then it triggers", () => {
|
|
||||||
const calls = Array.from({ length: 20 }, () => ({ tool: "read" }))
|
|
||||||
const window = buildWindowWithInputs(calls)
|
|
||||||
const result = detectRepetitiveToolUse(window)
|
|
||||||
expect(result).toEqual({
|
|
||||||
triggered: true,
|
|
||||||
toolName: "read",
|
|
||||||
repeatedCount: 20,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
import type { BackgroundTaskConfig } from "../../config/schema"
|
|
||||||
import {
|
|
||||||
DEFAULT_CIRCUIT_BREAKER_ENABLED,
|
|
||||||
DEFAULT_CIRCUIT_BREAKER_CONSECUTIVE_THRESHOLD,
|
|
||||||
DEFAULT_MAX_TOOL_CALLS,
|
|
||||||
} from "./constants"
|
|
||||||
import type { ToolCallWindow } from "./types"
|
|
||||||
|
|
||||||
export interface CircuitBreakerSettings {
|
|
||||||
enabled: boolean
|
|
||||||
maxToolCalls: number
|
|
||||||
consecutiveThreshold: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ToolLoopDetectionResult {
|
|
||||||
triggered: boolean
|
|
||||||
toolName?: string
|
|
||||||
repeatedCount?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export function resolveCircuitBreakerSettings(
|
|
||||||
config?: BackgroundTaskConfig
|
|
||||||
): CircuitBreakerSettings {
|
|
||||||
return {
|
|
||||||
enabled: config?.circuitBreaker?.enabled ?? DEFAULT_CIRCUIT_BREAKER_ENABLED,
|
|
||||||
maxToolCalls:
|
|
||||||
config?.circuitBreaker?.maxToolCalls ?? config?.maxToolCalls ?? DEFAULT_MAX_TOOL_CALLS,
|
|
||||||
consecutiveThreshold:
|
|
||||||
config?.circuitBreaker?.consecutiveThreshold ?? DEFAULT_CIRCUIT_BREAKER_CONSECUTIVE_THRESHOLD,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function recordToolCall(
|
|
||||||
window: ToolCallWindow | undefined,
|
|
||||||
toolName: string,
|
|
||||||
settings: CircuitBreakerSettings,
|
|
||||||
toolInput?: Record<string, unknown> | null
|
|
||||||
): ToolCallWindow {
|
|
||||||
const signature = createToolCallSignature(toolName, toolInput)
|
|
||||||
|
|
||||||
if (window && window.lastSignature === signature) {
|
|
||||||
return {
|
|
||||||
lastSignature: signature,
|
|
||||||
consecutiveCount: window.consecutiveCount + 1,
|
|
||||||
threshold: settings.consecutiveThreshold,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
lastSignature: signature,
|
|
||||||
consecutiveCount: 1,
|
|
||||||
threshold: settings.consecutiveThreshold,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function sortObject(obj: unknown): unknown {
|
|
||||||
if (obj === null || obj === undefined) return obj
|
|
||||||
if (typeof obj !== "object") return obj
|
|
||||||
if (Array.isArray(obj)) return obj.map(sortObject)
|
|
||||||
|
|
||||||
const sorted: Record<string, unknown> = {}
|
|
||||||
const keys = Object.keys(obj as Record<string, unknown>).sort()
|
|
||||||
for (const key of keys) {
|
|
||||||
sorted[key] = sortObject((obj as Record<string, unknown>)[key])
|
|
||||||
}
|
|
||||||
return sorted
|
|
||||||
}
|
|
||||||
|
|
||||||
export function createToolCallSignature(
|
|
||||||
toolName: string,
|
|
||||||
toolInput?: Record<string, unknown> | null
|
|
||||||
): string {
|
|
||||||
if (toolInput === undefined || toolInput === null) {
|
|
||||||
return toolName
|
|
||||||
}
|
|
||||||
if (Object.keys(toolInput).length === 0) {
|
|
||||||
return toolName
|
|
||||||
}
|
|
||||||
return `${toolName}::${JSON.stringify(sortObject(toolInput))}`
|
|
||||||
}
|
|
||||||
|
|
||||||
export function detectRepetitiveToolUse(
|
|
||||||
window: ToolCallWindow | undefined
|
|
||||||
): ToolLoopDetectionResult {
|
|
||||||
if (!window || window.consecutiveCount < window.threshold) {
|
|
||||||
return { triggered: false }
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
triggered: true,
|
|
||||||
toolName: window.lastSignature.split("::")[0],
|
|
||||||
repeatedCount: window.consecutiveCount,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,387 +0,0 @@
|
|||||||
import { describe, expect, test } from "bun:test"
|
|
||||||
import type { PluginInput } from "@opencode-ai/plugin"
|
|
||||||
import { tmpdir } from "node:os"
|
|
||||||
import type { BackgroundTaskConfig } from "../../config/schema"
|
|
||||||
import { BackgroundManager } from "./manager"
|
|
||||||
import type { BackgroundTask } from "./types"
|
|
||||||
|
|
||||||
function createManager(config?: BackgroundTaskConfig): BackgroundManager {
|
|
||||||
const client = {
|
|
||||||
session: {
|
|
||||||
prompt: async () => ({}),
|
|
||||||
promptAsync: async () => ({}),
|
|
||||||
abort: async () => ({}),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
const manager = new BackgroundManager({ client, directory: tmpdir() } as unknown as PluginInput, config)
|
|
||||||
const testManager = manager as unknown as {
|
|
||||||
enqueueNotificationForParent: (sessionID: string, fn: () => Promise<void>) => Promise<void>
|
|
||||||
notifyParentSession: (task: BackgroundTask) => Promise<void>
|
|
||||||
tasks: Map<string, BackgroundTask>
|
|
||||||
}
|
|
||||||
|
|
||||||
testManager.enqueueNotificationForParent = async (_sessionID, fn) => {
|
|
||||||
await fn()
|
|
||||||
}
|
|
||||||
testManager.notifyParentSession = async () => {}
|
|
||||||
|
|
||||||
return manager
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTaskMap(manager: BackgroundManager): Map<string, BackgroundTask> {
|
|
||||||
return (manager as unknown as { tasks: Map<string, BackgroundTask> }).tasks
|
|
||||||
}
|
|
||||||
|
|
||||||
async function flushAsyncWork() {
|
|
||||||
await new Promise(resolve => setTimeout(resolve, 0))
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("BackgroundManager circuit breaker", () => {
|
|
||||||
describe("#given the same tool is called consecutively", () => {
|
|
||||||
test("#when consecutive tool events arrive #then the task is cancelled", async () => {
|
|
||||||
const manager = createManager({
|
|
||||||
circuitBreaker: {
|
|
||||||
consecutiveThreshold: 20,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const task: BackgroundTask = {
|
|
||||||
id: "task-loop-1",
|
|
||||||
sessionID: "session-loop-1",
|
|
||||||
parentSessionID: "parent-1",
|
|
||||||
parentMessageID: "msg-1",
|
|
||||||
description: "Looping task",
|
|
||||||
prompt: "loop",
|
|
||||||
agent: "explore",
|
|
||||||
status: "running",
|
|
||||||
startedAt: new Date(Date.now() - 60_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 0,
|
|
||||||
lastUpdate: new Date(Date.now() - 60_000),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
getTaskMap(manager).set(task.id, task)
|
|
||||||
|
|
||||||
for (let i = 0; i < 20; i++) {
|
|
||||||
manager.handleEvent({
|
|
||||||
type: "message.part.updated",
|
|
||||||
properties: { sessionID: task.sessionID, type: "tool", tool: "read" },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await flushAsyncWork()
|
|
||||||
|
|
||||||
expect(task.status).toBe("cancelled")
|
|
||||||
expect(task.error).toContain("read 20 consecutive times")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given recent tool calls are diverse", () => {
|
|
||||||
test("#when the window fills #then the task keeps running", async () => {
|
|
||||||
const manager = createManager({
|
|
||||||
circuitBreaker: {
|
|
||||||
consecutiveThreshold: 10,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const task: BackgroundTask = {
|
|
||||||
id: "task-diverse-1",
|
|
||||||
sessionID: "session-diverse-1",
|
|
||||||
parentSessionID: "parent-1",
|
|
||||||
parentMessageID: "msg-1",
|
|
||||||
description: "Healthy task",
|
|
||||||
prompt: "work",
|
|
||||||
agent: "explore",
|
|
||||||
status: "running",
|
|
||||||
startedAt: new Date(Date.now() - 60_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 0,
|
|
||||||
lastUpdate: new Date(Date.now() - 60_000),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
getTaskMap(manager).set(task.id, task)
|
|
||||||
|
|
||||||
for (const toolName of [
|
|
||||||
"read",
|
|
||||||
"grep",
|
|
||||||
"edit",
|
|
||||||
"bash",
|
|
||||||
"glob",
|
|
||||||
"read",
|
|
||||||
"lsp_diagnostics",
|
|
||||||
"grep",
|
|
||||||
"edit",
|
|
||||||
"read",
|
|
||||||
]) {
|
|
||||||
manager.handleEvent({
|
|
||||||
type: "message.part.updated",
|
|
||||||
properties: { sessionID: task.sessionID, type: "tool", tool: toolName },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await flushAsyncWork()
|
|
||||||
|
|
||||||
expect(task.status).toBe("running")
|
|
||||||
expect(task.progress?.toolCalls).toBe(10)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given the absolute cap is configured lower than the repetition detector needs", () => {
|
|
||||||
test("#when the raw tool-call cap is reached #then the backstop still cancels the task", async () => {
|
|
||||||
const manager = createManager({
|
|
||||||
maxToolCalls: 3,
|
|
||||||
circuitBreaker: {
|
|
||||||
consecutiveThreshold: 95,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const task: BackgroundTask = {
|
|
||||||
id: "task-cap-1",
|
|
||||||
sessionID: "session-cap-1",
|
|
||||||
parentSessionID: "parent-1",
|
|
||||||
parentMessageID: "msg-1",
|
|
||||||
description: "Backstop task",
|
|
||||||
prompt: "work",
|
|
||||||
agent: "explore",
|
|
||||||
status: "running",
|
|
||||||
startedAt: new Date(Date.now() - 60_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 0,
|
|
||||||
lastUpdate: new Date(Date.now() - 60_000),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
getTaskMap(manager).set(task.id, task)
|
|
||||||
|
|
||||||
for (const toolName of ["read", "grep", "edit"]) {
|
|
||||||
manager.handleEvent({
|
|
||||||
type: "message.part.updated",
|
|
||||||
properties: { sessionID: task.sessionID, type: "tool", tool: toolName },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await flushAsyncWork()
|
|
||||||
|
|
||||||
expect(task.status).toBe("cancelled")
|
|
||||||
expect(task.error).toContain("maximum tool call limit (3)")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given the same running tool part emits multiple updates", () => {
|
|
||||||
test("#when duplicate running updates arrive #then it only counts the tool once", async () => {
|
|
||||||
const manager = createManager({
|
|
||||||
maxToolCalls: 2,
|
|
||||||
circuitBreaker: {
|
|
||||||
consecutiveThreshold: 5,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const task: BackgroundTask = {
|
|
||||||
id: "task-dedupe-1",
|
|
||||||
sessionID: "session-dedupe-1",
|
|
||||||
parentSessionID: "parent-1",
|
|
||||||
parentMessageID: "msg-1",
|
|
||||||
description: "Dedupe task",
|
|
||||||
prompt: "work",
|
|
||||||
agent: "explore",
|
|
||||||
status: "running",
|
|
||||||
startedAt: new Date(Date.now() - 60_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 0,
|
|
||||||
lastUpdate: new Date(Date.now() - 60_000),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
getTaskMap(manager).set(task.id, task)
|
|
||||||
|
|
||||||
for (let index = 0; index < 3; index += 1) {
|
|
||||||
manager.handleEvent({
|
|
||||||
type: "message.part.updated",
|
|
||||||
properties: {
|
|
||||||
part: {
|
|
||||||
id: "tool-1",
|
|
||||||
sessionID: task.sessionID,
|
|
||||||
type: "tool",
|
|
||||||
tool: "bash",
|
|
||||||
state: { status: "running" },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await flushAsyncWork()
|
|
||||||
|
|
||||||
expect(task.status).toBe("running")
|
|
||||||
expect(task.progress?.toolCalls).toBe(1)
|
|
||||||
expect(task.progress?.countedToolPartIDs).toEqual(new Set(["tool-1"]))
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given same tool reading different files", () => {
|
|
||||||
test("#when tool events arrive with state.input #then task keeps running", async () => {
|
|
||||||
const manager = createManager({
|
|
||||||
circuitBreaker: {
|
|
||||||
consecutiveThreshold: 20,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const task: BackgroundTask = {
|
|
||||||
id: "task-diff-files-1",
|
|
||||||
sessionID: "session-diff-files-1",
|
|
||||||
parentSessionID: "parent-1",
|
|
||||||
parentMessageID: "msg-1",
|
|
||||||
description: "Reading different files",
|
|
||||||
prompt: "work",
|
|
||||||
agent: "explore",
|
|
||||||
status: "running",
|
|
||||||
startedAt: new Date(Date.now() - 60_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 0,
|
|
||||||
lastUpdate: new Date(Date.now() - 60_000),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
getTaskMap(manager).set(task.id, task)
|
|
||||||
|
|
||||||
for (let i = 0; i < 20; i++) {
|
|
||||||
manager.handleEvent({
|
|
||||||
type: "message.part.updated",
|
|
||||||
properties: {
|
|
||||||
part: {
|
|
||||||
sessionID: task.sessionID,
|
|
||||||
type: "tool",
|
|
||||||
tool: "read",
|
|
||||||
state: { status: "running", input: { filePath: `/src/file-${i}.ts` } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await flushAsyncWork()
|
|
||||||
|
|
||||||
expect(task.status).toBe("running")
|
|
||||||
expect(task.progress?.toolCalls).toBe(20)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given same tool reading same file repeatedly", () => {
|
|
||||||
test("#when tool events arrive with state.input #then task is cancelled with bare tool name in error", async () => {
|
|
||||||
const manager = createManager({
|
|
||||||
circuitBreaker: {
|
|
||||||
consecutiveThreshold: 20,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const task: BackgroundTask = {
|
|
||||||
id: "task-same-file-1",
|
|
||||||
sessionID: "session-same-file-1",
|
|
||||||
parentSessionID: "parent-1",
|
|
||||||
parentMessageID: "msg-1",
|
|
||||||
description: "Reading same file repeatedly",
|
|
||||||
prompt: "work",
|
|
||||||
agent: "explore",
|
|
||||||
status: "running",
|
|
||||||
startedAt: new Date(Date.now() - 60_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 0,
|
|
||||||
lastUpdate: new Date(Date.now() - 60_000),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
getTaskMap(manager).set(task.id, task)
|
|
||||||
|
|
||||||
for (let i = 0; i < 20; i++) {
|
|
||||||
manager.handleEvent({
|
|
||||||
type: "message.part.updated",
|
|
||||||
properties: {
|
|
||||||
part: {
|
|
||||||
sessionID: task.sessionID,
|
|
||||||
type: "tool",
|
|
||||||
tool: "read",
|
|
||||||
state: { status: "running", input: { filePath: "/src/same.ts" } },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await flushAsyncWork()
|
|
||||||
|
|
||||||
expect(task.status).toBe("cancelled")
|
|
||||||
expect(task.error).toContain("read 20 consecutive times")
|
|
||||||
expect(task.error).not.toContain("::")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given circuit breaker enabled is false", () => {
|
|
||||||
test("#when repetitive tools arrive #then task keeps running", async () => {
|
|
||||||
const manager = createManager({
|
|
||||||
circuitBreaker: {
|
|
||||||
enabled: false,
|
|
||||||
consecutiveThreshold: 20,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const task: BackgroundTask = {
|
|
||||||
id: "task-disabled-1",
|
|
||||||
sessionID: "session-disabled-1",
|
|
||||||
parentSessionID: "parent-1",
|
|
||||||
parentMessageID: "msg-1",
|
|
||||||
description: "Disabled circuit breaker task",
|
|
||||||
prompt: "work",
|
|
||||||
agent: "explore",
|
|
||||||
status: "running",
|
|
||||||
startedAt: new Date(Date.now() - 60_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 0,
|
|
||||||
lastUpdate: new Date(Date.now() - 60_000),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
getTaskMap(manager).set(task.id, task)
|
|
||||||
|
|
||||||
for (let i = 0; i < 20; i++) {
|
|
||||||
manager.handleEvent({
|
|
||||||
type: "message.part.updated",
|
|
||||||
properties: {
|
|
||||||
sessionID: task.sessionID,
|
|
||||||
type: "tool",
|
|
||||||
tool: "read",
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await flushAsyncWork()
|
|
||||||
|
|
||||||
expect(task.status).toBe("running")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given circuit breaker enabled is false but absolute cap is low", () => {
|
|
||||||
test("#when max tool calls exceeded #then task is still cancelled by absolute cap", async () => {
|
|
||||||
const manager = createManager({
|
|
||||||
maxToolCalls: 3,
|
|
||||||
circuitBreaker: {
|
|
||||||
enabled: false,
|
|
||||||
consecutiveThreshold: 95,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
const task: BackgroundTask = {
|
|
||||||
id: "task-cap-disabled-1",
|
|
||||||
sessionID: "session-cap-disabled-1",
|
|
||||||
parentSessionID: "parent-1",
|
|
||||||
parentMessageID: "msg-1",
|
|
||||||
description: "Backstop task with disabled circuit breaker",
|
|
||||||
prompt: "work",
|
|
||||||
agent: "explore",
|
|
||||||
status: "running",
|
|
||||||
startedAt: new Date(Date.now() - 60_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 0,
|
|
||||||
lastUpdate: new Date(Date.now() - 60_000),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
getTaskMap(manager).set(task.id, task)
|
|
||||||
|
|
||||||
for (const toolName of ["read", "grep", "edit"]) {
|
|
||||||
manager.handleEvent({
|
|
||||||
type: "message.part.updated",
|
|
||||||
properties: { sessionID: task.sessionID, type: "tool", tool: toolName },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await flushAsyncWork()
|
|
||||||
|
|
||||||
expect(task.status).toBe("cancelled")
|
|
||||||
expect(task.error).toContain("maximum tool call limit (3)")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -153,42 +153,4 @@ describe("BackgroundManager pollRunningTasks", () => {
|
|||||||
expect(task.status).toBe("running")
|
expect(task.status).toBe("running")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("#given a running task whose session has terminal non-idle status", () => {
|
|
||||||
test('#when session status is "interrupted" #then completes the task', async () => {
|
|
||||||
//#given
|
|
||||||
const manager = createManagerWithClient({
|
|
||||||
status: async () => ({ data: { "ses-interrupted": { type: "interrupted" } } }),
|
|
||||||
})
|
|
||||||
const task = createRunningTask("ses-interrupted")
|
|
||||||
injectTask(manager, task)
|
|
||||||
|
|
||||||
//#when
|
|
||||||
const poll = (manager as unknown as { pollRunningTasks: () => Promise<void> }).pollRunningTasks
|
|
||||||
await poll.call(manager)
|
|
||||||
manager.shutdown()
|
|
||||||
|
|
||||||
//#then
|
|
||||||
expect(task.status).toBe("completed")
|
|
||||||
expect(task.completedAt).toBeDefined()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('#when session status is an unknown type #then completes the task', async () => {
|
|
||||||
//#given
|
|
||||||
const manager = createManagerWithClient({
|
|
||||||
status: async () => ({ data: { "ses-unknown": { type: "some-weird-status" } } }),
|
|
||||||
})
|
|
||||||
const task = createRunningTask("ses-unknown")
|
|
||||||
injectTask(manager, task)
|
|
||||||
|
|
||||||
//#when
|
|
||||||
const poll = (manager as unknown as { pollRunningTasks: () => Promise<void> }).pollRunningTasks
|
|
||||||
await poll.call(manager)
|
|
||||||
manager.shutdown()
|
|
||||||
|
|
||||||
//#then
|
|
||||||
expect(task.status).toBe("completed")
|
|
||||||
expect(task.completedAt).toBeDefined()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
@@ -3027,10 +3027,10 @@ describe("BackgroundManager.checkAndInterruptStaleTasks", () => {
|
|||||||
prompt: "Test",
|
prompt: "Test",
|
||||||
agent: "test-agent",
|
agent: "test-agent",
|
||||||
status: "running",
|
status: "running",
|
||||||
startedAt: new Date(Date.now() - 25 * 60 * 1000),
|
startedAt: new Date(Date.now() - 300_000),
|
||||||
progress: {
|
progress: {
|
||||||
toolCalls: 1,
|
toolCalls: 1,
|
||||||
lastUpdate: new Date(Date.now() - 21 * 60 * 1000),
|
lastUpdate: new Date(Date.now() - 200_000),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ import {
|
|||||||
import {
|
import {
|
||||||
POLLING_INTERVAL_MS,
|
POLLING_INTERVAL_MS,
|
||||||
TASK_CLEANUP_DELAY_MS,
|
TASK_CLEANUP_DELAY_MS,
|
||||||
TASK_TTL_MS,
|
|
||||||
} from "./constants"
|
} from "./constants"
|
||||||
|
|
||||||
import { subagentSessions } from "../claude-code-session-state"
|
import { subagentSessions } from "../claude-code-session-state"
|
||||||
@@ -52,13 +51,6 @@ import { join } from "node:path"
|
|||||||
import { pruneStaleTasksAndNotifications } from "./task-poller"
|
import { pruneStaleTasksAndNotifications } from "./task-poller"
|
||||||
import { checkAndInterruptStaleTasks } from "./task-poller"
|
import { checkAndInterruptStaleTasks } from "./task-poller"
|
||||||
import { removeTaskToastTracking } from "./remove-task-toast-tracking"
|
import { removeTaskToastTracking } from "./remove-task-toast-tracking"
|
||||||
import { isActiveSessionStatus, isTerminalSessionStatus } from "./session-status-classifier"
|
|
||||||
import {
|
|
||||||
detectRepetitiveToolUse,
|
|
||||||
recordToolCall,
|
|
||||||
resolveCircuitBreakerSettings,
|
|
||||||
type CircuitBreakerSettings,
|
|
||||||
} from "./loop-detector"
|
|
||||||
import {
|
import {
|
||||||
createSubagentDepthLimitError,
|
createSubagentDepthLimitError,
|
||||||
createSubagentDescendantLimitError,
|
createSubagentDescendantLimitError,
|
||||||
@@ -72,11 +64,9 @@ type OpencodeClient = PluginInput["client"]
|
|||||||
|
|
||||||
|
|
||||||
interface MessagePartInfo {
|
interface MessagePartInfo {
|
||||||
id?: string
|
|
||||||
sessionID?: string
|
sessionID?: string
|
||||||
type?: string
|
type?: string
|
||||||
tool?: string
|
tool?: string
|
||||||
state?: { status?: string; input?: Record<string, unknown> }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface EventProperties {
|
interface EventProperties {
|
||||||
@@ -90,19 +80,6 @@ interface Event {
|
|||||||
properties?: EventProperties
|
properties?: EventProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveMessagePartInfo(properties: EventProperties | undefined): MessagePartInfo | undefined {
|
|
||||||
if (!properties || typeof properties !== "object") {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
|
|
||||||
const nestedPart = properties.part
|
|
||||||
if (nestedPart && typeof nestedPart === "object") {
|
|
||||||
return nestedPart as MessagePartInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
return properties as MessagePartInfo
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Todo {
|
interface Todo {
|
||||||
content: string
|
content: string
|
||||||
status: string
|
status: string
|
||||||
@@ -123,8 +100,6 @@ export interface SubagentSessionCreatedEvent {
|
|||||||
|
|
||||||
export type OnSubagentSessionCreated = (event: SubagentSessionCreatedEvent) => Promise<void>
|
export type OnSubagentSessionCreated = (event: SubagentSessionCreatedEvent) => Promise<void>
|
||||||
|
|
||||||
const MAX_TASK_REMOVAL_RESCHEDULES = 6
|
|
||||||
|
|
||||||
export class BackgroundManager {
|
export class BackgroundManager {
|
||||||
|
|
||||||
|
|
||||||
@@ -153,7 +128,6 @@ export class BackgroundManager {
|
|||||||
private preStartDescendantReservations: Set<string>
|
private preStartDescendantReservations: Set<string>
|
||||||
private enableParentSessionNotifications: boolean
|
private enableParentSessionNotifications: boolean
|
||||||
readonly taskHistory = new TaskHistory()
|
readonly taskHistory = new TaskHistory()
|
||||||
private cachedCircuitBreakerSettings?: CircuitBreakerSettings
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
ctx: PluginInput,
|
ctx: PluginInput,
|
||||||
@@ -746,8 +720,6 @@ export class BackgroundManager {
|
|||||||
|
|
||||||
existingTask.progress = {
|
existingTask.progress = {
|
||||||
toolCalls: existingTask.progress?.toolCalls ?? 0,
|
toolCalls: existingTask.progress?.toolCalls ?? 0,
|
||||||
toolCallWindow: existingTask.progress?.toolCallWindow,
|
|
||||||
countedToolPartIDs: existingTask.progress?.countedToolPartIDs,
|
|
||||||
lastUpdate: new Date(),
|
lastUpdate: new Date(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -880,7 +852,8 @@ export class BackgroundManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.type === "message.part.updated" || event.type === "message.part.delta") {
|
if (event.type === "message.part.updated" || event.type === "message.part.delta") {
|
||||||
const partInfo = resolveMessagePartInfo(props)
|
if (!props || typeof props !== "object" || !("sessionID" in props)) return
|
||||||
|
const partInfo = props as unknown as MessagePartInfo
|
||||||
const sessionID = partInfo?.sessionID
|
const sessionID = partInfo?.sessionID
|
||||||
if (!sessionID) return
|
if (!sessionID) return
|
||||||
|
|
||||||
@@ -903,65 +876,8 @@ export class BackgroundManager {
|
|||||||
task.progress.lastUpdate = new Date()
|
task.progress.lastUpdate = new Date()
|
||||||
|
|
||||||
if (partInfo?.type === "tool" || partInfo?.tool) {
|
if (partInfo?.type === "tool" || partInfo?.tool) {
|
||||||
const countedToolPartIDs = task.progress.countedToolPartIDs ?? new Set<string>()
|
|
||||||
const shouldCountToolCall =
|
|
||||||
!partInfo.id ||
|
|
||||||
partInfo.state?.status !== "running" ||
|
|
||||||
!countedToolPartIDs.has(partInfo.id)
|
|
||||||
|
|
||||||
if (!shouldCountToolCall) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (partInfo.id && partInfo.state?.status === "running") {
|
|
||||||
countedToolPartIDs.add(partInfo.id)
|
|
||||||
task.progress.countedToolPartIDs = countedToolPartIDs
|
|
||||||
}
|
|
||||||
|
|
||||||
task.progress.toolCalls += 1
|
task.progress.toolCalls += 1
|
||||||
task.progress.lastTool = partInfo.tool
|
task.progress.lastTool = partInfo.tool
|
||||||
const circuitBreaker = this.cachedCircuitBreakerSettings ?? (this.cachedCircuitBreakerSettings = resolveCircuitBreakerSettings(this.config))
|
|
||||||
if (partInfo.tool) {
|
|
||||||
task.progress.toolCallWindow = recordToolCall(
|
|
||||||
task.progress.toolCallWindow,
|
|
||||||
partInfo.tool,
|
|
||||||
circuitBreaker,
|
|
||||||
partInfo.state?.input
|
|
||||||
)
|
|
||||||
|
|
||||||
if (circuitBreaker.enabled) {
|
|
||||||
const loopDetection = detectRepetitiveToolUse(task.progress.toolCallWindow)
|
|
||||||
if (loopDetection.triggered) {
|
|
||||||
log("[background-agent] Circuit breaker: consecutive tool usage detected", {
|
|
||||||
taskId: task.id,
|
|
||||||
agent: task.agent,
|
|
||||||
sessionID,
|
|
||||||
toolName: loopDetection.toolName,
|
|
||||||
repeatedCount: loopDetection.repeatedCount,
|
|
||||||
})
|
|
||||||
void this.cancelTask(task.id, {
|
|
||||||
source: "circuit-breaker",
|
|
||||||
reason: `Subagent called ${loopDetection.toolName} ${loopDetection.repeatedCount} consecutive times (threshold: ${circuitBreaker.consecutiveThreshold}). This usually indicates an infinite loop. The task was automatically cancelled to prevent excessive token usage.`,
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const maxToolCalls = circuitBreaker.maxToolCalls
|
|
||||||
if (task.progress.toolCalls >= maxToolCalls) {
|
|
||||||
log("[background-agent] Circuit breaker: tool call limit reached", {
|
|
||||||
taskId: task.id,
|
|
||||||
toolCalls: task.progress.toolCalls,
|
|
||||||
maxToolCalls,
|
|
||||||
agent: task.agent,
|
|
||||||
sessionID,
|
|
||||||
})
|
|
||||||
void this.cancelTask(task.id, {
|
|
||||||
source: "circuit-breaker",
|
|
||||||
reason: `Subagent exceeded maximum tool call limit (${maxToolCalls}). This usually indicates an infinite loop. The task was automatically cancelled to prevent excessive token usage.`,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1272,7 +1188,7 @@ export class BackgroundManager {
|
|||||||
this.completedTaskSummaries.delete(parentSessionID)
|
this.completedTaskSummaries.delete(parentSessionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
private scheduleTaskRemoval(taskId: string, rescheduleCount = 0): void {
|
private scheduleTaskRemoval(taskId: string): void {
|
||||||
const existingTimer = this.completionTimers.get(taskId)
|
const existingTimer = this.completionTimers.get(taskId)
|
||||||
if (existingTimer) {
|
if (existingTimer) {
|
||||||
clearTimeout(existingTimer)
|
clearTimeout(existingTimer)
|
||||||
@@ -1282,29 +1198,17 @@ export class BackgroundManager {
|
|||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
this.completionTimers.delete(taskId)
|
this.completionTimers.delete(taskId)
|
||||||
const task = this.tasks.get(taskId)
|
const task = this.tasks.get(taskId)
|
||||||
if (!task) return
|
if (task) {
|
||||||
|
this.clearNotificationsForTask(taskId)
|
||||||
if (task.parentSessionID) {
|
this.tasks.delete(taskId)
|
||||||
const siblings = this.getTasksByParentSession(task.parentSessionID)
|
this.clearTaskHistoryWhenParentTasksGone(task.parentSessionID)
|
||||||
const runningOrPendingSiblings = siblings.filter(
|
if (task.sessionID) {
|
||||||
sibling => sibling.id !== taskId && (sibling.status === "running" || sibling.status === "pending"),
|
subagentSessions.delete(task.sessionID)
|
||||||
)
|
SessionCategoryRegistry.remove(task.sessionID)
|
||||||
const completedAtTimestamp = task.completedAt?.getTime()
|
|
||||||
const reachedTaskTtl = completedAtTimestamp !== undefined && (Date.now() - completedAtTimestamp) >= TASK_TTL_MS
|
|
||||||
if (runningOrPendingSiblings.length > 0 && rescheduleCount < MAX_TASK_REMOVAL_RESCHEDULES && !reachedTaskTtl) {
|
|
||||||
this.scheduleTaskRemoval(taskId, rescheduleCount + 1)
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
log("[background-agent] Removed completed task from memory:", taskId)
|
||||||
|
this.clearTaskHistoryWhenParentTasksGone(task?.parentSessionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.clearNotificationsForTask(taskId)
|
|
||||||
this.tasks.delete(taskId)
|
|
||||||
this.clearTaskHistoryWhenParentTasksGone(task.parentSessionID)
|
|
||||||
if (task.sessionID) {
|
|
||||||
subagentSessions.delete(task.sessionID)
|
|
||||||
SessionCategoryRegistry.remove(task.sessionID)
|
|
||||||
}
|
|
||||||
log("[background-agent] Removed completed task from memory:", taskId)
|
|
||||||
}, TASK_CLEANUP_DELAY_MS)
|
}, TASK_CLEANUP_DELAY_MS)
|
||||||
|
|
||||||
this.completionTimers.set(taskId, timer)
|
this.completionTimers.set(taskId, timer)
|
||||||
@@ -1784,9 +1688,11 @@ Use \`background_output(task_id="${task.id}")\` to retrieve this result when rea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only skip completion when session status is actively running.
|
// Match sync-session-poller pattern: only skip completion check when
|
||||||
// Unknown or terminal statuses (like "interrupted") fall through to completion.
|
// status EXISTS and is not idle (i.e., session is actively running).
|
||||||
if (sessionStatus && isActiveSessionStatus(sessionStatus.type)) {
|
// When sessionStatus is undefined, the session has completed and dropped
|
||||||
|
// from the status response — fall through to completion detection.
|
||||||
|
if (sessionStatus && sessionStatus.type !== "idle") {
|
||||||
log("[background-agent] Session still running, relying on event-based progress:", {
|
log("[background-agent] Session still running, relying on event-based progress:", {
|
||||||
taskId: task.id,
|
taskId: task.id,
|
||||||
sessionID,
|
sessionID,
|
||||||
@@ -1796,24 +1702,6 @@ Use \`background_output(task_id="${task.id}")\` to retrieve this result when rea
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicit terminal non-idle status (e.g., "interrupted") — complete immediately,
|
|
||||||
// skipping output validation (session will never produce more output).
|
|
||||||
// Unknown statuses fall through to the idle/gone path with output validation.
|
|
||||||
if (sessionStatus && isTerminalSessionStatus(sessionStatus.type)) {
|
|
||||||
await this.tryCompleteTask(task, `polling (terminal session status: ${sessionStatus.type})`)
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unknown non-idle status — not active, not terminal, not idle.
|
|
||||||
// Fall through to idle/gone completion path with output validation.
|
|
||||||
if (sessionStatus && sessionStatus.type !== "idle") {
|
|
||||||
log("[background-agent] Unknown session status, treating as potentially idle:", {
|
|
||||||
taskId: task.id,
|
|
||||||
sessionID,
|
|
||||||
sessionStatus: sessionStatus.type,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Session is idle or no longer in status response (completed/disappeared)
|
// Session is idle or no longer in status response (completed/disappeared)
|
||||||
const completionSource = sessionStatus?.type === "idle"
|
const completionSource = sessionStatus?.type === "idle"
|
||||||
? "polling (idle status)"
|
? "polling (idle status)"
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
import { describe, test, expect, mock } from "bun:test"
|
|
||||||
import { isActiveSessionStatus, isTerminalSessionStatus } from "./session-status-classifier"
|
|
||||||
|
|
||||||
const mockLog = mock()
|
|
||||||
mock.module("../../shared", () => ({ log: mockLog }))
|
|
||||||
|
|
||||||
describe("isActiveSessionStatus", () => {
|
|
||||||
describe("#given a known active session status", () => {
|
|
||||||
test('#when type is "busy" #then returns true', () => {
|
|
||||||
expect(isActiveSessionStatus("busy")).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('#when type is "retry" #then returns true', () => {
|
|
||||||
expect(isActiveSessionStatus("retry")).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('#when type is "running" #then returns true', () => {
|
|
||||||
expect(isActiveSessionStatus("running")).toBe(true)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given a known terminal session status", () => {
|
|
||||||
test('#when type is "idle" #then returns false', () => {
|
|
||||||
expect(isActiveSessionStatus("idle")).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('#when type is "interrupted" #then returns false and does not log', () => {
|
|
||||||
mockLog.mockClear()
|
|
||||||
expect(isActiveSessionStatus("interrupted")).toBe(false)
|
|
||||||
expect(mockLog).not.toHaveBeenCalled()
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given an unknown session status", () => {
|
|
||||||
test('#when type is an arbitrary unknown string #then returns false and logs warning', () => {
|
|
||||||
mockLog.mockClear()
|
|
||||||
expect(isActiveSessionStatus("some-unknown-status")).toBe(false)
|
|
||||||
expect(mockLog).toHaveBeenCalledWith(
|
|
||||||
"[background-agent] Unknown session status type encountered:",
|
|
||||||
"some-unknown-status",
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('#when type is empty string #then returns false', () => {
|
|
||||||
expect(isActiveSessionStatus("")).toBe(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("isTerminalSessionStatus", () => {
|
|
||||||
test('#when type is "interrupted" #then returns true', () => {
|
|
||||||
expect(isTerminalSessionStatus("interrupted")).toBe(true)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('#when type is "idle" #then returns false (idle is handled separately)', () => {
|
|
||||||
expect(isTerminalSessionStatus("idle")).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('#when type is "busy" #then returns false', () => {
|
|
||||||
expect(isTerminalSessionStatus("busy")).toBe(false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test('#when type is an unknown string #then returns false', () => {
|
|
||||||
expect(isTerminalSessionStatus("some-unknown")).toBe(false)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import { log } from "../../shared"
|
|
||||||
|
|
||||||
const ACTIVE_SESSION_STATUSES = new Set(["busy", "retry", "running"])
|
|
||||||
const KNOWN_TERMINAL_STATUSES = new Set(["idle", "interrupted"])
|
|
||||||
|
|
||||||
export function isActiveSessionStatus(type: string): boolean {
|
|
||||||
if (ACTIVE_SESSION_STATUSES.has(type)) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!KNOWN_TERMINAL_STATUSES.has(type)) {
|
|
||||||
log("[background-agent] Unknown session status type encountered:", type)
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isTerminalSessionStatus(type: string): boolean {
|
|
||||||
return KNOWN_TERMINAL_STATUSES.has(type) && type !== "idle"
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
|
declare const require: (name: string) => any
|
||||||
|
const { describe, test, expect, afterEach } = require("bun:test")
|
||||||
import { tmpdir } from "node:os"
|
import { tmpdir } from "node:os"
|
||||||
import { afterEach, describe, expect, test } from "bun:test"
|
|
||||||
import type { PluginInput } from "@opencode-ai/plugin"
|
import type { PluginInput } from "@opencode-ai/plugin"
|
||||||
import { TASK_CLEANUP_DELAY_MS } from "./constants"
|
import { TASK_CLEANUP_DELAY_MS } from "./constants"
|
||||||
import { BackgroundManager } from "./manager"
|
import { BackgroundManager } from "./manager"
|
||||||
@@ -156,19 +157,17 @@ function getRequiredTimer(manager: BackgroundManager, taskID: string): ReturnTyp
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("BackgroundManager.notifyParentSession cleanup scheduling", () => {
|
describe("BackgroundManager.notifyParentSession cleanup scheduling", () => {
|
||||||
describe("#given 3 tasks for same parent and task A completed first", () => {
|
describe("#given 2 tasks for same parent and task A completed", () => {
|
||||||
test("#when siblings are still running or pending #then task A remains until siblings also complete", async () => {
|
test("#when task B is still running #then task A is cleaned up from this.tasks after delay even though task B is not done", async () => {
|
||||||
// given
|
// given
|
||||||
const { manager } = createManager(false)
|
const { manager } = createManager(false)
|
||||||
managerUnderTest = manager
|
managerUnderTest = manager
|
||||||
fakeTimers = installFakeTimers()
|
fakeTimers = installFakeTimers()
|
||||||
const taskA = createTask({ id: "task-a", parentSessionID: "parent-1", description: "task A", status: "completed", completedAt: new Date() })
|
const taskA = createTask({ id: "task-a", parentSessionID: "parent-1", description: "task A", status: "completed", completedAt: new Date("2026-03-11T00:01:00.000Z") })
|
||||||
const taskB = createTask({ id: "task-b", parentSessionID: "parent-1", description: "task B", status: "running" })
|
const taskB = createTask({ id: "task-b", parentSessionID: "parent-1", description: "task B", status: "running" })
|
||||||
const taskC = createTask({ id: "task-c", parentSessionID: "parent-1", description: "task C", status: "pending" })
|
|
||||||
getTasks(manager).set(taskA.id, taskA)
|
getTasks(manager).set(taskA.id, taskA)
|
||||||
getTasks(manager).set(taskB.id, taskB)
|
getTasks(manager).set(taskB.id, taskB)
|
||||||
getTasks(manager).set(taskC.id, taskC)
|
getPendingByParent(manager).set(taskA.parentSessionID, new Set([taskA.id, taskB.id]))
|
||||||
getPendingByParent(manager).set(taskA.parentSessionID, new Set([taskA.id, taskB.id, taskC.id]))
|
|
||||||
|
|
||||||
// when
|
// when
|
||||||
await notifyParentSessionForTest(manager, taskA)
|
await notifyParentSessionForTest(manager, taskA)
|
||||||
@@ -178,23 +177,8 @@ describe("BackgroundManager.notifyParentSession cleanup scheduling", () => {
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
expect(fakeTimers.getDelay(taskATimer)).toBeUndefined()
|
expect(fakeTimers.getDelay(taskATimer)).toBeUndefined()
|
||||||
expect(getTasks(manager).has(taskA.id)).toBe(true)
|
|
||||||
expect(getTasks(manager).get(taskB.id)).toBe(taskB)
|
|
||||||
expect(getTasks(manager).get(taskC.id)).toBe(taskC)
|
|
||||||
|
|
||||||
// when
|
|
||||||
taskB.status = "completed"
|
|
||||||
taskB.completedAt = new Date()
|
|
||||||
taskC.status = "completed"
|
|
||||||
taskC.completedAt = new Date()
|
|
||||||
await notifyParentSessionForTest(manager, taskB)
|
|
||||||
await notifyParentSessionForTest(manager, taskC)
|
|
||||||
const rescheduledTaskATimer = getRequiredTimer(manager, taskA.id)
|
|
||||||
expect(fakeTimers.getDelay(rescheduledTaskATimer)).toBe(TASK_CLEANUP_DELAY_MS)
|
|
||||||
fakeTimers.run(rescheduledTaskATimer)
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(getTasks(manager).has(taskA.id)).toBe(false)
|
expect(getTasks(manager).has(taskA.id)).toBe(false)
|
||||||
|
expect(getTasks(manager).get(taskB.id)).toBe(taskB)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -417,56 +417,6 @@ describe("checkAndInterruptStaleTasks", () => {
|
|||||||
expect(task.status).toBe("cancelled")
|
expect(task.status).toBe("cancelled")
|
||||||
expect(onTaskInterrupted).toHaveBeenCalledWith(task)
|
expect(onTaskInterrupted).toHaveBeenCalledWith(task)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should NOT protect task when session has terminal non-idle status like "interrupted"', async () => {
|
|
||||||
//#given — lastUpdate is 5min old, session is "interrupted" (terminal, not active)
|
|
||||||
const task = createRunningTask({
|
|
||||||
startedAt: new Date(Date.now() - 300_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 2,
|
|
||||||
lastUpdate: new Date(Date.now() - 300_000),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
//#when — session status is "interrupted" (terminal)
|
|
||||||
await checkAndInterruptStaleTasks({
|
|
||||||
tasks: [task],
|
|
||||||
client: mockClient as never,
|
|
||||||
config: { staleTimeoutMs: 180_000 },
|
|
||||||
concurrencyManager: mockConcurrencyManager as never,
|
|
||||||
notifyParentSession: mockNotify,
|
|
||||||
sessionStatuses: { "ses-1": { type: "interrupted" } },
|
|
||||||
})
|
|
||||||
|
|
||||||
//#then — terminal statuses should not protect from stale timeout
|
|
||||||
expect(task.status).toBe("cancelled")
|
|
||||||
expect(task.error).toContain("Stale timeout")
|
|
||||||
})
|
|
||||||
|
|
||||||
it('should NOT protect task when session has unknown status type', async () => {
|
|
||||||
//#given — lastUpdate is 5min old, session has an unknown status
|
|
||||||
const task = createRunningTask({
|
|
||||||
startedAt: new Date(Date.now() - 300_000),
|
|
||||||
progress: {
|
|
||||||
toolCalls: 2,
|
|
||||||
lastUpdate: new Date(Date.now() - 300_000),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
//#when — session has unknown status type
|
|
||||||
await checkAndInterruptStaleTasks({
|
|
||||||
tasks: [task],
|
|
||||||
client: mockClient as never,
|
|
||||||
config: { staleTimeoutMs: 180_000 },
|
|
||||||
concurrencyManager: mockConcurrencyManager as never,
|
|
||||||
notifyParentSession: mockNotify,
|
|
||||||
sessionStatuses: { "ses-1": { type: "some-weird-status" } },
|
|
||||||
})
|
|
||||||
|
|
||||||
//#then — unknown statuses should not protect from stale timeout
|
|
||||||
expect(task.status).toBe("cancelled")
|
|
||||||
expect(task.error).toContain("Stale timeout")
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("pruneStaleTasksAndNotifications", () => {
|
describe("pruneStaleTasksAndNotifications", () => {
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ import {
|
|||||||
DEFAULT_MESSAGE_STALENESS_TIMEOUT_MS,
|
DEFAULT_MESSAGE_STALENESS_TIMEOUT_MS,
|
||||||
DEFAULT_STALE_TIMEOUT_MS,
|
DEFAULT_STALE_TIMEOUT_MS,
|
||||||
MIN_RUNTIME_BEFORE_STALE_MS,
|
MIN_RUNTIME_BEFORE_STALE_MS,
|
||||||
TERMINAL_TASK_TTL_MS,
|
|
||||||
TASK_TTL_MS,
|
TASK_TTL_MS,
|
||||||
} from "./constants"
|
} from "./constants"
|
||||||
import { removeTaskToastTracking } from "./remove-task-toast-tracking"
|
import { removeTaskToastTracking } from "./remove-task-toast-tracking"
|
||||||
|
|
||||||
import { isActiveSessionStatus } from "./session-status-classifier"
|
const TERMINAL_TASK_TTL_MS = 30 * 60 * 1000
|
||||||
|
|
||||||
const TERMINAL_TASK_STATUSES = new Set<BackgroundTask["status"]>([
|
const TERMINAL_TASK_STATUSES = new Set<BackgroundTask["status"]>([
|
||||||
"completed",
|
"completed",
|
||||||
"error",
|
"error",
|
||||||
@@ -121,7 +121,7 @@ export async function checkAndInterruptStaleTasks(args: {
|
|||||||
if (!startedAt || !sessionID) continue
|
if (!startedAt || !sessionID) continue
|
||||||
|
|
||||||
const sessionStatus = sessionStatuses?.[sessionID]?.type
|
const sessionStatus = sessionStatuses?.[sessionID]?.type
|
||||||
const sessionIsRunning = sessionStatus !== undefined && isActiveSessionStatus(sessionStatus)
|
const sessionIsRunning = sessionStatus !== undefined && sessionStatus !== "idle"
|
||||||
const runtime = now - startedAt.getTime()
|
const runtime = now - startedAt.getTime()
|
||||||
|
|
||||||
if (!task.progress?.lastUpdate) {
|
if (!task.progress?.lastUpdate) {
|
||||||
|
|||||||
@@ -9,17 +9,9 @@ export type BackgroundTaskStatus =
|
|||||||
| "cancelled"
|
| "cancelled"
|
||||||
| "interrupt"
|
| "interrupt"
|
||||||
|
|
||||||
export interface ToolCallWindow {
|
|
||||||
lastSignature: string
|
|
||||||
consecutiveCount: number
|
|
||||||
threshold: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface TaskProgress {
|
export interface TaskProgress {
|
||||||
toolCalls: number
|
toolCalls: number
|
||||||
lastTool?: string
|
lastTool?: string
|
||||||
toolCallWindow?: ToolCallWindow
|
|
||||||
countedToolPartIDs?: Set<string>
|
|
||||||
lastUpdate: Date
|
lastUpdate: Date
|
||||||
lastMessage?: string
|
lastMessage?: string
|
||||||
lastMessageAt?: Date
|
lastMessageAt?: Date
|
||||||
|
|||||||
@@ -59,13 +59,10 @@ export function appendSessionId(directory: string, sessionId: string): BoulderSt
|
|||||||
if (!Array.isArray(state.session_ids)) {
|
if (!Array.isArray(state.session_ids)) {
|
||||||
state.session_ids = []
|
state.session_ids = []
|
||||||
}
|
}
|
||||||
const originalSessionIds = [...state.session_ids]
|
|
||||||
state.session_ids.push(sessionId)
|
state.session_ids.push(sessionId)
|
||||||
if (writeBoulderState(directory, state)) {
|
if (writeBoulderState(directory, state)) {
|
||||||
return state
|
return state
|
||||||
}
|
}
|
||||||
state.session_ids = originalSessionIds
|
|
||||||
return null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return state
|
return state
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export const START_WORK_TEMPLATE = `You are starting a Sisyphus work session.
|
|||||||
- \`--worktree <path>\` (optional): absolute path to an existing git worktree to work in
|
- \`--worktree <path>\` (optional): absolute path to an existing git worktree to work in
|
||||||
- If specified and valid: hook pre-sets worktree_path in boulder.json
|
- If specified and valid: hook pre-sets worktree_path in boulder.json
|
||||||
- If specified but invalid: you must run \`git worktree add <path> <branch>\` first
|
- If specified but invalid: you must run \`git worktree add <path> <branch>\` first
|
||||||
- If omitted: work directly in the current project directory (no worktree)
|
- If omitted: you MUST choose or create a worktree (see Worktree Setup below)
|
||||||
|
|
||||||
## WHAT TO DO
|
## WHAT TO DO
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ export const START_WORK_TEMPLATE = `You are starting a Sisyphus work session.
|
|||||||
- If ONE plan: auto-select it
|
- If ONE plan: auto-select it
|
||||||
- If MULTIPLE plans: show list with timestamps, ask user to select
|
- If MULTIPLE plans: show list with timestamps, ask user to select
|
||||||
|
|
||||||
4. **Worktree Setup** (ONLY when \`--worktree\` was explicitly specified and \`worktree_path\` not already set in boulder.json):
|
4. **Worktree Setup** (when \`worktree_path\` not already set in boulder.json):
|
||||||
1. \`git worktree list --porcelain\` — see available worktrees
|
1. \`git worktree list --porcelain\` — see available worktrees
|
||||||
2. Create: \`git worktree add <absolute-path> <branch-or-HEAD>\`
|
2. Create: \`git worktree add <absolute-path> <branch-or-HEAD>\`
|
||||||
3. Update boulder.json to add \`"worktree_path": "<absolute-path>"\`
|
3. Update boulder.json to add \`"worktree_path": "<absolute-path>"\`
|
||||||
@@ -86,38 +86,6 @@ Reading plan and beginning execution...
|
|||||||
|
|
||||||
- The session_id is injected by the hook - use it directly
|
- The session_id is injected by the hook - use it directly
|
||||||
- Always update boulder.json BEFORE starting work
|
- Always update boulder.json BEFORE starting work
|
||||||
- If worktree_path is set in boulder.json, all work happens inside that worktree directory
|
- Always set worktree_path in boulder.json before executing any tasks
|
||||||
- Read the FULL plan file before delegating any tasks
|
- Read the FULL plan file before delegating any tasks
|
||||||
- Follow atlas delegation protocols (7-section format)
|
- Follow atlas delegation protocols (7-section format)`
|
||||||
|
|
||||||
## TASK BREAKDOWN (MANDATORY)
|
|
||||||
|
|
||||||
After reading the plan file, you MUST decompose every plan task into granular, implementation-level sub-steps and register ALL of them as task/todo items BEFORE starting any work.
|
|
||||||
|
|
||||||
**How to break down**:
|
|
||||||
- Each plan checkbox item (e.g., \`- [ ] Add user authentication\`) must be split into concrete, actionable sub-tasks
|
|
||||||
- Sub-tasks should be specific enough that each one touches a clear set of files/functions
|
|
||||||
- Include: file to modify, what to change, expected behavior, and how to verify
|
|
||||||
- Do NOT leave any task vague — "implement feature X" is NOT acceptable; "add validateToken() to src/auth/middleware.ts that checks JWT expiry and returns 401" IS acceptable
|
|
||||||
|
|
||||||
**Example breakdown**:
|
|
||||||
Plan task: \`- [ ] Add rate limiting to API\`
|
|
||||||
→ Todo items:
|
|
||||||
1. Create \`src/middleware/rate-limiter.ts\` with sliding window algorithm (max 100 req/min per IP)
|
|
||||||
2. Add RateLimiter middleware to \`src/app.ts\` router chain, before auth middleware
|
|
||||||
3. Add rate limit headers (X-RateLimit-Limit, X-RateLimit-Remaining) to response in \`rate-limiter.ts\`
|
|
||||||
4. Add test: verify 429 response after exceeding limit in \`src/middleware/rate-limiter.test.ts\`
|
|
||||||
5. Add test: verify headers are present on normal responses
|
|
||||||
|
|
||||||
Register these as task/todo items so progress is tracked and visible throughout the session.
|
|
||||||
|
|
||||||
## WORKTREE COMPLETION
|
|
||||||
|
|
||||||
When working in a worktree (\`worktree_path\` is set in boulder.json) and ALL plan tasks are complete:
|
|
||||||
1. Commit all remaining changes in the worktree
|
|
||||||
2. Switch to the main working directory (the original repo, NOT the worktree)
|
|
||||||
3. Merge the worktree branch into the current branch: \`git merge <worktree-branch>\`
|
|
||||||
4. If merge succeeds, clean up: \`git worktree remove <worktree-path>\`
|
|
||||||
5. Remove the boulder.json state
|
|
||||||
|
|
||||||
This is the DEFAULT behavior when \`--worktree\` was used. Skip merge only if the user explicitly instructs otherwise (e.g., asks to create a PR instead).`
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ This guide covers installation for all platforms: macOS, Linux, and Windows.
|
|||||||
git clone https://github.com/sawyerhood/dev-browser /tmp/dev-browser-skill
|
git clone https://github.com/sawyerhood/dev-browser /tmp/dev-browser-skill
|
||||||
|
|
||||||
# Copy to skills directory (adjust path as needed)
|
# Copy to skills directory (adjust path as needed)
|
||||||
# For oh-my-opencode: already bundled
|
# For oh-my-openagent: already bundled
|
||||||
# For manual installation:
|
# For manual installation:
|
||||||
mkdir -p ~/.config/opencode/skills
|
mkdir -p ~/.config/opencode/skills
|
||||||
cp -r /tmp/dev-browser-skill/skills/dev-browser ~/.config/opencode/skills/dev-browser
|
cp -r /tmp/dev-browser-skill/skills/dev-browser ~/.config/opencode/skills/dev-browser
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
## OVERVIEW
|
## OVERVIEW
|
||||||
|
|
||||||
18 files. Full OAuth 2.0 authorization flow for MCP servers requiring authentication. Implements PKCE (RFC 7636), Dynamic Client Registration (DCR, RFC 7591), and resource indicators (RFC 8707). Used by `bunx oh-my-opencode mcp-oauth login`.
|
18 files. Full OAuth 2.0 authorization flow for MCP servers requiring authentication. Implements PKCE (RFC 7636), Dynamic Client Registration (DCR, RFC 7591), and resource indicators (RFC 8707). Used by `bunx oh-my-openagent mcp-oauth login`.
|
||||||
|
|
||||||
## AUTHORIZATION FLOW
|
## AUTHORIZATION FLOW
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ Fields: `access_token`, `refresh_token`, `expires_at`, `client_id`.
|
|||||||
## CLI COMMANDS
|
## CLI COMMANDS
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bunx oh-my-opencode mcp-oauth login <server-url> # Full PKCE flow
|
bunx oh-my-openagent mcp-oauth login <server-url> # Full PKCE flow
|
||||||
bunx oh-my-opencode mcp-oauth logout <server-url> # Revoke + delete token
|
bunx oh-my-openagent mcp-oauth logout <server-url> # Revoke + delete token
|
||||||
bunx oh-my-opencode mcp-oauth status # List stored tokens
|
bunx oh-my-openagent mcp-oauth status # List stored tokens
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -153,25 +153,3 @@ describe("#given git_env_prefix with commit footer", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("#given idempotency of prefixGitCommandsInBashCodeBlocks", () => {
|
|
||||||
describe("#when git_env_prefix is provided and template already has prefixed commands in env prefix section", () => {
|
|
||||||
it("#then does NOT double-prefix the already-prefixed commands", () => {
|
|
||||||
const result = injectGitMasterConfig(SAMPLE_TEMPLATE, {
|
|
||||||
commit_footer: false,
|
|
||||||
include_co_authored_by: false,
|
|
||||||
git_env_prefix: "GIT_MASTER=1",
|
|
||||||
})
|
|
||||||
|
|
||||||
expect(result).not.toContain("GIT_MASTER=1 GIT_MASTER=1 git status")
|
|
||||||
expect(result).not.toContain("GIT_MASTER=1 GIT_MASTER=1 git add")
|
|
||||||
expect(result).not.toContain("GIT_MASTER=1 GIT_MASTER=1 git commit")
|
|
||||||
expect(result).not.toContain("GIT_MASTER=1 GIT_MASTER=1 git push")
|
|
||||||
|
|
||||||
expect(result).toContain("GIT_MASTER=1 git status")
|
|
||||||
expect(result).toContain("GIT_MASTER=1 git add")
|
|
||||||
expect(result).toContain("GIT_MASTER=1 git commit")
|
|
||||||
expect(result).toContain("GIT_MASTER=1 git push")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -72,16 +72,8 @@ function prefixGitCommandsInBashCodeBlocks(template: string, prefix: string): st
|
|||||||
|
|
||||||
function prefixGitCommandsInCodeBlock(codeBlock: string, prefix: string): string {
|
function prefixGitCommandsInCodeBlock(codeBlock: string, prefix: string): string {
|
||||||
return codeBlock
|
return codeBlock
|
||||||
.split("\n")
|
.replace(LEADING_GIT_COMMAND_PATTERN, `$1${prefix} git`)
|
||||||
.map((line) => {
|
.replace(INLINE_GIT_COMMAND_PATTERN, `$1${prefix} git`)
|
||||||
if (line.includes(prefix)) {
|
|
||||||
return line
|
|
||||||
}
|
|
||||||
return line
|
|
||||||
.replace(LEADING_GIT_COMMAND_PATTERN, `$1${prefix} git`)
|
|
||||||
.replace(INLINE_GIT_COMMAND_PATTERN, `$1${prefix} git`)
|
|
||||||
})
|
|
||||||
.join("\n")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildCommitFooterInjection(
|
function buildCommitFooterInjection(
|
||||||
|
|||||||
@@ -199,236 +199,3 @@ describe("EXCLUDED_ENV_PATTERNS", () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe("secret env var filtering", () => {
|
|
||||||
it("filters out ANTHROPIC_API_KEY", () => {
|
|
||||||
// given
|
|
||||||
process.env.ANTHROPIC_API_KEY = "sk-ant-api03-secret"
|
|
||||||
process.env.PATH = "/usr/bin"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.ANTHROPIC_API_KEY).toBeUndefined()
|
|
||||||
expect(cleanEnv.PATH).toBe("/usr/bin")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("filters out AWS_SECRET_ACCESS_KEY", () => {
|
|
||||||
// given
|
|
||||||
process.env.AWS_SECRET_ACCESS_KEY = "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
|
|
||||||
process.env.AWS_ACCESS_KEY_ID = "AKIAIOSFODNN7EXAMPLE"
|
|
||||||
process.env.HOME = "/home/user"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.AWS_SECRET_ACCESS_KEY).toBeUndefined()
|
|
||||||
expect(cleanEnv.AWS_ACCESS_KEY_ID).toBeUndefined()
|
|
||||||
expect(cleanEnv.HOME).toBe("/home/user")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("filters out GITHUB_TOKEN", () => {
|
|
||||||
// given
|
|
||||||
process.env.GITHUB_TOKEN = "ghp_secrettoken123456789"
|
|
||||||
process.env.GITHUB_API_TOKEN = "another_secret_token"
|
|
||||||
process.env.SHELL = "/bin/bash"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.GITHUB_TOKEN).toBeUndefined()
|
|
||||||
expect(cleanEnv.GITHUB_API_TOKEN).toBeUndefined()
|
|
||||||
expect(cleanEnv.SHELL).toBe("/bin/bash")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("filters out OPENAI_API_KEY", () => {
|
|
||||||
// given
|
|
||||||
process.env.OPENAI_API_KEY = "sk-secret123456789"
|
|
||||||
process.env.LANG = "en_US.UTF-8"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.OPENAI_API_KEY).toBeUndefined()
|
|
||||||
expect(cleanEnv.LANG).toBe("en_US.UTF-8")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("filters out DATABASE_URL with credentials", () => {
|
|
||||||
// given
|
|
||||||
process.env.DATABASE_URL = "postgresql://user:password@localhost:5432/db"
|
|
||||||
process.env.DB_PASSWORD = "supersecretpassword"
|
|
||||||
process.env.TERM = "xterm-256color"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.DATABASE_URL).toBeUndefined()
|
|
||||||
expect(cleanEnv.DB_PASSWORD).toBeUndefined()
|
|
||||||
expect(cleanEnv.TERM).toBe("xterm-256color")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("suffix-based secret filtering", () => {
|
|
||||||
it("filters variables ending with _KEY", () => {
|
|
||||||
// given
|
|
||||||
process.env.MY_API_KEY = "secret-value"
|
|
||||||
process.env.SOME_KEY = "another-secret"
|
|
||||||
process.env.TMPDIR = "/tmp"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.MY_API_KEY).toBeUndefined()
|
|
||||||
expect(cleanEnv.SOME_KEY).toBeUndefined()
|
|
||||||
expect(cleanEnv.TMPDIR).toBe("/tmp")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("filters variables ending with _SECRET", () => {
|
|
||||||
// given
|
|
||||||
process.env.AWS_SECRET = "secret-value"
|
|
||||||
process.env.JWT_SECRET = "jwt-secret-token"
|
|
||||||
process.env.USER = "testuser"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.AWS_SECRET).toBeUndefined()
|
|
||||||
expect(cleanEnv.JWT_SECRET).toBeUndefined()
|
|
||||||
expect(cleanEnv.USER).toBe("testuser")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("filters variables ending with _TOKEN", () => {
|
|
||||||
// given
|
|
||||||
process.env.ACCESS_TOKEN = "token-value"
|
|
||||||
process.env.BEARER_TOKEN = "bearer-token"
|
|
||||||
process.env.HOME = "/home/user"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.ACCESS_TOKEN).toBeUndefined()
|
|
||||||
expect(cleanEnv.BEARER_TOKEN).toBeUndefined()
|
|
||||||
expect(cleanEnv.HOME).toBe("/home/user")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("filters variables ending with _PASSWORD", () => {
|
|
||||||
// given
|
|
||||||
process.env.DB_PASSWORD = "db-password"
|
|
||||||
process.env.APP_PASSWORD = "app-secret"
|
|
||||||
process.env.NODE_ENV = "production"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.DB_PASSWORD).toBeUndefined()
|
|
||||||
expect(cleanEnv.APP_PASSWORD).toBeUndefined()
|
|
||||||
expect(cleanEnv.NODE_ENV).toBe("production")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("filters variables ending with _CREDENTIAL", () => {
|
|
||||||
// given
|
|
||||||
process.env.GCP_CREDENTIAL = "json-credential"
|
|
||||||
process.env.AZURE_CREDENTIAL = "azure-creds"
|
|
||||||
process.env.PWD = "/current/dir"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.GCP_CREDENTIAL).toBeUndefined()
|
|
||||||
expect(cleanEnv.AZURE_CREDENTIAL).toBeUndefined()
|
|
||||||
expect(cleanEnv.PWD).toBe("/current/dir")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("filters variables ending with _API_KEY", () => {
|
|
||||||
// given
|
|
||||||
// given
|
|
||||||
process.env.STRIPE_API_KEY = "sk_live_secret"
|
|
||||||
process.env.SENDGRID_API_KEY = "SG.secret"
|
|
||||||
process.env.SHELL = "/bin/zsh"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.STRIPE_API_KEY).toBeUndefined()
|
|
||||||
expect(cleanEnv.SENDGRID_API_KEY).toBeUndefined()
|
|
||||||
expect(cleanEnv.SHELL).toBe("/bin/zsh")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("safe environment variables preserved", () => {
|
|
||||||
it("preserves PATH", () => {
|
|
||||||
// given
|
|
||||||
process.env.PATH = "/usr/bin:/usr/local/bin"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.PATH).toBe("/usr/bin:/usr/local/bin")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("preserves HOME", () => {
|
|
||||||
// given
|
|
||||||
process.env.HOME = "/home/testuser"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.HOME).toBe("/home/testuser")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("preserves SHELL", () => {
|
|
||||||
// given
|
|
||||||
process.env.SHELL = "/bin/bash"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.SHELL).toBe("/bin/bash")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("preserves LANG", () => {
|
|
||||||
// given
|
|
||||||
process.env.LANG = "en_US.UTF-8"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.LANG).toBe("en_US.UTF-8")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("preserves TERM", () => {
|
|
||||||
// given
|
|
||||||
process.env.TERM = "xterm-256color"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.TERM).toBe("xterm-256color")
|
|
||||||
})
|
|
||||||
|
|
||||||
it("preserves TMPDIR", () => {
|
|
||||||
// given
|
|
||||||
process.env.TMPDIR = "/tmp"
|
|
||||||
|
|
||||||
// when
|
|
||||||
const cleanEnv = createCleanMcpEnvironment()
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(cleanEnv.TMPDIR).toBe("/tmp")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|||||||
@@ -1,28 +1,10 @@
|
|||||||
// Filters npm/pnpm/yarn config env vars that break MCP servers in pnpm projects (#456)
|
// Filters npm/pnpm/yarn config env vars that break MCP servers in pnpm projects (#456)
|
||||||
// Also filters secret-containing env vars to prevent exposure to malicious stdio MCP servers (#B-02)
|
|
||||||
export const EXCLUDED_ENV_PATTERNS: RegExp[] = [
|
export const EXCLUDED_ENV_PATTERNS: RegExp[] = [
|
||||||
// npm/pnpm/yarn config patterns (original)
|
|
||||||
/^NPM_CONFIG_/i,
|
/^NPM_CONFIG_/i,
|
||||||
/^npm_config_/,
|
/^npm_config_/,
|
||||||
/^YARN_/,
|
/^YARN_/,
|
||||||
/^PNPM_/,
|
/^PNPM_/,
|
||||||
/^NO_UPDATE_NOTIFIER$/,
|
/^NO_UPDATE_NOTIFIER$/,
|
||||||
|
|
||||||
// Specific high-risk secret env vars (explicit blocks)
|
|
||||||
/^ANTHROPIC_API_KEY$/i,
|
|
||||||
/^AWS_ACCESS_KEY_ID$/i,
|
|
||||||
/^AWS_SECRET_ACCESS_KEY$/i,
|
|
||||||
/^GITHUB_TOKEN$/i,
|
|
||||||
/^DATABASE_URL$/i,
|
|
||||||
/^OPENAI_API_KEY$/i,
|
|
||||||
|
|
||||||
// Suffix-based patterns for common secret naming conventions
|
|
||||||
/_KEY$/i,
|
|
||||||
/_SECRET$/i,
|
|
||||||
/_TOKEN$/i,
|
|
||||||
/_PASSWORD$/i,
|
|
||||||
/_CREDENTIAL$/i,
|
|
||||||
/_API_KEY$/i,
|
|
||||||
]
|
]
|
||||||
|
|
||||||
export function createCleanMcpEnvironment(
|
export function createCleanMcpEnvironment(
|
||||||
|
|||||||
@@ -279,116 +279,6 @@ describe("TaskToastManager", () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("model name display in task line", () => {
|
|
||||||
test("should show model name before category when modelInfo exists", () => {
|
|
||||||
// given - a task with category and modelInfo
|
|
||||||
const task = {
|
|
||||||
id: "task_model_display",
|
|
||||||
description: "Build UI component",
|
|
||||||
agent: "sisyphus-junior",
|
|
||||||
isBackground: true,
|
|
||||||
category: "deep",
|
|
||||||
modelInfo: { model: "openai/gpt-5.3-codex", type: "category-default" as const },
|
|
||||||
}
|
|
||||||
|
|
||||||
// when - addTask is called
|
|
||||||
toastManager.addTask(task)
|
|
||||||
|
|
||||||
// then - toast should show model name before category like "gpt-5.3-codex: deep"
|
|
||||||
const call = mockClient.tui.showToast.mock.calls[0][0]
|
|
||||||
expect(call.body.message).toContain("gpt-5.3-codex: deep")
|
|
||||||
expect(call.body.message).not.toContain("sisyphus-junior/deep")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("should strip provider prefix from model name", () => {
|
|
||||||
// given - a task with provider-prefixed model
|
|
||||||
const task = {
|
|
||||||
id: "task_strip_provider",
|
|
||||||
description: "Fix styles",
|
|
||||||
agent: "sisyphus-junior",
|
|
||||||
isBackground: false,
|
|
||||||
category: "visual-engineering",
|
|
||||||
modelInfo: { model: "google/gemini-3.1-pro", type: "category-default" as const },
|
|
||||||
}
|
|
||||||
|
|
||||||
// when - addTask is called
|
|
||||||
toastManager.addTask(task)
|
|
||||||
|
|
||||||
// then - should show model ID without provider prefix
|
|
||||||
const call = mockClient.tui.showToast.mock.calls[0][0]
|
|
||||||
expect(call.body.message).toContain("gemini-3.1-pro: visual-engineering")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("should fall back to agent/category format when no modelInfo", () => {
|
|
||||||
// given - a task without modelInfo
|
|
||||||
const task = {
|
|
||||||
id: "task_no_model",
|
|
||||||
description: "Quick fix",
|
|
||||||
agent: "sisyphus-junior",
|
|
||||||
isBackground: true,
|
|
||||||
category: "quick",
|
|
||||||
}
|
|
||||||
|
|
||||||
// when - addTask is called
|
|
||||||
toastManager.addTask(task)
|
|
||||||
|
|
||||||
// then - should use old format with agent name
|
|
||||||
const call = mockClient.tui.showToast.mock.calls[0][0]
|
|
||||||
expect(call.body.message).toContain("sisyphus-junior/quick")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("should show model name without category when category is absent", () => {
|
|
||||||
// given - a task with modelInfo but no category
|
|
||||||
const task = {
|
|
||||||
id: "task_model_no_cat",
|
|
||||||
description: "Explore codebase",
|
|
||||||
agent: "explore",
|
|
||||||
isBackground: true,
|
|
||||||
modelInfo: { model: "anthropic/claude-sonnet-4-6", type: "category-default" as const },
|
|
||||||
}
|
|
||||||
|
|
||||||
// when - addTask is called
|
|
||||||
toastManager.addTask(task)
|
|
||||||
|
|
||||||
// then - should show just the model name in parens
|
|
||||||
const call = mockClient.tui.showToast.mock.calls[0][0]
|
|
||||||
expect(call.body.message).toContain("(claude-sonnet-4-6)")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("should show model name in queued tasks too", () => {
|
|
||||||
// given - a concurrency manager that limits to 1
|
|
||||||
const limitedConcurrency = {
|
|
||||||
getConcurrencyLimit: mock(() => 1),
|
|
||||||
} as unknown as ConcurrencyManager
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
||||||
const limitedManager = new TaskToastManager(mockClient as any, limitedConcurrency)
|
|
||||||
|
|
||||||
limitedManager.addTask({
|
|
||||||
id: "task_running",
|
|
||||||
description: "Running task",
|
|
||||||
agent: "sisyphus-junior",
|
|
||||||
isBackground: true,
|
|
||||||
category: "deep",
|
|
||||||
modelInfo: { model: "openai/gpt-5.3-codex", type: "category-default" as const },
|
|
||||||
})
|
|
||||||
limitedManager.addTask({
|
|
||||||
id: "task_queued",
|
|
||||||
description: "Queued task",
|
|
||||||
agent: "sisyphus-junior",
|
|
||||||
isBackground: true,
|
|
||||||
category: "quick",
|
|
||||||
status: "queued",
|
|
||||||
modelInfo: { model: "anthropic/claude-haiku-4-5", type: "category-default" as const },
|
|
||||||
})
|
|
||||||
|
|
||||||
// when - the queued task toast fires
|
|
||||||
const lastCall = mockClient.tui.showToast.mock.calls[1][0]
|
|
||||||
|
|
||||||
// then - queued task should also show model name
|
|
||||||
expect(lastCall.body.message).toContain("claude-haiku-4-5: quick")
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("updateTaskModelBySession", () => {
|
describe("updateTaskModelBySession", () => {
|
||||||
test("updates task model info and shows fallback toast", () => {
|
test("updates task model info and shows fallback toast", () => {
|
||||||
// given - task without model info
|
// given - task without model info
|
||||||
|
|||||||
@@ -127,13 +127,6 @@ export class TaskToastManager {
|
|||||||
const queued = this.getQueuedTasks()
|
const queued = this.getQueuedTasks()
|
||||||
const concurrencyInfo = this.getConcurrencyInfo()
|
const concurrencyInfo = this.getConcurrencyInfo()
|
||||||
|
|
||||||
const formatTaskIdentifier = (task: TrackedTask): string => {
|
|
||||||
const modelName = task.modelInfo?.model?.split("/").pop()
|
|
||||||
if (modelName && task.category) return `${modelName}: ${task.category}`
|
|
||||||
if (modelName) return modelName
|
|
||||||
if (task.category) return `${task.agent}/${task.category}`
|
|
||||||
return task.agent
|
|
||||||
}
|
|
||||||
const lines: string[] = []
|
const lines: string[] = []
|
||||||
|
|
||||||
const isFallback = newTask.modelInfo && (
|
const isFallback = newTask.modelInfo && (
|
||||||
@@ -158,9 +151,9 @@ export class TaskToastManager {
|
|||||||
const duration = this.formatDuration(task.startedAt)
|
const duration = this.formatDuration(task.startedAt)
|
||||||
const bgIcon = task.isBackground ? "[BG]" : "[RUN]"
|
const bgIcon = task.isBackground ? "[BG]" : "[RUN]"
|
||||||
const isNew = task.id === newTask.id ? " ← NEW" : ""
|
const isNew = task.id === newTask.id ? " ← NEW" : ""
|
||||||
const taskId = formatTaskIdentifier(task)
|
const categoryInfo = task.category ? `/${task.category}` : ""
|
||||||
const skillsInfo = task.skills?.length ? ` [${task.skills.join(", ")}]` : ""
|
const skillsInfo = task.skills?.length ? ` [${task.skills.join(", ")}]` : ""
|
||||||
lines.push(`${bgIcon} ${task.description} (${taskId})${skillsInfo} - ${duration}${isNew}`)
|
lines.push(`${bgIcon} ${task.description} (${task.agent}${categoryInfo})${skillsInfo} - ${duration}${isNew}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,10 +162,10 @@ export class TaskToastManager {
|
|||||||
lines.push(`Queued (${queued.length}):`)
|
lines.push(`Queued (${queued.length}):`)
|
||||||
for (const task of queued) {
|
for (const task of queued) {
|
||||||
const bgIcon = task.isBackground ? "[Q]" : "[W]"
|
const bgIcon = task.isBackground ? "[Q]" : "[W]"
|
||||||
const taskId = formatTaskIdentifier(task)
|
const categoryInfo = task.category ? `/${task.category}` : ""
|
||||||
const skillsInfo = task.skills?.length ? ` [${task.skills.join(", ")}]` : ""
|
const skillsInfo = task.skills?.length ? ` [${task.skills.join(", ")}]` : ""
|
||||||
const isNew = task.id === newTask.id ? " ← NEW" : ""
|
const isNew = task.id === newTask.id ? " ← NEW" : ""
|
||||||
lines.push(`${bgIcon} ${task.description} (${taskId})${skillsInfo} - Queued${isNew}`)
|
lines.push(`${bgIcon} ${task.description} (${task.agent}${categoryInfo})${skillsInfo} - Queued${isNew}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ function isTokenLimitError(text: string): boolean {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
const lower = text.toLowerCase()
|
const lower = text.toLowerCase()
|
||||||
return TOKEN_LIMIT_KEYWORDS.some((kw) => lower.includes(kw))
|
return TOKEN_LIMIT_KEYWORDS.some((kw) => lower.includes(kw.toLowerCase()))
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseAnthropicTokenLimitError(err: unknown): ParsedTokenLimitError | null {
|
export function parseAnthropicTokenLimitError(err: unknown): ParsedTokenLimitError | null {
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ function getLastAgentFromMessageDir(messageDir: string): string | null {
|
|||||||
const files = readdirSync(messageDir)
|
const files = readdirSync(messageDir)
|
||||||
.filter((fileName) => fileName.endsWith(".json"))
|
.filter((fileName) => fileName.endsWith(".json"))
|
||||||
.sort()
|
.sort()
|
||||||
|
.reverse()
|
||||||
|
|
||||||
for (let i = files.length - 1; i >= 0; i--) {
|
for (const fileName of files) {
|
||||||
const fileName = files[i]
|
|
||||||
try {
|
try {
|
||||||
const content = readFileSync(join(messageDir, fileName), "utf-8")
|
const content = readFileSync(join(messageDir, fileName), "utf-8")
|
||||||
const parsed = JSON.parse(content) as { agent?: unknown }
|
const parsed = JSON.parse(content) as { agent?: unknown }
|
||||||
|
|||||||
@@ -44,6 +44,12 @@ export interface ExecutorOptions {
|
|||||||
agent?: string
|
agent?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function filterDiscoveredCommandsByScope(
|
||||||
|
commands: DiscoveredCommandInfo[],
|
||||||
|
scope: DiscoveredCommandInfo["scope"],
|
||||||
|
): DiscoveredCommandInfo[] {
|
||||||
|
return commands.filter(command => command.scope === scope)
|
||||||
|
}
|
||||||
|
|
||||||
async function discoverAllCommands(options?: ExecutorOptions): Promise<CommandInfo[]> {
|
async function discoverAllCommands(options?: ExecutorOptions): Promise<CommandInfo[]> {
|
||||||
const discoveredCommands = discoverCommandsSync(process.cwd(), {
|
const discoveredCommands = discoverCommandsSync(process.cwd(), {
|
||||||
@@ -54,18 +60,14 @@ async function discoverAllCommands(options?: ExecutorOptions): Promise<CommandIn
|
|||||||
const skills = options?.skills ?? await discoverAllSkills()
|
const skills = options?.skills ?? await discoverAllSkills()
|
||||||
const skillCommands = skills.map(skillToCommandInfo)
|
const skillCommands = skills.map(skillToCommandInfo)
|
||||||
|
|
||||||
const scopeOrder: DiscoveredCommandInfo["scope"][] = ["project", "user", "opencode-project", "opencode", "builtin", "plugin"]
|
|
||||||
const grouped = new Map<string, DiscoveredCommandInfo[]>()
|
|
||||||
for (const cmd of discoveredCommands) {
|
|
||||||
const list = grouped.get(cmd.scope) ?? []
|
|
||||||
list.push(cmd)
|
|
||||||
grouped.set(cmd.scope, list)
|
|
||||||
}
|
|
||||||
const orderedCommands = scopeOrder.flatMap((scope) => grouped.get(scope) ?? [])
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...skillCommands,
|
...skillCommands,
|
||||||
...orderedCommands,
|
...filterDiscoveredCommandsByScope(discoveredCommands, "project"),
|
||||||
|
...filterDiscoveredCommandsByScope(discoveredCommands, "user"),
|
||||||
|
...filterDiscoveredCommandsByScope(discoveredCommands, "opencode-project"),
|
||||||
|
...filterDiscoveredCommandsByScope(discoveredCommands, "opencode"),
|
||||||
|
...filterDiscoveredCommandsByScope(discoveredCommands, "builtin"),
|
||||||
|
...filterDiscoveredCommandsByScope(discoveredCommands, "plugin"),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
import type { PluginInput } from "@opencode-ai/plugin"
|
import type { PluginInput } from "@opencode-ai/plugin"
|
||||||
import { existsSync } from "node:fs"
|
|
||||||
import { join } from "node:path"
|
|
||||||
import { runBunInstallWithDetails } from "../../../cli/config-manager"
|
import { runBunInstallWithDetails } from "../../../cli/config-manager"
|
||||||
import { log } from "../../../shared/logger"
|
import { log } from "../../../shared/logger"
|
||||||
import { getOpenCodeCacheDir, getOpenCodeConfigPaths } from "../../../shared"
|
|
||||||
import { invalidatePackage } from "../cache"
|
import { invalidatePackage } from "../cache"
|
||||||
import { PACKAGE_NAME } from "../constants"
|
import { PACKAGE_NAME } from "../constants"
|
||||||
import { extractChannel } from "../version-channel"
|
import { extractChannel } from "../version-channel"
|
||||||
@@ -14,36 +11,9 @@ function getPinnedVersionToastMessage(latestVersion: string): string {
|
|||||||
return `Update available: ${latestVersion} (version pinned, update manually)`
|
return `Update available: ${latestVersion} (version pinned, update manually)`
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
async function runBunInstallSafe(): Promise<boolean> {
|
||||||
* Resolves the active install workspace.
|
|
||||||
* Same logic as doctor check: prefer config-dir if installed, fall back to cache-dir.
|
|
||||||
*/
|
|
||||||
function resolveActiveInstallWorkspace(): string {
|
|
||||||
const configPaths = getOpenCodeConfigPaths({ binary: "opencode" })
|
|
||||||
const cacheDir = getOpenCodeCacheDir()
|
|
||||||
|
|
||||||
const configInstallPath = join(configPaths.configDir, "node_modules", PACKAGE_NAME, "package.json")
|
|
||||||
const cacheInstallPath = join(cacheDir, "node_modules", PACKAGE_NAME, "package.json")
|
|
||||||
|
|
||||||
// Prefer config-dir if installed there, otherwise fall back to cache-dir
|
|
||||||
if (existsSync(configInstallPath)) {
|
|
||||||
log(`[auto-update-checker] Active workspace: config-dir (${configPaths.configDir})`)
|
|
||||||
return configPaths.configDir
|
|
||||||
}
|
|
||||||
|
|
||||||
if (existsSync(cacheInstallPath)) {
|
|
||||||
log(`[auto-update-checker] Active workspace: cache-dir (${cacheDir})`)
|
|
||||||
return cacheDir
|
|
||||||
}
|
|
||||||
|
|
||||||
// Default to config-dir if neither exists (matches doctor behavior)
|
|
||||||
log(`[auto-update-checker] Active workspace: config-dir (default, no install detected)`)
|
|
||||||
return configPaths.configDir
|
|
||||||
}
|
|
||||||
|
|
||||||
async function runBunInstallSafe(workspaceDir: string): Promise<boolean> {
|
|
||||||
try {
|
try {
|
||||||
const result = await runBunInstallWithDetails({ outputMode: "pipe", workspaceDir })
|
const result = await runBunInstallWithDetails({ outputMode: "pipe" })
|
||||||
if (!result.success && result.error) {
|
if (!result.success && result.error) {
|
||||||
log("[auto-update-checker] bun install error:", result.error)
|
log("[auto-update-checker] bun install error:", result.error)
|
||||||
}
|
}
|
||||||
@@ -112,8 +82,7 @@ export async function runBackgroundUpdateCheck(
|
|||||||
|
|
||||||
invalidatePackage(PACKAGE_NAME)
|
invalidatePackage(PACKAGE_NAME)
|
||||||
|
|
||||||
const activeWorkspace = resolveActiveInstallWorkspace()
|
const installSuccess = await runBunInstallSafe()
|
||||||
const installSuccess = await runBunInstallSafe(activeWorkspace)
|
|
||||||
|
|
||||||
if (installSuccess) {
|
if (installSuccess) {
|
||||||
await showAutoUpdatedToast(ctx, currentVersion, latestVersion)
|
await showAutoUpdatedToast(ctx, currentVersion, latestVersion)
|
||||||
|
|||||||
@@ -1,223 +0,0 @@
|
|||||||
import type { PluginInput } from "@opencode-ai/plugin"
|
|
||||||
import { afterEach, beforeEach, describe, expect, it, mock } from "bun:test"
|
|
||||||
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs"
|
|
||||||
import { join } from "node:path"
|
|
||||||
|
|
||||||
type PluginEntry = {
|
|
||||||
entry: string
|
|
||||||
isPinned: boolean
|
|
||||||
pinnedVersion: string | null
|
|
||||||
configPath: string
|
|
||||||
}
|
|
||||||
|
|
||||||
type ToastMessageGetter = (isUpdate: boolean, version?: string) => string
|
|
||||||
|
|
||||||
function createPluginEntry(overrides?: Partial<PluginEntry>): PluginEntry {
|
|
||||||
return {
|
|
||||||
entry: "oh-my-opencode@3.4.0",
|
|
||||||
isPinned: false,
|
|
||||||
pinnedVersion: null,
|
|
||||||
configPath: "/test/opencode.json",
|
|
||||||
...overrides,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const TEST_DIR = join(import.meta.dir, "__test-workspace-resolution__")
|
|
||||||
const TEST_CACHE_DIR = join(TEST_DIR, "cache")
|
|
||||||
const TEST_CONFIG_DIR = join(TEST_DIR, "config")
|
|
||||||
|
|
||||||
const mockFindPluginEntry = mock((_directory: string): PluginEntry | null => createPluginEntry())
|
|
||||||
const mockGetCachedVersion = mock((): string | null => "3.4.0")
|
|
||||||
const mockGetLatestVersion = mock(async (): Promise<string | null> => "3.5.0")
|
|
||||||
const mockExtractChannel = mock(() => "latest")
|
|
||||||
const mockInvalidatePackage = mock(() => {})
|
|
||||||
const mockShowUpdateAvailableToast = mock(
|
|
||||||
async (_ctx: PluginInput, _latestVersion: string, _getToastMessage: ToastMessageGetter): Promise<void> => {}
|
|
||||||
)
|
|
||||||
const mockShowAutoUpdatedToast = mock(
|
|
||||||
async (_ctx: PluginInput, _fromVersion: string, _toVersion: string): Promise<void> => {}
|
|
||||||
)
|
|
||||||
const mockSyncCachePackageJsonToIntent = mock(() => ({ synced: true, error: null }))
|
|
||||||
|
|
||||||
const mockRunBunInstallWithDetails = mock(
|
|
||||||
async (opts?: { outputMode?: string; workspaceDir?: string }) => {
|
|
||||||
return { success: true }
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
mock.module("../checker", () => ({
|
|
||||||
findPluginEntry: mockFindPluginEntry,
|
|
||||||
getCachedVersion: mockGetCachedVersion,
|
|
||||||
getLatestVersion: mockGetLatestVersion,
|
|
||||||
revertPinnedVersion: mock(() => false),
|
|
||||||
syncCachePackageJsonToIntent: mockSyncCachePackageJsonToIntent,
|
|
||||||
}))
|
|
||||||
mock.module("../version-channel", () => ({ extractChannel: mockExtractChannel }))
|
|
||||||
mock.module("../cache", () => ({ invalidatePackage: mockInvalidatePackage }))
|
|
||||||
mock.module("../../../cli/config-manager", () => ({
|
|
||||||
runBunInstallWithDetails: mockRunBunInstallWithDetails,
|
|
||||||
}))
|
|
||||||
mock.module("./update-toasts", () => ({
|
|
||||||
showUpdateAvailableToast: mockShowUpdateAvailableToast,
|
|
||||||
showAutoUpdatedToast: mockShowAutoUpdatedToast,
|
|
||||||
}))
|
|
||||||
mock.module("../../../shared/logger", () => ({ log: () => {} }))
|
|
||||||
mock.module("../../../shared", () => ({
|
|
||||||
getOpenCodeCacheDir: () => TEST_CACHE_DIR,
|
|
||||||
getOpenCodeConfigPaths: () => ({
|
|
||||||
configDir: TEST_CONFIG_DIR,
|
|
||||||
configJson: join(TEST_CONFIG_DIR, "opencode.json"),
|
|
||||||
configJsonc: join(TEST_CONFIG_DIR, "opencode.jsonc"),
|
|
||||||
packageJson: join(TEST_CONFIG_DIR, "package.json"),
|
|
||||||
omoConfig: join(TEST_CONFIG_DIR, "oh-my-opencode.json"),
|
|
||||||
}),
|
|
||||||
getOpenCodeConfigDir: () => TEST_CONFIG_DIR,
|
|
||||||
}))
|
|
||||||
|
|
||||||
// Mock constants BEFORE importing the module
|
|
||||||
const ORIGINAL_PACKAGE_NAME = "oh-my-opencode"
|
|
||||||
mock.module("../constants", () => ({
|
|
||||||
PACKAGE_NAME: ORIGINAL_PACKAGE_NAME,
|
|
||||||
CACHE_DIR: TEST_CACHE_DIR,
|
|
||||||
USER_CONFIG_DIR: TEST_CONFIG_DIR,
|
|
||||||
}))
|
|
||||||
|
|
||||||
// Need to mock getOpenCodeCacheDir and getOpenCodeConfigPaths before importing the module
|
|
||||||
mock.module("../../../shared/data-path", () => ({
|
|
||||||
getDataDir: () => join(TEST_DIR, "data"),
|
|
||||||
getOpenCodeStorageDir: () => join(TEST_DIR, "data", "opencode", "storage"),
|
|
||||||
getCacheDir: () => TEST_DIR,
|
|
||||||
getOmoOpenCodeCacheDir: () => join(TEST_DIR, "oh-my-opencode"),
|
|
||||||
getOpenCodeCacheDir: () => TEST_CACHE_DIR,
|
|
||||||
}))
|
|
||||||
mock.module("../../../shared/opencode-config-dir", () => ({
|
|
||||||
getOpenCodeConfigDir: () => TEST_CONFIG_DIR,
|
|
||||||
getOpenCodeConfigPaths: () => ({
|
|
||||||
configDir: TEST_CONFIG_DIR,
|
|
||||||
configJson: join(TEST_CONFIG_DIR, "opencode.json"),
|
|
||||||
configJsonc: join(TEST_CONFIG_DIR, "opencode.jsonc"),
|
|
||||||
packageJson: join(TEST_CONFIG_DIR, "package.json"),
|
|
||||||
omoConfig: join(TEST_CONFIG_DIR, "oh-my-opencode.json"),
|
|
||||||
}),
|
|
||||||
}))
|
|
||||||
|
|
||||||
const modulePath = "./background-update-check?test"
|
|
||||||
const { runBackgroundUpdateCheck } = await import(modulePath)
|
|
||||||
|
|
||||||
describe("workspace resolution", () => {
|
|
||||||
const mockCtx = { directory: "/test" } as PluginInput
|
|
||||||
const getToastMessage: ToastMessageGetter = (isUpdate, version) =>
|
|
||||||
isUpdate ? `Update to ${version}` : "Up to date"
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
// Setup test directories
|
|
||||||
if (existsSync(TEST_DIR)) {
|
|
||||||
rmSync(TEST_DIR, { recursive: true, force: true })
|
|
||||||
}
|
|
||||||
mkdirSync(TEST_DIR, { recursive: true })
|
|
||||||
|
|
||||||
mockFindPluginEntry.mockReset()
|
|
||||||
mockGetCachedVersion.mockReset()
|
|
||||||
mockGetLatestVersion.mockReset()
|
|
||||||
mockExtractChannel.mockReset()
|
|
||||||
mockInvalidatePackage.mockReset()
|
|
||||||
mockRunBunInstallWithDetails.mockReset()
|
|
||||||
mockShowUpdateAvailableToast.mockReset()
|
|
||||||
mockShowAutoUpdatedToast.mockReset()
|
|
||||||
|
|
||||||
mockFindPluginEntry.mockReturnValue(createPluginEntry())
|
|
||||||
mockGetCachedVersion.mockReturnValue("3.4.0")
|
|
||||||
mockGetLatestVersion.mockResolvedValue("3.5.0")
|
|
||||||
mockExtractChannel.mockReturnValue("latest")
|
|
||||||
// Note: Don't use mockResolvedValue here - it overrides the function that captures args
|
|
||||||
mockSyncCachePackageJsonToIntent.mockReturnValue({ synced: true, error: null })
|
|
||||||
})
|
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
if (existsSync(TEST_DIR)) {
|
|
||||||
rmSync(TEST_DIR, { recursive: true, force: true })
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given config-dir install exists but cache-dir does not", () => {
|
|
||||||
it("installs to config-dir, not cache-dir", async () => {
|
|
||||||
//#given - config-dir has installation, cache-dir does not
|
|
||||||
mkdirSync(join(TEST_CONFIG_DIR, "node_modules", "oh-my-opencode"), { recursive: true })
|
|
||||||
writeFileSync(
|
|
||||||
join(TEST_CONFIG_DIR, "package.json"),
|
|
||||||
JSON.stringify({ dependencies: { "oh-my-opencode": "3.4.0" } }, null, 2)
|
|
||||||
)
|
|
||||||
writeFileSync(
|
|
||||||
join(TEST_CONFIG_DIR, "node_modules", "oh-my-opencode", "package.json"),
|
|
||||||
JSON.stringify({ name: "oh-my-opencode", version: "3.4.0" }, null, 2)
|
|
||||||
)
|
|
||||||
|
|
||||||
// cache-dir should NOT exist
|
|
||||||
expect(existsSync(TEST_CACHE_DIR)).toBe(false)
|
|
||||||
|
|
||||||
//#when
|
|
||||||
await runBackgroundUpdateCheck(mockCtx, true, getToastMessage)
|
|
||||||
|
|
||||||
//#then - install should be called with config-dir
|
|
||||||
const mockCalls = mockRunBunInstallWithDetails.mock.calls
|
|
||||||
expect(mockCalls[0][0]?.workspaceDir).toBe(TEST_CONFIG_DIR)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given both config-dir and cache-dir exist", () => {
|
|
||||||
it("prefers config-dir over cache-dir", async () => {
|
|
||||||
//#given - both directories have installations
|
|
||||||
mkdirSync(join(TEST_CONFIG_DIR, "node_modules", "oh-my-opencode"), { recursive: true })
|
|
||||||
writeFileSync(
|
|
||||||
join(TEST_CONFIG_DIR, "package.json"),
|
|
||||||
JSON.stringify({ dependencies: { "oh-my-opencode": "3.4.0" } }, null, 2)
|
|
||||||
)
|
|
||||||
writeFileSync(
|
|
||||||
join(TEST_CONFIG_DIR, "node_modules", "oh-my-opencode", "package.json"),
|
|
||||||
JSON.stringify({ name: "oh-my-opencode", version: "3.4.0" }, null, 2)
|
|
||||||
)
|
|
||||||
|
|
||||||
mkdirSync(join(TEST_CACHE_DIR, "node_modules", "oh-my-opencode"), { recursive: true })
|
|
||||||
writeFileSync(
|
|
||||||
join(TEST_CACHE_DIR, "package.json"),
|
|
||||||
JSON.stringify({ dependencies: { "oh-my-opencode": "3.4.0" } }, null, 2)
|
|
||||||
)
|
|
||||||
writeFileSync(
|
|
||||||
join(TEST_CACHE_DIR, "node_modules", "oh-my-opencode", "package.json"),
|
|
||||||
JSON.stringify({ name: "oh-my-opencode", version: "3.4.0" }, null, 2)
|
|
||||||
)
|
|
||||||
|
|
||||||
//#when
|
|
||||||
await runBackgroundUpdateCheck(mockCtx, true, getToastMessage)
|
|
||||||
|
|
||||||
//#then - install should prefer config-dir
|
|
||||||
const mockCalls2 = mockRunBunInstallWithDetails.mock.calls
|
|
||||||
expect(mockCalls2[0][0]?.workspaceDir).toBe(TEST_CONFIG_DIR)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
describe("#given only cache-dir install exists", () => {
|
|
||||||
it("falls back to cache-dir", async () => {
|
|
||||||
//#given - only cache-dir has installation
|
|
||||||
mkdirSync(join(TEST_CACHE_DIR, "node_modules", "oh-my-opencode"), { recursive: true })
|
|
||||||
writeFileSync(
|
|
||||||
join(TEST_CACHE_DIR, "package.json"),
|
|
||||||
JSON.stringify({ dependencies: { "oh-my-opencode": "3.4.0" } }, null, 2)
|
|
||||||
)
|
|
||||||
writeFileSync(
|
|
||||||
join(TEST_CACHE_DIR, "node_modules", "oh-my-opencode", "package.json"),
|
|
||||||
JSON.stringify({ name: "oh-my-opencode", version: "3.4.0" }, null, 2)
|
|
||||||
)
|
|
||||||
|
|
||||||
// config-dir should NOT exist
|
|
||||||
expect(existsSync(TEST_CONFIG_DIR)).toBe(false)
|
|
||||||
|
|
||||||
//#when
|
|
||||||
await runBackgroundUpdateCheck(mockCtx, true, getToastMessage)
|
|
||||||
|
|
||||||
//#then - install should fall back to cache-dir
|
|
||||||
const mockCalls3 = mockRunBunInstallWithDetails.mock.calls
|
|
||||||
expect(mockCalls3[0][0]?.workspaceDir).toBe(TEST_CACHE_DIR)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
@@ -79,6 +79,8 @@ export function createToolExecuteAfterHandler(ctx: PluginInput, config: PluginCo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const claudeConfig = await loadClaudeHooksConfig()
|
||||||
|
const extendedConfig = await loadPluginExtendedConfig()
|
||||||
|
|
||||||
const cachedInput = getToolInput(input.sessionID, input.tool, input.callID) || {}
|
const cachedInput = getToolInput(input.sessionID, input.tool, input.callID) || {}
|
||||||
|
|
||||||
@@ -94,9 +96,6 @@ export function createToolExecuteAfterHandler(ctx: PluginInput, config: PluginCo
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const claudeConfig = await loadClaudeHooksConfig()
|
|
||||||
const extendedConfig = await loadPluginExtendedConfig()
|
|
||||||
|
|
||||||
const postClient: PostToolUseClient = {
|
const postClient: PostToolUseClient = {
|
||||||
session: {
|
session: {
|
||||||
messages: (opts) => ctx.client.session.messages(opts),
|
messages: (opts) => ctx.client.session.messages(opts),
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ export function createToolExecuteBeforeHandler(ctx: PluginInput, config: PluginC
|
|||||||
log("todowrite: parsed todos string to array", { sessionID: input.sessionID })
|
log("todowrite: parsed todos string to array", { sessionID: input.sessionID })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const claudeConfig = await loadClaudeHooksConfig()
|
||||||
|
const extendedConfig = await loadPluginExtendedConfig()
|
||||||
|
|
||||||
appendTranscriptEntry(input.sessionID, {
|
appendTranscriptEntry(input.sessionID, {
|
||||||
type: "tool_use",
|
type: "tool_use",
|
||||||
@@ -57,9 +59,6 @@ export function createToolExecuteBeforeHandler(ctx: PluginInput, config: PluginC
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const claudeConfig = await loadClaudeHooksConfig()
|
|
||||||
const extendedConfig = await loadPluginExtendedConfig()
|
|
||||||
|
|
||||||
const preCtx: PreToolUseContext = {
|
const preCtx: PreToolUseContext = {
|
||||||
sessionId: input.sessionID,
|
sessionId: input.sessionID,
|
||||||
toolName: input.tool,
|
toolName: input.tool,
|
||||||
|
|||||||
@@ -3,18 +3,6 @@ import type { CommentCheckerConfig } from "../../config/schema"
|
|||||||
|
|
||||||
import z from "zod"
|
import z from "zod"
|
||||||
|
|
||||||
const ApplyPatchMetadataSchema = z.object({
|
|
||||||
files: z.array(
|
|
||||||
z.object({
|
|
||||||
filePath: z.string(),
|
|
||||||
movePath: z.string().optional(),
|
|
||||||
before: z.string(),
|
|
||||||
after: z.string(),
|
|
||||||
type: z.string().optional(),
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
})
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
initializeCommentCheckerCli,
|
initializeCommentCheckerCli,
|
||||||
getCommentCheckerCliPathPromise,
|
getCommentCheckerCliPathPromise,
|
||||||
@@ -116,6 +104,17 @@ export function createCommentCheckerHooks(config?: CommentCheckerConfig) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const ApplyPatchMetadataSchema = z.object({
|
||||||
|
files: z.array(
|
||||||
|
z.object({
|
||||||
|
filePath: z.string(),
|
||||||
|
movePath: z.string().optional(),
|
||||||
|
before: z.string(),
|
||||||
|
after: z.string(),
|
||||||
|
type: z.string().optional(),
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
})
|
||||||
|
|
||||||
if (toolLower === "apply_patch") {
|
if (toolLower === "apply_patch") {
|
||||||
const parsed = ApplyPatchMetadataSchema.safeParse(output.metadata)
|
const parsed = ApplyPatchMetadataSchema.safeParse(output.metadata)
|
||||||
|
|||||||
@@ -52,4 +52,3 @@ export { createWriteExistingFileGuardHook } from "./write-existing-file-guard";
|
|||||||
export { createHashlineReadEnhancerHook } from "./hashline-read-enhancer";
|
export { createHashlineReadEnhancerHook } from "./hashline-read-enhancer";
|
||||||
export { createJsonErrorRecoveryHook, JSON_ERROR_TOOL_EXCLUDE_LIST, JSON_ERROR_PATTERNS, JSON_ERROR_REMINDER } from "./json-error-recovery";
|
export { createJsonErrorRecoveryHook, JSON_ERROR_TOOL_EXCLUDE_LIST, JSON_ERROR_PATTERNS, JSON_ERROR_REMINDER } from "./json-error-recovery";
|
||||||
export { createReadImageResizerHook } from "./read-image-resizer"
|
export { createReadImageResizerHook } from "./read-image-resizer"
|
||||||
export { createTodoDescriptionOverrideHook } from "./todo-description-override"
|
|
||||||
|
|||||||
70
src/hooks/openclaw-sender/index.ts
Normal file
70
src/hooks/openclaw-sender/index.ts
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
import { wakeOpenClaw } from "../../openclaw/client";
|
||||||
|
import type { OpenClawConfig, OpenClawContext } from "../../openclaw/types";
|
||||||
|
import { getMainSessionID } from "../../features/claude-code-session-state";
|
||||||
|
import type { PluginContext } from "../../plugin/types";
|
||||||
|
|
||||||
|
export function createOpenClawSenderHook(
|
||||||
|
ctx: PluginContext,
|
||||||
|
config: OpenClawConfig
|
||||||
|
) {
|
||||||
|
return {
|
||||||
|
event: async (input: {
|
||||||
|
event: { type: string; properties?: Record<string, unknown> };
|
||||||
|
}) => {
|
||||||
|
const { type, properties } = input.event;
|
||||||
|
const info = properties?.info as Record<string, unknown> | undefined;
|
||||||
|
const context: OpenClawContext = {
|
||||||
|
sessionId:
|
||||||
|
(properties?.sessionID as string) ||
|
||||||
|
(info?.id as string) ||
|
||||||
|
getMainSessionID(),
|
||||||
|
projectPath: ctx.directory,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (type === "session.created") {
|
||||||
|
await wakeOpenClaw("session-start", context, config);
|
||||||
|
} else if (type === "session.idle") {
|
||||||
|
await wakeOpenClaw("session-idle", context, config);
|
||||||
|
} else if (type === "session.deleted") {
|
||||||
|
await wakeOpenClaw("session-end", context, config);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"tool.execute.before": async (
|
||||||
|
input: { tool: string; sessionID: string },
|
||||||
|
output: { args: Record<string, unknown> }
|
||||||
|
) => {
|
||||||
|
const toolName = input.tool.toLowerCase();
|
||||||
|
const context: OpenClawContext = {
|
||||||
|
sessionId: input.sessionID,
|
||||||
|
projectPath: ctx.directory,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (
|
||||||
|
toolName === "ask_user_question" ||
|
||||||
|
toolName === "askuserquestion" ||
|
||||||
|
toolName === "question"
|
||||||
|
) {
|
||||||
|
const question =
|
||||||
|
typeof output.args.question === "string"
|
||||||
|
? output.args.question
|
||||||
|
: undefined;
|
||||||
|
await wakeOpenClaw(
|
||||||
|
"ask-user-question",
|
||||||
|
{
|
||||||
|
...context,
|
||||||
|
question,
|
||||||
|
},
|
||||||
|
config
|
||||||
|
);
|
||||||
|
} else if (toolName === "skill") {
|
||||||
|
const rawName =
|
||||||
|
typeof output.args.name === "string" ? output.args.name : undefined;
|
||||||
|
const command = rawName?.replace(/^\//, "").toLowerCase();
|
||||||
|
if (command === "stop-continuation") {
|
||||||
|
await wakeOpenClaw("stop", context, config);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -23,10 +23,6 @@ export async function handleDetectedCompletion(
|
|||||||
const { sessionID, state, loopState, directory, apiTimeoutMs } = input
|
const { sessionID, state, loopState, directory, apiTimeoutMs } = input
|
||||||
|
|
||||||
if (state.ultrawork && !state.verification_pending) {
|
if (state.ultrawork && !state.verification_pending) {
|
||||||
if (state.verification_session_id) {
|
|
||||||
ctx.client.session.abort({ path: { id: state.verification_session_id } }).catch(() => {})
|
|
||||||
}
|
|
||||||
|
|
||||||
const verificationState = loopState.markVerificationPending(sessionID)
|
const verificationState = loopState.markVerificationPending(sessionID)
|
||||||
if (!verificationState) {
|
if (!verificationState) {
|
||||||
log(`[${HOOK_NAME}] Failed to transition ultrawork loop to verification`, {
|
log(`[${HOOK_NAME}] Failed to transition ultrawork loop to verification`, {
|
||||||
|
|||||||
@@ -1,96 +1,11 @@
|
|||||||
import type { PluginInput } from "@opencode-ai/plugin"
|
import type { PluginInput } from "@opencode-ai/plugin"
|
||||||
import { log } from "../../shared/logger"
|
import { log } from "../../shared/logger"
|
||||||
import { HOOK_NAME } from "./constants"
|
import { HOOK_NAME } from "./constants"
|
||||||
import { ULTRAWORK_VERIFICATION_PROMISE } from "./constants"
|
|
||||||
import type { RalphLoopState } from "./types"
|
import type { RalphLoopState } from "./types"
|
||||||
import { handleFailedVerification } from "./verification-failure-handler"
|
import { handleFailedVerification } from "./verification-failure-handler"
|
||||||
import { withTimeout } from "./with-timeout"
|
|
||||||
|
|
||||||
type OpenCodeSessionMessage = {
|
|
||||||
info?: { role?: string }
|
|
||||||
parts?: Array<{ type?: string; text?: string }>
|
|
||||||
}
|
|
||||||
|
|
||||||
const ORACLE_AGENT_PATTERN = /Agent:\s*oracle/i
|
|
||||||
const TASK_METADATA_SESSION_PATTERN = /<task_metadata>[\s\S]*?session_id:\s*([^\s<]+)[\s\S]*?<\/task_metadata>/i
|
|
||||||
const VERIFIED_PROMISE_PATTERN = new RegExp(
|
|
||||||
`<promise>\\s*${ULTRAWORK_VERIFICATION_PROMISE}\\s*<\\/promise>`,
|
|
||||||
"i",
|
|
||||||
)
|
|
||||||
|
|
||||||
function collectAssistantText(message: OpenCodeSessionMessage): string {
|
|
||||||
if (!Array.isArray(message.parts)) {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
let text = ""
|
|
||||||
for (const part of message.parts) {
|
|
||||||
if (part.type !== "text") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
text += `${text ? "\n" : ""}${part.text ?? ""}`
|
|
||||||
}
|
|
||||||
|
|
||||||
return text
|
|
||||||
}
|
|
||||||
|
|
||||||
async function detectOracleVerificationFromParentSession(
|
|
||||||
ctx: PluginInput,
|
|
||||||
parentSessionID: string,
|
|
||||||
directory: string,
|
|
||||||
apiTimeoutMs: number,
|
|
||||||
): Promise<string | undefined> {
|
|
||||||
try {
|
|
||||||
const response = await withTimeout(
|
|
||||||
ctx.client.session.messages({
|
|
||||||
path: { id: parentSessionID },
|
|
||||||
query: { directory },
|
|
||||||
}),
|
|
||||||
apiTimeoutMs,
|
|
||||||
)
|
|
||||||
|
|
||||||
const messagesResponse: unknown = response
|
|
||||||
const responseData =
|
|
||||||
typeof messagesResponse === "object" && messagesResponse !== null && "data" in messagesResponse
|
|
||||||
? (messagesResponse as { data?: unknown }).data
|
|
||||||
: undefined
|
|
||||||
const messageArray: unknown[] = Array.isArray(messagesResponse)
|
|
||||||
? messagesResponse
|
|
||||||
: Array.isArray(responseData)
|
|
||||||
? responseData
|
|
||||||
: []
|
|
||||||
|
|
||||||
for (let index = messageArray.length - 1; index >= 0; index -= 1) {
|
|
||||||
const message = messageArray[index] as OpenCodeSessionMessage
|
|
||||||
if (message.info?.role !== "assistant") {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
const assistantText = collectAssistantText(message)
|
|
||||||
if (!VERIFIED_PROMISE_PATTERN.test(assistantText) || !ORACLE_AGENT_PATTERN.test(assistantText)) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
const sessionMatch = assistantText.match(TASK_METADATA_SESSION_PATTERN)
|
|
||||||
const detectedOracleSessionID = sessionMatch?.[1]?.trim()
|
|
||||||
if (detectedOracleSessionID) {
|
|
||||||
return detectedOracleSessionID
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined
|
|
||||||
} catch (error) {
|
|
||||||
log(`[${HOOK_NAME}] Failed to scan parent session for oracle verification evidence`, {
|
|
||||||
parentSessionID,
|
|
||||||
error: String(error),
|
|
||||||
})
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
type LoopStateController = {
|
type LoopStateController = {
|
||||||
restartAfterFailedVerification: (sessionID: string, messageCountAtStart?: number) => RalphLoopState | null
|
restartAfterFailedVerification: (sessionID: string, messageCountAtStart?: number) => RalphLoopState | null
|
||||||
setVerificationSessionID: (sessionID: string, verificationSessionID: string) => RalphLoopState | null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function handlePendingVerification(
|
export async function handlePendingVerification(
|
||||||
@@ -118,29 +33,6 @@ export async function handlePendingVerification(
|
|||||||
} = input
|
} = input
|
||||||
|
|
||||||
if (matchesParentSession || (verificationSessionID && matchesVerificationSession)) {
|
if (matchesParentSession || (verificationSessionID && matchesVerificationSession)) {
|
||||||
if (!verificationSessionID && state.session_id) {
|
|
||||||
const recoveredVerificationSessionID = await detectOracleVerificationFromParentSession(
|
|
||||||
ctx,
|
|
||||||
state.session_id,
|
|
||||||
directory,
|
|
||||||
apiTimeoutMs,
|
|
||||||
)
|
|
||||||
|
|
||||||
if (recoveredVerificationSessionID) {
|
|
||||||
const updatedState = loopState.setVerificationSessionID(
|
|
||||||
state.session_id,
|
|
||||||
recoveredVerificationSessionID,
|
|
||||||
)
|
|
||||||
if (updatedState) {
|
|
||||||
log(`[${HOOK_NAME}] Recovered missing verification session from parent evidence`, {
|
|
||||||
parentSessionID: state.session_id,
|
|
||||||
recoveredVerificationSessionID,
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const restarted = await handleFailedVerification(ctx, {
|
const restarted = await handleFailedVerification(ctx, {
|
||||||
state,
|
state,
|
||||||
loopState,
|
loopState,
|
||||||
|
|||||||
@@ -136,13 +136,6 @@ export function createRalphLoopEventHandler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (state.verification_pending) {
|
if (state.verification_pending) {
|
||||||
if (!verificationSessionID && matchesParentSession) {
|
|
||||||
log(`[${HOOK_NAME}] Verification pending without tracked oracle session, running recovery check`, {
|
|
||||||
sessionID,
|
|
||||||
iteration: state.iteration,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
await handlePendingVerification(ctx, {
|
await handlePendingVerification(ctx, {
|
||||||
sessionID,
|
sessionID,
|
||||||
state,
|
state,
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ describe("ulw-loop verification", () => {
|
|||||||
const testDir = join(tmpdir(), `ulw-loop-verification-${Date.now()}`)
|
const testDir = join(tmpdir(), `ulw-loop-verification-${Date.now()}`)
|
||||||
let promptCalls: Array<{ sessionID: string; text: string }>
|
let promptCalls: Array<{ sessionID: string; text: string }>
|
||||||
let toastCalls: Array<{ title: string; message: string; variant: string }>
|
let toastCalls: Array<{ title: string; message: string; variant: string }>
|
||||||
let abortCalls: Array<{ id: string }>
|
|
||||||
let parentTranscriptPath: string
|
let parentTranscriptPath: string
|
||||||
let oracleTranscriptPath: string
|
let oracleTranscriptPath: string
|
||||||
|
|
||||||
@@ -26,10 +25,6 @@ describe("ulw-loop verification", () => {
|
|||||||
return {}
|
return {}
|
||||||
},
|
},
|
||||||
messages: async () => ({ data: [] }),
|
messages: async () => ({ data: [] }),
|
||||||
abort: async (opts: { path: { id: string } }) => {
|
|
||||||
abortCalls.push({ id: opts.path.id })
|
|
||||||
return {}
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
tui: {
|
tui: {
|
||||||
showToast: async (opts: { body: { title: string; message: string; variant: string } }) => {
|
showToast: async (opts: { body: { title: string; message: string; variant: string } }) => {
|
||||||
@@ -45,7 +40,6 @@ describe("ulw-loop verification", () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
promptCalls = []
|
promptCalls = []
|
||||||
toastCalls = []
|
toastCalls = []
|
||||||
abortCalls = []
|
|
||||||
parentTranscriptPath = join(testDir, "transcript-parent.jsonl")
|
parentTranscriptPath = join(testDir, "transcript-parent.jsonl")
|
||||||
oracleTranscriptPath = join(testDir, "transcript-oracle.jsonl")
|
oracleTranscriptPath = join(testDir, "transcript-oracle.jsonl")
|
||||||
|
|
||||||
@@ -391,96 +385,4 @@ describe("ulw-loop verification", () => {
|
|||||||
expect(promptCalls).toHaveLength(2)
|
expect(promptCalls).toHaveLength(2)
|
||||||
expect(promptCalls[1]?.text).toContain("Verification failed")
|
expect(promptCalls[1]?.text).toContain("Verification failed")
|
||||||
})
|
})
|
||||||
|
|
||||||
test("#given oracle verification fails #when loop restarts #then old oracle session is aborted", async () => {
|
|
||||||
const sessionMessages: Record<string, unknown[]> = {
|
|
||||||
"session-123": [{}, {}, {}],
|
|
||||||
}
|
|
||||||
const hook = createRalphLoopHook({
|
|
||||||
...createMockPluginInput(),
|
|
||||||
client: {
|
|
||||||
...createMockPluginInput().client,
|
|
||||||
session: {
|
|
||||||
...createMockPluginInput().client.session,
|
|
||||||
messages: async (opts: { path: { id: string } }) => ({
|
|
||||||
data: sessionMessages[opts.path.id] ?? [],
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as Parameters<typeof createRalphLoopHook>[0], {
|
|
||||||
getTranscriptPath: (sessionID) => sessionID === "ses-oracle" ? oracleTranscriptPath : parentTranscriptPath,
|
|
||||||
})
|
|
||||||
hook.startLoop("session-123", "Build API", { ultrawork: true })
|
|
||||||
writeFileSync(
|
|
||||||
parentTranscriptPath,
|
|
||||||
`${JSON.stringify({ type: "tool_result", timestamp: new Date().toISOString(), tool_output: { output: "done <promise>DONE</promise>" } })}\n`,
|
|
||||||
)
|
|
||||||
|
|
||||||
await hook.event({ event: { type: "session.idle", properties: { sessionID: "session-123" } } })
|
|
||||||
writeState(testDir, {
|
|
||||||
...hook.getState()!,
|
|
||||||
verification_session_id: "ses-oracle",
|
|
||||||
})
|
|
||||||
writeFileSync(
|
|
||||||
oracleTranscriptPath,
|
|
||||||
`${JSON.stringify({ type: "tool_result", timestamp: new Date().toISOString(), tool_output: { output: "verification failed: missing tests" } })}\n`,
|
|
||||||
)
|
|
||||||
|
|
||||||
await hook.event({ event: { type: "session.idle", properties: { sessionID: "ses-oracle" } } })
|
|
||||||
|
|
||||||
expect(abortCalls).toHaveLength(1)
|
|
||||||
expect(abortCalls[0].id).toBe("ses-oracle")
|
|
||||||
})
|
|
||||||
|
|
||||||
test("#given ulw loop re-enters verification #when DONE detected again after failed verification #then previous verification session is aborted", async () => {
|
|
||||||
const sessionMessages: Record<string, unknown[]> = {
|
|
||||||
"session-123": [{}, {}, {}],
|
|
||||||
}
|
|
||||||
const hook = createRalphLoopHook({
|
|
||||||
...createMockPluginInput(),
|
|
||||||
client: {
|
|
||||||
...createMockPluginInput().client,
|
|
||||||
session: {
|
|
||||||
...createMockPluginInput().client.session,
|
|
||||||
messages: async (opts: { path: { id: string } }) => ({
|
|
||||||
data: sessionMessages[opts.path.id] ?? [],
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as Parameters<typeof createRalphLoopHook>[0], {
|
|
||||||
getTranscriptPath: (sessionID) => sessionID === "ses-oracle" ? oracleTranscriptPath : parentTranscriptPath,
|
|
||||||
})
|
|
||||||
hook.startLoop("session-123", "Build API", { ultrawork: true })
|
|
||||||
writeFileSync(
|
|
||||||
parentTranscriptPath,
|
|
||||||
`${JSON.stringify({ type: "tool_result", timestamp: new Date().toISOString(), tool_output: { output: "done <promise>DONE</promise>" } })}\n`,
|
|
||||||
)
|
|
||||||
|
|
||||||
await hook.event({ event: { type: "session.idle", properties: { sessionID: "session-123" } } })
|
|
||||||
writeState(testDir, {
|
|
||||||
...hook.getState()!,
|
|
||||||
verification_session_id: "ses-oracle",
|
|
||||||
})
|
|
||||||
writeFileSync(
|
|
||||||
oracleTranscriptPath,
|
|
||||||
`${JSON.stringify({ type: "tool_result", timestamp: new Date().toISOString(), tool_output: { output: "failed" } })}\n`,
|
|
||||||
)
|
|
||||||
|
|
||||||
await hook.event({ event: { type: "session.idle", properties: { sessionID: "ses-oracle" } } })
|
|
||||||
abortCalls.length = 0
|
|
||||||
|
|
||||||
writeFileSync(
|
|
||||||
parentTranscriptPath,
|
|
||||||
`${JSON.stringify({ type: "tool_result", timestamp: new Date().toISOString(), tool_output: { output: "fixed it <promise>DONE</promise>" } })}\n`,
|
|
||||||
)
|
|
||||||
writeState(testDir, {
|
|
||||||
...hook.getState()!,
|
|
||||||
verification_session_id: "ses-oracle-old",
|
|
||||||
})
|
|
||||||
|
|
||||||
await hook.event({ event: { type: "session.idle", properties: { sessionID: "session-123" } } })
|
|
||||||
|
|
||||||
expect(abortCalls).toHaveLength(1)
|
|
||||||
expect(abortCalls[0].id).toBe("ses-oracle-old")
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -68,10 +68,6 @@ export async function handleFailedVerification(
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.verification_session_id) {
|
|
||||||
ctx.client.session.abort({ path: { id: state.verification_session_id } }).catch(() => {})
|
|
||||||
}
|
|
||||||
|
|
||||||
const resumedState = loopState.restartAfterFailedVerification(
|
const resumedState = loopState.restartAfterFailedVerification(
|
||||||
parentSessionID,
|
parentSessionID,
|
||||||
messageCountAtStart,
|
messageCountAtStart,
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user