diff --git a/package.json b/package.json index ccb07b9..7f8c3eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zcode-app-cli", - "version": "3.7.5-11", + "version": "3.7.6-11", "description": "Unofficial terminal client for the ZCode agent runtime", "keywords": [ "agent", diff --git a/scripts/check-runtime.ts b/scripts/check-runtime.ts index edcf99e..48cc87f 100755 --- a/scripts/check-runtime.ts +++ b/scripts/check-runtime.ts @@ -49,8 +49,6 @@ if (!runtimeSource.includes('"plugin://"') || !runtimeSource.includes(".subscribeSessionEvents=") || !runtimeSource.includes(".sendBackgroundTaskMessage=async") || !runtimeSource.includes("backgroundTaskDetails") - || !runtimeSource.includes('i.includes("AI SDK Warning")&&i.includes("cacheControl breakpoint limit")') - || !runtimeSource.includes('if(n==="model_not_found")return{code:lr.ModelNotFound') || !runtimeSource.includes("autoBackgroundMs:this.config.subagents?.autoBackgroundMs??1e3,outputRootDir:") || runtimeSource.split("Detached background agent lifecycle failed").length < 3 || !runtimeSource.includes('if(e?.restart===!0&&o.status==="running")') diff --git a/scripts/sync-runtime.ts b/scripts/sync-runtime.ts index e83608d..cab6fcf 100755 --- a/scripts/sync-runtime.ts +++ b/scripts/sync-runtime.ts @@ -247,24 +247,6 @@ export function supportsMultiMessageFileRewind(runtime: string): boolean { .test(runtime); } -/** Suppress known cache-control warnings before they reach the TUI stderr stream. */ -export function patchRuntimeTuiWarnings(runtime: string): string { - const suppression = 'i.includes("AI SDK Warning")&&i.includes("cacheControl breakpoint limit")'; - if (runtime.includes(suppression)) return runtime; - const anchor = "if(LKn.test(i)||BKn.test(i)){"; - if (!runtime.includes(anchor)) return runtime; - return runtime.replace(anchor, "if(LKn.test(i)||BKn.test(i)||" + suppression + "){"); -} - -/** Prevent provider model lookup failures from being retried as generic 5xx errors. */ -export function patchRuntimeProviderRetryClassification(runtime: string): string { - const classification = 'if(n==="model_not_found")return{code:lr.ModelNotFound,message:o,reason:Ht.InvalidRequest,retryReason:fn.NetworkError,retryable:!1,retryAfterMs:r,statusCode:i};'; - if (runtime.includes(classification)) return runtime; - const anchor = 'function QBr(e,t,r){if(!CS(e))return;let o=XBr(e),n=eUr(e),i=AWo(e,t),a=n?ZBr(n):void 0;'; - if (!runtime.includes(anchor)) return runtime; - return runtime.replace(anchor, anchor + classification); -} - /** Keep short Agent calls inline, but detach long-running agents from the foreground turn. */ export function patchRuntimeAgentAutoBackground(runtime: string): string { const marker = "autoBackgroundMs:this.config.subagents?.autoBackgroundMs??1e3,outputRootDir:"; @@ -743,11 +725,7 @@ async function installTuiBridge(nextVendor: string): Promise { patchRuntimeAgentAutoBackground( patchRuntimeDetachedAgentLifecycle( patchRuntimeTerminalToolProjection( - patchRuntimeProviderRetryClassification( - patchRuntimeTuiWarnings( - patchRuntimeBackgroundTaskProjection(patchRuntimeTuiBridge(runtime)) - ) - ) + patchRuntimeBackgroundTaskProjection(patchRuntimeTuiBridge(runtime)) ) ) ) diff --git a/test/sync-runtime.test.ts b/test/sync-runtime.test.ts index 2881b17..d923de3 100644 --- a/test/sync-runtime.test.ts +++ b/test/sync-runtime.test.ts @@ -8,11 +8,9 @@ import { patchRuntimeAgentAutoBackground, patchRuntimeBackgroundTaskProjection, patchRuntimeDetachedAgentLifecycle, - patchRuntimeProviderRetryClassification, patchRuntimeTerminalToolProjection, patchRuntimeOAuthHttpErrors, patchRuntimeTuiBridge, - patchRuntimeTuiWarnings, patchRuntimeZaiDesktopOAuth, resolveArtifactUrl, resolveLatestRuntimeLock, @@ -411,43 +409,6 @@ describe("runtime synchronization", () => { expect(modernPatched).not.toContain("Array.isArray(t.targetMessageIds)"); }); - test("filters cache-control warnings from the TUI stderr stream", () => { - const runtime = "function UKn(e,t){if(LKn.test(i)||BKn.test(i)){return i}}"; - const patched = patchRuntimeTuiWarnings(runtime); - expect(patched).toContain('i.includes("AI SDK Warning")&&i.includes("cacheControl breakpoint limit")'); - expect(patchRuntimeTuiWarnings(patched)).toBe(patched); - }); - - test("does not retry provider model lookup failures reported with HTTP 503", () => { - const runtime = [ - 'const CS=()=>true,XBr=e=>e.providerMessage,eUr=e=>e.providerCode,AWo=e=>e.responseStatus,ZBr=()=>undefined;', - 'const lr={ModelNotFound:"model_not_found"},Ht={InvalidRequest:"invalid_request"},fn={NetworkError:"network_error"};', - "function QBr(e,t,r){if(!CS(e))return;let o=XBr(e),n=eUr(e),i=AWo(e,t),a=n?ZBr(n):void 0;", - "if(a)return a;return i>=500?{retryable:!0,statusCode:i}:{retryable:!1,statusCode:i}}" - ].join(""); - const patched = patchRuntimeProviderRetryClassification(runtime); - expect(patched).toContain( - 'if(n==="model_not_found")return{code:lr.ModelNotFound,message:o,reason:Ht.InvalidRequest,retryReason:fn.NetworkError,retryable:!1' - ); - const classify = new Function(`${patched};return QBr;`)() as ( - error: { providerCode: string; providerMessage: string; responseStatus: number } - ) => { code?: string; retryable: boolean; statusCode: number }; - expect(classify({ - providerCode: "model_not_found", - providerMessage: "No available channel for model GLM-5.2", - responseStatus: 503 - })).toMatchObject({ code: "model_not_found", retryable: false, statusCode: 503 }); - expect(classify({ - providerCode: "server_error", - providerMessage: "Temporary upstream failure", - responseStatus: 503 - })).toMatchObject({ retryable: true, statusCode: 503 }); - expect(patchRuntimeProviderRetryClassification(patched)).toBe(patched); - expect(patchRuntimeProviderRetryClassification("runtime without the classifier anchor")).toBe( - "runtime without the classifier anchor" - ); - }); - test("auto-backgrounds long Agent calls while preserving explicit configuration", () => { const runtime = "function delay(){return{autoBackgroundMs:this.config.subagents?.autoBackgroundMs,outputRootDir:'tasks'}}"; const patched = patchRuntimeAgentAutoBackground(runtime); diff --git a/zcode-runtime.lock.json b/zcode-runtime.lock.json index 29ed3f9..e2e15ab 100644 --- a/zcode-runtime.lock.json +++ b/zcode-runtime.lock.json @@ -1,8 +1,8 @@ { "schemaVersion": 1, - "appVersion": "3.7.5", + "appVersion": "3.7.6", "platform": "linux", "arch": "x64", - "url": "https://cdn-zcode.z.ai/zcode/electron/releases/3.7.5/linux-x64/ZCode-3.7.5-linux-x64.deb", - "sha512": "+gCFedwyxr4BJEIQ4QWmbj21FlyGn7Gb3LbcQsyx38PKAt2qoRbjAVjM5XVU0Tj5wViuKFZk/1xRuem28Kjf7A==" + "url": "https://cdn-zcode.z.ai/zcode/electron/releases/3.7.6/linux-x64/ZCode-3.7.6-linux-x64.deb", + "sha512": "G2/jCJdOOc7vlCSoqJjCyz7UTdaBWucW7+itRYU5jCEeqvirGOau3hK7HAuf4/Ahv5qQNBO3kU2JjwXx4kdCWQ==" }