Compare commits

..

2 Commits

Author SHA1 Message Date
Aiden b0ae70bc26 test(opencode): narrow stream error assertion 2026-08-21 07:03:11 +00:00
Aiden 75473de591 fix(opencode): retry network finish errors 2026-08-21 06:56:46 +00:00
56 changed files with 130 additions and 221 deletions
+28 -28
View File
@@ -29,7 +29,7 @@
},
"packages/app": {
"name": "@opencode-ai/app",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@corvu/drawer": "catalog:",
"@dnd-kit/abstract": "0.5.0",
@@ -96,7 +96,7 @@
},
"packages/cli": {
"name": "@opencode-ai/cli",
"version": "1.18.20",
"version": "1.18.19",
"bin": {
"lildax": "./bin/lildax.cjs",
},
@@ -144,7 +144,7 @@
},
"packages/codemode": {
"name": "@opencode-ai/codemode",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"acorn": "8.15.0",
"effect": "catalog:",
@@ -158,7 +158,7 @@
},
"packages/console/app": {
"name": "@opencode-ai/console-app",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@cloudflare/vite-plugin": "1.15.2",
"@ibm/plex": "6.4.1",
@@ -194,7 +194,7 @@
},
"packages/console/core": {
"name": "@opencode-ai/console-core",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@aws-sdk/client-sts": "3.782.0",
"@jsx-email/render": "1.1.1",
@@ -221,7 +221,7 @@
},
"packages/console/function": {
"name": "@opencode-ai/console-function",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@ai-sdk/anthropic": "3.0.82",
"@ai-sdk/openai": "3.0.48",
@@ -243,7 +243,7 @@
},
"packages/console/mail": {
"name": "@opencode-ai/console-mail",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@jsx-email/all": "2.2.3",
"@jsx-email/cli": "1.4.3",
@@ -267,7 +267,7 @@
},
"packages/console/support": {
"name": "@opencode-ai/console-support",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@cloudflare/vite-plugin": "1.15.2",
"@opencode-ai/console-core": "workspace:*",
@@ -287,7 +287,7 @@
},
"packages/core": {
"name": "@opencode-ai/core",
"version": "1.18.20",
"version": "1.18.19",
"bin": {
"opencode": "./bin/opencode",
},
@@ -381,7 +381,7 @@
},
"packages/desktop": {
"name": "@opencode-ai/desktop",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@zip.js/zip.js": "2.7.62",
"drizzle-orm": "catalog:",
@@ -435,7 +435,7 @@
},
"packages/effect-drizzle-sqlite": {
"name": "@opencode-ai/effect-drizzle-sqlite",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"drizzle-orm": "catalog:",
"effect": "catalog:",
@@ -449,7 +449,7 @@
},
"packages/effect-sqlite-node": {
"name": "@opencode-ai/effect-sqlite-node",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"effect": "catalog:",
},
@@ -461,7 +461,7 @@
},
"packages/enterprise": {
"name": "@opencode-ai/enterprise",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@hono/standard-validator": "catalog:",
"@opencode-ai/core": "workspace:*",
@@ -493,7 +493,7 @@
},
"packages/function": {
"name": "@opencode-ai/function",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@octokit/auth-app": "8.0.1",
"@octokit/rest": "catalog:",
@@ -509,7 +509,7 @@
},
"packages/http-recorder": {
"name": "@opencode-ai/http-recorder",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@effect/platform-node": "4.0.0-beta.83",
"@effect/platform-node-shared": "4.0.0-beta.83",
@@ -540,7 +540,7 @@
},
"packages/llm": {
"name": "@opencode-ai/llm",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@opencode-ai/schema": "workspace:*",
"@smithy/eventstream-codec": "4.2.14",
@@ -559,7 +559,7 @@
},
"packages/opencode": {
"name": "opencode",
"version": "1.18.20",
"version": "1.18.19",
"bin": {
"opencode": "./bin/opencode",
},
@@ -690,7 +690,7 @@
},
"packages/plugin": {
"name": "@opencode-ai/plugin",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@ai-sdk/provider": "3.0.8",
"@opencode-ai/sdk": "workspace:*",
@@ -766,7 +766,7 @@
},
"packages/sdk/js": {
"name": "@opencode-ai/sdk",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"cross-spawn": "catalog:",
},
@@ -781,7 +781,7 @@
},
"packages/server": {
"name": "@opencode-ai/server",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@opencode-ai/core": "workspace:*",
"@opencode-ai/protocol": "workspace:*",
@@ -796,7 +796,7 @@
},
"packages/session-ui": {
"name": "@opencode-ai/session-ui",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@kobalte/core": "catalog:",
"@opencode-ai/client": "file:../app/vendor/opencode-ai-client-1.17.13-v2.tgz",
@@ -836,7 +836,7 @@
},
"packages/slack": {
"name": "@opencode-ai/slack",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@opencode-ai/sdk": "workspace:*",
"@slack/bolt": "^3.17.1",
@@ -849,7 +849,7 @@
},
"packages/stats/app": {
"name": "@opencode-ai/stats-app",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@ibm/plex": "6.4.1",
"@kobalte/core": "catalog:",
@@ -883,7 +883,7 @@
},
"packages/stats/core": {
"name": "@opencode-ai/stats-core",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@aws-sdk/client-athena": "3.933.0",
"@planetscale/database": "1.19.0",
@@ -902,7 +902,7 @@
},
"packages/stats/server": {
"name": "@opencode-ai/stats-server",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@aws-sdk/client-firehose": "3.933.0",
"@effect/platform-node": "catalog:",
@@ -944,7 +944,7 @@
},
"packages/tui": {
"name": "@opencode-ai/tui",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@opencode-ai/core": "workspace:*",
"@opencode-ai/plugin": "workspace:*",
@@ -971,7 +971,7 @@
},
"packages/ui": {
"name": "@opencode-ai/ui",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@kobalte/core": "catalog:",
"@pierre/diffs": "catalog:",
@@ -1022,7 +1022,7 @@
},
"packages/web": {
"name": "@opencode-ai/web",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@astrojs/cloudflare": "12.6.3",
"@astrojs/markdown-remark": "6.3.1",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/app",
"version": "1.18.20",
"version": "1.18.19",
"description": "",
"type": "module",
"exports": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/cli",
"version": "1.18.20",
"version": "1.18.19",
"type": "module",
"license": "MIT",
"bin": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/codemode",
"version": "1.18.20",
"version": "1.18.19",
"description": "Effect-native confined code execution over schema-described tools",
"private": true,
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-app",
"version": "1.18.20",
"version": "1.18.19",
"type": "module",
"license": "MIT",
"scripts": {
-1
View File
@@ -271,7 +271,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "الطلبات كل 5 ساعات",
"go.graph.limitedRegions": "مناطق محدودة",
"go.graph.limitedTime": "لفترة محدودة",
"go.graph.usageLimits": "حدود الاستخدام",
"go.graph.aria": "الطلبات كل 5 ساعات: {{free}} مقابل {{go}}",
-1
View File
@@ -275,7 +275,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Requisições por 5 horas",
"go.graph.limitedRegions": "regiões limitadas",
"go.graph.limitedTime": "tempo limitado",
"go.graph.usageLimits": "Limites de uso",
"go.graph.aria": "Requisições por 5h: {{free}} vs {{go}}",
-1
View File
@@ -273,7 +273,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Forespørgsler pr. 5 timer",
"go.graph.limitedRegions": "begrænsede regioner",
"go.graph.limitedTime": "begrænset periode",
"go.graph.usageLimits": "Brugsgrænser",
"go.graph.aria": "Forespørgsler pr. 5t: {{free}} vs {{go}}",
-1
View File
@@ -275,7 +275,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Anfragen pro 5 Stunden",
"go.graph.limitedRegions": "begrenzte Regionen",
"go.graph.limitedTime": "begrenzte Zeit",
"go.graph.usageLimits": "Nutzungslimits",
"go.graph.aria": "Anfragen pro 5h: {{free}} vs {{go}}",
-1
View File
@@ -271,7 +271,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Requests per 5 hour",
"go.graph.limitedRegions": "limited regions",
"go.graph.limitedTime": "limited time",
"go.graph.tick": "{{n}}x",
"go.graph.usageLimits": "Usage limits",
"go.graph.aria": "Requests per 5h: {{free}} vs {{go}}",
-1
View File
@@ -276,7 +276,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Solicitudes por 5 horas",
"go.graph.limitedRegions": "regiones limitadas",
"go.graph.limitedTime": "tiempo limitado",
"go.graph.usageLimits": "Límites de uso",
"go.graph.aria": "Solicitudes por 5h: {{free}} vs {{go}}",
-1
View File
@@ -277,7 +277,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Requêtes par tranche de 5 heures",
"go.graph.limitedRegions": "régions limitées",
"go.graph.limitedTime": "durée limitée",
"go.graph.usageLimits": "Limites d'utilisation",
"go.graph.aria": "Requêtes par 5h : {{free}} vs {{go}}",
-1
View File
@@ -273,7 +273,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Richieste ogni 5 ore",
"go.graph.limitedRegions": "regioni limitate",
"go.graph.limitedTime": "periodo limitato",
"go.graph.usageLimits": "Limiti di utilizzo",
"go.graph.aria": "Richieste ogni 5h: {{free}} vs {{go}}",
-1
View File
@@ -272,7 +272,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "5時間あたりのリクエスト数",
"go.graph.limitedRegions": "一部の地域に限定",
"go.graph.limitedTime": "期間限定",
"go.graph.usageLimits": "利用制限",
"go.graph.aria": "5時間あたりのリクエスト数: {{free}} 対 {{go}}",
-1
View File
@@ -269,7 +269,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "5시간당 요청 수",
"go.graph.limitedRegions": "일부 지역에서만 제공",
"go.graph.limitedTime": "한정된 기간",
"go.graph.usageLimits": "사용 한도",
"go.graph.aria": "5시간당 요청 수: {{free}} 대 {{go}}",
-1
View File
@@ -273,7 +273,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Forespørsler per 5 timer",
"go.graph.limitedRegions": "begrensede regioner",
"go.graph.limitedTime": "begrenset periode",
"go.graph.usageLimits": "Bruksgrenser",
"go.graph.aria": "Forespørsler per 5t: {{free}} vs {{go}}",
-1
View File
@@ -274,7 +274,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Żądania na 5 godzin",
"go.graph.limitedRegions": "ograniczone regiony",
"go.graph.limitedTime": "ograniczony czas",
"go.graph.usageLimits": "Limity użycia",
"go.graph.aria": "Żądania na 5h: {{free}} vs {{go}}",
-1
View File
@@ -277,7 +277,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Запросов за 5 часов",
"go.graph.limitedRegions": "доступно в отдельных регионах",
"go.graph.limitedTime": "ограниченное время",
"go.graph.usageLimits": "Лимиты использования",
"go.graph.aria": "Запросов за 5ч: {{free}} против {{go}}",
-1
View File
@@ -271,7 +271,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "คำขอต่อ 5 ชั่วโมง",
"go.graph.limitedRegions": "เฉพาะบางภูมิภาค",
"go.graph.limitedTime": "ช่วงเวลาจำกัด",
"go.graph.usageLimits": "ขีดจำกัดการใช้งาน",
"go.graph.aria": "คำขอต่อ 5 ชม.: {{free}} vs {{go}}",
-1
View File
@@ -275,7 +275,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "5 saat başına istekler",
"go.graph.limitedRegions": "sınırlı bölgeler",
"go.graph.limitedTime": "sınırlı süre",
"go.graph.usageLimits": "Kullanım limitleri",
"go.graph.aria": "5 saatlik istekler: {{free}} vs {{go}}",
-1
View File
@@ -274,7 +274,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "Запитів за 5 годин",
"go.graph.limitedRegions": "обмежені регіони",
"go.graph.limitedTime": "обмежений час",
"go.graph.usageLimits": "Ліміти використання",
"go.graph.aria": "Запитів за 5 год: {{free}} vs {{go}}",
-1
View File
@@ -261,7 +261,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "每 5 小时请求数",
"go.graph.limitedRegions": "仅限部分地区",
"go.graph.limitedTime": "限时",
"go.graph.usageLimits": "使用限制",
"go.graph.aria": "每 5 小时请求数: {{free}} vs {{go}}",
-1
View File
@@ -261,7 +261,6 @@ export const dict = {
"go.graph.go": "Go",
"go.graph.label": "每 5 小時請求數",
"go.graph.limitedRegions": "僅限部分地區",
"go.graph.limitedTime": "限時",
"go.graph.usageLimits": "使用限制",
"go.graph.aria": "每 5 小時請求數:{{free}} vs {{go}}",
+1 -6
View File
@@ -592,7 +592,7 @@ body {
white-space: nowrap;
}
:is([data-regions], [data-limited]) {
[data-regions] {
color: var(--color-text-weak);
white-space: nowrap;
@@ -698,11 +698,6 @@ body {
fill: color-mix(in srgb, var(--bar-go) 50%, transparent);
}
[data-item][data-infinite] [data-value] {
font-size: 18px;
line-height: 1;
}
[data-val] {
fill: var(--color-text-strong);
font-size: 13px;
+5 -11
View File
@@ -80,7 +80,6 @@ function LimitsGraph(props: { href: string }) {
{ id: "mimo-v2.5", name: "MiMo-V2.5", req: 30100, d: "340ms" },
{ id: "hy3", name: "Hy3", req: 34400, baseReq: 4300, d: "320ms" },
{ id: "muse-spark-1.2-contributor", name: "Muse Spark 1.2 Contributor", req: 45300, edge: true, d: "360ms" },
{ id: "x-preview-f-free", name: "Ox Alpha Free", req: Infinity, infinite: true, edge: true, d: "400ms" },
]
const w = 1040
@@ -90,10 +89,9 @@ function LimitsGraph(props: { href: string }) {
const top = 18
const bottom = 44
const plot = chartW - left - right
const infiniteX = w - 180
const ratio = (n: number) => n / baseline
const rmax = Math.max(1, ...graph.filter((m) => !("infinite" in m)).map((m) => ratio(m.req)))
const rmax = Math.max(1, ...graph.map((m) => ratio(m.req)))
const log = (n: number) => Math.log10(Math.max(n, 1))
const base = 24
const p = 2.2
@@ -155,10 +153,10 @@ function LimitsGraph(props: { href: string }) {
<rect
x={left}
y={gy(i()) - bh / 2}
width={Math.max(0, ("infinite" in m ? infiniteX : x(ratio(m.baseReq ?? m.req))) - left)}
width={Math.max(0, x(ratio(m.baseReq ?? m.req)) - left)}
height={bh}
data-bar
data-kind={"infinite" in m ? "infinite" : "go"}
data-kind="go"
data-model={m.id}
/>
{m.baseReq && (
@@ -202,12 +200,9 @@ function LimitsGraph(props: { href: string }) {
data-kind="go"
data-model={m.id}
data-edge={"edge" in m ? "" : undefined}
data-infinite={"infinite" in m ? "" : undefined}
style={
{ "--x": px("infinite" in m ? infiniteX : x(ratio(m.req))), "--y": py(gy(i())), "--d": m.d } as any
}
style={{ "--x": px(x(ratio(m.req))), "--y": py(gy(i())), "--d": m.d } as any}
>
<span data-value>{"infinite" in m ? "∞" : m.req.toLocaleString()}</span>
<span data-value>{m.req.toLocaleString()}</span>
<span data-name>{m.name}</span>
{m.id === "muse-spark-1.2-contributor" && (
<span data-regions>
@@ -218,7 +213,6 @@ function LimitsGraph(props: { href: string }) {
)
</span>
)}
{"infinite" in m && <span data-limited>({i18n.t("go.graph.limitedTime")})</span>}
{m.baseReq && <span data-bonus>8x usage</span>}
</span>
)}
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/console-core",
"version": "1.18.20",
"version": "1.18.19",
"private": true,
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-function",
"version": "1.18.20",
"version": "1.18.19",
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-mail",
"version": "1.18.20",
"version": "1.18.19",
"dependencies": {
"@jsx-email/all": "2.2.3",
"@jsx-email/cli": "1.4.3",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/console-support",
"version": "1.18.20",
"version": "1.18.19",
"type": "module",
"license": "MIT",
"scripts": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.18.20",
"version": "1.18.19",
"name": "@opencode-ai/core",
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"name": "@opencode-ai/desktop",
"private": true,
"version": "1.18.20",
"version": "1.18.19",
"type": "module",
"license": "MIT",
"homepage": "https://opencode.ai",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.18.20",
"version": "1.18.19",
"name": "@opencode-ai/effect-drizzle-sqlite",
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.18.20",
"version": "1.18.19",
"name": "@opencode-ai/effect-sqlite-node",
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/enterprise",
"version": "1.18.20",
"version": "1.18.19",
"private": true,
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/function",
"version": "1.18.20",
"version": "1.18.19",
"$schema": "https://json.schemastore.org/package.json",
"private": true,
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.18.20",
"version": "1.18.19",
"name": "@opencode-ai/http-recorder",
"description": "Record and replay Effect HTTP client traffic with deterministic cassettes",
"type": "module",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.18.20",
"version": "1.18.19",
"name": "@opencode-ai/llm",
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"$schema": "https://json.schemastore.org/package.json",
"version": "1.18.20",
"version": "1.18.19",
"name": "opencode",
"type": "module",
"license": "MIT",
+22
View File
@@ -29,6 +29,8 @@ import * as OtelTracer from "@effect/opentelemetry/Tracer"
import { LLMAISDK } from "./llm/ai-sdk"
import { LLMNativeRuntime } from "./llm/native-runtime"
import { LLMRequestPrep } from "./llm/request"
import { ProviderError } from "@/provider/error"
import type { LanguageModelV3StreamPart } from "@ai-sdk/provider"
export const OUTPUT_TOKEN_MAX = ProviderTransform.OUTPUT_TOKEN_MAX
@@ -338,6 +340,26 @@ const live: Layer.Layer<
}
return args.params
},
async wrapStream({ doStream }) {
const result = await doStream()
return {
...result,
stream: result.stream.pipeThrough(
new TransformStream<LanguageModelV3StreamPart, LanguageModelV3StreamPart>({
transform(part, controller) {
if (part.type === "finish" && part.finishReason.raw === "network_error") {
controller.enqueue({
type: "error",
error: new ProviderError.ResponseStreamError("Provider finish_reason: network_error"),
})
return
}
controller.enqueue(part)
},
}),
),
}
},
},
],
}),
@@ -2,7 +2,6 @@ import { FinishReason, LLMEvent, ProviderMetadata, ToolResultValue } from "@open
import { Effect, Schema } from "effect"
import { type streamText } from "ai"
import { errorMessage } from "@/util/error"
import { ProviderError } from "@/provider/error"
type Result = Awaited<ReturnType<typeof streamText>>
type AISDKEvent = Result["fullStream"] extends AsyncIterable<infer T> ? T : never
@@ -86,8 +85,6 @@ export function toLLMEvents(
return Effect.succeed([LLMEvent.stepStart({ index: state.step })])
case "finish-step":
if (event.rawFinishReason === "network_error")
return Effect.fail(new ProviderError.ResponseStreamError("Provider finish_reason: network_error"))
return Effect.sync(() => {
const original = providerMetadata(event.providerMetadata)
const metadata =
-4
View File
@@ -217,10 +217,6 @@ export const TaskTool = Tool.define(
: result.info.error.name
return yield* Effect.fail(new Error(`Subagent failed (task_id: ${nextSession.id}): ${message}`))
}
const failed = result.parts.findLast((item) => item.type === "tool" && item.state.status === "error")
if (failed?.type === "tool" && failed.state.status === "error") {
return yield* Effect.fail(new Error(`Subagent failed (task_id: ${nextSession.id}): ${failed.state.error}`))
}
return result.parts.findLast((item) => item.type === "text")?.text ?? ""
})
@@ -277,6 +277,50 @@ describe("opencode run (non-interactive subprocess)", () => {
60_000,
)
cliIt.concurrent(
"answers requested permissions from subagents",
({ llm, opencode }) =>
Effect.gen(function* () {
yield* llm.tool("task", {
description: "Run a command",
prompt: "Run the requested command",
subagent_type: "general",
})
yield* llm.tool("bash", { command: "printf child", description: "Print from the child" })
yield* llm.text("child finished")
yield* llm.text("parent finished")
const result = yield* opencode.run("delegate a command", {
permission: { bash: "ask" },
extraArgs: ["--dangerously-skip-permissions"],
timeoutMs: 10_000,
})
opencode.expectExit(result, 0)
expect(result.stdout).toContain("parent finished")
yield* llm.reset
yield* llm.tool("task", {
description: "Run a command",
prompt: "Run the requested command",
subagent_type: "general",
})
yield* llm.tool("bash", { command: "printf child", description: "Print from the child" })
yield* llm.text("child continued")
yield* llm.text("parent continued")
const rejected = yield* opencode.run("delegate a rejected command", {
permission: { bash: "ask" },
timeoutMs: 10_000,
})
opencode.expectExit(rejected, 0)
expect(rejected.stderr).toContain("permission requested: bash")
expect(rejected.stdout).toContain("child continued")
}),
30_000,
)
cliIt.live(
"attach mode sends client-local file contents without a shared path",
({ home, llm, opencode }) =>
@@ -651,63 +651,6 @@ it.live("session.processor effect tests retry OpenAI-compatible midstream server
),
)
it.live("session.processor effect tests retry network_error finish reasons", () =>
provideTmpdirServer(
({ dir, llm }) =>
Effect.gen(function* () {
const { processors, session, provider } = yield* boot()
yield* llm.push(
raw({
chunks: [
{
id: "chatcmpl-network-error",
object: "chat.completion.chunk",
choices: [{ index: 0, delta: { role: "assistant", content: "" }, finish_reason: "network_error" }],
},
],
}),
)
yield* llm.text("after retry")
const chat = yield* session.create({})
const parent = yield* user(chat.id, "retry network error")
const msg = yield* assistant(chat.id, parent.id, path.resolve(dir))
const mdl = yield* provider.getModel(ref.providerID, ref.modelID)
const handle = yield* processors.create({
assistantMessage: msg,
sessionID: chat.id,
model: mdl,
})
const value = yield* handle.process({
user: {
id: parent.id,
sessionID: chat.id,
role: "user",
time: parent.time,
agent: parent.agent,
model: { providerID: ref.providerID, modelID: ref.modelID },
} satisfies SessionV1.User,
sessionID: chat.id,
model: mdl,
agent: agent(),
system: [],
messages: [{ role: "user", content: "retry network error" }],
tools: {},
})
const parts = yield* MessageV2.parts(msg.id)
expect(value).toBe("continue")
expect(yield* llm.calls).toBe(2)
expect(parts.some((part) => part.type === "text" && part.text === "after retry")).toBe(true)
expect(handle.message.error).toBeUndefined()
}),
{ config: (url) => providerCfg(url) },
),
)
it.live("session.processor effect tests publish retry status updates", () =>
provideTmpdirServer(
({ dir, llm }) =>
+1 -65
View File
@@ -100,7 +100,6 @@ function stubOps(opts?: {
onPrompt?: (input: SessionPrompt.PromptInput) => void
text?: string
error?: NonNullable<SessionV1.Assistant["error"]>
toolError?: string
}): TaskPromptOps {
return {
cancel: () => Effect.void,
@@ -108,7 +107,7 @@ function stubOps(opts?: {
prompt: (input) =>
Effect.sync(() => {
opts?.onPrompt?.(input)
return reply(input, opts?.text ?? "done", opts?.error, opts?.toolError)
return reply(input, opts?.text ?? "done", opts?.error)
}),
}
}
@@ -117,7 +116,6 @@ function reply(
input: SessionPrompt.PromptInput,
text: string,
error?: NonNullable<SessionV1.Assistant["error"]>,
toolError?: string,
): SessionV1.WithParts {
const id = MessageID.ascending()
return {
@@ -145,24 +143,6 @@ function reply(
type: "text",
text,
},
...(toolError
? [
{
id: PartID.ascending(),
messageID: id,
sessionID: input.sessionID,
type: "tool" as const,
tool: "read",
callID: "call-1",
state: {
status: "error" as const,
input: { filePath: "/external" },
error: toolError,
time: { start: Date.now(), end: Date.now() },
},
},
]
: []),
],
}
}
@@ -327,50 +307,6 @@ describe("tool.task", () => {
}),
)
it.instance("execute surfaces terminal child tool errors with a resumable task_id", () =>
Effect.gen(function* () {
const sessions = yield* Session.Service
const { chat, assistant } = yield* seed()
const tool = yield* TaskTool
const def = yield* tool.init()
const exit = yield* def
.execute(
{
description: "inspect external directory",
prompt: "read the external directory",
subagent_type: "general",
},
{
sessionID: chat.id,
messageID: assistant.id,
agent: "build",
abort: new AbortController().signal,
extra: {
promptOps: stubOps({
text: "I will inspect the directory.",
toolError: "The user rejected permission to use this specific tool call.",
}),
},
messages: [],
metadata: () => Effect.void,
ask: () => Effect.void,
},
)
.pipe(Effect.exit)
expect(Exit.isFailure(exit)).toBe(true)
if (Exit.isSuccess(exit)) throw new Error("expected task failure")
const child = (yield* sessions.children(chat.id))[0]
const failure = Cause.squash(exit.cause)
expect(failure).toBeInstanceOf(Error)
if (!(failure instanceof Error)) throw new Error("expected Error defect")
expect(failure.message).toBe(
`Subagent failed (task_id: ${child?.id}): The user rejected permission to use this specific tool call.`,
)
}),
)
it.instance("execute asks by default and skips checks when bypassed", () =>
Effect.gen(function* () {
const { chat, assistant } = yield* seed()
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/plugin",
"version": "1.18.20",
"version": "1.18.19",
"type": "module",
"license": "MIT",
"scripts": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/sdk",
"version": "1.18.20",
"version": "1.18.19",
"type": "module",
"license": "MIT",
"scripts": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/server",
"version": "1.18.20",
"version": "1.18.19",
"private": true,
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/session-ui",
"version": "1.18.20",
"version": "1.18.19",
"private": true,
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/slack",
"version": "1.18.20",
"version": "1.18.19",
"type": "module",
"license": "MIT",
"scripts": {
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/stats-app",
"version": "1.18.20",
"version": "1.18.19",
"private": true,
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/stats-core",
"version": "1.18.20",
"version": "1.18.19",
"private": true,
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/stats-server",
"version": "1.18.20",
"version": "1.18.19",
"private": true,
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://json.schemastore.org/package.json",
"name": "@opencode-ai/tui",
"version": "1.18.20",
"version": "1.18.19",
"private": true,
"type": "module",
"license": "MIT",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@opencode-ai/ui",
"version": "1.18.20",
"version": "1.18.19",
"type": "module",
"license": "MIT",
"repository": {
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "@opencode-ai/web",
"type": "module",
"license": "MIT",
"version": "1.18.20",
"version": "1.18.19",
"scripts": {
"dev": "astro dev",
"dev:remote": "VITE_API_URL=https://api.opencode.ai astro dev",
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "opencode",
"displayName": "opencode",
"description": "opencode for VS Code",
"version": "1.18.20",
"version": "1.18.19",
"publisher": "sst-dev",
"repository": {
"type": "git",