@nklisch/pi-enhanced 0.1.2 → 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.
- package/CHANGELOG.md +7 -0
- package/README.md +3 -2
- package/node_modules/@nklisch/pi-clearance/README.md +10 -5
- package/node_modules/@nklisch/pi-clearance/docs/ARCHITECTURE.md +12 -7
- package/node_modules/@nklisch/pi-clearance/docs/CONFIGURATION.md +25 -35
- package/node_modules/@nklisch/pi-clearance/docs/DEVELOPER_GUIDE.md +30 -30
- package/node_modules/@nklisch/pi-clearance/docs/PACK_AUTHORING.md +5 -4
- package/node_modules/@nklisch/pi-clearance/docs/PRINCIPLES.md +14 -10
- package/node_modules/@nklisch/pi-clearance/docs/REFERENCE_PATTERNS.md +1 -1
- package/node_modules/@nklisch/pi-clearance/docs/REVIEWER_PROMPTS.md +12 -8
- package/node_modules/@nklisch/pi-clearance/docs/RULE_PACKS.md +1 -1
- package/node_modules/@nklisch/pi-clearance/docs/SPEC.md +7 -6
- package/node_modules/@nklisch/pi-clearance/docs/TUNE.md +2 -2
- package/node_modules/@nklisch/pi-clearance/docs/USER_GUIDE.md +7 -3
- package/node_modules/@nklisch/pi-clearance/docs/VISION.md +3 -3
- package/node_modules/@nklisch/pi-clearance/native/clearance-core.darwin-arm64.node +0 -0
- package/node_modules/@nklisch/pi-clearance/native/clearance-core.darwin-x64.node +0 -0
- package/node_modules/@nklisch/pi-clearance/native/clearance-core.linux-arm64-gnu.node +0 -0
- package/node_modules/@nklisch/pi-clearance/native/clearance-core.linux-x64-gnu.node +0 -0
- package/node_modules/@nklisch/pi-clearance/native/clearance-core.win32-arm64-msvc.node +0 -0
- package/node_modules/@nklisch/pi-clearance/native/clearance-core.win32-x64-msvc.node +0 -0
- package/node_modules/@nklisch/pi-clearance/package.json +9 -5
- package/node_modules/@nklisch/pi-clearance/src/config/config-command-plans.ts +79 -3
- package/node_modules/@nklisch/pi-clearance/src/config/config-command-writer.ts +7 -1
- package/node_modules/@nklisch/pi-clearance/src/config/defaults.ts +42 -0
- package/node_modules/@nklisch/pi-clearance/src/config/gated-tools.ts +7 -0
- package/node_modules/@nklisch/pi-clearance/src/config/loader.ts +7 -1
- package/node_modules/@nklisch/pi-clearance/src/config/pack-enablement-writer.ts +1 -0
- package/node_modules/@nklisch/pi-clearance/src/config/paths.ts +14 -3
- package/node_modules/@nklisch/pi-clearance/src/config/persistence.ts +135 -0
- package/node_modules/@nklisch/pi-clearance/src/config/schema.ts +74 -26
- package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCase.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseCategory.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseExpectation.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseResult.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseResultOutcome.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialCaseSource.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialValidationReport.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/AdversarialValidationStatus.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashBlock.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashCommandShape.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashConditionalArm.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashControlConstruct.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashFlag.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashForLoopKeywordSpans.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashIteratorEntry.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashIteratorEntryKind.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashListOperator.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashLoopVariableReference.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFact.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFactContext.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFactProvenance.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFactProvenanceEntry.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashPathFacts.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashPipeline.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashStage.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BashStageProgram.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/BlockOperator.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CapturedOutcome.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CommandFamilyKey.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CommandFamilySummary.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CompileError.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CompositionOperator.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CompoundBodyReason.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CompoundFeatureReason.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CompoundForm.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CompoundIteratorReason.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusEntry.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusExpectedLabel.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusFidelity.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusQueryModel.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusQuerySummary.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusQuerySummarySnapshot.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusRecord.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CorpusSource.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/CountByLabel.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/Decision.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/DecisionEffect.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/DecisionProvenance.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/DecisionSource.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/DiagnosticSeverity.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/EffectivePolicy.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/EmbeddedShellProjection.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/EnvironmentAssignment.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/IteratorSourceKind.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/LoopQuoteKind.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/LoopVariableUnknownReason.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/MatcherExpr.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/MutationShapeKind.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/MutationTrustBoundaryClassification.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/MutationTrustBoundaryKind.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PackCompileResult.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PackWarningLevel.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ParsedEvidence.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ParsedShapeSummary.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathAccess.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathFactProjectScope.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathFactsRequirement.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathFactsResolvedConfig.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathNormalization.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathScope.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathScopeMatcherExpr.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathScopeMatcherMode.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathUnknownReason.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PathUsageKind.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PiBuiltinToolOperation.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PiBuiltinToolPathInput.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PiBuiltinToolShape.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PiBuiltinToolSpec.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PiFileMutationToolName.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PiToolMutationFacts.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPack.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPackDocLink.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPackExample.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPackMetadata.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyPackWarning.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/PolicyRule.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ProposalNotRunReason.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ProposalNotRunSeverity.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/QuoteKind.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/Redirect.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/RedirectStream.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/RedirectTargetKind.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayCorpus.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDelta.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaBlockedSummary.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaChangedRecord.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaFamily.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaImprovement.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaRegression.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaStatus.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayDeltaTransitionCount.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayPathFacts.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayReviewerMode.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayReviewerOutcome.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayStatus.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ReplayedDecision.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ShapeDiagnostic.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/SourceFidelity.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/SourceSpan.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/Substitution.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/SubstitutionKind.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ToolCallIdentity.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathAccess.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathFact.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathFactContext.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathFacts.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ToolPathUsage.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/ToolShape.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/UnknownPathBehavior.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/UnknownToolShape.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/contracts/index.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/index.ts +33 -2
- package/node_modules/@nklisch/pi-clearance/src/native/loader.ts +29 -42
- package/node_modules/@nklisch/pi-clearance/src/replay/reviewer-config-proposals.ts +7 -4
- package/node_modules/@nklisch/pi-clearance/src/runtime/allow-request-message.ts +21 -0
- package/node_modules/@nklisch/pi-clearance/src/runtime/auto-reviewer-read-models.ts +165 -8
- package/node_modules/@nklisch/pi-clearance/src/runtime/command-registry.ts +1 -1
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/allow.ts +26 -2
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/packs.ts +6 -6
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/scope.ts +5 -5
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/actions.ts +11 -0
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/dispatcher.ts +274 -1
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/model-options.ts +52 -0
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/native-ui.ts +54 -67
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/panels/reviewer.ts +19 -3
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/panels/scope.ts +2 -11
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/panels.ts +10 -1
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings/read-model.ts +47 -13
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/settings.ts +32 -37
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/status.ts +3 -0
- package/node_modules/@nklisch/pi-clearance/src/runtime/config-commands/types.ts +14 -5
- package/node_modules/@nklisch/pi-clearance/src/runtime/handler.ts +36 -0
- package/node_modules/@nklisch/pi-clearance/src/runtime/mode-prompt.ts +0 -1
- package/node_modules/@nklisch/pi-clearance/src/runtime/model-adapter.ts +5 -1
- package/node_modules/@nklisch/pi-clearance/src/runtime/reviewer-context.ts +73 -10
- package/node_modules/@nklisch/pi-clearance/src/runtime/reviewer-prompts.ts +186 -175
- package/node_modules/@nklisch/pi-clearance/src/runtime/reviewer.ts +26 -6
- package/node_modules/@nklisch/pi-plugins/dist/infrastructure/state/local-lock-filesystem.d.ts +23 -1
- package/node_modules/@nklisch/pi-plugins/dist/infrastructure/state/local-lock-filesystem.js +46 -50
- package/node_modules/@nklisch/pi-plugins/dist/infrastructure/state/local-lock-filesystem.js.map +1 -1
- package/node_modules/@nklisch/pi-plugins/dist/runtime/mcp/pi-mcp-adapter-package.js +2 -2
- package/node_modules/@nklisch/pi-plugins/dist/runtime/mcp/pi-mcp-adapter-runtime.js +2 -2
- package/node_modules/@nklisch/pi-plugins/dist/runtime/subagents/pi-subagents-lifecycle.js +1 -1
- package/node_modules/@nklisch/pi-plugins/dist/runtime/subagents/pi-subagents-package.js +2 -2
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/README.md +41 -31
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/dist/public.d.ts +2 -1
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/docs/FORK-MAINTENANCE.md +17 -11
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/docs/VISION.md +14 -7
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/docs/architecture/architecture.md +11 -19
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/docs/comparison-with-upstream.md +58 -53
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/package.json +2 -2
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/agent-type-resolution.ts +43 -0
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/agent-types.ts +11 -6
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/custom-agents.ts +13 -6
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/default-agents.ts +0 -52
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/config/thinking-levels.ts +12 -0
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/handlers/interrupt.ts +5 -2
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/handlers/lifecycle.ts +3 -3
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/index.ts +7 -6
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/create-subagent-session.ts +7 -2
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/parent-snapshot.ts +11 -3
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent-manager.ts +26 -56
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent-session.ts +48 -9
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent-state.ts +32 -0
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/lifecycle/subagent.ts +105 -17
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/composite-subagent-observer.ts +4 -0
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/notification.ts +50 -46
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/renderer.ts +1 -1
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/observation/subagent-events-observer.ts +15 -0
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/runtime.ts +2 -0
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/service/service-adapter.ts +35 -6
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/service/service.ts +1 -0
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/session/model-label.ts +19 -0
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/session/prompts.ts +24 -1
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/session/session-config.ts +11 -6
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/settings.ts +70 -3
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/agent-tool.ts +27 -10
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/background-spawner.ts +6 -2
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/foreground-runner.ts +12 -3
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/get-result-report.ts +17 -3
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/get-result-tool.ts +13 -20
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/result-renderer.ts +6 -1
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/spawn-config.ts +16 -16
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/tools/steer-tool.ts +12 -4
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/types.ts +2 -2
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/agent-widget.ts +24 -11
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/display.ts +10 -7
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/glyphs.ts +7 -0
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/session-navigation.ts +34 -25
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/session-navigator.ts +30 -10
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/subagents-settings.ts +58 -13
- package/node_modules/@nklisch/pi-plugins/node_modules/@nklisch/pi-subagents/src/ui/widget-renderer.ts +32 -19
- package/node_modules/@nklisch/pi-plugins/package.json +3 -3
- package/package.json +1 -1
- package/test/verify-bundle.mjs +28 -1
|
@@ -186,7 +186,6 @@ export type NativeEngineStatus =
|
|
|
186
186
|
|
|
187
187
|
const require = createRequire(import.meta.url);
|
|
188
188
|
const NATIVE_MODULE_BASENAME = "clearance-core";
|
|
189
|
-
const NATIVE_PACKAGE_NAME = "pi-clearance";
|
|
190
189
|
let cachedStatus: NativeEngineStatus | undefined;
|
|
191
190
|
|
|
192
191
|
/**
|
|
@@ -196,12 +195,18 @@ let cachedStatus: NativeEngineStatus | undefined;
|
|
|
196
195
|
* prebuild files staged by `native:prepare`.
|
|
197
196
|
*/
|
|
198
197
|
export function nativePlatformTriple(): string | undefined {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
198
|
+
// Map the host platform/arch to a napi-rs platform-package suffix. Every
|
|
199
|
+
// common dev platform is covered. The list of *built* prebuilds is the
|
|
200
|
+
// narrower one in `package.json` `napi.targets`; this function returns a
|
|
201
|
+
// suffix for any platform Node can run on so the load path produces a
|
|
202
|
+
// precise "no prebuild for this platform" error rather than a generic
|
|
203
|
+
// "unsupported native platform" when the host is genuinely novel.
|
|
204
|
+
if (process.platform === "linux" && process.arch === "x64") return "linux-x64-gnu";
|
|
205
|
+
if (process.platform === "linux" && process.arch === "arm64") return "linux-arm64-gnu";
|
|
206
|
+
if (process.platform === "darwin" && process.arch === "x64") return "darwin-x64";
|
|
207
|
+
if (process.platform === "darwin" && process.arch === "arm64") return "darwin-arm64";
|
|
208
|
+
if (process.platform === "win32" && process.arch === "x64") return "win32-x64-msvc";
|
|
209
|
+
if (process.platform === "win32" && process.arch === "arm64") return "win32-arm64-msvc";
|
|
205
210
|
return undefined;
|
|
206
211
|
}
|
|
207
212
|
|
|
@@ -225,43 +230,25 @@ export function loadNativeEngine(): NativeEngineStatus {
|
|
|
225
230
|
}
|
|
226
231
|
|
|
227
232
|
const packageRoot = fileURLToPath(new URL("../../", import.meta.url));
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
];
|
|
233
|
+
const modulePath = join(
|
|
234
|
+
packageRoot,
|
|
235
|
+
"native",
|
|
236
|
+
`${NATIVE_MODULE_BASENAME}.${triple}.node`,
|
|
237
|
+
);
|
|
238
|
+
const attemptedPaths = [modulePath];
|
|
235
239
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
cachedStatus = {
|
|
248
|
-
ok: false,
|
|
249
|
-
reason: nativeLoadError(error),
|
|
250
|
-
attemptedPaths,
|
|
251
|
-
};
|
|
252
|
-
return cachedStatus;
|
|
253
|
-
}
|
|
254
|
-
}
|
|
240
|
+
try {
|
|
241
|
+
const candidate: unknown = require(modulePath);
|
|
242
|
+
const engine = asNativeEngine(candidate);
|
|
243
|
+
const health = engine.health();
|
|
244
|
+
cachedStatus = { ok: true, engine, health, modulePath };
|
|
245
|
+
} catch (error: unknown) {
|
|
246
|
+
cachedStatus = {
|
|
247
|
+
ok: false,
|
|
248
|
+
reason: nativeLoadError(error),
|
|
249
|
+
attemptedPaths,
|
|
250
|
+
};
|
|
255
251
|
}
|
|
256
|
-
|
|
257
|
-
// `attemptedPaths` always contains at least one path, but keep the fallback
|
|
258
|
-
// explicit so future platform additions cannot accidentally arm without a
|
|
259
|
-
// validated engine.
|
|
260
|
-
cachedStatus = {
|
|
261
|
-
ok: false,
|
|
262
|
-
reason: "native engine did not expose a supported module",
|
|
263
|
-
attemptedPaths,
|
|
264
|
-
};
|
|
265
252
|
return cachedStatus;
|
|
266
253
|
}
|
|
267
254
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
ReviewerConfigSchema,
|
|
10
10
|
} from "../config/schema.ts";
|
|
11
11
|
import {
|
|
12
|
+
isShippedReviewerPostureId,
|
|
12
13
|
REVIEWER_BASE_CONTRACT,
|
|
13
14
|
SHIPPED_REVIEWER_POSTURES,
|
|
14
15
|
validatePromptOverride,
|
|
@@ -146,8 +147,10 @@ export type ReviewerModelDrafter = (
|
|
|
146
147
|
) => Promise<ReviewerModelDraftResult | undefined>;
|
|
147
148
|
|
|
148
149
|
/** True iff `postureId` is one of the shipped reviewer posture fragments. */
|
|
149
|
-
export function isShippedReviewerPosture(
|
|
150
|
-
|
|
150
|
+
export function isShippedReviewerPosture(
|
|
151
|
+
postureId: string,
|
|
152
|
+
): postureId is keyof typeof SHIPPED_REVIEWER_POSTURES {
|
|
153
|
+
return isShippedReviewerPostureId(postureId);
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
/**
|
|
@@ -700,9 +703,9 @@ function draftOverrideSet(
|
|
|
700
703
|
const postureFragments =
|
|
701
704
|
SHIPPED_REVIEWER_POSTURES[
|
|
702
705
|
isShippedReviewerPosture(current.promptPosture)
|
|
703
|
-
?
|
|
706
|
+
? current.promptPosture
|
|
704
707
|
: "reviewer.default"
|
|
705
|
-
];
|
|
708
|
+
].fragments;
|
|
706
709
|
const text = [
|
|
707
710
|
REVIEWER_BASE_CONTRACT.text,
|
|
708
711
|
...postureFragments.map((fragment) => fragment.text),
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { MessageRenderer } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
3
|
+
|
|
4
|
+
export const CLEARANCE_ALLOW_REQUEST_CUSTOM_TYPE = "clearance.allow-request";
|
|
5
|
+
|
|
6
|
+
export interface ClearanceAllowRequestDetails {
|
|
7
|
+
readonly brief: string;
|
|
8
|
+
readonly form: "free-text" | "recent-command" | "no-recent-command";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Keep the transcript row compact while the custom message content remains the
|
|
13
|
+
* complete, clearly labelled brief that Pi sends to the model. The renderer is
|
|
14
|
+
* deliberately not the source of model context.
|
|
15
|
+
*/
|
|
16
|
+
export const renderClearanceAllowRequest: MessageRenderer<
|
|
17
|
+
ClearanceAllowRequestDetails
|
|
18
|
+
> = (message) => {
|
|
19
|
+
const form = message.details?.form ?? "request";
|
|
20
|
+
return new Text(`[Pi Clearance] Allow request handed to agent (${form})`);
|
|
21
|
+
};
|
|
@@ -5,6 +5,16 @@ import type {
|
|
|
5
5
|
ResolvedConfig,
|
|
6
6
|
ResolvedReviewerConfig,
|
|
7
7
|
} from "../config/loader.ts";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_PROJECT_SCOPE_BEHAVIOR,
|
|
10
|
+
DEFAULT_REVIEWER_CONTEXT_MODE,
|
|
11
|
+
DEFAULT_REVIEWER_ESCALATION,
|
|
12
|
+
DEFAULT_REVIEWER_PROMPT_POSTURE,
|
|
13
|
+
DEFAULT_REVIEWER_RECENT_CONTEXT,
|
|
14
|
+
DEFAULT_REVIEWER_TOKEN_BUDGET,
|
|
15
|
+
DEFAULT_REVIEW_NOTE_DISPLAY,
|
|
16
|
+
DEFAULT_UNKNOWN_TOOL_POSTURE,
|
|
17
|
+
} from "../config/defaults.ts";
|
|
8
18
|
import { shippedPackActivationCondition } from "../packs/activation.ts";
|
|
9
19
|
import type { PackageRegistrationSnapshot } from "../packs/package-registration.ts";
|
|
10
20
|
import {
|
|
@@ -49,6 +59,9 @@ export interface AutoReviewerStatusView {
|
|
|
49
59
|
readonly cwd: string;
|
|
50
60
|
};
|
|
51
61
|
readonly mode: ResolvedPolicy["config"]["mode"];
|
|
62
|
+
readonly gatedTools?: readonly string[];
|
|
63
|
+
/** Concise category labels for non-default user-owned settings. */
|
|
64
|
+
readonly customizations?: readonly string[];
|
|
52
65
|
readonly reviewer: {
|
|
53
66
|
readonly promptPosture: string;
|
|
54
67
|
readonly configuredModel: string | null;
|
|
@@ -63,7 +76,10 @@ export interface AutoReviewerStatusView {
|
|
|
63
76
|
readonly global: number;
|
|
64
77
|
readonly globalProjectConfigured: number;
|
|
65
78
|
readonly projectOverlayConfigured: number;
|
|
79
|
+
readonly repositoryConfigured: number;
|
|
66
80
|
readonly activeProject: number;
|
|
81
|
+
/** Configured or active append count, whichever is more informative. */
|
|
82
|
+
readonly total: number;
|
|
67
83
|
};
|
|
68
84
|
readonly promptOverrideConfigured?: boolean;
|
|
69
85
|
/** Plain-language current reviewer path for gray-area calls. */
|
|
@@ -149,7 +165,6 @@ export function buildAutoReviewerStatusView(input: {
|
|
|
149
165
|
const entries = input.policy.registry.entries;
|
|
150
166
|
const enabled = entries.filter((entry) => entry.availability.enabled).length;
|
|
151
167
|
const reviewer = input.policy.config.reviewer;
|
|
152
|
-
const snapshots = input.policy.config.sourceSnapshots;
|
|
153
168
|
const resolvedReviewerModel = resolveReviewerModel({
|
|
154
169
|
registry: reviewerModelRegistry(input.ctx),
|
|
155
170
|
spec: reviewer.model,
|
|
@@ -158,6 +173,7 @@ export function buildAutoReviewerStatusView(input: {
|
|
|
158
173
|
const modelHighCost =
|
|
159
174
|
resolvedReviewerModel.model !== undefined &&
|
|
160
175
|
isHighCostReviewerModel(resolvedReviewerModel.model.id);
|
|
176
|
+
const promptAppendCounts = reviewerPromptAppendCounts(input.policy.config);
|
|
161
177
|
const reviewerPath = resolveReviewerPath({
|
|
162
178
|
config: input.policy.config,
|
|
163
179
|
hasUI: hasHumanReviewUi(input.ctx),
|
|
@@ -170,6 +186,8 @@ export function buildAutoReviewerStatusView(input: {
|
|
|
170
186
|
cwd: projectCwd(input.ctx, input.policy),
|
|
171
187
|
},
|
|
172
188
|
mode: input.policy.config.mode,
|
|
189
|
+
gatedTools: [...(input.policy.config.gatedTools ?? [])],
|
|
190
|
+
customizations: customizationCategories(input.policy.config),
|
|
173
191
|
reviewer: {
|
|
174
192
|
promptPosture: reviewer.promptPosture,
|
|
175
193
|
configuredModel: reviewer.model,
|
|
@@ -185,13 +203,7 @@ export function buildAutoReviewerStatusView(input: {
|
|
|
185
203
|
contextMode: reviewer.contextMode,
|
|
186
204
|
tokenBudget: { ...reviewer.tokenBudget },
|
|
187
205
|
escalation: { ...reviewer.escalation },
|
|
188
|
-
promptAppends:
|
|
189
|
-
global: reviewer.promptAppends.length,
|
|
190
|
-
globalProjectConfigured:
|
|
191
|
-
snapshots?.global.reviewer.projectPromptAppends.length ?? 0,
|
|
192
|
-
projectOverlayConfigured: snapshots?.project.promptAppends.length ?? 0,
|
|
193
|
-
activeProject: reviewer.projectPromptAppends.length,
|
|
194
|
-
},
|
|
206
|
+
promptAppends: promptAppendCounts,
|
|
195
207
|
promptOverrideConfigured: reviewer.promptOverride !== null,
|
|
196
208
|
path: reviewerPath,
|
|
197
209
|
consequence: reviewerConsequence(reviewerPath),
|
|
@@ -460,6 +472,151 @@ function syntheticPackageRow(
|
|
|
460
472
|
};
|
|
461
473
|
}
|
|
462
474
|
|
|
475
|
+
function customizationCategories(
|
|
476
|
+
config: ResolvedPolicy["config"],
|
|
477
|
+
): readonly string[] {
|
|
478
|
+
const categories: string[] = [];
|
|
479
|
+
const snapshots = config.sourceSnapshots;
|
|
480
|
+
const reviewer = config.reviewer;
|
|
481
|
+
const promptAppendCounts = reviewerPromptAppendCounts(config);
|
|
482
|
+
|
|
483
|
+
if (reviewer.promptOverride !== null) categories.push("prompt override");
|
|
484
|
+
if (promptAppendCounts.total > 0) {
|
|
485
|
+
categories.push(`prompt appends (${promptAppendCounts.total})`);
|
|
486
|
+
}
|
|
487
|
+
if (reviewer.promptPosture !== DEFAULT_REVIEWER_PROMPT_POSTURE) {
|
|
488
|
+
categories.push("posture");
|
|
489
|
+
}
|
|
490
|
+
if (reviewer.model !== null) categories.push("model pin");
|
|
491
|
+
if (config.unknownToolPosture !== DEFAULT_UNKNOWN_TOOL_POSTURE) {
|
|
492
|
+
categories.push("unknown-tool posture");
|
|
493
|
+
}
|
|
494
|
+
const recentContext = reviewer.recentContext;
|
|
495
|
+
if (
|
|
496
|
+
reviewer.contextMode !== DEFAULT_REVIEWER_CONTEXT_MODE ||
|
|
497
|
+
recentContext.decisionLimit !== DEFAULT_REVIEWER_RECENT_CONTEXT.decisionLimit ||
|
|
498
|
+
recentContext.decisionWindow !== DEFAULT_REVIEWER_RECENT_CONTEXT.decisionWindow ||
|
|
499
|
+
(recentContext.conversationTurns ??
|
|
500
|
+
DEFAULT_REVIEWER_RECENT_CONTEXT.conversationTurns) !==
|
|
501
|
+
DEFAULT_REVIEWER_RECENT_CONTEXT.conversationTurns ||
|
|
502
|
+
(recentContext.userTurns ?? DEFAULT_REVIEWER_RECENT_CONTEXT.userTurns) !==
|
|
503
|
+
DEFAULT_REVIEWER_RECENT_CONTEXT.userTurns ||
|
|
504
|
+
recentContext.conversationCharLimit !==
|
|
505
|
+
DEFAULT_REVIEWER_RECENT_CONTEXT.conversationCharLimit
|
|
506
|
+
) {
|
|
507
|
+
categories.push("context");
|
|
508
|
+
}
|
|
509
|
+
if (
|
|
510
|
+
reviewer.tokenBudget.window !== DEFAULT_REVIEWER_TOKEN_BUDGET.window ||
|
|
511
|
+
reviewer.tokenBudget.limit !== DEFAULT_REVIEWER_TOKEN_BUDGET.limit
|
|
512
|
+
) {
|
|
513
|
+
categories.push("budget");
|
|
514
|
+
}
|
|
515
|
+
if (
|
|
516
|
+
reviewer.escalation.enabled !== DEFAULT_REVIEWER_ESCALATION.enabled ||
|
|
517
|
+
reviewer.escalation.denialLimit !==
|
|
518
|
+
DEFAULT_REVIEWER_ESCALATION.denialLimit ||
|
|
519
|
+
reviewer.escalation.window !== DEFAULT_REVIEWER_ESCALATION.window
|
|
520
|
+
) {
|
|
521
|
+
categories.push("escalation");
|
|
522
|
+
}
|
|
523
|
+
const gatedTools = config.gatedTools ?? [];
|
|
524
|
+
if (gatedTools.length > 0) {
|
|
525
|
+
categories.push(`gated tools (${gatedTools.length})`);
|
|
526
|
+
}
|
|
527
|
+
if (scopeIsCustomized(snapshots?.project.projectScope)) {
|
|
528
|
+
categories.push("scope");
|
|
529
|
+
}
|
|
530
|
+
const packCount = customizedPackCount(snapshots);
|
|
531
|
+
if (packCount > 0) categories.push(`packs (${packCount})`);
|
|
532
|
+
if (
|
|
533
|
+
config.display.reviewNote.mode !== DEFAULT_REVIEW_NOTE_DISPLAY.mode ||
|
|
534
|
+
config.display.reviewNote.showModelLabel !==
|
|
535
|
+
DEFAULT_REVIEW_NOTE_DISPLAY.showModelLabel ||
|
|
536
|
+
config.display.reviewNote.accent !== DEFAULT_REVIEW_NOTE_DISPLAY.accent
|
|
537
|
+
) {
|
|
538
|
+
categories.push("display");
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
return categories;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
function reviewerPromptAppendCounts(
|
|
545
|
+
config: ResolvedPolicy["config"],
|
|
546
|
+
): NonNullable<AutoReviewerStatusView["reviewer"]["promptAppends"]> {
|
|
547
|
+
const snapshots = config.sourceSnapshots;
|
|
548
|
+
const global = config.reviewer.promptAppends.length;
|
|
549
|
+
const globalProjectConfigured =
|
|
550
|
+
snapshots?.global.reviewer.projectPromptAppends.length ?? 0;
|
|
551
|
+
const projectOverlayConfigured = snapshots?.project.promptAppends.length ?? 0;
|
|
552
|
+
const repositoryConfigured = snapshots?.repository.promptAppends.length ?? 0;
|
|
553
|
+
const activeProject = config.reviewer.projectPromptAppends.length;
|
|
554
|
+
const configuredTotal =
|
|
555
|
+
global +
|
|
556
|
+
globalProjectConfigured +
|
|
557
|
+
projectOverlayConfigured +
|
|
558
|
+
repositoryConfigured;
|
|
559
|
+
const activeTotal = global + activeProject;
|
|
560
|
+
|
|
561
|
+
return {
|
|
562
|
+
global,
|
|
563
|
+
globalProjectConfigured,
|
|
564
|
+
projectOverlayConfigured,
|
|
565
|
+
repositoryConfigured,
|
|
566
|
+
activeProject,
|
|
567
|
+
total: Math.max(configuredTotal, activeTotal),
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function scopeIsCustomized(scope: unknown): boolean {
|
|
572
|
+
if (scope === undefined || typeof scope !== "object" || scope === null) {
|
|
573
|
+
return false;
|
|
574
|
+
}
|
|
575
|
+
const value = scope as Record<string, unknown>;
|
|
576
|
+
return (
|
|
577
|
+
[
|
|
578
|
+
"roots",
|
|
579
|
+
"writableDirectories",
|
|
580
|
+
"tempDirectories",
|
|
581
|
+
"deniedDirectories",
|
|
582
|
+
"safeHomeDirectories",
|
|
583
|
+
"agentSupportDirectories",
|
|
584
|
+
].some((key) => Array.isArray(value[key]) && value[key].length > 0) ||
|
|
585
|
+
(value.safeHomeUseDefaults !== undefined &&
|
|
586
|
+
value.safeHomeUseDefaults !==
|
|
587
|
+
DEFAULT_PROJECT_SCOPE_BEHAVIOR.safeHomeUseDefaults) ||
|
|
588
|
+
(value.agentSupportUseDefaults !== undefined &&
|
|
589
|
+
value.agentSupportUseDefaults !==
|
|
590
|
+
DEFAULT_PROJECT_SCOPE_BEHAVIOR.agentSupportUseDefaults) ||
|
|
591
|
+
(value.unknownPathBehavior !== undefined &&
|
|
592
|
+
value.unknownPathBehavior !==
|
|
593
|
+
DEFAULT_PROJECT_SCOPE_BEHAVIOR.unknownPathBehavior) ||
|
|
594
|
+
(value.sensitivePathBehavior !== undefined &&
|
|
595
|
+
value.sensitivePathBehavior !==
|
|
596
|
+
DEFAULT_PROJECT_SCOPE_BEHAVIOR.sensitivePathBehavior) ||
|
|
597
|
+
(value.homePathBehavior !== undefined &&
|
|
598
|
+
value.homePathBehavior !== DEFAULT_PROJECT_SCOPE_BEHAVIOR.homePathBehavior)
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function customizedPackCount(
|
|
603
|
+
snapshots: ResolvedPolicy["config"]["sourceSnapshots"],
|
|
604
|
+
): number {
|
|
605
|
+
if (snapshots === undefined) return 0;
|
|
606
|
+
const { global, project, repository } = snapshots;
|
|
607
|
+
return [
|
|
608
|
+
global.packs.length,
|
|
609
|
+
project.packs.length,
|
|
610
|
+
repository.packs.length,
|
|
611
|
+
global.packEnablement.enabledPackagePacks.length,
|
|
612
|
+
global.packEnablement.disabledPackagePacks.length,
|
|
613
|
+
global.packEnablement.disabledConfigPacks.length,
|
|
614
|
+
project.packEnablement.enabledPackagePacks.length,
|
|
615
|
+
project.packEnablement.disabledPackagePacks.length,
|
|
616
|
+
project.packEnablement.disabledConfigPacks.length,
|
|
617
|
+
].reduce((total, count) => total + count, 0);
|
|
618
|
+
}
|
|
619
|
+
|
|
463
620
|
function effectCopy(effect: PackEffectSummary): string {
|
|
464
621
|
switch (effect) {
|
|
465
622
|
case "deny-floor":
|
|
@@ -101,7 +101,7 @@ export async function handleClearanceCommand(
|
|
|
101
101
|
): Promise<CommandReport> {
|
|
102
102
|
const tokens = parseCommandArgs(args);
|
|
103
103
|
if (tokens.length === 0) {
|
|
104
|
-
return await
|
|
104
|
+
return await handleSetupCommand([], ctx, pi, deps);
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
const command = tokens[0] as string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
|
|
3
3
|
import type { ToolAnalyzerRegistry } from "../../parse/registry.ts";
|
|
4
|
+
import {
|
|
5
|
+
CLEARANCE_ALLOW_REQUEST_CUSTOM_TYPE,
|
|
6
|
+
type ClearanceAllowRequestDetails,
|
|
7
|
+
} from "../allow-request-message.ts";
|
|
4
8
|
import type { ToolShape } from "../../parse/shape.ts";
|
|
5
9
|
import {
|
|
6
10
|
flattenStages,
|
|
@@ -385,10 +389,30 @@ async function handoff(
|
|
|
385
389
|
if (!prepared.ok) return prepared.report;
|
|
386
390
|
|
|
387
391
|
try {
|
|
392
|
+
const details: ClearanceAllowRequestDetails = {
|
|
393
|
+
brief: prepared.brief,
|
|
394
|
+
form: prepared.form,
|
|
395
|
+
};
|
|
388
396
|
if (ctx.isIdle()) {
|
|
389
|
-
await pi.
|
|
397
|
+
await pi.sendMessage(
|
|
398
|
+
{
|
|
399
|
+
customType: CLEARANCE_ALLOW_REQUEST_CUSTOM_TYPE,
|
|
400
|
+
content: prepared.brief,
|
|
401
|
+
display: true,
|
|
402
|
+
details,
|
|
403
|
+
},
|
|
404
|
+
{ triggerTurn: true },
|
|
405
|
+
);
|
|
390
406
|
} else {
|
|
391
|
-
await pi.
|
|
407
|
+
await pi.sendMessage(
|
|
408
|
+
{
|
|
409
|
+
customType: CLEARANCE_ALLOW_REQUEST_CUSTOM_TYPE,
|
|
410
|
+
content: prepared.brief,
|
|
411
|
+
display: true,
|
|
412
|
+
details,
|
|
413
|
+
},
|
|
414
|
+
{ deliverAs: "followUp" },
|
|
415
|
+
);
|
|
392
416
|
}
|
|
393
417
|
} catch (error: unknown) {
|
|
394
418
|
const message = errorMessage(error);
|
|
@@ -165,7 +165,7 @@ export interface DefaultPackListingDetails
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
|
-
* Human-facing default pack listing used by `/
|
|
168
|
+
* Human-facing default pack listing used by `/clearance packs` and
|
|
169
169
|
* settings drill-downs. Titles are the primary labels; stable pack ids stay as
|
|
170
170
|
* secondary metadata so humans do not have to scan dot/colon-path identifiers.
|
|
171
171
|
*/
|
|
@@ -221,7 +221,7 @@ export async function handlePackMutationCommand(input: {
|
|
|
221
221
|
reason:
|
|
222
222
|
"Pack enable/disable requires interactive Pi UI confirmation; no config changes were written.",
|
|
223
223
|
markdownLines: [
|
|
224
|
-
"- Mutating `/
|
|
224
|
+
"- Mutating `/clearance packs enable|disable` commands require Pi UI confirmation.",
|
|
225
225
|
"- No config changes were written.",
|
|
226
226
|
],
|
|
227
227
|
});
|
|
@@ -338,7 +338,7 @@ export async function handlePackMutationCommand(input: {
|
|
|
338
338
|
};
|
|
339
339
|
|
|
340
340
|
return {
|
|
341
|
-
title: "
|
|
341
|
+
title: "Pi Clearance pack enablement updated",
|
|
342
342
|
summary: `${packId} ${request.action} planned for ${target.target.scope}; effective state ${formatEffectiveState(effectivePack)}.`,
|
|
343
343
|
markdown: formatPackMutationSuccessMarkdown(details),
|
|
344
344
|
details,
|
|
@@ -1038,7 +1038,7 @@ function formatPackExplorerNameCell(
|
|
|
1038
1038
|
const secondary = idsPrimary
|
|
1039
1039
|
? escapeCell(pack.title)
|
|
1040
1040
|
: `\`${escapeCell(pack.id)}\``;
|
|
1041
|
-
return `${primary}
|
|
1041
|
+
return `${primary} — ${secondary}`;
|
|
1042
1042
|
}
|
|
1043
1043
|
|
|
1044
1044
|
function formatPackExplorerScope(pack: AutoReviewerPackExplorerView): string {
|
|
@@ -1362,7 +1362,7 @@ function formatPackMutationSuccessMarkdown(
|
|
|
1362
1362
|
details: PackMutationSuccessDetails,
|
|
1363
1363
|
): string {
|
|
1364
1364
|
const lines = [
|
|
1365
|
-
"#
|
|
1365
|
+
"# Pi Clearance pack enablement updated",
|
|
1366
1366
|
"",
|
|
1367
1367
|
`- Pack: \`${details.request.packId}\``,
|
|
1368
1368
|
`- Action: ${details.request.action}`,
|
|
@@ -1513,7 +1513,7 @@ function escapeCell(value: string): string {
|
|
|
1513
1513
|
}
|
|
1514
1514
|
|
|
1515
1515
|
function packConfirmationTitle(plan: PackEnablementPlan): string {
|
|
1516
|
-
return `${capitalize(plan.request.action)}
|
|
1516
|
+
return `${capitalize(plan.request.action)} Pi Clearance pack?`;
|
|
1517
1517
|
}
|
|
1518
1518
|
|
|
1519
1519
|
function yesNo(value: boolean): string {
|
|
@@ -146,7 +146,7 @@ export async function handleScopeCommand(
|
|
|
146
146
|
reason:
|
|
147
147
|
"Project scope changes require interactive Pi UI confirmation; no config changes were written.",
|
|
148
148
|
markdownLines: [
|
|
149
|
-
"- Mutating `/
|
|
149
|
+
"- Mutating `/clearance scope` commands require Pi UI confirmation.",
|
|
150
150
|
"- No config changes were written.",
|
|
151
151
|
],
|
|
152
152
|
change: parsed.change,
|
|
@@ -232,7 +232,7 @@ export async function handleScopeCommand(
|
|
|
232
232
|
};
|
|
233
233
|
|
|
234
234
|
return {
|
|
235
|
-
title: "
|
|
235
|
+
title: "Pi Clearance project scope updated",
|
|
236
236
|
summary: `${planned.plan.title}; changed ${apply.changed ? "yes" : "no"}.`,
|
|
237
237
|
markdown: formatScopeMutationSuccessMarkdown(details),
|
|
238
238
|
details,
|
|
@@ -292,7 +292,7 @@ async function handleScopeStatus(
|
|
|
292
292
|
|
|
293
293
|
const details = scopeStatusFromConfig(policy.policy.config);
|
|
294
294
|
return {
|
|
295
|
-
title: "
|
|
295
|
+
title: "Pi Clearance project scope",
|
|
296
296
|
summary: `Project scope has ${details.raw.roots.length} configured root(s), ${details.raw.writableDirectories.length} configured writable path(s), and unknown paths ${details.raw.unknownPathBehavior}.`,
|
|
297
297
|
markdown: formatScopeStatusMarkdown(details),
|
|
298
298
|
details,
|
|
@@ -476,7 +476,7 @@ function scopeStatusFromConfig(config: ResolvedConfig): ScopeStatusDetails {
|
|
|
476
476
|
|
|
477
477
|
function formatScopeStatusMarkdown(details: ScopeStatusDetails): string {
|
|
478
478
|
const lines = [
|
|
479
|
-
"#
|
|
479
|
+
"# Pi Clearance project scope",
|
|
480
480
|
"",
|
|
481
481
|
"Project scope is lexical-only: it normalizes strings but does not follow symlinks, check filesystem existence, or provide sandbox containment.",
|
|
482
482
|
"",
|
|
@@ -618,7 +618,7 @@ function formatScopeMutationSuccessMarkdown(
|
|
|
618
618
|
details: ScopeMutationSuccessDetails,
|
|
619
619
|
): string {
|
|
620
620
|
const lines = [
|
|
621
|
-
"#
|
|
621
|
+
"# Pi Clearance project scope updated",
|
|
622
622
|
"",
|
|
623
623
|
`- Change: ${details.plan.title}`,
|
|
624
624
|
`- Target file: \`${details.plan.target.path}\``,
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export type SettingsActionId =
|
|
2
|
+
| "mode.select"
|
|
2
3
|
| "mode.set"
|
|
3
4
|
| "reviewer.open"
|
|
4
5
|
| "reviewer.model"
|
|
6
|
+
| "reviewer.posture.select"
|
|
7
|
+
| "reviewer.posture.set"
|
|
5
8
|
| "reviewer.prompt-append"
|
|
6
9
|
| "reviewer.prompt-override.set"
|
|
7
10
|
| "reviewer.prompt-override.clear"
|
|
@@ -9,15 +12,20 @@ export type SettingsActionId =
|
|
|
9
12
|
| "scope.add-path"
|
|
10
13
|
| "scope.remove-path"
|
|
11
14
|
| "scope.unknown-path"
|
|
15
|
+
| "scope.unknown-path.select"
|
|
12
16
|
| "scope.safe-home-defaults"
|
|
13
17
|
| "scope.agent-support-defaults"
|
|
14
18
|
| "scope.preset"
|
|
19
|
+
| "scope.preset.select"
|
|
15
20
|
| "packs.open"
|
|
16
21
|
| "packs.show"
|
|
17
22
|
| "packs.enable"
|
|
18
23
|
| "packs.disable"
|
|
19
24
|
| "briefing.open"
|
|
20
25
|
| "briefing.mode"
|
|
26
|
+
| "briefing.mode.select"
|
|
27
|
+
| "gated-tools.add"
|
|
28
|
+
| "gated-tools.remove"
|
|
21
29
|
| "briefing.model-label"
|
|
22
30
|
| "briefing.accent";
|
|
23
31
|
|
|
@@ -28,6 +36,9 @@ export interface SettingsAction {
|
|
|
28
36
|
|
|
29
37
|
export const WRITE_ACTION_IDS = [
|
|
30
38
|
"mode.set",
|
|
39
|
+
"reviewer.posture.set",
|
|
40
|
+
"gated-tools.add",
|
|
41
|
+
"gated-tools.remove",
|
|
31
42
|
"reviewer.model",
|
|
32
43
|
"reviewer.prompt-append",
|
|
33
44
|
"reviewer.prompt-override.set",
|