Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ This port applies the Cursor → Claude Code substitutions in skill bodies. Earl

**Muse Wonder Full 1.0 lanes (#291).** Started from LuneDevelops's PR #292. The catalog registers `muse:muse-wonder-full-1.0` as an optional family with efforts `low` to `max` and a default of `xhigh`, so `/setup-pstack` can place it in a role or panel. Muse lanes keep the external runner from every parent, and a Muse writer still needs `muse writer sandbox: full-access`. The Muse preflight also passes a signed-in `muse usage` that prints `No usage data (server_sent_no_usage)`, with the evidence `subscription-no-usage-data`; measured with Muse Code 1.4.14, that output proves the login, and the model call still checks the allowance. The Muse notes were rechecked with Muse Code 1.4.25, which also accepts `ultra` as an effort; the runner does not offer it.

**DeepSeek Harness 0.2.2-rc.3 on Windows (#312).** Started from Minervaowl7's PR #300. On Windows, the DeepSeek Harness lane accepts dsh `0.2.2-rc.3` as well as `0.2.1-rc.2`; other hosts accept only `0.2.1-rc.2`. The contributor measured `0.2.2-rc.3` on Windows for the patch rows, the stored-login preflight, read-only and the bounded writer. The Windows sandbox mechanism and the escape matrix were measured only on macOS.

## 1.21.0 adds Grok as a parent harness

Open Pstack 1.21.0 keeps the Cursor pstack 0.15.36 sync. Default roles and panels are unchanged.
Expand Down
6 changes: 3 additions & 3 deletions plugins/pstack/skills/poteto-mode/references/model-catalog.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Rolling aliases:
| grok | external runner | external runner | explicit descriptor: external runner; `inherit-parent`, `auto`: native `spawn_subagent` | `read-only`, `isolated-write` | file | provider report | allowlist | Linux: Landlock and `bwrap`; macOS: any `/var/run/docker.sock` symlink points inside Grok's runtime-socket list |
| devin | external runner | external runner | external runner | `read-only`, `isolated-write`, `isolated-write-full-access` | file | provider report | allowlist | - |
| opencode | external runner | external runner | external runner | `read-only`, `isolated-write-full-access` | stdin | pinned argv | allowlist | - |
| dsh | external runner | external runner | external runner | `read-only`, `isolated-write` | stdin | pinned argv | allowlist | dsh 0.2.1-rc.2 exactly |
| dsh | external runner | external runner | external runner | `read-only`, `isolated-write` | stdin | pinned argv | allowlist | dsh 0.2.1-rc.2 on all hosts or 0.2.2-rc.3 on Windows |
| amp | external runner | external runner | external runner | `read-only`, `isolated-write-full-access` | stdin | pinned argv | allowlist | - |
| agy | external runner | external runner | external runner | `read-only`, `isolated-write-full-access` | stdin | pinned argv | allowlist | - |
| cursor | external runner | external runner | external runner | `read-only`, `isolated-write-full-access` | stdin | pinned argv | allowlist | - |
Expand Down Expand Up @@ -155,10 +155,10 @@ The runner refuses an access mode outside a provider's Access modes cell before
### dsh: DeepSeek Harness

- Executable: `dsh`.
- Host prerequisites: dsh 0.2.1-rc.2 exactly.
- Host prerequisites: dsh 0.2.1-rc.2 on all hosts or 0.2.2-rc.3 on Windows.
- State paths: `<receipt>.provider/`, the lane's own `DSH_HOME`: the sessions (`sessions/<cwd-slug>/<session-id>/`), projection cache (`storages/session_projcache/`), `profiles/headless/` and `.anonymous-user-id` that dsh writes on every run; The stored key `<DSH_HOME, else ~/.dsh>/.credentials.yaml`, which the lane reads in place and does not copy.
- Child environment: only `PATH` `HOME` `USER` `LOGNAME` `SHELL` `TMPDIR` `LANG` `TERM` `COLORTERM` `TZ` `HTTP_PROXY` `HTTPS_PROXY` `NO_PROXY` `ALL_PROXY` `http_proxy` `https_proxy` `no_proxy` `all_proxy` `SSL_CERT_FILE` `SSL_CERT_DIR` `NODE_EXTRA_CA_CERTS` `DEEPSEEK_API_KEY`, and variables starting with `LC_`, `XDG_`; sets `DSH_HOME=<receipt>.provider`.
- Measured with dsh 0.2.0-rc.2, a developer preview, and rechecked on 0.2.1-rc.2 for the patch rows, the stored-login preflight and the writer. The runner checks `dsh --version` before the preflight and refuses any version but 0.2.1-rc.2 as `unavailable-cli`/69. Recheck on an upgrade: the config row IDs the patch names (dsh silently ignores a patch row it does not have, so a renamed row would drop that part of the lockdown), the SIGTERM exit 0 with a partial `final`, the hardcoded `/tmp` writable root, the session-log upload being on by default, that dsh reads only the cwd's `.env` and skips a directory there, the transport retry row, and the `credentials` row's `path` config. dsh 0.2.1-rc.2 ships the `credentials` row disabled, so the patch enables it.
- Measured with dsh 0.2.0-rc.2, a developer preview, and rechecked on 0.2.1-rc.2 for the patch rows, the stored-login preflight and the writer. The runner checks `dsh --version` before the preflight and refuses versions outside the host-specific list as `unavailable-cli`/69. On Windows, the contributor measured 0.2.2-rc.3 for the patch rows, the stored-login preflight, read-only and the bounded writer on disposable fixtures; the Windows sandbox mechanism and the escape matrix were measured only on macOS. Its headless profile has no `tool-subagent-list-agents` row. Recheck on an upgrade: the config row IDs the patch names (dsh silently ignores a patch row it does not have, so a renamed row would drop that part of the lockdown), the SIGTERM exit 0 with a partial `final`, the hardcoded `/tmp` writable root, the session-log upload being on by default, that dsh reads only the cwd's `.env` and skips a directory there, the transport retry row, and the `credentials` row's `path` config. dsh 0.2.1-rc.2 ships the `credentials` row disabled, so the patch enables it.
- Model and effort are config, not flags. Each lane gets a run-owned `--patch` file at `<receipt>.provider/patch.yml` (directory 0700, file 0600) that pins `agent-default-model` to provider `deepseek-official`, the lane's model and, unless the effort is `default`, its `reasoningEffort`. dsh offers efforts `off`, `low`, `high` and `max`, and fails `medium` locally.
- Each lane runs with `DSH_HOME` set to its `<receipt>.provider/` directory, and the allowlist drops every inherited `DSH_*` name. dsh creates the `headless` profile there on first use with no network or `pnpm` install (about 70 ms), so no user layer (`profiles/headless/cordis.patch.yml`) and no home `.env` from the operator's dsh home loads. Measured with `--dump-config`: a planted user layer that redirected `llm-deepseek.config.baseURL`, moved `fs-sandbox.config.cwd`, picked another `agent-default-model` provider and disabled `bash-sandbox` changed nothing, and the composed tree was the default rows plus the lane's patch. The patch's `credentials` row points the credential store at `<the parent's DSH_HOME, else ~/.dsh>/.credentials.yaml`, read in place. A key kept only in the operator's `<DSH_HOME>/.env` no longer authenticates; store it or export `DEEPSEEK_API_KEY`.
- The patch pins `sandbox-policy` to `read-only` for a read-only lane and `workspace-write` for an `isolated-write` lane, with the lane's cwd as the workspace root, and `approval` to `ask`, which overrides `DSH_PERMISSION_MODE`. The other sandbox rows keep dsh's defaults, including the bash tool's own timeout; the runner adds no deadline. Seatbelt enforces it on macOS for bash and the file tools. Headless has no approval channel, so an escalation request fails closed. Bash keeps network access, and the `read` tool is not confined to the cwd.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { describe, expect, it } from "bun:test";
import { readFileSync } from "node:fs";
import { homedir } from "node:os";
import { join } from "node:path";
import { join, resolve } from "node:path";
import type { ModelRun } from "../registry/contract.ts";
import type { LaneRequest } from "../registry/index.ts";
import { modelFailureStatus } from "../types.ts";
import { adapterSuite, testFacts, testLane } from "./adapter-suite.ts";
import { dsh } from "./dsh.ts";
import { dsh, measuredVersions } from "./dsh.ts";

adapterSuite(dsh);

Expand All @@ -27,7 +27,8 @@ describe("dsh launch", () => {

it("pins read-only mode, the stored login in place, the model and effort, and turns off the lockdown rows", () => {
const saved = process.env.DSH_HOME;
process.env.DSH_HOME = "/srv/dsh";
const credentialHome = resolve("/srv/dsh");
process.env.DSH_HOME = credentialHome;
const patch = dsh.launch.sidecar!.config!.content(lane({ model: "deepseek-v4-pro", effort: "low", cwd: "/tmp/a dir: #x" }));
if (saved === undefined) delete process.env.DSH_HOME;
else process.env.DSH_HOME = saved;
Expand All @@ -42,7 +43,7 @@ describe("dsh launch", () => {
"- id: credentials",
" disabled: false",
" config:",
" path: \"/srv/dsh/.credentials.yaml\"",
` path: ${JSON.stringify(join(credentialHome, ".credentials.yaml"))}`,
"- id: agent-default-model",
" config:",
" provider: deepseek-official",
Expand All @@ -63,8 +64,9 @@ describe("dsh launch", () => {
it("reads the stored login from the parent's DSH_HOME, resolved as dsh resolves it, else ~/.dsh", () => {
const saved = process.env.DSH_HOME;
try {
process.env.DSH_HOME = "/srv/dsh home";
expect(dsh.launch.sidecar!.config!.content(lane())).toContain("- id: credentials\n disabled: false\n config:\n path: \"/srv/dsh home/.credentials.yaml\"\n");
const credentialHome = resolve("/srv/dsh home");
process.env.DSH_HOME = credentialHome;
expect(dsh.launch.sidecar!.config!.content(lane())).toContain(`- id: credentials\n disabled: false\n config:\n path: ${JSON.stringify(join(credentialHome, ".credentials.yaml"))}\n`);
for (const [value, home] of [
[undefined, join(homedir(), ".dsh")],
[" \t", join(homedir(), ".dsh")],
Expand Down Expand Up @@ -101,13 +103,30 @@ describe("dsh launch", () => {
});

describe("dsh preflight", () => {
it.each([
["win32", ["0.2.1-rc.2", "0.2.2-rc.3"]],
["darwin", ["0.2.1-rc.2"]],
["linux", ["0.2.1-rc.2"]],
] as const)("measures %s at %p", (platform, versions) => {
expect(measuredVersions(platform)).toEqual([...versions]);
});

it("accepts rc.3 only on Windows and preserves the baseline version", () => {
const check = (stdout: string) => dsh.preflight.guard!.check({ exitCode: 0, stdout, stderr: "" });
expect(check("0.2.1-rc.2\n")).toBeNull();
const windowsRelease = check("0.2.2-rc.3\r\n");
if (process.platform === "win32") expect(windowsRelease).toBeNull();
else expect(windowsRelease).toMatchObject({ status: "unavailable-cli" });
expect(check("0.2.2-rc.4")).toMatchObject({ status: "unavailable-cli" });
});

it("runs a positional task with the lane's patch, then the shipped preflight patch", () => {
const argv = dsh.preflight.argv(lane(), testFacts(dsh).providerSidecar);
expect(argv).toEqual([
"--profile", "headless", "--patch", "/tmp/receipt.json.provider/patch.yml",
"--patch", join(import.meta.dir, "dsh-preflight.yml"), "--json", "preflight",
]);
expect(readFileSync(argv[5]!, "utf8")).toContain("baseURL: http://127.0.0.1:1\n- id: llm-retry\n disabled: true\n");
expect(readFileSync(argv[5]!, "utf8").replace(/\r\n/g, "\n")).toContain("baseURL: http://127.0.0.1:1\n- id: llm-retry\n disabled: true\n");
});

it("passes TRANSPORT with fixed evidence that the key is not validated", () => {
Expand Down
26 changes: 20 additions & 6 deletions plugins/pstack/skills/poteto-mode/scripts/runner/providers/dsh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,18 @@ function parse(run: ModelRun): ParseResult {
return { kind: "complete", text, metadata };
}

const VERSION = "0.2.1-rc.2";
const BASELINE_VERSION = "0.2.1-rc.2";
const WINDOWS_VERSION = "0.2.2-rc.3";
const MEASURED: readonly { version: string; platforms: readonly NodeJS.Platform[] | null }[] = [
{ version: BASELINE_VERSION, platforms: null },
{ version: WINDOWS_VERSION, platforms: ["win32"] },
];

export function measuredVersions(platform: NodeJS.Platform): string[] {
return MEASURED
.filter((entry) => entry.platforms === null || entry.platforms.includes(platform))
.map((entry) => entry.version);
}

// dsh has no status command. The preflight turn's error code says only whether a key is stored or exported.
function classify(run: ChildRun) {
Expand All @@ -172,9 +183,12 @@ export const dsh = adapter({
// dsh ignores a patch row it does not have, so another version could drop the lockdown silently.
guard: {
argv: ["--version"],
check: (run) => run.stdout.trim() === VERSION ? null : {
status: "unavailable-cli",
message: `dsh ${run.stdout.trim()} is not the measured ${VERSION}; the adapter must be re-measured before it runs this version`,
check: (run) => {
const versions = measuredVersions(process.platform);
return versions.includes(run.stdout.trim()) ? null : {
status: "unavailable-cli",
message: `dsh ${run.stdout.trim()} is outside the measured versions for ${process.platform} (${versions.join(", ")}); the adapter must be re-measured before it runs this version`,
};
},
},
},
Expand All @@ -198,13 +212,13 @@ export const dsh = adapter({
},
docs: {
name: "DeepSeek Harness",
hostPrerequisites: ["dsh 0.2.1-rc.2 exactly"],
hostPrerequisites: [`dsh ${BASELINE_VERSION} on all hosts or ${WINDOWS_VERSION} on Windows`],
statePaths: [
"`<receipt>.provider/`, the lane's own `DSH_HOME`: the sessions (`sessions/<cwd-slug>/<session-id>/`), projection cache (`storages/session_projcache/`), `profiles/headless/` and `.anonymous-user-id` that dsh writes on every run",
"The stored key `<DSH_HOME, else ~/.dsh>/.credentials.yaml`, which the lane reads in place and does not copy",
],
notes: [
"Measured with dsh 0.2.0-rc.2, a developer preview, and rechecked on 0.2.1-rc.2 for the patch rows, the stored-login preflight and the writer. The runner checks `dsh --version` before the preflight and refuses any version but 0.2.1-rc.2 as `unavailable-cli`/69. Recheck on an upgrade: the config row IDs the patch names (dsh silently ignores a patch row it does not have, so a renamed row would drop that part of the lockdown), the SIGTERM exit 0 with a partial `final`, the hardcoded `/tmp` writable root, the session-log upload being on by default, that dsh reads only the cwd's `.env` and skips a directory there, the transport retry row, and the `credentials` row's `path` config. dsh 0.2.1-rc.2 ships the `credentials` row disabled, so the patch enables it.",
"Measured with dsh 0.2.0-rc.2, a developer preview, and rechecked on 0.2.1-rc.2 for the patch rows, the stored-login preflight and the writer. The runner checks `dsh --version` before the preflight and refuses versions outside the host-specific list as `unavailable-cli`/69. On Windows, the contributor measured 0.2.2-rc.3 for the patch rows, the stored-login preflight, read-only and the bounded writer on disposable fixtures; the Windows sandbox mechanism and the escape matrix were measured only on macOS. Its headless profile has no `tool-subagent-list-agents` row. Recheck on an upgrade: the config row IDs the patch names (dsh silently ignores a patch row it does not have, so a renamed row would drop that part of the lockdown), the SIGTERM exit 0 with a partial `final`, the hardcoded `/tmp` writable root, the session-log upload being on by default, that dsh reads only the cwd's `.env` and skips a directory there, the transport retry row, and the `credentials` row's `path` config. dsh 0.2.1-rc.2 ships the `credentials` row disabled, so the patch enables it.",
"Model and effort are config, not flags. Each lane gets a run-owned `--patch` file at `<receipt>.provider/patch.yml` (directory 0700, file 0600) that pins `agent-default-model` to provider `deepseek-official`, the lane's model and, unless the effort is `default`, its `reasoningEffort`. dsh offers efforts `off`, `low`, `high` and `max`, and fails `medium` locally.",
"Each lane runs with `DSH_HOME` set to its `<receipt>.provider/` directory, and the allowlist drops every inherited `DSH_*` name. dsh creates the `headless` profile there on first use with no network or `pnpm` install (about 70 ms), so no user layer (`profiles/headless/cordis.patch.yml`) and no home `.env` from the operator's dsh home loads. Measured with `--dump-config`: a planted user layer that redirected `llm-deepseek.config.baseURL`, moved `fs-sandbox.config.cwd`, picked another `agent-default-model` provider and disabled `bash-sandbox` changed nothing, and the composed tree was the default rows plus the lane's patch. The patch's `credentials` row points the credential store at `<the parent's DSH_HOME, else ~/.dsh>/.credentials.yaml`, read in place. A key kept only in the operator's `<DSH_HOME>/.env` no longer authenticates; store it or export `DEEPSEEK_API_KEY`.",
"The patch pins `sandbox-policy` to `read-only` for a read-only lane and `workspace-write` for an `isolated-write` lane, with the lane's cwd as the workspace root, and `approval` to `ask`, which overrides `DSH_PERMISSION_MODE`. The other sandbox rows keep dsh's defaults, including the bash tool's own timeout; the runner adds no deadline. Seatbelt enforces it on macOS for bash and the file tools. Headless has no approval channel, so an escalation request fails closed. Bash keeps network access, and the `read` tool is not confined to the cwd.",
Expand Down
5 changes: 3 additions & 2 deletions plugins/pstack/skills/poteto-mode/scripts/runner/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { main } from "./cli.ts";
import { type LaneRequest, REGISTRY, resolveLane } from "./registry/index.ts";
import { access, type Lane, type ProviderAdapter } from "./registry/contract.ts";
import { devin } from "./providers/devin.ts";
import { measuredVersions } from "./providers/dsh.ts";
import { opencode } from "./providers/opencode.ts";
import { BASE_ALLOWLIST, BASE_PREFIXES } from "./providers/shared.ts";
import type { ProviderId } from "./registry/family.ts";
Expand Down Expand Up @@ -2715,7 +2716,7 @@ process.exit(130);`);
expect(existsSync(interrupted.outputPath)).toBe(false);
});

it("refuses a dsh other than the measured version before the preflight", async () => {
it("refuses an unmeasured dsh version before the preflight", async () => {
fakeDsh(TRANSPORT, OBSERVE, "0.3.0");
const input = dshOptions("dsh-version");
const result = await runLane(laneOf(input));
Expand All @@ -2724,7 +2725,7 @@ process.exit(130);`);
status: "unavailable-cli",
preflight: { status: "not-run" },
error: {
message: "dsh 0.3.0 is not the measured 0.2.1-rc.2; the adapter must be re-measured before it runs this version",
message: `dsh 0.3.0 is outside the measured versions for ${process.platform} (${measuredVersions(process.platform).join(", ")}); the adapter must be re-measured before it runs this version`,
evidence: "0.3.0",
},
});
Expand Down
Loading