@nklisch/pi-enhanced 0.1.3 → 0.1.4

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 (235) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/node_modules/@nklisch/pi-clearance/README.md +10 -5
  3. package/node_modules/@nklisch/pi-clearance/docs/ARCHITECTURE.md +8 -5
  4. package/node_modules/@nklisch/pi-clearance/docs/CONFIGURATION.md +25 -35
  5. package/node_modules/@nklisch/pi-clearance/docs/DEVELOPER_GUIDE.md +13 -11
  6. package/node_modules/@nklisch/pi-clearance/docs/PACK_AUTHORING.md +5 -4
  7. package/node_modules/@nklisch/pi-clearance/docs/PRINCIPLES.md +14 -10
  8. package/node_modules/@nklisch/pi-clearance/docs/REFERENCE_PATTERNS.md +1 -1
  9. package/node_modules/@nklisch/pi-clearance/docs/REVIEWER_PROMPTS.md +12 -8
  10. package/node_modules/@nklisch/pi-clearance/docs/RULE_PACKS.md +1 -1
  11. package/node_modules/@nklisch/pi-clearance/docs/SPEC.md +7 -6
  12. package/node_modules/@nklisch/pi-clearance/docs/TUNE.md +2 -2
  13. package/node_modules/@nklisch/pi-clearance/docs/USER_GUIDE.md +7 -3
  14. package/node_modules/@nklisch/pi-clearance/docs/VISION.md +3 -3
  15. package/node_modules/@nklisch/pi-clearance/native/clearance-core.darwin-x64.node +0 -0
  16. package/node_modules/@nklisch/pi-clearance/native/clearance-core.linux-arm64-gnu.node +0 -0
  17. package/node_modules/@nklisch/pi-clearance/native/clearance-core.win32-arm64-msvc.node +0 -0
  18. package/node_modules/@nklisch/pi-clearance/native/clearance-core.win32-x64-msvc.node +0 -0
  19. package/node_modules/@nklisch/pi-clearance/package.json +9 -5
  20. package/node_modules/@nklisch/pi-clearance/src/config/config-command-plans.ts +79 -3
  21. package/node_modules/@nklisch/pi-clearance/src/config/config-command-writer.ts +7 -1
  22. package/node_modules/@nklisch/pi-clearance/src/config/defaults.ts +42 -0
  23. package/node_modules/@nklisch/pi-clearance/src/config/gated-tools.ts +7 -0
  24. package/node_modules/@nklisch/pi-clearance/src/config/loader.ts +7 -1
  25. package/node_modules/@nklisch/pi-clearance/src/config/pack-enablement-writer.ts +1 -0
  26. package/node_modules/@nklisch/pi-clearance/src/config/paths.ts +14 -3
  27. package/node_modules/@nklisch/pi-clearance/src/config/persistence.ts +135 -0
  28. package/node_modules/@nklisch/pi-clearance/src/config/schema.ts +74 -26
  29. package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCase.ts +1 -1
  30. package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseCategory.ts +1 -1
  31. package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseExpectation.ts +1 -1
  32. package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseResult.ts +1 -1
  33. package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseResultOutcome.ts +1 -1
  34. package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseSource.ts +1 -1
  35. package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialValidationReport.ts +1 -1
  36. package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialValidationStatus.ts +1 -1
  37. package/node_modules/@nklisch/pi-clearance/src/contracts/BashBlock.ts +1 -1
  38. package/node_modules/@nklisch/pi-clearance/src/contracts/BashCommandShape.ts +1 -1
  39. package/node_modules/@nklisch/pi-clearance/src/contracts/BashConditionalArm.ts +1 -1
  40. package/node_modules/@nklisch/pi-clearance/src/contracts/BashControlConstruct.ts +1 -1
  41. package/node_modules/@nklisch/pi-clearance/src/contracts/BashFlag.ts +1 -1
  42. package/node_modules/@nklisch/pi-clearance/src/contracts/BashForLoopKeywordSpans.ts +1 -1
  43. package/node_modules/@nklisch/pi-clearance/src/contracts/BashIteratorEntry.ts +1 -1
  44. package/node_modules/@nklisch/pi-clearance/src/contracts/BashIteratorEntryKind.ts +1 -1
  45. package/node_modules/@nklisch/pi-clearance/src/contracts/BashListOperator.ts +1 -1
  46. package/node_modules/@nklisch/pi-clearance/src/contracts/BashLoopVariableReference.ts +1 -1
  47. package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFact.ts +1 -1
  48. package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFactContext.ts +1 -1
  49. package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFactProvenance.ts +1 -1
  50. package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFactProvenanceEntry.ts +1 -1
  51. package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFacts.ts +1 -1
  52. package/node_modules/@nklisch/pi-clearance/src/contracts/BashPipeline.ts +1 -1
  53. package/node_modules/@nklisch/pi-clearance/src/contracts/BashStage.ts +1 -1
  54. package/node_modules/@nklisch/pi-clearance/src/contracts/BashStageProgram.ts +1 -1
  55. package/node_modules/@nklisch/pi-clearance/src/contracts/BlockOperator.ts +1 -1
  56. package/node_modules/@nklisch/pi-clearance/src/contracts/CapturedOutcome.ts +1 -1
  57. package/node_modules/@nklisch/pi-clearance/src/contracts/CommandFamilyKey.ts +1 -1
  58. package/node_modules/@nklisch/pi-clearance/src/contracts/CommandFamilySummary.ts +1 -1
  59. package/node_modules/@nklisch/pi-clearance/src/contracts/CompileError.ts +1 -1
  60. package/node_modules/@nklisch/pi-clearance/src/contracts/CompositionOperator.ts +1 -1
  61. package/node_modules/@nklisch/pi-clearance/src/contracts/CompoundBodyReason.ts +1 -1
  62. package/node_modules/@nklisch/pi-clearance/src/contracts/CompoundFeatureReason.ts +1 -1
  63. package/node_modules/@nklisch/pi-clearance/src/contracts/CompoundForm.ts +1 -1
  64. package/node_modules/@nklisch/pi-clearance/src/contracts/CompoundIteratorReason.ts +1 -1
  65. package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusEntry.ts +1 -1
  66. package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusExpectedLabel.ts +1 -1
  67. package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusFidelity.ts +1 -1
  68. package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusQueryModel.ts +1 -1
  69. package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusQuerySummary.ts +1 -1
  70. package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusQuerySummarySnapshot.ts +1 -1
  71. package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusRecord.ts +1 -1
  72. package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusSource.ts +1 -1
  73. package/node_modules/@nklisch/pi-clearance/src/contracts/CountByLabel.ts +1 -1
  74. package/node_modules/@nklisch/pi-clearance/src/contracts/Decision.ts +1 -1
  75. package/node_modules/@nklisch/pi-clearance/src/contracts/DecisionEffect.ts +1 -1
  76. package/node_modules/@nklisch/pi-clearance/src/contracts/DecisionProvenance.ts +1 -1
  77. package/node_modules/@nklisch/pi-clearance/src/contracts/DecisionSource.ts +1 -1
  78. package/node_modules/@nklisch/pi-clearance/src/contracts/DiagnosticSeverity.ts +1 -1
  79. package/node_modules/@nklisch/pi-clearance/src/contracts/EffectivePolicy.ts +1 -1
  80. package/node_modules/@nklisch/pi-clearance/src/contracts/EmbeddedShellProjection.ts +1 -1
  81. package/node_modules/@nklisch/pi-clearance/src/contracts/EnvironmentAssignment.ts +1 -1
  82. package/node_modules/@nklisch/pi-clearance/src/contracts/IteratorSourceKind.ts +1 -1
  83. package/node_modules/@nklisch/pi-clearance/src/contracts/LoopQuoteKind.ts +1 -1
  84. package/node_modules/@nklisch/pi-clearance/src/contracts/LoopVariableUnknownReason.ts +1 -1
  85. package/node_modules/@nklisch/pi-clearance/src/contracts/MatcherExpr.ts +1 -1
  86. package/node_modules/@nklisch/pi-clearance/src/contracts/MutationShapeKind.ts +1 -1
  87. package/node_modules/@nklisch/pi-clearance/src/contracts/MutationTrustBoundaryClassification.ts +1 -1
  88. package/node_modules/@nklisch/pi-clearance/src/contracts/MutationTrustBoundaryKind.ts +1 -1
  89. package/node_modules/@nklisch/pi-clearance/src/contracts/PackCompileResult.ts +1 -1
  90. package/node_modules/@nklisch/pi-clearance/src/contracts/PackWarningLevel.ts +1 -1
  91. package/node_modules/@nklisch/pi-clearance/src/contracts/ParsedEvidence.ts +1 -1
  92. package/node_modules/@nklisch/pi-clearance/src/contracts/ParsedShapeSummary.ts +1 -1
  93. package/node_modules/@nklisch/pi-clearance/src/contracts/PathAccess.ts +1 -1
  94. package/node_modules/@nklisch/pi-clearance/src/contracts/PathFactProjectScope.ts +1 -1
  95. package/node_modules/@nklisch/pi-clearance/src/contracts/PathFactsRequirement.ts +1 -1
  96. package/node_modules/@nklisch/pi-clearance/src/contracts/PathFactsResolvedConfig.ts +1 -1
  97. package/node_modules/@nklisch/pi-clearance/src/contracts/PathNormalization.ts +1 -1
  98. package/node_modules/@nklisch/pi-clearance/src/contracts/PathScope.ts +1 -1
  99. package/node_modules/@nklisch/pi-clearance/src/contracts/PathScopeMatcherExpr.ts +1 -1
  100. package/node_modules/@nklisch/pi-clearance/src/contracts/PathScopeMatcherMode.ts +1 -1
  101. package/node_modules/@nklisch/pi-clearance/src/contracts/PathUnknownReason.ts +1 -1
  102. package/node_modules/@nklisch/pi-clearance/src/contracts/PathUsageKind.ts +1 -1
  103. package/node_modules/@nklisch/pi-clearance/src/contracts/PiBuiltinToolOperation.ts +1 -1
  104. package/node_modules/@nklisch/pi-clearance/src/contracts/PiBuiltinToolPathInput.ts +1 -1
  105. package/node_modules/@nklisch/pi-clearance/src/contracts/PiBuiltinToolShape.ts +1 -1
  106. package/node_modules/@nklisch/pi-clearance/src/contracts/PiBuiltinToolSpec.ts +1 -1
  107. package/node_modules/@nklisch/pi-clearance/src/contracts/PiFileMutationToolName.ts +1 -1
  108. package/node_modules/@nklisch/pi-clearance/src/contracts/PiToolMutationFacts.ts +1 -1
  109. package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPack.ts +1 -1
  110. package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPackDocLink.ts +1 -1
  111. package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPackExample.ts +1 -1
  112. package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPackMetadata.ts +1 -1
  113. package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPackWarning.ts +1 -1
  114. package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyRule.ts +1 -1
  115. package/node_modules/@nklisch/pi-clearance/src/contracts/ProposalNotRunReason.ts +1 -1
  116. package/node_modules/@nklisch/pi-clearance/src/contracts/ProposalNotRunSeverity.ts +1 -1
  117. package/node_modules/@nklisch/pi-clearance/src/contracts/QuoteKind.ts +1 -1
  118. package/node_modules/@nklisch/pi-clearance/src/contracts/Redirect.ts +1 -1
  119. package/node_modules/@nklisch/pi-clearance/src/contracts/RedirectStream.ts +1 -1
  120. package/node_modules/@nklisch/pi-clearance/src/contracts/RedirectTargetKind.ts +1 -1
  121. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayCorpus.ts +1 -1
  122. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDelta.ts +1 -1
  123. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaBlockedSummary.ts +1 -1
  124. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaChangedRecord.ts +1 -1
  125. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaFamily.ts +1 -1
  126. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaImprovement.ts +1 -1
  127. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaRegression.ts +1 -1
  128. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaStatus.ts +1 -1
  129. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaTransitionCount.ts +1 -1
  130. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayPathFacts.ts +1 -1
  131. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayReviewerMode.ts +1 -1
  132. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayReviewerOutcome.ts +1 -1
  133. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayStatus.ts +1 -1
  134. package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayedDecision.ts +1 -1
  135. package/node_modules/@nklisch/pi-clearance/src/contracts/ShapeDiagnostic.ts +1 -1
  136. package/node_modules/@nklisch/pi-clearance/src/contracts/SourceFidelity.ts +1 -1
  137. package/node_modules/@nklisch/pi-clearance/src/contracts/SourceSpan.ts +1 -1
  138. package/node_modules/@nklisch/pi-clearance/src/contracts/Substitution.ts +1 -1
  139. package/node_modules/@nklisch/pi-clearance/src/contracts/SubstitutionKind.ts +1 -1
  140. package/node_modules/@nklisch/pi-clearance/src/contracts/ToolCallIdentity.ts +1 -1
  141. package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathAccess.ts +1 -1
  142. package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathFact.ts +1 -1
  143. package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathFactContext.ts +1 -1
  144. package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathFacts.ts +1 -1
  145. package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathUsage.ts +1 -1
  146. package/node_modules/@nklisch/pi-clearance/src/contracts/ToolShape.ts +1 -1
  147. package/node_modules/@nklisch/pi-clearance/src/contracts/UnknownPathBehavior.ts +1 -1
  148. package/node_modules/@nklisch/pi-clearance/src/contracts/UnknownToolShape.ts +1 -1
  149. package/node_modules/@nklisch/pi-clearance/src/contracts/index.ts +1 -1
  150. package/node_modules/@nklisch/pi-clearance/src/index.ts +33 -2
  151. package/node_modules/@nklisch/pi-clearance/src/native/loader.ts +12 -6
  152. package/node_modules/@nklisch/pi-clearance/src/replay/reviewer-config-proposals.ts +7 -4
  153. package/node_modules/@nklisch/pi-clearance/src/runtime/allow-request-message.ts +21 -0
  154. package/node_modules/@nklisch/pi-clearance/src/runtime/auto-reviewer-read-models.ts +165 -8
  155. package/node_modules/@nklisch/pi-clearance/src/runtime/command-registry.ts +1 -1
  156. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/allow.ts +26 -2
  157. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/packs.ts +6 -6
  158. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/scope.ts +5 -5
  159. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/actions.ts +11 -0
  160. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/dispatcher.ts +274 -1
  161. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/model-options.ts +52 -0
  162. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/native-ui.ts +54 -67
  163. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/panels/reviewer.ts +19 -3
  164. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/panels/scope.ts +2 -11
  165. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/panels.ts +10 -1
  166. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/read-model.ts +47 -13
  167. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings.ts +32 -37
  168. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/status.ts +3 -0
  169. package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/types.ts +14 -5
  170. package/node_modules/@nklisch/pi-clearance/src/runtime/handler.ts +36 -0
  171. package/node_modules/@nklisch/pi-clearance/src/runtime/mode-prompt.ts +0 -1
  172. package/node_modules/@nklisch/pi-clearance/src/runtime/model-adapter.ts +5 -1
  173. package/node_modules/@nklisch/pi-clearance/src/runtime/reviewer-context.ts +73 -10
  174. package/node_modules/@nklisch/pi-clearance/src/runtime/reviewer-prompts.ts +186 -175
  175. package/node_modules/@nklisch/pi-clearance/src/runtime/reviewer.ts +26 -6
  176. package/node_modules/@nklisch/pi-plugins/dist/infrastructure/state/local-lock-filesystem.d.ts +23 -1
  177. package/node_modules/@nklisch/pi-plugins/dist/infrastructure/state/local-lock-filesystem.js +46 -50
  178. package/node_modules/@nklisch/pi-plugins/dist/infrastructure/state/local-lock-filesystem.js.map +1 -1
  179. package/node_modules/@nklisch/pi-plugins/dist/runtime/mcp/pi-mcp-adapter-package.js +2 -2
  180. package/node_modules/@nklisch/pi-plugins/dist/runtime/mcp/pi-mcp-adapter-package.js.map +1 -1
  181. package/node_modules/@nklisch/pi-plugins/dist/runtime/mcp/pi-mcp-adapter-runtime.js +2 -2
  182. package/node_modules/@nklisch/pi-plugins/dist/runtime/mcp/pi-mcp-adapter-runtime.js.map +1 -1
  183. package/node_modules/@nklisch/pi-plugins/dist/runtime/subagents/pi-subagents-lifecycle.js +1 -1
  184. package/node_modules/@nklisch/pi-plugins/dist/runtime/subagents/pi-subagents-package.js +2 -2
  185. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/README.md +41 -31
  186. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/dist/public.d.ts +2 -1
  187. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/docs/FORK-MAINTENANCE.md +17 -11
  188. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/docs/VISION.md +14 -7
  189. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/docs/architecture/architecture.md +11 -19
  190. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/docs/comparison-with-upstream.md +58 -53
  191. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/package.json +2 -2
  192. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/agent-type-resolution.ts +43 -0
  193. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/agent-types.ts +11 -6
  194. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/custom-agents.ts +13 -6
  195. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/default-agents.ts +0 -52
  196. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/thinking-levels.ts +12 -0
  197. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/handlers/interrupt.ts +5 -2
  198. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/handlers/lifecycle.ts +3 -3
  199. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/index.ts +7 -6
  200. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/create-subagent-session.ts +7 -2
  201. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/parent-snapshot.ts +11 -3
  202. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent-manager.ts +26 -56
  203. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent-session.ts +48 -9
  204. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent-state.ts +32 -0
  205. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent.ts +105 -17
  206. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/composite-subagent-observer.ts +4 -0
  207. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/notification.ts +50 -46
  208. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/renderer.ts +1 -1
  209. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/subagent-events-observer.ts +15 -0
  210. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/runtime.ts +2 -0
  211. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/service/service-adapter.ts +35 -6
  212. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/service/service.ts +1 -0
  213. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/session/model-label.ts +19 -0
  214. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/session/prompts.ts +24 -1
  215. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/session/session-config.ts +11 -6
  216. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/settings.ts +70 -3
  217. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/agent-tool.ts +27 -10
  218. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/background-spawner.ts +6 -2
  219. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/foreground-runner.ts +12 -3
  220. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/get-result-report.ts +17 -3
  221. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/get-result-tool.ts +13 -20
  222. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/result-renderer.ts +6 -1
  223. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/spawn-config.ts +16 -16
  224. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/steer-tool.ts +12 -4
  225. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/types.ts +2 -2
  226. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/agent-widget.ts +24 -11
  227. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/display.ts +10 -7
  228. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/glyphs.ts +7 -0
  229. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/session-navigation.ts +34 -25
  230. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/session-navigator.ts +30 -10
  231. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/subagents-settings.ts +58 -13
  232. package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/widget-renderer.ts +32 -19
  233. package/node_modules/@nklisch/pi-plugins/package.json +3 -3
  234. package/package.json +1 -1
  235. package/test/verify-bundle.mjs +4 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # Changelog
2
+
3
+ ## v0.1.4
4
+
5
+ ### Changed
6
+
7
+ - Rebundled `@nklisch/pi-clearance` (now v0.2.2) and `@nklisch/pi-plugins` (now v0.3.4). pi-clearance now ships native engine prebuilds for Windows x64, Windows ARM64, Intel Mac, and Linux ARM64 in addition to the prior Linux x64 and Apple Silicon Mac prebuilds, so the bundle activates on every common dev platform instead of refusing to arm. pi-plugins fixes GitHub issue #2 (the macOS filesystem-capability gate that hard-failed plugin-host startup) and removes the over-engineered filesystem-gate class altogether; see the project principle in `docs/PRINCIPLES.md`.
@@ -7,14 +7,16 @@ Pi Clearance is a Pi extension that structurally evaluates tool calls against a
7
7
  ## Mode
8
8
 
9
9
  ```json
10
- { "version": 1, "mode": "ask" }
10
+ { "version": 1 }
11
11
  ```
12
12
 
13
13
  - **Off** — review-bucket calls pass through and are audited; floor and explicit deterministic denies still block.
14
14
  - **Ask** — review-bucket calls prompt the human, with unattended block-and-log fallback.
15
15
  - **Auto** — model reviewer first, then human/block fallback.
16
16
 
17
- The default is `ask`. Choosing Auto through `/clearance setup`, `/clearance settings`, or `/clearance mode auto` shows the model/provider, prompt posture, context, and untrusted-context disclosure before writing global config.
17
+ The default runtime mode is `ask`; a default persisted config is only `{ "version": 1 }`. Choosing Auto through `/clearance`, `/clearance setup`, `/clearance settings`, or `/clearance mode auto` shows the model/provider, prompt posture, context, and untrusted-context disclosure before writing global config.
18
+
19
+ User-owned `global.json` and project overlays written through Clearance are sparse: they contain `version` and only choices that differ from runtime defaults. Package installation does not read, create, repair, or rewrite user config.
18
20
 
19
21
  ## Commands
20
22
 
@@ -30,16 +32,19 @@ The default is `ask`. Choosing Auto through `/clearance setup`, `/clearance sett
30
32
  /clearance why
31
33
  ```
32
34
 
33
- The former profile and auto commands are removed with no aliases. Package installation only makes contributed packs available; user-owned `packEnablement.enabledPackagePacks` must explicitly enable them.
35
+ The former profile and auto commands are removed with no aliases. Package installation makes contributed packs available but does not enable them or change Clearance config; user-owned `packEnablement.enabledPackagePacks` must explicitly enable them.
34
36
 
35
37
  ## Safety model
36
38
 
37
39
  - Shell and typed Pi tools are analyzed structurally.
38
40
  - The sealed floor is always active and cannot be loosened.
39
41
  - Invalid config fails closed to floor-only policy.
40
- - `unknownToolPosture` remains an advanced config-file-only setting and defaults to `review`.
42
+ - Non-Bash tools bypass Clearance by default. Add exact names to global `gatedTools` to opt them into analysis and policy; Bash is always gated and cannot be listed.
43
+ - `unknownToolPosture` remains an advanced config-file-only setting and defaults to `allow`, applying only to opted-in unknown tools.
41
44
  - Model decisions resolve one call and never become policy without Tune approval.
42
45
 
43
- The built-in baseline includes the former default pack set plus network reads, typed network-research tools, and safe-home typed Pi file tools. Reviewer prompt postures (`reviewer.strict`, `reviewer.default`, `reviewer.permissive`) survive as config-file-only advanced options; model pinning remains interactive in the settings UI.
46
+ The non-Bash default bypass intentionally makes typed edit/read protections opt-in. This is a published behavioral break that must be called out in the next minor release; this package is not versioned or published by this change.
47
+
48
+ The built-in baseline includes the former default pack set plus network reads, typed network-research tools, and safe-home typed Pi file tools. Reviewer prompt postures (`reviewer.strict`, `reviewer.default`, `reviewer.permissive`) are confirm-backed settings selectors alongside reviewer model pinning; remaining advanced reviewer fields stay in user-owned config.
44
49
 
45
50
  See [docs/USER_GUIDE.md](docs/USER_GUIDE.md), [docs/CONFIGURATION.md](docs/CONFIGURATION.md), [docs/RULE_PACKS.md](docs/RULE_PACKS.md), [docs/PACK_AUTHORING.md](docs/PACK_AUTHORING.md), and [docs/REVIEWER_PROMPTS.md](docs/REVIEWER_PROMPTS.md).
@@ -4,7 +4,9 @@
4
4
  Pi tool_call
5
5
  -> runtime handler
6
6
  -> config/package/scope resolution
7
- -> structural analyzer
7
+ -> exact non-Bash gate check
8
+ -> absent name: audit allow/bypass -> execute
9
+ -> Bash or opted-in name: structural analyzer
8
10
  -> sealed floor + baseline + overlays
9
11
  -> allow / deny / review
10
12
  -> mode dispatch: passthrough / human / model-first
@@ -28,15 +30,16 @@ TypeScript owns Pi lifecycle, config I/O, package discovery, settings, audit, an
28
30
  - `src/replay/` — TypeScript corpus acquisition and proposal/presentation adapters; replay computation is delegated to native kernels.
29
31
 
30
32
  Release CI builds every declared native target on an appropriate runner, then
31
- stages both `clearance-core.<platform>.node` artifacts into the existing
33
+ stages all six `clearance-core.<platform>.node` artifacts into the existing
32
34
  `@nklisch/pi-clearance` package. The loader selects the matching bundled artifact
33
35
  at runtime. Publishing fails unless every declared target is present, preventing a
34
36
  release that works only on the publisher's host. Installation never builds Rust and
35
- does not create separate platform packages.
37
+ does not create separate platform packages. Clearance defines no npm install
38
+ lifecycle hooks and does not read or write user config during package installation.
36
39
 
37
40
  ## Policy and dispatch
38
41
 
39
- The handler never skips deterministic policy. `dispatchReview` is the only tri-state seam:
42
+ The handler resolves config before dispatch. Bash and exact names in global `gatedTools` use the deterministic pipeline; absent non-Bash names short-circuit before analysis/policy, audit an allow/bypass, and execute. `dispatchReview` is the only tri-state seam for opted-in review results:
40
43
 
41
44
  - `off`: return allow, log `reviewer.decision` with `decisionSource: "mode-off-passthrough"`;
42
45
  - `ask`: human adapter, then block-and-log when unattended;
@@ -46,4 +49,4 @@ Consent is not a runtime state. `mode: "auto"` in explicit user configuration is
46
49
 
47
50
  ## Settings
48
51
 
49
- The settings read model exposes one mode selector. Reviewer details are read-only except interactive model selection. Briefing/display and reviewer prompt/context/budget/escalation writes are advanced config-file concerns. The baseline explorer uses `inBaseline`; it does not expose policy posture membership.
52
+ The settings read model exposes compact selector/toggle rows for mode, reviewer model/posture, scope preset and unknown-path behavior, briefing/display controls, and exact gated non-Bash tools. Every mutation uses the existing planner, confirmation, atomic writer, reload, and policy invalidation path. The baseline explorer uses `inBaseline`; it does not expose policy posture membership. Status exposes one concise customization-category line when non-default settings exist.
@@ -1,6 +1,6 @@
1
1
  # Configuration reference
2
2
 
3
- Pi Clearance uses strict JSON schemas. Missing config is safe and normalizes to `mode: "ask"`; unknown fields are rejected and invalid config causes the composer to use the sealed floor only.
3
+ Pi Clearance uses strict JSON schemas. Missing config is safe and normalizes to `mode: "ask"`; unknown fields are rejected and invalid config causes the composer to use the sealed floor only. Config written through Clearance is sparse: persisted global and project files contain `version` plus only non-default user choices. Defaults remain runtime-only, so the examples below intentionally omit default scaffolding. Package installation never reads, creates, repairs, or rewrites user config.
4
4
 
5
5
  ## Files
6
6
 
@@ -14,23 +14,18 @@ Pi Clearance uses strict JSON schemas. Missing config is safe and normalizes to
14
14
  ```json
15
15
  {
16
16
  "version": 1,
17
- "mode": "ask",
18
- "unknownToolPosture": "allow",
19
- "packs": [],
20
- "packEnablement": {
21
- "enabledPackagePacks": [],
22
- "disabledPackagePacks": [],
23
- "disabledConfigPacks": []
24
- },
25
- "reviewer": {
26
- "promptPosture": "reviewer.default",
27
- "model": null,
28
- "contextMode": "recentContext"
29
- },
30
- "display": { "reviewNote": { "mode": "reason+accent", "showModelLabel": false, "accent": true } }
17
+ "mode": "auto",
18
+ "gatedTools": ["pi.read"],
19
+ "packEnablement": { "enabledPackagePacks": ["example.package-pack"] },
20
+ "reviewer": { "model": "openai/example" },
21
+ "display": { "reviewNote": { "accent": false } }
31
22
  }
32
23
  ```
33
24
 
25
+ A default global config is simply `{ "version": 1 }`. For example, setting only
26
+ `mode` persists `{ "version": 1, "mode": "auto" }`; the omitted reviewer,
27
+ display, pack, and posture fields are supplied by runtime normalization.
28
+
34
29
  `mode` is global-only:
35
30
 
36
31
  | Mode | Review bucket | Deterministic deny |
@@ -39,7 +34,9 @@ Pi Clearance uses strict JSON schemas. Missing config is safe and normalizes to
39
34
  | `ask` | human prompt; unattended calls block-and-log | deny |
40
35
  | `auto` | model first, then human/block fallback | deny |
41
36
 
42
- `unknownToolPosture` remains a config-file-only knob and feeds the review bucket before mode dispatch. It defaults to `"allow"`: non-bash tools without a registered analyzer are ungated (audit-logged), matching bash-focused clearance. Setting it to `"review"` or `"deny"` re-gates those tools. The sealed floor and all active user/shipped deny rules run in every mode.
37
+ `gatedTools` is a global exact-name list and defaults to empty. Non-Bash tools absent from the list bypass Clearance analysis and policy entirely, execute, and receive an audit entry marked as an allow/bypass. There are no wildcards or future-tool opt-ins, and `bash` cannot be listed. Bash remains fully gated. This intentionally makes typed edit/read protections opt-in and is a published behavioral break for the next minor release.
38
+
39
+ `unknownToolPosture` remains a config-file-only knob and applies only to an opted-in non-Bash tool that has no registered analyzer. It defaults to `"allow"`; it does not re-gate tools absent from `gatedTools`. Setting it to `"review"` or `"deny"` tightens opted-in unknown tools. The sealed floor and all active user/shipped deny rules run in every mode.
43
40
 
44
41
  There is no `defaultPosture`, `maxPosture`, project/repository `posture`, `reviewer.enabled`, or `reviewer.mode`. Those legacy keys are not translated; strict validation rejects them and runtime falls back to floor-only policy. There is no consent file or Clearance trust record: explicit `mode: "auto"` is the acknowledgment, and existing trust files are inert.
45
42
 
@@ -48,25 +45,18 @@ There is no `defaultPosture`, `maxPosture`, project/repository `posture`, `revie
48
45
  ```json
49
46
  {
50
47
  "version": 1,
51
- "packs": [],
52
- "packEnablement": {
53
- "enabledPackagePacks": [],
54
- "disabledPackagePacks": [],
55
- "disabledConfigPacks": []
56
- },
57
48
  "projectScope": {
58
- "roots": [], "writableDirectories": [], "tempDirectories": [],
59
- "deniedDirectories": [], "safeHomeDirectories": [],
60
- "safeHomeUseDefaults": true,
61
- "agentSupportDirectories": [], "agentSupportUseDefaults": true,
62
- "unknownPathBehavior": "review",
63
- "sensitivePathBehavior": "review",
64
- "homePathBehavior": "allow"
49
+ "roots": ["packages"],
50
+ "safeHomeUseDefaults": false,
51
+ "homePathBehavior": "review"
65
52
  },
66
- "promptAppends": []
53
+ "promptAppends": ["Prefer the project test command."]
67
54
  }
68
55
  ```
69
56
 
57
+ A default project overlay is `{ "version": 1 }`. Non-default nested scope
58
+ fields are retained without persisting the other scope defaults.
59
+
70
60
  `unknownPathBehavior` and `sensitivePathBehavior` are ceilings, not just knobs: even `review` emits a config-derived rule so no allow can auto-clear unknown or sensitive-home (credentials, keys, auth files) paths, and `deny` hard-blocks them. One exception: scope classification puts writable-project/project ahead of sensitive-home, so a sensitive location explicitly made a project root classifies as project and the sensitive ceiling does not fire there. `homePathBehavior: "review"` sends any command touching home paths to review. Configured `deniedDirectories` deny outright at the effective-policy level. These rules compose as the derived `config.scope.behavior` pack; they never appear in `/clearance packs` because they are a projection of config, not a discoverable pack.
71
61
 
72
62
  Three presets bundle the behavior fields and apply via `/clearance scope preset <project|home|unrestricted>` or the settings scope panel: **project** (safe-home/agent-support defaults off, home paths review), **home** (defaults on, home reads allowed, sensitive review), **unrestricted** (defaults on, sensitive denied). Presets never touch path lists; a mixed configuration reads as "custom".
@@ -77,7 +67,7 @@ Mode cannot be set per project. Repository policy has `version`, `packs`, and `p
77
67
 
78
68
  ## Reviewer advanced settings
79
69
 
80
- The surviving config-file-only reviewer fields are `promptPosture` (default `reviewer.default`), `promptAppends`, `projectPromptAppends`, `promptOverride`, `model`, `tokenBudget`, `contextMode` (default `recentContext`), `recentContext`, and `escalation`. Reviewer model selection is interactive in the settings UI (chosen from available models with configured auth); the other advanced fields are read-only there. `display.reviewNote` preferences (mode, model label, accent) are editable in the settings Stream briefing panel. The shipped prompt ids are `reviewer.strict`, `reviewer.default`, and `reviewer.permissive`.
70
+ The reviewer settings selector exposes `promptPosture` and `model` interactively; both changes use Pi confirmation and write only user-owned config. The remaining config-file-only reviewer fields are `promptAppends`, `projectPromptAppends`, `promptOverride`, `tokenBudget`, `contextMode` (default `recentContext`), `recentContext` (including `conversationTurns`, `userTurns` default `5`, and the shared `conversationCharLimit`), and `escalation`. `display.reviewNote` preferences (mode, model label, accent) are editable in the settings Stream briefing panel. The shipped prompt ids are `reviewer.strict`, `reviewer.default`, and `reviewer.permissive`.
81
71
 
82
72
  ## Packs
83
73
 
@@ -85,10 +75,10 @@ The baseline is always the old default pack set plus `bash.network.read`, `pi.ex
85
75
 
86
76
  ## Commands
87
77
 
88
- - `/clearance setup` — one mode selector; choosing Auto shows the model/context disclosure in the confirmation card.
89
- - `/clearance mode [off|ask|auto]` — read/select or set the global mode; writes require UI confirmation.
90
- - `/clearance settings` — control center; mode is the only behavioral dial.
78
+ - `/clearance` and `/clearance setup` — open guided setup; choosing Auto shows the model/context disclosure in the confirmation card.
79
+ - `/clearance mode [off|ask|auto]` — read/select or set the global mode; writes require UI confirmation. Without an argument it opens settings.
80
+ - `/clearance settings` — compact control center with selector/toggle rows, including exact gated non-Bash tools.
91
81
  - `/clearance status`, `/clearance packs`, `/clearance scope`, `/clearance tune`, `/clearance why` — unchanged surfaces with mode/baseline vocabulary. Scope management also supports `scope agent-support add|remove <path>` and `scope agent-support-defaults <on|off>`.
92
82
  - `/clearance allow <plain language>` or `/clearance allow` — hand an agent-authored structural allow request to the shared proposal card. Accepted rules land in the user-global pack; this command adds no separate config surface.
93
83
 
94
- `/clearance profile` and `/clearance auto` are removed with no aliases.
84
+ `/clearance profile` and `/clearance auto` are removed with no aliases. The next minor release must call out the non-Bash default bypass and the typed-tool protection break.
@@ -8,7 +8,7 @@ For product behavior, start with [README.md](../README.md) and [USER_GUIDE.md](U
8
8
 
9
9
  ## Requirements
10
10
 
11
- - Node.js 24 or newer
11
+ - Node.js 22.18 or newer
12
12
  - npm 11
13
13
  - a stable Rust toolchain for native builds and tests
14
14
  - Pi, when testing the extension in a real session
@@ -50,10 +50,10 @@ Node-API addon, not a package-install build:
50
50
 
51
51
  Pi loads `src/index.ts` as the extension composition root. `src/native/loader.ts`
52
52
  resolves the matching artifact from the package's `native/` directory. A missing
53
- artifact refuses to arm the extension; no install script or Cargo fallback exists.
54
- Native builds are contributor- and release-only. Release CI builds every declared
55
- target and stages all artifacts into the existing Pi Clearance package before
56
- publishing.
53
+ artifact refuses to arm the extension. The package has no npm install lifecycle
54
+ hooks: installation neither invokes Cargo nor reads or writes user config. Native
55
+ builds are contributor- and release-only. Release CI builds every declared target
56
+ and stages all artifacts into the existing Pi Clearance package before publishing.
57
57
 
58
58
  Shipped interfaces:
59
59
 
@@ -97,6 +97,7 @@ README.md or docs/*.md # docs linked from pack metadata
97
97
  The registration payload provides package provenance (`name`, optional `version`, install kind,
98
98
  source spec, package path, entrypoint path) for display and audit. Provenance is not trust:
99
99
  installation makes packs visible in the registry, while user-owned config enables them later.
100
+ Installation does not change Clearance settings.
100
101
  Bad registrations produce issues and no active policy. `/reload` clears the in-memory snapshot
101
102
  and asks package extensions to register again. Contributor extensions should keep the unsubscribe
102
103
  returned by `pi.events.on` and call it from `session_shutdown`; Pi reuses the event bus across
@@ -132,7 +133,7 @@ package README snippets.
132
133
 
133
134
  The primary command surface is `/clearance`, `/clearance setup`, `/clearance mode [off|ask|auto]`, `/clearance settings`, `/clearance status`, `/clearance packs`, `/clearance scope`, `/clearance tune`, and `/clearance why`. The former profile and auto commands are removed with no aliases.
134
135
 
135
- Bare `/clearance` and `/clearance settings` open the native in-chat settings component in `src/runtime/config-commands/settings/native-ui.ts`. There is intentionally no markdown fallback for settings: hosts without Pi's `ctx.ui.custom()` surface get a no-write unavailable result instead of a transcript dump.
136
+ Bare `/clearance` opens guided setup; `/clearance settings` opens the native in-chat settings component in `src/runtime/config-commands/settings/native-ui.ts`; `/clearance mode` without an argument also opens settings. There is intentionally no markdown fallback for settings: hosts without Pi's `ctx.ui.custom()` surface get a no-write unavailable result instead of a transcript dump.
136
137
 
137
138
  Settings panels must route every mutation through `dispatchSettingsAction` in `src/runtime/config-commands/settings/dispatcher.ts`. The stable action ids live in `SettingsActionId` in `src/runtime/config-commands/settings/actions.ts`. That type is the single list panels use for both write actions and drill actions.
138
139
 
@@ -151,17 +152,18 @@ The dispatcher keeps settings writes on the same path as direct commands: existi
151
152
 
152
153
  1. Pi fires `session_start`; the policy resolver warms the config cache.
153
154
  2. Pi fires `tool_call`.
154
- 3. The TypeScript runtime sends the tool input plus resolved scope/config snapshot into the lazy native engine.
155
- 4. The Rust core analyzes the tool input, parses bash structurally, derives path facts, validates/compiles data packs, and evaluates effective policy.
156
- 5. The native policy result returns `allow`, `deny`, or `review`.
157
- 6. `review` goes through the runtime reviewer path:
155
+ 3. The TypeScript runtime resolves exact `gatedTools`; an absent non-Bash name is audit-logged as allow/bypass and executes without analyzer or policy evaluation. Bash and opted-in names continue through the shared path.
156
+ 4. The TypeScript runtime sends the tool input plus resolved scope/config snapshot into the lazy native engine.
157
+ 5. The Rust core analyzes the tool input, parses bash structurally, derives path facts, validates/compiles data packs, and evaluates effective policy.
158
+ 6. The native policy result returns `allow`, `deny`, or `review`.
159
+ 7. `review` goes through the runtime reviewer path:
158
160
  - token-budget gate;
159
161
  - optional recent-context gathering;
160
162
  - model adapter when global Clearance mode is `auto`;
161
163
  - temporary escalation/contention labels for repeated denies or unresolved calls;
162
164
  - human UI fallback only after the model path is unavailable, fails, or denies/escalates;
163
165
  - block-and-log fallback.
164
- 7. Audit entries are written for policy and reviewer decisions.
166
+ 8. Audit entries are written for policy and reviewer decisions.
165
167
 
166
168
  Do not move safety decisions into prompt text. Prompt text is for runtime review only; deterministic policy remains the source of truth for fast paths and hard blocks.
167
169
 
@@ -7,8 +7,8 @@ model review.
7
7
  Use this order:
8
8
 
9
9
  1. **Enable an existing shipped or package-contributed pack** if one already matches the
10
- workflow. Package installation only makes packs available; enablement still goes through
11
- user-owned config and approval.
10
+ workflow. Package installation makes packs available but does not enable them or change
11
+ Clearance config; enablement still goes through user-owned config and approval.
12
12
  2. **Write a data pack** when the policy can be expressed with the matcher DSL. Normal file
13
13
  editing can create a global or project raw pack definition in `packs`, but broadening policy
14
14
  still needs schema validation, sealed-floor checks, replay evidence, and approval.
@@ -386,8 +386,9 @@ Package-distributed collection checklist:
386
386
  - unsubscribe request listeners on `session_shutdown`;
387
387
  - never imply installation enables policy.
388
388
 
389
- Installing a Pi package makes contributed packs discoverable. It does not enable them. Users
390
- enable package pack ids through user-owned global or project `packEnablement.enabledPackagePacks`,
389
+ Installing a Pi package makes contributed packs discoverable. It does not enable them or
390
+ change Clearance config. Users enable package pack ids through user-owned global or project
391
+ `packEnablement.enabledPackagePacks`,
391
392
  usually via `/clearance packs`. Live Pi tune tools replay and validate package-pack
392
393
  enablement against the current package-registration snapshot collected from the event bus. A
393
394
  helper or offline replay path that lacks such a snapshot is lower fidelity: it marks package
@@ -48,17 +48,20 @@ pretends the floor is still active.
48
48
  ## 5. Review is the safe default for uncertainty
49
49
 
50
50
  Parse failure, unsupported shell syntax, invalid config, ambiguous policy conflicts,
51
- unknown tools, model failure, and missing UI all move toward `review` or
51
+ opted-in unknown tools, model failure, and missing UI all move toward `review` or
52
52
  block-and-log. They never become auto-allow by accident.
53
53
 
54
- `unknownToolPosture` defaults to `"allow"`: tools without a registered analyzer (non-bash
55
- extension and MCP tools) are ungated, because no structural analysis exists for them and
56
- review of an opaque tool is guesswork. Bash is always fully gated. Setting it to `"review"`
57
- or `"deny"` is an explicit tightening knob: those calls then bypass bash-specific structural
58
- analysis and the sealed bash deny floor when allowed, and carry no safety guarantee.
54
+ Non-Bash extension and MCP tools are ungated by default because harness availability is
55
+ the host approval boundary. Global `gatedTools` is an exact-name opt-in list with no
56
+ wildcards or future-tool consent; Bash is always fully gated and cannot be listed. An
57
+ opted-in tool without a registered analyzer uses `unknownToolPosture`, which defaults to
58
+ `"allow"` and may be tightened to `"review"` or `"deny"`. The posture does not apply to
59
+ absent names, and the next minor release must communicate this intentional typed-tool
60
+ protection break.
59
61
 
60
- **Implication:** the interpreter must be pure and total: every input returns `allow`,
61
- `deny`, or `review` with a reason.
62
+ **Implication:** the interpreter must be pure and total for gated calls: every analyzed
63
+ or opted-in unknown input returns `allow`, `deny`, or `review` with a reason; bypasses are
64
+ separately audit-visible.
62
65
 
63
66
  ## 6. Policy growth is agent-mediated, Pi-native, and user-approved
64
67
 
@@ -133,8 +136,9 @@ redacted, and clearly labeled as untrusted context.
133
136
  ## 11. Generalize only after a second tool earns it
134
137
 
135
138
  Bash is the proving ground. Other Pi tools should get analyzers when real history shows
136
- repeated review friction or safety ambiguity. The analyzer seam should be simple, but the
137
- policy model should not be warped around hypothetical tools.
139
+ repeated review friction or safety ambiguity, and users must explicitly opt those tools
140
+ into Clearance through exact names. The analyzer seam should be simple, but the policy
141
+ model should not be warped around hypothetical tools.
138
142
 
139
143
  **Implication:** implement bash deeply before abstracting the whole product around generic
140
144
  tool policy.
@@ -266,7 +266,7 @@ Package-shape facts to carry forward:
266
266
  - Bash parser grammar source: `tree-sitter-bash`; the active product target routes runtime
267
267
  parsing through the Rust native clearance core rather than a JavaScript/WASM parser
268
268
  dependency shape.
269
- - Node engine: `node >=22`, matching the Pi host runtime expectation.
269
+ - Node engine: `node >=22.18`, matching the Pi host runtime expectation. Pi loads the package's TypeScript extension entrypoint directly.
270
270
 
271
271
  Cleanup inputs only:
272
272
 
@@ -4,17 +4,21 @@ The model reviewer runs only after deterministic policy returns `review` and onl
4
4
 
5
5
  ## Advanced config knob
6
6
 
7
- `reviewer.promptPosture` is a config-file-only advanced setting. It defaults statically to `reviewer.default` and accepts:
7
+ `reviewer.promptPosture` is an advanced setting exposed as a confirm-backed selector in the settings UI, alongside reviewer model pinning. It defaults statically to `reviewer.default` and accepts:
8
8
 
9
- - `reviewer.strict` — conservative uncertainty handling;
10
- - `reviewer.default` — balanced bounded project workflow review;
11
- - `reviewer.permissive` — broader trusted-project context while retaining floor/secret/system safeguards.
9
+ - `reviewer.strict` — proof-complete structural evidence; missing, conflicting, or parser-uncertain evidence is denied.
10
+ - `reviewer.default` — parsed structural facts plus clear, relevant user intent must resolve material uncertainty.
11
+ - `reviewer.permissive` — practical trust for ordinary non-destructive work across projects and systems, while concrete danger, the sealed floor, secrets, and high-impact destructive authorization boundaries still govern.
12
12
 
13
- The prompt posture is no longer derived from a policy profile because policy profiles were removed. `promptAppends`, trusted project appends, and a full `promptOverride` survive as advanced config fields. Unknown `reviewer.*` fragments fail closed.
13
+ The three shipped fragments are evidence thresholds, not tool or workflow allowlists. The shared contract carries universal safeguards and threshold-neutral shape evidence guidance; it does not contain a proof-complete allow gate. Strict owns the proof-complete requirement, default owns the parsed-facts-plus-intent requirement, and permissive owns the practical-trust rule.
14
+
15
+ Under permissive, ordinary non-destructive repository and system operations—including expected edits, replacements, deletions, and cleanup—may cross project and system boundaries and do not require task-specific authorization. Missing task specificity, an unfamiliar target, or a boundary crossing is neutral by itself. Permissive may proceed when parser evidence is incomplete unless concrete evidence shows meaningful danger. Clearly destructive operations against external or high-impact targets—such as cloud or production resources, shared remote state, mass deletion, or secret/credential access—require recent, relevant user-authored authorization for that risk and target scope. Assistant and extension text, tool output, repository text, and generated Clearance briefs can provide context but never authorization.
16
+
17
+ `promptAppends`, trusted project appends, and a full `promptOverride` survive as advanced config fields. Unknown `reviewer.*` fragments fail closed.
14
18
 
15
19
  ## Context
16
20
 
17
- `contextMode` defaults to `recentContext`. `minimal` sends the current call, parsed shape, policy result, and prompt summary. `recentContext` adds bounded, redacted recent decisions and conversation turns. That context is explicitly untrusted intent evidence, never policy, precedent, or instructions.
21
+ `contextMode` defaults to `recentContext`. `minimal` sends the current call, parsed shape, policy result, and prompt summary. `recentContext` adds bounded, redacted recent decisions, a separate user-authored intent section, and mixed recent conversation turns. `recentContext.userTurns` defaults to `5`; `conversationTurns` remains the mixed recent-conversation cap, and user turns are deduplicated from the general section. Custom-role extension messages are excluded. All context is explicitly untrusted intent evidence, never policy, precedent, or instructions.
18
22
 
19
23
  `tokenBudget` is windowed and unlimited by default. `escalation` records contention but does not bypass the first model attempt when Auto mode has a usable model.
20
24
 
@@ -24,7 +28,7 @@ The Auto mode confirmation card discloses the configured/fallback model and prov
24
28
 
25
29
  ## Prompt contract
26
30
 
27
- The assembled prompt must preserve the required response schema:
31
+ The assembled prompt must preserve the required response schema. The model request also carries the current deterministic decision reason and provenance as a separately labelled fact/data field outside prompt fragment assembly, so prompt overrides cannot hide why the call reached review:
28
32
 
29
33
  ```text
30
34
  {"decision":"allow"|"deny","reason":"short explanation"}
@@ -34,4 +38,4 @@ Commands, tool output, repository text, recent decisions, and conversation excer
34
38
 
35
39
  ## Model selection
36
40
 
37
- `reviewer.model` remains interactive in the settings UI and can pin `provider/modelId`; the panel otherwise displays reviewer settings read-only. The model falls back to the active Pi session model when no explicit pin is available.
41
+ `reviewer.model` is also interactive in the settings UI and can pin `provider/modelId`; selecting either the model or prompt posture still requires confirmation before writing user-owned config. The remaining reviewer details are read-only in that panel and remain advanced config fields. The model falls back to the active Pi session model when no explicit pin is available. Only genuine user-authored session turns can authorize clearly destructive operations against external or high-impact targets; assistant and extension text may contextualize but cannot authorize them.
@@ -53,7 +53,7 @@ The baseline also includes the formerly permissive-only network and home surface
53
53
  - `pi.extension.network-research`;
54
54
  - `pi.home.safe`.
55
55
 
56
- Typed Pi `read`, `ls`, `find`, `grep`, `fffind`, and `ffgrep` calls are baseline-allowable when every path fact is proven inside project/temp, non-secret `home`, or `agent-support` scope. `safe-home` remains covered by the home pack, while typed mutations remain `safe-home`-only. The non-secret home read decision is intentionally baseline-wide now that postures are gone: the sealed floor remains non-overridable, and the sensitive-home catalog is the explicit carveout for credential harbors. System and outside paths therefore remain review-gated. Denied, unknown, and sensitive-home paths are governed by the config-derived `config.scope.behavior` rules: configured denied directories deny outright, while unknown and sensitive-home paths are ceilings that review or deny per `projectScope` behavior fields.
56
+ When a typed tool is explicitly listed in global `gatedTools`, its `read`, `ls`, `find`, `grep`, `fffind`, and `ffgrep` calls are baseline-allowable when every path fact is proven inside project/temp, non-secret `home`, or `agent-support` scope. Unlisted non-Bash typed tools bypass these packs by design. `safe-home` remains covered by the home pack, while opted-in typed mutations remain `safe-home`-only. The non-secret home read decision is intentionally baseline-wide now that postures are gone: the sealed floor remains non-overridable, and the sensitive-home catalog is the explicit carveout for credential harbors. System and outside paths therefore remain review-gated. Denied, unknown, and sensitive-home paths are governed by the config-derived `config.scope.behavior` rules: configured denied directories deny outright, while unknown and sensitive-home paths are ceilings that review or deny per `projectScope` behavior fields.
57
57
 
58
58
  Mode is a review-dispatch choice, not a policy-pack selector. Conditional extension packs activate only when their owning tools are registered. Package-contributed packs are available for discovery but never active until user-owned `packEnablement.enabledPackagePacks` explicitly enables them.
59
59
 
@@ -6,21 +6,22 @@ Pi Clearance is a Pi extension that structurally analyzes tool calls, evaluates
6
6
 
7
7
  - The sealed deny floor always evaluates first and cannot be loosened.
8
8
  - The Rust policy interpreter is pure and total: every call resolves to `allow`, `deny`, or `review`.
9
- - Parser/analyzer uncertainty, unknown tools, invalid config, and ambiguous conflicts fail closed.
9
+ - Parser/analyzer uncertainty, opted-in unknown tools, invalid config, and ambiguous conflicts fail closed; non-Bash tools absent from exact `gatedTools` bypass Clearance and are audit-logged as allow/bypass.
10
10
  - Mode is global-only and is the single behavioral dial: `off`, `ask`, or `auto`.
11
11
  - Mode changes only dispatch of `review`: Off passes through and audits; Ask prompts a human; Auto uses model-first review with human/block fallback.
12
12
  - Off still honors floor, user, shipped, repository, and package deny rules.
13
13
  - Model output resolves one call and cannot edit policy or loosen the floor.
14
14
  - User-owned global/project config may add policy; repository policy is tighten-only unless Pi reports the project as trusted.
15
- - Package installation makes packs available, not active. Explicit user-owned enablement is required.
15
+ - Package installation makes packs available, not active. Explicit user-owned enablement is required. Clearance defines no npm install lifecycle hooks and package installation never reads or writes user config.
16
+ - Global and project config written through Clearance is sparse: `version` plus recursively retained non-default user choices. Defaults remain runtime-only. Invalid or obsolete files fail strict validation and runtime falls back to floor-only policy; package installation does not migrate them.
16
17
  - Pre-public migrations are clean cutovers. Removed keys fail strict schema validation; there are no translators or aliases. Trusted TypeScript rule modules are deliberately cut and are never loaded.
17
- - The native engine is distributed as prebuilt Node-API artifacts for Linux x64 glibc and macOS arm64. Installation never runs Cargo; a missing or unsupported artifact fails closed.
18
+ - The native engine is distributed as prebuilt Node-API artifacts for Linux x64 glibc, Linux arm64 glibc, macOS x64, macOS arm64, Windows x64 MSVC, and Windows arm64 MSVC. Installation never runs Cargo; a missing or unsupported artifact fails closed.
18
19
 
19
20
  ## Config
20
21
 
21
- `GlobalConfigSchema` contains `version`, `mode` (default `ask`), `unknownToolPosture`, packs, package/config enablement, reviewer advanced fields, and display preferences. Project overlays contain packs, enablement, project scope, and trusted prompt appends. Repository policy has no mode or posture.
22
+ `GlobalConfigSchema` contains `version`, `mode` (default `ask`), exact `gatedTools` (default empty; Bash and wildcards rejected), `unknownToolPosture`, packs, package/config enablement, reviewer advanced fields, and display preferences. Project overlays contain packs, enablement, project scope, and trusted prompt appends. Repository policy has no mode or posture. The complete schemas normalize runtime views; `src/config/persistence.ts` owns the sparse persisted representation.
22
23
 
23
- The former policy posture system and reviewer `enabled`/`mode` fields are removed. Reviewer model pinning remains an interactive settings action; other reviewer advanced knobs are config-file-only. The separate reviewer consent schema/file is removed; explicit `mode: "auto"` is the acknowledgment.
24
+ The former policy posture system and reviewer `enabled`/`mode` fields are removed. Reviewer model pinning and the compact selector/toggle settings controls remain confirm-backed. The separate reviewer consent schema/file is removed; explicit `mode: "auto"` is the acknowledgment. The next minor release must communicate the intentional typed-tool bypass behavior break.
24
25
 
25
26
  ## Native boundary
26
27
 
@@ -42,4 +43,4 @@ The baseline is the former default pack set plus `bash.network.read`, `pi.extens
42
43
 
43
44
  ## Commands
44
45
 
45
- `/clearance setup`, `/clearance mode [off|ask|auto]`, `/clearance settings`, `/clearance status`, `/clearance packs`, `/clearance scope`, `/clearance tune`, `/clearance why`, `/clearance allow <plain language>`, and `/clearance allow`. The allow handler only hands a deterministic brief to the agent; it does not construct policy or call the reviewer. `/clearance profile` and `/clearance auto` are removed.
46
+ `/clearance`, `/clearance setup`, `/clearance mode [off|ask|auto]`, `/clearance settings`, `/clearance status`, `/clearance packs`, `/clearance scope`, `/clearance tune`, `/clearance why`, `/clearance allow <plain language>`, and `/clearance allow`. The allow handler only hands a deterministic brief to the agent; it does not construct policy or call the reviewer. `/clearance profile` and `/clearance auto` are removed.
@@ -25,8 +25,8 @@ The safe loop is:
25
25
  6. write only user-owned config;
26
26
  7. reload, validate, and replay again.
27
27
 
28
- Runtime reviewer decisions are evidence, not permanent policy. Package installation only makes packs available; Tune must still show and approve explicit enablement. Trusted TypeScript rule-module proposals are removed; Tune emits only inspectable data-pack and core-matcher design inputs.
28
+ Runtime reviewer decisions are evidence, not permanent policy. Package installation makes packs available but does not enable them or change Clearance config; Tune must still show and approve explicit enablement. Trusted TypeScript rule-module proposals are removed; Tune emits only inspectable data-pack and core-matcher design inputs.
29
29
 
30
30
  The product interface is Pi-native. Helper executables are plumbing for tests and debugging, not the user's control surface.
31
31
 
32
- `/clearance allow` is the user-initiated entry point: it hands a deterministic authoring brief to the agent (one draft per named family, batches kept focused) and feeds the same `clearance_propose`/`clearance_present` approval pipeline. Tune remains the corpus-evidence batch surface; it sizes proposals from replay history rather than a single user request.
32
+ `/clearance allow` is the user-initiated entry point: it sends a displayed Pi custom message of type `clearance.allow-request` containing a clearly `[Pi Clearance]`-labelled deterministic authoring brief to the agent (one draft per named family, batches kept focused). Idle sessions trigger a turn; busy sessions queue the message as a follow-up. It never impersonates a user turn and feeds the same `clearance_propose`/`clearance_present` approval pipeline. Tune remains the corpus-evidence batch surface; it sizes proposals from replay history rather than a single user request.
@@ -16,6 +16,8 @@ Setup presents one selector:
16
16
 
17
17
  Selecting Auto shows the model/provider, prompt posture, context, and untrusted-context disclosure in the confirmation card before writing `mode: "auto"` to `global.json`.
18
18
 
19
+ Global and project config written through Clearance is persisted sparsely. Package installation does not read, create, repair, or rewrite user config.
20
+
19
21
  ## Commands
20
22
 
21
23
  ```text
@@ -32,7 +34,7 @@ Selecting Auto shows the model/provider, prompt posture, context, and untrusted-
32
34
  /clearance allow
33
35
  ```
34
36
 
35
- `/clearance profile` and `/clearance auto` were removed before release. There are no aliases. Settings mutations require interactive confirmation and write only user-owned config.
37
+ Bare `/clearance` opens guided setup. `/clearance mode` without an argument still opens settings. `/clearance profile` and `/clearance auto` were removed before release. There are no aliases. Settings mutations require interactive confirmation and write only user-owned config.
36
38
 
37
39
  ## Allow a command family
38
40
 
@@ -55,14 +57,16 @@ Review surfaces speak plain language. The human approval card shows what the com
55
57
 
56
58
  ## Settings
57
59
 
58
- The settings control center exposes the mode selector, a pack explorer with enable/disable toggles for installed package packs, the project scope panel (presets, path lists, and a full raw/resolved scope dossier), reviewer model selection from available models, and the Stream briefing panel for `display.reviewNote` preferences (reason text, model label, accent, or off). Prompt posture, context mode, token budget, escalation, prompt appends, and overrides remain advanced config-file settings.
60
+ The settings control center uses compact selector/toggle rows. It exposes mode, reviewer model and evidence posture, scope preset and unknown-path behavior, a pack explorer, exact gated non-Bash tools, and Stream briefing preferences (note mode, model label, accent). Every mutation uses confirmation, the config planner, atomic write, reload, and policy invalidation. Advanced context, budget, escalation, prompt appends, and overrides remain config-file settings; status names their customization categories without dumping values.
59
61
 
60
62
  The baseline is broad by default: it includes the former default pack set plus expanded inspection, shell-builtin and system/service reads, bounded development verification, network reads, typed network research, non-secret home and agent-support typed Pi reads, and safe-home typed Pi mutations. Literal project/temp output redirects and `/dev/null` are eligible, while dynamic, `.git`, unknown-fd, and network output redirects remain review-gated. Installed package packs are merely available until explicitly enabled by user-owned config.
61
63
 
62
64
  ## Safety model
63
65
 
64
66
  - Parsed structure, not raw shell text, drives policy.
65
- - Unknown tools follow `unknownToolPosture` (default `allow`; non-bash tools are ungated).
67
+ - Non-Bash tools bypass Clearance unless their exact name appears in global `gatedTools` (default `[]`); Bash is always gated and cannot be listed.
68
+ - Opted-in unknown tools follow `unknownToolPosture` (default `allow`). Wildcards and future-tool opt-in are not supported.
69
+ - This default typed-tool bypass is an intentional published behavior break and must be called out in the next minor release.
66
70
  - Parser uncertainty and unsupported forms fail closed to review.
67
71
  - Model decisions resolve one call and never create permanent policy.
68
72
  - Tune mode proposes user-approved inspectable data-pack changes after replay and adversarial evidence; executable TypeScript rule modules are not supported.
@@ -4,7 +4,7 @@ Pi Clearance makes long-running Pi sessions feel fast without turning tool calls
4
4
 
5
5
  ## Product shape
6
6
 
7
- 1. **Structural analysis** — bash and typed Pi tools become inspectable shapes; parser uncertainty reviews or denies.
7
+ 1. **Structural analysis** — Bash and explicitly opted-in typed Pi tools become inspectable shapes; parser uncertainty reviews or denies. Non-Bash tools not opted in remain host-approved bypasses.
8
8
  2. **Broad built-in baseline** — common development, project-scoped mutation, network-read, typed research, non-secret home/support reads, and safe-home workflows are active by default while the sealed floor remains non-overridable.
9
9
  3. **One behavioral dial** — `mode: off | ask | auto` globally controls only dispatch of deterministic `review` results.
10
10
  4. **Model reviewer** — Auto mode resolves one uncertain call with configurable prompt/context/model details; model decisions never become policy.
@@ -16,8 +16,8 @@ Pi Clearance makes long-running Pi sessions feel fast without turning tool calls
16
16
  - **Ask:** known-safe calls run; uncertainty asks the user and blocks unattended calls.
17
17
  - **Auto:** known-safe calls run; uncertainty goes model-first, then human/block fallback.
18
18
 
19
- The sealed floor always wins. Invalid config fails closed to floor-only policy. Unknown (non-bash) tools default to allow through the config-file-only `unknownToolPosture` setting.
19
+ The sealed floor always wins. Invalid config fails closed to floor-only policy. Non-Bash tools bypass Clearance by default and can be opted in by exact name through global `gatedTools`; Bash remains fully gated. `unknownToolPosture` applies only to opted-in unknown tools.
20
20
 
21
21
  ## Trust and growth
22
22
 
23
- User-owned global/project config may widen policy. Repository policy and installed packs cannot silently widen it. Tune replay, adversarial checks, explicit confirmation, and post-write validation make policy growth auditable.
23
+ User-owned global/project config may widen policy. Repository policy and installed packs cannot silently widen it. Persisted settings written through Clearance contain only non-default choices, while runtime normalization supplies the rest. Package installation neither changes config nor enables packs. Tune replay, adversarial checks, explicit confirmation, and post-write validation make policy growth auditable. The default non-Bash bypass is an intentional published behavioral break requiring next-minor release communication.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nklisch/pi-clearance",
3
- "version": "0.1.1",
3
+ "version": "0.2.2",
4
4
  "description": "Configurable auto-reviewer Pi extension for parsed, structural command policy",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -15,13 +15,17 @@
15
15
  "tree-sitter"
16
16
  ],
17
17
  "engines": {
18
- "node": ">=22"
18
+ "node": ">=22.18"
19
19
  },
20
20
  "napi": {
21
21
  "binaryName": "clearance-core",
22
22
  "targets": [
23
23
  "x86_64-unknown-linux-gnu",
24
- "aarch64-apple-darwin"
24
+ "aarch64-unknown-linux-gnu",
25
+ "x86_64-apple-darwin",
26
+ "aarch64-apple-darwin",
27
+ "x86_64-pc-windows-msvc",
28
+ "aarch64-pc-windows-msvc"
25
29
  ]
26
30
  },
27
31
  "exports": {
@@ -59,8 +63,7 @@
59
63
  "cargo:fmt": "cargo fmt --all -- --check"
60
64
  },
61
65
  "dependencies": {
62
- "@sinclair/typebox": "^0.34.49",
63
- "jiti": "^2.7.0"
66
+ "@sinclair/typebox": "^0.34.49"
64
67
  },
65
68
  "peerDependencies": {
66
69
  "@earendil-works/pi-ai": "*",
@@ -73,6 +76,7 @@
73
76
  "@earendil-works/pi-tui": "0.82.0",
74
77
  "@napi-rs/cli": "^3.7.4",
75
78
  "@types/node": "^24.0.0",
79
+ "jiti": "^2.7.0",
76
80
  "tsx": "^4.23.1",
77
81
  "typescript": "^5.9.3",
78
82
  "vitest": "^4.0.0",