interlockd 0.1.5__tar.gz → 0.1.7__tar.gz
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.
- {interlockd-0.1.5 → interlockd-0.1.7}/.github/workflows/ci.yml +4 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/.github/workflows/release.yml +34 -6
- {interlockd-0.1.5 → interlockd-0.1.7}/CHANGELOG.md +10 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/PKG-INFO +6 -4
- {interlockd-0.1.5 → interlockd-0.1.7}/README.md +4 -3
- {interlockd-0.1.5 → interlockd-0.1.7}/SECURITY.md +3 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/ADAPTERS.md +3 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/GETTING-STARTED.md +2 -2
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/USER-GUIDE.md +5 -4
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/github-workflow.yml +1 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/__init__.py +1 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/bench.py +13 -2
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/capture.py +4 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/cli.py +68 -31
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/insights.py +11 -7
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/mcp_proxy.py +5 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/onboard.py +7 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/plugin_api.py +35 -3
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/policy/workspace.py +143 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/service.py +60 -8
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/shims/claude-code/interlock-hook.sh +1 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/shims/kiro/interlock-hook.mjs +1 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/shims/kiro/interlock-hook.sh +1 -1
- interlockd-0.1.7/interlockd/shims/py/interlock-hook.py +214 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/pyproject.toml +2 -1
- interlockd-0.1.7/scripts/e2e-hooks.py +138 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/sdk/js/package.json +1 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/sdk/js/src/index.js +1 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/conftest.py +16 -10
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_claude_code.py +5 -3
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_cursor_gemini.py +4 -2
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_insights.py +5 -2
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_more_adapters.py +15 -7
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_onboard.py +15 -2
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_plugin_api.py +17 -2
- interlockd-0.1.7/tests/test_policy_compose.py +149 -0
- interlockd-0.1.7/tests/test_service_windows.py +55 -0
- interlockd-0.1.7/tests/test_shim_py.py +142 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_version.py +1 -1
- {interlockd-0.1.5 → interlockd-0.1.7}/.github/CODEOWNERS +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/.github/ISSUE_TEMPLATE/agent.yml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/.github/ISSUE_TEMPLATE/bug.yml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/.github/ISSUE_TEMPLATE/decision.yml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/.github/dependabot.yml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/.github/pull_request_template.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/.gitignore +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/CLAUDE.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/CODE_OF_CONDUCT.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/CONTRIBUTING.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/LICENSE +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/NOTICE +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/action.yml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/README.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/antigravity/PAYLOADS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/claude-code/PAYLOADS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/claude-code/README.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/codex/PAYLOADS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/codex/README.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/copilot-cli/PAYLOADS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/cursor/PAYLOADS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/gemini-cli/PAYLOADS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/kiro/PAYLOADS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/opencode/PAYLOADS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/adapters/windsurf/PAYLOADS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/benchmarks/agentdojo_template.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/benchmarks/injecagent.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/benchmarks/nl2bash.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/README.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/_corpus.yaml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/archetypes/_corpus.yaml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/archetypes/exfil_and_secrets.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/archetypes/git_and_history.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/archetypes/injection_persistence_supplychain.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/archetypes/judge_confirmation.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/archetypes/judge_exfil.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/archetypes/judge_injection.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/archetypes/judge_intent.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/archetypes/slow_hijack.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/external/README.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/external/samples/agentdojo.sample.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/external/samples/agentdrift.sample.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/external/samples/injecagent.sample.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/ogr-seed-v0/README.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/corpus/ogr-seed-v0/seed-v0.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/demo/demo.sh +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/demo/demo.tape +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/BENCHMARKS.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/PERFORMANCE.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/THREAT-MODEL.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/mandate-example.cedar +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/policy-example.yaml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/reports/M3-judge-calibration.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/reports/ogr-seed-v0-results.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/docs/reports/ogr-seed-v0-results.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/agents/README.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/agents/claude_agent_sdk_agent.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/agents/crewai_crew.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/agents/google_adk_agent.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/agents/langgraph_agent.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/agents/openai_agents.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/agents/semantic_kernel_agent.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/agents/strands_agent.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/aws/interlock-audit.yaml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/policies/ci.yaml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/policies/mcp-locked-down.yaml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/examples/policies/strict-team.yaml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/__main__.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/aibom.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/api.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/auth.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/calibration.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/compose.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/config.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/control.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/corpus.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/data/packs/_corpus.yaml +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/data/packs/egress.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/data/packs/fileops.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/data/packs/git.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/data/packs/packages.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/data/packs/persistence.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/data/packs/secrets.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/data/packs/shell.jsonl +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/__init__.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/describe.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/engine.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/flow.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/mandate.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/mcp.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/memory.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/oauth.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/packs.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/det/shellparse.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/egress.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/gateway.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/ids.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/integrations/__init__.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/integrations/claude_agent_sdk.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/integrations/client.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/integrations/crewai.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/integrations/google_adk.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/integrations/langchain.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/integrations/openai_agents.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/integrations/semantic_kernel.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/integrations/strands.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/judge_setup.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/judges/__init__.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/judges/guardrails.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/judges/local_probe.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/judges/projector.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/judges/strands_decider.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/ledger.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/mcp_http.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/mcp_server.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/models.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/normalize/__init__.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/normalize/claude_code.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/normalize/cursor.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/normalize/gemini_cli.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/normalize/kiro.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/normalize/more.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/ogr.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/otel.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/paths.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/pipeline.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/plugins.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/policy/__init__.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/policy/managed.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/policy_lint.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/render.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/sandbox.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/scan.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/schema/verdict.schema.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/selftest.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/shims/opencode/interlock.js +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/store/__init__.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/store/drainer.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/store/dynamodb.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/store/memory.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/store/spool.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/testkit.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/tiers.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/transcript/__init__.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/transcript/claude_code.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/transcript/kiro.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/interlockd/watch.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/packaging/homebrew/Formula/interlock.rb +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/packaging/homebrew/README.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/packaging/homebrew/make_formula.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/scripts/check-hygiene.sh +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/sdk/js/README.md +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/sdk/js/src/index.d.ts +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fake_mcp_server.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/claude-code/post-bash-inject.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/claude-code/post-read-inject.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/claude-code/pre-bash-block.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/claude-code/pre-bash-inject.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/codex/post-bash-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/codex/post-bash-inject.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/codex/pre-bash-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/codex/pre-bash-block.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/copilot-cli/post-bash-inject.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/copilot-cli/pre-bash-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/copilot-cli/pre-bash-block.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/cursor/post-read-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/cursor/post-shell-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/cursor/pre-read-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/cursor/pre-shell-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/cursor/pre-shell-block.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/gemini-cli/post-read-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/gemini-cli/post-read-inject.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/gemini-cli/post-shell-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/gemini-cli/post-shell-rot13-inject.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/gemini-cli/pre-read-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/gemini-cli/pre-shell-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/gemini-cli/pre-shell-block.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/windsurf/post-shell-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/windsurf/pre-shell-benign.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/fixtures/windsurf/pre-shell-block.json +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_aibom.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_api.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_audit_chain.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_bench.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_calibration.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_capture.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_claude_agent_sdk.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_control.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_corpus.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_crewai.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_dynamodb.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_egress.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_examples.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_flow.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_gateway.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_google_adk.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_homebrew_formula.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_interlock_test.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_js_sdk.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_judge.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_judge_setup.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_langchain.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_local_probe.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_managed_policy.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_mandate.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_mcp_http.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_mcp_oauth.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_mcp_policy.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_mcp_proxy.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_mcp_server.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_memory.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_normalize_kiro.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_ogr.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_openai_agents.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_opencode.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_otel.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_packs.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_paths_windows.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_pipeline.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_plugins.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_policy_lint.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_repo_policy.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_sandbox.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_scan.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_selftest.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_semantic_kernel.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_shim_sh.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_spool.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_strands.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_text_encoding.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_tiers.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_transcript.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_unix_socket.py +0 -0
- {interlockd-0.1.5 → interlockd-0.1.7}/tests/test_watch.py +0 -0
|
@@ -56,6 +56,10 @@ jobs:
|
|
|
56
56
|
run: .venv/Scripts/python.exe -m pytest -q -p no:cacheprovider
|
|
57
57
|
- name: Rule corpus gate
|
|
58
58
|
run: .venv/Scripts/interlock.exe test
|
|
59
|
+
- name: Agent hooks on Windows (init, every installed hook through cmd.exe / PowerShell, uninstall)
|
|
60
|
+
run: |
|
|
61
|
+
export USERPROFILE="$(cygpath -w "$RUNNER_TEMP/e2e-home")" HOME="$RUNNER_TEMP/e2e-home"
|
|
62
|
+
mkdir -p "$HOME" && .venv/Scripts/python.exe scripts/e2e-hooks.py --service
|
|
59
63
|
- name: Live daemon on Windows (start, decide, audit, stop)
|
|
60
64
|
run: |
|
|
61
65
|
export INTERLOCK_HOME="$RUNNER_TEMP/ih" IL=.venv/Scripts/interlock.exe
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
name: release
|
|
2
2
|
|
|
3
|
-
# Publish to PyPI when a version tag is pushed (git tag v0.1.0 && git push origin v0.1.0).
|
|
4
|
-
#
|
|
5
|
-
# project "interlockd" → Publishing → add GitHub publisher: owner interlockd, repo interlock,
|
|
6
|
-
#
|
|
3
|
+
# Publish to PyPI and npm when a version tag is pushed (git tag v0.1.0 && git push origin v0.1.0).
|
|
4
|
+
# Both use trusted publishing (OIDC): no API token is stored. One-time setup:
|
|
5
|
+
# pypi.org: project "interlockd" → Publishing → add GitHub publisher: owner interlockd, repo interlock,
|
|
6
|
+
# workflow release.yml, environment pypi.
|
|
7
|
+
# npmjs.com: package @interlockd/sdk → Settings → Trusted publishing → GitHub Actions: organization interlockd,
|
|
8
|
+
# repository interlock, workflow release.yml, environment npm.
|
|
7
9
|
|
|
8
10
|
on:
|
|
9
11
|
push:
|
|
@@ -27,8 +29,9 @@ jobs:
|
|
|
27
29
|
tag="${GITHUB_REF_NAME#v}"
|
|
28
30
|
pkg=$(python3 -c "import tomllib;print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])")
|
|
29
31
|
mod=$(python3 -c "import re;print(re.search(r'__version__ = \"(.+)\"', open('interlockd/__init__.py').read()).group(1))")
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
js=$(python3 -c "import json;print(json.load(open('sdk/js/package.json'))['version'])")
|
|
33
|
+
echo "tag=$tag pyproject=$pkg module=$mod sdk/js=$js"
|
|
34
|
+
[ "$tag" = "$pkg" ] && [ "$tag" = "$mod" ] && [ "$tag" = "$js" ]
|
|
32
35
|
- name: Test
|
|
33
36
|
run: |
|
|
34
37
|
uv venv --python 3.12 && uv pip install -e ".[dev]" --python .venv/bin/python
|
|
@@ -66,6 +69,31 @@ jobs:
|
|
|
66
69
|
gh release create "$GITHUB_REF_NAME" dist/* --repo "$GITHUB_REPOSITORY" --title "$GITHUB_REF_NAME" --generate-notes
|
|
67
70
|
fi
|
|
68
71
|
|
|
72
|
+
npm:
|
|
73
|
+
# @interlockd/sdk (sdk/js) with npm trusted publishing: the job's OIDC identity is the credential (npm 11.5.1+), and
|
|
74
|
+
# npm attaches provenance (which commit and workflow built it) because the repository is public.
|
|
75
|
+
needs: publish
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
environment: npm
|
|
78
|
+
permissions:
|
|
79
|
+
contents: read
|
|
80
|
+
id-token: write # trusted publishing + provenance
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@v7
|
|
83
|
+
- uses: actions/setup-node@v7
|
|
84
|
+
with: { node-version: "24", registry-url: "https://registry.npmjs.org" }
|
|
85
|
+
- name: npm with trusted publishing
|
|
86
|
+
run: npm install -g "npm@>=11.5.1" && npm --version
|
|
87
|
+
- name: Publish @interlockd/sdk
|
|
88
|
+
working-directory: sdk/js
|
|
89
|
+
run: |
|
|
90
|
+
v="${GITHUB_REF_NAME#v}"
|
|
91
|
+
[ "$(node -p 'require("./package.json").version')" = "$v" ] || { echo "::error::sdk/js version is not $v"; exit 1; }
|
|
92
|
+
if npm view "@interlockd/sdk@$v" version >/dev/null 2>&1; then
|
|
93
|
+
echo "@interlockd/sdk@$v is already on npm (published by hand?); nothing to do"; exit 0
|
|
94
|
+
fi
|
|
95
|
+
npm publish --access public --provenance
|
|
96
|
+
|
|
69
97
|
homebrew:
|
|
70
98
|
# Regenerates Formula/interlock.rb from the release on PyPI. With a HOMEBREW_TAP_TOKEN secret (a fine-grained token
|
|
71
99
|
# with contents: write on interlockd/homebrew-tap) it commits the formula there; without one it is kept as an artifact.
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.7 (2026-10-25)
|
|
4
|
+
|
|
5
|
+
- Plugin API (still version 1, additive): `compose_policies(docs)` returns one policy document that tightens a policy as applying the documents one after another would, for layering policies centrally (a baseline plus group policies) into the one managed policy a machine applies; `tighten_policy(base, data)` and `lint_policy(policy)` expose the tighten-only merge and `policy lint`. A property test checks `compose` against applying the layers in order on random policies. One documented exception: `trust.allowed_git_remotes` is narrowed left to right, never looser than the machine's own list.
|
|
6
|
+
|
|
7
|
+
## 0.1.6 (2026-10-25)
|
|
8
|
+
|
|
9
|
+
- **Native Windows, agent hooks:** `interlock init` / `install` set up Claude Code, Codex, Cursor, Gemini CLI, Copilot CLI, Windsurf, Antigravity and Kiro on Windows with a Python hook shim (`interlockd/shims/py`): the same replies as the `sh` shim byte for byte (tested on every captured payload), about 60 ms per call, standard library only. The background service on Windows is a per-user Run-key entry (no admin rights). `selftest`, `capture` and `gateway` work on Windows too; only `sandbox` and `judge` still need macOS or Linux. CI runs `init` and every installed hook through `cmd.exe` / PowerShell on a Windows runner (`scripts/e2e-hooks.py`); live runs with each agent on Windows are still to do.
|
|
10
|
+
- The MCP gateway starts servers like `npx` on Windows (their `.cmd` launchers), and `capture export` redacts Windows home paths to `/Users/dev/...` like POSIX ones.
|
|
11
|
+
- Releases publish `@interlockd/sdk` to npm from the release workflow with npm trusted publishing (no stored token) and npm provenance; the release checks that the tag matches the JS SDK's version too.
|
|
12
|
+
|
|
3
13
|
## 0.1.5 (2026-10-24)
|
|
4
14
|
|
|
5
15
|
- Plugin API: `interlockd.plugin_api` (version 1) is the stable interface for plugins (settings, policy validation, the managed policy, daemon status, hook integrity, audit records without tool content), covered by contract tests. A plugin can require a newer API with `PLUGIN_API = <n>`; an older interlockd skips it with a message. `interlock plugins` shows the API version.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: interlockd
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.7
|
|
4
4
|
Summary: Interlock daemon: a pre/post-action interlock for coding agents
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
License-File: LICENSE
|
|
7
7
|
License-File: NOTICE
|
|
8
8
|
Classifier: Environment :: Console
|
|
9
9
|
Classifier: Operating System :: MacOS
|
|
10
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
10
11
|
Classifier: Operating System :: POSIX :: Linux
|
|
11
12
|
Classifier: Programming Language :: Python :: 3.12
|
|
12
13
|
Classifier: Topic :: Security
|
|
@@ -56,8 +57,9 @@ pipx install interlockd # or: uv tool install interlockd, or: brew install i
|
|
|
56
57
|
interlock init # finds your agents, installs hooks, starts the daemon (shadow mode)
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
Runs on macOS and
|
|
60
|
-
|
|
60
|
+
Runs on macOS, Linux and Windows (Python 3.12+). On Windows, `interlock init` installs the agent hooks natively (a
|
|
61
|
+
Python hook shim instead of `sh` + `curl`) and starts the daemon at sign-in; the OS sandbox and the local judge need
|
|
62
|
+
macOS or Linux (on Windows, WSL2).
|
|
61
63
|
|
|
62
64
|
New here? [docs/GETTING-STARTED.md](docs/GETTING-STARTED.md) walks through shadow mode, enforcing, MCP servers, your own agents and CI in about ten minutes.
|
|
63
65
|
|
|
@@ -131,7 +133,7 @@ The full threat model is in [docs/THREAT-MODEL.md](docs/THREAT-MODEL.md). Latenc
|
|
|
131
133
|
|
|
132
134
|
```yaml
|
|
133
135
|
- uses: actions/checkout@v7
|
|
134
|
-
- uses: interlockd/interlock@v0.1.
|
|
136
|
+
- uses: interlockd/interlock@v0.1.7 # scan MCP/agent configs, test .interlock/policy.yaml
|
|
135
137
|
with: { fail-on: high }
|
|
136
138
|
- uses: github/codeql-action/upload-sarif@v3
|
|
137
139
|
if: always()
|
|
@@ -12,8 +12,9 @@ pipx install interlockd # or: uv tool install interlockd, or: brew install i
|
|
|
12
12
|
interlock init # finds your agents, installs hooks, starts the daemon (shadow mode)
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
Runs on macOS and
|
|
16
|
-
|
|
15
|
+
Runs on macOS, Linux and Windows (Python 3.12+). On Windows, `interlock init` installs the agent hooks natively (a
|
|
16
|
+
Python hook shim instead of `sh` + `curl`) and starts the daemon at sign-in; the OS sandbox and the local judge need
|
|
17
|
+
macOS or Linux (on Windows, WSL2).
|
|
17
18
|
|
|
18
19
|
New here? [docs/GETTING-STARTED.md](docs/GETTING-STARTED.md) walks through shadow mode, enforcing, MCP servers, your own agents and CI in about ten minutes.
|
|
19
20
|
|
|
@@ -87,7 +88,7 @@ The full threat model is in [docs/THREAT-MODEL.md](docs/THREAT-MODEL.md). Latenc
|
|
|
87
88
|
|
|
88
89
|
```yaml
|
|
89
90
|
- uses: actions/checkout@v7
|
|
90
|
-
- uses: interlockd/interlock@v0.1.
|
|
91
|
+
- uses: interlockd/interlock@v0.1.7 # scan MCP/agent configs, test .interlock/policy.yaml
|
|
91
92
|
with: { fail-on: high }
|
|
92
93
|
- uses: github/codeql-action/upload-sarif@v3
|
|
93
94
|
if: always()
|
|
@@ -32,3 +32,6 @@ pip download interlockd==<version> --no-deps -d /tmp/il && gh attestation verify
|
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
PyPI shows the same provenance on each file's page ("Verified details").
|
|
35
|
+
|
|
36
|
+
From 0.1.6, `@interlockd/sdk` is published to npm by the same workflow with npm trusted publishing, with npm
|
|
37
|
+
provenance (shown on its npm page). In a project that depends on it: `npm audit signatures`.
|
|
@@ -48,7 +48,9 @@ The daemon returns a `Verdict` with `disposition` in `allow | ask | block` (pre-
|
|
|
48
48
|
|
|
49
49
|
## 3. The shim
|
|
50
50
|
|
|
51
|
-
Copy `interlockd/shims/claude-code/interlock-hook.sh` as a template
|
|
51
|
+
Copy `interlockd/shims/claude-code/interlock-hook.sh` as a template, and add the same behaviour to the Python shim
|
|
52
|
+
(`interlockd/shims/py/interlock-hook.py`, used on Windows); `tests/test_shim_py.py` requires the two to answer every
|
|
53
|
+
captured payload byte for byte alike. A shim must:
|
|
52
54
|
|
|
53
55
|
- read the token from `~/.interlock/token` (exit 0 silently if missing: an uninstalled Interlock must never break the agent);
|
|
54
56
|
- POST `{"adapter": {...}, "payload": <raw stdin>}` to `/interlock/v1/hooks/<harness>?format=<renderer>` with the bearer token and a short timeout (pre 1.5 s, post 2.5 s);
|
|
@@ -9,8 +9,8 @@ pipx install interlockd # or: uv tool install interlockd, or: brew instal
|
|
|
9
9
|
interlock init
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
macOS and
|
|
13
|
-
|
|
12
|
+
macOS, Linux and Windows. Everything here works the same on Windows (PowerShell or cmd), except the sandbox and the
|
|
13
|
+
local judge, which need macOS or Linux (on Windows, WSL2); see the user guide, §2.
|
|
14
14
|
|
|
15
15
|
`init` lists everything it will change and asks first. It then:
|
|
16
16
|
|
|
@@ -35,7 +35,7 @@ A new install runs in **shadow** mode: every decision is computed and recorded,
|
|
|
35
35
|
|
|
36
36
|
## 2. Install and run
|
|
37
37
|
|
|
38
|
-
Prerequisites: macOS or
|
|
38
|
+
Prerequisites: macOS, Linux or Windows, Python 3.12 or newer, and at least one supported agent (§4); macOS and Linux also need `curl` (the hooks are `sh` + `curl`). **Windows:** everything works natively except `interlock sandbox` and `interlock judge` (use WSL2 for those). The hooks there are a Python shim (`interlockd/shims/py`, same replies as the `sh` shim, about 60 ms per call); Copilot CLI runs its Windows hooks through PowerShell, whose startup adds up to a couple of seconds per call. The background service is an entry in your user's Run key (`HKCU\Software\Microsoft\Windows\CurrentVersion\Run`, no admin rights) that starts the daemon at sign-in; unlike launchd and systemd it doesn't restart a crashed daemon, which `interlock doctor` reports. Hooks on Windows are tested by running each agent's installed hook command through `cmd.exe` / PowerShell with captured payloads in CI, not yet live with every agent on Windows. Linux: the background service is a systemd user service; `interlock sandbox` needs `bubblewrap`.
|
|
39
39
|
|
|
40
40
|
```sh
|
|
41
41
|
pipx install interlockd # or: uv tool install interlockd
|
|
@@ -47,7 +47,7 @@ interlock log -f # watch decisions live
|
|
|
47
47
|
|
|
48
48
|
- creates `~/.interlock/` with a per-install bearer token (mode 0600; hooks send it and the daemon requires it, even on loopback), the fail-mode table the hooks use when the daemon is down, and a commented starter policy in **shadow** mode;
|
|
49
49
|
- adds Interlock's hooks to every supported agent it finds: user-level for Claude Code (`~/.claude/settings.json`), Codex (`~/.codex/hooks.json`), Cursor (`~/.cursor/hooks.json`), Gemini CLI (`~/.gemini/settings.json`), GitHub Copilot CLI (`~/.copilot/hooks/interlock.json`), Windsurf (`~/.codeium/windsurf/hooks.json`), and Antigravity CLI (`~/.gemini/config/hooks.json`), and the Kiro workspace you run it from (`.kiro/hooks/interlock.json`). Your existing hooks and settings are preserved;
|
|
50
|
-
- installs and starts a background service: launchd on macOS, a systemd user unit on Linux, or a detached process elsewhere (`--backend`), logging to `~/.interlock/interlockd.log`;
|
|
50
|
+
- installs and starts a background service: launchd on macOS, a systemd user unit on Linux, the per-user Run key on Windows, or a detached process elsewhere (`--backend`), logging to `~/.interlock/interlockd.log`;
|
|
51
51
|
- shows what the gate would decide for a few sample commands, without running them.
|
|
52
52
|
|
|
53
53
|
Everything `init` changed is recorded in `~/.interlock/install-manifest.json`; `interlock uninstall` reverses exactly that (`--purge` also deletes `~/.interlock`). Options: `--harness claude-code,codex,cursor,gemini-cli,kiro` for a subset, `--enforce` to start enforcing, `--no-service` to run the daemon yourself with `interlock serve`, `--mcp` to also register the Interlock MCP server with each agent, `--gateway` to route MCP servers through the MCP gateway (§2.1).
|
|
@@ -624,8 +624,9 @@ CLI or the daemon. `interlock plugins` lists what's installed; `INTERLOCK_PLUGIN
|
|
|
624
624
|
plugin into Interlock's own environment, e.g. `pipx inject interlockd <package>`.
|
|
625
625
|
|
|
626
626
|
**Plugin API.** Besides the two hooks, a plugin should use only `interlockd.plugin_api`, the stable interface:
|
|
627
|
-
settings and the spool location, loading and
|
|
628
|
-
|
|
627
|
+
settings and the spool location, loading, validating and linting policy, tightening one policy with another and
|
|
628
|
+
composing several into one (`compose_policies`: layer an organization's baseline and group policies into one managed
|
|
629
|
+
file), the managed (tighten-only) policy file, the daemon's status, hook integrity, and audit records with tool arguments and results left out. Everything else in `interlockd`
|
|
629
630
|
is internal and can change in any release. Within one `plugin_api.API_VERSION`, names are only added; a breaking
|
|
630
631
|
change bumps the version and keeps the old behaviour, with a deprecation warning, for at least one minor release. A
|
|
631
632
|
plugin that needs a newer API sets `PLUGIN_API = <n>` in its module, and an older interlockd skips it with a message
|
|
@@ -32,7 +32,7 @@ def _pct(xs: list[float]) -> dict[str, float]:
|
|
|
32
32
|
|
|
33
33
|
def run(rounds: int = 3, http_calls: int = 300, shim_calls: int = 100) -> dict[str, dict]:
|
|
34
34
|
from .api import ApiServer
|
|
35
|
-
from .cli import CLAUDE_SHIM_SRC
|
|
35
|
+
from .cli import CLAUDE_SHIM_SRC, PY_SHIM_SRC, _hook_python, hook_runtime
|
|
36
36
|
from .config import Settings
|
|
37
37
|
from .models import AdapterInfo, Capabilities, Context, InterlockEvent, ToolCall, ToolResult
|
|
38
38
|
from .pipeline import Daemon
|
|
@@ -81,7 +81,18 @@ def run(rounds: int = 3, http_calls: int = 300, shim_calls: int = 100) -> dict[s
|
|
|
81
81
|
t0 = time.perf_counter(); urllib.request.urlopen(req, timeout=5).read(); t.append((time.perf_counter() - t0) * 1000)
|
|
82
82
|
out["http"] = _pct(t)
|
|
83
83
|
|
|
84
|
-
if
|
|
84
|
+
if hook_runtime() == "py": # the Python shim (native Windows), over TCP
|
|
85
|
+
shim = home / "shim.py"; shim.write_text(PY_SHIM_SRC.read_text(encoding="utf-8").replace("__HARNESS__", "claude-code"), encoding="utf-8")
|
|
86
|
+
env = {**os.environ, "INTERLOCK_HOME": str(home), "INTERLOCK_URL": f"http://{host}:{port}"}
|
|
87
|
+
t = []
|
|
88
|
+
for _ in range(shim_calls):
|
|
89
|
+
t0 = time.perf_counter()
|
|
90
|
+
subprocess.run([_hook_python(), "-I", "-S", str(shim)], input=json.dumps(payload), text=True, capture_output=True,
|
|
91
|
+
env=env, timeout=10, check=False)
|
|
92
|
+
t.append((time.perf_counter() - t0) * 1000)
|
|
93
|
+
if t:
|
|
94
|
+
out["shim (python)"] = _pct(t)
|
|
95
|
+
elif shutil.which("curl"):
|
|
85
96
|
shim = home / "shim.sh"; shim.write_text(CLAUDE_SHIM_SRC.read_text(encoding="utf-8").replace("__HARNESS__", "claude-code"), encoding="utf-8")
|
|
86
97
|
for label, extra in (("shim (tcp)", {"INTERLOCK_URL": f"http://{host}:{port}"}), ("shim (unix)", {})):
|
|
87
98
|
env = {**{k: v for k, v in os.environ.items() if k != "INTERLOCK_URL"}, "INTERLOCK_HOME": str(home), **extra}
|
|
@@ -150,7 +150,10 @@ def redact(obj: Any, home: str | None = None, user: str | None = None) -> Any:
|
|
|
150
150
|
user = user or getpass.getuser()
|
|
151
151
|
|
|
152
152
|
def s(x: str) -> str:
|
|
153
|
-
|
|
153
|
+
for h in dict.fromkeys((home, os.path.realpath(home))):
|
|
154
|
+
if "\\" in h: # Windows: the rest of the path in forward slashes too, like the POSIX fixtures
|
|
155
|
+
x = re.sub(re.escape(h) + r"((?:\\[^\\\"'\s]*)*)", lambda m: "/Users/dev" + m.group(1).replace("\\", "/"), x)
|
|
156
|
+
x = x.replace(h, "/Users/dev")
|
|
154
157
|
x = EMAIL.sub("dev@example.com", x)
|
|
155
158
|
return re.sub(rf"\b{re.escape(user)}\b", "dev", x) if user else x
|
|
156
159
|
|
|
@@ -24,8 +24,10 @@ from .policy import load_policy
|
|
|
24
24
|
from .store.spool import Spool
|
|
25
25
|
|
|
26
26
|
SHIMS_ROOT = Path(__file__).resolve().parent / "shims" # shipped as package data; docs live in the repo's adapters/
|
|
27
|
-
HOOK_SHIMS = {"sh": SHIMS_ROOT / "kiro" / "interlock-hook.sh", "node": SHIMS_ROOT / "kiro" / "interlock-hook.mjs"
|
|
27
|
+
HOOK_SHIMS = {"sh": SHIMS_ROOT / "kiro" / "interlock-hook.sh", "node": SHIMS_ROOT / "kiro" / "interlock-hook.mjs",
|
|
28
|
+
"py": SHIMS_ROOT / "py" / "interlock-hook.py"}
|
|
28
29
|
CLAUDE_SHIM_SRC = SHIMS_ROOT / "claude-code" / "interlock-hook.sh"
|
|
30
|
+
PY_SHIM_SRC = SHIMS_ROOT / "py" / "interlock-hook.py" # the same contract without sh + curl (native Windows)
|
|
29
31
|
CLAUDE_PRE_MATCHER = "Bash|Edit|Write|MultiEdit|NotebookEdit|WebFetch|Task|mcp__.*"
|
|
30
32
|
CLAUDE_POST_MATCHER = "Bash|Read|WebFetch|mcp__.*"
|
|
31
33
|
CODEX_PRE_MATCHER = "Bash|apply_patch|Edit|Write|mcp__.*"
|
|
@@ -212,18 +214,46 @@ def _find_kiro_root(start: Path) -> Path | None:
|
|
|
212
214
|
return None
|
|
213
215
|
|
|
214
216
|
|
|
217
|
+
def hook_runtime() -> str:
|
|
218
|
+
""""sh" (POSIX sh + curl, fastest) or "py" (the Python shim) for the hooks `init` installs: py on Windows, or
|
|
219
|
+
when INTERLOCK_HOOK_RUNTIME=py."""
|
|
220
|
+
want = os.environ.get("INTERLOCK_HOOK_RUNTIME")
|
|
221
|
+
if want in ("sh", "py"):
|
|
222
|
+
return want
|
|
223
|
+
return "py" if sys.platform == "win32" else "sh"
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def _hook_python() -> str:
|
|
227
|
+
"""The interpreter hooks run the Python shim with. It needs only the standard library, so the base interpreter
|
|
228
|
+
(not a venv's launcher, which costs a second process on Windows) is enough."""
|
|
229
|
+
return getattr(sys, "_base_executable", None) or sys.executable
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
def hook_command(shim: Path, arg: str = "") -> str:
|
|
233
|
+
"""The command line an agent config runs for `shim` (plus "pre"/"post" where the payload doesn't say)."""
|
|
234
|
+
tail = f" {arg}" if arg else ""
|
|
235
|
+
if shim.suffix == ".py":
|
|
236
|
+
return f'"{_hook_python()}" -I -S "{shim}"{tail}'
|
|
237
|
+
if shim.suffix == ".mjs":
|
|
238
|
+
return f"{shutil.which('node') or 'node'} {shim}{tail}"
|
|
239
|
+
return f"sh {shim}{tail}"
|
|
240
|
+
|
|
241
|
+
|
|
215
242
|
def _install_shared_shim(s: Settings, harness: str) -> Path:
|
|
216
|
-
"""Copy the Claude-compatible shim with HARNESS baked in; returns
|
|
243
|
+
"""Copy the Claude-compatible shim (sh, or the Python one, see hook_runtime) with HARNESS baked in; returns its
|
|
244
|
+
installed path."""
|
|
217
245
|
shim_dir = s.home / "adapters" / harness
|
|
218
246
|
shim_dir.mkdir(parents=True, exist_ok=True)
|
|
219
|
-
|
|
220
|
-
shim
|
|
247
|
+
py = hook_runtime() == "py"
|
|
248
|
+
shim = shim_dir / ("interlock-hook.py" if py else "interlock-hook.sh")
|
|
249
|
+
src = PY_SHIM_SRC if py else CLAUDE_SHIM_SRC
|
|
250
|
+
shim.write_text(src.read_text(encoding="utf-8").replace("__HARNESS__", harness), encoding="utf-8")
|
|
221
251
|
shim.chmod(0o755)
|
|
222
252
|
return shim
|
|
223
253
|
|
|
224
254
|
|
|
225
255
|
def _hook_groups(shim: Path, pre_matcher: str, post_matcher: str, *, status: bool = False) -> dict:
|
|
226
|
-
handler = {"type": "command", "command":
|
|
256
|
+
handler = {"type": "command", "command": hook_command(shim), "timeout": 5}
|
|
227
257
|
if status:
|
|
228
258
|
handler["statusMessage"] = "Interlock"
|
|
229
259
|
return {
|
|
@@ -234,9 +264,11 @@ def _hook_groups(shim: Path, pre_matcher: str, post_matcher: str, *, status: boo
|
|
|
234
264
|
|
|
235
265
|
def _merge_hook_groups(existing: dict, ours: dict, marker: str) -> dict:
|
|
236
266
|
"""Replace any previous Interlock groups (identified by the shim path marker) and append ours."""
|
|
267
|
+
from .onboard import mentions
|
|
268
|
+
|
|
237
269
|
hooks = dict(existing.get("hooks") or {})
|
|
238
270
|
for event, groups in ours.items():
|
|
239
|
-
kept = [g for g in (hooks.get(event) or []) if
|
|
271
|
+
kept = [g for g in (hooks.get(event) or []) if not mentions(json.dumps(g), marker)]
|
|
240
272
|
hooks[event] = kept + groups
|
|
241
273
|
return {**existing, "hooks": hooks}
|
|
242
274
|
|
|
@@ -260,23 +292,22 @@ def _write_codex_hooks(s: Settings, target: Path) -> Path:
|
|
|
260
292
|
return shim
|
|
261
293
|
|
|
262
294
|
|
|
263
|
-
def _write_kiro_hooks(s: Settings, root: Path, runtime: str =
|
|
295
|
+
def _write_kiro_hooks(s: Settings, root: Path, runtime: str | None = None, custom_shim: str | None = None) -> tuple[Path, Path]:
|
|
264
296
|
shim_dir = s.home / "adapters" / "kiro"
|
|
265
297
|
shim_dir.mkdir(parents=True, exist_ok=True)
|
|
266
|
-
src = Path(custom_shim).resolve() if custom_shim else HOOK_SHIMS[runtime]
|
|
298
|
+
src = Path(custom_shim).resolve() if custom_shim else HOOK_SHIMS[runtime or hook_runtime()]
|
|
267
299
|
shim = shim_dir / src.name
|
|
268
|
-
|
|
300
|
+
shim.write_text(src.read_text(encoding="utf-8").replace("__HARNESS__", "kiro"), encoding="utf-8")
|
|
269
301
|
shim.chmod(0o755)
|
|
270
|
-
runner = (shutil.which("node") or "node") if shim.suffix == ".mjs" else "sh"
|
|
271
302
|
hook = {
|
|
272
303
|
"version": "v1",
|
|
273
304
|
"hooks": [
|
|
274
305
|
{"name": "interlock-pre", "description": "Interlock pre-action gate",
|
|
275
306
|
"trigger": "PreToolUse", "matcher": ".*",
|
|
276
|
-
"action": {"type": "command", "command":
|
|
307
|
+
"action": {"type": "command", "command": hook_command(shim)}, "timeout": 3},
|
|
277
308
|
{"name": "interlock-post", "description": "Interlock post-action probe (record-only on Kiro)",
|
|
278
309
|
"trigger": "PostToolUse", "matcher": ".*",
|
|
279
|
-
"action": {"type": "command", "command":
|
|
310
|
+
"action": {"type": "command", "command": hook_command(shim)}, "timeout": 3},
|
|
280
311
|
],
|
|
281
312
|
}
|
|
282
313
|
hooks_dir = root / ".kiro" / "hooks"
|
|
@@ -291,7 +322,7 @@ def _write_cursor_hooks(s: Settings, target: Path) -> Path:
|
|
|
291
322
|
shim = _install_shared_shim(s, "cursor")
|
|
292
323
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
293
324
|
existing = json.loads(target.read_text(encoding="utf-8")) if target.exists() and target.read_text(encoding="utf-8").strip() else {}
|
|
294
|
-
entry = {"command":
|
|
325
|
+
entry = {"command": hook_command(shim), "type": "command", "timeout": 5, "matcher": "*"}
|
|
295
326
|
merged = _merge_hook_groups(existing, {"preToolUse": [dict(entry)], "postToolUse": [dict(entry)]}, str(shim))
|
|
296
327
|
merged.setdefault("version", 1)
|
|
297
328
|
target.write_text(json.dumps(merged, indent=2) + "\n", encoding="utf-8")
|
|
@@ -303,7 +334,7 @@ def _write_gemini_hooks(s: Settings, target: Path) -> Path:
|
|
|
303
334
|
shim = _install_shared_shim(s, "gemini-cli")
|
|
304
335
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
305
336
|
existing = json.loads(target.read_text(encoding="utf-8")) if target.exists() and target.read_text(encoding="utf-8").strip() else {}
|
|
306
|
-
handler = {"name": "interlock", "type": "command", "command":
|
|
337
|
+
handler = {"name": "interlock", "type": "command", "command": hook_command(shim), "timeout": 5000,
|
|
307
338
|
"description": "Interlock pre/post-action gate"}
|
|
308
339
|
merged = _merge_hook_groups(existing, {"BeforeTool": [{"matcher": ".*", "hooks": [dict(handler)]}],
|
|
309
340
|
"AfterTool": [{"matcher": ".*", "hooks": [dict(handler)]}]}, str(shim))
|
|
@@ -311,14 +342,21 @@ def _write_gemini_hooks(s: Settings, target: Path) -> Path:
|
|
|
311
342
|
return shim
|
|
312
343
|
|
|
313
344
|
|
|
345
|
+
def _copilot_cmd(shim: Path, arg: str) -> dict:
|
|
346
|
+
"""Copilot CLI hook entries name the shell that runs them: "powershell" on Windows, "bash" elsewhere."""
|
|
347
|
+
if sys.platform == "win32":
|
|
348
|
+
return {"powershell": "& " + hook_command(shim, arg)}
|
|
349
|
+
return {"bash": hook_command(shim, arg)}
|
|
350
|
+
|
|
351
|
+
|
|
314
352
|
def _write_copilot_hooks(s: Settings, target: Path) -> Path:
|
|
315
353
|
"""~/.copilot/hooks/interlock.json (docs.github.com/en/copilot/reference/hooks-configuration)."""
|
|
316
354
|
shim = _install_shared_shim(s, "copilot-cli")
|
|
317
355
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
318
356
|
existing = json.loads(target.read_text(encoding="utf-8")) if target.exists() and target.read_text(encoding="utf-8").strip() else {}
|
|
319
357
|
merged = _merge_hook_groups(existing, {
|
|
320
|
-
"preToolUse": [{"type": "command",
|
|
321
|
-
"postToolUse": [{"type": "command",
|
|
358
|
+
"preToolUse": [{"type": "command", **_copilot_cmd(shim, "pre"), "timeoutSec": 5}],
|
|
359
|
+
"postToolUse": [{"type": "command", **_copilot_cmd(shim, "post"), "timeoutSec": 5}]}, str(shim))
|
|
322
360
|
merged.setdefault("version", 1)
|
|
323
361
|
target.write_text(json.dumps(merged, indent=2) + "\n", encoding="utf-8")
|
|
324
362
|
return shim
|
|
@@ -329,7 +367,7 @@ def _write_windsurf_hooks(s: Settings, target: Path) -> Path:
|
|
|
329
367
|
shim = _install_shared_shim(s, "windsurf")
|
|
330
368
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
331
369
|
existing = json.loads(target.read_text(encoding="utf-8")) if target.exists() and target.read_text(encoding="utf-8").strip() else {}
|
|
332
|
-
entry = {"command":
|
|
370
|
+
entry = {"command": hook_command(shim, "pre"), "show_output": True}
|
|
333
371
|
merged = _merge_hook_groups(existing, {e: [dict(entry)] for e in
|
|
334
372
|
("pre_run_command", "pre_mcp_tool_use", "pre_read_code", "pre_write_code")}, str(shim))
|
|
335
373
|
target.write_text(json.dumps(merged, indent=2) + "\n", encoding="utf-8")
|
|
@@ -342,8 +380,8 @@ def _write_antigravity_hooks(s: Settings, target: Path) -> Path:
|
|
|
342
380
|
target.parent.mkdir(parents=True, exist_ok=True)
|
|
343
381
|
data = json.loads(target.read_text(encoding="utf-8")) if target.exists() and target.read_text(encoding="utf-8").strip() else {}
|
|
344
382
|
data["interlock"] = {"enabled": True,
|
|
345
|
-
"PreToolUse": [{"matcher": "*", "hooks": [{"type": "command", "command":
|
|
346
|
-
"PostToolUse": [{"matcher": "*", "hooks": [{"type": "command", "command":
|
|
383
|
+
"PreToolUse": [{"matcher": "*", "hooks": [{"type": "command", "command": hook_command(shim, "pre"), "timeout": 10}]}],
|
|
384
|
+
"PostToolUse": [{"matcher": "*", "hooks": [{"type": "command", "command": hook_command(shim, "post"), "timeout": 10}]}]}
|
|
347
385
|
target.write_text(json.dumps(data, indent=2) + "\n", encoding="utf-8")
|
|
348
386
|
return shim
|
|
349
387
|
|
|
@@ -1311,7 +1349,7 @@ def cmd_init(args) -> int:
|
|
|
1311
1349
|
|
|
1312
1350
|
|
|
1313
1351
|
def cmd_uninstall(args) -> int:
|
|
1314
|
-
from .onboard import Manifest, confirm, remove_hook_groups
|
|
1352
|
+
from .onboard import Manifest, confirm, mentions, remove_hook_groups
|
|
1315
1353
|
|
|
1316
1354
|
s = _settings(args)
|
|
1317
1355
|
man = Manifest.load(s.home)
|
|
@@ -1327,7 +1365,7 @@ def cmd_uninstall(args) -> int:
|
|
|
1327
1365
|
for h in hooks:
|
|
1328
1366
|
f = Path(h["file"])
|
|
1329
1367
|
if h["harness"] in ("kiro", "opencode"):
|
|
1330
|
-
if f.exists() and (
|
|
1368
|
+
if f.exists() and (mentions(f.read_text(encoding="utf-8"), h["marker"]) or h["harness"] == "opencode"):
|
|
1331
1369
|
f.unlink()
|
|
1332
1370
|
print(f"removed {f}")
|
|
1333
1371
|
elif h["harness"] == "antigravity":
|
|
@@ -1897,14 +1935,12 @@ def cmd_bench(args) -> int:
|
|
|
1897
1935
|
return 0
|
|
1898
1936
|
|
|
1899
1937
|
|
|
1900
|
-
# Native Windows runs
|
|
1901
|
-
#
|
|
1902
|
-
WINDOWS_UNSUPPORTED = {"
|
|
1938
|
+
# Native Windows runs everything except the OS sandbox and the local judge (macOS/Linux; on Windows, inside WSL2).
|
|
1939
|
+
# Agent hooks there use the Python shim (shims/py), installed by `init` as any other.
|
|
1940
|
+
WINDOWS_UNSUPPORTED = {"sandbox", "judge"}
|
|
1903
1941
|
WINDOWS_MESSAGE = (
|
|
1904
|
-
"`interlock {cmd}` isn't available on native Windows
|
|
1905
|
-
"
|
|
1906
|
-
"`pipx install interlockd && interlock init`. Natively, `interlock start` runs the daemon for the Python and\n"
|
|
1907
|
-
"JavaScript SDKs.")
|
|
1942
|
+
"`interlock {cmd}` isn't available on native Windows: the OS sandbox and the local judge need macOS or Linux.\n"
|
|
1943
|
+
"On Windows, use them inside WSL2 (Ubuntu), with your agents run from the WSL terminal.")
|
|
1908
1944
|
|
|
1909
1945
|
|
|
1910
1946
|
def main(argv: list[str] | None = None) -> int:
|
|
@@ -1924,14 +1960,14 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
1924
1960
|
p.add_argument("--no-service", action="store_true", help="don't install a background service")
|
|
1925
1961
|
p.add_argument("--mcp", action="store_true", help="also register the Interlock MCP server (advisory tools) with each agent")
|
|
1926
1962
|
p.add_argument("--gateway", action="store_true", help="also route your stdio MCP servers through the Interlock MCP gateway")
|
|
1927
|
-
p.add_argument("--backend", choices=["launchd", "systemd", "process"], help="service backend (default: detected)")
|
|
1963
|
+
p.add_argument("--backend", choices=["launchd", "systemd", "winrun", "process"], help="service backend (default: detected)")
|
|
1928
1964
|
p.set_defaults(fn=cmd_init)
|
|
1929
1965
|
p = sub.add_parser("uninstall", help="remove Interlock's hooks and background service")
|
|
1930
1966
|
p.add_argument("-y", "--yes", action="store_true"); p.add_argument("--purge", action="store_true", help="also delete the Interlock home")
|
|
1931
1967
|
p.set_defaults(fn=cmd_uninstall)
|
|
1932
1968
|
for name, help_ in (("start", "start the background daemon"), ("stop", "stop the background daemon"),
|
|
1933
1969
|
("restart", "restart the background daemon"), ("status", "daemon, service, mode, and hooks")):
|
|
1934
|
-
p = sub.add_parser(name, help=help_); p.add_argument("--backend", choices=["launchd", "systemd", "process"])
|
|
1970
|
+
p = sub.add_parser(name, help=help_); p.add_argument("--backend", choices=["launchd", "systemd", "winrun", "process"])
|
|
1935
1971
|
p.set_defaults(fn=cmd_service)
|
|
1936
1972
|
for name, help_ in (("enforce", "switch to enforce mode (block closed categories, ask on the rest)"),
|
|
1937
1973
|
("shadow", "switch to shadow mode (record decisions, never block)")):
|
|
@@ -2048,7 +2084,8 @@ def main(argv: list[str] | None = None) -> int:
|
|
|
2048
2084
|
p.add_argument("--project", help="project root for Claude Code / Codex hooks (default: cwd)")
|
|
2049
2085
|
p.add_argument("--user", action="store_true", help="install Claude Code / Codex hooks at the user level instead")
|
|
2050
2086
|
p.add_argument("--workspace-root"); p.add_argument("--shim", help="path to a custom shim")
|
|
2051
|
-
p.add_argument("--runtime", choices=["sh", "node"
|
|
2087
|
+
p.add_argument("--runtime", choices=["sh", "node", "py"], default=None,
|
|
2088
|
+
help="shim runtime (default: sh on macOS/Linux, ~70 ms faster per call than node; py on Windows)")
|
|
2052
2089
|
p.set_defaults(fn=cmd_install)
|
|
2053
2090
|
|
|
2054
2091
|
p = sub.add_parser("test", help="run the deterministic corpus and report FPR/FNR (CI gate)")
|
|
@@ -174,13 +174,17 @@ def _health(listen: str) -> dict[str, Any] | None:
|
|
|
174
174
|
return None
|
|
175
175
|
|
|
176
176
|
|
|
177
|
-
def expected_shim(harness: str) -> str | None:
|
|
178
|
-
|
|
177
|
+
def expected_shim(harness: str, shim: Path | None = None) -> str | None:
|
|
178
|
+
"""This version's shim for `harness`, in the runtime of the installed `shim` (its suffix: .sh, .py, .mjs)."""
|
|
179
|
+
from .cli import CLAUDE_SHIM_SRC, HOOK_SHIMS, PY_SHIM_SRC
|
|
179
180
|
|
|
181
|
+
suffix = shim.suffix if shim is not None else ".sh"
|
|
182
|
+
if suffix == ".py" and harness != "opencode":
|
|
183
|
+
return PY_SHIM_SRC.read_text(encoding="utf-8").replace("__HARNESS__", harness)
|
|
180
184
|
if harness in ("claude-code", "codex", "cursor", "gemini-cli", "copilot-cli", "windsurf", "antigravity"):
|
|
181
185
|
return CLAUDE_SHIM_SRC.read_text(encoding="utf-8").replace("__HARNESS__", harness)
|
|
182
186
|
if harness == "kiro":
|
|
183
|
-
return HOOK_SHIMS["sh"].read_text(encoding="utf-8")
|
|
187
|
+
return HOOK_SHIMS["node" if suffix == ".mjs" else "sh"].read_text(encoding="utf-8")
|
|
184
188
|
if harness == "opencode":
|
|
185
189
|
from . import __version__
|
|
186
190
|
from .cli import OPENCODE_PLUGIN_SRC
|
|
@@ -192,7 +196,7 @@ def expected_shim(harness: str) -> str | None:
|
|
|
192
196
|
def hook_integrity(home: Path) -> list[dict[str, str]]:
|
|
193
197
|
"""For each hook `interlock init` installed: {harness, file, problem, detail}, where problem is "" (intact),
|
|
194
198
|
"hook_removed" (the agent's hook file no longer runs Interlock), "shim_missing", or "shim_modified"."""
|
|
195
|
-
from .onboard import Manifest
|
|
199
|
+
from .onboard import Manifest, mentions
|
|
196
200
|
|
|
197
201
|
man = Manifest.load(home)
|
|
198
202
|
out = []
|
|
@@ -203,7 +207,7 @@ def hook_integrity(home: Path) -> list[dict[str, str]]:
|
|
|
203
207
|
text = f.read_text(encoding="utf-8", errors="replace") if f.exists() else ""
|
|
204
208
|
except OSError:
|
|
205
209
|
text = ""
|
|
206
|
-
if hk["marker"]
|
|
210
|
+
if not mentions(text, hk["marker"]):
|
|
207
211
|
row.update(problem="hook_removed", detail=f"Interlock hook missing from {f} (removed or edited)")
|
|
208
212
|
elif state := shim_state(shim, hk["harness"]):
|
|
209
213
|
row.update(problem=state, detail=SHIM_DETAIL[state].format(shim=shim))
|
|
@@ -220,7 +224,7 @@ def shim_state(shim: Path, harness: str) -> str:
|
|
|
220
224
|
shim_modified."""
|
|
221
225
|
if not shim.exists():
|
|
222
226
|
return "shim_missing"
|
|
223
|
-
want = expected_shim(harness)
|
|
227
|
+
want = expected_shim(harness, shim)
|
|
224
228
|
have = shim.read_text(encoding="utf-8", errors="replace")
|
|
225
229
|
if want is None or have == want:
|
|
226
230
|
return ""
|
|
@@ -239,7 +243,7 @@ def refresh_outdated_shims(home: Path) -> list[str]:
|
|
|
239
243
|
|
|
240
244
|
man = Manifest.load(home)
|
|
241
245
|
for hk in (man.hooks if man else []):
|
|
242
|
-
if hk["harness"] == h["harness"] and (want := expected_shim(h["harness"])) is not None:
|
|
246
|
+
if hk["harness"] == h["harness"] and (want := expected_shim(h["harness"], Path(hk["marker"]))) is not None:
|
|
243
247
|
Path(hk["marker"]).write_text(want, encoding="utf-8")
|
|
244
248
|
done.append(hk["marker"])
|
|
245
249
|
return done
|
|
@@ -20,6 +20,7 @@ from __future__ import annotations
|
|
|
20
20
|
import hashlib
|
|
21
21
|
import json
|
|
22
22
|
import os
|
|
23
|
+
import shutil
|
|
23
24
|
import subprocess
|
|
24
25
|
import sys
|
|
25
26
|
import threading
|
|
@@ -263,8 +264,11 @@ class Proxy:
|
|
|
263
264
|
|
|
264
265
|
# ---- run
|
|
265
266
|
def run(self) -> int:
|
|
267
|
+
cmd = list(self.command)
|
|
268
|
+
if sys.platform == "win32" and cmd: # "npx" is npx.cmd there: CreateProcess needs the full name
|
|
269
|
+
cmd[0] = shutil.which(cmd[0]) or cmd[0]
|
|
266
270
|
try:
|
|
267
|
-
proc = subprocess.Popen(
|
|
271
|
+
proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None,
|
|
268
272
|
text=True, bufsize=1)
|
|
269
273
|
except OSError as e:
|
|
270
274
|
self.log(f"could not start server {self.command[0]!r}: {e}")
|
|
@@ -137,6 +137,12 @@ def detect(cwd: Path | None = None) -> list[Detected]:
|
|
|
137
137
|
# ------------------------------------------------------------------------------------------------ hook removal
|
|
138
138
|
|
|
139
139
|
|
|
140
|
+
def mentions(text: str, marker: str) -> bool:
|
|
141
|
+
"""True when `text` (a config file, or a hook group's JSON) refers to `marker` (an installed shim path), written
|
|
142
|
+
plainly or JSON-escaped (Windows paths: each backslash appears doubled)."""
|
|
143
|
+
return marker in text or json.dumps(marker)[1:-1] in text
|
|
144
|
+
|
|
145
|
+
|
|
140
146
|
def remove_hook_groups(path: Path, marker: str) -> bool:
|
|
141
147
|
"""Drop every hook group whose JSON mentions `marker` (the installed shim path). Returns True if changed."""
|
|
142
148
|
if not path.exists() or not path.read_text(encoding="utf-8").strip():
|
|
@@ -148,7 +154,7 @@ def remove_hook_groups(path: Path, marker: str) -> bool:
|
|
|
148
154
|
changed = False
|
|
149
155
|
for event in list(hooks):
|
|
150
156
|
groups = hooks[event] or []
|
|
151
|
-
kept = [g for g in groups if
|
|
157
|
+
kept = [g for g in groups if not mentions(json.dumps(g), marker)]
|
|
152
158
|
if len(kept) != len(groups):
|
|
153
159
|
changed = True
|
|
154
160
|
if kept:
|