@christang/keel 5.99.4 → 5.99.5

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.
@@ -1,4 +1,4 @@
1
- <!-- keel:start version=5.99.4 -->
1
+ <!-- keel:start version=5.99.5 -->
2
2
  ## Keel Bootstrap
3
3
 
4
4
  - Start every session with `keel context`; OpenSpec artifacts and Git are the only durable authority — never native memory, goals, or transcripts.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@christang/keel",
3
- "version": "5.99.4",
3
+ "version": "5.99.5",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@christang/keel",
9
- "version": "5.99.4",
9
+ "version": "5.99.5",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@fission-ai/openspec": "^1.4.1"
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@christang/keel",
3
3
  "displayName": "Keel",
4
4
  "description": "Keel OpenSpec execution discipline CLI for Claude Code, Codex, and OpenCode.",
5
- "version": "5.99.4",
5
+ "version": "5.99.5",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.99.4",
3
+ "version": "5.99.5",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keel",
3
- "version": "5.99.4",
3
+ "version": "5.99.5",
4
4
  "description": "Keel OpenSpec execution discipline: stateless continuity, task capsules, deterministic gates, and expectation alignment for Codex and Claude Code.",
5
5
  "author": {
6
6
  "name": "TanglmChris",
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
47
47
  "scripts/validate_plugin.py",
48
48
  ]
49
49
 
50
- PACKAGE_VERSION = "5.99.4"
51
- PROTOCOL_VERSION = "5.99.4"
50
+ PACKAGE_VERSION = "5.99.5"
51
+ PROTOCOL_VERSION = "5.99.5"
52
52
  LEGACY_MANAGED_START = "<!-- keel:start version=2.1 -->"
53
53
  OPENSPEC_SCHEMA_NAME = "keel-spec-driven"
54
54
  # Mirrors KEEL_PACKAGE_NAME in scripts/install_to_repo.py, one of the two
@@ -36443,7 +36443,7 @@ def validate_codex_receiving_scenario() -> int:
36443
36443
 
36444
36444
  EXTERNAL_AGENT_FACT_FIELDS = {
36445
36445
  "name", "source", "executable", "resolved", "allowed",
36446
- "command", "sandbox", "sendsTo", "pitfalls",
36446
+ "command", "sandbox", "ownSandbox", "sendsTo", "pitfalls",
36447
36447
  }
36448
36448
 
36449
36449
 
@@ -36548,6 +36548,20 @@ def validate_external_agent_catalog_scenario() -> int:
36548
36548
  report(f"{label} `keel agents codex` does not print {needle!r}.")
36549
36549
  return 1
36550
36550
 
36551
+ # Issue #259: dsh's headless profile has a sandbox of its own, as measured.
36552
+ dsh_text = run_keel(repo, "agents", "dsh", env=env).stdout
36553
+ sandbox_line = next((line for line in dsh_text.splitlines() if line.startswith("Sandbox:")), "")
36554
+ if "workspace-write" not in sandbox_line:
36555
+ report(f"{label} `keel agents dsh` does not describe its own sandbox: {sandbox_line!r}")
36556
+ return 1
36557
+ for needle in ("/dev/stdout", "PYTHONPYCACHEPREFIX"):
36558
+ if needle not in dsh_text:
36559
+ report(f"{label} `keel agents dsh` has no pitfall naming {needle!r}.")
36560
+ return 1
36561
+ if "reads and writes wherever it is started" in dsh_text:
36562
+ report(f"{label} `keel agents dsh` still says it reads and writes wherever it is started.")
36563
+ return 1
36564
+
36551
36565
  # A machine entry declaring one field overrides that field only.
36552
36566
  custom = base / "bin" / "dsh"
36553
36567
  (base / "home" / "agents.json").write_text(
@@ -36778,6 +36792,19 @@ def validate_external_agent_brief_scenario() -> int:
36778
36792
  report(f"{label} a helper worktree under .claude/worktrees/ was refused from a sibling worktree: "
36779
36793
  f"{out.strip()[:600]}")
36780
36794
  return 1
36795
+ # Issue #259: a dsh brief keeps temporary files in tmp/ beside the brief.
36796
+ tmp = prompt.parent / "tmp"
36797
+ if not tmp.is_dir():
36798
+ report(f"{label} the dsh brief did not create {tmp} beside --out.")
36799
+ return 1
36800
+ if str(tmp) not in prompt.read_text(encoding="utf-8"):
36801
+ report(f"{label} the dsh brief does not name its temporary directory {tmp}.")
36802
+ return 1
36803
+ command = payload.get("run") or ""
36804
+ for needle in (f"TMPDIR={tmp}", f"PYTHONPYCACHEPREFIX={tmp}/pycache"):
36805
+ if needle not in command:
36806
+ report(f"{label} the dsh command does not set {needle!r}: {command}")
36807
+ return 1
36781
36808
  payload, out = helper_brief(helper_tree)
36782
36809
  if not refused(payload, out, str(helper_tree.resolve()), "current directory", "--repo",
36783
36810
  what="a helper brief run from inside its own --dir"):
@@ -20,7 +20,7 @@ const path = require("path");
20
20
 
21
21
  const { readExternalAgents } = require("./config");
22
22
 
23
- const FIELDS = ["executable", "command", "sandbox", "sendsTo", "pitfalls"];
23
+ const FIELDS = ["executable", "command", "sandbox", "ownSandbox", "sendsTo", "pitfalls"];
24
24
  const MODES = ["helper", "implementation"];
25
25
 
26
26
  const RTL_TOOLCHAIN = "rtl_ppa_prj docs/toolchain.md (main 632ad85)";
@@ -71,8 +71,9 @@ const BUNDLED = {
71
71
  },
72
72
  dsh: {
73
73
  executable: "/Applications/DeepSeek Harness.app/Contents/Resources/runtime/cli/bin/dsh",
74
- command: "cd {dir} && {executable} --profile headless - < {prompt} > {out}",
74
+ command: "cd {dir} && TMPDIR={tmp} PYTHONPYCACHEPREFIX={tmp}/pycache {executable} --profile headless - < {prompt} > {out}",
75
75
  sandbox: { helper: null, implementation: null },
76
+ ownSandbox: "the headless profile applies its own workspace-write file policy: outside the directory it starts in, writes are refused (including /dev/stdout and ~/Library/Caches) while /tmp stays writable; inside it, it writes freely, so it still needs a separate worktree (dsh 0.2.0-rc.2, #259)",
76
77
  sendsTo: "DeepSeek, through the provider the profile configures (by default deepseek-official, model deepseek-flash)",
77
78
  pitfalls: [
78
79
  {
@@ -86,9 +87,19 @@ const BUNDLED = {
86
87
  text: "First use needs a DeepSeek API key, stored once through the app's Models page or exported as DEEPSEEK_API_KEY where it is launched; until then the headless profile fails with MISSING_CREDENTIAL. With the key stored it runs from any directory.",
87
88
  },
88
89
  {
89
- date: "2026-10-04",
90
- source: "dsh headless --help, 0.2.0-rc.2",
91
- text: "It offers no sandbox flag and no working-directory flag. It reads and writes wherever it is started, so start it in a separate worktree.",
90
+ date: "2026-10-05",
91
+ source: "https://github.com/TanglmChris/keel/issues/259",
92
+ text: "It offers no sandbox flag and no working-directory flag, and its headless profile has no read-only mode: it writes freely inside the directory it starts in, so start it in a separate worktree.",
93
+ },
94
+ {
95
+ date: "2026-10-05",
96
+ source: "https://github.com/TanglmChris/keel/issues/259",
97
+ text: "Writing /dev/stdout is refused (`Operation not permitted`), so a tool that writes through it, such as yosys `tee -o /dev/stdout`, fails in its shell. One run spent about an hour working around it.",
98
+ },
99
+ {
100
+ date: "2026-10-05",
101
+ source: "https://github.com/TanglmChris/keel/issues/259",
102
+ text: "macOS Python's cache directory under ~/Library/Caches is not writable, so `python -m compileall` fails unless PYTHONPYCACHEPREFIX points inside a writable directory. The brief's command sets it, and TMPDIR, to `tmp/` beside the brief.",
92
103
  },
93
104
  {
94
105
  date: "2026-10-04",
@@ -230,6 +241,7 @@ function describeAgents(repo) {
230
241
  allowed: declaration.allow.includes(entry.name),
231
242
  command: entry.command,
232
243
  sandbox: entry.sandbox,
244
+ ownSandbox: entry.ownSandbox || null,
233
245
  sendsTo: entry.sendsTo || null,
234
246
  pitfalls: entry.pitfalls,
235
247
  }));
@@ -248,8 +260,9 @@ function describeAgents(repo) {
248
260
  };
249
261
  }
250
262
 
251
- function sandboxLine(sandbox) {
252
- return MODES.map((mode) => `${mode} ${sandbox[mode] || "none (needs a separate worktree)"}`).join("; ");
263
+ function sandboxLine(sandbox, ownSandbox) {
264
+ const modes = MODES.map((mode) => `${mode} ${sandbox[mode] || "none (needs a separate worktree)"}`).join("; ");
265
+ return ownSandbox ? `${modes}. Its own: ${ownSandbox}` : modes;
253
266
  }
254
267
 
255
268
  function pitfallLines(pitfalls) {
@@ -278,7 +291,7 @@ function renderAgent(payload, agent) {
278
291
  `${agent.name} [${agent.source}]`,
279
292
  `Executable: ${agent.executable} → ${agent.resolved || "not found"}`,
280
293
  `Command: ${agent.command}`,
281
- `Sandbox: ${sandboxLine(agent.sandbox)}`,
294
+ `Sandbox: ${sandboxLine(agent.sandbox, agent.ownSandbox)}`,
282
295
  `Sends to: ${agent.sendsTo || "not recorded"}`,
283
296
  `Allowed here: ${agent.allowed ? "yes" : "no"}`,
284
297
  "",
@@ -372,7 +385,7 @@ function shellQuote(value) {
372
385
  }
373
386
 
374
387
  function fillCommand(template, values) {
375
- return template.replace(/\{(executable|sandbox|dir|prompt|out)\}/g, (_, key) => shellQuote(values[key]));
388
+ return template.replace(/\{(executable|sandbox|dir|prompt|out|tmp)\}/g, (_, key) => shellQuote(values[key]));
376
389
  }
377
390
 
378
391
  const BRIEF_PROHIBITIONS = [
@@ -382,7 +395,7 @@ const BRIEF_PROHIBITIONS = [
382
395
  "Do not update a task's checkbox, Contract, Evidence, or Review.",
383
396
  ];
384
397
 
385
- function renderBrief({ agent, mode, dir, projection, source, result }) {
398
+ function renderBrief({ agent, mode, dir, projection, source, result, tmp }) {
386
399
  const list = (items) => (items.length ? items.map((item) => `- ${item}`) : ["- none"]);
387
400
  const lines = [
388
401
  `# Brief for ${agent.name}: ${source.change}#${source.task}`,
@@ -390,6 +403,7 @@ function renderBrief({ agent, mode, dir, projection, source, result }) {
390
403
  `Mode: ${mode}${agent.sandbox[mode] ? ` (sandbox ${agent.sandbox[mode]})` : ""}`,
391
404
  `Working directory: ${dir}`,
392
405
  `Write your final report to: ${result}`,
406
+ ...(tmp ? [`Temporary files: ${tmp} (TMPDIR points there); put none anywhere else.`] : []),
393
407
  "",
394
408
  "## Task",
395
409
  "",
@@ -499,8 +513,12 @@ function compileBrief(repo, options) {
499
513
  const out = path.resolve(options.out);
500
514
  const result = out.replace(/(\.md)?$/, ".result.md");
501
515
  fs.mkdirSync(path.dirname(out), { recursive: true });
516
+ // A template's {tmp} is a directory beside the brief, inside whatever the
517
+ // agent's own sandbox lets it write when --out is in its worktree (#259).
518
+ const tmp = entry.command.includes("{tmp}") ? path.join(path.dirname(out), "tmp") : null;
519
+ if (tmp) fs.mkdirSync(tmp, { recursive: true });
502
520
  fs.writeFileSync(out, renderBrief({
503
- agent: entry, mode: options.mode, dir, projection, source: projected.source, result,
521
+ agent: entry, mode: options.mode, dir, projection, source: projected.source, result, tmp,
504
522
  }));
505
523
  // A subshell, so a `cd` in a template does not move the caller, and the exit
506
524
  // status beside the result, because it is the one account of how the run
@@ -512,6 +530,7 @@ function compileBrief(repo, options) {
512
530
  dir,
513
531
  prompt: out,
514
532
  out: result,
533
+ tmp: tmp || "",
515
534
  });
516
535
  const run = `( ${filled} ); echo $? > ${shellQuote(exit)}`;
517
536
  return {