@christang/keel 5.99.4 → 5.99.6
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/assets/bootstrap/AGENTS.md +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/plugins/keel/.claude-plugin/plugin.json +1 -1
- package/plugins/keel/.codex-plugin/plugin.json +1 -1
- package/plugins/keel/scripts/session-start.js +39 -3
- package/scripts/validate_plugin.py +62 -3
- package/src/core/agents.js +30 -11
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@christang/keel",
|
|
3
|
-
"version": "5.99.
|
|
3
|
+
"version": "5.99.6",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@christang/keel",
|
|
9
|
-
"version": "5.99.
|
|
9
|
+
"version": "5.99.6",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@fission-ai/openspec": "^1.4.1"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "keel",
|
|
3
|
-
"version": "5.99.
|
|
3
|
+
"version": "5.99.6",
|
|
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.
|
|
3
|
+
"version": "5.99.6",
|
|
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",
|
|
@@ -203,6 +203,30 @@ function protocolVersion(cwd) {
|
|
|
203
203
|
return null;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
+
// Numeric X.Y.Z order; a string that is not one sorts as equal, so it never
|
|
207
|
+
// decides which side lags.
|
|
208
|
+
function olderVersion(a, b) {
|
|
209
|
+
const x = String(a).split(".").map(Number);
|
|
210
|
+
const y = String(b).split(".").map(Number);
|
|
211
|
+
if (x.length !== 3 || y.length !== 3 || [...x, ...y].some(Number.isNaN)) return false;
|
|
212
|
+
for (let i = 0; i < 3; i += 1) {
|
|
213
|
+
if (x[i] !== y[i]) return x[i] < y[i];
|
|
214
|
+
}
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// The target `keel context` names in its protocol refresh (src/core/context.js
|
|
219
|
+
// installedTarget), so both surfaces print the same command.
|
|
220
|
+
function installedTarget(cwd) {
|
|
221
|
+
try {
|
|
222
|
+
if (/<!--\s*keel:start/.test(fs.readFileSync(path.join(cwd, "CLAUDE.md"), "utf8"))) return "claude";
|
|
223
|
+
} catch {
|
|
224
|
+
// No CLAUDE.md: not the Claude target.
|
|
225
|
+
}
|
|
226
|
+
if (fs.existsSync(path.join(cwd, ".opencode", "commands"))) return "opencode";
|
|
227
|
+
return "codex";
|
|
228
|
+
}
|
|
229
|
+
|
|
206
230
|
// Three versions are comparable in any repository: the plugin executing this
|
|
207
231
|
// hook, the CLI it just invoked, and the protocol version the repository
|
|
208
232
|
// stamped into its managed block. Keel reports the disagreement and stops
|
|
@@ -254,9 +278,21 @@ function versionReport(cwd, cli, pathCli = null) {
|
|
|
254
278
|
: "";
|
|
255
279
|
// An update the host already installed needs only the reload (#172), so
|
|
256
280
|
// naming the update command there sends the reader to what already happened.
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
281
|
+
// The remedy belongs to what lags (#240): a protocol block behind the
|
|
282
|
+
// runtime is fixed by the protocol refresh, and naming the plugin update
|
|
283
|
+
// there sends the reader to a command that changes nothing.
|
|
284
|
+
const newest = known.map(([, value]) => value).reduce((a, b) => (olderVersion(a, b) ? b : a));
|
|
285
|
+
const runtimeBehind = [plugin.version, cli].some((value) => value && olderVersion(value, newest));
|
|
286
|
+
const protocol = found.find(([name]) => name === "protocol")[1];
|
|
287
|
+
const protocolBehind = Boolean(protocol) && olderVersion(protocol, newest);
|
|
288
|
+
const parts = [];
|
|
289
|
+
if (pending) parts.push(`The host has already installed plugin ${pending}, so nothing needs updating.`);
|
|
290
|
+
else if (runtimeBehind || !protocolBehind) parts.push(`Updating is ${plugin.remedy}, which Keel names and does not run.`);
|
|
291
|
+
if (protocolBehind) {
|
|
292
|
+
parts.push(`The repository's protocol block is behind: refresh it with \`keel --install --target ${installedTarget(cwd)}\`, `
|
|
293
|
+
+ "the command `keel context` names on its Protocol: line.");
|
|
294
|
+
}
|
|
295
|
+
const remedy = parts.join(" ");
|
|
260
296
|
return `runtime versions disagree: ${named}${missing}. A session's hooks are `
|
|
261
297
|
+ "fixed when it loads the plugin, so an updated plugin applies after "
|
|
262
298
|
+ `\`/reload-plugins\` or at the next session start. ${remedy}${shadow}`;
|
|
@@ -47,8 +47,8 @@ REQUIRED_SCRIPTS = [
|
|
|
47
47
|
"scripts/validate_plugin.py",
|
|
48
48
|
]
|
|
49
49
|
|
|
50
|
-
PACKAGE_VERSION = "5.99.
|
|
51
|
-
PROTOCOL_VERSION = "5.99.
|
|
50
|
+
PACKAGE_VERSION = "5.99.6"
|
|
51
|
+
PROTOCOL_VERSION = "5.99.6"
|
|
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
|
|
@@ -19493,6 +19493,38 @@ def validate_runtime_version_drift_scenario() -> int:
|
|
|
19493
19493
|
)
|
|
19494
19494
|
return 1
|
|
19495
19495
|
|
|
19496
|
+
# The remedy belongs to what lags (#240): plugin and CLI behind the
|
|
19497
|
+
# protocol name the plugin update, and a protocol behind them names the
|
|
19498
|
+
# protocol refresh, never the plugin update that would change nothing.
|
|
19499
|
+
if "claude plugin update" not in channels["additionalContext"]:
|
|
19500
|
+
report(
|
|
19501
|
+
"runtime-version-drift a plugin behind the protocol does not name "
|
|
19502
|
+
f"the plugin update: {channels['additionalContext']!r}"
|
|
19503
|
+
)
|
|
19504
|
+
return 1
|
|
19505
|
+
lagging = tmp / "lagging-protocol"
|
|
19506
|
+
write_text(lagging / "openspec/changes/demo/tasks.md", task_contract_fixture())
|
|
19507
|
+
write_text(
|
|
19508
|
+
lagging / "CLAUDE.md",
|
|
19509
|
+
"<!-- keel:start version=5.2.0 -->\n## Session Start\n<!-- keel:end -->\n",
|
|
19510
|
+
)
|
|
19511
|
+
behind = run_session_start_hook(
|
|
19512
|
+
lagging, codex_event, keel_cli=stale_cli, plugin_root=stale_plugin
|
|
19513
|
+
)
|
|
19514
|
+
behind_text = session_start_context(behind) or ""
|
|
19515
|
+
if "keel --install --target claude" not in behind_text:
|
|
19516
|
+
report(
|
|
19517
|
+
"runtime-version-drift a protocol behind the plugin and CLI does not "
|
|
19518
|
+
f"name the protocol refresh: {behind_text!r}"
|
|
19519
|
+
)
|
|
19520
|
+
return 1
|
|
19521
|
+
if "claude plugin update" in behind_text:
|
|
19522
|
+
report(
|
|
19523
|
+
"runtime-version-drift a protocol behind the plugin and CLI still "
|
|
19524
|
+
f"names the plugin update, which changes nothing: {behind_text!r}"
|
|
19525
|
+
)
|
|
19526
|
+
return 1
|
|
19527
|
+
|
|
19496
19528
|
# Silence when aligned, and silence that costs nothing else. The drift
|
|
19497
19529
|
# sentence is lifted off the mismatched payload and the remainder must
|
|
19498
19530
|
# be byte-identical to the aligned one: that is the comparison disabled
|
|
@@ -36443,7 +36475,7 @@ def validate_codex_receiving_scenario() -> int:
|
|
|
36443
36475
|
|
|
36444
36476
|
EXTERNAL_AGENT_FACT_FIELDS = {
|
|
36445
36477
|
"name", "source", "executable", "resolved", "allowed",
|
|
36446
|
-
"command", "sandbox", "sendsTo", "pitfalls",
|
|
36478
|
+
"command", "sandbox", "ownSandbox", "sendsTo", "pitfalls",
|
|
36447
36479
|
}
|
|
36448
36480
|
|
|
36449
36481
|
|
|
@@ -36548,6 +36580,20 @@ def validate_external_agent_catalog_scenario() -> int:
|
|
|
36548
36580
|
report(f"{label} `keel agents codex` does not print {needle!r}.")
|
|
36549
36581
|
return 1
|
|
36550
36582
|
|
|
36583
|
+
# Issue #259: dsh's headless profile has a sandbox of its own, as measured.
|
|
36584
|
+
dsh_text = run_keel(repo, "agents", "dsh", env=env).stdout
|
|
36585
|
+
sandbox_line = next((line for line in dsh_text.splitlines() if line.startswith("Sandbox:")), "")
|
|
36586
|
+
if "workspace-write" not in sandbox_line:
|
|
36587
|
+
report(f"{label} `keel agents dsh` does not describe its own sandbox: {sandbox_line!r}")
|
|
36588
|
+
return 1
|
|
36589
|
+
for needle in ("/dev/stdout", "PYTHONPYCACHEPREFIX"):
|
|
36590
|
+
if needle not in dsh_text:
|
|
36591
|
+
report(f"{label} `keel agents dsh` has no pitfall naming {needle!r}.")
|
|
36592
|
+
return 1
|
|
36593
|
+
if "reads and writes wherever it is started" in dsh_text:
|
|
36594
|
+
report(f"{label} `keel agents dsh` still says it reads and writes wherever it is started.")
|
|
36595
|
+
return 1
|
|
36596
|
+
|
|
36551
36597
|
# A machine entry declaring one field overrides that field only.
|
|
36552
36598
|
custom = base / "bin" / "dsh"
|
|
36553
36599
|
(base / "home" / "agents.json").write_text(
|
|
@@ -36778,6 +36824,19 @@ def validate_external_agent_brief_scenario() -> int:
|
|
|
36778
36824
|
report(f"{label} a helper worktree under .claude/worktrees/ was refused from a sibling worktree: "
|
|
36779
36825
|
f"{out.strip()[:600]}")
|
|
36780
36826
|
return 1
|
|
36827
|
+
# Issue #259: a dsh brief keeps temporary files in tmp/ beside the brief.
|
|
36828
|
+
tmp = prompt.parent / "tmp"
|
|
36829
|
+
if not tmp.is_dir():
|
|
36830
|
+
report(f"{label} the dsh brief did not create {tmp} beside --out.")
|
|
36831
|
+
return 1
|
|
36832
|
+
if str(tmp) not in prompt.read_text(encoding="utf-8"):
|
|
36833
|
+
report(f"{label} the dsh brief does not name its temporary directory {tmp}.")
|
|
36834
|
+
return 1
|
|
36835
|
+
command = payload.get("run") or ""
|
|
36836
|
+
for needle in (f"TMPDIR={tmp}", f"PYTHONPYCACHEPREFIX={tmp}/pycache"):
|
|
36837
|
+
if needle not in command:
|
|
36838
|
+
report(f"{label} the dsh command does not set {needle!r}: {command}")
|
|
36839
|
+
return 1
|
|
36781
36840
|
payload, out = helper_brief(helper_tree)
|
|
36782
36841
|
if not refused(payload, out, str(helper_tree.resolve()), "current directory", "--repo",
|
|
36783
36842
|
what="a helper brief run from inside its own --dir"):
|
package/src/core/agents.js
CHANGED
|
@@ -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-
|
|
90
|
-
source: "
|
|
91
|
-
text: "It offers no sandbox flag and no working-directory flag
|
|
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
|
-
|
|
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 {
|