interlockd 0.1.4__tar.gz → 0.1.5__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 (269) hide show
  1. {interlockd-0.1.4 → interlockd-0.1.5}/.gitignore +3 -0
  2. {interlockd-0.1.4 → interlockd-0.1.5}/CHANGELOG.md +5 -0
  3. interlockd-0.1.5/CLAUDE.md +30 -0
  4. {interlockd-0.1.4 → interlockd-0.1.5}/PKG-INFO +2 -2
  5. {interlockd-0.1.4 → interlockd-0.1.5}/README.md +1 -1
  6. {interlockd-0.1.4 → interlockd-0.1.5}/docs/USER-GUIDE.md +9 -1
  7. interlockd-0.1.5/examples/aws/interlock-audit.yaml +70 -0
  8. {interlockd-0.1.4 → interlockd-0.1.5}/examples/github-workflow.yml +1 -1
  9. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/__init__.py +1 -1
  10. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/cli.py +1 -0
  11. interlockd-0.1.5/interlockd/plugin_api.py +186 -0
  12. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/plugins.py +14 -0
  13. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/shims/claude-code/interlock-hook.sh +1 -1
  14. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/shims/kiro/interlock-hook.mjs +1 -1
  15. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/shims/kiro/interlock-hook.sh +1 -1
  16. {interlockd-0.1.4 → interlockd-0.1.5}/pyproject.toml +1 -1
  17. {interlockd-0.1.4 → interlockd-0.1.5}/sdk/js/package.json +1 -1
  18. {interlockd-0.1.4 → interlockd-0.1.5}/sdk/js/src/index.js +1 -1
  19. interlockd-0.1.5/tests/test_plugin_api.py +121 -0
  20. {interlockd-0.1.4 → interlockd-0.1.5}/.github/CODEOWNERS +0 -0
  21. {interlockd-0.1.4 → interlockd-0.1.5}/.github/ISSUE_TEMPLATE/agent.yml +0 -0
  22. {interlockd-0.1.4 → interlockd-0.1.5}/.github/ISSUE_TEMPLATE/bug.yml +0 -0
  23. {interlockd-0.1.4 → interlockd-0.1.5}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  24. {interlockd-0.1.4 → interlockd-0.1.5}/.github/ISSUE_TEMPLATE/decision.yml +0 -0
  25. {interlockd-0.1.4 → interlockd-0.1.5}/.github/dependabot.yml +0 -0
  26. {interlockd-0.1.4 → interlockd-0.1.5}/.github/pull_request_template.md +0 -0
  27. {interlockd-0.1.4 → interlockd-0.1.5}/.github/workflows/ci.yml +0 -0
  28. {interlockd-0.1.4 → interlockd-0.1.5}/.github/workflows/release.yml +0 -0
  29. {interlockd-0.1.4 → interlockd-0.1.5}/CODE_OF_CONDUCT.md +0 -0
  30. {interlockd-0.1.4 → interlockd-0.1.5}/CONTRIBUTING.md +0 -0
  31. {interlockd-0.1.4 → interlockd-0.1.5}/LICENSE +0 -0
  32. {interlockd-0.1.4 → interlockd-0.1.5}/NOTICE +0 -0
  33. {interlockd-0.1.4 → interlockd-0.1.5}/SECURITY.md +0 -0
  34. {interlockd-0.1.4 → interlockd-0.1.5}/action.yml +0 -0
  35. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/README.md +0 -0
  36. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/antigravity/PAYLOADS.md +0 -0
  37. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/claude-code/PAYLOADS.md +0 -0
  38. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/claude-code/README.md +0 -0
  39. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/codex/PAYLOADS.md +0 -0
  40. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/codex/README.md +0 -0
  41. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/copilot-cli/PAYLOADS.md +0 -0
  42. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/cursor/PAYLOADS.md +0 -0
  43. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/gemini-cli/PAYLOADS.md +0 -0
  44. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/kiro/PAYLOADS.md +0 -0
  45. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/opencode/PAYLOADS.md +0 -0
  46. {interlockd-0.1.4 → interlockd-0.1.5}/adapters/windsurf/PAYLOADS.md +0 -0
  47. {interlockd-0.1.4 → interlockd-0.1.5}/benchmarks/agentdojo_template.py +0 -0
  48. {interlockd-0.1.4 → interlockd-0.1.5}/benchmarks/injecagent.py +0 -0
  49. {interlockd-0.1.4 → interlockd-0.1.5}/benchmarks/nl2bash.py +0 -0
  50. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/README.md +0 -0
  51. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/_corpus.yaml +0 -0
  52. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/archetypes/_corpus.yaml +0 -0
  53. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/archetypes/exfil_and_secrets.jsonl +0 -0
  54. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/archetypes/git_and_history.jsonl +0 -0
  55. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/archetypes/injection_persistence_supplychain.jsonl +0 -0
  56. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/archetypes/judge_confirmation.jsonl +0 -0
  57. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/archetypes/judge_exfil.jsonl +0 -0
  58. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/archetypes/judge_injection.jsonl +0 -0
  59. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/archetypes/judge_intent.jsonl +0 -0
  60. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/archetypes/slow_hijack.jsonl +0 -0
  61. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/external/README.md +0 -0
  62. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/external/samples/agentdojo.sample.json +0 -0
  63. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/external/samples/agentdrift.sample.json +0 -0
  64. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/external/samples/injecagent.sample.json +0 -0
  65. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/ogr-seed-v0/README.md +0 -0
  66. {interlockd-0.1.4 → interlockd-0.1.5}/corpus/ogr-seed-v0/seed-v0.jsonl +0 -0
  67. {interlockd-0.1.4 → interlockd-0.1.5}/demo/demo.sh +0 -0
  68. {interlockd-0.1.4 → interlockd-0.1.5}/demo/demo.tape +0 -0
  69. {interlockd-0.1.4 → interlockd-0.1.5}/docs/ADAPTERS.md +0 -0
  70. {interlockd-0.1.4 → interlockd-0.1.5}/docs/BENCHMARKS.md +0 -0
  71. {interlockd-0.1.4 → interlockd-0.1.5}/docs/GETTING-STARTED.md +0 -0
  72. {interlockd-0.1.4 → interlockd-0.1.5}/docs/PERFORMANCE.md +0 -0
  73. {interlockd-0.1.4 → interlockd-0.1.5}/docs/THREAT-MODEL.md +0 -0
  74. {interlockd-0.1.4 → interlockd-0.1.5}/docs/mandate-example.cedar +0 -0
  75. {interlockd-0.1.4 → interlockd-0.1.5}/docs/policy-example.yaml +0 -0
  76. {interlockd-0.1.4 → interlockd-0.1.5}/docs/reports/M3-judge-calibration.md +0 -0
  77. {interlockd-0.1.4 → interlockd-0.1.5}/docs/reports/ogr-seed-v0-results.jsonl +0 -0
  78. {interlockd-0.1.4 → interlockd-0.1.5}/docs/reports/ogr-seed-v0-results.md +0 -0
  79. {interlockd-0.1.4 → interlockd-0.1.5}/examples/agents/README.md +0 -0
  80. {interlockd-0.1.4 → interlockd-0.1.5}/examples/agents/claude_agent_sdk_agent.py +0 -0
  81. {interlockd-0.1.4 → interlockd-0.1.5}/examples/agents/crewai_crew.py +0 -0
  82. {interlockd-0.1.4 → interlockd-0.1.5}/examples/agents/google_adk_agent.py +0 -0
  83. {interlockd-0.1.4 → interlockd-0.1.5}/examples/agents/langgraph_agent.py +0 -0
  84. {interlockd-0.1.4 → interlockd-0.1.5}/examples/agents/openai_agents.py +0 -0
  85. {interlockd-0.1.4 → interlockd-0.1.5}/examples/agents/semantic_kernel_agent.py +0 -0
  86. {interlockd-0.1.4 → interlockd-0.1.5}/examples/agents/strands_agent.py +0 -0
  87. {interlockd-0.1.4 → interlockd-0.1.5}/examples/policies/ci.yaml +0 -0
  88. {interlockd-0.1.4 → interlockd-0.1.5}/examples/policies/mcp-locked-down.yaml +0 -0
  89. {interlockd-0.1.4 → interlockd-0.1.5}/examples/policies/strict-team.yaml +0 -0
  90. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/__main__.py +0 -0
  91. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/aibom.py +0 -0
  92. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/api.py +0 -0
  93. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/auth.py +0 -0
  94. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/bench.py +0 -0
  95. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/calibration.py +0 -0
  96. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/capture.py +0 -0
  97. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/compose.py +0 -0
  98. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/config.py +0 -0
  99. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/control.py +0 -0
  100. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/corpus.py +0 -0
  101. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/data/packs/_corpus.yaml +0 -0
  102. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/data/packs/egress.jsonl +0 -0
  103. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/data/packs/fileops.jsonl +0 -0
  104. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/data/packs/git.jsonl +0 -0
  105. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/data/packs/packages.jsonl +0 -0
  106. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/data/packs/persistence.jsonl +0 -0
  107. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/data/packs/secrets.jsonl +0 -0
  108. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/data/packs/shell.jsonl +0 -0
  109. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/__init__.py +0 -0
  110. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/describe.py +0 -0
  111. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/engine.py +0 -0
  112. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/flow.py +0 -0
  113. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/mandate.py +0 -0
  114. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/mcp.py +0 -0
  115. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/memory.py +0 -0
  116. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/oauth.py +0 -0
  117. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/packs.py +0 -0
  118. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/det/shellparse.py +0 -0
  119. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/egress.py +0 -0
  120. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/gateway.py +0 -0
  121. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/ids.py +0 -0
  122. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/insights.py +0 -0
  123. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/integrations/__init__.py +0 -0
  124. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/integrations/claude_agent_sdk.py +0 -0
  125. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/integrations/client.py +0 -0
  126. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/integrations/crewai.py +0 -0
  127. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/integrations/google_adk.py +0 -0
  128. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/integrations/langchain.py +0 -0
  129. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/integrations/openai_agents.py +0 -0
  130. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/integrations/semantic_kernel.py +0 -0
  131. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/integrations/strands.py +0 -0
  132. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/judge_setup.py +0 -0
  133. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/judges/__init__.py +0 -0
  134. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/judges/guardrails.py +0 -0
  135. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/judges/local_probe.py +0 -0
  136. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/judges/projector.py +0 -0
  137. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/judges/strands_decider.py +0 -0
  138. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/ledger.py +0 -0
  139. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/mcp_http.py +0 -0
  140. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/mcp_proxy.py +0 -0
  141. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/mcp_server.py +0 -0
  142. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/models.py +0 -0
  143. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/normalize/__init__.py +0 -0
  144. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/normalize/claude_code.py +0 -0
  145. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/normalize/cursor.py +0 -0
  146. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/normalize/gemini_cli.py +0 -0
  147. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/normalize/kiro.py +0 -0
  148. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/normalize/more.py +0 -0
  149. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/ogr.py +0 -0
  150. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/onboard.py +0 -0
  151. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/otel.py +0 -0
  152. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/paths.py +0 -0
  153. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/pipeline.py +0 -0
  154. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/policy/__init__.py +0 -0
  155. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/policy/managed.py +0 -0
  156. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/policy/workspace.py +0 -0
  157. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/policy_lint.py +0 -0
  158. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/render.py +0 -0
  159. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/sandbox.py +0 -0
  160. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/scan.py +0 -0
  161. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/schema/verdict.schema.json +0 -0
  162. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/selftest.py +0 -0
  163. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/service.py +0 -0
  164. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/shims/opencode/interlock.js +0 -0
  165. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/store/__init__.py +0 -0
  166. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/store/drainer.py +0 -0
  167. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/store/dynamodb.py +0 -0
  168. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/store/memory.py +0 -0
  169. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/store/spool.py +0 -0
  170. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/testkit.py +0 -0
  171. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/tiers.py +0 -0
  172. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/transcript/__init__.py +0 -0
  173. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/transcript/claude_code.py +0 -0
  174. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/transcript/kiro.py +0 -0
  175. {interlockd-0.1.4 → interlockd-0.1.5}/interlockd/watch.py +0 -0
  176. {interlockd-0.1.4 → interlockd-0.1.5}/packaging/homebrew/Formula/interlock.rb +0 -0
  177. {interlockd-0.1.4 → interlockd-0.1.5}/packaging/homebrew/README.md +0 -0
  178. {interlockd-0.1.4 → interlockd-0.1.5}/packaging/homebrew/make_formula.py +0 -0
  179. {interlockd-0.1.4 → interlockd-0.1.5}/scripts/check-hygiene.sh +0 -0
  180. {interlockd-0.1.4 → interlockd-0.1.5}/sdk/js/README.md +0 -0
  181. {interlockd-0.1.4 → interlockd-0.1.5}/sdk/js/src/index.d.ts +0 -0
  182. {interlockd-0.1.4 → interlockd-0.1.5}/tests/conftest.py +0 -0
  183. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fake_mcp_server.py +0 -0
  184. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/claude-code/post-bash-inject.json +0 -0
  185. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/claude-code/post-read-inject.json +0 -0
  186. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/claude-code/pre-bash-block.json +0 -0
  187. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/claude-code/pre-bash-inject.json +0 -0
  188. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/codex/post-bash-benign.json +0 -0
  189. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/codex/post-bash-inject.json +0 -0
  190. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/codex/pre-bash-benign.json +0 -0
  191. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/codex/pre-bash-block.json +0 -0
  192. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/copilot-cli/post-bash-inject.json +0 -0
  193. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/copilot-cli/pre-bash-benign.json +0 -0
  194. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/copilot-cli/pre-bash-block.json +0 -0
  195. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/cursor/post-read-benign.json +0 -0
  196. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/cursor/post-shell-benign.json +0 -0
  197. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/cursor/pre-read-benign.json +0 -0
  198. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/cursor/pre-shell-benign.json +0 -0
  199. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/cursor/pre-shell-block.json +0 -0
  200. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/gemini-cli/post-read-benign.json +0 -0
  201. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/gemini-cli/post-read-inject.json +0 -0
  202. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/gemini-cli/post-shell-benign.json +0 -0
  203. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/gemini-cli/post-shell-rot13-inject.json +0 -0
  204. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/gemini-cli/pre-read-benign.json +0 -0
  205. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/gemini-cli/pre-shell-benign.json +0 -0
  206. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/gemini-cli/pre-shell-block.json +0 -0
  207. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/windsurf/post-shell-benign.json +0 -0
  208. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/windsurf/pre-shell-benign.json +0 -0
  209. {interlockd-0.1.4 → interlockd-0.1.5}/tests/fixtures/windsurf/pre-shell-block.json +0 -0
  210. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_aibom.py +0 -0
  211. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_api.py +0 -0
  212. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_audit_chain.py +0 -0
  213. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_bench.py +0 -0
  214. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_calibration.py +0 -0
  215. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_capture.py +0 -0
  216. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_claude_agent_sdk.py +0 -0
  217. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_claude_code.py +0 -0
  218. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_control.py +0 -0
  219. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_corpus.py +0 -0
  220. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_crewai.py +0 -0
  221. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_cursor_gemini.py +0 -0
  222. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_dynamodb.py +0 -0
  223. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_egress.py +0 -0
  224. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_examples.py +0 -0
  225. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_flow.py +0 -0
  226. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_gateway.py +0 -0
  227. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_google_adk.py +0 -0
  228. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_homebrew_formula.py +0 -0
  229. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_insights.py +0 -0
  230. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_interlock_test.py +0 -0
  231. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_js_sdk.py +0 -0
  232. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_judge.py +0 -0
  233. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_judge_setup.py +0 -0
  234. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_langchain.py +0 -0
  235. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_local_probe.py +0 -0
  236. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_managed_policy.py +0 -0
  237. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_mandate.py +0 -0
  238. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_mcp_http.py +0 -0
  239. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_mcp_oauth.py +0 -0
  240. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_mcp_policy.py +0 -0
  241. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_mcp_proxy.py +0 -0
  242. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_mcp_server.py +0 -0
  243. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_memory.py +0 -0
  244. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_more_adapters.py +0 -0
  245. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_normalize_kiro.py +0 -0
  246. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_ogr.py +0 -0
  247. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_onboard.py +0 -0
  248. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_openai_agents.py +0 -0
  249. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_opencode.py +0 -0
  250. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_otel.py +0 -0
  251. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_packs.py +0 -0
  252. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_paths_windows.py +0 -0
  253. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_pipeline.py +0 -0
  254. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_plugins.py +0 -0
  255. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_policy_lint.py +0 -0
  256. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_repo_policy.py +0 -0
  257. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_sandbox.py +0 -0
  258. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_scan.py +0 -0
  259. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_selftest.py +0 -0
  260. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_semantic_kernel.py +0 -0
  261. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_shim_sh.py +0 -0
  262. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_spool.py +0 -0
  263. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_strands.py +0 -0
  264. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_text_encoding.py +0 -0
  265. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_tiers.py +0 -0
  266. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_transcript.py +0 -0
  267. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_unix_socket.py +0 -0
  268. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_version.py +0 -0
  269. {interlockd-0.1.4 → interlockd-0.1.5}/tests/test_watch.py +0 -0
@@ -218,3 +218,6 @@ __marimo__/
218
218
 
219
219
  # Streamlit
220
220
  .streamlit/secrets.toml
221
+
222
+ # exported shadow traffic (interlock corpus export): your own recorded calls, never committed
223
+ corpus/shadow/*.jsonl
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.5 (2026-10-24)
4
+
5
+ - 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.
6
+ - `examples/aws/interlock-audit.yaml`: a CloudFormation sample for the optional DynamoDB audit table (it keeps the table, and your audit records, if the stack is deleted); the user guide links it.
7
+
3
8
  ## 0.1.4 (2026-10-24)
4
9
 
5
10
  - Windsurf adapter verified live on Windsurf (Devin.app) 3.10.67: a refused force push, an injected README refused before Cascade read it, and a `cat` of it refused (`flow.reread_withheld`). Windsurf's read hooks carry no contents, so the daemon reads the file itself (256 KiB, never a sensitive path). Fixed live: Windsurf sends `cwd: null`, so a repository policy never applied; the hook's own directory is used now. Windsurf runs each hook twice; the repeat is answered from the first decision.
@@ -0,0 +1,30 @@
1
+ # Working on Interlock (for AI coding agents and their humans)
2
+
3
+ Interlock is a pre- and post-action gate for AI agents: a local daemon, a deterministic rule engine, hook adapters
4
+ for each agent, an MCP gateway, and Python/JS SDKs. Read `CONTRIBUTING.md` first; `docs/USER-GUIDE.md` is the full
5
+ reference and `docs/ADAPTERS.md` covers agent adapters.
6
+
7
+ ## Setup and checks (run all before you commit)
8
+
9
+ ```sh
10
+ uv venv --python 3.12 && uv pip install -e ".[dev]" --python .venv/bin/python
11
+ .venv/bin/ruff check .
12
+ .venv/bin/pytest -q
13
+ .venv/bin/interlock test # rule corpus gates
14
+ .venv/bin/interlock test --corpus corpus/archetypes # evaluation corpus
15
+ scripts/check-hygiene.sh # no real home paths, account ids or keys
16
+ ```
17
+
18
+ ## Rules
19
+
20
+ - **Sign off every commit** (`git commit -s`); work on a branch and open a PR to `main`. If several agents or sessions
21
+ work on this repo at once, give each its own `git worktree`; never switch branches in a checkout someone else uses.
22
+ - **Never touch the real environment while testing:** use a throwaway `HOME` and `INTERLOCK_HOME`, and a port other
23
+ than 7391. Don't edit your own agent configs (`~/.claude`, `~/.codex`, ...) or the running daemon.
24
+ - **A rule change needs positive and hard-negative cases** in `interlockd/data/packs/<pack>.jsonl`.
25
+ - **Adapters are verified live, never assumed:** record real payloads with `interlock capture`, export them redacted,
26
+ and replay them as fixtures. Don't write "verified" anywhere without a live run; say what is untested.
27
+ - **Cross-platform:** paths go through `interlockd/paths.py` (forward slashes, case-insensitive on macOS and Windows);
28
+ text files are read and written with `encoding="utf-8"` (a test enforces it).
29
+ - **Commit nothing that identifies a real machine, account or person:** redact home paths, user names, emails, tokens
30
+ and account ids in fixtures and docs. Security fixes go through a private advisory (`SECURITY.md`), not a public PR.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: interlockd
3
- Version: 0.1.4
3
+ Version: 0.1.5
4
4
  Summary: Interlock daemon: a pre/post-action interlock for coding agents
5
5
  License: Apache-2.0
6
6
  License-File: LICENSE
@@ -131,7 +131,7 @@ The full threat model is in [docs/THREAT-MODEL.md](docs/THREAT-MODEL.md). Latenc
131
131
 
132
132
  ```yaml
133
133
  - uses: actions/checkout@v7
134
- - uses: interlockd/interlock@v0.1.4 # scan MCP/agent configs, test .interlock/policy.yaml
134
+ - uses: interlockd/interlock@v0.1.5 # scan MCP/agent configs, test .interlock/policy.yaml
135
135
  with: { fail-on: high }
136
136
  - uses: github/codeql-action/upload-sarif@v3
137
137
  if: always()
@@ -87,7 +87,7 @@ The full threat model is in [docs/THREAT-MODEL.md](docs/THREAT-MODEL.md). Latenc
87
87
 
88
88
  ```yaml
89
89
  - uses: actions/checkout@v7
90
- - uses: interlockd/interlock@v0.1.4 # scan MCP/agent configs, test .interlock/policy.yaml
90
+ - uses: interlockd/interlock@v0.1.5 # scan MCP/agent configs, test .interlock/policy.yaml
91
91
  with: { fail-on: high }
92
92
  - uses: github/codeql-action/upload-sarif@v3
93
93
  if: always()
@@ -128,7 +128,7 @@ Log: `~/.interlock/mcp-proxy.log`. Pins: `~/.interlock/mcp-pins.json`; after rev
128
128
  }
129
129
  ```
130
130
 
131
- `otlp_endpoint` (e.g. `http://localhost:4318/v1/traces`) and `otlp_headers` send one OpenTelemetry span per decision to your collector (OTLP/HTTP JSON, batched in the background; a session is one trace; attributes follow the GenAI conventions plus `interlock.*`; arguments and results are never exported). `interlock otel export --endpoint URL` backfills from the audit log. The daemon also serves the API on `~/.interlock/interlockd.sock`, created with mode 0600 so only your user can connect; the shell hooks prefer it over loopback TCP (`"unix_socket": false` turns it off; TCP stays for the HTTP MCP gateway and the Python clients). All keys are optional, and `init` writes none of them. Without `dynamodb_table` the daemon runs spool-only (fully functional; records stay in `~/.interlock/spool/`). Other keys: `listen`, `mode`, `agent_id`, `kiro_sessions_dir`, `user_messages_n`, `pre_timeout_ms`, `post_timeout_ms`.
131
+ `otlp_endpoint` (e.g. `http://localhost:4318/v1/traces`) and `otlp_headers` send one OpenTelemetry span per decision to your collector (OTLP/HTTP JSON, batched in the background; a session is one trace; attributes follow the GenAI conventions plus `interlock.*`; arguments and results are never exported). `interlock otel export --endpoint URL` backfills from the audit log. The daemon also serves the API on `~/.interlock/interlockd.sock`, created with mode 0600 so only your user can connect; the shell hooks prefer it over loopback TCP (`"unix_socket": false` turns it off; TCP stays for the HTTP MCP gateway and the Python clients). All keys are optional, and `init` writes none of them. Without `dynamodb_table` the daemon runs spool-only (fully functional; records stay in `~/.interlock/spool/`). To create the table, deploy [`examples/aws/interlock-audit.yaml`](../examples/aws/interlock-audit.yaml) with CloudFormation (it keeps the table if the stack is deleted). Other keys: `listen`, `mode`, `agent_id`, `kiro_sessions_dir`, `user_messages_n`, `pre_timeout_ms`, `post_timeout_ms`.
132
132
 
133
133
  ### CLI
134
134
 
@@ -623,6 +623,14 @@ they can't change a decision. A plugin that fails to load or raises is skipped w
623
623
  CLI or the daemon. `interlock plugins` lists what's installed; `INTERLOCK_PLUGINS=0` turns them all off. Install a
624
624
  plugin into Interlock's own environment, e.g. `pipx inject interlockd <package>`.
625
625
 
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`
629
+ is internal and can change in any release. Within one `plugin_api.API_VERSION`, names are only added; a breaking
630
+ change bumps the version and keeps the old behaviour, with a deprecation warning, for at least one minor release. A
631
+ plugin that needs a newer API sets `PLUGIN_API = <n>` in its module, and an older interlockd skips it with a message
632
+ to upgrade. `interlock plugins` prints the API version. `tests/test_plugin_api.py` is the contract.
633
+
626
634
  ## 7. Troubleshooting
627
635
 
628
636
  | Symptom | Cause | Fix |
@@ -0,0 +1,70 @@
1
+ AWSTemplateFormatVersion: "2010-09-09"
2
+ Description: >-
3
+ Interlock audit store (optional): one DynamoDB table for the daemon's audit records, on-demand, TTL on expires_at,
4
+ point-in-time recovery, a stream (NEW_IMAGE), three GSIs, encrypted with the AWS-managed DynamoDB key.
5
+ Deploy: aws cloudformation deploy --stack-name interlock-audit --template-file interlock-audit.yaml
6
+ then set "dynamodb_table": "interlock-audit" (and aws_region / aws_profile) in ~/.interlock/config.json.
7
+
8
+ Parameters:
9
+ TableName:
10
+ Type: String
11
+ Default: interlock-audit
12
+ Environment:
13
+ Type: String
14
+ Default: dev
15
+
16
+ Resources:
17
+ AuditTable:
18
+ Type: AWS::DynamoDB::Table
19
+ DeletionPolicy: Retain # deleting the stack keeps your audit records; delete the table yourself
20
+ UpdateReplacePolicy: Retain
21
+ Properties:
22
+ TableName: !Ref TableName
23
+ BillingMode: PAY_PER_REQUEST
24
+ DeletionProtectionEnabled: false
25
+ AttributeDefinitions:
26
+ - { AttributeName: PK, AttributeType: S }
27
+ - { AttributeName: SK, AttributeType: S }
28
+ - { AttributeName: session_id, AttributeType: S }
29
+ - { AttributeName: event_id, AttributeType: S }
30
+ - { AttributeName: GSI2PK, AttributeType: S }
31
+ - { AttributeName: GSI3PK, AttributeType: S }
32
+ KeySchema:
33
+ - { AttributeName: PK, KeyType: HASH }
34
+ - { AttributeName: SK, KeyType: RANGE }
35
+ GlobalSecondaryIndexes:
36
+ - IndexName: GSI1-session
37
+ KeySchema:
38
+ - { AttributeName: session_id, KeyType: HASH }
39
+ - { AttributeName: event_id, KeyType: RANGE }
40
+ Projection: { ProjectionType: ALL }
41
+ - IndexName: GSI2-workspace-time
42
+ KeySchema:
43
+ - { AttributeName: GSI2PK, KeyType: HASH }
44
+ - { AttributeName: event_id, KeyType: RANGE }
45
+ Projection: { ProjectionType: ALL }
46
+ - IndexName: GSI3-review
47
+ KeySchema:
48
+ - { AttributeName: GSI3PK, KeyType: HASH }
49
+ - { AttributeName: event_id, KeyType: RANGE }
50
+ Projection: { ProjectionType: ALL }
51
+ TimeToLiveSpecification: { AttributeName: expires_at, Enabled: true }
52
+ PointInTimeRecoverySpecification: { PointInTimeRecoveryEnabled: true }
53
+ StreamSpecification: { StreamViewType: NEW_IMAGE }
54
+ SSESpecification: { SSEEnabled: true, SSEType: KMS } # AWS-managed key alias/aws/dynamodb
55
+ Tags:
56
+ - { Key: Project, Value: interlock }
57
+ - { Key: Component, Value: audit-store }
58
+ - { Key: Environment, Value: !Ref Environment }
59
+ - { Key: ManagedBy, Value: cloudformation }
60
+
61
+ Outputs:
62
+ TableName:
63
+ Value: !Ref AuditTable
64
+ Export: { Name: !Sub "${AWS::StackName}-TableName" }
65
+ TableArn:
66
+ Value: !GetAtt AuditTable.Arn
67
+ Export: { Name: !Sub "${AWS::StackName}-TableArn" }
68
+ StreamArn:
69
+ Value: !GetAtt AuditTable.StreamArn
70
+ Export: { Name: !Sub "${AWS::StackName}-StreamArn" }
@@ -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.4
12
+ - uses: interlockd/interlock@v0.1.5
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.4"
3
+ __version__ = "0.1.5"
@@ -1824,6 +1824,7 @@ def cmd_plugins(args) -> int:
1824
1824
  print("plugins are off (INTERLOCK_PLUGINS=0)")
1825
1825
  return 0
1826
1826
  found = plugins.load()
1827
+ print(f"plugin API {plugins._api_version()} (interlockd.plugin_api)")
1827
1828
  if not found:
1828
1829
  print(f"no plugins installed (entry-point group {plugins.GROUP})")
1829
1830
  return 0
@@ -0,0 +1,186 @@
1
+ """The stable interface for interlockd plugins (plugin API version 1).
2
+
3
+ Plugins (see `interlockd.plugins`) should use only this module and `interlockd.plugins` hooks. Everything else in
4
+ `interlockd` is internal and may change in any release.
5
+
6
+ Compatibility promise: within one `API_VERSION`, names here are only added, never removed or changed incompatibly.
7
+ A breaking change bumps `API_VERSION`; the previous behaviour stays available, with a deprecation warning, for at
8
+ least one minor release. A plugin that needs a newer API declares `PLUGIN_API = <n>` in its module; an interlockd
9
+ with an older API skips it with a message instead of failing at runtime.
10
+
11
+ `tests/test_plugin_api.py` is the contract: it exercises every name below.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import json
17
+ import os
18
+ from collections.abc import Iterator, Mapping
19
+ from dataclasses import dataclass
20
+ from datetime import UTC, datetime
21
+ from pathlib import Path
22
+ from typing import Any
23
+
24
+ from . import __version__ as INTERLOCKD_VERSION
25
+ from .policy import Policy
26
+
27
+ API_VERSION = 1
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"]
32
+
33
+
34
+ # ---- settings and policy -------------------------------------------------------------------------------------
35
+
36
+ def settings_from_args(args: Any):
37
+ """The daemon `Settings` for a parsed `interlock` command line (honours `--home` and `$INTERLOCK_HOME`)."""
38
+ from .plugins import settings_from_args as _s
39
+
40
+ return _s(args)
41
+
42
+
43
+ def spool_dir(home: str | Path) -> Path:
44
+ """Where the daemon in `home` writes its audit records."""
45
+ from .config import Settings
46
+
47
+ return Settings(home=Path(home).expanduser()).spool_dir
48
+
49
+
50
+ def load_policy(home: str | Path) -> Policy:
51
+ """The user-level policy for the Interlock home `home` (defaults plus `<home>/policy.yaml`), as the daemon loads
52
+ it at startup. Repository and managed layers are applied per call, not here."""
53
+ from .policy import load_policy as _load
54
+
55
+ return _load(None, home=Path(home).expanduser())
56
+
57
+
58
+ def validate_policy(data: Mapping[str, Any]) -> Policy:
59
+ """Validate a whole policy document (a parsed policy.yaml) over the defaults. Raises ValueError, naming the
60
+ problem, when it isn't a valid policy."""
61
+ from .policy import _merge
62
+
63
+ if not isinstance(data, Mapping):
64
+ raise ValueError("a policy document is a mapping") # noqa: TRY004 - one exception type for "not a valid policy"
65
+ doc = {k: v for k, v in data.items() if k not in ("source_paths", "sha256")}
66
+ try:
67
+ return Policy.model_validate(_merge(Policy().model_dump(exclude={"source_paths", "sha256"}), doc))
68
+ except Exception as e: # pydantic ValidationError and merge type errors
69
+ raise ValueError(f"invalid policy: {e}") from e
70
+
71
+
72
+ def managed_policy_path(home: str | Path) -> Path:
73
+ """The managed (tighten-only) policy file for `home`; a plugin that manages policy centrally writes it here."""
74
+ from .policy.managed import managed_path
75
+
76
+ return managed_path(home)
77
+
78
+
79
+ def check_managed_policy(data: Mapping[str, Any], *, base: Policy | None = None,
80
+ home: str | Path | None = None) -> list[str]:
81
+ """Check a document before writing it as the managed policy: it must be a valid policy (ValueError otherwise),
82
+ and it is applied tighten-only over `base` (or the policy loaded from `home`, or the defaults). Returns the keys
83
+ the tighten-only rule ignores (settings that would loosen a decision), so a caller can report them."""
84
+ from .policy.managed import Managed, apply_managed
85
+
86
+ validate_policy(data)
87
+ if base is None:
88
+ base = load_policy(home) if home is not None else Policy()
89
+ _, ignored = apply_managed(base, Managed("(candidate)", "", {k: v for k, v in data.items()
90
+ if k not in ("source_paths", "sha256")}))
91
+ return ignored
92
+
93
+
94
+ def effective_policy(policy: Policy, home: str | Path) -> Policy:
95
+ """`policy` with the managed file in `home` applied (what decisions use); unchanged if there is none."""
96
+ from .policy.managed import apply_managed, read_managed
97
+
98
+ m = read_managed(home)
99
+ return apply_managed(policy, m)[0] if m is not None else policy
100
+
101
+
102
+ # ---- the running daemon -------------------------------------------------------------------------------------------
103
+
104
+ @dataclass(frozen=True)
105
+ class DaemonStatus:
106
+ mode: str # "shadow" or "enforce"
107
+ policy: Policy | None
108
+ judge: str # "ok" (answering), "off" (none configured), "error" (configured, not reachable)
109
+ probe: str # "ok" (a result probe is on) or "off"
110
+ ledger: str # "ok" (spool writable) or "error"
111
+ spool_dir: Path | None
112
+
113
+
114
+ def daemon_status(daemon: Any | None) -> DaemonStatus:
115
+ """What a plugin may report about the daemon handed to `on_serve` (or None, when no daemon runs)."""
116
+ if daemon is None:
117
+ return DaemonStatus("shadow", None, "off", "off", "ok", None)
118
+ pol = getattr(daemon, "policy", None)
119
+ jtype = getattr(getattr(getattr(pol, "judge", None), "primary", None), "type", "none")
120
+ judge = "ok" if getattr(daemon, "backend", None) is not None else ("off" if jtype in (None, "", "none") else "error")
121
+ probe = "ok" if (getattr(daemon, "local_probe", None) or getattr(daemon, "probe", None)) else "off"
122
+ spool = getattr(getattr(daemon, "spool", None), "dir", None)
123
+ ledger = "ok" if spool is None or os.access(spool, os.W_OK) else "error"
124
+ mode = getattr(daemon, "mode", None) or getattr(pol, "mode", None) or "shadow"
125
+ return DaemonStatus(mode, pol, judge, probe, ledger, Path(spool) if spool else None)
126
+
127
+
128
+ def hook_status(home: str | Path) -> list[dict[str, str]]:
129
+ """For each agent hook `interlock init` installed: {"harness", "problem"}, where problem is "" (intact),
130
+ "hook_removed", "shim_missing" or "shim_modified"."""
131
+ from .insights import hook_integrity
132
+
133
+ return [{"harness": h["harness"], "problem": h["problem"]} for h in hook_integrity(Path(home))]
134
+
135
+
136
+ # ---- audit records --------------------------------------------------------------------------------------------
137
+
138
+ @dataclass(frozen=True)
139
+ class Decision:
140
+ """The parts of one audit record a plugin may read. Tool arguments, results and messages are never exposed."""
141
+ received_at: datetime
142
+ kind: str # "pre_action", "post_action" or "control"
143
+ disposition: str # "allow", "ask", "block", "warn", "withhold", ...
144
+ findings: tuple[tuple[str, str], ...] # (rule id, category) per finding
145
+ judged: bool # routed to the judge (answered, or recorded unjudged)
146
+ session_id: str
147
+ selftest: bool # a `interlock selftest` probe, not real agent traffic
148
+
149
+
150
+ def _parse_ts(v: Any) -> datetime | None:
151
+ try:
152
+ ts = datetime.fromisoformat(str(v))
153
+ except ValueError:
154
+ return None
155
+ return ts if ts.tzinfo else ts.replace(tzinfo=UTC)
156
+
157
+
158
+ def decisions(spool: str | Path, since: datetime, until: datetime) -> Iterator[Decision]:
159
+ """Audit records received in [since, until) from the spool directory `spool` (see `spool_dir`), oldest file
160
+ first. Unreadable lines are skipped."""
161
+ root = Path(spool)
162
+ if not root.exists():
163
+ return
164
+ first_day = since.astimezone(UTC).date().isoformat()
165
+ for seg in sorted(root.glob("*.jsonl")):
166
+ if seg.stem < first_day: # one file per UTC day
167
+ continue
168
+ try:
169
+ lines = seg.read_text(encoding="utf-8", errors="replace").splitlines()
170
+ except OSError:
171
+ continue
172
+ for line in lines:
173
+ try:
174
+ rec = json.loads(line)
175
+ except ValueError:
176
+ continue
177
+ if not isinstance(rec, dict):
178
+ continue
179
+ ts = _parse_ts(rec.get("received_at"))
180
+ if ts is None or not since <= ts < until:
181
+ continue
182
+ found = tuple((str(f.get("rule", "")), str(f.get("category", "")))
183
+ for f in rec.get("findings") or [] if isinstance(f, dict))
184
+ sid = str(rec.get("session_id") or "")
185
+ yield Decision(ts, str(rec.get("kind") or ""), str(rec.get("disposition") or ""), found,
186
+ bool(rec.get("answers") or rec.get("unjudged")), sid, sid.startswith("interlock-selftest"))
@@ -11,6 +11,9 @@ The module may define either or both hooks:
11
11
  def on_serve(daemon, home): ... # `interlock serve` started; begin background work, never block.
12
12
  # Return a callable to stop it on shutdown, or None.
13
13
 
14
+ Plugins should use only `interlockd.plugin_api` (the stable, versioned interface) besides these hooks; a module that
15
+ sets `PLUGIN_API = <n>` higher than this interlockd's `plugin_api.API_VERSION` is skipped with a message to upgrade.
16
+
14
17
  Plugins can't change a decision: they run beside the gate, never inside it. A plugin that fails to import or raises
15
18
  in a hook logs one warning and is skipped; it never stops the CLI or the daemon. `INTERLOCK_PLUGINS=0` turns all
16
19
  plugins off. `interlock plugins` lists what's installed.
@@ -67,10 +70,21 @@ def load() -> list[Plugin]:
67
70
  except Exception as e: # noqa: BLE001 - a broken plugin is skipped, never fatal
68
71
  p.error = f"{type(e).__name__}: {e}"
69
72
  log.warning("plugin %s (%s) failed to load and is skipped: %s", p.name, p.target, p.error)
73
+ else:
74
+ need, have = getattr(p.module, "PLUGIN_API", 1), _api_version()
75
+ if not isinstance(need, int) or need > have:
76
+ p.module, p.error = None, f"needs plugin API {need}; this interlockd has {have} (upgrade interlockd)"
77
+ log.warning("plugin %s is skipped: %s", p.name, p.error)
70
78
  _loaded.append(p)
71
79
  return _loaded
72
80
 
73
81
 
82
+ def _api_version() -> int:
83
+ from .plugin_api import API_VERSION
84
+
85
+ return API_VERSION
86
+
87
+
74
88
  def reset() -> None:
75
89
  """Forget loaded plugins (tests)."""
76
90
  global _loaded
@@ -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.4"
19
+ VERSION="0.1.5"
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.4";
14
+ const VERSION = "0.1.5";
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.4"
15
+ VERSION="0.1.5"
16
16
  nl='
17
17
  '
18
18
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "interlockd"
3
- version = "0.1.4"
3
+ version = "0.1.5"
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.4",
3
+ "version": "0.1.5",
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.4";
18
+ export const VERSION = "0.1.5";
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
 
@@ -0,0 +1,121 @@
1
+ """Contract for interlockd.plugin_api (plugin API version 1): every public name, as plugins use it.
2
+
3
+ Changing what a test here expects is a breaking change for plugins: bump API_VERSION (see the module docstring).
4
+ """
5
+
6
+ from __future__ import annotations
7
+
8
+ import argparse
9
+ import inspect
10
+ from datetime import UTC, datetime, timedelta
11
+
12
+ import pytest
13
+
14
+ from interlockd import __version__, plugin_api, plugins
15
+ from interlockd.config import Settings
16
+ from interlockd.models import AdapterInfo, Context, InterlockEvent, ToolCall
17
+ from interlockd.pipeline import Daemon
18
+ from interlockd.policy import Policy
19
+ from interlockd.store.memory import MemoryRepository
20
+ from interlockd.store.spool import Spool
21
+
22
+
23
+ def test_version_one_surface_is_complete():
24
+ assert plugin_api.API_VERSION == 1 and plugin_api.INTERLOCKD_VERSION == __version__
25
+ for name in plugin_api.__all__:
26
+ assert hasattr(plugin_api, name), name
27
+ sigs = {n: list(inspect.signature(getattr(plugin_api, n)).parameters) for n in
28
+ ("settings_from_args", "spool_dir", "load_policy", "validate_policy", "managed_policy_path",
29
+ "check_managed_policy", "effective_policy", "daemon_status", "hook_status", "decisions")}
30
+ assert sigs == {"settings_from_args": ["args"], "spool_dir": ["home"], "load_policy": ["home"],
31
+ "validate_policy": ["data"], "managed_policy_path": ["home"],
32
+ "check_managed_policy": ["data", "base", "home"], "effective_policy": ["policy", "home"],
33
+ "daemon_status": ["daemon"], "hook_status": ["home"], "decisions": ["spool", "since", "until"]}
34
+
35
+
36
+ def test_settings_and_paths(tmp_path, monkeypatch):
37
+ monkeypatch.setenv("INTERLOCK_HOME", str(tmp_path / "ih"))
38
+ s = plugin_api.settings_from_args(argparse.Namespace(home=None))
39
+ assert s.home == tmp_path / "ih"
40
+ assert plugin_api.spool_dir(tmp_path / "ih") == s.spool_dir
41
+ assert plugin_api.managed_policy_path(tmp_path / "ih") == tmp_path / "ih" / "managed-policy.yaml"
42
+
43
+
44
+ def test_policy_load_validate_and_managed(tmp_path):
45
+ home = tmp_path / "ih"; home.mkdir()
46
+ (home / "policy.yaml").write_text("version: 1\nmode: shadow\n", encoding="utf-8")
47
+ pol = plugin_api.load_policy(home)
48
+ assert isinstance(pol, Policy) and pol.mode == "shadow"
49
+
50
+ assert plugin_api.validate_policy({"mode": "enforce"}).mode == "enforce"
51
+ for bad in ({"mode": "sometimes"}, ["not", "a", "mapping"]):
52
+ with pytest.raises(ValueError):
53
+ plugin_api.validate_policy(bad)
54
+
55
+ # tighten-only: switching enforce on is kept, turning a pack off is reported as ignored
56
+ ignored = plugin_api.check_managed_policy({"mode": "enforce", "packs": {"enabled": ["git"]}}, base=pol)
57
+ assert any("packs" in k for k in ignored)
58
+ assert plugin_api.check_managed_policy({"mode": "enforce"}, home=home) == []
59
+ with pytest.raises(ValueError):
60
+ plugin_api.check_managed_policy({"mode": 3})
61
+
62
+ assert plugin_api.effective_policy(pol, home).mode == "shadow" # no managed file
63
+ plugin_api.managed_policy_path(home).write_text("mode: enforce\n", encoding="utf-8")
64
+ eff = plugin_api.effective_policy(pol, home)
65
+ assert eff.mode == "enforce" and eff.sha256 != pol.sha256
66
+
67
+
68
+ def test_daemon_status_and_decisions(tmp_path):
69
+ s = Settings(home=tmp_path / "ih")
70
+ pol = Policy(); pol.mode = "enforce"; pol.trust.workspace_roots = [str(tmp_path)]
71
+ d = Daemon(s, spool=Spool(s.spool_dir), repo=MemoryRepository(), policy=pol)
72
+
73
+ st = plugin_api.daemon_status(d)
74
+ assert (st.mode, st.judge, st.probe, st.ledger, st.spool_dir) == ("enforce", "off", "ok", "ok", s.spool_dir)
75
+ assert st.policy is pol
76
+ assert plugin_api.daemon_status(None).mode == "shadow"
77
+
78
+ before = datetime.now(UTC) - timedelta(seconds=1)
79
+ for cmd in ("git push --force origin main", "ls"):
80
+ d.decide(InterlockEvent(kind="pre_action", adapter=AdapterInfo(name="claude-code"), session_hint="s1",
81
+ tool_call=ToolCall(name="Bash", arguments={"command": cmd}),
82
+ context=Context(cwd=str(tmp_path))))
83
+ got = list(plugin_api.decisions(s.spool_dir, before, datetime.now(UTC) + timedelta(seconds=1)))
84
+ assert [g.disposition for g in got] == ["block", "allow"]
85
+ assert got[0].kind == "pre_action" and not got[0].selftest and isinstance(got[0].received_at, datetime)
86
+ assert "git.force_push_protected_branch" in {r for r, _ in got[0].findings}
87
+ assert all(c.startswith("security.") for _, c in got[0].findings)
88
+ assert list(plugin_api.decisions(s.spool_dir, before - timedelta(days=2), before)) == []
89
+ assert list(plugin_api.decisions(tmp_path / "missing", before, datetime.now(UTC))) == []
90
+
91
+
92
+ def test_decisions_expose_no_tool_content():
93
+ fields = set(plugin_api.Decision.__dataclass_fields__)
94
+ assert fields == {"received_at", "kind", "disposition", "findings", "judged", "session_id", "selftest"}
95
+
96
+
97
+ def test_hook_status_without_init(tmp_path):
98
+ assert plugin_api.hook_status(tmp_path / "ih") == []
99
+
100
+
101
+ def test_plugin_needing_a_newer_api_is_skipped(monkeypatch):
102
+ import types
103
+
104
+ newer = types.ModuleType("needs_v2"); newer.PLUGIN_API = 2
105
+ ok = types.ModuleType("needs_v1"); ok.PLUGIN_API = 1
106
+
107
+ class EP:
108
+ def __init__(self, name, mod):
109
+ self.name, self.value, self.dist, self._m = name, f"{name}.plugin", None, mod
110
+
111
+ def load(self):
112
+ return self._m
113
+
114
+ monkeypatch.setattr(plugins, "_entry_points", lambda: [EP("a_new", newer), EP("b_ok", ok)])
115
+ plugins.reset()
116
+ try:
117
+ loaded = {p.name: p for p in plugins.load()}
118
+ assert loaded["a_new"].module is None and "needs plugin API 2" in loaded["a_new"].error
119
+ assert loaded["b_ok"].module is ok and not loaded["b_ok"].error
120
+ finally:
121
+ plugins.reset()
File without changes
File without changes
File without changes
File without changes
File without changes