dsh-eval-guard 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/lib/index.js +29 -9
- package/package.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -34,7 +34,7 @@ node scripts/build-native.mjs
|
|
|
34
34
|
~~~bash
|
|
35
35
|
scripts/install.sh web
|
|
36
36
|
# 如果脚本找不到 dsh 命令:
|
|
37
|
-
DSH_CHECKOUT=/
|
|
37
|
+
DSH_CHECKOUT=/path/to/deepseek-harness scripts/install.sh web
|
|
38
38
|
# 然后重启 dsh web
|
|
39
39
|
~~~
|
|
40
40
|
|
package/lib/index.js
CHANGED
|
@@ -337,10 +337,29 @@ function packageRoot() {
|
|
|
337
337
|
function supervisorPath() {
|
|
338
338
|
return path.join(packageRoot(), "native", "dsh-eval-supervisor");
|
|
339
339
|
}
|
|
340
|
-
/**
|
|
340
|
+
/** Launcher-provided facts; nothing here is a fixed install path. */
|
|
341
|
+
let runtimeHome;
|
|
342
|
+
let runtimeProfileDir;
|
|
343
|
+
/** Record the launcher's profile/home paths. */
|
|
344
|
+
function configureRuntimeContext(next) {
|
|
345
|
+
if (next.home !== void 0 && next.home !== "") runtimeHome = next.home;
|
|
346
|
+
if (next.profileDir !== void 0 && next.profileDir !== "") runtimeProfileDir = next.profileDir;
|
|
347
|
+
}
|
|
348
|
+
/** The DSH home: launcher profile context, then $DSH_HOME, then ~/.dsh. */
|
|
341
349
|
function dshHome() {
|
|
350
|
+
if (runtimeHome !== void 0) return runtimeHome;
|
|
342
351
|
return process.env.DSH_HOME && process.env.DSH_HOME !== "" ? process.env.DSH_HOME : path.join(os.homedir(), ".dsh");
|
|
343
352
|
}
|
|
353
|
+
/** Candidate node_modules directories, launcher profile first and then profiles/*. */
|
|
354
|
+
function profileNodeModules() {
|
|
355
|
+
const out = [];
|
|
356
|
+
if (runtimeProfileDir !== void 0) out.push(path.join(runtimeProfileDir, "node_modules"));
|
|
357
|
+
const profiles = path.join(dshHome(), "profiles");
|
|
358
|
+
try {
|
|
359
|
+
for (const entry of fs.readdirSync(profiles, { withFileTypes: true })) if (entry.isDirectory()) out.push(path.join(profiles, entry.name, "node_modules"));
|
|
360
|
+
} catch {}
|
|
361
|
+
return out;
|
|
362
|
+
}
|
|
344
363
|
/** Root for run records, audits, and sandbox policy files. */
|
|
345
364
|
function guardRoot() {
|
|
346
365
|
return path.join(dshHome(), "eval-guard");
|
|
@@ -381,14 +400,9 @@ function packageDir(name) {
|
|
|
381
400
|
const require = createRequire(path.join(process.cwd(), "noop.js"));
|
|
382
401
|
candidates.push(path.dirname(require.resolve(name + "/package.json")));
|
|
383
402
|
} catch {}
|
|
384
|
-
if (name === "@deepseek-ai/dsh-ptc-runtime-node")
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
}
|
|
388
|
-
if (name === "@deepseek-ai/dsh-subprocess") {
|
|
389
|
-
candidates.push(path.join(process.cwd(), "packages", "subprocess", "subprocess"));
|
|
390
|
-
candidates.push(path.join(dshHome(), "profiles", "web", "node_modules", name));
|
|
391
|
-
}
|
|
403
|
+
if (name === "@deepseek-ai/dsh-ptc-runtime-node") candidates.push(path.join(process.cwd(), "packages", "ptc-runtime", "ptc-runtime-node"));
|
|
404
|
+
if (name === "@deepseek-ai/dsh-subprocess") candidates.push(path.join(process.cwd(), "packages", "subprocess", "subprocess"));
|
|
405
|
+
for (const modules of profileNodeModules()) candidates.push(path.join(modules, name));
|
|
392
406
|
for (const candidate of candidates) try {
|
|
393
407
|
if (fs.statSync(path.join(candidate, "package.json")).isFile()) return fs.realpathSync.native(candidate);
|
|
394
408
|
} catch {}
|
|
@@ -1650,6 +1664,12 @@ function apply(ctx, config) {
|
|
|
1650
1664
|
"sandboxPolicy",
|
|
1651
1665
|
"workspaceRegistry"
|
|
1652
1666
|
], (child) => {
|
|
1667
|
+
const getService = ctx.get;
|
|
1668
|
+
const profile = typeof getService === "function" ? getService.call(ctx, "profileContext") : void 0;
|
|
1669
|
+
configureRuntimeContext({
|
|
1670
|
+
home: profile?.home,
|
|
1671
|
+
profileDir: profile?.dir
|
|
1672
|
+
});
|
|
1653
1673
|
const services = {
|
|
1654
1674
|
sessions: child.get("sessions"),
|
|
1655
1675
|
agents: child.get("agents"),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-eval-guard",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Evaluation guard for DSH: workspace-only filesystem, no network/subagents, wall-clock limits, and task installation for the meow-ai-arena tank task.",
|
|
6
6
|
"license": "MIT",
|