interlockd 0.1.6__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.
Files changed (274) hide show
  1. {interlockd-0.1.6 → interlockd-0.1.7}/CHANGELOG.md +4 -0
  2. {interlockd-0.1.6 → interlockd-0.1.7}/PKG-INFO +2 -2
  3. {interlockd-0.1.6 → interlockd-0.1.7}/README.md +1 -1
  4. {interlockd-0.1.6 → interlockd-0.1.7}/docs/USER-GUIDE.md +3 -2
  5. {interlockd-0.1.6 → interlockd-0.1.7}/examples/github-workflow.yml +1 -1
  6. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/__init__.py +1 -1
  7. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/plugin_api.py +35 -3
  8. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/policy/workspace.py +143 -0
  9. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/shims/claude-code/interlock-hook.sh +1 -1
  10. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/shims/kiro/interlock-hook.mjs +1 -1
  11. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/shims/kiro/interlock-hook.sh +1 -1
  12. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/shims/py/interlock-hook.py +1 -1
  13. {interlockd-0.1.6 → interlockd-0.1.7}/pyproject.toml +1 -1
  14. {interlockd-0.1.6 → interlockd-0.1.7}/sdk/js/package.json +1 -1
  15. {interlockd-0.1.6 → interlockd-0.1.7}/sdk/js/src/index.js +1 -1
  16. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_plugin_api.py +17 -2
  17. interlockd-0.1.7/tests/test_policy_compose.py +149 -0
  18. {interlockd-0.1.6 → interlockd-0.1.7}/.github/CODEOWNERS +0 -0
  19. {interlockd-0.1.6 → interlockd-0.1.7}/.github/ISSUE_TEMPLATE/agent.yml +0 -0
  20. {interlockd-0.1.6 → interlockd-0.1.7}/.github/ISSUE_TEMPLATE/bug.yml +0 -0
  21. {interlockd-0.1.6 → interlockd-0.1.7}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  22. {interlockd-0.1.6 → interlockd-0.1.7}/.github/ISSUE_TEMPLATE/decision.yml +0 -0
  23. {interlockd-0.1.6 → interlockd-0.1.7}/.github/dependabot.yml +0 -0
  24. {interlockd-0.1.6 → interlockd-0.1.7}/.github/pull_request_template.md +0 -0
  25. {interlockd-0.1.6 → interlockd-0.1.7}/.github/workflows/ci.yml +0 -0
  26. {interlockd-0.1.6 → interlockd-0.1.7}/.github/workflows/release.yml +0 -0
  27. {interlockd-0.1.6 → interlockd-0.1.7}/.gitignore +0 -0
  28. {interlockd-0.1.6 → interlockd-0.1.7}/CLAUDE.md +0 -0
  29. {interlockd-0.1.6 → interlockd-0.1.7}/CODE_OF_CONDUCT.md +0 -0
  30. {interlockd-0.1.6 → interlockd-0.1.7}/CONTRIBUTING.md +0 -0
  31. {interlockd-0.1.6 → interlockd-0.1.7}/LICENSE +0 -0
  32. {interlockd-0.1.6 → interlockd-0.1.7}/NOTICE +0 -0
  33. {interlockd-0.1.6 → interlockd-0.1.7}/SECURITY.md +0 -0
  34. {interlockd-0.1.6 → interlockd-0.1.7}/action.yml +0 -0
  35. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/README.md +0 -0
  36. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/antigravity/PAYLOADS.md +0 -0
  37. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/claude-code/PAYLOADS.md +0 -0
  38. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/claude-code/README.md +0 -0
  39. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/codex/PAYLOADS.md +0 -0
  40. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/codex/README.md +0 -0
  41. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/copilot-cli/PAYLOADS.md +0 -0
  42. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/cursor/PAYLOADS.md +0 -0
  43. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/gemini-cli/PAYLOADS.md +0 -0
  44. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/kiro/PAYLOADS.md +0 -0
  45. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/opencode/PAYLOADS.md +0 -0
  46. {interlockd-0.1.6 → interlockd-0.1.7}/adapters/windsurf/PAYLOADS.md +0 -0
  47. {interlockd-0.1.6 → interlockd-0.1.7}/benchmarks/agentdojo_template.py +0 -0
  48. {interlockd-0.1.6 → interlockd-0.1.7}/benchmarks/injecagent.py +0 -0
  49. {interlockd-0.1.6 → interlockd-0.1.7}/benchmarks/nl2bash.py +0 -0
  50. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/README.md +0 -0
  51. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/_corpus.yaml +0 -0
  52. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/archetypes/_corpus.yaml +0 -0
  53. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/archetypes/exfil_and_secrets.jsonl +0 -0
  54. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/archetypes/git_and_history.jsonl +0 -0
  55. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/archetypes/injection_persistence_supplychain.jsonl +0 -0
  56. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/archetypes/judge_confirmation.jsonl +0 -0
  57. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/archetypes/judge_exfil.jsonl +0 -0
  58. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/archetypes/judge_injection.jsonl +0 -0
  59. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/archetypes/judge_intent.jsonl +0 -0
  60. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/archetypes/slow_hijack.jsonl +0 -0
  61. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/external/README.md +0 -0
  62. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/external/samples/agentdojo.sample.json +0 -0
  63. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/external/samples/agentdrift.sample.json +0 -0
  64. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/external/samples/injecagent.sample.json +0 -0
  65. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/ogr-seed-v0/README.md +0 -0
  66. {interlockd-0.1.6 → interlockd-0.1.7}/corpus/ogr-seed-v0/seed-v0.jsonl +0 -0
  67. {interlockd-0.1.6 → interlockd-0.1.7}/demo/demo.sh +0 -0
  68. {interlockd-0.1.6 → interlockd-0.1.7}/demo/demo.tape +0 -0
  69. {interlockd-0.1.6 → interlockd-0.1.7}/docs/ADAPTERS.md +0 -0
  70. {interlockd-0.1.6 → interlockd-0.1.7}/docs/BENCHMARKS.md +0 -0
  71. {interlockd-0.1.6 → interlockd-0.1.7}/docs/GETTING-STARTED.md +0 -0
  72. {interlockd-0.1.6 → interlockd-0.1.7}/docs/PERFORMANCE.md +0 -0
  73. {interlockd-0.1.6 → interlockd-0.1.7}/docs/THREAT-MODEL.md +0 -0
  74. {interlockd-0.1.6 → interlockd-0.1.7}/docs/mandate-example.cedar +0 -0
  75. {interlockd-0.1.6 → interlockd-0.1.7}/docs/policy-example.yaml +0 -0
  76. {interlockd-0.1.6 → interlockd-0.1.7}/docs/reports/M3-judge-calibration.md +0 -0
  77. {interlockd-0.1.6 → interlockd-0.1.7}/docs/reports/ogr-seed-v0-results.jsonl +0 -0
  78. {interlockd-0.1.6 → interlockd-0.1.7}/docs/reports/ogr-seed-v0-results.md +0 -0
  79. {interlockd-0.1.6 → interlockd-0.1.7}/examples/agents/README.md +0 -0
  80. {interlockd-0.1.6 → interlockd-0.1.7}/examples/agents/claude_agent_sdk_agent.py +0 -0
  81. {interlockd-0.1.6 → interlockd-0.1.7}/examples/agents/crewai_crew.py +0 -0
  82. {interlockd-0.1.6 → interlockd-0.1.7}/examples/agents/google_adk_agent.py +0 -0
  83. {interlockd-0.1.6 → interlockd-0.1.7}/examples/agents/langgraph_agent.py +0 -0
  84. {interlockd-0.1.6 → interlockd-0.1.7}/examples/agents/openai_agents.py +0 -0
  85. {interlockd-0.1.6 → interlockd-0.1.7}/examples/agents/semantic_kernel_agent.py +0 -0
  86. {interlockd-0.1.6 → interlockd-0.1.7}/examples/agents/strands_agent.py +0 -0
  87. {interlockd-0.1.6 → interlockd-0.1.7}/examples/aws/interlock-audit.yaml +0 -0
  88. {interlockd-0.1.6 → interlockd-0.1.7}/examples/policies/ci.yaml +0 -0
  89. {interlockd-0.1.6 → interlockd-0.1.7}/examples/policies/mcp-locked-down.yaml +0 -0
  90. {interlockd-0.1.6 → interlockd-0.1.7}/examples/policies/strict-team.yaml +0 -0
  91. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/__main__.py +0 -0
  92. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/aibom.py +0 -0
  93. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/api.py +0 -0
  94. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/auth.py +0 -0
  95. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/bench.py +0 -0
  96. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/calibration.py +0 -0
  97. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/capture.py +0 -0
  98. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/cli.py +0 -0
  99. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/compose.py +0 -0
  100. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/config.py +0 -0
  101. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/control.py +0 -0
  102. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/corpus.py +0 -0
  103. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/data/packs/_corpus.yaml +0 -0
  104. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/data/packs/egress.jsonl +0 -0
  105. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/data/packs/fileops.jsonl +0 -0
  106. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/data/packs/git.jsonl +0 -0
  107. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/data/packs/packages.jsonl +0 -0
  108. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/data/packs/persistence.jsonl +0 -0
  109. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/data/packs/secrets.jsonl +0 -0
  110. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/data/packs/shell.jsonl +0 -0
  111. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/__init__.py +0 -0
  112. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/describe.py +0 -0
  113. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/engine.py +0 -0
  114. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/flow.py +0 -0
  115. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/mandate.py +0 -0
  116. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/mcp.py +0 -0
  117. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/memory.py +0 -0
  118. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/oauth.py +0 -0
  119. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/packs.py +0 -0
  120. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/det/shellparse.py +0 -0
  121. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/egress.py +0 -0
  122. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/gateway.py +0 -0
  123. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/ids.py +0 -0
  124. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/insights.py +0 -0
  125. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/integrations/__init__.py +0 -0
  126. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/integrations/claude_agent_sdk.py +0 -0
  127. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/integrations/client.py +0 -0
  128. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/integrations/crewai.py +0 -0
  129. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/integrations/google_adk.py +0 -0
  130. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/integrations/langchain.py +0 -0
  131. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/integrations/openai_agents.py +0 -0
  132. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/integrations/semantic_kernel.py +0 -0
  133. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/integrations/strands.py +0 -0
  134. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/judge_setup.py +0 -0
  135. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/judges/__init__.py +0 -0
  136. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/judges/guardrails.py +0 -0
  137. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/judges/local_probe.py +0 -0
  138. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/judges/projector.py +0 -0
  139. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/judges/strands_decider.py +0 -0
  140. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/ledger.py +0 -0
  141. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/mcp_http.py +0 -0
  142. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/mcp_proxy.py +0 -0
  143. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/mcp_server.py +0 -0
  144. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/models.py +0 -0
  145. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/normalize/__init__.py +0 -0
  146. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/normalize/claude_code.py +0 -0
  147. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/normalize/cursor.py +0 -0
  148. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/normalize/gemini_cli.py +0 -0
  149. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/normalize/kiro.py +0 -0
  150. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/normalize/more.py +0 -0
  151. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/ogr.py +0 -0
  152. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/onboard.py +0 -0
  153. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/otel.py +0 -0
  154. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/paths.py +0 -0
  155. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/pipeline.py +0 -0
  156. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/plugins.py +0 -0
  157. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/policy/__init__.py +0 -0
  158. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/policy/managed.py +0 -0
  159. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/policy_lint.py +0 -0
  160. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/render.py +0 -0
  161. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/sandbox.py +0 -0
  162. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/scan.py +0 -0
  163. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/schema/verdict.schema.json +0 -0
  164. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/selftest.py +0 -0
  165. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/service.py +0 -0
  166. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/shims/opencode/interlock.js +0 -0
  167. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/store/__init__.py +0 -0
  168. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/store/drainer.py +0 -0
  169. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/store/dynamodb.py +0 -0
  170. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/store/memory.py +0 -0
  171. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/store/spool.py +0 -0
  172. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/testkit.py +0 -0
  173. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/tiers.py +0 -0
  174. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/transcript/__init__.py +0 -0
  175. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/transcript/claude_code.py +0 -0
  176. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/transcript/kiro.py +0 -0
  177. {interlockd-0.1.6 → interlockd-0.1.7}/interlockd/watch.py +0 -0
  178. {interlockd-0.1.6 → interlockd-0.1.7}/packaging/homebrew/Formula/interlock.rb +0 -0
  179. {interlockd-0.1.6 → interlockd-0.1.7}/packaging/homebrew/README.md +0 -0
  180. {interlockd-0.1.6 → interlockd-0.1.7}/packaging/homebrew/make_formula.py +0 -0
  181. {interlockd-0.1.6 → interlockd-0.1.7}/scripts/check-hygiene.sh +0 -0
  182. {interlockd-0.1.6 → interlockd-0.1.7}/scripts/e2e-hooks.py +0 -0
  183. {interlockd-0.1.6 → interlockd-0.1.7}/sdk/js/README.md +0 -0
  184. {interlockd-0.1.6 → interlockd-0.1.7}/sdk/js/src/index.d.ts +0 -0
  185. {interlockd-0.1.6 → interlockd-0.1.7}/tests/conftest.py +0 -0
  186. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fake_mcp_server.py +0 -0
  187. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/claude-code/post-bash-inject.json +0 -0
  188. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/claude-code/post-read-inject.json +0 -0
  189. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/claude-code/pre-bash-block.json +0 -0
  190. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/claude-code/pre-bash-inject.json +0 -0
  191. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/codex/post-bash-benign.json +0 -0
  192. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/codex/post-bash-inject.json +0 -0
  193. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/codex/pre-bash-benign.json +0 -0
  194. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/codex/pre-bash-block.json +0 -0
  195. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/copilot-cli/post-bash-inject.json +0 -0
  196. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/copilot-cli/pre-bash-benign.json +0 -0
  197. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/copilot-cli/pre-bash-block.json +0 -0
  198. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/cursor/post-read-benign.json +0 -0
  199. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/cursor/post-shell-benign.json +0 -0
  200. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/cursor/pre-read-benign.json +0 -0
  201. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/cursor/pre-shell-benign.json +0 -0
  202. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/cursor/pre-shell-block.json +0 -0
  203. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/gemini-cli/post-read-benign.json +0 -0
  204. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/gemini-cli/post-read-inject.json +0 -0
  205. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/gemini-cli/post-shell-benign.json +0 -0
  206. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/gemini-cli/post-shell-rot13-inject.json +0 -0
  207. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/gemini-cli/pre-read-benign.json +0 -0
  208. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/gemini-cli/pre-shell-benign.json +0 -0
  209. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/gemini-cli/pre-shell-block.json +0 -0
  210. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/windsurf/post-shell-benign.json +0 -0
  211. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/windsurf/pre-shell-benign.json +0 -0
  212. {interlockd-0.1.6 → interlockd-0.1.7}/tests/fixtures/windsurf/pre-shell-block.json +0 -0
  213. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_aibom.py +0 -0
  214. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_api.py +0 -0
  215. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_audit_chain.py +0 -0
  216. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_bench.py +0 -0
  217. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_calibration.py +0 -0
  218. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_capture.py +0 -0
  219. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_claude_agent_sdk.py +0 -0
  220. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_claude_code.py +0 -0
  221. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_control.py +0 -0
  222. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_corpus.py +0 -0
  223. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_crewai.py +0 -0
  224. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_cursor_gemini.py +0 -0
  225. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_dynamodb.py +0 -0
  226. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_egress.py +0 -0
  227. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_examples.py +0 -0
  228. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_flow.py +0 -0
  229. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_gateway.py +0 -0
  230. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_google_adk.py +0 -0
  231. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_homebrew_formula.py +0 -0
  232. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_insights.py +0 -0
  233. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_interlock_test.py +0 -0
  234. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_js_sdk.py +0 -0
  235. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_judge.py +0 -0
  236. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_judge_setup.py +0 -0
  237. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_langchain.py +0 -0
  238. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_local_probe.py +0 -0
  239. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_managed_policy.py +0 -0
  240. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_mandate.py +0 -0
  241. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_mcp_http.py +0 -0
  242. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_mcp_oauth.py +0 -0
  243. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_mcp_policy.py +0 -0
  244. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_mcp_proxy.py +0 -0
  245. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_mcp_server.py +0 -0
  246. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_memory.py +0 -0
  247. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_more_adapters.py +0 -0
  248. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_normalize_kiro.py +0 -0
  249. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_ogr.py +0 -0
  250. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_onboard.py +0 -0
  251. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_openai_agents.py +0 -0
  252. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_opencode.py +0 -0
  253. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_otel.py +0 -0
  254. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_packs.py +0 -0
  255. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_paths_windows.py +0 -0
  256. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_pipeline.py +0 -0
  257. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_plugins.py +0 -0
  258. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_policy_lint.py +0 -0
  259. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_repo_policy.py +0 -0
  260. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_sandbox.py +0 -0
  261. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_scan.py +0 -0
  262. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_selftest.py +0 -0
  263. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_semantic_kernel.py +0 -0
  264. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_service_windows.py +0 -0
  265. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_shim_py.py +0 -0
  266. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_shim_sh.py +0 -0
  267. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_spool.py +0 -0
  268. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_strands.py +0 -0
  269. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_text_encoding.py +0 -0
  270. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_tiers.py +0 -0
  271. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_transcript.py +0 -0
  272. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_unix_socket.py +0 -0
  273. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_version.py +0 -0
  274. {interlockd-0.1.6 → interlockd-0.1.7}/tests/test_watch.py +0 -0
@@ -1,5 +1,9 @@
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
+
3
7
  ## 0.1.6 (2026-10-25)
4
8
 
5
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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: interlockd
3
- Version: 0.1.6
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
@@ -133,7 +133,7 @@ The full threat model is in [docs/THREAT-MODEL.md](docs/THREAT-MODEL.md). Latenc
133
133
 
134
134
  ```yaml
135
135
  - uses: actions/checkout@v7
136
- - uses: interlockd/interlock@v0.1.6 # scan MCP/agent configs, test .interlock/policy.yaml
136
+ - uses: interlockd/interlock@v0.1.7 # scan MCP/agent configs, test .interlock/policy.yaml
137
137
  with: { fail-on: high }
138
138
  - uses: github/codeql-action/upload-sarif@v3
139
139
  if: always()
@@ -88,7 +88,7 @@ The full threat model is in [docs/THREAT-MODEL.md](docs/THREAT-MODEL.md). Latenc
88
88
 
89
89
  ```yaml
90
90
  - uses: actions/checkout@v7
91
- - uses: interlockd/interlock@v0.1.6 # scan MCP/agent configs, test .interlock/policy.yaml
91
+ - uses: interlockd/interlock@v0.1.7 # scan MCP/agent configs, test .interlock/policy.yaml
92
92
  with: { fail-on: high }
93
93
  - uses: github/codeql-action/upload-sarif@v3
94
94
  if: always()
@@ -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 validating policy, the managed (tighten-only) policy file, the daemon's
628
- status, hook integrity, and audit records with tool arguments and results left out. Everything else in `interlockd`
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
@@ -9,7 +9,7 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
11
  - uses: actions/checkout@v7
12
- - uses: interlockd/interlock@v0.1.6
12
+ - uses: interlockd/interlock@v0.1.7
13
13
  with: { fail-on: high }
14
14
  - uses: github/codeql-action/upload-sarif@v3
15
15
  if: always()
@@ -1,3 +1,3 @@
1
1
  """Interlock daemon package."""
2
2
 
3
- __version__ = "0.1.6"
3
+ __version__ = "0.1.7"
@@ -26,9 +26,9 @@ from .policy import Policy
26
26
 
27
27
  API_VERSION = 1
28
28
 
29
- __all__ = ["API_VERSION", "INTERLOCKD_VERSION", "DaemonStatus", "Decision", "check_managed_policy", "daemon_status",
30
- "decisions", "effective_policy", "hook_status", "load_policy", "managed_policy_path", "settings_from_args",
31
- "spool_dir", "validate_policy"]
29
+ __all__ = ["API_VERSION", "INTERLOCKD_VERSION", "DaemonStatus", "Decision", "LintIssue", "check_managed_policy",
30
+ "compose_policies", "daemon_status", "decisions", "effective_policy", "hook_status", "lint_policy",
31
+ "load_policy", "managed_policy_path", "settings_from_args", "spool_dir", "tighten_policy", "validate_policy"]
32
32
 
33
33
 
34
34
  # ---- settings and policy -------------------------------------------------------------------------------------
@@ -91,6 +91,38 @@ def check_managed_policy(data: Mapping[str, Any], *, base: Policy | None = None,
91
91
  return ignored
92
92
 
93
93
 
94
+ def tighten_policy(base: Policy, data: Mapping[str, Any]) -> tuple[Policy, list[str]]:
95
+ """Apply only the parts of `data` that make `base` stricter, as the managed policy and repository policies are
96
+ applied. Returns (policy, the keys that were ignored because they would loosen a decision)."""
97
+ from .policy.workspace import tighten
98
+
99
+ return tighten(base, {k: v for k, v in data.items() if k not in ("source_paths", "sha256")})
100
+
101
+
102
+ def compose_policies(docs: list[Mapping[str, Any]]) -> dict[str, Any]:
103
+ """One policy document that tightens a policy as applying `docs` in order would (for layering policies centrally,
104
+ e.g. an organization's baseline and group policies, into one managed policy). See
105
+ `interlockd.policy.workspace.compose` for the rules, including the one exception (`trust.allowed_git_remotes`)."""
106
+ from .policy.workspace import compose
107
+
108
+ return compose([dict(d) for d in docs if isinstance(d, Mapping)])
109
+
110
+
111
+ @dataclass(frozen=True)
112
+ class LintIssue:
113
+ level: str # "error" or "warning"
114
+ where: str # e.g. "packs.overrides.shell.pipe_to_shel"
115
+ message: str
116
+
117
+
118
+ def lint_policy(policy: Policy) -> list[LintIssue]:
119
+ """What `interlock policy lint` reports for `policy`: unknown rule ids (an override that does nothing), unknown
120
+ packs, weakened or disabled critical rules, catch-all allows."""
121
+ from .policy_lint import lint
122
+
123
+ return [LintIssue(i.level, i.where, i.message) for i in lint(policy)]
124
+
125
+
94
126
  def effective_policy(policy: Policy, home: str | Path) -> Policy:
95
127
  """`policy` with the managed file in `home` applied (what decisions use); unchanged if there is none."""
96
128
  from .policy.managed import apply_managed, read_managed
@@ -187,6 +187,149 @@ def _flow(p: Policy, base: Policy, val: dict, ignored: list[str]) -> None:
187
187
  ignored.append(f"flow.{k}")
188
188
 
189
189
 
190
+ def compose(docs: list[Any]) -> dict[str, Any]:
191
+ """One document that tightens a policy as applying `docs` one after another with `tighten` would.
192
+
193
+ For every base policy P: `tighten(P, compose([D1, D2, ...]))` is the policy `tighten(tighten(P, D1), D2) ...`
194
+ (tests/test_policy_compose.py checks this on random policies). Each setting follows `tighten`: `mode: enforce` wins;
195
+ rule actions, the MCP default and the flow action take the strictest; packs, paths, branches, flow sources and sinks,
196
+ and denied OAuth scopes are unions; allowed hosts and package indexes are intersections; denial budgets take the
197
+ smallest; anything `tighten` ignores is left out. An MCP `ask` from a layer after one that blocks something is left
198
+ out, as the machine would ignore it.
199
+
200
+ One exception: `trust.allowed_git_remotes` is narrowed left to right, skipping a layer that shares no remote with
201
+ the result so far. On a machine whose own policy lists remotes, a layer that shares none with that list is skipped
202
+ there instead, so the outcome can differ from applying the layers one by one; it is never looser than the machine's
203
+ own list.
204
+
205
+ For layering policies centrally (a baseline plus group policies) into the one managed policy a machine applies.
206
+ """
207
+ from ..det import RULES, flow, mcp, oauth, packs # noqa: F401 register every rule
208
+
209
+ enforce, declared, budget_block, flow_enabled, mcp_seen, oauth_seen, pin, blocked = (False,) * 8
210
+ enabled: list[str] = []
211
+ overrides: dict[str, str] = {}
212
+ unions: dict[str, list[str]] = {k: [] for k in ("protected_paths", "sensitive_paths", "protected_branches")}
213
+ allow: dict[str, list[str] | None] = {"allowed_hosts": None, "allowed_package_indexes": None}
214
+ remotes: list[str] | None = None
215
+ mcp_default, mcp_tools, deny_scopes = "allow", {}, []
216
+ flow_action: str | None = None
217
+ flow_lists: dict[str, list[str]] = {k: [] for k in ("private_sources", "untrusted_sources", "sinks")}
218
+ budget: dict[str, int] = {}
219
+
220
+ def union(into: list[str], items: list) -> None:
221
+ into.extend(x for x in (str(i) for i in items) if x not in into)
222
+
223
+ for doc in docs:
224
+ if not isinstance(doc, dict):
225
+ continue
226
+ if doc.get("mode") == "enforce":
227
+ enforce = True
228
+ pk = doc.get("packs")
229
+ if isinstance(pk, dict):
230
+ if isinstance(pk.get("enabled"), list):
231
+ union(enabled, pk["enabled"])
232
+ for rid, raw in (pk.get("overrides") if isinstance(pk.get("overrides"), dict) else {}).items():
233
+ try:
234
+ ov = RuleOverride.model_validate(raw or {})
235
+ except ValueError:
236
+ continue
237
+ if (rid in RULES and ov.enabled and ov.action is not None
238
+ and (rid not in overrides or ORDER[ov.action] > ORDER[overrides[rid]])):
239
+ overrides[rid] = ov.action
240
+ tr = doc.get("trust")
241
+ if isinstance(tr, dict):
242
+ for k, into in unions.items():
243
+ if isinstance(tr.get(k), list):
244
+ union(into, tr[k])
245
+ for k, cur in allow.items():
246
+ if isinstance(tr.get(k), list):
247
+ v = [str(x) for x in tr[k]]
248
+ allow[k] = v if cur is None else [h for h in cur if h in v]
249
+ v = tr.get("allowed_git_remotes")
250
+ if isinstance(v, list) and v:
251
+ v = [str(x) for x in v]
252
+ keep = v if remotes is None else [r for r in remotes if r in v]
253
+ if keep:
254
+ remotes = keep
255
+ if tr.get("declared_packages_only") is True:
256
+ declared = True
257
+ mv = doc.get("mcp")
258
+ if isinstance(mv, dict):
259
+ try:
260
+ m = McpPolicy.model_validate(mv)
261
+ except ValueError:
262
+ m = None
263
+ if m is not None:
264
+ mcp_seen = True
265
+ if ORDER[m.default] > ORDER[mcp_default]:
266
+ mcp_default = m.default
267
+ if "oauth" in mv:
268
+ oauth_seen = True
269
+ union(deny_scopes, m.oauth.deny_scopes)
270
+ pin = pin or m.oauth.pin_authorization_servers
271
+ for pat, action in m.tools.items():
272
+ if action == "block":
273
+ mcp_tools[pat] = "block"
274
+ elif action == "ask" and not blocked and pat not in mcp_tools:
275
+ mcp_tools[pat] = "ask"
276
+ blocked = blocked or m.default == "block" or "block" in m.tools.values()
277
+ fl = doc.get("flow")
278
+ if isinstance(fl, dict):
279
+ if fl.get("enabled") is True:
280
+ flow_enabled = True
281
+ a = fl.get("action")
282
+ if a in ("block", "ask", "flag") and (flow_action is None or ORDER[a] > ORDER[flow_action]):
283
+ flow_action = a
284
+ for k, into in flow_lists.items():
285
+ if isinstance(fl.get(k), list):
286
+ union(into, fl[k])
287
+ db = doc.get("denial_budget")
288
+ if isinstance(db, dict):
289
+ for k in ("consecutive", "total"):
290
+ v = db.get(k)
291
+ if isinstance(v, int) and v > 0:
292
+ budget[k] = min(budget.get(k, v), v)
293
+ if db.get("then") == "block":
294
+ budget_block = True
295
+
296
+ out: dict[str, Any] = {}
297
+ if enforce:
298
+ out["mode"] = "enforce"
299
+ packs_out = {**({"enabled": enabled} if enabled else {}),
300
+ **({"overrides": {r: {"action": a} for r, a in overrides.items()}} if overrides else {})}
301
+ if packs_out:
302
+ out["packs"] = packs_out
303
+ trust_out: dict[str, Any] = {k: v for k, v in unions.items() if v}
304
+ trust_out.update({k: v for k, v in allow.items() if v is not None})
305
+ if remotes:
306
+ trust_out["allowed_git_remotes"] = remotes
307
+ if declared:
308
+ trust_out["declared_packages_only"] = True
309
+ if trust_out:
310
+ out["trust"] = trust_out
311
+ if mcp_seen:
312
+ mcp_out: dict[str, Any] = {}
313
+ if mcp_default != "allow":
314
+ mcp_out["default"] = mcp_default
315
+ if mcp_tools:
316
+ mcp_out["tools"] = mcp_tools
317
+ if oauth_seen:
318
+ mcp_out["oauth"] = {"deny_scopes": deny_scopes, "pin_authorization_servers": pin}
319
+ if mcp_out:
320
+ out["mcp"] = mcp_out
321
+ flow_out: dict[str, Any] = {k: v for k, v in flow_lists.items() if v}
322
+ if flow_enabled:
323
+ flow_out["enabled"] = True
324
+ if flow_action:
325
+ flow_out["action"] = flow_action
326
+ if flow_out:
327
+ out["flow"] = flow_out
328
+ if budget or budget_block:
329
+ out["denial_budget"] = {**budget, **({"then": "block"} if budget_block else {})}
330
+ return out
331
+
332
+
190
333
  class RepoPolicies:
191
334
  """Resolve and cache the policy for a call's working directory. Thread-safe; a changed file is re-read."""
192
335
 
@@ -16,7 +16,7 @@ HARNESS="__HARNESS__"
16
16
  HOME_DIR="${INTERLOCK_HOME:-$HOME/.interlock}"
17
17
  PRE_TIMEOUT="${INTERLOCK_PRE_TIMEOUT_MS:-1500}"
18
18
  POST_TIMEOUT="${INTERLOCK_POST_TIMEOUT_MS:-2500}"
19
- VERSION="0.1.6"
19
+ VERSION="0.1.7"
20
20
 
21
21
  log_local() {
22
22
  mkdir -p "$HOME_DIR" 2>/dev/null
@@ -11,7 +11,7 @@ import { readFileSync, appendFileSync, mkdirSync } from "node:fs";
11
11
  import { homedir } from "node:os";
12
12
  import path from "node:path";
13
13
 
14
- const VERSION = "0.1.6";
14
+ const VERSION = "0.1.7";
15
15
  const HOME = process.env.INTERLOCK_HOME || path.join(homedir(), ".interlock");
16
16
  const BASE = (process.env.INTERLOCK_URL || readListen() || "http://127.0.0.1:7391").replace(/\/$/, "");
17
17
  const PRE_TIMEOUT_MS = Number(process.env.INTERLOCK_PRE_TIMEOUT_MS || 1500);
@@ -12,7 +12,7 @@
12
12
  HOME_DIR="${INTERLOCK_HOME:-$HOME/.interlock}"
13
13
  PRE_TIMEOUT="${INTERLOCK_PRE_TIMEOUT_MS:-1500}"
14
14
  POST_TIMEOUT="${INTERLOCK_POST_TIMEOUT_MS:-2500}"
15
- VERSION="0.1.6"
15
+ VERSION="0.1.7"
16
16
  nl='
17
17
  '
18
18
 
@@ -18,7 +18,7 @@ import socket
18
18
  import sys
19
19
 
20
20
  HARNESS = "__HARNESS__"
21
- VERSION = "0.1.6"
21
+ VERSION = "0.1.7"
22
22
  HOME_DIR = os.environ.get("INTERLOCK_HOME") or os.path.join(os.path.expanduser("~"), ".interlock")
23
23
  PRE_TIMEOUT = int(os.environ.get("INTERLOCK_PRE_TIMEOUT_MS") or 1500)
24
24
  POST_TIMEOUT = int(os.environ.get("INTERLOCK_POST_TIMEOUT_MS") or 2500)
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "interlockd"
3
- version = "0.1.6"
3
+ version = "0.1.7"
4
4
  description = "Interlock daemon: a pre/post-action interlock for coding agents"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interlockd/sdk",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Interlock for JavaScript and TypeScript agents: check every tool call before it runs and every result before the model reads it.",
5
5
  "type": "module",
6
6
  "exports": { ".": { "types": "./src/index.d.ts", "default": "./src/index.js" } },
@@ -15,7 +15,7 @@ import { readFileSync } from "node:fs";
15
15
  import { homedir } from "node:os";
16
16
  import { join } from "node:path";
17
17
 
18
- export const VERSION = "0.1.6";
18
+ export const VERSION = "0.1.7";
19
19
  export const UNREACHABLE =
20
20
  "[interlock] This action was NOT executed: the Interlock daemon is unreachable and this machine fails closed.";
21
21
 
@@ -26,11 +26,13 @@ def test_version_one_surface_is_complete():
26
26
  assert hasattr(plugin_api, name), name
27
27
  sigs = {n: list(inspect.signature(getattr(plugin_api, n)).parameters) for n in
28
28
  ("settings_from_args", "spool_dir", "load_policy", "validate_policy", "managed_policy_path",
29
- "check_managed_policy", "effective_policy", "daemon_status", "hook_status", "decisions")}
29
+ "check_managed_policy", "effective_policy", "daemon_status", "hook_status", "decisions",
30
+ "tighten_policy", "compose_policies", "lint_policy")}
30
31
  assert sigs == {"settings_from_args": ["args"], "spool_dir": ["home"], "load_policy": ["home"],
31
32
  "validate_policy": ["data"], "managed_policy_path": ["home"],
32
33
  "check_managed_policy": ["data", "base", "home"], "effective_policy": ["policy", "home"],
33
- "daemon_status": ["daemon"], "hook_status": ["home"], "decisions": ["spool", "since", "until"]}
34
+ "daemon_status": ["daemon"], "hook_status": ["home"], "decisions": ["spool", "since", "until"],
35
+ "tighten_policy": ["base", "data"], "compose_policies": ["docs"], "lint_policy": ["policy"]}
34
36
 
35
37
 
36
38
  def test_settings_and_paths(tmp_path, monkeypatch):
@@ -119,3 +121,16 @@ def test_plugin_needing_a_newer_api_is_skipped(monkeypatch):
119
121
  assert loaded["b_ok"].module is ok and not loaded["b_ok"].error
120
122
  finally:
121
123
  plugins.reset()
124
+
125
+
126
+ def test_tighten_compose_and_lint():
127
+ base = plugin_api.validate_policy({})
128
+ pol, ignored = plugin_api.tighten_policy(base, {"mode": "enforce", "trust": {"allowed_hosts": ["evil.example"]},
129
+ "sha256": "x"})
130
+ assert pol.mode == "enforce" and ignored == ["trust.allowed_hosts (hosts you have not allowed)"]
131
+ doc = plugin_api.compose_policies([{"mode": "enforce"}, {"trust": {"protected_branches": ["prod"]}}, "junk"])
132
+ assert doc == {"mode": "enforce", "trust": {"protected_branches": ["prod"]}}
133
+ one, _ = plugin_api.tighten_policy(base, doc)
134
+ assert one.mode == "enforce" and "prod" in one.trust.protected_branches
135
+ issues = plugin_api.lint_policy(plugin_api.validate_policy({"packs": {"overrides": {"shell.pipe_to_shel": {"action": "block"}}}}))
136
+ assert issues and issues[0].level == "error" and "pipe_to_shell" in issues[0].message
@@ -0,0 +1,149 @@
1
+ """compose(): one document that tightens like applying several, in order (central baseline + group policies)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import random
6
+
7
+ import pytest
8
+
9
+ from interlockd.policy import Policy
10
+ from interlockd.policy.workspace import compose, tighten
11
+
12
+ RULES = ["git.force_push_own_branch", "git.force_push_protected_branch", "shell.pipe_to_shell", "egress.unknown_host",
13
+ "no.such_rule"]
14
+ ACTIONS = ["allow", "flag", "model", "ask", "block"]
15
+ HOSTS = ["github.com", "pypi.org", "registry.npmjs.org", "example.com"]
16
+ REMOTES = ["github.com/acme/*", "github.com/acme/api", "gitlab.com/acme/*"]
17
+ PATHS = ["~/.ssh/**", "deploy/**", "infra/**"]
18
+ BRANCHES = ["main", "release/*", "prod"]
19
+ MCP_PATTERNS = ["github/*", "fs/write_file", "*/delete_*", "slack/post"]
20
+ PACKS = ["shell", "git", "egress", "persistence", "secrets", "packages"]
21
+
22
+
23
+ def sub(rng: random.Random, xs: list[str]) -> list[str]:
24
+ return [x for x in xs if rng.random() < 0.5]
25
+
26
+
27
+ def random_doc(rng: random.Random) -> dict:
28
+ d: dict = {}
29
+ if rng.random() < 0.4:
30
+ d["mode"] = rng.choice(["enforce", "shadow"])
31
+ if rng.random() < 0.5:
32
+ d["packs"] = {}
33
+ if rng.random() < 0.4:
34
+ d["packs"]["enabled"] = sub(rng, PACKS)
35
+ if rng.random() < 0.8:
36
+ d["packs"]["overrides"] = {r: rng.choice([{"action": rng.choice(ACTIONS)}, {"enabled": False}, {"action": "nope"}])
37
+ for r in sub(rng, RULES)}
38
+ if rng.random() < 0.6:
39
+ t: dict = {}
40
+ for k, universe in (("protected_paths", PATHS), ("sensitive_paths", PATHS), ("protected_branches", BRANCHES),
41
+ ("allowed_hosts", HOSTS), ("allowed_package_indexes", HOSTS),
42
+ ("allowed_git_remotes", REMOTES)):
43
+ if rng.random() < 0.35:
44
+ t[k] = sub(rng, universe)
45
+ if rng.random() < 0.2:
46
+ t["declared_packages_only"] = rng.choice([True, False])
47
+ if rng.random() < 0.1:
48
+ t["trusted_workspaces"] = ["~/code/*"] # ignored by tighten
49
+ d["trust"] = t
50
+ if rng.random() < 0.5:
51
+ m: dict = {}
52
+ if rng.random() < 0.5:
53
+ m["default"] = rng.choice(["allow", "ask", "block"])
54
+ if rng.random() < 0.7:
55
+ m["tools"] = {p: rng.choice(["allow", "ask", "block"]) for p in sub(rng, MCP_PATTERNS)}
56
+ if rng.random() < 0.3:
57
+ m["oauth"] = {"deny_scopes": sub(rng, ["admin:*", "delete_repo"]),
58
+ **({"pin_authorization_servers": rng.choice([True, False])} if rng.random() < 0.5 else {})}
59
+ if rng.random() < 0.05:
60
+ m["default"] = "maybe" # invalid: the whole mcp section is ignored
61
+ d["mcp"] = m
62
+ if rng.random() < 0.4:
63
+ d["flow"] = {k: v for k, v in {"enabled": rng.choice([True, False]), "action": rng.choice(["block", "ask", "flag", "x"]),
64
+ "sinks": sub(rng, ["egress", "git.push", "mcp:slack/*"])}.items() if rng.random() < 0.6}
65
+ if rng.random() < 0.3:
66
+ d["denial_budget"] = {k: v for k, v in {"consecutive": rng.choice([1, 2, 5, 0, -1]), "total": rng.choice([5, 10, 50]),
67
+ "then": rng.choice(["ask", "block"])}.items() if rng.random() < 0.6}
68
+ if rng.random() < 0.15:
69
+ d["judge"] = {"backend": "none"} # never applied by tighten
70
+ if rng.random() < 0.05:
71
+ d["packs"] = "not a mapping"
72
+ return d
73
+
74
+
75
+ def random_base(rng: random.Random) -> Policy:
76
+ p, _ = Policy(), None
77
+ data = random_doc(rng)
78
+ data.pop("judge", None)
79
+ if isinstance(data.get("packs"), str):
80
+ data.pop("packs")
81
+ for k in ("mode",):
82
+ if k in data:
83
+ p.mode = data[k]
84
+ try: # a base with its own lists, overrides, MCP rules
85
+ merged = Policy.model_validate({**p.model_dump(exclude={"source_paths", "sha256"}),
86
+ **{k: {**p.model_dump()[k], **v} for k, v in data.items()
87
+ if isinstance(v, dict) and k in ("trust", "mcp", "flow", "denial_budget")}})
88
+ if isinstance(data.get("packs"), dict) and "overrides" in data["packs"]:
89
+ for rid, ov in data["packs"]["overrides"].items():
90
+ if ov.get("action") in ACTIONS or ov.get("enabled") is False:
91
+ merged.packs.overrides[rid] = merged.packs.overrides.get(rid, None) or type(next(iter(
92
+ Policy.model_validate({"packs": {"overrides": {rid: ov}}}).packs.overrides.values())))(**ov)
93
+ return merged
94
+ except ValueError:
95
+ return p
96
+
97
+
98
+ def view(p: Policy) -> dict:
99
+ d = p.model_dump(exclude={"source_paths", "sha256"})
100
+ d["trust"].pop("allowed_git_remotes")
101
+ return d
102
+
103
+
104
+ @pytest.mark.parametrize("seed", range(25))
105
+ def test_compose_matches_applying_the_layers_in_order(seed):
106
+ rng = random.Random(seed)
107
+ for _ in range(120):
108
+ base = random_base(rng)
109
+ docs = [random_doc(rng) for _ in range(rng.randint(0, 4))]
110
+ seq = base
111
+ for d in docs:
112
+ seq, _ = tighten(seq, d)
113
+ one, _ = tighten(base, compose(docs))
114
+ assert view(one) == view(seq), (docs, compose(docs))
115
+ # remotes: exact for a machine without its own list, never looser than the machine's list
116
+ if not base.trust.allowed_git_remotes:
117
+ assert one.trust.allowed_git_remotes == seq.trust.allowed_git_remotes
118
+ else:
119
+ assert set(one.trust.allowed_git_remotes) <= set(base.trust.allowed_git_remotes)
120
+
121
+
122
+ def test_compose_is_never_looser_than_any_layer():
123
+ rng = random.Random(7)
124
+ for _ in range(300):
125
+ base = random_base(rng)
126
+ docs = [random_doc(rng) for _ in range(rng.randint(1, 4))]
127
+ one, _ = tighten(base, compose(docs))
128
+ for d in docs:
129
+ alone, _ = tighten(base, d)
130
+ again, _ = tighten(one, d) # applying a layer once more changes nothing
131
+ assert view(again) == view(one)
132
+ assert (alone.mode == "enforce") <= (one.mode == "enforce")
133
+
134
+
135
+ def test_compose_examples():
136
+ baseline = {"mode": "enforce", "trust": {"allowed_hosts": ["github.com", "pypi.org"]},
137
+ "mcp": {"tools": {"fs/write_file": "ask"}}}
138
+ oncall = {"packs": {"overrides": {"git.force_push_own_branch": {"action": "block"}}},
139
+ "trust": {"allowed_hosts": ["github.com"], "protected_branches": ["prod"]},
140
+ "mcp": {"tools": {"*/delete_*": "block", "github/*": "ask"}}} # same layer: the ask applies
141
+ contractors = {"mcp": {"tools": {"slack/post": "ask"}}} # after a block: a machine ignores it
142
+ out = compose([baseline, oncall, contractors])
143
+ assert out == {"mode": "enforce",
144
+ "packs": {"overrides": {"git.force_push_own_branch": {"action": "block"}}},
145
+ "trust": {"protected_branches": ["prod"], "allowed_hosts": ["github.com"]},
146
+ "mcp": {"tools": {"fs/write_file": "ask", "*/delete_*": "block", "github/*": "ask"}}}
147
+ assert compose([]) == {} and compose([{"judge": {"backend": "none"}, "mode": "shadow"}, "junk"]) == {}
148
+ assert compose([{"trust": {"allowed_git_remotes": ["a"]}}, {"trust": {"allowed_git_remotes": ["b"]}}]) == \
149
+ {"trust": {"allowed_git_remotes": ["a"]}} # a layer sharing no remote is skipped
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes