@event4u/agent-config 16.3.0 → 16.5.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/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +178 -78
- package/README.md +2 -2
- package/agents/templates/.ai-council.yml.example +26 -8
- package/dist/agent-src/commands/analyze/inbox.md +10 -7
- package/dist/agent-src/commands/bug/investigate.md +1 -1
- package/dist/agent-src/commands/commit/in-chunks.md +40 -31
- package/dist/agent-src/commands/commit.md +72 -33
- package/dist/agent-src/commands/condense.md +2 -8
- package/dist/agent-src/commands/council/debate.md +11 -7
- package/dist/agent-src/commands/council/default.md +10 -9
- package/dist/agent-src/commands/council.md +1 -1
- package/dist/agent-src/commands/design.md +1 -1
- package/dist/agent-src/commands/estimate-ticket.md +1 -1
- package/dist/agent-src/commands/feature/explore.md +3 -3
- package/dist/agent-src/commands/feature/plan.md +1 -1
- package/dist/agent-src/commands/fix/ci.md +17 -3
- package/dist/agent-src/commands/fix/commit-messages.md +48 -23
- package/dist/agent-src/commands/fix/pr-comments.md +3 -6
- package/dist/agent-src/commands/implement-ticket.md +3 -3
- package/dist/agent-src/commands/memory/add.md +4 -16
- package/dist/agent-src/commands/memory/load.md +5 -6
- package/dist/agent-src/commands/memory/promote.md +3 -16
- package/dist/agent-src/commands/mission/upgrade.md +3 -2
- package/dist/agent-src/commands/optimize/agents-dir.md +2 -2
- package/dist/agent-src/commands/optimize/deep.md +4 -2
- package/dist/agent-src/commands/optimize/rtk.md +4 -26
- package/dist/agent-src/commands/pr/create/description-only.md +18 -15
- package/dist/agent-src/commands/pr/create.md +42 -34
- package/dist/agent-src/commands/pr/merge.md +136 -9
- package/dist/agent-src/commands/prepare-for-review.md +13 -11
- package/dist/agent-src/commands/project/analyze.md +7 -35
- package/dist/agent-src/commands/refine-ticket.md +1 -1
- package/dist/agent-src/commands/review/changes.md +14 -19
- package/dist/agent-src/commands/roadmap/next.md +10 -1
- package/dist/agent-src/commands/roadmap/process-full.md +52 -38
- package/dist/agent-src/commands/roadmap/resolve-blockers.md +64 -14
- package/dist/agent-src/commands/worktree/create.md +7 -3
- package/dist/agent-src/commands/worktree/verify.md +2 -1
- package/dist/agent-src/contexts/communication/rules-auto/think-before-action-mechanics.md +5 -3
- package/dist/agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +7 -9
- package/dist/agent-src/contexts/contracts/command-suggestion-flow.md +8 -6
- package/dist/agent-src/contexts/contracts/frugality-charter.md +8 -5
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +1 -1
- package/dist/agent-src/contexts/execution/auto-orchestration-activation.md +0 -1
- package/dist/agent-src/contexts/execution/evidence-discipline.md +2 -2
- package/dist/agent-src/contexts/execution/non-interactive-contract.md +5 -8
- package/dist/agent-src/contexts/execution/rdp-gate.md +4 -4
- package/dist/agent-src/contexts/execution/roadmap-execution-contract.md +9 -8
- package/dist/agent-src/contexts/execution/roadmap-process-loop.md +67 -52
- package/dist/agent-src/contexts/execution/subagent-routing.md +8 -8
- package/dist/agent-src/contexts/execution/subagent-steering.md +6 -4
- package/dist/agent-src/contexts/execution/terminal-states.md +2 -2
- package/dist/agent-src/contexts/execution/toolchain-resolver.md +4 -10
- package/dist/agent-src/contexts/subagent-configuration.md +1 -1
- package/dist/agent-src/guidelines/agent-infra/active-remediation-mechanics.md +39 -0
- package/dist/agent-src/guidelines/agent-infra/context-hygiene-mechanics.md +1 -1
- package/dist/agent-src/guidelines/agent-infra/cross-source-consistency-mechanics.md +8 -10
- package/dist/agent-src/guidelines/agent-infra/frontier-reasoning-operating-profile.md +3 -2
- package/dist/agent-src/guidelines/agent-infra/layered-settings.md +13 -1
- package/dist/agent-src/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/dist/agent-src/guidelines/agent-infra/self-improvement-pipeline.md +10 -3
- package/dist/agent-src/guidelines/agent-infra/size-and-scope.md +36 -0
- package/dist/agent-src/guidelines/design-antipatterns.md +1 -1
- package/dist/agent-src/guidelines/php/git.md +15 -2
- package/dist/agent-src/rules/active-remediation.md +0 -1
- package/dist/agent-src/rules/analysis-skill-routing.md +0 -1
- package/dist/agent-src/rules/architecture.md +0 -1
- package/dist/agent-src/rules/artifact-drafting-protocol.md +0 -1
- package/dist/agent-src/rules/artifact-engagement-recording.md +0 -1
- package/dist/agent-src/rules/augment-edit-discipline.md +0 -1
- package/dist/agent-src/rules/autonomous-execution.md +0 -1
- package/dist/agent-src/rules/brand-consistency.md +0 -1
- package/dist/agent-src/rules/brand-source-of-truth.md +0 -1
- package/dist/agent-src/rules/broken-access-control.md +0 -1
- package/dist/agent-src/rules/cli-output-handling.md +0 -1
- package/dist/agent-src/rules/code-comment-discipline.md +0 -1
- package/dist/agent-src/rules/code-provenance.md +0 -1
- package/dist/agent-src/rules/command-suggestion-policy.md +0 -1
- package/dist/agent-src/rules/commit-conventions.md +1 -2
- package/dist/agent-src/rules/communication-through-line.md +1 -2
- package/dist/agent-src/rules/content-quoting-floor.md +1 -2
- package/dist/agent-src/rules/context-hygiene.md +5 -5
- package/dist/agent-src/rules/copilot-routing.md +1 -2
- package/dist/agent-src/rules/council-availability.md +4 -4
- package/dist/agent-src/rules/cross-source-consistency.md +4 -6
- package/dist/agent-src/rules/decision-revisit-gate.md +2 -3
- package/dist/agent-src/rules/delegation-policy.md +2 -3
- package/dist/agent-src/rules/design-fidelity.md +0 -1
- package/dist/agent-src/rules/design-review-after-ui-write.md +3 -3
- package/dist/agent-src/rules/devcontainer-routing.md +1 -2
- package/dist/agent-src/rules/doc-screenshot-hygiene.md +0 -1
- package/dist/agent-src/rules/docker-commands.md +0 -1
- package/dist/agent-src/rules/domain-adoption-policy.md +0 -1
- package/dist/agent-src/rules/domain-safety-disclaimer.md +0 -1
- package/dist/agent-src/rules/domain-safety-pii.md +0 -1
- package/dist/agent-src/rules/domain-safety-retention.md +0 -1
- package/dist/agent-src/rules/downstream-changes.md +0 -1
- package/dist/agent-src/rules/engineering-safety-floor.md +0 -1
- package/dist/agent-src/rules/external-code-graph-interop.md +0 -1
- package/dist/agent-src/rules/external-reference-deep-dive.md +0 -1
- package/dist/agent-src/rules/fast-path-marker-visibility.md +1 -2
- package/dist/agent-src/rules/finance-safety-floor.md +0 -1
- package/dist/agent-src/rules/fix-what-you-see.md +6 -32
- package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +0 -1
- package/dist/agent-src/rules/git-history-discipline.md +1 -2
- package/dist/agent-src/rules/guidelines.md +0 -1
- package/dist/agent-src/rules/history-discipline.md +0 -1
- package/dist/agent-src/rules/icon-consistency.md +0 -1
- package/dist/agent-src/rules/image-likeness-and-rights.md +0 -1
- package/dist/agent-src/rules/improve-before-implement.md +0 -1
- package/dist/agent-src/rules/invite-challenge.md +0 -1
- package/dist/agent-src/rules/laravel-routing.md +1 -2
- package/dist/agent-src/rules/laravel-translations.md +0 -1
- package/dist/agent-src/rules/legal-safety-floor.md +0 -1
- package/dist/agent-src/rules/lethal-trifecta-guard.md +0 -1
- package/dist/agent-src/rules/linked-projects-onboarding-gate.md +0 -1
- package/dist/agent-src/rules/low-impact-corpus-privacy-floor.md +0 -1
- package/dist/agent-src/rules/markdown-safe-codeblocks.md +0 -1
- package/dist/agent-src/rules/media-governance-routing.md +1 -2
- package/dist/agent-src/rules/media-sync-ground-truth.md +0 -1
- package/dist/agent-src/rules/minimal-safe-diff.md +0 -1
- package/dist/agent-src/rules/missing-skill-recovery.md +0 -1
- package/dist/agent-src/rules/missing-tool-handling.md +0 -1
- package/dist/agent-src/rules/model-recommendation.md +0 -1
- package/dist/agent-src/rules/neighbour-precedence.md +64 -0
- package/dist/agent-src/rules/no-attribution-footers.md +0 -1
- package/dist/agent-src/rules/no-decorative-emojis-in-git-surfaces.md +0 -1
- package/dist/agent-src/rules/no-pr-progress-comments.md +0 -1
- package/dist/agent-src/rules/no-roadmap-references.md +0 -1
- package/dist/agent-src/rules/notes-first-reasoning.md +0 -1
- package/dist/agent-src/rules/onboarding-gate.md +0 -1
- package/dist/agent-src/rules/output-discipline.md +0 -1
- package/dist/agent-src/rules/package-ci-checks.md +0 -1
- package/dist/agent-src/rules/persona-governance.md +2 -3
- package/dist/agent-src/rules/php-coding.md +0 -1
- package/dist/agent-src/rules/prefer-enums-over-literals.md +0 -1
- package/dist/agent-src/rules/preservation-guard.md +0 -1
- package/dist/agent-src/rules/provider-lifecycle-discipline.md +2 -3
- package/dist/agent-src/rules/question-not-instruction.md +0 -1
- package/dist/agent-src/rules/reviewer-awareness.md +0 -1
- package/dist/agent-src/rules/roadmap-ci-steps-policy.md +0 -1
- package/dist/agent-src/rules/roadmap-progress-sync.md +3 -6
- package/dist/agent-src/rules/role-mode-adherence.md +0 -1
- package/dist/agent-src/rules/rule-type-governance.md +0 -1
- package/dist/agent-src/rules/runtime-safety.md +0 -1
- package/dist/agent-src/rules/scale-discipline.md +0 -1
- package/dist/agent-src/rules/secret-vcs-guard.md +0 -1
- package/dist/agent-src/rules/security-sensitive-stop.md +0 -1
- package/dist/agent-src/rules/self-repair-loop.md +0 -1
- package/dist/agent-src/rules/senior-engineering-discipline.md +0 -1
- package/dist/agent-src/rules/session-canary.md +0 -1
- package/dist/agent-src/rules/settings-ask-protocol.md +5 -6
- package/dist/agent-src/rules/size-enforcement.md +0 -1
- package/dist/agent-src/rules/skill-improvement-trigger.md +2 -3
- package/dist/agent-src/rules/skill-quality.md +0 -1
- package/dist/agent-src/rules/slash-command-routing-policy.md +0 -1
- package/dist/agent-src/rules/source-confidentiality.md +0 -1
- package/dist/agent-src/rules/source-discovery-gate.md +0 -1
- package/dist/agent-src/rules/source-of-truth.md +0 -1
- package/dist/agent-src/rules/spreadsheet-source-quality.md +1 -2
- package/dist/agent-src/rules/strategy-safety-floor.md +0 -1
- package/dist/agent-src/rules/symfony-routing.md +1 -2
- package/dist/agent-src/rules/think-before-action.md +0 -1
- package/dist/agent-src/rules/token-budget-discipline.md +14 -48
- package/dist/agent-src/rules/token-efficiency.md +0 -1
- package/dist/agent-src/rules/token-optimizer-maintenance.md +0 -1
- package/dist/agent-src/rules/tool-safety.md +0 -1
- package/dist/agent-src/rules/ui-audit-gate.md +1 -2
- package/dist/agent-src/rules/untrusted-input-defense.md +0 -1
- package/dist/agent-src/rules/upstream-proposal.md +0 -1
- package/dist/agent-src/rules/user-interaction.md +0 -1
- package/dist/agent-src/rules/user-interrupt-priority.md +0 -1
- package/dist/agent-src/scripts/gate_budget.ts +47 -23
- package/dist/agent-src/scripts/gate_execute.ts +12 -4
- package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +2 -0
- package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
- package/dist/agent-src/skills/ai-council/SKILL.md +7 -4
- package/dist/agent-src/skills/ai-council/references/cost-and-redaction.md +21 -11
- package/dist/agent-src/skills/ai-council/references/procedure.md +12 -6
- package/dist/agent-src/skills/analysis-autonomous-mode/SKILL.md +1 -1
- package/dist/agent-src/skills/bug-analyzer/SKILL.md +1 -1
- package/dist/agent-src/skills/canvas-design/SKILL.md +4 -2
- package/dist/agent-src/skills/command-routing/SKILL.md +3 -4
- package/dist/agent-src/skills/conventional-commits-writing/SKILL.md +127 -139
- package/dist/agent-src/skills/corpus-grounding/ATTRIBUTION.md +39 -0
- package/dist/agent-src/skills/corpus-grounding/SKILL.md +8 -2
- package/dist/agent-src/skills/database/data/manifest.json +2 -2
- package/dist/agent-src/skills/database/data/query-tuning.csv +13 -13
- package/dist/agent-src/skills/design-intelligence/references/integration-mapping.md +13 -10
- package/dist/agent-src/skills/design-system-capture/SKILL.md +0 -3
- package/dist/agent-src/skills/estimate-ticket/SKILL.md +1 -1
- package/dist/agent-src/skills/fe-design/references/design-patterns.md +49 -2
- package/dist/agent-src/skills/feature-planning/SKILL.md +1 -1
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +9 -0
- package/dist/agent-src/skills/git-workflow/SKILL.md +44 -44
- package/dist/agent-src/skills/git-workflow/references/branch-update.md +312 -0
- package/dist/agent-src/skills/git-workflow/references/commit-subject.md +205 -0
- package/dist/agent-src/skills/iconography/SKILL.md +4 -2
- package/dist/agent-src/skills/image-provider-routing/SKILL.md +16 -5
- package/dist/agent-src/skills/jira-integration/SKILL.md +3 -3
- package/dist/agent-src/skills/logo-generation/SKILL.md +12 -8
- package/dist/agent-src/skills/merge-conflicts/SKILL.md +10 -4
- package/dist/agent-src/skills/po-discovery/SKILL.md +1 -1
- package/dist/agent-src/skills/refine-ticket/SKILL.md +4 -4
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +2 -2
- package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +4 -2
- package/dist/agent-src/skills/source-discovery/SKILL.md +1 -1
- package/dist/agent-src/skills/svg-authoring/SKILL.md +318 -0
- package/dist/agent-src/skills/tailwind-engineer/SKILL.md +3 -1
- package/dist/agent-src/skills/testing-anti-patterns/SKILL.md +1 -1
- package/dist/agent-src/skills/using-git-worktrees/SKILL.md +1 -1
- package/dist/agent-src/skills/verify-repair-loop/SKILL.md +2 -2
- package/dist/agent-src/skills/wireframe/SKILL.md +5 -2
- package/dist/agent-src/templates/AGENTS.md +1 -1
- package/dist/agent-src/templates/agent-settings.md +46 -129
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +3 -3
- package/dist/agent-src/templates/command.md +2 -2
- package/dist/agent-src/templates/roadmaps.md +6 -1
- package/dist/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +0 -6
- package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +11 -7
- package/dist/agent-src/templates/scripts/work_engine/hooks/builtin/decision_trace.ts +3 -2
- package/dist/agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.ts +2 -1
- package/dist/agent-src/templates/scripts/work_engine/hooks/settings.ts +0 -6
- package/dist/agent-src/templates/scripts/work_engine/scoring/decision_engine.ts +9 -12
- package/dist/agent-src/templates/scripts/work_engine/scoring/memory_visibility.ts +2 -1
- package/dist/agent-src/templates/skill.md +1 -1
- package/dist/cli/commands/uiRender.js +201 -4
- package/dist/cli/commands/uiRenderAsset.js +1308 -0
- package/dist/cli/commands/uiRenderAssetCompare.js +752 -0
- package/dist/cli/commands/uiRenderAssetGrid.js +265 -0
- package/dist/cli/commands/uiRenderAssetGrounds.js +323 -0
- package/dist/cli/commands/uiRenderAssetIsolation.js +85 -0
- package/dist/cli/commands/uiRenderAssetTypes.js +145 -0
- package/dist/cli/main.js +47 -1
- package/dist/cli/registry.js +2 -1
- package/dist/cli-delegate/check_update_banner.js +195 -119
- package/dist/cli-delegate/{chunk-S4UMZNES.js → chunk-4DBG5K7M.js} +5 -5
- package/dist/cli-delegate/{chunk-TRI6DQZ6.js → chunk-5GPULQBE.js} +60 -42
- package/dist/cli-delegate/{chunk-JQVYKIZA.js → chunk-6SRJTYJS.js} +33 -177
- package/dist/cli-delegate/chunk-6V5FMA3P.js +186 -0
- package/dist/cli-delegate/chunk-6YQC2HLF.js +415 -0
- package/dist/cli-delegate/{chunk-E4XIZDIB.js → chunk-7HKRE54K.js} +1 -64
- package/dist/cli-delegate/{chunk-7HQ52DHU.js → chunk-AL3RZ22D.js} +1 -1
- package/dist/cli-delegate/{chunk-DBH4AHDK.js → chunk-ED7KCMLB.js} +9 -11
- package/dist/cli-delegate/{chunk-NXEILF2K.js → chunk-F3QDG2GT.js} +481 -72
- package/dist/cli-delegate/{chunk-CQWX336L.js → chunk-G5VVIZRC.js} +3 -3
- package/dist/cli-delegate/{chunk-JY2I2DXV.js → chunk-H76PHZBI.js} +137 -60
- package/dist/cli-delegate/chunk-IAYTIIQW.js +67 -0
- package/dist/cli-delegate/{chunk-LIYTLH6O.js → chunk-KXXWJTDO.js} +5 -10
- package/dist/cli-delegate/{chunk-T7L2QK3K.js → chunk-LQOCRFWT.js} +1 -1
- package/dist/cli-delegate/{chunk-S4YWNRKO.js → chunk-MDPPKQCQ.js} +34 -1
- package/dist/cli-delegate/chunk-OAFSJBHH.js +272 -0
- package/dist/cli-delegate/{chunk-GKE7ZVFA.js → chunk-PWX7CKMD.js} +1 -1
- package/dist/cli-delegate/{chunk-NDJLNC6Q.js → chunk-T6BP34WI.js} +1 -0
- package/dist/cli-delegate/{chunk-RQNNW7IF.js → chunk-T7XSJSUQ.js} +433 -632
- package/dist/cli-delegate/{chunk-NQ7WT43P.js → chunk-TMWYUOK4.js} +75 -12
- package/dist/cli-delegate/{chunk-EEHDXSYD.js → chunk-WQWXGIWB.js} +12 -273
- package/dist/cli-delegate/{chunk-QLDHIPWR.js → chunk-XQTPXKFA.js} +1 -1
- package/dist/cli-delegate/cmd_analyze_session.js +223 -43
- package/dist/cli-delegate/cmd_brand_status.js +3 -2
- package/dist/cli-delegate/cmd_conformance.js +489 -238
- package/dist/cli-delegate/cmd_converge.js +3 -3
- package/dist/cli-delegate/cmd_doctor.js +15 -12
- package/dist/cli-delegate/cmd_doctor_neighbours.js +11 -4
- package/dist/cli-delegate/cmd_explain.js +43 -19
- package/dist/cli-delegate/cmd_export.js +10 -10
- package/dist/cli-delegate/cmd_git_convention.js +1851 -0
- package/dist/cli-delegate/cmd_handoff.js +40 -21
- package/dist/cli-delegate/cmd_mcp_available.js +3 -2
- package/dist/cli-delegate/cmd_migrate.js +3 -3
- package/dist/cli-delegate/cmd_packs_active.js +4 -3
- package/dist/cli-delegate/cmd_prune.js +10 -10
- package/dist/cli-delegate/cmd_route_audit.js +7 -7
- package/dist/cli-delegate/cmd_route_explain.js +5 -5
- package/dist/cli-delegate/cmd_session_recycle.js +9 -7
- package/dist/cli-delegate/cmd_settings_check.js +54 -7
- package/dist/cli-delegate/cmd_settings_get.js +18 -8
- package/dist/cli-delegate/cmd_settings_migrate.js +10 -10
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +10 -10
- package/dist/cli-delegate/cmd_uninstall.js +10 -10
- package/dist/cli-delegate/cmd_update.js +7 -7
- package/dist/cli-delegate/cmd_upgrade.js +7 -7
- package/dist/cli-delegate/cmd_validate.js +10 -10
- package/dist/cli-delegate/cmd_versions.js +5 -5
- package/dist/cli-delegate/gate_budget.js +1 -1
- package/dist/cli-delegate/gate_execute.js +2 -2
- package/dist/cli-delegate/roadmap_gates.js +2 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +171 -107
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +7 -7
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +41 -22
- package/dist/discovery/trust-report.md +3 -3
- package/dist/discovery/workspaces.json +16 -11
- package/dist/hooks/dispatch.js +2520 -1924
- package/dist/hooks/dispatch.sha256 +1 -1
- package/dist/hooks/svg_rules.chunk.cjs +1626 -0
- package/dist/hooks/svg_rules.chunk.cjs.sha256 +1 -0
- package/dist/install/install.mjs +462 -431
- package/dist/install/installThinLayer.js +40 -12
- package/dist/install/installedRuleLinks.js +105 -19
- package/dist/mcp/awesome-mcp-servers.row.md +1 -1
- package/dist/mcp/mcp-cloudflare-catalogue.json +2 -2
- package/dist/mcp/registry-manifest.json +5 -5
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +3063 -2160
- package/dist/router.json +1 -1
- package/dist/scripts/_lib/agent_settings.js +15 -120
- package/dist/scripts/_lib/compile_time_toggles.js +12 -21
- package/dist/scripts/_lib/git_convention.js +232 -0
- package/dist/scripts/_lib/global_deploy_inventory.js +730 -0
- package/dist/scripts/_lib/installed_layer.js +344 -18
- package/dist/scripts/_lib/package_root.js +68 -0
- package/dist/scripts/_lib/rule_law_section.js +1 -1
- package/dist/scripts/_lib/scan_scope.js +105 -0
- package/dist/scripts/_lib/settings_removed_keys.js +168 -0
- package/dist/scripts/_lib/svg_dom.js +284 -0
- package/dist/scripts/_lib/svg_geometry.js +477 -0
- package/dist/scripts/_lib/svg_motion.js +179 -0
- package/dist/scripts/_lib/svg_rules.js +1337 -0
- package/dist/scripts/_lib/svg_urls.js +67 -0
- package/dist/scripts/_lib/thin_rules.js +80 -3
- package/dist/scripts/lint_svg_asset.js +324 -0
- package/dist/server/app.js +2 -1
- package/dist/server/gitKeysGate.js +105 -0
- package/dist/server/routes/settings.js +67 -8
- package/dist/server/routes/wizard.js +4 -0
- package/dist/server/schemas/settings.js +23 -81
- package/dist/shared/skillRanking.js +30 -4
- package/dist/ui/assets/{index-Cwq4d0hX.js → index-C3djEJah.js} +2 -2
- package/dist/ui/index.html +1 -1
- package/docs/MIGRATION.md +72 -1
- package/docs/contracts/settings-classes.md +35 -65
- package/docs/guidelines/agent-infra/active-remediation-mechanics.md +39 -0
- package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/cross-source-consistency-mechanics.md +8 -10
- package/docs/guidelines/agent-infra/frontier-reasoning-operating-profile.md +3 -2
- package/docs/guidelines/agent-infra/layered-settings.md +13 -1
- package/docs/guidelines/agent-infra/roadmap-progress-mechanics.md +1 -1
- package/docs/guidelines/agent-infra/self-improvement-pipeline.md +10 -3
- package/docs/guidelines/agent-infra/size-and-scope.md +36 -0
- package/docs/guidelines/design-antipatterns.md +1 -1
- package/docs/guidelines/php/git.md +15 -2
- package/package.json +4 -3
- package/src/agent-src/scripts/gate_budget.ts +47 -23
- package/src/agent-src/scripts/gate_execute.ts +12 -4
- package/src/agent-src/templates/AGENTS.md +1 -1
- package/src/agent-src/templates/scripts/work_engine/_lib/agent_settings.ts +0 -6
- package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +11 -7
- package/src/agent-src/templates/scripts/work_engine/hooks/builtin/decision_trace.ts +3 -2
- package/src/agent-src/templates/scripts/work_engine/hooks/builtin/memory_visibility.ts +2 -1
- package/src/agent-src/templates/scripts/work_engine/hooks/settings.ts +0 -6
- package/src/agent-src/templates/scripts/work_engine/scoring/decision_engine.ts +9 -12
- package/src/agent-src/templates/scripts/work_engine/scoring/memory_visibility.ts +2 -1
- package/src/config/agent-settings.template.yml +79 -312
- package/src/config/agents-paths.yml +16 -0
- package/src/config/assurance-capability-registry.json +7 -3
- package/src/config/ci-local-parity.yml +3 -0
- package/src/config/continuity-surface.json +3 -3
- package/src/config/discovery/packs.yml +17 -1
- package/src/config/evaluator-budgets.json +19 -6
- package/src/config/gate-coverage.yml +65 -23
- package/src/config/gate-violation-baselines.json +56 -16
- package/src/config/gitignore-block.txt +19 -0
- package/src/config/hook-bundle-budget.json +1 -1
- package/src/config/release-gate-locality.yml +2 -1
- package/src/config/routing-coverage-seed.json +55 -6
- package/src/config/rule-law-ceilings.json +12 -6
- package/src/config/rule-obligations.json +833 -0
- package/src/install/installThinLayer.ts +76 -10
- package/src/install/installedRuleLinks.ts +105 -17
- package/src/scripts/_cli/cmd_analyze_session.ts +9 -15
- package/src/scripts/_cli/cmd_conformance.ts +13 -2
- package/src/scripts/_cli/cmd_doctor.ts +10 -10
- package/src/scripts/_cli/cmd_doctor_neighbours.ts +133 -0
- package/src/scripts/_cli/cmd_explain.ts +72 -14
- package/src/scripts/_cli/cmd_git_convention.ts +637 -0
- package/src/scripts/_cli/cmd_settings_check.ts +66 -8
- package/src/scripts/_cli/cmd_settings_get.ts +18 -3
- package/src/scripts/_cli/doctor_execution.ts +72 -1
- package/src/scripts/_dispatch.bash +37 -2
- package/src/scripts/_lib/agent_settings.ts +15 -124
- package/src/scripts/_lib/blocked_by_marker.ts +1 -1
- package/src/scripts/_lib/compile_time_toggles.ts +12 -21
- package/src/scripts/_lib/dispatch_import_closure.ts +163 -0
- package/src/scripts/_lib/git_base_ref.ts +92 -0
- package/src/scripts/_lib/git_convention.ts +291 -0
- package/src/scripts/_lib/git_convention_carrier.ts +389 -0
- package/src/scripts/_lib/git_convention_grammar.ts +246 -0
- package/src/scripts/_lib/git_convention_measure.ts +344 -0
- package/src/scripts/_lib/global_deploy_inventory.ts +74 -0
- package/src/scripts/_lib/graph_feeder_record.ts +236 -13
- package/src/scripts/_lib/installed_layer.ts +448 -23
- package/src/scripts/_lib/knowledge_global.ts +14 -1
- package/src/scripts/_lib/module_reach.ts +456 -0
- package/src/scripts/_lib/neighbour_contradictions.ts +236 -0
- package/src/scripts/_lib/neighbour_tool_use.ts +8 -10
- package/src/scripts/_lib/ratification_artifact.ts +220 -1
- package/src/scripts/_lib/ratification_subject.ts +92 -0
- package/src/scripts/_lib/release_findings_ingest.ts +15 -7
- package/src/scripts/_lib/release_highlights.ts +5 -0
- package/src/scripts/_lib/rule_law_section.ts +1 -1
- package/src/scripts/_lib/rule_obligations.ts +205 -0
- package/src/scripts/_lib/self_repair.ts +1 -1
- package/src/scripts/_lib/settings_removed_keys.ts +173 -0
- package/src/scripts/_lib/svg_dom.ts +318 -0
- package/src/scripts/_lib/svg_geometry.ts +480 -0
- package/src/scripts/_lib/svg_motion.ts +208 -0
- package/src/scripts/_lib/svg_rules.ts +1453 -0
- package/src/scripts/_lib/svg_urls.ts +72 -0
- package/src/scripts/_lib/test_red_state.ts +5 -0
- package/src/scripts/_lib/thin_rules.ts +83 -3
- package/src/scripts/_lib/touched_file_quality.ts +142 -6
- package/src/scripts/_lib/verification_command.ts +59 -0
- package/src/scripts/_lib/verify_clause.ts +27 -17
- package/src/scripts/_lib/worker_budget.ts +1 -1
- package/src/scripts/adr/regenerate_index.ts +16 -1
- package/src/scripts/ai_council/config.ts +7 -7
- package/src/scripts/ai_council/modification_review.ts +100 -0
- package/src/scripts/ai_council/modification_review_questions.ts +90 -0
- package/src/scripts/ai_council/orchestrator.ts +5 -5
- package/src/scripts/ai_council/spend_gate.ts +18 -7
- package/src/scripts/ai_team/config.ts +11 -16
- package/src/scripts/audit_user_type_axis.ts +20 -8
- package/src/scripts/bench_ab_clone.ts +1 -2
- package/src/scripts/bench_concern_spawn_path.ts +129 -0
- package/src/scripts/bench_graph_feeder_latency.ts +584 -0
- package/src/scripts/check_agent_artifact_location.ts +36 -0
- package/src/scripts/check_branch_freshness.ts +147 -24
- package/src/scripts/check_enforcement_coverage.ts +130 -0
- package/src/scripts/check_evaluator_budgets.ts +4 -0
- package/src/scripts/check_finding_dispositions.ts +88 -25
- package/src/scripts/check_gate_coverage.ts +4 -3
- package/src/scripts/check_gate_reachability.ts +48 -1
- package/src/scripts/check_generator_sync.ts +48 -0
- package/src/scripts/check_hook_bundle_composition.ts +107 -0
- package/src/scripts/check_kernel_edit_ratified.ts +86 -6
- package/src/scripts/check_pack_size.ts +1 -1
- package/src/scripts/check_release_manifest_content.ts +189 -0
- package/src/scripts/check_standing_rule_delivery.ts +96 -0
- package/src/scripts/check_suppression_hygiene.ts +2 -5
- package/src/scripts/ci_settle.ts +42 -5
- package/src/scripts/classify_merge_risk.ts +320 -0
- package/src/scripts/closure_scan.ts +91 -1
- package/src/scripts/command_suggester/settings.ts +8 -108
- package/src/scripts/command_suggester/types.ts +4 -5
- package/src/scripts/consumer_matrix.ts +102 -0
- package/src/scripts/context_hygiene_hook.ts +13 -23
- package/src/scripts/cost/preflight.mjs +12 -1
- package/src/scripts/council_cli.ts +7 -7
- package/src/scripts/dispatch_r2_reviewer.ts +24 -11
- package/src/scripts/explain_run.ts +8 -13
- package/src/scripts/generate_git_convention_grammar.ts +127 -0
- package/src/scripts/generate_host_cost_table.ts +20 -3
- package/src/scripts/handoff_context_hook.ts +86 -37
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +25 -6
- package/src/scripts/hooks/block_config_weakening.ts +48 -5
- package/src/scripts/hooks/block_plumbing_writes.ts +8 -4
- package/src/scripts/hooks/block_speaking_inbox_dir.ts +16 -1
- package/src/scripts/hooks/concern_registry.ts +2 -0
- package/src/scripts/hooks/delegation_nudge_hook.ts +2 -3
- package/src/scripts/hooks/design_pass_hook.ts +157 -3
- package/src/scripts/hooks/evidence_independence.ts +12 -4
- package/src/scripts/hooks/mcp_usage_observation_hook.ts +121 -0
- package/src/scripts/hooks/push_settle_hook.ts +4 -3
- package/src/scripts/hooks/rule_inject_hook.ts +44 -3
- package/src/scripts/hooks/state_io.ts +8 -4
- package/src/scripts/hooks/svg_obligation.ts +497 -0
- package/src/scripts/hooks/svg_rules_loader.ts +133 -0
- package/src/scripts/hooks/telemetry_usage_hook.ts +7 -46
- package/src/scripts/hooks/turn_end_gate_hook.ts +6 -3
- package/src/scripts/install-hooks.sh +42 -14
- package/src/scripts/install.ts +7 -31
- package/src/scripts/lint_blocker_citations.ts +198 -0
- package/src/scripts/lint_consolidation_lineage.ts +6 -3
- package/src/scripts/lint_design_quality.ts +60 -12
- package/src/scripts/lint_evidence_artifacts.ts +9 -0
- package/src/scripts/lint_hook_concern_budget.ts +10 -21
- package/src/scripts/lint_motion_authority_drift.ts +27 -0
- package/src/scripts/lint_pack_boundaries.ts +406 -28
- package/src/scripts/lint_roadmap_blockers.ts +282 -29
- package/src/scripts/lint_roadmap_complexity.ts +4 -2
- package/src/scripts/lint_rule_law_section.ts +151 -21
- package/src/scripts/lint_rule_skill_pack_reach.ts +17 -0
- package/src/scripts/lint_settings_classes.ts +1 -1
- package/src/scripts/lint_svg_asset.ts +365 -0
- package/src/scripts/lint_ticked_unmet_criteria.ts +165 -0
- package/src/scripts/lint_workflow_security.ts +12 -1
- package/src/scripts/measure_skill_ranker_baseline.ts +5 -0
- package/src/scripts/model_rule_injection.ts +3 -3
- package/src/scripts/onboarding_gate_hook.ts +7 -6
- package/src/scripts/print_required_checks.ts +15 -3
- package/src/scripts/probe_host_compliance.ts +33 -5
- package/src/scripts/probe_turnaround.ts +183 -3
- package/src/scripts/ratification_header.ts +77 -0
- package/src/scripts/refusal_envelope.ts +138 -0
- package/src/scripts/release_publication.ts +29 -3
- package/src/scripts/report_dispatch_import_closure.ts +76 -0
- package/src/scripts/report_installed_rule_links.ts +118 -1
- package/src/scripts/report_module_reach.ts +212 -0
- package/src/scripts/report_obligation_mechanism.ts +16 -18
- package/src/scripts/report_parked_blockers.ts +222 -0
- package/src/scripts/report_required_checks_drift.ts +196 -0
- package/src/scripts/report_skill_ranker_confusion.ts +103 -2
- package/src/scripts/report_standing_payload_by_host.ts +1 -1
- package/src/scripts/routing_doctor.ts +2 -2
- package/src/scripts/schemas/agent-settings.schema.json +17 -31
- package/src/scripts/schemas/command.schema.json +1 -1
- package/src/scripts/schemas/skill.schema.json +1 -1
- package/src/scripts/self_review_gate.ts +39 -2
- package/src/scripts/skill_tools/score_skill_relevance.ts +28 -19
- package/src/scripts/sync_pr_branch.ts +403 -132
- package/src/scripts/trigger_eval_grandfather.json +0 -16
- package/src/server/schemas/settings.ts +33 -177
- package/src/shared/skillRanking.ts +53 -4
- package/dist/cli-delegate/chunk-NYX3L2PZ.js +0 -99
- package/src/scripts/_lib/config_chain.ts +0 -477
- package/src/scripts/_lib/conformance_report.ts +0 -403
- package/src/scripts/_lib/eval_discrimination.ts +0 -95
- package/src/scripts/_lib/evaluator_promotion.ts +0 -225
- package/src/scripts/_lib/file_slicer.ts +0 -117
- package/src/scripts/_lib/legacy_boundary_map.ts +0 -228
- package/src/scripts/_lib/minimality_tiebreak.ts +0 -168
- package/src/scripts/_lib/overbuild_lens_contract.ts +0 -196
- package/src/scripts/_lib/role_split.ts +0 -338
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
THIN_ENTRY_MARKER,
|
|
3
4
|
readRecentEntries
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-6YQC2HLF.js";
|
|
6
|
+
import {
|
|
7
|
+
detectToolPresence
|
|
8
|
+
} from "./chunk-A4QJ6ENT.js";
|
|
5
9
|
import {
|
|
6
10
|
NO_RED_EVIDENCE_REASON,
|
|
7
11
|
deriveSessionKey,
|
|
@@ -9,9 +13,10 @@ import {
|
|
|
9
13
|
foldRefusal,
|
|
10
14
|
foldShadow,
|
|
11
15
|
hasRedThenGreen,
|
|
16
|
+
isAssetRenderCommand,
|
|
12
17
|
isCiPoll,
|
|
13
18
|
isVacuousOutput,
|
|
14
|
-
|
|
19
|
+
isVerificationAttempt,
|
|
15
20
|
parseRecord,
|
|
16
21
|
parseShadowRecord,
|
|
17
22
|
pendingCount,
|
|
@@ -23,10 +28,7 @@ import {
|
|
|
23
28
|
shadowSetBy,
|
|
24
29
|
statePathFor,
|
|
25
30
|
validateAssumption
|
|
26
|
-
} from "./chunk-
|
|
27
|
-
import {
|
|
28
|
-
readHookStdin
|
|
29
|
-
} from "./chunk-F7DQWYR5.js";
|
|
31
|
+
} from "./chunk-TMWYUOK4.js";
|
|
30
32
|
import {
|
|
31
33
|
LexicalIndex,
|
|
32
34
|
isSqliteAvailableSync,
|
|
@@ -35,9 +37,6 @@ import {
|
|
|
35
37
|
stampUserVersion,
|
|
36
38
|
tokenize
|
|
37
39
|
} from "./chunk-ZBZV2G5R.js";
|
|
38
|
-
import {
|
|
39
|
-
detectToolPresence
|
|
40
|
-
} from "./chunk-A4QJ6ENT.js";
|
|
41
40
|
import {
|
|
42
41
|
ArgparseExit,
|
|
43
42
|
STATUS_SYMBOLS,
|
|
@@ -56,7 +55,7 @@ import {
|
|
|
56
55
|
proseEqual,
|
|
57
56
|
resolveSessionRole,
|
|
58
57
|
splitFrontmatter
|
|
59
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-5GPULQBE.js";
|
|
60
59
|
import "./chunk-FTAISGDQ.js";
|
|
61
60
|
import "./chunk-6V6TA25H.js";
|
|
62
61
|
import "./chunk-ROYYTEZU.js";
|
|
@@ -64,12 +63,15 @@ import "./chunk-BTWUYDGN.js";
|
|
|
64
63
|
import {
|
|
65
64
|
atomicAppendLine,
|
|
66
65
|
probeHostCapabilities
|
|
67
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-MDPPKQCQ.js";
|
|
67
|
+
import "./chunk-DMSZHXZS.js";
|
|
68
68
|
import "./chunk-ULQRUR23.js";
|
|
69
69
|
import {
|
|
70
70
|
hardenedSpawnEnv,
|
|
71
71
|
projectStoreSlug
|
|
72
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-OAFSJBHH.js";
|
|
73
|
+
import "./chunk-IAYTIIQW.js";
|
|
74
|
+
import "./chunk-LQOCRFWT.js";
|
|
73
75
|
import {
|
|
74
76
|
atomic_write_json,
|
|
75
77
|
atomic_write_text,
|
|
@@ -79,45 +81,48 @@ import {
|
|
|
79
81
|
prune_legacy_state_file,
|
|
80
82
|
prune_stale_session_states,
|
|
81
83
|
session_state_file
|
|
82
|
-
} from "./chunk-
|
|
83
|
-
import "./chunk-
|
|
84
|
-
import "./chunk-DMSZHXZS.js";
|
|
85
|
-
import "./chunk-NXEILF2K.js";
|
|
84
|
+
} from "./chunk-7HKRE54K.js";
|
|
85
|
+
import "./chunk-F3QDG2GT.js";
|
|
86
86
|
import "./chunk-DEIV7XP7.js";
|
|
87
|
-
import "./chunk-KB5FZ655.js";
|
|
88
|
-
import "./chunk-JQOM7TTM.js";
|
|
89
87
|
import {
|
|
90
88
|
manifest_path,
|
|
91
89
|
read_manifest
|
|
92
90
|
} from "./chunk-OKJUIAPS.js";
|
|
91
|
+
import "./chunk-WQWXGIWB.js";
|
|
92
|
+
import "./chunk-KB5FZ655.js";
|
|
93
93
|
import "./chunk-MWRD5YOH.js";
|
|
94
|
+
import "./chunk-JQOM7TTM.js";
|
|
94
95
|
import {
|
|
95
96
|
DeadScopeError,
|
|
96
97
|
assertScanned,
|
|
97
98
|
reportScanned
|
|
98
99
|
} from "./chunk-I3EIN2YG.js";
|
|
100
|
+
import {
|
|
101
|
+
readHookStdin
|
|
102
|
+
} from "./chunk-F7DQWYR5.js";
|
|
99
103
|
import {
|
|
100
104
|
require_dist
|
|
101
105
|
} from "./chunk-OY53J6II.js";
|
|
102
|
-
import
|
|
103
|
-
resolvePackageRoot
|
|
104
|
-
} from "./chunk-MCJYCQPF.js";
|
|
106
|
+
import "./chunk-LF2KKJ4Q.js";
|
|
105
107
|
import {
|
|
106
108
|
load_agent_settings
|
|
107
|
-
} from "./chunk-
|
|
108
|
-
import "./chunk-NDJLNC6Q.js";
|
|
109
|
+
} from "./chunk-H76PHZBI.js";
|
|
109
110
|
import {
|
|
110
111
|
artefact_roots
|
|
111
112
|
} from "./chunk-YCU3TIXH.js";
|
|
113
|
+
import "./chunk-T6BP34WI.js";
|
|
114
|
+
import {
|
|
115
|
+
resolvePackageRoot
|
|
116
|
+
} from "./chunk-MCJYCQPF.js";
|
|
112
117
|
import {
|
|
113
118
|
__toESM
|
|
114
119
|
} from "./chunk-J55WI3RR.js";
|
|
115
120
|
|
|
116
121
|
// src/scripts/_cli/cmd_conformance.ts
|
|
117
122
|
var YAML = __toESM(require_dist(), 1);
|
|
118
|
-
import * as
|
|
123
|
+
import * as fs21 from "node:fs";
|
|
119
124
|
import * as os7 from "node:os";
|
|
120
|
-
import * as
|
|
125
|
+
import * as path19 from "node:path";
|
|
121
126
|
import process5 from "node:process";
|
|
122
127
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
123
128
|
import { fileURLToPath as fileURLToPath14, pathToFileURL as pathToFileURL14 } from "node:url";
|
|
@@ -133,10 +138,10 @@ var ROUTE_TARGET_TEMPLATES = Object.freeze({
|
|
|
133
138
|
])
|
|
134
139
|
});
|
|
135
140
|
function parseRouteTarget(target) {
|
|
136
|
-
const
|
|
137
|
-
if (
|
|
138
|
-
const kind = target.slice(0,
|
|
139
|
-
const id = target.slice(
|
|
141
|
+
const sep5 = target.indexOf(":");
|
|
142
|
+
if (sep5 <= 0) return null;
|
|
143
|
+
const kind = target.slice(0, sep5);
|
|
144
|
+
const id = target.slice(sep5 + 1);
|
|
140
145
|
if (!id) return null;
|
|
141
146
|
if (!Object.prototype.hasOwnProperty.call(ROUTE_TARGET_TEMPLATES, kind)) return null;
|
|
142
147
|
return { kind, id };
|
|
@@ -148,17 +153,17 @@ function routeTargetPathsPosix(target) {
|
|
|
148
153
|
}
|
|
149
154
|
|
|
150
155
|
// src/scripts/report_conformance_funnel.ts
|
|
151
|
-
import * as
|
|
156
|
+
import * as fs20 from "node:fs";
|
|
152
157
|
import * as os6 from "node:os";
|
|
153
|
-
import * as
|
|
158
|
+
import * as path18 from "node:path";
|
|
154
159
|
import process4 from "node:process";
|
|
155
160
|
import { fileURLToPath as fileURLToPath13, pathToFileURL as pathToFileURL13 } from "node:url";
|
|
156
161
|
|
|
157
162
|
// src/scripts/conformance_scan.ts
|
|
158
|
-
import { createHash as
|
|
159
|
-
import
|
|
163
|
+
import { createHash as createHash5 } from "node:crypto";
|
|
164
|
+
import fs16 from "node:fs";
|
|
160
165
|
import os2 from "node:os";
|
|
161
|
-
import
|
|
166
|
+
import path14 from "node:path";
|
|
162
167
|
import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL9 } from "node:url";
|
|
163
168
|
|
|
164
169
|
// src/scripts/_lib/transcript_entry.ts
|
|
@@ -1943,8 +1948,8 @@ var COMMAND_OBJECTS = {
|
|
|
1943
1948
|
};
|
|
1944
1949
|
|
|
1945
1950
|
// src/scripts/hooks/turn_end_gate_hook.ts
|
|
1946
|
-
import * as
|
|
1947
|
-
import * as
|
|
1951
|
+
import * as fs13 from "node:fs";
|
|
1952
|
+
import * as path11 from "node:path";
|
|
1948
1953
|
import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL6 } from "node:url";
|
|
1949
1954
|
|
|
1950
1955
|
// src/scripts/check_reply_consistency.ts
|
|
@@ -2111,11 +2116,11 @@ function _rglobMdSorted(dir) {
|
|
|
2111
2116
|
return out;
|
|
2112
2117
|
}
|
|
2113
2118
|
function _relToPosixOrAbs(child, root) {
|
|
2114
|
-
const
|
|
2115
|
-
if (
|
|
2119
|
+
const rel2 = path3.relative(root, child);
|
|
2120
|
+
if (rel2 === "" || rel2.startsWith("..") || path3.isAbsolute(rel2)) {
|
|
2116
2121
|
return child.split(path3.sep).join("/");
|
|
2117
2122
|
}
|
|
2118
|
-
return
|
|
2123
|
+
return rel2.split(path3.sep).join("/");
|
|
2119
2124
|
}
|
|
2120
2125
|
function cmd_scan_dir(root) {
|
|
2121
2126
|
let roots;
|
|
@@ -2502,8 +2507,8 @@ function looksLikeGraph(p) {
|
|
|
2502
2507
|
function detectSources(root, nativeCache) {
|
|
2503
2508
|
const abs = path4.resolve(root);
|
|
2504
2509
|
const out = [];
|
|
2505
|
-
for (const
|
|
2506
|
-
const p = path4.join(abs,
|
|
2510
|
+
for (const rel2 of consumerCandidates(abs)) {
|
|
2511
|
+
const p = path4.join(abs, rel2);
|
|
2507
2512
|
if (fs4.existsSync(p)) {
|
|
2508
2513
|
const { ok, sha } = looksLikeGraph(p);
|
|
2509
2514
|
if (ok) out.push({ kind: "consumer", path: p, present: true, ...freshness(abs, p, sha) });
|
|
@@ -3139,10 +3144,51 @@ function untested(g, files, state) {
|
|
|
3139
3144
|
|
|
3140
3145
|
// src/scripts/_lib/graph_feeder_record.ts
|
|
3141
3146
|
var MAX_PATHS = 5;
|
|
3147
|
+
var OUTSIDE_WORKSPACE = "<outside-workspace>";
|
|
3142
3148
|
var MAX_ROWS_PER_SESSION = 200;
|
|
3143
3149
|
function feederFile(workspaceRoot, sessionKey) {
|
|
3144
3150
|
return path6.join(workspaceRoot, "agents", "state", "graph-feeder", `${sessionKey}.jsonl`);
|
|
3145
3151
|
}
|
|
3152
|
+
function toRepoRelative(root, paths) {
|
|
3153
|
+
let realRoot = null;
|
|
3154
|
+
return paths.map((p) => {
|
|
3155
|
+
if (!path6.isAbsolute(p)) return p;
|
|
3156
|
+
const raw = _relativeInside(root, p);
|
|
3157
|
+
if (raw !== null) return raw;
|
|
3158
|
+
realRoot ??= _resolveReal(root);
|
|
3159
|
+
return _relativeInside(realRoot, _resolveReal(p)) ?? p;
|
|
3160
|
+
});
|
|
3161
|
+
}
|
|
3162
|
+
function _relativeInside(from, to) {
|
|
3163
|
+
let rel2;
|
|
3164
|
+
try {
|
|
3165
|
+
rel2 = path6.relative(from, to);
|
|
3166
|
+
} catch {
|
|
3167
|
+
return null;
|
|
3168
|
+
}
|
|
3169
|
+
if (rel2 === "") return ".";
|
|
3170
|
+
if (rel2 === ".." || rel2.startsWith(`..${path6.sep}`) || path6.isAbsolute(rel2)) return null;
|
|
3171
|
+
return rel2.split(path6.sep).join("/");
|
|
3172
|
+
}
|
|
3173
|
+
function _resolveReal(p) {
|
|
3174
|
+
const abs = path6.resolve(p);
|
|
3175
|
+
const tail = [];
|
|
3176
|
+
let cur = abs;
|
|
3177
|
+
for (; ; ) {
|
|
3178
|
+
try {
|
|
3179
|
+
const real = fs7.realpathSync(cur);
|
|
3180
|
+
return tail.length === 0 ? real : path6.join(real, ...[...tail].reverse());
|
|
3181
|
+
} catch {
|
|
3182
|
+
const parent = path6.dirname(cur);
|
|
3183
|
+
if (parent === cur) return abs;
|
|
3184
|
+
tail.push(path6.basename(cur));
|
|
3185
|
+
cur = parent;
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3188
|
+
}
|
|
3189
|
+
function _escapesWorkspace(p) {
|
|
3190
|
+
return path6.isAbsolute(p) || path6.win32.isAbsolute(p) || p === ".." || p.startsWith("../") || p.startsWith(`..${path6.sep}`);
|
|
3191
|
+
}
|
|
3146
3192
|
function graphUntestedVerdict(root, state, paths) {
|
|
3147
3193
|
const none = { verdict: null, untested: 0, tested: 0 };
|
|
3148
3194
|
if (state !== "fresh" && state !== "edited") return none;
|
|
@@ -3161,7 +3207,7 @@ function graphUntestedVerdict(root, state, paths) {
|
|
|
3161
3207
|
return none;
|
|
3162
3208
|
}
|
|
3163
3209
|
try {
|
|
3164
|
-
const r = untested(g, paths, state);
|
|
3210
|
+
const r = untested(g, toRepoRelative(root, paths), state);
|
|
3165
3211
|
if (r.seeds.length === 0) return { verdict: "no-seeds", untested: 0, tested: 0 };
|
|
3166
3212
|
return {
|
|
3167
3213
|
verdict: r.untested.length > 0 ? "untested" : "tested",
|
|
@@ -3203,11 +3249,215 @@ function buildFeederRow(input) {
|
|
|
3203
3249
|
graph: input.graph.verdict,
|
|
3204
3250
|
graph_untested: input.graph.untested,
|
|
3205
3251
|
graph_tested: input.graph.tested,
|
|
3206
|
-
|
|
3252
|
+
// An out-of-workspace edit is REDACTED, not dropped and not stored
|
|
3253
|
+
// verbatim. After relativising, a still-absolute path is exactly one
|
|
3254
|
+
// that lay outside the root.
|
|
3255
|
+
//
|
|
3256
|
+
// Verbatim is an egress surface: `paths` is handed to external council
|
|
3257
|
+
// seats at step 3.3's labelling, and a home-rooted path names a real
|
|
3258
|
+
// user and an unrelated project.
|
|
3259
|
+
//
|
|
3260
|
+
// Dropping it looked right and was worse, which a completion review
|
|
3261
|
+
// caught before it shipped. It would have shortened `paths` below
|
|
3262
|
+
// `path_count` and so reused the protocol's truncation signal for a
|
|
3263
|
+
// second, different cause — two meanings on one wire, with no field
|
|
3264
|
+
// separating them. Worse, a turn editing one in-repo file and one file
|
|
3265
|
+
// outside the root would then be excluded from labelling altogether,
|
|
3266
|
+
// losing a perfectly labellable in-repo path from a corpus that is
|
|
3267
|
+
// blocked precisely for want of rows.
|
|
3268
|
+
//
|
|
3269
|
+
// The marker keeps the lengths equal, so truncation stays the only
|
|
3270
|
+
// cause of `path_count > paths.length`; keeps the row honest that an
|
|
3271
|
+
// edit happened outside the tree, so a labeller can answer
|
|
3272
|
+
// `cannot tell` rather than be silently misled; and carries nothing
|
|
3273
|
+
// identifying. The graph's answer is unchanged either way — the probe
|
|
3274
|
+
// sees the real path and resolves no seeds for it.
|
|
3275
|
+
paths: toRepoRelative(input.root, input.paths.slice(0, MAX_PATHS)).map(
|
|
3276
|
+
(p) => _escapesWorkspace(p) ? OUTSIDE_WORKSPACE : p
|
|
3277
|
+
),
|
|
3207
3278
|
path_count: input.paths.length
|
|
3208
3279
|
};
|
|
3209
3280
|
}
|
|
3210
3281
|
|
|
3282
|
+
// src/scripts/hooks/svg_obligation.ts
|
|
3283
|
+
import * as crypto from "node:crypto";
|
|
3284
|
+
import * as fs8 from "node:fs";
|
|
3285
|
+
import * as path7 from "node:path";
|
|
3286
|
+
var EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
|
|
3287
|
+
var RENDER_REL = path7.join("agents", "runtime", "state", "render");
|
|
3288
|
+
var PLANTED_PREFIXES = [
|
|
3289
|
+
"tests/design-artifacts/fixtures/",
|
|
3290
|
+
"tests/design-artifacts/scenarios/"
|
|
3291
|
+
];
|
|
3292
|
+
function hasErrorFinding(m) {
|
|
3293
|
+
const f = m.asset?.findings;
|
|
3294
|
+
return Array.isArray(f) && f.some((x) => x?.severity === "error");
|
|
3295
|
+
}
|
|
3296
|
+
var rel = (root, p) => {
|
|
3297
|
+
const slashed = p.split(path7.sep).join("/");
|
|
3298
|
+
if (!path7.isAbsolute(p)) return path7.posix.normalize(slashed).replace(/^\.\//, "");
|
|
3299
|
+
const inside = path7.relative(root, p).split(path7.sep).join("/");
|
|
3300
|
+
return inside === "" || inside.startsWith("../") ? slashed : inside;
|
|
3301
|
+
};
|
|
3302
|
+
function isPlantedFixture(relPath, root = "") {
|
|
3303
|
+
const norm = rel(root, relPath);
|
|
3304
|
+
return PLANTED_PREFIXES.some((prefix) => norm.startsWith(prefix));
|
|
3305
|
+
}
|
|
3306
|
+
function readAssetManifests(root) {
|
|
3307
|
+
const dir = path7.join(root, RENDER_REL);
|
|
3308
|
+
let entries;
|
|
3309
|
+
try {
|
|
3310
|
+
entries = fs8.readdirSync(dir);
|
|
3311
|
+
} catch {
|
|
3312
|
+
return [];
|
|
3313
|
+
}
|
|
3314
|
+
const out = [];
|
|
3315
|
+
for (const name of entries) {
|
|
3316
|
+
let raw;
|
|
3317
|
+
try {
|
|
3318
|
+
raw = fs8.readFileSync(path7.join(dir, name, "manifest.json"), "utf8");
|
|
3319
|
+
} catch {
|
|
3320
|
+
continue;
|
|
3321
|
+
}
|
|
3322
|
+
try {
|
|
3323
|
+
const parsed = JSON.parse(raw);
|
|
3324
|
+
if (parsed.profile === "asset") out.push(parsed);
|
|
3325
|
+
} catch {
|
|
3326
|
+
}
|
|
3327
|
+
}
|
|
3328
|
+
return out;
|
|
3329
|
+
}
|
|
3330
|
+
function dischargeFor(manifests, digest) {
|
|
3331
|
+
let staticOnly = false;
|
|
3332
|
+
for (const m of manifests) {
|
|
3333
|
+
if (m.verification === "verified" && m.asset?.digest === digest && !hasErrorFinding(m)) {
|
|
3334
|
+
return "verified";
|
|
3335
|
+
}
|
|
3336
|
+
if (m.reason === "renderer-absent" && m.static?.digest === digest && m.static.errors === 0) {
|
|
3337
|
+
staticOnly = true;
|
|
3338
|
+
}
|
|
3339
|
+
}
|
|
3340
|
+
return staticOnly ? "static-only" : null;
|
|
3341
|
+
}
|
|
3342
|
+
function readSvgObligations(root, inputs) {
|
|
3343
|
+
const open = [];
|
|
3344
|
+
const discharged = [];
|
|
3345
|
+
const seen = /* @__PURE__ */ new Set();
|
|
3346
|
+
let manifests = null;
|
|
3347
|
+
for (const { path: raw, rendered } of inputs.edits) {
|
|
3348
|
+
if (!/\.svg$/i.test(raw)) continue;
|
|
3349
|
+
const relPath = rel(root, raw);
|
|
3350
|
+
if (seen.has(relPath)) continue;
|
|
3351
|
+
seen.add(relPath);
|
|
3352
|
+
if (isPlantedFixture(relPath, root)) continue;
|
|
3353
|
+
const abs = path7.isAbsolute(raw) ? raw : path7.join(root, relPath);
|
|
3354
|
+
let bytes;
|
|
3355
|
+
try {
|
|
3356
|
+
bytes = fs8.readFileSync(abs);
|
|
3357
|
+
} catch {
|
|
3358
|
+
continue;
|
|
3359
|
+
}
|
|
3360
|
+
const digest = crypto.createHash("sha256").update(bytes).digest("hex");
|
|
3361
|
+
if (!renderNames(rendered, relPath)) {
|
|
3362
|
+
open.push({
|
|
3363
|
+
file: relPath,
|
|
3364
|
+
reason: "no `ui:render --profile asset` naming this file ran after THIS file's last edit, so no manifest on disk can be attributed to it \u2014 a manifest written by any other route, and a render of some other file, both discharge nothing"
|
|
3365
|
+
});
|
|
3366
|
+
continue;
|
|
3367
|
+
}
|
|
3368
|
+
if (inputs.renderDirTampered) {
|
|
3369
|
+
open.push({
|
|
3370
|
+
file: relPath,
|
|
3371
|
+
reason: "this turn wrote into the render directory by a route other than `ui:render`, so no manifest there is evidence of a render \u2014 re-run the render in a turn that does not touch it"
|
|
3372
|
+
});
|
|
3373
|
+
continue;
|
|
3374
|
+
}
|
|
3375
|
+
manifests ??= readAssetManifests(root);
|
|
3376
|
+
const kind = dischargeFor(manifests, digest);
|
|
3377
|
+
if (kind === null) {
|
|
3378
|
+
open.push({
|
|
3379
|
+
file: relPath,
|
|
3380
|
+
reason: "no asset manifest matches this file's current digest \u2014 a render that is `verified`, or a `renderer-absent` one whose static witness reports 0 errors on the same digest, discharges it"
|
|
3381
|
+
});
|
|
3382
|
+
continue;
|
|
3383
|
+
}
|
|
3384
|
+
discharged.push({ file: relPath, kind });
|
|
3385
|
+
}
|
|
3386
|
+
return { open, discharged };
|
|
3387
|
+
}
|
|
3388
|
+
function renderNames(commands, relPath) {
|
|
3389
|
+
const base = relPath.split("/").pop() ?? relPath;
|
|
3390
|
+
return commands.some((c) => {
|
|
3391
|
+
const slashed = c.split(path7.sep).join("/");
|
|
3392
|
+
const bounded = (needle) => new RegExp(`(^|[\\s/'"])${escapeRe(needle)}(\\s|$|['"])`).test(slashed);
|
|
3393
|
+
return bounded(relPath) || bounded(base);
|
|
3394
|
+
});
|
|
3395
|
+
}
|
|
3396
|
+
function isPureRender(command) {
|
|
3397
|
+
if (!isAssetRenderCommand(command)) return false;
|
|
3398
|
+
const [head, ...pipes] = command.replace(/^\s*cd\s+[^;&|<>`$\n]+&&\s*/, "").replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ").split("|");
|
|
3399
|
+
if (/[;&<>`\n]|\$\(/.test(head ?? "")) return false;
|
|
3400
|
+
return pipes.every((p) => /^\s*(tail|head|grep|jq|cat|less|wc)\b[^;&<>`|]*$/.test(p) && !/\$\(/.test(p));
|
|
3401
|
+
}
|
|
3402
|
+
function writesRenderDir(command) {
|
|
3403
|
+
if (isPureRender(command)) return false;
|
|
3404
|
+
const slashed = command.split(path7.sep).join("/");
|
|
3405
|
+
const names = /(^|[\s/'"])(render\/|manifest\.json\b)/.test(slashed) || slashed.includes("state/render");
|
|
3406
|
+
const writes = />(?!&)|\b(tee|sponge)\b|\b(cp|mv|ln|install|rsync|dd)\s|\bsed\s+-i|\bwriteFile|\b(python[\d.]*|perl|ruby|node|deno|bun|php|osascript)\b/.test(
|
|
3407
|
+
slashed.replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ")
|
|
3408
|
+
);
|
|
3409
|
+
return names && writes;
|
|
3410
|
+
}
|
|
3411
|
+
function escapeRe(s) {
|
|
3412
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3413
|
+
}
|
|
3414
|
+
function openSvgObligation(workspaceRoot, toolCalls) {
|
|
3415
|
+
const lastEditOf = /* @__PURE__ */ new Map();
|
|
3416
|
+
for (let i = 0; i < toolCalls.length; i += 1) {
|
|
3417
|
+
const c = toolCalls[i];
|
|
3418
|
+
if (!EDIT_TOOLS.has(c.name) || c.path === void 0) continue;
|
|
3419
|
+
lastEditOf.set(c.path, i);
|
|
3420
|
+
}
|
|
3421
|
+
if (lastEditOf.size === 0) return null;
|
|
3422
|
+
const edits = [...lastEditOf].map(([p, at]) => {
|
|
3423
|
+
const rendered = [];
|
|
3424
|
+
for (let i = at + 1; i < toolCalls.length; i += 1) {
|
|
3425
|
+
const c = toolCalls[i];
|
|
3426
|
+
if (c.name === "Bash" && c.command !== void 0 && isPureRender(c.command)) {
|
|
3427
|
+
rendered.push(c.command);
|
|
3428
|
+
}
|
|
3429
|
+
}
|
|
3430
|
+
return { path: p, rendered };
|
|
3431
|
+
});
|
|
3432
|
+
const renderDir = RENDER_REL.split(path7.sep).join("/");
|
|
3433
|
+
const renderDirTampered = toolCalls.some((c) => {
|
|
3434
|
+
if (EDIT_TOOLS.has(c.name) && c.path !== void 0) {
|
|
3435
|
+
return rel(workspaceRoot, c.path).startsWith(`${renderDir}/`);
|
|
3436
|
+
}
|
|
3437
|
+
return c.name === "Bash" && c.command !== void 0 && writesRenderDir(c.command);
|
|
3438
|
+
});
|
|
3439
|
+
let reading;
|
|
3440
|
+
try {
|
|
3441
|
+
reading = readSvgObligations(workspaceRoot, { edits, renderDirTampered });
|
|
3442
|
+
} catch {
|
|
3443
|
+
return null;
|
|
3444
|
+
}
|
|
3445
|
+
const first = reading.open[0];
|
|
3446
|
+
if (first === void 0) return null;
|
|
3447
|
+
const more = reading.open.length > 1 ? ` (and ${String(reading.open.length - 1)} more)` : "";
|
|
3448
|
+
return {
|
|
3449
|
+
// Reported under `verification` rather than a seventh detector id: it
|
|
3450
|
+
// IS a verification finding — a file changed and nothing that can fail
|
|
3451
|
+
// ran over it — and a new id would ripple through DETECTOR_IDS, the
|
|
3452
|
+
// per-detector counters and the demotion contract for a distinction the
|
|
3453
|
+
// operator never makes.
|
|
3454
|
+
detector: "verification",
|
|
3455
|
+
mode: "transcript",
|
|
3456
|
+
evidence: first.file,
|
|
3457
|
+
reason: `this turn edited an .svg and no render describes it${more} \u2014 ${first.reason}. A bare \`ui:render --profile asset\` that rendered nothing, and a test or lint run over other files, both discharge nothing: the gate reads the render, never the call.`
|
|
3458
|
+
};
|
|
3459
|
+
}
|
|
3460
|
+
|
|
3211
3461
|
// src/scripts/hooks/envelope.ts
|
|
3212
3462
|
var ENVELOPE_KEYS = [
|
|
3213
3463
|
"schema_version",
|
|
@@ -3263,9 +3513,9 @@ function unwrap(stdin_text, default_platform = "generic") {
|
|
|
3263
3513
|
}
|
|
3264
3514
|
|
|
3265
3515
|
// src/scripts/hooks/subagent_ledger_hook.ts
|
|
3266
|
-
import * as
|
|
3267
|
-
import * as
|
|
3268
|
-
import * as
|
|
3516
|
+
import * as crypto2 from "node:crypto";
|
|
3517
|
+
import * as fs9 from "node:fs";
|
|
3518
|
+
import * as path8 from "node:path";
|
|
3269
3519
|
import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL4 } from "node:url";
|
|
3270
3520
|
|
|
3271
3521
|
// src/scripts/_lib/subagent_response.ts
|
|
@@ -3407,11 +3657,11 @@ var EXIT_CODES = Object.freeze([
|
|
|
3407
3657
|
function isObject2(v) {
|
|
3408
3658
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
3409
3659
|
}
|
|
3410
|
-
var LEDGER_DIR =
|
|
3660
|
+
var LEDGER_DIR = path8.join("agents", "runtime", "state", "subagent-ledger");
|
|
3411
3661
|
var OPEN_SUBDIR = "open";
|
|
3412
3662
|
var OPEN_RECORD_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
3413
3663
|
function refFor(agentId) {
|
|
3414
|
-
return
|
|
3664
|
+
return crypto2.createHash("sha256").update(agentId, "utf8").digest("hex").slice(0, 12);
|
|
3415
3665
|
}
|
|
3416
3666
|
function unwrapPayload(envelope) {
|
|
3417
3667
|
const inner = envelope["payload"];
|
|
@@ -3497,10 +3747,10 @@ function _jsonObjectCandidates(message) {
|
|
|
3497
3747
|
return out;
|
|
3498
3748
|
}
|
|
3499
3749
|
function openDir(root) {
|
|
3500
|
-
return
|
|
3750
|
+
return path8.join(root, LEDGER_DIR, OPEN_SUBDIR);
|
|
3501
3751
|
}
|
|
3502
3752
|
function openFile(root, ref) {
|
|
3503
|
-
return
|
|
3753
|
+
return path8.join(openDir(root), `${ref}.json`);
|
|
3504
3754
|
}
|
|
3505
3755
|
var DEPTH_BASES = /* @__PURE__ */ new Set(["observed", "asserted-parent", "assumed-root"]);
|
|
3506
3756
|
function _asOpenRecord(value, expectedRef) {
|
|
@@ -3527,7 +3777,7 @@ function readOpenRecords(root) {
|
|
|
3527
3777
|
const out = /* @__PURE__ */ new Map();
|
|
3528
3778
|
let names;
|
|
3529
3779
|
try {
|
|
3530
|
-
names =
|
|
3780
|
+
names = fs9.readdirSync(openDir(root));
|
|
3531
3781
|
} catch {
|
|
3532
3782
|
return out;
|
|
3533
3783
|
}
|
|
@@ -3535,7 +3785,7 @@ function readOpenRecords(root) {
|
|
|
3535
3785
|
if (!name.endsWith(".json")) continue;
|
|
3536
3786
|
const expectedRef = name.slice(0, -".json".length);
|
|
3537
3787
|
try {
|
|
3538
|
-
const raw =
|
|
3788
|
+
const raw = fs9.readFileSync(path8.join(openDir(root), name), "utf8");
|
|
3539
3789
|
const rec = _asOpenRecord(JSON.parse(raw), expectedRef);
|
|
3540
3790
|
if (rec) out.set(rec.ref, rec);
|
|
3541
3791
|
} catch {
|
|
@@ -3550,13 +3800,13 @@ function resolveDepth(parentRef, open) {
|
|
|
3550
3800
|
return { depth: parent.depth + 1, depth_basis: "observed" };
|
|
3551
3801
|
}
|
|
3552
3802
|
function ledgerFileFor2(root, ts) {
|
|
3553
|
-
return
|
|
3803
|
+
return path8.join(root, LEDGER_DIR, `${ts.slice(0, 7)}.jsonl`);
|
|
3554
3804
|
}
|
|
3555
3805
|
function appendLedgerLine(root, ts, line) {
|
|
3556
3806
|
if (is_replay_mode()) return;
|
|
3557
3807
|
const file = ledgerFileFor2(root, ts);
|
|
3558
|
-
|
|
3559
|
-
|
|
3808
|
+
fs9.mkdirSync(path8.dirname(file), { recursive: true });
|
|
3809
|
+
fs9.appendFileSync(file, `${JSON.stringify(line)}
|
|
3560
3810
|
`, "utf8");
|
|
3561
3811
|
}
|
|
3562
3812
|
var WALL_CLOCK_ARMS_MS = [
|
|
@@ -3570,7 +3820,7 @@ function armsExceeded(elapsedMs) {
|
|
|
3570
3820
|
return WALL_CLOCK_ARMS_MS.filter((a) => elapsedMs >= a.ms).map((a) => a.label);
|
|
3571
3821
|
}
|
|
3572
3822
|
function openRecordStats(root, nowMs = Date.now()) {
|
|
3573
|
-
const ledgerPresent =
|
|
3823
|
+
const ledgerPresent = fs9.existsSync(path8.join(root, LEDGER_DIR));
|
|
3574
3824
|
const open = readOpenRecords(root);
|
|
3575
3825
|
let maxDepth = 0;
|
|
3576
3826
|
let counted = 0;
|
|
@@ -3598,13 +3848,13 @@ function writeOpenRecord(root, rec) {
|
|
|
3598
3848
|
function removeOpenRecord(root, ref) {
|
|
3599
3849
|
if (is_replay_mode()) return;
|
|
3600
3850
|
try {
|
|
3601
|
-
|
|
3851
|
+
fs9.unlinkSync(openFile(root, ref));
|
|
3602
3852
|
} catch {
|
|
3603
3853
|
}
|
|
3604
3854
|
}
|
|
3605
3855
|
function countOpen(root) {
|
|
3606
3856
|
try {
|
|
3607
|
-
return
|
|
3857
|
+
return fs9.readdirSync(openDir(root)).filter((n) => n.endsWith(".json")).length;
|
|
3608
3858
|
} catch {
|
|
3609
3859
|
return 0;
|
|
3610
3860
|
}
|
|
@@ -3770,10 +4020,10 @@ function _isCliEntry4() {
|
|
|
3770
4020
|
return false;
|
|
3771
4021
|
}
|
|
3772
4022
|
if (process.argv[1] === void 0) return false;
|
|
3773
|
-
const argvUrl = pathToFileURL4(
|
|
4023
|
+
const argvUrl = pathToFileURL4(path8.resolve(process.argv[1])).href;
|
|
3774
4024
|
if (import.meta.url === argvUrl) return true;
|
|
3775
4025
|
try {
|
|
3776
|
-
return
|
|
4026
|
+
return fs9.realpathSync(fileURLToPath4(import.meta.url)) === fs9.realpathSync(path8.resolve(process.argv[1]));
|
|
3777
4027
|
} catch {
|
|
3778
4028
|
return false;
|
|
3779
4029
|
}
|
|
@@ -3781,20 +4031,20 @@ function _isCliEntry4() {
|
|
|
3781
4031
|
if (_isCliEntry4()) process.exit(main4());
|
|
3782
4032
|
|
|
3783
4033
|
// src/scripts/_lib/turn_end_transcript.ts
|
|
3784
|
-
import * as
|
|
4034
|
+
import * as fs12 from "node:fs";
|
|
3785
4035
|
|
|
3786
4036
|
// src/scripts/hooks/end_review_nudge_hook.ts
|
|
3787
4037
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
3788
|
-
import * as
|
|
3789
|
-
import * as
|
|
4038
|
+
import * as crypto3 from "node:crypto";
|
|
4039
|
+
import * as fs11 from "node:fs";
|
|
3790
4040
|
import * as os from "node:os";
|
|
3791
|
-
import * as
|
|
4041
|
+
import * as path10 from "node:path";
|
|
3792
4042
|
import { fileURLToPath as fileURLToPath5, pathToFileURL as pathToFileURL5 } from "node:url";
|
|
3793
4043
|
|
|
3794
4044
|
// src/scripts/_lib/review_baseline.ts
|
|
3795
4045
|
import { spawnSync } from "node:child_process";
|
|
3796
|
-
import * as
|
|
3797
|
-
import * as
|
|
4046
|
+
import * as fs10 from "node:fs";
|
|
4047
|
+
import * as path9 from "node:path";
|
|
3798
4048
|
function currentHeadSha(cwd) {
|
|
3799
4049
|
try {
|
|
3800
4050
|
const r = spawnSync("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf8" });
|
|
@@ -3805,12 +4055,12 @@ function currentHeadSha(cwd) {
|
|
|
3805
4055
|
return null;
|
|
3806
4056
|
}
|
|
3807
4057
|
}
|
|
3808
|
-
var BASELINE_STATE_REL =
|
|
4058
|
+
var BASELINE_STATE_REL = path9.join("agents", "runtime", "state", "review-baseline");
|
|
3809
4059
|
function baselineStateDir(workspaceRoot) {
|
|
3810
|
-
return
|
|
4060
|
+
return path9.join(workspaceRoot, BASELINE_STATE_REL);
|
|
3811
4061
|
}
|
|
3812
4062
|
function baselineStateFile(workspaceRoot, sessionKey) {
|
|
3813
|
-
return
|
|
4063
|
+
return path9.join(baselineStateDir(workspaceRoot), `${sessionKey}.json`);
|
|
3814
4064
|
}
|
|
3815
4065
|
function parseBaseline(raw) {
|
|
3816
4066
|
let decoded;
|
|
@@ -3838,7 +4088,7 @@ function readBaseline(workspaceRoot, sessionKey) {
|
|
|
3838
4088
|
const file = baselineStateFile(workspaceRoot, sessionKey);
|
|
3839
4089
|
let raw;
|
|
3840
4090
|
try {
|
|
3841
|
-
raw =
|
|
4091
|
+
raw = fs10.readFileSync(file, "utf-8");
|
|
3842
4092
|
} catch (exc) {
|
|
3843
4093
|
const code = exc?.code;
|
|
3844
4094
|
return code === "ENOENT" ? "absent" : "unreadable";
|
|
@@ -3948,13 +4198,13 @@ function isSafeTranscriptPath(rawPath, opts = {}) {
|
|
|
3948
4198
|
const homeDir = opts.homeDir ?? os.homedir();
|
|
3949
4199
|
const maxBytes = opts.maxBytes ?? TRANSCRIPT_SCAN_MAX_BYTES;
|
|
3950
4200
|
try {
|
|
3951
|
-
const realHome =
|
|
3952
|
-
const realPath =
|
|
3953
|
-
const
|
|
3954
|
-
if (
|
|
4201
|
+
const realHome = fs11.realpathSync(homeDir);
|
|
4202
|
+
const realPath = fs11.realpathSync(rawPath);
|
|
4203
|
+
const relative6 = path10.relative(realHome, realPath);
|
|
4204
|
+
if (relative6 === "" || relative6.startsWith("..") || path10.isAbsolute(relative6)) {
|
|
3955
4205
|
return false;
|
|
3956
4206
|
}
|
|
3957
|
-
const { size } =
|
|
4207
|
+
const { size } = fs11.statSync(realPath);
|
|
3958
4208
|
return size <= maxBytes;
|
|
3959
4209
|
} catch {
|
|
3960
4210
|
return false;
|
|
@@ -4012,13 +4262,13 @@ var BINARY_PROBE_BYTES = 8e3;
|
|
|
4012
4262
|
var UNTRACKED_FILE_READ_CAP_BYTES = 8 * 1024 * 1024;
|
|
4013
4263
|
function untrackedFileLineCount(cwd, relPath) {
|
|
4014
4264
|
try {
|
|
4015
|
-
const abs =
|
|
4016
|
-
const size =
|
|
4265
|
+
const abs = path10.resolve(cwd, relPath);
|
|
4266
|
+
const size = fs11.statSync(abs).size;
|
|
4017
4267
|
if (size === 0) return 0;
|
|
4018
4268
|
if (size > UNTRACKED_FILE_READ_CAP_BYTES) {
|
|
4019
4269
|
return MUTATION_LINE_THRESHOLD + 1;
|
|
4020
4270
|
}
|
|
4021
|
-
const buf =
|
|
4271
|
+
const buf = fs11.readFileSync(abs);
|
|
4022
4272
|
if (buf.length === 0) return 0;
|
|
4023
4273
|
const probe = buf.subarray(0, Math.min(buf.length, BINARY_PROBE_BYTES));
|
|
4024
4274
|
if (probe.includes(0)) return 0;
|
|
@@ -4104,33 +4354,33 @@ function appendReviewSkippedTelemetry(workspaceRoot, diffLines, mutationMeasure,
|
|
|
4104
4354
|
diff_lines: diffLines,
|
|
4105
4355
|
mutation_measure: mutationMeasure,
|
|
4106
4356
|
ts,
|
|
4107
|
-
id:
|
|
4357
|
+
id: crypto3.randomUUID(),
|
|
4108
4358
|
baseline
|
|
4109
4359
|
});
|
|
4110
4360
|
if (errors.length || line === null) return;
|
|
4111
4361
|
try {
|
|
4112
|
-
const dir =
|
|
4113
|
-
|
|
4114
|
-
const file =
|
|
4115
|
-
|
|
4362
|
+
const dir = path10.join(workspaceRoot, "agents", "runtime", "state", "audit");
|
|
4363
|
+
fs11.mkdirSync(dir, { recursive: true });
|
|
4364
|
+
const file = path10.join(dir, `${ts.slice(0, 7)}.jsonl`);
|
|
4365
|
+
fs11.appendFileSync(file, `${JSON.stringify(line)}
|
|
4116
4366
|
`, "utf8");
|
|
4117
4367
|
} catch {
|
|
4118
4368
|
}
|
|
4119
4369
|
}
|
|
4120
4370
|
function sessionStateDir(workspaceRoot) {
|
|
4121
|
-
return
|
|
4371
|
+
return path10.join(workspaceRoot, "agents", "runtime", "state", "end-review-nudge");
|
|
4122
4372
|
}
|
|
4123
4373
|
function sessionStateFile(workspaceRoot, sessionKey) {
|
|
4124
|
-
return
|
|
4374
|
+
return path10.join(sessionStateDir(workspaceRoot), `${sessionKey}.json`);
|
|
4125
4375
|
}
|
|
4126
4376
|
function deriveSessionKey2(envelope, payload) {
|
|
4127
4377
|
const raw = str2(envelope["session_id"]) || str2(payload["transcript_path"] ?? payload["transcriptPath"]);
|
|
4128
4378
|
const material = raw || "unknown-session";
|
|
4129
|
-
return
|
|
4379
|
+
return crypto3.createHash("sha256").update(material).digest("hex");
|
|
4130
4380
|
}
|
|
4131
4381
|
function hasFiredThisSession(workspaceRoot, sessionKey) {
|
|
4132
4382
|
try {
|
|
4133
|
-
return
|
|
4383
|
+
return fs11.existsSync(sessionStateFile(workspaceRoot, sessionKey));
|
|
4134
4384
|
} catch {
|
|
4135
4385
|
return false;
|
|
4136
4386
|
}
|
|
@@ -4192,7 +4442,7 @@ function main5() {
|
|
|
4192
4442
|
let reviewerRan = false;
|
|
4193
4443
|
if (transcriptPath && isSafeTranscriptPath(transcriptPath)) {
|
|
4194
4444
|
try {
|
|
4195
|
-
reviewerRan = scanTranscriptForReviewer(
|
|
4445
|
+
reviewerRan = scanTranscriptForReviewer(fs11.readFileSync(transcriptPath, "utf-8"));
|
|
4196
4446
|
} catch {
|
|
4197
4447
|
reviewerRan = false;
|
|
4198
4448
|
}
|
|
@@ -4227,13 +4477,13 @@ function _isCliEntry5() {
|
|
|
4227
4477
|
if (process.argv[1] === void 0) {
|
|
4228
4478
|
return false;
|
|
4229
4479
|
}
|
|
4230
|
-
const argvUrl = pathToFileURL5(
|
|
4480
|
+
const argvUrl = pathToFileURL5(path10.resolve(process.argv[1])).href;
|
|
4231
4481
|
if (import.meta.url === argvUrl) {
|
|
4232
4482
|
return true;
|
|
4233
4483
|
}
|
|
4234
4484
|
try {
|
|
4235
|
-
const here =
|
|
4236
|
-
const argv =
|
|
4485
|
+
const here = fs11.realpathSync(fileURLToPath5(import.meta.url));
|
|
4486
|
+
const argv = fs11.realpathSync(path10.resolve(process.argv[1]));
|
|
4237
4487
|
return here === argv;
|
|
4238
4488
|
} catch {
|
|
4239
4489
|
return false;
|
|
@@ -4254,10 +4504,10 @@ function readTranscriptTail(transcriptPath, opts = {}) {
|
|
|
4254
4504
|
if (!transcriptPath || !isSafeTranscriptPath(transcriptPath, opts)) return empty;
|
|
4255
4505
|
let lines;
|
|
4256
4506
|
try {
|
|
4257
|
-
if (opts.maxBytes !== void 0 &&
|
|
4507
|
+
if (opts.maxBytes !== void 0 && fs12.statSync(transcriptPath).size > opts.maxBytes) {
|
|
4258
4508
|
return empty;
|
|
4259
4509
|
}
|
|
4260
|
-
lines =
|
|
4510
|
+
lines = fs12.readFileSync(transcriptPath, "utf-8").split("\n");
|
|
4261
4511
|
} catch {
|
|
4262
4512
|
return empty;
|
|
4263
4513
|
}
|
|
@@ -4444,7 +4694,7 @@ function detectPromissory(reply) {
|
|
|
4444
4694
|
function readCiSettled(workspaceRoot, session_id) {
|
|
4445
4695
|
if (!hasStableSessionId(session_id)) return { seen: false, settled: false };
|
|
4446
4696
|
try {
|
|
4447
|
-
const raw =
|
|
4697
|
+
const raw = fs13.readFileSync(path11.join(workspaceRoot, statePathFor(session_id)), "utf-8");
|
|
4448
4698
|
const decoded = JSON.parse(raw);
|
|
4449
4699
|
if (!owns_session_state(decoded, session_id)) return { seen: false, settled: false };
|
|
4450
4700
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
@@ -4480,8 +4730,8 @@ function detectCompletionClaim(reply, ci) {
|
|
|
4480
4730
|
function readLanguagePin(workspaceRoot, session_id) {
|
|
4481
4731
|
if (!hasStableSessionId(session_id)) return "und";
|
|
4482
4732
|
try {
|
|
4483
|
-
const raw =
|
|
4484
|
-
|
|
4733
|
+
const raw = fs13.readFileSync(
|
|
4734
|
+
path11.join(workspaceRoot, statePathFor2(session_id)),
|
|
4485
4735
|
"utf-8"
|
|
4486
4736
|
);
|
|
4487
4737
|
const decoded = JSON.parse(raw);
|
|
@@ -4528,7 +4778,7 @@ function detectUnverifiedEdit(toolCalls, runState = null) {
|
|
|
4528
4778
|
}
|
|
4529
4779
|
for (let i = lastEdit + 1; i < toolCalls.length; i += 1) {
|
|
4530
4780
|
const c = toolCalls[i];
|
|
4531
|
-
if (c.name === "Bash" && c.command !== void 0 &&
|
|
4781
|
+
if (c.name === "Bash" && c.command !== void 0 && isVerificationAttempt(c.command)) {
|
|
4532
4782
|
return null;
|
|
4533
4783
|
}
|
|
4534
4784
|
}
|
|
@@ -4537,7 +4787,7 @@ function detectUnverifiedEdit(toolCalls, runState = null) {
|
|
|
4537
4787
|
// The path, never the diff: the evidence span is quoted into a refusal,
|
|
4538
4788
|
// and `ToolCall` is shaped so a file body cannot reach it.
|
|
4539
4789
|
evidence: edited,
|
|
4540
|
-
reason: "this turn changed a file and then ran no verification command \u2014 no test, type-check, lint or
|
|
4790
|
+
reason: "this turn changed a file and then ran no verification command \u2014 no test, type-check, lint, build or asset render follows the last edit (verify-before-complete: a claim without a fresh run is unverified)",
|
|
4541
4791
|
mode: "transcript"
|
|
4542
4792
|
};
|
|
4543
4793
|
}
|
|
@@ -4590,7 +4840,7 @@ function sessionStateFile2(workspaceRoot, sessionKey) {
|
|
|
4590
4840
|
}
|
|
4591
4841
|
function alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal) {
|
|
4592
4842
|
try {
|
|
4593
|
-
const raw =
|
|
4843
|
+
const raw = fs13.readFileSync(sessionStateFile2(workspaceRoot, sessionKey), "utf-8");
|
|
4594
4844
|
const decoded = JSON.parse(raw);
|
|
4595
4845
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
4596
4846
|
return decoded["refused_turn"] === turnOrdinal;
|
|
@@ -4604,7 +4854,7 @@ function markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, detectors, prom
|
|
|
4604
4854
|
const file = sessionStateFile2(workspaceRoot, sessionKey);
|
|
4605
4855
|
let prev = null;
|
|
4606
4856
|
try {
|
|
4607
|
-
prev = parseRecord(
|
|
4857
|
+
prev = parseRecord(fs13.readFileSync(file, "utf-8"));
|
|
4608
4858
|
} catch {
|
|
4609
4859
|
}
|
|
4610
4860
|
let version;
|
|
@@ -4701,6 +4951,7 @@ function runDetectors(inputs) {
|
|
|
4701
4951
|
// on a completion CLAIM, and a turn waiting on a subagent has not
|
|
4702
4952
|
// finished — so its closing is not the claim F is about. Same slot,
|
|
4703
4953
|
// opposite trigger, opposite treatment of `dispatchOpen`.
|
|
4954
|
+
openSvgObligation(workspaceRoot, toolCalls),
|
|
4704
4955
|
dispatchOpen ? null : detectUntestedChange(lastAssistant, toolCalls, runState)
|
|
4705
4956
|
]) {
|
|
4706
4957
|
if (f) findings.push(f);
|
|
@@ -4723,6 +4974,7 @@ function recordGraphFeeder(inputs, findings, layer) {
|
|
|
4723
4974
|
inputs.workspaceRoot,
|
|
4724
4975
|
inputs.sessionKey,
|
|
4725
4976
|
buildFeederRow({
|
|
4977
|
+
root: inputs.workspaceRoot,
|
|
4726
4978
|
turn: inputs.turnOrdinal,
|
|
4727
4979
|
layer,
|
|
4728
4980
|
state,
|
|
@@ -4744,7 +4996,7 @@ function recordShadow(inputs, layer) {
|
|
|
4744
4996
|
const file = sessionShadowFile(inputs.workspaceRoot, inputs.sessionKey);
|
|
4745
4997
|
let prev = null;
|
|
4746
4998
|
try {
|
|
4747
|
-
prev = parseShadowRecord(
|
|
4999
|
+
prev = parseShadowRecord(fs13.readFileSync(file, "utf-8"));
|
|
4748
5000
|
} catch {
|
|
4749
5001
|
}
|
|
4750
5002
|
atomic_write_json(
|
|
@@ -4812,13 +5064,13 @@ function _isCliEntry6() {
|
|
|
4812
5064
|
if (process.argv[1] === void 0) {
|
|
4813
5065
|
return false;
|
|
4814
5066
|
}
|
|
4815
|
-
const argvUrl = pathToFileURL6(
|
|
5067
|
+
const argvUrl = pathToFileURL6(path11.resolve(process.argv[1])).href;
|
|
4816
5068
|
if (import.meta.url === argvUrl) {
|
|
4817
5069
|
return true;
|
|
4818
5070
|
}
|
|
4819
5071
|
try {
|
|
4820
|
-
const here =
|
|
4821
|
-
const argv =
|
|
5072
|
+
const here = fs13.realpathSync(fileURLToPath6(import.meta.url));
|
|
5073
|
+
const argv = fs13.realpathSync(path11.resolve(process.argv[1]));
|
|
4822
5074
|
return here === argv;
|
|
4823
5075
|
} catch {
|
|
4824
5076
|
return false;
|
|
@@ -4830,9 +5082,9 @@ if (_isCliEntry6()) {
|
|
|
4830
5082
|
|
|
4831
5083
|
// src/scripts/hooks/evidence_independence.ts
|
|
4832
5084
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
4833
|
-
import
|
|
4834
|
-
import
|
|
4835
|
-
import
|
|
5085
|
+
import crypto4 from "node:crypto";
|
|
5086
|
+
import fs14 from "node:fs";
|
|
5087
|
+
import path12 from "node:path";
|
|
4836
5088
|
import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL7 } from "node:url";
|
|
4837
5089
|
|
|
4838
5090
|
// src/scripts/_lib/test_delta.ts
|
|
@@ -4851,7 +5103,7 @@ function isTestPath(p) {
|
|
|
4851
5103
|
}
|
|
4852
5104
|
|
|
4853
5105
|
// src/scripts/hooks/evidence_independence.ts
|
|
4854
|
-
var STATE_FILE3 =
|
|
5106
|
+
var STATE_FILE3 = path12.join("agents", "state", "evidence-dispatch.json");
|
|
4855
5107
|
function _isObject5(v) {
|
|
4856
5108
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
4857
5109
|
}
|
|
@@ -4917,10 +5169,10 @@ function extractDispatch(envelope) {
|
|
|
4917
5169
|
}
|
|
4918
5170
|
return [tool, ""];
|
|
4919
5171
|
}
|
|
4920
|
-
function _ledgerStamp(consumer_root) {
|
|
5172
|
+
function _ledgerStamp(consumer_root, session_id) {
|
|
4921
5173
|
try {
|
|
4922
|
-
const raw =
|
|
4923
|
-
|
|
5174
|
+
const raw = fs14.readFileSync(
|
|
5175
|
+
path12.join(consumer_root, ledgerFileFor(session_id)),
|
|
4924
5176
|
"utf8"
|
|
4925
5177
|
);
|
|
4926
5178
|
const d = JSON.parse(raw);
|
|
@@ -4931,7 +5183,7 @@ function _ledgerStamp(consumer_root) {
|
|
|
4931
5183
|
}
|
|
4932
5184
|
function _load(target) {
|
|
4933
5185
|
try {
|
|
4934
|
-
const decoded = JSON.parse(
|
|
5186
|
+
const decoded = JSON.parse(fs14.readFileSync(target, "utf8"));
|
|
4935
5187
|
if (_isObject5(decoded) && Array.isArray(decoded["evaluations"])) {
|
|
4936
5188
|
return decoded;
|
|
4937
5189
|
}
|
|
@@ -5015,10 +5267,10 @@ function run3(stdin_text, options) {
|
|
|
5015
5267
|
return EXIT_ALLOW3;
|
|
5016
5268
|
}
|
|
5017
5269
|
}
|
|
5018
|
-
const target =
|
|
5270
|
+
const target = path12.join(options.consumer_root, STATE_FILE3);
|
|
5019
5271
|
const state = _load(target);
|
|
5020
5272
|
const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
|
|
5021
|
-
const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root)}`;
|
|
5273
|
+
const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root, session_id)}`;
|
|
5022
5274
|
if (state.session_id !== turnMarker) {
|
|
5023
5275
|
state.session_id = turnMarker;
|
|
5024
5276
|
state.turn_started_at = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -5038,7 +5290,7 @@ function run3(stdin_text, options) {
|
|
|
5038
5290
|
if (decision.evaluations > state.evaluations.length) {
|
|
5039
5291
|
state.evaluations.push({
|
|
5040
5292
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
5041
|
-
digest:
|
|
5293
|
+
digest: crypto4.createHash("sha256").update(prompt).digest("hex").slice(0, 16),
|
|
5042
5294
|
prompt_chars: prompt.length
|
|
5043
5295
|
});
|
|
5044
5296
|
try {
|
|
@@ -5083,13 +5335,13 @@ function _isCliEntry7() {
|
|
|
5083
5335
|
if (process.argv[1] === void 0) {
|
|
5084
5336
|
return false;
|
|
5085
5337
|
}
|
|
5086
|
-
const argvUrl = pathToFileURL7(
|
|
5338
|
+
const argvUrl = pathToFileURL7(path12.resolve(process.argv[1])).href;
|
|
5087
5339
|
if (import.meta.url === argvUrl) {
|
|
5088
5340
|
return true;
|
|
5089
5341
|
}
|
|
5090
5342
|
try {
|
|
5091
|
-
const here =
|
|
5092
|
-
const argv =
|
|
5343
|
+
const here = fs14.realpathSync(fileURLToPath7(import.meta.url));
|
|
5344
|
+
const argv = fs14.realpathSync(path12.resolve(process.argv[1]));
|
|
5093
5345
|
return here === argv;
|
|
5094
5346
|
} catch {
|
|
5095
5347
|
return false;
|
|
@@ -5100,8 +5352,8 @@ if (_isCliEntry7()) {
|
|
|
5100
5352
|
}
|
|
5101
5353
|
|
|
5102
5354
|
// src/scripts/hooks/delegation_nudge_hook.ts
|
|
5103
|
-
import
|
|
5104
|
-
import
|
|
5355
|
+
import fs15 from "node:fs";
|
|
5356
|
+
import path13 from "node:path";
|
|
5105
5357
|
import { fileURLToPath as fileURLToPath8, pathToFileURL as pathToFileURL8 } from "node:url";
|
|
5106
5358
|
|
|
5107
5359
|
// src/scripts/_lib/auto_dispatch.ts
|
|
@@ -5465,11 +5717,10 @@ function resolveActivation(workspace_root, hostId) {
|
|
|
5465
5717
|
const emergency = settings["emergency"] ?? {};
|
|
5466
5718
|
const halted = emergency["orchestration_halt"] === true;
|
|
5467
5719
|
const host_manifest = probeHostCapabilities(hostId);
|
|
5468
|
-
const sub = settings["subagents"] ?? {};
|
|
5469
|
-
const downshift = sub["downshift"] !== false;
|
|
5470
5720
|
return {
|
|
5471
5721
|
activation: { halted, subagent_spawn: host_manifest.subagent_spawn },
|
|
5472
|
-
downshift
|
|
5722
|
+
// Fixed on: the `subagents.downshift` key was retired with this default.
|
|
5723
|
+
downshift: true,
|
|
5473
5724
|
separate_quota_pool: host_manifest.separate_quota_pool,
|
|
5474
5725
|
agentTeams: host_manifest.agent_teams
|
|
5475
5726
|
};
|
|
@@ -5601,13 +5852,13 @@ function _isCliEntry8() {
|
|
|
5601
5852
|
if (process.argv[1] === void 0) {
|
|
5602
5853
|
return false;
|
|
5603
5854
|
}
|
|
5604
|
-
const argvUrl = pathToFileURL8(
|
|
5855
|
+
const argvUrl = pathToFileURL8(path13.resolve(process.argv[1])).href;
|
|
5605
5856
|
if (import.meta.url === argvUrl) {
|
|
5606
5857
|
return true;
|
|
5607
5858
|
}
|
|
5608
5859
|
try {
|
|
5609
|
-
const here =
|
|
5610
|
-
const argv =
|
|
5860
|
+
const here = fs15.realpathSync(fileURLToPath8(import.meta.url));
|
|
5861
|
+
const argv = fs15.realpathSync(path13.resolve(process.argv[1]));
|
|
5611
5862
|
return here === argv;
|
|
5612
5863
|
} catch {
|
|
5613
5864
|
return false;
|
|
@@ -5618,7 +5869,7 @@ if (_isCliEntry8()) {
|
|
|
5618
5869
|
}
|
|
5619
5870
|
|
|
5620
5871
|
// src/scripts/conformance_scan.ts
|
|
5621
|
-
var REPO_ROOT =
|
|
5872
|
+
var REPO_ROOT = path14.resolve(path14.dirname(fileURLToPath9(import.meta.url)), "..", "..");
|
|
5622
5873
|
var OBSERVED_BAND = { low: 9.1, high: 39.2 };
|
|
5623
5874
|
var BAND_MIN_TURNS = 1978;
|
|
5624
5875
|
var CARRIER_CHANGES = [
|
|
@@ -5984,7 +6235,7 @@ function scanSession(sessionId, lines) {
|
|
|
5984
6235
|
closeWindow();
|
|
5985
6236
|
return report;
|
|
5986
6237
|
}
|
|
5987
|
-
var DEFAULT_RATE_SERIES =
|
|
6238
|
+
var DEFAULT_RATE_SERIES = path14.join(
|
|
5988
6239
|
REPO_ROOT,
|
|
5989
6240
|
"agents",
|
|
5990
6241
|
"runtime",
|
|
@@ -5993,7 +6244,7 @@ var DEFAULT_RATE_SERIES = path13.join(
|
|
|
5993
6244
|
);
|
|
5994
6245
|
function defaultStore(projectDir) {
|
|
5995
6246
|
const slug = projectStoreSlug(projectDir);
|
|
5996
|
-
return
|
|
6247
|
+
return path14.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
|
|
5997
6248
|
}
|
|
5998
6249
|
function _tokens(chars) {
|
|
5999
6250
|
return Math.round(chars / 4);
|
|
@@ -6004,13 +6255,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
6004
6255
|
return {
|
|
6005
6256
|
project: {
|
|
6006
6257
|
dir: projectRulesDir,
|
|
6007
|
-
present:
|
|
6258
|
+
present: fs16.existsSync(projectRulesDir),
|
|
6008
6259
|
files: p.files,
|
|
6009
6260
|
tokens: _tokens(p.chars)
|
|
6010
6261
|
},
|
|
6011
6262
|
global: {
|
|
6012
6263
|
dir: globalRulesDir,
|
|
6013
|
-
present:
|
|
6264
|
+
present: fs16.existsSync(globalRulesDir),
|
|
6014
6265
|
files: g.files,
|
|
6015
6266
|
tokens: _tokens(g.chars)
|
|
6016
6267
|
},
|
|
@@ -6018,13 +6269,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
6018
6269
|
};
|
|
6019
6270
|
}
|
|
6020
6271
|
function storeKey(store) {
|
|
6021
|
-
return
|
|
6272
|
+
return createHash5("sha256").update(path14.resolve(store)).digest("hex").slice(0, 12);
|
|
6022
6273
|
}
|
|
6023
6274
|
function scanStore(store, limit) {
|
|
6024
|
-
const files =
|
|
6275
|
+
const files = fs16.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs16.statSync(path14.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
|
|
6025
6276
|
const per_session = [];
|
|
6026
6277
|
for (const f of files) {
|
|
6027
|
-
const lines =
|
|
6278
|
+
const lines = fs16.readFileSync(path14.join(store, f), "utf8").split("\n");
|
|
6028
6279
|
const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
|
|
6029
6280
|
if (r.assistant_turns > 0) {
|
|
6030
6281
|
per_session.push(r);
|
|
@@ -6052,10 +6303,10 @@ function scanStore(store, limit) {
|
|
|
6052
6303
|
const task_completeness_rate_pct = completeness_windows === 0 ? 0 : Number((100 * task_completeness / completeness_windows).toFixed(1));
|
|
6053
6304
|
const era = spansCarrierChange(per_session.map((s) => s.first_at));
|
|
6054
6305
|
const delivered = measureDelivered(
|
|
6055
|
-
|
|
6056
|
-
|
|
6306
|
+
path14.join(REPO_ROOT, ".claude", "rules"),
|
|
6307
|
+
path14.join(process.env["HOME"] ?? os2.homedir(), ".claude", "rules")
|
|
6057
6308
|
);
|
|
6058
|
-
const ownStore =
|
|
6309
|
+
const ownStore = path14.resolve(store) === path14.resolve(defaultStore(REPO_ROOT));
|
|
6059
6310
|
return {
|
|
6060
6311
|
scanned_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
6061
6312
|
store,
|
|
@@ -6085,8 +6336,8 @@ function scanStore(store, limit) {
|
|
|
6085
6336
|
};
|
|
6086
6337
|
}
|
|
6087
6338
|
function recordRate(file, scanned_at, rate) {
|
|
6088
|
-
|
|
6089
|
-
|
|
6339
|
+
fs16.mkdirSync(path14.dirname(file), { recursive: true });
|
|
6340
|
+
fs16.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
|
|
6090
6341
|
`, "utf8");
|
|
6091
6342
|
}
|
|
6092
6343
|
function render(report) {
|
|
@@ -6217,14 +6468,14 @@ function main9(argv) {
|
|
|
6217
6468
|
return 2;
|
|
6218
6469
|
}
|
|
6219
6470
|
const resolved = store ?? defaultStore(process.cwd());
|
|
6220
|
-
if (!
|
|
6471
|
+
if (!fs16.existsSync(resolved)) {
|
|
6221
6472
|
process.stderr.write(`conformance:behavior: no transcript store at ${resolved}
|
|
6222
6473
|
`);
|
|
6223
6474
|
return 1;
|
|
6224
6475
|
}
|
|
6225
6476
|
const report = scanStore(resolved, Number.isFinite(limit) && limit > 0 ? limit : 30);
|
|
6226
6477
|
if (out) {
|
|
6227
|
-
|
|
6478
|
+
fs16.writeFileSync(out, `${JSON.stringify(report, null, 2)}
|
|
6228
6479
|
`, "utf8");
|
|
6229
6480
|
}
|
|
6230
6481
|
if (record) {
|
|
@@ -6232,7 +6483,7 @@ function main9(argv) {
|
|
|
6232
6483
|
}
|
|
6233
6484
|
if (why !== null) {
|
|
6234
6485
|
const id = why;
|
|
6235
|
-
|
|
6486
|
+
fs16.writeSync(
|
|
6236
6487
|
1,
|
|
6237
6488
|
json ? `${JSON.stringify(
|
|
6238
6489
|
{
|
|
@@ -6252,7 +6503,7 @@ function main9(argv) {
|
|
|
6252
6503
|
);
|
|
6253
6504
|
return 0;
|
|
6254
6505
|
}
|
|
6255
|
-
|
|
6506
|
+
fs16.writeSync(1, json ? `${JSON.stringify(report, null, 2)}
|
|
6256
6507
|
` : `${render(report)}
|
|
6257
6508
|
`);
|
|
6258
6509
|
return 0;
|
|
@@ -6264,13 +6515,13 @@ function _isCliEntry9() {
|
|
|
6264
6515
|
if (process.argv[1] === void 0) {
|
|
6265
6516
|
return false;
|
|
6266
6517
|
}
|
|
6267
|
-
const argvUrl = pathToFileURL9(
|
|
6518
|
+
const argvUrl = pathToFileURL9(path14.resolve(process.argv[1])).href;
|
|
6268
6519
|
if (import.meta.url === argvUrl) {
|
|
6269
6520
|
return true;
|
|
6270
6521
|
}
|
|
6271
6522
|
try {
|
|
6272
|
-
const here =
|
|
6273
|
-
const argv =
|
|
6523
|
+
const here = fs16.realpathSync(fileURLToPath9(import.meta.url));
|
|
6524
|
+
const argv = fs16.realpathSync(path14.resolve(process.argv[1]));
|
|
6274
6525
|
return here === argv;
|
|
6275
6526
|
} catch {
|
|
6276
6527
|
return false;
|
|
@@ -6281,19 +6532,19 @@ if (_isCliEntry9()) {
|
|
|
6281
6532
|
}
|
|
6282
6533
|
|
|
6283
6534
|
// src/scripts/report_carrier_divergence.ts
|
|
6284
|
-
import * as
|
|
6535
|
+
import * as fs17 from "node:fs";
|
|
6285
6536
|
import * as os3 from "node:os";
|
|
6286
|
-
import * as
|
|
6537
|
+
import * as path15 from "node:path";
|
|
6287
6538
|
import process2 from "node:process";
|
|
6288
6539
|
import { fileURLToPath as fileURLToPath10, pathToFileURL as pathToFileURL10 } from "node:url";
|
|
6289
6540
|
var _HERE2 = fileURLToPath10(import.meta.url);
|
|
6290
|
-
var REPO_ROOT2 =
|
|
6291
|
-
var PROJECT_RULES =
|
|
6292
|
-
var PROJECTION_SOURCE =
|
|
6293
|
-
var GLOBAL_RULES =
|
|
6541
|
+
var REPO_ROOT2 = path15.resolve(path15.dirname(_HERE2), "..", "..");
|
|
6542
|
+
var PROJECT_RULES = path15.join(".claude", "rules");
|
|
6543
|
+
var PROJECTION_SOURCE = path15.join("dist", "agent-src", "rules");
|
|
6544
|
+
var GLOBAL_RULES = path15.join(".claude", "rules");
|
|
6294
6545
|
function _listRules(dir) {
|
|
6295
6546
|
try {
|
|
6296
|
-
return
|
|
6547
|
+
return fs17.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
|
|
6297
6548
|
} catch {
|
|
6298
6549
|
return [];
|
|
6299
6550
|
}
|
|
@@ -6301,7 +6552,7 @@ function _listRules(dir) {
|
|
|
6301
6552
|
function _ruleType(file) {
|
|
6302
6553
|
let text;
|
|
6303
6554
|
try {
|
|
6304
|
-
text =
|
|
6555
|
+
text = fs17.readFileSync(file, "utf-8");
|
|
6305
6556
|
} catch {
|
|
6306
6557
|
return "";
|
|
6307
6558
|
}
|
|
@@ -6312,8 +6563,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
6312
6563
|
const out = {
|
|
6313
6564
|
projectDir,
|
|
6314
6565
|
globalDir,
|
|
6315
|
-
globalPresent:
|
|
6316
|
-
projectPresent:
|
|
6566
|
+
globalPresent: fs17.existsSync(globalDir),
|
|
6567
|
+
projectPresent: fs17.existsSync(projectDir),
|
|
6317
6568
|
shared: 0,
|
|
6318
6569
|
identical: [],
|
|
6319
6570
|
provenanceOnly: [],
|
|
@@ -6336,7 +6587,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
6336
6587
|
}
|
|
6337
6588
|
if (!inP && inG) {
|
|
6338
6589
|
out.globalOnly.push(rule);
|
|
6339
|
-
if (sourceDir !== void 0 && _ruleType(
|
|
6590
|
+
if (sourceDir !== void 0 && _ruleType(path15.join(sourceDir, rule)) === "manual") {
|
|
6340
6591
|
out.manualOnlyGlobal.push(rule);
|
|
6341
6592
|
}
|
|
6342
6593
|
continue;
|
|
@@ -6346,8 +6597,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
6346
6597
|
let projectCopy;
|
|
6347
6598
|
let globalCopy;
|
|
6348
6599
|
try {
|
|
6349
|
-
projectCopy =
|
|
6350
|
-
globalCopy =
|
|
6600
|
+
projectCopy = fs17.readFileSync(path15.join(projectDir, rule));
|
|
6601
|
+
globalCopy = fs17.readFileSync(path15.join(globalDir, rule));
|
|
6351
6602
|
verdict = comparePair(projectCopy, globalCopy);
|
|
6352
6603
|
} catch {
|
|
6353
6604
|
out.shared -= 1;
|
|
@@ -6494,9 +6745,9 @@ function render2(d) {
|
|
|
6494
6745
|
}
|
|
6495
6746
|
function main10(argv) {
|
|
6496
6747
|
const args = argv ?? process2.argv.slice(2);
|
|
6497
|
-
let projectDir =
|
|
6498
|
-
let globalDir =
|
|
6499
|
-
let sourceDir =
|
|
6748
|
+
let projectDir = path15.join(REPO_ROOT2, PROJECT_RULES);
|
|
6749
|
+
let globalDir = path15.join(os3.homedir(), GLOBAL_RULES);
|
|
6750
|
+
let sourceDir = path15.join(REPO_ROOT2, PROJECTION_SOURCE);
|
|
6500
6751
|
const value = (i) => {
|
|
6501
6752
|
const v = args[i + 1];
|
|
6502
6753
|
return v === void 0 || v.startsWith("-") ? null : v;
|
|
@@ -6510,7 +6761,7 @@ function main10(argv) {
|
|
|
6510
6761
|
`);
|
|
6511
6762
|
return 1;
|
|
6512
6763
|
}
|
|
6513
|
-
const resolved =
|
|
6764
|
+
const resolved = path15.resolve(v);
|
|
6514
6765
|
if (a === "--project") projectDir = resolved;
|
|
6515
6766
|
else if (a === "--global") globalDir = resolved;
|
|
6516
6767
|
else sourceDir = resolved;
|
|
@@ -6532,9 +6783,9 @@ function main10(argv) {
|
|
|
6532
6783
|
}
|
|
6533
6784
|
function _isCliEntry10() {
|
|
6534
6785
|
if (process2.argv[1] === void 0) return false;
|
|
6535
|
-
if (import.meta.url === pathToFileURL10(
|
|
6786
|
+
if (import.meta.url === pathToFileURL10(path15.resolve(process2.argv[1])).href) return true;
|
|
6536
6787
|
try {
|
|
6537
|
-
return
|
|
6788
|
+
return fs17.realpathSync(_HERE2) === fs17.realpathSync(path15.resolve(process2.argv[1]));
|
|
6538
6789
|
} catch {
|
|
6539
6790
|
return false;
|
|
6540
6791
|
}
|
|
@@ -6544,12 +6795,12 @@ if (_isCliEntry10()) {
|
|
|
6544
6795
|
}
|
|
6545
6796
|
|
|
6546
6797
|
// src/scripts/report_skill_activation.ts
|
|
6547
|
-
import * as
|
|
6798
|
+
import * as fs18 from "node:fs";
|
|
6548
6799
|
import * as os4 from "node:os";
|
|
6549
|
-
import * as
|
|
6800
|
+
import * as path16 from "node:path";
|
|
6550
6801
|
import { fileURLToPath as fileURLToPath11, pathToFileURL as pathToFileURL11 } from "node:url";
|
|
6551
6802
|
var _HERE3 = fileURLToPath11(import.meta.url);
|
|
6552
|
-
var REPO_ROOT3 =
|
|
6803
|
+
var REPO_ROOT3 = path16.resolve(path16.dirname(_HERE3), "..", "..");
|
|
6553
6804
|
var SKILLS_ROOT = "src/skills";
|
|
6554
6805
|
var TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
|
|
6555
6806
|
var DETERMINISTIC_RE = /^\s*(?:[-*]\s*)?(?:\*\*)?(MUST|NEVER|ALWAYS)\b/m;
|
|
@@ -6560,25 +6811,25 @@ function censusSkills(root) {
|
|
|
6560
6811
|
withTriggerCorpus: [],
|
|
6561
6812
|
withDeterministicObligation: []
|
|
6562
6813
|
};
|
|
6563
|
-
if (!
|
|
6814
|
+
if (!fs18.existsSync(root)) {
|
|
6564
6815
|
return out;
|
|
6565
6816
|
}
|
|
6566
|
-
for (const entry of
|
|
6817
|
+
for (const entry of fs18.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
6567
6818
|
if (!entry.isDirectory()) {
|
|
6568
6819
|
continue;
|
|
6569
6820
|
}
|
|
6570
|
-
const file =
|
|
6571
|
-
if (!
|
|
6821
|
+
const file = path16.join(root, entry.name, "SKILL.md");
|
|
6822
|
+
if (!fs18.existsSync(file)) {
|
|
6572
6823
|
continue;
|
|
6573
6824
|
}
|
|
6574
6825
|
out.total += 1;
|
|
6575
|
-
const text =
|
|
6826
|
+
const text = fs18.readFileSync(file, "utf8");
|
|
6576
6827
|
const fmEnd = text.startsWith("---") ? text.indexOf("\n---", 3) : -1;
|
|
6577
6828
|
const fm = fmEnd === -1 ? "" : text.slice(0, fmEnd);
|
|
6578
6829
|
if (TRIGGER_KEYS.some((k) => new RegExp(`^${k}`, "m").test(fm))) {
|
|
6579
6830
|
out.withTriggerKey.push(entry.name);
|
|
6580
6831
|
}
|
|
6581
|
-
if (
|
|
6832
|
+
if (fs18.existsSync(path16.join(root, entry.name, "evals", "triggers.json"))) {
|
|
6582
6833
|
out.withTriggerCorpus.push(entry.name);
|
|
6583
6834
|
}
|
|
6584
6835
|
const body = fmEnd === -1 ? text : text.slice(fmEnd + 4);
|
|
@@ -6589,17 +6840,17 @@ function censusSkills(root) {
|
|
|
6589
6840
|
return out;
|
|
6590
6841
|
}
|
|
6591
6842
|
function defaultStore2(cwd) {
|
|
6592
|
-
return
|
|
6843
|
+
return path16.join(os4.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
6593
6844
|
}
|
|
6594
6845
|
function measureUsage(store, limit) {
|
|
6595
6846
|
const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
|
|
6596
|
-
if (!
|
|
6847
|
+
if (!fs18.existsSync(store)) {
|
|
6597
6848
|
return rep;
|
|
6598
6849
|
}
|
|
6599
|
-
const files =
|
|
6850
|
+
const files = fs18.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path16.join(store, f)).sort((a, b) => fs18.statSync(b).mtimeMs - fs18.statSync(a).mtimeMs).slice(0, limit);
|
|
6600
6851
|
rep.sessions = files.length;
|
|
6601
6852
|
for (const file of files) {
|
|
6602
|
-
for (const line of
|
|
6853
|
+
for (const line of fs18.readFileSync(file, "utf8").split("\n")) {
|
|
6603
6854
|
if (!line.trim()) {
|
|
6604
6855
|
continue;
|
|
6605
6856
|
}
|
|
@@ -6672,15 +6923,15 @@ function buildRecord(census, usage, today) {
|
|
|
6672
6923
|
assistant_turns: usage.reduce((a, u) => a + u.assistantTurns, 0),
|
|
6673
6924
|
invocations: usage.reduce((a, u) => a + u.invocations, 0),
|
|
6674
6925
|
distinct_skills_invoked: distinct.size,
|
|
6675
|
-
stores: usage.map((u) =>
|
|
6926
|
+
stores: usage.map((u) => path16.basename(u.store))
|
|
6676
6927
|
};
|
|
6677
6928
|
}
|
|
6678
6929
|
function readRecord(repoRoot) {
|
|
6679
|
-
const file =
|
|
6680
|
-
if (!
|
|
6930
|
+
const file = path16.join(repoRoot, RECORD_PATH);
|
|
6931
|
+
if (!fs18.existsSync(file)) {
|
|
6681
6932
|
return null;
|
|
6682
6933
|
}
|
|
6683
|
-
return JSON.parse(
|
|
6934
|
+
return JSON.parse(fs18.readFileSync(file, "utf8"));
|
|
6684
6935
|
}
|
|
6685
6936
|
function render3(census, usage, published = null) {
|
|
6686
6937
|
const lines = [];
|
|
@@ -6715,7 +6966,7 @@ function render3(census, usage, published = null) {
|
|
|
6715
6966
|
}
|
|
6716
6967
|
totalInv += u.invocations;
|
|
6717
6968
|
lines.push(
|
|
6718
|
-
` ${
|
|
6969
|
+
` ${path16.basename(u.store).slice(-38).padEnd(38)} sessions=${String(u.sessions).padStart(3)} asst=${String(u.assistantTurns).padStart(6)} Skill calls=${String(u.invocations).padStart(3)}`
|
|
6719
6970
|
);
|
|
6720
6971
|
}
|
|
6721
6972
|
lines.push("");
|
|
@@ -6819,7 +7070,7 @@ function main11(argv) {
|
|
|
6819
7070
|
if (stores.length === 0) {
|
|
6820
7071
|
stores.push(defaultStore2(REPO_ROOT3));
|
|
6821
7072
|
}
|
|
6822
|
-
const census = censusSkills(
|
|
7073
|
+
const census = censusSkills(path16.join(root, SKILLS_ROOT));
|
|
6823
7074
|
const usage = stores.map((s) => measureUsage(s, limit));
|
|
6824
7075
|
process.stdout.write(`${render3(census, usage, readRecord(root))}
|
|
6825
7076
|
`);
|
|
@@ -6840,27 +7091,27 @@ function main11(argv) {
|
|
|
6840
7091
|
return 1;
|
|
6841
7092
|
}
|
|
6842
7093
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
6843
|
-
const file =
|
|
6844
|
-
|
|
6845
|
-
|
|
7094
|
+
const file = path16.join(root, RECORD_PATH);
|
|
7095
|
+
fs18.mkdirSync(path16.dirname(file), { recursive: true });
|
|
7096
|
+
fs18.writeFileSync(file, `${JSON.stringify(buildRecord(census, usage, today), null, 2)}
|
|
6846
7097
|
`);
|
|
6847
7098
|
process.stdout.write(`
|
|
6848
7099
|
wrote ${RECORD_PATH} (measured ${today})
|
|
6849
7100
|
`);
|
|
6850
7101
|
return 0;
|
|
6851
7102
|
}
|
|
6852
|
-
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL11(
|
|
7103
|
+
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL11(path16.resolve(process.argv[1])).href) {
|
|
6853
7104
|
process.exit(main11(process.argv.slice(2)));
|
|
6854
7105
|
}
|
|
6855
7106
|
|
|
6856
7107
|
// src/scripts/report_skill_obligation_violations.ts
|
|
6857
|
-
import * as
|
|
7108
|
+
import * as fs19 from "node:fs";
|
|
6858
7109
|
import * as os5 from "node:os";
|
|
6859
|
-
import * as
|
|
7110
|
+
import * as path17 from "node:path";
|
|
6860
7111
|
import process3 from "node:process";
|
|
6861
7112
|
import { fileURLToPath as fileURLToPath12, pathToFileURL as pathToFileURL12 } from "node:url";
|
|
6862
7113
|
var _HERE4 = fileURLToPath12(import.meta.url);
|
|
6863
|
-
var REPO_ROOT4 =
|
|
7114
|
+
var REPO_ROOT4 = path17.resolve(path17.dirname(_HERE4), "..", "..");
|
|
6864
7115
|
var OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
|
|
6865
7116
|
var PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
|
|
6866
7117
|
var CMD_RE = /`([a-z][a-z0-9-]*(?: [a-z][a-z0-9:._-]*){1,3})`/g;
|
|
@@ -6898,7 +7149,7 @@ function _artefacts(line) {
|
|
|
6898
7149
|
return out;
|
|
6899
7150
|
}
|
|
6900
7151
|
function extractObligations(repoRoot) {
|
|
6901
|
-
const skillsRoot =
|
|
7152
|
+
const skillsRoot = path17.join(repoRoot, SKILLS_ROOT);
|
|
6902
7153
|
const census = censusSkills(skillsRoot);
|
|
6903
7154
|
const out = {
|
|
6904
7155
|
skills: census.withDeterministicObligation,
|
|
@@ -6912,7 +7163,7 @@ function extractObligations(repoRoot) {
|
|
|
6912
7163
|
for (const skill of census.withDeterministicObligation) {
|
|
6913
7164
|
let text;
|
|
6914
7165
|
try {
|
|
6915
|
-
text =
|
|
7166
|
+
text = fs19.readFileSync(path17.join(skillsRoot, skill, "SKILL.md"), "utf-8");
|
|
6916
7167
|
} catch {
|
|
6917
7168
|
continue;
|
|
6918
7169
|
}
|
|
@@ -7028,7 +7279,7 @@ function scanSessionForViolations(session, lines, forbidden, parsed) {
|
|
|
7028
7279
|
return flags;
|
|
7029
7280
|
}
|
|
7030
7281
|
function defaultStore3(cwd) {
|
|
7031
|
-
return
|
|
7282
|
+
return path17.join(os5.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
7032
7283
|
}
|
|
7033
7284
|
function scanStore2(repoRoot, store, limit) {
|
|
7034
7285
|
const census = extractObligations(repoRoot);
|
|
@@ -7041,14 +7292,14 @@ function scanStore2(repoRoot, store, limit) {
|
|
|
7041
7292
|
};
|
|
7042
7293
|
let files;
|
|
7043
7294
|
try {
|
|
7044
|
-
files =
|
|
7295
|
+
files = fs19.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path17.join(store, f), m: fs19.statSync(path17.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
|
|
7045
7296
|
} catch {
|
|
7046
7297
|
return report;
|
|
7047
7298
|
}
|
|
7048
7299
|
report.sessions = files.length;
|
|
7049
7300
|
for (const file of files) {
|
|
7050
|
-
const lines =
|
|
7051
|
-
const id =
|
|
7301
|
+
const lines = fs19.readFileSync(file, "utf-8").split("\n");
|
|
7302
|
+
const id = path17.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
|
|
7052
7303
|
const entries = _parseSession(lines);
|
|
7053
7304
|
if (loadedSkillsFrom(entries).size > 0) report.sessionsWithASkill += 1;
|
|
7054
7305
|
report.flags.push(...scanSessionForViolations(id, lines, census.forbidden, entries));
|
|
@@ -7173,9 +7424,9 @@ function main12(argv) {
|
|
|
7173
7424
|
}
|
|
7174
7425
|
function _isCliEntry11() {
|
|
7175
7426
|
if (process3.argv[1] === void 0) return false;
|
|
7176
|
-
if (import.meta.url === pathToFileURL12(
|
|
7427
|
+
if (import.meta.url === pathToFileURL12(path17.resolve(process3.argv[1])).href) return true;
|
|
7177
7428
|
try {
|
|
7178
|
-
return
|
|
7429
|
+
return fs19.realpathSync(_HERE4) === fs19.realpathSync(path17.resolve(process3.argv[1]));
|
|
7179
7430
|
} catch {
|
|
7180
7431
|
return false;
|
|
7181
7432
|
}
|
|
@@ -7186,20 +7437,20 @@ if (_isCliEntry11()) {
|
|
|
7186
7437
|
|
|
7187
7438
|
// src/scripts/report_conformance_funnel.ts
|
|
7188
7439
|
var _HERE5 = fileURLToPath13(import.meta.url);
|
|
7189
|
-
var REPO_ROOT5 =
|
|
7440
|
+
var REPO_ROOT5 = path18.resolve(path18.dirname(_HERE5), "..", "..");
|
|
7190
7441
|
function buildFunnel(opts = {}) {
|
|
7191
7442
|
const repoRoot = opts.repoRoot ?? REPO_ROOT5;
|
|
7192
|
-
const projectRulesDir = opts.projectRulesDir ??
|
|
7193
|
-
const globalRulesDir = opts.globalRulesDir ??
|
|
7194
|
-
const sourceDir = opts.sourceDir ??
|
|
7443
|
+
const projectRulesDir = opts.projectRulesDir ?? path18.join(repoRoot, PROJECT_RULES);
|
|
7444
|
+
const globalRulesDir = opts.globalRulesDir ?? path18.join(os6.homedir(), GLOBAL_RULES);
|
|
7445
|
+
const sourceDir = opts.sourceDir ?? path18.join(repoRoot, PROJECTION_SOURCE);
|
|
7195
7446
|
const store = opts.store ?? defaultStore(repoRoot);
|
|
7196
7447
|
const limit = opts.limit ?? 30;
|
|
7197
7448
|
return {
|
|
7198
7449
|
delivered: measureDelivered(projectRulesDir, globalRulesDir),
|
|
7199
7450
|
divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
|
|
7200
|
-
skills: censusSkills(
|
|
7451
|
+
skills: censusSkills(path18.join(repoRoot, SKILLS_ROOT)),
|
|
7201
7452
|
usage: measureUsage(store, limit),
|
|
7202
|
-
storePresent:
|
|
7453
|
+
storePresent: fs20.existsSync(store),
|
|
7203
7454
|
sk2: scanStore2(repoRoot, store, limit)
|
|
7204
7455
|
};
|
|
7205
7456
|
}
|
|
@@ -7340,7 +7591,7 @@ function main13(argv) {
|
|
|
7340
7591
|
`);
|
|
7341
7592
|
return 1;
|
|
7342
7593
|
}
|
|
7343
|
-
const resolved =
|
|
7594
|
+
const resolved = path18.resolve(v);
|
|
7344
7595
|
if (a === "--store") opts.store = resolved;
|
|
7345
7596
|
else if (a === "--project") opts.projectRulesDir = resolved;
|
|
7346
7597
|
else if (a === "--global") opts.globalRulesDir = resolved;
|
|
@@ -7372,9 +7623,9 @@ function main13(argv) {
|
|
|
7372
7623
|
}
|
|
7373
7624
|
function _isCliEntry12() {
|
|
7374
7625
|
if (process4.argv[1] === void 0) return false;
|
|
7375
|
-
if (import.meta.url === pathToFileURL13(
|
|
7626
|
+
if (import.meta.url === pathToFileURL13(path18.resolve(process4.argv[1])).href) return true;
|
|
7376
7627
|
try {
|
|
7377
|
-
return
|
|
7628
|
+
return fs20.realpathSync(_HERE5) === fs20.realpathSync(path18.resolve(process4.argv[1]));
|
|
7378
7629
|
} catch {
|
|
7379
7630
|
return false;
|
|
7380
7631
|
}
|
|
@@ -7393,7 +7644,7 @@ var CONFORMANCE_CHECK_IDS = [
|
|
|
7393
7644
|
"lean-projection",
|
|
7394
7645
|
"host-manifest"
|
|
7395
7646
|
];
|
|
7396
|
-
var THIN_STUB_MARKER =
|
|
7647
|
+
var THIN_STUB_MARKER = THIN_ENTRY_MARKER;
|
|
7397
7648
|
var CONFORMANCE_STATUS_SYMBOLS = {
|
|
7398
7649
|
...STATUS_SYMBOLS,
|
|
7399
7650
|
unknown: "\u2754"
|
|
@@ -7411,20 +7662,20 @@ function conformanceLogPath() {
|
|
|
7411
7662
|
if (override && override.trim().length > 0) {
|
|
7412
7663
|
return override;
|
|
7413
7664
|
}
|
|
7414
|
-
return
|
|
7665
|
+
return path19.join(os7.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
|
|
7415
7666
|
}
|
|
7416
7667
|
function installLogPath() {
|
|
7417
7668
|
const override = process5.env["AGENT_CONFIG_INSTALL_LOG"];
|
|
7418
7669
|
if (override && override.trim().length > 0) {
|
|
7419
7670
|
return override;
|
|
7420
7671
|
}
|
|
7421
|
-
return
|
|
7672
|
+
return path19.join(os7.homedir(), ".event4u", "agent-config", "install-log.jsonl");
|
|
7422
7673
|
}
|
|
7423
7674
|
function _installLogExpected(projectRoot) {
|
|
7424
|
-
return
|
|
7675
|
+
return fs21.existsSync(manifest_path(projectRoot));
|
|
7425
7676
|
}
|
|
7426
7677
|
function _check_txlog_clean(logPath = installLogPath(), projectRoot = null) {
|
|
7427
|
-
const entries =
|
|
7678
|
+
const entries = fs21.existsSync(logPath) ? readRecentEntries(logPath) : [];
|
|
7428
7679
|
if (entries.length === 0) {
|
|
7429
7680
|
if (projectRoot !== null && _installLogExpected(projectRoot)) {
|
|
7430
7681
|
return {
|
|
@@ -7458,11 +7709,11 @@ function _check_txlog_clean(logPath = installLogPath(), projectRoot = null) {
|
|
|
7458
7709
|
};
|
|
7459
7710
|
}
|
|
7460
7711
|
function routeTargetPaths(target) {
|
|
7461
|
-
return routeTargetPathsPosix(target).map((
|
|
7712
|
+
return routeTargetPathsPosix(target).map((rel2) => path19.join(...rel2.split("/")));
|
|
7462
7713
|
}
|
|
7463
7714
|
function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
7464
|
-
const routerPath =
|
|
7465
|
-
if (!
|
|
7715
|
+
const routerPath = path19.join(packageRoot, "dist", "router.json");
|
|
7716
|
+
if (!fs21.existsSync(routerPath)) {
|
|
7466
7717
|
return {
|
|
7467
7718
|
id: "router-pointers",
|
|
7468
7719
|
status: "fail",
|
|
@@ -7472,7 +7723,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
7472
7723
|
}
|
|
7473
7724
|
let router;
|
|
7474
7725
|
try {
|
|
7475
|
-
router = JSON.parse(
|
|
7726
|
+
router = JSON.parse(fs21.readFileSync(routerPath, "utf8"));
|
|
7476
7727
|
} catch (exc) {
|
|
7477
7728
|
return {
|
|
7478
7729
|
id: "router-pointers",
|
|
@@ -7481,13 +7732,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
7481
7732
|
remedy: "reinstall the package \u2014 dist/router.json is corrupt"
|
|
7482
7733
|
};
|
|
7483
7734
|
}
|
|
7484
|
-
const rulesDir =
|
|
7735
|
+
const rulesDir = path19.join(packageRoot, "dist", "agent-src", "rules");
|
|
7485
7736
|
const broken = [];
|
|
7486
7737
|
let ids = 0;
|
|
7487
7738
|
let targets = 0;
|
|
7488
7739
|
for (const kernelId of router["kernel"] ?? []) {
|
|
7489
7740
|
ids += 1;
|
|
7490
|
-
if (!
|
|
7741
|
+
if (!fs21.existsSync(path19.join(rulesDir, `${kernelId}.md`))) {
|
|
7491
7742
|
broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
|
|
7492
7743
|
}
|
|
7493
7744
|
}
|
|
@@ -7495,7 +7746,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
7495
7746
|
for (const entry of router[tier] ?? []) {
|
|
7496
7747
|
const ruleId = String(entry["id"] ?? "");
|
|
7497
7748
|
ids += 1;
|
|
7498
|
-
if (!
|
|
7749
|
+
if (!fs21.existsSync(path19.join(rulesDir, `${ruleId}.md`))) {
|
|
7499
7750
|
broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
|
|
7500
7751
|
}
|
|
7501
7752
|
for (const target of entry["routes_to"] ?? []) {
|
|
@@ -7505,7 +7756,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT) {
|
|
|
7505
7756
|
broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
|
|
7506
7757
|
continue;
|
|
7507
7758
|
}
|
|
7508
|
-
if (!candidates.some((
|
|
7759
|
+
if (!candidates.some((rel2) => fs21.existsSync(path19.join(packageRoot, rel2)))) {
|
|
7509
7760
|
broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
|
|
7510
7761
|
}
|
|
7511
7762
|
}
|
|
@@ -7537,9 +7788,9 @@ function detectSmokePlatform(projectRoot) {
|
|
|
7537
7788
|
return "claude";
|
|
7538
7789
|
}
|
|
7539
7790
|
function dispatcherRunner(packageRoot) {
|
|
7540
|
-
const localTsx =
|
|
7541
|
-
const script =
|
|
7542
|
-
if (
|
|
7791
|
+
const localTsx = path19.join(packageRoot, "node_modules", ".bin", "tsx");
|
|
7792
|
+
const script = path19.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
|
|
7793
|
+
if (fs21.existsSync(localTsx)) {
|
|
7543
7794
|
return [localTsx, script];
|
|
7544
7795
|
}
|
|
7545
7796
|
return ["npx", "tsx", script];
|
|
@@ -7589,12 +7840,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT, opts =
|
|
|
7589
7840
|
};
|
|
7590
7841
|
}
|
|
7591
7842
|
function readSettingsMode(projectRoot) {
|
|
7592
|
-
const settingsPath =
|
|
7593
|
-
if (!
|
|
7843
|
+
const settingsPath = path19.join(projectRoot, ".agent-settings.yml");
|
|
7844
|
+
if (!fs21.existsSync(settingsPath)) {
|
|
7594
7845
|
return "eager-all";
|
|
7595
7846
|
}
|
|
7596
7847
|
try {
|
|
7597
|
-
const parsed = YAML.parse(
|
|
7848
|
+
const parsed = YAML.parse(fs21.readFileSync(settingsPath, "utf8"));
|
|
7598
7849
|
const lean = parsed?.["lean_projection"] ?? null;
|
|
7599
7850
|
const mode = lean?.["mode"];
|
|
7600
7851
|
return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
|
|
@@ -7605,7 +7856,7 @@ function readSettingsMode(projectRoot) {
|
|
|
7605
7856
|
function kernelIdsFromRouter(packageRoot) {
|
|
7606
7857
|
try {
|
|
7607
7858
|
const router = JSON.parse(
|
|
7608
|
-
|
|
7859
|
+
fs21.readFileSync(path19.join(packageRoot, "dist", "router.json"), "utf8")
|
|
7609
7860
|
);
|
|
7610
7861
|
return new Set((router["kernel"] ?? []).map(String));
|
|
7611
7862
|
} catch {
|
|
@@ -7622,8 +7873,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
7622
7873
|
remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
|
|
7623
7874
|
};
|
|
7624
7875
|
}
|
|
7625
|
-
const rulesDir = projectedRulesDir ??
|
|
7626
|
-
if (!
|
|
7876
|
+
const rulesDir = projectedRulesDir ?? path19.join(projectRoot, ".augment", "rules");
|
|
7877
|
+
if (!fs21.existsSync(rulesDir)) {
|
|
7627
7878
|
return {
|
|
7628
7879
|
id: "lean-projection",
|
|
7629
7880
|
status: "skipped",
|
|
@@ -7632,7 +7883,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
7632
7883
|
};
|
|
7633
7884
|
}
|
|
7634
7885
|
const kernel = kernelIdsFromRouter(packageRoot);
|
|
7635
|
-
const files =
|
|
7886
|
+
const files = fs21.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
|
|
7636
7887
|
const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
|
|
7637
7888
|
if (nonKernel.length === 0) {
|
|
7638
7889
|
return {
|
|
@@ -7646,7 +7897,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
7646
7897
|
for (const f of nonKernel) {
|
|
7647
7898
|
let text = "";
|
|
7648
7899
|
try {
|
|
7649
|
-
text =
|
|
7900
|
+
text = fs21.readFileSync(path19.join(rulesDir, f), "utf8");
|
|
7650
7901
|
} catch {
|
|
7651
7902
|
continue;
|
|
7652
7903
|
}
|
|
@@ -7677,8 +7928,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT, project
|
|
|
7677
7928
|
function _check_host_manifest(projectRoot) {
|
|
7678
7929
|
const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
|
|
7679
7930
|
const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
|
|
7680
|
-
const settingsPath =
|
|
7681
|
-
if (!
|
|
7931
|
+
const settingsPath = path19.join(projectRoot, ".agent-settings.yml");
|
|
7932
|
+
if (!fs21.existsSync(settingsPath)) {
|
|
7682
7933
|
return {
|
|
7683
7934
|
id: "host-manifest",
|
|
7684
7935
|
status: "ok",
|
|
@@ -7688,7 +7939,7 @@ function _check_host_manifest(projectRoot) {
|
|
|
7688
7939
|
}
|
|
7689
7940
|
let parsed = null;
|
|
7690
7941
|
try {
|
|
7691
|
-
parsed = YAML.parse(
|
|
7942
|
+
parsed = YAML.parse(fs21.readFileSync(settingsPath, "utf8"));
|
|
7692
7943
|
} catch (exc) {
|
|
7693
7944
|
return {
|
|
7694
7945
|
id: "host-manifest",
|
|
@@ -7862,13 +8113,13 @@ function _isCliEntry13() {
|
|
|
7862
8113
|
if (process5.argv[1] === void 0) {
|
|
7863
8114
|
return false;
|
|
7864
8115
|
}
|
|
7865
|
-
const argvUrl = pathToFileURL14(
|
|
8116
|
+
const argvUrl = pathToFileURL14(path19.resolve(process5.argv[1])).href;
|
|
7866
8117
|
if (import.meta.url === argvUrl) {
|
|
7867
8118
|
return true;
|
|
7868
8119
|
}
|
|
7869
8120
|
try {
|
|
7870
|
-
const here =
|
|
7871
|
-
const argv =
|
|
8121
|
+
const here = fs21.realpathSync(fileURLToPath14(import.meta.url));
|
|
8122
|
+
const argv = fs21.realpathSync(path19.resolve(process5.argv[1]));
|
|
7872
8123
|
return here === argv;
|
|
7873
8124
|
} catch {
|
|
7874
8125
|
return false;
|