mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-15 17:08:21 -04:00
Compare commits
75 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b3d027e3b | |||
| ce209e22a2 | |||
| 56fa267e09 | |||
| 2b73a08916 | |||
| b0190116a7 | |||
| 11c0ad24aa | |||
| 4cfe8a8bf8 | |||
| 754951bbbd | |||
| 38d4d03ba8 | |||
| 162da4bd97 | |||
| 18563363da | |||
| d18891523d | |||
| bda7a488d4 | |||
| bde80e24e5 | |||
| 0114a3f317 | |||
| a4d4a3f545 | |||
| e8b4eb8972 | |||
| 7c18b95826 | |||
| 381afd6e10 | |||
| a8d5b14d1a | |||
| 39b4f861f3 | |||
| 13f89d5aa5 | |||
| f29cb81c7d | |||
| d034a61635 | |||
| 2eca96c80f | |||
| 057208e022 | |||
| 6db0f9855c | |||
| e0894d7b63 | |||
| cd3a58a4c2 | |||
| a5614f988f | |||
| 0f58efe030 | |||
| 4abb464345 | |||
| d1d3d420bf | |||
| 1d68cd288c | |||
| 0b8f8bc196 | |||
| 4d30ad1e7c | |||
| c90640e0e1 | |||
| 36b51cad33 | |||
| 776e61d1ec | |||
| 28aebb2772 | |||
| 6494f48136 | |||
| 15fae6cb60 | |||
| aacf1d20d3 | |||
| bcf7817127 | |||
| abf79ae24c | |||
| 922633ea9d | |||
| 49b40e3c90 | |||
| df3276fc87 | |||
| f8f986536b | |||
| 785635caef | |||
| ec27518eca | |||
| 8ee4ada38e | |||
| ab7b1d78bf | |||
| 2f44d1900e | |||
| cb535eef9d | |||
| d3ec6f75f4 | |||
| 9a8b2ae0b1 | |||
| eadb0e25da | |||
| ddd30ef304 | |||
| 2abf1100ee | |||
| bd2e34f3bd | |||
| a45c3a0049 | |||
| 52d1ee70a0 | |||
| 0a9fcab56f | |||
| 62fae6d182 | |||
| 3a5be7ad33 | |||
| f1e88d35ba | |||
| b737e87d9a | |||
| bd6e81f30b | |||
| f080147363 | |||
| 0051b605ae | |||
| 56e0e5ce65 | |||
| d065d5a8ec | |||
| cf79208055 | |||
| f276a8db42 |
@@ -1,5 +1,6 @@
|
|||||||
name: Bug report
|
name: Bug report
|
||||||
description: Report an issue that should be fixed
|
description: Report an issue that should be fixed
|
||||||
|
labels: ["bug"]
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: description
|
id: description
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
name: 🚀 Feature Request
|
name: 🚀 Feature Request
|
||||||
description: Suggest an idea, feature, or enhancement
|
description: Suggest an idea, feature, or enhancement
|
||||||
|
labels: [discussion]
|
||||||
title: "[FEATURE]:"
|
title: "[FEATURE]:"
|
||||||
|
|
||||||
body:
|
body:
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
name: Question
|
name: Question
|
||||||
description: Ask a question
|
description: Ask a question
|
||||||
|
labels: ["question"]
|
||||||
body:
|
body:
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: question
|
id: question
|
||||||
|
|||||||
@@ -11,6 +11,5 @@ MrMushrooooom
|
|||||||
nexxeln
|
nexxeln
|
||||||
R44VC0RP
|
R44VC0RP
|
||||||
rekram1-node
|
rekram1-node
|
||||||
|
RhysSullivan
|
||||||
thdxr
|
thdxr
|
||||||
simonklee
|
|
||||||
vimtor
|
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Vouched contributors for this project.
|
||||||
|
#
|
||||||
|
# See https://github.com/mitchellh/vouch for details.
|
||||||
|
#
|
||||||
|
# Syntax:
|
||||||
|
# - One handle per line (without @), sorted alphabetically.
|
||||||
|
# - Optional platform prefix: platform:username (e.g., github:user).
|
||||||
|
# - Denounce with minus prefix: -username or -platform:username.
|
||||||
|
# - Optional details after a space following the handle.
|
||||||
|
adamdotdevin
|
||||||
|
-agusbasari29 AI PR slop
|
||||||
|
ariane-emory
|
||||||
|
-atharvau AI review spamming literally every PR
|
||||||
|
-borealbytes
|
||||||
|
-danieljoshuanazareth
|
||||||
|
-danieljoshuanazareth
|
||||||
|
edemaine
|
||||||
|
-florianleibert
|
||||||
|
fwang
|
||||||
|
iamdavidhill
|
||||||
|
jayair
|
||||||
|
kitlangton
|
||||||
|
kommander
|
||||||
|
-opencode2026
|
||||||
|
-opencodeengineer bot that spams issues
|
||||||
|
r44vc0rp
|
||||||
|
rekram1-node
|
||||||
|
-ricardo-m-l
|
||||||
|
-robinmordasiewicz
|
||||||
|
shantur
|
||||||
|
simonklee
|
||||||
|
-spider-yamet clawdbot/llm psychosis, spam pinging the team
|
||||||
|
thdxr
|
||||||
|
-toastythebot
|
||||||
@@ -1,10 +1,5 @@
|
|||||||
name: "Setup Bun"
|
name: "Setup Bun"
|
||||||
description: "Setup Bun with caching and install dependencies"
|
description: "Setup Bun with caching and install dependencies"
|
||||||
inputs:
|
|
||||||
install-flags:
|
|
||||||
description: "Additional flags to pass to 'bun install'"
|
|
||||||
required: false
|
|
||||||
default: ""
|
|
||||||
runs:
|
runs:
|
||||||
using: "composite"
|
using: "composite"
|
||||||
steps:
|
steps:
|
||||||
@@ -51,8 +46,8 @@ runs:
|
|||||||
# e.g. ./patches/ for standard-openapi
|
# e.g. ./patches/ for standard-openapi
|
||||||
# https://github.com/oven-sh/bun/issues/28147
|
# https://github.com/oven-sh/bun/issues/28147
|
||||||
if [ "$RUNNER_OS" = "Windows" ]; then
|
if [ "$RUNNER_OS" = "Windows" ]; then
|
||||||
bun install --linker hoisted ${{ inputs.install-flags }}
|
bun install --linker hoisted
|
||||||
else
|
else
|
||||||
bun install ${{ inputs.install-flags }}
|
bun install
|
||||||
fi
|
fi
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|||||||
@@ -0,0 +1,170 @@
|
|||||||
|
name: daily-issues-recap
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# Run at 6 PM EST (23:00 UTC, or 22:00 UTC during daylight saving)
|
||||||
|
- cron: "0 23 * * *"
|
||||||
|
workflow_dispatch: # Allow manual trigger for testing
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
daily-recap:
|
||||||
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- uses: ./.github/actions/setup-bun
|
||||||
|
|
||||||
|
- name: Install opencode
|
||||||
|
run: curl -fsSL https://opencode.ai/install | bash
|
||||||
|
|
||||||
|
- name: Generate daily issues recap
|
||||||
|
id: recap
|
||||||
|
env:
|
||||||
|
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
OPENCODE_PERMISSION: |
|
||||||
|
{
|
||||||
|
"bash": {
|
||||||
|
"*": "deny",
|
||||||
|
"gh issue*": "allow",
|
||||||
|
"gh search*": "allow"
|
||||||
|
},
|
||||||
|
"webfetch": "deny",
|
||||||
|
"edit": "deny",
|
||||||
|
"write": "deny"
|
||||||
|
}
|
||||||
|
run: |
|
||||||
|
# Get today's date range
|
||||||
|
TODAY=$(date -u +%Y-%m-%d)
|
||||||
|
|
||||||
|
opencode run -m opencode/claude-sonnet-4-5 "Generate a daily issues recap for the OpenCode repository.
|
||||||
|
|
||||||
|
TODAY'S DATE: ${TODAY}
|
||||||
|
|
||||||
|
STEP 1: Gather today's issues
|
||||||
|
Search for all OPEN issues created today (${TODAY}) using:
|
||||||
|
gh issue list --repo ${{ github.repository }} --state open --search \"created:${TODAY}\" --json number,title,body,labels,state,comments,createdAt,author --limit 500
|
||||||
|
|
||||||
|
IMPORTANT: EXCLUDE all issues authored by Anomaly team members. Filter out issues where the author login matches ANY of these:
|
||||||
|
adamdotdevin, Brendonovich, fwang, Hona, iamdavidhill, jayair, kitlangton, kommander, MrMushrooooom, R44VC0RP, rekram1-node, thdxr
|
||||||
|
This recap is specifically for COMMUNITY (external) issues only.
|
||||||
|
|
||||||
|
STEP 2: Analyze and categorize
|
||||||
|
For each issue created today, categorize it:
|
||||||
|
|
||||||
|
**Severity Assessment:**
|
||||||
|
- CRITICAL: Crashes, data loss, security issues, blocks major functionality
|
||||||
|
- HIGH: Significant bugs affecting many users, important features broken
|
||||||
|
- MEDIUM: Bugs with workarounds, minor features broken
|
||||||
|
- LOW: Minor issues, cosmetic, nice-to-haves
|
||||||
|
|
||||||
|
**Activity Assessment:**
|
||||||
|
- Note issues with high comment counts or engagement
|
||||||
|
- Note issues from repeat reporters (check if author has filed before)
|
||||||
|
|
||||||
|
STEP 3: Cross-reference with existing issues
|
||||||
|
For issues that seem like feature requests or recurring bugs:
|
||||||
|
- Search for similar older issues to identify patterns
|
||||||
|
- Note if this is a frequently requested feature
|
||||||
|
- Identify any issues that are duplicates of long-standing requests
|
||||||
|
|
||||||
|
STEP 4: Generate the recap
|
||||||
|
Create a structured recap with these sections:
|
||||||
|
|
||||||
|
===DISCORD_START===
|
||||||
|
**Daily Issues Recap - ${TODAY}**
|
||||||
|
|
||||||
|
**Summary Stats**
|
||||||
|
- Total issues opened today: [count]
|
||||||
|
- By category: [bugs/features/questions]
|
||||||
|
|
||||||
|
**Critical/High Priority Issues**
|
||||||
|
[List any CRITICAL or HIGH severity issues with brief descriptions and issue numbers]
|
||||||
|
|
||||||
|
**Most Active/Discussed**
|
||||||
|
[Issues with significant engagement or from active community members]
|
||||||
|
|
||||||
|
**Trending Topics**
|
||||||
|
[Patterns noticed - e.g., 'Multiple reports about X', 'Continued interest in Y feature']
|
||||||
|
|
||||||
|
**Duplicates & Related**
|
||||||
|
[Issues that relate to existing open issues]
|
||||||
|
===DISCORD_END===
|
||||||
|
|
||||||
|
STEP 5: Format for Discord
|
||||||
|
Format the recap as a Discord-compatible message:
|
||||||
|
- Use Discord markdown (**, __, etc.)
|
||||||
|
- BE EXTREMELY CONCISE - this is an EOD summary, not a detailed report
|
||||||
|
- Use hyperlinked issue numbers with suppressed embeds: [#1234](<https://github.com/${{ github.repository }}/issues/1234>)
|
||||||
|
- Group related issues on single lines where possible
|
||||||
|
- Add emoji sparingly for critical items only
|
||||||
|
- HARD LIMIT: Keep under 1800 characters total
|
||||||
|
- Skip sections that have nothing notable (e.g., if no critical issues, omit that section)
|
||||||
|
- Prioritize signal over completeness - only surface what matters
|
||||||
|
|
||||||
|
OUTPUT: Output ONLY the content between ===DISCORD_START=== and ===DISCORD_END=== markers. Include the markers so I can extract it." > /tmp/recap_raw.txt
|
||||||
|
|
||||||
|
# Extract only the Discord message between markers
|
||||||
|
sed -n '/===DISCORD_START===/,/===DISCORD_END===/p' /tmp/recap_raw.txt | grep -v '===DISCORD' > /tmp/recap.txt
|
||||||
|
|
||||||
|
echo "recap_file=/tmp/recap.txt" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Post to Discord
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_ISSUES_WEBHOOK_URL }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$DISCORD_WEBHOOK_URL" ]; then
|
||||||
|
echo "Warning: DISCORD_ISSUES_WEBHOOK_URL secret not set, skipping Discord post"
|
||||||
|
cat /tmp/recap.txt
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read the recap
|
||||||
|
RECAP_RAW=$(cat /tmp/recap.txt)
|
||||||
|
RECAP_LENGTH=${#RECAP_RAW}
|
||||||
|
|
||||||
|
echo "Recap length: ${RECAP_LENGTH} chars"
|
||||||
|
|
||||||
|
# Function to post a message to Discord
|
||||||
|
post_to_discord() {
|
||||||
|
local msg="$1"
|
||||||
|
local content=$(echo "$msg" | jq -Rs '.')
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\": ${content}}" \
|
||||||
|
"$DISCORD_WEBHOOK_URL"
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# If under limit, send as single message
|
||||||
|
if [ "$RECAP_LENGTH" -le 1950 ]; then
|
||||||
|
post_to_discord "$RECAP_RAW"
|
||||||
|
else
|
||||||
|
echo "Splitting into multiple messages..."
|
||||||
|
remaining="$RECAP_RAW"
|
||||||
|
while [ ${#remaining} -gt 0 ]; do
|
||||||
|
if [ ${#remaining} -le 1950 ]; then
|
||||||
|
post_to_discord "$remaining"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
chunk="${remaining:0:1900}"
|
||||||
|
last_newline=$(echo "$chunk" | grep -bo $'\n' | tail -1 | cut -d: -f1)
|
||||||
|
if [ -n "$last_newline" ] && [ "$last_newline" -gt 500 ]; then
|
||||||
|
chunk="${remaining:0:$last_newline}"
|
||||||
|
remaining="${remaining:$((last_newline+1))}"
|
||||||
|
else
|
||||||
|
chunk="${remaining:0:1900}"
|
||||||
|
remaining="${remaining:1900}"
|
||||||
|
fi
|
||||||
|
post_to_discord "$chunk"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Posted daily recap to Discord"
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
name: daily-pr-recap
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
# Run at 5pm EST (22:00 UTC, or 21:00 UTC during daylight saving)
|
||||||
|
- cron: "0 22 * * *"
|
||||||
|
workflow_dispatch: # Allow manual trigger for testing
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pr-recap:
|
||||||
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: read
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- uses: ./.github/actions/setup-bun
|
||||||
|
|
||||||
|
- name: Install opencode
|
||||||
|
run: curl -fsSL https://opencode.ai/install | bash
|
||||||
|
|
||||||
|
- name: Generate daily PR recap
|
||||||
|
id: recap
|
||||||
|
env:
|
||||||
|
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
OPENCODE_PERMISSION: |
|
||||||
|
{
|
||||||
|
"bash": {
|
||||||
|
"*": "deny",
|
||||||
|
"gh pr*": "allow",
|
||||||
|
"gh search*": "allow"
|
||||||
|
},
|
||||||
|
"webfetch": "deny",
|
||||||
|
"edit": "deny",
|
||||||
|
"write": "deny"
|
||||||
|
}
|
||||||
|
run: |
|
||||||
|
TODAY=$(date -u +%Y-%m-%d)
|
||||||
|
|
||||||
|
opencode run -m opencode/claude-sonnet-4-5 "Generate a daily PR activity recap for the OpenCode repository.
|
||||||
|
|
||||||
|
TODAY'S DATE: ${TODAY}
|
||||||
|
|
||||||
|
STEP 1: Gather PR data
|
||||||
|
Run these commands to gather PR information. ONLY include OPEN PRs created or updated TODAY (${TODAY}):
|
||||||
|
|
||||||
|
# Open PRs created today
|
||||||
|
gh pr list --repo ${{ github.repository }} --state open --search \"created:${TODAY}\" --json number,title,author,labels,createdAt,updatedAt,reviewDecision,isDraft,additions,deletions --limit 100
|
||||||
|
|
||||||
|
# Open PRs with activity today (updated today)
|
||||||
|
gh pr list --repo ${{ github.repository }} --state open --search \"updated:${TODAY}\" --json number,title,author,labels,createdAt,updatedAt,reviewDecision,isDraft,additions,deletions --limit 100
|
||||||
|
|
||||||
|
IMPORTANT: EXCLUDE all PRs authored by Anomaly team members. Filter out PRs where the author login matches ANY of these:
|
||||||
|
adamdotdevin, Brendonovich, fwang, Hona, iamdavidhill, jayair, kitlangton, kommander, MrMushrooooom, R44VC0RP, rekram1-node, thdxr
|
||||||
|
This recap is specifically for COMMUNITY (external) contributions only.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
STEP 2: For high-activity PRs, check comment counts
|
||||||
|
For promising PRs, run:
|
||||||
|
gh pr view [NUMBER] --repo ${{ github.repository }} --json comments --jq '[.comments[] | select(.author.login != \"copilot-pull-request-reviewer\" and .author.login != \"github-actions\")] | length'
|
||||||
|
|
||||||
|
IMPORTANT: When counting comments/activity, EXCLUDE these bot accounts:
|
||||||
|
- copilot-pull-request-reviewer
|
||||||
|
- github-actions
|
||||||
|
|
||||||
|
STEP 3: Identify what matters (ONLY from today's PRs)
|
||||||
|
|
||||||
|
**Bug Fixes From Today:**
|
||||||
|
- PRs with 'fix' or 'bug' in title created/updated today
|
||||||
|
- Small bug fixes (< 100 lines changed) that are easy to review
|
||||||
|
- Bug fixes from community contributors
|
||||||
|
|
||||||
|
**High Activity Today:**
|
||||||
|
- PRs with significant human comments today (excluding bots listed above)
|
||||||
|
- PRs with back-and-forth discussion today
|
||||||
|
|
||||||
|
**Quick Wins:**
|
||||||
|
- Small PRs (< 50 lines) that are approved or nearly approved
|
||||||
|
- PRs that just need a final review
|
||||||
|
|
||||||
|
STEP 4: Generate the recap
|
||||||
|
Create a structured recap:
|
||||||
|
|
||||||
|
===DISCORD_START===
|
||||||
|
**Daily PR Recap - ${TODAY}**
|
||||||
|
|
||||||
|
**New PRs Today**
|
||||||
|
[PRs opened today - group by type: bug fixes, features, etc.]
|
||||||
|
|
||||||
|
**Active PRs Today**
|
||||||
|
[PRs with activity/updates today - significant discussion]
|
||||||
|
|
||||||
|
**Quick Wins**
|
||||||
|
[Small PRs ready to merge]
|
||||||
|
===DISCORD_END===
|
||||||
|
|
||||||
|
STEP 5: Format for Discord
|
||||||
|
- Use Discord markdown (**, __, etc.)
|
||||||
|
- BE EXTREMELY CONCISE - surface what we might miss
|
||||||
|
- Use hyperlinked PR numbers with suppressed embeds: [#1234](<https://github.com/${{ github.repository }}/pull/1234>)
|
||||||
|
- Include PR author: [#1234](<url>) (@author)
|
||||||
|
- For bug fixes, add brief description of what it fixes
|
||||||
|
- Show line count for quick wins: \"(+15/-3 lines)\"
|
||||||
|
- HARD LIMIT: Keep under 1800 characters total
|
||||||
|
- Skip empty sections
|
||||||
|
- Focus on PRs that need human eyes
|
||||||
|
|
||||||
|
OUTPUT: Output ONLY the content between ===DISCORD_START=== and ===DISCORD_END=== markers. Include the markers so I can extract it." > /tmp/pr_recap_raw.txt
|
||||||
|
|
||||||
|
# Extract only the Discord message between markers
|
||||||
|
sed -n '/===DISCORD_START===/,/===DISCORD_END===/p' /tmp/pr_recap_raw.txt | grep -v '===DISCORD' > /tmp/pr_recap.txt
|
||||||
|
|
||||||
|
echo "recap_file=/tmp/pr_recap.txt" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Post to Discord
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_ISSUES_WEBHOOK_URL }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$DISCORD_WEBHOOK_URL" ]; then
|
||||||
|
echo "Warning: DISCORD_ISSUES_WEBHOOK_URL secret not set, skipping Discord post"
|
||||||
|
cat /tmp/pr_recap.txt
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Read the recap
|
||||||
|
RECAP_RAW=$(cat /tmp/pr_recap.txt)
|
||||||
|
RECAP_LENGTH=${#RECAP_RAW}
|
||||||
|
|
||||||
|
echo "Recap length: ${RECAP_LENGTH} chars"
|
||||||
|
|
||||||
|
# Function to post a message to Discord
|
||||||
|
post_to_discord() {
|
||||||
|
local msg="$1"
|
||||||
|
local content=$(echo "$msg" | jq -Rs '.')
|
||||||
|
curl -s -H "Content-Type: application/json" \
|
||||||
|
-X POST \
|
||||||
|
-d "{\"content\": ${content}}" \
|
||||||
|
"$DISCORD_WEBHOOK_URL"
|
||||||
|
sleep 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# If under limit, send as single message
|
||||||
|
if [ "$RECAP_LENGTH" -le 1950 ]; then
|
||||||
|
post_to_discord "$RECAP_RAW"
|
||||||
|
else
|
||||||
|
echo "Splitting into multiple messages..."
|
||||||
|
remaining="$RECAP_RAW"
|
||||||
|
while [ ${#remaining} -gt 0 ]; do
|
||||||
|
if [ ${#remaining} -le 1950 ]; then
|
||||||
|
post_to_discord "$remaining"
|
||||||
|
break
|
||||||
|
else
|
||||||
|
chunk="${remaining:0:1900}"
|
||||||
|
last_newline=$(echo "$chunk" | grep -bo $'\n' | tail -1 | cut -d: -f1)
|
||||||
|
if [ -n "$last_newline" ] && [ "$last_newline" -gt 500 ]; then
|
||||||
|
chunk="${remaining:0:$last_newline}"
|
||||||
|
remaining="${remaining:$((last_newline+1))}"
|
||||||
|
else
|
||||||
|
chunk="${remaining:0:1900}"
|
||||||
|
remaining="${remaining:1900}"
|
||||||
|
fi
|
||||||
|
post_to_discord "$chunk"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Posted daily PR recap to Discord"
|
||||||
@@ -36,10 +36,3 @@ jobs:
|
|||||||
PLANETSCALE_SERVICE_TOKEN_NAME: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_NAME }}
|
PLANETSCALE_SERVICE_TOKEN_NAME: ${{ secrets.PLANETSCALE_SERVICE_TOKEN_NAME }}
|
||||||
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }}
|
PLANETSCALE_SERVICE_TOKEN: ${{ secrets.PLANETSCALE_SERVICE_TOKEN }}
|
||||||
STRIPE_SECRET_KEY: ${{ github.ref_name == 'production' && secrets.STRIPE_SECRET_KEY_PROD || secrets.STRIPE_SECRET_KEY_DEV }}
|
STRIPE_SECRET_KEY: ${{ github.ref_name == 'production' && secrets.STRIPE_SECRET_KEY_PROD || secrets.STRIPE_SECRET_KEY_DEV }}
|
||||||
HONEYCOMB_API_KEY: ${{ secrets.HONEYCOMB_API_KEY }}
|
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
||||||
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
|
|
||||||
SENTRY_PROJECT: ${{ vars.WEB_SENTRY_PROJECT }}
|
|
||||||
SENTRY_RELEASE: web@${{ github.sha }}
|
|
||||||
VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }}
|
|
||||||
VITE_SENTRY_RELEASE: web@${{ github.sha }}
|
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
"on":
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- opencode-remote-voice
|
||||||
|
name: Deploy to apn-relay
|
||||||
|
jobs:
|
||||||
|
porter-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set Github tag
|
||||||
|
id: vars
|
||||||
|
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
||||||
|
- name: Setup porter
|
||||||
|
uses: porter-dev/setup-porter@v0.1.0
|
||||||
|
- name: Deploy stack
|
||||||
|
timeout-minutes: 30
|
||||||
|
run: porter apply
|
||||||
|
env:
|
||||||
|
PORTER_APP_NAME: apn-relay
|
||||||
|
PORTER_CLUSTER: "5534"
|
||||||
|
PORTER_DEPLOYMENT_TARGET_ID: d60e67f5-b0a6-4275-8ed6-3cebaf092147
|
||||||
|
PORTER_HOST: https://dashboard.porter.run
|
||||||
|
PORTER_PROJECT: "18525"
|
||||||
|
PORTER_TAG: ${{ steps.vars.outputs.sha_short }}
|
||||||
|
PORTER_TOKEN: ${{ secrets.PORTER_APP_18525_975734319 }}
|
||||||
+197
-57
@@ -88,7 +88,7 @@ jobs:
|
|||||||
- name: Build
|
- name: Build
|
||||||
id: build
|
id: build
|
||||||
run: |
|
run: |
|
||||||
./packages/opencode/script/build.ts ${{ (github.ref_name == 'beta' && '--sourcemaps') || '' }}
|
./packages/opencode/script/build.ts
|
||||||
env:
|
env:
|
||||||
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
||||||
OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
|
OPENCODE_RELEASE: ${{ needs.version.outputs.release }}
|
||||||
@@ -209,6 +209,182 @@ jobs:
|
|||||||
packages/opencode/dist/opencode-windows-x64
|
packages/opencode/dist/opencode-windows-x64
|
||||||
packages/opencode/dist/opencode-windows-x64-baseline
|
packages/opencode/dist/opencode-windows-x64-baseline
|
||||||
|
|
||||||
|
build-tauri:
|
||||||
|
needs:
|
||||||
|
- build-cli
|
||||||
|
- version
|
||||||
|
continue-on-error: false
|
||||||
|
env:
|
||||||
|
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
AZURE_TRUSTED_SIGNING_ACCOUNT_NAME: ${{ secrets.AZURE_TRUSTED_SIGNING_ACCOUNT_NAME }}
|
||||||
|
AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE: ${{ secrets.AZURE_TRUSTED_SIGNING_CERTIFICATE_PROFILE }}
|
||||||
|
AZURE_TRUSTED_SIGNING_ENDPOINT: ${{ secrets.AZURE_TRUSTED_SIGNING_ENDPOINT }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
settings:
|
||||||
|
- host: macos-latest
|
||||||
|
target: x86_64-apple-darwin
|
||||||
|
- host: macos-latest
|
||||||
|
target: aarch64-apple-darwin
|
||||||
|
# github-hosted: blacksmith lacks ARM64 MSVC cross-compilation toolchain
|
||||||
|
- host: windows-2025
|
||||||
|
target: aarch64-pc-windows-msvc
|
||||||
|
- host: blacksmith-4vcpu-windows-2025
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
- host: blacksmith-4vcpu-ubuntu-2404
|
||||||
|
target: x86_64-unknown-linux-gnu
|
||||||
|
- host: blacksmith-8vcpu-ubuntu-2404-arm
|
||||||
|
target: aarch64-unknown-linux-gnu
|
||||||
|
runs-on: ${{ matrix.settings.host }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-tags: true
|
||||||
|
|
||||||
|
- uses: apple-actions/import-codesign-certs@v2
|
||||||
|
if: ${{ runner.os == 'macOS' }}
|
||||||
|
with:
|
||||||
|
keychain: build
|
||||||
|
p12-file-base64: ${{ secrets.APPLE_CERTIFICATE }}
|
||||||
|
p12-password: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Verify Certificate
|
||||||
|
if: ${{ runner.os == 'macOS' }}
|
||||||
|
run: |
|
||||||
|
CERT_INFO=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application")
|
||||||
|
CERT_ID=$(echo "$CERT_INFO" | awk -F'"' '{print $2}')
|
||||||
|
echo "CERT_ID=$CERT_ID" >> $GITHUB_ENV
|
||||||
|
echo "Certificate imported."
|
||||||
|
|
||||||
|
- name: Setup Apple API Key
|
||||||
|
if: ${{ runner.os == 'macOS' }}
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
|
||||||
|
|
||||||
|
- uses: ./.github/actions/setup-bun
|
||||||
|
|
||||||
|
- name: Azure login
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
uses: azure/login@v2
|
||||||
|
with:
|
||||||
|
client-id: ${{ env.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ env.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ env.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "24"
|
||||||
|
|
||||||
|
- name: Cache apt packages
|
||||||
|
if: contains(matrix.settings.host, 'ubuntu')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/apt-cache
|
||||||
|
key: ${{ runner.os }}-${{ matrix.settings.target }}-apt-${{ hashFiles('.github/workflows/publish.yml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ matrix.settings.target }}-apt-
|
||||||
|
|
||||||
|
- name: install dependencies (ubuntu only)
|
||||||
|
if: contains(matrix.settings.host, 'ubuntu')
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/apt-cache && chmod -R a+rw ~/apt-cache
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y --no-install-recommends -o dir::cache::archives="$HOME/apt-cache" libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
|
||||||
|
sudo chmod -R a+rw ~/apt-cache
|
||||||
|
|
||||||
|
- name: install Rust stable
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
targets: ${{ matrix.settings.target }}
|
||||||
|
|
||||||
|
- uses: Swatinem/rust-cache@v2
|
||||||
|
with:
|
||||||
|
workspaces: packages/desktop/src-tauri
|
||||||
|
shared-key: ${{ matrix.settings.target }}
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
run: |
|
||||||
|
cd packages/desktop
|
||||||
|
bun ./scripts/prepare.ts
|
||||||
|
env:
|
||||||
|
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
||||||
|
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
|
||||||
|
OPENCODE_CLI_ARTIFACT: ${{ (runner.os == 'Windows' && 'opencode-cli-windows') || 'opencode-cli' }}
|
||||||
|
RUST_TARGET: ${{ matrix.settings.target }}
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
GITHUB_RUN_ID: ${{ github.run_id }}
|
||||||
|
|
||||||
|
- name: Resolve tauri portable SHA
|
||||||
|
if: contains(matrix.settings.host, 'ubuntu')
|
||||||
|
run: echo "TAURI_PORTABLE_SHA=$(git ls-remote https://github.com/tauri-apps/tauri.git refs/heads/feat/truly-portable-appimage | cut -f1)" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
# Fixes AppImage build issues, can be removed when https://github.com/tauri-apps/tauri/pull/12491 is released
|
||||||
|
- name: Install tauri-cli from portable appimage branch
|
||||||
|
uses: taiki-e/cache-cargo-install-action@v3
|
||||||
|
if: contains(matrix.settings.host, 'ubuntu')
|
||||||
|
with:
|
||||||
|
tool: tauri-cli
|
||||||
|
git: https://github.com/tauri-apps/tauri
|
||||||
|
# branch: feat/truly-portable-appimage
|
||||||
|
rev: ${{ env.TAURI_PORTABLE_SHA }}
|
||||||
|
|
||||||
|
- name: Show tauri-cli version
|
||||||
|
if: contains(matrix.settings.host, 'ubuntu')
|
||||||
|
run: cargo tauri --version
|
||||||
|
|
||||||
|
- name: Setup git committer
|
||||||
|
id: committer
|
||||||
|
uses: ./.github/actions/setup-git-committer
|
||||||
|
with:
|
||||||
|
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
|
||||||
|
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
|
||||||
|
|
||||||
|
- name: Build and upload artifacts
|
||||||
|
uses: tauri-apps/tauri-action@390cbe447412ced1303d35abe75287949e43437a
|
||||||
|
timeout-minutes: 60
|
||||||
|
with:
|
||||||
|
projectPath: packages/desktop
|
||||||
|
uploadWorkflowArtifacts: true
|
||||||
|
tauriScript: ${{ (contains(matrix.settings.host, 'ubuntu') && 'cargo tauri') || '' }}
|
||||||
|
args: --target ${{ matrix.settings.target }} --config ${{ (github.ref_name == 'beta' && './src-tauri/tauri.beta.conf.json') || './src-tauri/tauri.prod.conf.json' }} --verbose
|
||||||
|
updaterJsonPreferNsis: true
|
||||||
|
releaseId: ${{ needs.version.outputs.release }}
|
||||||
|
tagName: ${{ needs.version.outputs.tag }}
|
||||||
|
releaseDraft: true
|
||||||
|
releaseAssetNamePattern: opencode-desktop-[platform]-[arch][ext]
|
||||||
|
repo: ${{ (github.ref_name == 'beta' && 'opencode-beta') || '' }}
|
||||||
|
releaseCommitish: ${{ github.sha }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
|
||||||
|
TAURI_BUNDLER_NEW_APPIMAGE_FORMAT: true
|
||||||
|
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
||||||
|
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
||||||
|
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||||
|
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||||
|
APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }}
|
||||||
|
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
|
||||||
|
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
|
||||||
|
APPLE_API_KEY_PATH: ${{ runner.temp }}/apple-api-key.p8
|
||||||
|
|
||||||
|
- name: Verify signed Windows desktop artifacts
|
||||||
|
if: runner.os == 'Windows'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$files = @(
|
||||||
|
"${{ github.workspace }}\packages\desktop\src-tauri\sidecars\opencode-cli-${{ matrix.settings.target }}.exe"
|
||||||
|
)
|
||||||
|
$files += Get-ChildItem "${{ github.workspace }}\packages\desktop\src-tauri\target\${{ matrix.settings.target }}\release\bundle\nsis\*.exe" | Select-Object -ExpandProperty FullName
|
||||||
|
|
||||||
|
foreach ($file in $files) {
|
||||||
|
$sig = Get-AuthenticodeSignature $file
|
||||||
|
if ($sig.Status -ne "Valid") {
|
||||||
|
throw "Invalid signature for ${file}: $($sig.Status)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
build-electron:
|
build-electron:
|
||||||
needs:
|
needs:
|
||||||
- build-cli
|
- build-cli
|
||||||
@@ -226,14 +402,12 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
settings:
|
settings:
|
||||||
- host: macos-26-intel
|
- host: macos-latest
|
||||||
target: x86_64-apple-darwin
|
target: x86_64-apple-darwin
|
||||||
platform_flag: --mac --x64
|
platform_flag: --mac --x64
|
||||||
bun_install_flags: --os=darwin --cpu=x64
|
- host: macos-latest
|
||||||
- host: macos-26
|
|
||||||
target: aarch64-apple-darwin
|
target: aarch64-apple-darwin
|
||||||
platform_flag: --mac --arm64
|
platform_flag: --mac --arm64
|
||||||
bun_install_flags: --os=darwin --cpu=arm64
|
|
||||||
# github-hosted: blacksmith lacks ARM64 MSVC cross-compilation toolchain
|
# github-hosted: blacksmith lacks ARM64 MSVC cross-compilation toolchain
|
||||||
- host: "windows-2025"
|
- host: "windows-2025"
|
||||||
target: aarch64-pc-windows-msvc
|
target: aarch64-pc-windows-msvc
|
||||||
@@ -263,8 +437,6 @@ jobs:
|
|||||||
run: echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
|
run: echo "${{ secrets.APPLE_API_KEY_PATH }}" > $RUNNER_TEMP/apple-api-key.p8
|
||||||
|
|
||||||
- uses: ./.github/actions/setup-bun
|
- uses: ./.github/actions/setup-bun
|
||||||
with:
|
|
||||||
install-flags: ${{ matrix.settings.bun_install_flags }}
|
|
||||||
|
|
||||||
- name: Azure login
|
- name: Azure login
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
@@ -304,7 +476,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Prepare
|
- name: Prepare
|
||||||
run: bun ./scripts/prepare.ts
|
run: bun ./scripts/prepare.ts
|
||||||
working-directory: packages/desktop
|
working-directory: packages/desktop-electron
|
||||||
env:
|
env:
|
||||||
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
OPENCODE_VERSION: ${{ needs.version.outputs.version }}
|
||||||
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
||||||
@@ -315,21 +487,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: bun run build
|
run: bun run build
|
||||||
working-directory: packages/desktop
|
working-directory: packages/desktop-electron
|
||||||
env:
|
env:
|
||||||
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
||||||
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
|
|
||||||
SENTRY_ORG: ${{ vars.SENTRY_ORG }}
|
|
||||||
SENTRY_PROJECT: ${{ vars.WEB_SENTRY_PROJECT }}
|
|
||||||
SENTRY_RELEASE: desktop@${{ needs.version.outputs.version }}
|
|
||||||
VITE_SENTRY_DSN: ${{ vars.WEB_SENTRY_DSN }}
|
|
||||||
VITE_SENTRY_ENVIRONMENT: ${{ (github.ref_name == 'beta' && 'beta') || 'production' }}
|
|
||||||
VITE_SENTRY_RELEASE: desktop@${{ needs.version.outputs.version }}
|
|
||||||
|
|
||||||
- name: Package and publish
|
- name: Package and publish
|
||||||
if: needs.version.outputs.release
|
if: needs.version.outputs.release
|
||||||
run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish always --config electron-builder.config.ts
|
run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish always --config electron-builder.config.ts
|
||||||
working-directory: packages/desktop
|
working-directory: packages/desktop-electron
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
env:
|
env:
|
||||||
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
||||||
@@ -343,43 +508,19 @@ jobs:
|
|||||||
- name: Package (no publish)
|
- name: Package (no publish)
|
||||||
if: ${{ !needs.version.outputs.release }}
|
if: ${{ !needs.version.outputs.release }}
|
||||||
run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish never --config electron-builder.config.ts
|
run: npx electron-builder ${{ matrix.settings.platform_flag }} --publish never --config electron-builder.config.ts
|
||||||
working-directory: packages/desktop
|
working-directory: packages/desktop-electron
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
env:
|
env:
|
||||||
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
OPENCODE_CHANNEL: ${{ (github.ref_name == 'beta' && 'beta') || 'prod' }}
|
||||||
|
|
||||||
- name: Create and upload macOS .app.tar.gz
|
|
||||||
if: runner.os == 'macOS' && needs.version.outputs.release
|
|
||||||
working-directory: packages/desktop/dist
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ steps.committer.outputs.token }}
|
|
||||||
run: |
|
|
||||||
if [[ "${{ matrix.settings.target }}" == "x86_64-apple-darwin" ]]; then
|
|
||||||
APP_DIR="mac"
|
|
||||||
OUT_NAME="opencode-desktop-mac-x64.app.tar.gz"
|
|
||||||
elif [[ "${{ matrix.settings.target }}" == "aarch64-apple-darwin" ]]; then
|
|
||||||
APP_DIR="mac-arm64"
|
|
||||||
OUT_NAME="opencode-desktop-mac-arm64.app.tar.gz"
|
|
||||||
else
|
|
||||||
echo "Unknown macOS target: ${{ matrix.settings.target }}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
APP_PATH=$(find "$APP_DIR" -maxdepth 1 -name "*.app" -type d | head -1)
|
|
||||||
if [ -z "$APP_PATH" ]; then
|
|
||||||
echo "No .app bundle found in $APP_DIR"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
tar -czf "$OUT_NAME" -C "$(dirname "$APP_PATH")" "$(basename "$APP_PATH")"
|
|
||||||
gh release upload "v${{ needs.version.outputs.version }}" "$OUT_NAME" --clobber --repo "${{ needs.version.outputs.repo }}"
|
|
||||||
|
|
||||||
- name: Verify signed Windows Electron artifacts
|
- name: Verify signed Windows Electron artifacts
|
||||||
if: runner.os == 'Windows'
|
if: runner.os == 'Windows'
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$files = @()
|
$files = @()
|
||||||
$files += Get-ChildItem "${{ github.workspace }}\packages\desktop\dist\*.exe" | Select-Object -ExpandProperty FullName
|
$files += Get-ChildItem "${{ github.workspace }}\packages\desktop-electron\dist\*.exe" | Select-Object -ExpandProperty FullName
|
||||||
$files += Get-ChildItem "${{ github.workspace }}\packages\desktop\dist\*unpacked\*.exe" | Select-Object -ExpandProperty FullName
|
$files += Get-ChildItem "${{ github.workspace }}\packages\desktop-electron\dist\*unpacked\*.exe" | Select-Object -ExpandProperty FullName
|
||||||
$files += Get-ChildItem "${{ github.workspace }}\packages\desktop\dist\*unpacked\resources\opencode-cli.exe" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
|
$files += Get-ChildItem "${{ github.workspace }}\packages\desktop-electron\dist\*unpacked\resources\opencode-cli.exe" -ErrorAction SilentlyContinue | Select-Object -ExpandProperty FullName
|
||||||
|
|
||||||
foreach ($file in $files | Select-Object -Unique) {
|
foreach ($file in $files | Select-Object -Unique) {
|
||||||
$sig = Get-AuthenticodeSignature $file
|
$sig = Get-AuthenticodeSignature $file
|
||||||
@@ -390,20 +531,21 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: opencode-desktop-${{ matrix.settings.target }}
|
name: opencode-electron-${{ matrix.settings.target }}
|
||||||
path: packages/desktop/dist/*
|
path: packages/desktop-electron/dist/*
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
if: needs.version.outputs.release
|
if: needs.version.outputs.release
|
||||||
with:
|
with:
|
||||||
name: latest-yml-${{ matrix.settings.target }}
|
name: latest-yml-${{ matrix.settings.target }}
|
||||||
path: packages/desktop/dist/latest*.yml
|
path: packages/desktop-electron/dist/latest*.yml
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
needs:
|
needs:
|
||||||
- version
|
- version
|
||||||
- build-cli
|
- build-cli
|
||||||
- sign-cli-windows
|
- sign-cli-windows
|
||||||
|
- build-tauri
|
||||||
- build-electron
|
- build-electron
|
||||||
if: always() && !failure() && !cancelled()
|
if: always() && !failure() && !cancelled()
|
||||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
@@ -430,6 +572,13 @@ jobs:
|
|||||||
node-version: "24"
|
node-version: "24"
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
|
- name: Setup git committer
|
||||||
|
id: committer
|
||||||
|
uses: ./.github/actions/setup-git-committer
|
||||||
|
with:
|
||||||
|
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
|
||||||
|
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: opencode-cli
|
name: opencode-cli
|
||||||
@@ -451,13 +600,6 @@ jobs:
|
|||||||
pattern: latest-yml-*
|
pattern: latest-yml-*
|
||||||
path: /tmp/latest-yml
|
path: /tmp/latest-yml
|
||||||
|
|
||||||
- name: Setup git committer
|
|
||||||
id: committer
|
|
||||||
uses: ./.github/actions/setup-git-committer
|
|
||||||
with:
|
|
||||||
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
|
|
||||||
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
|
|
||||||
|
|
||||||
- name: Cache apt packages (AUR)
|
- name: Cache apt packages (AUR)
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
@@ -486,5 +628,3 @@ jobs:
|
|||||||
GH_REPO: ${{ needs.version.outputs.repo }}
|
GH_REPO: ${{ needs.version.outputs.repo }}
|
||||||
NPM_CONFIG_PROVENANCE: false
|
NPM_CONFIG_PROVENANCE: false
|
||||||
LATEST_YML_DIR: /tmp/latest-yml
|
LATEST_YML_DIR: /tmp/latest-yml
|
||||||
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
|
|
||||||
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
|
|
||||||
|
|||||||
@@ -45,13 +45,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Check PR guidelines compliance
|
- name: Check PR guidelines compliance
|
||||||
env:
|
env:
|
||||||
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
OPENCODE_PERMISSION: '{ "bash": { "*": "deny", "gh*": "allow", "gh pr review*": "deny" } }'
|
OPENCODE_PERMISSION: '{ "bash": { "*": "deny", "gh*": "allow", "gh pr review*": "deny" } }'
|
||||||
PR_TITLE: ${{ steps.pr-details.outputs.title }}
|
PR_TITLE: ${{ steps.pr-details.outputs.title }}
|
||||||
run: |
|
run: |
|
||||||
PR_BODY=$(jq -r .body pr_data.json)
|
PR_BODY=$(jq -r .body pr_data.json)
|
||||||
opencode run -m opencode/gpt-5.5 --variant medium "A new pull request has been created: '${PR_TITLE}'
|
opencode run -m anthropic/claude-opus-4-5 "A new pull request has been created: '${PR_TITLE}'
|
||||||
|
|
||||||
<pr-number>
|
<pr-number>
|
||||||
${{ steps.pr-number.outputs.number }}
|
${{ steps.pr-number.outputs.number }}
|
||||||
|
|||||||
@@ -68,11 +68,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
|
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER: ${{ runner.os == 'Windows' && 'true' || 'false' }}
|
||||||
|
|
||||||
- name: Run HttpApi exerciser gates
|
|
||||||
if: runner.os == 'Linux'
|
|
||||||
working-directory: packages/opencode
|
|
||||||
run: bun run test:httpapi
|
|
||||||
|
|
||||||
- name: Publish unit reports
|
- name: Publish unit reports
|
||||||
if: always()
|
if: always()
|
||||||
uses: mikepenz/action-junit-report@v6
|
uses: mikepenz/action-junit-report@v6
|
||||||
|
|||||||
@@ -0,0 +1,116 @@
|
|||||||
|
name: vouch-check-issue
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check if issue author is denounced
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const author = context.payload.issue.user.login;
|
||||||
|
const issueNumber = context.payload.issue.number;
|
||||||
|
|
||||||
|
// Skip bots
|
||||||
|
if (author.endsWith('[bot]')) {
|
||||||
|
core.info(`Skipping bot: ${author}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the VOUCHED.td file via API (no checkout needed)
|
||||||
|
let content;
|
||||||
|
try {
|
||||||
|
const response = await github.rest.repos.getContent({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
path: '.github/VOUCHED.td',
|
||||||
|
});
|
||||||
|
content = Buffer.from(response.data.content, 'base64').toString('utf-8');
|
||||||
|
} catch (error) {
|
||||||
|
if (error.status === 404) {
|
||||||
|
core.info('No .github/VOUCHED.td file found, skipping check.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse the .td file for vouched and denounced users
|
||||||
|
const vouched = new Set();
|
||||||
|
const denounced = new Map();
|
||||||
|
for (const line of content.split('\n')) {
|
||||||
|
const trimmed = line.trim();
|
||||||
|
if (!trimmed || trimmed.startsWith('#')) continue;
|
||||||
|
|
||||||
|
const isDenounced = trimmed.startsWith('-');
|
||||||
|
const rest = isDenounced ? trimmed.slice(1).trim() : trimmed;
|
||||||
|
if (!rest) continue;
|
||||||
|
|
||||||
|
const spaceIdx = rest.indexOf(' ');
|
||||||
|
const handle = spaceIdx === -1 ? rest : rest.slice(0, spaceIdx);
|
||||||
|
const reason = spaceIdx === -1 ? null : rest.slice(spaceIdx + 1).trim();
|
||||||
|
|
||||||
|
// Handle platform:username or bare username
|
||||||
|
// Only match bare usernames or github: prefix (skip other platforms)
|
||||||
|
const colonIdx = handle.indexOf(':');
|
||||||
|
if (colonIdx !== -1) {
|
||||||
|
const platform = handle.slice(0, colonIdx).toLowerCase();
|
||||||
|
if (platform !== 'github') continue;
|
||||||
|
}
|
||||||
|
const username = colonIdx === -1 ? handle : handle.slice(colonIdx + 1);
|
||||||
|
if (!username) continue;
|
||||||
|
|
||||||
|
if (isDenounced) {
|
||||||
|
denounced.set(username.toLowerCase(), reason);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vouched.add(username.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the author is denounced
|
||||||
|
const reason = denounced.get(author.toLowerCase());
|
||||||
|
if (reason !== undefined) {
|
||||||
|
// Author is denounced — close the issue
|
||||||
|
const body = 'This issue has been automatically closed.';
|
||||||
|
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
body,
|
||||||
|
});
|
||||||
|
|
||||||
|
await github.rest.issues.update({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
state: 'closed',
|
||||||
|
state_reason: 'not_planned',
|
||||||
|
});
|
||||||
|
|
||||||
|
core.info(`Closed issue #${issueNumber} from denounced user ${author}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Author is positively vouched — add label
|
||||||
|
if (!vouched.has(author.toLowerCase())) {
|
||||||
|
core.info(`User ${author} is not denounced or vouched. Allowing issue.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await github.rest.issues.addLabels({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: issueNumber,
|
||||||
|
labels: ['Vouched'],
|
||||||
|
});
|
||||||
|
|
||||||
|
core.info(`Added vouched label to issue #${issueNumber} from ${author}`);
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
name: vouch-check-pr
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request_target:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check if PR author is denounced
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const author = context.payload.pull_request.user.login;
|
||||||
|
const prNumber = context.payload.pull_request.number;
|
||||||
|
|
||||||
|
// Skip bots
|
||||||
|
if (author.endsWith('[bot]')) {
|
||||||
|
core.info(`Skipping bot: ${author}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Read the VOUCHED.td file via API (no checkout needed)
|
||||||
|
let content;
|
||||||
|
try {
|
||||||
|
const response = await github.rest.repos.getContent({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
path: '.github/VOUCHED.td',
|
||||||
|
});
|
||||||
|
content = Buffer.from(response.data.content, 'base64').toString('utf-8');
|
||||||
|
} catch (error) {
|
||||||
|
if (error.status === 404) {
|
||||||
|
core.info('No .github/VOUCHED.td file found, skipping check.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse the .td file for vouched and denounced users
|
||||||
|
const vouched = new Set();
|
||||||
|
const denounced = new Map();
|
||||||
|
for (const line of content.split('\n')) {
|
||||||
|
const trimmed = line.trim();
|
||||||
|
if (!trimmed || trimmed.startsWith('#')) continue;
|
||||||
|
|
||||||
|
const isDenounced = trimmed.startsWith('-');
|
||||||
|
const rest = isDenounced ? trimmed.slice(1).trim() : trimmed;
|
||||||
|
if (!rest) continue;
|
||||||
|
|
||||||
|
const spaceIdx = rest.indexOf(' ');
|
||||||
|
const handle = spaceIdx === -1 ? rest : rest.slice(0, spaceIdx);
|
||||||
|
const reason = spaceIdx === -1 ? null : rest.slice(spaceIdx + 1).trim();
|
||||||
|
|
||||||
|
// Handle platform:username or bare username
|
||||||
|
// Only match bare usernames or github: prefix (skip other platforms)
|
||||||
|
const colonIdx = handle.indexOf(':');
|
||||||
|
if (colonIdx !== -1) {
|
||||||
|
const platform = handle.slice(0, colonIdx).toLowerCase();
|
||||||
|
if (platform !== 'github') continue;
|
||||||
|
}
|
||||||
|
const username = colonIdx === -1 ? handle : handle.slice(colonIdx + 1);
|
||||||
|
if (!username) continue;
|
||||||
|
|
||||||
|
if (isDenounced) {
|
||||||
|
denounced.set(username.toLowerCase(), reason);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
vouched.add(username.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the author is denounced
|
||||||
|
const reason = denounced.get(author.toLowerCase());
|
||||||
|
if (reason !== undefined) {
|
||||||
|
// Author is denounced — close the PR
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: prNumber,
|
||||||
|
body: 'This pull request has been automatically closed.',
|
||||||
|
});
|
||||||
|
|
||||||
|
await github.rest.pulls.update({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
pull_number: prNumber,
|
||||||
|
state: 'closed',
|
||||||
|
});
|
||||||
|
|
||||||
|
core.info(`Closed PR #${prNumber} from denounced user ${author}`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Author is positively vouched — add label
|
||||||
|
if (!vouched.has(author.toLowerCase())) {
|
||||||
|
core.info(`User ${author} is not denounced or vouched. Allowing PR.`);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await github.rest.issues.addLabels({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
issue_number: prNumber,
|
||||||
|
labels: ['Vouched'],
|
||||||
|
});
|
||||||
|
|
||||||
|
core.info(`Added vouched label to PR #${prNumber} from ${author}`);
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
name: vouch-manage-by-issue
|
||||||
|
|
||||||
|
on:
|
||||||
|
issue_comment:
|
||||||
|
types: [created]
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: vouch-manage
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
issues: write
|
||||||
|
pull-requests: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
manage:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup git committer
|
||||||
|
id: committer
|
||||||
|
uses: ./.github/actions/setup-git-committer
|
||||||
|
with:
|
||||||
|
opencode-app-id: ${{ vars.OPENCODE_APP_ID }}
|
||||||
|
opencode-app-secret: ${{ secrets.OPENCODE_APP_SECRET }}
|
||||||
|
|
||||||
|
- uses: mitchellh/vouch/action/manage-by-issue@main
|
||||||
|
with:
|
||||||
|
issue-id: ${{ github.event.issue.number }}
|
||||||
|
comment-id: ${{ github.event.comment.id }}
|
||||||
|
roles: admin,maintain,write
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ steps.committer.outputs.token }}
|
||||||
@@ -3,7 +3,6 @@ node_modules
|
|||||||
.worktrees
|
.worktrees
|
||||||
.sst
|
.sst
|
||||||
.env
|
.env
|
||||||
.env.local
|
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
.codex
|
.codex
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
# Fake secret-looking strings used by HTTP recorder redaction tests.
|
|
||||||
afa57acfda894e0ebf3c637dd710310b705c0a2f:packages/http-recorder/test/record-replay.test.ts:generic-api-key:69
|
|
||||||
afa57acfda894e0ebf3c637dd710310b705c0a2f:packages/http-recorder/test/record-replay.test.ts:generic-api-key:92
|
|
||||||
afa57acfda894e0ebf3c637dd710310b705c0a2f:packages/http-recorder/test/record-replay.test.ts:generic-api-key:146
|
|
||||||
afa57acfda894e0ebf3c637dd710310b705c0a2f:packages/http-recorder/test/record-replay.test.ts:gcp-api-key:71
|
|
||||||
@@ -0,0 +1,899 @@
|
|||||||
|
---
|
||||||
|
description: Translate content for a specified locale while preserving technical terms
|
||||||
|
mode: subagent
|
||||||
|
model: opencode/gpt-5.4
|
||||||
|
---
|
||||||
|
|
||||||
|
You are a professional translator and localization specialist.
|
||||||
|
|
||||||
|
Translate the user's content into the requested target locale (language + region, e.g. fr-FR, de-DE).
|
||||||
|
|
||||||
|
Requirements:
|
||||||
|
|
||||||
|
- Preserve meaning, intent, tone, and formatting (including Markdown/MDX structure).
|
||||||
|
- Preserve all technical terms and artifacts exactly: product/company names, API names, identifiers, code, commands/flags, file paths, URLs, versions, error messages, config keys/values, and anything inside inline code or code blocks.
|
||||||
|
- Also preserve every term listed in the Do-Not-Translate glossary below.
|
||||||
|
- Also apply locale-specific guidance from `.opencode/glossary/<locale>.md` when available (for example, `zh-cn.md`).
|
||||||
|
- Do not modify fenced code blocks.
|
||||||
|
- Output ONLY the translation (no commentary).
|
||||||
|
|
||||||
|
If the target locale is missing, ask the user to provide it.
|
||||||
|
If no locale-specific glossary exists, use the global glossary only.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Locale-Specific Glossaries
|
||||||
|
|
||||||
|
When a locale glossary exists, use it to:
|
||||||
|
|
||||||
|
- Apply preferred wording for recurring UI/docs terms in that locale
|
||||||
|
- Preserve locale-specific do-not-translate terms and casing decisions
|
||||||
|
- Prefer natural phrasing over literal translation when the locale file calls it out
|
||||||
|
- If the repo uses a locale alias slug, apply that file too (for example, `pt-BR` maps to `br.md` in this repo)
|
||||||
|
|
||||||
|
Locale guidance does not override code/command preservation rules or the global Do-Not-Translate glossary below.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Do-Not-Translate Terms (OpenCode Docs)
|
||||||
|
|
||||||
|
Generated from: `packages/web/src/content/docs/*.mdx` (default English docs)
|
||||||
|
Generated on: 2026-02-10
|
||||||
|
|
||||||
|
Use this as a translation QA checklist / glossary. Preserve listed terms exactly (spelling, casing, punctuation).
|
||||||
|
|
||||||
|
General rules (verbatim, even if not listed below):
|
||||||
|
|
||||||
|
- Anything inside inline code (single backticks) or fenced code blocks (triple backticks)
|
||||||
|
- MDX/JS code in docs: `import ... from "..."`, component tags, identifiers
|
||||||
|
- CLI commands, flags, config keys/values, file paths, URLs/domains, and env vars
|
||||||
|
|
||||||
|
## Proper nouns and product names
|
||||||
|
|
||||||
|
Additional (not reliably captured via link text):
|
||||||
|
|
||||||
|
```text
|
||||||
|
Astro
|
||||||
|
Bun
|
||||||
|
Chocolatey
|
||||||
|
Cursor
|
||||||
|
Docker
|
||||||
|
Git
|
||||||
|
GitHub Actions
|
||||||
|
GitLab CI
|
||||||
|
GNOME Terminal
|
||||||
|
Homebrew
|
||||||
|
Mise
|
||||||
|
Neovim
|
||||||
|
Node.js
|
||||||
|
npm
|
||||||
|
Obsidian
|
||||||
|
opencode
|
||||||
|
opencode-ai
|
||||||
|
Paru
|
||||||
|
pnpm
|
||||||
|
ripgrep
|
||||||
|
Scoop
|
||||||
|
SST
|
||||||
|
Starlight
|
||||||
|
Visual Studio Code
|
||||||
|
VS Code
|
||||||
|
VSCodium
|
||||||
|
Windsurf
|
||||||
|
Windows Terminal
|
||||||
|
Yarn
|
||||||
|
Zellij
|
||||||
|
Zed
|
||||||
|
anomalyco
|
||||||
|
```
|
||||||
|
|
||||||
|
Extracted from link labels in the English docs (review and prune as desired):
|
||||||
|
|
||||||
|
```text
|
||||||
|
@openspoon/subtask2
|
||||||
|
302.AI console
|
||||||
|
ACP progress report
|
||||||
|
Agent Client Protocol
|
||||||
|
Agent Skills
|
||||||
|
Agentic
|
||||||
|
AGENTS.md
|
||||||
|
AI SDK
|
||||||
|
Alacritty
|
||||||
|
Anthropic
|
||||||
|
Anthropic's Data Policies
|
||||||
|
Atom One
|
||||||
|
Avante.nvim
|
||||||
|
Ayu
|
||||||
|
Azure AI Foundry
|
||||||
|
Azure portal
|
||||||
|
Baseten
|
||||||
|
built-in GITHUB_TOKEN
|
||||||
|
Bun.$
|
||||||
|
Catppuccin
|
||||||
|
Cerebras console
|
||||||
|
ChatGPT Plus or Pro
|
||||||
|
Cloudflare dashboard
|
||||||
|
CodeCompanion.nvim
|
||||||
|
CodeNomad
|
||||||
|
Configuring Adapters: Environment Variables
|
||||||
|
Context7 MCP server
|
||||||
|
Cortecs console
|
||||||
|
Deep Infra dashboard
|
||||||
|
DeepSeek console
|
||||||
|
Duo Agent Platform
|
||||||
|
Everforest
|
||||||
|
Fireworks AI console
|
||||||
|
Firmware dashboard
|
||||||
|
Ghostty
|
||||||
|
GitLab CLI agents docs
|
||||||
|
GitLab docs
|
||||||
|
GitLab User Settings > Access Tokens
|
||||||
|
Granular Rules (Object Syntax)
|
||||||
|
Grep by Vercel
|
||||||
|
Groq console
|
||||||
|
Gruvbox
|
||||||
|
Helicone
|
||||||
|
Helicone documentation
|
||||||
|
Helicone Header Directory
|
||||||
|
Helicone's Model Directory
|
||||||
|
Hugging Face Inference Providers
|
||||||
|
Hugging Face settings
|
||||||
|
install WSL
|
||||||
|
IO.NET console
|
||||||
|
JetBrains IDE
|
||||||
|
Kanagawa
|
||||||
|
Kitty
|
||||||
|
MiniMax API Console
|
||||||
|
Models.dev
|
||||||
|
Moonshot AI console
|
||||||
|
Nebius Token Factory console
|
||||||
|
Nord
|
||||||
|
OAuth
|
||||||
|
Ollama integration docs
|
||||||
|
OpenAI's Data Policies
|
||||||
|
OpenChamber
|
||||||
|
OpenCode
|
||||||
|
OpenCode config
|
||||||
|
OpenCode Config
|
||||||
|
OpenCode TUI with the opencode theme
|
||||||
|
OpenCode Web - Active Session
|
||||||
|
OpenCode Web - New Session
|
||||||
|
OpenCode Web - See Servers
|
||||||
|
OpenCode Zen
|
||||||
|
OpenCode-Obsidian
|
||||||
|
OpenRouter dashboard
|
||||||
|
OpenWork
|
||||||
|
OVHcloud panel
|
||||||
|
Pro+ subscription
|
||||||
|
SAP BTP Cockpit
|
||||||
|
Scaleway Console IAM settings
|
||||||
|
Scaleway Generative APIs
|
||||||
|
SDK documentation
|
||||||
|
Sentry MCP server
|
||||||
|
shell API
|
||||||
|
Together AI console
|
||||||
|
Tokyonight
|
||||||
|
Unified Billing
|
||||||
|
Venice AI console
|
||||||
|
Vercel dashboard
|
||||||
|
WezTerm
|
||||||
|
Windows Subsystem for Linux (WSL)
|
||||||
|
WSL
|
||||||
|
WSL (Windows Subsystem for Linux)
|
||||||
|
WSL extension
|
||||||
|
xAI console
|
||||||
|
Z.AI API console
|
||||||
|
Zed
|
||||||
|
ZenMux dashboard
|
||||||
|
Zod
|
||||||
|
```
|
||||||
|
|
||||||
|
## Acronyms and initialisms
|
||||||
|
|
||||||
|
```text
|
||||||
|
ACP
|
||||||
|
AGENTS
|
||||||
|
AI
|
||||||
|
AI21
|
||||||
|
ANSI
|
||||||
|
API
|
||||||
|
AST
|
||||||
|
AWS
|
||||||
|
BTP
|
||||||
|
CD
|
||||||
|
CDN
|
||||||
|
CI
|
||||||
|
CLI
|
||||||
|
CMD
|
||||||
|
CORS
|
||||||
|
DEBUG
|
||||||
|
EKS
|
||||||
|
ERROR
|
||||||
|
FAQ
|
||||||
|
GLM
|
||||||
|
GNOME
|
||||||
|
GPT
|
||||||
|
HTML
|
||||||
|
HTTP
|
||||||
|
HTTPS
|
||||||
|
IAM
|
||||||
|
ID
|
||||||
|
IDE
|
||||||
|
INFO
|
||||||
|
IO
|
||||||
|
IP
|
||||||
|
IRSA
|
||||||
|
JS
|
||||||
|
JSON
|
||||||
|
JSONC
|
||||||
|
K2
|
||||||
|
LLM
|
||||||
|
LM
|
||||||
|
LSP
|
||||||
|
M2
|
||||||
|
MCP
|
||||||
|
MR
|
||||||
|
NET
|
||||||
|
NPM
|
||||||
|
NTLM
|
||||||
|
OIDC
|
||||||
|
OS
|
||||||
|
PAT
|
||||||
|
PATH
|
||||||
|
PHP
|
||||||
|
PR
|
||||||
|
PTY
|
||||||
|
README
|
||||||
|
RFC
|
||||||
|
RPC
|
||||||
|
SAP
|
||||||
|
SDK
|
||||||
|
SKILL
|
||||||
|
SSE
|
||||||
|
SSO
|
||||||
|
TS
|
||||||
|
TTY
|
||||||
|
TUI
|
||||||
|
UI
|
||||||
|
URL
|
||||||
|
US
|
||||||
|
UX
|
||||||
|
VCS
|
||||||
|
VPC
|
||||||
|
VPN
|
||||||
|
VS
|
||||||
|
WARN
|
||||||
|
WSL
|
||||||
|
X11
|
||||||
|
YAML
|
||||||
|
```
|
||||||
|
|
||||||
|
## Code identifiers used in prose (CamelCase, mixedCase)
|
||||||
|
|
||||||
|
```text
|
||||||
|
apiKey
|
||||||
|
AppleScript
|
||||||
|
AssistantMessage
|
||||||
|
baseURL
|
||||||
|
BurntSushi
|
||||||
|
ChatGPT
|
||||||
|
ClangFormat
|
||||||
|
CodeCompanion
|
||||||
|
CodeNomad
|
||||||
|
DeepSeek
|
||||||
|
DefaultV2
|
||||||
|
FileContent
|
||||||
|
FileDiff
|
||||||
|
FileNode
|
||||||
|
fineGrained
|
||||||
|
FormatterStatus
|
||||||
|
GitHub
|
||||||
|
GitLab
|
||||||
|
iTerm2
|
||||||
|
JavaScript
|
||||||
|
JetBrains
|
||||||
|
macOS
|
||||||
|
mDNS
|
||||||
|
MiniMax
|
||||||
|
NeuralNomadsAI
|
||||||
|
NickvanDyke
|
||||||
|
NoeFabris
|
||||||
|
OpenAI
|
||||||
|
OpenAPI
|
||||||
|
OpenChamber
|
||||||
|
OpenCode
|
||||||
|
OpenRouter
|
||||||
|
OpenTUI
|
||||||
|
OpenWork
|
||||||
|
ownUserPermissions
|
||||||
|
PowerShell
|
||||||
|
ProviderAuthAuthorization
|
||||||
|
ProviderAuthMethod
|
||||||
|
ProviderInitError
|
||||||
|
SessionStatus
|
||||||
|
TabItem
|
||||||
|
tokenType
|
||||||
|
ToolIDs
|
||||||
|
ToolList
|
||||||
|
TypeScript
|
||||||
|
typesUrl
|
||||||
|
UserMessage
|
||||||
|
VcsInfo
|
||||||
|
WebView2
|
||||||
|
WezTerm
|
||||||
|
xAI
|
||||||
|
ZenMux
|
||||||
|
```
|
||||||
|
|
||||||
|
## OpenCode CLI commands (as shown in docs)
|
||||||
|
|
||||||
|
```text
|
||||||
|
opencode
|
||||||
|
opencode [project]
|
||||||
|
opencode /path/to/project
|
||||||
|
opencode acp
|
||||||
|
opencode agent [command]
|
||||||
|
opencode agent create
|
||||||
|
opencode agent list
|
||||||
|
opencode attach [url]
|
||||||
|
opencode attach http://10.20.30.40:4096
|
||||||
|
opencode attach http://localhost:4096
|
||||||
|
opencode auth [command]
|
||||||
|
opencode auth list
|
||||||
|
opencode auth login
|
||||||
|
opencode auth logout
|
||||||
|
opencode auth ls
|
||||||
|
opencode export [sessionID]
|
||||||
|
opencode github [command]
|
||||||
|
opencode github install
|
||||||
|
opencode github run
|
||||||
|
opencode import <file>
|
||||||
|
opencode import https://opncd.ai/s/abc123
|
||||||
|
opencode import session.json
|
||||||
|
opencode mcp [command]
|
||||||
|
opencode mcp add
|
||||||
|
opencode mcp auth [name]
|
||||||
|
opencode mcp auth list
|
||||||
|
opencode mcp auth ls
|
||||||
|
opencode mcp auth my-oauth-server
|
||||||
|
opencode mcp auth sentry
|
||||||
|
opencode mcp debug <name>
|
||||||
|
opencode mcp debug my-oauth-server
|
||||||
|
opencode mcp list
|
||||||
|
opencode mcp logout [name]
|
||||||
|
opencode mcp logout my-oauth-server
|
||||||
|
opencode mcp ls
|
||||||
|
opencode models --refresh
|
||||||
|
opencode models [provider]
|
||||||
|
opencode models anthropic
|
||||||
|
opencode run [message..]
|
||||||
|
opencode run Explain the use of context in Go
|
||||||
|
opencode serve
|
||||||
|
opencode serve --cors http://localhost:5173 --cors https://app.example.com
|
||||||
|
opencode serve --hostname 0.0.0.0 --port 4096
|
||||||
|
opencode serve [--port <number>] [--hostname <string>] [--cors <origin>]
|
||||||
|
opencode session [command]
|
||||||
|
opencode session list
|
||||||
|
opencode session delete <sessionID>
|
||||||
|
opencode stats
|
||||||
|
opencode uninstall
|
||||||
|
opencode upgrade
|
||||||
|
opencode upgrade [target]
|
||||||
|
opencode upgrade v0.1.48
|
||||||
|
opencode web
|
||||||
|
opencode web --cors https://example.com
|
||||||
|
opencode web --hostname 0.0.0.0
|
||||||
|
opencode web --mdns
|
||||||
|
opencode web --mdns --mdns-domain myproject.local
|
||||||
|
opencode web --port 4096
|
||||||
|
opencode web --port 4096 --hostname 0.0.0.0
|
||||||
|
opencode.server.close()
|
||||||
|
```
|
||||||
|
|
||||||
|
## Slash commands and routes
|
||||||
|
|
||||||
|
```text
|
||||||
|
/agent
|
||||||
|
/auth/:id
|
||||||
|
/clear
|
||||||
|
/command
|
||||||
|
/config
|
||||||
|
/config/providers
|
||||||
|
/connect
|
||||||
|
/continue
|
||||||
|
/doc
|
||||||
|
/editor
|
||||||
|
/event
|
||||||
|
/experimental/tool?provider=<p>&model=<m>
|
||||||
|
/experimental/tool/ids
|
||||||
|
/export
|
||||||
|
/file?path=<path>
|
||||||
|
/file/content?path=<p>
|
||||||
|
/file/status
|
||||||
|
/find?pattern=<pat>
|
||||||
|
/find/file
|
||||||
|
/find/file?query=<q>
|
||||||
|
/find/symbol?query=<q>
|
||||||
|
/formatter
|
||||||
|
/global/event
|
||||||
|
/global/health
|
||||||
|
/help
|
||||||
|
/init
|
||||||
|
/instance/dispose
|
||||||
|
/log
|
||||||
|
/lsp
|
||||||
|
/mcp
|
||||||
|
/mnt/
|
||||||
|
/mnt/c/
|
||||||
|
/mnt/d/
|
||||||
|
/models
|
||||||
|
/oc
|
||||||
|
/opencode
|
||||||
|
/path
|
||||||
|
/project
|
||||||
|
/project/current
|
||||||
|
/provider
|
||||||
|
/provider/{id}/oauth/authorize
|
||||||
|
/provider/{id}/oauth/callback
|
||||||
|
/provider/auth
|
||||||
|
/q
|
||||||
|
/quit
|
||||||
|
/redo
|
||||||
|
/resume
|
||||||
|
/session
|
||||||
|
/session/:id
|
||||||
|
/session/:id/abort
|
||||||
|
/session/:id/children
|
||||||
|
/session/:id/command
|
||||||
|
/session/:id/diff
|
||||||
|
/session/:id/fork
|
||||||
|
/session/:id/init
|
||||||
|
/session/:id/message
|
||||||
|
/session/:id/message/:messageID
|
||||||
|
/session/:id/permissions/:permissionID
|
||||||
|
/session/:id/prompt_async
|
||||||
|
/session/:id/revert
|
||||||
|
/session/:id/share
|
||||||
|
/session/:id/shell
|
||||||
|
/session/:id/summarize
|
||||||
|
/session/:id/todo
|
||||||
|
/session/:id/unrevert
|
||||||
|
/session/status
|
||||||
|
/share
|
||||||
|
/summarize
|
||||||
|
/theme
|
||||||
|
/tui
|
||||||
|
/tui/append-prompt
|
||||||
|
/tui/clear-prompt
|
||||||
|
/tui/control/next
|
||||||
|
/tui/control/response
|
||||||
|
/tui/execute-command
|
||||||
|
/tui/open-help
|
||||||
|
/tui/open-models
|
||||||
|
/tui/open-sessions
|
||||||
|
/tui/open-themes
|
||||||
|
/tui/show-toast
|
||||||
|
/tui/submit-prompt
|
||||||
|
/undo
|
||||||
|
/Users/username
|
||||||
|
/Users/username/projects/*
|
||||||
|
/vcs
|
||||||
|
```
|
||||||
|
|
||||||
|
## CLI flags and short options
|
||||||
|
|
||||||
|
```text
|
||||||
|
--agent
|
||||||
|
--attach
|
||||||
|
--command
|
||||||
|
--continue
|
||||||
|
--cors
|
||||||
|
--cwd
|
||||||
|
--days
|
||||||
|
--dir
|
||||||
|
--dry-run
|
||||||
|
--event
|
||||||
|
--file
|
||||||
|
--force
|
||||||
|
--fork
|
||||||
|
--format
|
||||||
|
--help
|
||||||
|
--hostname
|
||||||
|
--hostname 0.0.0.0
|
||||||
|
--keep-config
|
||||||
|
--keep-data
|
||||||
|
--log-level
|
||||||
|
--max-count
|
||||||
|
--mdns
|
||||||
|
--mdns-domain
|
||||||
|
--method
|
||||||
|
--model
|
||||||
|
--models
|
||||||
|
--port
|
||||||
|
--print-logs
|
||||||
|
--project
|
||||||
|
--prompt
|
||||||
|
--refresh
|
||||||
|
--session
|
||||||
|
--share
|
||||||
|
--title
|
||||||
|
--token
|
||||||
|
--tools
|
||||||
|
--verbose
|
||||||
|
--version
|
||||||
|
--wait
|
||||||
|
|
||||||
|
-c
|
||||||
|
-d
|
||||||
|
-f
|
||||||
|
-h
|
||||||
|
-m
|
||||||
|
-n
|
||||||
|
-s
|
||||||
|
-v
|
||||||
|
```
|
||||||
|
|
||||||
|
## Environment variables
|
||||||
|
|
||||||
|
```text
|
||||||
|
AI_API_URL
|
||||||
|
AI_FLOW_CONTEXT
|
||||||
|
AI_FLOW_EVENT
|
||||||
|
AI_FLOW_INPUT
|
||||||
|
AICORE_DEPLOYMENT_ID
|
||||||
|
AICORE_RESOURCE_GROUP
|
||||||
|
AICORE_SERVICE_KEY
|
||||||
|
ANTHROPIC_API_KEY
|
||||||
|
AWS_ACCESS_KEY_ID
|
||||||
|
AWS_BEARER_TOKEN_BEDROCK
|
||||||
|
AWS_PROFILE
|
||||||
|
AWS_REGION
|
||||||
|
AWS_ROLE_ARN
|
||||||
|
AWS_SECRET_ACCESS_KEY
|
||||||
|
AWS_WEB_IDENTITY_TOKEN_FILE
|
||||||
|
AZURE_COGNITIVE_SERVICES_RESOURCE_NAME
|
||||||
|
AZURE_RESOURCE_NAME
|
||||||
|
CI_PROJECT_DIR
|
||||||
|
CI_SERVER_FQDN
|
||||||
|
CI_WORKLOAD_REF
|
||||||
|
CLOUDFLARE_ACCOUNT_ID
|
||||||
|
CLOUDFLARE_API_TOKEN
|
||||||
|
CLOUDFLARE_GATEWAY_ID
|
||||||
|
CONTEXT7_API_KEY
|
||||||
|
GITHUB_TOKEN
|
||||||
|
GITLAB_AI_GATEWAY_URL
|
||||||
|
GITLAB_HOST
|
||||||
|
GITLAB_INSTANCE_URL
|
||||||
|
GITLAB_OAUTH_CLIENT_ID
|
||||||
|
GITLAB_TOKEN
|
||||||
|
GITLAB_TOKEN_OPENCODE
|
||||||
|
GOOGLE_APPLICATION_CREDENTIALS
|
||||||
|
GOOGLE_CLOUD_PROJECT
|
||||||
|
HTTP_PROXY
|
||||||
|
HTTPS_PROXY
|
||||||
|
K2_
|
||||||
|
MY_API_KEY
|
||||||
|
MY_ENV_VAR
|
||||||
|
MY_MCP_CLIENT_ID
|
||||||
|
MY_MCP_CLIENT_SECRET
|
||||||
|
NO_PROXY
|
||||||
|
NODE_ENV
|
||||||
|
NODE_EXTRA_CA_CERTS
|
||||||
|
NPM_AUTH_TOKEN
|
||||||
|
OC_ALLOW_WAYLAND
|
||||||
|
OPENCODE_API_KEY
|
||||||
|
OPENCODE_AUTH_JSON
|
||||||
|
OPENCODE_AUTO_SHARE
|
||||||
|
OPENCODE_CLIENT
|
||||||
|
OPENCODE_CONFIG
|
||||||
|
OPENCODE_CONFIG_CONTENT
|
||||||
|
OPENCODE_CONFIG_DIR
|
||||||
|
OPENCODE_DISABLE_AUTOCOMPACT
|
||||||
|
OPENCODE_DISABLE_AUTOUPDATE
|
||||||
|
OPENCODE_DISABLE_CLAUDE_CODE
|
||||||
|
OPENCODE_DISABLE_CLAUDE_CODE_PROMPT
|
||||||
|
OPENCODE_DISABLE_CLAUDE_CODE_SKILLS
|
||||||
|
OPENCODE_DISABLE_DEFAULT_PLUGINS
|
||||||
|
OPENCODE_DISABLE_LSP_DOWNLOAD
|
||||||
|
OPENCODE_DISABLE_MODELS_FETCH
|
||||||
|
OPENCODE_DISABLE_PRUNE
|
||||||
|
OPENCODE_DISABLE_TERMINAL_TITLE
|
||||||
|
OPENCODE_ENABLE_EXA
|
||||||
|
OPENCODE_ENABLE_EXPERIMENTAL_MODELS
|
||||||
|
OPENCODE_EXPERIMENTAL
|
||||||
|
OPENCODE_EXPERIMENTAL_BASH_DEFAULT_TIMEOUT_MS
|
||||||
|
OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT
|
||||||
|
OPENCODE_EXPERIMENTAL_DISABLE_FILEWATCHER
|
||||||
|
OPENCODE_EXPERIMENTAL_EXA
|
||||||
|
OPENCODE_EXPERIMENTAL_FILEWATCHER
|
||||||
|
OPENCODE_EXPERIMENTAL_ICON_DISCOVERY
|
||||||
|
OPENCODE_EXPERIMENTAL_LSP_TOOL
|
||||||
|
OPENCODE_EXPERIMENTAL_LSP_TY
|
||||||
|
OPENCODE_EXPERIMENTAL_MARKDOWN
|
||||||
|
OPENCODE_EXPERIMENTAL_OUTPUT_TOKEN_MAX
|
||||||
|
OPENCODE_EXPERIMENTAL_OXFMT
|
||||||
|
OPENCODE_EXPERIMENTAL_PLAN_MODE
|
||||||
|
OPENCODE_ENABLE_QUESTION_TOOL
|
||||||
|
OPENCODE_FAKE_VCS
|
||||||
|
OPENCODE_GIT_BASH_PATH
|
||||||
|
OPENCODE_MODEL
|
||||||
|
OPENCODE_MODELS_URL
|
||||||
|
OPENCODE_PERMISSION
|
||||||
|
OPENCODE_PORT
|
||||||
|
OPENCODE_SERVER_PASSWORD
|
||||||
|
OPENCODE_SERVER_USERNAME
|
||||||
|
PROJECT_ROOT
|
||||||
|
RESOURCE_NAME
|
||||||
|
RUST_LOG
|
||||||
|
VARIABLE_NAME
|
||||||
|
VERTEX_LOCATION
|
||||||
|
XDG_CONFIG_HOME
|
||||||
|
```
|
||||||
|
|
||||||
|
## Package/module identifiers
|
||||||
|
|
||||||
|
```text
|
||||||
|
../../../config.mjs
|
||||||
|
@astrojs/starlight/components
|
||||||
|
@opencode-ai/plugin
|
||||||
|
@opencode-ai/sdk
|
||||||
|
path
|
||||||
|
shescape
|
||||||
|
zod
|
||||||
|
|
||||||
|
@
|
||||||
|
@ai-sdk/anthropic
|
||||||
|
@ai-sdk/cerebras
|
||||||
|
@ai-sdk/google
|
||||||
|
@ai-sdk/openai
|
||||||
|
@ai-sdk/openai-compatible
|
||||||
|
@File#L37-42
|
||||||
|
@modelcontextprotocol/server-everything
|
||||||
|
@opencode
|
||||||
|
```
|
||||||
|
|
||||||
|
## GitHub owner/repo slugs referenced in docs
|
||||||
|
|
||||||
|
```text
|
||||||
|
24601/opencode-zellij-namer
|
||||||
|
angristan/opencode-wakatime
|
||||||
|
anomalyco/opencode
|
||||||
|
apps/opencode-agent
|
||||||
|
athal7/opencode-devcontainers
|
||||||
|
awesome-opencode/awesome-opencode
|
||||||
|
backnotprop/plannotator
|
||||||
|
ben-vargas/ai-sdk-provider-opencode-sdk
|
||||||
|
btriapitsyn/openchamber
|
||||||
|
BurntSushi/ripgrep
|
||||||
|
Cluster444/agentic
|
||||||
|
code-yeongyu/oh-my-opencode
|
||||||
|
darrenhinde/opencode-agents
|
||||||
|
different-ai/opencode-scheduler
|
||||||
|
different-ai/openwork
|
||||||
|
features/copilot
|
||||||
|
folke/tokyonight.nvim
|
||||||
|
franlol/opencode-md-table-formatter
|
||||||
|
ggml-org/llama.cpp
|
||||||
|
ghoulr/opencode-websearch-cited.git
|
||||||
|
H2Shami/opencode-helicone-session
|
||||||
|
hosenur/portal
|
||||||
|
jamesmurdza/daytona
|
||||||
|
jenslys/opencode-gemini-auth
|
||||||
|
JRedeker/opencode-morph-fast-apply
|
||||||
|
JRedeker/opencode-shell-strategy
|
||||||
|
kdcokenny/ocx
|
||||||
|
kdcokenny/opencode-background-agents
|
||||||
|
kdcokenny/opencode-notify
|
||||||
|
kdcokenny/opencode-workspace
|
||||||
|
kdcokenny/opencode-worktree
|
||||||
|
login/device
|
||||||
|
mohak34/opencode-notifier
|
||||||
|
morhetz/gruvbox
|
||||||
|
mtymek/opencode-obsidian
|
||||||
|
NeuralNomadsAI/CodeNomad
|
||||||
|
nick-vi/opencode-type-inject
|
||||||
|
NickvanDyke/opencode.nvim
|
||||||
|
NoeFabris/opencode-antigravity-auth
|
||||||
|
nordtheme/nord
|
||||||
|
numman-ali/opencode-openai-codex-auth
|
||||||
|
olimorris/codecompanion.nvim
|
||||||
|
panta82/opencode-notificator
|
||||||
|
rebelot/kanagawa.nvim
|
||||||
|
remorses/kimaki
|
||||||
|
sainnhe/everforest
|
||||||
|
shekohex/opencode-google-antigravity-auth
|
||||||
|
shekohex/opencode-pty.git
|
||||||
|
spoons-and-mirrors/subtask2
|
||||||
|
sudo-tee/opencode.nvim
|
||||||
|
supermemoryai/opencode-supermemory
|
||||||
|
Tarquinen/opencode-dynamic-context-pruning
|
||||||
|
Th3Whit3Wolf/one-nvim
|
||||||
|
upstash/context7
|
||||||
|
vtemian/micode
|
||||||
|
vtemian/octto
|
||||||
|
yetone/avante.nvim
|
||||||
|
zenobi-us/opencode-plugin-template
|
||||||
|
zenobi-us/opencode-skillful
|
||||||
|
```
|
||||||
|
|
||||||
|
## Paths, filenames, globs, and URLs
|
||||||
|
|
||||||
|
```text
|
||||||
|
./.opencode/themes/*.json
|
||||||
|
./<project-slug>/storage/
|
||||||
|
./config/#custom-directory
|
||||||
|
./global/storage/
|
||||||
|
.agents/skills/*/SKILL.md
|
||||||
|
.agents/skills/<name>/SKILL.md
|
||||||
|
.clang-format
|
||||||
|
.claude
|
||||||
|
.claude/skills
|
||||||
|
.claude/skills/*/SKILL.md
|
||||||
|
.claude/skills/<name>/SKILL.md
|
||||||
|
.env
|
||||||
|
.github/workflows/opencode.yml
|
||||||
|
.gitignore
|
||||||
|
.gitlab-ci.yml
|
||||||
|
.ignore
|
||||||
|
.NET SDK
|
||||||
|
.npmrc
|
||||||
|
.ocamlformat
|
||||||
|
.opencode
|
||||||
|
.opencode/
|
||||||
|
.opencode/agents/
|
||||||
|
.opencode/commands/
|
||||||
|
.opencode/commands/test.md
|
||||||
|
.opencode/modes/
|
||||||
|
.opencode/plans/*.md
|
||||||
|
.opencode/plugins/
|
||||||
|
.opencode/skills/<name>/SKILL.md
|
||||||
|
.opencode/skills/git-release/SKILL.md
|
||||||
|
.opencode/tools/
|
||||||
|
.well-known/opencode
|
||||||
|
{ type: "raw" \| "patch", content: string }
|
||||||
|
{file:path/to/file}
|
||||||
|
**/*.js
|
||||||
|
%USERPROFILE%/intelephense/license.txt
|
||||||
|
%USERPROFILE%\.cache\opencode
|
||||||
|
%USERPROFILE%\.config\opencode\opencode.jsonc
|
||||||
|
%USERPROFILE%\.config\opencode\plugins
|
||||||
|
%USERPROFILE%\.local\share\opencode
|
||||||
|
%USERPROFILE%\.local\share\opencode\log
|
||||||
|
<project-root>/.opencode/themes/*.json
|
||||||
|
<providerId>/<modelId>
|
||||||
|
<your-project>/.opencode/plugins/
|
||||||
|
~
|
||||||
|
~/...
|
||||||
|
~/.agents/skills/*/SKILL.md
|
||||||
|
~/.agents/skills/<name>/SKILL.md
|
||||||
|
~/.aws/credentials
|
||||||
|
~/.bashrc
|
||||||
|
~/.cache/opencode
|
||||||
|
~/.cache/opencode/node_modules/
|
||||||
|
~/.claude/CLAUDE.md
|
||||||
|
~/.claude/skills/
|
||||||
|
~/.claude/skills/*/SKILL.md
|
||||||
|
~/.claude/skills/<name>/SKILL.md
|
||||||
|
~/.config/opencode
|
||||||
|
~/.config/opencode/AGENTS.md
|
||||||
|
~/.config/opencode/agents/
|
||||||
|
~/.config/opencode/commands/
|
||||||
|
~/.config/opencode/modes/
|
||||||
|
~/.config/opencode/opencode.json
|
||||||
|
~/.config/opencode/opencode.jsonc
|
||||||
|
~/.config/opencode/plugins/
|
||||||
|
~/.config/opencode/skills/*/SKILL.md
|
||||||
|
~/.config/opencode/skills/<name>/SKILL.md
|
||||||
|
~/.config/opencode/themes/*.json
|
||||||
|
~/.config/opencode/tools/
|
||||||
|
~/.config/zed/settings.json
|
||||||
|
~/.local/share
|
||||||
|
~/.local/share/opencode/
|
||||||
|
~/.local/share/opencode/auth.json
|
||||||
|
~/.local/share/opencode/log/
|
||||||
|
~/.local/share/opencode/mcp-auth.json
|
||||||
|
~/.local/share/opencode/opencode.jsonc
|
||||||
|
~/.npmrc
|
||||||
|
~/.zshrc
|
||||||
|
~/code/
|
||||||
|
~/Library/Application Support
|
||||||
|
~/projects/*
|
||||||
|
~/projects/personal/
|
||||||
|
${config.github}/blob/dev/packages/sdk/js/src/gen/types.gen.ts
|
||||||
|
$HOME/intelephense/license.txt
|
||||||
|
$HOME/projects/*
|
||||||
|
$XDG_CONFIG_HOME/opencode/themes/*.json
|
||||||
|
agent/
|
||||||
|
agents/
|
||||||
|
build/
|
||||||
|
commands/
|
||||||
|
dist/
|
||||||
|
http://<wsl-ip>:4096
|
||||||
|
http://127.0.0.1:8080/callback
|
||||||
|
http://localhost:<port>
|
||||||
|
http://localhost:4096
|
||||||
|
http://localhost:4096/doc
|
||||||
|
https://app.example.com
|
||||||
|
https://AZURE_COGNITIVE_SERVICES_RESOURCE_NAME.cognitiveservices.azure.com/
|
||||||
|
https://opencode.ai/zen/v1/chat/completions
|
||||||
|
https://opencode.ai/zen/v1/messages
|
||||||
|
https://opencode.ai/zen/v1/models/gemini-3-flash
|
||||||
|
https://opencode.ai/zen/v1/models/gemini-3-pro
|
||||||
|
https://opencode.ai/zen/v1/responses
|
||||||
|
https://RESOURCE_NAME.openai.azure.com/
|
||||||
|
laravel/pint
|
||||||
|
log/
|
||||||
|
model: "anthropic/claude-sonnet-4-5"
|
||||||
|
modes/
|
||||||
|
node_modules/
|
||||||
|
openai/gpt-4.1
|
||||||
|
opencode.ai/config.json
|
||||||
|
opencode/<model-id>
|
||||||
|
opencode/gpt-5.1-codex
|
||||||
|
opencode/gpt-5.2-codex
|
||||||
|
opencode/kimi-k2
|
||||||
|
openrouter/google/gemini-2.5-flash
|
||||||
|
opncd.ai/s/<share-id>
|
||||||
|
packages/*/AGENTS.md
|
||||||
|
plugins/
|
||||||
|
project/
|
||||||
|
provider_id/model_id
|
||||||
|
provider/model
|
||||||
|
provider/model-id
|
||||||
|
rm -rf ~/.cache/opencode
|
||||||
|
skills/
|
||||||
|
skills/*/SKILL.md
|
||||||
|
src/**/*.ts
|
||||||
|
themes/
|
||||||
|
tools/
|
||||||
|
```
|
||||||
|
|
||||||
|
## Keybind strings
|
||||||
|
|
||||||
|
```text
|
||||||
|
alt+b
|
||||||
|
Alt+Ctrl+K
|
||||||
|
alt+d
|
||||||
|
alt+f
|
||||||
|
Cmd+Esc
|
||||||
|
Cmd+Option+K
|
||||||
|
Cmd+Shift+Esc
|
||||||
|
Cmd+Shift+G
|
||||||
|
Cmd+Shift+P
|
||||||
|
ctrl+a
|
||||||
|
ctrl+b
|
||||||
|
ctrl+d
|
||||||
|
ctrl+e
|
||||||
|
Ctrl+Esc
|
||||||
|
ctrl+f
|
||||||
|
ctrl+g
|
||||||
|
ctrl+k
|
||||||
|
Ctrl+Shift+Esc
|
||||||
|
Ctrl+Shift+P
|
||||||
|
ctrl+t
|
||||||
|
ctrl+u
|
||||||
|
ctrl+w
|
||||||
|
ctrl+x
|
||||||
|
DELETE
|
||||||
|
Shift+Enter
|
||||||
|
WIN+R
|
||||||
|
```
|
||||||
|
|
||||||
|
## Model ID strings referenced
|
||||||
|
|
||||||
|
```text
|
||||||
|
{env:OPENCODE_MODEL}
|
||||||
|
anthropic/claude-3-5-sonnet-20241022
|
||||||
|
anthropic/claude-haiku-4-20250514
|
||||||
|
anthropic/claude-haiku-4-5
|
||||||
|
anthropic/claude-sonnet-4-20250514
|
||||||
|
anthropic/claude-sonnet-4-5
|
||||||
|
gitlab/duo-chat-haiku-4-5
|
||||||
|
lmstudio/google/gemma-3n-e4b
|
||||||
|
openai/gpt-4.1
|
||||||
|
openai/gpt-5
|
||||||
|
opencode/gpt-5.1-codex
|
||||||
|
opencode/gpt-5.2-codex
|
||||||
|
opencode/kimi-k2
|
||||||
|
openrouter/google/gemini-2.5-flash
|
||||||
|
```
|
||||||
+112
-15
@@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
mode: primary
|
mode: primary
|
||||||
hidden: true
|
hidden: true
|
||||||
model: opencode/gpt-5.4-nano
|
model: opencode/minimax-m2.5
|
||||||
color: "#44BA81"
|
color: "#44BA81"
|
||||||
tools:
|
tools:
|
||||||
"*": false
|
"*": false
|
||||||
@@ -14,30 +14,127 @@ Use your github-triage tool to triage issues.
|
|||||||
|
|
||||||
This file is the source of truth for ownership/routing rules.
|
This file is the source of truth for ownership/routing rules.
|
||||||
|
|
||||||
Assign issues by choosing the team with the strongest overlap. The github-triage tool will assign a random member from that team.
|
## Labels
|
||||||
|
|
||||||
Do not add labels to issues. Only assign an owner.
|
### windows
|
||||||
|
|
||||||
When calling github-triage, pass one of these team values: tui, desktop_web, core, inference, windows.
|
Use for any issue that mentions Windows (the OS). Be sure they are saying that they are on Windows.
|
||||||
|
|
||||||
## Teams
|
- Use if they mention WSL too
|
||||||
|
|
||||||
### TUI
|
#### perf
|
||||||
|
|
||||||
Terminal UI issues, including rendering, keybindings, scrolling, terminal compatibility, SSH behavior, crashes in the TUI, and low-level TUI performance.
|
Performance-related issues:
|
||||||
|
|
||||||
### Desktop / Web
|
- Slow performance
|
||||||
|
- High RAM usage
|
||||||
|
- High CPU usage
|
||||||
|
|
||||||
Desktop application and browser-based app issues, including `opencode web`, desktop-specific UI behavior, packaging, and web view problems.
|
**Only** add if it's likely a RAM or CPU issue. **Do not** add for LLM slowness.
|
||||||
|
|
||||||
### Core
|
#### desktop
|
||||||
|
|
||||||
Core opencode server and harness issues, including sqlite, snapshots, memory, API behavior, agent context construction, tool execution, provider integrations, model behavior, documentation, and larger architectural features.
|
Desktop app issues:
|
||||||
|
|
||||||
### Inference
|
- `opencode web` command
|
||||||
|
- The desktop app itself
|
||||||
|
|
||||||
OpenCode Zen, OpenCode Go, and billing issues.
|
**Only** add if it's specifically about the Desktop application or `opencode web` view. **Do not** add for terminal, TUI, or general opencode issues.
|
||||||
|
|
||||||
### Windows
|
#### nix
|
||||||
|
|
||||||
Windows-specific issues, including native Windows behavior, WSL interactions, path handling, shell compatibility, and installation or runtime problems that only happen on Windows.
|
**Only** add if the issue explicitly mentions nix.
|
||||||
|
|
||||||
|
If the issue does not mention nix, do not add nix.
|
||||||
|
|
||||||
|
If the issue mentions nix, assign to `rekram1-node`.
|
||||||
|
|
||||||
|
#### zen
|
||||||
|
|
||||||
|
**Only** add if the issue mentions "zen" or "opencode zen" or "opencode black".
|
||||||
|
|
||||||
|
If the issue doesn't have "zen" or "opencode black" in it then don't add zen label
|
||||||
|
|
||||||
|
#### core
|
||||||
|
|
||||||
|
Use for core server issues in `packages/opencode/`, excluding `packages/opencode/src/cli/cmd/tui/`.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
- LSP server behavior
|
||||||
|
- Harness behavior (agent + tools)
|
||||||
|
- Feature requests for server behavior
|
||||||
|
- Agent context construction
|
||||||
|
- API endpoints
|
||||||
|
- Provider integration issues
|
||||||
|
- New, broken, or poor-quality models
|
||||||
|
|
||||||
|
#### acp
|
||||||
|
|
||||||
|
If the issue mentions acp support, assign acp label.
|
||||||
|
|
||||||
|
#### docs
|
||||||
|
|
||||||
|
Add if the issue requests better documentation or docs updates.
|
||||||
|
|
||||||
|
#### opentui
|
||||||
|
|
||||||
|
TUI issues potentially caused by our underlying TUI library:
|
||||||
|
|
||||||
|
- Keybindings not working
|
||||||
|
- Scroll speed issues (too fast/slow/laggy)
|
||||||
|
- Screen flickering
|
||||||
|
- Crashes with opentui in the log
|
||||||
|
|
||||||
|
**Do not** add for general TUI bugs.
|
||||||
|
|
||||||
|
When assigning to people here are the following rules:
|
||||||
|
|
||||||
|
Desktop / Web:
|
||||||
|
Use for desktop-labeled issues only.
|
||||||
|
|
||||||
|
- adamdotdevin
|
||||||
|
- iamdavidhill
|
||||||
|
- Brendonovich
|
||||||
|
- nexxeln
|
||||||
|
|
||||||
|
Zen:
|
||||||
|
ONLY assign if the issue will have the "zen" label.
|
||||||
|
|
||||||
|
- fwang
|
||||||
|
- MrMushrooooom
|
||||||
|
|
||||||
|
TUI (`packages/opencode/src/cli/cmd/tui/...`):
|
||||||
|
|
||||||
|
- thdxr for TUI UX/UI product decisions and interaction flow
|
||||||
|
- kommander for OpenTUI engine issues: rendering artifacts, keybind handling, terminal compatibility, SSH behavior, and low-level perf bottlenecks
|
||||||
|
- rekram1-node for TUI bugs that are not clearly OpenTUI engine issues
|
||||||
|
|
||||||
|
Core (`packages/opencode/...`, excluding TUI subtree):
|
||||||
|
|
||||||
|
- thdxr for sqlite/snapshot/memory bugs and larger architectural core features
|
||||||
|
- jlongster for opencode server + API feature work (tool currently remaps jlongster -> thdxr until assignable)
|
||||||
|
- rekram1-node for harness issues, provider issues, and other bug-squashing
|
||||||
|
|
||||||
|
For core bugs that do not clearly map, either thdxr or rekram1-node is acceptable.
|
||||||
|
|
||||||
|
Docs:
|
||||||
|
|
||||||
|
- R44VC0RP
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
|
||||||
|
- Hona (assign any issue that mentions Windows or is likely Windows-specific)
|
||||||
|
|
||||||
|
Determinism rules:
|
||||||
|
|
||||||
|
- If title + body does not contain "zen", do not add the "zen" label
|
||||||
|
- If "nix" label is added but title + body does not mention nix/nixos, the tool will drop "nix"
|
||||||
|
- If title + body mentions nix/nixos, assign to `rekram1-node`
|
||||||
|
- If "desktop" label is added, the tool will override assignee and randomly pick one Desktop / Web owner
|
||||||
|
|
||||||
|
In all other cases, choose the team/section with the most overlap with the issue and assign a member from that team at random.
|
||||||
|
|
||||||
|
ACP:
|
||||||
|
|
||||||
|
- rekram1-node (assign any acp issues to rekram1-node)
|
||||||
|
|||||||
@@ -18,12 +18,9 @@ Do not use `git log` or author metadata when deciding attribution.
|
|||||||
|
|
||||||
Rules:
|
Rules:
|
||||||
|
|
||||||
- Write the final file with release sections in this order:
|
- Write the final file with sections in this order:
|
||||||
`## Core`, `## TUI`, `## Desktop`, `## SDK`, `## Extensions`
|
`## Core`, `## TUI`, `## Desktop`, `## SDK`, `## Extensions`
|
||||||
- Only include sections that have at least one notable entry
|
- Only include sections that have at least one notable entry
|
||||||
- Within each release section, keep bug fixes grouped under `### Bugfixes`
|
|
||||||
- Keep other notable entries under `### Improvements` when a section has bug fixes too
|
|
||||||
- Omit empty subsections
|
|
||||||
- Keep one bullet per commit you keep
|
- Keep one bullet per commit you keep
|
||||||
- Skip commits that are entirely internal, CI, tests, refactors, or otherwise not user-facing
|
- Skip commits that are entirely internal, CI, tests, refactors, or otherwise not user-facing
|
||||||
- Start each bullet with a capital letter
|
- Start each bullet with a capital letter
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
---
|
|
||||||
description: translate English to other languages
|
|
||||||
model: opencode/claude-opus-4-7
|
|
||||||
---
|
|
||||||
|
|
||||||
run git diff and translate changed english doc and UI copy files to other international languages. Translate all languages in parallel to save time.
|
|
||||||
|
|
||||||
Requirements:
|
|
||||||
|
|
||||||
- Preserve meaning, intent, tone, and formatting (including Markdown/MDX structure).
|
|
||||||
- Preserve all technical terms and artifacts exactly: product/company names, API names, identifiers, code, commands/flags, file paths, URLs, versions, error messages, config keys/values, and anything inside inline code or code blocks.
|
|
||||||
- Also preserve every term listed in the Do-Not-Translate glossary below.
|
|
||||||
- Also apply locale-specific guidance from `.opencode/glossary/<locale>.md` when available (for example, `zh-cn.md`).
|
|
||||||
- Do not modify fenced code blocks.
|
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"provider": {},
|
"provider": {},
|
||||||
"permission": {
|
"permission": {
|
||||||
"edit": {
|
"edit": {
|
||||||
"packages/opencode/migration/*": "ask",
|
"packages/opencode/migration/*": "deny",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"mcp": {},
|
"mcp": {},
|
||||||
|
|||||||
+285
-367
@@ -1,62 +1,35 @@
|
|||||||
/** @jsxImportSource @opentui/solid */
|
/** @jsxImportSource @opentui/solid */
|
||||||
import { useTerminalDimensions, type JSX } from "@opentui/solid"
|
import { useKeyboard, useTerminalDimensions, type JSX } from "@opentui/solid"
|
||||||
import { useBindings, useKeymapSelector } from "@opentui/keymap/solid"
|
import { RGBA, VignetteEffect } from "@opentui/core"
|
||||||
import { RGBA, VignetteEffect, type KeyEvent, type Renderable } from "@opentui/core"
|
import type {
|
||||||
import { createBindingLookup, type BindingConfig } from "@opentui/keymap/extras"
|
TuiKeybindSet,
|
||||||
import type { TuiPlugin, TuiPluginApi, TuiPluginMeta, TuiPluginModule, TuiSlotPlugin } from "@opencode-ai/plugin/tui"
|
TuiPlugin,
|
||||||
|
TuiPluginApi,
|
||||||
|
TuiPluginMeta,
|
||||||
|
TuiPluginModule,
|
||||||
|
TuiSlotPlugin,
|
||||||
|
} from "@opencode-ai/plugin/tui"
|
||||||
|
|
||||||
const tabs = ["overview", "counter", "help"]
|
const tabs = ["overview", "counter", "help"]
|
||||||
const command = {
|
const bind = {
|
||||||
modal: "smoke_modal",
|
modal: "ctrl+shift+m",
|
||||||
screen: "smoke_screen",
|
screen: "ctrl+shift+o",
|
||||||
alert: "smoke_alert",
|
home: "escape,ctrl+h",
|
||||||
confirm: "smoke_confirm",
|
left: "left,h",
|
||||||
prompt: "smoke_prompt",
|
right: "right,l",
|
||||||
select: "smoke_select",
|
up: "up,k",
|
||||||
host: "smoke_host",
|
down: "down,j",
|
||||||
home: "smoke_home",
|
alert: "a",
|
||||||
toast: "smoke_toast",
|
confirm: "c",
|
||||||
dialog_close: "smoke_dialog_close",
|
prompt: "p",
|
||||||
local_push: "smoke_local_push",
|
select: "s",
|
||||||
local_pop: "smoke_local_pop",
|
modal_accept: "enter,return",
|
||||||
screen_home: "smoke_screen_home",
|
modal_close: "escape",
|
||||||
screen_left: "smoke_screen_left",
|
dialog_close: "escape",
|
||||||
screen_right: "smoke_screen_right",
|
local: "x",
|
||||||
screen_up: "smoke_screen_up",
|
local_push: "enter,return",
|
||||||
screen_down: "smoke_screen_down",
|
local_close: "q,backspace",
|
||||||
screen_modal: "smoke_screen_modal",
|
host: "z",
|
||||||
screen_local: "smoke_screen_local",
|
|
||||||
screen_host: "smoke_screen_host",
|
|
||||||
screen_alert: "smoke_screen_alert",
|
|
||||||
screen_confirm: "smoke_screen_confirm",
|
|
||||||
screen_prompt: "smoke_screen_prompt",
|
|
||||||
screen_select: "smoke_screen_select",
|
|
||||||
modal_accept: "smoke_modal_accept",
|
|
||||||
modal_close: "smoke_modal_close",
|
|
||||||
}
|
|
||||||
|
|
||||||
type SmokeBindings = BindingConfig<Renderable, KeyEvent>
|
|
||||||
|
|
||||||
const defaultKeymap = {
|
|
||||||
[command.modal]: "ctrl+shift+m",
|
|
||||||
[command.screen]: "ctrl+shift+o",
|
|
||||||
[command.dialog_close]: "escape",
|
|
||||||
[command.local_push]: "enter,return",
|
|
||||||
[command.local_pop]: "escape,q,backspace",
|
|
||||||
[command.screen_home]: "escape,ctrl+h",
|
|
||||||
[command.screen_left]: "left,h",
|
|
||||||
[command.screen_right]: "right,l",
|
|
||||||
[command.screen_up]: "up,k",
|
|
||||||
[command.screen_down]: "down,j",
|
|
||||||
[command.screen_modal]: "ctrl+shift+m",
|
|
||||||
[command.screen_local]: "x",
|
|
||||||
[command.screen_host]: "z",
|
|
||||||
[command.screen_alert]: "a",
|
|
||||||
[command.screen_confirm]: "c",
|
|
||||||
[command.screen_prompt]: "p",
|
|
||||||
[command.screen_select]: "s",
|
|
||||||
[command.modal_accept]: "enter,return",
|
|
||||||
[command.modal_close]: "escape",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const pick = (value: unknown, fallback: string) => {
|
const pick = (value: unknown, fallback: string) => {
|
||||||
@@ -70,14 +43,16 @@ const num = (value: unknown, fallback: number) => {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
const record = (value: unknown): value is Record<string, unknown> =>
|
const rec = (value: unknown) => {
|
||||||
!!value && typeof value === "object" && !Array.isArray(value)
|
if (!value || typeof value !== "object" || Array.isArray(value)) return
|
||||||
|
return Object.fromEntries(Object.entries(value))
|
||||||
|
}
|
||||||
|
|
||||||
type Cfg = {
|
type Cfg = {
|
||||||
label: string
|
label: string
|
||||||
route: string
|
route: string
|
||||||
vignette: number
|
vignette: number
|
||||||
keybinds: SmokeBindings | undefined
|
keybinds: Record<string, unknown> | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
type Route = {
|
type Route = {
|
||||||
@@ -99,7 +74,7 @@ const cfg = (options: Record<string, unknown> | undefined) => {
|
|||||||
label: pick(options?.label, "smoke"),
|
label: pick(options?.label, "smoke"),
|
||||||
route: pick(options?.route, "workspace-smoke"),
|
route: pick(options?.route, "workspace-smoke"),
|
||||||
vignette: Math.max(0, num(options?.vignette, 0.35)),
|
vignette: Math.max(0, num(options?.vignette, 0.35)),
|
||||||
keybinds: record(options?.keybinds) ? (options.keybinds as SmokeBindings) : undefined,
|
keybinds: rec(options?.keybinds),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,12 +85,7 @@ const names = (input: Cfg) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createKeys(input: SmokeBindings | undefined) {
|
type Keys = TuiKeybindSet
|
||||||
return createBindingLookup({ ...defaultKeymap, ...input })
|
|
||||||
}
|
|
||||||
|
|
||||||
type Keys = ReturnType<typeof createKeys>
|
|
||||||
|
|
||||||
const ui = {
|
const ui = {
|
||||||
panel: "#1d1d1d",
|
panel: "#1d1d1d",
|
||||||
border: "#4a4a4a",
|
border: "#4a4a4a",
|
||||||
@@ -322,174 +292,125 @@ const Screen = (props: {
|
|||||||
}
|
}
|
||||||
const pop = (base?: State) => {
|
const pop = (base?: State) => {
|
||||||
const next = base ?? current(props.api, props.route)
|
const next = base ?? current(props.api, props.route)
|
||||||
set(Math.max(0, next.local - 1), next)
|
const local = Math.max(0, next.local - 1)
|
||||||
|
set(local, next)
|
||||||
}
|
}
|
||||||
const show = () => {
|
const show = () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
open()
|
open()
|
||||||
}, 0)
|
}, 0)
|
||||||
}
|
}
|
||||||
const screenActive = () => props.api.route.current.name === props.route.screen
|
useKeyboard((evt) => {
|
||||||
|
if (props.api.route.current.name !== props.route.screen) return
|
||||||
|
const next = current(props.api, props.route)
|
||||||
|
if (props.api.ui.dialog.open) {
|
||||||
|
if (props.keys.match("dialog_close", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
props.api.ui.dialog.clear()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
useBindings(() => ({
|
if (next.local > 0) {
|
||||||
enabled: () => screenActive() && props.api.ui.dialog.open,
|
if (evt.name === "escape" || props.keys.match("local_close", evt)) {
|
||||||
commands: [
|
evt.preventDefault()
|
||||||
{
|
evt.stopPropagation()
|
||||||
name: command.dialog_close,
|
pop(next)
|
||||||
run() {
|
return
|
||||||
props.api.ui.dialog.clear()
|
}
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
bindings: props.keys.gather("smoke.dialog", [command.dialog_close]),
|
|
||||||
}))
|
|
||||||
|
|
||||||
useBindings(() => ({
|
if (props.keys.match("local_push", evt)) {
|
||||||
enabled: () => screenActive() && !props.api.ui.dialog.open && current(props.api, props.route).local > 0,
|
evt.preventDefault()
|
||||||
commands: [
|
evt.stopPropagation()
|
||||||
{
|
push(next)
|
||||||
name: command.local_push,
|
return
|
||||||
run() {
|
}
|
||||||
push(current(props.api, props.route))
|
return
|
||||||
},
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.local_pop,
|
|
||||||
run() {
|
|
||||||
pop(current(props.api, props.route))
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
bindings: props.keys.gather("smoke.local", [command.local_push, command.local_pop]),
|
|
||||||
}))
|
|
||||||
|
|
||||||
useBindings(() => ({
|
if (props.keys.match("home", evt)) {
|
||||||
enabled: () => screenActive() && !props.api.ui.dialog.open && current(props.api, props.route).local === 0,
|
evt.preventDefault()
|
||||||
commands: [
|
evt.stopPropagation()
|
||||||
{
|
props.api.route.navigate("home")
|
||||||
name: command.screen_home,
|
return
|
||||||
run() {
|
}
|
||||||
props.api.route.navigate("home")
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_left,
|
|
||||||
run() {
|
|
||||||
const next = current(props.api, props.route)
|
|
||||||
props.api.route.navigate(props.route.screen, { ...next, tab: (next.tab - 1 + tabs.length) % tabs.length })
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_right,
|
|
||||||
run() {
|
|
||||||
const next = current(props.api, props.route)
|
|
||||||
props.api.route.navigate(props.route.screen, { ...next, tab: (next.tab + 1) % tabs.length })
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_up,
|
|
||||||
run() {
|
|
||||||
const next = current(props.api, props.route)
|
|
||||||
props.api.route.navigate(props.route.screen, { ...next, count: next.count + 1 })
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_down,
|
|
||||||
run() {
|
|
||||||
const next = current(props.api, props.route)
|
|
||||||
props.api.route.navigate(props.route.screen, { ...next, count: next.count - 1 })
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_modal,
|
|
||||||
run() {
|
|
||||||
props.api.route.navigate(props.route.modal, current(props.api, props.route))
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_local,
|
|
||||||
run() {
|
|
||||||
open()
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_host,
|
|
||||||
run() {
|
|
||||||
host(props.api, props.input, skin)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_alert,
|
|
||||||
run() {
|
|
||||||
warn(props.api, props.route, current(props.api, props.route))
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_confirm,
|
|
||||||
run() {
|
|
||||||
check(props.api, props.route, current(props.api, props.route))
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_prompt,
|
|
||||||
run() {
|
|
||||||
entry(props.api, props.route, current(props.api, props.route))
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.screen_select,
|
|
||||||
run() {
|
|
||||||
picker(props.api, props.route, current(props.api, props.route))
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
bindings: props.keys.gather("smoke.screen", [
|
|
||||||
command.screen_home,
|
|
||||||
command.screen_left,
|
|
||||||
command.screen_right,
|
|
||||||
command.screen_up,
|
|
||||||
command.screen_down,
|
|
||||||
command.screen_modal,
|
|
||||||
command.screen_local,
|
|
||||||
command.screen_host,
|
|
||||||
command.screen_alert,
|
|
||||||
command.screen_confirm,
|
|
||||||
command.screen_prompt,
|
|
||||||
command.screen_select,
|
|
||||||
]),
|
|
||||||
}))
|
|
||||||
const shortcuts = useKeymapSelector((keymap) => {
|
|
||||||
const bindings = keymap.getCommandBindings({
|
|
||||||
visibility: "registered",
|
|
||||||
commands: [
|
|
||||||
command.screen_home,
|
|
||||||
command.screen_up,
|
|
||||||
command.screen_down,
|
|
||||||
command.screen_modal,
|
|
||||||
command.screen_alert,
|
|
||||||
command.screen_confirm,
|
|
||||||
command.screen_prompt,
|
|
||||||
command.screen_select,
|
|
||||||
command.screen_local,
|
|
||||||
command.screen_host,
|
|
||||||
command.local_push,
|
|
||||||
command.local_pop,
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
if (props.keys.match("left", evt)) {
|
||||||
screen_home: props.api.keys.formatBindings(bindings.get(command.screen_home)) ?? "",
|
evt.preventDefault()
|
||||||
screen_up: props.api.keys.formatBindings(bindings.get(command.screen_up)) ?? "",
|
evt.stopPropagation()
|
||||||
screen_down: props.api.keys.formatBindings(bindings.get(command.screen_down)) ?? "",
|
props.api.route.navigate(props.route.screen, { ...next, tab: (next.tab - 1 + tabs.length) % tabs.length })
|
||||||
screen_modal: props.api.keys.formatBindings(bindings.get(command.screen_modal)) ?? "",
|
return
|
||||||
screen_alert: props.api.keys.formatBindings(bindings.get(command.screen_alert)) ?? "",
|
}
|
||||||
screen_confirm: props.api.keys.formatBindings(bindings.get(command.screen_confirm)) ?? "",
|
|
||||||
screen_prompt: props.api.keys.formatBindings(bindings.get(command.screen_prompt)) ?? "",
|
if (props.keys.match("right", evt)) {
|
||||||
screen_select: props.api.keys.formatBindings(bindings.get(command.screen_select)) ?? "",
|
evt.preventDefault()
|
||||||
screen_local: props.api.keys.formatBindings(bindings.get(command.screen_local)) ?? "",
|
evt.stopPropagation()
|
||||||
screen_host: props.api.keys.formatBindings(bindings.get(command.screen_host)) ?? "",
|
props.api.route.navigate(props.route.screen, { ...next, tab: (next.tab + 1) % tabs.length })
|
||||||
local_push: props.api.keys.formatBindings(bindings.get(command.local_push)) ?? "",
|
return
|
||||||
local_pop: props.api.keys.formatBindings(bindings.get(command.local_pop)) ?? "",
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("up", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
props.api.route.navigate(props.route.screen, { ...next, count: next.count + 1 })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("down", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
props.api.route.navigate(props.route.screen, { ...next, count: next.count - 1 })
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("modal", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
props.api.route.navigate(props.route.modal, next)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("local", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
open()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("host", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
host(props.api, props.input, skin)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("alert", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
warn(props.api, props.route, next)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("confirm", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
check(props.api, props.route, next)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("prompt", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
entry(props.api, props.route, next)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("select", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
picker(props.api, props.route, next)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -509,7 +430,7 @@ const Screen = (props: {
|
|||||||
<b>{props.input.label} screen</b>
|
<b>{props.input.label} screen</b>
|
||||||
<span style={{ fg: skin.muted }}> plugin route</span>
|
<span style={{ fg: skin.muted }}> plugin route</span>
|
||||||
</text>
|
</text>
|
||||||
<text fg={skin.muted}>{shortcuts().screen_home} home</text>
|
<text fg={skin.muted}>{props.keys.print("home")} home</text>
|
||||||
</box>
|
</box>
|
||||||
|
|
||||||
<box flexDirection="row" gap={1} paddingBottom={1}>
|
<box flexDirection="row" gap={1} paddingBottom={1}>
|
||||||
@@ -556,7 +477,7 @@ const Screen = (props: {
|
|||||||
<box flexDirection="column" gap={1}>
|
<box flexDirection="column" gap={1}>
|
||||||
<text fg={skin.text}>Counter: {value.count}</text>
|
<text fg={skin.text}>Counter: {value.count}</text>
|
||||||
<text fg={skin.muted}>
|
<text fg={skin.muted}>
|
||||||
{shortcuts().screen_up} / {shortcuts().screen_down} change value
|
{props.keys.print("up")} / {props.keys.print("down")} change value
|
||||||
</text>
|
</text>
|
||||||
</box>
|
</box>
|
||||||
) : null}
|
) : null}
|
||||||
@@ -564,16 +485,17 @@ const Screen = (props: {
|
|||||||
{value.tab === 2 ? (
|
{value.tab === 2 ? (
|
||||||
<box flexDirection="column" gap={1}>
|
<box flexDirection="column" gap={1}>
|
||||||
<text fg={skin.muted}>
|
<text fg={skin.muted}>
|
||||||
{shortcuts().screen_modal} modal | {shortcuts().screen_alert} alert | {shortcuts().screen_confirm}{" "}
|
{props.keys.print("modal")} modal | {props.keys.print("alert")} alert | {props.keys.print("confirm")}{" "}
|
||||||
confirm | {shortcuts().screen_prompt} prompt | {shortcuts().screen_select} select
|
confirm | {props.keys.print("prompt")} prompt | {props.keys.print("select")} select
|
||||||
</text>
|
</text>
|
||||||
<text fg={skin.muted}>
|
<text fg={skin.muted}>
|
||||||
{shortcuts().screen_local} local stack | {shortcuts().screen_host} host stack
|
{props.keys.print("local")} local stack | {props.keys.print("host")} host stack
|
||||||
</text>
|
</text>
|
||||||
<text fg={skin.muted}>
|
<text fg={skin.muted}>
|
||||||
local open: {shortcuts().local_push} push nested · {shortcuts().local_pop} close
|
local open: {props.keys.print("local_push")} push nested · esc or {props.keys.print("local_close")}{" "}
|
||||||
|
close
|
||||||
</text>
|
</text>
|
||||||
<text fg={skin.muted}>{shortcuts().screen_home} returns home</text>
|
<text fg={skin.muted}>{props.keys.print("home")} returns home</text>
|
||||||
</box>
|
</box>
|
||||||
) : null}
|
) : null}
|
||||||
</box>
|
</box>
|
||||||
@@ -626,7 +548,7 @@ const Screen = (props: {
|
|||||||
</text>
|
</text>
|
||||||
<text fg={skin.muted}>Plugin-owned stack depth: {value.local}</text>
|
<text fg={skin.muted}>Plugin-owned stack depth: {value.local}</text>
|
||||||
<text fg={skin.muted}>
|
<text fg={skin.muted}>
|
||||||
{shortcuts().local_push} push nested · {shortcuts().local_pop} pop/close
|
{props.keys.print("local_push")} push nested · {props.keys.print("local_close")} pop/close
|
||||||
</text>
|
</text>
|
||||||
<box flexDirection="row" gap={1}>
|
<box flexDirection="row" gap={1}>
|
||||||
<Btn txt="push" run={push} skin={skin} on />
|
<Btn txt="push" run={push} skin={skin} on />
|
||||||
@@ -649,35 +571,20 @@ const Modal = (props: {
|
|||||||
const value = parse(props.params)
|
const value = parse(props.params)
|
||||||
const skin = tone(props.api)
|
const skin = tone(props.api)
|
||||||
|
|
||||||
useBindings(() => ({
|
useKeyboard((evt) => {
|
||||||
enabled: () => props.api.route.current.name === props.route.modal,
|
if (props.api.route.current.name !== props.route.modal) return
|
||||||
commands: [
|
|
||||||
{
|
|
||||||
name: command.modal_accept,
|
|
||||||
run() {
|
|
||||||
props.api.route.navigate(props.route.screen, { ...parse(props.params), source: "modal" })
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: command.modal_close,
|
|
||||||
run() {
|
|
||||||
props.api.route.navigate("home")
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
bindings: props.keys.gather("smoke.modal", [command.modal_accept, command.modal_close]),
|
|
||||||
}))
|
|
||||||
const shortcuts = useKeymapSelector((keymap) => {
|
|
||||||
const bindings = keymap.getCommandBindings({
|
|
||||||
visibility: "registered",
|
|
||||||
commands: [command.modal, command.screen, command.modal_accept, command.modal_close],
|
|
||||||
})
|
|
||||||
|
|
||||||
return {
|
if (props.keys.match("modal_accept", evt)) {
|
||||||
modal: props.api.keys.formatBindings(bindings.get(command.modal)) ?? "",
|
evt.preventDefault()
|
||||||
screen: props.api.keys.formatBindings(bindings.get(command.screen)) ?? "",
|
evt.stopPropagation()
|
||||||
modal_accept: props.api.keys.formatBindings(bindings.get(command.modal_accept)) ?? "",
|
props.api.route.navigate(props.route.screen, { ...value, source: "modal" })
|
||||||
modal_close: props.api.keys.formatBindings(bindings.get(command.modal_close)) ?? "",
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (props.keys.match("modal_close", evt)) {
|
||||||
|
evt.preventDefault()
|
||||||
|
evt.stopPropagation()
|
||||||
|
props.api.route.navigate("home")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -688,10 +595,10 @@ const Modal = (props: {
|
|||||||
<text fg={skin.text}>
|
<text fg={skin.text}>
|
||||||
<b>{props.input.label} modal</b>
|
<b>{props.input.label} modal</b>
|
||||||
</text>
|
</text>
|
||||||
<text fg={skin.muted}>{shortcuts().modal} modal command</text>
|
<text fg={skin.muted}>{props.keys.print("modal")} modal command</text>
|
||||||
<text fg={skin.muted}>{shortcuts().screen} screen command</text>
|
<text fg={skin.muted}>{props.keys.print("screen")} screen command</text>
|
||||||
<text fg={skin.muted}>
|
<text fg={skin.muted}>
|
||||||
{shortcuts().modal_accept} opens screen · {shortcuts().modal_close} closes
|
{props.keys.print("modal_accept")} opens screen · {props.keys.print("modal_close")} closes
|
||||||
</text>
|
</text>
|
||||||
<box flexDirection="row" gap={1}>
|
<box flexDirection="row" gap={1}>
|
||||||
<Btn
|
<Btn
|
||||||
@@ -744,8 +651,25 @@ const home = (api: TuiPluginApi, input: Cfg) => ({
|
|||||||
},
|
},
|
||||||
home_prompt(ctx, value) {
|
home_prompt(ctx, value) {
|
||||||
const skin = look(ctx.theme.current)
|
const skin = look(ctx.theme.current)
|
||||||
const Prompt = api.ui.Prompt
|
type Prompt = (props: {
|
||||||
const Slot = api.ui.Slot
|
workspaceID?: string
|
||||||
|
visible?: boolean
|
||||||
|
disabled?: boolean
|
||||||
|
onSubmit?: () => void
|
||||||
|
hint?: JSX.Element
|
||||||
|
right?: JSX.Element
|
||||||
|
showPlaceholder?: boolean
|
||||||
|
placeholders?: {
|
||||||
|
normal?: string[]
|
||||||
|
shell?: string[]
|
||||||
|
}
|
||||||
|
}) => JSX.Element
|
||||||
|
type Slot = (
|
||||||
|
props: { name: string; mode?: unknown; children?: JSX.Element } & Record<string, unknown>,
|
||||||
|
) => JSX.Element | null
|
||||||
|
const ui = api.ui as TuiPluginApi["ui"] & { Prompt: Prompt; Slot: Slot }
|
||||||
|
const Prompt = ui.Prompt
|
||||||
|
const Slot = ui.Slot
|
||||||
const normal = [
|
const normal = [
|
||||||
`[SMOKE] route check for ${input.label}`,
|
`[SMOKE] route check for ${input.label}`,
|
||||||
"[SMOKE] confirm home_prompt slot override",
|
"[SMOKE] confirm home_prompt slot override",
|
||||||
@@ -867,115 +791,109 @@ const slot = (api: TuiPluginApi, input: Cfg): TuiSlotPlugin[] => [
|
|||||||
|
|
||||||
const reg = (api: TuiPluginApi, input: Cfg, keys: Keys) => {
|
const reg = (api: TuiPluginApi, input: Cfg, keys: Keys) => {
|
||||||
const route = names(input)
|
const route = names(input)
|
||||||
api.keymap.registerLayer({
|
api.command.register(() => [
|
||||||
commands: [
|
{
|
||||||
{
|
title: `${input.label} modal`,
|
||||||
name: command.modal,
|
value: "plugin.smoke.modal",
|
||||||
title: `${input.label} modal`,
|
keybind: keys.get("modal"),
|
||||||
category: "Plugin",
|
category: "Plugin",
|
||||||
namespace: "palette",
|
slash: {
|
||||||
slashName: "smoke",
|
name: "smoke",
|
||||||
run() {
|
|
||||||
api.route.navigate(route.modal, { source: "command" })
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
onSelect: () => {
|
||||||
name: command.screen,
|
api.route.navigate(route.modal, { source: "command" })
|
||||||
title: `${input.label} screen`,
|
|
||||||
category: "Plugin",
|
|
||||||
namespace: "palette",
|
|
||||||
slashName: "smoke-screen",
|
|
||||||
run() {
|
|
||||||
api.route.navigate(route.screen, { source: "command", tab: 0, count: 0 })
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
name: command.alert,
|
{
|
||||||
title: `${input.label} alert dialog`,
|
title: `${input.label} screen`,
|
||||||
category: "Plugin",
|
value: "plugin.smoke.screen",
|
||||||
namespace: "palette",
|
keybind: keys.get("screen"),
|
||||||
slashName: "smoke-alert",
|
category: "Plugin",
|
||||||
run() {
|
slash: {
|
||||||
warn(api, route, current(api, route))
|
name: "smoke-screen",
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
onSelect: () => {
|
||||||
name: command.confirm,
|
api.route.navigate(route.screen, { source: "command", tab: 0, count: 0 })
|
||||||
title: `${input.label} confirm dialog`,
|
|
||||||
category: "Plugin",
|
|
||||||
namespace: "palette",
|
|
||||||
slashName: "smoke-confirm",
|
|
||||||
run() {
|
|
||||||
check(api, route, current(api, route))
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
name: command.prompt,
|
{
|
||||||
title: `${input.label} prompt dialog`,
|
title: `${input.label} alert dialog`,
|
||||||
category: "Plugin",
|
value: "plugin.smoke.alert",
|
||||||
namespace: "palette",
|
category: "Plugin",
|
||||||
slashName: "smoke-prompt",
|
slash: {
|
||||||
run() {
|
name: "smoke-alert",
|
||||||
entry(api, route, current(api, route))
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
onSelect: () => {
|
||||||
name: command.select,
|
warn(api, route, current(api, route))
|
||||||
title: `${input.label} select dialog`,
|
|
||||||
category: "Plugin",
|
|
||||||
namespace: "palette",
|
|
||||||
slashName: "smoke-select",
|
|
||||||
run() {
|
|
||||||
picker(api, route, current(api, route))
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
name: command.host,
|
{
|
||||||
title: `${input.label} host overlay`,
|
title: `${input.label} confirm dialog`,
|
||||||
category: "Plugin",
|
value: "plugin.smoke.confirm",
|
||||||
namespace: "palette",
|
category: "Plugin",
|
||||||
slashName: "smoke-host",
|
slash: {
|
||||||
run() {
|
name: "smoke-confirm",
|
||||||
host(api, input, tone(api))
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
onSelect: () => {
|
||||||
name: command.home,
|
check(api, route, current(api, route))
|
||||||
title: `${input.label} go home`,
|
|
||||||
category: "Plugin",
|
|
||||||
namespace: "palette",
|
|
||||||
enabled: () => api.route.current.name !== "home",
|
|
||||||
run() {
|
|
||||||
api.route.navigate("home")
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
name: command.toast,
|
{
|
||||||
title: `${input.label} toast`,
|
title: `${input.label} prompt dialog`,
|
||||||
category: "Plugin",
|
value: "plugin.smoke.prompt",
|
||||||
namespace: "palette",
|
category: "Plugin",
|
||||||
run() {
|
slash: {
|
||||||
api.ui.toast({
|
name: "smoke-prompt",
|
||||||
variant: "info",
|
|
||||||
title: "Smoke",
|
|
||||||
message: "Plugin toast works",
|
|
||||||
duration: 2000,
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
],
|
onSelect: () => {
|
||||||
bindings: keys.gather("smoke.global", [
|
entry(api, route, current(api, route))
|
||||||
command.modal,
|
},
|
||||||
command.screen,
|
},
|
||||||
command.alert,
|
{
|
||||||
command.confirm,
|
title: `${input.label} select dialog`,
|
||||||
command.prompt,
|
value: "plugin.smoke.select",
|
||||||
command.select,
|
category: "Plugin",
|
||||||
command.host,
|
slash: {
|
||||||
command.home,
|
name: "smoke-select",
|
||||||
command.toast,
|
},
|
||||||
]),
|
onSelect: () => {
|
||||||
})
|
picker(api, route, current(api, route))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: `${input.label} host overlay`,
|
||||||
|
value: "plugin.smoke.host",
|
||||||
|
category: "Plugin",
|
||||||
|
slash: {
|
||||||
|
name: "smoke-host",
|
||||||
|
},
|
||||||
|
onSelect: () => {
|
||||||
|
host(api, input, tone(api))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: `${input.label} go home`,
|
||||||
|
value: "plugin.smoke.home",
|
||||||
|
category: "Plugin",
|
||||||
|
enabled: api.route.current.name !== "home",
|
||||||
|
onSelect: () => {
|
||||||
|
api.route.navigate("home")
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: `${input.label} toast`,
|
||||||
|
value: "plugin.smoke.toast",
|
||||||
|
category: "Plugin",
|
||||||
|
onSelect: () => {
|
||||||
|
api.ui.toast({
|
||||||
|
variant: "info",
|
||||||
|
title: "Smoke",
|
||||||
|
message: "Plugin toast works",
|
||||||
|
duration: 2000,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
const tui: TuiPlugin = async (api, options, meta) => {
|
const tui: TuiPlugin = async (api, options, meta) => {
|
||||||
@@ -984,9 +902,9 @@ const tui: TuiPlugin = async (api, options, meta) => {
|
|||||||
await api.theme.install("./smoke-theme.json")
|
await api.theme.install("./smoke-theme.json")
|
||||||
api.theme.set("smoke-theme")
|
api.theme.set("smoke-theme")
|
||||||
|
|
||||||
const value = cfg(options)
|
const value = cfg(options ?? undefined)
|
||||||
const route = names(value)
|
const route = names(value)
|
||||||
const keys = createKeys(value.keybinds)
|
const keys = api.keybind.create(bind, value.keybinds)
|
||||||
const fx = new VignetteEffect(value.vignette)
|
const fx = new VignetteEffect(value.vignette)
|
||||||
const post = fx.apply.bind(fx)
|
const post = fx.apply.bind(fx)
|
||||||
api.renderer.addPostProcessFn(post)
|
api.renderer.addPostProcessFn(post)
|
||||||
|
|||||||
@@ -1,38 +1,21 @@
|
|||||||
---
|
---
|
||||||
name: effect
|
name: effect
|
||||||
description: Work with Effect v4 / effect-smol TypeScript code in this repo
|
description: Answer questions about the Effect framework
|
||||||
---
|
---
|
||||||
|
|
||||||
# Effect
|
# Effect
|
||||||
|
|
||||||
This codebase uses Effect for typed, composable TypeScript services, schemas, and workflows.
|
This codebase uses Effect, a framework for writing typescript.
|
||||||
|
|
||||||
## Source Of Truth
|
## How to Answer Effect Questions
|
||||||
|
|
||||||
Use the current Effect v4 / effect-smol source, not memory or older Effect v2/v3 examples.
|
1. Clone the Effect repository: `https://github.com/Effect-TS/effect-smol` to
|
||||||
|
`.opencode/references/effect-smol` in this project NOT the skill folder.
|
||||||
1. If `.opencode/references/effect-smol` is missing, clone `https://github.com/Effect-TS/effect-smol` there. Do this in the project, not in the skill folder.
|
2. Use the explore agent to search the codebase for answers about Effect patterns, APIs, and concepts
|
||||||
2. Search `.opencode/references/effect-smol` for exact APIs, examples, tests, and naming patterns before answering or implementing Effect-specific code.
|
3. Provide responses based on the actual Effect source code and documentation
|
||||||
3. Also inspect existing repo code for local house style before introducing new patterns.
|
|
||||||
4. Prefer answers and implementations backed by specific source files or nearby repo examples.
|
|
||||||
|
|
||||||
## Guidelines
|
## Guidelines
|
||||||
|
|
||||||
- Prefer current Effect v4 APIs and project-local patterns over old blog posts, examples, or package-memory guesses.
|
- Always use the explore agent with the cloned repository when answering Effect-related questions
|
||||||
- Use `Effect.gen(function* () { ... })` for multi-step workflows.
|
- Reference specific files and patterns found in the Effect codebase
|
||||||
- Use `Effect.fn("Name")` or `Effect.fnUntraced(...)` for named effects when adding reusable service methods or important workflows.
|
- Do not answer from memory - always verify against the source
|
||||||
- Prefer Effect `Schema` for API and domain data shapes. Use branded schemas for IDs and `Schema.TaggedErrorClass` for typed domain errors when modeling new error surfaces.
|
|
||||||
- Keep HTTP handlers thin: decode input, read request context, call services, and map transport errors. Put business rules in services.
|
|
||||||
- In Effect service code, prefer Effect-aware platform abstractions and dependencies over ad hoc promises where the surrounding code already does so.
|
|
||||||
- Keep layer composition explicit. Avoid broad hidden provisioning that makes missing dependencies hard to see.
|
|
||||||
- In tests, prefer the repo's existing Effect test helpers and live tests for filesystem, git, child process, locks, or timing behavior.
|
|
||||||
- Do not introduce `any`, non-null assertions, unchecked casts, or older Effect APIs just to satisfy types.
|
|
||||||
- Do not answer from memory. Verify against `.opencode/references/effect-smol` or nearby code first.
|
|
||||||
|
|
||||||
## Testing Patterns
|
|
||||||
|
|
||||||
- Use `testEffect(...)` from `packages/opencode/test/lib/effect.ts` for tests that exercise Effect services, layers, runtime context, scoped resources, or platform integrations.
|
|
||||||
- Use `it.live(...)` for filesystem, git repositories, HTTP servers, sockets, child processes, locks, real time, and other live platform behavior.
|
|
||||||
- Run tests from package directories such as `packages/opencode`; never run package tests from the repo root.
|
|
||||||
- Prefer explicit test layers over ad hoc managed runtimes. Keep dependency provisioning visible in the test file.
|
|
||||||
- Use scoped fixtures and finalizers for resources that must be cleaned up, including temporary directories, flags, databases, fibers, servers, and global state.
|
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
/// <reference path="../env.d.ts" />
|
/// <reference path="../env.d.ts" />
|
||||||
import { tool } from "@opencode-ai/plugin"
|
import { tool } from "@opencode-ai/plugin"
|
||||||
|
|
||||||
const TEAM = {
|
const TEAM = {
|
||||||
tui: ["kommander", "simonklee"],
|
desktop: ["adamdotdevin", "iamdavidhill", "Brendonovich", "nexxeln"],
|
||||||
desktop_web: ["Hona", "Brendonovich"],
|
zen: ["fwang", "MrMushrooooom"],
|
||||||
core: ["jlongster", "rekram1-node", "nexxeln", "kitlangton"],
|
tui: ["thdxr", "kommander", "rekram1-node"],
|
||||||
inference: ["fwang", "MrMushrooooom"],
|
core: ["thdxr", "rekram1-node", "jlongster"],
|
||||||
|
docs: ["R44VC0RP"],
|
||||||
windows: ["Hona"],
|
windows: ["Hona"],
|
||||||
} as const
|
} as const
|
||||||
|
|
||||||
|
const ASSIGNEES = [...new Set(Object.values(TEAM).flat())]
|
||||||
|
|
||||||
function pick<T>(items: readonly T[]) {
|
function pick<T>(items: readonly T[]) {
|
||||||
return items[Math.floor(Math.random() * items.length)]!
|
return items[Math.floor(Math.random() * items.length)]!
|
||||||
}
|
}
|
||||||
@@ -36,25 +38,79 @@ async function githubFetch(endpoint: string, options: RequestInit = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default tool({
|
export default tool({
|
||||||
description: `Use this tool to assign a GitHub issue.
|
description: `Use this tool to assign and/or label a GitHub issue.
|
||||||
|
|
||||||
Provide the team that should own the issue. This tool picks a random assignee from that team and does not apply labels.`,
|
Choose labels and assignee using the current triage policy and ownership rules.
|
||||||
|
Pick the most fitting labels for the issue and assign one owner.
|
||||||
|
|
||||||
|
If unsure, choose the team/section with the most overlap with the issue and assign a member from that team at random.`,
|
||||||
args: {
|
args: {
|
||||||
team: tool.schema
|
assignee: tool.schema
|
||||||
.enum(Object.keys(TEAM) as [keyof typeof TEAM, ...(keyof typeof TEAM)[]])
|
.enum(ASSIGNEES as [string, ...string[]])
|
||||||
.describe("The owning team"),
|
.describe("The username of the assignee")
|
||||||
|
.default("rekram1-node"),
|
||||||
|
labels: tool.schema
|
||||||
|
.array(tool.schema.enum(["nix", "opentui", "perf", "web", "desktop", "zen", "docs", "windows", "core"]))
|
||||||
|
.describe("The labels(s) to add to the issue")
|
||||||
|
.default([]),
|
||||||
},
|
},
|
||||||
async execute(args) {
|
async execute(args) {
|
||||||
const issue = getIssueNumber()
|
const issue = getIssueNumber()
|
||||||
const owner = "anomalyco"
|
const owner = "anomalyco"
|
||||||
const repo = "opencode"
|
const repo = "opencode"
|
||||||
const assignee = pick(TEAM[args.team])
|
|
||||||
|
const results: string[] = []
|
||||||
|
let labels = [...new Set(args.labels.map((x) => (x === "desktop" ? "web" : x)))]
|
||||||
|
const web = labels.includes("web")
|
||||||
|
const text = `${process.env.ISSUE_TITLE ?? ""}\n${process.env.ISSUE_BODY ?? ""}`.toLowerCase()
|
||||||
|
const zen = /\bzen\b/.test(text) || text.includes("opencode black")
|
||||||
|
const nix = /\bnix(os)?\b/.test(text)
|
||||||
|
|
||||||
|
if (labels.includes("nix") && !nix) {
|
||||||
|
labels = labels.filter((x) => x !== "nix")
|
||||||
|
results.push("Dropped label: nix (issue does not mention nix)")
|
||||||
|
}
|
||||||
|
|
||||||
|
const assignee = nix ? "rekram1-node" : web ? pick(TEAM.desktop) : args.assignee
|
||||||
|
|
||||||
|
if (labels.includes("zen") && !zen) {
|
||||||
|
throw new Error("Only add the zen label when issue title/body contains 'zen'")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (web && !nix && !(TEAM.desktop as readonly string[]).includes(assignee)) {
|
||||||
|
throw new Error("Web issues must be assigned to adamdotdevin, iamdavidhill, Brendonovich, or nexxeln")
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((TEAM.zen as readonly string[]).includes(assignee) && !labels.includes("zen")) {
|
||||||
|
throw new Error("Only zen issues should be assigned to fwang or MrMushrooooom")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assignee === "Hona" && !labels.includes("windows")) {
|
||||||
|
throw new Error("Only windows issues should be assigned to Hona")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assignee === "R44VC0RP" && !labels.includes("docs")) {
|
||||||
|
throw new Error("Only docs issues should be assigned to R44VC0RP")
|
||||||
|
}
|
||||||
|
|
||||||
|
if (assignee === "kommander" && !labels.includes("opentui")) {
|
||||||
|
throw new Error("Only opentui issues should be assigned to kommander")
|
||||||
|
}
|
||||||
|
|
||||||
await githubFetch(`/repos/${owner}/${repo}/issues/${issue}/assignees`, {
|
await githubFetch(`/repos/${owner}/${repo}/issues/${issue}/assignees`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: JSON.stringify({ assignees: [assignee] }),
|
body: JSON.stringify({ assignees: [assignee] }),
|
||||||
})
|
})
|
||||||
|
results.push(`Assigned @${assignee} to issue #${issue}`)
|
||||||
|
|
||||||
return `Assigned @${assignee} from ${args.team} to issue #${issue}`
|
if (labels.length > 0) {
|
||||||
|
await githubFetch(`/repos/${owner}/${repo}/issues/${issue}/labels`, {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({ labels }),
|
||||||
|
})
|
||||||
|
results.push(`Added labels: ${labels.join(", ")}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
return results.join("\n")
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
+4
-5
@@ -7,11 +7,10 @@
|
|||||||
"enabled": false,
|
"enabled": false,
|
||||||
"label": "workspace",
|
"label": "workspace",
|
||||||
"keybinds": {
|
"keybinds": {
|
||||||
"smoke_modal": "ctrl+alt+m",
|
"modal": "ctrl+alt+m",
|
||||||
"smoke_screen": "ctrl+alt+o",
|
"screen": "ctrl+alt+o",
|
||||||
"smoke_screen_home": "escape,ctrl+shift+h",
|
"home": "escape,ctrl+shift+h",
|
||||||
"smoke_screen_modal": "ctrl+alt+m",
|
"dialog_close": "escape,q"
|
||||||
"smoke_dialog_close": "escape,q"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
- To regenerate the JavaScript SDK, run `./packages/sdk/js/script/build.ts`.
|
# OpenCode Monorepo Agent Guide
|
||||||
- ALWAYS USE PARALLEL TOOLS WHEN APPLICABLE.
|
|
||||||
- The default branch in this repo is `dev`.
|
|
||||||
- Local `main` ref may not exist; use `dev` or `origin/dev` for diffs.
|
|
||||||
- Prefer automation: execute requested actions without confirmation unless blocked by missing info or safety/irreversibility.
|
|
||||||
|
|
||||||
## Style Guide
|
This file is for coding agents working in `/Users/ryanvogel/dev/opencode`.
|
||||||
|
|
||||||
### General Principles
|
## Scope And Precedence
|
||||||
|
|
||||||
- Keep things in one function unless composable or reusable
|
- Keep things in one function unless composable or reusable
|
||||||
- Avoid `try`/`catch` where possible
|
- Avoid `try`/`catch` where possible
|
||||||
@@ -56,48 +52,48 @@ else foo = 2
|
|||||||
|
|
||||||
### Control Flow
|
### Control Flow
|
||||||
|
|
||||||
Avoid `else` statements. Prefer early returns.
|
- Prefer early returns over nested `else` blocks.
|
||||||
|
- Keep functions focused; split only when it improves reuse or readability.
|
||||||
|
|
||||||
```ts
|
### Error Handling
|
||||||
// Good
|
|
||||||
function foo() {
|
|
||||||
if (condition) return 1
|
|
||||||
return 2
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bad
|
- Fail with actionable messages.
|
||||||
function foo() {
|
- Avoid swallowing errors silently.
|
||||||
if (condition) return 1
|
- Log enough context to debug production issues (IDs, env, status), but never secrets.
|
||||||
else return 2
|
- In UI code, degrade gracefully for missing capabilities.
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Schema Definitions (Drizzle)
|
### Data / DB
|
||||||
|
|
||||||
Use snake_case for field names so column names don't need to be redefined as strings.
|
- For Drizzle schema, use snake_case fields and columns.
|
||||||
|
- Keep migration and schema changes minimal and explicit.
|
||||||
|
- Follow package-specific DB guidance in `packages/opencode/AGENTS.md`.
|
||||||
|
|
||||||
```ts
|
### Testing Philosophy
|
||||||
// Good
|
|
||||||
const table = sqliteTable("session", {
|
|
||||||
id: text().primaryKey(),
|
|
||||||
project_id: text().notNull(),
|
|
||||||
created_at: integer().notNull(),
|
|
||||||
})
|
|
||||||
|
|
||||||
// Bad
|
- Prefer testing real behavior over mocks.
|
||||||
const table = sqliteTable("session", {
|
- Add regression tests for bug fixes where practical.
|
||||||
id: text("id").primaryKey(),
|
- Keep fixtures small and focused.
|
||||||
projectID: text("project_id").notNull(),
|
|
||||||
createdAt: integer("created_at").notNull(),
|
|
||||||
})
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing
|
## Agent Workflow Tips
|
||||||
|
|
||||||
- Avoid mocks as much as possible
|
- Read existing code paths before introducing new abstractions.
|
||||||
- Test actual implementation, do not duplicate logic into tests
|
- Match local patterns first; do not impose a new style per file.
|
||||||
- Tests cannot run from repo root (guard: `do-not-run-tests-from-root`); run from package dirs like `packages/opencode`.
|
- If a package has its own `AGENTS.md`, review it before editing.
|
||||||
|
- For OpenCode Effect services, follow `packages/opencode/AGENTS.md` strictly.
|
||||||
|
|
||||||
## Type Checking
|
## Known Operational Notes
|
||||||
|
|
||||||
- Always run `bun typecheck` from package directories (e.g., `packages/opencode`), never `tsc` directly.
|
- `packages/app/AGENTS.md` says: never restart app/server processes during that package's debugging workflow.
|
||||||
|
- `packages/app/AGENTS.md` also documents local backend+web split for UI work.
|
||||||
|
- `packages/opencode/AGENTS.md` contains mandatory Effect and database conventions.
|
||||||
|
|
||||||
|
## Regeneration / Special Scripts
|
||||||
|
|
||||||
|
- Regenerate JS SDK with: `./packages/sdk/js/script/build.ts`
|
||||||
|
|
||||||
|
## Quick Checklist Before Finishing
|
||||||
|
|
||||||
|
- Ran relevant package checks.
|
||||||
|
- Updated docs/config when behavior changed.
|
||||||
|
- Avoided committing unrelated files.
|
||||||
|
- Kept edits minimal and aligned with local conventions.
|
||||||
|
|||||||
+18
-6
@@ -73,7 +73,7 @@ Replace `<platform>` with your platform (e.g., `darwin-arm64`, `linux-x64`).
|
|||||||
- `packages/opencode`: OpenCode core business logic & server.
|
- `packages/opencode`: OpenCode core business logic & server.
|
||||||
- `packages/opencode/src/cli/cmd/tui/`: The TUI code, written in SolidJS with [opentui](https://github.com/sst/opentui)
|
- `packages/opencode/src/cli/cmd/tui/`: The TUI code, written in SolidJS with [opentui](https://github.com/sst/opentui)
|
||||||
- `packages/app`: The shared web UI components, written in SolidJS
|
- `packages/app`: The shared web UI components, written in SolidJS
|
||||||
- `packages/desktop`: The native desktop app, built with Electron (wraps `packages/app`)
|
- `packages/desktop`: The native desktop app, built with Tauri (wraps `packages/app`)
|
||||||
- `packages/plugin`: Source for `@opencode-ai/plugin`
|
- `packages/plugin`: Source for `@opencode-ai/plugin`
|
||||||
|
|
||||||
### Understanding bun dev vs opencode
|
### Understanding bun dev vs opencode
|
||||||
@@ -123,21 +123,33 @@ This starts a local dev server at http://localhost:5173 (or similar port shown i
|
|||||||
|
|
||||||
### Running the Desktop App
|
### Running the Desktop App
|
||||||
|
|
||||||
The desktop app is an Electron application that wraps the web UI.
|
The desktop app is a native Tauri application that wraps the web UI.
|
||||||
|
|
||||||
To run the desktop app in development:
|
To run the native desktop app:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bun run --cwd packages/desktop tauri dev
|
||||||
|
```
|
||||||
|
|
||||||
|
This starts the web dev server on http://localhost:1420 and opens the native window.
|
||||||
|
|
||||||
|
If you only want the web dev server (no native shell):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bun run --cwd packages/desktop dev
|
bun run --cwd packages/desktop dev
|
||||||
```
|
```
|
||||||
|
|
||||||
To create a production build and package the app:
|
To create a production `dist/` and build the native app bundle:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bun run --cwd packages/desktop build
|
bun run --cwd packages/desktop tauri build
|
||||||
bun run --cwd packages/desktop package
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This runs `bun run --cwd packages/desktop build` automatically via Tauri’s `beforeBuildCommand`.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> Running the desktop app requires additional Tauri dependencies (Rust toolchain, platform-specific libraries). See the [Tauri prerequisites](https://v2.tauri.app/start/prerequisites/) for setup instructions.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> If you make changes to the API or SDK (e.g. `packages/opencode/src/server/server.ts`), run `./script/generate.ts` to regenerate the SDK and related files.
|
> If you make changes to the API or SDK (e.g. `packages/opencode/src/server/server.ts`), run `./script/generate.ts` to regenerate the SDK and related files.
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # او github:anomalyco/opencode لاحدث
|
|||||||
|
|
||||||
يتوفر OpenCode ايضا كتطبيق سطح مكتب. قم بالتنزيل مباشرة من [صفحة الاصدارات](https://github.com/anomalyco/opencode/releases) او من [opencode.ai/download](https://opencode.ai/download).
|
يتوفر OpenCode ايضا كتطبيق سطح مكتب. قم بالتنزيل مباشرة من [صفحة الاصدارات](https://github.com/anomalyco/opencode/releases) او من [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| المنصة | التنزيل |
|
| المنصة | التنزيل |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb` او `.rpm` او AppImage |
|
| Linux | `.deb` او `.rpm` او AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # or github:anomalyco/opencode for latest dev
|
|||||||
|
|
||||||
OpenCode ডেস্কটপ অ্যাপ্লিকেশন হিসেবেও উপলব্ধ। সরাসরি [রিলিজ পেজ](https://github.com/anomalyco/opencode/releases) অথবা [opencode.ai/download](https://opencode.ai/download) থেকে ডাউনলোড করুন।
|
OpenCode ডেস্কটপ অ্যাপ্লিকেশন হিসেবেও উপলব্ধ। সরাসরি [রিলিজ পেজ](https://github.com/anomalyco/opencode/releases) অথবা [opencode.ai/download](https://opencode.ai/download) থেকে ডাউনলোড করুন।
|
||||||
|
|
||||||
| প্ল্যাটফর্ম | ডাউনলোড |
|
| প্ল্যাটফর্ম | ডাউনলোড |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, or `.AppImage` |
|
| Linux | `.deb`, `.rpm`, or AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # ou github:anomalyco/opencode para a branch
|
|||||||
|
|
||||||
O OpenCode também está disponível como aplicativo desktop. Baixe diretamente pela [página de releases](https://github.com/anomalyco/opencode/releases) ou em [opencode.ai/download](https://opencode.ai/download).
|
O OpenCode também está disponível como aplicativo desktop. Baixe diretamente pela [página de releases](https://github.com/anomalyco/opencode/releases) ou em [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Plataforma | Download |
|
| Plataforma | Download |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm` ou AppImage |
|
| Linux | `.deb`, `.rpm` ou AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # ili github:anomalyco/opencode za najnoviji
|
|||||||
|
|
||||||
OpenCode je dostupan i kao desktop aplikacija. Preuzmi je direktno sa [stranice izdanja](https://github.com/anomalyco/opencode/releases) ili sa [opencode.ai/download](https://opencode.ai/download).
|
OpenCode je dostupan i kao desktop aplikacija. Preuzmi je direktno sa [stranice izdanja](https://github.com/anomalyco/opencode/releases) ili sa [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Platforma | Preuzimanje |
|
| Platforma | Preuzimanje |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, ili AppImage |
|
| Linux | `.deb`, `.rpm`, ili AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # eller github:anomalyco/opencode for nyeste
|
|||||||
|
|
||||||
OpenCode findes også som desktop-app. Download direkte fra [releases-siden](https://github.com/anomalyco/opencode/releases) eller [opencode.ai/download](https://opencode.ai/download).
|
OpenCode findes også som desktop-app. Download direkte fra [releases-siden](https://github.com/anomalyco/opencode/releases) eller [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Platform | Download |
|
| Platform | Download |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, eller AppImage |
|
| Linux | `.deb`, `.rpm`, eller AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # oder github:anomalyco/opencode für den neu
|
|||||||
|
|
||||||
OpenCode ist auch als Desktop-Anwendung verfügbar. Lade sie direkt von der [Releases-Seite](https://github.com/anomalyco/opencode/releases) oder [opencode.ai/download](https://opencode.ai/download) herunter.
|
OpenCode ist auch als Desktop-Anwendung verfügbar. Lade sie direkt von der [Releases-Seite](https://github.com/anomalyco/opencode/releases) oder [opencode.ai/download](https://opencode.ai/download) herunter.
|
||||||
|
|
||||||
| Plattform | Download |
|
| Plattform | Download |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm` oder AppImage |
|
| Linux | `.deb`, `.rpm` oder AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # o github:anomalyco/opencode para la rama de
|
|||||||
|
|
||||||
OpenCode también está disponible como aplicación de escritorio. Descárgala directamente desde la [página de releases](https://github.com/anomalyco/opencode/releases) o desde [opencode.ai/download](https://opencode.ai/download).
|
OpenCode también está disponible como aplicación de escritorio. Descárgala directamente desde la [página de releases](https://github.com/anomalyco/opencode/releases) o desde [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Plataforma | Descarga |
|
| Plataforma | Descarga |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, o AppImage |
|
| Linux | `.deb`, `.rpm`, o AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # ou github:anomalyco/opencode pour la branch
|
|||||||
|
|
||||||
OpenCode est aussi disponible en application de bureau. Téléchargez-la directement depuis la [page des releases](https://github.com/anomalyco/opencode/releases) ou [opencode.ai/download](https://opencode.ai/download).
|
OpenCode est aussi disponible en application de bureau. Téléchargez-la directement depuis la [page des releases](https://github.com/anomalyco/opencode/releases) ou [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Plateforme | Téléchargement |
|
| Plateforme | Téléchargement |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, ou AppImage |
|
| Linux | `.deb`, `.rpm`, ou AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # ή github:anomalyco/opencode με βάση
|
|||||||
|
|
||||||
Το OpenCode είναι επίσης διαθέσιμο ως εφαρμογή. Κατέβασε το απευθείας από τη [σελίδα εκδόσεων](https://github.com/anomalyco/opencode/releases) ή το [opencode.ai/download](https://opencode.ai/download).
|
Το OpenCode είναι επίσης διαθέσιμο ως εφαρμογή. Κατέβασε το απευθείας από τη [σελίδα εκδόσεων](https://github.com/anomalyco/opencode/releases) ή το [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Πλατφόρμα | Λήψη |
|
| Πλατφόρμα | Λήψη |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, ή AppImage |
|
| Linux | `.deb`, `.rpm`, ή AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # oppure github:anomalyco/opencode per l’ul
|
|||||||
|
|
||||||
OpenCode è disponibile anche come applicazione desktop. Puoi scaricarla direttamente dalla [pagina delle release](https://github.com/anomalyco/opencode/releases) oppure da [opencode.ai/download](https://opencode.ai/download).
|
OpenCode è disponibile anche come applicazione desktop. Puoi scaricarla direttamente dalla [pagina delle release](https://github.com/anomalyco/opencode/releases) oppure da [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Piattaforma | Download |
|
| Piattaforma | Download |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, oppure AppImage |
|
| Linux | `.deb`, `.rpm`, oppure AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # または github:anomalyco/opencode で最
|
|||||||
|
|
||||||
OpenCode はデスクトップアプリとしても利用できます。[releases page](https://github.com/anomalyco/opencode/releases) から直接ダウンロードするか、[opencode.ai/download](https://opencode.ai/download) を利用してください。
|
OpenCode はデスクトップアプリとしても利用できます。[releases page](https://github.com/anomalyco/opencode/releases) から直接ダウンロードするか、[opencode.ai/download](https://opencode.ai/download) を利用してください。
|
||||||
|
|
||||||
| プラットフォーム | ダウンロード |
|
| プラットフォーム | ダウンロード |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`、`.rpm`、または AppImage |
|
| Linux | `.deb`、`.rpm`、または AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # 또는 github:anomalyco/opencode 로 최신
|
|||||||
|
|
||||||
OpenCode 는 데스크톱 앱으로도 제공됩니다. [releases page](https://github.com/anomalyco/opencode/releases) 에서 직접 다운로드하거나 [opencode.ai/download](https://opencode.ai/download) 를 이용하세요.
|
OpenCode 는 데스크톱 앱으로도 제공됩니다. [releases page](https://github.com/anomalyco/opencode/releases) 에서 직접 다운로드하거나 [opencode.ai/download](https://opencode.ai/download) 를 이용하세요.
|
||||||
|
|
||||||
| 플랫폼 | 다운로드 |
|
| 플랫폼 | 다운로드 |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, 또는 AppImage |
|
| Linux | `.deb`, `.rpm`, 또는 AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # or github:anomalyco/opencode for latest dev
|
|||||||
|
|
||||||
OpenCode is also available as a desktop application. Download directly from the [releases page](https://github.com/anomalyco/opencode/releases) or [opencode.ai/download](https://opencode.ai/download).
|
OpenCode is also available as a desktop application. Download directly from the [releases page](https://github.com/anomalyco/opencode/releases) or [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Platform | Download |
|
| Platform | Download |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, or `.AppImage` |
|
| Linux | `.deb`, `.rpm`, or AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
@@ -132,7 +132,7 @@ It's very similar to Claude Code in terms of capability. Here are the key differ
|
|||||||
|
|
||||||
- 100% open source
|
- 100% open source
|
||||||
- Not coupled to any provider. Although we recommend the models we provide through [OpenCode Zen](https://opencode.ai/zen), OpenCode can be used with Claude, OpenAI, Google, or even local models. As models evolve, the gaps between them will close and pricing will drop, so being provider-agnostic is important.
|
- Not coupled to any provider. Although we recommend the models we provide through [OpenCode Zen](https://opencode.ai/zen), OpenCode can be used with Claude, OpenAI, Google, or even local models. As models evolve, the gaps between them will close and pricing will drop, so being provider-agnostic is important.
|
||||||
- Built-in opt-in LSP support
|
- Out-of-the-box LSP support
|
||||||
- A focus on TUI. OpenCode is built by neovim users and the creators of [terminal.shop](https://terminal.shop); we are going to push the limits of what's possible in the terminal.
|
- A focus on TUI. OpenCode is built by neovim users and the creators of [terminal.shop](https://terminal.shop); we are going to push the limits of what's possible in the terminal.
|
||||||
- A client/server architecture. This, for example, can allow OpenCode to run on your computer while you drive it remotely from a mobile app, meaning that the TUI frontend is just one of the possible clients.
|
- A client/server architecture. This, for example, can allow OpenCode to run on your computer while you drive it remotely from a mobile app, meaning that the TUI frontend is just one of the possible clients.
|
||||||
|
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # eller github:anomalyco/opencode for nyeste
|
|||||||
|
|
||||||
OpenCode er også tilgjengelig som en desktop-app. Last ned direkte fra [releases-siden](https://github.com/anomalyco/opencode/releases) eller [opencode.ai/download](https://opencode.ai/download).
|
OpenCode er også tilgjengelig som en desktop-app. Last ned direkte fra [releases-siden](https://github.com/anomalyco/opencode/releases) eller [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Plattform | Nedlasting |
|
| Plattform | Nedlasting |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm` eller AppImage |
|
| Linux | `.deb`, `.rpm` eller AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # lub github:anomalyco/opencode dla najnowsze
|
|||||||
|
|
||||||
OpenCode jest także dostępny jako aplikacja desktopowa. Pobierz ją bezpośrednio ze strony [releases](https://github.com/anomalyco/opencode/releases) lub z [opencode.ai/download](https://opencode.ai/download).
|
OpenCode jest także dostępny jako aplikacja desktopowa. Pobierz ją bezpośrednio ze strony [releases](https://github.com/anomalyco/opencode/releases) lub z [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Platforma | Pobieranie |
|
| Platforma | Pobieranie |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm` lub AppImage |
|
| Linux | `.deb`, `.rpm` lub AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # или github:anomalyco/opencode для с
|
|||||||
|
|
||||||
OpenCode также доступен как десктопное приложение. Скачайте его со [страницы релизов](https://github.com/anomalyco/opencode/releases) или с [opencode.ai/download](https://opencode.ai/download).
|
OpenCode также доступен как десктопное приложение. Скачайте его со [страницы релизов](https://github.com/anomalyco/opencode/releases) или с [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Платформа | Загрузка |
|
| Платформа | Загрузка |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm` или AppImage |
|
| Linux | `.deb`, `.rpm` или AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # หรือ github:anomalyco/opencode ส
|
|||||||
|
|
||||||
OpenCode มีให้ใช้งานเป็นแอปพลิเคชันเดสก์ท็อป ดาวน์โหลดโดยตรงจาก [หน้ารุ่น](https://github.com/anomalyco/opencode/releases) หรือ [opencode.ai/download](https://opencode.ai/download)
|
OpenCode มีให้ใช้งานเป็นแอปพลิเคชันเดสก์ท็อป ดาวน์โหลดโดยตรงจาก [หน้ารุ่น](https://github.com/anomalyco/opencode/releases) หรือ [opencode.ai/download](https://opencode.ai/download)
|
||||||
|
|
||||||
| แพลตฟอร์ม | ดาวน์โหลด |
|
| แพลตฟอร์ม | ดาวน์โหลด |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, หรือ AppImage |
|
| Linux | `.deb`, `.rpm`, หรือ AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # veya en güncel geliştirme dalı için git
|
|||||||
|
|
||||||
OpenCode ayrıca masaüstü uygulaması olarak da mevcuttur. Doğrudan [sürüm sayfasından](https://github.com/anomalyco/opencode/releases) veya [opencode.ai/download](https://opencode.ai/download) adresinden indirebilirsiniz.
|
OpenCode ayrıca masaüstü uygulaması olarak da mevcuttur. Doğrudan [sürüm sayfasından](https://github.com/anomalyco/opencode/releases) veya [opencode.ai/download](https://opencode.ai/download) adresinden indirebilirsiniz.
|
||||||
|
|
||||||
| Platform | İndirme |
|
| Platform | İndirme |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm` veya AppImage |
|
| Linux | `.deb`, `.rpm` veya AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # або github:anomalyco/opencode для н
|
|||||||
|
|
||||||
OpenCode також доступний як десктопний застосунок. Завантажуйте напряму зі [сторінки релізів](https://github.com/anomalyco/opencode/releases) або [opencode.ai/download](https://opencode.ai/download).
|
OpenCode також доступний як десктопний застосунок. Завантажуйте напряму зі [сторінки релізів](https://github.com/anomalyco/opencode/releases) або [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Платформа | Завантаження |
|
| Платформа | Завантаження |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm` або AppImage |
|
| Linux | `.deb`, `.rpm` або AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # hoặc github:anomalyco/opencode cho nhánh
|
|||||||
|
|
||||||
OpenCode cũng có sẵn dưới dạng ứng dụng desktop. Tải trực tiếp từ [trang releases](https://github.com/anomalyco/opencode/releases) hoặc [opencode.ai/download](https://opencode.ai/download).
|
OpenCode cũng có sẵn dưới dạng ứng dụng desktop. Tải trực tiếp từ [trang releases](https://github.com/anomalyco/opencode/releases) hoặc [opencode.ai/download](https://opencode.ai/download).
|
||||||
|
|
||||||
| Nền tảng | Tải xuống |
|
| Nền tảng | Tải xuống |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, hoặc AppImage |
|
| Linux | `.deb`, `.rpm`, hoặc AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew)
|
# macOS (Homebrew)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # 或用 github:anomalyco/opencode 获取最
|
|||||||
|
|
||||||
OpenCode 也提供桌面版应用。可直接从 [发布页 (releases page)](https://github.com/anomalyco/opencode/releases) 或 [opencode.ai/download](https://opencode.ai/download) 下载。
|
OpenCode 也提供桌面版应用。可直接从 [发布页 (releases page)](https://github.com/anomalyco/opencode/releases) 或 [opencode.ai/download](https://opencode.ai/download) 下载。
|
||||||
|
|
||||||
| 平台 | 下载文件 |
|
| 平台 | 下载文件 |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`、`.rpm` 或 AppImage |
|
| Linux | `.deb`、`.rpm` 或 AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew Cask)
|
# macOS (Homebrew Cask)
|
||||||
|
|||||||
+6
-6
@@ -68,12 +68,12 @@ nix run nixpkgs#opencode # 或使用 github:anomalyco/opencode 以取
|
|||||||
|
|
||||||
OpenCode 也提供桌面版應用程式。您可以直接從 [發佈頁面 (releases page)](https://github.com/anomalyco/opencode/releases) 或 [opencode.ai/download](https://opencode.ai/download) 下載。
|
OpenCode 也提供桌面版應用程式。您可以直接從 [發佈頁面 (releases page)](https://github.com/anomalyco/opencode/releases) 或 [opencode.ai/download](https://opencode.ai/download) 下載。
|
||||||
|
|
||||||
| 平台 | 下載連結 |
|
| 平台 | 下載連結 |
|
||||||
| --------------------- | ---------------------------------- |
|
| --------------------- | ------------------------------------- |
|
||||||
| macOS (Apple Silicon) | `opencode-desktop-mac-arm64.dmg` |
|
| macOS (Apple Silicon) | `opencode-desktop-darwin-aarch64.dmg` |
|
||||||
| macOS (Intel) | `opencode-desktop-mac-x64.dmg` |
|
| macOS (Intel) | `opencode-desktop-darwin-x64.dmg` |
|
||||||
| Windows | `opencode-desktop-windows-x64.exe` |
|
| Windows | `opencode-desktop-windows-x64.exe` |
|
||||||
| Linux | `.deb`, `.rpm`, 或 AppImage |
|
| Linux | `.deb`, `.rpm`, 或 AppImage |
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# macOS (Homebrew Cask)
|
# macOS (Homebrew Cask)
|
||||||
|
|||||||
Generated
+3
-3
@@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1776683584,
|
"lastModified": 1773909469,
|
||||||
"narHash": "sha256-NuTLMrr10Tng72hurYG8jYQ4XKK8wnpJmOGcPiis96g=",
|
"narHash": "sha256-vglVrLfHjFIzIdV9A27Ugul6rh3I1qHbbitGW7dk420=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "9dd5558b06dbdacbf635a3dd36dce1b1a7ee3a89",
|
"rev": "7149c06513f335be57f26fcbbbe34afda923882b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ export const api = new sst.cloudflare.Worker("Api", {
|
|||||||
transform: {
|
transform: {
|
||||||
worker: (args) => {
|
worker: (args) => {
|
||||||
args.logpush = true
|
args.logpush = true
|
||||||
if ($app.stage === "vimtor") return
|
|
||||||
args.bindings = $resolve(args.bindings).apply((bindings) => [
|
args.bindings = $resolve(args.bindings).apply((bindings) => [
|
||||||
...bindings,
|
...bindings,
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { domain } from "./stage"
|
import { domain } from "./stage"
|
||||||
import { EMAILOCTOPUS_API_KEY } from "./app"
|
import { EMAILOCTOPUS_API_KEY } from "./app"
|
||||||
import { SECRET } from "./secret"
|
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
// DATABASE
|
// DATABASE
|
||||||
@@ -116,27 +115,6 @@ const zenLiteCouponFirstMonth100 = new stripe.Coupon("ZenLiteCouponFirstMonth100
|
|||||||
appliesToProducts: [zenLiteProduct.id],
|
appliesToProducts: [zenLiteProduct.id],
|
||||||
duration: "once",
|
duration: "once",
|
||||||
})
|
})
|
||||||
const zenLiteCouponThreeMonths100 = new stripe.Coupon("ZenLiteCoupon3Months100", {
|
|
||||||
name: "3 months 100% off",
|
|
||||||
percentOff: 100,
|
|
||||||
appliesToProducts: [zenLiteProduct.id],
|
|
||||||
duration: "repeating",
|
|
||||||
durationInMonths: 3,
|
|
||||||
})
|
|
||||||
const zenLiteCouponSixMonths100 = new stripe.Coupon("ZenLiteCoupon6Months100", {
|
|
||||||
name: "6 months 100% off",
|
|
||||||
percentOff: 100,
|
|
||||||
appliesToProducts: [zenLiteProduct.id],
|
|
||||||
duration: "repeating",
|
|
||||||
durationInMonths: 6,
|
|
||||||
})
|
|
||||||
const zenLiteCouponTwelveMonths100 = new stripe.Coupon("ZenLiteCoupon12Months100", {
|
|
||||||
name: "12 months 100% off",
|
|
||||||
percentOff: 100,
|
|
||||||
appliesToProducts: [zenLiteProduct.id],
|
|
||||||
duration: "repeating",
|
|
||||||
durationInMonths: 12,
|
|
||||||
})
|
|
||||||
const zenLitePrice = new stripe.Price("ZenLitePrice", {
|
const zenLitePrice = new stripe.Price("ZenLitePrice", {
|
||||||
product: zenLiteProduct.id,
|
product: zenLiteProduct.id,
|
||||||
currency: "usd",
|
currency: "usd",
|
||||||
@@ -153,9 +131,6 @@ const ZEN_LITE_PRICE = new sst.Linkable("ZEN_LITE_PRICE", {
|
|||||||
priceInr: 92900,
|
priceInr: 92900,
|
||||||
firstMonth50Coupon: zenLiteCouponFirstMonth50.id,
|
firstMonth50Coupon: zenLiteCouponFirstMonth50.id,
|
||||||
firstMonth100Coupon: zenLiteCouponFirstMonth100.id,
|
firstMonth100Coupon: zenLiteCouponFirstMonth100.id,
|
||||||
threeMonths100Coupon: zenLiteCouponThreeMonths100.id,
|
|
||||||
sixMonths100Coupon: zenLiteCouponSixMonths100.id,
|
|
||||||
twelveMonths100Coupon: zenLiteCouponTwelveMonths100.id,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -222,7 +197,6 @@ const AUTH_API_URL = new sst.Linkable("AUTH_API_URL", {
|
|||||||
const STRIPE_WEBHOOK_SECRET = new sst.Linkable("STRIPE_WEBHOOK_SECRET", {
|
const STRIPE_WEBHOOK_SECRET = new sst.Linkable("STRIPE_WEBHOOK_SECRET", {
|
||||||
properties: { value: stripeWebhook.secret },
|
properties: { value: stripeWebhook.secret },
|
||||||
})
|
})
|
||||||
|
|
||||||
const gatewayKv = new sst.cloudflare.Kv("GatewayKv")
|
const gatewayKv = new sst.cloudflare.Kv("GatewayKv")
|
||||||
|
|
||||||
////////////////
|
////////////////
|
||||||
@@ -232,7 +206,6 @@ const gatewayKv = new sst.cloudflare.Kv("GatewayKv")
|
|||||||
const bucket = new sst.cloudflare.Bucket("ZenData")
|
const bucket = new sst.cloudflare.Bucket("ZenData")
|
||||||
const bucketNew = new sst.cloudflare.Bucket("ZenDataNew")
|
const bucketNew = new sst.cloudflare.Bucket("ZenDataNew")
|
||||||
|
|
||||||
const DISCORD_INCIDENT_WEBHOOK_URL = new sst.Secret("DISCORD_INCIDENT_WEBHOOK_URL")
|
|
||||||
const AWS_SES_ACCESS_KEY_ID = new sst.Secret("AWS_SES_ACCESS_KEY_ID")
|
const AWS_SES_ACCESS_KEY_ID = new sst.Secret("AWS_SES_ACCESS_KEY_ID")
|
||||||
const AWS_SES_SECRET_ACCESS_KEY = new sst.Secret("AWS_SES_SECRET_ACCESS_KEY")
|
const AWS_SES_SECRET_ACCESS_KEY = new sst.Secret("AWS_SES_SECRET_ACCESS_KEY")
|
||||||
|
|
||||||
@@ -254,8 +227,6 @@ new sst.cloudflare.x.SolidStart("Console", {
|
|||||||
database,
|
database,
|
||||||
AUTH_API_URL,
|
AUTH_API_URL,
|
||||||
STRIPE_WEBHOOK_SECRET,
|
STRIPE_WEBHOOK_SECRET,
|
||||||
DISCORD_INCIDENT_WEBHOOK_URL,
|
|
||||||
SECRET.HoneycombWebhookSecret,
|
|
||||||
STRIPE_SECRET_KEY,
|
STRIPE_SECRET_KEY,
|
||||||
EMAILOCTOPUS_API_KEY,
|
EMAILOCTOPUS_API_KEY,
|
||||||
AWS_SES_ACCESS_KEY_ID,
|
AWS_SES_ACCESS_KEY_ID,
|
||||||
|
|||||||
@@ -1,202 +0,0 @@
|
|||||||
import { SECRET } from "./secret"
|
|
||||||
import { domain } from "./stage"
|
|
||||||
|
|
||||||
const webhookRecipient = new honeycomb.WebhookRecipient("DiscordAlerts", {
|
|
||||||
name: $app.stage === "production" ? "Discord Alerts" : `Discord Alerts (${$app.stage})`,
|
|
||||||
url: `https://${domain}/honeycomb/webhook`,
|
|
||||||
secret: SECRET.HoneycombWebhookSecret.result,
|
|
||||||
templates: [
|
|
||||||
{
|
|
||||||
type: "trigger",
|
|
||||||
body: `{
|
|
||||||
"url": {{ .Result.URL | quote }},
|
|
||||||
"type": {{ .Vars.type | quote }},
|
|
||||||
"name": {{ .Name | quote }},
|
|
||||||
"status": {{ .Alert.Status | quote }},
|
|
||||||
"isTest": {{ .Alert.IsTest }},
|
|
||||||
"groups": {{ .Result.GroupsTriggered | toJson }}
|
|
||||||
}`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
variables: [
|
|
||||||
{
|
|
||||||
name: "type",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
const modelHttpErrorsQuery = (product: "go" | "zen") => {
|
|
||||||
const filters = [
|
|
||||||
{ column: "model", op: "exists" },
|
|
||||||
{ column: "event_type", op: "=", value: "completions" },
|
|
||||||
{ column: "user_agent", op: "contains", value: "opencode" },
|
|
||||||
{ column: "isGoTier", op: "=", value: product === "go" ? "true" : "false" },
|
|
||||||
]
|
|
||||||
|
|
||||||
return honeycomb.getQuerySpecificationOutput({
|
|
||||||
breakdowns: ["model"],
|
|
||||||
calculatedFields: [
|
|
||||||
{
|
|
||||||
name: "is_failed_http_status",
|
|
||||||
expression:
|
|
||||||
product === "go"
|
|
||||||
? `IF(AND(GTE($status, "400"), NOT(EQUALS($status, "401")), NOT(EQUALS($status, "429"))), 1, 0)`
|
|
||||||
: `IF(AND(GTE($status, "400"), NOT(EQUALS($status, "401"))), 1, 0)`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
calculations: [
|
|
||||||
{ op: "COUNT", name: "TOTAL", filterCombination: "AND", filters },
|
|
||||||
{ op: "SUM", name: "FAILED", column: "is_failed_http_status", filterCombination: "AND", filters },
|
|
||||||
],
|
|
||||||
formulas: [{ name: "ERROR", expression: "IF(GTE($TOTAL, 100), DIV($FAILED, $TOTAL), 0)" }],
|
|
||||||
timeRange: 900,
|
|
||||||
}).json
|
|
||||||
}
|
|
||||||
|
|
||||||
const providerHttpErrorsQuery = (product: "go" | "zen") => {
|
|
||||||
const filters = [
|
|
||||||
{ column: "provider", op: "exists" },
|
|
||||||
{ column: "user_agent", op: "contains", value: "opencode" },
|
|
||||||
{ column: "isGoTier", op: "=", value: product === "go" ? "true" : "false" },
|
|
||||||
]
|
|
||||||
|
|
||||||
return honeycomb.getQuerySpecificationOutput({
|
|
||||||
breakdowns: ["provider"],
|
|
||||||
calculatedFields: [
|
|
||||||
{
|
|
||||||
name: "is_success_http_status",
|
|
||||||
expression: `IF(AND(GTE($status, "200"), LT($status, "400")), 1, 0)`,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "is_failed_provider_http_status",
|
|
||||||
expression: `IF(GT($llm.error.code, "400"), 1, 0)`,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
calculations: [
|
|
||||||
{
|
|
||||||
op: "SUM",
|
|
||||||
name: "SUCCESS",
|
|
||||||
column: "is_success_http_status",
|
|
||||||
filterCombination: "AND",
|
|
||||||
filters: [...filters, { column: "event_type", op: "=", value: "completions" }],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
op: "SUM",
|
|
||||||
name: "FAILED",
|
|
||||||
column: "is_failed_provider_http_status",
|
|
||||||
filterCombination: "AND",
|
|
||||||
filters: [...filters, { column: "event_type", op: "=", value: "llm.error" }],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
formulas: [
|
|
||||||
{ name: "ERROR", expression: "IF(GTE(SUM($SUCCESS, $FAILED), 50), DIV($FAILED, SUM($SUCCESS, $FAILED)), 0)" },
|
|
||||||
],
|
|
||||||
timeRange: 900,
|
|
||||||
}).json
|
|
||||||
}
|
|
||||||
|
|
||||||
const description = "Managed by SST (Don't edit in Honeycomb UI)"
|
|
||||||
|
|
||||||
new honeycomb.Trigger("IncreasedModelHttpErrorsGo", {
|
|
||||||
name: "Increased Model HTTP Errors [Go]",
|
|
||||||
description,
|
|
||||||
queryJson: modelHttpErrorsQuery("go"),
|
|
||||||
alertType: "on_change",
|
|
||||||
frequency: 300,
|
|
||||||
thresholds: [{ op: ">=", value: 0.7, exceededLimit: 1 }],
|
|
||||||
recipients: [
|
|
||||||
{
|
|
||||||
id: webhookRecipient.id,
|
|
||||||
notificationDetails: [
|
|
||||||
{
|
|
||||||
variables: [{ name: "type", value: "model_http_errors" }],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
new honeycomb.Trigger("IncreasedModelHttpErrorsZen", {
|
|
||||||
name: "Increased Model HTTP Errors [Zen]",
|
|
||||||
description,
|
|
||||||
queryJson: modelHttpErrorsQuery("zen"),
|
|
||||||
alertType: "on_change",
|
|
||||||
frequency: 300,
|
|
||||||
thresholds: [{ op: ">=", value: 0.7, exceededLimit: 1 }],
|
|
||||||
recipients: [
|
|
||||||
{
|
|
||||||
id: webhookRecipient.id,
|
|
||||||
notificationDetails: [
|
|
||||||
{
|
|
||||||
variables: [{ name: "type", value: "model_http_errors" }],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
new honeycomb.Trigger("IncreasedProviderHttpErrorsGo", {
|
|
||||||
name: "Increased Provider HTTP Errors [Go]",
|
|
||||||
description,
|
|
||||||
queryJson: providerHttpErrorsQuery("go"),
|
|
||||||
alertType: "on_change",
|
|
||||||
frequency: 300,
|
|
||||||
thresholds: [{ op: ">=", value: 0.7, exceededLimit: 1 }],
|
|
||||||
recipients: [
|
|
||||||
{
|
|
||||||
id: webhookRecipient.id,
|
|
||||||
notificationDetails: [
|
|
||||||
{
|
|
||||||
variables: [{ name: "type", value: "provider_http_errors" }],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
new honeycomb.Trigger("IncreasedProviderHttpErrorsZen", {
|
|
||||||
name: "Increased Provider HTTP Errors [Zen]",
|
|
||||||
description,
|
|
||||||
queryJson: providerHttpErrorsQuery("zen"),
|
|
||||||
alertType: "on_change",
|
|
||||||
frequency: 300,
|
|
||||||
thresholds: [{ op: ">=", value: 0.7, exceededLimit: 1 }],
|
|
||||||
recipients: [
|
|
||||||
{
|
|
||||||
id: webhookRecipient.id,
|
|
||||||
notificationDetails: [
|
|
||||||
{
|
|
||||||
variables: [{ name: "type", value: "provider_http_errors" }],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
new honeycomb.Trigger("IncreasedFreeTierRequests", {
|
|
||||||
name: "Increased Free Tier Requests",
|
|
||||||
description,
|
|
||||||
queryJson: honeycomb.getQuerySpecificationOutput({
|
|
||||||
calculations: [{ op: "COUNT" }],
|
|
||||||
filters: [
|
|
||||||
{ column: "event_type", op: "=", value: "completions" },
|
|
||||||
{ column: "user_agent", op: "contains", value: "opencode" },
|
|
||||||
{ column: "isFreeTier", op: "=", value: "true" },
|
|
||||||
],
|
|
||||||
timeRange: 3600,
|
|
||||||
}).json,
|
|
||||||
alertType: "on_change",
|
|
||||||
frequency: 900,
|
|
||||||
thresholds: [{ op: ">=", value: 50, exceededLimit: 1 }],
|
|
||||||
baselineDetails: [{ type: "percentage", offsetMinutes: 1440 }],
|
|
||||||
recipients: [
|
|
||||||
{
|
|
||||||
id: webhookRecipient.id,
|
|
||||||
notificationDetails: [
|
|
||||||
{
|
|
||||||
variables: [{ name: "type", value: "custom" }],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
@@ -1,11 +1,4 @@
|
|||||||
sst.Linkable.wrap(random.RandomPassword, (resource) => ({
|
|
||||||
properties: {
|
|
||||||
value: resource.result,
|
|
||||||
},
|
|
||||||
}))
|
|
||||||
|
|
||||||
export const SECRET = {
|
export const SECRET = {
|
||||||
R2AccessKey: new sst.Secret("R2AccessKey", "unknown"),
|
R2AccessKey: new sst.Secret("R2AccessKey", "unknown"),
|
||||||
R2SecretKey: new sst.Secret("R2SecretKey", "unknown"),
|
R2SecretKey: new sst.Secret("R2SecretKey", "unknown"),
|
||||||
HoneycombWebhookSecret: new random.RandomPassword("HoneycombWebhookSecret", { length: 24 }),
|
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"nodeModules": {
|
"nodeModules": {
|
||||||
"x86_64-linux": "sha256-LTo0ohJN5hBOubqFLVL45unVEIwBDkACNVv64k2nkq4=",
|
"x86_64-linux": "sha256-i9TxYwWkJAR+kW6pbvhgQbRW9UYPtdrPQAGic4zPoa4=",
|
||||||
"aarch64-linux": "sha256-oYKY2UJRWG2fhufW4aGujX/Poou93023ZF2Fu7oyYOw=",
|
"aarch64-linux": "sha256-RYc/OYlETXUwkWBRDas+/P4cBW6zde4FqxxnMARu5vs=",
|
||||||
"aarch64-darwin": "sha256-618c9vqKN5I+no1nzylctAiWvqw7Bsa+bzSTNwXmSQA=",
|
"aarch64-darwin": "sha256-jIhUOIRIQEa2WT62TVIedmRIhl/edhK8sbiAFvU3yCM=",
|
||||||
"x86_64-darwin": "sha256-1ro3/gH0FC0TWXwWT+k675xR396GE98HpnBEeuD4t6k="
|
"x86_64-darwin": "sha256-xLGzaX7OofFlZzVgpORJR5QXD2u+54hp+t3cCfUtO84="
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ stdenvNoCC.mkDerivation {
|
|||||||
--filter './packages/opencode' \
|
--filter './packages/opencode' \
|
||||||
--filter './packages/desktop' \
|
--filter './packages/desktop' \
|
||||||
--filter './packages/app' \
|
--filter './packages/app' \
|
||||||
|
--filter './packages/shared' \
|
||||||
--frozen-lockfile \
|
--frozen-lockfile \
|
||||||
--ignore-scripts \
|
--ignore-scripts \
|
||||||
--no-progress
|
--no-progress
|
||||||
|
|||||||
+1
-1
@@ -64,7 +64,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
|
|||||||
[
|
[
|
||||||
ripgrep
|
ripgrep
|
||||||
]
|
]
|
||||||
# bun runs sysctl to detect if running on rosetta2
|
# bun runs sysctl to detect if dunning on rosetta2
|
||||||
++ lib.optional stdenvNoCC.hostPlatform.isDarwin sysctl
|
++ lib.optional stdenvNoCC.hostPlatform.isDarwin sysctl
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-15
@@ -4,16 +4,15 @@
|
|||||||
"description": "AI-powered development tool",
|
"description": "AI-powered development tool",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"packageManager": "bun@1.3.13",
|
"packageManager": "bun@1.3.11",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun run --cwd packages/opencode --conditions=browser src/index.ts",
|
"dev": "bun run --cwd packages/opencode --conditions=browser src/index.ts",
|
||||||
"dev:desktop": "bun --cwd packages/desktop dev",
|
"dev:desktop": "bun --cwd packages/desktop-electron dev",
|
||||||
"dev:web": "bun --cwd packages/app dev",
|
"dev:web": "bun --cwd packages/app dev",
|
||||||
"dev:console": "ulimit -n 10240 2>/dev/null; bun run --cwd packages/console/app dev",
|
"dev:console": "ulimit -n 10240 2>/dev/null; bun run --cwd packages/console/app dev",
|
||||||
"dev:storybook": "bun --cwd packages/storybook storybook",
|
"dev:storybook": "bun --cwd packages/storybook storybook",
|
||||||
"lint": "oxlint",
|
"lint": "oxlint",
|
||||||
"typecheck": "bun turbo typecheck",
|
"typecheck": "bun turbo typecheck",
|
||||||
"upgrade-opentui": "bun run script/upgrade-opentui.ts",
|
|
||||||
"postinstall": "bun run --cwd packages/opencode fix-node-pty",
|
"postinstall": "bun run --cwd packages/opencode fix-node-pty",
|
||||||
"prepare": "husky",
|
"prepare": "husky",
|
||||||
"random": "echo 'Random script'",
|
"random": "echo 'Random script'",
|
||||||
@@ -28,34 +27,32 @@
|
|||||||
"packages/slack"
|
"packages/slack"
|
||||||
],
|
],
|
||||||
"catalog": {
|
"catalog": {
|
||||||
"@effect/opentelemetry": "4.0.0-beta.57",
|
"@effect/opentelemetry": "4.0.0-beta.48",
|
||||||
"@effect/platform-node": "4.0.0-beta.57",
|
"@effect/platform-node": "4.0.0-beta.48",
|
||||||
"@npmcli/arborist": "9.4.0",
|
"@npmcli/arborist": "9.4.0",
|
||||||
"@types/bun": "1.3.12",
|
"@types/bun": "1.3.11",
|
||||||
"@types/cross-spawn": "6.0.6",
|
"@types/cross-spawn": "6.0.6",
|
||||||
"@octokit/rest": "22.0.0",
|
"@octokit/rest": "22.0.0",
|
||||||
"@hono/zod-validator": "0.4.2",
|
"@hono/zod-validator": "0.4.2",
|
||||||
"@opentui/core": "0.2.6",
|
"@opentui/core": "0.1.99",
|
||||||
"@opentui/keymap": "0.2.6",
|
"@opentui/solid": "0.1.99",
|
||||||
"@opentui/solid": "0.2.6",
|
|
||||||
"ulid": "3.0.1",
|
"ulid": "3.0.1",
|
||||||
"@kobalte/core": "0.13.11",
|
"@kobalte/core": "0.13.11",
|
||||||
"@types/luxon": "3.7.1",
|
"@types/luxon": "3.7.1",
|
||||||
"@types/node": "24.12.2",
|
"@types/node": "22.13.9",
|
||||||
"@types/semver": "7.7.1",
|
"@types/semver": "7.7.1",
|
||||||
"@tsconfig/node22": "22.0.2",
|
"@tsconfig/node22": "22.0.2",
|
||||||
"@tsconfig/bun": "1.0.9",
|
"@tsconfig/bun": "1.0.9",
|
||||||
"@cloudflare/workers-types": "4.20251008.0",
|
"@cloudflare/workers-types": "4.20251008.0",
|
||||||
"@openauthjs/openauth": "0.0.0-20250322224806",
|
"@openauthjs/openauth": "0.0.0-20250322224806",
|
||||||
"@pierre/diffs": "1.1.0-beta.18",
|
"@pierre/diffs": "1.1.0-beta.18",
|
||||||
"opentui-spinner": "0.0.6",
|
|
||||||
"@solid-primitives/storage": "4.3.3",
|
"@solid-primitives/storage": "4.3.3",
|
||||||
"@tailwindcss/vite": "4.1.11",
|
"@tailwindcss/vite": "4.1.11",
|
||||||
"diff": "8.0.2",
|
"diff": "8.0.2",
|
||||||
"dompurify": "3.3.1",
|
"dompurify": "3.3.1",
|
||||||
"drizzle-kit": "1.0.0-beta.19-d95b7a4",
|
"drizzle-kit": "1.0.0-beta.19-d95b7a4",
|
||||||
"drizzle-orm": "1.0.0-beta.19-d95b7a4",
|
"drizzle-orm": "1.0.0-beta.19-d95b7a4",
|
||||||
"effect": "4.0.0-beta.59",
|
"effect": "4.0.0-beta.48",
|
||||||
"ai": "6.0.168",
|
"ai": "6.0.168",
|
||||||
"cross-spawn": "7.0.6",
|
"cross-spawn": "7.0.6",
|
||||||
"hono": "4.10.7",
|
"hono": "4.10.7",
|
||||||
@@ -79,8 +76,6 @@
|
|||||||
"@solidjs/meta": "0.29.4",
|
"@solidjs/meta": "0.29.4",
|
||||||
"@solidjs/router": "0.15.4",
|
"@solidjs/router": "0.15.4",
|
||||||
"@solidjs/start": "https://pkg.pr.new/@solidjs/start@dfb2020",
|
"@solidjs/start": "https://pkg.pr.new/@solidjs/start@dfb2020",
|
||||||
"@sentry/solid": "10.36.0",
|
|
||||||
"@sentry/vite-plugin": "4.6.0",
|
|
||||||
"solid-js": "1.9.10",
|
"solid-js": "1.9.10",
|
||||||
"vite-plugin-solid": "2.11.10",
|
"vite-plugin-solid": "2.11.10",
|
||||||
"@lydell/node-pty": "1.2.0-beta.10"
|
"@lydell/node-pty": "1.2.0-beta.10"
|
||||||
@@ -132,7 +127,6 @@
|
|||||||
"@types/node": "catalog:"
|
"@types/node": "catalog:"
|
||||||
},
|
},
|
||||||
"patchedDependencies": {
|
"patchedDependencies": {
|
||||||
"@npmcli/agent@4.0.0": "patches/@npmcli%2Fagent@4.0.0.patch",
|
|
||||||
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
|
"@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch",
|
||||||
"solid-js@1.9.10": "patches/solid-js@1.9.10.patch"
|
"solid-js@1.9.10": "patches/solid-js@1.9.10.patch"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
PORT=8787
|
||||||
|
|
||||||
|
DATABASE_HOST=
|
||||||
|
DATABASE_USERNAME=
|
||||||
|
DATABASE_PASSWORD=
|
||||||
|
DATABASE_NAME=main
|
||||||
|
|
||||||
|
APNS_TEAM_ID=
|
||||||
|
APNS_KEY_ID=
|
||||||
|
APNS_PRIVATE_KEY=
|
||||||
|
APNS_DEFAULT_BUNDLE_ID=com.anomalyco.mobilevoice
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
# apn-relay Agent Guide
|
||||||
|
|
||||||
|
This file defines package-specific guidance for agents working in `packages/apn-relay`.
|
||||||
|
|
||||||
|
## Scope And Precedence
|
||||||
|
|
||||||
|
- Follow root `AGENTS.md` first.
|
||||||
|
- This file provides stricter package-level conventions for relay service work.
|
||||||
|
- If future local guides are added, closest guide wins.
|
||||||
|
|
||||||
|
## Project Overview
|
||||||
|
|
||||||
|
- Minimal APNs relay service (Hono + Bun + PlanetScale via Drizzle).
|
||||||
|
- Core routes:
|
||||||
|
- `GET /health`
|
||||||
|
- `GET /`
|
||||||
|
- `POST /v1/device/register`
|
||||||
|
- `POST /v1/device/unregister`
|
||||||
|
- `POST /v1/event`
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
Run all commands from `packages/apn-relay`.
|
||||||
|
|
||||||
|
- Install deps: `bun install`
|
||||||
|
- Start relay locally: `bun run dev`
|
||||||
|
- Typecheck: `bun run typecheck`
|
||||||
|
- DB connectivity check: `bun run db:check`
|
||||||
|
|
||||||
|
## Build / Test Expectations
|
||||||
|
|
||||||
|
- There is no dedicated package test script currently.
|
||||||
|
- Required validation for behavior changes:
|
||||||
|
- `bun run typecheck`
|
||||||
|
- `bun run db:check` when DB/env changes are involved
|
||||||
|
- manual endpoint verification against `/health`, `/v1/device/register`, `/v1/event`
|
||||||
|
|
||||||
|
## Single-Test Guidance
|
||||||
|
|
||||||
|
- No single-test command exists for this package today.
|
||||||
|
- For focused checks, run endpoint-level manual tests against a local dev server.
|
||||||
|
|
||||||
|
## Code Style Guidelines
|
||||||
|
|
||||||
|
### Formatting / Structure
|
||||||
|
|
||||||
|
- Keep handlers compact and explicit.
|
||||||
|
- Prefer small local helpers for repeated route logic.
|
||||||
|
- Avoid broad refactors when a targeted fix is enough.
|
||||||
|
|
||||||
|
### Types / Validation
|
||||||
|
|
||||||
|
- Validate request bodies with `zod` at route boundaries.
|
||||||
|
- Keep payload and DB row shapes explicit and close to usage.
|
||||||
|
- Avoid `any`; narrow unknown input immediately after parsing.
|
||||||
|
|
||||||
|
### Naming
|
||||||
|
|
||||||
|
- Follow existing concise naming in this package (`reg`, `unreg`, `evt`, `row`, `key`).
|
||||||
|
- For DB columns, keep snake_case alignment with schema.
|
||||||
|
|
||||||
|
### Error Handling
|
||||||
|
|
||||||
|
- Return clear JSON errors for invalid input.
|
||||||
|
- Keep handler failures observable via `app.onError` and structured logs.
|
||||||
|
- Do not leak secrets in responses or logs.
|
||||||
|
|
||||||
|
### Logging
|
||||||
|
|
||||||
|
- Log delivery lifecycle at key checkpoints:
|
||||||
|
- registration/unregistration attempts
|
||||||
|
- event fanout start/end
|
||||||
|
- APNs send failures and retries
|
||||||
|
- Mask sensitive values; prefer token suffixes and metadata.
|
||||||
|
|
||||||
|
### APNs Environment Rules
|
||||||
|
|
||||||
|
- Keep APNs env explicit per registration (`sandbox` / `production`).
|
||||||
|
- For `BadEnvironmentKeyInToken`, retry once with flipped env and persist correction.
|
||||||
|
- Avoid infinite retry loops; one retry max per delivery attempt.
|
||||||
|
|
||||||
|
## Database Conventions
|
||||||
|
|
||||||
|
- Schema is in `src/schema.sql.ts`.
|
||||||
|
- Keep table/column names snake_case.
|
||||||
|
- Maintain index naming consistency with existing schema.
|
||||||
|
- For upserts, update only fields required by current behavior.
|
||||||
|
|
||||||
|
## API Behavior Expectations
|
||||||
|
|
||||||
|
- `register`/`unregister` must be idempotent.
|
||||||
|
- `event` should return success envelope even when no devices are registered.
|
||||||
|
- Delivery logs should capture per-attempt result and error payload.
|
||||||
|
|
||||||
|
## Operational Notes
|
||||||
|
|
||||||
|
- Ensure `APNS_PRIVATE_KEY` supports escaped newline format (`\n`) and raw multiline.
|
||||||
|
- Validate that `APNS_DEFAULT_BUNDLE_ID` matches mobile app bundle identifier.
|
||||||
|
- Avoid coupling route behavior to deployment platform specifics.
|
||||||
|
|
||||||
|
## Before Finishing
|
||||||
|
|
||||||
|
- Run `bun run typecheck`.
|
||||||
|
- If DB/env behavior changed, run `bun run db:check`.
|
||||||
|
- Manually exercise affected endpoints.
|
||||||
|
- Confirm logs are useful and secret-safe.
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
FROM oven/bun:1.3.11-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package.json ./
|
||||||
|
COPY tsconfig.json ./
|
||||||
|
COPY drizzle.config.ts ./
|
||||||
|
RUN bun install --production
|
||||||
|
|
||||||
|
COPY src ./src
|
||||||
|
|
||||||
|
EXPOSE 8787
|
||||||
|
|
||||||
|
CMD ["bun", "run", "src/index.ts"]
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
# APN Relay
|
||||||
|
|
||||||
|
Minimal APNs relay for OpenCode mobile background notifications.
|
||||||
|
|
||||||
|
## What it does
|
||||||
|
|
||||||
|
- Registers iOS device tokens for a shared secret.
|
||||||
|
- Receives OpenCode event posts (`complete`, `permission`, `error`).
|
||||||
|
- Sends APNs notifications to mapped devices.
|
||||||
|
- Stores delivery rows in PlanetScale.
|
||||||
|
|
||||||
|
## Routes
|
||||||
|
|
||||||
|
- `GET /health`
|
||||||
|
- `GET /` (simple dashboard)
|
||||||
|
- `POST /v1/device/register`
|
||||||
|
- `POST /v1/device/unregister`
|
||||||
|
- `POST /v1/event`
|
||||||
|
|
||||||
|
## Environment
|
||||||
|
|
||||||
|
Use `.env.example` as a starting point.
|
||||||
|
|
||||||
|
- `DATABASE_HOST`
|
||||||
|
- `DATABASE_USERNAME`
|
||||||
|
- `DATABASE_PASSWORD`
|
||||||
|
- `APNS_TEAM_ID`
|
||||||
|
- `APNS_KEY_ID`
|
||||||
|
- `APNS_PRIVATE_KEY`
|
||||||
|
- `APNS_DEFAULT_BUNDLE_ID`
|
||||||
|
|
||||||
|
## Run locally
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bun install
|
||||||
|
bun run src/index.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
## Docker
|
||||||
|
|
||||||
|
Build from this directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t apn-relay .
|
||||||
|
docker run --rm -p 8787:8787 --env-file .env apn-relay
|
||||||
|
```
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { defineConfig } from "drizzle-kit"
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
out: "./migration",
|
||||||
|
strict: true,
|
||||||
|
schema: ["./src/**/*.sql.ts"],
|
||||||
|
dialect: "mysql",
|
||||||
|
dbCredentials: {
|
||||||
|
host: process.env.DATABASE_HOST ?? "",
|
||||||
|
user: process.env.DATABASE_USERNAME ?? "",
|
||||||
|
password: process.env.DATABASE_PASSWORD ?? "",
|
||||||
|
database: process.env.DATABASE_NAME ?? "main",
|
||||||
|
ssl: {
|
||||||
|
rejectUnauthorized: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/package.json",
|
||||||
|
"name": "@opencode-ai/apn-relay",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"private": true,
|
||||||
|
"type": "module",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "bun run src/index.ts",
|
||||||
|
"db:check": "bun run --env-file .env src/check.ts",
|
||||||
|
"typecheck": "tsgo --noEmit"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@planetscale/database": "1.19.0",
|
||||||
|
"drizzle-orm": "1.0.0-beta.19-d95b7a4",
|
||||||
|
"hono": "4.10.7",
|
||||||
|
"jose": "6.0.11",
|
||||||
|
"zod": "4.1.8"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@tsconfig/bun": "1.0.9",
|
||||||
|
"@types/bun": "1.3.11",
|
||||||
|
"@typescript/native-preview": "7.0.0-dev.20251207.1",
|
||||||
|
"drizzle-kit": "1.0.0-beta.19-d95b7a4",
|
||||||
|
"typescript": "5.8.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,185 @@
|
|||||||
|
import { connect } from "node:http2"
|
||||||
|
import { SignJWT, importPKCS8 } from "jose"
|
||||||
|
import { env } from "./env"
|
||||||
|
|
||||||
|
export type PushEnv = "sandbox" | "production"
|
||||||
|
|
||||||
|
type PushInput = {
|
||||||
|
token: string
|
||||||
|
bundle: string
|
||||||
|
env: PushEnv
|
||||||
|
title: string
|
||||||
|
body: string
|
||||||
|
data: Record<string, unknown>
|
||||||
|
}
|
||||||
|
|
||||||
|
type PushResult = {
|
||||||
|
ok: boolean
|
||||||
|
code: number
|
||||||
|
error?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
function tokenSuffix(input: string) {
|
||||||
|
return input.length > 8 ? input.slice(-8) : input
|
||||||
|
}
|
||||||
|
|
||||||
|
let jwt = ""
|
||||||
|
let exp = 0
|
||||||
|
let pk: Awaited<ReturnType<typeof importPKCS8>> | undefined
|
||||||
|
|
||||||
|
function host(input: PushEnv) {
|
||||||
|
if (input === "sandbox") return "api.sandbox.push.apple.com"
|
||||||
|
return "api.push.apple.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
function key() {
|
||||||
|
if (env.APNS_PRIVATE_KEY.includes("\\n")) return env.APNS_PRIVATE_KEY.replace(/\\n/g, "\n")
|
||||||
|
return env.APNS_PRIVATE_KEY
|
||||||
|
}
|
||||||
|
|
||||||
|
async function sign() {
|
||||||
|
if (!pk) pk = await importPKCS8(key(), "ES256")
|
||||||
|
const now = Math.floor(Date.now() / 1000)
|
||||||
|
if (jwt && now < exp) return jwt
|
||||||
|
jwt = await new SignJWT({})
|
||||||
|
.setProtectedHeader({ alg: "ES256", kid: env.APNS_KEY_ID })
|
||||||
|
.setIssuer(env.APNS_TEAM_ID)
|
||||||
|
.setIssuedAt(now)
|
||||||
|
.sign(pk)
|
||||||
|
exp = now + 50 * 60
|
||||||
|
return jwt
|
||||||
|
}
|
||||||
|
|
||||||
|
function post(input: {
|
||||||
|
host: string
|
||||||
|
token: string
|
||||||
|
auth: string
|
||||||
|
bundle: string
|
||||||
|
payload: string
|
||||||
|
}): Promise<{ code: number; body: string }> {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const cli = connect(`https://${input.host}`)
|
||||||
|
let done = false
|
||||||
|
let code = 0
|
||||||
|
let body = ""
|
||||||
|
|
||||||
|
const stop = (fn: () => void) => {
|
||||||
|
if (done) return
|
||||||
|
done = true
|
||||||
|
fn()
|
||||||
|
}
|
||||||
|
|
||||||
|
cli.on("error", (err) => {
|
||||||
|
stop(() => reject(err))
|
||||||
|
cli.close()
|
||||||
|
})
|
||||||
|
|
||||||
|
const req = cli.request({
|
||||||
|
":method": "POST",
|
||||||
|
":path": `/3/device/${input.token}`,
|
||||||
|
authorization: `bearer ${input.auth}`,
|
||||||
|
"apns-topic": input.bundle,
|
||||||
|
"apns-push-type": "alert",
|
||||||
|
"apns-priority": "10",
|
||||||
|
"content-type": "application/json",
|
||||||
|
})
|
||||||
|
|
||||||
|
req.setEncoding("utf8")
|
||||||
|
req.on("response", (headers) => {
|
||||||
|
code = Number(headers[":status"] ?? 0)
|
||||||
|
})
|
||||||
|
req.on("data", (chunk) => {
|
||||||
|
body += chunk
|
||||||
|
})
|
||||||
|
req.on("end", () => {
|
||||||
|
stop(() => resolve({ code, body }))
|
||||||
|
cli.close()
|
||||||
|
})
|
||||||
|
req.on("error", (err) => {
|
||||||
|
stop(() => reject(err))
|
||||||
|
cli.close()
|
||||||
|
})
|
||||||
|
req.end(input.payload)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function send(input: PushInput): Promise<PushResult> {
|
||||||
|
const apnsHost = host(input.env)
|
||||||
|
const suffix = tokenSuffix(input.token)
|
||||||
|
|
||||||
|
console.log("[ APN RELAY ] push:start", {
|
||||||
|
env: input.env,
|
||||||
|
host: apnsHost,
|
||||||
|
bundle: input.bundle,
|
||||||
|
tokenSuffix: suffix,
|
||||||
|
})
|
||||||
|
|
||||||
|
const auth = await sign().catch((err) => {
|
||||||
|
return `error:${String(err)}`
|
||||||
|
})
|
||||||
|
if (auth.startsWith("error:")) {
|
||||||
|
console.log("[ APN RELAY ] push:auth-failed", {
|
||||||
|
env: input.env,
|
||||||
|
host: apnsHost,
|
||||||
|
bundle: input.bundle,
|
||||||
|
tokenSuffix: suffix,
|
||||||
|
error: auth,
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
code: 0,
|
||||||
|
error: auth,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const payload = JSON.stringify({
|
||||||
|
aps: {
|
||||||
|
alert: {
|
||||||
|
title: input.title,
|
||||||
|
body: input.body,
|
||||||
|
},
|
||||||
|
sound: "alert.wav",
|
||||||
|
},
|
||||||
|
...input.data,
|
||||||
|
})
|
||||||
|
|
||||||
|
const out = await post({
|
||||||
|
host: apnsHost,
|
||||||
|
token: input.token,
|
||||||
|
auth,
|
||||||
|
bundle: input.bundle,
|
||||||
|
payload,
|
||||||
|
}).catch((err) => ({
|
||||||
|
code: 0,
|
||||||
|
body: String(err),
|
||||||
|
}))
|
||||||
|
|
||||||
|
if (out.code === 200) {
|
||||||
|
console.log("[ APN RELAY ] push:sent", {
|
||||||
|
env: input.env,
|
||||||
|
host: apnsHost,
|
||||||
|
bundle: input.bundle,
|
||||||
|
tokenSuffix: suffix,
|
||||||
|
code: out.code,
|
||||||
|
})
|
||||||
|
return {
|
||||||
|
ok: true,
|
||||||
|
code: 200,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("[ APN RELAY ] push:failed", {
|
||||||
|
env: input.env,
|
||||||
|
host: apnsHost,
|
||||||
|
bundle: input.bundle,
|
||||||
|
tokenSuffix: suffix,
|
||||||
|
code: out.code,
|
||||||
|
error: out.body,
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
ok: false,
|
||||||
|
code: out.code,
|
||||||
|
error: out.body,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { sql } from "drizzle-orm"
|
||||||
|
import { db } from "./db"
|
||||||
|
import { env } from "./env"
|
||||||
|
import { delivery_log, device_registration } from "./schema.sql"
|
||||||
|
import { setup } from "./setup"
|
||||||
|
|
||||||
|
async function run() {
|
||||||
|
console.log(`[apn-relay] DB host: ${env.DATABASE_HOST}`)
|
||||||
|
|
||||||
|
await db.execute(sql`SELECT 1`)
|
||||||
|
console.log("[apn-relay] DB connection OK")
|
||||||
|
|
||||||
|
await setup()
|
||||||
|
console.log("[apn-relay] Setup migration OK")
|
||||||
|
|
||||||
|
const [a] = await db.select({ value: sql<number>`count(*)` }).from(device_registration)
|
||||||
|
const [b] = await db.select({ value: sql<number>`count(*)` }).from(delivery_log)
|
||||||
|
|
||||||
|
console.log(`[apn-relay] device_registration rows: ${Number(a?.value ?? 0)}`)
|
||||||
|
console.log(`[apn-relay] delivery_log rows: ${Number(b?.value ?? 0)}`)
|
||||||
|
console.log("[apn-relay] DB check passed")
|
||||||
|
}
|
||||||
|
|
||||||
|
run().catch((err) => {
|
||||||
|
console.error("[apn-relay] DB check failed")
|
||||||
|
console.error(err)
|
||||||
|
process.exit(1)
|
||||||
|
})
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { Client } from "@planetscale/database"
|
||||||
|
import { drizzle } from "drizzle-orm/planetscale-serverless"
|
||||||
|
import { env } from "./env"
|
||||||
|
|
||||||
|
const client = new Client({
|
||||||
|
host: env.DATABASE_HOST,
|
||||||
|
username: env.DATABASE_USERNAME,
|
||||||
|
password: env.DATABASE_PASSWORD,
|
||||||
|
})
|
||||||
|
|
||||||
|
export const db = drizzle({ client })
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
import { z } from "zod"
|
||||||
|
|
||||||
|
const bad = new Set(["undefined", "null"])
|
||||||
|
const txt = z
|
||||||
|
.string()
|
||||||
|
.transform((input) => input.trim())
|
||||||
|
.refine((input) => input.length > 0 && !bad.has(input.toLowerCase()))
|
||||||
|
|
||||||
|
const schema = z.object({
|
||||||
|
PORT: z.coerce.number().int().positive().default(8787),
|
||||||
|
DATABASE_HOST: txt,
|
||||||
|
DATABASE_USERNAME: txt,
|
||||||
|
DATABASE_PASSWORD: txt,
|
||||||
|
APNS_TEAM_ID: txt,
|
||||||
|
APNS_KEY_ID: txt,
|
||||||
|
APNS_PRIVATE_KEY: txt,
|
||||||
|
APNS_DEFAULT_BUNDLE_ID: txt,
|
||||||
|
})
|
||||||
|
|
||||||
|
const req = [
|
||||||
|
"DATABASE_HOST",
|
||||||
|
"DATABASE_USERNAME",
|
||||||
|
"DATABASE_PASSWORD",
|
||||||
|
"APNS_TEAM_ID",
|
||||||
|
"APNS_KEY_ID",
|
||||||
|
"APNS_PRIVATE_KEY",
|
||||||
|
"APNS_DEFAULT_BUNDLE_ID",
|
||||||
|
] as const
|
||||||
|
|
||||||
|
const out = schema.safeParse(process.env)
|
||||||
|
|
||||||
|
if (!out.success) {
|
||||||
|
const miss = req.filter((key) => !process.env[key]?.trim())
|
||||||
|
const bad = out.error.issues
|
||||||
|
.map((item) => item.path[0])
|
||||||
|
.filter((key): key is string => typeof key === "string")
|
||||||
|
.filter((key) => !miss.includes(key as (typeof req)[number]))
|
||||||
|
|
||||||
|
console.error("[apn-relay] Invalid startup configuration")
|
||||||
|
if (miss.length) console.error(`[apn-relay] Missing required env vars: ${miss.join(", ")}`)
|
||||||
|
if (bad.length) console.error(`[apn-relay] Invalid env vars: ${Array.from(new Set(bad)).join(", ")}`)
|
||||||
|
console.error("[apn-relay] Check .env.example and restart")
|
||||||
|
|
||||||
|
throw new Error("Startup configuration invalid")
|
||||||
|
}
|
||||||
|
|
||||||
|
export const env = out.data
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { createHash } from "node:crypto"
|
||||||
|
|
||||||
|
export function hash(input: string) {
|
||||||
|
return createHash("sha256").update(input).digest("hex")
|
||||||
|
}
|
||||||
@@ -0,0 +1,448 @@
|
|||||||
|
import { randomUUID } from "node:crypto"
|
||||||
|
import { and, desc, eq, sql } from "drizzle-orm"
|
||||||
|
import { Hono } from "hono"
|
||||||
|
import { z } from "zod"
|
||||||
|
import { send } from "./apns"
|
||||||
|
import { db } from "./db"
|
||||||
|
import { env } from "./env"
|
||||||
|
import { hash } from "./hash"
|
||||||
|
import { delivery_log, device_registration } from "./schema.sql"
|
||||||
|
import { setup } from "./setup"
|
||||||
|
|
||||||
|
function bad(input?: string) {
|
||||||
|
if (!input) return false
|
||||||
|
return input.includes("BadEnvironmentKeyInToken")
|
||||||
|
}
|
||||||
|
|
||||||
|
function flip(input: "sandbox" | "production") {
|
||||||
|
if (input === "sandbox") return "production"
|
||||||
|
return "sandbox"
|
||||||
|
}
|
||||||
|
|
||||||
|
function tail(input: string) {
|
||||||
|
return input.slice(-8)
|
||||||
|
}
|
||||||
|
|
||||||
|
function esc(input: unknown) {
|
||||||
|
return String(input ?? "")
|
||||||
|
.replaceAll("&", "&")
|
||||||
|
.replaceAll("<", "<")
|
||||||
|
.replaceAll(">", ">")
|
||||||
|
.replaceAll('"', """)
|
||||||
|
.replaceAll("'", "'")
|
||||||
|
}
|
||||||
|
|
||||||
|
function fmt(input: number) {
|
||||||
|
return new Date(input).toISOString()
|
||||||
|
}
|
||||||
|
|
||||||
|
const reg = z.object({
|
||||||
|
secret: z.string().min(1),
|
||||||
|
deviceToken: z.string().min(1),
|
||||||
|
bundleId: z.string().min(1).optional(),
|
||||||
|
apnsEnv: z.enum(["sandbox", "production"]).default("production"),
|
||||||
|
})
|
||||||
|
|
||||||
|
const unreg = z.object({
|
||||||
|
secret: z.string().min(1),
|
||||||
|
deviceToken: z.string().min(1),
|
||||||
|
})
|
||||||
|
|
||||||
|
const evt = z.object({
|
||||||
|
secret: z.string().min(1),
|
||||||
|
serverID: z.string().min(1).optional(),
|
||||||
|
eventType: z.enum(["complete", "permission", "error"]),
|
||||||
|
sessionID: z.string().min(1),
|
||||||
|
title: z.string().min(1).optional(),
|
||||||
|
body: z.string().min(1).optional(),
|
||||||
|
})
|
||||||
|
|
||||||
|
function title(input: z.infer<typeof evt>["eventType"]) {
|
||||||
|
if (input === "complete") return "Session complete"
|
||||||
|
if (input === "permission") return "Action needed"
|
||||||
|
return "Session error"
|
||||||
|
}
|
||||||
|
|
||||||
|
function body(input: z.infer<typeof evt>["eventType"]) {
|
||||||
|
if (input === "complete") return "OpenCode finished your session."
|
||||||
|
if (input === "permission") return "OpenCode needs your permission decision."
|
||||||
|
return "OpenCode reported an error for your session."
|
||||||
|
}
|
||||||
|
|
||||||
|
const app = new Hono()
|
||||||
|
|
||||||
|
app.onError((err, c) => {
|
||||||
|
return c.json(
|
||||||
|
{
|
||||||
|
ok: false,
|
||||||
|
error: err.message,
|
||||||
|
},
|
||||||
|
500,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
app.notFound((c) => {
|
||||||
|
return c.json(
|
||||||
|
{
|
||||||
|
ok: false,
|
||||||
|
error: "Not found",
|
||||||
|
},
|
||||||
|
404,
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get("/health", async (c) => {
|
||||||
|
const [a] = await db.select({ value: sql<number>`count(*)` }).from(device_registration)
|
||||||
|
const [b] = await db.select({ value: sql<number>`count(*)` }).from(delivery_log)
|
||||||
|
return c.json({
|
||||||
|
ok: true,
|
||||||
|
devices: Number(a?.value ?? 0),
|
||||||
|
deliveries: Number(b?.value ?? 0),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
app.get("/", async (c) => {
|
||||||
|
const [a] = await db.select({ value: sql<number>`count(*)` }).from(device_registration)
|
||||||
|
const [b] = await db.select({ value: sql<number>`count(*)` }).from(delivery_log)
|
||||||
|
const devices = await db.select().from(device_registration).orderBy(desc(device_registration.updated_at)).limit(100)
|
||||||
|
const byBundle = await db
|
||||||
|
.select({
|
||||||
|
bundle: device_registration.bundle_id,
|
||||||
|
env: device_registration.apns_env,
|
||||||
|
value: sql<number>`count(*)`,
|
||||||
|
})
|
||||||
|
.from(device_registration)
|
||||||
|
.groupBy(device_registration.bundle_id, device_registration.apns_env)
|
||||||
|
.orderBy(desc(sql<number>`count(*)`))
|
||||||
|
const rows = await db.select().from(delivery_log).orderBy(desc(delivery_log.created_at)).limit(20)
|
||||||
|
|
||||||
|
const html = `<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>APN Relay</title>
|
||||||
|
<style>
|
||||||
|
body { font-family: ui-sans-serif, system-ui, sans-serif; margin: 24px; color: #111827; }
|
||||||
|
h1 { margin: 0 0 12px 0; }
|
||||||
|
h2 { margin: 22px 0 10px 0; font-size: 16px; }
|
||||||
|
.stats { display: flex; gap: 16px; margin: 0 0 18px 0; }
|
||||||
|
.card { border: 1px solid #e5e7eb; border-radius: 8px; padding: 10px 12px; min-width: 160px; }
|
||||||
|
.muted { color: #6b7280; font-size: 12px; }
|
||||||
|
.small { font-size: 11px; color: #6b7280; }
|
||||||
|
table { border-collapse: collapse; width: 100%; }
|
||||||
|
th, td { border: 1px solid #e5e7eb; text-align: left; padding: 8px; font-size: 12px; }
|
||||||
|
th { background: #f9fafb; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>APN Relay</h1>
|
||||||
|
<p class="muted">MVP dashboard</p>
|
||||||
|
<div class="stats">
|
||||||
|
<div class="card">
|
||||||
|
<div class="muted">Registered devices</div>
|
||||||
|
<div>${Number(a?.value ?? 0)}</div>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<div class="muted">Delivery log rows</div>
|
||||||
|
<div>${Number(b?.value ?? 0)}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<h2>Registered devices</h2>
|
||||||
|
<p class="small">Most recent 100 registrations. Token values are masked to suffix only.</p>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>updated</th>
|
||||||
|
<th>created</th>
|
||||||
|
<th>token suffix</th>
|
||||||
|
<th>env</th>
|
||||||
|
<th>bundle</th>
|
||||||
|
<th>secret hash</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
${
|
||||||
|
devices.length
|
||||||
|
? devices
|
||||||
|
.map(
|
||||||
|
(row) => `<tr>
|
||||||
|
<td>${esc(fmt(row.updated_at))}</td>
|
||||||
|
<td>${esc(fmt(row.created_at))}</td>
|
||||||
|
<td>${esc(tail(row.device_token))}</td>
|
||||||
|
<td>${esc(row.apns_env)}</td>
|
||||||
|
<td>${esc(row.bundle_id)}</td>
|
||||||
|
<td>${esc(`${row.secret_hash.slice(0, 12)}…`)}</td>
|
||||||
|
</tr>`,
|
||||||
|
)
|
||||||
|
.join("")
|
||||||
|
: `<tr><td colspan="6" class="muted">No devices registered.</td></tr>`
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<h2>Bundle breakdown</h2>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>bundle</th>
|
||||||
|
<th>env</th>
|
||||||
|
<th>count</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
${
|
||||||
|
byBundle.length
|
||||||
|
? byBundle
|
||||||
|
.map(
|
||||||
|
(row) => `<tr>
|
||||||
|
<td>${esc(row.bundle)}</td>
|
||||||
|
<td>${esc(row.env)}</td>
|
||||||
|
<td>${esc(Number(row.value ?? 0))}</td>
|
||||||
|
</tr>`,
|
||||||
|
)
|
||||||
|
.join("")
|
||||||
|
: `<tr><td colspan="3" class="muted">No device data.</td></tr>`
|
||||||
|
}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<h2>Recent deliveries</h2>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>time</th>
|
||||||
|
<th>event</th>
|
||||||
|
<th>session</th>
|
||||||
|
<th>status</th>
|
||||||
|
<th>error</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
${rows
|
||||||
|
.map(
|
||||||
|
(row) => `<tr>
|
||||||
|
<td>${esc(fmt(row.created_at))}</td>
|
||||||
|
<td>${esc(row.event_type)}</td>
|
||||||
|
<td>${esc(row.session_id)}</td>
|
||||||
|
<td>${esc(row.status)}</td>
|
||||||
|
<td>${esc(row.error ?? "")}</td>
|
||||||
|
</tr>`,
|
||||||
|
)
|
||||||
|
.join("")}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>`
|
||||||
|
|
||||||
|
return c.html(html)
|
||||||
|
})
|
||||||
|
|
||||||
|
app.post("/v1/device/register", async (c) => {
|
||||||
|
const raw = await c.req.json().catch(() => undefined)
|
||||||
|
const check = reg.safeParse(raw)
|
||||||
|
if (!check.success) {
|
||||||
|
return c.json(
|
||||||
|
{
|
||||||
|
ok: false,
|
||||||
|
error: "Invalid request body",
|
||||||
|
},
|
||||||
|
400,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const now = Date.now()
|
||||||
|
const key = hash(check.data.secret)
|
||||||
|
const row = {
|
||||||
|
id: randomUUID(),
|
||||||
|
secret_hash: key,
|
||||||
|
device_token: check.data.deviceToken,
|
||||||
|
bundle_id: check.data.bundleId ?? env.APNS_DEFAULT_BUNDLE_ID,
|
||||||
|
apns_env: check.data.apnsEnv,
|
||||||
|
created_at: now,
|
||||||
|
updated_at: now,
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("[relay] register", {
|
||||||
|
token: tail(row.device_token),
|
||||||
|
env: row.apns_env,
|
||||||
|
bundle: row.bundle_id,
|
||||||
|
secretHash: `${key.slice(0, 12)}...`,
|
||||||
|
})
|
||||||
|
|
||||||
|
await db
|
||||||
|
.insert(device_registration)
|
||||||
|
.values(row)
|
||||||
|
.onDuplicateKeyUpdate({
|
||||||
|
set: {
|
||||||
|
bundle_id: row.bundle_id,
|
||||||
|
apns_env: row.apns_env,
|
||||||
|
updated_at: now,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
return c.json({ ok: true })
|
||||||
|
})
|
||||||
|
|
||||||
|
app.post("/v1/device/unregister", async (c) => {
|
||||||
|
const raw = await c.req.json().catch(() => undefined)
|
||||||
|
const check = unreg.safeParse(raw)
|
||||||
|
if (!check.success) {
|
||||||
|
return c.json(
|
||||||
|
{
|
||||||
|
ok: false,
|
||||||
|
error: "Invalid request body",
|
||||||
|
},
|
||||||
|
400,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const key = hash(check.data.secret)
|
||||||
|
|
||||||
|
console.log("[relay] unregister", {
|
||||||
|
token: tail(check.data.deviceToken),
|
||||||
|
secretHash: `${key.slice(0, 12)}...`,
|
||||||
|
})
|
||||||
|
|
||||||
|
await db
|
||||||
|
.delete(device_registration)
|
||||||
|
.where(and(eq(device_registration.secret_hash, key), eq(device_registration.device_token, check.data.deviceToken)))
|
||||||
|
|
||||||
|
return c.json({ ok: true })
|
||||||
|
})
|
||||||
|
|
||||||
|
app.post("/v1/event", async (c) => {
|
||||||
|
const raw = await c.req.json().catch(() => undefined)
|
||||||
|
const check = evt.safeParse(raw)
|
||||||
|
if (!check.success) {
|
||||||
|
return c.json(
|
||||||
|
{
|
||||||
|
ok: false,
|
||||||
|
error: "Invalid request body",
|
||||||
|
},
|
||||||
|
400,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
const key = hash(check.data.secret)
|
||||||
|
const list = await db.select().from(device_registration).where(eq(device_registration.secret_hash, key))
|
||||||
|
console.log("[relay] event", {
|
||||||
|
type: check.data.eventType,
|
||||||
|
serverID: check.data.serverID,
|
||||||
|
session: check.data.sessionID,
|
||||||
|
secretHash: `${key.slice(0, 12)}...`,
|
||||||
|
devices: list.length,
|
||||||
|
})
|
||||||
|
if (!list.length) {
|
||||||
|
const [total] = await db.select({ value: sql<number>`count(*)` }).from(device_registration)
|
||||||
|
console.log("[relay] event:no-matching-devices", {
|
||||||
|
type: check.data.eventType,
|
||||||
|
serverID: check.data.serverID,
|
||||||
|
session: check.data.sessionID,
|
||||||
|
secretHash: `${key.slice(0, 12)}...`,
|
||||||
|
totalDevices: Number(total?.value ?? 0),
|
||||||
|
})
|
||||||
|
|
||||||
|
return c.json({
|
||||||
|
ok: true,
|
||||||
|
sent: 0,
|
||||||
|
failed: 0,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const out = await Promise.all(
|
||||||
|
list.map(async (row) => {
|
||||||
|
const env = row.apns_env === "sandbox" ? "sandbox" : "production"
|
||||||
|
const payload = {
|
||||||
|
token: row.device_token,
|
||||||
|
bundle: row.bundle_id,
|
||||||
|
title: check.data.title ?? title(check.data.eventType),
|
||||||
|
body: check.data.body ?? body(check.data.eventType),
|
||||||
|
data: {
|
||||||
|
serverID: check.data.serverID,
|
||||||
|
eventType: check.data.eventType,
|
||||||
|
sessionID: check.data.sessionID,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
const first = await send({ ...payload, env })
|
||||||
|
if (first.ok || !bad(first.error)) {
|
||||||
|
if (!first.ok) {
|
||||||
|
console.log("[relay] send:error", {
|
||||||
|
token: tail(row.device_token),
|
||||||
|
env,
|
||||||
|
error: first.error,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return first
|
||||||
|
}
|
||||||
|
|
||||||
|
const alt = flip(env)
|
||||||
|
console.log("[relay] send:retry-env", {
|
||||||
|
token: tail(row.device_token),
|
||||||
|
from: env,
|
||||||
|
to: alt,
|
||||||
|
})
|
||||||
|
const second = await send({ ...payload, env: alt })
|
||||||
|
if (!second.ok) {
|
||||||
|
console.log("[relay] send:error", {
|
||||||
|
token: tail(row.device_token),
|
||||||
|
env: alt,
|
||||||
|
error: second.error,
|
||||||
|
})
|
||||||
|
return second
|
||||||
|
}
|
||||||
|
|
||||||
|
await db
|
||||||
|
.update(device_registration)
|
||||||
|
.set({ apns_env: alt, updated_at: Date.now() })
|
||||||
|
.where(
|
||||||
|
and(
|
||||||
|
eq(device_registration.secret_hash, row.secret_hash),
|
||||||
|
eq(device_registration.device_token, row.device_token),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
console.log("[relay] send:env-updated", {
|
||||||
|
token: tail(row.device_token),
|
||||||
|
env: alt,
|
||||||
|
})
|
||||||
|
return second
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
|
||||||
|
const now = Date.now()
|
||||||
|
await db.insert(delivery_log).values(
|
||||||
|
out.map((item) => ({
|
||||||
|
id: randomUUID(),
|
||||||
|
secret_hash: key,
|
||||||
|
event_type: check.data.eventType,
|
||||||
|
session_id: check.data.sessionID,
|
||||||
|
status: item.ok ? "sent" : "failed",
|
||||||
|
error: item.error,
|
||||||
|
created_at: now,
|
||||||
|
})),
|
||||||
|
)
|
||||||
|
|
||||||
|
const sent = out.filter((item) => item.ok).length
|
||||||
|
console.log("[relay] event:done", {
|
||||||
|
type: check.data.eventType,
|
||||||
|
session: check.data.sessionID,
|
||||||
|
sent,
|
||||||
|
failed: out.length - sent,
|
||||||
|
})
|
||||||
|
return c.json({
|
||||||
|
ok: true,
|
||||||
|
sent,
|
||||||
|
failed: out.length - sent,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
await setup()
|
||||||
|
|
||||||
|
if (import.meta.main) {
|
||||||
|
Bun.serve({
|
||||||
|
port: env.PORT,
|
||||||
|
fetch: app.fetch,
|
||||||
|
})
|
||||||
|
console.log(`apn-relay listening on http://0.0.0.0:${env.PORT}`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export { app }
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import { bigint, index, mysqlTable, uniqueIndex, varchar } from "drizzle-orm/mysql-core"
|
||||||
|
|
||||||
|
export const device_registration = mysqlTable(
|
||||||
|
"device_registration",
|
||||||
|
{
|
||||||
|
id: varchar("id", { length: 36 }).primaryKey(),
|
||||||
|
secret_hash: varchar("secret_hash", { length: 64 }).notNull(),
|
||||||
|
device_token: varchar("device_token", { length: 255 }).notNull(),
|
||||||
|
bundle_id: varchar("bundle_id", { length: 255 }).notNull(),
|
||||||
|
apns_env: varchar("apns_env", { length: 16 }).notNull().default("production"),
|
||||||
|
created_at: bigint("created_at", { mode: "number" }).notNull(),
|
||||||
|
updated_at: bigint("updated_at", { mode: "number" }).notNull(),
|
||||||
|
},
|
||||||
|
(table) => [
|
||||||
|
uniqueIndex("device_registration_secret_token_idx").on(table.secret_hash, table.device_token),
|
||||||
|
index("device_registration_secret_hash_idx").on(table.secret_hash),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
export const delivery_log = mysqlTable(
|
||||||
|
"delivery_log",
|
||||||
|
{
|
||||||
|
id: varchar("id", { length: 36 }).primaryKey(),
|
||||||
|
secret_hash: varchar("secret_hash", { length: 64 }).notNull(),
|
||||||
|
event_type: varchar("event_type", { length: 32 }).notNull(),
|
||||||
|
session_id: varchar("session_id", { length: 255 }).notNull(),
|
||||||
|
status: varchar("status", { length: 16 }).notNull(),
|
||||||
|
error: varchar("error", { length: 1024 }),
|
||||||
|
created_at: bigint("created_at", { mode: "number" }).notNull(),
|
||||||
|
},
|
||||||
|
(table) => [
|
||||||
|
index("delivery_log_secret_hash_idx").on(table.secret_hash),
|
||||||
|
index("delivery_log_created_at_idx").on(table.created_at),
|
||||||
|
],
|
||||||
|
)
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import { sql } from "drizzle-orm"
|
||||||
|
import { db } from "./db"
|
||||||
|
|
||||||
|
export async function setup() {
|
||||||
|
await db.execute(sql`
|
||||||
|
CREATE TABLE IF NOT EXISTS device_registration (
|
||||||
|
id varchar(36) NOT NULL,
|
||||||
|
secret_hash varchar(64) NOT NULL,
|
||||||
|
device_token varchar(255) NOT NULL,
|
||||||
|
bundle_id varchar(255) NOT NULL,
|
||||||
|
apns_env varchar(16) NOT NULL DEFAULT 'production',
|
||||||
|
created_at bigint NOT NULL,
|
||||||
|
updated_at bigint NOT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
UNIQUE KEY device_registration_secret_token_idx (secret_hash, device_token),
|
||||||
|
KEY device_registration_secret_hash_idx (secret_hash)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
`)
|
||||||
|
|
||||||
|
await db.execute(sql`
|
||||||
|
CREATE TABLE IF NOT EXISTS delivery_log (
|
||||||
|
id varchar(36) NOT NULL,
|
||||||
|
secret_hash varchar(64) NOT NULL,
|
||||||
|
event_type varchar(32) NOT NULL,
|
||||||
|
session_id varchar(255) NOT NULL,
|
||||||
|
status varchar(16) NOT NULL,
|
||||||
|
error varchar(1024) NULL,
|
||||||
|
created_at bigint NOT NULL,
|
||||||
|
PRIMARY KEY (id),
|
||||||
|
KEY delivery_log_secret_hash_idx (secret_hash),
|
||||||
|
KEY delivery_log_created_at_idx (created_at)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
`)
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
"$schema": "https://json.schemastore.org/tsconfig",
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
"extends": "@tsconfig/bun/tsconfig.json",
|
"extends": "@tsconfig/bun/tsconfig.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"lib": ["ESNext", "DOM", "DOM.Iterable"],
|
||||||
"noUncheckedIndexedAccess": false
|
"noUncheckedIndexedAccess": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@opencode-ai/app",
|
"name": "@opencode-ai/app",
|
||||||
"version": "1.14.42",
|
"version": "1.14.18",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"exports": {
|
"exports": {
|
||||||
@@ -27,7 +27,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@happy-dom/global-registrator": "20.0.11",
|
"@happy-dom/global-registrator": "20.0.11",
|
||||||
"@playwright/test": "catalog:",
|
"@playwright/test": "catalog:",
|
||||||
"@sentry/vite-plugin": "catalog:",
|
|
||||||
"@tailwindcss/vite": "catalog:",
|
"@tailwindcss/vite": "catalog:",
|
||||||
"@tsconfig/bun": "1.0.9",
|
"@tsconfig/bun": "1.0.9",
|
||||||
"@types/bun": "catalog:",
|
"@types/bun": "catalog:",
|
||||||
@@ -41,10 +40,9 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kobalte/core": "catalog:",
|
"@kobalte/core": "catalog:",
|
||||||
"@sentry/solid": "catalog:",
|
|
||||||
"@opencode-ai/sdk": "workspace:*",
|
"@opencode-ai/sdk": "workspace:*",
|
||||||
"@opencode-ai/ui": "workspace:*",
|
"@opencode-ai/ui": "workspace:*",
|
||||||
"@opencode-ai/core": "workspace:*",
|
"@opencode-ai/shared": "workspace:*",
|
||||||
"@shikijs/transformers": "3.9.2",
|
"@shikijs/transformers": "3.9.2",
|
||||||
"@solid-primitives/active-element": "2.1.3",
|
"@solid-primitives/active-element": "2.1.3",
|
||||||
"@solid-primitives/audio": "1.4.2",
|
"@solid-primitives/audio": "1.4.2",
|
||||||
|
|||||||
+16
-32
@@ -1,5 +1,4 @@
|
|||||||
import "@/index.css"
|
import "@/index.css"
|
||||||
import * as Sentry from "@sentry/solid"
|
|
||||||
import { I18nProvider } from "@opencode-ai/ui/context"
|
import { I18nProvider } from "@opencode-ai/ui/context"
|
||||||
import { DialogProvider } from "@opencode-ai/ui/context/dialog"
|
import { DialogProvider } from "@opencode-ai/ui/context/dialog"
|
||||||
import { FileComponentProvider } from "@opencode-ai/ui/context/file"
|
import { FileComponentProvider } from "@opencode-ai/ui/context/file"
|
||||||
@@ -83,15 +82,7 @@ declare global {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function QueryProvider(props: ParentProps) {
|
function QueryProvider(props: ParentProps) {
|
||||||
const client = new QueryClient({
|
const client = new QueryClient()
|
||||||
defaultOptions: {
|
|
||||||
queries: {
|
|
||||||
refetchOnReconnect: false,
|
|
||||||
refetchOnMount: false,
|
|
||||||
refetchOnWindowFocus: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
return <QueryClientProvider client={client}>{props.children}</QueryClientProvider>
|
return <QueryClientProvider client={client}>{props.children}</QueryClientProvider>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,12 +140,7 @@ export function AppBaseProviders(props: ParentProps<{ locale?: Locale }>) {
|
|||||||
>
|
>
|
||||||
<LanguageProvider locale={props.locale}>
|
<LanguageProvider locale={props.locale}>
|
||||||
<UiI18nBridge>
|
<UiI18nBridge>
|
||||||
<ErrorBoundary
|
<ErrorBoundary fallback={(error) => <ErrorPage error={error} />}>
|
||||||
fallback={(error) => {
|
|
||||||
Sentry.captureException(error)
|
|
||||||
return <ErrorPage error={error} />
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<QueryProvider>
|
<QueryProvider>
|
||||||
<DialogProvider>
|
<DialogProvider>
|
||||||
<MarkedProvider>
|
<MarkedProvider>
|
||||||
@@ -307,22 +293,20 @@ export function AppInterface(props: {
|
|||||||
>
|
>
|
||||||
<ConnectionGate disableHealthCheck={props.disableHealthCheck}>
|
<ConnectionGate disableHealthCheck={props.disableHealthCheck}>
|
||||||
<ServerKey>
|
<ServerKey>
|
||||||
<QueryProvider>
|
<GlobalSDKProvider>
|
||||||
<GlobalSDKProvider>
|
<GlobalSyncProvider>
|
||||||
<GlobalSyncProvider>
|
<Dynamic
|
||||||
<Dynamic
|
component={props.router ?? Router}
|
||||||
component={props.router ?? Router}
|
root={(routerProps) => <RouterRoot appChildren={props.children}>{routerProps.children}</RouterRoot>}
|
||||||
root={(routerProps) => <RouterRoot appChildren={props.children}>{routerProps.children}</RouterRoot>}
|
>
|
||||||
>
|
<Route path="/" component={HomeRoute} />
|
||||||
<Route path="/" component={HomeRoute} />
|
<Route path="/:dir" component={DirectoryLayout}>
|
||||||
<Route path="/:dir" component={DirectoryLayout}>
|
<Route path="/" component={SessionIndexRoute} />
|
||||||
<Route path="/" component={SessionIndexRoute} />
|
<Route path="/session/:id?" component={SessionRoute} />
|
||||||
<Route path="/session/:id?" component={SessionRoute} />
|
</Route>
|
||||||
</Route>
|
</Dynamic>
|
||||||
</Dynamic>
|
</GlobalSyncProvider>
|
||||||
</GlobalSyncProvider>
|
</GlobalSDKProvider>
|
||||||
</GlobalSDKProvider>
|
|
||||||
</QueryProvider>
|
|
||||||
</ServerKey>
|
</ServerKey>
|
||||||
</ConnectionGate>
|
</ConnectionGate>
|
||||||
</ServerProvider>
|
</ServerProvider>
|
||||||
|
|||||||
@@ -9,10 +9,9 @@ import { createStore } from "solid-js/store"
|
|||||||
import { useGlobalSDK } from "@/context/global-sdk"
|
import { useGlobalSDK } from "@/context/global-sdk"
|
||||||
import { useGlobalSync } from "@/context/global-sync"
|
import { useGlobalSync } from "@/context/global-sync"
|
||||||
import { type LocalProject, getAvatarColors } from "@/context/layout"
|
import { type LocalProject, getAvatarColors } from "@/context/layout"
|
||||||
import { getFilename } from "@opencode-ai/core/util/path"
|
import { getFilename } from "@opencode-ai/shared/util/path"
|
||||||
import { Avatar } from "@opencode-ai/ui/avatar"
|
import { Avatar } from "@opencode-ai/ui/avatar"
|
||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
import { getProjectAvatarSource } from "@/pages/layout/sidebar-items"
|
|
||||||
|
|
||||||
const AVATAR_COLOR_KEYS = ["pink", "mint", "orange", "purple", "cyan", "lime"] as const
|
const AVATAR_COLOR_KEYS = ["pink", "mint", "orange", "purple", "cyan", "lime"] as const
|
||||||
|
|
||||||
@@ -27,8 +26,8 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
|
|
||||||
const [store, setStore] = createStore({
|
const [store, setStore] = createStore({
|
||||||
name: defaultName(),
|
name: defaultName(),
|
||||||
color: props.project.icon?.color,
|
color: props.project.icon?.color || "pink",
|
||||||
iconOverride: props.project.icon?.override,
|
iconUrl: props.project.icon?.override || "",
|
||||||
startup: props.project.commands?.start ?? "",
|
startup: props.project.commands?.start ?? "",
|
||||||
dragOver: false,
|
dragOver: false,
|
||||||
iconHover: false,
|
iconHover: false,
|
||||||
@@ -40,7 +39,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
if (!file.type.startsWith("image/")) return
|
if (!file.type.startsWith("image/")) return
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.onload = (e) => {
|
reader.onload = (e) => {
|
||||||
setStore("iconOverride", e.target?.result as string)
|
setStore("iconUrl", e.target?.result as string)
|
||||||
setStore("iconHover", false)
|
setStore("iconHover", false)
|
||||||
}
|
}
|
||||||
reader.readAsDataURL(file)
|
reader.readAsDataURL(file)
|
||||||
@@ -69,7 +68,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearIcon() {
|
function clearIcon() {
|
||||||
setStore("iconOverride", "")
|
setStore("iconUrl", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
const saveMutation = useMutation(() => ({
|
const saveMutation = useMutation(() => ({
|
||||||
@@ -82,17 +81,17 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
projectID: props.project.id,
|
projectID: props.project.id,
|
||||||
directory: props.project.worktree,
|
directory: props.project.worktree,
|
||||||
name,
|
name,
|
||||||
icon: { color: store.color || "", override: store.iconOverride || "" },
|
icon: { color: store.color, override: store.iconUrl },
|
||||||
commands: { start },
|
commands: { start },
|
||||||
})
|
})
|
||||||
globalSync.project.icon(props.project.worktree, store.iconOverride || undefined)
|
globalSync.project.icon(props.project.worktree, store.iconUrl || undefined)
|
||||||
dialog.close()
|
dialog.close()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
globalSync.project.meta(props.project.worktree, {
|
globalSync.project.meta(props.project.worktree, {
|
||||||
name,
|
name,
|
||||||
icon: { color: store.color || undefined, override: store.iconOverride || undefined },
|
icon: { color: store.color, override: store.iconUrl || undefined },
|
||||||
commands: { start: start || undefined },
|
commands: { start: start || undefined },
|
||||||
})
|
})
|
||||||
dialog.close()
|
dialog.close()
|
||||||
@@ -131,13 +130,13 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
classList={{
|
classList={{
|
||||||
"border-text-interactive-base bg-surface-info-base/20": store.dragOver,
|
"border-text-interactive-base bg-surface-info-base/20": store.dragOver,
|
||||||
"border-border-base hover:border-border-strong": !store.dragOver,
|
"border-border-base hover:border-border-strong": !store.dragOver,
|
||||||
"overflow-hidden": !!store.iconOverride,
|
"overflow-hidden": !!store.iconUrl,
|
||||||
}}
|
}}
|
||||||
onDrop={handleDrop}
|
onDrop={handleDrop}
|
||||||
onDragOver={handleDragOver}
|
onDragOver={handleDragOver}
|
||||||
onDragLeave={handleDragLeave}
|
onDragLeave={handleDragLeave}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (store.iconOverride && store.iconHover) {
|
if (store.iconUrl && store.iconHover) {
|
||||||
clearIcon()
|
clearIcon()
|
||||||
} else {
|
} else {
|
||||||
iconInput?.click()
|
iconInput?.click()
|
||||||
@@ -145,11 +144,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Show
|
<Show
|
||||||
when={getProjectAvatarSource(props.project.id, {
|
when={store.iconUrl}
|
||||||
color: store.color,
|
|
||||||
url: props.project.icon?.url,
|
|
||||||
override: store.iconOverride,
|
|
||||||
})}
|
|
||||||
fallback={
|
fallback={
|
||||||
<div class="size-full flex items-center justify-center">
|
<div class="size-full flex items-center justify-center">
|
||||||
<Avatar
|
<Avatar
|
||||||
@@ -160,20 +155,18 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{(src) => (
|
<img
|
||||||
<img
|
src={store.iconUrl}
|
||||||
src={src()}
|
alt={language.t("dialog.project.edit.icon.alt")}
|
||||||
alt={language.t("dialog.project.edit.icon.alt")}
|
class="size-full object-cover"
|
||||||
class="size-full object-cover"
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"
|
class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"
|
||||||
classList={{
|
classList={{
|
||||||
"opacity-100": store.iconHover && !store.iconOverride,
|
"opacity-100": store.iconHover && !store.iconUrl,
|
||||||
"opacity-0": !(store.iconHover && !store.iconOverride),
|
"opacity-0": !(store.iconHover && !store.iconUrl),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon name="cloud-upload" size="large" class="text-icon-on-interactive-base drop-shadow-sm" />
|
<Icon name="cloud-upload" size="large" class="text-icon-on-interactive-base drop-shadow-sm" />
|
||||||
@@ -181,8 +174,8 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
<div
|
<div
|
||||||
class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"
|
class="absolute inset-0 size-16 bg-surface-raised-stronger-non-alpha/90 rounded-[6px] z-10 pointer-events-none flex items-center justify-center transition-opacity"
|
||||||
classList={{
|
classList={{
|
||||||
"opacity-100": store.iconHover && !!store.iconOverride,
|
"opacity-100": store.iconHover && !!store.iconUrl,
|
||||||
"opacity-0": !(store.iconHover && !!store.iconOverride),
|
"opacity-0": !(store.iconHover && !!store.iconUrl),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon name="trash" size="large" class="text-icon-on-interactive-base drop-shadow-sm" />
|
<Icon name="trash" size="large" class="text-icon-on-interactive-base drop-shadow-sm" />
|
||||||
@@ -205,7 +198,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Show when={!store.iconOverride}>
|
<Show when={!store.iconUrl}>
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<label class="text-12-medium text-text-weak">{language.t("dialog.project.edit.color")}</label>
|
<label class="text-12-medium text-text-weak">{language.t("dialog.project.edit.color")}</label>
|
||||||
<div class="flex gap-1.5">
|
<div class="flex gap-1.5">
|
||||||
@@ -222,10 +215,7 @@ export function DialogEditProject(props: { project: LocalProject }) {
|
|||||||
"bg-transparent border border-transparent hover:bg-surface-base-hover hover:border-border-weak-base":
|
"bg-transparent border border-transparent hover:bg-surface-base-hover hover:border-border-weak-base":
|
||||||
store.color !== color,
|
store.color !== color,
|
||||||
}}
|
}}
|
||||||
onClick={() => {
|
onClick={() => setStore("color", color)}
|
||||||
if (store.color === color && !props.project.icon?.url) return
|
|
||||||
setStore("color", store.color === color ? undefined : color)
|
|
||||||
}}
|
|
||||||
>
|
>
|
||||||
<Avatar
|
<Avatar
|
||||||
fallback={store.name || defaultName()}
|
fallback={store.name || defaultName()}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { List } from "@opencode-ai/ui/list"
|
|||||||
import { showToast } from "@opencode-ai/ui/toast"
|
import { showToast } from "@opencode-ai/ui/toast"
|
||||||
import { extractPromptFromParts } from "@/utils/prompt"
|
import { extractPromptFromParts } from "@/utils/prompt"
|
||||||
import type { TextPart as SDKTextPart } from "@opencode-ai/sdk/v2/client"
|
import type { TextPart as SDKTextPart } from "@opencode-ai/sdk/v2/client"
|
||||||
import { base64Encode } from "@opencode-ai/core/util/encode"
|
import { base64Encode } from "@opencode-ai/shared/util/encode"
|
||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
|
|
||||||
interface ForkableMessage {
|
interface ForkableMessage {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Dialog } from "@opencode-ai/ui/dialog"
|
|||||||
import { FileIcon } from "@opencode-ai/ui/file-icon"
|
import { FileIcon } from "@opencode-ai/ui/file-icon"
|
||||||
import { List } from "@opencode-ai/ui/list"
|
import { List } from "@opencode-ai/ui/list"
|
||||||
import type { ListRef } from "@opencode-ai/ui/list"
|
import type { ListRef } from "@opencode-ai/ui/list"
|
||||||
import { getDirectory, getFilename } from "@opencode-ai/core/util/path"
|
import { getDirectory, getFilename } from "@opencode-ai/shared/util/path"
|
||||||
import fuzzysort from "fuzzysort"
|
import fuzzysort from "fuzzysort"
|
||||||
import { createMemo, createResource, createSignal } from "solid-js"
|
import { createMemo, createResource, createSignal } from "solid-js"
|
||||||
import { useGlobalSDK } from "@/context/global-sdk"
|
import { useGlobalSDK } from "@/context/global-sdk"
|
||||||
|
|||||||
@@ -4,8 +4,8 @@ import { FileIcon } from "@opencode-ai/ui/file-icon"
|
|||||||
import { Icon } from "@opencode-ai/ui/icon"
|
import { Icon } from "@opencode-ai/ui/icon"
|
||||||
import { Keybind } from "@opencode-ai/ui/keybind"
|
import { Keybind } from "@opencode-ai/ui/keybind"
|
||||||
import { List } from "@opencode-ai/ui/list"
|
import { List } from "@opencode-ai/ui/list"
|
||||||
import { base64Encode } from "@opencode-ai/core/util/encode"
|
import { base64Encode } from "@opencode-ai/shared/util/encode"
|
||||||
import { getDirectory, getFilename } from "@opencode-ai/core/util/path"
|
import { getDirectory, getFilename } from "@opencode-ai/shared/util/path"
|
||||||
import { useNavigate } from "@solidjs/router"
|
import { useNavigate } from "@solidjs/router"
|
||||||
import { createMemo, createSignal, Match, onCleanup, Show, Switch } from "solid-js"
|
import { createMemo, createSignal, Match, onCleanup, Show, Switch } from "solid-js"
|
||||||
import { formatKeybind, useCommand, type CommandOption } from "@/context/command"
|
import { formatKeybind, useCommand, type CommandOption } from "@/context/command"
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
import { useMutation, useQueryClient } from "@tanstack/solid-query"
|
import { useMutation } from "@tanstack/solid-query"
|
||||||
import { Component, createMemo, Show } from "solid-js"
|
import { Component, createEffect, createMemo, on, Show } from "solid-js"
|
||||||
|
import { createStore } from "solid-js/store"
|
||||||
import { useSync } from "@/context/sync"
|
import { useSync } from "@/context/sync"
|
||||||
import { useSDK } from "@/context/sdk"
|
import { useSDK } from "@/context/sdk"
|
||||||
import { Dialog } from "@opencode-ai/ui/dialog"
|
import { Dialog } from "@opencode-ai/ui/dialog"
|
||||||
import { List } from "@opencode-ai/ui/list"
|
import { List } from "@opencode-ai/ui/list"
|
||||||
import { Switch } from "@opencode-ai/ui/switch"
|
import { Switch } from "@opencode-ai/ui/switch"
|
||||||
|
import { showToast } from "@opencode-ai/ui/toast"
|
||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
import { mcpQueryKey } from "@/context/global-sync"
|
|
||||||
|
|
||||||
const statusLabels = {
|
const statusLabels = {
|
||||||
connected: "mcp.status.connected",
|
connected: "mcp.status.connected",
|
||||||
@@ -19,7 +20,48 @@ export const DialogSelectMcp: Component = () => {
|
|||||||
const sync = useSync()
|
const sync = useSync()
|
||||||
const sdk = useSDK()
|
const sdk = useSDK()
|
||||||
const language = useLanguage()
|
const language = useLanguage()
|
||||||
const queryClient = useQueryClient()
|
const [state, setState] = createStore({
|
||||||
|
done: false,
|
||||||
|
loading: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
createEffect(
|
||||||
|
on(
|
||||||
|
() => sync.data.mcp_ready,
|
||||||
|
(ready, prev) => {
|
||||||
|
if (!ready && prev) setState("done", false)
|
||||||
|
},
|
||||||
|
{ defer: true },
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
createEffect(() => {
|
||||||
|
if (state.done || state.loading) return
|
||||||
|
if (sync.data.mcp_ready) {
|
||||||
|
setState("done", true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setState("loading", true)
|
||||||
|
void sdk.client.mcp
|
||||||
|
.status()
|
||||||
|
.then((result) => {
|
||||||
|
sync.set("mcp", result.data ?? {})
|
||||||
|
sync.set("mcp_ready", true)
|
||||||
|
setState("done", true)
|
||||||
|
})
|
||||||
|
.catch((err) => {
|
||||||
|
setState("done", true)
|
||||||
|
showToast({
|
||||||
|
variant: "error",
|
||||||
|
title: language.t("common.requestFailed"),
|
||||||
|
description: err instanceof Error ? err.message : String(err),
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setState("loading", false)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
const items = createMemo(() =>
|
const items = createMemo(() =>
|
||||||
Object.entries(sync.data.mcp ?? {})
|
Object.entries(sync.data.mcp ?? {})
|
||||||
@@ -29,10 +71,16 @@ export const DialogSelectMcp: Component = () => {
|
|||||||
|
|
||||||
const toggle = useMutation(() => ({
|
const toggle = useMutation(() => ({
|
||||||
mutationFn: async (name: string) => {
|
mutationFn: async (name: string) => {
|
||||||
if (sync.data.mcp[name]?.status === "connected") await sdk.client.mcp.disconnect({ name })
|
const status = sync.data.mcp[name]
|
||||||
else await sdk.client.mcp.connect({ name })
|
if (status?.status === "connected") {
|
||||||
|
await sdk.client.mcp.disconnect({ name })
|
||||||
|
} else {
|
||||||
|
await sdk.client.mcp.connect({ name })
|
||||||
|
}
|
||||||
|
|
||||||
|
const result = await sdk.client.mcp.status()
|
||||||
|
if (result.data) sync.set("mcp", result.data)
|
||||||
},
|
},
|
||||||
onSuccess: () => queryClient.refetchQueries({ queryKey: mcpQueryKey(sync.directory) }),
|
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const enabledCount = createMemo(() => items().filter((i) => i.status === "connected").length)
|
const enabledCount = createMemo(() => items().filter((i) => i.status === "connected").length)
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ export function DialogSelectServer() {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog title={formTitle()}>
|
<Dialog title={formTitle()}>
|
||||||
<div class="flex flex-1 min-h-0 flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<Show
|
<Show
|
||||||
when={!isFormMode()}
|
when={!isFormMode()}
|
||||||
fallback={
|
fallback={
|
||||||
@@ -539,7 +539,7 @@ export function DialogSelectServer() {
|
|||||||
if (x) void select(x)
|
if (x) void select(x)
|
||||||
}}
|
}}
|
||||||
divider={true}
|
divider={true}
|
||||||
class="flex-1 min-h-0 px-5 [&_[data-slot=list-search-wrapper]]:w-full [&_[data-slot=list-scroll]]:flex-1 [&_[data-slot=list-scroll]]:overflow-y-auto [&_[data-slot=list-items]]:bg-surface-base [&_[data-slot=list-items]]:rounded-md [&_[data-slot=list-item]]:min-h-14 [&_[data-slot=list-item]]:p-3 [&_[data-slot=list-item]]:!bg-transparent"
|
class="px-5 [&_[data-slot=list-search-wrapper]]:w-full [&_[data-slot=list-scroll]]h-[300px] [&_[data-slot=list-scroll]]:overflow-y-auto [&_[data-slot=list-items]]:bg-surface-base [&_[data-slot=list-items]]:rounded-md [&_[data-slot=list-item]]:min-h-14 [&_[data-slot=list-item]]:p-3 [&_[data-slot=list-item]]:!bg-transparent"
|
||||||
>
|
>
|
||||||
{(i) => {
|
{(i) => {
|
||||||
const key = ServerConnection.key(i)
|
const key = ServerConnection.key(i)
|
||||||
@@ -619,7 +619,7 @@ export function DialogSelectServer() {
|
|||||||
</List>
|
</List>
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<div class="shrink-0 px-5 pb-5">
|
<div class="px-5 pb-5">
|
||||||
<Show
|
<Show
|
||||||
when={isFormMode()}
|
when={isFormMode()}
|
||||||
fallback={
|
fallback={
|
||||||
|
|||||||
@@ -8,14 +8,20 @@ import { SettingsGeneral } from "./settings-general"
|
|||||||
import { SettingsKeybinds } from "./settings-keybinds"
|
import { SettingsKeybinds } from "./settings-keybinds"
|
||||||
import { SettingsProviders } from "./settings-providers"
|
import { SettingsProviders } from "./settings-providers"
|
||||||
import { SettingsModels } from "./settings-models"
|
import { SettingsModels } from "./settings-models"
|
||||||
|
import { SettingsPair } from "./settings-pair"
|
||||||
|
|
||||||
export const DialogSettings: Component = () => {
|
export const DialogSettings: Component<{ defaultTab?: string }> = (props) => {
|
||||||
const language = useLanguage()
|
const language = useLanguage()
|
||||||
const platform = usePlatform()
|
const platform = usePlatform()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Dialog size="x-large" transition>
|
<Dialog size="x-large" transition>
|
||||||
<Tabs orientation="vertical" variant="settings" defaultValue="general" class="h-full settings-dialog">
|
<Tabs
|
||||||
|
orientation="vertical"
|
||||||
|
variant="settings"
|
||||||
|
defaultValue={props.defaultTab ?? "general"}
|
||||||
|
class="h-full settings-dialog"
|
||||||
|
>
|
||||||
<Tabs.List>
|
<Tabs.List>
|
||||||
<div class="flex flex-col justify-between h-full w-full">
|
<div class="flex flex-col justify-between h-full w-full">
|
||||||
<div class="flex flex-col gap-3 w-full pt-3">
|
<div class="flex flex-col gap-3 w-full pt-3">
|
||||||
@@ -45,6 +51,10 @@ export const DialogSettings: Component = () => {
|
|||||||
<Icon name="models" />
|
<Icon name="models" />
|
||||||
{language.t("settings.models.title")}
|
{language.t("settings.models.title")}
|
||||||
</Tabs.Trigger>
|
</Tabs.Trigger>
|
||||||
|
<Tabs.Trigger value="pair">
|
||||||
|
<Icon name="link" />
|
||||||
|
{language.t("settings.pair.title")}
|
||||||
|
</Tabs.Trigger>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -67,6 +77,9 @@ export const DialogSettings: Component = () => {
|
|||||||
<Tabs.Content value="models" class="no-scrollbar">
|
<Tabs.Content value="models" class="no-scrollbar">
|
||||||
<SettingsModels />
|
<SettingsModels />
|
||||||
</Tabs.Content>
|
</Tabs.Content>
|
||||||
|
<Tabs.Content value="pair" class="no-scrollbar">
|
||||||
|
<SettingsPair />
|
||||||
|
</Tabs.Content>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
</Dialog>
|
</Dialog>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useFilteredList } from "@opencode-ai/ui/hooks"
|
import { useFilteredList } from "@opencode-ai/ui/hooks"
|
||||||
import { useSpring } from "@opencode-ai/ui/motion-spring"
|
import { useSpring } from "@opencode-ai/ui/motion-spring"
|
||||||
import { createEffect, on, Component, Show, onCleanup, createMemo, createSignal, createResource } from "solid-js"
|
import { createEffect, on, Component, Show, onCleanup, createMemo, createSignal } from "solid-js"
|
||||||
import { createStore } from "solid-js/store"
|
import { createStore } from "solid-js/store"
|
||||||
import { useLocal } from "@/context/local"
|
import { useLocal } from "@/context/local"
|
||||||
import { selectionFromLines, type SelectedLineRange, useFile } from "@/context/file"
|
import { selectionFromLines, type SelectedLineRange, useFile } from "@/context/file"
|
||||||
@@ -16,7 +16,6 @@ import {
|
|||||||
} from "@/context/prompt"
|
} from "@/context/prompt"
|
||||||
import { useLayout } from "@/context/layout"
|
import { useLayout } from "@/context/layout"
|
||||||
import { useSDK } from "@/context/sdk"
|
import { useSDK } from "@/context/sdk"
|
||||||
import { useGlobalSDK } from "@/context/global-sdk"
|
|
||||||
import { useSync } from "@/context/sync"
|
import { useSync } from "@/context/sync"
|
||||||
import { useComments } from "@/context/comments"
|
import { useComments } from "@/context/comments"
|
||||||
import { Button } from "@opencode-ai/ui/button"
|
import { Button } from "@opencode-ai/ui/button"
|
||||||
@@ -55,7 +54,7 @@ import { PromptImageAttachments } from "./prompt-input/image-attachments"
|
|||||||
import { PromptDragOverlay } from "./prompt-input/drag-overlay"
|
import { PromptDragOverlay } from "./prompt-input/drag-overlay"
|
||||||
import { promptPlaceholder } from "./prompt-input/placeholder"
|
import { promptPlaceholder } from "./prompt-input/placeholder"
|
||||||
import { ImagePreview } from "@opencode-ai/ui/image-preview"
|
import { ImagePreview } from "@opencode-ai/ui/image-preview"
|
||||||
import { useQueries } from "@tanstack/solid-query"
|
import { useQuery } from "@tanstack/solid-query"
|
||||||
import { loadAgentsQuery, loadProvidersQuery } from "@/context/global-sync/bootstrap"
|
import { loadAgentsQuery, loadProvidersQuery } from "@/context/global-sync/bootstrap"
|
||||||
|
|
||||||
interface PromptInputProps {
|
interface PromptInputProps {
|
||||||
@@ -103,7 +102,6 @@ const NON_EMPTY_TEXT = /[^\s\u200B]/
|
|||||||
|
|
||||||
export const PromptInput: Component<PromptInputProps> = (props) => {
|
export const PromptInput: Component<PromptInputProps> = (props) => {
|
||||||
const sdk = useSDK()
|
const sdk = useSDK()
|
||||||
const globalSDK = useGlobalSDK()
|
|
||||||
|
|
||||||
const sync = useSync()
|
const sync = useSync()
|
||||||
const local = useLocal()
|
const local = useLocal()
|
||||||
@@ -272,7 +270,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
const buttonsSpring = useSpring(() => (store.mode === "normal" ? 1 : 0), { visualDuration: 0.2, bounce: 0 })
|
const buttonsSpring = useSpring(() => (store.mode === "normal" ? 1 : 0), { visualDuration: 0.2, bounce: 0 })
|
||||||
const motion = (value: number) => ({
|
const motion = (value: number) => ({
|
||||||
opacity: value,
|
opacity: value,
|
||||||
transform: `scale(${0.98 + value * 0.02})`,
|
transform: `scale(${0.95 + value * 0.05})`,
|
||||||
filter: `blur(${(1 - value) * 2}px)`,
|
filter: `blur(${(1 - value) * 2}px)`,
|
||||||
"pointer-events": value > 0.5 ? ("auto" as const) : ("none" as const),
|
"pointer-events": value > 0.5 ? ("auto" as const) : ("none" as const),
|
||||||
})
|
})
|
||||||
@@ -347,7 +345,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
promptPlaceholder({
|
promptPlaceholder({
|
||||||
mode: store.mode,
|
mode: store.mode,
|
||||||
commentCount: commentCount(),
|
commentCount: commentCount(),
|
||||||
example: suggest() ? (store.mode === "shell" ? "git status" : language.t(EXAMPLES[store.placeholder])) : "",
|
example: suggest() ? language.t(EXAMPLES[store.placeholder]) : "",
|
||||||
suggest: suggest(),
|
suggest: suggest(),
|
||||||
t: (key, params) => language.t(key as Parameters<typeof language.t>[0], params as never),
|
t: (key, params) => language.t(key as Parameters<typeof language.t>[0], params as never),
|
||||||
}),
|
}),
|
||||||
@@ -1254,27 +1252,16 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const [agentsQuery, globalProvidersQuery, providersQuery] = useQueries(() => ({
|
const agentsQuery = useQuery(() => loadAgentsQuery(sdk.directory))
|
||||||
queries: [
|
|
||||||
loadAgentsQuery(sdk.directory, sdk.client),
|
|
||||||
loadProvidersQuery(null, globalSDK.client),
|
|
||||||
loadProvidersQuery(sdk.directory, sdk.client),
|
|
||||||
],
|
|
||||||
}))
|
|
||||||
|
|
||||||
const agentsLoading = () => agentsQuery.isLoading
|
const agentsLoading = () => agentsQuery.isLoading
|
||||||
const agentsShouldFadeIn = createMemo((prev) => prev ?? agentsLoading())
|
|
||||||
const providersLoading = () => agentsLoading() || providersQuery.isLoading || globalProvidersQuery.isLoading
|
|
||||||
const providersShouldFadeIn = createMemo((prev) => prev ?? providersLoading())
|
|
||||||
|
|
||||||
const [promptReady] = createResource(
|
const globalProvidersQuery = useQuery(() => loadProvidersQuery(null))
|
||||||
() => prompt.ready().promise,
|
const providersQuery = useQuery(() => loadProvidersQuery(sdk.directory))
|
||||||
(p) => p,
|
|
||||||
)
|
const providersLoading = () => agentsLoading() || providersQuery.isLoading || globalProvidersQuery.isLoading
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="relative size-full _max-h-[320px] flex flex-col gap-0">
|
<div class="relative size-full _max-h-[320px] flex flex-col gap-0">
|
||||||
{(promptReady(), null)}
|
|
||||||
<PromptPopover
|
<PromptPopover
|
||||||
popover={store.popover}
|
popover={store.popover}
|
||||||
setSlashPopoverRef={(el) => (slashPopoverRef = el)}
|
setSlashPopoverRef={(el) => (slashPopoverRef = el)}
|
||||||
@@ -1371,13 +1358,15 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
}}
|
}}
|
||||||
style={{ "padding-bottom": space }}
|
style={{ "padding-bottom": space }}
|
||||||
/>
|
/>
|
||||||
<div
|
<Show when={!prompt.dirty()}>
|
||||||
class="absolute top-0 inset-x-0 pl-3 pr-2 pt-2 text-14-regular text-text-weak pointer-events-none whitespace-nowrap truncate"
|
<div
|
||||||
classList={{ "font-mono!": store.mode === "shell" }}
|
class="absolute top-0 inset-x-0 pl-3 pr-2 pt-2 text-14-regular text-text-weak pointer-events-none whitespace-nowrap truncate"
|
||||||
style={{ "padding-bottom": space, display: prompt.dirty() ? "none" : undefined }}
|
classList={{ "font-mono!": store.mode === "shell" }}
|
||||||
>
|
style={{ "padding-bottom": space }}
|
||||||
{placeholder()}
|
>
|
||||||
</div>
|
{placeholder()}
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
@@ -1409,11 +1398,12 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
<IconButton
|
<IconButton
|
||||||
data-action="prompt-submit"
|
data-action="prompt-submit"
|
||||||
type="submit"
|
type="submit"
|
||||||
disabled={!working() && blank()}
|
disabled={store.mode !== "normal" || (!working() && blank())}
|
||||||
tabIndex={store.mode === "normal" ? undefined : -1}
|
tabIndex={store.mode === "normal" ? undefined : -1}
|
||||||
icon={stopping() ? "stop" : store.mode === "shell" ? "arrow-undo-down" : "arrow-up"}
|
icon={stopping() ? "stop" : "arrow-up"}
|
||||||
variant="primary"
|
variant="primary"
|
||||||
class="size-8"
|
class="size-8"
|
||||||
|
style={buttons()}
|
||||||
aria-label={stopping() ? language.t("prompt.action.stop") : language.t("prompt.action.send")}
|
aria-label={stopping() ? language.t("prompt.action.stop") : language.t("prompt.action.send")}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
@@ -1456,31 +1446,18 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
<div class="px-1.75 pt-5.5 pb-2 flex items-center gap-2 min-w-0">
|
<div class="px-1.75 pt-5.5 pb-2 flex items-center gap-2 min-w-0">
|
||||||
<div class="flex items-center gap-1.5 min-w-0 flex-1 relative">
|
<div class="flex items-center gap-1.5 min-w-0 flex-1 relative">
|
||||||
<div
|
<div
|
||||||
class="h-7 flex items-center gap-1.5 min-w-0 absolute inset-0"
|
class="h-7 flex items-center gap-1.5 max-w-[160px] min-w-0 absolute inset-y-0 left-0"
|
||||||
style={{
|
style={{
|
||||||
padding: "0 0px 0 8px",
|
padding: "0 4px 0 8px",
|
||||||
...shell(),
|
...shell(),
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon name="console" />
|
<span class="truncate text-13-medium text-text-strong">{language.t("prompt.mode.shell")}</span>
|
||||||
<span class="truncate text-13-medium text-text-base">{language.t("prompt.mode.shell")}</span>
|
<div class="size-4 shrink-0" />
|
||||||
<div class="flex-1" />
|
|
||||||
<Button
|
|
||||||
variant="ghost"
|
|
||||||
class="text-text-base"
|
|
||||||
onClick={() => {
|
|
||||||
setStore("mode", "normal")
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{language.t("common.cancel")}
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center gap-1.5 min-w-0 flex-1 h-7">
|
<div class="flex items-center gap-1.5 min-w-0 flex-1 h-7">
|
||||||
<Show when={!agentsLoading()}>
|
<Show when={!agentsLoading()}>
|
||||||
<div
|
<div data-component="prompt-agent-control">
|
||||||
data-component="prompt-agent-control"
|
|
||||||
style={agentsShouldFadeIn() ? { animation: "fade-in 0.3s" } : undefined}
|
|
||||||
>
|
|
||||||
<TooltipKeybind
|
<TooltipKeybind
|
||||||
placement="top"
|
placement="top"
|
||||||
gutter={4}
|
gutter={4}
|
||||||
@@ -1506,10 +1483,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
</Show>
|
</Show>
|
||||||
<Show when={!providersLoading()}>
|
<Show when={!providersLoading()}>
|
||||||
<Show when={store.mode !== "shell"}>
|
<Show when={store.mode !== "shell"}>
|
||||||
<div
|
<div data-component="prompt-model-control">
|
||||||
data-component="prompt-model-control"
|
|
||||||
style={providersShouldFadeIn() ? { animation: "fade-in 0.3s" } : undefined}
|
|
||||||
>
|
|
||||||
<Show
|
<Show
|
||||||
when={providers.paid().length > 0}
|
when={providers.paid().length > 0}
|
||||||
fallback={
|
fallback={
|
||||||
@@ -1580,35 +1554,30 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
</TooltipKeybind>
|
</TooltipKeybind>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
<Show when={variants().length > 2}>
|
<div data-component="prompt-variant-control">
|
||||||
<div
|
<TooltipKeybind
|
||||||
data-component="prompt-variant-control"
|
placement="top"
|
||||||
style={providersShouldFadeIn() ? { animation: "fade-in 0.3s" } : undefined}
|
gutter={4}
|
||||||
|
title={language.t("command.model.variant.cycle")}
|
||||||
|
keybind={command.keybind("model.variant.cycle")}
|
||||||
>
|
>
|
||||||
<TooltipKeybind
|
<Select
|
||||||
placement="top"
|
size="normal"
|
||||||
gutter={4}
|
options={variants()}
|
||||||
title={language.t("command.model.variant.cycle")}
|
current={local.model.variant.current() ?? "default"}
|
||||||
keybind={command.keybind("model.variant.cycle")}
|
label={(x) => (x === "default" ? language.t("common.default") : x)}
|
||||||
>
|
onSelect={(value) => {
|
||||||
<Select
|
local.model.variant.set(value === "default" ? undefined : value)
|
||||||
size="normal"
|
restoreFocus()
|
||||||
options={variants()}
|
}}
|
||||||
current={local.model.variant.current() ?? "default"}
|
class="capitalize max-w-[160px] text-text-base"
|
||||||
label={(x) => (x === "default" ? language.t("common.default") : x)}
|
valueClass="truncate text-13-regular text-text-base"
|
||||||
onSelect={(value) => {
|
triggerStyle={control()}
|
||||||
local.model.variant.set(value === "default" ? undefined : value)
|
triggerProps={{ "data-action": "prompt-model-variant" }}
|
||||||
restoreFocus()
|
variant="ghost"
|
||||||
}}
|
/>
|
||||||
class="capitalize max-w-[160px] text-text-base"
|
</TooltipKeybind>
|
||||||
valueClass="truncate text-13-regular text-text-base"
|
</div>
|
||||||
triggerStyle={control()}
|
|
||||||
triggerProps={{ "data-action": "prompt-model-variant" }}
|
|
||||||
variant="ghost"
|
|
||||||
/>
|
|
||||||
</TooltipKeybind>
|
|
||||||
</div>
|
|
||||||
</Show>
|
|
||||||
</Show>
|
</Show>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getFilename } from "@opencode-ai/core/util/path"
|
import { getFilename } from "@opencode-ai/shared/util/path"
|
||||||
import { type AgentPartInput, type FilePartInput, type Part, type TextPartInput } from "@opencode-ai/sdk/v2/client"
|
import { type AgentPartInput, type FilePartInput, type Part, type TextPartInput } from "@opencode-ai/sdk/v2/client"
|
||||||
import type { FileSelection } from "@/context/file"
|
import type { FileSelection } from "@/context/file"
|
||||||
import { encodeFilePath } from "@/context/file/path"
|
import { encodeFilePath } from "@/context/file/path"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { Component, For, Show } from "solid-js"
|
|||||||
import { FileIcon } from "@opencode-ai/ui/file-icon"
|
import { FileIcon } from "@opencode-ai/ui/file-icon"
|
||||||
import { IconButton } from "@opencode-ai/ui/icon-button"
|
import { IconButton } from "@opencode-ai/ui/icon-button"
|
||||||
import { Tooltip } from "@opencode-ai/ui/tooltip"
|
import { Tooltip } from "@opencode-ai/ui/tooltip"
|
||||||
import { getDirectory, getFilename, getFilenameTruncated } from "@opencode-ai/core/util/path"
|
import { getDirectory, getFilename, getFilenameTruncated } from "@opencode-ai/shared/util/path"
|
||||||
import type { ContextItem } from "@/context/prompt"
|
import type { ContextItem } from "@/context/prompt"
|
||||||
|
|
||||||
type PromptContextItem = ContextItem & { key: string }
|
type PromptContextItem = ContextItem & { key: string }
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ describe("promptPlaceholder", () => {
|
|||||||
suggest: true,
|
suggest: true,
|
||||||
t,
|
t,
|
||||||
})
|
})
|
||||||
expect(value).toBe("prompt.placeholder.shell:example")
|
expect(value).toBe("prompt.placeholder.shell")
|
||||||
})
|
})
|
||||||
|
|
||||||
test("returns summarize placeholders for comment context", () => {
|
test("returns summarize placeholders for comment context", () => {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ type PromptPlaceholderInput = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function promptPlaceholder(input: PromptPlaceholderInput) {
|
export function promptPlaceholder(input: PromptPlaceholderInput) {
|
||||||
if (input.mode === "shell") return input.t("prompt.placeholder.shell", { example: input.example })
|
if (input.mode === "shell") return input.t("prompt.placeholder.shell")
|
||||||
if (input.commentCount > 1) return input.t("prompt.placeholder.summarizeComments")
|
if (input.commentCount > 1) return input.t("prompt.placeholder.summarizeComments")
|
||||||
if (input.commentCount === 1) return input.t("prompt.placeholder.summarizeComment")
|
if (input.commentCount === 1) return input.t("prompt.placeholder.summarizeComment")
|
||||||
if (!input.suggest) return input.t("prompt.placeholder.simple")
|
if (!input.suggest) return input.t("prompt.placeholder.simple")
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component, For, Match, Show, Switch } from "solid-js"
|
import { Component, For, Match, Show, Switch } from "solid-js"
|
||||||
import { FileIcon } from "@opencode-ai/ui/file-icon"
|
import { FileIcon } from "@opencode-ai/ui/file-icon"
|
||||||
import { Icon } from "@opencode-ai/ui/icon"
|
import { Icon } from "@opencode-ai/ui/icon"
|
||||||
import { getDirectory, getFilename } from "@opencode-ai/core/util/path"
|
import { getDirectory, getFilename } from "@opencode-ai/shared/util/path"
|
||||||
|
|
||||||
export type AtOption =
|
export type AtOption =
|
||||||
| { type: "agent"; name: string; display: string }
|
| { type: "agent"; name: string; display: string }
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ beforeAll(async () => {
|
|||||||
showToast: () => 0,
|
showToast: () => 0,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
mock.module("@opencode-ai/core/util/encode", () => ({
|
mock.module("@opencode-ai/shared/util/encode", () => ({
|
||||||
base64Encode: (value: string) => value,
|
base64Encode: (value: string) => value,
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import type { Message, Session } from "@opencode-ai/sdk/v2/client"
|
import type { Message, Session } from "@opencode-ai/sdk/v2/client"
|
||||||
import { showToast } from "@opencode-ai/ui/toast"
|
import { showToast } from "@opencode-ai/ui/toast"
|
||||||
import { base64Encode } from "@opencode-ai/core/util/encode"
|
import { base64Encode } from "@opencode-ai/shared/util/encode"
|
||||||
import { Binary } from "@opencode-ai/core/util/binary"
|
import { Binary } from "@opencode-ai/shared/util/binary"
|
||||||
import { useNavigate, useParams } from "@solidjs/router"
|
import { useNavigate, useParams } from "@solidjs/router"
|
||||||
import { batch, type Accessor } from "solid-js"
|
import { batch, type Accessor } from "solid-js"
|
||||||
import type { FileSelection } from "@/context/file"
|
import type { FileSelection } from "@/context/file"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import { createMemo, createEffect, on, onCleanup, For, Show } from "solid-js"
|
import { createMemo, createEffect, on, onCleanup, For, Show } from "solid-js"
|
||||||
import type { JSX } from "solid-js"
|
import type { JSX } from "solid-js"
|
||||||
import { useSync } from "@/context/sync"
|
import { useSync } from "@/context/sync"
|
||||||
import { checksum } from "@opencode-ai/core/util/encode"
|
import { checksum } from "@opencode-ai/shared/util/encode"
|
||||||
import { findLast } from "@opencode-ai/core/util/array"
|
import { findLast } from "@opencode-ai/shared/util/array"
|
||||||
import { same } from "@/utils/same"
|
import { same } from "@/utils/same"
|
||||||
import { Icon } from "@opencode-ai/ui/icon"
|
import { Icon } from "@opencode-ai/ui/icon"
|
||||||
import { Accordion } from "@opencode-ai/ui/accordion"
|
import { Accordion } from "@opencode-ai/ui/accordion"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { Keybind } from "@opencode-ai/ui/keybind"
|
|||||||
import { Spinner } from "@opencode-ai/ui/spinner"
|
import { Spinner } from "@opencode-ai/ui/spinner"
|
||||||
import { showToast } from "@opencode-ai/ui/toast"
|
import { showToast } from "@opencode-ai/ui/toast"
|
||||||
import { Tooltip, TooltipKeybind } from "@opencode-ai/ui/tooltip"
|
import { Tooltip, TooltipKeybind } from "@opencode-ai/ui/tooltip"
|
||||||
import { getFilename } from "@opencode-ai/core/util/path"
|
import { getFilename } from "@opencode-ai/shared/util/path"
|
||||||
import { createEffect, createMemo, createSignal, For, onMount, Show } from "solid-js"
|
import { createEffect, createMemo, createSignal, For, onMount, Show } from "solid-js"
|
||||||
import { createStore } from "solid-js/store"
|
import { createStore } from "solid-js/store"
|
||||||
import { Portal } from "solid-js/web"
|
import { Portal } from "solid-js/web"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { useSDK } from "@/context/sdk"
|
|||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
import { Icon } from "@opencode-ai/ui/icon"
|
import { Icon } from "@opencode-ai/ui/icon"
|
||||||
import { Mark } from "@opencode-ai/ui/logo"
|
import { Mark } from "@opencode-ai/ui/logo"
|
||||||
import { getDirectory, getFilename } from "@opencode-ai/core/util/path"
|
import { getDirectory, getFilename } from "@opencode-ai/shared/util/path"
|
||||||
|
|
||||||
const MAIN_WORKTREE = "main"
|
const MAIN_WORKTREE = "main"
|
||||||
const CREATE_WORKTREE = "create"
|
const CREATE_WORKTREE = "create"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import { FileIcon } from "@opencode-ai/ui/file-icon"
|
|||||||
import { IconButton } from "@opencode-ai/ui/icon-button"
|
import { IconButton } from "@opencode-ai/ui/icon-button"
|
||||||
import { TooltipKeybind } from "@opencode-ai/ui/tooltip"
|
import { TooltipKeybind } from "@opencode-ai/ui/tooltip"
|
||||||
import { Tabs } from "@opencode-ai/ui/tabs"
|
import { Tabs } from "@opencode-ai/ui/tabs"
|
||||||
import { getFilename } from "@opencode-ai/core/util/path"
|
import { getFilename } from "@opencode-ai/shared/util/path"
|
||||||
import { useFile } from "@/context/file"
|
import { useFile } from "@/context/file"
|
||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
import { useCommand } from "@/context/command"
|
import { useCommand } from "@/context/command"
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ import { showToast } from "@opencode-ai/ui/toast"
|
|||||||
import { useParams } from "@solidjs/router"
|
import { useParams } from "@solidjs/router"
|
||||||
import { useLanguage } from "@/context/language"
|
import { useLanguage } from "@/context/language"
|
||||||
import { usePermission } from "@/context/permission"
|
import { usePermission } from "@/context/permission"
|
||||||
import { usePlatform, type DisplayBackend } from "@/context/platform"
|
import { usePlatform } from "@/context/platform"
|
||||||
import { useGlobalSync } from "@/context/global-sync"
|
|
||||||
import { useGlobalSDK } from "@/context/global-sdk"
|
|
||||||
import {
|
import {
|
||||||
monoDefault,
|
monoDefault,
|
||||||
monoFontFamily,
|
monoFontFamily,
|
||||||
@@ -42,18 +40,6 @@ type ThemeOption = {
|
|||||||
name: string
|
name: string
|
||||||
}
|
}
|
||||||
|
|
||||||
type ShellOption = {
|
|
||||||
path: string
|
|
||||||
name: string
|
|
||||||
acceptable: boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
type ShellSelectOption = {
|
|
||||||
id: string
|
|
||||||
value: string
|
|
||||||
label: string
|
|
||||||
}
|
|
||||||
|
|
||||||
// To prevent audio from overlapping/playing very quickly when navigating the settings menus,
|
// To prevent audio from overlapping/playing very quickly when navigating the settings menus,
|
||||||
// delay the playback by 100ms during quick selection changes and pause existing sounds.
|
// delay the playback by 100ms during quick selection changes and pause existing sounds.
|
||||||
const stopDemoSound = () => {
|
const stopDemoSound = () => {
|
||||||
@@ -89,6 +75,10 @@ export const SettingsGeneral: Component = () => {
|
|||||||
const params = useParams()
|
const params = useParams()
|
||||||
const settings = useSettings()
|
const settings = useSettings()
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
void theme.loadThemes()
|
||||||
|
})
|
||||||
|
|
||||||
const [store, setStore] = createStore({
|
const [store, setStore] = createStore({
|
||||||
checking: false,
|
checking: false,
|
||||||
})
|
})
|
||||||
@@ -138,25 +128,27 @@ export const SettingsGeneral: Component = () => {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const actions = platform.updateAndRestart
|
const actions =
|
||||||
? [
|
platform.update && platform.restart
|
||||||
{
|
? [
|
||||||
label: language.t("toast.update.action.installRestart"),
|
{
|
||||||
onClick: async () => {
|
label: language.t("toast.update.action.installRestart"),
|
||||||
await platform.updateAndRestart!()
|
onClick: async () => {
|
||||||
|
await platform.update!()
|
||||||
|
await platform.restart!()
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
label: language.t("toast.update.action.notYet"),
|
||||||
label: language.t("toast.update.action.notYet"),
|
onClick: "dismiss" as const,
|
||||||
onClick: "dismiss" as const,
|
},
|
||||||
},
|
]
|
||||||
]
|
: [
|
||||||
: [
|
{
|
||||||
{
|
label: language.t("toast.update.action.notYet"),
|
||||||
label: language.t("toast.update.action.notYet"),
|
onClick: "dismiss" as const,
|
||||||
onClick: "dismiss" as const,
|
},
|
||||||
},
|
]
|
||||||
]
|
|
||||||
|
|
||||||
showToast({
|
showToast({
|
||||||
persistent: true,
|
persistent: true,
|
||||||
@@ -175,70 +167,6 @@ export const SettingsGeneral: Component = () => {
|
|||||||
|
|
||||||
const themeOptions = createMemo<ThemeOption[]>(() => theme.ids().map((id) => ({ id, name: theme.name(id) })))
|
const themeOptions = createMemo<ThemeOption[]>(() => theme.ids().map((id) => ({ id, name: theme.name(id) })))
|
||||||
|
|
||||||
const globalSync = useGlobalSync()
|
|
||||||
const globalSdk = useGlobalSDK()
|
|
||||||
|
|
||||||
const [shells] = createResource(
|
|
||||||
() =>
|
|
||||||
globalSdk.client.pty
|
|
||||||
.shells()
|
|
||||||
.then((res) => res.data ?? [])
|
|
||||||
.catch(() => [] as ShellOption[]),
|
|
||||||
{ initialValue: [] as ShellOption[] },
|
|
||||||
)
|
|
||||||
|
|
||||||
const [displayBackend, { refetch: refetchDisplayBackend }] = createResource(
|
|
||||||
() => (linux() && platform.getDisplayBackend ? true : false),
|
|
||||||
() => Promise.resolve(platform.getDisplayBackend?.() ?? null).catch(() => null as DisplayBackend | null),
|
|
||||||
{ initialValue: null as DisplayBackend | null },
|
|
||||||
)
|
|
||||||
|
|
||||||
onMount(() => {
|
|
||||||
void theme.loadThemes()
|
|
||||||
})
|
|
||||||
|
|
||||||
const autoOption = { id: "auto", value: "", label: language.t("settings.general.row.shell.autoDefault") }
|
|
||||||
const currentShell = createMemo(() => globalSync.data.config.shell ?? "")
|
|
||||||
|
|
||||||
const shellOptions = createMemo<ShellSelectOption[]>(() => {
|
|
||||||
const list = shells.latest
|
|
||||||
const current = globalSync.data.config.shell
|
|
||||||
|
|
||||||
const nameCounts = new Map<string, number>()
|
|
||||||
for (const s of list) {
|
|
||||||
nameCounts.set(s.name, (nameCounts.get(s.name) || 0) + 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
const options = [
|
|
||||||
autoOption,
|
|
||||||
...list.map((s) => {
|
|
||||||
const ambiguousName = (nameCounts.get(s.name) || 0) > 1
|
|
||||||
const text = ambiguousName ? s.path : s.name
|
|
||||||
const label = s.acceptable ? text : `${text} (${language.t("settings.general.row.shell.terminalOnly")})`
|
|
||||||
return {
|
|
||||||
id: s.path,
|
|
||||||
// Prefer name over path - "bash" is much cleaner than the explicit full route even when it may change due to PATH.
|
|
||||||
value: ambiguousName ? s.path : s.name,
|
|
||||||
label,
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
]
|
|
||||||
|
|
||||||
if (current && !options.some((o) => o.value === current)) {
|
|
||||||
options.push({ id: current, value: current, label: current })
|
|
||||||
}
|
|
||||||
|
|
||||||
return options
|
|
||||||
})
|
|
||||||
|
|
||||||
const onDisplayBackendChange = (checked: boolean) => {
|
|
||||||
const update = platform.setDisplayBackend?.(checked ? "wayland" : "auto")
|
|
||||||
if (!update) return
|
|
||||||
void update.finally(() => {
|
|
||||||
void refetchDisplayBackend()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const colorSchemeOptions = createMemo((): { value: ColorScheme; label: string }[] => [
|
const colorSchemeOptions = createMemo((): { value: ColorScheme; label: string }[] => [
|
||||||
{ value: "system", label: language.t("theme.scheme.system") },
|
{ value: "system", label: language.t("theme.scheme.system") },
|
||||||
{ value: "light", label: language.t("theme.scheme.light") },
|
{ value: "light", label: language.t("theme.scheme.light") },
|
||||||
@@ -317,28 +245,6 @@ export const SettingsGeneral: Component = () => {
|
|||||||
</div>
|
</div>
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
|
|
||||||
<SettingsRow
|
|
||||||
title={language.t("settings.general.row.shell.title")}
|
|
||||||
description={language.t("settings.general.row.shell.description")}
|
|
||||||
>
|
|
||||||
<Select
|
|
||||||
data-action="settings-shell"
|
|
||||||
options={shellOptions()}
|
|
||||||
current={shellOptions().find((o) => o.value === currentShell()) ?? autoOption}
|
|
||||||
value={(o) => o.id}
|
|
||||||
label={(o) => o.label}
|
|
||||||
onSelect={(option) => {
|
|
||||||
if (!option) return
|
|
||||||
if (option.value === currentShell()) return
|
|
||||||
globalSync.updateConfig({ shell: option.value })
|
|
||||||
}}
|
|
||||||
variant="secondary"
|
|
||||||
size="small"
|
|
||||||
triggerVariant="settings"
|
|
||||||
triggerStyle={{ "min-width": "180px" }}
|
|
||||||
/>
|
|
||||||
</SettingsRow>
|
|
||||||
|
|
||||||
<SettingsRow
|
<SettingsRow
|
||||||
title={language.t("settings.general.row.reasoningSummaries.title")}
|
title={language.t("settings.general.row.reasoningSummaries.title")}
|
||||||
description={language.t("settings.general.row.reasoningSummaries.description")}
|
description={language.t("settings.general.row.reasoningSummaries.description")}
|
||||||
@@ -374,18 +280,6 @@ export const SettingsGeneral: Component = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</SettingsRow>
|
</SettingsRow>
|
||||||
|
|
||||||
<SettingsRow
|
|
||||||
title={language.t("settings.general.row.showSessionProgressBar.title")}
|
|
||||||
description={language.t("settings.general.row.showSessionProgressBar.description")}
|
|
||||||
>
|
|
||||||
<div data-action="settings-show-session-progress-bar">
|
|
||||||
<Switch
|
|
||||||
checked={settings.general.showSessionProgressBar()}
|
|
||||||
onChange={(checked) => settings.general.setShowSessionProgressBar(checked)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</SettingsRow>
|
|
||||||
</SettingsList>
|
</SettingsList>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
@@ -747,32 +641,70 @@ export const SettingsGeneral: Component = () => {
|
|||||||
|
|
||||||
<SoundsSection />
|
<SoundsSection />
|
||||||
|
|
||||||
|
{/*<Show when={platform.platform === "desktop" && platform.os === "windows" && platform.getWslEnabled}>
|
||||||
|
{(_) => {
|
||||||
|
const [enabledResource, actions] = createResource(() => platform.getWslEnabled?.())
|
||||||
|
const enabled = () => (enabledResource.state === "pending" ? undefined : enabledResource.latest)
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<h3 class="text-14-medium text-text-strong pb-2">{language.t("settings.desktop.section.wsl")}</h3>
|
||||||
|
|
||||||
|
<SettingsList>
|
||||||
|
<SettingsRow
|
||||||
|
title={language.t("settings.desktop.wsl.title")}
|
||||||
|
description={language.t("settings.desktop.wsl.description")}
|
||||||
|
>
|
||||||
|
<div data-action="settings-wsl">
|
||||||
|
<Switch
|
||||||
|
checked={enabled() ?? false}
|
||||||
|
disabled={enabledResource.state === "pending"}
|
||||||
|
onChange={(checked) => platform.setWslEnabled?.(checked)?.finally(() => actions.refetch())}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</SettingsRow>
|
||||||
|
</SettingsList>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</Show>*/}
|
||||||
|
|
||||||
<UpdatesSection />
|
<UpdatesSection />
|
||||||
|
|
||||||
<Show when={linux()}>
|
<Show when={linux()}>
|
||||||
<div class="flex flex-col gap-1">
|
{(_) => {
|
||||||
<h3 class="text-14-medium text-text-strong pb-2">{language.t("settings.general.section.display")}</h3>
|
const [valueResource, actions] = createResource(() => platform.getDisplayBackend?.())
|
||||||
|
const value = () => (valueResource.state === "pending" ? undefined : valueResource.latest)
|
||||||
|
|
||||||
<SettingsList>
|
const onChange = (checked: boolean) =>
|
||||||
<SettingsRow
|
platform.setDisplayBackend?.(checked ? "wayland" : "auto").finally(() => actions.refetch())
|
||||||
title={
|
|
||||||
<div class="flex items-center gap-2">
|
return (
|
||||||
<span>{language.t("settings.general.row.wayland.title")}</span>
|
<div class="flex flex-col gap-1">
|
||||||
<Tooltip value={language.t("settings.general.row.wayland.tooltip")} placement="top">
|
<h3 class="text-14-medium text-text-strong pb-2">{language.t("settings.general.section.display")}</h3>
|
||||||
<span class="text-text-weak">
|
|
||||||
<Icon name="help" size="small" />
|
<SettingsList>
|
||||||
</span>
|
<SettingsRow
|
||||||
</Tooltip>
|
title={
|
||||||
</div>
|
<div class="flex items-center gap-2">
|
||||||
}
|
<span>{language.t("settings.general.row.wayland.title")}</span>
|
||||||
description={language.t("settings.general.row.wayland.description")}
|
<Tooltip value={language.t("settings.general.row.wayland.tooltip")} placement="top">
|
||||||
>
|
<span class="text-text-weak">
|
||||||
<div data-action="settings-wayland">
|
<Icon name="help" size="small" />
|
||||||
<Switch checked={displayBackend.latest === "wayland"} onChange={onDisplayBackendChange} />
|
</span>
|
||||||
</div>
|
</Tooltip>
|
||||||
</SettingsRow>
|
</div>
|
||||||
</SettingsList>
|
}
|
||||||
</div>
|
description={language.t("settings.general.row.wayland.description")}
|
||||||
|
>
|
||||||
|
<div data-action="settings-wayland">
|
||||||
|
<Switch checked={value() === "wayland"} onChange={onChange} />
|
||||||
|
</div>
|
||||||
|
</SettingsRow>
|
||||||
|
</SettingsList>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}}
|
||||||
</Show>
|
</Show>
|
||||||
|
|
||||||
<Show when={desktop() && import.meta.env.VITE_OPENCODE_CHANNEL === "beta"}>
|
<Show when={desktop() && import.meta.env.VITE_OPENCODE_CHANNEL === "beta"}>
|
||||||
|
|||||||
@@ -0,0 +1,166 @@
|
|||||||
|
import { type Component, createResource, Show } from "solid-js"
|
||||||
|
import { Icon } from "@opencode-ai/ui/icon"
|
||||||
|
import { useLanguage } from "@/context/language"
|
||||||
|
import { useGlobalSDK } from "@/context/global-sdk"
|
||||||
|
import { useServer } from "@/context/server"
|
||||||
|
import { usePlatform } from "@/context/platform"
|
||||||
|
import { SettingsList } from "./settings-list"
|
||||||
|
|
||||||
|
type PairResult =
|
||||||
|
| { enabled: false }
|
||||||
|
| {
|
||||||
|
enabled: true
|
||||||
|
hosts: string[]
|
||||||
|
relayURL?: string
|
||||||
|
serverID?: string
|
||||||
|
relaySecretHash?: string
|
||||||
|
link: string
|
||||||
|
qr: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export const SettingsPair: Component = () => {
|
||||||
|
const language = useLanguage()
|
||||||
|
const globalSDK = useGlobalSDK()
|
||||||
|
const server = useServer()
|
||||||
|
const platform = usePlatform()
|
||||||
|
|
||||||
|
const [data] = createResource(async () => {
|
||||||
|
const url = `${globalSDK.url}/experimental/push/pair`
|
||||||
|
console.debug("[settings-pair] fetching pair data", {
|
||||||
|
serverUrl: globalSDK.url,
|
||||||
|
serverName: server.name,
|
||||||
|
serverKey: server.key,
|
||||||
|
})
|
||||||
|
const f = platform.fetch ?? fetch
|
||||||
|
const res = await f(url)
|
||||||
|
if (!res.ok) {
|
||||||
|
console.debug("[settings-pair] pair endpoint returned non-ok", {
|
||||||
|
status: res.status,
|
||||||
|
serverUrl: globalSDK.url,
|
||||||
|
})
|
||||||
|
return { enabled: false as const }
|
||||||
|
}
|
||||||
|
const result = (await res.json()) as PairResult
|
||||||
|
console.debug("[settings-pair] pair data received", {
|
||||||
|
enabled: result.enabled,
|
||||||
|
serverUrl: globalSDK.url,
|
||||||
|
serverName: server.name,
|
||||||
|
...(result.enabled
|
||||||
|
? {
|
||||||
|
relayURL: result.relayURL,
|
||||||
|
serverID: result.serverID,
|
||||||
|
relaySecretHash: result.relaySecretHash,
|
||||||
|
hostCount: result.hosts.length,
|
||||||
|
hosts: result.hosts,
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
|
})
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div class="flex flex-col gap-6 py-4 px-5">
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<h2 class="text-16-semibold text-text-strong">{language.t("settings.pair.title")}</h2>
|
||||||
|
<p class="text-13-regular text-text-weak">{language.t("settings.pair.description")}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Show when={data.loading}>
|
||||||
|
<SettingsList>
|
||||||
|
<div class="flex items-center justify-center py-12">
|
||||||
|
<span class="text-14-regular text-text-weak">{language.t("settings.pair.loading")}</span>
|
||||||
|
</div>
|
||||||
|
</SettingsList>
|
||||||
|
</Show>
|
||||||
|
|
||||||
|
<Show when={data.error}>
|
||||||
|
<SettingsList>
|
||||||
|
<div class="flex flex-col items-center justify-center py-12 gap-3 text-center">
|
||||||
|
<Icon name="warning" size="large" />
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<span class="text-14-medium text-text-strong">{language.t("settings.pair.error.title")}</span>
|
||||||
|
<span class="text-13-regular text-text-weak max-w-md">
|
||||||
|
{language.t("settings.pair.error.description")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</SettingsList>
|
||||||
|
</Show>
|
||||||
|
|
||||||
|
<Show when={!data.loading && !data.error && data()}>
|
||||||
|
{(result) => (
|
||||||
|
<Show
|
||||||
|
when={result().enabled && result()}
|
||||||
|
fallback={
|
||||||
|
<SettingsList>
|
||||||
|
<div class="flex flex-col items-center justify-center py-12 gap-3 text-center">
|
||||||
|
<Icon name="link" size="large" />
|
||||||
|
<div class="flex flex-col gap-1">
|
||||||
|
<span class="text-14-medium text-text-strong">{language.t("settings.pair.disabled.title")}</span>
|
||||||
|
<span class="text-13-regular text-text-weak max-w-md">
|
||||||
|
{language.t("settings.pair.disabled.description")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<code class="text-12-regular text-text-weak bg-surface-inset px-3 py-1.5 rounded mt-1">
|
||||||
|
opencode serve --relay-url <url> --relay-secret <secret>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
</SettingsList>
|
||||||
|
}
|
||||||
|
>
|
||||||
|
{(pair) => {
|
||||||
|
const p = pair() as PairResult & { enabled: true }
|
||||||
|
return (
|
||||||
|
<SettingsList>
|
||||||
|
<div class="flex flex-col items-center py-8 gap-4">
|
||||||
|
<Show when={server.list.length > 1 || p.relayURL}>
|
||||||
|
<div class="flex flex-col gap-1.5 w-full max-w-sm text-left">
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-12-medium text-text-weak shrink-0">
|
||||||
|
{language.t("settings.pair.server.label")}
|
||||||
|
</span>
|
||||||
|
<code class="text-12-regular text-text-default bg-surface-inset px-2 py-0.5 rounded truncate">
|
||||||
|
{server.name}
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
<Show when={p.relayURL}>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-12-medium text-text-weak shrink-0">
|
||||||
|
{language.t("settings.pair.relay.label")}
|
||||||
|
</span>
|
||||||
|
<code class="text-12-regular text-text-default bg-surface-inset px-2 py-0.5 rounded truncate">
|
||||||
|
{p.relayURL}
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
<Show when={p.relaySecretHash}>
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<span class="text-12-medium text-text-weak shrink-0">
|
||||||
|
{language.t("settings.pair.secret.label")}
|
||||||
|
</span>
|
||||||
|
<code class="text-12-regular text-text-default bg-surface-inset px-2 py-0.5 rounded truncate">
|
||||||
|
{p.relaySecretHash}
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
</div>
|
||||||
|
</Show>
|
||||||
|
<img src={p.qr} alt="Pairing QR code" class="w-64 h-64" />
|
||||||
|
<div class="flex flex-col gap-1 text-center max-w-sm">
|
||||||
|
<span class="text-14-medium text-text-strong">
|
||||||
|
{language.t("settings.pair.instructions.title")}
|
||||||
|
</span>
|
||||||
|
<span class="text-13-regular text-text-weak">
|
||||||
|
{language.t("settings.pair.instructions.description")}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</SettingsList>
|
||||||
|
)
|
||||||
|
}}
|
||||||
|
</Show>
|
||||||
|
)}
|
||||||
|
</Show>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user