Documented tree replacement (the history has no git-subtree metadata): 3-way merge of the old subtree (570201a:engine/strata) against upstream 41cf05a06a25dd29103b7b27a2279a3f60c21876 (2026-10-25), merge base = the old pin d9ab8435 (tree-identical to upstream 5b734e42; d9ab8435 is not an ancestor of upstream main). Local patches re-applied by hand where they conflicted (15 files): STRATA_CUDA_STATIC profile, experimental KAR experts and KAR PLE arms, keyless V-only arm (now beside upstream's K8V4 hybrid KV and fused norm+rope). Details, conflict table and left-out files are in docs/upstream.md. Left out (weights, captures, logs, media): new bench/results (2022 files), binary media and app assets (61), docs/work/evidence (24), *.bin / *.gguf data files, and the 7 files the first import already left out. scripts/build-cpu.sh: build the 11 CPU tests upstream registered since the old pin (they ran as "Not Run"). Checked: build-cpu.sh 16/16 ctest in WSL; sm_86 CUDA objects of the patched files compile, also with the KAR macros on. No GPU run, no quality gate. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
80 lines
4.1 KiB
JavaScript
80 lines
4.1 KiB
JavaScript
/**
|
|
* Which files and folders of the staged Harness are dropped, and the check that nothing the Harness imports is gone.
|
|
*
|
|
* The 2026-10-17 tester report: on Linux and Mac every agent chat failed ("session/create ... waiting for workflowEngine").
|
|
* Cause: the old rule "drop any folder named after another operating system" also removed the Harness's own JavaScript package
|
|
* `@deepseek-ai/dsh-win32-process`. It is plain JS (no binary), and `dsh-subprocess-local` and `dsh-sandbox-local` import it by
|
|
* name on every platform, so those two plugins failed to load, and everything waiting on them (shell, subprocess, ptcRuntime,
|
|
* workflowEngine) never started. Windows kept it (the rule differs there), so the Windows tests passed.
|
|
*/
|
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
import { join, sep } from 'node:path';
|
|
|
|
export const OTHER_OS = {
|
|
win32: /(^|[\\/._-])(darwin|linux|android|freebsd|musl)([\\/._-]|$)/i,
|
|
darwin: /(^|[\\/._-])(win32|linux|android|freebsd|musl)([\\/._-]|$)/i,
|
|
// Linux: the AppImage bundler (linuxdeploy) resolves the libraries of every ELF file under resources and stops on one it
|
|
// cannot satisfy (koffi's musl build wants libc.musl). The app is glibc x86_64, so musl and other-CPU builds are dropped.
|
|
linux: /(^|[\\/._-])(win32|darwin|android|freebsd|musl|arm64|aarch64|armv7|arm|ia32|riscv64|ppc64|s390x|loong64)([\\/._-]|$)/i,
|
|
};
|
|
const NATIVE_FOLDER = /prebuild|bin|native|platform|-(win32|darwin|linux)/i;
|
|
|
|
/** The Harness's own JavaScript packages (`@deepseek-ai/dsh-*`) are code every platform imports by name; never drop one. */
|
|
export function isHarnessCodePackage(path) {
|
|
const parts = path.split(sep);
|
|
const i = parts.lastIndexOf('@deepseek-ai');
|
|
return i >= 0 && i === parts.length - 2 && parts[i + 1].startsWith('dsh-');
|
|
}
|
|
|
|
/** True when the folder `path` (a directory named `name`) is another operating system's prebuilt binary and can go. */
|
|
export function isOtherOsBinaryFolder(platform, name, path) {
|
|
const rule = OTHER_OS[platform] ?? OTHER_OS.linux;
|
|
if (isHarnessCodePackage(path)) return false;
|
|
return rule.test(name) && NATIVE_FOLDER.test(path);
|
|
}
|
|
|
|
/** Imports the Windows copy (which works) is also without: browser-side or dev-only bundles, and the document converter the app drops on purpose. */
|
|
const KNOWN_ABSENT = new Set([
|
|
'@deepseek-ai/libreoffice-kit', '@deepseek-ai/dsh-client-ui-dockkit', '@deepseek-ai/dsh-client-web',
|
|
'@deepseek-ai/dsh-experimental-webworker-runtime', '@deepseek-ai/dsh-remote-mock', '@deepseek-ai/dsh-client-test-runtime',
|
|
]);
|
|
|
|
function jsFiles(dir, out = []) {
|
|
for (const e of readdirSync(dir, { withFileTypes: true })) {
|
|
const p = join(dir, e.name);
|
|
if (e.isSymbolicLink()) continue;
|
|
if (e.isDirectory()) jsFiles(p, out);
|
|
else if (/\.(m?js|cjs)$/.test(e.name)) out.push(p);
|
|
}
|
|
return out;
|
|
}
|
|
|
|
/**
|
|
* Every bare `@deepseek-ai/<package>` the staged Harness's own packages import (static `from "x"` and `import("x")`) must exist
|
|
* in the staged node_modules. Returns the list of `{from, missing}` problems (empty = good). Plugins that are only loaded on
|
|
* another platform still count: Node resolves a static import whether or not the code runs.
|
|
*/
|
|
export function missingHarnessImports(harnessDir) {
|
|
const scope = join(harnessDir, 'node_modules', '@deepseek-ai');
|
|
if (!existsSync(scope)) return [{ from: scope, missing: '@deepseek-ai (no installed packages)' }];
|
|
const problems = [];
|
|
const seen = new Set();
|
|
const re = /(?:from|import)\s*\(?\s*["'](@deepseek-ai\/[^"'/]+)(?:\/[^"']*)?["']/g;
|
|
for (const pkg of readdirSync(scope)) {
|
|
const lib = join(scope, pkg, 'lib');
|
|
if (!existsSync(lib)) continue;
|
|
for (const file of jsFiles(lib)) {
|
|
const text = readFileSync(file, 'utf8');
|
|
for (const m of text.matchAll(re)) {
|
|
const name = m[1];
|
|
const key = `${pkg}>${name}`;
|
|
if (seen.has(key) || KNOWN_ABSENT.has(name)) continue;
|
|
seen.add(key);
|
|
if (!existsSync(join(harnessDir, 'node_modules', ...name.split('/')))
|
|
&& !existsSync(join(scope, pkg, 'node_modules', ...name.split('/')))) problems.push({ from: `${pkg}`, missing: name });
|
|
}
|
|
}
|
|
}
|
|
return problems;
|
|
}
|