@yasaswy.nagavolu/agents 0.36.2 → 0.37.0
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/README.md +12 -0
- package/bin/cli.js +41 -5
- package/content/global/code-mode/README.md +10 -0
- package/content/manifest.json +74 -11
- package/content/manifest.schema.json +1 -1
- package/content/mods/handoff/tests/e2e/keepwarm_e2e.py +2 -3
- package/content/mods/handoff/tests/e2e/run_e2e.py +9 -2
- package/content/mods/handoff/tests/e2e/run_real_prep.py +2 -1
- package/content/mods/handoff/tests/e2e/tui_driver.py +2 -2
- package/content/mods/model-routing/tests/e2e/run_e2e.py +1 -1
- package/content/mods/model-routing/tests/e2e/run_routing_e2e.py +1 -1
- package/content/mods/model-routing/tests/e2e/run_workflow_e2e.py +1 -1
- package/content/proxy/README.md +1 -1
- package/content/proxy/git_shell_parse.py +5 -0
- package/content/proxy/html_mocker_monitor_guard.py +101 -3
- package/content/proxy/publish_guard.py +114 -4
- package/content/proxy/shared_worktree_revert_guard.py +101 -15
- package/content/proxy/shell_parse.py +102 -1
- package/content/scripts/spend_parse.py +163 -0
- package/content/scripts/spend_prices.json +13 -0
- package/content/scripts/spend_report.py +364 -0
- package/content/skills/resale/CONTRACTS.md +6 -2
- package/content/skills/resale/README.md +12 -1
- package/content/skills/resale/resale/comps/specs.py +1 -1
- package/content/skills/resale/resale/conditions.py +16 -0
- package/content/skills/resale/resale/contracts/item_specs.schema.json +4 -1
- package/content/skills/resale/resale/db/migrations/0028_site_draft_url.sql +1 -0
- package/content/skills/resale/resale/portal/views_postkit.py +16 -5
- package/content/skills/resale/resale/poster/adapters.py +48 -13
- package/content/skills/resale/resale/poster/commands.py +64 -14
- package/content/skills/resale/resale/poster/driver.py +223 -4
- package/content/skills/resale/resale/poster/preflight.py +62 -0
- package/content/skills/resale/resale/poster/review_window.py +76 -1
- package/content/skills/resale/resale/poster/runner.py +235 -57
- package/content/skills/resale/resale/poster/tabs.py +159 -0
- package/content/skills/resale/resale/postkit/fill.py +34 -2
- package/content/skills/resale/resale/postkit/specs.py +7 -1
- package/content/skills/resale/resale/publisher/login_watch.py +57 -0
- package/content/skills/resale/resale/service/server.py +8 -0
- package/content/skills/resale/resale/sources/client.py +3 -0
- package/content/skills/resale/resale/sources/login_window.py +7 -2
- package/content/skills/resale/resale/sources/logins.py +2 -1
- package/content/skills/resale/tests/test_login_window_autoclose.py +71 -0
- package/content/skills/resale/tests/test_portal_postkit.py +16 -0
- package/content/skills/resale/tests/test_poster.py +309 -3
- package/content/skills/resale/tests/test_poster_preflight.py +65 -0
- package/content/skills/resale/tests/test_poster_review_window.py +6 -6
- package/content/skills/resale/tests/test_poster_tabs.py +580 -0
- package/content/skills/resale/tests/test_postkit_fill.py +60 -2
- package/lib/claudeProfile.js +60 -4
- package/lib/claudeVersion.js +17 -1
- package/lib/codeMode.js +106 -0
- package/lib/deployment.js +2 -0
- package/lib/doctor.js +6 -0
- package/lib/downgradeGuard.js +45 -0
- package/lib/shellProfile.js +14 -5
- package/lib/update.js +2 -0
- package/lib/wiring.js +31 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -96,6 +96,18 @@ agents-cli install
|
|
|
96
96
|
[Updating](#updating) below.
|
|
97
97
|
Run from a git checkout, `update` refuses (exit 1, nothing deployed) when HEAD is behind origin's default branch,
|
|
98
98
|
because it would deploy older files over newer ones; `--allow-stale` overrides, and an unreachable remote only warns.
|
|
99
|
+
`update` also refuses (exit 1, nothing written, no project, profile or bypass step run) when the install record
|
|
100
|
+
(`agents-ledger.json`, `cliVersion`) was written by a newer agents-cli than the one running, since it would write older
|
|
101
|
+
guard files over newer ones and remove newer settings items; `--allow-downgrade` overrides. The Codex record is checked
|
|
102
|
+
the same way. Equal or older records are unaffected. `doctor` prints the install record version against the running one
|
|
103
|
+
and warns when the record is newer.
|
|
104
|
+
- **Hook failure policy.** A hook registration in `manifest.json` may carry `timeout` (seconds) and `onFailure`
|
|
105
|
+
(`"continue"` or `"block"`, read by Claude Code 2.1.295 and later). The two every-call `PreToolUse` helpers
|
|
106
|
+
(`permission_mode_enforce.js`, `chat_inbox_hook.py`) carry `timeout: 15` and `onFailure: "continue"`, so a helper that
|
|
107
|
+
cannot start under memory pressure never refuses a tool call; safety guards carry neither and keep refusing when they
|
|
108
|
+
cannot run. `update` also sets a declared `timeout`/`onFailure` on a handler that is already wired (no new entry, handlers
|
|
109
|
+
the manifest does not own untouched). An older Claude Code ignores `onFailure` without any settings error. A registration
|
|
110
|
+
with `platforms` is wired only on those `process.platform` values.
|
|
99
111
|
`doctor` checks ledger hashes, not source drift, so it cannot detect a stale deploy.
|
|
100
112
|
- `agents-cli runner install --group-id <id> | --project-id <id>` — install a
|
|
101
113
|
ready GitLab CI runner on this machine (`linux-docker`, or `macos-shell` on
|
package/bin/cli.js
CHANGED
|
@@ -50,9 +50,11 @@ const litellmHealth = require('../lib/litellmHealth');
|
|
|
50
50
|
const pyDeps = require('../lib/pyDeps');
|
|
51
51
|
const pwshStore = require('../lib/pwshStore');
|
|
52
52
|
const { staleCheckoutGate } = require('../lib/staleCheckout');
|
|
53
|
+
const { downgradeGate } = require('../lib/downgradeGuard');
|
|
53
54
|
const releaseLock = require('../lib/releaseLock');
|
|
54
55
|
const claudeProfile = require('../lib/claudeProfile');
|
|
55
56
|
const shellProfile = require('../lib/shellProfile');
|
|
57
|
+
const codeMode = require('../lib/codeMode');
|
|
56
58
|
const devRootHooks = require('../lib/devRootHooks');
|
|
57
59
|
const { promptBundleSettingsStep, activateBundlesStep } = require('../lib/bundleRuntimeStep');
|
|
58
60
|
const secretFiles = require('../lib/secretFiles');
|
|
@@ -169,6 +171,8 @@ Flags for update:
|
|
|
169
171
|
--no-secrets Skip secret and settings prompting for a dependency bundle this update installs
|
|
170
172
|
--allow-stale Update even when this checkout is behind origin's default branch (default: refused;
|
|
171
173
|
doctor checks ledger hashes, not source drift, so it cannot catch a stale deploy)
|
|
174
|
+
--allow-downgrade Update even when the install record was written by a newer agents-cli than this one
|
|
175
|
+
(default: refused, since older files would overwrite newer ones)
|
|
172
176
|
|
|
173
177
|
Update compares each installed file's source hash, ledger hash, and on-disk
|
|
174
178
|
hash: a file no one has touched since install is silently overwritten when
|
|
@@ -878,6 +882,7 @@ async function runUninstall(argv) {
|
|
|
878
882
|
`${result.filesKeptUserEdited.join(', ')}`
|
|
879
883
|
);
|
|
880
884
|
}
|
|
885
|
+
printClaudeProfileReport(claudeProfileStep(result.targetBase, true, { codeModeOnly: true }), { fixRequested: true });
|
|
881
886
|
printShellProfileReport(shellProfileStep(result.targetBase, true), { fixRequested: true });
|
|
882
887
|
if (result.filesKeptShared.length > 0) {
|
|
883
888
|
console.log(
|
|
@@ -1169,6 +1174,8 @@ function parseUpdateArgs(argv) {
|
|
|
1169
1174
|
args.noSecrets = true;
|
|
1170
1175
|
} else if (arg === '--allow-stale') {
|
|
1171
1176
|
args.allowStale = true;
|
|
1177
|
+
} else if (arg === '--allow-downgrade') {
|
|
1178
|
+
// consumed by the gate in main() before update runs
|
|
1172
1179
|
} else if (arg === '--repair') {
|
|
1173
1180
|
args.repair = true;
|
|
1174
1181
|
} else {
|
|
@@ -1197,6 +1204,7 @@ function summarizeBundleUpdate(b) {
|
|
|
1197
1204
|
if (b.conflictsResolved.length) parts.push(`${b.conflictsResolved.length} conflict(s) resolved`);
|
|
1198
1205
|
if (b.unresolvedConflicts.length) parts.push(`${b.unresolvedConflicts.length} conflict(s) unresolved`);
|
|
1199
1206
|
if (b.hooksWired.length) parts.push(`${b.hooksWired.length} hook(s) rewired`);
|
|
1207
|
+
if ((b.hooksRetuned || []).length) parts.push(`${b.hooksRetuned.length} hook(s) given the manifest timeout/onFailure`);
|
|
1200
1208
|
if ((b.hooksSkipped || []).length) parts.push(`${b.hooksSkipped.length} hook(s) waiting for a repo clone (${[...new Set(b.hooksSkipped.map((s) => s.requires))].join(', ')})`);
|
|
1201
1209
|
if (b.mcpWired.length) parts.push(`${b.mcpWired.length} MCP server(s) rewired`);
|
|
1202
1210
|
if ((b.keybindingsWired || []).length) parts.push(`${b.keybindingsWired.length} keybinding(s) bound`);
|
|
@@ -1450,15 +1458,15 @@ Project hooks (${step.findings.length} finding(s), ${step.repos.length} repo(s)
|
|
|
1450
1458
|
}
|
|
1451
1459
|
|
|
1452
1460
|
function printClaudeProfileReport(report, { fixRequested }) {
|
|
1453
|
-
for (const f of report.fixed) console.log(`\
|
|
1461
|
+
for (const f of report.fixed) console.log(`\nUpdated the PowerShell profile ${f.file} (backup: ${f.backup}); open a new terminal tab or run \`. $PROFILE\` to load it.`);
|
|
1454
1462
|
if (report.findings.length === 0 || report.fixed.length > 0) return;
|
|
1455
1463
|
console.log(`\nPowerShell profile claude command (${report.findings.length} finding(s)):`);
|
|
1456
1464
|
for (const f of report.findings) console.log(` ${claudeProfile.describeProfileFinding(f)}`);
|
|
1457
1465
|
if (!fixRequested) console.log(` Fix: ${claudeProfile.FIX_COMMAND}`);
|
|
1458
1466
|
}
|
|
1459
1467
|
|
|
1460
|
-
function claudeProfileStep(targetBase, fix) {
|
|
1461
|
-
return claudeProfile.checkClaudeProfile({ home: path.dirname(targetBase), fix });
|
|
1468
|
+
function claudeProfileStep(targetBase, fix, extra = {}) {
|
|
1469
|
+
return claudeProfile.checkClaudeProfile({ home: path.dirname(targetBase), fix, withCodeMode: codeMode.installed(targetBase), ...extra });
|
|
1462
1470
|
}
|
|
1463
1471
|
|
|
1464
1472
|
function printShellProfileReport(report, { fixRequested }) {
|
|
@@ -1545,6 +1553,17 @@ function splitProjectHookFlags(argv) {
|
|
|
1545
1553
|
return { rest, opts };
|
|
1546
1554
|
}
|
|
1547
1555
|
|
|
1556
|
+
/** Refuse an update that would roll the install record back, before any step (project hooks, profile, bypass) writes to the target. */
|
|
1557
|
+
function updateDowngradeGate(argv) {
|
|
1558
|
+
const { opts } = splitProjectHookFlags(argv);
|
|
1559
|
+
try {
|
|
1560
|
+
return downgradeGate({ targetBase: opts.targetDir || defaultTargetBase(), running: pkg.version, allowDowngrade: argv.includes('--allow-downgrade') });
|
|
1561
|
+
} catch (err) {
|
|
1562
|
+
if (err instanceof LedgerError) return null;
|
|
1563
|
+
throw err;
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1548
1567
|
async function withProjectHookStep(argv, run, { healBypass = false } = {}) {
|
|
1549
1568
|
const { rest, opts } = splitProjectHookFlags(argv);
|
|
1550
1569
|
const code = await run(rest);
|
|
@@ -1624,12 +1643,13 @@ function runDoctor(argv) {
|
|
|
1624
1643
|
let result = checkHealth({
|
|
1625
1644
|
packageRoot: PACKAGE_ROOT,
|
|
1626
1645
|
targetBase: args.targetDir,
|
|
1646
|
+
cliVersion: pkg.version,
|
|
1627
1647
|
});
|
|
1628
1648
|
const fixedPython = args.fix ? fixPythonDeps(result, { json: args.json }) : null;
|
|
1629
|
-
if (fixedPython) result = checkHealth({ packageRoot: PACKAGE_ROOT, targetBase: args.targetDir });
|
|
1649
|
+
if (fixedPython) result = checkHealth({ packageRoot: PACKAGE_ROOT, targetBase: args.targetDir, cliVersion: pkg.version });
|
|
1630
1650
|
const fixedRuntimes = args.fix ? fixBundleRuntimes(result, { json: args.json }) : [];
|
|
1631
1651
|
if (fixedRuntimes.length > 0 || fixedPython) {
|
|
1632
|
-
result = checkHealth({ packageRoot: PACKAGE_ROOT, targetBase: args.targetDir });
|
|
1652
|
+
result = checkHealth({ packageRoot: PACKAGE_ROOT, targetBase: args.targetDir, cliVersion: pkg.version });
|
|
1633
1653
|
if (fixedRuntimes.length > 0) result.runtimeFixed = fixedRuntimes;
|
|
1634
1654
|
if (fixedPython) result.pythonDepsFixed = fixedPython;
|
|
1635
1655
|
}
|
|
@@ -1693,6 +1713,8 @@ Hooks that run a script from another repo (${devHooks.findings.length} finding(s
|
|
|
1693
1713
|
printRuleMigrationReport(rules);
|
|
1694
1714
|
};
|
|
1695
1715
|
|
|
1716
|
+
const printCliVersions = () => console.log(`\nagents-cli: ${result.cliVersions.line}`);
|
|
1717
|
+
|
|
1696
1718
|
const printModVersions = () => {
|
|
1697
1719
|
if (result.modVersions.length === 0) return;
|
|
1698
1720
|
console.log('\nClaude Code version vs. installed mods:');
|
|
@@ -1750,6 +1772,14 @@ Hooks that run a script from another repo (${devHooks.findings.length} finding(s
|
|
|
1750
1772
|
for (const f of p.findings) console.log(` ${mark('skip')} ${f}`);
|
|
1751
1773
|
};
|
|
1752
1774
|
|
|
1775
|
+
const printCodeMode = () => {
|
|
1776
|
+
const c = result.codeMode;
|
|
1777
|
+
if (!c) return;
|
|
1778
|
+
console.log(`\nCode Mode (experimental; warnings only, see ${codeMode.DOC}):`);
|
|
1779
|
+
for (const line of codeMode.describeCodeMode(c)) console.log(` ${line}`);
|
|
1780
|
+
for (const w of c.warnings) console.log(` ${mark('skip')} ${w}`);
|
|
1781
|
+
};
|
|
1782
|
+
|
|
1753
1783
|
const printBundleRuntimes = () => {
|
|
1754
1784
|
for (const b of result.bundleRuntimes || []) {
|
|
1755
1785
|
console.log(`\nBundle "${b.bundle}" runtime:`);
|
|
@@ -1788,6 +1818,7 @@ Managed by Claude Code, not an orphan: ${m.relTarget}/ (${m.note}).`);
|
|
|
1788
1818
|
printPythonLaunchReport(py);
|
|
1789
1819
|
console.log(`${result.targetBase}: healthy — no orphans, no missing files, no drift.`);
|
|
1790
1820
|
printClaudeManaged();
|
|
1821
|
+
printCliVersions();
|
|
1791
1822
|
printModVersions();
|
|
1792
1823
|
printModValidation();
|
|
1793
1824
|
printMemoryIndex();
|
|
@@ -1796,6 +1827,7 @@ Managed by Claude Code, not an orphan: ${m.relTarget}/ (${m.note}).`);
|
|
|
1796
1827
|
printPortal();
|
|
1797
1828
|
printLiteLLM();
|
|
1798
1829
|
printPwshStore();
|
|
1830
|
+
printCodeMode();
|
|
1799
1831
|
printBundleRuntimes();
|
|
1800
1832
|
printPythonDeps();
|
|
1801
1833
|
printModeDrift();
|
|
@@ -1816,6 +1848,7 @@ Managed by Claude Code, not an orphan: ${m.relTarget}/ (${m.note}).`);
|
|
|
1816
1848
|
for (const d of result.drifted) console.log(` ${d.relTarget} (${ownerLabel(d)})`);
|
|
1817
1849
|
}
|
|
1818
1850
|
printClaudeManaged();
|
|
1851
|
+
printCliVersions();
|
|
1819
1852
|
printModVersions();
|
|
1820
1853
|
printModValidation();
|
|
1821
1854
|
printMemoryIndex();
|
|
@@ -1824,6 +1857,7 @@ Managed by Claude Code, not an orphan: ${m.relTarget}/ (${m.note}).`);
|
|
|
1824
1857
|
printPortal();
|
|
1825
1858
|
printLiteLLM();
|
|
1826
1859
|
printPwshStore();
|
|
1860
|
+
printCodeMode();
|
|
1827
1861
|
printBundleRuntimes();
|
|
1828
1862
|
printPythonDeps();
|
|
1829
1863
|
printProjectHooks();
|
|
@@ -1925,6 +1959,8 @@ async function main(argv, { captureSelection = false } = {}) {
|
|
|
1925
1959
|
}
|
|
1926
1960
|
|
|
1927
1961
|
if (command === 'update') {
|
|
1962
|
+
const downgraded = updateDowngradeGate(rest);
|
|
1963
|
+
if (downgraded !== null) return downgraded;
|
|
1928
1964
|
return withProjectHookStep(rest, runUpdate, { healBypass: true });
|
|
1929
1965
|
}
|
|
1930
1966
|
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Code Mode launcher (experimental)
|
|
2
|
+
|
|
3
|
+
This folder exists while the `code-mode` bundle is installed. It marks the machine as opted in.
|
|
4
|
+
|
|
5
|
+
- `claude` starts a normal chat with Remote Control, as always.
|
|
6
|
+
- `claudecm` starts a Code Mode chat. It runs `claude` with `CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1` for that one process only and passes every argument through, so `claudecm --resume <id>` works. A Code Mode chat has no Remote Control and resumes only through `claudecm`; plain `claude --resume` is refused.
|
|
7
|
+
|
|
8
|
+
Remove it: `agents-cli uninstall --bundle code-mode --yes`. The `claudecm` command leaves your shell profiles with it.
|
|
9
|
+
|
|
10
|
+
Full guide: `docs/code-mode.md` in the my-agents repository.
|
package/content/manifest.json
CHANGED
|
@@ -857,7 +857,9 @@
|
|
|
857
857
|
{
|
|
858
858
|
"event": "PreToolUse",
|
|
859
859
|
"type": "command",
|
|
860
|
-
"command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/chat_inbox_hook.py"
|
|
860
|
+
"command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/chat_inbox_hook.py",
|
|
861
|
+
"timeout": 15,
|
|
862
|
+
"onFailure": "continue"
|
|
861
863
|
},
|
|
862
864
|
{
|
|
863
865
|
"event": "SessionEnd",
|
|
@@ -1178,7 +1180,9 @@
|
|
|
1178
1180
|
"wiring": {
|
|
1179
1181
|
"event": "PreToolUse",
|
|
1180
1182
|
"type": "command",
|
|
1181
|
-
"command": "node ~/.claude/hooks/permission_mode_enforce.js"
|
|
1183
|
+
"command": "node ~/.claude/hooks/permission_mode_enforce.js",
|
|
1184
|
+
"timeout": 15,
|
|
1185
|
+
"onFailure": "continue"
|
|
1182
1186
|
}
|
|
1183
1187
|
},
|
|
1184
1188
|
{
|
|
@@ -1538,7 +1542,16 @@
|
|
|
1538
1542
|
},
|
|
1539
1543
|
{
|
|
1540
1544
|
"path": "proxy/autostart_hook.py",
|
|
1541
|
-
"kind": "
|
|
1545
|
+
"kind": "hook",
|
|
1546
|
+
"wiring": {
|
|
1547
|
+
"event": "UserPromptSubmit",
|
|
1548
|
+
"type": "command",
|
|
1549
|
+
"command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/autostart_hook.py",
|
|
1550
|
+
"platforms": [
|
|
1551
|
+
"win32"
|
|
1552
|
+
]
|
|
1553
|
+
},
|
|
1554
|
+
"note": "Warns when the model router (a Windows scheduled task) is down or a model override is left active; wired on Windows only."
|
|
1542
1555
|
},
|
|
1543
1556
|
{
|
|
1544
1557
|
"path": "proxy/capture_proxy.py",
|
|
@@ -1555,13 +1568,25 @@
|
|
|
1555
1568
|
},
|
|
1556
1569
|
{
|
|
1557
1570
|
"path": "proxy/publish_guard.py",
|
|
1558
|
-
"kind": "
|
|
1559
|
-
"note": "
|
|
1571
|
+
"kind": "hook",
|
|
1572
|
+
"note": "PreToolUse Bash hook.",
|
|
1573
|
+
"wiring": {
|
|
1574
|
+
"event": "PreToolUse",
|
|
1575
|
+
"matcher": "Bash",
|
|
1576
|
+
"type": "command",
|
|
1577
|
+
"command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/publish_guard.py"
|
|
1578
|
+
}
|
|
1560
1579
|
},
|
|
1561
1580
|
{
|
|
1562
1581
|
"path": "proxy/credential_mutation_guard.py",
|
|
1563
|
-
"kind": "
|
|
1564
|
-
"note": "
|
|
1582
|
+
"kind": "hook",
|
|
1583
|
+
"note": "PreToolUse Bash hook, unscoped like publish_guard.py — blocks credential mutation/exposure for main session and every subagent.",
|
|
1584
|
+
"wiring": {
|
|
1585
|
+
"event": "PreToolUse",
|
|
1586
|
+
"matcher": "Bash",
|
|
1587
|
+
"type": "command",
|
|
1588
|
+
"command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/credential_mutation_guard.py"
|
|
1589
|
+
}
|
|
1565
1590
|
},
|
|
1566
1591
|
{
|
|
1567
1592
|
"path": "proxy/shell_parse.py",
|
|
@@ -1570,8 +1595,14 @@
|
|
|
1570
1595
|
},
|
|
1571
1596
|
{
|
|
1572
1597
|
"path": "proxy/headless_spawn_guard.py",
|
|
1573
|
-
"kind": "
|
|
1574
|
-
"
|
|
1598
|
+
"kind": "hook",
|
|
1599
|
+
"wiring": {
|
|
1600
|
+
"event": "PreToolUse",
|
|
1601
|
+
"matcher": "Bash|PowerShell",
|
|
1602
|
+
"type": "command",
|
|
1603
|
+
"command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/headless_spawn_guard.py"
|
|
1604
|
+
},
|
|
1605
|
+
"note": "PreToolUse Bash|PowerShell hook, unscoped like publish_guard.py — denies visible-window spawns (start/Start-Process without -WindowStyle Hidden/-NoNewWindow, -Verb RunAs, wt, GUI apps, non-headless browsers, playwright --headed/headless=False); escape hatch is ALLOW_VISIBLE_WINDOW=1 or the time-boxed ~/.claude/.allow_visible_window.json marker (--allow-visible CLI), html-mocker/mocker.py allowlisted. On macOS it also denies open, osascript beyond display notification, Terminal/iTerm and other terminal apps, .app/Contents/MacOS executables, Safari and headed browsers, and qlmanage -p, with the same escape hatch."
|
|
1575
1606
|
},
|
|
1576
1607
|
{
|
|
1577
1608
|
"path": "proxy/headless_process.py",
|
|
@@ -1595,8 +1626,14 @@
|
|
|
1595
1626
|
},
|
|
1596
1627
|
{
|
|
1597
1628
|
"path": "proxy/gitlab_mutation_guard.py",
|
|
1598
|
-
"kind": "
|
|
1599
|
-
"
|
|
1629
|
+
"kind": "hook",
|
|
1630
|
+
"wiring": {
|
|
1631
|
+
"event": "PreToolUse",
|
|
1632
|
+
"matcher": "Bash|PowerShell|Write|Edit",
|
|
1633
|
+
"type": "command",
|
|
1634
|
+
"command": "node ~/.claude/hooks/pyrun.js ~/.claude/proxy/gitlab_mutation_guard.py"
|
|
1635
|
+
},
|
|
1636
|
+
"note": "PreToolUse Bash|PowerShell|Write|Edit hook — denies raw scribe_runner GitLab-mutation calls outside ship.py/gitlab_phase.py, redirecting to those wrappers instead of letting an agent route around a blocked skill invocation."
|
|
1600
1637
|
},
|
|
1601
1638
|
{
|
|
1602
1639
|
"path": "proxy/agent_model_guard.py",
|
|
@@ -2479,6 +2516,15 @@
|
|
|
2479
2516
|
]
|
|
2480
2517
|
}
|
|
2481
2518
|
}
|
|
2519
|
+
},
|
|
2520
|
+
{
|
|
2521
|
+
"path": "global/CLAUDE.md",
|
|
2522
|
+
"kind": "setting",
|
|
2523
|
+
"note": "Subagents, workflows, in-process teammates, compaction and session-title requests write the prompt cache with the one-hour lifetime instead of the five-minute default (Claude Code 2.1.242 or later; FORCE_PROMPT_CACHING_5M and CLAUDE_CODE_SUBAGENT_PROMPT_CACHE_TTL override it per session). Cache writes cost more per token than at five minutes, so the item is maintainer-only. Rollback: delete this item and run `node packages\\cli\\bin\\cli.js update --yes`.",
|
|
2524
|
+
"wiring": {
|
|
2525
|
+
"settingsKey": "subagentPromptCacheTtl",
|
|
2526
|
+
"value": "1h"
|
|
2527
|
+
}
|
|
2482
2528
|
}
|
|
2483
2529
|
],
|
|
2484
2530
|
"deps": [],
|
|
@@ -2691,6 +2737,23 @@
|
|
|
2691
2737
|
"deps": [],
|
|
2692
2738
|
"secrets": []
|
|
2693
2739
|
},
|
|
2740
|
+
{
|
|
2741
|
+
"key": "code-mode",
|
|
2742
|
+
"title": "Code Mode launcher (maintainer-only, experimental)",
|
|
2743
|
+
"summary": "Adds the claudecm command to the PowerShell, zsh and bash profiles: it starts one Code Mode chat (CLAUDE_CODE_EXPERIMENTAL_CODE_MODE=1 for that chat's process only) and passes every argument through. claude itself is unchanged and keeps Remote Control. Off by default; uninstall removes the command. Needs Claude Code 2.1.323 or later",
|
|
2744
|
+
"profile": "self",
|
|
2745
|
+
"advanced": true,
|
|
2746
|
+
"items": [
|
|
2747
|
+
{
|
|
2748
|
+
"path": "global/code-mode/README.md",
|
|
2749
|
+
"targetPath": "code-mode/README.md",
|
|
2750
|
+
"kind": "infra",
|
|
2751
|
+
"note": "Carries the opt-in: while this file is tracked in the ledger, update and doctor --fix keep the claudecm function in the profiles (packages/cli/lib/claudeProfile.js for PowerShell, shellProfile.js for zsh and bash); uninstalling the bundle removes it and the function. No settings item: the flag is set per process by the function."
|
|
2752
|
+
}
|
|
2753
|
+
],
|
|
2754
|
+
"deps": [],
|
|
2755
|
+
"secrets": []
|
|
2756
|
+
},
|
|
2694
2757
|
{
|
|
2695
2758
|
"key": "self-model-routing-mod",
|
|
2696
2759
|
"title": "Model Routing Mod (maintainer-only)",
|
|
@@ -180,7 +180,7 @@
|
|
|
180
180
|
"description": "\"infra\" (added npx distribution slice #28) tags a self-profile-only proxy asset that is deployed but never registered as a settings.json hook event — a daemon script, PowerShell launcher, or config/asset directory (e.g. claude_router.py, litellm/config.yaml, portal/). \"hook\" stays reserved for items that either carry a wiring block or are a shared library a wired hook imports (see agents_env.py's existing convention). \"setting\" (added npx distribution slice #29) tags a declarative-only item that sets one plain top-level settings.json key ({settingsKey, value} wiring) with no file of its own to install — `path` typically points at a real file another item in the same bundle already claims/copies (e.g. the hook whose behavior the setting complements), purely to satisfy prepack.js's \"every claimed path must exist\" staging check; it is never independently copied (see install.js's file-copy loop, which skips kind:\"setting\" the same way it skips kind:\"mcp\"). \"mod\" tags a Claude Code mod (plugin with a hooks module) copied to targetPath like a skill directory; its deployed directory is also added to settings.json env.CLAUDE_CODE_PLUGIN_DIRS (packages/cli/lib/modWiring.js), the sideload path that loads while the installed-plugin rollout flag is off. \"container\" and \"task\" (added with the resale bundle) are wiring-only like \"setting\": `path` names a file another item of the bundle ships (the compose file, or the script a task runs) and nothing is copied for them. A container item's wiring is {project, containers[], envFile?, healthTimeoutS?}: after install, `docker compose -p <project> up -d --build` runs on the deployed copy of `path` (the compose file must set a restart policy so it returns after a reboot), uninstall runs `down` and keeps named volumes, doctor checks the named containers. A task item's wiring is {name, exe, args[], workingDirectory?, description?, logonDelay?, repeat?, keepRunning?}: a hidden Windows logon task (conhost --headless, no window) is registered by lib/hiddenTask/register_hidden_task.ps1; exe is an absolute path or a PATH name; args and workingDirectory accept {{TARGET}} and {{HOME}}. Neither kind starts while the bundle's required secrets or required settings values are missing. A mod's wiring may also carry keybindings: {context, bindings:{<key>: <command>}}, merged into <target>/keybindings.json by packages/cli/lib/keybindingWiring.js (absent keys appended to the context block, existing user bindings kept and reported, uninstall removes only what was added)."
|
|
181
181
|
},
|
|
182
182
|
"wiring": {
|
|
183
|
-
"description": "Optional wiring spec. For hooks: {event, matcher?, if?, type, command[, timeout][, shell][, requires]} mirroring the settings.json shape documented in proxy/README.md (`if` is one permission rule for a tool event whose matcher selects that tool, written on the hook handler and never on the matcher group, and tools/manifest_lint.py rejects the group shape; shell is copied onto the handler; a `~/dev/...` path in command resolves to the dev root at install time, and requires names a `~/dev/...` file that must exist before the hook is wired, so a hook that runs a script from a separate repo waits for the clone and doctor reports it) — or an array of such objects when one item must be registered under more than one matcher block (e.g. a guard hook wired under both \"Bash\" and \"Monitor\"). For the statusline item: {settingsKey: \"statusLine\", type, command[, refreshInterval][, platforms]} — the whole object minus settingsKey and platforms is the settings.json value, `command` resolved like a hook command; `platforms` (process.platform values) limits the wiring to those platforms, so one settingsKey is wired by the PowerShell script on win32 and by the Python port through pyrun.js on darwin and linux. For kind:\"setting\" items: {settingsKey, value} — settingsKey is the top-level settings.json key to keep in sync with value (any JSON type), independent of the statusline shape above (no type/command). For mcp items: {name, ...serverDef} — \"name\" is the mcpServers key to write, and the rest is the mcpServers server-entry object itself (type/url/headers, or type/command/args/env for stdio), copied from mcps/mcps.json. \"scope\" may be present (documentation-only convention shared with mcps.json) but is stripped before writing — only \"user\" scope is supported by the executor. A string value of the form \"${VAR_NAME}\" anywhere in the entry is a secret placeholder, resolved at wire time via the shared agentsEnv contract (real env var, else agents.env); an unresolved placeholder is dropped rather than written literally, so an optional secret degrades gracefully instead of blocking install. Execution (packages/cli/lib/wiring.js landed slice #23; packages/cli/lib/mcpWiring.js landed slice #25; kind:\"setting\" landed slice #29, also in packages/cli/lib/wiring.js) acts on kind:\"hook\" items whose wiring object(s) carry {event, type, command}, on kind:\"mcp\" items whose wiring carries {name, ...}, and on kind:\"setting\" items whose wiring carries {settingsKey, value}; on kind:\"statusline\" items whose wiring carries {settingsKey, type, command} (same executor; an existing statusLine whose command runs a different script is left alone, and unrelated keys inside the object are preserved).",
|
|
183
|
+
"description": "Optional wiring spec. For hooks: {event, matcher?, if?, type, command[, timeout][, onFailure][, shell][, platforms][, requires]} mirroring the settings.json shape documented in proxy/README.md (`if` is one permission rule for a tool event whose matcher selects that tool, written on the hook handler and never on the matcher group, and tools/manifest_lint.py rejects the group shape; shell is copied onto the handler; timeout (seconds) and onFailure (\"continue\" or \"block\", read by Claude Code 2.1.295 and later, ignored by older ones) are copied onto the handler and, on update, set on an already-wired handler whose key the manifest declares; platforms (process.platform values) wires the hook only on those platforms; a `~/dev/...` path in command resolves to the dev root at install time, and requires names a `~/dev/...` file that must exist before the hook is wired, so a hook that runs a script from a separate repo waits for the clone and doctor reports it) — or an array of such objects when one item must be registered under more than one matcher block (e.g. a guard hook wired under both \"Bash\" and \"Monitor\"). For the statusline item: {settingsKey: \"statusLine\", type, command[, refreshInterval][, platforms]} — the whole object minus settingsKey and platforms is the settings.json value, `command` resolved like a hook command; `platforms` (process.platform values) limits the wiring to those platforms, so one settingsKey is wired by the PowerShell script on win32 and by the Python port through pyrun.js on darwin and linux. For kind:\"setting\" items: {settingsKey, value} — settingsKey is the top-level settings.json key to keep in sync with value (any JSON type), independent of the statusline shape above (no type/command). For mcp items: {name, ...serverDef} — \"name\" is the mcpServers key to write, and the rest is the mcpServers server-entry object itself (type/url/headers, or type/command/args/env for stdio), copied from mcps/mcps.json. \"scope\" may be present (documentation-only convention shared with mcps.json) but is stripped before writing — only \"user\" scope is supported by the executor. A string value of the form \"${VAR_NAME}\" anywhere in the entry is a secret placeholder, resolved at wire time via the shared agentsEnv contract (real env var, else agents.env); an unresolved placeholder is dropped rather than written literally, so an optional secret degrades gracefully instead of blocking install. Execution (packages/cli/lib/wiring.js landed slice #23; packages/cli/lib/mcpWiring.js landed slice #25; kind:\"setting\" landed slice #29, also in packages/cli/lib/wiring.js) acts on kind:\"hook\" items whose wiring object(s) carry {event, type, command}, on kind:\"mcp\" items whose wiring carries {name, ...}, and on kind:\"setting\" items whose wiring carries {settingsKey, value}; on kind:\"statusline\" items whose wiring carries {settingsKey, type, command} (same executor; an existing statusLine whose command runs a different script is left alone, and unrelated keys inside the object are preserved).",
|
|
184
184
|
"oneOf": [
|
|
185
185
|
{ "type": "object" },
|
|
186
186
|
{ "type": "array", "items": { "type": "object" }, "minItems": 1 }
|
|
@@ -17,7 +17,7 @@ import threading
|
|
|
17
17
|
import time
|
|
18
18
|
from pathlib import Path
|
|
19
19
|
|
|
20
|
-
from run_e2e import CREATE_NO_WINDOW, ISOLATE, MOD, OBSERVER, STUBS, claude_exe
|
|
20
|
+
from run_e2e import CREATE_NO_WINDOW, ISOLATE, MOD, OBSERVER, STUBS, claude_env, claude_exe
|
|
21
21
|
|
|
22
22
|
NUDGE_HEAD = "Keep-warm check."
|
|
23
23
|
STUB_TAIL = " Stub nudge for a headless test. Do exactly this and nothing else: "
|
|
@@ -46,8 +46,7 @@ class Run:
|
|
|
46
46
|
cache.mkdir()
|
|
47
47
|
self.cache = cache
|
|
48
48
|
self.log = self.work / "observer.log"
|
|
49
|
-
env =
|
|
50
|
-
os.environ,
|
|
49
|
+
env = claude_env(
|
|
51
50
|
MSYS_NO_PATHCONV="1",
|
|
52
51
|
OBSERVER_LOG=str(self.log),
|
|
53
52
|
HANDOFF_DIR=str(self.work / "handoffs"),
|
|
@@ -20,6 +20,7 @@ MOD = HERE.parent.parent
|
|
|
20
20
|
OBSERVER = HERE / "observer"
|
|
21
21
|
CREATE_NO_WINDOW = 0x08000000
|
|
22
22
|
ISOLATE = json.dumps({"env": {"CLAUDE_CODE_PLUGIN_DIRS": ""}})
|
|
23
|
+
CODE_MODE_FLAG = "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"
|
|
23
24
|
|
|
24
25
|
HANDOFF_BODY = """# Session handoff
|
|
25
26
|
|
|
@@ -80,6 +81,13 @@ def make_dirty_repo(cwd):
|
|
|
80
81
|
(cwd / "tracked.txt").write_text("two" + chr(10), encoding="utf-8")
|
|
81
82
|
|
|
82
83
|
|
|
84
|
+
def claude_env(**extra):
|
|
85
|
+
"""Child env without Code Mode; a test opts in by passing the flag in `extra`."""
|
|
86
|
+
env = {k: v for k, v in os.environ.items() if k != CODE_MODE_FLAG}
|
|
87
|
+
env.update(extra)
|
|
88
|
+
return env
|
|
89
|
+
|
|
90
|
+
|
|
83
91
|
def claude_exe():
|
|
84
92
|
override = os.environ.get("HANDOFF_E2E_CLAUDE_EXE")
|
|
85
93
|
if override:
|
|
@@ -116,8 +124,7 @@ def run(scenario, timeout=150):
|
|
|
116
124
|
if scenario == "dirty":
|
|
117
125
|
make_dirty_repo(cwd)
|
|
118
126
|
log = work / "observer.log"
|
|
119
|
-
env =
|
|
120
|
-
os.environ,
|
|
127
|
+
env = claude_env(
|
|
121
128
|
MSYS_NO_PATHCONV="1",
|
|
122
129
|
HANDOFF_DIR=str(work / "handoffs"),
|
|
123
130
|
OBSERVER_LOG=str(log),
|
|
@@ -24,6 +24,7 @@ OBSERVER = HERE / "observer"
|
|
|
24
24
|
CREATE_NO_WINDOW = 0x08000000 if os.name == "nt" else 0
|
|
25
25
|
SECRET_PATTERN = re.compile(r"GITLAB|GLAB|GITHUB|^GH_|TOKEN|SECRET|PASSWORD|API_KEY", re.I)
|
|
26
26
|
KEEP_PREFIX = ("CLAUDE_CODE_", "ANTHROPIC_")
|
|
27
|
+
CODE_MODE_FLAG = "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"
|
|
27
28
|
|
|
28
29
|
CALC = "def add(a, b):\n return a - b\n"
|
|
29
30
|
TEST = (
|
|
@@ -115,7 +116,7 @@ def clipboard_set(text):
|
|
|
115
116
|
|
|
116
117
|
|
|
117
118
|
def sandbox_env(work, log):
|
|
118
|
-
env = {k: v for k, v in os.environ.items() if k.startswith(KEEP_PREFIX) or not SECRET_PATTERN.search(k)}
|
|
119
|
+
env = {k: v for k, v in os.environ.items() if k != CODE_MODE_FLAG and (k.startswith(KEEP_PREFIX) or not SECRET_PATTERN.search(k))}
|
|
119
120
|
env.update(MSYS_NO_PATHCONV="1", HANDOFF_DIR=str(work / "handoffs"), OBSERVER_LOG=str(log),
|
|
120
121
|
)
|
|
121
122
|
return env
|
|
@@ -28,7 +28,7 @@ import pyte
|
|
|
28
28
|
from winpty import PtyProcess
|
|
29
29
|
|
|
30
30
|
sys.path.insert(0, str(Path(__file__).resolve().parent))
|
|
31
|
-
from run_e2e import CREATE_NO_WINDOW, ISOLATE, MOD, OBSERVER, claude_exe # noqa: E402,F401
|
|
31
|
+
from run_e2e import CREATE_NO_WINDOW, ISOLATE, MOD, OBSERVER, claude_env, claude_exe # noqa: E402,F401
|
|
32
32
|
|
|
33
33
|
KEYS = {
|
|
34
34
|
"Enter": "\r", "Esc": "\x1b", "Up": "\x1b[A", "Down": "\x1b[B", "Right": "\x1b[C",
|
|
@@ -55,7 +55,7 @@ class Tui:
|
|
|
55
55
|
for d in plugin_dirs:
|
|
56
56
|
argv += ["--plugin-dir", str(d)]
|
|
57
57
|
argv += ["--model", model, *extra_args]
|
|
58
|
-
full_env =
|
|
58
|
+
full_env = claude_env(MSYS_NO_PATHCONV="1", **env)
|
|
59
59
|
self.proc = PtyProcess.spawn(argv, cwd=str(cwd) if cwd else None, env=full_env, dimensions=(ROWS, COLS))
|
|
60
60
|
self.pid = self.proc.pid
|
|
61
61
|
threading.Thread(target=self._pump, daemon=True).start()
|
|
@@ -60,7 +60,7 @@ def build_prompt():
|
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
def run_claude(project, out_dir, with_guard):
|
|
63
|
-
env =
|
|
63
|
+
env = {k: v for k, v in os.environ.items() if k != "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"}
|
|
64
64
|
env.update({
|
|
65
65
|
"CLAUDE_CODE_PLUGIN_DIRS": str(MOD),
|
|
66
66
|
"CLAUDE_MODELS_CONFIG": str(CONFIG),
|
|
@@ -71,7 +71,7 @@ def settings(sandbox: Path) -> Path:
|
|
|
71
71
|
|
|
72
72
|
|
|
73
73
|
def env_for(sandbox: Path, with_mod: bool, fork: bool = False) -> dict:
|
|
74
|
-
env =
|
|
74
|
+
env = {k: v for k, v in os.environ.items() if k != "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"}
|
|
75
75
|
if fork:
|
|
76
76
|
env["CLAUDE_CODE_FORK_SUBAGENT"] = "1"
|
|
77
77
|
env.update({
|
|
@@ -61,7 +61,7 @@ def run_claude(sandbox: Path, claude: str, with_mod: bool) -> subprocess.Complet
|
|
|
61
61
|
(project / ".claude" / "workflows").mkdir(parents=True)
|
|
62
62
|
(project / ".claude" / "workflows" / "routing-e2e.js").write_text(WORKFLOW, encoding="utf-8")
|
|
63
63
|
cfg = json.loads(CONFIG.read_text(encoding="utf-8"))
|
|
64
|
-
env =
|
|
64
|
+
env = {k: v for k, v in os.environ.items() if k != "CLAUDE_CODE_EXPERIMENTAL_CODE_MODE"}
|
|
65
65
|
env.update({
|
|
66
66
|
"CLAUDE_CODE_PLUGIN_DIRS": str(MOD) if with_mod else "",
|
|
67
67
|
"CLAUDE_MODELS_CONFIG": str(CONFIG),
|
package/content/proxy/README.md
CHANGED
|
@@ -163,7 +163,7 @@ Emits a `permissionDecision`-equivalent denial (exit code 2, reason on stderr) w
|
|
|
163
163
|
**Time-boxed marker override**
|
|
164
164
|
For a founder-approved snapshotted-dirt discard, drop a `<repo-root>/.claude/.allow_shared_revert.json` marker (`{"until", "reason", "paths", "created_by"}`, max 1h lifetime) instead of exporting `ALLOW_SHARED_REVERT=1`; the repo root resolves to the superproject for submodules, and an expired/malformed marker is ignored (fails CLOSED back to the normal deny).
|
|
165
165
|
|
|
166
|
-
Tests: `proxy/tests/test_shared_worktree_revert_guard.py` (real temp git repos, subprocess-driven — no mocking of `git status` itself). Repo-wide: `proxy/tests/test_no_syntax_warnings.py` compiles every `proxy/*.py` hook module with warnings-as-errors — catches a non-raw docstring documenting shell syntax (`\;`, `\s`, `\p`, ...) emitting a `SyntaxWarning` on stderr on EVERY hook invocation, a class of bug found in three modules on 2026-09-02.
|
|
166
|
+
Tests: `proxy/tests/test_shared_worktree_revert_guard.py` (real temp git repos, subprocess-driven — no mocking of `git status` itself). Repo-wide: `proxy/tests/test_no_syntax_warnings.py` compiles every `proxy/*.py` hook module with warnings-as-errors — catches a non-raw docstring documenting shell syntax (`\;`, `\s`, `\p`, ...) emitting a `SyntaxWarning` on stderr on EVERY hook invocation, a class of bug found in three modules on 2026-09-02. Directory tracking shared by the Bash guards (`cd`/`pushd`/`popd`, PowerShell location cmdlets, `~`, `mkdir x && cd x`, and `publish_guard.py`'s stack-apply resolution): `proxy/tests/test_guard_cd_tracking.py`.
|
|
167
167
|
|
|
168
168
|
---
|
|
169
169
|
|
|
@@ -34,10 +34,14 @@ from shell_parse import ( # noqa: F401 - re-exported for existing callers
|
|
|
34
34
|
_quote_balanced,
|
|
35
35
|
apply_cd,
|
|
36
36
|
binary_name,
|
|
37
|
+
dir_command,
|
|
37
38
|
is_shell_like_binary,
|
|
38
39
|
leading_env_assignments,
|
|
39
40
|
mentions_heredoc,
|
|
41
|
+
home_for,
|
|
40
42
|
normalize_msys_path,
|
|
43
|
+
parse_cd,
|
|
44
|
+
resolve_cd,
|
|
41
45
|
resolve_dir,
|
|
42
46
|
split_pipe_stages,
|
|
43
47
|
split_segments,
|
|
@@ -45,6 +49,7 @@ from shell_parse import ( # noqa: F401 - re-exported for existing callers
|
|
|
45
49
|
strip_env_assignments,
|
|
46
50
|
strip_quotes,
|
|
47
51
|
unwind_shell_wrapper,
|
|
52
|
+
wrapper_shell,
|
|
48
53
|
)
|
|
49
54
|
|
|
50
55
|
# Global git options that consume a SEPARATE following token as their
|