@event4u/agent-config 9.9.0 → 9.10.0
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +153 -194
- package/README.md +1 -1
- package/dist/agent-src/commands/agent-status.md +12 -11
- package/dist/agent-src/commands/agents/user/accept.md +115 -30
- package/dist/agent-src/commands/agents/user/delete.md +147 -0
- package/dist/agent-src/commands/agents/user/review.md +65 -28
- package/dist/agent-src/commands/agents/user/show.md +82 -29
- package/dist/agent-src/commands/agents/user/update.md +2 -2
- package/dist/agent-src/commands/agents/user.md +16 -3
- package/dist/agent-src/commands/check-current-md.md +0 -10
- package/dist/agent-src/commands/condense.md +28 -97
- package/dist/agent-src/commands/cost/report.md +7 -0
- package/dist/agent-src/commands/fix/portability.md +0 -8
- package/dist/agent-src/commands/fix/refs.md +0 -8
- package/dist/agent-src/commands/humanize.md +2 -2
- package/dist/agent-src/commands/jira-ticket.md +1 -1
- package/dist/agent-src/commands/memory/load.md +11 -0
- package/dist/agent-src/commands/optimize/skills.md +1 -1
- package/dist/agent-src/commands/pr/create.md +4 -4
- package/dist/agent-src/commands/profile/show.md +3 -3
- package/dist/agent-src/commands/rule-compliance-audit.md +5 -4
- package/dist/agent-src/commands/security-audit-config.md +1 -1
- package/dist/agent-src/commands/sync/gitignore/fix.md +1 -1
- package/dist/agent-src/commands/tdd.md +21 -0
- package/dist/agent-src/commands/team/delegate.md +2 -2
- package/dist/agent-src/commands/team-knowledge/bootstrap.md +9 -8
- package/dist/agent-src/commands/team-knowledge/consolidate.md +8 -7
- package/dist/agent-src/commands/team.md +4 -1
- package/dist/agent-src/commands/upstream-contribute.md +0 -1
- package/dist/agent-src/contexts/authority/commit-mechanics.md +7 -0
- package/dist/agent-src/contexts/authority/destructive-mechanics.md +16 -0
- package/dist/agent-src/contexts/authority/scope-mechanics.md +61 -0
- package/dist/agent-src/contexts/communication/rules-auto/reply-close-mechanics.md +20 -18
- package/dist/agent-src/contexts/communication/rules-auto/skill-quality-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/slash-command-routing-policy-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/source-of-truth-mechanics.md +9 -10
- package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +1 -1
- package/dist/agent-src/contexts/communication/rules-auto/user-interaction-mechanics.md +11 -0
- package/dist/agent-src/contexts/contracts/artifact-engagement-flow.md +26 -15
- package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +3 -0
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +67 -37
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +1 -1
- package/dist/agent-src/contexts/execution/autonomy-examples.md +1 -1
- package/dist/agent-src/contexts/execution/autonomy-mechanics.md +7 -6
- package/dist/agent-src/contexts/execution/evidence-discipline.md +92 -77
- package/dist/agent-src/contexts/execution/orchestration-benchmark-gate.md +22 -21
- package/dist/agent-src/contexts/execution/orchestration-telemetry.md +24 -0
- package/dist/agent-src/contexts/execution/project-intelligence.md +122 -103
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +23 -21
- package/dist/agent-src/contexts/execution/subagent-response-contract.md +5 -5
- package/dist/agent-src/contexts/execution/subagent-routing.md +11 -0
- package/dist/agent-src/contexts/execution/subagent-spawn-contract.md +13 -13
- package/dist/agent-src/contexts/execution/subagent-steering.md +36 -34
- package/dist/agent-src/contexts/execution/toolchain-resolver.md +1 -1
- package/dist/agent-src/contexts/execution/user-memory-channels.md +189 -0
- package/dist/agent-src/contexts/execution/verification-mechanics.md +9 -0
- package/dist/agent-src/contexts/model-recommendations.md +3 -2
- package/dist/agent-src/contexts/subagent-configuration.md +3 -3
- package/dist/agent-src/ghostwriter/README.md +2 -2
- package/dist/agent-src/packs/README.md +1 -1
- package/dist/agent-src/personas/README.md +5 -5
- package/dist/agent-src/personas/_template-specialist/persona.md +3 -3
- package/dist/agent-src/personas/backend-architect.md +24 -23
- package/dist/agent-src/personas/eloquent-tamer.md +30 -30
- package/dist/agent-src/personas/frontend-engineer.md +30 -30
- package/dist/agent-src/personas/product-owner.md +41 -38
- package/dist/agent-src/personas/qa.md +13 -13
- package/dist/agent-src/personas/security-engineer.md +22 -22
- package/dist/agent-src/presets/README.md +3 -3
- package/dist/agent-src/profiles/README.md +3 -3
- package/dist/agent-src/rules/active-remediation.md +2 -2
- package/dist/agent-src/rules/artifact-engagement-recording.md +4 -4
- package/dist/agent-src/rules/ask-when-uncertain.md +0 -4
- package/dist/agent-src/rules/augment-edit-discipline.md +1 -1
- package/dist/agent-src/rules/broken-access-control.md +4 -4
- package/dist/agent-src/rules/code-comment-discipline.md +1 -1
- package/dist/agent-src/rules/code-provenance.md +2 -2
- package/dist/agent-src/rules/commit-policy.md +4 -9
- package/dist/agent-src/rules/communication-through-line.md +5 -5
- package/dist/agent-src/rules/decision-revisit-gate.md +1 -1
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +1 -1
- package/dist/agent-src/rules/domain-adoption-policy.md +1 -1
- package/dist/agent-src/rules/domain-safety-pii.md +1 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +1 -1
- package/dist/agent-src/rules/fast-path-marker-visibility.md +43 -7
- package/dist/agent-src/rules/finance-safety-floor.md +1 -1
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +3 -3
- package/dist/agent-src/rules/history-discipline.md +1 -1
- package/dist/agent-src/rules/legal-safety-floor.md +1 -1
- package/dist/agent-src/rules/lethal-trifecta-guard.md +5 -5
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +10 -8
- package/dist/agent-src/rules/media-governance-routing.md +13 -13
- package/dist/agent-src/rules/media-sync-ground-truth.md +29 -11
- package/dist/agent-src/rules/no-cheap-questions.md +7 -7
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +29 -18
- package/dist/agent-src/rules/non-destructive-by-default.md +5 -23
- package/dist/agent-src/rules/onboarding-gate.md +14 -4
- package/dist/agent-src/rules/persona-governance.md +2 -2
- package/dist/agent-src/rules/prefer-enums-over-literals.md +9 -9
- package/dist/agent-src/rules/preservation-guard.md +10 -2
- package/dist/agent-src/rules/question-not-instruction.md +1 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +6 -6
- package/dist/agent-src/rules/rule-type-governance.md +1 -1
- package/dist/agent-src/rules/scale-discipline.md +1 -1
- package/dist/agent-src/rules/scope-control.md +1 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +1 -1
- package/dist/agent-src/rules/security-sensitive-stop.md +17 -11
- package/dist/agent-src/rules/senior-engineering-discipline.md +17 -17
- package/dist/agent-src/rules/session-canary.md +1 -1
- package/dist/agent-src/rules/skill-quality.md +1 -1
- package/dist/agent-src/rules/source-confidentiality.md +21 -19
- package/dist/agent-src/rules/source-of-truth.md +6 -5
- package/dist/agent-src/rules/spreadsheet-source-quality.md +2 -2
- package/dist/agent-src/rules/strategy-safety-floor.md +1 -1
- package/dist/agent-src/rules/think-before-action.md +5 -5
- package/dist/agent-src/rules/token-budget-discipline.md +5 -3
- package/dist/agent-src/rules/token-efficiency.md +2 -2
- package/dist/agent-src/rules/untrusted-input-defense.md +4 -4
- package/dist/agent-src/rules/user-interaction.md +12 -0
- package/dist/agent-src/rules/verify-before-complete.md +4 -24
- package/dist/agent-src/skills/adversarial-review/SKILL.md +2 -2
- package/dist/agent-src/skills/agent-security-review/SKILL.md +52 -45
- package/dist/agent-src/skills/agents-md-thin-root/SKILL.md +2 -2
- package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +20 -20
- package/dist/agent-src/skills/ai-council/SKILL.md +185 -128
- package/dist/agent-src/skills/analysis-skill-router/SKILL.md +3 -3
- package/dist/agent-src/skills/api-endpoint/SKILL.md +2 -2
- package/dist/agent-src/skills/artisan-commands/SKILL.md +2 -2
- package/dist/agent-src/skills/async-python-patterns/SKILL.md +8 -7
- package/dist/agent-src/skills/authz-review/SKILL.md +16 -15
- package/dist/agent-src/skills/aws-infrastructure/SKILL.md +5 -5
- package/dist/agent-src/skills/blade-ui/SKILL.md +1 -1
- package/dist/agent-src/skills/bug-analyzer/SKILL.md +30 -12
- package/dist/agent-src/skills/code-intelligence/SKILL.md +0 -1
- package/dist/agent-src/skills/code-intelligence/evals/triggers.json +52 -0
- package/dist/agent-src/skills/code-review/SKILL.md +6 -6
- package/dist/agent-src/skills/command-routing/SKILL.md +5 -4
- package/dist/agent-src/skills/composer-packages/SKILL.md +2 -2
- package/dist/agent-src/skills/condense-memory/SKILL.md +43 -41
- package/dist/agent-src/skills/context-document/SKILL.md +23 -21
- package/dist/agent-src/skills/copilot-config/SKILL.md +6 -1
- package/dist/agent-src/skills/decision-record/SKILL.md +20 -18
- package/dist/agent-src/skills/design-intelligence/SKILL.md +4 -4
- package/dist/agent-src/skills/design-review/SKILL.md +15 -14
- package/dist/agent-src/skills/design-system-capture/reference/design-system-json.md +28 -25
- package/dist/agent-src/skills/devcontainer/SKILL.md +2 -2
- package/dist/agent-src/skills/docker/SKILL.md +1 -1
- package/dist/agent-src/skills/docx-authoring/evals/triggers.json +52 -0
- package/dist/agent-src/skills/emit-tickets/SKILL.md +2 -2
- package/dist/agent-src/skills/error-handling-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +2 -2
- package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +0 -1
- package/dist/agent-src/skills/evaluate-llm-feature/evals/triggers.json +52 -0
- package/dist/agent-src/skills/existing-ui-audit/SKILL.md +6 -5
- package/dist/agent-src/skills/feature-planning/SKILL.md +2 -2
- package/dist/agent-src/skills/finishing-a-development-branch/SKILL.md +3 -3
- package/dist/agent-src/skills/flux/SKILL.md +1 -1
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +13 -13
- package/dist/agent-src/skills/git-workflow/SKILL.md +33 -33
- package/dist/agent-src/skills/grafana/SKILL.md +5 -0
- package/dist/agent-src/skills/humanizer/SKILL.md +83 -66
- package/dist/agent-src/skills/humanizer/data/patterns.md +14 -14
- package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +4 -4
- package/dist/agent-src/skills/judge-artifact-completeness/SKILL.md +82 -37
- package/dist/agent-src/skills/judge-bug-hunter/SKILL.md +17 -5
- package/dist/agent-src/skills/judge-injection-defense/SKILL.md +63 -25
- package/dist/agent-src/skills/judge-security-auditor/SKILL.md +2 -0
- package/dist/agent-src/skills/judge-synthesis/SKILL.md +72 -28
- package/dist/agent-src/skills/laravel-horizon/SKILL.md +5 -0
- package/dist/agent-src/skills/laravel-mail/SKILL.md +5 -4
- package/dist/agent-src/skills/laravel-middleware/SKILL.md +5 -4
- package/dist/agent-src/skills/laravel-notifications/SKILL.md +10 -9
- package/dist/agent-src/skills/laravel-pennant/SKILL.md +1 -1
- package/dist/agent-src/skills/laravel-pulse/SKILL.md +9 -8
- package/dist/agent-src/skills/laravel-reverb/SKILL.md +6 -5
- package/dist/agent-src/skills/laravel-scheduling/SKILL.md +6 -1
- package/dist/agent-src/skills/laravel-validation/SKILL.md +12 -0
- package/dist/agent-src/skills/launch-readiness/SKILL.md +1 -1
- package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +7 -7
- package/dist/agent-src/skills/learning-tutor/SKILL.md +44 -43
- package/dist/agent-src/skills/learning-tutor/evals/triggers.json +52 -0
- package/dist/agent-src/skills/license-compliance-audit/SKILL.md +7 -7
- package/dist/agent-src/skills/license-compliance-borrow-check/SKILL.md +3 -3
- package/dist/agent-src/skills/license-compliance-credits/SKILL.md +4 -4
- package/dist/agent-src/skills/llm-provider-knowledge/SKILL.md +0 -1
- package/dist/agent-src/skills/memory-consolidation/SKILL.md +69 -64
- package/dist/agent-src/skills/motion-choreographer/SKILL.md +6 -6
- package/dist/agent-src/skills/pdf-tools/evals/triggers.json +52 -0
- package/dist/agent-src/skills/performance-analysis/SKILL.md +7 -3
- package/dist/agent-src/skills/persona-improvement/SKILL.md +0 -2
- package/dist/agent-src/skills/persona-improvement/evals/triggers.json +52 -0
- package/dist/agent-src/skills/php-coder/SKILL.md +10 -0
- package/dist/agent-src/skills/prediction-pool-optimizer/SKILL.md +129 -120
- package/dist/agent-src/skills/prediction-pool-optimizer/reference/ev-fixtures.md +36 -35
- package/dist/agent-src/skills/prediction-pool-optimizer/reference/odds-and-bonus.md +45 -41
- package/dist/agent-src/skills/project-analysis-core/SKILL.md +4 -4
- package/dist/agent-src/skills/project-analysis-hypothesis-driven/SKILL.md +3 -3
- package/dist/agent-src/skills/project-analysis-react/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analysis-symfony/SKILL.md +1 -1
- package/dist/agent-src/skills/project-analysis-zend-laminas/SKILL.md +2 -2
- package/dist/agent-src/skills/prompt-engineering-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/prompt-validator/SKILL.md +39 -39
- package/dist/agent-src/skills/quality-tools/SKILL.md +15 -15
- package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +55 -19
- package/dist/agent-src/skills/react-shadcn-ui/reference/registry.md +29 -27
- package/dist/agent-src/skills/readme-writing-package/SKILL.md +2 -2
- package/dist/agent-src/skills/reasoning-orchestrator/SKILL.md +25 -25
- package/dist/agent-src/skills/recursive-verification/SKILL.md +6 -5
- package/dist/agent-src/skills/refine-prompt/SKILL.md +1 -1
- package/dist/agent-src/skills/refine-ticket/SKILL.md +20 -2
- package/dist/agent-src/skills/repomix-packer/SKILL.md +1 -1
- package/dist/agent-src/skills/requesting-code-review/SKILL.md +2 -2
- package/dist/agent-src/skills/roadmap-management/SKILL.md +80 -66
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +84 -77
- package/dist/agent-src/skills/rule-refactor/SKILL.md +1 -1
- package/dist/agent-src/skills/screenshot-hygiene/evals/triggers.json +52 -0
- package/dist/agent-src/skills/security-audit/SKILL.md +26 -9
- package/dist/agent-src/skills/security-maturity-assessment/SKILL.md +38 -16
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +14 -11
- package/dist/agent-src/skills/skill-writing/SKILL.md +9 -8
- package/dist/agent-src/skills/song-to-script/SKILL.md +93 -85
- package/dist/agent-src/skills/sql-writing/SKILL.md +2 -2
- package/dist/agent-src/skills/stakeholder-tradeoff/SKILL.md +4 -3
- package/dist/agent-src/skills/standards-from-config/SKILL.md +61 -43
- package/dist/agent-src/skills/subagent-orchestration/SKILL.md +22 -8
- package/dist/agent-src/skills/subagent-orchestration/prompts/README.md +28 -2
- package/dist/agent-src/skills/supply-chain-intake/SKILL.md +13 -13
- package/dist/agent-src/skills/systematic-debugging/SKILL.md +22 -21
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +1 -1
- package/dist/agent-src/skills/technical-specification/SKILL.md +5 -0
- package/dist/agent-src/skills/terraform/SKILL.md +2 -2
- package/dist/agent-src/skills/terragrunt/SKILL.md +8 -8
- package/dist/agent-src/skills/testing-anti-patterns/process-anti-patterns.md +1 -1
- package/dist/agent-src/skills/threat-modeling/SKILL.md +19 -13
- package/dist/agent-src/skills/universal-project-analysis/SKILL.md +1 -1
- package/dist/agent-src/skills/upstream-contribute/SKILL.md +0 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +9 -9
- package/dist/agent-src/skills/validate-feature-fit/SKILL.md +3 -1
- package/dist/agent-src/skills/verify-completion-evidence/SKILL.md +4 -6
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +67 -61
- package/dist/agent-src/skills/video-director/SKILL.md +7 -7
- package/dist/agent-src/skills/worktree-lifecycle/SKILL.md +3 -3
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/contexts/knowledge-pages.md +47 -45
- package/dist/agent-src/templates/contexts/lesson-card.md +2 -2
- package/dist/agent-src/templates/contexts/tenant-boundaries.md +2 -2
- package/dist/agent-src/templates/contexts.md +1 -1
- package/dist/agent-src/templates/features.md +1 -1
- package/dist/agent-src/templates/roadmaps.md +125 -116
- package/dist/agent-src/templates/rule.md +2 -1
- package/dist/agent-src/templates/scripts/pr_risk_review.ts +0 -0
- package/dist/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/dist/agent-src/templates/scripts/tier_usage_report.ts +2 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -2
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +1 -1
- package/dist/agent-src/user-types/README.md +8 -8
- package/dist/agent-src/user-types/galabau-field-crew.md +34 -33
- package/dist/agent-src/user-types/metalworking-shop.md +35 -34
- package/dist/agent-src/user-types/truck-driver.md +22 -20
- package/dist/cli/python/workspace_roles.js +2 -2
- package/dist/cli/python/workspace_roles.js.map +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +88 -62
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +6 -5
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +5 -4
- package/dist/hooks/dispatch.js +186 -12
- package/dist/install/install.mjs +8 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1199 -857
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/compile_time_toggles.js +48 -0
- package/dist/scripts/_lib/compile_time_toggles.js.map +1 -0
- package/dist/scripts/condense.js +234 -217
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/schemas/settings.js +4 -0
- package/dist/server/schemas/settings.js.map +1 -1
- package/dist/shared/userMd/utils.js +30 -0
- package/dist/shared/userMd/utils.js.map +1 -1
- package/dist/ui/assets/index-BpSQt5vm.js.map +1 -1
- package/docs/guidelines/agent-infra/api-cost-levers.md +56 -5
- package/docs/guidelines/agent-infra/simplicity-and-goal-demos.md +93 -33
- package/package.json +1 -1
- package/src/agent-src/templates/scripts/pr_risk_review.ts +0 -0
- package/src/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
- package/src/agent-src/templates/scripts/tier_usage_report.ts +2 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +2 -2
- package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +1 -1
- package/src/config/agent-settings.template.yml +32 -2
- package/src/config/ci-local-parity.yml +142 -0
- package/src/config/gate-coverage.yml +127 -0
- package/src/config/preamble-payload-budget.json +44 -0
- package/src/scripts/_cli/cmd_doctor.ts +78 -2
- package/src/scripts/_lib/agent_user_profile.ts +381 -0
- package/src/scripts/_lib/agents_overlay.ts +9 -0
- package/src/scripts/_lib/anchor_eval.ts +311 -0
- package/src/scripts/_lib/cc_transcript.ts +316 -0
- package/src/scripts/_lib/compile_time_toggles.ts +79 -0
- package/src/scripts/_lib/confusables.ts +101 -0
- package/src/scripts/_lib/duplicate_scope_census.ts +77 -0
- package/src/scripts/_lib/managed_agents_folder.ts +181 -0
- package/src/scripts/_lib/payload_hash_drift.ts +126 -0
- package/src/scripts/_lib/preservation_migration.ts +291 -0
- package/src/scripts/_lib/retrieval_sanitize.ts +166 -2
- package/src/scripts/_lib/scan_scope.ts +115 -0
- package/src/scripts/_lib/user_global_memory_audit.ts +187 -0
- package/src/scripts/_lib/user_global_observations.ts +830 -0
- package/src/scripts/_lib/user_global_revocations.ts +110 -0
- package/src/scripts/_lib/user_memory_gate_counters.ts +291 -0
- package/src/scripts/ai_council/blind_review.ts +0 -0
- package/src/scripts/ai_council/budget_guard.ts +90 -11
- package/src/scripts/ai_council/bundler.ts +2 -2
- package/src/scripts/ai_council/clients.ts +59 -3
- package/src/scripts/ai_council/config.ts +38 -0
- package/src/scripts/ai_council/orchestrator.ts +54 -9
- package/src/scripts/ai_team/team_dispatch.ts +17 -6
- package/src/scripts/anchor_eval_falsify.ts +198 -0
- package/src/scripts/anchor_scoring_run.ts +239 -0
- package/src/scripts/annotate_discovery.ts +1 -65
- package/src/scripts/bench_quality_run.ts +168 -4
- package/src/scripts/cache_realization_report.ts +782 -0
- package/src/scripts/check_artefact_count_messaging.ts +5 -1
- package/src/scripts/check_augment_description_cap.ts +15 -4
- package/src/scripts/check_ci_local_parity.ts +317 -0
- package/src/scripts/check_condensation.ts +96 -191
- package/src/scripts/check_context_paths.ts +38 -9
- package/src/scripts/check_gate_coverage.ts +299 -0
- package/src/scripts/check_iron_law_prominence.ts +22 -1
- package/src/scripts/check_kernel_prefix_stability.ts +0 -0
- package/src/scripts/check_no_new_legacy_path.ts +16 -6
- package/src/scripts/check_no_roadmap_refs.ts +22 -9
- package/src/scripts/check_originality_freshness.ts +167 -0
- package/src/scripts/check_preamble_payload_budget.ts +130 -0
- package/src/scripts/check_proposal.ts +0 -0
- package/src/scripts/check_references.ts +0 -1
- package/src/scripts/check_safety_floor_untouched.ts +171 -24
- package/src/scripts/check_site_links.ts +62 -3
- package/src/scripts/ci_status.ts +0 -0
- package/src/scripts/cluster_near_miss_patterns.ts +0 -0
- package/src/scripts/code_graph/build.ts +0 -0
- package/src/scripts/command_suggester/types.ts +0 -0
- package/src/scripts/compile_router.ts +10 -14
- package/src/scripts/condense.sh +3 -4
- package/src/scripts/condense.ts +247 -228
- package/src/scripts/cost/track.mjs +168 -33
- package/src/scripts/cost_summary.ts +33 -1
- package/src/scripts/council_cli.ts +45 -3
- package/src/scripts/discovery_graph.ts +0 -0
- package/src/scripts/encoding_corpus.ts +500 -0
- package/src/scripts/encoding_corpus_report.ts +216 -0
- package/src/scripts/generate_index.ts +19 -2
- package/src/scripts/install-hooks.sh +2 -2
- package/src/scripts/learning_sidecar.ts +0 -0
- package/src/scripts/lint_confusables.ts +10 -72
- package/src/scripts/lint_featured_skills.ts +0 -0
- package/src/scripts/lint_hidden_unicode.ts +208 -0
- package/src/scripts/lint_load_context.ts +17 -5
- package/src/scripts/lint_new_skill_gate.ts +9 -3
- package/src/scripts/lint_no_python_twin_rationale.ts +17 -2
- package/src/scripts/lint_originality.ts +1 -1
- package/src/scripts/lint_skill_originality.ts +1 -1
- package/src/scripts/lint_ticket_buildable.ts +1 -1
- package/src/scripts/mcp_server/tools.ts +4 -4
- package/src/scripts/measure_scope_dedup.ts +224 -0
- package/src/scripts/memory_lookup.ts +0 -0
- package/src/scripts/mine_session.ts +98 -0
- package/src/scripts/orchestration_payload_hash_drift.ts +145 -0
- package/src/scripts/preamble_byte_census.ts +574 -0
- package/src/scripts/probe_skill_registration.ts +2 -2
- package/src/scripts/redact_hook_capture.ts +13 -0
- package/src/scripts/release.ts +65 -10
- package/src/scripts/router_telemetry.ts +1 -1
- package/src/scripts/second_brain_retrieval.ts +14 -4
- package/src/scripts/skill_linter.ts +5 -0
- package/src/scripts/surface-tiers.yml +2 -0
- package/src/scripts/validate_pack_yaml.ts +0 -0
- package/src/server/schemas/settings.ts +8 -0
- package/src/shared/userMd/utils.ts +31 -0
- package/dist/agent-src/rules/telegraph-speak.md +0 -87
package/dist/mcp/server.mjs
CHANGED
|
@@ -1669,17 +1669,17 @@ var require_visit = __commonJS({
|
|
|
1669
1669
|
visit.BREAK = BREAK;
|
|
1670
1670
|
visit.SKIP = SKIP;
|
|
1671
1671
|
visit.REMOVE = REMOVE;
|
|
1672
|
-
function visit_(key, node, visitor,
|
|
1673
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
1672
|
+
function visit_(key, node, visitor, path47) {
|
|
1673
|
+
const ctrl = callVisitor(key, node, visitor, path47);
|
|
1674
1674
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
1675
|
-
replaceNode(key,
|
|
1676
|
-
return visit_(key, ctrl, visitor,
|
|
1675
|
+
replaceNode(key, path47, ctrl);
|
|
1676
|
+
return visit_(key, ctrl, visitor, path47);
|
|
1677
1677
|
}
|
|
1678
1678
|
if (typeof ctrl !== "symbol") {
|
|
1679
1679
|
if (identity.isCollection(node)) {
|
|
1680
|
-
|
|
1680
|
+
path47 = Object.freeze(path47.concat(node));
|
|
1681
1681
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1682
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
1682
|
+
const ci = visit_(i, node.items[i], visitor, path47);
|
|
1683
1683
|
if (typeof ci === "number")
|
|
1684
1684
|
i = ci - 1;
|
|
1685
1685
|
else if (ci === BREAK)
|
|
@@ -1690,13 +1690,13 @@ var require_visit = __commonJS({
|
|
|
1690
1690
|
}
|
|
1691
1691
|
}
|
|
1692
1692
|
} else if (identity.isPair(node)) {
|
|
1693
|
-
|
|
1694
|
-
const ck = visit_("key", node.key, visitor,
|
|
1693
|
+
path47 = Object.freeze(path47.concat(node));
|
|
1694
|
+
const ck = visit_("key", node.key, visitor, path47);
|
|
1695
1695
|
if (ck === BREAK)
|
|
1696
1696
|
return BREAK;
|
|
1697
1697
|
else if (ck === REMOVE)
|
|
1698
1698
|
node.key = null;
|
|
1699
|
-
const cv = visit_("value", node.value, visitor,
|
|
1699
|
+
const cv = visit_("value", node.value, visitor, path47);
|
|
1700
1700
|
if (cv === BREAK)
|
|
1701
1701
|
return BREAK;
|
|
1702
1702
|
else if (cv === REMOVE)
|
|
@@ -1717,17 +1717,17 @@ var require_visit = __commonJS({
|
|
|
1717
1717
|
visitAsync.BREAK = BREAK;
|
|
1718
1718
|
visitAsync.SKIP = SKIP;
|
|
1719
1719
|
visitAsync.REMOVE = REMOVE;
|
|
1720
|
-
async function visitAsync_(key, node, visitor,
|
|
1721
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
1720
|
+
async function visitAsync_(key, node, visitor, path47) {
|
|
1721
|
+
const ctrl = await callVisitor(key, node, visitor, path47);
|
|
1722
1722
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
1723
|
-
replaceNode(key,
|
|
1724
|
-
return visitAsync_(key, ctrl, visitor,
|
|
1723
|
+
replaceNode(key, path47, ctrl);
|
|
1724
|
+
return visitAsync_(key, ctrl, visitor, path47);
|
|
1725
1725
|
}
|
|
1726
1726
|
if (typeof ctrl !== "symbol") {
|
|
1727
1727
|
if (identity.isCollection(node)) {
|
|
1728
|
-
|
|
1728
|
+
path47 = Object.freeze(path47.concat(node));
|
|
1729
1729
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1730
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
1730
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path47);
|
|
1731
1731
|
if (typeof ci === "number")
|
|
1732
1732
|
i = ci - 1;
|
|
1733
1733
|
else if (ci === BREAK)
|
|
@@ -1738,13 +1738,13 @@ var require_visit = __commonJS({
|
|
|
1738
1738
|
}
|
|
1739
1739
|
}
|
|
1740
1740
|
} else if (identity.isPair(node)) {
|
|
1741
|
-
|
|
1742
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
1741
|
+
path47 = Object.freeze(path47.concat(node));
|
|
1742
|
+
const ck = await visitAsync_("key", node.key, visitor, path47);
|
|
1743
1743
|
if (ck === BREAK)
|
|
1744
1744
|
return BREAK;
|
|
1745
1745
|
else if (ck === REMOVE)
|
|
1746
1746
|
node.key = null;
|
|
1747
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
1747
|
+
const cv = await visitAsync_("value", node.value, visitor, path47);
|
|
1748
1748
|
if (cv === BREAK)
|
|
1749
1749
|
return BREAK;
|
|
1750
1750
|
else if (cv === REMOVE)
|
|
@@ -1771,23 +1771,23 @@ var require_visit = __commonJS({
|
|
|
1771
1771
|
}
|
|
1772
1772
|
return visitor;
|
|
1773
1773
|
}
|
|
1774
|
-
function callVisitor(key, node, visitor,
|
|
1774
|
+
function callVisitor(key, node, visitor, path47) {
|
|
1775
1775
|
if (typeof visitor === "function")
|
|
1776
|
-
return visitor(key, node,
|
|
1776
|
+
return visitor(key, node, path47);
|
|
1777
1777
|
if (identity.isMap(node))
|
|
1778
|
-
return visitor.Map?.(key, node,
|
|
1778
|
+
return visitor.Map?.(key, node, path47);
|
|
1779
1779
|
if (identity.isSeq(node))
|
|
1780
|
-
return visitor.Seq?.(key, node,
|
|
1780
|
+
return visitor.Seq?.(key, node, path47);
|
|
1781
1781
|
if (identity.isPair(node))
|
|
1782
|
-
return visitor.Pair?.(key, node,
|
|
1782
|
+
return visitor.Pair?.(key, node, path47);
|
|
1783
1783
|
if (identity.isScalar(node))
|
|
1784
|
-
return visitor.Scalar?.(key, node,
|
|
1784
|
+
return visitor.Scalar?.(key, node, path47);
|
|
1785
1785
|
if (identity.isAlias(node))
|
|
1786
|
-
return visitor.Alias?.(key, node,
|
|
1786
|
+
return visitor.Alias?.(key, node, path47);
|
|
1787
1787
|
return void 0;
|
|
1788
1788
|
}
|
|
1789
|
-
function replaceNode(key,
|
|
1790
|
-
const parent =
|
|
1789
|
+
function replaceNode(key, path47, node) {
|
|
1790
|
+
const parent = path47[path47.length - 1];
|
|
1791
1791
|
if (identity.isCollection(parent)) {
|
|
1792
1792
|
parent.items[key] = node;
|
|
1793
1793
|
} else if (identity.isPair(parent)) {
|
|
@@ -2397,10 +2397,10 @@ var require_Collection = __commonJS({
|
|
|
2397
2397
|
var createNode = require_createNode();
|
|
2398
2398
|
var identity = require_identity();
|
|
2399
2399
|
var Node = require_Node();
|
|
2400
|
-
function collectionFromPath(schema,
|
|
2400
|
+
function collectionFromPath(schema, path47, value) {
|
|
2401
2401
|
let v = value;
|
|
2402
|
-
for (let i =
|
|
2403
|
-
const k =
|
|
2402
|
+
for (let i = path47.length - 1; i >= 0; --i) {
|
|
2403
|
+
const k = path47[i];
|
|
2404
2404
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2405
2405
|
const a = [];
|
|
2406
2406
|
a[k] = v;
|
|
@@ -2419,7 +2419,7 @@ var require_Collection = __commonJS({
|
|
|
2419
2419
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2420
2420
|
});
|
|
2421
2421
|
}
|
|
2422
|
-
var isEmptyPath = (
|
|
2422
|
+
var isEmptyPath = (path47) => path47 == null || typeof path47 === "object" && !!path47[Symbol.iterator]().next().done;
|
|
2423
2423
|
var Collection = class extends Node.NodeBase {
|
|
2424
2424
|
constructor(type, schema) {
|
|
2425
2425
|
super(type);
|
|
@@ -2449,11 +2449,11 @@ var require_Collection = __commonJS({
|
|
|
2449
2449
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2450
2450
|
* that already exists in the map.
|
|
2451
2451
|
*/
|
|
2452
|
-
addIn(
|
|
2453
|
-
if (isEmptyPath(
|
|
2452
|
+
addIn(path47, value) {
|
|
2453
|
+
if (isEmptyPath(path47))
|
|
2454
2454
|
this.add(value);
|
|
2455
2455
|
else {
|
|
2456
|
-
const [key, ...rest] =
|
|
2456
|
+
const [key, ...rest] = path47;
|
|
2457
2457
|
const node = this.get(key, true);
|
|
2458
2458
|
if (identity.isCollection(node))
|
|
2459
2459
|
node.addIn(rest, value);
|
|
@@ -2467,8 +2467,8 @@ var require_Collection = __commonJS({
|
|
|
2467
2467
|
* Removes a value from the collection.
|
|
2468
2468
|
* @returns `true` if the item was found and removed.
|
|
2469
2469
|
*/
|
|
2470
|
-
deleteIn(
|
|
2471
|
-
const [key, ...rest] =
|
|
2470
|
+
deleteIn(path47) {
|
|
2471
|
+
const [key, ...rest] = path47;
|
|
2472
2472
|
if (rest.length === 0)
|
|
2473
2473
|
return this.delete(key);
|
|
2474
2474
|
const node = this.get(key, true);
|
|
@@ -2482,8 +2482,8 @@ var require_Collection = __commonJS({
|
|
|
2482
2482
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2483
2483
|
* `true` (collections are always returned intact).
|
|
2484
2484
|
*/
|
|
2485
|
-
getIn(
|
|
2486
|
-
const [key, ...rest] =
|
|
2485
|
+
getIn(path47, keepScalar) {
|
|
2486
|
+
const [key, ...rest] = path47;
|
|
2487
2487
|
const node = this.get(key, true);
|
|
2488
2488
|
if (rest.length === 0)
|
|
2489
2489
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -2501,8 +2501,8 @@ var require_Collection = __commonJS({
|
|
|
2501
2501
|
/**
|
|
2502
2502
|
* Checks if the collection includes a value with the key `key`.
|
|
2503
2503
|
*/
|
|
2504
|
-
hasIn(
|
|
2505
|
-
const [key, ...rest] =
|
|
2504
|
+
hasIn(path47) {
|
|
2505
|
+
const [key, ...rest] = path47;
|
|
2506
2506
|
if (rest.length === 0)
|
|
2507
2507
|
return this.has(key);
|
|
2508
2508
|
const node = this.get(key, true);
|
|
@@ -2512,8 +2512,8 @@ var require_Collection = __commonJS({
|
|
|
2512
2512
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2513
2513
|
* boolean to add/remove the item from the set.
|
|
2514
2514
|
*/
|
|
2515
|
-
setIn(
|
|
2516
|
-
const [key, ...rest] =
|
|
2515
|
+
setIn(path47, value) {
|
|
2516
|
+
const [key, ...rest] = path47;
|
|
2517
2517
|
if (rest.length === 0) {
|
|
2518
2518
|
this.set(key, value);
|
|
2519
2519
|
} else {
|
|
@@ -5028,9 +5028,9 @@ var require_Document = __commonJS({
|
|
|
5028
5028
|
this.contents.add(value);
|
|
5029
5029
|
}
|
|
5030
5030
|
/** Adds a value to the document. */
|
|
5031
|
-
addIn(
|
|
5031
|
+
addIn(path47, value) {
|
|
5032
5032
|
if (assertCollection(this.contents))
|
|
5033
|
-
this.contents.addIn(
|
|
5033
|
+
this.contents.addIn(path47, value);
|
|
5034
5034
|
}
|
|
5035
5035
|
/**
|
|
5036
5036
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -5105,14 +5105,14 @@ var require_Document = __commonJS({
|
|
|
5105
5105
|
* Removes a value from the document.
|
|
5106
5106
|
* @returns `true` if the item was found and removed.
|
|
5107
5107
|
*/
|
|
5108
|
-
deleteIn(
|
|
5109
|
-
if (Collection.isEmptyPath(
|
|
5108
|
+
deleteIn(path47) {
|
|
5109
|
+
if (Collection.isEmptyPath(path47)) {
|
|
5110
5110
|
if (this.contents == null)
|
|
5111
5111
|
return false;
|
|
5112
5112
|
this.contents = null;
|
|
5113
5113
|
return true;
|
|
5114
5114
|
}
|
|
5115
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
5115
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path47) : false;
|
|
5116
5116
|
}
|
|
5117
5117
|
/**
|
|
5118
5118
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -5127,10 +5127,10 @@ var require_Document = __commonJS({
|
|
|
5127
5127
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5128
5128
|
* `true` (collections are always returned intact).
|
|
5129
5129
|
*/
|
|
5130
|
-
getIn(
|
|
5131
|
-
if (Collection.isEmptyPath(
|
|
5130
|
+
getIn(path47, keepScalar) {
|
|
5131
|
+
if (Collection.isEmptyPath(path47))
|
|
5132
5132
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
5133
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
5133
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path47, keepScalar) : void 0;
|
|
5134
5134
|
}
|
|
5135
5135
|
/**
|
|
5136
5136
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -5141,10 +5141,10 @@ var require_Document = __commonJS({
|
|
|
5141
5141
|
/**
|
|
5142
5142
|
* Checks if the document includes a value at `path`.
|
|
5143
5143
|
*/
|
|
5144
|
-
hasIn(
|
|
5145
|
-
if (Collection.isEmptyPath(
|
|
5144
|
+
hasIn(path47) {
|
|
5145
|
+
if (Collection.isEmptyPath(path47))
|
|
5146
5146
|
return this.contents !== void 0;
|
|
5147
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
5147
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path47) : false;
|
|
5148
5148
|
}
|
|
5149
5149
|
/**
|
|
5150
5150
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -5161,13 +5161,13 @@ var require_Document = __commonJS({
|
|
|
5161
5161
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
5162
5162
|
* boolean to add/remove the item from the set.
|
|
5163
5163
|
*/
|
|
5164
|
-
setIn(
|
|
5165
|
-
if (Collection.isEmptyPath(
|
|
5164
|
+
setIn(path47, value) {
|
|
5165
|
+
if (Collection.isEmptyPath(path47)) {
|
|
5166
5166
|
this.contents = value;
|
|
5167
5167
|
} else if (this.contents == null) {
|
|
5168
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
5168
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path47), value);
|
|
5169
5169
|
} else if (assertCollection(this.contents)) {
|
|
5170
|
-
this.contents.setIn(
|
|
5170
|
+
this.contents.setIn(path47, value);
|
|
5171
5171
|
}
|
|
5172
5172
|
}
|
|
5173
5173
|
/**
|
|
@@ -7127,9 +7127,9 @@ var require_cst_visit = __commonJS({
|
|
|
7127
7127
|
visit.BREAK = BREAK;
|
|
7128
7128
|
visit.SKIP = SKIP;
|
|
7129
7129
|
visit.REMOVE = REMOVE;
|
|
7130
|
-
visit.itemAtPath = (cst,
|
|
7130
|
+
visit.itemAtPath = (cst, path47) => {
|
|
7131
7131
|
let item = cst;
|
|
7132
|
-
for (const [field, index] of
|
|
7132
|
+
for (const [field, index] of path47) {
|
|
7133
7133
|
const tok = item?.[field];
|
|
7134
7134
|
if (tok && "items" in tok) {
|
|
7135
7135
|
item = tok.items[index];
|
|
@@ -7138,23 +7138,23 @@ var require_cst_visit = __commonJS({
|
|
|
7138
7138
|
}
|
|
7139
7139
|
return item;
|
|
7140
7140
|
};
|
|
7141
|
-
visit.parentCollection = (cst,
|
|
7142
|
-
const parent = visit.itemAtPath(cst,
|
|
7143
|
-
const field =
|
|
7141
|
+
visit.parentCollection = (cst, path47) => {
|
|
7142
|
+
const parent = visit.itemAtPath(cst, path47.slice(0, -1));
|
|
7143
|
+
const field = path47[path47.length - 1][0];
|
|
7144
7144
|
const coll = parent?.[field];
|
|
7145
7145
|
if (coll && "items" in coll)
|
|
7146
7146
|
return coll;
|
|
7147
7147
|
throw new Error("Parent collection not found");
|
|
7148
7148
|
};
|
|
7149
|
-
function _visit(
|
|
7150
|
-
let ctrl = visitor(item,
|
|
7149
|
+
function _visit(path47, item, visitor) {
|
|
7150
|
+
let ctrl = visitor(item, path47);
|
|
7151
7151
|
if (typeof ctrl === "symbol")
|
|
7152
7152
|
return ctrl;
|
|
7153
7153
|
for (const field of ["key", "value"]) {
|
|
7154
7154
|
const token = item[field];
|
|
7155
7155
|
if (token && "items" in token) {
|
|
7156
7156
|
for (let i = 0; i < token.items.length; ++i) {
|
|
7157
|
-
const ci = _visit(Object.freeze(
|
|
7157
|
+
const ci = _visit(Object.freeze(path47.concat([[field, i]])), token.items[i], visitor);
|
|
7158
7158
|
if (typeof ci === "number")
|
|
7159
7159
|
i = ci - 1;
|
|
7160
7160
|
else if (ci === BREAK)
|
|
@@ -7165,10 +7165,10 @@ var require_cst_visit = __commonJS({
|
|
|
7165
7165
|
}
|
|
7166
7166
|
}
|
|
7167
7167
|
if (typeof ctrl === "function" && field === "key")
|
|
7168
|
-
ctrl = ctrl(item,
|
|
7168
|
+
ctrl = ctrl(item, path47);
|
|
7169
7169
|
}
|
|
7170
7170
|
}
|
|
7171
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
7171
|
+
return typeof ctrl === "function" ? ctrl(item, path47) : ctrl;
|
|
7172
7172
|
}
|
|
7173
7173
|
exports.visit = visit;
|
|
7174
7174
|
}
|
|
@@ -8470,14 +8470,14 @@ var require_parser = __commonJS({
|
|
|
8470
8470
|
case "scalar":
|
|
8471
8471
|
case "single-quoted-scalar":
|
|
8472
8472
|
case "double-quoted-scalar": {
|
|
8473
|
-
const
|
|
8473
|
+
const fs54 = this.flowScalar(this.type);
|
|
8474
8474
|
if (atNextItem || it.value) {
|
|
8475
|
-
map.items.push({ start, key:
|
|
8475
|
+
map.items.push({ start, key: fs54, sep: [] });
|
|
8476
8476
|
this.onKeyLine = true;
|
|
8477
8477
|
} else if (it.sep) {
|
|
8478
|
-
this.stack.push(
|
|
8478
|
+
this.stack.push(fs54);
|
|
8479
8479
|
} else {
|
|
8480
|
-
Object.assign(it, { key:
|
|
8480
|
+
Object.assign(it, { key: fs54, sep: [] });
|
|
8481
8481
|
this.onKeyLine = true;
|
|
8482
8482
|
}
|
|
8483
8483
|
return;
|
|
@@ -8605,13 +8605,13 @@ var require_parser = __commonJS({
|
|
|
8605
8605
|
case "scalar":
|
|
8606
8606
|
case "single-quoted-scalar":
|
|
8607
8607
|
case "double-quoted-scalar": {
|
|
8608
|
-
const
|
|
8608
|
+
const fs54 = this.flowScalar(this.type);
|
|
8609
8609
|
if (!it || it.value)
|
|
8610
|
-
fc.items.push({ start: [], key:
|
|
8610
|
+
fc.items.push({ start: [], key: fs54, sep: [] });
|
|
8611
8611
|
else if (it.sep)
|
|
8612
|
-
this.stack.push(
|
|
8612
|
+
this.stack.push(fs54);
|
|
8613
8613
|
else
|
|
8614
|
-
Object.assign(it, { key:
|
|
8614
|
+
Object.assign(it, { key: fs54, sep: [] });
|
|
8615
8615
|
return;
|
|
8616
8616
|
}
|
|
8617
8617
|
case "flow-map-end":
|
|
@@ -9365,6 +9365,7 @@ var init_security_lint = __esm({
|
|
|
9365
9365
|
// src/scripts/lint_hidden_unicode.ts
|
|
9366
9366
|
import * as fs7 from "node:fs";
|
|
9367
9367
|
import * as path7 from "node:path";
|
|
9368
|
+
import { spawnSync } from "node:child_process";
|
|
9368
9369
|
import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
|
|
9369
9370
|
function _classify(cp) {
|
|
9370
9371
|
if (_BIDI.has(cp)) {
|
|
@@ -9437,6 +9438,73 @@ function _scan(sf) {
|
|
|
9437
9438
|
}
|
|
9438
9439
|
return out;
|
|
9439
9440
|
}
|
|
9441
|
+
function _isGenerated(rel) {
|
|
9442
|
+
return _GENERATED_PREFIXES.some((p) => rel.startsWith(p));
|
|
9443
|
+
}
|
|
9444
|
+
function _isRawControlCodepoint(cp) {
|
|
9445
|
+
if (cp === 9 || cp === 10 || cp === 13) return false;
|
|
9446
|
+
return cp <= 31 || cp >= 127 && cp <= 159;
|
|
9447
|
+
}
|
|
9448
|
+
function _extensionOf(rel) {
|
|
9449
|
+
const base = rel.slice(rel.lastIndexOf("/") + 1);
|
|
9450
|
+
const dot = base.lastIndexOf(".");
|
|
9451
|
+
return dot <= 0 ? "" : base.slice(dot + 1).toLowerCase();
|
|
9452
|
+
}
|
|
9453
|
+
function _trackedFiles() {
|
|
9454
|
+
const res = spawnSync("git", ["ls-files", "-z"], {
|
|
9455
|
+
cwd: ROOT,
|
|
9456
|
+
maxBuffer: 64 * 1024 * 1024
|
|
9457
|
+
});
|
|
9458
|
+
if (res.status !== 0 || res.stdout === null) return null;
|
|
9459
|
+
return res.stdout.toString("utf-8").split("\0").filter((p) => p !== "");
|
|
9460
|
+
}
|
|
9461
|
+
function _eligibleSourceFiles() {
|
|
9462
|
+
const tracked = _trackedFiles();
|
|
9463
|
+
if (tracked === null) return null;
|
|
9464
|
+
return tracked.filter((rel) => !_isGenerated(rel) && !_BINARY_EXT.has(_extensionOf(rel)));
|
|
9465
|
+
}
|
|
9466
|
+
function _scanSourceControlBytes(files = null) {
|
|
9467
|
+
const tracked = files ?? _eligibleSourceFiles();
|
|
9468
|
+
if (tracked === null) return [];
|
|
9469
|
+
const out = [];
|
|
9470
|
+
for (const rel of tracked) {
|
|
9471
|
+
if (_isGenerated(rel)) continue;
|
|
9472
|
+
if (_BINARY_EXT.has(_extensionOf(rel))) continue;
|
|
9473
|
+
let data;
|
|
9474
|
+
try {
|
|
9475
|
+
data = fs7.readFileSync(path7.join(ROOT, rel));
|
|
9476
|
+
} catch {
|
|
9477
|
+
continue;
|
|
9478
|
+
}
|
|
9479
|
+
try {
|
|
9480
|
+
new TextDecoder("utf-8", { fatal: true }).decode(data);
|
|
9481
|
+
} catch {
|
|
9482
|
+
continue;
|
|
9483
|
+
}
|
|
9484
|
+
let line = 1;
|
|
9485
|
+
for (const ch of data.toString("utf-8")) {
|
|
9486
|
+
const cp = ch.codePointAt(0);
|
|
9487
|
+
if (cp === void 0) continue;
|
|
9488
|
+
if (cp === 10) {
|
|
9489
|
+
line += 1;
|
|
9490
|
+
continue;
|
|
9491
|
+
}
|
|
9492
|
+
if (!_isRawControlCodepoint(cp)) continue;
|
|
9493
|
+
const hex = cp.toString(16).toUpperCase().padStart(2, "0");
|
|
9494
|
+
out.push(
|
|
9495
|
+
new Finding(
|
|
9496
|
+
rel,
|
|
9497
|
+
line,
|
|
9498
|
+
CHECK,
|
|
9499
|
+
"HIGH",
|
|
9500
|
+
`raw control character U+${hex} in a text source \u2014 makes grep/file(1)/git treat this file as binary and skip it silently; use the language escape (e.g. \\0, \\x7F) instead`,
|
|
9501
|
+
1
|
|
9502
|
+
)
|
|
9503
|
+
);
|
|
9504
|
+
}
|
|
9505
|
+
}
|
|
9506
|
+
return out;
|
|
9507
|
+
}
|
|
9440
9508
|
function _sanitize(filePath) {
|
|
9441
9509
|
const raw = fs7.readFileSync(filePath, "utf-8");
|
|
9442
9510
|
let cleaned = "";
|
|
@@ -9490,6 +9558,17 @@ function main(argv = null) {
|
|
|
9490
9558
|
flagged.add(sf.path);
|
|
9491
9559
|
}
|
|
9492
9560
|
}
|
|
9561
|
+
const sourceFiles = _eligibleSourceFiles();
|
|
9562
|
+
for (const h of _scanSourceControlBytes(sourceFiles)) {
|
|
9563
|
+
findings.push(h);
|
|
9564
|
+
}
|
|
9565
|
+
if (!args.json) {
|
|
9566
|
+
const n = sourceFiles === null ? 0 : sourceFiles.length;
|
|
9567
|
+
process.stdout.write(
|
|
9568
|
+
sourceFiles === null ? " source pass: SKIPPED \u2014 `git ls-files` unavailable, 0 files read for raw control bytes\n" : ` source pass: ${n} tracked text file(s) read for raw C0 control bytes (generated trees + verbatim captures excluded)
|
|
9569
|
+
`
|
|
9570
|
+
);
|
|
9571
|
+
}
|
|
9493
9572
|
if (args.fix) {
|
|
9494
9573
|
for (const p of [...flagged].sort()) {
|
|
9495
9574
|
const sanitized = _sanitize(p);
|
|
@@ -9524,7 +9603,7 @@ function _isCliEntry() {
|
|
|
9524
9603
|
return false;
|
|
9525
9604
|
}
|
|
9526
9605
|
}
|
|
9527
|
-
var CHECK, _BIDI, _ZERO_WIDTH, _DEPRECATED, _VS_LO, _VS_HI, _CP_NAME;
|
|
9606
|
+
var CHECK, _BIDI, _ZERO_WIDTH, _DEPRECATED, _VS_LO, _VS_HI, _CP_NAME, _BINARY_EXT, _GENERATED_PREFIXES;
|
|
9528
9607
|
var init_lint_hidden_unicode = __esm({
|
|
9529
9608
|
"src/scripts/lint_hidden_unicode.ts"() {
|
|
9530
9609
|
"use strict";
|
|
@@ -9684,12 +9763,101 @@ var init_lint_hidden_unicode = __esm({
|
|
|
9684
9763
|
917630: "TAG TILDE",
|
|
9685
9764
|
917631: "CANCEL TAG"
|
|
9686
9765
|
};
|
|
9766
|
+
_BINARY_EXT = /* @__PURE__ */ new Set([
|
|
9767
|
+
"png",
|
|
9768
|
+
"jpg",
|
|
9769
|
+
"jpeg",
|
|
9770
|
+
"gif",
|
|
9771
|
+
"ico",
|
|
9772
|
+
"webp",
|
|
9773
|
+
"avif",
|
|
9774
|
+
"bmp",
|
|
9775
|
+
"tiff",
|
|
9776
|
+
"pdf",
|
|
9777
|
+
"woff",
|
|
9778
|
+
"woff2",
|
|
9779
|
+
"ttf",
|
|
9780
|
+
"otf",
|
|
9781
|
+
"eot",
|
|
9782
|
+
"zip",
|
|
9783
|
+
"gz",
|
|
9784
|
+
"tgz",
|
|
9785
|
+
"bz2",
|
|
9786
|
+
"xz",
|
|
9787
|
+
"zst",
|
|
9788
|
+
"7z",
|
|
9789
|
+
"rar",
|
|
9790
|
+
"wasm",
|
|
9791
|
+
"mp3",
|
|
9792
|
+
"mp4",
|
|
9793
|
+
"wav",
|
|
9794
|
+
"ogg",
|
|
9795
|
+
"webm",
|
|
9796
|
+
"mov",
|
|
9797
|
+
"avi",
|
|
9798
|
+
"so",
|
|
9799
|
+
"dylib",
|
|
9800
|
+
"dll",
|
|
9801
|
+
"node",
|
|
9802
|
+
"a",
|
|
9803
|
+
"o",
|
|
9804
|
+
"exe",
|
|
9805
|
+
"jar",
|
|
9806
|
+
"class",
|
|
9807
|
+
"pyc",
|
|
9808
|
+
"pyo",
|
|
9809
|
+
"db",
|
|
9810
|
+
"sqlite",
|
|
9811
|
+
"sqlite3",
|
|
9812
|
+
"bin",
|
|
9813
|
+
"dat",
|
|
9814
|
+
"docx",
|
|
9815
|
+
"xlsx",
|
|
9816
|
+
"pptx",
|
|
9817
|
+
"doc",
|
|
9818
|
+
"xls",
|
|
9819
|
+
"ppt",
|
|
9820
|
+
"odt",
|
|
9821
|
+
"ods",
|
|
9822
|
+
"odp"
|
|
9823
|
+
]);
|
|
9824
|
+
_GENERATED_PREFIXES = [
|
|
9825
|
+
"dist/",
|
|
9826
|
+
".augment/",
|
|
9827
|
+
".claude/",
|
|
9828
|
+
".cursor/",
|
|
9829
|
+
".clinerules/",
|
|
9830
|
+
// Verbatim captured tool output, not authored text. These are RECORDINGS:
|
|
9831
|
+
// escaping a control byte inside one would falsify the record it exists to
|
|
9832
|
+
// preserve. If a capture needs to stay grep-readable, the fix is to escape
|
|
9833
|
+
// at capture time — never to edit the artifact afterwards.
|
|
9834
|
+
"agents/evidence/analysis/",
|
|
9835
|
+
// The frozen hostile-encoding corpus. Its positives ARE raw control
|
|
9836
|
+
// characters — that is the thing under test, so flagging them would demand
|
|
9837
|
+
// escaping the fixtures and thereby delete the test. The corpus has its own,
|
|
9838
|
+
// stronger integrity controls: a sha256 freeze plus a scope-guard test that
|
|
9839
|
+
// is itself falsified by an out-of-scope fixture. Excluded here because it
|
|
9840
|
+
// is DATA, on the same principle as the captures above.
|
|
9841
|
+
"internal/bench/corpora/encoding-channels/"
|
|
9842
|
+
];
|
|
9687
9843
|
if (_isCliEntry()) {
|
|
9688
9844
|
process.exitCode = main();
|
|
9689
9845
|
}
|
|
9690
9846
|
}
|
|
9691
9847
|
});
|
|
9692
9848
|
|
|
9849
|
+
// src/scripts/_lib/confusables.ts
|
|
9850
|
+
var _LATIN, _CYRILLIC, _GREEK, _LETTER;
|
|
9851
|
+
var init_confusables = __esm({
|
|
9852
|
+
"src/scripts/_lib/confusables.ts"() {
|
|
9853
|
+
"use strict";
|
|
9854
|
+
_LATIN = new RegExp("\\p{Script=Latin}", "u");
|
|
9855
|
+
_CYRILLIC = new RegExp("\\p{Script=Cyrillic}", "u");
|
|
9856
|
+
_GREEK = new RegExp("\\p{Script=Greek}", "u");
|
|
9857
|
+
_LETTER = new RegExp("\\p{L}", "u");
|
|
9858
|
+
}
|
|
9859
|
+
});
|
|
9860
|
+
|
|
9693
9861
|
// src/scripts/_lib/retrieval_sanitize.ts
|
|
9694
9862
|
function _isStrippableControl(cp) {
|
|
9695
9863
|
if (cp === 9 || cp === 10) return false;
|
|
@@ -9705,6 +9873,7 @@ function sanitize_text(s) {
|
|
|
9705
9873
|
if (cp === void 0) continue;
|
|
9706
9874
|
if (_classify(cp) !== null) continue;
|
|
9707
9875
|
if (_isStrippableControl(cp)) continue;
|
|
9876
|
+
if (_INVISIBLE_FILLERS.has(cp)) continue;
|
|
9708
9877
|
out += ch;
|
|
9709
9878
|
}
|
|
9710
9879
|
return out.length > MAX_FIELD_CHARS ? out.slice(0, MAX_FIELD_CHARS) : out;
|
|
@@ -9724,12 +9893,21 @@ function _sanitize_value(v) {
|
|
|
9724
9893
|
}
|
|
9725
9894
|
return v;
|
|
9726
9895
|
}
|
|
9727
|
-
var MAX_FIELD_CHARS;
|
|
9896
|
+
var MAX_FIELD_CHARS, _INVISIBLE_FILLERS;
|
|
9728
9897
|
var init_retrieval_sanitize = __esm({
|
|
9729
9898
|
"src/scripts/_lib/retrieval_sanitize.ts"() {
|
|
9730
9899
|
"use strict";
|
|
9731
9900
|
init_lint_hidden_unicode();
|
|
9901
|
+
init_confusables();
|
|
9732
9902
|
MAX_FIELD_CHARS = 8192;
|
|
9903
|
+
_INVISIBLE_FILLERS = /* @__PURE__ */ new Set([
|
|
9904
|
+
12644,
|
|
9905
|
+
// HANGUL FILLER
|
|
9906
|
+
4447,
|
|
9907
|
+
// HANGUL CHOSEONG FILLER
|
|
9908
|
+
4448
|
|
9909
|
+
// HANGUL JUNGSEONG FILLER
|
|
9910
|
+
]);
|
|
9733
9911
|
}
|
|
9734
9912
|
});
|
|
9735
9913
|
|
|
@@ -11903,6 +12081,9 @@ function _retrieve_internal(types, keys, limit, today) {
|
|
|
11903
12081
|
}
|
|
11904
12082
|
}
|
|
11905
12083
|
const hits = (positives.length > 0 ? positives : repo_hits).slice(0, limit);
|
|
12084
|
+
for (const h of hits) {
|
|
12085
|
+
if (_isPlainObject4(h.entry)) h.entry = sanitize_entry(h.entry);
|
|
12086
|
+
}
|
|
11906
12087
|
return [hits, skipped];
|
|
11907
12088
|
}
|
|
11908
12089
|
function retrieve(types, keys, limit = 5) {
|
|
@@ -13729,7 +13910,7 @@ __export(skill_linter_exports, {
|
|
|
13729
13910
|
parse_output_schema: () => parse_output_schema,
|
|
13730
13911
|
validate_evals_json: () => validate_evals_json
|
|
13731
13912
|
});
|
|
13732
|
-
import { spawnSync } from "node:child_process";
|
|
13913
|
+
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
13733
13914
|
import * as fs19 from "node:fs";
|
|
13734
13915
|
import * as path18 from "node:path";
|
|
13735
13916
|
import process7 from "node:process";
|
|
@@ -15667,7 +15848,7 @@ function gather_changed_candidate_files(root) {
|
|
|
15667
15848
|
try {
|
|
15668
15849
|
let rawLines = [];
|
|
15669
15850
|
for (const cmd of diffCommands) {
|
|
15670
|
-
const result =
|
|
15851
|
+
const result = spawnSync2(cmd[0], cmd.slice(1), {
|
|
15671
15852
|
cwd: root,
|
|
15672
15853
|
encoding: "utf-8"
|
|
15673
15854
|
});
|
|
@@ -16630,6 +16811,7 @@ function format_text(results, quiet = false) {
|
|
|
16630
16811
|
const passes = results.filter((r) => r.status === "pass").length;
|
|
16631
16812
|
const suffix = maliceTotal ? `, ${maliceTotal} malice` : "";
|
|
16632
16813
|
lines.push(`Summary: ${passes} pass, ${warns} warn, ${fails} fail, ${total} total${suffix}`);
|
|
16814
|
+
lines.push(`scanned: ${total}`);
|
|
16633
16815
|
return lines.join("\n");
|
|
16634
16816
|
}
|
|
16635
16817
|
function format_json(results) {
|
|
@@ -17914,7 +18096,7 @@ __export(update_roadmap_progress_exports, {
|
|
|
17914
18096
|
unarchived_complete: () => unarchived_complete
|
|
17915
18097
|
});
|
|
17916
18098
|
import { createRequire as createRequire4 } from "node:module";
|
|
17917
|
-
import { spawnSync as
|
|
18099
|
+
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
17918
18100
|
import * as fs21 from "node:fs";
|
|
17919
18101
|
import * as path20 from "node:path";
|
|
17920
18102
|
import { fileURLToPath as fileURLToPath14, pathToFileURL as pathToFileURL9 } from "node:url";
|
|
@@ -18445,7 +18627,7 @@ function _parseArgs5(argv) {
|
|
|
18445
18627
|
}
|
|
18446
18628
|
function _fallback_git_toplevel(repo_root) {
|
|
18447
18629
|
try {
|
|
18448
|
-
const r =
|
|
18630
|
+
const r = spawnSync3("git", ["rev-parse", "--show-toplevel"], {
|
|
18449
18631
|
cwd: repo_root,
|
|
18450
18632
|
encoding: "utf-8",
|
|
18451
18633
|
timeout: 1e4
|
|
@@ -18734,13 +18916,13 @@ __export(archive_completed_roadmaps_exports, {
|
|
|
18734
18916
|
archive_completed: () => archive_completed,
|
|
18735
18917
|
main: () => main10
|
|
18736
18918
|
});
|
|
18737
|
-
import { spawnSync as
|
|
18919
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
18738
18920
|
import * as fs22 from "node:fs";
|
|
18739
18921
|
import * as path21 from "node:path";
|
|
18740
18922
|
import process9 from "node:process";
|
|
18741
18923
|
import { fileURLToPath as fileURLToPath15, pathToFileURL as pathToFileURL10 } from "node:url";
|
|
18742
18924
|
function _run(cmd, cwd) {
|
|
18743
|
-
const res =
|
|
18925
|
+
const res = spawnSync4(cmd[0], cmd.slice(1), { cwd, encoding: "utf-8" });
|
|
18744
18926
|
if (res.error) {
|
|
18745
18927
|
return { returncode: -1, stdout: res.stdout ?? "", stderr: String(res.error.message ?? "") };
|
|
18746
18928
|
}
|
|
@@ -18935,7 +19117,7 @@ function _runTwin(root, script) {
|
|
|
18935
19117
|
for (; ; ) {
|
|
18936
19118
|
const candidate = path21.join(dir, "node_modules", ".bin", binName);
|
|
18937
19119
|
if (fs22.existsSync(candidate)) {
|
|
18938
|
-
|
|
19120
|
+
spawnSync4(candidate, [script], { cwd: root, encoding: "utf-8" });
|
|
18939
19121
|
return;
|
|
18940
19122
|
}
|
|
18941
19123
|
const parent = path21.dirname(dir);
|
|
@@ -18944,7 +19126,7 @@ function _runTwin(root, script) {
|
|
|
18944
19126
|
}
|
|
18945
19127
|
dir = parent;
|
|
18946
19128
|
}
|
|
18947
|
-
|
|
19129
|
+
spawnSync4("npx", ["tsx", script], { cwd: root, encoding: "utf-8" });
|
|
18948
19130
|
}
|
|
18949
19131
|
function _usage2() {
|
|
18950
19132
|
return `usage: ${_PROG6} [-h] [--all] [--base BASE] [--dry-run]
|
|
@@ -19584,12 +19766,12 @@ import {
|
|
|
19584
19766
|
unlinkSync as unlinkSync2,
|
|
19585
19767
|
writeSync
|
|
19586
19768
|
} from "node:fs";
|
|
19587
|
-
import { dirname as dirname12, join as
|
|
19769
|
+
import { dirname as dirname12, join as join22 } from "node:path";
|
|
19588
19770
|
function atomicWriteFile(target, data, options = {}) {
|
|
19589
19771
|
const mode = options.mode ?? 420;
|
|
19590
19772
|
const parent = dirname12(target);
|
|
19591
19773
|
mkdirSync8(parent, { recursive: true });
|
|
19592
|
-
const tmp =
|
|
19774
|
+
const tmp = join22(parent, `.tmp.${process.pid}.${randSuffix()}`);
|
|
19593
19775
|
let fd = null;
|
|
19594
19776
|
try {
|
|
19595
19777
|
fd = openSync(tmp, "w", mode);
|
|
@@ -20464,7 +20646,7 @@ var init_sync_gitattributes = __esm({
|
|
|
20464
20646
|
// src/scripts/_cli/cmd_refresh.ts
|
|
20465
20647
|
import * as fs29 from "node:fs";
|
|
20466
20648
|
import * as path27 from "node:path";
|
|
20467
|
-
import { spawnSync as
|
|
20649
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
20468
20650
|
import process14 from "node:process";
|
|
20469
20651
|
import { fileURLToPath as fileURLToPath20, pathToFileURL as pathToFileURL14 } from "node:url";
|
|
20470
20652
|
function _print2(out, line = "") {
|
|
@@ -20512,7 +20694,7 @@ function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
|
|
|
20512
20694
|
return target;
|
|
20513
20695
|
}
|
|
20514
20696
|
function _default_runner(cmd) {
|
|
20515
|
-
const r =
|
|
20697
|
+
const r = spawnSync5(cmd[0], cmd.slice(1), { stdio: "inherit" });
|
|
20516
20698
|
if (r.error) {
|
|
20517
20699
|
_stderr.write(`agent-config refresh: cannot run ${cmd[0]}: ${osErrorStr(r.error)}
|
|
20518
20700
|
`);
|
|
@@ -20799,8 +20981,8 @@ function lockfile_path(env) {
|
|
|
20799
20981
|
}
|
|
20800
20982
|
return write_target("installed.lock", { env: env ?? null });
|
|
20801
20983
|
}
|
|
20802
|
-
function read_lockfile(
|
|
20803
|
-
const target =
|
|
20984
|
+
function read_lockfile(path47) {
|
|
20985
|
+
const target = path47 ?? lockfile_path();
|
|
20804
20986
|
let text;
|
|
20805
20987
|
try {
|
|
20806
20988
|
text = fs30.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -21010,18 +21192,18 @@ function manifest_path(project_root, env) {
|
|
|
21010
21192
|
}
|
|
21011
21193
|
return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
|
|
21012
21194
|
}
|
|
21013
|
-
function read_manifest(
|
|
21195
|
+
function read_manifest(path47) {
|
|
21014
21196
|
let text;
|
|
21015
21197
|
try {
|
|
21016
|
-
text = require_read_text(
|
|
21198
|
+
text = require_read_text(path47);
|
|
21017
21199
|
} catch {
|
|
21018
21200
|
return null;
|
|
21019
21201
|
}
|
|
21020
21202
|
const data = _parse_manual(text);
|
|
21021
21203
|
return _normalise_v2_shape(data);
|
|
21022
21204
|
}
|
|
21023
|
-
function require_read_text(
|
|
21024
|
-
return fs32.readFileSync(
|
|
21205
|
+
function require_read_text(path47) {
|
|
21206
|
+
return fs32.readFileSync(path47, { encoding: "utf-8" });
|
|
21025
21207
|
}
|
|
21026
21208
|
function _normalise_v2_shape(data) {
|
|
21027
21209
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -21202,9 +21384,9 @@ function stable_sort(items, key) {
|
|
|
21202
21384
|
return a.index - b.index;
|
|
21203
21385
|
}).map((entry) => entry.item);
|
|
21204
21386
|
}
|
|
21205
|
-
function write_manifest(
|
|
21387
|
+
function write_manifest(path47, version, tools, options = {}) {
|
|
21206
21388
|
const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
21207
|
-
return write_atomic(
|
|
21389
|
+
return write_atomic(path47, rendered);
|
|
21208
21390
|
}
|
|
21209
21391
|
function upsert_tool(existing, options) {
|
|
21210
21392
|
const {
|
|
@@ -21756,6 +21938,50 @@ var init_global_deploy_inventory = __esm({
|
|
|
21756
21938
|
}
|
|
21757
21939
|
});
|
|
21758
21940
|
|
|
21941
|
+
// src/scripts/_lib/duplicate_scope_census.ts
|
|
21942
|
+
import * as fs34 from "node:fs";
|
|
21943
|
+
import * as path31 from "node:path";
|
|
21944
|
+
function censusDuplicateScope(userRulesDir, projectRulesDir) {
|
|
21945
|
+
if (!fs34.existsSync(userRulesDir) || !fs34.existsSync(projectRulesDir)) {
|
|
21946
|
+
return {
|
|
21947
|
+
evaluable: false,
|
|
21948
|
+
reason: `one or both rule directories are missing (user: ${userRulesDir}, project: ${projectRulesDir})`,
|
|
21949
|
+
shared_filenames: [],
|
|
21950
|
+
duplicate_chars: 0
|
|
21951
|
+
};
|
|
21952
|
+
}
|
|
21953
|
+
const userFiles = new Set(fs34.readdirSync(userRulesDir).filter((f) => f.endsWith(".md")));
|
|
21954
|
+
const projectFiles = fs34.readdirSync(projectRulesDir).filter((f) => f.endsWith(".md"));
|
|
21955
|
+
const shared = [];
|
|
21956
|
+
let duplicateChars = 0;
|
|
21957
|
+
for (const f of projectFiles) {
|
|
21958
|
+
if (!userFiles.has(f)) continue;
|
|
21959
|
+
shared.push(f);
|
|
21960
|
+
const a = fs34.statSync(path31.join(userRulesDir, f)).size;
|
|
21961
|
+
const b = fs34.statSync(path31.join(projectRulesDir, f)).size;
|
|
21962
|
+
duplicateChars += Math.min(a, b);
|
|
21963
|
+
}
|
|
21964
|
+
shared.sort();
|
|
21965
|
+
if (shared.length === 0) {
|
|
21966
|
+
return {
|
|
21967
|
+
evaluable: false,
|
|
21968
|
+
reason: "no shared .md filenames between the two rule scopes \u2014 this checkout has no duplicate-scope install",
|
|
21969
|
+
shared_filenames: [],
|
|
21970
|
+
duplicate_chars: 0
|
|
21971
|
+
};
|
|
21972
|
+
}
|
|
21973
|
+
return {
|
|
21974
|
+
evaluable: true,
|
|
21975
|
+
shared_filenames: shared,
|
|
21976
|
+
duplicate_chars: duplicateChars
|
|
21977
|
+
};
|
|
21978
|
+
}
|
|
21979
|
+
var init_duplicate_scope_census = __esm({
|
|
21980
|
+
"src/scripts/_lib/duplicate_scope_census.ts"() {
|
|
21981
|
+
"use strict";
|
|
21982
|
+
}
|
|
21983
|
+
});
|
|
21984
|
+
|
|
21759
21985
|
// src/scripts/_lib/spawn_env.ts
|
|
21760
21986
|
function isDeniedByFamily(name) {
|
|
21761
21987
|
if (name.startsWith("LD_") || name.startsWith("DYLD_")) return true;
|
|
@@ -21828,8 +22054,8 @@ var init_spawn_env = __esm({
|
|
|
21828
22054
|
|
|
21829
22055
|
// src/scripts/ai_council/events_log.ts
|
|
21830
22056
|
import * as crypto4 from "node:crypto";
|
|
21831
|
-
import * as
|
|
21832
|
-
import * as
|
|
22057
|
+
import * as fs35 from "node:fs";
|
|
22058
|
+
import * as path32 from "node:path";
|
|
21833
22059
|
import { fileURLToPath as fileURLToPath21 } from "node:url";
|
|
21834
22060
|
function _hash_original_ask(originalAsk) {
|
|
21835
22061
|
if (!originalAsk) {
|
|
@@ -21925,9 +22151,9 @@ function appendEvent(event, opts = {}) {
|
|
|
21925
22151
|
}
|
|
21926
22152
|
}
|
|
21927
22153
|
const target = opts.logPath != null ? opts.logPath : _DEFAULT_LOG_PATH;
|
|
21928
|
-
|
|
22154
|
+
fs35.mkdirSync(path32.dirname(target), { recursive: true });
|
|
21929
22155
|
const line = _pyJsonDumpsCompact(record);
|
|
21930
|
-
|
|
22156
|
+
fs35.appendFileSync(target, line + "\n", { encoding: "utf-8" });
|
|
21931
22157
|
return true;
|
|
21932
22158
|
}
|
|
21933
22159
|
function _isoSecondsZ(d) {
|
|
@@ -22025,8 +22251,8 @@ var init_events_log = __esm({
|
|
|
22025
22251
|
]);
|
|
22026
22252
|
_KILL_SWITCH_ENV = "AGENT_CONFIG_NO_EVENTS_LOG";
|
|
22027
22253
|
_HERE11 = fileURLToPath21(import.meta.url);
|
|
22028
|
-
_REPO_ROOT =
|
|
22029
|
-
_DEFAULT_LOG_PATH =
|
|
22254
|
+
_REPO_ROOT = path32.resolve(path32.dirname(_HERE11), "..", "..", "..");
|
|
22255
|
+
_DEFAULT_LOG_PATH = path32.join(
|
|
22030
22256
|
_REPO_ROOT,
|
|
22031
22257
|
"agents",
|
|
22032
22258
|
"runtime",
|
|
@@ -22056,6 +22282,7 @@ __export(clients_exports, {
|
|
|
22056
22282
|
DEFAULT_OPENAI_CLI_MODEL: () => DEFAULT_OPENAI_CLI_MODEL,
|
|
22057
22283
|
DEFAULT_OPENAI_MODEL: () => DEFAULT_OPENAI_MODEL,
|
|
22058
22284
|
DEFAULT_PERPLEXITY_MODEL: () => DEFAULT_PERPLEXITY_MODEL,
|
|
22285
|
+
DEFAULT_PROMPT_CACHE_TTL: () => DEFAULT_PROMPT_CACHE_TTL,
|
|
22059
22286
|
DEFAULT_XAI_MODEL: () => DEFAULT_XAI_MODEL,
|
|
22060
22287
|
ExternalAIClient: () => ExternalAIClient,
|
|
22061
22288
|
GeminiCliClient: () => GeminiCliClient,
|
|
@@ -22082,6 +22309,7 @@ __export(clients_exports, {
|
|
|
22082
22309
|
_read_until_marker: () => _read_until_marker,
|
|
22083
22310
|
_setMonotonicSource: () => _setMonotonicSource,
|
|
22084
22311
|
_today_utc_iso: () => _today_utc_iso,
|
|
22312
|
+
assertCacheBreakpointOrder: () => assertCacheBreakpointOrder,
|
|
22085
22313
|
load_anthropic_key: () => load_anthropic_key,
|
|
22086
22314
|
load_cli_call_counts: () => load_cli_call_counts,
|
|
22087
22315
|
load_openai_key: () => load_openai_key,
|
|
@@ -22089,9 +22317,9 @@ __export(clients_exports, {
|
|
|
22089
22317
|
record_cli_call: () => record_cli_call,
|
|
22090
22318
|
reset_cli_call_counts: () => reset_cli_call_counts
|
|
22091
22319
|
});
|
|
22092
|
-
import { spawnSync as
|
|
22093
|
-
import * as
|
|
22094
|
-
import * as
|
|
22320
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
22321
|
+
import * as fs36 from "node:fs";
|
|
22322
|
+
import * as path33 from "node:path";
|
|
22095
22323
|
function _resolveKeyPath(filename) {
|
|
22096
22324
|
const found = resolve_with_fallback(filename);
|
|
22097
22325
|
if (found !== null) {
|
|
@@ -22103,6 +22331,18 @@ function _is_reasoning_model(model) {
|
|
|
22103
22331
|
const name = model.toLowerCase();
|
|
22104
22332
|
return _REASONING_PREFIXES.some((p) => name === p || name.startsWith(`${p}-`));
|
|
22105
22333
|
}
|
|
22334
|
+
function assertCacheBreakpointOrder(ttls) {
|
|
22335
|
+
let sawFiveMinute = false;
|
|
22336
|
+
for (const ttl of ttls) {
|
|
22337
|
+
if (ttl === "5m") {
|
|
22338
|
+
sawFiveMinute = true;
|
|
22339
|
+
} else if (ttl === "1h" && sawFiveMinute) {
|
|
22340
|
+
throw new TypeError(
|
|
22341
|
+
`cache_control breakpoint order violation: a '1h' breakpoint followed a '5m' one (${JSON.stringify(ttls)}) \u2014 Anthropic requires every 1h breakpoint before any 5m breakpoint.`
|
|
22342
|
+
);
|
|
22343
|
+
}
|
|
22344
|
+
}
|
|
22345
|
+
}
|
|
22106
22346
|
function _nowMs() {
|
|
22107
22347
|
return _monotonicSource();
|
|
22108
22348
|
}
|
|
@@ -22115,13 +22355,13 @@ function _setMonotonicSource(fn) {
|
|
|
22115
22355
|
return prev;
|
|
22116
22356
|
}
|
|
22117
22357
|
function _loadKey(p, prefix, installScript) {
|
|
22118
|
-
if (!
|
|
22358
|
+
if (!fs36.existsSync(p)) {
|
|
22119
22359
|
throw new KeyGateError(
|
|
22120
22360
|
`Key not found at ${p}.
|
|
22121
22361
|
Install it with: bash ${installScript}`
|
|
22122
22362
|
);
|
|
22123
22363
|
}
|
|
22124
|
-
const st =
|
|
22364
|
+
const st = fs36.statSync(p);
|
|
22125
22365
|
const mode = st.mode & 511;
|
|
22126
22366
|
if (mode !== 384) {
|
|
22127
22367
|
throw new KeyGateError(
|
|
@@ -22129,7 +22369,7 @@ function _loadKey(p, prefix, installScript) {
|
|
|
22129
22369
|
Fix: chmod 600 ${p}`
|
|
22130
22370
|
);
|
|
22131
22371
|
}
|
|
22132
|
-
const key =
|
|
22372
|
+
const key = fs36.readFileSync(p, { encoding: "utf-8" }).trim();
|
|
22133
22373
|
if (!key) {
|
|
22134
22374
|
throw new KeyGateError(`${p} is empty.`);
|
|
22135
22375
|
}
|
|
@@ -22169,7 +22409,7 @@ function _curlJsonPost(url, extraHeaders, body) {
|
|
|
22169
22409
|
}
|
|
22170
22410
|
args.push("--connect-timeout", "30", "--max-time", "290");
|
|
22171
22411
|
args.push("-w", "\n%{http_code}", "--data-binary", "@-");
|
|
22172
|
-
const r =
|
|
22412
|
+
const r = spawnSync6("curl", args, {
|
|
22173
22413
|
input: JSON.stringify(body),
|
|
22174
22414
|
encoding: "utf8",
|
|
22175
22415
|
maxBuffer: 64 * 1024 * 1024,
|
|
@@ -22202,12 +22442,12 @@ function _today_utc_iso() {
|
|
|
22202
22442
|
}
|
|
22203
22443
|
function load_cli_call_counts(p = null) {
|
|
22204
22444
|
const target = p !== null ? p : _cliCallsStatePath();
|
|
22205
|
-
if (!
|
|
22445
|
+
if (!fs36.existsSync(target)) {
|
|
22206
22446
|
return {};
|
|
22207
22447
|
}
|
|
22208
22448
|
let data;
|
|
22209
22449
|
try {
|
|
22210
|
-
data = JSON.parse(
|
|
22450
|
+
data = JSON.parse(fs36.readFileSync(target, { encoding: "utf-8" }));
|
|
22211
22451
|
} catch {
|
|
22212
22452
|
return {};
|
|
22213
22453
|
}
|
|
@@ -22234,8 +22474,8 @@ function record_cli_call(provider, p = null) {
|
|
|
22234
22474
|
const target = p !== null ? p : _cliCallsStatePath();
|
|
22235
22475
|
const counts = load_cli_call_counts(target);
|
|
22236
22476
|
counts[provider] = (counts[provider] ?? 0) + 1;
|
|
22237
|
-
|
|
22238
|
-
|
|
22477
|
+
fs36.mkdirSync(path33.dirname(target), { recursive: true });
|
|
22478
|
+
fs36.writeFileSync(
|
|
22239
22479
|
target,
|
|
22240
22480
|
_jsonDumpsIndent2({ date: _today_utc_iso(), counts }),
|
|
22241
22481
|
{ encoding: "utf-8" }
|
|
@@ -22250,8 +22490,8 @@ function reset_cli_call_counts(provider = null, p = null) {
|
|
|
22250
22490
|
} else {
|
|
22251
22491
|
delete counts[provider];
|
|
22252
22492
|
}
|
|
22253
|
-
|
|
22254
|
-
|
|
22493
|
+
fs36.mkdirSync(path33.dirname(target), { recursive: true });
|
|
22494
|
+
fs36.writeFileSync(
|
|
22255
22495
|
target,
|
|
22256
22496
|
_jsonDumpsIndent2({ date: _today_utc_iso(), counts }),
|
|
22257
22497
|
{ encoding: "utf-8" }
|
|
@@ -22546,7 +22786,7 @@ function _pyJsonStringAscii(s) {
|
|
|
22546
22786
|
return out + '"';
|
|
22547
22787
|
}
|
|
22548
22788
|
function _which(name) {
|
|
22549
|
-
if (name.includes(
|
|
22789
|
+
if (name.includes(path33.sep) || path33.sep !== "/" && name.includes("/")) {
|
|
22550
22790
|
return _isExecutable(name) ? name : null;
|
|
22551
22791
|
}
|
|
22552
22792
|
const pathEnv = process.env.PATH ?? "";
|
|
@@ -22554,12 +22794,12 @@ function _which(name) {
|
|
|
22554
22794
|
return null;
|
|
22555
22795
|
}
|
|
22556
22796
|
const exts = process.platform === "win32" ? (process.env.PATHEXT ?? ".COM;.EXE;.BAT;.CMD").split(";").filter(Boolean) : [""];
|
|
22557
|
-
for (const dir of pathEnv.split(
|
|
22797
|
+
for (const dir of pathEnv.split(path33.delimiter)) {
|
|
22558
22798
|
if (!dir) {
|
|
22559
22799
|
continue;
|
|
22560
22800
|
}
|
|
22561
22801
|
for (const ext of exts) {
|
|
22562
|
-
const candidate =
|
|
22802
|
+
const candidate = path33.join(dir, name + ext);
|
|
22563
22803
|
if (_isExecutable(candidate)) {
|
|
22564
22804
|
return candidate;
|
|
22565
22805
|
}
|
|
@@ -22569,7 +22809,7 @@ function _which(name) {
|
|
|
22569
22809
|
}
|
|
22570
22810
|
function _isExecutable(p) {
|
|
22571
22811
|
try {
|
|
22572
|
-
const st =
|
|
22812
|
+
const st = fs36.statSync(p);
|
|
22573
22813
|
if (!st.isFile()) {
|
|
22574
22814
|
return false;
|
|
22575
22815
|
}
|
|
@@ -22596,7 +22836,7 @@ function _defaultStdin() {
|
|
|
22596
22836
|
function ensure() {
|
|
22597
22837
|
if (buffer === null) {
|
|
22598
22838
|
try {
|
|
22599
|
-
buffer =
|
|
22839
|
+
buffer = fs36.readFileSync(0, { encoding: "utf-8" });
|
|
22600
22840
|
} catch {
|
|
22601
22841
|
buffer = "";
|
|
22602
22842
|
}
|
|
@@ -22635,7 +22875,7 @@ function _defaultStdin() {
|
|
|
22635
22875
|
}
|
|
22636
22876
|
};
|
|
22637
22877
|
}
|
|
22638
|
-
var ANTHROPIC_KEY_FILENAME, OPENAI_KEY_FILENAME, ANTHROPIC_KEY_PATH, OPENAI_KEY_PATH, DEFAULT_ANTHROPIC_MODEL, DEFAULT_OPENAI_MODEL, DEFAULT_GEMINI_MODEL, DEFAULT_XAI_MODEL, DEFAULT_PERPLEXITY_MODEL, DEFAULT_OPENAI_CLI_MODEL, DEFAULT_ANTHROPIC_CLI_MODEL, DEFAULT_GEMINI_CLI_MODEL, XAI_BASE_URL, PERPLEXITY_BASE_URL, DEFAULT_MAX_TOKENS, UNLIMITED_TOKENS_FALLBACK, _REASONING_PREFIXES, KeyGateError, CliClientError, CouncilResponse, _monotonicSource, ExternalAIClient, AnthropicClient, OpenAIClient, GeminiClient, _OpenAICompatibleClient, XAIClient, PerplexityClient, CLI_CALLS_FILENAME, DEFAULT_CLI_TIMEOUT_SECONDS, SubprocessError, CliClient, AnthropicCliClient, OpenAICliClient, GeminiCliClient, XAICliClient, PerplexityCliClient, MANUAL_END_MARKER, ManualClient, ValueError3, JSONDecodeError;
|
|
22878
|
+
var ANTHROPIC_KEY_FILENAME, OPENAI_KEY_FILENAME, ANTHROPIC_KEY_PATH, OPENAI_KEY_PATH, DEFAULT_ANTHROPIC_MODEL, DEFAULT_OPENAI_MODEL, DEFAULT_GEMINI_MODEL, DEFAULT_XAI_MODEL, DEFAULT_PERPLEXITY_MODEL, DEFAULT_OPENAI_CLI_MODEL, DEFAULT_ANTHROPIC_CLI_MODEL, DEFAULT_GEMINI_CLI_MODEL, XAI_BASE_URL, PERPLEXITY_BASE_URL, DEFAULT_MAX_TOKENS, UNLIMITED_TOKENS_FALLBACK, _REASONING_PREFIXES, KeyGateError, CliClientError, DEFAULT_PROMPT_CACHE_TTL, CouncilResponse, _monotonicSource, ExternalAIClient, AnthropicClient, OpenAIClient, GeminiClient, _OpenAICompatibleClient, XAIClient, PerplexityClient, CLI_CALLS_FILENAME, DEFAULT_CLI_TIMEOUT_SECONDS, SubprocessError, CliClient, AnthropicCliClient, OpenAICliClient, GeminiCliClient, XAICliClient, PerplexityCliClient, MANUAL_END_MARKER, ManualClient, ValueError3, JSONDecodeError;
|
|
22639
22879
|
var init_clients = __esm({
|
|
22640
22880
|
"src/scripts/ai_council/clients.ts"() {
|
|
22641
22881
|
"use strict";
|
|
@@ -22658,7 +22898,7 @@ var init_clients = __esm({
|
|
|
22658
22898
|
PERPLEXITY_BASE_URL = "https://api.perplexity.ai";
|
|
22659
22899
|
DEFAULT_MAX_TOKENS = 2048;
|
|
22660
22900
|
UNLIMITED_TOKENS_FALLBACK = 16384;
|
|
22661
|
-
_REASONING_PREFIXES = ["o1", "o3", "o4"];
|
|
22901
|
+
_REASONING_PREFIXES = ["o1", "o3", "o4", "gpt-5"];
|
|
22662
22902
|
KeyGateError = class extends Error {
|
|
22663
22903
|
constructor(message) {
|
|
22664
22904
|
super(message);
|
|
@@ -22671,6 +22911,7 @@ var init_clients = __esm({
|
|
|
22671
22911
|
this.name = "CliClientError";
|
|
22672
22912
|
}
|
|
22673
22913
|
};
|
|
22914
|
+
DEFAULT_PROMPT_CACHE_TTL = "5m";
|
|
22674
22915
|
CouncilResponse = class {
|
|
22675
22916
|
provider;
|
|
22676
22917
|
model;
|
|
@@ -22732,10 +22973,16 @@ var init_clients = __esm({
|
|
|
22732
22973
|
// ApiClientOptions.enable_prompt_cache. Prevents silent activation (and the
|
|
22733
22974
|
// write premium) for callers that don't benefit from a shared-prefix cache.
|
|
22734
22975
|
_enablePromptCache;
|
|
22976
|
+
// TTL applied to BOTH cache_control breakpoints below. '5m' (the
|
|
22977
|
+
// default) is never serialised on the wire — omitting `ttl` is the
|
|
22978
|
+
// Anthropic API's own 5-minute default, so the default case stays
|
|
22979
|
+
// byte-identical to the pre-Phase-4 request shape.
|
|
22980
|
+
_promptCacheTtl;
|
|
22735
22981
|
constructor(opts = {}) {
|
|
22736
22982
|
super();
|
|
22737
22983
|
this.model = opts.model ?? DEFAULT_ANTHROPIC_MODEL;
|
|
22738
22984
|
this._enablePromptCache = opts.enable_prompt_cache ?? false;
|
|
22985
|
+
this._promptCacheTtl = opts.prompt_cache_ttl ?? DEFAULT_PROMPT_CACHE_TTL;
|
|
22739
22986
|
if (opts.client !== void 0 && opts.client !== null) {
|
|
22740
22987
|
this._client = opts.client;
|
|
22741
22988
|
return;
|
|
@@ -22772,6 +23019,9 @@ var init_clients = __esm({
|
|
|
22772
23019
|
if (typeof create !== "function") {
|
|
22773
23020
|
throw new TypeError("'messages.create' is not callable");
|
|
22774
23021
|
}
|
|
23022
|
+
const ttl = this._promptCacheTtl;
|
|
23023
|
+
assertCacheBreakpointOrder([ttl, ttl]);
|
|
23024
|
+
const cache_control = ttl === "1h" ? { type: "ephemeral", ttl: "1h" } : { type: "ephemeral" };
|
|
22775
23025
|
const kwargs = this._enablePromptCache ? {
|
|
22776
23026
|
model: this.model,
|
|
22777
23027
|
max_tokens,
|
|
@@ -22779,7 +23029,7 @@ var init_clients = __esm({
|
|
|
22779
23029
|
{
|
|
22780
23030
|
type: "text",
|
|
22781
23031
|
text: system_prompt,
|
|
22782
|
-
cache_control
|
|
23032
|
+
cache_control
|
|
22783
23033
|
}
|
|
22784
23034
|
],
|
|
22785
23035
|
messages: [
|
|
@@ -22789,11 +23039,13 @@ var init_clients = __esm({
|
|
|
22789
23039
|
// volatile suffix (round critiques) rides after
|
|
22790
23040
|
// it, so round N+1 reads the cached prefix
|
|
22791
23041
|
// instead of re-writing it (A3 read unlock).
|
|
23042
|
+
// The volatile suffix NEVER carries cache_control
|
|
23043
|
+
// — the ttl reaches only the stable prefix.
|
|
22792
23044
|
content: [
|
|
22793
23045
|
{
|
|
22794
23046
|
type: "text",
|
|
22795
23047
|
text: stable_prompt,
|
|
22796
|
-
cache_control
|
|
23048
|
+
cache_control
|
|
22797
23049
|
},
|
|
22798
23050
|
...volatile_suffix ? [{ type: "text", text: volatile_suffix }] : []
|
|
22799
23051
|
]
|
|
@@ -23168,7 +23420,7 @@ ${user_prompt}`;
|
|
|
23168
23420
|
if (stdinPayload !== null) {
|
|
23169
23421
|
spawnOpts.input = stdinPayload;
|
|
23170
23422
|
}
|
|
23171
|
-
const r =
|
|
23423
|
+
const r = spawnSync6(argv0, cmd.slice(1), spawnOpts);
|
|
23172
23424
|
if (r.error) {
|
|
23173
23425
|
const err = r.error;
|
|
23174
23426
|
if (r.signal === "SIGTERM" || err.code === "ETIMEDOUT") {
|
|
@@ -23831,9 +24083,9 @@ __export(config_exports, {
|
|
|
23831
24083
|
resolve_api_key: () => resolve_api_key,
|
|
23832
24084
|
resolve_config_path: () => resolve_config_path
|
|
23833
24085
|
});
|
|
23834
|
-
import * as
|
|
24086
|
+
import * as fs37 from "node:fs";
|
|
23835
24087
|
import * as os8 from "node:os";
|
|
23836
|
-
import * as
|
|
24088
|
+
import * as path34 from "node:path";
|
|
23837
24089
|
function _pyReprStr(s) {
|
|
23838
24090
|
const hasSingle = s.includes("'");
|
|
23839
24091
|
const hasDouble = s.includes('"');
|
|
@@ -24004,7 +24256,7 @@ function _expanduser2(p) {
|
|
|
24004
24256
|
return os8.homedir();
|
|
24005
24257
|
}
|
|
24006
24258
|
if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
|
|
24007
|
-
return
|
|
24259
|
+
return path34.join(os8.homedir(), p.slice(2));
|
|
24008
24260
|
}
|
|
24009
24261
|
return p;
|
|
24010
24262
|
}
|
|
@@ -24033,14 +24285,14 @@ function resolve_config_path(project_root, options = {}) {
|
|
|
24033
24285
|
});
|
|
24034
24286
|
}
|
|
24035
24287
|
function load_council_config(p) {
|
|
24036
|
-
if (!
|
|
24288
|
+
if (!fs37.existsSync(p)) {
|
|
24037
24289
|
throw new CouncilConfigError(
|
|
24038
24290
|
`Council config not found at ${p}. Create it per docs/contracts/ai-council-config.md.`
|
|
24039
24291
|
);
|
|
24040
24292
|
}
|
|
24041
24293
|
let raw;
|
|
24042
24294
|
try {
|
|
24043
|
-
const text =
|
|
24295
|
+
const text = fs37.readFileSync(p, "utf-8");
|
|
24044
24296
|
const parsed = (0, import_yaml5.parse)(text, { version: "1.1" });
|
|
24045
24297
|
raw = parsed === null || parsed === void 0 ? {} : parsed;
|
|
24046
24298
|
} catch (exc) {
|
|
@@ -24752,13 +25004,15 @@ function _build_cost_budget(d) {
|
|
|
24752
25004
|
max_input_tokens: _pyInt2(_get(d, "max_input_tokens", 5e5)),
|
|
24753
25005
|
max_output_tokens: _pyInt2(_get(d, "max_output_tokens", 2e5)),
|
|
24754
25006
|
max_calls: _pyInt2(_get(d, "max_calls", 50)),
|
|
24755
|
-
max_total_usd: _pyFloat(_get(d, "max_total_usd", 20))
|
|
25007
|
+
max_total_usd: _pyFloat(_get(d, "max_total_usd", 20)),
|
|
25008
|
+
daily_limit_usd: _pyFloat(_get(d, "daily_limit_usd", 0))
|
|
24756
25009
|
};
|
|
24757
25010
|
const fields = [
|
|
24758
25011
|
["max_input_tokens", false],
|
|
24759
25012
|
["max_output_tokens", false],
|
|
24760
25013
|
["max_calls", false],
|
|
24761
|
-
["max_total_usd", true]
|
|
25014
|
+
["max_total_usd", true],
|
|
25015
|
+
["daily_limit_usd", true]
|
|
24762
25016
|
];
|
|
24763
25017
|
for (const [fname, isFloat] of fields) {
|
|
24764
25018
|
const val = cb[fname];
|
|
@@ -24858,6 +25112,22 @@ function _build_member(name, cfg, default_mode = "api") {
|
|
|
24858
25112
|
}
|
|
24859
25113
|
tier = tier_raw;
|
|
24860
25114
|
}
|
|
25115
|
+
const prompt_cache_raw = _get(cfg, "prompt_cache", null);
|
|
25116
|
+
let prompt_cache_ttl = "5m";
|
|
25117
|
+
if (prompt_cache_raw !== null && prompt_cache_raw !== void 0 && !_isBool(prompt_cache_raw)) {
|
|
25118
|
+
if (!_isDict(prompt_cache_raw)) {
|
|
25119
|
+
throw new CouncilConfigError(
|
|
25120
|
+
`members.${name}.prompt_cache must be a bool or a mapping (got ${_pyTypeName(prompt_cache_raw)}).`
|
|
25121
|
+
);
|
|
25122
|
+
}
|
|
25123
|
+
const ttl_raw = _get(prompt_cache_raw, "ttl", "5m");
|
|
25124
|
+
if (ttl_raw !== "5m" && ttl_raw !== "1h") {
|
|
25125
|
+
throw new CouncilConfigError(
|
|
25126
|
+
`members.${name}.prompt_cache.ttl must be '5m' or '1h' (got ${_pyRepr6(ttl_raw)}). '5m' remains the default until a pre-registered 30-debate gap sample clears 40% at >=5-minute inter-round gaps.`
|
|
25127
|
+
);
|
|
25128
|
+
}
|
|
25129
|
+
prompt_cache_ttl = ttl_raw;
|
|
25130
|
+
}
|
|
24861
25131
|
return {
|
|
24862
25132
|
name,
|
|
24863
25133
|
enabled: member_enabled,
|
|
@@ -24867,7 +25137,8 @@ function _build_member(name, cfg, default_mode = "api") {
|
|
|
24867
25137
|
binary: binary ?? null,
|
|
24868
25138
|
model_ladder: ladder,
|
|
24869
25139
|
participate_low_impact: participate_raw,
|
|
24870
|
-
tier
|
|
25140
|
+
tier,
|
|
25141
|
+
prompt_cache_ttl
|
|
24871
25142
|
};
|
|
24872
25143
|
}
|
|
24873
25144
|
function _build_cli_call_budget(d) {
|
|
@@ -24992,16 +25263,16 @@ function resolve_api_key(ref, scope = "api_key_ref") {
|
|
|
24992
25263
|
}
|
|
24993
25264
|
resolved = found;
|
|
24994
25265
|
}
|
|
24995
|
-
if (!
|
|
25266
|
+
if (!fs37.existsSync(resolved)) {
|
|
24996
25267
|
throw new CouncilConfigError(`${scope}: key file does not exist at ${resolved}.`);
|
|
24997
25268
|
}
|
|
24998
|
-
const mode =
|
|
25269
|
+
const mode = fs37.statSync(resolved).mode & 4095;
|
|
24999
25270
|
if (mode !== 384) {
|
|
25000
25271
|
throw new CouncilConfigError(
|
|
25001
25272
|
`${scope}: unsafe permissions on ${resolved}: got ${_pyOct(mode)}, expected 0o600. Fix: chmod 600 ${resolved}`
|
|
25002
25273
|
);
|
|
25003
25274
|
}
|
|
25004
|
-
const value =
|
|
25275
|
+
const value = fs37.readFileSync(resolved, "utf-8").trim();
|
|
25005
25276
|
if (value === "") {
|
|
25006
25277
|
throw new CouncilConfigError(`${scope}: key file at ${resolved} is empty.`);
|
|
25007
25278
|
}
|
|
@@ -25136,17 +25407,17 @@ var init_config2 = __esm({
|
|
|
25136
25407
|
|
|
25137
25408
|
// src/scripts/ai_team/review_gate.ts
|
|
25138
25409
|
import * as crypto5 from "node:crypto";
|
|
25139
|
-
import * as
|
|
25410
|
+
import * as fs38 from "node:fs";
|
|
25140
25411
|
import * as os9 from "node:os";
|
|
25141
|
-
import * as
|
|
25412
|
+
import * as path35 from "node:path";
|
|
25142
25413
|
function _workspace_state_segment(workspace_root) {
|
|
25143
25414
|
let canonical = workspace_root;
|
|
25144
25415
|
try {
|
|
25145
|
-
canonical =
|
|
25416
|
+
canonical = fs38.realpathSync.native(workspace_root);
|
|
25146
25417
|
} catch {
|
|
25147
25418
|
canonical = workspace_root;
|
|
25148
25419
|
}
|
|
25149
|
-
const slug_source =
|
|
25420
|
+
const slug_source = path35.basename(workspace_root) || "workspace";
|
|
25150
25421
|
const slug = slug_source.replace(/[^a-zA-Z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "workspace";
|
|
25151
25422
|
const hash = crypto5.createHash("sha256").update(canonical).digest("hex").slice(0, 16);
|
|
25152
25423
|
return `${slug}-${hash}`;
|
|
@@ -25156,19 +25427,19 @@ function upstream_state_dir_candidates(workspace_root) {
|
|
|
25156
25427
|
const candidates = [];
|
|
25157
25428
|
const env = (process.env["CLAUDE_PLUGIN_DATA"] ?? "").trim();
|
|
25158
25429
|
if (env !== "") {
|
|
25159
|
-
candidates.push(
|
|
25430
|
+
candidates.push(path35.join(env, "state", segment));
|
|
25160
25431
|
}
|
|
25161
25432
|
candidates.push(
|
|
25162
|
-
|
|
25433
|
+
path35.join(claude_config_dir(), "plugins", "data", _CODEX_PLUGIN_DATA_DIRNAME, "state", segment)
|
|
25163
25434
|
);
|
|
25164
|
-
candidates.push(
|
|
25435
|
+
candidates.push(path35.join(os9.tmpdir(), "codex-companion", segment));
|
|
25165
25436
|
return candidates;
|
|
25166
25437
|
}
|
|
25167
25438
|
function upstream_gate_enabled(workspace_root) {
|
|
25168
25439
|
for (const dir of upstream_state_dir_candidates(workspace_root)) {
|
|
25169
25440
|
let parsed;
|
|
25170
25441
|
try {
|
|
25171
|
-
parsed = JSON.parse(
|
|
25442
|
+
parsed = JSON.parse(fs38.readFileSync(path35.join(dir, "state.json"), "utf-8"));
|
|
25172
25443
|
} catch {
|
|
25173
25444
|
continue;
|
|
25174
25445
|
}
|
|
@@ -25221,7 +25492,7 @@ var init_review_gate = __esm({
|
|
|
25221
25492
|
init_claude_plugin();
|
|
25222
25493
|
init_state_io();
|
|
25223
25494
|
init_config2();
|
|
25224
|
-
GATE_LEDGER_RELPATH =
|
|
25495
|
+
GATE_LEDGER_RELPATH = path35.join("agents", "runtime", "team", "events.log");
|
|
25225
25496
|
_CODEX_PLUGIN_DATA_DIRNAME = `${CODEX_PLUGIN_ID}-${CODEX_MARKETPLACE_NAME}`;
|
|
25226
25497
|
UPSTREAM_GATE_COST_WARNING = "The review gate can create a long-running Claude/Codex loop and may drain usage limits quickly.";
|
|
25227
25498
|
}
|
|
@@ -25349,6 +25620,38 @@ var init_claude_builtin_names = __esm({
|
|
|
25349
25620
|
}
|
|
25350
25621
|
});
|
|
25351
25622
|
|
|
25623
|
+
// src/scripts/_lib/compile_time_toggles.ts
|
|
25624
|
+
function rule_is_compile_enabled(rule_id, settings) {
|
|
25625
|
+
const predicate = COMPILE_TIME_TOGGLES[rule_id];
|
|
25626
|
+
return predicate === void 0 ? true : predicate(settings);
|
|
25627
|
+
}
|
|
25628
|
+
var COMPILE_TIME_TOGGLES;
|
|
25629
|
+
var init_compile_time_toggles = __esm({
|
|
25630
|
+
"src/scripts/_lib/compile_time_toggles.ts"() {
|
|
25631
|
+
"use strict";
|
|
25632
|
+
COMPILE_TIME_TOGGLES = {
|
|
25633
|
+
// `speak` defaults FALSE (dormant) per docs/adrs/telegraph/0002 — the absent-key
|
|
25634
|
+
// fallback used to be `true`, which silently contradicted ADR 0001 (accepted,
|
|
25635
|
+
// "default off until bench"). Measured basis: median vs_terse −9.27% (API) /
|
|
25636
|
+
// −5.47% (exact cl100k_base) — telegraph emits MORE than a plain "be terse".
|
|
25637
|
+
// Opt back in with an explicit `telegraph.speak: true` once an output-side bench
|
|
25638
|
+
// clears the kill-criterion bar. `enabled` keeps its true default: it is the
|
|
25639
|
+
// family master switch, and flipping it would silence sibling telegraph settings
|
|
25640
|
+
// that were never measured negative.
|
|
25641
|
+
//
|
|
25642
|
+
// This predicate deliberately does NOT read `speak_scope`. That key disables the
|
|
25643
|
+
// rule's *behaviour* and never removed its token cost — the trap the measurement
|
|
25644
|
+
// exposed.
|
|
25645
|
+
"telegraph-speak": (s) => {
|
|
25646
|
+
const tg = s["telegraph"] ?? {};
|
|
25647
|
+
const enabled = tg["enabled"] === void 0 ? true : tg["enabled"];
|
|
25648
|
+
const speak = tg["speak"] === void 0 ? false : tg["speak"];
|
|
25649
|
+
return Boolean(enabled) && Boolean(speak);
|
|
25650
|
+
}
|
|
25651
|
+
};
|
|
25652
|
+
}
|
|
25653
|
+
});
|
|
25654
|
+
|
|
25352
25655
|
// src/scripts/_lib/script_output.ts
|
|
25353
25656
|
function _read_settings_level(settings_path) {
|
|
25354
25657
|
const data = load_agent_settings({ project_path: settings_path });
|
|
@@ -25437,9 +25740,9 @@ var init_model_tier = __esm({
|
|
|
25437
25740
|
});
|
|
25438
25741
|
|
|
25439
25742
|
// src/scripts/condense.ts
|
|
25440
|
-
import * as
|
|
25441
|
-
import * as
|
|
25442
|
-
import * as
|
|
25743
|
+
import * as fs39 from "node:fs";
|
|
25744
|
+
import * as os10 from "node:os";
|
|
25745
|
+
import * as path36 from "node:path";
|
|
25443
25746
|
import { fileURLToPath as fileURLToPath22, pathToFileURL as pathToFileURL15 } from "node:url";
|
|
25444
25747
|
function _yamlParse(text) {
|
|
25445
25748
|
try {
|
|
@@ -25451,8 +25754,8 @@ function _yamlParse(text) {
|
|
|
25451
25754
|
}
|
|
25452
25755
|
function _exists6(p) {
|
|
25453
25756
|
try {
|
|
25454
|
-
|
|
25455
|
-
|
|
25757
|
+
fs39.lstatSync(p);
|
|
25758
|
+
fs39.statSync(p);
|
|
25456
25759
|
return true;
|
|
25457
25760
|
} catch {
|
|
25458
25761
|
return false;
|
|
@@ -25460,7 +25763,7 @@ function _exists6(p) {
|
|
|
25460
25763
|
}
|
|
25461
25764
|
function _existsOrSymlink(p) {
|
|
25462
25765
|
try {
|
|
25463
|
-
|
|
25766
|
+
fs39.lstatSync(p);
|
|
25464
25767
|
return true;
|
|
25465
25768
|
} catch {
|
|
25466
25769
|
return false;
|
|
@@ -25468,50 +25771,50 @@ function _existsOrSymlink(p) {
|
|
|
25468
25771
|
}
|
|
25469
25772
|
function _isDir11(p) {
|
|
25470
25773
|
try {
|
|
25471
|
-
return
|
|
25774
|
+
return fs39.statSync(p).isDirectory();
|
|
25472
25775
|
} catch {
|
|
25473
25776
|
return false;
|
|
25474
25777
|
}
|
|
25475
25778
|
}
|
|
25476
25779
|
function _isFile13(p) {
|
|
25477
25780
|
try {
|
|
25478
|
-
return
|
|
25781
|
+
return fs39.statSync(p).isFile();
|
|
25479
25782
|
} catch {
|
|
25480
25783
|
return false;
|
|
25481
25784
|
}
|
|
25482
25785
|
}
|
|
25483
25786
|
function _isSymlink2(p) {
|
|
25484
25787
|
try {
|
|
25485
|
-
return
|
|
25788
|
+
return fs39.lstatSync(p).isSymbolicLink();
|
|
25486
25789
|
} catch {
|
|
25487
25790
|
return false;
|
|
25488
25791
|
}
|
|
25489
25792
|
}
|
|
25490
25793
|
function _isDirNoFollow(p) {
|
|
25491
25794
|
try {
|
|
25492
|
-
return
|
|
25795
|
+
return fs39.lstatSync(p).isDirectory();
|
|
25493
25796
|
} catch {
|
|
25494
25797
|
return false;
|
|
25495
25798
|
}
|
|
25496
25799
|
}
|
|
25497
25800
|
function _readText2(p) {
|
|
25498
|
-
return
|
|
25801
|
+
return fs39.readFileSync(p, "utf-8");
|
|
25499
25802
|
}
|
|
25500
25803
|
function _writeText2(p, text) {
|
|
25501
|
-
|
|
25804
|
+
fs39.writeFileSync(p, text, "utf-8");
|
|
25502
25805
|
}
|
|
25503
25806
|
function _mkdirp(p) {
|
|
25504
|
-
|
|
25807
|
+
fs39.mkdirSync(p, { recursive: true });
|
|
25505
25808
|
}
|
|
25506
25809
|
function _iterdirSorted4(p) {
|
|
25507
25810
|
let names;
|
|
25508
25811
|
try {
|
|
25509
|
-
names =
|
|
25812
|
+
names = fs39.readdirSync(p);
|
|
25510
25813
|
} catch {
|
|
25511
25814
|
return [];
|
|
25512
25815
|
}
|
|
25513
25816
|
names.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
25514
|
-
return names.map((n) =>
|
|
25817
|
+
return names.map((n) => path36.join(p, n));
|
|
25515
25818
|
}
|
|
25516
25819
|
function _rglobSorted4(root, pattern) {
|
|
25517
25820
|
const out = [];
|
|
@@ -25519,12 +25822,12 @@ function _rglobSorted4(root, pattern) {
|
|
|
25519
25822
|
const walk = (dir) => {
|
|
25520
25823
|
let entries;
|
|
25521
25824
|
try {
|
|
25522
|
-
entries =
|
|
25825
|
+
entries = fs39.readdirSync(dir, { withFileTypes: true });
|
|
25523
25826
|
} catch {
|
|
25524
25827
|
return;
|
|
25525
25828
|
}
|
|
25526
25829
|
for (const ent of entries) {
|
|
25527
|
-
const full =
|
|
25830
|
+
const full = path36.join(dir, ent.name);
|
|
25528
25831
|
const matches = suffix === null ? true : ent.name.endsWith(suffix);
|
|
25529
25832
|
if (matches) {
|
|
25530
25833
|
out.push(full);
|
|
@@ -25539,12 +25842,12 @@ function _rglobSorted4(root, pattern) {
|
|
|
25539
25842
|
return out;
|
|
25540
25843
|
}
|
|
25541
25844
|
function _relativeToPosix2(child, root) {
|
|
25542
|
-
const rel =
|
|
25543
|
-
return rel.split(
|
|
25845
|
+
const rel = path36.relative(root, child);
|
|
25846
|
+
return rel.split(path36.sep).join("/");
|
|
25544
25847
|
}
|
|
25545
25848
|
function _isUnder2(child, root) {
|
|
25546
|
-
const rel =
|
|
25547
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
25849
|
+
const rel = path36.relative(root, child);
|
|
25850
|
+
return rel !== "" && !rel.startsWith("..") && !path36.isAbsolute(rel);
|
|
25548
25851
|
}
|
|
25549
25852
|
function _posixParts(p) {
|
|
25550
25853
|
return p.split("/").filter((s) => s.length > 0);
|
|
@@ -25568,24 +25871,23 @@ function _stripChars(s, chars) {
|
|
|
25568
25871
|
function _deriveState(root) {
|
|
25569
25872
|
return {
|
|
25570
25873
|
PROJECT_ROOT: root,
|
|
25571
|
-
SOURCE_DIR:
|
|
25572
|
-
TARGET_DIR:
|
|
25573
|
-
AUGMENT_DIR:
|
|
25574
|
-
HASH_FILE: path35.join(root, "internal", ".condensation-hashes.json"),
|
|
25874
|
+
SOURCE_DIR: path36.join(root, ".agent-src.uncondensed"),
|
|
25875
|
+
TARGET_DIR: path36.join(root, "dist/agent-src"),
|
|
25876
|
+
AUGMENT_DIR: path36.join(root, ".augment"),
|
|
25575
25877
|
SETTINGS_FILE: project_settings_path(root),
|
|
25576
|
-
RULES_SOURCE:
|
|
25577
|
-
SKILLS_SOURCE:
|
|
25578
|
-
COMMANDS_SOURCE:
|
|
25579
|
-
PERSONAS_SOURCE:
|
|
25580
|
-
USER_TYPES_SOURCE:
|
|
25581
|
-
CLAUDE_SKILLS_DIR:
|
|
25878
|
+
RULES_SOURCE: path36.join(root, "dist/agent-src", "rules"),
|
|
25879
|
+
SKILLS_SOURCE: path36.join(root, "dist/agent-src", "skills"),
|
|
25880
|
+
COMMANDS_SOURCE: path36.join(root, "dist/agent-src", "commands"),
|
|
25881
|
+
PERSONAS_SOURCE: path36.join(root, "dist/agent-src", "personas"),
|
|
25882
|
+
USER_TYPES_SOURCE: path36.join(root, "dist/agent-src", "user-types"),
|
|
25883
|
+
CLAUDE_SKILLS_DIR: path36.join(root, ".claude", "skills"),
|
|
25582
25884
|
// ADR-109: subagents project from src/ directly (NOT dist/) — a subagent
|
|
25583
25885
|
// is an executable system prompt Claude Code runs verbatim; telegraph
|
|
25584
25886
|
// condensation would alter its behaviour, and it is not routed through the
|
|
25585
25887
|
// pack/discovery condensation flow.
|
|
25586
|
-
CLAUDE_AGENTS_DIR:
|
|
25587
|
-
SUBAGENTS_SOURCE:
|
|
25588
|
-
PLUGIN_SKILLS_DIR:
|
|
25888
|
+
CLAUDE_AGENTS_DIR: path36.join(root, ".claude", "agents"),
|
|
25889
|
+
SUBAGENTS_SOURCE: path36.join(root, "src", "subagents"),
|
|
25890
|
+
PLUGIN_SKILLS_DIR: path36.join(root, ".claude-plugin", "skills"),
|
|
25589
25891
|
iter_all_sources,
|
|
25590
25892
|
resolve_logical,
|
|
25591
25893
|
artefact_roots
|
|
@@ -25601,7 +25903,7 @@ function _any_source_root_exists() {
|
|
|
25601
25903
|
return [...MODULE_STATE.artefact_roots()].length > 0;
|
|
25602
25904
|
}
|
|
25603
25905
|
function _active_tools() {
|
|
25604
|
-
const tools_file =
|
|
25906
|
+
const tools_file = path36.join(MODULE_STATE.PROJECT_ROOT, "agents", ".agent-tools.yml");
|
|
25605
25907
|
if (!_exists6(tools_file)) {
|
|
25606
25908
|
return null;
|
|
25607
25909
|
}
|
|
@@ -25637,114 +25939,64 @@ function _read_augment_rules_use_symlinks() {
|
|
|
25637
25939
|
}
|
|
25638
25940
|
return false;
|
|
25639
25941
|
}
|
|
25640
|
-
function
|
|
25942
|
+
function _read_projection_scope_dedup() {
|
|
25641
25943
|
const data = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
|
|
25642
|
-
const
|
|
25643
|
-
if (typeof
|
|
25644
|
-
return
|
|
25944
|
+
const projection = data["projection"];
|
|
25945
|
+
if (typeof projection !== "object" || projection === null || Array.isArray(projection)) {
|
|
25946
|
+
return false;
|
|
25645
25947
|
}
|
|
25646
|
-
|
|
25647
|
-
|
|
25648
|
-
|
|
25649
|
-
const h = crypto6.createHash("sha256");
|
|
25650
|
-
h.update(fs38.readFileSync(filepath));
|
|
25651
|
-
return h.digest("hex");
|
|
25652
|
-
}
|
|
25653
|
-
function _slug_to_logical(slug) {
|
|
25654
|
-
for (const cand of [`skills/${slug}/SKILL.md`, `rules/${slug}.md`]) {
|
|
25655
|
-
if (_resolve_source(cand) !== null) {
|
|
25656
|
-
return cand;
|
|
25657
|
-
}
|
|
25948
|
+
const value = projection["scope_dedup"];
|
|
25949
|
+
if (typeof value === "boolean") {
|
|
25950
|
+
return value;
|
|
25658
25951
|
}
|
|
25659
|
-
|
|
25952
|
+
if (typeof value === "string") {
|
|
25953
|
+
return ["true", "yes", "on", "1"].includes(value.trim().toLowerCase());
|
|
25954
|
+
}
|
|
25955
|
+
return false;
|
|
25660
25956
|
}
|
|
25661
|
-
function
|
|
25662
|
-
const
|
|
25663
|
-
if (
|
|
25664
|
-
return
|
|
25957
|
+
function _dedupable_rules(tool_dir, rules, userHome) {
|
|
25958
|
+
const relative15 = USER_SCOPE_RULE_DIRS[tool_dir];
|
|
25959
|
+
if (relative15 === void 0) {
|
|
25960
|
+
return /* @__PURE__ */ new Set();
|
|
25665
25961
|
}
|
|
25666
|
-
let
|
|
25962
|
+
let userDirStat;
|
|
25963
|
+
const userDir = path36.join(userHome, relative15);
|
|
25667
25964
|
try {
|
|
25668
|
-
|
|
25965
|
+
userDirStat = fs39.statSync(userDir);
|
|
25669
25966
|
} catch {
|
|
25670
|
-
return
|
|
25671
|
-
}
|
|
25672
|
-
const deps = [];
|
|
25673
|
-
for (const key of _DEP_FRONTMATTER_KEYS) {
|
|
25674
|
-
const value = meta[key];
|
|
25675
|
-
if (!Array.isArray(value)) {
|
|
25676
|
-
continue;
|
|
25677
|
-
}
|
|
25678
|
-
for (const item of value) {
|
|
25679
|
-
if (typeof item !== "string") {
|
|
25680
|
-
continue;
|
|
25681
|
-
}
|
|
25682
|
-
const logical = _slug_to_logical(item.trim());
|
|
25683
|
-
if (logical !== null && logical !== relative15) {
|
|
25684
|
-
deps.push(logical);
|
|
25685
|
-
}
|
|
25686
|
-
}
|
|
25687
|
-
}
|
|
25688
|
-
return deps;
|
|
25689
|
-
}
|
|
25690
|
-
function effective_hash(relative15, _seen = null) {
|
|
25691
|
-
const source = _resolve_source(relative15);
|
|
25692
|
-
if (source === null) {
|
|
25693
|
-
return "";
|
|
25967
|
+
return /* @__PURE__ */ new Set();
|
|
25694
25968
|
}
|
|
25695
|
-
|
|
25696
|
-
|
|
25697
|
-
return own;
|
|
25969
|
+
if (!userDirStat.isDirectory()) {
|
|
25970
|
+
return /* @__PURE__ */ new Set();
|
|
25698
25971
|
}
|
|
25699
|
-
|
|
25700
|
-
(
|
|
25701
|
-
|
|
25702
|
-
if (deps.length === 0) {
|
|
25703
|
-
return own;
|
|
25972
|
+
if ((userDirStat.mode & 2) !== 0) {
|
|
25973
|
+
_print3(` \u26A0\uFE0F ${tool_dir}: user-scope rules dir is world-writable \u2014 scope-dedup skipped`);
|
|
25974
|
+
return /* @__PURE__ */ new Set();
|
|
25704
25975
|
}
|
|
25705
|
-
const
|
|
25706
|
-
|
|
25707
|
-
|
|
25708
|
-
|
|
25709
|
-
}
|
|
25710
|
-
function load_hashes() {
|
|
25711
|
-
if (_exists6(MODULE_STATE.HASH_FILE)) {
|
|
25976
|
+
const skip = /* @__PURE__ */ new Set();
|
|
25977
|
+
for (const rule of rules) {
|
|
25978
|
+
const twin = path36.join(userDir, rule);
|
|
25979
|
+
const source = path36.join(MODULE_STATE.RULES_SOURCE, rule);
|
|
25712
25980
|
try {
|
|
25713
|
-
|
|
25981
|
+
if (!_isFile13(twin) || !_isFile13(source)) continue;
|
|
25982
|
+
if (fs39.readFileSync(twin).equals(fs39.readFileSync(source))) {
|
|
25983
|
+
skip.add(rule);
|
|
25984
|
+
}
|
|
25714
25985
|
} catch {
|
|
25715
|
-
return {};
|
|
25716
25986
|
}
|
|
25717
25987
|
}
|
|
25718
|
-
return
|
|
25988
|
+
return skip;
|
|
25719
25989
|
}
|
|
25720
|
-
function
|
|
25721
|
-
|
|
25722
|
-
|
|
25723
|
-
|
|
25724
|
-
|
|
25725
|
-
const keys = Object.keys(obj).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
25726
|
-
if (keys.length === 0) {
|
|
25727
|
-
return "{}";
|
|
25728
|
-
}
|
|
25729
|
-
const lines = keys.map((k) => ` ${JSON.stringify(k)}: ${JSON.stringify(obj[k])}`);
|
|
25730
|
-
return `{
|
|
25731
|
-
${lines.join(",\n")}
|
|
25732
|
-
}`;
|
|
25733
|
-
}
|
|
25734
|
-
function mark_done(relative_path) {
|
|
25735
|
-
const source_file = _resolve_source(relative_path);
|
|
25736
|
-
if (source_file === null || !_exists6(source_file)) {
|
|
25737
|
-
_print3(`\u274C Source file not found: ${relative_path}`);
|
|
25738
|
-
process.exit(1);
|
|
25990
|
+
function _lean_projection_mode() {
|
|
25991
|
+
const data = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
|
|
25992
|
+
const lean = data["lean_projection"];
|
|
25993
|
+
if (typeof lean === "object" && lean !== null && !Array.isArray(lean) && String(lean["mode"] ?? "").trim().toLowerCase() === "thin") {
|
|
25994
|
+
return "thin";
|
|
25739
25995
|
}
|
|
25740
|
-
|
|
25741
|
-
const hashes = load_hashes();
|
|
25742
|
-
hashes[relative_path] = effective_hash(relative_path);
|
|
25743
|
-
save_hashes(hashes);
|
|
25744
|
-
_print3(`\u2705 Marked as condensed: ${relative_path}`);
|
|
25996
|
+
return "eager-all";
|
|
25745
25997
|
}
|
|
25746
25998
|
function apply_path_rewriter(relative_path) {
|
|
25747
|
-
const target =
|
|
25999
|
+
const target = path36.join(MODULE_STATE.TARGET_DIR, relative_path);
|
|
25748
26000
|
if (!_exists6(target) || !relative_path.endsWith(".md")) {
|
|
25749
26001
|
return false;
|
|
25750
26002
|
}
|
|
@@ -25756,64 +26008,46 @@ function apply_path_rewriter(relative_path) {
|
|
|
25756
26008
|
_writeText2(target, rewritten);
|
|
25757
26009
|
return true;
|
|
25758
26010
|
}
|
|
25759
|
-
function
|
|
25760
|
-
const
|
|
25761
|
-
|
|
25762
|
-
|
|
25763
|
-
|
|
25764
|
-
|
|
25765
|
-
|
|
25766
|
-
|
|
25767
|
-
|
|
26011
|
+
function is_projection_stale(relative15) {
|
|
26012
|
+
const source = _resolve_source(relative15);
|
|
26013
|
+
if (source === null) {
|
|
26014
|
+
return false;
|
|
26015
|
+
}
|
|
26016
|
+
if (skip_compile_disabled_rule(relative15)) {
|
|
26017
|
+
return false;
|
|
26018
|
+
}
|
|
26019
|
+
const target = path36.join(MODULE_STATE.TARGET_DIR, relative15);
|
|
26020
|
+
if (!_exists6(target)) {
|
|
26021
|
+
return true;
|
|
25768
26022
|
}
|
|
25769
|
-
|
|
25770
|
-
_print3(`\u2705 Marked ${count} files as condensed`);
|
|
26023
|
+
return _readText2(target) !== _rewrite_paths(_readText2(source), relative15);
|
|
25771
26024
|
}
|
|
25772
26025
|
function list_changed_md(_source_dir) {
|
|
25773
|
-
const hashes = load_hashes();
|
|
25774
26026
|
const changed = [];
|
|
25775
|
-
|
|
25776
|
-
|
|
26027
|
+
const seen = /* @__PURE__ */ new Set();
|
|
26028
|
+
for (const [, relative15] of _iter_sources()) {
|
|
26029
|
+
if (seen.has(relative15)) {
|
|
25777
26030
|
continue;
|
|
25778
26031
|
}
|
|
25779
|
-
|
|
25780
|
-
const
|
|
25781
|
-
if (
|
|
26032
|
+
seen.add(relative15);
|
|
26033
|
+
const source = _resolve_source(relative15);
|
|
26034
|
+
if (source === null || !should_condense(source)) {
|
|
26035
|
+
continue;
|
|
26036
|
+
}
|
|
26037
|
+
if (is_projection_stale(relative15)) {
|
|
25782
26038
|
changed.push(relative15);
|
|
25783
26039
|
}
|
|
25784
26040
|
}
|
|
25785
26041
|
return changed;
|
|
25786
26042
|
}
|
|
25787
|
-
function find_stale_hashes(_source_dir) {
|
|
25788
|
-
const hashes = load_hashes();
|
|
25789
|
-
const stale = [];
|
|
25790
|
-
for (const relative15 of Object.keys(hashes).sort((a, b) => a < b ? -1 : a > b ? 1 : 0)) {
|
|
25791
|
-
if (_resolve_source(relative15) === null) {
|
|
25792
|
-
stale.push(relative15);
|
|
25793
|
-
}
|
|
25794
|
-
}
|
|
25795
|
-
return stale;
|
|
25796
|
-
}
|
|
25797
|
-
function clean_stale_hashes(_source_dir) {
|
|
25798
|
-
const stale = find_stale_hashes(_source_dir);
|
|
25799
|
-
if (stale.length === 0) {
|
|
25800
|
-
return 0;
|
|
25801
|
-
}
|
|
25802
|
-
const hashes = load_hashes();
|
|
25803
|
-
for (const relative15 of stale) {
|
|
25804
|
-
delete hashes[relative15];
|
|
25805
|
-
}
|
|
25806
|
-
save_hashes(hashes);
|
|
25807
|
-
return stale.length;
|
|
25808
|
-
}
|
|
25809
26043
|
function should_condense(filepath) {
|
|
25810
|
-
if (
|
|
26044
|
+
if (path36.extname(filepath) !== ".md") {
|
|
25811
26045
|
return false;
|
|
25812
26046
|
}
|
|
25813
|
-
if (COPY_AS_IS.has(
|
|
26047
|
+
if (COPY_AS_IS.has(path36.basename(filepath))) {
|
|
25814
26048
|
return false;
|
|
25815
26049
|
}
|
|
25816
|
-
let rel_parts = filepath.split(
|
|
26050
|
+
let rel_parts = filepath.split(path36.sep).filter((s) => s.length > 0);
|
|
25817
26051
|
for (const root of MODULE_STATE.artefact_roots()) {
|
|
25818
26052
|
if (filepath !== root && !_isUnder2(filepath, root)) {
|
|
25819
26053
|
continue;
|
|
@@ -25827,12 +26061,12 @@ function should_condense(filepath) {
|
|
|
25827
26061
|
return true;
|
|
25828
26062
|
}
|
|
25829
26063
|
function copy_file(source, target) {
|
|
25830
|
-
_mkdirp(
|
|
25831
|
-
|
|
26064
|
+
_mkdirp(path36.dirname(target));
|
|
26065
|
+
fs39.copyFileSync(source, target);
|
|
25832
26066
|
try {
|
|
25833
|
-
const st =
|
|
25834
|
-
|
|
25835
|
-
|
|
26067
|
+
const st = fs39.statSync(source);
|
|
26068
|
+
fs39.utimesSync(target, st.atime, st.mtime);
|
|
26069
|
+
fs39.chmodSync(target, st.mode);
|
|
25836
26070
|
} catch {
|
|
25837
26071
|
}
|
|
25838
26072
|
}
|
|
@@ -25848,15 +26082,15 @@ function cleanup_stale(_source_dir, target_dir) {
|
|
|
25848
26082
|
const relative15 = _relativeToPosix2(target_file, target_dir);
|
|
25849
26083
|
if (_resolve_source(relative15) === null) {
|
|
25850
26084
|
_print3(` Deleting stale: ${relative15}`);
|
|
25851
|
-
|
|
26085
|
+
fs39.unlinkSync(target_file);
|
|
25852
26086
|
deleted += 1;
|
|
25853
26087
|
}
|
|
25854
26088
|
}
|
|
25855
26089
|
const dirs = _rglobSorted4(target_dir, "*").filter((p) => _isDir11(p)).sort((a, b) => a < b ? 1 : a > b ? -1 : 0);
|
|
25856
26090
|
for (const dirpath of dirs) {
|
|
25857
26091
|
try {
|
|
25858
|
-
if (
|
|
25859
|
-
|
|
26092
|
+
if (fs39.readdirSync(dirpath).length === 0) {
|
|
26093
|
+
fs39.rmdirSync(dirpath);
|
|
25860
26094
|
_print3(` Removing empty dir: ${_relativeToPosix2(dirpath, target_dir)}`);
|
|
25861
26095
|
}
|
|
25862
26096
|
} catch {
|
|
@@ -25864,19 +26098,34 @@ function cleanup_stale(_source_dir, target_dir) {
|
|
|
25864
26098
|
}
|
|
25865
26099
|
return deleted;
|
|
25866
26100
|
}
|
|
26101
|
+
function skip_compile_disabled_rule(relative15) {
|
|
26102
|
+
const posix = relative15.split(path36.sep).join("/");
|
|
26103
|
+
if (!posix.startsWith("rules/") || !posix.endsWith(".md")) {
|
|
26104
|
+
return false;
|
|
26105
|
+
}
|
|
26106
|
+
const rule_id = path36.basename(posix, ".md");
|
|
26107
|
+
const settings = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
|
|
26108
|
+
return !rule_is_compile_enabled(rule_id, settings);
|
|
26109
|
+
}
|
|
25867
26110
|
function sync_non_md(_source_dir, target_dir) {
|
|
25868
26111
|
let copied = 0;
|
|
25869
26112
|
const seen = /* @__PURE__ */ new Set();
|
|
25870
26113
|
for (const [source_file, relative15] of _iter_sources()) {
|
|
25871
|
-
if (should_condense(source_file)) {
|
|
26114
|
+
if (!COPY_MD_VERBATIM && should_condense(source_file)) {
|
|
25872
26115
|
continue;
|
|
25873
26116
|
}
|
|
25874
26117
|
if (seen.has(relative15)) {
|
|
25875
26118
|
continue;
|
|
25876
26119
|
}
|
|
26120
|
+
if (skip_compile_disabled_rule(relative15)) {
|
|
26121
|
+
continue;
|
|
26122
|
+
}
|
|
25877
26123
|
seen.add(relative15);
|
|
25878
|
-
const target_file =
|
|
26124
|
+
const target_file = path36.join(target_dir, relative15);
|
|
25879
26125
|
copy_file(source_file, target_file);
|
|
26126
|
+
if (COPY_MD_VERBATIM && relative15.endsWith(".md")) {
|
|
26127
|
+
apply_path_rewriter(relative15);
|
|
26128
|
+
}
|
|
25880
26129
|
_print3(` Copied: ${relative15}`);
|
|
25881
26130
|
copied += 1;
|
|
25882
26131
|
}
|
|
@@ -25906,7 +26155,10 @@ function check_sync(_source_dir, target_dir) {
|
|
|
25906
26155
|
continue;
|
|
25907
26156
|
}
|
|
25908
26157
|
seen.add(relative15);
|
|
25909
|
-
if (
|
|
26158
|
+
if (skip_compile_disabled_rule(relative15)) {
|
|
26159
|
+
continue;
|
|
26160
|
+
}
|
|
26161
|
+
if (!_exists6(path36.join(target_dir, relative15))) {
|
|
25910
26162
|
missing.push(relative15);
|
|
25911
26163
|
}
|
|
25912
26164
|
}
|
|
@@ -25916,7 +26168,7 @@ function check_sync(_source_dir, target_dir) {
|
|
|
25916
26168
|
continue;
|
|
25917
26169
|
}
|
|
25918
26170
|
const relative15 = _relativeToPosix2(target_file, target_dir);
|
|
25919
|
-
if (_resolve_source(relative15) === null) {
|
|
26171
|
+
if (_resolve_source(relative15) === null || skip_compile_disabled_rule(relative15)) {
|
|
25920
26172
|
stale.push(relative15);
|
|
25921
26173
|
}
|
|
25922
26174
|
}
|
|
@@ -26116,7 +26368,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
|
|
|
26116
26368
|
function _scoped_rule_basenames() {
|
|
26117
26369
|
const scope = _read_rule_workspaces();
|
|
26118
26370
|
const pack_scope = _read_rule_packs();
|
|
26119
|
-
return _iterdirSorted4(MODULE_STATE.RULES_SOURCE).filter((p) => p.endsWith(".md") && _isFile13(p)).filter((p) => rule_in_scope(p, scope, pack_scope)).map((p) =>
|
|
26371
|
+
return _iterdirSorted4(MODULE_STATE.RULES_SOURCE).filter((p) => p.endsWith(".md") && _isFile13(p)).filter((p) => rule_in_scope(p, scope, pack_scope)).filter((p) => !skip_compile_disabled_rule(`rules/${path36.basename(p)}`)).map((p) => path36.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
26120
26372
|
}
|
|
26121
26373
|
function generate_rule_symlinks() {
|
|
26122
26374
|
const rules = _scoped_rule_basenames();
|
|
@@ -26127,35 +26379,51 @@ function generate_rule_symlinks() {
|
|
|
26127
26379
|
"lean_projection.mode=thin requires project_thin_rules (not ported in condense.ts)"
|
|
26128
26380
|
);
|
|
26129
26381
|
}
|
|
26382
|
+
const dedup_on = _read_projection_scope_dedup();
|
|
26383
|
+
const user_home = process.env["HOME"] ?? os10.homedir();
|
|
26384
|
+
const skipped_per_tool = {};
|
|
26130
26385
|
let total = 0;
|
|
26131
26386
|
for (const [tool_dir, rel_prefix] of Object.entries(tool_dirs)) {
|
|
26132
|
-
const target_dir =
|
|
26387
|
+
const target_dir = path36.join(MODULE_STATE.PROJECT_ROOT, tool_dir);
|
|
26388
|
+
const skip = dedup_on ? _dedupable_rules(tool_dir, rules, user_home) : /* @__PURE__ */ new Set();
|
|
26389
|
+
skipped_per_tool[tool_dir] = skip;
|
|
26133
26390
|
_mkdirp(target_dir);
|
|
26134
26391
|
for (const item of _iterdirSorted4(target_dir)) {
|
|
26135
|
-
const name =
|
|
26136
|
-
if (_isSymlink2(item) && !rules.includes(name) && name !== "README.md") {
|
|
26137
|
-
|
|
26392
|
+
const name = path36.basename(item);
|
|
26393
|
+
if (_isSymlink2(item) && (!rules.includes(name) || skip.has(name)) && name !== "README.md") {
|
|
26394
|
+
fs39.unlinkSync(item);
|
|
26138
26395
|
}
|
|
26139
26396
|
}
|
|
26140
26397
|
for (const rule of rules) {
|
|
26141
|
-
|
|
26398
|
+
if (skip.has(rule)) {
|
|
26399
|
+
continue;
|
|
26400
|
+
}
|
|
26401
|
+
const link = path36.join(target_dir, rule);
|
|
26142
26402
|
if (_existsOrSymlink(link)) {
|
|
26143
|
-
|
|
26403
|
+
fs39.unlinkSync(link);
|
|
26144
26404
|
}
|
|
26145
26405
|
if (thin_files !== null) {
|
|
26146
26406
|
_writeText2(link, thin_files[rule]);
|
|
26147
26407
|
} else {
|
|
26148
|
-
|
|
26408
|
+
fs39.symlinkSync(path36.join(rel_prefix, rule), link);
|
|
26149
26409
|
}
|
|
26150
26410
|
total += 1;
|
|
26151
26411
|
}
|
|
26152
26412
|
}
|
|
26153
26413
|
const source_count = rules.length;
|
|
26154
26414
|
for (const tool_dir of Object.keys(tool_dirs)) {
|
|
26155
|
-
const target_dir =
|
|
26156
|
-
const
|
|
26157
|
-
|
|
26158
|
-
|
|
26415
|
+
const target_dir = path36.join(MODULE_STATE.PROJECT_ROOT, tool_dir);
|
|
26416
|
+
const emitted = new Set(rules);
|
|
26417
|
+
const tool_count = _iterdirSorted4(target_dir).filter((f) => emitted.has(path36.basename(f))).length;
|
|
26418
|
+
const skipped = (skipped_per_tool[tool_dir] ?? /* @__PURE__ */ new Set()).size;
|
|
26419
|
+
const expected = source_count - skipped;
|
|
26420
|
+
if (tool_count !== expected) {
|
|
26421
|
+
_print3(` \u26A0\uFE0F ${tool_dir}: ${tool_count} rules (expected ${expected})`);
|
|
26422
|
+
}
|
|
26423
|
+
if (skipped > 0) {
|
|
26424
|
+
_print3(
|
|
26425
|
+
` \u2139\uFE0F ${tool_dir}: ${skipped} rule(s) skipped \u2014 byte-identical twin already installed at user scope`
|
|
26426
|
+
);
|
|
26159
26427
|
}
|
|
26160
26428
|
}
|
|
26161
26429
|
info(
|
|
@@ -26167,29 +26435,29 @@ function generate_windsurfrules() {
|
|
|
26167
26435
|
const rules = _scoped_rule_basenames();
|
|
26168
26436
|
const parts = ["# Auto-generated from dist/agent-src/rules/ \u2014 do not edit directly\n"];
|
|
26169
26437
|
for (const rule of rules) {
|
|
26170
|
-
const p =
|
|
26438
|
+
const p = path36.join(MODULE_STATE.RULES_SOURCE, rule);
|
|
26171
26439
|
const content = strip_frontmatter(_readText2(p));
|
|
26172
26440
|
parts.push(`---
|
|
26173
26441
|
|
|
26174
26442
|
${_strip6(content)}
|
|
26175
26443
|
`);
|
|
26176
26444
|
}
|
|
26177
|
-
const output =
|
|
26445
|
+
const output = path36.join(MODULE_STATE.PROJECT_ROOT, ".windsurfrules");
|
|
26178
26446
|
_writeText2(output, parts.join("\n") + "\n");
|
|
26179
26447
|
info(` \u2705 Generated .windsurfrules (${rules.length} rules)`);
|
|
26180
26448
|
return rules.length;
|
|
26181
26449
|
}
|
|
26182
26450
|
function _CURSOR_RULES_MDC_DIR() {
|
|
26183
|
-
return
|
|
26451
|
+
return path36.join(MODULE_STATE.PROJECT_ROOT, ".cursor", "rules");
|
|
26184
26452
|
}
|
|
26185
26453
|
function _WINDSURF_RULES_DIR() {
|
|
26186
|
-
return
|
|
26454
|
+
return path36.join(MODULE_STATE.PROJECT_ROOT, ".windsurf", "rules");
|
|
26187
26455
|
}
|
|
26188
26456
|
function _WINDSURF_WORKFLOWS_DIR() {
|
|
26189
|
-
return
|
|
26457
|
+
return path36.join(MODULE_STATE.PROJECT_ROOT, ".windsurf", "workflows");
|
|
26190
26458
|
}
|
|
26191
26459
|
function _CURSOR_COMMANDS_DIR() {
|
|
26192
|
-
return
|
|
26460
|
+
return path36.join(MODULE_STATE.PROJECT_ROOT, ".cursor", "commands");
|
|
26193
26461
|
}
|
|
26194
26462
|
function _parse_frontmatter(content) {
|
|
26195
26463
|
if (!content.startsWith("---")) {
|
|
@@ -26245,7 +26513,7 @@ function _emit_cursor_mdc(source, target) {
|
|
|
26245
26513
|
"",
|
|
26246
26514
|
_pyRstrip(body) + "\n"
|
|
26247
26515
|
];
|
|
26248
|
-
_mkdirp(
|
|
26516
|
+
_mkdirp(path36.dirname(target));
|
|
26249
26517
|
_writeText2(target, lines.join("\n"));
|
|
26250
26518
|
}
|
|
26251
26519
|
function _emit_windsurf_rule(source, target) {
|
|
@@ -26263,7 +26531,7 @@ function _emit_windsurf_rule(source, target) {
|
|
|
26263
26531
|
"",
|
|
26264
26532
|
_pyRstrip(body) + "\n"
|
|
26265
26533
|
];
|
|
26266
|
-
_mkdirp(
|
|
26534
|
+
_mkdirp(path36.dirname(target));
|
|
26267
26535
|
_writeText2(target, lines.join("\n"));
|
|
26268
26536
|
}
|
|
26269
26537
|
function _pyRstrip(s) {
|
|
@@ -26274,15 +26542,15 @@ function _clean_modern_dir(target_dir, valid_names) {
|
|
|
26274
26542
|
return;
|
|
26275
26543
|
}
|
|
26276
26544
|
for (const item of _iterdirSorted4(target_dir)) {
|
|
26277
|
-
const name =
|
|
26545
|
+
const name = path36.basename(item);
|
|
26278
26546
|
if (name === "README.md") {
|
|
26279
26547
|
continue;
|
|
26280
26548
|
}
|
|
26281
26549
|
if (!valid_names.has(name)) {
|
|
26282
26550
|
if (_isDir11(item) && !_isSymlink2(item)) {
|
|
26283
|
-
|
|
26551
|
+
fs39.rmSync(item, { recursive: true, force: true });
|
|
26284
26552
|
} else {
|
|
26285
|
-
|
|
26553
|
+
fs39.unlinkSync(item);
|
|
26286
26554
|
}
|
|
26287
26555
|
}
|
|
26288
26556
|
}
|
|
@@ -26291,14 +26559,14 @@ function generate_cursor_mdc_rules() {
|
|
|
26291
26559
|
const scope = _read_rule_workspaces();
|
|
26292
26560
|
const pack_scope = _read_rule_packs();
|
|
26293
26561
|
const rules = _rglobSorted4(MODULE_STATE.RULES_SOURCE, "*.md").filter((p) => _isFile13(p)).filter((p) => rule_in_scope(p, scope, pack_scope));
|
|
26294
|
-
const stems = rules.map((r) =>
|
|
26562
|
+
const stems = rules.map((r) => path36.basename(r, ".md"));
|
|
26295
26563
|
const valid = /* @__PURE__ */ new Set([
|
|
26296
26564
|
...stems.map((s) => `${s}.mdc`),
|
|
26297
|
-
...rules.map((r) =>
|
|
26565
|
+
...rules.map((r) => path36.basename(r))
|
|
26298
26566
|
]);
|
|
26299
26567
|
_clean_modern_dir(_CURSOR_RULES_MDC_DIR(), valid);
|
|
26300
26568
|
for (const rule of rules) {
|
|
26301
|
-
_emit_cursor_mdc(rule,
|
|
26569
|
+
_emit_cursor_mdc(rule, path36.join(_CURSOR_RULES_MDC_DIR(), `${path36.basename(rule, ".md")}.mdc`));
|
|
26302
26570
|
}
|
|
26303
26571
|
info(` \u2705 Wrote ${rules.length} \`.cursor/rules/*.mdc\` files`);
|
|
26304
26572
|
return rules.length;
|
|
@@ -26307,16 +26575,16 @@ function generate_windsurf_modern_rules() {
|
|
|
26307
26575
|
const scope = _read_rule_workspaces();
|
|
26308
26576
|
const pack_scope = _read_rule_packs();
|
|
26309
26577
|
const rules = _rglobSorted4(MODULE_STATE.RULES_SOURCE, "*.md").filter((p) => _isFile13(p)).filter((p) => rule_in_scope(p, scope, pack_scope));
|
|
26310
|
-
const valid = new Set(rules.map((r) =>
|
|
26578
|
+
const valid = new Set(rules.map((r) => path36.basename(r)));
|
|
26311
26579
|
_clean_modern_dir(_WINDSURF_RULES_DIR(), valid);
|
|
26312
26580
|
for (const rule of rules) {
|
|
26313
|
-
_emit_windsurf_rule(rule,
|
|
26581
|
+
_emit_windsurf_rule(rule, path36.join(_WINDSURF_RULES_DIR(), path36.basename(rule)));
|
|
26314
26582
|
}
|
|
26315
26583
|
info(` \u2705 Wrote ${rules.length} \`.windsurf/rules/*.md\` files`);
|
|
26316
26584
|
return rules.length;
|
|
26317
26585
|
}
|
|
26318
26586
|
function generate_cursor_commands(active_command_slugs = null) {
|
|
26319
|
-
if (!_isDir11(
|
|
26587
|
+
if (!_isDir11(path36.join(MODULE_STATE.PROJECT_ROOT, "src", "domains"))) {
|
|
26320
26588
|
return 0;
|
|
26321
26589
|
}
|
|
26322
26590
|
const cmds = [...iterCommands()].filter(
|
|
@@ -26327,19 +26595,19 @@ function generate_cursor_commands(active_command_slugs = null) {
|
|
|
26327
26595
|
_mkdirp(_CURSOR_COMMANDS_DIR());
|
|
26328
26596
|
let count = 0;
|
|
26329
26597
|
for (const [source_file, slug] of cmds) {
|
|
26330
|
-
const link =
|
|
26598
|
+
const link = path36.join(_CURSOR_COMMANDS_DIR(), `${slug}.md`);
|
|
26331
26599
|
if (_existsOrSymlink(link)) {
|
|
26332
|
-
|
|
26600
|
+
fs39.unlinkSync(link);
|
|
26333
26601
|
}
|
|
26334
|
-
const rel =
|
|
26335
|
-
|
|
26602
|
+
const rel = path36.join("../..", _relativeToPosix2(source_file, MODULE_STATE.PROJECT_ROOT));
|
|
26603
|
+
fs39.symlinkSync(rel, link);
|
|
26336
26604
|
count += 1;
|
|
26337
26605
|
}
|
|
26338
26606
|
info(` \u2705 Linked ${count} \`.cursor/commands/*.md\` files`);
|
|
26339
26607
|
return count;
|
|
26340
26608
|
}
|
|
26341
26609
|
function generate_windsurf_workflows(active_command_slugs = null) {
|
|
26342
|
-
if (!_isDir11(
|
|
26610
|
+
if (!_isDir11(path36.join(MODULE_STATE.PROJECT_ROOT, "src", "domains"))) {
|
|
26343
26611
|
return 0;
|
|
26344
26612
|
}
|
|
26345
26613
|
const cmds = [...iterCommands()].filter(
|
|
@@ -26350,27 +26618,27 @@ function generate_windsurf_workflows(active_command_slugs = null) {
|
|
|
26350
26618
|
_mkdirp(_WINDSURF_WORKFLOWS_DIR());
|
|
26351
26619
|
let count = 0;
|
|
26352
26620
|
for (const [source_file, slug] of cmds) {
|
|
26353
|
-
const link =
|
|
26621
|
+
const link = path36.join(_WINDSURF_WORKFLOWS_DIR(), `${slug}.md`);
|
|
26354
26622
|
if (_existsOrSymlink(link)) {
|
|
26355
|
-
|
|
26623
|
+
fs39.unlinkSync(link);
|
|
26356
26624
|
}
|
|
26357
|
-
const rel =
|
|
26358
|
-
|
|
26625
|
+
const rel = path36.join("../..", _relativeToPosix2(source_file, MODULE_STATE.PROJECT_ROOT));
|
|
26626
|
+
fs39.symlinkSync(rel, link);
|
|
26359
26627
|
count += 1;
|
|
26360
26628
|
}
|
|
26361
26629
|
info(` \u2705 Linked ${count} \`.windsurf/workflows/*.md\` files`);
|
|
26362
26630
|
return count;
|
|
26363
26631
|
}
|
|
26364
26632
|
function generate_gemini_md() {
|
|
26365
|
-
const link =
|
|
26633
|
+
const link = path36.join(MODULE_STATE.PROJECT_ROOT, "GEMINI.md");
|
|
26366
26634
|
if (_existsOrSymlink(link)) {
|
|
26367
|
-
|
|
26635
|
+
fs39.unlinkSync(link);
|
|
26368
26636
|
}
|
|
26369
|
-
|
|
26637
|
+
fs39.symlinkSync("AGENTS.md", link);
|
|
26370
26638
|
info(" \u2705 Created GEMINI.md \u2192 AGENTS.md symlink");
|
|
26371
26639
|
}
|
|
26372
26640
|
function* iterCommands() {
|
|
26373
|
-
const src_domains =
|
|
26641
|
+
const src_domains = path36.join(MODULE_STATE.PROJECT_ROOT, "src", "domains");
|
|
26374
26642
|
if (!_isDir11(src_domains)) {
|
|
26375
26643
|
return;
|
|
26376
26644
|
}
|
|
@@ -26410,7 +26678,7 @@ function _read_projection_mode() {
|
|
|
26410
26678
|
return "legacy-all";
|
|
26411
26679
|
}
|
|
26412
26680
|
function _domains_slug_prefix(pack_id) {
|
|
26413
|
-
const manifest =
|
|
26681
|
+
const manifest = path36.join(MODULE_STATE.PROJECT_ROOT, "src", "domains", pack_id, "pack.yaml");
|
|
26414
26682
|
if (!_isFile13(manifest)) {
|
|
26415
26683
|
return "";
|
|
26416
26684
|
}
|
|
@@ -26422,7 +26690,7 @@ function _command_path_to_slug(manifest_path2) {
|
|
|
26422
26690
|
if (logical && logical.startsWith("commands/")) {
|
|
26423
26691
|
return _posixParts(logical.slice("commands/".length).replace(/\.md$/, "")).join("-");
|
|
26424
26692
|
}
|
|
26425
|
-
const parts = manifest_path2.split(
|
|
26693
|
+
const parts = manifest_path2.split(path36.sep).filter((s) => s.length > 0);
|
|
26426
26694
|
const i = parts.indexOf("commands");
|
|
26427
26695
|
return parts.slice(i + 1).join("/").replace(/\.md$/, "").split("/").join("-");
|
|
26428
26696
|
}
|
|
@@ -26436,7 +26704,7 @@ function _model_tier(skill_md) {
|
|
|
26436
26704
|
if (!_exists6(skill_md)) {
|
|
26437
26705
|
return null;
|
|
26438
26706
|
}
|
|
26439
|
-
const text =
|
|
26707
|
+
const text = fs39.readFileSync(skill_md).toString("utf-8");
|
|
26440
26708
|
if (!text.startsWith("---\n")) {
|
|
26441
26709
|
return null;
|
|
26442
26710
|
}
|
|
@@ -26457,7 +26725,7 @@ function generate_claude_skills(active_skill_names = null) {
|
|
|
26457
26725
|
process.stderr.write(" \u26A0\uFE0F dist/agent-src/skills/ not found \u2014 skipping skills\n");
|
|
26458
26726
|
return 0;
|
|
26459
26727
|
}
|
|
26460
|
-
let skills = _iterdirSorted4(MODULE_STATE.SKILLS_SOURCE).filter((p) => _isDir11(p)).map((p) =>
|
|
26728
|
+
let skills = _iterdirSorted4(MODULE_STATE.SKILLS_SOURCE).filter((p) => _isDir11(p)).map((p) => path36.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
26461
26729
|
if (active_skill_names !== null) {
|
|
26462
26730
|
skills = skills.filter((s) => active_skill_names.has(s));
|
|
26463
26731
|
}
|
|
@@ -26466,51 +26734,51 @@ function generate_claude_skills(active_skill_names = null) {
|
|
|
26466
26734
|
_mkdirp(MODULE_STATE.CLAUDE_SKILLS_DIR);
|
|
26467
26735
|
const auto = _read_model_auto_switch() === "auto";
|
|
26468
26736
|
for (const item of _iterdirSorted4(MODULE_STATE.CLAUDE_SKILLS_DIR)) {
|
|
26469
|
-
const name =
|
|
26737
|
+
const name = path36.basename(item);
|
|
26470
26738
|
if (skill_set.has(name) || command_slugs.has(name) || name === "README.md") {
|
|
26471
26739
|
continue;
|
|
26472
26740
|
}
|
|
26473
26741
|
if (_isSymlink2(item)) {
|
|
26474
|
-
|
|
26742
|
+
fs39.unlinkSync(item);
|
|
26475
26743
|
} else if (_isDirNoFollow(item)) {
|
|
26476
|
-
const skill_md =
|
|
26744
|
+
const skill_md = path36.join(item, "SKILL.md");
|
|
26477
26745
|
if (_isFile13(skill_md) && !_isSymlink2(skill_md)) {
|
|
26478
|
-
|
|
26746
|
+
fs39.rmSync(item, { recursive: true, force: true });
|
|
26479
26747
|
}
|
|
26480
26748
|
}
|
|
26481
26749
|
}
|
|
26482
26750
|
let count = 0;
|
|
26483
26751
|
let rendered = 0;
|
|
26484
26752
|
for (const skill of skills) {
|
|
26485
|
-
const link =
|
|
26486
|
-
const src_dir =
|
|
26487
|
-
const value = auto ? _model_tier(
|
|
26753
|
+
const link = path36.join(MODULE_STATE.CLAUDE_SKILLS_DIR, skill);
|
|
26754
|
+
const src_dir = path36.join(MODULE_STATE.SKILLS_SOURCE, skill);
|
|
26755
|
+
const value = auto ? _model_tier(path36.join(src_dir, "SKILL.md")) : null;
|
|
26488
26756
|
if (_isSymlink2(link)) {
|
|
26489
|
-
|
|
26757
|
+
fs39.unlinkSync(link);
|
|
26490
26758
|
} else if (_isDirNoFollow(link)) {
|
|
26491
|
-
|
|
26759
|
+
fs39.rmSync(link, { recursive: true, force: true });
|
|
26492
26760
|
} else if (_existsOrSymlink(link)) {
|
|
26493
|
-
|
|
26761
|
+
fs39.unlinkSync(link);
|
|
26494
26762
|
}
|
|
26495
26763
|
if (value !== null && value in TIER_TO_CLAUDE_MODEL) {
|
|
26496
26764
|
_mkdirp(link);
|
|
26497
26765
|
for (const entry of _iterdirSorted4(src_dir)) {
|
|
26498
|
-
const entryName =
|
|
26766
|
+
const entryName = path36.basename(entry);
|
|
26499
26767
|
if (entryName === "SKILL.md") {
|
|
26500
26768
|
_writeText2(
|
|
26501
|
-
|
|
26769
|
+
path36.join(link, "SKILL.md"),
|
|
26502
26770
|
_render_native_model_md(entry, value)
|
|
26503
26771
|
);
|
|
26504
26772
|
} else {
|
|
26505
|
-
|
|
26506
|
-
|
|
26507
|
-
|
|
26773
|
+
fs39.symlinkSync(
|
|
26774
|
+
path36.join("../../../dist/agent-src/skills", skill, entryName),
|
|
26775
|
+
path36.join(link, entryName)
|
|
26508
26776
|
);
|
|
26509
26777
|
}
|
|
26510
26778
|
}
|
|
26511
26779
|
rendered += 1;
|
|
26512
26780
|
} else {
|
|
26513
|
-
|
|
26781
|
+
fs39.symlinkSync(path36.join("../../dist/agent-src/skills", skill), link);
|
|
26514
26782
|
}
|
|
26515
26783
|
count += 1;
|
|
26516
26784
|
}
|
|
@@ -26519,7 +26787,7 @@ function generate_claude_skills(active_skill_names = null) {
|
|
|
26519
26787
|
return count;
|
|
26520
26788
|
}
|
|
26521
26789
|
function generate_claude_commands(active_command_slugs = null) {
|
|
26522
|
-
if (!_isDir11(
|
|
26790
|
+
if (!_isDir11(path36.join(MODULE_STATE.PROJECT_ROOT, "src", "domains"))) {
|
|
26523
26791
|
process.stderr.write(" \u26A0\uFE0F src/domains/ not found \u2014 skipping commands\n");
|
|
26524
26792
|
return 0;
|
|
26525
26793
|
}
|
|
@@ -26527,7 +26795,7 @@ function generate_claude_commands(active_command_slugs = null) {
|
|
|
26527
26795
|
let skill_names = /* @__PURE__ */ new Set();
|
|
26528
26796
|
if (_exists6(MODULE_STATE.SKILLS_SOURCE)) {
|
|
26529
26797
|
skill_names = new Set(
|
|
26530
|
-
_iterdirSorted4(MODULE_STATE.SKILLS_SOURCE).filter((p) => _isDir11(p)).map((p) =>
|
|
26798
|
+
_iterdirSorted4(MODULE_STATE.SKILLS_SOURCE).filter((p) => _isDir11(p)).map((p) => path36.basename(p))
|
|
26531
26799
|
);
|
|
26532
26800
|
}
|
|
26533
26801
|
const current_slugs = /* @__PURE__ */ new Set();
|
|
@@ -26549,11 +26817,11 @@ function generate_claude_commands(active_command_slugs = null) {
|
|
|
26549
26817
|
continue;
|
|
26550
26818
|
}
|
|
26551
26819
|
current_slugs.add(slug);
|
|
26552
|
-
const skill_dir =
|
|
26820
|
+
const skill_dir = path36.join(MODULE_STATE.CLAUDE_SKILLS_DIR, slug);
|
|
26553
26821
|
_mkdirp(skill_dir);
|
|
26554
|
-
const skill_file =
|
|
26822
|
+
const skill_file = path36.join(skill_dir, "SKILL.md");
|
|
26555
26823
|
if (_existsOrSymlink(skill_file)) {
|
|
26556
|
-
|
|
26824
|
+
fs39.unlinkSync(skill_file);
|
|
26557
26825
|
}
|
|
26558
26826
|
const rel_path = _relativeToPosix2(source_file, MODULE_STATE.PROJECT_ROOT);
|
|
26559
26827
|
const value = auto ? _model_tier(source_file) : null;
|
|
@@ -26561,8 +26829,8 @@ function generate_claude_commands(active_command_slugs = null) {
|
|
|
26561
26829
|
_writeText2(skill_file, _render_native_model_md(source_file, value));
|
|
26562
26830
|
rendered += 1;
|
|
26563
26831
|
} else {
|
|
26564
|
-
const rel_target =
|
|
26565
|
-
|
|
26832
|
+
const rel_target = path36.join("../../..", rel_path);
|
|
26833
|
+
fs39.symlinkSync(rel_target, skill_file);
|
|
26566
26834
|
}
|
|
26567
26835
|
count += 1;
|
|
26568
26836
|
}
|
|
@@ -26571,16 +26839,16 @@ function generate_claude_commands(active_command_slugs = null) {
|
|
|
26571
26839
|
if (!_isDirNoFollow(item) || _isSymlink2(item)) {
|
|
26572
26840
|
continue;
|
|
26573
26841
|
}
|
|
26574
|
-
const name =
|
|
26842
|
+
const name = path36.basename(item);
|
|
26575
26843
|
if (skill_names.has(name) || current_slugs.has(name)) {
|
|
26576
26844
|
continue;
|
|
26577
26845
|
}
|
|
26578
|
-
const skill_md =
|
|
26846
|
+
const skill_md = path36.join(item, "SKILL.md");
|
|
26579
26847
|
if (_isSymlink2(skill_md) || _isFile13(skill_md)) {
|
|
26580
26848
|
const entries = _iterdirSorted4(item);
|
|
26581
|
-
if (entries.length === 1 &&
|
|
26582
|
-
|
|
26583
|
-
|
|
26849
|
+
if (entries.length === 1 && path36.basename(entries[0]) === "SKILL.md") {
|
|
26850
|
+
fs39.unlinkSync(skill_md);
|
|
26851
|
+
fs39.rmdirSync(item);
|
|
26584
26852
|
removed_dirs += 1;
|
|
26585
26853
|
}
|
|
26586
26854
|
}
|
|
@@ -26607,14 +26875,14 @@ function generate_claude_subagents() {
|
|
|
26607
26875
|
}
|
|
26608
26876
|
_mkdirp(MODULE_STATE.CLAUDE_AGENTS_DIR);
|
|
26609
26877
|
const sources = _rglobSorted4(MODULE_STATE.SUBAGENTS_SOURCE, "*.md").filter(
|
|
26610
|
-
(p) => _isFile13(p) && !
|
|
26878
|
+
(p) => _isFile13(p) && !path36.basename(p).startsWith("_")
|
|
26611
26879
|
);
|
|
26612
26880
|
const current = /* @__PURE__ */ new Set();
|
|
26613
26881
|
let count = 0;
|
|
26614
|
-
const defensePath =
|
|
26882
|
+
const defensePath = path36.join(MODULE_STATE.SUBAGENTS_SOURCE, "_prompt-defense.md");
|
|
26615
26883
|
const defense = _isFile13(defensePath) ? _readText2(defensePath).trim() : "";
|
|
26616
26884
|
for (const src of sources) {
|
|
26617
|
-
const stem2 =
|
|
26885
|
+
const stem2 = path36.basename(src, ".md");
|
|
26618
26886
|
const text = _readText2(src);
|
|
26619
26887
|
if (!text.startsWith("---\n")) {
|
|
26620
26888
|
continue;
|
|
@@ -26646,18 +26914,18 @@ tools: ${tools}
|
|
|
26646
26914
|
model: ${model}
|
|
26647
26915
|
` + (effort !== null ? `effort: ${effort}
|
|
26648
26916
|
` : "") + "---\n" + guardedBody;
|
|
26649
|
-
const target =
|
|
26917
|
+
const target = path36.join(MODULE_STATE.CLAUDE_AGENTS_DIR, `${name}.md`);
|
|
26650
26918
|
_writeText2(target, out);
|
|
26651
26919
|
current.add(`${name}.md`);
|
|
26652
26920
|
count += 1;
|
|
26653
26921
|
}
|
|
26654
26922
|
for (const item of _iterdirSorted4(MODULE_STATE.CLAUDE_AGENTS_DIR)) {
|
|
26655
|
-
const base =
|
|
26923
|
+
const base = path36.basename(item);
|
|
26656
26924
|
if (base === "README.md" || current.has(base)) {
|
|
26657
26925
|
continue;
|
|
26658
26926
|
}
|
|
26659
26927
|
if (_isFile13(item) && base.endsWith(".md") && !_isSymlink2(item)) {
|
|
26660
|
-
|
|
26928
|
+
fs39.unlinkSync(item);
|
|
26661
26929
|
}
|
|
26662
26930
|
}
|
|
26663
26931
|
info(` \u2705 Created ${count} subagent entries in .claude/agents/`);
|
|
@@ -26670,7 +26938,7 @@ function generate_subagent_host_contexts() {
|
|
|
26670
26938
|
const sources = _rglobSorted4(MODULE_STATE.SUBAGENTS_SOURCE, "*.md").filter((p) => _isFile13(p));
|
|
26671
26939
|
const rendered = [];
|
|
26672
26940
|
for (const src of sources) {
|
|
26673
|
-
const stem2 =
|
|
26941
|
+
const stem2 = path36.basename(src, ".md");
|
|
26674
26942
|
const text = _readText2(src);
|
|
26675
26943
|
if (!text.startsWith("---\n")) {
|
|
26676
26944
|
continue;
|
|
@@ -26713,19 +26981,19 @@ description: ${description}
|
|
|
26713
26981
|
const targets = [
|
|
26714
26982
|
{
|
|
26715
26983
|
active: _tool_active("cursor"),
|
|
26716
|
-
dir:
|
|
26984
|
+
dir: path36.join(MODULE_STATE.PROJECT_ROOT, ".cursor", "subagents"),
|
|
26717
26985
|
file: (n) => `${n}.md`,
|
|
26718
26986
|
owns: (b) => b.endsWith(".md")
|
|
26719
26987
|
},
|
|
26720
26988
|
{
|
|
26721
26989
|
active: _tool_active("windsurf"),
|
|
26722
|
-
dir:
|
|
26990
|
+
dir: path36.join(MODULE_STATE.PROJECT_ROOT, ".windsurf", "subagents"),
|
|
26723
26991
|
file: (n) => `${n}.md`,
|
|
26724
26992
|
owns: (b) => b.endsWith(".md")
|
|
26725
26993
|
},
|
|
26726
26994
|
{
|
|
26727
26995
|
active: _tool_active("cline"),
|
|
26728
|
-
dir:
|
|
26996
|
+
dir: path36.join(MODULE_STATE.PROJECT_ROOT, ".clinerules"),
|
|
26729
26997
|
file: (n) => `${n}.subagent.md`,
|
|
26730
26998
|
owns: (b) => b.endsWith(".subagent.md")
|
|
26731
26999
|
}
|
|
@@ -26738,17 +27006,17 @@ description: ${description}
|
|
|
26738
27006
|
const current = new Set(rendered.map((r) => t.file(r.name)));
|
|
26739
27007
|
_mkdirp(t.dir);
|
|
26740
27008
|
for (const r of rendered) {
|
|
26741
|
-
_writeText2(
|
|
27009
|
+
_writeText2(path36.join(t.dir, t.file(r.name)), r.text);
|
|
26742
27010
|
count += 1;
|
|
26743
27011
|
}
|
|
26744
27012
|
if (_exists6(t.dir)) {
|
|
26745
27013
|
for (const item of _iterdirSorted4(t.dir)) {
|
|
26746
|
-
const base =
|
|
27014
|
+
const base = path36.basename(item);
|
|
26747
27015
|
if (base === "README.md" || current.has(base)) {
|
|
26748
27016
|
continue;
|
|
26749
27017
|
}
|
|
26750
27018
|
if (_isFile13(item) && !_isSymlink2(item) && t.owns(base)) {
|
|
26751
|
-
|
|
27019
|
+
fs39.unlinkSync(item);
|
|
26752
27020
|
}
|
|
26753
27021
|
}
|
|
26754
27022
|
}
|
|
@@ -26757,35 +27025,35 @@ description: ${description}
|
|
|
26757
27025
|
return count;
|
|
26758
27026
|
}
|
|
26759
27027
|
function generate_plugin_command_skills() {
|
|
26760
|
-
if (!_isDir11(
|
|
27028
|
+
if (!_isDir11(path36.join(MODULE_STATE.PROJECT_ROOT, "src", "domains"))) {
|
|
26761
27029
|
return 0;
|
|
26762
27030
|
}
|
|
26763
27031
|
_mkdirp(MODULE_STATE.PLUGIN_SKILLS_DIR);
|
|
26764
|
-
const pointer_dir =
|
|
27032
|
+
const pointer_dir = path36.join(MODULE_STATE.PLUGIN_SKILLS_DIR, PLUGIN_POINTER_SLUG);
|
|
26765
27033
|
_mkdirp(pointer_dir);
|
|
26766
|
-
const pointer_file =
|
|
27034
|
+
const pointer_file = path36.join(pointer_dir, "SKILL.md");
|
|
26767
27035
|
if (_isSymlink2(pointer_file)) {
|
|
26768
|
-
|
|
27036
|
+
fs39.unlinkSync(pointer_file);
|
|
26769
27037
|
}
|
|
26770
|
-
if (!_isFile13(pointer_file) ||
|
|
26771
|
-
|
|
27038
|
+
if (!_isFile13(pointer_file) || fs39.readFileSync(pointer_file, "utf-8") !== PLUGIN_POINTER_SKILL_BODY) {
|
|
27039
|
+
fs39.writeFileSync(pointer_file, PLUGIN_POINTER_SKILL_BODY);
|
|
26772
27040
|
}
|
|
26773
27041
|
let removed_dirs = 0;
|
|
26774
27042
|
for (const item of _iterdirSorted4(MODULE_STATE.PLUGIN_SKILLS_DIR)) {
|
|
26775
27043
|
if (!_isDirNoFollow(item) || _isSymlink2(item)) {
|
|
26776
27044
|
continue;
|
|
26777
27045
|
}
|
|
26778
|
-
if (
|
|
27046
|
+
if (path36.basename(item) === PLUGIN_POINTER_SLUG) {
|
|
26779
27047
|
continue;
|
|
26780
27048
|
}
|
|
26781
27049
|
const entries = _iterdirSorted4(item);
|
|
26782
27050
|
const all_symlinks = entries.length > 0 && entries.every((e) => _isSymlink2(e));
|
|
26783
|
-
const single_skill_md = entries.length === 1 &&
|
|
27051
|
+
const single_skill_md = entries.length === 1 && path36.basename(entries[0]) === "SKILL.md" && _isFile13(entries[0]);
|
|
26784
27052
|
if (all_symlinks || single_skill_md) {
|
|
26785
27053
|
for (const e of entries) {
|
|
26786
|
-
|
|
27054
|
+
fs39.unlinkSync(e);
|
|
26787
27055
|
}
|
|
26788
|
-
|
|
27056
|
+
fs39.rmdirSync(item);
|
|
26789
27057
|
removed_dirs += 1;
|
|
26790
27058
|
}
|
|
26791
27059
|
}
|
|
@@ -26801,28 +27069,28 @@ function generate_persona_symlinks() {
|
|
|
26801
27069
|
_print3(" \u26A0\uFE0F dist/agent-src/personas/ not found \u2014 skipping personas");
|
|
26802
27070
|
return 0;
|
|
26803
27071
|
}
|
|
26804
|
-
const personas = _rglobSorted4(MODULE_STATE.PERSONAS_SOURCE, "*.md").filter((p) => _isFile13(p) &&
|
|
26805
|
-
const direct = _iterdirSorted4(MODULE_STATE.PERSONAS_SOURCE).filter((p) => p.endsWith(".md") && _isFile13(p) &&
|
|
27072
|
+
const personas = _rglobSorted4(MODULE_STATE.PERSONAS_SOURCE, "*.md").filter((p) => _isFile13(p) && path36.basename(p, ".md") !== "README").map((p) => path36.basename(p)).filter((name) => _isFile13(path36.join(MODULE_STATE.PERSONAS_SOURCE, name)));
|
|
27073
|
+
const direct = _iterdirSorted4(MODULE_STATE.PERSONAS_SOURCE).filter((p) => p.endsWith(".md") && _isFile13(p) && path36.basename(p, ".md") !== "README").map((p) => path36.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
26806
27074
|
void personas;
|
|
26807
27075
|
const list = direct;
|
|
26808
27076
|
const tool_dirs = _filter_tool_dirs(PERSONA_TOOL_DIRS);
|
|
26809
27077
|
let total = 0;
|
|
26810
27078
|
for (const [tool_dir, rel_prefix] of Object.entries(tool_dirs)) {
|
|
26811
|
-
const target_dir =
|
|
27079
|
+
const target_dir = path36.join(MODULE_STATE.PROJECT_ROOT, tool_dir);
|
|
26812
27080
|
_mkdirp(target_dir);
|
|
26813
27081
|
for (const item of _iterdirSorted4(target_dir)) {
|
|
26814
|
-
const name =
|
|
27082
|
+
const name = path36.basename(item);
|
|
26815
27083
|
if (_isSymlink2(item) && !list.includes(name) && name !== "README.md") {
|
|
26816
|
-
|
|
27084
|
+
fs39.unlinkSync(item);
|
|
26817
27085
|
}
|
|
26818
27086
|
}
|
|
26819
27087
|
for (const persona of list) {
|
|
26820
|
-
const link =
|
|
26821
|
-
const target =
|
|
27088
|
+
const link = path36.join(target_dir, persona);
|
|
27089
|
+
const target = path36.join(rel_prefix, persona);
|
|
26822
27090
|
if (_existsOrSymlink(link)) {
|
|
26823
|
-
|
|
27091
|
+
fs39.unlinkSync(link);
|
|
26824
27092
|
}
|
|
26825
|
-
|
|
27093
|
+
fs39.symlinkSync(target, link);
|
|
26826
27094
|
total += 1;
|
|
26827
27095
|
}
|
|
26828
27096
|
}
|
|
@@ -26836,25 +27104,25 @@ function generate_user_type_symlinks() {
|
|
|
26836
27104
|
_print3(" \u26A0\uFE0F dist/agent-src/user-types/ not found \u2014 skipping user-types");
|
|
26837
27105
|
return 0;
|
|
26838
27106
|
}
|
|
26839
|
-
const user_types = _iterdirSorted4(MODULE_STATE.USER_TYPES_SOURCE).filter((p) => p.endsWith(".md") && _isFile13(p) &&
|
|
27107
|
+
const user_types = _iterdirSorted4(MODULE_STATE.USER_TYPES_SOURCE).filter((p) => p.endsWith(".md") && _isFile13(p) && path36.basename(p, ".md") !== "README").map((p) => path36.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
26840
27108
|
const tool_dirs = _filter_tool_dirs(USER_TYPE_TOOL_DIRS);
|
|
26841
27109
|
let total = 0;
|
|
26842
27110
|
for (const [tool_dir, rel_prefix] of Object.entries(tool_dirs)) {
|
|
26843
|
-
const target_dir =
|
|
27111
|
+
const target_dir = path36.join(MODULE_STATE.PROJECT_ROOT, tool_dir);
|
|
26844
27112
|
_mkdirp(target_dir);
|
|
26845
27113
|
for (const item of _iterdirSorted4(target_dir)) {
|
|
26846
|
-
const name =
|
|
27114
|
+
const name = path36.basename(item);
|
|
26847
27115
|
if (_isSymlink2(item) && !user_types.includes(name) && name !== "README.md") {
|
|
26848
|
-
|
|
27116
|
+
fs39.unlinkSync(item);
|
|
26849
27117
|
}
|
|
26850
27118
|
}
|
|
26851
27119
|
for (const user_type of user_types) {
|
|
26852
|
-
const link =
|
|
26853
|
-
const target =
|
|
27120
|
+
const link = path36.join(target_dir, user_type);
|
|
27121
|
+
const target = path36.join(rel_prefix, user_type);
|
|
26854
27122
|
if (_existsOrSymlink(link)) {
|
|
26855
|
-
|
|
27123
|
+
fs39.unlinkSync(link);
|
|
26856
27124
|
}
|
|
26857
|
-
|
|
27125
|
+
fs39.symlinkSync(target, link);
|
|
26858
27126
|
total += 1;
|
|
26859
27127
|
}
|
|
26860
27128
|
}
|
|
@@ -26864,7 +27132,7 @@ function generate_user_type_symlinks() {
|
|
|
26864
27132
|
return total;
|
|
26865
27133
|
}
|
|
26866
27134
|
function generate_plugin_hooks() {
|
|
26867
|
-
const manifest_path2 =
|
|
27135
|
+
const manifest_path2 = path36.join(
|
|
26868
27136
|
MODULE_STATE.PROJECT_ROOT,
|
|
26869
27137
|
"src",
|
|
26870
27138
|
"scripts",
|
|
@@ -26879,9 +27147,9 @@ function generate_plugin_hooks() {
|
|
|
26879
27147
|
for (const [native, command] of Object.entries(matrix)) {
|
|
26880
27148
|
hooks[native] = [{ hooks: [{ type: "command", command }] }];
|
|
26881
27149
|
}
|
|
26882
|
-
const hooks_dir =
|
|
27150
|
+
const hooks_dir = path36.join(MODULE_STATE.PROJECT_ROOT, "hooks");
|
|
26883
27151
|
_mkdirp(hooks_dir);
|
|
26884
|
-
const out =
|
|
27152
|
+
const out = path36.join(hooks_dir, "hooks.json");
|
|
26885
27153
|
_writeText2(out, _jsonDumpsHooks({ hooks }) + "\n");
|
|
26886
27154
|
info(` \u2705 Generated hooks/hooks.json (${Object.keys(hooks).length} Claude plugin hooks)`);
|
|
26887
27155
|
return Object.keys(hooks).length;
|
|
@@ -26961,30 +27229,30 @@ function generate_tools() {
|
|
|
26961
27229
|
}
|
|
26962
27230
|
function project_to_augment() {
|
|
26963
27231
|
if (!_exists6(MODULE_STATE.TARGET_DIR)) {
|
|
26964
|
-
_print3(` \u26A0\uFE0F ${
|
|
27232
|
+
_print3(` \u26A0\uFE0F ${path36.basename(MODULE_STATE.TARGET_DIR)}/ not found \u2014 nothing to project`);
|
|
26965
27233
|
return;
|
|
26966
27234
|
}
|
|
26967
27235
|
_mkdirp(MODULE_STATE.AUGMENT_DIR);
|
|
26968
27236
|
const use_symlinks = _read_augment_rules_use_symlinks();
|
|
26969
|
-
const src_rules =
|
|
26970
|
-
const dst_rules =
|
|
27237
|
+
const src_rules = path36.join(MODULE_STATE.TARGET_DIR, "rules");
|
|
27238
|
+
const dst_rules = path36.join(MODULE_STATE.AUGMENT_DIR, "rules");
|
|
26971
27239
|
_mkdirp(dst_rules);
|
|
26972
27240
|
const existing = new Set(
|
|
26973
|
-
_iterdirSorted4(dst_rules).filter((f) => _isFile13(f) || _isSymlink2(f)).map((f) =>
|
|
27241
|
+
_iterdirSorted4(dst_rules).filter((f) => _isFile13(f) || _isSymlink2(f)).map((f) => path36.basename(f))
|
|
26974
27242
|
);
|
|
26975
27243
|
const current = /* @__PURE__ */ new Set();
|
|
26976
27244
|
let written = 0;
|
|
26977
27245
|
if (_exists6(src_rules)) {
|
|
26978
|
-
const rules = _iterdirSorted4(src_rules).filter((p) => p.endsWith(".md") && _isFile13(p)).map((p) =>
|
|
27246
|
+
const rules = _iterdirSorted4(src_rules).filter((p) => p.endsWith(".md") && _isFile13(p)).map((p) => path36.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
26979
27247
|
for (const rule of rules) {
|
|
26980
|
-
const target =
|
|
27248
|
+
const target = path36.join(dst_rules, rule);
|
|
26981
27249
|
if (_isSymlink2(target) || _existsOrSymlink(target)) {
|
|
26982
|
-
|
|
27250
|
+
fs39.unlinkSync(target);
|
|
26983
27251
|
}
|
|
26984
27252
|
if (use_symlinks) {
|
|
26985
|
-
|
|
27253
|
+
fs39.symlinkSync(path36.join("..", "..", "dist/agent-src", "rules", rule), target);
|
|
26986
27254
|
} else {
|
|
26987
|
-
copy_file(
|
|
27255
|
+
copy_file(path36.join(src_rules, rule), target);
|
|
26988
27256
|
}
|
|
26989
27257
|
current.add(rule);
|
|
26990
27258
|
written += 1;
|
|
@@ -26993,7 +27261,7 @@ function project_to_augment() {
|
|
|
26993
27261
|
let removed_rules = 0;
|
|
26994
27262
|
for (const name of existing) {
|
|
26995
27263
|
if (!current.has(name)) {
|
|
26996
|
-
|
|
27264
|
+
fs39.unlinkSync(path36.join(dst_rules, name));
|
|
26997
27265
|
removed_rules += 1;
|
|
26998
27266
|
}
|
|
26999
27267
|
}
|
|
@@ -27002,61 +27270,61 @@ function project_to_augment() {
|
|
|
27002
27270
|
` \u2705 ${mode_label} ${written} rules to .augment/rules/` + (removed_rules ? ` (${removed_rules} stale removed)` : "")
|
|
27003
27271
|
);
|
|
27004
27272
|
for (const sub of AUGMENT_SYMLINK_DIRS) {
|
|
27005
|
-
const dst =
|
|
27273
|
+
const dst = path36.join(MODULE_STATE.AUGMENT_DIR, sub);
|
|
27006
27274
|
if (_isSymlink2(dst) || _existsOrSymlink(dst)) {
|
|
27007
27275
|
if (_isDir11(dst) && !_isSymlink2(dst)) {
|
|
27008
|
-
|
|
27276
|
+
fs39.rmSync(dst, { recursive: true, force: true });
|
|
27009
27277
|
} else {
|
|
27010
|
-
|
|
27278
|
+
fs39.unlinkSync(dst);
|
|
27011
27279
|
}
|
|
27012
27280
|
}
|
|
27013
|
-
const src =
|
|
27281
|
+
const src = path36.join(MODULE_STATE.TARGET_DIR, sub);
|
|
27014
27282
|
if (_exists6(src)) {
|
|
27015
|
-
|
|
27283
|
+
fs39.symlinkSync(path36.join("..", "dist/agent-src", sub), dst);
|
|
27016
27284
|
_print3(` \u2705 Symlinked .augment/${sub} \u2192 ../dist/agent-src/${sub}`);
|
|
27017
27285
|
}
|
|
27018
27286
|
}
|
|
27019
27287
|
for (const name of AUGMENT_SYMLINK_FILES) {
|
|
27020
|
-
const dst =
|
|
27021
|
-
const src =
|
|
27288
|
+
const dst = path36.join(MODULE_STATE.AUGMENT_DIR, name);
|
|
27289
|
+
const src = path36.join(MODULE_STATE.TARGET_DIR, name);
|
|
27022
27290
|
if (_isSymlink2(dst) || _existsOrSymlink(dst)) {
|
|
27023
|
-
|
|
27291
|
+
fs39.unlinkSync(dst);
|
|
27024
27292
|
}
|
|
27025
27293
|
if (_exists6(src)) {
|
|
27026
|
-
|
|
27294
|
+
fs39.symlinkSync(path36.join("..", "dist/agent-src", name), dst);
|
|
27027
27295
|
_print3(` \u2705 Symlinked .augment/${name} \u2192 ../dist/agent-src/${name}`);
|
|
27028
27296
|
}
|
|
27029
27297
|
}
|
|
27030
27298
|
const known = /* @__PURE__ */ new Set([...AUGMENT_SYMLINK_DIRS, ...AUGMENT_SYMLINK_FILES, "rules", "state"]);
|
|
27031
27299
|
for (const item of _iterdirSorted4(MODULE_STATE.AUGMENT_DIR)) {
|
|
27032
|
-
const name =
|
|
27300
|
+
const name = path36.basename(item);
|
|
27033
27301
|
if (known.has(name)) {
|
|
27034
27302
|
continue;
|
|
27035
27303
|
}
|
|
27036
27304
|
if (_isSymlink2(item) || _isFile13(item)) {
|
|
27037
|
-
|
|
27305
|
+
fs39.unlinkSync(item);
|
|
27038
27306
|
_print3(` \u{1F5D1}\uFE0F Removed stale .augment/${name}`);
|
|
27039
27307
|
} else if (_isDir11(item)) {
|
|
27040
|
-
|
|
27308
|
+
fs39.rmSync(item, { recursive: true, force: true });
|
|
27041
27309
|
_print3(` \u{1F5D1}\uFE0F Removed stale .augment/${name}/`);
|
|
27042
27310
|
}
|
|
27043
27311
|
}
|
|
27044
27312
|
}
|
|
27045
27313
|
function clean_tools() {
|
|
27046
27314
|
const targets = [
|
|
27047
|
-
|
|
27048
|
-
|
|
27049
|
-
|
|
27050
|
-
|
|
27051
|
-
|
|
27052
|
-
|
|
27315
|
+
path36.join(MODULE_STATE.PROJECT_ROOT, ".claude"),
|
|
27316
|
+
path36.join(MODULE_STATE.PROJECT_ROOT, ".cursor"),
|
|
27317
|
+
path36.join(MODULE_STATE.PROJECT_ROOT, ".clinerules"),
|
|
27318
|
+
path36.join(MODULE_STATE.PROJECT_ROOT, ".windsurf"),
|
|
27319
|
+
path36.join(MODULE_STATE.PROJECT_ROOT, ".windsurfrules"),
|
|
27320
|
+
path36.join(MODULE_STATE.PROJECT_ROOT, "GEMINI.md")
|
|
27053
27321
|
];
|
|
27054
27322
|
for (const t of targets) {
|
|
27055
27323
|
if (_isDirNoFollow(t) && !_isSymlink2(t)) {
|
|
27056
|
-
|
|
27324
|
+
fs39.rmSync(t, { recursive: true, force: true });
|
|
27057
27325
|
_print3(` \u{1F5D1}\uFE0F Removed ${_relativeToPosix2(t, MODULE_STATE.PROJECT_ROOT)}`);
|
|
27058
27326
|
} else if (_existsOrSymlink(t)) {
|
|
27059
|
-
|
|
27327
|
+
fs39.unlinkSync(t);
|
|
27060
27328
|
_print3(` \u{1F5D1}\uFE0F Removed ${_relativeToPosix2(t, MODULE_STATE.PROJECT_ROOT)}`);
|
|
27061
27329
|
}
|
|
27062
27330
|
}
|
|
@@ -27069,7 +27337,7 @@ function _print3(line) {
|
|
|
27069
27337
|
function main15(argv = process.argv.slice(2)) {
|
|
27070
27338
|
if (!_exists6(MODULE_STATE.SOURCE_DIR) && !_any_source_root_exists()) {
|
|
27071
27339
|
_print3(
|
|
27072
|
-
`\u274C No source directory found (looked at ${MODULE_STATE.SOURCE_DIR}
|
|
27340
|
+
`\u274C No source directory found (looked at the artefact roots under src/ and ${MODULE_STATE.SOURCE_DIR})`
|
|
27073
27341
|
);
|
|
27074
27342
|
return 1;
|
|
27075
27343
|
}
|
|
@@ -27084,26 +27352,18 @@ function main15(argv = process.argv.slice(2)) {
|
|
|
27084
27352
|
} else if (arg === "--changed") {
|
|
27085
27353
|
const changed = list_changed_md(MODULE_STATE.SOURCE_DIR);
|
|
27086
27354
|
if (changed.length === 0) {
|
|
27087
|
-
_print3("\u2705
|
|
27355
|
+
_print3("\u2705 Every .md projection matches its source");
|
|
27088
27356
|
return 0;
|
|
27089
27357
|
}
|
|
27090
|
-
_print3(`\u{1F4DD} ${changed.length} .md
|
|
27358
|
+
_print3(`\u{1F4DD} ${changed.length} .md projection(s) out of date \u2014 run 'task sync':
|
|
27091
27359
|
`);
|
|
27092
27360
|
for (const f of changed) {
|
|
27093
27361
|
_print3(` ${f}`);
|
|
27094
27362
|
}
|
|
27095
|
-
} else if (arg === "--mark-done") {
|
|
27096
|
-
if (argv.length < 2) {
|
|
27097
|
-
_print3("Usage: python scripts/condense.py --mark-done <relative-path>");
|
|
27098
|
-
return 1;
|
|
27099
|
-
}
|
|
27100
|
-
mark_done(argv[1]);
|
|
27101
|
-
} else if (arg === "--mark-all-done") {
|
|
27102
|
-
mark_all_done();
|
|
27103
27363
|
} else if (arg === "--check") {
|
|
27104
27364
|
const [missing, stale] = check_sync(MODULE_STATE.SOURCE_DIR, MODULE_STATE.TARGET_DIR);
|
|
27105
27365
|
if (missing.length === 0 && stale.length === 0) {
|
|
27106
|
-
_print3("\u2705 dist/agent-src/ is in sync with
|
|
27366
|
+
_print3("\u2705 dist/agent-src/ is in sync with the artefact roots under src/");
|
|
27107
27367
|
return 0;
|
|
27108
27368
|
}
|
|
27109
27369
|
if (missing.length > 0) {
|
|
@@ -27119,10 +27379,10 @@ function main15(argv = process.argv.slice(2)) {
|
|
|
27119
27379
|
}
|
|
27120
27380
|
}
|
|
27121
27381
|
_print3(`
|
|
27122
|
-
Run 'task sync'
|
|
27382
|
+
Run 'task sync' \u2014 the projection is a deterministic copy, so it needs no agent step.`);
|
|
27123
27383
|
return 1;
|
|
27124
27384
|
} else if (arg === "--sync") {
|
|
27125
|
-
_print3(`Source:
|
|
27385
|
+
_print3(`Source: the artefact roots under src/`);
|
|
27126
27386
|
_print3(`Target: ${MODULE_STATE.TARGET_DIR}
|
|
27127
27387
|
`);
|
|
27128
27388
|
_print3("--- Syncing non-.md files ---");
|
|
@@ -27130,65 +27390,17 @@ Run 'task sync' to fix non-.md files, then ask the agent to condense .md files.`
|
|
|
27130
27390
|
_print3(`
|
|
27131
27391
|
--- Cleanup stale files ---`);
|
|
27132
27392
|
const deleted = cleanup_stale(MODULE_STATE.SOURCE_DIR, MODULE_STATE.TARGET_DIR);
|
|
27133
|
-
const hashes = load_hashes();
|
|
27134
|
-
const stale_keys = Object.keys(hashes).filter((k) => _resolve_source(k) === null);
|
|
27135
|
-
for (const k of stale_keys) {
|
|
27136
|
-
delete hashes[k];
|
|
27137
|
-
}
|
|
27138
|
-
if (stale_keys.length > 0) {
|
|
27139
|
-
save_hashes(hashes);
|
|
27140
|
-
_print3(` Cleaned ${stale_keys.length} stale hash entries`);
|
|
27141
|
-
}
|
|
27142
27393
|
const changed = list_changed_md(MODULE_STATE.SOURCE_DIR);
|
|
27143
27394
|
_print3(`
|
|
27144
27395
|
\u2705 Done: ${copied} copied, ${deleted} stale deleted`);
|
|
27145
27396
|
if (changed.length > 0) {
|
|
27146
|
-
_print3(`\
|
|
27397
|
+
_print3(`\u274C ${changed.length} .md projection(s) still out of date after sync (run --changed)`);
|
|
27147
27398
|
} else {
|
|
27148
|
-
_print3(`\u2705
|
|
27399
|
+
_print3(`\u2705 Every .md projection matches its source`);
|
|
27149
27400
|
}
|
|
27150
27401
|
_print3(`
|
|
27151
27402
|
--- Projecting dist/agent-src/ \u2192 .augment/ ---`);
|
|
27152
27403
|
project_to_augment();
|
|
27153
|
-
} else if (arg === "--check-hashes") {
|
|
27154
|
-
let has_issues = false;
|
|
27155
|
-
const changed = list_changed_md(MODULE_STATE.SOURCE_DIR);
|
|
27156
|
-
const stale = find_stale_hashes(MODULE_STATE.SOURCE_DIR);
|
|
27157
|
-
if (stale.length > 0) {
|
|
27158
|
-
has_issues = true;
|
|
27159
|
-
_print3(`\u26A0\uFE0F ${stale.length} stale hash(es) for deleted source files:
|
|
27160
|
-
`);
|
|
27161
|
-
for (const f of stale) {
|
|
27162
|
-
_print3(` ${f}`);
|
|
27163
|
-
}
|
|
27164
|
-
_print3(`
|
|
27165
|
-
Run 'task sync-clean-hashes' to remove them.
|
|
27166
|
-
`);
|
|
27167
|
-
}
|
|
27168
|
-
if (changed.length > 0) {
|
|
27169
|
-
has_issues = true;
|
|
27170
|
-
_print3(`\u274C ${changed.length} .md file(s) need recondensation:
|
|
27171
|
-
`);
|
|
27172
|
-
for (const f of changed) {
|
|
27173
|
-
const stored = load_hashes()[f];
|
|
27174
|
-
const reason = stored === void 0 ? "no hash stored" : "hash mismatch";
|
|
27175
|
-
_print3(` ${f} (${reason})`);
|
|
27176
|
-
}
|
|
27177
|
-
_print3(`
|
|
27178
|
-
Run '/condense' command to recondense these files.`);
|
|
27179
|
-
}
|
|
27180
|
-
if (!has_issues) {
|
|
27181
|
-
_print3("\u2705 All condensation hashes are clean (no stale, no mismatches)");
|
|
27182
|
-
return 0;
|
|
27183
|
-
}
|
|
27184
|
-
return 1;
|
|
27185
|
-
} else if (arg === "--clean-hashes") {
|
|
27186
|
-
const count = clean_stale_hashes(MODULE_STATE.SOURCE_DIR);
|
|
27187
|
-
if (count) {
|
|
27188
|
-
_print3(`\u2705 Removed ${count} stale hash(es)`);
|
|
27189
|
-
} else {
|
|
27190
|
-
_print3("\u2705 No stale hashes found");
|
|
27191
|
-
}
|
|
27192
27404
|
} else if (arg === "--generate-tools") {
|
|
27193
27405
|
generate_tools();
|
|
27194
27406
|
} else if (arg === "--clean-tools") {
|
|
@@ -27197,7 +27409,7 @@ Run '/condense' command to recondense these files.`);
|
|
|
27197
27409
|
project_to_augment();
|
|
27198
27410
|
} else {
|
|
27199
27411
|
_print3(
|
|
27200
|
-
"Usage:
|
|
27412
|
+
"Usage: condense [--sync|--list|--changed|--check|--generate-tools|--clean-tools|--project-augment]"
|
|
27201
27413
|
);
|
|
27202
27414
|
return 1;
|
|
27203
27415
|
}
|
|
@@ -27207,19 +27419,19 @@ function _isCliEntry15() {
|
|
|
27207
27419
|
if (process.argv[1] === void 0) {
|
|
27208
27420
|
return false;
|
|
27209
27421
|
}
|
|
27210
|
-
const argvUrl = pathToFileURL15(
|
|
27422
|
+
const argvUrl = pathToFileURL15(path36.resolve(process.argv[1])).href;
|
|
27211
27423
|
if (import.meta.url === argvUrl) {
|
|
27212
27424
|
return true;
|
|
27213
27425
|
}
|
|
27214
27426
|
try {
|
|
27215
|
-
const here =
|
|
27216
|
-
const argv =
|
|
27427
|
+
const here = fs39.realpathSync(fileURLToPath22(import.meta.url));
|
|
27428
|
+
const argv = fs39.realpathSync(path36.resolve(process.argv[1]));
|
|
27217
27429
|
return here === argv;
|
|
27218
27430
|
} catch {
|
|
27219
27431
|
return false;
|
|
27220
27432
|
}
|
|
27221
27433
|
}
|
|
27222
|
-
var YAML4, _SLUG_PREFIX_RE, _HERE12, _DEFAULT_PROJECT_ROOT, MODULE_STATE, COPY_AS_IS, COPY_AS_IS_DIRS,
|
|
27434
|
+
var YAML4, _SLUG_PREFIX_RE, _HERE12, _DEFAULT_PROJECT_ROOT, MODULE_STATE, COPY_AS_IS, COPY_AS_IS_DIRS, USER_SCOPE_RULE_DIRS, COPY_MD_VERBATIM, TOOL_DIRS, PERSONA_TOOL_DIRS, USER_TYPE_TOOL_DIRS, _DIR_TOOL_ID, _LEGACY_SRC_PREFIX, _PROJECTED_SRC_PREFIX, _LEGACY_PROJECTED_SRC_PREFIX, _FM_LIST_ITEM_RE, _FM_PATH_PREFIX_RE, _BODY_DOCS_RE, _FM_PLAIN_LIST_RE, _HRR_BANNER_MARKER, PLUGIN_POINTER_SLUG, PLUGIN_POINTER_SKILL_BODY, AUGMENT_SYMLINK_DIRS, AUGMENT_SYMLINK_FILES, isMain;
|
|
27223
27435
|
var init_condense = __esm({
|
|
27224
27436
|
"src/scripts/condense.ts"() {
|
|
27225
27437
|
"use strict";
|
|
@@ -27228,15 +27440,19 @@ var init_condense = __esm({
|
|
|
27228
27440
|
init_claude_settings_hooks();
|
|
27229
27441
|
init_claude_builtin_names();
|
|
27230
27442
|
init_agent_settings();
|
|
27443
|
+
init_compile_time_toggles();
|
|
27231
27444
|
init_script_output();
|
|
27232
27445
|
init_model_tier();
|
|
27233
27446
|
_SLUG_PREFIX_RE = /^slug_prefix:\s*"?([a-z][a-z0-9-]*)"?\s*$/m;
|
|
27234
|
-
_HERE12 =
|
|
27235
|
-
_DEFAULT_PROJECT_ROOT =
|
|
27447
|
+
_HERE12 = path36.dirname(fileURLToPath22(import.meta.url));
|
|
27448
|
+
_DEFAULT_PROJECT_ROOT = path36.resolve(_HERE12, "..", "..");
|
|
27236
27449
|
MODULE_STATE = _deriveState(_DEFAULT_PROJECT_ROOT);
|
|
27237
27450
|
COPY_AS_IS = /* @__PURE__ */ new Set(["README.md"]);
|
|
27238
27451
|
COPY_AS_IS_DIRS = /* @__PURE__ */ new Set(["ghostwriter"]);
|
|
27239
|
-
|
|
27452
|
+
USER_SCOPE_RULE_DIRS = {
|
|
27453
|
+
".claude/rules": path36.join(".claude", "rules")
|
|
27454
|
+
};
|
|
27455
|
+
COPY_MD_VERBATIM = true;
|
|
27240
27456
|
TOOL_DIRS = {
|
|
27241
27457
|
".claude/rules": "../../dist/agent-src/rules",
|
|
27242
27458
|
".cursor/rules": "../../dist/agent-src/rules",
|
|
@@ -27320,8 +27536,8 @@ Run \`agent-config doctor\` to check for duplicate surfaces, and
|
|
|
27320
27536
|
});
|
|
27321
27537
|
|
|
27322
27538
|
// src/install/rule_scope.ts
|
|
27323
|
-
import * as
|
|
27324
|
-
import * as
|
|
27539
|
+
import * as fs40 from "node:fs";
|
|
27540
|
+
import * as path37 from "node:path";
|
|
27325
27541
|
function _list(value) {
|
|
27326
27542
|
if (Array.isArray(value) && value.length > 0) {
|
|
27327
27543
|
return value.map((v) => String(v));
|
|
@@ -27344,7 +27560,7 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
27344
27560
|
if (!sourcePath.endsWith(".md")) {
|
|
27345
27561
|
return true;
|
|
27346
27562
|
}
|
|
27347
|
-
const basename17 =
|
|
27563
|
+
const basename17 = path37.basename(sourcePath);
|
|
27348
27564
|
if (COMPAT_ALWAYS_EXCLUDED.includes(basename17)) {
|
|
27349
27565
|
return false;
|
|
27350
27566
|
}
|
|
@@ -27353,7 +27569,7 @@ function ruleFileArrives(sourcePath, scope) {
|
|
|
27353
27569
|
function excludedRuleBasenames(rulesDir, scope) {
|
|
27354
27570
|
let entries;
|
|
27355
27571
|
try {
|
|
27356
|
-
entries =
|
|
27572
|
+
entries = fs40.readdirSync(rulesDir).sort();
|
|
27357
27573
|
} catch {
|
|
27358
27574
|
return [];
|
|
27359
27575
|
}
|
|
@@ -27362,9 +27578,9 @@ function excludedRuleBasenames(rulesDir, scope) {
|
|
|
27362
27578
|
if (!name.endsWith(".md")) {
|
|
27363
27579
|
continue;
|
|
27364
27580
|
}
|
|
27365
|
-
const full =
|
|
27581
|
+
const full = path37.join(rulesDir, name);
|
|
27366
27582
|
try {
|
|
27367
|
-
if (!
|
|
27583
|
+
if (!fs40.statSync(full).isFile()) {
|
|
27368
27584
|
continue;
|
|
27369
27585
|
}
|
|
27370
27586
|
} catch {
|
|
@@ -27405,6 +27621,7 @@ __export(cmd_doctor_exports, {
|
|
|
27405
27621
|
_check_claude_command_wrappers: () => _check_claude_command_wrappers,
|
|
27406
27622
|
_check_claude_plugin: () => _check_claude_plugin,
|
|
27407
27623
|
_check_council_cli: () => _check_council_cli,
|
|
27624
|
+
_check_duplicate_scope_rules: () => _check_duplicate_scope_rules,
|
|
27408
27625
|
_check_git_identity: () => _check_git_identity,
|
|
27409
27626
|
_check_global_binary: () => _check_global_binary,
|
|
27410
27627
|
_check_humanizer_runtime: () => _check_humanizer_runtime,
|
|
@@ -27448,22 +27665,22 @@ __export(cmd_doctor_exports, {
|
|
|
27448
27665
|
_wizard_state_path: () => _wizard_state_path,
|
|
27449
27666
|
main: () => main16
|
|
27450
27667
|
});
|
|
27451
|
-
import * as
|
|
27452
|
-
import * as
|
|
27453
|
-
import * as
|
|
27454
|
-
import * as
|
|
27668
|
+
import * as crypto6 from "node:crypto";
|
|
27669
|
+
import * as fs41 from "node:fs";
|
|
27670
|
+
import * as os11 from "node:os";
|
|
27671
|
+
import * as path38 from "node:path";
|
|
27455
27672
|
import process15 from "node:process";
|
|
27456
27673
|
import { fileURLToPath as fileURLToPath23, pathToFileURL as pathToFileURL16 } from "node:url";
|
|
27457
27674
|
function expanduser5(p) {
|
|
27458
|
-
if (p === "~") return
|
|
27675
|
+
if (p === "~") return os11.homedir();
|
|
27459
27676
|
if (p.startsWith("~/") || p.startsWith("~\\")) {
|
|
27460
|
-
return
|
|
27677
|
+
return path38.join(os11.homedir(), p.slice(2));
|
|
27461
27678
|
}
|
|
27462
27679
|
return p;
|
|
27463
27680
|
}
|
|
27464
27681
|
function pathExists(p) {
|
|
27465
27682
|
try {
|
|
27466
|
-
|
|
27683
|
+
fs41.statSync(p);
|
|
27467
27684
|
return true;
|
|
27468
27685
|
} catch {
|
|
27469
27686
|
return false;
|
|
@@ -27471,27 +27688,27 @@ function pathExists(p) {
|
|
|
27471
27688
|
}
|
|
27472
27689
|
function isFile2(p) {
|
|
27473
27690
|
try {
|
|
27474
|
-
return
|
|
27691
|
+
return fs41.statSync(p).isFile();
|
|
27475
27692
|
} catch {
|
|
27476
27693
|
return false;
|
|
27477
27694
|
}
|
|
27478
27695
|
}
|
|
27479
27696
|
function isDir2(p) {
|
|
27480
27697
|
try {
|
|
27481
|
-
return
|
|
27698
|
+
return fs41.statSync(p).isDirectory();
|
|
27482
27699
|
} catch {
|
|
27483
27700
|
return false;
|
|
27484
27701
|
}
|
|
27485
27702
|
}
|
|
27486
27703
|
function resolvePath(p) {
|
|
27487
27704
|
try {
|
|
27488
|
-
return
|
|
27705
|
+
return fs41.realpathSync(path38.resolve(p));
|
|
27489
27706
|
} catch {
|
|
27490
|
-
return
|
|
27707
|
+
return path38.resolve(p);
|
|
27491
27708
|
}
|
|
27492
27709
|
}
|
|
27493
27710
|
function readText2(p) {
|
|
27494
|
-
return
|
|
27711
|
+
return fs41.readFileSync(p, "utf-8");
|
|
27495
27712
|
}
|
|
27496
27713
|
function _jsonStrAscii3(s) {
|
|
27497
27714
|
let out = '"';
|
|
@@ -27598,7 +27815,7 @@ function _resolve_project_root(arg) {
|
|
|
27598
27815
|
return resolve_project_root(arg);
|
|
27599
27816
|
}
|
|
27600
27817
|
function _detect_install_mode(project_root) {
|
|
27601
|
-
const marker =
|
|
27818
|
+
const marker = path38.join(project_root, _INSTALL_MODE_MARKER_REL);
|
|
27602
27819
|
if (isFile2(marker)) {
|
|
27603
27820
|
let value;
|
|
27604
27821
|
try {
|
|
@@ -27610,9 +27827,9 @@ function _detect_install_mode(project_root) {
|
|
|
27610
27827
|
return [value, "marker-file"];
|
|
27611
27828
|
}
|
|
27612
27829
|
}
|
|
27613
|
-
const has_agents_md = pathExists(
|
|
27830
|
+
const has_agents_md = pathExists(path38.join(project_root, "AGENTS.md"));
|
|
27614
27831
|
const has_copilot = pathExists(
|
|
27615
|
-
|
|
27832
|
+
path38.join(project_root, ".github", "copilot-instructions.md")
|
|
27616
27833
|
);
|
|
27617
27834
|
if (has_agents_md && has_copilot) {
|
|
27618
27835
|
return ["full", "heuristic"];
|
|
@@ -27632,7 +27849,7 @@ function _settings_layer_chain(project_root) {
|
|
|
27632
27849
|
return layers;
|
|
27633
27850
|
}
|
|
27634
27851
|
function _detect_wrapper(project_root) {
|
|
27635
|
-
const wrapper =
|
|
27852
|
+
const wrapper = path38.join(project_root, "agent-config");
|
|
27636
27853
|
if (!pathExists(wrapper)) {
|
|
27637
27854
|
return { path: String(wrapper), exists: false, embedded_root: null };
|
|
27638
27855
|
}
|
|
@@ -27699,21 +27916,21 @@ function _emit_context_text(ctx) {
|
|
|
27699
27916
|
}
|
|
27700
27917
|
function _resolve_path(project_root, raw) {
|
|
27701
27918
|
let p = expanduser5(raw);
|
|
27702
|
-
if (!
|
|
27703
|
-
p =
|
|
27919
|
+
if (!path38.isAbsolute(p)) {
|
|
27920
|
+
p = path38.join(project_root, p);
|
|
27704
27921
|
}
|
|
27705
27922
|
return p;
|
|
27706
27923
|
}
|
|
27707
27924
|
function _sha256(p) {
|
|
27708
27925
|
try {
|
|
27709
|
-
const data =
|
|
27710
|
-
return
|
|
27926
|
+
const data = fs41.readFileSync(p);
|
|
27927
|
+
return crypto6.createHash("sha256").update(data).digest("hex");
|
|
27711
27928
|
} catch {
|
|
27712
27929
|
return null;
|
|
27713
27930
|
}
|
|
27714
27931
|
}
|
|
27715
27932
|
function _read_inline_package_tag(p) {
|
|
27716
|
-
if (
|
|
27933
|
+
if (path38.extname(p) !== ".md") {
|
|
27717
27934
|
return NO_FRONTMATTER;
|
|
27718
27935
|
}
|
|
27719
27936
|
let text;
|
|
@@ -27752,7 +27969,7 @@ function splitlines5(text) {
|
|
|
27752
27969
|
return out;
|
|
27753
27970
|
}
|
|
27754
27971
|
function rstrip(s) {
|
|
27755
|
-
return s.replace(/[\s
|
|
27972
|
+
return s.replace(/[\s\u0085 ]+$/u, "");
|
|
27756
27973
|
}
|
|
27757
27974
|
function stripQuotes2(s) {
|
|
27758
27975
|
let out = s;
|
|
@@ -27842,13 +28059,13 @@ function rglob2(root) {
|
|
|
27842
28059
|
const walk = (dir) => {
|
|
27843
28060
|
let entries;
|
|
27844
28061
|
try {
|
|
27845
|
-
entries =
|
|
28062
|
+
entries = fs41.readdirSync(dir, { withFileTypes: true });
|
|
27846
28063
|
} catch {
|
|
27847
28064
|
return;
|
|
27848
28065
|
}
|
|
27849
28066
|
entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
27850
28067
|
for (const ent of entries) {
|
|
27851
|
-
const full =
|
|
28068
|
+
const full = path38.join(dir, ent.name);
|
|
27852
28069
|
out.push(full);
|
|
27853
28070
|
let dirLike = ent.isDirectory();
|
|
27854
28071
|
if (ent.isSymbolicLink()) {
|
|
@@ -27923,19 +28140,19 @@ function _foreign_records(project_root, foreign) {
|
|
|
27923
28140
|
return out;
|
|
27924
28141
|
}
|
|
27925
28142
|
function relativeTo(p, base) {
|
|
27926
|
-
const rel =
|
|
28143
|
+
const rel = path38.relative(base, p);
|
|
27927
28144
|
if (rel === "") return rel;
|
|
27928
|
-
if (rel.startsWith("..") ||
|
|
28145
|
+
if (rel.startsWith("..") || path38.isAbsolute(rel)) {
|
|
27929
28146
|
return null;
|
|
27930
28147
|
}
|
|
27931
28148
|
return rel;
|
|
27932
28149
|
}
|
|
27933
28150
|
function _is_global_only_consumer(project_root) {
|
|
27934
|
-
return isFile2(
|
|
28151
|
+
return isFile2(path38.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir2(path38.join(project_root, "agents", "overrides"));
|
|
27935
28152
|
}
|
|
27936
28153
|
function _check_scope(project_root) {
|
|
27937
28154
|
for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
|
|
27938
|
-
if (pathExists(
|
|
28155
|
+
if (pathExists(path38.join(project_root, marker))) {
|
|
27939
28156
|
return {
|
|
27940
28157
|
id: "scope",
|
|
27941
28158
|
status: "warn",
|
|
@@ -27944,7 +28161,7 @@ function _check_scope(project_root) {
|
|
|
27944
28161
|
};
|
|
27945
28162
|
}
|
|
27946
28163
|
}
|
|
27947
|
-
const pkg =
|
|
28164
|
+
const pkg = path38.join(project_root, "package.json");
|
|
27948
28165
|
if (pathExists(pkg)) {
|
|
27949
28166
|
try {
|
|
27950
28167
|
const data = JSON.parse(readText2(pkg));
|
|
@@ -27967,23 +28184,23 @@ function _check_scope(project_root) {
|
|
|
27967
28184
|
};
|
|
27968
28185
|
}
|
|
27969
28186
|
function _git_config_path(project_root) {
|
|
27970
|
-
const gd =
|
|
28187
|
+
const gd = path38.join(project_root, ".git");
|
|
27971
28188
|
try {
|
|
27972
|
-
const st =
|
|
28189
|
+
const st = fs41.statSync(gd);
|
|
27973
28190
|
if (st.isDirectory()) {
|
|
27974
|
-
return
|
|
28191
|
+
return path38.join(gd, "config");
|
|
27975
28192
|
}
|
|
27976
28193
|
const m = readText2(gd).match(/^gitdir:\s*(.+)\s*$/m);
|
|
27977
28194
|
if (m === null) {
|
|
27978
28195
|
return null;
|
|
27979
28196
|
}
|
|
27980
|
-
const gdPath =
|
|
27981
|
-
const commondirFile =
|
|
28197
|
+
const gdPath = path38.resolve(project_root, m[1].trim());
|
|
28198
|
+
const commondirFile = path38.join(gdPath, "commondir");
|
|
27982
28199
|
if (pathExists(commondirFile)) {
|
|
27983
|
-
const common =
|
|
27984
|
-
return
|
|
28200
|
+
const common = path38.resolve(gdPath, readText2(commondirFile).trim());
|
|
28201
|
+
return path38.join(common, "config");
|
|
27985
28202
|
}
|
|
27986
|
-
return
|
|
28203
|
+
return path38.join(gdPath, "config");
|
|
27987
28204
|
} catch {
|
|
27988
28205
|
return null;
|
|
27989
28206
|
}
|
|
@@ -28016,7 +28233,7 @@ function _check_git_identity(project_root) {
|
|
|
28016
28233
|
}
|
|
28017
28234
|
let ident = _parse_git_user(readText2(cfgPath));
|
|
28018
28235
|
if (ident.name === null && ident.email === null) {
|
|
28019
|
-
const globalCfg =
|
|
28236
|
+
const globalCfg = path38.join(os11.homedir(), ".gitconfig");
|
|
28020
28237
|
if (pathExists(globalCfg)) {
|
|
28021
28238
|
ident = _parse_git_user(readText2(globalCfg));
|
|
28022
28239
|
}
|
|
@@ -28073,11 +28290,11 @@ function _check_manifest_integrity(manifest) {
|
|
|
28073
28290
|
};
|
|
28074
28291
|
}
|
|
28075
28292
|
function _package_root() {
|
|
28076
|
-
return
|
|
28293
|
+
return path38.resolve(path38.dirname(_HERE13), "..", "..", "..");
|
|
28077
28294
|
}
|
|
28078
28295
|
function _current_package_version() {
|
|
28079
28296
|
try {
|
|
28080
|
-
const data = JSON.parse(readText2(
|
|
28297
|
+
const data = JSON.parse(readText2(path38.join(_package_root(), "package.json")));
|
|
28081
28298
|
const v = data["version"];
|
|
28082
28299
|
if (typeof v === "string" && v.trim()) {
|
|
28083
28300
|
return v.trim();
|
|
@@ -28121,7 +28338,7 @@ function _check_lockfile_freshness(manifest) {
|
|
|
28121
28338
|
};
|
|
28122
28339
|
}
|
|
28123
28340
|
function shutilWhich(name) {
|
|
28124
|
-
if (
|
|
28341
|
+
if (path38.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
|
|
28125
28342
|
return isExecutableFile(name) ? name : null;
|
|
28126
28343
|
}
|
|
28127
28344
|
const pathEnv = process15.env["PATH"] || "";
|
|
@@ -28134,12 +28351,12 @@ function shutilWhich(name) {
|
|
|
28134
28351
|
if (seenDirs.has(d)) continue;
|
|
28135
28352
|
seenDirs.add(d);
|
|
28136
28353
|
for (const ext of exts) {
|
|
28137
|
-
const candidate =
|
|
28354
|
+
const candidate = path38.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
|
|
28138
28355
|
if (isExecutableFile(candidate)) {
|
|
28139
28356
|
return candidate;
|
|
28140
28357
|
}
|
|
28141
28358
|
if (ext !== "") {
|
|
28142
|
-
const upper =
|
|
28359
|
+
const upper = path38.join(d, name + ext);
|
|
28143
28360
|
if (isExecutableFile(upper)) return upper;
|
|
28144
28361
|
}
|
|
28145
28362
|
}
|
|
@@ -28148,10 +28365,10 @@ function shutilWhich(name) {
|
|
|
28148
28365
|
}
|
|
28149
28366
|
function isExecutableFile(p) {
|
|
28150
28367
|
try {
|
|
28151
|
-
const st =
|
|
28368
|
+
const st = fs41.statSync(p);
|
|
28152
28369
|
if (!st.isFile()) return false;
|
|
28153
28370
|
if (process15.platform === "win32") return true;
|
|
28154
|
-
|
|
28371
|
+
fs41.accessSync(p, fs41.constants.X_OK);
|
|
28155
28372
|
return true;
|
|
28156
28373
|
} catch {
|
|
28157
28374
|
return false;
|
|
@@ -28215,7 +28432,7 @@ function _check_claude_plugin() {
|
|
|
28215
28432
|
remedy: ""
|
|
28216
28433
|
};
|
|
28217
28434
|
}
|
|
28218
|
-
const projection =
|
|
28435
|
+
const projection = path38.join(os11.homedir(), ".claude", "skills");
|
|
28219
28436
|
const projection_present = isDir2(projection);
|
|
28220
28437
|
if (projection_present) {
|
|
28221
28438
|
return {
|
|
@@ -28252,8 +28469,8 @@ function _check_claude_command_wrappers() {
|
|
|
28252
28469
|
remedy: ""
|
|
28253
28470
|
};
|
|
28254
28471
|
}
|
|
28255
|
-
const anchor =
|
|
28256
|
-
const commands_dir =
|
|
28472
|
+
const anchor = path38.join(os11.homedir(), ".claude");
|
|
28473
|
+
const commands_dir = path38.join(anchor, "commands");
|
|
28257
28474
|
if (!isDir2(commands_dir)) {
|
|
28258
28475
|
return {
|
|
28259
28476
|
id: "claude-command-wrappers",
|
|
@@ -28262,8 +28479,8 @@ function _check_claude_command_wrappers() {
|
|
|
28262
28479
|
remedy: ""
|
|
28263
28480
|
};
|
|
28264
28481
|
}
|
|
28265
|
-
const flat_probe =
|
|
28266
|
-
const wrapper_probe =
|
|
28482
|
+
const flat_probe = fs41.existsSync(path38.join(commands_dir, "commit.md"));
|
|
28483
|
+
const wrapper_probe = fs41.existsSync(path38.join(anchor, "skills", "commit", "SKILL.md"));
|
|
28267
28484
|
if (wrapper_probe) {
|
|
28268
28485
|
return {
|
|
28269
28486
|
id: "claude-command-wrappers",
|
|
@@ -28288,7 +28505,7 @@ function _check_claude_command_wrappers() {
|
|
|
28288
28505
|
};
|
|
28289
28506
|
}
|
|
28290
28507
|
function _check_surface_state() {
|
|
28291
|
-
const matrix_path =
|
|
28508
|
+
const matrix_path = path38.join(_package_root(), "src", "config", "surface-matrix.yml");
|
|
28292
28509
|
if (!isFile2(matrix_path)) {
|
|
28293
28510
|
return {
|
|
28294
28511
|
id: "surface-state",
|
|
@@ -28312,7 +28529,7 @@ function _check_surface_state() {
|
|
|
28312
28529
|
remedy: "agent-config upgrade (reinstalls the package data files)"
|
|
28313
28530
|
};
|
|
28314
28531
|
}
|
|
28315
|
-
const _expand = (p) => p.startsWith("~/") ?
|
|
28532
|
+
const _expand = (p) => p.startsWith("~/") ? path38.join(os11.homedir(), p.slice(2)) : path38.join(_package_root(), p);
|
|
28316
28533
|
const violations = [];
|
|
28317
28534
|
const remedies = [];
|
|
28318
28535
|
let checked = 0;
|
|
@@ -28354,7 +28571,7 @@ function _check_surface_state() {
|
|
|
28354
28571
|
}
|
|
28355
28572
|
function pathExistsAny(p) {
|
|
28356
28573
|
try {
|
|
28357
|
-
|
|
28574
|
+
fs41.statSync(p);
|
|
28358
28575
|
return true;
|
|
28359
28576
|
} catch {
|
|
28360
28577
|
return false;
|
|
@@ -28370,13 +28587,13 @@ function _check_hook_wiring() {
|
|
|
28370
28587
|
remedy: ""
|
|
28371
28588
|
};
|
|
28372
28589
|
}
|
|
28373
|
-
const settings_path =
|
|
28590
|
+
const settings_path = path38.join(os11.homedir(), ".claude", "settings.json");
|
|
28374
28591
|
let missing;
|
|
28375
28592
|
try {
|
|
28376
28593
|
const matrix = build_claude_hook_matrix(
|
|
28377
|
-
|
|
28594
|
+
path38.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
|
|
28378
28595
|
);
|
|
28379
|
-
const settings = pathExists(settings_path) ? JSON.parse(
|
|
28596
|
+
const settings = pathExists(settings_path) ? JSON.parse(fs41.readFileSync(settings_path, "utf8")) : {};
|
|
28380
28597
|
const hooks = (settings["hooks"] ?? {}) || {};
|
|
28381
28598
|
missing = Object.keys(matrix).filter((ev) => {
|
|
28382
28599
|
const groups = hooks[ev];
|
|
@@ -28451,7 +28668,7 @@ function _check_mcp_mode(project_root) {
|
|
|
28451
28668
|
];
|
|
28452
28669
|
const found = [];
|
|
28453
28670
|
for (const [rel, label] of candidates) {
|
|
28454
|
-
const p =
|
|
28671
|
+
const p = path38.join(project_root, rel);
|
|
28455
28672
|
if (!pathExists(p)) {
|
|
28456
28673
|
continue;
|
|
28457
28674
|
}
|
|
@@ -28483,7 +28700,7 @@ function _check_mcp_mode(project_root) {
|
|
|
28483
28700
|
};
|
|
28484
28701
|
}
|
|
28485
28702
|
function _check_offline_readiness() {
|
|
28486
|
-
const script =
|
|
28703
|
+
const script = path38.join(_package_root(), "src", "scripts", "hermetic-install.sh");
|
|
28487
28704
|
if (!pathExists(script)) {
|
|
28488
28705
|
return {
|
|
28489
28706
|
id: "offline-readiness",
|
|
@@ -28541,7 +28758,7 @@ function _check_stale_orphans() {
|
|
|
28541
28758
|
(a, b) => a < b ? -1 : a > b ? 1 : 0
|
|
28542
28759
|
);
|
|
28543
28760
|
for (const root_name of ownedSorted) {
|
|
28544
|
-
const root =
|
|
28761
|
+
const root = path38.join(anchor, root_name);
|
|
28545
28762
|
if (!isDir2(root)) {
|
|
28546
28763
|
continue;
|
|
28547
28764
|
}
|
|
@@ -28556,7 +28773,7 @@ function _check_stale_orphans() {
|
|
|
28556
28773
|
if (rel === null) {
|
|
28557
28774
|
continue;
|
|
28558
28775
|
}
|
|
28559
|
-
const relPosix2 = rel.split(
|
|
28776
|
+
const relPosix2 = rel.split(path38.sep).join("/");
|
|
28560
28777
|
if (recorded_set.has(relPosix2)) {
|
|
28561
28778
|
continue;
|
|
28562
28779
|
}
|
|
@@ -28605,14 +28822,14 @@ function _check_rule_scope_drift(project_root) {
|
|
|
28605
28822
|
let rules_dir = null;
|
|
28606
28823
|
let found = 0;
|
|
28607
28824
|
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
28608
|
-
const cand =
|
|
28825
|
+
const cand = path38.join(project_root, rel);
|
|
28609
28826
|
if (!isDir2(cand)) {
|
|
28610
28827
|
continue;
|
|
28611
28828
|
}
|
|
28612
28829
|
let count = 0;
|
|
28613
28830
|
try {
|
|
28614
|
-
for (const name of
|
|
28615
|
-
if (name.endsWith(".md") && isFile2(
|
|
28831
|
+
for (const name of fs41.readdirSync(cand)) {
|
|
28832
|
+
if (name.endsWith(".md") && isFile2(path38.join(cand, name))) {
|
|
28616
28833
|
count += 1;
|
|
28617
28834
|
}
|
|
28618
28835
|
}
|
|
@@ -28665,6 +28882,47 @@ function _check_rule_scope_drift(project_root) {
|
|
|
28665
28882
|
remedy: "re-run `agent-config init --project` (or `agent-config global`) to re-project rules under the current scope \u2014 these are leftover from a pre-9.0 full/global projection"
|
|
28666
28883
|
};
|
|
28667
28884
|
}
|
|
28885
|
+
function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
|
|
28886
|
+
const user_rules_dir = userRulesDirOverride ?? path38.join(os11.homedir(), ".claude", "rules");
|
|
28887
|
+
let project_rules_dir = null;
|
|
28888
|
+
if (_is_source_repo(project_root)) {
|
|
28889
|
+
const cand = path38.join(project_root, "dist", "agent-src", "rules");
|
|
28890
|
+
if (isDir2(cand)) project_rules_dir = cand;
|
|
28891
|
+
} else {
|
|
28892
|
+
for (const rel of _RULE_PROJECTION_DIRS) {
|
|
28893
|
+
const cand = path38.join(project_root, rel);
|
|
28894
|
+
if (isDir2(cand)) {
|
|
28895
|
+
project_rules_dir = cand;
|
|
28896
|
+
break;
|
|
28897
|
+
}
|
|
28898
|
+
}
|
|
28899
|
+
}
|
|
28900
|
+
if (project_rules_dir === null) {
|
|
28901
|
+
return {
|
|
28902
|
+
id: "duplicate-scope-rules",
|
|
28903
|
+
status: "skipped",
|
|
28904
|
+
message: "no project-scope rule tree found (dist/agent-src/rules, .augment/rules, \u2026) \u2014 nothing to compare against the user-scope copy",
|
|
28905
|
+
remedy: ""
|
|
28906
|
+
};
|
|
28907
|
+
}
|
|
28908
|
+
const census = censusDuplicateScope(user_rules_dir, project_rules_dir);
|
|
28909
|
+
if (!census.evaluable) {
|
|
28910
|
+
return {
|
|
28911
|
+
id: "duplicate-scope-rules",
|
|
28912
|
+
status: "ok",
|
|
28913
|
+
message: census.reason ?? "no duplicate-scope rule install detected",
|
|
28914
|
+
remedy: ""
|
|
28915
|
+
};
|
|
28916
|
+
}
|
|
28917
|
+
const tokens = Math.round(census.duplicate_chars / 4);
|
|
28918
|
+
const rel_project = relativeTo(project_rules_dir, project_root) ?? project_rules_dir;
|
|
28919
|
+
return {
|
|
28920
|
+
id: "duplicate-scope-rules",
|
|
28921
|
+
status: "warn",
|
|
28922
|
+
message: `${census.shared_filenames.length} rule(s) installed at BOTH user scope (${user_rules_dir}) and project scope (${rel_project}) \u2014 an estimated ${tokens} redundant tokens are injected on every session AND every subagent spawn (both copies are always-loaded). Project scope is authoritative for this checkout.`,
|
|
28923
|
+
remedy: "detection only \u2014 no file is modified. If the duplication is unwanted, refresh the user-scope copy (e.g. `agent-config global`) to re-sync it with the project-scope version."
|
|
28924
|
+
};
|
|
28925
|
+
}
|
|
28668
28926
|
function _check_python_runtime() {
|
|
28669
28927
|
return {
|
|
28670
28928
|
id: "python-runtime",
|
|
@@ -28701,7 +28959,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
28701
28959
|
}
|
|
28702
28960
|
const pending = [];
|
|
28703
28961
|
for (const [gate_id, rel] of MCP_BETA_GATES) {
|
|
28704
|
-
if (!pathExists(
|
|
28962
|
+
if (!pathExists(path38.join(project_root, rel))) {
|
|
28705
28963
|
pending.push(`${gate_id} (${rel})`);
|
|
28706
28964
|
}
|
|
28707
28965
|
}
|
|
@@ -28722,7 +28980,7 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
28722
28980
|
}
|
|
28723
28981
|
function _check_tier_usage_readiness(project_root) {
|
|
28724
28982
|
const settings_file = project_settings_path(project_root);
|
|
28725
|
-
let log_path =
|
|
28983
|
+
let log_path = path38.join(project_root, ".agent-tier-usage.jsonl");
|
|
28726
28984
|
let enabled = false;
|
|
28727
28985
|
if (isFile2(settings_file)) {
|
|
28728
28986
|
let raw;
|
|
@@ -28741,7 +28999,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
28741
28999
|
const outputRaw = tu["output"];
|
|
28742
29000
|
const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
|
|
28743
29001
|
if (typeof output["path"] === "string" && output["path"].trim()) {
|
|
28744
|
-
log_path =
|
|
29002
|
+
log_path = path38.join(project_root, output["path"].trim());
|
|
28745
29003
|
}
|
|
28746
29004
|
const val = tu["enabled"];
|
|
28747
29005
|
if (typeof val === "boolean") {
|
|
@@ -28766,7 +29024,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
28766
29024
|
return {
|
|
28767
29025
|
id: "tier-usage-readiness",
|
|
28768
29026
|
status: "warn",
|
|
28769
|
-
message: `tier-usage telemetry on but ${
|
|
29027
|
+
message: `tier-usage telemetry on but ${path38.basename(log_path)} not yet written \u2014 no signal accumulated`,
|
|
28770
29028
|
remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
|
|
28771
29029
|
};
|
|
28772
29030
|
}
|
|
@@ -28781,7 +29039,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
28781
29039
|
return {
|
|
28782
29040
|
id: "tier-usage-readiness",
|
|
28783
29041
|
status: "fail",
|
|
28784
|
-
message: `cannot read ${
|
|
29042
|
+
message: `cannot read ${path38.basename(log_path)}: ${osErrorStr2(exc)}`,
|
|
28785
29043
|
remedy: "fix permissions on the tier-usage log"
|
|
28786
29044
|
};
|
|
28787
29045
|
}
|
|
@@ -28812,7 +29070,7 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
28812
29070
|
return {
|
|
28813
29071
|
id: "tier-usage-readiness",
|
|
28814
29072
|
status: "fail",
|
|
28815
|
-
message: `${total} record(s) in ${
|
|
29073
|
+
message: `${total} record(s) in ${path38.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
|
|
28816
29074
|
remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
|
|
28817
29075
|
};
|
|
28818
29076
|
}
|
|
@@ -28820,19 +29078,19 @@ function _check_tier_usage_readiness(project_root) {
|
|
|
28820
29078
|
return {
|
|
28821
29079
|
id: "tier-usage-readiness",
|
|
28822
29080
|
status: "warn",
|
|
28823
|
-
message: `${
|
|
29081
|
+
message: `${path38.basename(log_path)} present but empty \u2014 no signal yet`,
|
|
28824
29082
|
remedy: "run any tracked command to seed the log"
|
|
28825
29083
|
};
|
|
28826
29084
|
}
|
|
28827
29085
|
return {
|
|
28828
29086
|
id: "tier-usage-readiness",
|
|
28829
29087
|
status: "ok",
|
|
28830
|
-
message: `${valid} record(s) past the privacy floor in ${
|
|
29088
|
+
message: `${valid} record(s) past the privacy floor in ${path38.basename(log_path)} \u2014 retiering signal available`,
|
|
28831
29089
|
remedy: ""
|
|
28832
29090
|
};
|
|
28833
29091
|
}
|
|
28834
29092
|
function readText0(p) {
|
|
28835
|
-
return
|
|
29093
|
+
return fs41.readFileSync(p, "utf-8");
|
|
28836
29094
|
}
|
|
28837
29095
|
function osErrorStr2(exc) {
|
|
28838
29096
|
if (exc && typeof exc === "object" && "message" in exc) {
|
|
@@ -28949,7 +29207,7 @@ function pyFloat(value) {
|
|
|
28949
29207
|
}
|
|
28950
29208
|
function _codex_home() {
|
|
28951
29209
|
const env = (process15.env["CODEX_HOME"] ?? "").trim();
|
|
28952
|
-
return env !== "" ? env :
|
|
29210
|
+
return env !== "" ? env : path38.join(os11.homedir(), ".codex");
|
|
28953
29211
|
}
|
|
28954
29212
|
function _team_codex_binary_name(project_root) {
|
|
28955
29213
|
const default_bin = _CLI_PROVIDER_META["openai"][0];
|
|
@@ -29005,7 +29263,7 @@ function _epoch_seconds(value) {
|
|
|
29005
29263
|
function _codex_auth_expiry(auth_path) {
|
|
29006
29264
|
let data;
|
|
29007
29265
|
try {
|
|
29008
|
-
data = JSON.parse(
|
|
29266
|
+
data = JSON.parse(fs41.readFileSync(auth_path, "utf-8"));
|
|
29009
29267
|
} catch {
|
|
29010
29268
|
return null;
|
|
29011
29269
|
}
|
|
@@ -29068,7 +29326,7 @@ function _check_team(project_root) {
|
|
|
29068
29326
|
if (binary_resolved === null) {
|
|
29069
29327
|
remedies.push("install the codex CLI: `npm install -g @openai/codex`");
|
|
29070
29328
|
}
|
|
29071
|
-
const auth_path =
|
|
29329
|
+
const auth_path = path38.join(_codex_home(), "auth.json");
|
|
29072
29330
|
const authed = pathExists(auth_path);
|
|
29073
29331
|
let auth_str;
|
|
29074
29332
|
if (!authed) {
|
|
@@ -29148,7 +29406,7 @@ function _check_unsupported_combos(manifest) {
|
|
|
29148
29406
|
};
|
|
29149
29407
|
}
|
|
29150
29408
|
function _wizard_state_path() {
|
|
29151
|
-
return
|
|
29409
|
+
return path38.join(event4u_root(), "state", "wizard-state.json");
|
|
29152
29410
|
}
|
|
29153
29411
|
function _check_wizard_state() {
|
|
29154
29412
|
const state_pth = _wizard_state_path();
|
|
@@ -29228,7 +29486,7 @@ function _check_wizard_state() {
|
|
|
29228
29486
|
};
|
|
29229
29487
|
}
|
|
29230
29488
|
function _check_settings_review_pending() {
|
|
29231
|
-
const delta_pth =
|
|
29489
|
+
const delta_pth = path38.join(event4u_root(), "state", "settings-delta.json");
|
|
29232
29490
|
if (!pathExists(delta_pth)) {
|
|
29233
29491
|
return {
|
|
29234
29492
|
id: "settings-review-pending",
|
|
@@ -29254,7 +29512,7 @@ function _check_settings_review_pending() {
|
|
|
29254
29512
|
}
|
|
29255
29513
|
function _check_memory_merge_union(project_root) {
|
|
29256
29514
|
const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
|
|
29257
|
-
const target =
|
|
29515
|
+
const target = path38.join(project_root, DEFAULT_GITATTRIBUTES);
|
|
29258
29516
|
if (!pathExists(target)) {
|
|
29259
29517
|
return {
|
|
29260
29518
|
id: "memory-merge-union",
|
|
@@ -29392,7 +29650,8 @@ function _run_checks(project_root, manifest, drift, only = null) {
|
|
|
29392
29650
|
"unsupported-combos": () => _check_unsupported_combos(manifest),
|
|
29393
29651
|
"wizard-state": _check_wizard_state,
|
|
29394
29652
|
"settings-review-pending": _check_settings_review_pending,
|
|
29395
|
-
"memory-merge-union": () => _check_memory_merge_union(project_root)
|
|
29653
|
+
"memory-merge-union": () => _check_memory_merge_union(project_root),
|
|
29654
|
+
"duplicate-scope-rules": () => _check_duplicate_scope_rules(project_root)
|
|
29396
29655
|
};
|
|
29397
29656
|
const out = [];
|
|
29398
29657
|
for (const cid of CHECK_IDS) {
|
|
@@ -29452,7 +29711,8 @@ function _run_checks_no_manifest(project_root, bridge_present, only = null) {
|
|
|
29452
29711
|
"unsupported-combos": () => _skipped_manifest_check("unsupported-combos"),
|
|
29453
29712
|
"wizard-state": _check_wizard_state,
|
|
29454
29713
|
"settings-review-pending": _check_settings_review_pending,
|
|
29455
|
-
"memory-merge-union": () => _check_memory_merge_union(project_root)
|
|
29714
|
+
"memory-merge-union": () => _check_memory_merge_union(project_root),
|
|
29715
|
+
"duplicate-scope-rules": () => _check_duplicate_scope_rules(project_root)
|
|
29456
29716
|
};
|
|
29457
29717
|
const out = [];
|
|
29458
29718
|
for (const cid of CHECK_IDS) {
|
|
@@ -29703,7 +29963,7 @@ function _run_repair(opts) {
|
|
|
29703
29963
|
};
|
|
29704
29964
|
if (exists2) {
|
|
29705
29965
|
try {
|
|
29706
|
-
|
|
29966
|
+
fs41.unlinkSync(state_pth);
|
|
29707
29967
|
} catch (exc) {
|
|
29708
29968
|
payload["action"] = "error";
|
|
29709
29969
|
payload["error"] = osErrorStr2(exc);
|
|
@@ -29797,13 +30057,13 @@ function _isCliEntry16() {
|
|
|
29797
30057
|
if (process15.argv[1] === void 0) {
|
|
29798
30058
|
return false;
|
|
29799
30059
|
}
|
|
29800
|
-
const argvUrl = pathToFileURL16(
|
|
30060
|
+
const argvUrl = pathToFileURL16(path38.resolve(process15.argv[1])).href;
|
|
29801
30061
|
if (import.meta.url === argvUrl) {
|
|
29802
30062
|
return true;
|
|
29803
30063
|
}
|
|
29804
30064
|
try {
|
|
29805
|
-
const here =
|
|
29806
|
-
const argv =
|
|
30065
|
+
const here = fs41.realpathSync(fileURLToPath23(import.meta.url));
|
|
30066
|
+
const argv = fs41.realpathSync(path38.resolve(process15.argv[1]));
|
|
29807
30067
|
return here === argv;
|
|
29808
30068
|
} catch {
|
|
29809
30069
|
return false;
|
|
@@ -29821,6 +30081,7 @@ var init_cmd_doctor = __esm({
|
|
|
29821
30081
|
init_installed_tools();
|
|
29822
30082
|
init_user_global_paths();
|
|
29823
30083
|
init_global_deploy_inventory();
|
|
30084
|
+
init_duplicate_scope_census();
|
|
29824
30085
|
init_sync_gitattributes();
|
|
29825
30086
|
init_agent_settings();
|
|
29826
30087
|
init_clients();
|
|
@@ -29865,7 +30126,8 @@ var init_cmd_doctor = __esm({
|
|
|
29865
30126
|
"unsupported-combos",
|
|
29866
30127
|
"wizard-state",
|
|
29867
30128
|
"settings-review-pending",
|
|
29868
|
-
"memory-merge-union"
|
|
30129
|
+
"memory-merge-union",
|
|
30130
|
+
"duplicate-scope-rules"
|
|
29869
30131
|
];
|
|
29870
30132
|
GLOBAL_CHECK_IDS = /* @__PURE__ */ new Set([
|
|
29871
30133
|
"scope",
|
|
@@ -29887,7 +30149,8 @@ var init_cmd_doctor = __esm({
|
|
|
29887
30149
|
"team",
|
|
29888
30150
|
"wizard-state",
|
|
29889
30151
|
"settings-review-pending",
|
|
29890
|
-
"memory-merge-union"
|
|
30152
|
+
"memory-merge-union",
|
|
30153
|
+
"duplicate-scope-rules"
|
|
29891
30154
|
]);
|
|
29892
30155
|
MANIFEST_REQUIRED_CHECK_IDS = /* @__PURE__ */ new Set([
|
|
29893
30156
|
"manifest-integrity",
|
|
@@ -29956,9 +30219,9 @@ var init_cmd_doctor = __esm({
|
|
|
29956
30219
|
});
|
|
29957
30220
|
|
|
29958
30221
|
// src/install/txlog.ts
|
|
29959
|
-
import { createReadStream, createWriteStream, existsSync as
|
|
30222
|
+
import { createReadStream, createWriteStream, existsSync as existsSync16, readFileSync as readFileSync35, renameSync as renameSync7, statSync as statSync27, unlinkSync as unlinkSync7 } from "node:fs";
|
|
29960
30223
|
function readRecentEntries(logPath) {
|
|
29961
|
-
if (!
|
|
30224
|
+
if (!existsSync16(logPath)) {
|
|
29962
30225
|
return [];
|
|
29963
30226
|
}
|
|
29964
30227
|
const raw = readFileSync35(logPath, "utf8");
|
|
@@ -29996,21 +30259,21 @@ var init_txlog = __esm({
|
|
|
29996
30259
|
});
|
|
29997
30260
|
|
|
29998
30261
|
// src/install/detect.ts
|
|
29999
|
-
import { existsSync as
|
|
30000
|
-
import { join as
|
|
30262
|
+
import { existsSync as existsSync17, readFileSync as readFileSync36, readdirSync as readdirSync24, statSync as statSync28 } from "node:fs";
|
|
30263
|
+
import { join as join37, resolve as resolve26 } from "node:path";
|
|
30001
30264
|
function detectToolPresence(root) {
|
|
30002
30265
|
return {
|
|
30003
|
-
augment: isDir3(
|
|
30004
|
-
claude: isDir3(
|
|
30005
|
-
cursor: isDir3(
|
|
30006
|
-
cline: isDir3(
|
|
30007
|
-
windsurf: isDir3(
|
|
30008
|
-
agentsMd:
|
|
30266
|
+
augment: isDir3(join37(root, ".augment")),
|
|
30267
|
+
claude: isDir3(join37(root, ".claude")),
|
|
30268
|
+
cursor: isDir3(join37(root, ".cursor")),
|
|
30269
|
+
cline: isDir3(join37(root, ".clinerules")),
|
|
30270
|
+
windsurf: isDir3(join37(root, ".windsurf")) || existsSync17(join37(root, ".windsurfrules")),
|
|
30271
|
+
agentsMd: existsSync17(join37(root, "AGENTS.md"))
|
|
30009
30272
|
};
|
|
30010
30273
|
}
|
|
30011
|
-
function isDir3(
|
|
30274
|
+
function isDir3(path47) {
|
|
30012
30275
|
try {
|
|
30013
|
-
return
|
|
30276
|
+
return statSync28(path47).isDirectory();
|
|
30014
30277
|
} catch {
|
|
30015
30278
|
return false;
|
|
30016
30279
|
}
|
|
@@ -30041,11 +30304,11 @@ __export(cmd_conformance_exports, {
|
|
|
30041
30304
|
routeTargetPaths: () => routeTargetPaths,
|
|
30042
30305
|
runConformanceChecks: () => runConformanceChecks
|
|
30043
30306
|
});
|
|
30044
|
-
import * as
|
|
30045
|
-
import * as
|
|
30046
|
-
import * as
|
|
30307
|
+
import * as fs42 from "node:fs";
|
|
30308
|
+
import * as os12 from "node:os";
|
|
30309
|
+
import * as path39 from "node:path";
|
|
30047
30310
|
import process16 from "node:process";
|
|
30048
|
-
import { spawnSync as
|
|
30311
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
30049
30312
|
import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL17 } from "node:url";
|
|
30050
30313
|
function print2(s = "") {
|
|
30051
30314
|
process16.stdout.write(`${s}
|
|
@@ -30060,17 +30323,17 @@ function conformanceLogPath() {
|
|
|
30060
30323
|
if (override && override.trim().length > 0) {
|
|
30061
30324
|
return override;
|
|
30062
30325
|
}
|
|
30063
|
-
return
|
|
30326
|
+
return path39.join(os12.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
|
|
30064
30327
|
}
|
|
30065
30328
|
function installLogPath() {
|
|
30066
30329
|
const override = process16.env["AGENT_CONFIG_INSTALL_LOG"];
|
|
30067
30330
|
if (override && override.trim().length > 0) {
|
|
30068
30331
|
return override;
|
|
30069
30332
|
}
|
|
30070
|
-
return
|
|
30333
|
+
return path39.join(os12.homedir(), ".event4u", "agent-config", "install-log.jsonl");
|
|
30071
30334
|
}
|
|
30072
30335
|
function _check_txlog_clean(logPath = installLogPath()) {
|
|
30073
|
-
if (!
|
|
30336
|
+
if (!fs42.existsSync(logPath)) {
|
|
30074
30337
|
return {
|
|
30075
30338
|
id: "txlog-clean",
|
|
30076
30339
|
status: "ok",
|
|
@@ -30111,23 +30374,23 @@ function routeTargetPaths(target) {
|
|
|
30111
30374
|
if (!id) return [];
|
|
30112
30375
|
switch (kind) {
|
|
30113
30376
|
case "skill":
|
|
30114
|
-
return [
|
|
30377
|
+
return [path39.join("dist", "agent-src", "skills", id, "SKILL.md")];
|
|
30115
30378
|
case "command":
|
|
30116
|
-
return [
|
|
30379
|
+
return [path39.join("dist", "agent-src", "commands", `${id}.md`)];
|
|
30117
30380
|
case "guideline":
|
|
30118
|
-
return [
|
|
30381
|
+
return [path39.join("docs", "guidelines", `${id}.md`)];
|
|
30119
30382
|
case "contract":
|
|
30120
30383
|
return [
|
|
30121
|
-
|
|
30122
|
-
|
|
30384
|
+
path39.join("docs", "contracts", `${id}.md`),
|
|
30385
|
+
path39.join("dist", "agent-src", "contexts", "contracts", `${id}.md`)
|
|
30123
30386
|
];
|
|
30124
30387
|
default:
|
|
30125
30388
|
return [];
|
|
30126
30389
|
}
|
|
30127
30390
|
}
|
|
30128
30391
|
function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
30129
|
-
const routerPath =
|
|
30130
|
-
if (!
|
|
30392
|
+
const routerPath = path39.join(packageRoot, "dist", "router.json");
|
|
30393
|
+
if (!fs42.existsSync(routerPath)) {
|
|
30131
30394
|
return {
|
|
30132
30395
|
id: "router-pointers",
|
|
30133
30396
|
status: "fail",
|
|
@@ -30137,7 +30400,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
30137
30400
|
}
|
|
30138
30401
|
let router;
|
|
30139
30402
|
try {
|
|
30140
|
-
router = JSON.parse(
|
|
30403
|
+
router = JSON.parse(fs42.readFileSync(routerPath, "utf8"));
|
|
30141
30404
|
} catch (exc) {
|
|
30142
30405
|
return {
|
|
30143
30406
|
id: "router-pointers",
|
|
@@ -30146,13 +30409,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
30146
30409
|
remedy: "reinstall the package \u2014 dist/router.json is corrupt"
|
|
30147
30410
|
};
|
|
30148
30411
|
}
|
|
30149
|
-
const rulesDir =
|
|
30412
|
+
const rulesDir = path39.join(packageRoot, "dist", "agent-src", "rules");
|
|
30150
30413
|
const broken = [];
|
|
30151
30414
|
let ids = 0;
|
|
30152
30415
|
let targets = 0;
|
|
30153
30416
|
for (const kernelId of router["kernel"] ?? []) {
|
|
30154
30417
|
ids += 1;
|
|
30155
|
-
if (!
|
|
30418
|
+
if (!fs42.existsSync(path39.join(rulesDir, `${kernelId}.md`))) {
|
|
30156
30419
|
broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
|
|
30157
30420
|
}
|
|
30158
30421
|
}
|
|
@@ -30160,7 +30423,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
30160
30423
|
for (const entry of router[tier] ?? []) {
|
|
30161
30424
|
const ruleId = String(entry["id"] ?? "");
|
|
30162
30425
|
ids += 1;
|
|
30163
|
-
if (!
|
|
30426
|
+
if (!fs42.existsSync(path39.join(rulesDir, `${ruleId}.md`))) {
|
|
30164
30427
|
broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
|
|
30165
30428
|
}
|
|
30166
30429
|
for (const target of entry["routes_to"] ?? []) {
|
|
@@ -30170,7 +30433,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
30170
30433
|
broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
|
|
30171
30434
|
continue;
|
|
30172
30435
|
}
|
|
30173
|
-
if (!candidates.some((rel) =>
|
|
30436
|
+
if (!candidates.some((rel) => fs42.existsSync(path39.join(packageRoot, rel)))) {
|
|
30174
30437
|
broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
|
|
30175
30438
|
}
|
|
30176
30439
|
}
|
|
@@ -30202,9 +30465,9 @@ function detectSmokePlatform(projectRoot) {
|
|
|
30202
30465
|
return "claude";
|
|
30203
30466
|
}
|
|
30204
30467
|
function dispatcherRunner(packageRoot) {
|
|
30205
|
-
const localTsx =
|
|
30206
|
-
const script =
|
|
30207
|
-
if (
|
|
30468
|
+
const localTsx = path39.join(packageRoot, "node_modules", ".bin", "tsx");
|
|
30469
|
+
const script = path39.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
|
|
30470
|
+
if (fs42.existsSync(localTsx)) {
|
|
30208
30471
|
return [localTsx, script];
|
|
30209
30472
|
}
|
|
30210
30473
|
return ["npx", "tsx", script];
|
|
@@ -30221,7 +30484,7 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
|
|
|
30221
30484
|
...event === "stop" ? { stop_reason: "conformance-smoke" } : { source: "startup" }
|
|
30222
30485
|
});
|
|
30223
30486
|
const argv = [...runner, "--platform", platform, "--event", event];
|
|
30224
|
-
const proc =
|
|
30487
|
+
const proc = spawnSync7(argv[0], argv.slice(1), {
|
|
30225
30488
|
input: payload,
|
|
30226
30489
|
cwd: projectRoot,
|
|
30227
30490
|
encoding: "utf8",
|
|
@@ -30254,12 +30517,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
|
|
|
30254
30517
|
};
|
|
30255
30518
|
}
|
|
30256
30519
|
function readSettingsMode(projectRoot) {
|
|
30257
|
-
const settingsPath =
|
|
30258
|
-
if (!
|
|
30520
|
+
const settingsPath = path39.join(projectRoot, ".agent-settings.yml");
|
|
30521
|
+
if (!fs42.existsSync(settingsPath)) {
|
|
30259
30522
|
return "eager-all";
|
|
30260
30523
|
}
|
|
30261
30524
|
try {
|
|
30262
|
-
const parsed = YAML6.parse(
|
|
30525
|
+
const parsed = YAML6.parse(fs42.readFileSync(settingsPath, "utf8"));
|
|
30263
30526
|
const lean = parsed?.["lean_projection"] ?? null;
|
|
30264
30527
|
const mode = lean?.["mode"];
|
|
30265
30528
|
return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
|
|
@@ -30270,7 +30533,7 @@ function readSettingsMode(projectRoot) {
|
|
|
30270
30533
|
function kernelIdsFromRouter(packageRoot) {
|
|
30271
30534
|
try {
|
|
30272
30535
|
const router = JSON.parse(
|
|
30273
|
-
|
|
30536
|
+
fs42.readFileSync(path39.join(packageRoot, "dist", "router.json"), "utf8")
|
|
30274
30537
|
);
|
|
30275
30538
|
return new Set((router["kernel"] ?? []).map(String));
|
|
30276
30539
|
} catch {
|
|
@@ -30287,8 +30550,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
30287
30550
|
remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
|
|
30288
30551
|
};
|
|
30289
30552
|
}
|
|
30290
|
-
const rulesDir = projectedRulesDir ??
|
|
30291
|
-
if (!
|
|
30553
|
+
const rulesDir = projectedRulesDir ?? path39.join(projectRoot, ".augment", "rules");
|
|
30554
|
+
if (!fs42.existsSync(rulesDir)) {
|
|
30292
30555
|
return {
|
|
30293
30556
|
id: "lean-projection",
|
|
30294
30557
|
status: "skipped",
|
|
@@ -30297,7 +30560,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
30297
30560
|
};
|
|
30298
30561
|
}
|
|
30299
30562
|
const kernel = kernelIdsFromRouter(packageRoot);
|
|
30300
|
-
const files =
|
|
30563
|
+
const files = fs42.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
|
|
30301
30564
|
const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
|
|
30302
30565
|
if (nonKernel.length === 0) {
|
|
30303
30566
|
return {
|
|
@@ -30311,7 +30574,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
30311
30574
|
for (const f of nonKernel) {
|
|
30312
30575
|
let text = "";
|
|
30313
30576
|
try {
|
|
30314
|
-
text =
|
|
30577
|
+
text = fs42.readFileSync(path39.join(rulesDir, f), "utf8");
|
|
30315
30578
|
} catch {
|
|
30316
30579
|
continue;
|
|
30317
30580
|
}
|
|
@@ -30342,8 +30605,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
30342
30605
|
function _check_host_manifest(projectRoot) {
|
|
30343
30606
|
const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
|
|
30344
30607
|
const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
|
|
30345
|
-
const settingsPath =
|
|
30346
|
-
if (!
|
|
30608
|
+
const settingsPath = path39.join(projectRoot, ".agent-settings.yml");
|
|
30609
|
+
if (!fs42.existsSync(settingsPath)) {
|
|
30347
30610
|
return {
|
|
30348
30611
|
id: "host-manifest",
|
|
30349
30612
|
status: "ok",
|
|
@@ -30353,7 +30616,7 @@ function _check_host_manifest(projectRoot) {
|
|
|
30353
30616
|
}
|
|
30354
30617
|
let parsed = null;
|
|
30355
30618
|
try {
|
|
30356
|
-
parsed = YAML6.parse(
|
|
30619
|
+
parsed = YAML6.parse(fs42.readFileSync(settingsPath, "utf8"));
|
|
30357
30620
|
} catch (exc) {
|
|
30358
30621
|
return {
|
|
30359
30622
|
id: "host-manifest",
|
|
@@ -30550,13 +30813,13 @@ function _isCliEntry17() {
|
|
|
30550
30813
|
if (process16.argv[1] === void 0) {
|
|
30551
30814
|
return false;
|
|
30552
30815
|
}
|
|
30553
|
-
const argvUrl = pathToFileURL17(
|
|
30816
|
+
const argvUrl = pathToFileURL17(path39.resolve(process16.argv[1])).href;
|
|
30554
30817
|
if (import.meta.url === argvUrl) {
|
|
30555
30818
|
return true;
|
|
30556
30819
|
}
|
|
30557
30820
|
try {
|
|
30558
|
-
const here =
|
|
30559
|
-
const argv =
|
|
30821
|
+
const here = fs42.realpathSync(fileURLToPath24(import.meta.url));
|
|
30822
|
+
const argv = fs42.realpathSync(path39.resolve(process16.argv[1]));
|
|
30560
30823
|
return here === argv;
|
|
30561
30824
|
} catch {
|
|
30562
30825
|
return false;
|
|
@@ -30573,7 +30836,7 @@ var init_cmd_conformance = __esm({
|
|
|
30573
30836
|
init_detect();
|
|
30574
30837
|
init_cmd_doctor();
|
|
30575
30838
|
_HERE14 = fileURLToPath24(import.meta.url);
|
|
30576
|
-
PACKAGE_ROOT2 =
|
|
30839
|
+
PACKAGE_ROOT2 = path39.resolve(path39.dirname(_HERE14), "..", "..", "..");
|
|
30577
30840
|
CONFORMANCE_CHECK_IDS = [
|
|
30578
30841
|
"txlog-clean",
|
|
30579
30842
|
"router-pointers",
|
|
@@ -30618,7 +30881,7 @@ __export(settings_exports, {
|
|
|
30618
30881
|
read_tier_usage_settings: () => read_tier_usage_settings
|
|
30619
30882
|
});
|
|
30620
30883
|
import { createRequire as createRequire5 } from "node:module";
|
|
30621
|
-
import * as
|
|
30884
|
+
import * as fs43 from "node:fs";
|
|
30622
30885
|
function _isPlainObject8(v) {
|
|
30623
30886
|
return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
|
|
30624
30887
|
}
|
|
@@ -30655,7 +30918,7 @@ function _coerce_path(value, def) {
|
|
|
30655
30918
|
}
|
|
30656
30919
|
function _isFile14(p) {
|
|
30657
30920
|
try {
|
|
30658
|
-
return
|
|
30921
|
+
return fs43.statSync(p).isFile();
|
|
30659
30922
|
} catch {
|
|
30660
30923
|
return false;
|
|
30661
30924
|
}
|
|
@@ -30666,7 +30929,7 @@ function read_settings(p) {
|
|
|
30666
30929
|
if (_isFile14(p)) {
|
|
30667
30930
|
let raw = {};
|
|
30668
30931
|
try {
|
|
30669
|
-
raw = YAML7.parse(
|
|
30932
|
+
raw = YAML7.parse(fs43.readFileSync(p, "utf-8"), { version: "1.1" });
|
|
30670
30933
|
if (raw === null || raw === void 0) {
|
|
30671
30934
|
raw = {};
|
|
30672
30935
|
}
|
|
@@ -30700,7 +30963,7 @@ function read_tier_usage_settings(p) {
|
|
|
30700
30963
|
if (_isFile14(p)) {
|
|
30701
30964
|
let raw = {};
|
|
30702
30965
|
try {
|
|
30703
|
-
raw = YAML7.parse(
|
|
30966
|
+
raw = YAML7.parse(fs43.readFileSync(p, "utf-8"), { version: "1.1" });
|
|
30704
30967
|
if (raw === null || raw === void 0) {
|
|
30705
30968
|
raw = {};
|
|
30706
30969
|
}
|
|
@@ -31238,7 +31501,7 @@ __export(aggregator_exports, {
|
|
|
31238
31501
|
aggregate: () => aggregate2,
|
|
31239
31502
|
rank_artefacts: () => rank_artefacts
|
|
31240
31503
|
});
|
|
31241
|
-
import * as
|
|
31504
|
+
import * as fs44 from "node:fs";
|
|
31242
31505
|
function _key(kind, artId) {
|
|
31243
31506
|
return `${kind}\0${artId}`;
|
|
31244
31507
|
}
|
|
@@ -31275,7 +31538,7 @@ function* _iter_events(log_path) {
|
|
|
31275
31538
|
if (!_isFile15(log_path)) {
|
|
31276
31539
|
return;
|
|
31277
31540
|
}
|
|
31278
|
-
const text =
|
|
31541
|
+
const text = fs44.readFileSync(log_path, "utf-8");
|
|
31279
31542
|
const lines = _pyFileLines(text);
|
|
31280
31543
|
let lineNo = 0;
|
|
31281
31544
|
for (const line of lines) {
|
|
@@ -31309,7 +31572,7 @@ function _pyFileLines(text) {
|
|
|
31309
31572
|
}
|
|
31310
31573
|
function _isFile15(p) {
|
|
31311
31574
|
try {
|
|
31312
|
-
return
|
|
31575
|
+
return fs44.statSync(p).isFile();
|
|
31313
31576
|
} catch {
|
|
31314
31577
|
return false;
|
|
31315
31578
|
}
|
|
@@ -31823,7 +32086,7 @@ var init_report_renderer = __esm({
|
|
|
31823
32086
|
});
|
|
31824
32087
|
|
|
31825
32088
|
// src/scripts/ai_council/bundler.ts
|
|
31826
|
-
import * as
|
|
32089
|
+
import * as fs45 from "node:fs";
|
|
31827
32090
|
function _context(mode, text, manifest = [], excluded = []) {
|
|
31828
32091
|
return { mode, text, manifest, excluded };
|
|
31829
32092
|
}
|
|
@@ -31881,10 +32144,10 @@ function bundle_prompt(text) {
|
|
|
31881
32144
|
return _context("prompt", _enforceSize(redacted, "prompt"), ["<inline prompt>"]);
|
|
31882
32145
|
}
|
|
31883
32146
|
function bundle_roadmap(p) {
|
|
31884
|
-
if (!
|
|
32147
|
+
if (!fs45.existsSync(p)) {
|
|
31885
32148
|
throw new FileNotFoundError2(`Roadmap not found: ${p}`);
|
|
31886
32149
|
}
|
|
31887
|
-
const raw =
|
|
32150
|
+
const raw = fs45.readFileSync(p, { encoding: "utf-8" });
|
|
31888
32151
|
const redacted = redact(raw);
|
|
31889
32152
|
return _context(
|
|
31890
32153
|
"roadmap",
|
|
@@ -31970,7 +32233,7 @@ var init_chairman = __esm({
|
|
|
31970
32233
|
|
|
31971
32234
|
// src/scripts/_lib/text_similarity.ts
|
|
31972
32235
|
function tokenize2(text) {
|
|
31973
|
-
const tokens = (text.toLowerCase().match(
|
|
32236
|
+
const tokens = (text.toLowerCase().match(TOKEN_RE2) ?? []).filter((t) => t.length > 0);
|
|
31974
32237
|
return new Set(tokens);
|
|
31975
32238
|
}
|
|
31976
32239
|
function jaccardSimilarity(a, b) {
|
|
@@ -31985,11 +32248,11 @@ function jaccardSimilarity(a, b) {
|
|
|
31985
32248
|
const union = setA.size + setB.size - intersection;
|
|
31986
32249
|
return union === 0 ? 1 : intersection / union;
|
|
31987
32250
|
}
|
|
31988
|
-
var
|
|
32251
|
+
var TOKEN_RE2;
|
|
31989
32252
|
var init_text_similarity = __esm({
|
|
31990
32253
|
"src/scripts/_lib/text_similarity.ts"() {
|
|
31991
32254
|
"use strict";
|
|
31992
|
-
|
|
32255
|
+
TOKEN_RE2 = /[a-z0-9]+/g;
|
|
31993
32256
|
}
|
|
31994
32257
|
});
|
|
31995
32258
|
|
|
@@ -32447,8 +32710,8 @@ not. Cite the peer-reviewer label and the targeted response label
|
|
|
32447
32710
|
});
|
|
32448
32711
|
|
|
32449
32712
|
// src/scripts/ai_council/advisors.ts
|
|
32450
|
-
import * as
|
|
32451
|
-
import * as
|
|
32713
|
+
import * as fs46 from "node:fs";
|
|
32714
|
+
import * as path40 from "node:path";
|
|
32452
32715
|
function _split_frontmatter2(raw) {
|
|
32453
32716
|
const match = _FRONTMATTER_RE2.exec(raw);
|
|
32454
32717
|
if (!match) {
|
|
@@ -32476,12 +32739,12 @@ function _display_name_from(advisor_name, frontmatter) {
|
|
|
32476
32739
|
}
|
|
32477
32740
|
function resolve_persona_text(persona_path, repo_root) {
|
|
32478
32741
|
const candidates = [
|
|
32479
|
-
|
|
32480
|
-
|
|
32742
|
+
path40.join(repo_root, "dist/agent-src", persona_path),
|
|
32743
|
+
path40.join(repo_root, ".agent-src.uncondensed", persona_path)
|
|
32481
32744
|
];
|
|
32482
32745
|
for (const candidate of candidates) {
|
|
32483
|
-
if (
|
|
32484
|
-
const raw =
|
|
32746
|
+
if (fs46.existsSync(candidate)) {
|
|
32747
|
+
const raw = fs46.readFileSync(candidate, "utf-8");
|
|
32485
32748
|
const [meta, body] = _split_frontmatter2(raw);
|
|
32486
32749
|
return [body.trim(), meta];
|
|
32487
32750
|
}
|
|
@@ -32869,7 +33132,7 @@ __export(low_impact_corpus_exports, {
|
|
|
32869
33132
|
load_validated_phrases: () => load_validated_phrases,
|
|
32870
33133
|
parse_corpus_strict: () => parse_corpus_strict
|
|
32871
33134
|
});
|
|
32872
|
-
import * as
|
|
33135
|
+
import * as fs47 from "node:fs";
|
|
32873
33136
|
function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
|
|
32874
33137
|
return { phrase, normalised, section, line_no, trailing_metadata };
|
|
32875
33138
|
}
|
|
@@ -33042,10 +33305,10 @@ function _checkHeadingDrift(text, title) {
|
|
|
33042
33305
|
}
|
|
33043
33306
|
function parse_corpus_strict(corpusPath) {
|
|
33044
33307
|
const p = corpusPath;
|
|
33045
|
-
if (!
|
|
33308
|
+
if (!fs47.existsSync(p)) {
|
|
33046
33309
|
return new CorpusParseResult();
|
|
33047
33310
|
}
|
|
33048
|
-
const text =
|
|
33311
|
+
const text = fs47.readFileSync(p, { encoding: "utf-8" });
|
|
33049
33312
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
33050
33313
|
const resultSections = {
|
|
33051
33314
|
validated: [],
|
|
@@ -33108,10 +33371,10 @@ function load_anti_example_phrases(corpusPath) {
|
|
|
33108
33371
|
}
|
|
33109
33372
|
function load_corpus_lock(yamlPath) {
|
|
33110
33373
|
const p = yamlPath;
|
|
33111
|
-
if (!
|
|
33374
|
+
if (!fs47.existsSync(p)) {
|
|
33112
33375
|
return new CorpusParseResult();
|
|
33113
33376
|
}
|
|
33114
|
-
const parsed = (0, import_yaml7.parse)(
|
|
33377
|
+
const parsed = (0, import_yaml7.parse)(fs47.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
|
|
33115
33378
|
const doc = parsed === null || parsed === void 0 ? {} : parsed;
|
|
33116
33379
|
const schemaVersion = doc["schema_version"];
|
|
33117
33380
|
if (schemaVersion !== 1) {
|
|
@@ -33173,7 +33436,7 @@ function _deriveLockPath(corpusPath) {
|
|
|
33173
33436
|
}
|
|
33174
33437
|
function _loadSectionFromLock(corpusPath, section) {
|
|
33175
33438
|
const lockPath = _deriveLockPath(corpusPath);
|
|
33176
|
-
if (!
|
|
33439
|
+
if (!fs47.existsSync(lockPath)) {
|
|
33177
33440
|
return null;
|
|
33178
33441
|
}
|
|
33179
33442
|
try {
|
|
@@ -33185,10 +33448,10 @@ function _loadSectionFromLock(corpusPath, section) {
|
|
|
33185
33448
|
}
|
|
33186
33449
|
function _loadSectionLenient(corpusPath, section) {
|
|
33187
33450
|
const p = corpusPath;
|
|
33188
|
-
if (!
|
|
33451
|
+
if (!fs47.existsSync(p)) {
|
|
33189
33452
|
return [];
|
|
33190
33453
|
}
|
|
33191
|
-
const text =
|
|
33454
|
+
const text = fs47.readFileSync(p, { encoding: "utf-8" });
|
|
33192
33455
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
33193
33456
|
const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
|
|
33194
33457
|
if (bounds === null) {
|
|
@@ -33968,8 +34231,8 @@ var init_necessity = __esm({
|
|
|
33968
34231
|
});
|
|
33969
34232
|
|
|
33970
34233
|
// src/scripts/ai_council/budget_guard.ts
|
|
33971
|
-
import * as
|
|
33972
|
-
import * as
|
|
34234
|
+
import * as fs48 from "node:fs";
|
|
34235
|
+
import * as path41 from "node:path";
|
|
33973
34236
|
function _resolveLedgerPath(p) {
|
|
33974
34237
|
if (p !== null) {
|
|
33975
34238
|
return p;
|
|
@@ -33984,18 +34247,18 @@ function _nowUtcMs() {
|
|
|
33984
34247
|
return Date.now();
|
|
33985
34248
|
}
|
|
33986
34249
|
function _ensureLedgerDir(p) {
|
|
33987
|
-
const parent =
|
|
34250
|
+
const parent = path41.dirname(p);
|
|
33988
34251
|
try {
|
|
33989
|
-
|
|
34252
|
+
fs48.mkdirSync(parent, { recursive: true });
|
|
33990
34253
|
let mode;
|
|
33991
34254
|
try {
|
|
33992
|
-
mode =
|
|
34255
|
+
mode = fs48.statSync(parent).mode & 511;
|
|
33993
34256
|
} catch {
|
|
33994
34257
|
mode = 448;
|
|
33995
34258
|
}
|
|
33996
34259
|
if (mode !== 448) {
|
|
33997
34260
|
try {
|
|
33998
|
-
|
|
34261
|
+
fs48.chmodSync(parent, 448);
|
|
33999
34262
|
} catch {
|
|
34000
34263
|
}
|
|
34001
34264
|
}
|
|
@@ -34007,18 +34270,18 @@ function _ensureLedgerDir(p) {
|
|
|
34007
34270
|
}
|
|
34008
34271
|
}
|
|
34009
34272
|
function _ensureLedgerFileMode(p) {
|
|
34010
|
-
if (!
|
|
34273
|
+
if (!fs48.existsSync(p)) {
|
|
34011
34274
|
return;
|
|
34012
34275
|
}
|
|
34013
34276
|
let current;
|
|
34014
34277
|
try {
|
|
34015
|
-
current =
|
|
34278
|
+
current = fs48.statSync(p).mode & 511;
|
|
34016
34279
|
} catch {
|
|
34017
34280
|
return;
|
|
34018
34281
|
}
|
|
34019
34282
|
if (current !== 384) {
|
|
34020
34283
|
try {
|
|
34021
|
-
|
|
34284
|
+
fs48.chmodSync(p, 384);
|
|
34022
34285
|
} catch {
|
|
34023
34286
|
}
|
|
34024
34287
|
}
|
|
@@ -34107,8 +34370,18 @@ function _pyJsonString(s) {
|
|
|
34107
34370
|
}
|
|
34108
34371
|
return `${out}"`;
|
|
34109
34372
|
}
|
|
34110
|
-
function _dumpEntry(ts, usd, provider, model) {
|
|
34111
|
-
|
|
34373
|
+
function _dumpEntry(ts, usd, provider, model, cacheRead, cacheWrite, cacheTtl) {
|
|
34374
|
+
let body = `${_pyJsonString("ts")}: ${_pyJsonString(ts)}, ${_pyJsonString("usd")}: ${pyFloatRepr(usd)}, ${_pyJsonString("provider")}: ${_pyJsonString(provider)}, ${_pyJsonString("model")}: ${_pyJsonString(model)}`;
|
|
34375
|
+
if (cacheRead !== void 0) {
|
|
34376
|
+
body += `, ${_pyJsonString("cache_read_input_tokens")}: ${Math.trunc(cacheRead)}`;
|
|
34377
|
+
}
|
|
34378
|
+
if (cacheWrite !== void 0) {
|
|
34379
|
+
body += `, ${_pyJsonString("cache_creation_input_tokens")}: ${Math.trunc(cacheWrite)}`;
|
|
34380
|
+
}
|
|
34381
|
+
if (cacheTtl !== void 0) {
|
|
34382
|
+
body += `, ${_pyJsonString("cache_ttl")}: ${_pyJsonString(cacheTtl)}`;
|
|
34383
|
+
}
|
|
34384
|
+
return `{${body}}`;
|
|
34112
34385
|
}
|
|
34113
34386
|
function _toFloat(v) {
|
|
34114
34387
|
if (typeof v === "number") {
|
|
@@ -34160,11 +34433,11 @@ function pyNumToStr(n) {
|
|
|
34160
34433
|
}
|
|
34161
34434
|
function read_entries2(p = null) {
|
|
34162
34435
|
const resolved = _resolveLedgerPath(p);
|
|
34163
|
-
if (!
|
|
34436
|
+
if (!fs48.existsSync(resolved)) {
|
|
34164
34437
|
return [];
|
|
34165
34438
|
}
|
|
34166
34439
|
const out = [];
|
|
34167
|
-
const text =
|
|
34440
|
+
const text = fs48.readFileSync(resolved, "utf-8");
|
|
34168
34441
|
for (const rawLine of text.split(/\r\n|\r|\n/u)) {
|
|
34169
34442
|
const line = rawLine.trim();
|
|
34170
34443
|
if (line === "") {
|
|
@@ -34188,15 +34461,38 @@ function read_entries2(p = null) {
|
|
|
34188
34461
|
if (usd === null) {
|
|
34189
34462
|
continue;
|
|
34190
34463
|
}
|
|
34191
|
-
|
|
34464
|
+
const entry = {
|
|
34192
34465
|
ts,
|
|
34193
34466
|
usd,
|
|
34194
34467
|
provider: _toStr(record.provider, ""),
|
|
34195
34468
|
model: _toStr(record.model, "")
|
|
34196
|
-
}
|
|
34469
|
+
};
|
|
34470
|
+
const cacheRead = _toOptionalNonNegInt(record.cache_read_input_tokens);
|
|
34471
|
+
if (cacheRead !== void 0) {
|
|
34472
|
+
entry.cache_read_input_tokens = cacheRead;
|
|
34473
|
+
}
|
|
34474
|
+
const cacheWrite = _toOptionalNonNegInt(record.cache_creation_input_tokens);
|
|
34475
|
+
if (cacheWrite !== void 0) {
|
|
34476
|
+
entry.cache_creation_input_tokens = cacheWrite;
|
|
34477
|
+
}
|
|
34478
|
+
const cacheTtl = _toOptionalTtl(record.cache_ttl);
|
|
34479
|
+
if (cacheTtl !== void 0) {
|
|
34480
|
+
entry.cache_ttl = cacheTtl;
|
|
34481
|
+
}
|
|
34482
|
+
out.push(entry);
|
|
34197
34483
|
}
|
|
34198
34484
|
return out;
|
|
34199
34485
|
}
|
|
34486
|
+
function _toOptionalNonNegInt(v) {
|
|
34487
|
+
if (v === void 0 || v === null) {
|
|
34488
|
+
return void 0;
|
|
34489
|
+
}
|
|
34490
|
+
const n = _toFloat(v);
|
|
34491
|
+
return n === null || n < 0 ? void 0 : n;
|
|
34492
|
+
}
|
|
34493
|
+
function _toOptionalTtl(v) {
|
|
34494
|
+
return v === "5m" || v === "1h" ? v : void 0;
|
|
34495
|
+
}
|
|
34200
34496
|
function _rawStr(v) {
|
|
34201
34497
|
if (v === void 0) {
|
|
34202
34498
|
return "";
|
|
@@ -34233,10 +34529,18 @@ function record_spend(usd, provider, model, options = {}) {
|
|
|
34233
34529
|
}
|
|
34234
34530
|
const nowMs = options.now ?? _nowUtcMs();
|
|
34235
34531
|
const ts = nowUtcIso(nowMs);
|
|
34236
|
-
const entry = `${_dumpEntry(
|
|
34532
|
+
const entry = `${_dumpEntry(
|
|
34533
|
+
ts,
|
|
34534
|
+
_pyRound6(usd),
|
|
34535
|
+
provider,
|
|
34536
|
+
model,
|
|
34537
|
+
options.cache_read_input_tokens,
|
|
34538
|
+
options.cache_creation_input_tokens,
|
|
34539
|
+
options.cache_ttl
|
|
34540
|
+
)}
|
|
34237
34541
|
`;
|
|
34238
34542
|
try {
|
|
34239
|
-
|
|
34543
|
+
fs48.appendFileSync(p, entry, { encoding: "utf-8" });
|
|
34240
34544
|
} catch (exc) {
|
|
34241
34545
|
process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
|
|
34242
34546
|
`);
|
|
@@ -34359,8 +34663,8 @@ function aggregate_scores(findings, scores) {
|
|
|
34359
34663
|
by_id.get(s.finding_id).push(s);
|
|
34360
34664
|
}
|
|
34361
34665
|
const out = /* @__PURE__ */ new Map();
|
|
34362
|
-
for (const [fid,
|
|
34363
|
-
if (
|
|
34666
|
+
for (const [fid, fs54] of by_id) {
|
|
34667
|
+
if (fs54.length === 0) {
|
|
34364
34668
|
out.set(
|
|
34365
34669
|
fid,
|
|
34366
34670
|
new ConsensusMetadata({
|
|
@@ -34376,13 +34680,13 @@ function aggregate_scores(findings, scores) {
|
|
|
34376
34680
|
);
|
|
34377
34681
|
continue;
|
|
34378
34682
|
}
|
|
34379
|
-
const mean =
|
|
34380
|
-
const agree_rate =
|
|
34683
|
+
const mean = fs54.reduce((acc, s) => acc + s.score, 0) / fs54.length;
|
|
34684
|
+
const agree_rate = fs54.filter((s) => s.agree).length / fs54.length;
|
|
34381
34685
|
const strength = mean / 10 * agree_rate;
|
|
34382
|
-
const dissent =
|
|
34383
|
-
const concur =
|
|
34384
|
-
const scorers =
|
|
34385
|
-
const dissent_reasons =
|
|
34686
|
+
const dissent = fs54.filter((s) => !s.agree).length;
|
|
34687
|
+
const concur = fs54.filter((s) => s.agree).length;
|
|
34688
|
+
const scorers = fs54.map((s) => s.scorer);
|
|
34689
|
+
const dissent_reasons = fs54.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
|
|
34386
34690
|
const mean_rounded = pyRound(mean, 2);
|
|
34387
34691
|
out.set(
|
|
34388
34692
|
fid,
|
|
@@ -34763,11 +35067,11 @@ __export(pricing_exports, {
|
|
|
34763
35067
|
prices_file_for: () => prices_file_for,
|
|
34764
35068
|
reprice_with_cache: () => reprice_with_cache
|
|
34765
35069
|
});
|
|
34766
|
-
import * as
|
|
34767
|
-
import * as
|
|
35070
|
+
import * as fs49 from "node:fs";
|
|
35071
|
+
import * as path42 from "node:path";
|
|
34768
35072
|
import { fileURLToPath as fileURLToPath25 } from "node:url";
|
|
34769
35073
|
function prices_file_for(repo_root) {
|
|
34770
|
-
return
|
|
35074
|
+
return path42.join(repo_root, "agents", "runtime", ".agent-prices.md");
|
|
34771
35075
|
}
|
|
34772
35076
|
function lookup(table, provider, model) {
|
|
34773
35077
|
return table.prices.get(priceKey(provider, model)) ?? null;
|
|
@@ -34861,16 +35165,16 @@ function is_stale(table, now) {
|
|
|
34861
35165
|
return last < last_monday_utc(now);
|
|
34862
35166
|
}
|
|
34863
35167
|
function load_prices(p = PRICES_FILE) {
|
|
34864
|
-
if (!
|
|
35168
|
+
if (!fs49.existsSync(p)) {
|
|
34865
35169
|
bootstrap_from_defaults(p);
|
|
34866
35170
|
}
|
|
34867
|
-
return _parse4(
|
|
35171
|
+
return _parse4(fs49.readFileSync(p, "utf-8"));
|
|
34868
35172
|
}
|
|
34869
35173
|
function bootstrap_from_defaults(p = PRICES_FILE) {
|
|
34870
|
-
|
|
35174
|
+
fs49.mkdirSync(path42.dirname(p), { recursive: true });
|
|
34871
35175
|
const rows = as_rows();
|
|
34872
35176
|
const body = _render_markdown(LAST_UPDATED, "shipped-default", rows);
|
|
34873
|
-
|
|
35177
|
+
fs49.writeFileSync(p, body, "utf-8");
|
|
34874
35178
|
}
|
|
34875
35179
|
function _fmt62f(x) {
|
|
34876
35180
|
const s = x.toFixed(2);
|
|
@@ -34993,8 +35297,8 @@ var init_pricing = __esm({
|
|
|
34993
35297
|
"use strict";
|
|
34994
35298
|
init_default_prices();
|
|
34995
35299
|
_HERE15 = fileURLToPath25(import.meta.url);
|
|
34996
|
-
REPO_ROOT =
|
|
34997
|
-
PRICES_FILE =
|
|
35300
|
+
REPO_ROOT = path42.resolve(path42.dirname(_HERE15), "..", "..", "..");
|
|
35301
|
+
PRICES_FILE = path42.join(REPO_ROOT, "agents", "runtime", ".agent-prices.md");
|
|
34998
35302
|
_CHARS_PER_TOKEN = 4;
|
|
34999
35303
|
CACHE_READ_MULTIPLIER = 0.1;
|
|
35000
35304
|
CACHE_WRITE_MULTIPLIER_5M = 1.25;
|
|
@@ -35159,9 +35463,9 @@ var init_stance_tally = __esm({
|
|
|
35159
35463
|
});
|
|
35160
35464
|
|
|
35161
35465
|
// src/scripts/ai_council/blind_review.ts
|
|
35162
|
-
import { createHash as
|
|
35466
|
+
import { createHash as createHash8 } from "node:crypto";
|
|
35163
35467
|
function _sha256_hex(s) {
|
|
35164
|
-
return
|
|
35468
|
+
return createHash8("sha256").update(s, "utf-8").digest("hex");
|
|
35165
35469
|
}
|
|
35166
35470
|
function deterministic_shuffle_indices(seed, n) {
|
|
35167
35471
|
const keyed = Array.from({ length: n }, (_, i) => ({ i, key: _sha256_hex(`${seed}\0${i}`) }));
|
|
@@ -35637,17 +35941,26 @@ ${suffix}` : base;
|
|
|
35637
35941
|
spent.output += response.output_tokens;
|
|
35638
35942
|
let actual_usd = null;
|
|
35639
35943
|
if (estimates !== null && table !== null) {
|
|
35640
|
-
const actual =
|
|
35944
|
+
const actual = reprice_with_cache(
|
|
35641
35945
|
member.name,
|
|
35642
35946
|
member.model,
|
|
35643
|
-
|
|
35644
|
-
|
|
35645
|
-
|
|
35947
|
+
{
|
|
35948
|
+
input_tokens: response.input_tokens,
|
|
35949
|
+
cache_read_input_tokens: response.cache_read_input_tokens,
|
|
35950
|
+
cache_creation_input_tokens: response.cache_creation_input_tokens,
|
|
35951
|
+
output_tokens: response.output_tokens
|
|
35952
|
+
},
|
|
35953
|
+
table,
|
|
35954
|
+
"5m"
|
|
35646
35955
|
);
|
|
35647
35956
|
actual_usd = _total_usd(actual);
|
|
35648
35957
|
spent.usd += _total_usd(actual);
|
|
35649
35958
|
if (budget.daily_limit_usd > 0 && !response.error) {
|
|
35650
|
-
record_spend(_total_usd(actual), member.name, member.model
|
|
35959
|
+
record_spend(_total_usd(actual), member.name, member.model, {
|
|
35960
|
+
cache_read_input_tokens: response.cache_read_input_tokens,
|
|
35961
|
+
cache_creation_input_tokens: response.cache_creation_input_tokens,
|
|
35962
|
+
cache_ttl: "5m"
|
|
35963
|
+
});
|
|
35651
35964
|
}
|
|
35652
35965
|
}
|
|
35653
35966
|
_stamp_transport_metadata(response, member, actual_usd);
|
|
@@ -35816,6 +36129,7 @@ function run_debate(members, question, opts = {}) {
|
|
|
35816
36129
|
const on_continue = opts.on_continue ?? null;
|
|
35817
36130
|
const advisor_plans = opts.advisor_plans ?? null;
|
|
35818
36131
|
const seed_round_1 = opts.seed_round_1 ?? null;
|
|
36132
|
+
const now = opts.now ?? Date.now;
|
|
35819
36133
|
if (max_rounds < 1) {
|
|
35820
36134
|
throw new Error(`max_rounds must be >= 1 (got ${max_rounds})`);
|
|
35821
36135
|
}
|
|
@@ -35832,6 +36146,7 @@ function run_debate(members, question, opts = {}) {
|
|
|
35832
36146
|
const all_rounds = [];
|
|
35833
36147
|
let current_suffix = "";
|
|
35834
36148
|
let current_user_prompt = question.user_prompt;
|
|
36149
|
+
let previous_round_end_ms = null;
|
|
35835
36150
|
if (opts.restate === true) {
|
|
35836
36151
|
const restateQ = new CouncilQuestion({
|
|
35837
36152
|
mode: question.mode,
|
|
@@ -35853,6 +36168,8 @@ ${question.user_prompt}`,
|
|
|
35853
36168
|
}
|
|
35854
36169
|
for (let round_idx = 0; round_idx < max_rounds; round_idx++) {
|
|
35855
36170
|
const round_number = round_idx + 1;
|
|
36171
|
+
const round_start_ms = now();
|
|
36172
|
+
const cache_gap_ms_since_previous_round = previous_round_end_ms === null ? null : round_start_ms - previous_round_end_ms;
|
|
35856
36173
|
let results;
|
|
35857
36174
|
if (round_idx === 0 && seed_round_1 !== null) {
|
|
35858
36175
|
results = [...seed_round_1];
|
|
@@ -35890,7 +36207,7 @@ ${question.user_prompt}`,
|
|
|
35890
36207
|
}
|
|
35891
36208
|
all_rounds.push(results);
|
|
35892
36209
|
if (on_round_complete !== null) {
|
|
35893
|
-
on_round_complete(round_number, results);
|
|
36210
|
+
on_round_complete(round_number, results, cache_gap_ms_since_previous_round);
|
|
35894
36211
|
}
|
|
35895
36212
|
if (round_idx + 1 < max_rounds) {
|
|
35896
36213
|
current_suffix = _debate_suffix(
|
|
@@ -35939,6 +36256,7 @@ ${question.user_prompt}`,
|
|
|
35939
36256
|
}
|
|
35940
36257
|
}
|
|
35941
36258
|
}
|
|
36259
|
+
previous_round_end_ms = now();
|
|
35942
36260
|
}
|
|
35943
36261
|
return all_rounds;
|
|
35944
36262
|
}
|
|
@@ -36515,18 +36833,18 @@ __export(project_context_exports, {
|
|
|
36515
36833
|
REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
|
|
36516
36834
|
detect_project_context: () => detect_project_context
|
|
36517
36835
|
});
|
|
36518
|
-
import * as
|
|
36519
|
-
import * as
|
|
36836
|
+
import * as fs50 from "node:fs";
|
|
36837
|
+
import * as path43 from "node:path";
|
|
36520
36838
|
function _isPlainObject11(v) {
|
|
36521
36839
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
36522
36840
|
}
|
|
36523
36841
|
function _read_json(p) {
|
|
36524
|
-
if (!
|
|
36842
|
+
if (!fs50.existsSync(p)) {
|
|
36525
36843
|
return null;
|
|
36526
36844
|
}
|
|
36527
36845
|
let raw;
|
|
36528
36846
|
try {
|
|
36529
|
-
raw =
|
|
36847
|
+
raw = fs50.readFileSync(p, "utf-8");
|
|
36530
36848
|
} catch {
|
|
36531
36849
|
return null;
|
|
36532
36850
|
}
|
|
@@ -36548,7 +36866,7 @@ function _name_from(composer, pkg, root) {
|
|
|
36548
36866
|
}
|
|
36549
36867
|
}
|
|
36550
36868
|
try {
|
|
36551
|
-
const base =
|
|
36869
|
+
const base = path43.basename(root);
|
|
36552
36870
|
return base || null;
|
|
36553
36871
|
} catch {
|
|
36554
36872
|
return null;
|
|
@@ -36617,12 +36935,12 @@ function _splitlines10(text) {
|
|
|
36617
36935
|
return parts;
|
|
36618
36936
|
}
|
|
36619
36937
|
function _purpose_from_readme(p) {
|
|
36620
|
-
if (!
|
|
36938
|
+
if (!fs50.existsSync(p)) {
|
|
36621
36939
|
return null;
|
|
36622
36940
|
}
|
|
36623
36941
|
let text;
|
|
36624
36942
|
try {
|
|
36625
|
-
text =
|
|
36943
|
+
text = fs50.readFileSync(p, "utf-8");
|
|
36626
36944
|
} catch {
|
|
36627
36945
|
return null;
|
|
36628
36946
|
}
|
|
@@ -36706,13 +37024,13 @@ function _rfind(haystack, needle) {
|
|
|
36706
37024
|
return -1;
|
|
36707
37025
|
}
|
|
36708
37026
|
function detect_project_context(root) {
|
|
36709
|
-
const resolvedRoot =
|
|
36710
|
-
const composer = _read_json(
|
|
36711
|
-
const pkg = _read_json(
|
|
37027
|
+
const resolvedRoot = path43.resolve(root ?? process.cwd());
|
|
37028
|
+
const composer = _read_json(path43.join(resolvedRoot, "composer.json"));
|
|
37029
|
+
const pkg = _read_json(path43.join(resolvedRoot, "package.json"));
|
|
36712
37030
|
return new ProjectContext(
|
|
36713
37031
|
_name_from(composer, pkg, resolvedRoot),
|
|
36714
37032
|
_stack_from(composer, pkg),
|
|
36715
|
-
_purpose_from_readme(
|
|
37033
|
+
_purpose_from_readme(path43.join(resolvedRoot, "README.md"))
|
|
36716
37034
|
);
|
|
36717
37035
|
}
|
|
36718
37036
|
var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
|
|
@@ -36982,8 +37300,8 @@ __export(shadow_dispatch_exports, {
|
|
|
36982
37300
|
slo_banner: () => slo_banner,
|
|
36983
37301
|
slo_status: () => slo_status
|
|
36984
37302
|
});
|
|
36985
|
-
import * as
|
|
36986
|
-
import { createHash as
|
|
37303
|
+
import * as fs51 from "node:fs";
|
|
37304
|
+
import { createHash as createHash9 } from "node:crypto";
|
|
36987
37305
|
function should_shadow(sampleRate, opts = {}) {
|
|
36988
37306
|
const rate = Math.max(0, Math.min(1, sampleRate));
|
|
36989
37307
|
const rng = opts.rng ?? null;
|
|
@@ -36992,7 +37310,7 @@ function should_shadow(sampleRate, opts = {}) {
|
|
|
36992
37310
|
}
|
|
36993
37311
|
function _hashQuery(query) {
|
|
36994
37312
|
const redacted = redact(query);
|
|
36995
|
-
return
|
|
37313
|
+
return createHash9("sha256").update(Buffer.from(redacted, "utf-8")).digest("hex").slice(0, 16);
|
|
36996
37314
|
}
|
|
36997
37315
|
function _privacyDropped(redacted) {
|
|
36998
37316
|
const stripped = _strip8(redacted);
|
|
@@ -37020,7 +37338,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
37020
37338
|
escalated,
|
|
37021
37339
|
escalation_reason: escalationReason
|
|
37022
37340
|
};
|
|
37023
|
-
|
|
37341
|
+
fs51.mkdirSync(_dirname2(logPath), { recursive: true });
|
|
37024
37342
|
const row = _pyJsonDumps2({
|
|
37025
37343
|
timestamp: decision.timestamp,
|
|
37026
37344
|
query_hash: decision.query_hash,
|
|
@@ -37030,7 +37348,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
37030
37348
|
escalated: decision.escalated,
|
|
37031
37349
|
escalation_reason: decision.escalation_reason
|
|
37032
37350
|
}) + "\n";
|
|
37033
|
-
|
|
37351
|
+
fs51.appendFileSync(logPath, row, { encoding: "utf-8" });
|
|
37034
37352
|
return decision;
|
|
37035
37353
|
}
|
|
37036
37354
|
function _isoNowSeconds() {
|
|
@@ -37039,10 +37357,10 @@ function _isoNowSeconds() {
|
|
|
37039
37357
|
return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}+00:00`;
|
|
37040
37358
|
}
|
|
37041
37359
|
function* _iterLog(logPath) {
|
|
37042
|
-
if (!
|
|
37360
|
+
if (!fs51.existsSync(logPath)) {
|
|
37043
37361
|
return;
|
|
37044
37362
|
}
|
|
37045
|
-
const content =
|
|
37363
|
+
const content = fs51.readFileSync(logPath, { encoding: "utf-8" });
|
|
37046
37364
|
for (const rawLine of _splitlines11(content)) {
|
|
37047
37365
|
const line = _strip8(rawLine);
|
|
37048
37366
|
if (!line) {
|
|
@@ -37963,8 +38281,8 @@ __export(council_cli_exports, {
|
|
|
37963
38281
|
load_settings: () => load_settings,
|
|
37964
38282
|
main: () => main18
|
|
37965
38283
|
});
|
|
37966
|
-
import * as
|
|
37967
|
-
import * as
|
|
38284
|
+
import * as fs52 from "node:fs";
|
|
38285
|
+
import * as path44 from "node:path";
|
|
37968
38286
|
import { fileURLToPath as fileURLToPath26, pathToFileURL as pathToFileURL18 } from "node:url";
|
|
37969
38287
|
function _pyFixed6(x, ndigits) {
|
|
37970
38288
|
if (!Number.isFinite(x)) {
|
|
@@ -38173,7 +38491,7 @@ function _stderr2(s) {
|
|
|
38173
38491
|
function load_settings(p = SETTINGS_FILE3, opts = {}) {
|
|
38174
38492
|
const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
|
|
38175
38493
|
const settings = load_agent_settings({ project_path: p });
|
|
38176
|
-
if (
|
|
38494
|
+
if (fs52.existsSync(ai_council_path)) {
|
|
38177
38495
|
const cfg = load_council_config(ai_council_path);
|
|
38178
38496
|
settings["ai_council"] = _synthesize_ai_council_block(cfg);
|
|
38179
38497
|
}
|
|
@@ -38195,6 +38513,9 @@ function _synthesize_ai_council_block(cfg) {
|
|
|
38195
38513
|
if (m.model_ladder && m.model_ladder.length > 0) {
|
|
38196
38514
|
entry["model_ladder"] = [...m.model_ladder];
|
|
38197
38515
|
}
|
|
38516
|
+
if (m.prompt_cache_ttl !== "5m") {
|
|
38517
|
+
entry["prompt_cache_ttl"] = m.prompt_cache_ttl;
|
|
38518
|
+
}
|
|
38198
38519
|
members[name] = entry;
|
|
38199
38520
|
}
|
|
38200
38521
|
const advisors = {};
|
|
@@ -38233,7 +38554,8 @@ function _synthesize_ai_council_block(cfg) {
|
|
|
38233
38554
|
max_input_tokens: cfg.cost_budget.max_input_tokens,
|
|
38234
38555
|
max_output_tokens: cfg.cost_budget.max_output_tokens,
|
|
38235
38556
|
max_calls: cfg.cost_budget.max_calls,
|
|
38236
|
-
max_total_usd: cfg.cost_budget.max_total_usd
|
|
38557
|
+
max_total_usd: cfg.cost_budget.max_total_usd,
|
|
38558
|
+
daily_limit_usd: cfg.cost_budget.daily_limit_usd
|
|
38237
38559
|
},
|
|
38238
38560
|
consensus_scoring: {
|
|
38239
38561
|
enabled: cfg.consensus_scoring.enabled,
|
|
@@ -38344,9 +38666,14 @@ function build_members(settings, opts = {}) {
|
|
|
38344
38666
|
}
|
|
38345
38667
|
const api_key_ref = cfg["api_key_ref"] ?? null;
|
|
38346
38668
|
const enable_prompt_cache = cfg["prompt_cache"] !== false;
|
|
38669
|
+
const prompt_cache_ttl = cfg["prompt_cache_ttl"] ?? void 0;
|
|
38347
38670
|
for (const sib_model of siblings[name]) {
|
|
38348
38671
|
members.push(
|
|
38349
|
-
_construct_api_member(name, sib_model, {
|
|
38672
|
+
_construct_api_member(name, sib_model, {
|
|
38673
|
+
api_key_ref,
|
|
38674
|
+
enable_prompt_cache,
|
|
38675
|
+
prompt_cache_ttl
|
|
38676
|
+
})
|
|
38350
38677
|
);
|
|
38351
38678
|
}
|
|
38352
38679
|
continue;
|
|
@@ -38358,7 +38685,9 @@ function build_members(settings, opts = {}) {
|
|
|
38358
38685
|
api_key_ref: cfg["api_key_ref"] ?? null,
|
|
38359
38686
|
// Council opts in explicitly (client-default OFF); on unless
|
|
38360
38687
|
// the operator sets `prompt_cache: false`.
|
|
38361
|
-
enable_prompt_cache: cfg["prompt_cache"] !== false
|
|
38688
|
+
enable_prompt_cache: cfg["prompt_cache"] !== false,
|
|
38689
|
+
// road-to-cache-economy Phase 4 — see the siblings branch above.
|
|
38690
|
+
prompt_cache_ttl: cfg["prompt_cache_ttl"] ?? void 0
|
|
38362
38691
|
})
|
|
38363
38692
|
);
|
|
38364
38693
|
} else if (mode === "cli" && _CLI_PROVIDERS.has(name)) {
|
|
@@ -38476,7 +38805,8 @@ function _construct_api_member(name, model, opts = {}) {
|
|
|
38476
38805
|
return new AnthropicClient({
|
|
38477
38806
|
model: model || "claude-sonnet-4-5",
|
|
38478
38807
|
api_key,
|
|
38479
|
-
enable_prompt_cache: opts.enable_prompt_cache
|
|
38808
|
+
enable_prompt_cache: opts.enable_prompt_cache,
|
|
38809
|
+
prompt_cache_ttl: opts.prompt_cache_ttl
|
|
38480
38810
|
});
|
|
38481
38811
|
}
|
|
38482
38812
|
if (name === "openai") {
|
|
@@ -38537,7 +38867,7 @@ function build_question(opts) {
|
|
|
38537
38867
|
let ctx;
|
|
38538
38868
|
let artefact;
|
|
38539
38869
|
if (input_mode === "prompt") {
|
|
38540
|
-
const text =
|
|
38870
|
+
const text = fs52.readFileSync(input_path, "utf-8");
|
|
38541
38871
|
ctx = bundle_prompt(text);
|
|
38542
38872
|
artefact = String(input_path);
|
|
38543
38873
|
} else if (input_mode === "roadmap") {
|
|
@@ -38680,9 +39010,9 @@ function _maybe_write_decision_replay(opts) {
|
|
|
38680
39010
|
include_member_arguments: include_args
|
|
38681
39011
|
})
|
|
38682
39012
|
);
|
|
38683
|
-
const target =
|
|
38684
|
-
|
|
38685
|
-
|
|
39013
|
+
const target = path44.join(path44.dirname(opts.out_path), "decision-replay.md");
|
|
39014
|
+
fs52.mkdirSync(path44.dirname(target), { recursive: true });
|
|
39015
|
+
fs52.writeFileSync(target, replay, { encoding: "utf-8" });
|
|
38686
39016
|
return target;
|
|
38687
39017
|
}
|
|
38688
39018
|
function _peer_review_active(ai_cfg, args) {
|
|
@@ -39462,7 +39792,12 @@ function cmd_run(args, opts = {}) {
|
|
|
39462
39792
|
max_input_tokens: _pyInt6(cost_cfg["max_input_tokens"] ?? 5e4, 5e4),
|
|
39463
39793
|
max_output_tokens: _pyInt6(cost_cfg["max_output_tokens"] ?? 2e4, 2e4),
|
|
39464
39794
|
max_calls: _pyInt6(cost_cfg["max_calls"] ?? 10, 10),
|
|
39465
|
-
max_total_usd: _pyFloat3(cost_cfg["max_total_usd"] ?? 0, 0) || 0
|
|
39795
|
+
max_total_usd: _pyFloat3(cost_cfg["max_total_usd"] ?? 0, 0) || 0,
|
|
39796
|
+
// Rolling 24h cap. Unwired until now: the field existed on CostBudget and
|
|
39797
|
+
// gated the spend-ledger append, but no caller ever passed it, so the
|
|
39798
|
+
// ledger could not be written at all — an archived acceptance criterion
|
|
39799
|
+
// claimed otherwise. 0 keeps the cap disabled, which stays the default.
|
|
39800
|
+
daily_limit_usd: _pyFloat3(cost_cfg["daily_limit_usd"] ?? 0, 0) || 0
|
|
39466
39801
|
});
|
|
39467
39802
|
const rounds = _resolve_rounds(args, ai_cfg);
|
|
39468
39803
|
const stance_tally_on = _isDict3(ai_cfg) && _isDict3(ai_cfg["stance_tally"]) && ai_cfg["stance_tally"]["enabled"] === true;
|
|
@@ -39567,8 +39902,8 @@ function cmd_run(args, opts = {}) {
|
|
|
39567
39902
|
kind: "responses",
|
|
39568
39903
|
subcommand: "run"
|
|
39569
39904
|
});
|
|
39570
|
-
|
|
39571
|
-
|
|
39905
|
+
fs52.mkdirSync(path44.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
39906
|
+
fs52.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
|
|
39572
39907
|
_stdout2(
|
|
39573
39908
|
`
|
|
39574
39909
|
council:run \xB7 wrote ${out_path} (estimated $${_pyFixed6(estimated_total, 4)} / actual $${_pyFixed6(actual_total, 4)})
|
|
@@ -39593,7 +39928,7 @@ function _debate_round_filename(round_number) {
|
|
|
39593
39928
|
return `debate-round-${round_number}.json`;
|
|
39594
39929
|
}
|
|
39595
39930
|
function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
39596
|
-
|
|
39931
|
+
fs52.mkdirSync(_resolveTarget(out_dir), { recursive: true });
|
|
39597
39932
|
let actual_total = 0;
|
|
39598
39933
|
for (const r of responses) {
|
|
39599
39934
|
if (r.error) {
|
|
@@ -39614,17 +39949,18 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
|
39614
39949
|
debate_total_rounds: opts.total_planned_rounds,
|
|
39615
39950
|
rounds: 1,
|
|
39616
39951
|
cost_usd_actual: _pyRound7(actual_total, 6),
|
|
39952
|
+
prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
|
|
39617
39953
|
responses: _serialise_responses(responses)
|
|
39618
39954
|
};
|
|
39619
|
-
const out_path =
|
|
39620
|
-
|
|
39955
|
+
const out_path = path44.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
|
|
39956
|
+
fs52.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
|
|
39621
39957
|
return out_path;
|
|
39622
39958
|
}
|
|
39623
39959
|
function _load_debate_seed(p, expected_members) {
|
|
39624
|
-
if (!
|
|
39960
|
+
if (!fs52.existsSync(p)) {
|
|
39625
39961
|
throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
|
|
39626
39962
|
}
|
|
39627
|
-
const payload = JSON.parse(
|
|
39963
|
+
const payload = JSON.parse(fs52.readFileSync(p, "utf-8"));
|
|
39628
39964
|
const source_members = (payload["members"] || []).slice();
|
|
39629
39965
|
const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
|
|
39630
39966
|
if (!_listEq(source_members, expected_labels)) {
|
|
@@ -39670,7 +40006,7 @@ function _readStdinLine() {
|
|
|
39670
40006
|
try {
|
|
39671
40007
|
const buf = Buffer.alloc(4096);
|
|
39672
40008
|
const fd = 0;
|
|
39673
|
-
const n =
|
|
40009
|
+
const n = fs52.readSync(fd, buf, 0, buf.length, null);
|
|
39674
40010
|
return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
|
|
39675
40011
|
} catch {
|
|
39676
40012
|
return "";
|
|
@@ -39783,7 +40119,12 @@ function cmd_debate(args, opts = {}) {
|
|
|
39783
40119
|
max_input_tokens: _pyInt6(cost_cfg["max_input_tokens"] ?? 5e4, 5e4),
|
|
39784
40120
|
max_output_tokens: _pyInt6(cost_cfg["max_output_tokens"] ?? 2e4, 2e4),
|
|
39785
40121
|
max_calls: _pyInt6(cost_cfg["max_calls"] ?? 10, 10),
|
|
39786
|
-
max_total_usd: _pyFloat3(cost_cfg["max_total_usd"] ?? 0, 0) || 0
|
|
40122
|
+
max_total_usd: _pyFloat3(cost_cfg["max_total_usd"] ?? 0, 0) || 0,
|
|
40123
|
+
// Rolling 24h cap. Unwired until now: the field existed on CostBudget and
|
|
40124
|
+
// gated the spend-ledger append, but no caller ever passed it, so the
|
|
40125
|
+
// ledger could not be written at all — an archived acceptance criterion
|
|
40126
|
+
// claimed otherwise. 0 keeps the cap disabled, which stays the default.
|
|
40127
|
+
daily_limit_usd: _pyFloat3(cost_cfg["daily_limit_usd"] ?? 0, 0) || 0
|
|
39787
40128
|
});
|
|
39788
40129
|
const out_dir = _validate_council_output_path(args.output, {
|
|
39789
40130
|
kind: "responses",
|
|
@@ -39798,7 +40139,7 @@ function cmd_debate(args, opts = {}) {
|
|
|
39798
40139
|
);
|
|
39799
40140
|
}
|
|
39800
40141
|
const written = [];
|
|
39801
|
-
const _on_round_complete = (round_number, results) => {
|
|
40142
|
+
const _on_round_complete = (round_number, results, cache_gap_ms_since_previous_round) => {
|
|
39802
40143
|
const p = _write_debate_round(out_dir, round_number, results, {
|
|
39803
40144
|
question,
|
|
39804
40145
|
members,
|
|
@@ -39807,7 +40148,8 @@ function cmd_debate(args, opts = {}) {
|
|
|
39807
40148
|
total_planned_rounds: rounds,
|
|
39808
40149
|
table,
|
|
39809
40150
|
prompt_mode: "debate",
|
|
39810
|
-
prose_synthesis: _getattr3(args, "prose_synthesis", null)
|
|
40151
|
+
prose_synthesis: _getattr3(args, "prose_synthesis", null),
|
|
40152
|
+
cache_gap_ms_since_previous_round
|
|
39811
40153
|
});
|
|
39812
40154
|
written.push(p);
|
|
39813
40155
|
const errors = results.filter((r) => r.error);
|
|
@@ -39890,7 +40232,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
|
|
|
39890
40232
|
return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
|
|
39891
40233
|
}
|
|
39892
40234
|
function cmd_render(args) {
|
|
39893
|
-
const payload = JSON.parse(
|
|
40235
|
+
const payload = JSON.parse(fs52.readFileSync(args.responses, "utf-8"));
|
|
39894
40236
|
const items = payload["responses"] || [];
|
|
39895
40237
|
const explicit = _getattr3(args, "prompt_mode", null);
|
|
39896
40238
|
const mode = explicit || payload["prompt_mode"] || payload["mode"];
|
|
@@ -39916,8 +40258,8 @@ function cmd_render(args) {
|
|
|
39916
40258
|
kind: "sessions",
|
|
39917
40259
|
subcommand: "render"
|
|
39918
40260
|
});
|
|
39919
|
-
|
|
39920
|
-
|
|
40261
|
+
fs52.mkdirSync(path44.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
40262
|
+
fs52.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
|
|
39921
40263
|
_stdout2(`council:render \xB7 wrote ${out_path}
|
|
39922
40264
|
`);
|
|
39923
40265
|
return 0;
|
|
@@ -39928,15 +40270,15 @@ function cmd_render(args) {
|
|
|
39928
40270
|
function _cmd_replay_low_impact_stats(args) {
|
|
39929
40271
|
const li = low_impact_exports;
|
|
39930
40272
|
const responses_path = args.responses;
|
|
39931
|
-
const log_path =
|
|
39932
|
-
if (!
|
|
40273
|
+
const log_path = path44.join(path44.dirname(responses_path), "low-impact-resolutions.md");
|
|
40274
|
+
if (!fs52.existsSync(log_path)) {
|
|
39933
40275
|
_stdout2(
|
|
39934
40276
|
`council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
|
|
39935
40277
|
`
|
|
39936
40278
|
);
|
|
39937
40279
|
return 0;
|
|
39938
40280
|
}
|
|
39939
|
-
const body =
|
|
40281
|
+
const body = fs52.readFileSync(log_path, "utf-8");
|
|
39940
40282
|
const stats = li.parse_low_impact_log(body);
|
|
39941
40283
|
const out = li.render_low_impact_stats(stats);
|
|
39942
40284
|
if (_getattr3(args, "output", null)) {
|
|
@@ -39944,8 +40286,8 @@ function _cmd_replay_low_impact_stats(args) {
|
|
|
39944
40286
|
kind: "sessions",
|
|
39945
40287
|
subcommand: "replay"
|
|
39946
40288
|
});
|
|
39947
|
-
|
|
39948
|
-
|
|
40289
|
+
fs52.mkdirSync(path44.dirname(_resolveTarget(target)), { recursive: true });
|
|
40290
|
+
fs52.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
|
|
39949
40291
|
_stdout2(`council:replay \xB7 wrote ${target}
|
|
39950
40292
|
`);
|
|
39951
40293
|
return 0;
|
|
@@ -39957,7 +40299,7 @@ function cmd_replay(args) {
|
|
|
39957
40299
|
if (_getattr3(args, "low_impact_stats", false)) {
|
|
39958
40300
|
return _cmd_replay_low_impact_stats(args);
|
|
39959
40301
|
}
|
|
39960
|
-
const payload = JSON.parse(
|
|
40302
|
+
const payload = JSON.parse(fs52.readFileSync(args.responses, "utf-8"));
|
|
39961
40303
|
const consensus = _deserialise_consensus(payload["consensus"]);
|
|
39962
40304
|
if (consensus === null) {
|
|
39963
40305
|
_stderr2(
|
|
@@ -39982,8 +40324,8 @@ function cmd_replay(args) {
|
|
|
39982
40324
|
kind: "sessions",
|
|
39983
40325
|
subcommand: "replay"
|
|
39984
40326
|
});
|
|
39985
|
-
|
|
39986
|
-
|
|
40327
|
+
fs52.mkdirSync(path44.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
40328
|
+
fs52.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
|
|
39987
40329
|
_stdout2(`council:replay \xB7 wrote ${out_path}
|
|
39988
40330
|
`);
|
|
39989
40331
|
} else {
|
|
@@ -40040,8 +40382,8 @@ function cmd_quota(args, opts = {}) {
|
|
|
40040
40382
|
}
|
|
40041
40383
|
function _validate_council_output_path(path_str, opts) {
|
|
40042
40384
|
const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
|
|
40043
|
-
const expected_abs = _resolveReal(
|
|
40044
|
-
const target =
|
|
40385
|
+
const expected_abs = _resolveReal(path44.join(REPO_ROOT2, expected_rel));
|
|
40386
|
+
const target = path44.isAbsolute(path_str) ? path_str : path44.join(REPO_ROOT2, path_str);
|
|
40045
40387
|
const target_resolved = _resolveReal(target);
|
|
40046
40388
|
if (!_isRelativeTo(target_resolved, expected_abs)) {
|
|
40047
40389
|
throw new ArgumentTypeError(
|
|
@@ -40051,12 +40393,12 @@ function _validate_council_output_path(path_str, opts) {
|
|
|
40051
40393
|
return path_str;
|
|
40052
40394
|
}
|
|
40053
40395
|
function _resolveTarget(path_str) {
|
|
40054
|
-
return
|
|
40396
|
+
return path44.isAbsolute(path_str) ? path_str : path44.join(REPO_ROOT2, path_str);
|
|
40055
40397
|
}
|
|
40056
40398
|
function _resolveReal(p) {
|
|
40057
|
-
const abs =
|
|
40399
|
+
const abs = path44.resolve(p);
|
|
40058
40400
|
try {
|
|
40059
|
-
return
|
|
40401
|
+
return fs52.realpathSync(abs);
|
|
40060
40402
|
} catch {
|
|
40061
40403
|
return abs;
|
|
40062
40404
|
}
|
|
@@ -40065,8 +40407,8 @@ function _isRelativeTo(target, base) {
|
|
|
40065
40407
|
if (target === base) {
|
|
40066
40408
|
return true;
|
|
40067
40409
|
}
|
|
40068
|
-
const rel =
|
|
40069
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
40410
|
+
const rel = path44.relative(base, target);
|
|
40411
|
+
return rel !== "" && !rel.startsWith("..") && !path44.isAbsolute(rel);
|
|
40070
40412
|
}
|
|
40071
40413
|
function _topError(message) {
|
|
40072
40414
|
_stderr2(_TOP_USAGE2);
|
|
@@ -40427,13 +40769,13 @@ function _isCliEntry18() {
|
|
|
40427
40769
|
if (process.argv[1] === void 0) {
|
|
40428
40770
|
return false;
|
|
40429
40771
|
}
|
|
40430
|
-
const argvUrl = pathToFileURL18(
|
|
40772
|
+
const argvUrl = pathToFileURL18(path44.resolve(process.argv[1])).href;
|
|
40431
40773
|
if (import.meta.url === argvUrl) {
|
|
40432
40774
|
return true;
|
|
40433
40775
|
}
|
|
40434
40776
|
try {
|
|
40435
|
-
const here =
|
|
40436
|
-
const argv =
|
|
40777
|
+
const here = fs52.realpathSync(fileURLToPath26(import.meta.url));
|
|
40778
|
+
const argv = fs52.realpathSync(path44.resolve(process.argv[1]));
|
|
40437
40779
|
return here === argv;
|
|
40438
40780
|
} catch {
|
|
40439
40781
|
return false;
|
|
@@ -40485,7 +40827,7 @@ var init_council_cli = __esm({
|
|
|
40485
40827
|
"xai",
|
|
40486
40828
|
"perplexity"
|
|
40487
40829
|
]);
|
|
40488
|
-
_HERE16 =
|
|
40830
|
+
_HERE16 = path44.dirname(fileURLToPath26(import.meta.url));
|
|
40489
40831
|
[REPO_ROOT2] = resolve_project_root(null);
|
|
40490
40832
|
SETTINGS_FILE3 = project_settings_path(REPO_ROOT2);
|
|
40491
40833
|
AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT2);
|
|
@@ -40587,7 +40929,7 @@ var init_safety_envelope = __esm({
|
|
|
40587
40929
|
});
|
|
40588
40930
|
|
|
40589
40931
|
// src/scripts/mcp_server/__main__.ts
|
|
40590
|
-
import * as
|
|
40932
|
+
import * as path46 from "node:path";
|
|
40591
40933
|
import { fileURLToPath as fileURLToPath28 } from "node:url";
|
|
40592
40934
|
|
|
40593
40935
|
// src/scripts/mcp_server/index.ts
|
|
@@ -40635,8 +40977,8 @@ init_prompts();
|
|
|
40635
40977
|
init_resources();
|
|
40636
40978
|
|
|
40637
40979
|
// src/scripts/mcp_server/tools.ts
|
|
40638
|
-
import * as
|
|
40639
|
-
import * as
|
|
40980
|
+
import * as fs53 from "node:fs";
|
|
40981
|
+
import * as path45 from "node:path";
|
|
40640
40982
|
import { fileURLToPath as fileURLToPath27 } from "node:url";
|
|
40641
40983
|
|
|
40642
40984
|
// src/scripts/chat_history.ts
|
|
@@ -42884,9 +43226,9 @@ function _strip9(s) {
|
|
|
42884
43226
|
}
|
|
42885
43227
|
function _resolvePath2(p) {
|
|
42886
43228
|
try {
|
|
42887
|
-
return
|
|
43229
|
+
return fs53.realpathSync(p);
|
|
42888
43230
|
} catch {
|
|
42889
|
-
return
|
|
43231
|
+
return path45.resolve(p);
|
|
42890
43232
|
}
|
|
42891
43233
|
}
|
|
42892
43234
|
function _resolveConsumerRoot(override) {
|
|
@@ -42896,14 +43238,14 @@ function _resolveConsumerRoot(override) {
|
|
|
42896
43238
|
return _resolvePath2(process.cwd());
|
|
42897
43239
|
}
|
|
42898
43240
|
function _relativeUnder(target, root) {
|
|
42899
|
-
const rel =
|
|
43241
|
+
const rel = path45.relative(root, target);
|
|
42900
43242
|
if (rel === "") {
|
|
42901
43243
|
return "";
|
|
42902
43244
|
}
|
|
42903
|
-
if (rel.startsWith("..") ||
|
|
43245
|
+
if (rel.startsWith("..") || path45.isAbsolute(rel)) {
|
|
42904
43246
|
return null;
|
|
42905
43247
|
}
|
|
42906
|
-
return rel.split(
|
|
43248
|
+
return rel.split(path45.sep).join("/");
|
|
42907
43249
|
}
|
|
42908
43250
|
function _reprStrList(values) {
|
|
42909
43251
|
return `[${values.map((v) => `'${v}'`).join(", ")}]`;
|
|
@@ -42912,11 +43254,11 @@ function _validateInTreePath(raw, consumerRoot) {
|
|
|
42912
43254
|
const root = _resolvePath2(consumerRoot);
|
|
42913
43255
|
let target;
|
|
42914
43256
|
if (raw === null || raw === void 0 || raw === "") {
|
|
42915
|
-
target =
|
|
42916
|
-
} else if (
|
|
43257
|
+
target = path45.join(root, "agents", "runtime", ".agent-chat-history");
|
|
43258
|
+
} else if (path45.isAbsolute(raw)) {
|
|
42917
43259
|
target = _resolvePath2(raw);
|
|
42918
43260
|
} else {
|
|
42919
|
-
target = _resolvePath2(
|
|
43261
|
+
target = _resolvePath2(path45.join(root, raw));
|
|
42920
43262
|
}
|
|
42921
43263
|
const rel = _relativeUnder(target, root);
|
|
42922
43264
|
if (rel === null) {
|
|
@@ -42954,11 +43296,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
|
|
|
42954
43296
|
if (typeof raw !== "string") {
|
|
42955
43297
|
throw new Error("'paths' entries must be strings");
|
|
42956
43298
|
}
|
|
42957
|
-
const resolved =
|
|
43299
|
+
const resolved = path45.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path45.join(root, raw));
|
|
42958
43300
|
if (_relativeUnder(resolved, root) === null) {
|
|
42959
43301
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
42960
43302
|
}
|
|
42961
|
-
if (
|
|
43303
|
+
if (fs53.existsSync(resolved)) {
|
|
42962
43304
|
paths.push(resolved);
|
|
42963
43305
|
}
|
|
42964
43306
|
}
|
|
@@ -42995,7 +43337,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
42995
43337
|
if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
|
|
42996
43338
|
throw new Error("'min_schema_version' must be an integer");
|
|
42997
43339
|
}
|
|
42998
|
-
const existingHeader =
|
|
43340
|
+
const existingHeader = fs53.existsSync(target) ? _chReadHeader(target) : null;
|
|
42999
43341
|
const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
|
|
43000
43342
|
if (observed < minSchema) {
|
|
43001
43343
|
throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
|
|
@@ -43010,8 +43352,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
43010
43352
|
session: session === void 0 ? null : session
|
|
43011
43353
|
};
|
|
43012
43354
|
}
|
|
43013
|
-
if (!
|
|
43014
|
-
|
|
43355
|
+
if (!fs53.existsSync(target) || _chReadHeader(target) === null) {
|
|
43356
|
+
fs53.mkdirSync(path45.dirname(target), { recursive: true });
|
|
43015
43357
|
_chInit(target);
|
|
43016
43358
|
}
|
|
43017
43359
|
_chAppend(entry, target, session ?? null);
|
|
@@ -43055,7 +43397,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
|
|
|
43055
43397
|
if (detail !== "full" && detail !== "index") {
|
|
43056
43398
|
throw new Error("'detail' must be 'index' or 'full'");
|
|
43057
43399
|
}
|
|
43058
|
-
if (!
|
|
43400
|
+
if (!fs53.existsSync(target)) {
|
|
43059
43401
|
return { path: target, entries: [], count: 0 };
|
|
43060
43402
|
}
|
|
43061
43403
|
if (around !== void 0 && around !== null) {
|
|
@@ -43157,8 +43499,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
|
|
|
43157
43499
|
}
|
|
43158
43500
|
return result;
|
|
43159
43501
|
}
|
|
43160
|
-
var _PACKAGE_ROOT2 =
|
|
43161
|
-
|
|
43502
|
+
var _PACKAGE_ROOT2 = path45.resolve(
|
|
43503
|
+
path45.dirname(fileURLToPath27(import.meta.url)),
|
|
43162
43504
|
"..",
|
|
43163
43505
|
"..",
|
|
43164
43506
|
".."
|
|
@@ -43202,10 +43544,10 @@ async function _memorySignalHandler(args, consumerRoot) {
|
|
|
43202
43544
|
async function _roadmapProgressHandler(args, consumerRoot) {
|
|
43203
43545
|
const dryRun = _pyTruthy6(args.dry_run ?? false);
|
|
43204
43546
|
const root = _resolvePath2(consumerRoot);
|
|
43205
|
-
const roadmapRoot =
|
|
43206
|
-
const target =
|
|
43547
|
+
const roadmapRoot = path45.join(root, "agents", "roadmaps");
|
|
43548
|
+
const target = path45.join(root, "agents", "roadmaps-progress.md");
|
|
43207
43549
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
43208
|
-
if (!
|
|
43550
|
+
if (!fs53.existsSync(roadmapRoot)) {
|
|
43209
43551
|
return {
|
|
43210
43552
|
written: false,
|
|
43211
43553
|
path: target,
|
|
@@ -43220,7 +43562,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
|
|
|
43220
43562
|
const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
|
|
43221
43563
|
const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
|
|
43222
43564
|
if (!dryRun) {
|
|
43223
|
-
|
|
43565
|
+
fs53.writeFileSync(target, content, "utf-8");
|
|
43224
43566
|
}
|
|
43225
43567
|
return {
|
|
43226
43568
|
written: !dryRun,
|
|
@@ -43241,11 +43583,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
43241
43583
|
let dashboardRegenerated = false;
|
|
43242
43584
|
if (archived.length > 0) {
|
|
43243
43585
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
43244
|
-
const roadmapRoot =
|
|
43245
|
-
if (
|
|
43586
|
+
const roadmapRoot = path45.join(root, "agents", "roadmaps");
|
|
43587
|
+
if (fs53.existsSync(roadmapRoot)) {
|
|
43246
43588
|
const roadmaps = urp.collect(roadmapRoot);
|
|
43247
|
-
|
|
43248
|
-
|
|
43589
|
+
fs53.writeFileSync(
|
|
43590
|
+
path45.join(root, "agents", "roadmaps-progress.md"),
|
|
43249
43591
|
urp.render(roadmaps, urp.collect_bundles(root)),
|
|
43250
43592
|
"utf-8"
|
|
43251
43593
|
);
|
|
@@ -43261,9 +43603,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
43261
43603
|
async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
43262
43604
|
const check = _pyTruthy6(args.check ?? false);
|
|
43263
43605
|
const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
|
|
43264
|
-
const out =
|
|
43606
|
+
const out = path45.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
|
|
43265
43607
|
const content = cap.build();
|
|
43266
|
-
const onDisk =
|
|
43608
|
+
const onDisk = fs53.existsSync(out) ? fs53.readFileSync(out, "utf-8") : "";
|
|
43267
43609
|
const drift = onDisk !== content;
|
|
43268
43610
|
if (check) {
|
|
43269
43611
|
return { check: true, written: false, drift, path: out };
|
|
@@ -43274,7 +43616,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
|
43274
43616
|
`CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
|
|
43275
43617
|
);
|
|
43276
43618
|
}
|
|
43277
|
-
|
|
43619
|
+
fs53.writeFileSync(out, content, "utf-8");
|
|
43278
43620
|
return { check: false, written: true, drift, path: out };
|
|
43279
43621
|
}
|
|
43280
43622
|
async function _runDoctorLeg(consumerRoot) {
|
|
@@ -43374,11 +43716,11 @@ async function _councilEstimateHandler(args, consumerRoot) {
|
|
|
43374
43716
|
throw new Error("'depth' must be 'shallow' or 'deep' when provided");
|
|
43375
43717
|
}
|
|
43376
43718
|
const root = _resolvePath2(consumerRoot);
|
|
43377
|
-
const target =
|
|
43719
|
+
const target = path45.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path45.join(root, inputRaw));
|
|
43378
43720
|
if (_relativeUnder(target, root) === null) {
|
|
43379
43721
|
throw new Error(`path escapes consumer_root: ${target}`);
|
|
43380
43722
|
}
|
|
43381
|
-
if (!
|
|
43723
|
+
if (!fs53.existsSync(target)) {
|
|
43382
43724
|
throw new Error(`input_path not found: ${target}`);
|
|
43383
43725
|
}
|
|
43384
43726
|
const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
|
|
@@ -43440,18 +43782,18 @@ async function _runTestsHandler(args, consumerRoot) {
|
|
|
43440
43782
|
if (typeof relPathRaw !== "string" || !_strip9(relPathRaw)) {
|
|
43441
43783
|
throw new Error("'path' must be a non-empty string when provided");
|
|
43442
43784
|
}
|
|
43443
|
-
const resolved =
|
|
43785
|
+
const resolved = path45.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path45.join(root, relPathRaw));
|
|
43444
43786
|
const rel = _relativeUnder(resolved, root);
|
|
43445
43787
|
if (rel === null) {
|
|
43446
43788
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
43447
43789
|
}
|
|
43448
|
-
if (!
|
|
43790
|
+
if (!fs53.existsSync(resolved)) {
|
|
43449
43791
|
throw new Error(`path not found: ${resolved}`);
|
|
43450
43792
|
}
|
|
43451
43793
|
relArg = rel;
|
|
43452
43794
|
}
|
|
43453
|
-
const vitestEntry =
|
|
43454
|
-
if (!
|
|
43795
|
+
const vitestEntry = path45.join(root, "node_modules", "vitest", "vitest.mjs");
|
|
43796
|
+
if (!fs53.existsSync(vitestEntry)) {
|
|
43455
43797
|
throw new Error(
|
|
43456
43798
|
"run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
|
|
43457
43799
|
);
|
|
@@ -44057,8 +44399,8 @@ function _strCmp3(a, b) {
|
|
|
44057
44399
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
44058
44400
|
}
|
|
44059
44401
|
function _pathlibCompare3(a, b) {
|
|
44060
|
-
const pa = a.split(
|
|
44061
|
-
const pb = b.split(
|
|
44402
|
+
const pa = a.split(path45.sep);
|
|
44403
|
+
const pb = b.split(path45.sep);
|
|
44062
44404
|
const n = Math.min(pa.length, pb.length);
|
|
44063
44405
|
for (let i = 0; i < n; i++) {
|
|
44064
44406
|
const c = _strCmp3(pa[i], pb[i]);
|
|
@@ -44283,7 +44625,7 @@ function main19() {
|
|
|
44283
44625
|
|
|
44284
44626
|
// src/scripts/mcp_server/__main__.ts
|
|
44285
44627
|
var _selfPath = fileURLToPath28(import.meta.url);
|
|
44286
|
-
var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 &&
|
|
44628
|
+
var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path46.resolve(process.argv[1]) === path46.resolve(_selfPath);
|
|
44287
44629
|
if (_invokedDirectly2) {
|
|
44288
44630
|
main19();
|
|
44289
44631
|
}
|