@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
|
@@ -19,5 +19,5 @@
|
|
|
19
19
|
`),l}function Qr(e,t){if(t.valueStart===zr)return``;let{valueStart:n,valueEnd:r}=t;if(t.fast)return e.slice(n,r);switch(t.style){case R.SINGLE_QUOTED:return Yr(e,n,r);case R.DOUBLE_QUOTED:return Xr(e,n,r);case R.LITERAL_BLOCK:return Zr(e,n,r,t.indent,t.chomping,!1);case R.FOLDED_BLOCK:return Zr(e,n,r,t.indent,t.chomping,!0);default:return Jr(e,n,r)}}var $r=Object.assign(Object.create(null),{"!":`!`,"!!":`tag:yaml.org,2002:`});function ei(e,t){if(e.startsWith(`!<`)&&e.endsWith(`>`))return decodeURIComponent(e.slice(2,-1));let n=e.indexOf(`!`,1),r=n===-1?`!`:e.slice(0,n+1),i=t?.[r]??$r[r]??r;return decodeURIComponent(i)+decodeURIComponent(e.slice(r.length))}var ti=-1,ni=`tag:yaml.org,2002:merge`,ri={filename:``,schema:Ar,json:!1,maxTotalMergeKeys:1e4,maxAliases:-1};function ii(e){return`tagStart`in e&&e.tagStart!==ti?e.tagStart:`anchorStart`in e&&e.anchorStart!==ti?e.anchorStart:`valueStart`in e&&e.valueStart!==ti?e.valueStart:`start`in e?e.start:0}function B(e,t){Lr.throwAt(e.source,e.position,t,e.filename)}function ai(e,t,n,r){try{return n.finalize(r)}catch(n){if(n instanceof Lr)throw n;Lr.throwAt(e.source,t,n instanceof Error?n.message:String(n),e.filename)}}function oi(e,t){let n=Qr(e.source,t),r=t.tagStart===ti?``:e.source.slice(t.tagStart,t.tagEnd),i=e.schema.defaultScalarTag;if(r!==``){if(r===`!`)return{value:n,tag:i};let t=ei(r,e.tagHandlers),a=e.schema.lookupScalarTag(t);if(a){let r=a.resolve(n,!0,t);return r===F&&B(e,`cannot resolve a node with !<${t}> explicit tag`),{value:r,tag:a}}let o=e.schema.lookupMappingTag(t)??e.schema.lookupSequenceTag(t);if(o){n!==``&&B(e,`cannot resolve a node with !<${t}> explicit tag`);let r=o.create(t);return{value:o.carrierIsResult?r:ai(e,e.position,o,r),tag:o}}B(e,`unknown scalar tag !<${t}>`)}return t.style===R.PLAIN?e.schema.resolveImplicitScalarTag(n):{value:i.resolve(n,!1,i.tagName),tag:i}}function si(e,t,n){let r=t.tagStart===ti?``:e.source.slice(t.tagStart,t.tagEnd);return r===``||r===`!`?n:ei(r,e.tagHandlers)}function ci(e){return e.nodeKind===`mapping`}function li(e){e.totalMergeKeys++,e.maxTotalMergeKeys!==-1&&e.totalMergeKeys>e.maxTotalMergeKeys&&B(e,`merge keys exceeded maxTotalMergeKeys (${e.maxTotalMergeKeys})`)}function ui(e,t,n,r){li(e);for(let i of r.keys(n)){if(li(e),t.tag.has(t.value,i))continue;let a=t.tag.addPair(t.value,i,r.get(n,i));a&&B(e,a),t.overridable??=new Set,t.overridable.add(i)}}function di(e,t,n,r){if(e.position=t.keyPosition,ci(r))ui(e,t,n,r);else if(r.nodeKind===`sequence`&&Array.isArray(n)){n.length>100&&B(e,`abnormal merge sequence size`);for(let r of n){let n=e.nodeTags.get(r);n||B(e,`cannot merge mappings; the provided source object is unacceptable`),ui(e,t,r,n)}}else B(e,`cannot merge mappings; the provided source object is unacceptable`)}function fi(e,t,n,r,i){if(e.position=t.keyPosition,t.keyIsMerge){di(e,t,r,i);return}!e.json&&t.tag.has(t.value,n)&&!t.overridable?.has(n)&&B(e,`duplicated mapping key`);let a=t.tag.addPair(t.value,n,r);a&&B(e,a),t.overridable?.delete(n)}function pi(e,t,n){let r=e.frames[e.frames.length-1];if(r.kind===`document`)r.value=t,r.hasValue=!0;else if(r.kind===`sequence`){ci(n)&&e.nodeTags.set(t,n);let i=r.tag.addItem(r.value,t,r.index++);i&&B(e,i)}else if(r.hasKey){let i=r.key;r.key=void 0,r.hasKey=!1,fi(e,r,i,t,n)}else r.key=t,r.keyPosition=e.position,r.hasKey=!0,r.keyIsMerge=n.tagName===ni}function mi(e,t,n,r,i){if(t.anchorStart!==ti){let a={value:n,tag:r,isValueFinal:i};return e.anchors.set(e.source.slice(t.anchorStart,t.anchorEnd),a),a}return null}function hi(e,t){let n={...ri,...t,events:e,documents:[],eventIndex:0,position:0,frames:[],anchors:new Map,nodeTags:new Map,tagHandlers:Object.create(null),totalMergeKeys:0,aliasCount:0};for(;n.eventIndex<n.events.length;){let e=n.events[n.eventIndex++];switch(n.position=ii(e),e.type){case L.DOCUMENT:n.anchors=new Map,n.nodeTags=new Map,n.aliasCount=0,n.tagHandlers=Object.create(null);for(let t of e.directives)t.kind===`tag`&&(n.tagHandlers[t.handle]=t.prefix);n.frames.push({kind:`document`,position:n.position,value:void 0,hasValue:!1});break;case L.SCALAR:{let{value:t,tag:r}=oi(n,e);mi(n,e,t,r,!0),pi(n,t,r);break}case L.SEQUENCE:{let t=si(n,e,`tag:yaml.org,2002:seq`),r=n.schema.lookupSequenceTag(t);r||B(n,`unknown sequence tag !<${t}>`);let i=r.create(t),a=mi(n,e,i,r,r.carrierIsResult);n.frames.push({kind:`sequence`,position:n.position,value:i,tag:r,anchor:a,index:0});break}case L.MAPPING:{let t=si(n,e,`tag:yaml.org,2002:map`),r=n.schema.lookupMappingTag(t);r||B(n,`unknown mapping tag !<${t}>`);let i=r.create(t),a=mi(n,e,i,r,r.carrierIsResult);n.frames.push({kind:`mapping`,position:n.position,value:i,tag:r,anchor:a,key:void 0,keyPosition:n.position,hasKey:!1,keyIsMerge:!1,overridable:null});break}case L.ALIAS:{n.maxAliases!==-1&&++n.aliasCount>n.maxAliases&&B(n,`aliases exceeded maxAliases (${n.maxAliases})`);let t=n.source.slice(e.anchorStart,e.anchorEnd),r=n.anchors.get(t);r||B(n,`unidentified alias "${t}"`),r.isValueFinal||B(n,`recursive alias "${t}" is not supported for tag ${r.tag.tagName} because it uses finalize()`),pi(n,r.value,r.tag);break}case L.POP:{let e=n.frames.pop();if(e.kind===`mapping`&&e.hasKey&&(n.position=e.keyPosition,B(n,`incomplete mapping pair in event stream`)),e.kind===`document`)n.documents.push(e.value);else{let t=e.tag.carrierIsResult?e.value:ai(n,e.position,e.tag,e.value);e.anchor&&(e.anchor.value=t,e.anchor.isValueFinal=!0),pi(n,t,e.tag)}break}}}return n.documents}var V=-1,gi=Object.prototype.hasOwnProperty,_i=1,vi=2,yi=3,bi=4,xi=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Si=/[,\[\]{}]/,Ci=/^(?:!|!!|![0-9A-Za-z-]+!)$/,wi=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$,_.!~*'()\[\]])`,Ti=String.raw`(?:%[0-9A-Fa-f]{2}|[0-9A-Za-z\-#;/?:@&=+$.~*'()_])`,Ei=RegExp(`^(?:${wi})*$`),Di=RegExp(`^(?:${Ti})+$`),Oi=RegExp(`^(?:!(?:${wi})*|${Ti}(?:${wi})*)$`),ki={filename:``,maxDepth:100};function Ai(e,t,n){e.events.push({type:L.DOCUMENT,explicitStart:t,explicitEnd:n,directives:e.directives})}function ji(e,t,n,r,i,a,o){e.events.push({type:L.SEQUENCE,start:t,anchorStart:n,anchorEnd:r,tagStart:i,tagEnd:a,style:o})}function Mi(e,t,n,r,i,a,o){e.events.push({type:L.MAPPING,start:t,anchorStart:n,anchorEnd:r,tagStart:i,tagEnd:a,style:o})}function Ni(e,t){e.events.splice(t.eventsLength,0,{type:L.MAPPING,start:t.position,anchorStart:V,anchorEnd:V,tagStart:V,tagEnd:V,style:Rr.FLOW})}function Pi(e,t,n,r,i,a,o,s,c=z.CLIP,l=-1,u=!1){e.events.push({type:L.SCALAR,valueStart:t,valueEnd:n,anchorStart:r,anchorEnd:i,tagStart:a,tagEnd:o,style:s,chomping:c,indent:l,fast:u})}function Fi(e,t,n){e.events.push({type:L.ALIAS,anchorStart:t,anchorEnd:n})}function Ii(e){e.events.push({type:L.POP})}function H(e){Pi(e,V,V,V,V,V,V,R.PLAIN)}function Li(){return{anchorStart:V,anchorEnd:V,tagStart:V,tagEnd:V}}function Ri(e){return{position:e.position,line:e.line,lineStart:e.lineStart,lineIndent:e.lineIndent,firstTabInLine:e.firstTabInLine,eventsLength:e.events.length}}function zi(e,t){e.position=t.position,e.line=t.line,e.lineStart=t.lineStart,e.lineIndent=t.lineIndent,e.firstTabInLine=t.firstTabInLine,e.events.length=t.eventsLength}function U(e,t){Lr.throwAt(e.input.slice(0,e.length),e.position,t,e.filename)}function W(e){return e===10||e===13}function Bi(e){return e===9||e===32}function G(e){return Bi(e)||W(e)}function Vi(e){return e===0||G(e)}function Hi(e){return e===44||e===91||e===93||e===123||e===125}function Ui(e){return e>=48&&e<=57?e-48:-1}function Wi(e){if(e>=48&&e<=57)return e-48;let t=e|32;return t>=97&&t<=102?t-97+10:-1}function Gi(e){return e===120?2:e===117?4:e===85?8:0}function Ki(e){return e===48||e===97||e===98||e===116||e===9||e===110||e===118||e===102||e===114||e===101||e===32||e===34||e===47||e===92||e===78||e===95||e===76||e===80}function qi(e){e.input.charCodeAt(e.position)===10?e.position++:(e.position++,e.input.charCodeAt(e.position)===10&&e.position++),e.line++,e.lineStart=e.position,e.lineIndent=0,e.firstTabInLine=-1}function K(e,t){let n=0,r=e.input.charCodeAt(e.position),i=e.position===e.lineStart||G(e.input.charCodeAt(e.position-1));for(;r!==0;){for(;Bi(r);)i=!0,r===9&&e.firstTabInLine===-1&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position);if(t&&i&&r===35)do r=e.input.charCodeAt(++e.position);while(!W(r)&&r!==0);if(!W(r))break;for(qi(e),n++,i=!0,r=e.input.charCodeAt(e.position);r===32;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return n}function Ji(e,t=e.position){let n=e.input.charCodeAt(t);if((n===45||n===46)&&n===e.input.charCodeAt(t+1)&&n===e.input.charCodeAt(t+2)){let n=e.input.charCodeAt(t+3);return n===0||G(n)}return!1}function Yi(e){e.position===e.lineStart&&e.input.charCodeAt(e.position)===65279&&(e.position++,e.lineStart=e.position)}function Xi(e){if(e.position!==e.lineStart)return!1;if(Ji(e))return!0;if(e.input.charCodeAt(e.position)!==65279)return!1;let t=Ri(e);Yi(e),K(e,!0);let n=e.input.charCodeAt(e.position),r=e.position===e.lineStart&&(n===37||n===45&&Ji(e));return zi(e,t),r}function Zi(e){let t=e.input.charCodeAt(e.position);for(;t!==0&&!W(t);)t=e.input.charCodeAt(++e.position)}function Qi(e,t,n){xi.test(e.input.slice(t,n))&&U(e,`the stream contains non-printable characters`)}function $i(e,t,n){if(e.input.charCodeAt(e.position)!==33)return!1;t.tagStart!==V&&U(e,`duplication of a tag property`);let r=e.position,i=!1,a=!1,o=`!`,s=e.input.charCodeAt(++e.position);s===60?(i=!0,s=e.input.charCodeAt(++e.position)):s===33&&(a=!0,o=`!!`,s=e.input.charCodeAt(++e.position));let c=e.position,l;if(i){for(;s!==0&&s!==62;)s=e.input.charCodeAt(++e.position);s!==62&&U(e,`unexpected end of the stream within a verbatim tag`),l=e.input.slice(c,e.position),e.position++}else{for(;s!==0&&!G(s)&&!(n&&Hi(s));)s===33&&(a?U(e,`tag suffix cannot contain exclamation marks`):(o=e.input.slice(c-1,e.position+1),Ci.test(o)||U(e,`named tag handle cannot contain such characters`),a=!0,c=e.position+1)),s=e.input.charCodeAt(++e.position);l=e.input.slice(c,e.position),Si.test(l)&&U(e,`tag suffix cannot contain flow indicator characters`)}return l&&!(i?Ei.test(l):Di.test(l))&&U(e,`tag name cannot contain such characters: ${l}`),!i&&o!==`!`&&o!==`!!`&&!gi.call(e.tagHandlers,o)&&U(e,`undeclared tag handle "${o}"`),t.tagStart=r,t.tagEnd=e.position,!0}function ea(e,t){if(e.input.charCodeAt(e.position)!==38)return!1;t.anchorStart!==V&&U(e,`duplication of an anchor property`),e.position++;let n=e.position;for(;e.input.charCodeAt(e.position)!==0&&!G(e.input.charCodeAt(e.position))&&!Hi(e.input.charCodeAt(e.position));)e.position++;return e.position===n&&U(e,`name of an anchor node must contain at least one character`),t.anchorStart=n,t.anchorEnd=e.position,!0}function ta(e,t){if(e.input.charCodeAt(e.position)!==42)return!1;(t.anchorStart!==V||t.tagStart!==V)&&U(e,`alias node should not have any properties`),e.position++;let n=e.position;for(;e.input.charCodeAt(e.position)!==0&&!G(e.input.charCodeAt(e.position))&&!Hi(e.input.charCodeAt(e.position));)e.position++;return e.position===n&&U(e,`name of an alias node must contain at least one character`),Fi(e,n,e.position),!0}function na(e,t){K(e,!1),e.lineIndent<t&&U(e,`deficient indentation`)}function ra(e,t,n){if(e.input.charCodeAt(e.position)!==39)return!1;e.position++;let r=e.position,i=!0;for(;e.input.charCodeAt(e.position)!==0;){let a=e.input.charCodeAt(e.position);if(a===39){if(e.input.charCodeAt(e.position+1)===39){i=!1,e.position+=2;continue}let t=e.position;return e.position++,Pi(e,r,t,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,R.SINGLE_QUOTED,z.CLIP,-1,i),!0}W(a)?(i=!1,na(e,t)):e.position===e.lineStart&&Ji(e)?U(e,`unexpected end of the document within a single quoted scalar`):a!==9&&a<32?U(e,`expected valid JSON character`):e.position++}U(e,`unexpected end of the stream within a single quoted scalar`)}function ia(e,t,n){if(e.input.charCodeAt(e.position)!==34)return!1;e.position++;let r=e.position,i=!0;for(;e.input.charCodeAt(e.position)!==0;){let a=e.input.charCodeAt(e.position);if(a===34){let t=e.position;return e.position++,Pi(e,r,t,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,R.DOUBLE_QUOTED,z.CLIP,-1,i),!0}if(a===92){i=!1;let n=e.input.charCodeAt(++e.position);if(W(n))na(e,t);else if(Ki(n))e.position++;else{let t=Gi(n);for(t===0&&U(e,`unknown escape sequence`);t-->0;)e.position++,Wi(e.input.charCodeAt(e.position))<0&&U(e,`expected hexadecimal character`);e.position++}}else W(a)?(i=!1,na(e,t)):e.position===e.lineStart&&Ji(e)?U(e,`unexpected end of the document within a double quoted scalar`):a!==9&&a<32?U(e,`expected valid JSON character`):e.position++}U(e,`unexpected end of the stream within a double quoted scalar`)}function aa(e,t,n){let r=e.input.charCodeAt(e.position),i=z.CLIP,a=-1,o=!1;if(r!==124&&r!==62)return!1;let s=r===124?R.LITERAL_BLOCK:R.FOLDED_BLOCK;for(e.position++;e.input.charCodeAt(e.position)!==0;){let n=e.input.charCodeAt(e.position),r=Ui(n);if(n===43||n===45)i!==z.CLIP&&U(e,`repeat of a chomping mode identifier`),i=n===43?z.KEEP:z.STRIP,e.position++;else if(r>=0)r===0&&U(e,`bad explicit indentation width of a block scalar; it cannot be less than one`),o&&U(e,`repeat of an indentation width identifier`),a=t+r-1,o=!0,e.position++;else break}let c=!1;for(;Bi(e.input.charCodeAt(e.position));)c=!0,e.position++;c&&e.input.charCodeAt(e.position)===35&&Zi(e),W(e.input.charCodeAt(e.position))?qi(e):e.input.charCodeAt(e.position)!==0&&U(e,`a line break is expected`);let l=o?a:-1,u=0,d=e.position,f=e.position;for(;e.input.charCodeAt(e.position)!==0;){let n=e.position,r=0;for(;e.input.charCodeAt(n+r)===32;)r++;let i=e.input.charCodeAt(n+r);if(i===0){l>=0?r>l&&(f=n+r):r>0&&(f=n+r);break}if(Xi(e))break;if(!o&&l===-1&&W(i)&&(u=Math.max(u,r)),!o&&l===-1&&!W(i)&&(i===9&&r<t&&(e.position=n+r,U(e,`tab characters must not be used in indentation`)),r<u&&(e.position=n+r,U(e,`bad indentation of a mapping entry`))),l===-1&&i!==0&&!W(i)&&r<t){e.lineIndent=r,e.position=n+r;break}!o&&i!==0&&!W(i)&&l===-1&&(l=r);let a=l===-1?t+1:l;if(i!==0&&!W(i)&&r<a){e.lineIndent=r,e.position=n+r;break}Zi(e),f=e.position,W(e.input.charCodeAt(e.position))&&(qi(e),f=e.position)}return Qi(e,d,f),Pi(e,d,f,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,s,i,l),!0}function oa(e,t){let n=e.input.charCodeAt(e.position),r=t===_i;if(n===0||G(n)||n===35||n===38||n===42||n===33||n===124||n===62||n===39||n===34||n===37||n===64||n===96||r&&Hi(n))return!1;if(n===63||n===45){let t=e.input.charCodeAt(e.position+1);if(Vi(t)||r&&Hi(t))return!1}return!0}function sa(e,t,n,r){if(!oa(e,n))return!1;let i=e.position,a=e.position,o=e.input.charCodeAt(e.position),s=n===_i,c=!1;for(;o!==0&&!Xi(e);){if(o===58){let t=e.input.charCodeAt(e.position+1);if(Vi(t)||s&&Hi(t))break}else if(o===35){if(G(e.input.charCodeAt(e.position-1)))break}else if(s&&Hi(o))break;else if(W(o)){let n=e.position,r=e.line,i=e.lineStart,a=e.lineIndent;if(K(e,!1),e.lineIndent>=t){c=!0,o=e.input.charCodeAt(e.position);continue}e.position=n,e.line=r,e.lineStart=i,e.lineIndent=a;break}Bi(o)||(a=e.position+1),o=e.input.charCodeAt(++e.position)}return a!==i&&(Qi(e,i,a),Pi(e,i,a,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,R.PLAIN,z.CLIP,-1,!c),!0)}function ca(e,t){let n=e.line;K(e,!0),(e.line>n&&e.lineIndent<t||e.firstTabInLine!==-1&&e.lineIndent<t)&&U(e,`deficient indentation`)}function la(e,t,n){let r=e.input.charCodeAt(e.position),i=r===123,a=e.position,o=!0;if(r!==91&&r!==123)return!1;let s=i?125:93;for(i?Mi(e,a,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,Rr.FLOW):ji(e,a,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,Rr.FLOW),e.position++;e.input.charCodeAt(e.position)!==0;){ca(e,t);let n=e.input.charCodeAt(e.position);if(n===s)return e.position++,Ii(e),!0;o?n===44&&U(e,`expected the node content, but found ','`):U(e,`missed comma between flow collection entries`);let r=!1,a=!1;n===63&&G(e.input.charCodeAt(e.position+1))&&(r=a=!0,e.position+=1,ca(e,t));let c=e.line,l=Ri(e),u=fa(e,t,_i,!1,!0);ca(e,t),n=e.input.charCodeAt(e.position),(i||a||e.line===c)&&n===58?(r=!0,e.position++,ca(e,t),i||Ni(e,l),u||H(e),fa(e,t,_i,!1,!0)||H(e),ca(e,t),i||Ii(e)):i&&r?(u||H(e),H(e)):i?H(e):r&&(Ni(e,l),u||H(e),H(e),Ii(e)),n=e.input.charCodeAt(e.position),n===44?(o=!0,e.position++):o=!1}U(e,`unexpected end of the stream within a flow collection`)}function ua(e,t,n){if(e.firstTabInLine!==-1||e.input.charCodeAt(e.position)!==45||!Vi(e.input.charCodeAt(e.position+1)))return!1;for(ji(e,e.position,n.anchorStart,n.anchorEnd,n.tagStart,n.tagEnd,Rr.BLOCK);e.input.charCodeAt(e.position)===45&&Vi(e.input.charCodeAt(e.position+1));){e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,U(e,`tab characters must not be used in indentation`));let n=e.line;e.position++;let r=K(e,!0)>0;if(e.firstTabInLine!==-1&&e.input.charCodeAt(e.position)===45&&Vi(e.input.charCodeAt(e.position+1))&&U(e,`bad indentation of a sequence entry`),r&&e.lineIndent<=t?H(e):fa(e,t,yi,!1,!0),K(e,!0),e.lineIndent<t||e.position>=e.length)break;e.lineIndent>t&&U(e,`bad indentation of a sequence entry`),e.line===n&&e.input.charCodeAt(e.position)===45&&Vi(e.input.charCodeAt(e.position+1))&&U(e,`bad indentation of a sequence entry`)}return Ii(e),!0}function da(e,t,n,r){let i=!1,a=!1,o=!1,s=!1;if(e.firstTabInLine!==-1)return!1;let c=e.input.charCodeAt(e.position);for(;c!==0;){!i&&e.firstTabInLine!==-1&&(e.position=e.firstTabInLine,U(e,`tab characters must not be used in indentation`));let l=e.input.charCodeAt(e.position+1),u=e.line;if((c===63||c===58)&&Vi(l))o||=(Mi(e,e.position,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,Rr.BLOCK),!0),c===63?(i&&H(e),a=!0,i=!0):i?i=!1:(H(e),a=!0,i=!1),e.position+=1,s=!0;else{i&&=(H(e),!1);let t=Ri(e);if(!fa(e,n,vi,!1,!0))break;if(e.line===u){for(c=e.input.charCodeAt(e.position);Bi(c);)c=e.input.charCodeAt(++e.position);if(c===58){if(c=e.input.charCodeAt(++e.position),Vi(c)||U(e,`a whitespace character is expected after the key-value separator within a block mapping`),!o){for(zi(e,t),Mi(e,t.position,r.anchorStart,r.anchorEnd,r.tagStart,r.tagEnd,Rr.BLOCK),o=!0,fa(e,n,vi,!1,!0),c=e.input.charCodeAt(e.position);Bi(c);)c=e.input.charCodeAt(++e.position);e.position++}a=!0,i=!1,s=!1}else if(a)U(e,`expected ':' after a mapping key`);else return r.anchorStart!==V||r.tagStart!==V?(zi(e,t),!1):!0}else if(a)U(e,`can not read a block mapping entry; a multiline key may not be an implicit key`);else return r.anchorStart!==V||r.tagStart!==V?(zi(e,t),!1):!0}if(fa(e,t,bi,!0,s)&&(s=!1),i||(s&&=(H(e),!1)),K(e,!0),c=e.input.charCodeAt(e.position),(e.line===u||e.lineIndent>t)&&c!==0)U(e,`bad indentation of a mapping entry`);else if(e.lineIndent<t)break}return a?(i&&H(e),o&&Ii(e),!0):!1}function fa(e,t,n,r,i,a=!0){e.depth>=e.maxDepth&&U(e,`nesting exceeded maxDepth (${e.maxDepth})`),e.depth++;let o=1,s=!1,c=!1,l=null,u=Li(),d=n===bi||n===yi,f=d,p=d;if(r&&K(e,!0)&&(s=!0,o=e.lineIndent>t?1:e.lineIndent===t?0:-1),o===1)for(;;){let r=e.input.charCodeAt(e.position),i=Ri(e);if(s&&o!==1&&(r===33||r===38))break;if(s&&p&&(u.tagStart!==V||u.anchorStart!==V)&&(r===33||r===38)){let n=Ri(e),r=t+1;if(da(e,e.position-e.lineStart,r,u)&&e.events[n.eventsLength]?.type===L.MAPPING)return e.depth--,!0;zi(e,n)}if(s&&(r===33&&u.tagStart!==V||r===38&&u.anchorStart!==V)||!$i(e,u,n===_i)&&!ea(e,u))break;l===null&&(l=i),K(e,!0)?(s=!0,f=p,o=e.lineIndent>t?1:e.lineIndent===t?0:-1):f=!1}if(f&&=s||i,o===1||n===bi){let r=n===_i||n===vi?t:t+1,i=e.position-e.lineStart;if(o===1){if(f&&(ua(e,i,u)||da(e,i,r,u))||la(e,r,u))c=!0;else{let t=e.input.charCodeAt(e.position);if(l!==null&&a&&p&&!f&&t!==124&&t!==62){let t=Ri(e),n=l.position-l.lineStart;zi(e,l),da(e,n,r,Li())&&e.events[t.eventsLength]?.type===L.MAPPING?c=!0:zi(e,t)}!c&&(d&&aa(e,r,u)||ra(e,r,u)||ia(e,r,u)||ta(e,u)||sa(e,r,n,u))&&(c=!0)}}else o===0&&(c=f&&ua(e,i,u))}return d&&=!c,!c&&(u.anchorStart!==V||u.tagStart!==V||d)&&(Pi(e,V,V,u.anchorStart,u.anchorEnd,u.tagStart,u.tagEnd,R.PLAIN),c=!0),e.depth--,c||u.anchorStart!==V||u.tagStart!==V}function pa(e){if(e.lineIndent>0||e.input.charCodeAt(e.position)!==37)return!1;e.position++;let t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!G(e.input.charCodeAt(e.position));)e.position++;let n=e.input.slice(t,e.position),r=[];for(n.length===0&&U(e,`directive name must not be less than one character in length`);e.input.charCodeAt(e.position)!==0&&!W(e.input.charCodeAt(e.position));){for(;Bi(e.input.charCodeAt(e.position));)e.position++;if(e.input.charCodeAt(e.position)===35||W(e.input.charCodeAt(e.position))||e.input.charCodeAt(e.position)===0)break;let t=e.position;for(;e.input.charCodeAt(e.position)!==0&&!G(e.input.charCodeAt(e.position));)e.position++;r.push(e.input.slice(t,e.position))}if(W(e.input.charCodeAt(e.position))&&qi(e),n===`YAML`){e.directives.some(e=>e.kind===`yaml`)&&U(e,`duplication of %YAML directive`),r.length!==1&&U(e,`YAML directive accepts exactly one argument`);let t=/^([0-9]+)\.([0-9]+)$/.exec(r[0]);t===null&&U(e,`ill-formed argument of the YAML directive`),parseInt(t[1],10)!==1&&U(e,`unacceptable YAML version of the document`),e.directives.push({kind:`yaml`,version:r[0]})}else if(n===`TAG`){r.length!==2&&U(e,`TAG directive accepts exactly two arguments`);let[t,n]=r;Ci.test(t)||U(e,`ill-formed tag handle (first argument) of the TAG directive`),gi.call(e.tagHandlers,t)&&U(e,`there is a previously declared suffix for "${t}" tag handle`),Oi.test(n)||U(e,`ill-formed tag prefix (second argument) of the TAG directive`),e.tagHandlers[t]=n,e.directives.push({kind:`tag`,handle:t,prefix:n})}return!0}function ma(e){e.directives=[],e.tagHandlers=Object.create(null);let t=!1;for(K(e,!0);pa(e);)t=!0,K(e,!0);let n=!1,r=!1,i=!0;if(e.lineIndent===0&&e.input.charCodeAt(e.position)===45&&e.input.charCodeAt(e.position+1)===45&&e.input.charCodeAt(e.position+2)===45&&Vi(e.input.charCodeAt(e.position+3))){n=!0;let t=e.line;e.position+=3,K(e,!0),i=e.line>t}else t&&U(e,`directives end mark is expected`);let a=e.events.length;if(!n&&e.position===e.lineStart&&e.input.charCodeAt(e.position)===46&&Ji(e)){e.position+=3,K(e,!0);return}if(Ai(e,n,!1),fa(e,e.lineIndent-1,bi,!1,i,i)||H(e),K(e,!0),e.position===e.lineStart&&Ji(e)&&(r=e.input.charCodeAt(e.position)===46,r)){let t=e.line;e.position+=3,K(e,!0),e.line===t&&e.position<e.length&&U(e,`end of the stream or a document separator is expected`)}let o=e.events[a];o?.type===L.DOCUMENT&&(o.explicitEnd=r),Ii(e),!r&&e.position<e.length&&!Xi(e)&&U(e,`end of the stream or a document separator is expected`)}function ha(e,t){let n=e.length,r={...ki,...t,input:`${e}\0`,length:n,position:0,line:0,lineStart:0,lineIndent:0,firstTabInLine:-1,depth:0,directives:[],tagHandlers:Object.create(null),events:[]},i=e.indexOf(`\0`);for(i!==-1&&Lr.throwAt(e,i,`null byte is not allowed in input`,r.filename);r.position<r.length&&(Yi(r),K(r,!0),!(r.position>=r.length));){let e=r.position;ma(r),r.position===e&&U(r,`can not read a document`)}return r.events}var ga={...ki,...ri};function _a(e,t={}){let n={...ga,...t},r=String(e),i=Object.keys(ki),a=Object.keys(ri);return hi(ha(r,br(n,i)),{...br(n,a),source:r})}function va(e,t){let n=_a(e,t);if(n.length===0)throw new Lr(`expected a document, but the input is empty`);if(n.length===1)return n[0];throw new Lr(`expected a single document in the stream, but found more`)}function ya(e,t){return!!(e&1<<t)}var ba={applyQuoteFlowKeysOption:Sa,doubleQuoteForInvisibles:Ca,doubleQuoteWhitespaceOnly:wa,applyForceQuotesOption:Ta,tryLongOrMultilineAsBlock:Ea,quoteInvalidPlain:Da,fallbackToDoubleQuoted:Oa};function xa(e){return e.presenterOptions.quoteStyle===`single`&&ya(e.allowedStylesMask,R.SINGLE_QUOTED)?R.SINGLE_QUOTED:R.DOUBLE_QUOTED}function Sa(e){e.presenterOptions.quoteFlowKeys&&e.isKey&&e.flowOnly&&e.style===R.PLAIN&&(e.style=R.DOUBLE_QUOTED)}function Ca(e){e.style===R.PLAIN&&/[\t\x7F-\xA0\u2028\u2029\uFEFF\uFFFE\uFFFF]/.test(e.node.value)&&(e.style=R.DOUBLE_QUOTED)}function wa(e){e.style===R.PLAIN&&/^\s+$/.test(e.node.value)&&(e.style=R.DOUBLE_QUOTED)}function Ta(e){e.presenterOptions.forceQuotes&&(e.isKey||e.style!==R.PLAIN||(e.style=e.node.value.includes(`
|
|
20
20
|
`)?R.DOUBLE_QUOTED:xa(e)))}function Ea(e){if(e.style!==R.PLAIN||e.isKey)return;let t=e.node.value,n=t.indexOf(`
|
|
21
21
|
`)!==-1;if(!ya(e.allowedStylesMask,R.LITERAL_BLOCK)){n&&(e.style=R.DOUBLE_QUOTED);return}let r=e.presenterOptions.lineWidth;if(r===-1){n&&(e.style=R.LITERAL_BLOCK);return}let i=Math.max(Math.min(r,40),r-e.shiftOfContent),a=0,o=!1;for(;a<=t.length;){let e=t.length,n=t.indexOf(`
|
|
22
|
-
`,a);n!==-1&&(e=n);let r=t.slice(a,e);if(r.length>i&&r[0]!==` `&&/ [^ \t]/.test(r)&&(o=!0),n===-1)break;a=n+1}o?e.style=R.FOLDED_BLOCK:n&&(e.style=R.LITERAL_BLOCK)}function Da(e){e.style===R.PLAIN&&!ya(e.allowedStylesMask,R.PLAIN)&&(e.style=xa(e))}function Oa(e){ya(e.allowedStylesMask,e.style)||(e.style=R.DOUBLE_QUOTED)}var ka=`[\\x09\\x0A\\x0D\\x20-\\x7E\\x85\\xA0-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]`,Aa=`[\\n\\r]`,ja=`\\uFEFF`,Ma=`[ \\t]`,Na=`(?:(?!(?:${Aa}|${ja}))${ka})`,Pa=`(?:(?!${Ma})${Na})`,Fa=`[\\x09\\x20-\\uD7FF\\uE000-\\uFFFF\\u{10000}-\\u{10FFFF}]`,Ia=`[-?:,\\[\\]{}#&*!|>'"%@\`]`,La=`[,\\[\\]{}]`,Ra=Pa,za=`(?:(?!${La})${Pa})`,Ba=`(?:(?:(?!${Ia})${Pa})|[?:-](?=${Ra}))`,Va=`(?:(?:(?!${Ia})${Pa})|[?:-](?=${za}))`,Ha=`(?:(?:(?![:#])${Ra})|:(?=${Ra}))#*`,Ua=`(?:(?:(?![:#])${za})|:(?=${za}))#*`,Wa=`(?:${Ma}*${Ha})*`,Ga=`(?:${Ma}*${Ua})*`,Ka=`${Ba}#*${Wa}`,qa=`${Va}#*${Ga}`,Ja=Ka,Ya=qa,Xa=`\\n+${Ha}${Wa}`,Za=`\\n+${Ua}${Ga}`,Qa=`${Ka}(?:${Xa})*`,$a=`${qa}(?:${Za})*`;RegExp(`^(?:${Qa})$`,`u`),RegExp(`^(?:${$a})$`,`u`),RegExp(`^(?:${Ja})$`,`u`),RegExp(`^(?:${Ya})$`,`u`),RegExp(`^(?:${Fa})*$`,`u`),RegExp(`^(?:${Fa}|\\n)*$`,`u`),RegExp(`^(?:${Na}|\\n)*$`,`u`),Object.keys(ba).map(e=>Reflect.get(ba,e)),L.DOCUMENT,L.SEQUENCE,L.MAPPING,L.SCALAR,L.ALIAS,L.POP,R.PLAIN,R.SINGLE_QUOTED,R.DOUBLE_QUOTED,R.LITERAL_BLOCK,R.FOLDED_BLOCK,Rr.BLOCK,Rr.FLOW,z.CLIP,z.STRIP,z.KEEP;function eo(e){if(e.trim()===``)return{};let t=va(e);if(t==null)return{};if(typeof t!=`object`||Array.isArray(t))throw Error(`.agent-user.yml must parse to an object`);return t}var to={id:`welcome`,title:`Welcome — who are you?`,navLabel:`You`,subtitle:`Your name and language. Stored in .agent-user.yml; we pre-fill what we can detect.`,kind:`welcome`},no={id:`profile`,title:`Which experience?`,navLabel:`Experience`,subtitle:"Pick the experience that fits you — developer · content · founder · agency · finance · ops. It selects your default command/skill surface and persona pre-selection. Cost tier is a secondary knob on a later step. You can switch later with `agent-config use --profile=<id>`.",kind:`form`,paths:[`profile.id`]},ro=[{id:`ai-tools`,title:`Which AI tools do you use?`,navLabel:`AI tools`,subtitle:`Pick the editors and CLIs that should pick up this config. Auto-detect runs first; you can override.`,kind:`aiTools`},{id:`roles`,title:`What do you work on?`,navLabel:`Roles`,subtitle:`Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in .agent-user.yml.`,kind:`roles`},{id:`packs`,title:`Which capability packs do you want?`,navLabel:`Packs`,subtitle:`Founder-strategy, finance-basic, gtm-sales, ops-people, ai-video — pick zero or more. You can change this later.`,kind:`packs`},{id:`legal-consent`,title:`Legal review-prep — not legal advice`,navLabel:`Legal consent`,subtitle:`Only relevant if you picked the legal-review-prep pack. It provides templates and general information, never legal advice — check the box to acknowledge before it activates. Leave unchecked otherwise; the pack stays inactive.`,kind:`form`,paths:[`legal_review_prep.acknowledged`]}],io=[{id:`identity`,title:`Editor & behaviour`,navLabel:`Preferences`,subtitle:`Your IDE plus how the agent behaves: autonomy, output verbosity, PR-comment style. rtk presence is auto-detected (see the rtk row). Your name lives in .agent-user.yml (later step).`,kind:`form`,paths:[`personal.ide`,`personal.open_edited_files`,`personal.autonomy`,`personal.minimal_output`,`personal.play_by_play`,`personal.pr_comment_bot_icon`]},{id:`cost`,title:`Budgets, rules & cadence`,navLabel:`Budgets & cadence`,subtitle:`Independent levers: rule_loading_tier (how many behavioural rules load — token footprint), cost.budgets (optional USD ceilings), model.auto_switch (per-skill model tier), plus quality/roadmap cadence and memory thresholds.`,kind:`form`,paths:[`rule_loading_tier`,`cost.budgets.daily`,`cost.budgets.weekly`,`cost.budgets.monthly`,`cost.enforcement`,`model.auto_switch`,`tokens.rich_skills`,`roadmap.quality_cadence`,`roadmap.dashboard_regen_cadence`,`quality.local_auto_run`,`memory.review_threshold`,`memory.redact_patterns`]},{id:`user-md`,title:`Your .agent-user.yml`,navLabel:`User profile`,subtitle:`Identity, voice, preferences. Stored at agents/settings/.agent-user.yml. Skip to leave empty.`,kind:`userMd`},{id:`review`,title:`Review & finish`,navLabel:`Review`,subtitle:`These keys will change. Confirm to write .agent-settings.yml and .agent-user.yml atomically.`,kind:`review`}];io.length+2;function ao(e={}){return e.extended===!0?[to,no,...ro,...io]:[to,no,...io]}function oo(e,t={}){let n=ao(t);return n[Math.max(0,Math.min(n.length-1,e))]}function so(e){let t={},n=n=>{t[n]=!0;let r=e.clusterOf.get(n);r!==void 0&&(t[r]=!0)};for(let t of e.installed)n(t);for(let t of e.roleDefaults)n(t);for(let t of e.detected)n(t);return t}function co(e,t){let n=new Set(t);return e.filter(e=>e!==`engineering-base`&&!n.has(e)).sort()}function lo(e,t){let n={type:`object`,properties:{},...e.description===void 0?{}:{description:e.description}},r=n.properties,i=e.properties??{};for(let e of t){let t=e.split(`.`).filter(e=>e.length>0);if(t.length===0)continue;let[n,a,o]=t;if(n===void 0)continue;let s=i[n];if(s===void 0)continue;if(a===void 0){r[n]=s;continue}let c=s.properties?.[a];if(c===void 0)continue;let l=r[n]??{type:`object`,properties:{},...s.description===void 0?{}:{description:s.description}},u=l.properties??={};if(o===void 0){u[a]=c,r[n]=l;continue}let d=c.properties?.[o];if(d===void 0)continue;let f=u[a]??{type:`object`,properties:{},...c.description===void 0?{}:{description:c.description}},p=f.properties??={};p[o]=d,u[a]=f,r[n]=l}return n}function uo({current:e,total:t}){let n=Math.max(1,t),r=Math.max(0,Math.min(n-1,e)),i=Array.from({length:n},(e,t)=>t<=r),a=Math.round((r+1)/n*100);return P(`div`,{class:`ac-wizard__progress`,role:`progressbar`,"aria-valuenow":r+1,"aria-valuemin":1,"aria-valuemax":n,"aria-valuetext":`Step ${r+1} of ${n} (${a}%)`,children:i.map((e,t)=>P(`span`,{class:`ac-wizard__progress-segment${e?` ac-wizard__progress-segment--filled`:``}`,"aria-hidden":`true`},t))})}function fo({step:e,index:t,total:n}){return P(`header`,{class:`ac-page__header ac-wizard__header`,children:[P(`p`,{class:`ac-wizard__step-count`,children:[`Step `,t+1,` of `,n]}),P(`div`,{class:`ac-wizard__header-text`,children:[P(`h1`,{children:e.title}),P(`p`,{class:`ac-wizard__subtitle`,children:e.subtitle})]}),P(uo,{current:t,total:n})]})}function po(e){let t=e.canFinish??!0,n=e.completed??!1;return P(`div`,{class:`ac-form__actions ac-wizard__nav`,children:[P(`button`,{type:`button`,class:`ac-button`,disabled:!e.canGoPrev||e.busy,onClick:e.onPrev,children:`Back`}),e.canSkip&&e.onSkip!==void 0?P(`button`,{type:`button`,class:`ac-button ac-wizard__skip`,disabled:e.busy,onClick:e.onSkip,children:e.skipLabel??`Skip`}):null,e.isLast?n?null:P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:e.busy||!t,onClick:e.onFinish,children:e.busy?`Saving…`:`Finish & save`}):P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:!e.canGoNext||e.busy,onClick:e.onNext,children:e.nextLabel??`Next`})]})}function mo(e,t){return e.kind!==`form`||e.paths===void 0?!1:!!(e.paths.includes(t)||e.id===`cost`&&(t.startsWith(`telegraph.`)||t.startsWith(`verbosity.`)))}function ho(e,t){return e.kind===`userMd`?t===`body`||t.startsWith(`body.`):mo(e,t)}function go(e,t){for(let n of Object.keys(t.errors))if(ho(e,n))return!0;return!1}function _o(e,t){if(go(e,t))return{label:`needs attention`,tone:`error`};if(e.kind===`userMd`)return t.userMdChanged?{label:t.userMdAction===`create`?`will create`:`will replace`,tone:`changed`}:{label:``,tone:`idle`};if(e.kind===`form`){let n=t.changes.filter(t=>mo(e,t.path)).length;return n===0?{label:``,tone:`idle`}:{label:`${n} change${n===1?``:`s`}`,tone:`changed`}}if(e.kind===`aiTools`){let e=t.selectedToolsCount??0;return e===0?{label:``,tone:`idle`}:{label:`${e} tool${e===1?``:`s`}`,tone:`changed`}}if(e.kind===`packs`){let e=t.selectedPacksCount??0;return e===0?{label:``,tone:`idle`}:{label:`${e} pack${e===1?``:`s`}`,tone:`changed`}}return{label:``,tone:`idle`}}function vo(e){let t=e.steps.filter((t,n)=>n!==e.currentIndex),n=e.packRemovals??[],r=e.selectedToolIds??[],i=e.packAdditions??[],a=e.changes.length;return P(b,{children:[r.length>0||i.length>0||a>0||e.userMdChanged?P(`section`,{class:`ac-review-summary`,"aria-label":`What happens on Finish`,children:[P(`h2`,{class:`ac-review-summary__title`,children:`What happens on Finish`}),P(`ul`,{class:`ac-review-summary__list`,children:[a>0?P(`li`,{children:[P(`strong`,{children:a}),` setting`,a===1?``:`s`,` will change`,` `,`in `,P(`code`,{children:`.agent-settings.yml`}),`.`]}):P(`li`,{children:`No settings change.`}),e.userMdChanged?P(`li`,{children:[P(`code`,{children:`.agent-user.yml`}),` will be`,` `,e.userMdAction===`create`?`created`:`updated`,`.`]}):null,r.length>0?P(`li`,{children:[`Config is installed for `,r.length,` tool`,r.length===1?``:`s`,`:`,P(`span`,{class:`ac-review-summary__chips`,children:r.map(e=>P(`code`,{class:`ac-review-summary__chip`,children:e},e))})]}):null,i.length>0?P(`li`,{children:[`New pack`,i.length===1?``:`s`,`:`,P(`span`,{class:`ac-review-summary__chips`,children:i.map(e=>P(`code`,{class:`ac-review-summary__chip`,children:e},e))})]}):null]})]}):null,n.length>0?P(`div`,{class:`ac-review-removals`,role:`alert`,children:[P(`p`,{class:`ac-review-removals__title`,children:[`⚠️ `,n.length===1?`1 installed pack will be removed`:`${n.length} installed packs will be removed`]}),P(`ul`,{class:`ac-review-removals__list`,children:n.map(e=>P(`li`,{children:P(`code`,{children:e})},e))}),P(`label`,{class:`ac-review-removals__confirm`,children:[P(`input`,{type:`checkbox`,checked:e.removalsConfirmed??!1,onChange:t=>{e.onConfirmRemovals?.(t.currentTarget.checked)}}),P(`span`,{children:`I understand these packs will no longer be installed. Re-check them on the packs step to keep them.`})]})]}):null,P(`nav`,{class:`ac-wizard__review-nav`,"aria-label":`Jump back to a step`,children:[P(`p`,{class:`ac-wizard__review-nav-label`,children:`Jump back to a step:`}),P(`ul`,{class:`ac-wizard__review-nav-list`,children:t.map(t=>{let n=e.steps.indexOf(t),r=_o(t,e);return P(`li`,{children:P(`button`,{type:`button`,class:r.tone===`error`?`ac-wizard__review-nav-button ac-wizard__review-nav-button--error`:`ac-wizard__review-nav-button`,onClick:()=>{e.onJump(n)},children:[P(`span`,{class:`ac-wizard__review-nav-index`,children:n+1}),P(`span`,{class:`ac-wizard__review-nav-text`,children:t.navLabel}),r.label===``?null:P(`span`,{class:`ac-wizard__review-nav-status ac-wizard__review-nav-status--${r.tone}`,children:r.label})]})},t.id)})})]})]})}function yo(e){let t=e.abortedAt??`unknown time`,n=e.abortNote??`no further detail recorded`,r=e.writesSinceRollback;return P(`aside`,{class:`ac-banner ac-banner--recovery`,role:`alert`,children:[P(`strong`,{children:`Previous install was interrupted.`}),P(`p`,{children:[`Aborted at `,P(`code`,{children:t}),` — `,n,`. `,r,` write`,r===1?``:`s`,` landed before the abort marker.`]}),P(`p`,{children:`Pick how to recover before continuing. Resume reopens the wizard fresh, Rollback discards the abort state, Ignore hides this banner without touching the log.`}),P(`div`,{class:`ac-banner__actions`,children:[P(`button`,{type:`button`,disabled:e.busy,onClick:()=>e.onResume(),children:`Resume install`}),P(`button`,{type:`button`,disabled:e.busy,onClick:()=>e.onRollback(),children:`Rollback`}),P(`button`,{type:`button`,disabled:e.busy,onClick:()=>e.onIgnore(),children:`Ignore`})]})]})}function bo(){return P(`section`,{class:`ac-continue-screen`,"aria-labelledby":`ac-continue-title`,children:[P(`h2`,{id:`ac-continue-title`,children:`Install complete — continue with setup?`}),P(`p`,{children:`Your install selections (AI tools, roles, capability packs) are captured. Use the footer to continue:`}),P(`ul`,{children:[P(`li`,{children:[P(`strong`,{children:`Next`}),` — go through the remaining personalisation steps: editor + tooling, personality, cost profile, roadmap & quality, memory, your`,P(`code`,{children:` .agent-user.yml`}),`, and finally the project module roots.`]}),P(`li`,{children:[P(`strong`,{children:`Finish install here`}),` — skip the rest and write `,P(`code`,{children:`.agent-settings.yml`}),` with the install-only selections. You can re-run `,P(`code`,{children:`agent-config setup`}),`later to pick up the personalisation steps.`]})]})]})}function xo(e){let t=e.version??`unknown`;return P(`section`,{class:`ac-backup-screen`,"aria-labelledby":`ac-backup-title`,children:[P(`h2`,{id:`ac-backup-title`,children:`Existing v3 install detected`}),P(`p`,{children:[`Found a v3.x install at `,P(`code`,{children:e.sourcePath}),` `,`(VERSION: `,P(`code`,{children:t}),`). v4 is a hard-cut release with no auto-migration — settings, identity, and history layouts changed. The wizard can back up the v3 tree before writing the v4 layout so you can roll back manually if needed.`]}),e.error===null?null:P(`p`,{class:`ac-banner ac-banner--error`,children:[`Backup failed: `,e.error]}),P(`ul`,{children:[P(`li`,{children:[P(`strong`,{children:`Backup v3 and proceed`}),` — copies the tree to `,P(`code`,{children:e.backupTarget}),`, then runs the v4 install. Restore later with`,P(`code`,{children:[` mv `,e.backupTarget,` `,e.sourcePath]}),`.`]}),P(`li`,{children:[P(`strong`,{children:`Abort, uninstall v3 first`}),` — closes the wizard. You decide what to keep.`]})]}),P(`div`,{class:`ac-backup-screen__actions`,children:[P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:e.busy,onClick:()=>e.onBackupAndProceed(),children:e.busy?`Backing up…`:`Backup v3 and proceed`}),P(`button`,{type:`button`,class:`ac-button`,disabled:e.busy,onClick:()=>e.onAbort(),children:`Abort, uninstall v3 first`})]})]})}var So=[{title:`Restart your AI tools`,detail:`Editors and CLIs pick up the new skills, rules, and commands on their next start.`},{title:`Verify the installation`,detail:`A read-only health report — scope, deployed files, drift.`,command:`agent-config doctor`},{title:`Tune your settings any time`,detail:`Opens the configuration GUI (global settings; --project for a project).`,command:`agent-config config`},{title:`Initialize a project`,detail:`Adds the minimal agents/ bridge + .gitignore block to a repository.`,command:`agent-config init --project`},{title:`Stay up to date`,detail:`Upgrades the global install and additively syncs your settings.`,command:`agent-config upgrade`}];function Co({text:e}){let[t,n]=Ne(!1);return P(`button`,{type:`button`,class:`ac-button ac-checklist__copy`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{n(!0),setTimeout(()=>{n(!1)},1500)})},children:t?`Copied ✓`:`Copy`})}function wo({message:e}){return P(`div`,{class:`ac-checklist`,children:[P(`div`,{class:`ac-checklist__hero`,children:[P(`h2`,{class:`ac-checklist__headline`,children:`Setup complete`}),e===null?null:P(`p`,{class:`ac-checklist__message`,children:e})]}),P(`ol`,{class:`ac-checklist__items`,children:So.map(e=>P(`li`,{class:`ac-checklist__item`,children:[P(`div`,{class:`ac-checklist__text`,children:[P(`span`,{class:`ac-checklist__item-title`,children:e.title}),P(`span`,{class:`ac-checklist__item-detail`,children:e.detail})]}),e.command===void 0?null:P(`div`,{class:`ac-checklist__cmd-row`,children:[P(`code`,{class:`ac-checklist__cmd`,children:e.command}),P(Co,{text:e.command})]})]},e.title))}),P(`p`,{class:`ac-checklist__close-hint`,children:`You can close this browser window — the local server shuts down on its own.`})]})}var To=A(!1),Eo=A(null),q=A(null),Do=A(!1),Oo=A(!1),ko=A(0),Ao=A(null),J=A({}),jo=A({}),Mo=A(0),No=A({}),Y=A(null),Po=A(null),Fo=A(!1),Io=A(!1),Lo=A(!1),Ro=A({}),zo=A([]);A(`global`);var Bo=A(!1),X=A(!1),Vo=A(!1),Ho=A(!1),Uo=A(null),Wo=A([]),Go=A({}),Ko=A(!0),qo=A(``),Jo=A(`agents`);A(!1);var Yo=A(null),Xo=[{id:`claude-code`,label:`Claude Code`},{id:`claude-desktop`,label:`Claude Desktop`},{id:`cursor`,label:`Cursor`},{id:`windsurf`,label:`Windsurf`},{id:`cline`,label:`Cline`},{id:`gemini-cli`,label:`Gemini CLI`},{id:`copilot`,label:`GitHub Copilot`},{id:`augment`,label:`Augment`},{id:`aider`,label:`Aider`},{id:`codex`,label:`Codex`},{id:`roocode`,label:`Roo Code`},{id:`continue`,label:`Continue`},{id:`kilocode`,label:`Kilo Code`},{id:`zed`,label:`Zed`},{id:`jetbrains`,label:`JetBrains`},{id:`kiro`,label:`Kiro`},{id:`qoder`,label:`Qoder`},{id:`opencode`,label:`OpenCode`},{id:`trae`,label:`Trae`},{id:`antigravity`,label:`Antigravity`},{id:`codebuddy`,label:`CodeBuddy`},{id:`droid`,label:`Droid`},{id:`warp`,label:`Warp`}],Zo=A(!1),Qo=A(!1),$o=A(null),es=A([]),ts=A([]),ns=A([]),rs=A(!1),is=A([]),as=A({}),os=A(!1),ss=A(!1),cs=A(!1),ls=A({}),us=A(!1),ds=A(null),fs=A(null),ps=A(null),ms=A(null),hs=A(null),gs=A(null),_s=A(`https://github.com/rtk-ai/rtk`),vs=A(!1),ys=A(null),bs=A(null),xs=A(null),Ss=A(`event4u-app/agent-switch`),Cs=A(!1);A(!1),A(null),A([]),A({}),A({});var ws=A({}),Ts=A({}),Es=A(!1),Ds=A(!1);A({}),A(null),A(null),A(!1),A(null);var Os=A(null),ks=A(!1),As=A(null),js=A(!1),Ms=A(!1),Ns=A(null),Ps=A(null),Fs=A(!1),Is=A(!1);function Ls(){return ao({extended:X.value})}function Rs(){return Ls().length}function zs(e){return e??new Date().toISOString()}function Bs(e){return Math.max(0,Math.min(Rs()-1,e))}function Vs(e){if(`$ref`in e&&e.$ref!==void 0&&`definitions`in e&&e.definitions!==void 0){let t=e.$ref.replace(`#/definitions/`,``),n=e.definitions[t];if(n!==void 0)return n}return e}async function Hs(){try{return await M(`/api/v1/settings`)}catch(e){if(e instanceof j&&e.status===404&&e.body.error?.code===`NOT_FOUND`){let t=e.body;return t.defaults!==void 0&&t.schema!==void 0?{values:t.defaults,lastModified:t.lastModified??0,path:t.path??`.agent-settings.yml`,schema:t.schema}:{values:{},lastModified:0,path:`.agent-settings.yml`,schema:(await M(`/api/v1/schema`)).settings}}throw e}}async function Us(){try{let e=await M(`/api/v1/install/recovery`);Os.value=e.incomplete?e:null}catch{Os.value=null}}async function Ws(){try{let e=await M(`/api/v1/install/legacy-v3`);As.value=e.present?e:null}catch{As.value=null}}async function Gs(){Ms.value=!0,Ns.value=null;try{await M(`/api/v1/install/backup-v3`,{method:`POST`}),js.value=!0}catch(e){Ns.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}finally{Ms.value=!1}}async function Ks(e){try{await M(`/api/v1/install/recovery/dismiss`,{method:`POST`,body:{reason:e}})}catch(e){q.value={message:e instanceof Error?e.message:String(e),tone:`error`};return}Os.value=null,ks.value=!0}async function qs(){Eo.value=null;try{Us(),Ws();let[e,t]=await Promise.all([M(`/api/v1/wizard/state`),Hs()]);Ao.value=Vs(t.schema),Mo.value=t.lastModified,jo.value=t.values,Ro.value=t.legacyHints??{},X.value=e.extendedSteps===!0,Ps.value=e.wizardMode??null,J.value=Object.keys(e.partial??{}).length>0?{...t.values,...e.partial}:t.values,ko.value=Bs(e.step),Bo.value=!1,To.value=!0;let n=oo(ko.value,{extended:X.value});(n.kind===`welcome`||n.kind===`userMd`||n.kind===`review`)&&Ys(),(n.kind===`roles`||n.kind===`aiTools`||n.kind===`packs`)&&Zs(),n.kind===`roles`&&oc(),n.kind===`aiTools`&&Qs(),n.id===`identity`&&($s(),ec()),n.kind===`review`&&nc()}catch(e){Eo.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}}function Js(e,t){return e.identity.name.trim()===``?{...e,identity:{...e.identity,name:t}}:e}async function Ys(){if(!Io.value)try{let e=await M(`/api/v1/user-md`);if(Fo.value=e.exists,e.exists&&e.identity!==null){let t=hn(e.identity);Po.value=t,Y.value=t}else{let e;try{e=hn(eo((await M(`/api/v1/user-md/template`)).body))}catch{e=ln()}let t=Ro.value.user_name;typeof t==`string`&&t.trim()!==``&&(e=Js(e,t)),Po.value=e,Y.value=e}}catch(e){q.value={message:e instanceof Error?e.message:String(e),tone:`error`}}finally{Io.value=!0}}var Xs=new Set([`python`]);async function Zs(){if(!(Zo.value||Qo.value)){Qo.value=!0,$o.value=null;try{let[e,t]=await Promise.all([M(`/api/v1/wizard/manifest`),M(`/api/v1/wizard/auto-detect`)]),n=(e.packs??[]).map(e=>({id:e.id,label:e.label??e.id,description:e.description??``,requires_hint:e.requires_hint,cluster:e.cluster??void 0,workspaces:e.workspaces}));es.value=n,is.value=(e.workspaces??[]).filter(e=>e.id!==`agent-config-maintainer`).map(e=>({id:e.id,label:e.label??e.id,description:e.description??``,default_packs:e.default_packs??[],optional_packs:e.optional_packs??[],...e.example_roles===void 0?{}:{example_roles:e.example_roles}}));let r=new Set(n.map(e=>e.id));ts.value=t.signals.map(e=>e.id.startsWith(`pack-`)?e.id.slice(5):e.id).filter(e=>r.has(e)).filter(e=>!Xs.has(e)),ns.value=(e.installedPacks??[]).filter(e=>r.has(e))}catch(e){$o.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}finally{Qo.value=!1,Zo.value=!0}}}async function Qs(){if(!(ss.value||cs.value)){cs.value=!0;try{let e=await M(`/api/v1/wizard/detect-tools`),t=e.tools??{},n=e.configured??[];if(ls.value=t,Object.keys(ws.value).length===0){let e={};if(n.length>0)for(let t of n)e[t]=!0;else for(let[n,r]of Object.entries(t))r&&(e[n]=!0);ws.value=e}}catch{}finally{cs.value=!1,ss.value=!0}}}async function $s(){if(!us.value){us.value=!0;try{let e=await M(`/api/v1/wizard/detect-rtk`),t=e.installed===!0;ds.value=t,fs.value=e.present===!0,ps.value=e.identity??null,ms.value=e.version??null,hs.value=e.installCommand??null,gs.value=e.installCommands??null,typeof e.repo==`string`&&(_s.value=e.repo);let n=J.value.personal??{};J.value={...J.value,personal:{...n,rtk_installed:t}}}catch{}}}async function ec(){if(!vs.value){vs.value=!0;try{let e=await M(`/api/v1/wizard/detect-agent-switch`);ys.value=e.installed===!0,bs.value=e.version??null,xs.value=e.installCommand??null,typeof e.repo==`string`&&(Ss.value=e.repo),Cs.value=e.dismissed===!0}catch{}}}async function tc(e,t){try{await M(`/api/v1/wizard/state`,{method:`POST`,body:{step:e,totalSteps:Rs(),partial:t,startedAt:zs(null)}})}catch(e){q.value={message:e instanceof Error?e.message:String(e),tone:`error`}}}async function nc(){Oo.value=!0;try{zo.value=(await M(`/api/v1/settings/diff`,{method:`POST`,body:{values:J.value,ifUnmodifiedSince:Mo.value}})).changes,No.value={}}catch(e){e instanceof j?(No.value=Ft(e.body.error??{code:`UNKNOWN`,message:e.message}),q.value={message:N(e.body.error??{code:`UNKNOWN`,message:e.message}),tone:`error`}):q.value={message:e instanceof Error?e.message:String(e),tone:`error`}}finally{Oo.value=!1}}function rc(){return Lo.value?!1:Y.value===null||Po.value===null?Y.value!==Po.value:JSON.stringify(Y.value)!==JSON.stringify(Po.value)}async function ic(e){let t=Bs(e);await tc(t,J.value),ko.value=t,q.value=null;let n=oo(t,{extended:X.value});(n.kind===`welcome`||n.kind===`userMd`)&&Ys(),(n.kind===`roles`||n.kind===`aiTools`||n.kind===`packs`)&&Zs(),n.kind===`roles`&&oc(),n.kind===`packs`&&sc(),n.kind===`aiTools`&&Qs(),n.id===`identity`&&($s(),ec()),n.kind===`review`&&nc()}function ac(){let e=Ts.value,t=new Map(es.value.map(e=>[e.id,e])),n=Object.entries(e).filter(([,e])=>e===!0).map(([e])=>e).filter(n=>{let r=t.get(n)?.cluster;return r===void 0||e[r]===!0}),r=new Set,i=e=>{if(!r.has(e)){r.add(e);for(let n of t.get(e)?.requires_hint??[])i(n)}};for(let e of n)i(e);return[...r].sort()}async function oc(){if(await Promise.all([Zs(),Ys()]),os.value||Object.values(as.value).some(Boolean))return;let e=Y.value?.role??[];if(e.length===0)return;let t=new Set(is.value.map(e=>e.id)),n={};for(let r of e)t.has(r)&&(n[r]=!0);Object.keys(n).length!==0&&(as.value=n,sc())}function sc(){if(Es.value)return;let e=Object.entries(as.value).filter(([,e])=>e===!0).map(([e])=>e),t=new Map(is.value.map(e=>[e.id,e])),n=[];for(let r of e)for(let e of t.get(r)?.default_packs??[])n.push(e);let r=new Map;for(let e of es.value)e.cluster!==void 0&&r.set(e.id,e.cluster);Ts.value=so({installed:ns.value,roleDefaults:n,detected:ts.value,clusterOf:r})}function cc(){let e=Object.entries(ws.value).filter(([,e])=>e===!0).map(([e])=>e);if(e.length===0)return null;let t={schema_version:`wizard-v2`,tools:e,packs:ac(),settings:J.value};return Mt.value?.dryRun===!0&&(t.dry_run=!0),t}async function lc(){Do.value=!0,q.value=null;try{let e={settings:J.value},t=Object.entries(as.value).filter(([,e])=>e===!0).map(([e])=>e),n=Y.value!==null&&typeof Y.value.identity?.name==`string`&&Y.value.identity.name.trim().length>0;Y.value!==null&&n&&(rc()||t.length>0)&&(e.identity=t.length>0?{...Y.value,role:t}:Y.value);let r=await M(`/api/v1/wizard/finish`,{method:`POST`,body:e}),i=r.dryRun===!0?`Dry-run complete — no files written. Settings would be saved.`:Array.isArray(r.writtenPaths)?`Saved (${r.writtenPaths.join(`, `)}). Wizard complete.`:`Wizard complete.`,a=X.value?cc():null,o=``;if(a!==null&&a.dry_run===!0)try{await M(`/api/v1/wizard/apply`,{method:`POST`,body:a}),o=` Installer preview OK (dry-run) — no files written.`}catch(e){o=` Installer preview failed: ${e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}.`}else if(a!==null)try{let e=null,t=0;await jt(`/api/v1/wizard/apply`,a,n=>{if(n.type===`error`)e=typeof n.message==`string`?n.message:`install failed`;else if(n.type===`done`){let e=n.summary;t=typeof e?.conflicts==`number`?e.conflicts:0}});let n=a.tools.length,r=a.packs.length;o=e===null?` Installer applied ${n} tool${n===1?``:`s`}`+(r>0?` and ${r} pack${r===1?``:`s`}.`:`.`)+(t>0?` ${t} file${t===1?``:`s`} you had edited ${t===1?`was`:`were`} kept; the new package content is staged alongside as *.agent-config.new. This installation is not current until you merge it.`:``):` Installer failed: ${e}. Settings were saved; re-run the wizard to retry.`}catch(e){o=` Installer bridge failed: ${e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}. Settings were saved; re-run the wizard to retry the install plan.`}q.value={message:`${i}${o} You can close this browser window now.`,tone:`success`},ko.value=Bs(Rs()-1),jo.value=J.value,Po.value=rc()?Y.value:Po.value,zo.value=[],Bo.value=!0}catch(e){e instanceof j?(No.value=Ft(e.body.error??{code:`UNKNOWN`,message:e.message}),q.value={message:N(e.body.error??{code:`UNKNOWN`,message:e.message}),tone:`error`}):q.value={message:e instanceof Error?e.message:String(e),tone:`error`}}finally{Do.value=!1}}async function uc(){Is.value=!0,await Promise.all([Zs(),Qs()]),await oc(),sc(),await ic(Rs()-1)}function dc(){D(()=>{Zs(),Qs()},[]);let e=Qo.value||cs.value||!Zo.value||!ss.value,t=Object.values(ls.value).filter(Boolean).length,n=ns.value.length,r=ts.value.filter(e=>!ns.value.includes(e)).length;return P(`div`,{class:`ac-start`,children:[P(`section`,{class:`ac-start__card ac-start__card--primary`,children:[P(`h2`,{class:`ac-start__title`,children:`Recommended setup`}),P(`p`,{class:`ac-start__desc`,children:`The fastest path — we pre-select everything we can detect and you confirm one review screen before anything is written.`}),P(`ul`,{class:`ac-start__facts`,children:[P(`li`,{children:e?`Detecting your AI tools…`:t===0?`No AI tools detected — pick them on the review screen.`:`${t} AI tool${t===1?``:`s`} detected and pre-selected.`}),P(`li`,{children:e?`Detecting capability packs…`:n>0?`${n} installed pack${n===1?``:`s`} kept${r>0?`, ${r} more auto-detected`:``}.`:r>0?`${r} capability pack${r===1?``:`s`} auto-detected.`:`No packs pre-selected — add them any time later.`}),P(`li`,{children:`Settings keep their current values (or safe defaults on a first run).`}),P(`li`,{children:`Nothing is written until you confirm the review screen.`})]}),P(`button`,{type:`button`,class:`ac-button ac-button--primary ac-start__cta`,disabled:e,onClick:()=>{uc()},children:e?`Detecting…`:`Use recommended setup`})]}),P(`section`,{class:`ac-start__card`,children:[P(`h2`,{class:`ac-start__title`,children:`Customize`}),P(`p`,{class:`ac-start__desc`,children:`Walk through every step — tools, roles, packs, behaviour, budgets — and tune each choice yourself.`}),P(`button`,{type:`button`,class:`ac-button ac-start__cta`,onClick:()=>{Is.value=!0},children:`Customize step by step`})]})]})}var fc=[`de`,`en`,`en-US`,`en-GB`,`fr`,`es`,`it`,`nl`,`pt`,`pt-BR`];function pc(){if(Ds.value)return;let e=Y.value;if(e===null)return;Ds.value=!0;let t=e;if(e.identity.name.trim()===``){let e=Mt.value?.systemUser;e!==void 0&&e.trim()!==``&&(t={...t,identity:{...t.identity,name:e}})}if(!Fo.value&&typeof navigator<`u`){let e=(navigator.language||``).split(`-`)[0];e.length>=2&&(t={...t,language:e})}t!==e&&(Y.value=t)}function mc(){let e=Y.value;if(D(()=>{pc()},[e]),e===null)return P(`p`,{children:`Loading…`});let t=e=>{Y.value={...e,last_updated:new Date().toISOString().slice(0,10)},Lo.value=!1};return P(`div`,{class:`ac-wizard-step-stub ac-wizard__module-fields`,children:[P(`p`,{children:[`Tell the agent who you are. We pre-filled what we could detect — adjust freely. Stored in `,P(`code`,{children:`.agent-user.yml`}),`.`]}),P(`div`,{class:`ac-field`,children:[P(`label`,{class:`ac-field__label`,for:`welcome-name`,children:`Name`}),P(`input`,{class:`ac-input`,id:`welcome-name`,type:`text`,placeholder:`How should the agent address you?`,value:e.identity.name,onInput:n=>t({...e,identity:{...e.identity,name:n.currentTarget.value}})})]}),P(`div`,{class:`ac-field`,children:[P(`label`,{class:`ac-field__label`,for:`welcome-lang`,children:`Language`}),P(`input`,{class:`ac-input`,id:`welcome-lang`,type:`text`,list:`welcome-lang-list`,placeholder:`BCP-47 code, e.g. de, en, en-US`,value:e.language,onInput:n=>t({...e,language:n.currentTarget.value})}),P(`datalist`,{id:`welcome-lang-list`,children:fc.map(e=>P(`option`,{value:e},e))})]})]})}function hc(){let e=ws.value,t=ls.value;return P(`div`,{class:`ac-wizard-step-stub`,children:[P(`p`,{children:`Pick the AI tools you use. Tools detected on this machine are pre-selected on first run. The installer wires each selected tool's surface (skills, rules, commands) on apply; you can change this list later by re-running the wizard.`}),P(`ul`,{class:`ac-wizard__tool-list`,children:Xo.map(n=>{let r=t[n.id]===!0;return P(`li`,{class:`ac-wizard__tool-row`,children:[P(`label`,{class:`ac-wizard__tool-label`,children:[P(`input`,{type:`checkbox`,checked:e[n.id]??!1,onChange:t=>{let r=t.currentTarget.checked;ws.value={...e,[n.id]:r}}}),` `,n.label]}),P(`span`,{class:`ac-badge ${r?`ac-badge--installed`:`ac-badge--missing`}`,title:r?`Detected on this machine`:`Not detected on this machine`,children:r?`installed`:`not installed`})]},n.id)})})]})}function gc(){if(Qo.value)return P(`p`,{children:`Loading roles…`});if($o.value!==null)return P(`div`,{class:`ac-wizard-step-stub`,children:P(`p`,{class:`ac-banner ac-banner--error`,children:[`Discovery failed: `,$o.value]})});let e=as.value,t=is.value,n=(e,t)=>{os.value=!0,as.value={...as.value,[e]:t},sc()};return P(`div`,{class:`ac-wizard-step-stub`,children:[P(`p`,{children:[`Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in`,P(`code`,{children:` .agent-user.yml`}),`.`]}),t.length===0?P(`p`,{children:P(`em`,{children:`No roles available in the manifest.`})}):P(`div`,{class:`ac-wizard__pack-grid`,children:t.map(t=>P(`section`,{class:`ac-pack-tile`,children:[P(`label`,{class:`ac-pack-tile__head`,children:[P(`input`,{type:`checkbox`,checked:e[t.id]??!1,onChange:e=>{n(t.id,e.currentTarget.checked)}}),P(`span`,{class:`ac-pack-tile__title`,children:t.label})]}),(t.example_roles??[]).length>0?P(`p`,{class:`ac-pack-tile__role`,children:[`e.g. `,(t.example_roles??[]).join(`, `)]}):null,t.description===``?null:P(`p`,{class:`ac-pack-tile__desc`,children:t.description})]},t.id))})]})}function _c(){if(Qo.value)return P(`p`,{children:`Loading discovery manifest…`});if($o.value!==null)return P(`div`,{class:`ac-wizard-step-stub`,children:[P(`p`,{class:`ac-banner ac-banner--error`,children:[`Discovery failed: `,$o.value]}),P(`p`,{children:`The manifest endpoint is gated on extended-mode. Re-run the server with extended steps enabled to populate this list.`})]});let e=Ts.value,t=new Set(ts.value),n=new Set(ns.value),r=e=>n.has(e)?P(`span`,{class:`ac-badge ac-badge--installed`,children:`installed`}):t.has(e)?P(`span`,{class:`ac-badge ac-badge--detected`,children:`auto-detected`}):null,i=new Map(is.value.map(e=>[e.id,e.label])),a=as.value,o=e=>{let t=(e??[]).filter(e=>e!==`agent-config-maintainer`);return t.length===0?null:P(`span`,{class:`ac-pack-tile__ws`,children:t.map(e=>P(`span`,{class:`ac-badge ac-badge--ws${a[e]===!0?` ac-badge--ws-active`:``}`,title:a[e]===!0?`Matches a role you picked`:`Workspace / area`,children:i.get(e)??e},e))})},s=es.value.filter(e=>e.id!==`engineering-base`),c=new Map;for(let e of s)if(e.cluster!==void 0){let t=c.get(e.cluster)??[];t.push(e),c.set(e.cluster,t)}let l=new Set(s.filter(e=>e.cluster!==void 0).map(e=>e.id)),u=s.filter(e=>!l.has(e.id)),d=(e,t)=>{Es.value=!0,Ts.value={...Ts.value,[e]:t}},f=(e,t)=>{Es.value=!0;let n={...Ts.value,[e]:t};if(t)for(let t of c.get(e)??[])n[t.id]===void 0&&(n[t.id]=!0);Ts.value=n};return P(`div`,{class:`ac-wizard-step-stub`,children:[P(`p`,{children:`Pick the capability packs to install. Auto-detected packs are pre-selected; engineering hygiene is included automatically when a pack needs it. A language tile expands to its frameworks — turn the language off to skip them all.`}),u.length===0?P(`p`,{children:P(`em`,{children:`No packs available in the manifest.`})}):P(`div`,{class:`ac-wizard__pack-grid`,children:u.map(t=>{let n=c.get(t.id)??[],i=n.length>0,a=e[t.id]??!1;return P(`section`,{class:`ac-pack-tile`,children:[P(`label`,{class:`ac-pack-tile__head`,children:[P(`input`,{type:`checkbox`,checked:a,onChange:e=>{let n=e.currentTarget.checked;i?f(t.id,n):d(t.id,n)}}),P(`span`,{class:`ac-pack-tile__title`,children:t.label}),r(t.id)]}),o(t.workspaces),t.description===``?null:P(`p`,{class:`ac-pack-tile__desc`,children:t.description}),i?P(`fieldset`,{class:`ac-pack-tile__children`,disabled:!a,children:n.map(t=>P(`label`,{class:`ac-pack-tile__child`,children:[P(`input`,{type:`checkbox`,checked:e[t.id]??!1,disabled:!a,onChange:e=>{d(t.id,e.currentTarget.checked)}}),P(`span`,{children:t.label}),r(t.id)]},t.id))}):null]},t.id)})})]})}function vc(){let e=ds.value,t=fs.value,n=ps.value,r=ms.value,i=gs.value,a=e===null?P(`span`,{class:`ac-badge ac-badge--missing`,children:`detecting…`}):e?P(`span`,{class:`ac-badge ac-badge--installed`,children:[`installed`,r===null?``:` (v${r})`]}):t===!0?P(`span`,{class:`ac-badge ac-badge--missing`,children:n===`unknown-rtk`?`different tool`:`unverified`}):P(`span`,{class:`ac-badge ac-badge--missing`,children:`not installed`});return P(`div`,{class:`ac-rtk-row`,children:[P(`div`,{class:`ac-rtk-row__head`,children:[P(`span`,{class:`ac-rtk-row__label`,children:[`rtk `,P(`small`,{children:`(Rust Token Killer — third-party, Apache-2.0)`})]}),a]}),t===!0&&n===`unknown-rtk`?P(`div`,{class:`ac-rtk-row__install`,children:[P(`p`,{class:`ac-field__description`,children:[`A binary named `,P(`code`,{children:`rtk`}),` is on PATH, but it is not Rust Token Killer — two unrelated projects share the name (the other is Rust Type Kit). The token-saving integration stays off. See the upstream name-collision guidance:`]}),P(`a`,{class:`ac-button`,href:`${_s.value}/blob/master/INSTALL.md`,target:`_blank`,rel:`noreferrer noopener`,children:`Open rtk install guide`})]}):null,t===!0&&n===`unverified`?P(`p`,{class:`ac-field__description`,children:[`rtk found but the identity check failed — verify manually with `,P(`code`,{children:`rtk gain`}),` (Rust Token Killer renders a token-savings dashboard; the colliding Rust Type Kit does not).`]}):null,t===!1?P(`div`,{class:`ac-rtk-row__install`,children:[P(`p`,{class:`ac-field__description`,children:`rtk wraps verbose CLI output — upstream reports 60–90% token savings (their estimate). Install it, then re-open the wizard to pick up detection:`}),i===null?hs.value===null?null:P(`code`,{class:`ac-rtk-row__cmd`,children:hs.value}):P(b,{children:[i.recommendedLabel===void 0?null:P(`p`,{class:`ac-field__description`,children:[i.recommendedLabel,`:`]}),P(`code`,{class:`ac-rtk-row__cmd`,children:i.recommended}),i.manual===void 0?null:P(b,{children:[P(`p`,{class:`ac-field__description`,children:[i.manualLabel??`Manual`,`:`]}),P(`code`,{class:`ac-rtk-row__cmd`,children:i.manual})]}),i.note===void 0?null:P(`p`,{class:`ac-field__description`,children:i.note})]}),P(`a`,{class:`ac-button`,href:_s.value,target:`_blank`,rel:`noreferrer noopener`,children:`Open rtk repo`})]}):null]})}async function yc(){try{await M(`/api/v1/wizard/dismiss-recommendation`,{method:`POST`,body:{id:`agent-switch`}})}catch(e){q.value={message:e instanceof Error?e.message:String(e),tone:`error`};return}Cs.value=!0}function bc(){return!vs.value||ys.value!==!1||Cs.value?null:P(`div`,{class:`ac-rtk-row`,children:[P(`div`,{class:`ac-rtk-row__head`,children:[P(`span`,{class:`ac-rtk-row__label`,children:[`agent-switch `,P(`small`,{children:`(third-party, MIT)`})]}),P(`span`,{class:`ac-badge ac-badge--missing`,children:`not installed`})]}),P(`div`,{class:`ac-rtk-row__install`,children:[P(`p`,{class:`ac-field__description`,children:[`agent-switch isolates multiple agent accounts into per-account profiles (`,P(`code`,{children:`CLAUDE_CONFIG_DIR`}),`) so switching accounts never requires a re-login. Free and MIT-licensed.`]}),xs.value===null?null:P(`code`,{class:`ac-rtk-row__cmd`,children:xs.value}),P(`a`,{class:`ac-button`,href:`https://github.com/${Ss.value}`,target:`_blank`,rel:`noreferrer noopener`,children:`Open agent-switch repo`}),P(`button`,{type:`button`,class:`ac-button ac-button--small`,onClick:()=>{yc()},children:`Don't show again`})]})]})}function xc(){let e=oo(ko.value,{extended:X.value});if(X.value&&Ps.value===`install`&&e.id===`identity`&&!Fs.value)return P(bo,{});if(e.kind===`form`){let t=lo(Ao.value,e.paths??[]);return P(b,{children:[e.id===`identity`?P(vc,{}):null,e.id===`identity`?P(bc,{}):null,P(tn,{schema:t,values:J.value,errors:No.value,onChange:e=>{J.value=e}})]})}return e.kind===`userMd`?!Io.value||Y.value===null?P(`p`,{children:`Loading .agent-user.yml…`}):P(cn,{value:Y.value,errors:No.value,hideRole:X.value&&Ps.value===`install`,hideIdentityBasics:X.value&&Ps.value===`install`,onChange:e=>{Y.value=e,Lo.value=!1}}):e.kind===`welcome`?P(mc,{}):e.kind===`aiTools`?P(hc,{}):e.kind===`roles`?P(gc,{}):e.kind===`packs`?P(_c,{}):P(vo,{steps:Ls(),currentIndex:ko.value,changes:zo.value,errors:No.value,userMdChanged:rc(),userMdAction:Fo.value?`replace`:`create`,loading:Oo.value,onJump:e=>{ic(e)},selectedToolsCount:Object.values(ws.value).filter(Boolean).length,selectedPacksCount:Object.values(Ts.value).filter(Boolean).length,packRemovals:Sc(),removalsConfirmed:rs.value,onConfirmRemovals:e=>{rs.value=e},selectedToolIds:Object.entries(ws.value).filter(([,e])=>e).map(([e])=>e),packAdditions:X.value?ac().filter(e=>e!==`engineering-base`&&!ns.value.includes(e)):[]})}function Sc(){return X.value?co(ns.value,ac()):[]}function Cc({path:e}){if(D(()=>{qs()},[]),!To.value||Ao.value===null)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Setup wizard`}),Eo.value===null?P(`p`,{children:`Loading…`}):P(`p`,{class:`ac-banner ac-banner--error`,children:Eo.value})]});let t=ko.value,n=Rs(),r=oo(t,{extended:X.value}),i=t===n-1,a=r.kind===`aiTools`&&Object.values(ws.value).filter(Boolean).length===0||r.kind===`roles`&&Object.values(as.value).filter(Boolean).length===0||r.kind===`packs`&&ac().length===0,o=X.value&&Ps.value===`install`&&r.id===`identity`&&!Fs.value,s=Os.value,c=s!==null&&!ks.value,l=As.value,u=l!==null&&l.present&&!js.value,d=X.value&&Ps.value===`install`&&t===0&&!Is.value&&!Bo.value;return u?P(`div`,{class:`ac-page`,children:P(xo,{sourcePath:l.path,backupTarget:l.backupTarget,version:l.version,busy:Ms.value,error:Ns.value,onBackupAndProceed:()=>{Gs()},onAbort:()=>{q.value={tone:`info`,message:"Aborted. Uninstall v3 manually, then re-run `agent-config install`."},js.value=!0}})}):d?P(`div`,{class:`ac-page`,children:[P(`header`,{class:`ac-page__header`,children:P(`h1`,{children:`Set up agent-config`})}),q.value===null?null:P(`p`,{class:`ac-banner${q.value.tone===`error`?` ac-banner--error`:``}`,children:q.value.message}),P(dc,{})]}):P(`div`,{class:`ac-page`,children:[P(fo,{step:r,index:t,total:n}),c?P(yo,{abortedAt:s.abortedAt,abortNote:s.abortNote,writesSinceRollback:s.writesSinceRollback,busy:Do.value,onResume:()=>{Ks(`resume`)},onRollback:()=>{Ks(`rollback`)},onIgnore:()=>{Ks(`ignore`)}}):null,q.value!==null&&!(Bo.value&&i&&q.value.tone===`success`)?P(`p`,{class:`ac-banner${q.value.tone===`error`?` ac-banner--error`:``}`,children:q.value.message}):null,P(`div`,{class:`ac-wizard__step`,children:Bo.value&&i?P(wo,{message:q.value?.tone===`success`?q.value.message:null}):P(xc,{})}),a?P(`p`,{class:`ac-wizard__hint`,children:r.kind===`aiTools`?`Select at least one AI tool to continue.`:r.kind===`roles`?`Select at least one role to continue.`:`Select at least one capability pack to continue.`}):null,P(po,{canGoPrev:t>0,canGoNext:!i&&!a,canSkip:o||r.kind===`userMd`,skipLabel:o?`Finish install here`:`Skip`,isLast:i,busy:Do.value||Oo.value,canFinish:(zo.value.length>0||rc()||Sc().length>0||X.value&&Object.values(ws.value).some(Boolean))&&(Sc().length===0||rs.value),completed:Bo.value,onPrev:()=>{ic(t-1)},onNext:()=>{if(o){Fs.value=!0;return}ic(t+1)},onSkip:()=>{if(o){Fs.value=!0,ic(Rs()-1);return}Lo.value=!0,ic(t+1)},onFinish:()=>{lc()}})]})}var wc=new Set([`profile.id`,`rule_loading_tier`,`discipline_profile`,`personal.ide`,`personal.open_edited_files`,`personal.autonomy`,`personal.minimal_output`,`personal.play_by_play`,`personal.pr_comment_bot_icon`,`personal.pr_progress_comments`,`cost.budgets.daily`,`cost.budgets.weekly`,`cost.budgets.monthly`,`cost.enforcement`,`model.auto_switch`,`tokens.rich_skills`,`roadmap.quality_cadence`,`roadmap.dashboard_regen_cadence`,`quality.local_auto_run`,`memory.review_threshold`,`memory.redact_patterns`,`memory.cadence`,`chat_history.enabled`,`update_check.enabled`,`legal_review_prep.acknowledged`]);function Tc(e){return wc.has(e)}function Ec(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function Dc(e,t){if(e.kind===`enum_removed`){let n=new Set(e.values??[]);return t!==void 0&&n.has(t)?`must_fix`:`info`}return e.kind===`type_changed`?`must_fix`:e.kind===`default_changed`?t===void 0||Ec(t,e.old?.default)?`adopt`:`review`:e.kind===`added`&&e.new?.default===void 0?`must_fix`:`info`}var Oc=A(!0),kc=A(null),Ac=A(!1),jc=A(null),Mc=A({}),Nc=A(0),Pc=A({}),Fc=A(null),Ic=A(!1),Lc=A(!1);function Rc(e){return`${e.key}:${e.kind}`}async function zc(){Oc.value=!0,kc.value=null,Ac.value=!1,Lc.value=!1;try{let e=await M(`/api/v1/settings/changes`),t=await M(`/api/v1/settings`);jc.value=e.delta,Mc.value=t.values,Nc.value=t.lastModified,Bc(e.delta,t.values)}catch(e){e instanceof j&&e.status===404?Ac.value=!0:kc.value=e instanceof Error?e.message:String(e)}finally{Oc.value=!1}}function Bc(e,t){let n={};for(let r of e.changes){let e=Dc(r,Yt(t,r.key.split(`.`)));e===`adopt`?n[Rc(r)]={mode:`adopt`}:e===`review`?n[Rc(r)]={mode:`keep`}:e===`must_fix`&&(n[Rc(r)]={mode:null})}Pc.value=n}function Vc(e){return Dc(e,Yt(Mc.value,e.key.split(`.`)))}function Hc(e,t){Pc.value={...Pc.value,[e]:t}}function Uc(){let e=jc.value;return e===null?[]:e.changes.filter(e=>{if(Vc(e)!==`must_fix`)return!1;let t=Pc.value[Rc(e)];return t===void 0||t.mode===null||t.mode===`custom`&&(t.value===void 0||t.value===``)})}function Wc(){let e=jc.value,t=Mc.value;if(e===null)return t;for(let n of e.changes){let e=Pc.value[Rc(n)];if(e===void 0||e.mode===null||e.mode===`keep`)continue;let r=n.key.split(`.`);e.mode===`adopt`&&n.new?.default!==void 0?t=Xt(t,r,n.new.default):e.mode===`custom`&&e.value!==void 0&&(t=Xt(t,r,e.value))}return t}async function Gc(){if(Ic.value)return;let e=Uc();if(e.length>0){Fc.value=`Resolve the ${e.length} “Must fix” item${e.length===1?``:`s`} first.`;return}Ic.value=!0,Fc.value=null;try{let e=Wc();if(JSON.stringify(e)!==JSON.stringify(Mc.value)){let t=await M(`/api/v1/settings`,{method:`PUT`,headers:{"If-Unmodified-Since":String(Nc.value)},body:{values:e}});Mc.value=e,Nc.value=t.lastModified}await M(`/api/v1/settings/changes/ack`,{method:`POST`}),Lc.value=!0}catch(e){Fc.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}finally{Ic.value=!1}}async function Kc(){if(!Ic.value){if(Uc().length>0){Fc.value=`Cannot dismiss — “Must fix” items would leave invalid values in place.`;return}Ic.value=!0;try{await M(`/api/v1/settings/changes/ack`,{method:`POST`}),Lc.value=!0}catch(e){Fc.value=e instanceof Error?e.message:String(e)}finally{Ic.value=!1}}}function qc(e){return e===void 0?`—`:typeof e==`string`?e:JSON.stringify(e)}function Jc({change:e,id:t}){let n=e.new,r=Pc.value[t]?.value;return n?.enum===void 0?n?.type===`boolean`?P(`select`,{class:`ac-input`,"aria-label":`New value for ${e.key}`,value:r===void 0?``:String(r),onChange:e=>{Hc(t,{mode:`custom`,value:e.currentTarget.value===`true`})},children:[P(`option`,{value:``,disabled:!0,children:`Choose…`}),P(`option`,{value:`true`,children:`true`}),P(`option`,{value:`false`,children:`false`})]}):P(`input`,{class:`ac-input`,type:n?.type===`number`||n?.type===`integer`?`number`:`text`,"aria-label":`New value for ${e.key}`,value:r===void 0?``:String(r),onInput:e=>{let r=e.currentTarget.value;Hc(t,{mode:`custom`,value:n?.type===`number`||n?.type===`integer`?Number(r):r})}}):P(`select`,{class:`ac-input`,"aria-label":`New value for ${e.key}`,value:r===void 0?``:String(r),onChange:e=>{let n=e.currentTarget.value;Hc(t,{mode:`custom`,value:n})},children:[P(`option`,{value:``,disabled:!0,children:`Choose a value…`}),n.enum.map(e=>P(`option`,{value:String(e),children:String(e)},String(e)))]})}function Yc({change:e}){let t=Vc(e),n=Rc(e),r=Pc.value[n],i=Yt(Mc.value,e.key.split(`.`));return P(`li`,{class:`ac-change-card ac-change-card--${t}`,"data-key":e.key,"data-kind":e.kind,children:[P(`div`,{class:`ac-change-card__head`,children:[P(`code`,{class:`ac-change-card__key`,children:e.key}),P(`span`,{class:`ac-change-card__badge ac-change-card__badge--${t}`,children:t===`must_fix`?`Must fix`:t===`adopt`?`New default`:t===`review`?`Review`:`Info`})]}),e.new?.description===void 0?null:P(`p`,{class:`ac-change-card__desc`,children:e.new.description}),e.kind===`default_changed`?P(b,{children:[P(`p`,{class:`ac-change-card__detail`,children:[`Default changed: `,P(`code`,{children:qc(e.old?.default)}),` → `,P(`code`,{children:qc(e.new?.default)}),t===`review`?P(b,{children:[` · your value: `,P(`code`,{children:qc(i)})]}):null]}),P(`div`,{class:`ac-change-card__choices`,role:`radiogroup`,"aria-label":`Resolution for ${e.key}`,children:[P(`label`,{class:`ac-change-card__choice`,children:[P(`input`,{type:`radio`,name:n,checked:r?.mode===`adopt`,onChange:()=>{Hc(n,{mode:`adopt`})}}),P(`span`,{children:[`Adopt new default (`,P(`code`,{children:qc(e.new?.default)}),`)`]})]}),P(`label`,{class:`ac-change-card__choice`,children:[P(`input`,{type:`radio`,name:n,checked:r?.mode===`keep`,onChange:()=>{Hc(n,{mode:`keep`})}}),P(`span`,{children:[`Keep current (`,P(`code`,{children:qc(i??e.old?.default)}),`)`]})]})]})]}):null,e.kind===`enum_removed`?t===`must_fix`?P(b,{children:[P(`p`,{class:`ac-change-card__detail`,children:[`Your value `,P(`code`,{children:qc(i)}),` is no longer valid — removed option`,(e.values?.length??0)===1?``:`s`,`: `,P(`code`,{children:(e.values??[]).join(`, `)}),`. Pick a replacement:`]}),P(Jc,{change:e,id:n})]}):P(`p`,{class:`ac-change-card__detail`,children:[`Removed option`,(e.values?.length??0)===1?``:`s`,`: `,P(`code`,{children:(e.values??[]).join(`, `)}),` — your value `,P(`code`,{children:qc(i??e.new?.default)}),` is unaffected.`]}):null,e.kind===`enum_added`?P(`p`,{class:`ac-change-card__detail`,children:[`New option`,(e.values?.length??0)===1?``:`s`,` available: `,P(`code`,{children:(e.values??[]).join(`, `)})]}):null,e.kind===`added`?t===`must_fix`?P(b,{children:[P(`p`,{class:`ac-change-card__detail`,children:`New setting without a shipped default — define a value:`}),P(Jc,{change:e,id:n})]}):P(`p`,{class:`ac-change-card__detail`,children:[`New setting · default: `,P(`code`,{children:qc(e.new?.default)}),e.new?.enum===void 0?null:P(b,{children:[` · options: `,P(`code`,{children:e.new.enum.join(`, `)})]})]}):null,e.kind===`removed`?P(`p`,{class:`ac-change-card__detail`,children:`This setting no longer exists. Your stored value is kept in place and ignored (nothing is deleted).`}):null,e.kind===`type_changed`?P(b,{children:[P(`p`,{class:`ac-change-card__detail`,children:[`Type changed: `,P(`code`,{children:e.old?.type}),` → `,P(`code`,{children:e.new?.type}),`. Define a new value:`]}),P(Jc,{change:e,id:n})]}):null]})}function Xc(e){let t=new Map;for(let n of e.changes){let e=Vc(n);t.set(e,[...t.get(e)??[],n])}let n=[],r=t.get(`must_fix`)??[];r.length>0&&n.push({title:`Must fix`,hint:`These stored values are invalid after the upgrade — saving is blocked until each has a valid value.`,changes:r});let i=[...t.get(`adopt`)??[],...t.get(`review`)??[]];i.length>0&&n.push({title:`Changed defaults`,hint:`Values you never customized are preselected to adopt the new default; customized values are kept unless you choose otherwise.`,changes:i});let a=t.get(`info`)??[],o=a.filter(e=>e.kind===`added`),s=a.filter(e=>e.kind===`enum_added`),c=a.filter(e=>e.kind!==`added`&&e.kind!==`enum_added`);return o.length>0&&n.push({title:`New settings`,changes:o}),s.length>0&&n.push({title:`New options`,changes:s}),c.length>0&&n.push({title:`Removed / other`,changes:c}),n}function Zc(){if(D(()=>{zc()},[]),Oc.value)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Settings changes`}),P(`p`,{children:`Loading…`})]});if(kc.value!==null)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Settings changes`}),P(`p`,{class:`ac-banner ac-banner--error`,children:kc.value})]});if(Lc.value||Ac.value)return P(`div`,{class:`ac-page ac-settings-changes`,children:[P(`h1`,{children:`Settings changes`}),P(`p`,{class:`ac-banner`,children:Lc.value?`Review complete — all changes resolved.`:`Nothing to review — your settings are up to date.`}),P(`button`,{type:`button`,class:`ac-button`,onClick:()=>Et(`/settings`),children:`Back to Settings`})]});let e=jc.value;if(e===null)return P(`div`,{class:`ac-page`,children:P(`h1`,{children:`Settings changes`})});let t=Xc(e),n=Uc().length;return P(`div`,{class:`ac-page ac-settings-changes`,children:[P(`header`,{class:`ac-page__header`,children:[P(`h1`,{children:`Settings changes`}),P(`p`,{class:`ac-page__lede`,children:[`The upgrade `,P(`code`,{children:e.oldVersion}),` → `,P(`code`,{children:e.newVersion}),` changed the available settings. Review below — nothing was changed automatically.`]})]}),Fc.value===null?null:P(`p`,{class:`ac-banner ac-banner--error`,role:`alert`,children:Fc.value}),t.map(e=>P(`section`,{class:`ac-settings-changes__group`,children:[P(`h2`,{children:[e.title,` `,P(`span`,{class:`ac-settings-changes__count`,children:[`(`,e.changes.length,`)`]})]}),e.hint===void 0?null:P(`p`,{class:`ac-settings-changes__hint`,children:e.hint}),P(`ul`,{class:`ac-settings-changes__list`,children:e.changes.map(e=>P(Yc,{change:e},Rc(e)))})]},e.title)),P(`div`,{class:`ac-form__actions`,children:[P(`button`,{type:`button`,class:`ac-button`,disabled:Ic.value,onClick:()=>{Kc()},children:`Dismiss (keep everything)`}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:Ic.value||n>0,title:n>0?`${n} “Must fix” item${n===1?``:`s`} unresolved`:void 0,onClick:()=>{Gc()},children:Ic.value?`Saving…`:`Apply & finish review`})]})]})}var Qc=A(null);function $c(){return D(()=>{(async()=>{try{Qc.value=(await M(`/api/v1/settings/changes`)).delta.changes.length}catch{Qc.value=null}})()},[]),Qc.value===null||Qc.value===0?null:P(`div`,{class:`ac-banner ac-banner--pending`,role:`status`,children:[P(`span`,{children:[`An upgrade changed `,Qc.value,` setting`,Qc.value===1?``:`s`,` — review recommended.`]}),P(`button`,{type:`button`,class:`ac-button ac-button--small`,onClick:()=>Et(`/settings/changes`),children:`Review changes`})]})}var el=A(!1),tl=A(null),Z=A({}),nl=A(null),rl=A(0),il=A({}),al=A(null),ol=A(!1),sl=A(null),cl=A(null),ll=A(``),ul=A(!1),dl=A({}),fl=A({global:new Set,project:new Set});function pl(e){if(`$ref`in e&&e.$ref!==void 0&&`definitions`in e&&e.definitions!==void 0){let t=e.$ref.replace(`#/definitions/`,``),n=e.definitions[t];if(n!==void 0)return n}return e}async function ml(){tl.value=null;try{let e=await M(`/api/v1/settings`);Z.value=e.values,nl.value=pl(e.schema),rl.value=e.lastModified,fl.value={global:new Set(e.sources?.global??[]),project:new Set(e.sources?.project??[])},el.value=!0}catch(e){if(e instanceof j&&e.status===404&&e.body.error?.code===`NOT_FOUND`){let t=e.body;if(t.defaults!==void 0&&t.schema!==void 0){Z.value=t.defaults,nl.value=pl(t.schema),rl.value=t.lastModified??0,el.value=!0;return}}tl.value=e instanceof Error?e.message:String(e)}}async function hl(){if(!ol.value){al.value=null,il.value={};try{let e=await M(`/api/v1/settings/diff`,{method:`POST`,body:{values:Z.value,ifUnmodifiedSince:rl.value}});if(e.changes.length===0){al.value=`No changes to save.`;return}sl.value=e.changes}catch(e){e instanceof j?(il.value=Ft(e.body.error??{code:`UNKNOWN`,message:e.message}),al.value=N(e.body.error??{code:`UNKNOWN`,message:e.message})):al.value=e instanceof Error?e.message:String(e)}}}async function gl(e=!1){ol.value=!0;try{let t=await M(`/api/v1/settings`,{method:`PUT`,headers:{"If-Unmodified-Since":String(rl.value)},body:e?{values:Z.value,confirmSharedWrite:!0}:{values:Z.value}});rl.value=t.lastModified,sl.value=null,cl.value=null,al.value=`Saved (${t.writtenPaths.join(`, `)}).`}catch(e){if(e instanceof j){let t=e.body;if(e.status===409&&t.error===`shared-write`){sl.value=null,cl.value={sharedPath:typeof t.sharedPath==`string`?t.sharedPath:``,message:typeof t.message==`string`?t.message:`This write affects a shared agent-switch profile.`};return}let n=e.body.error??{code:`UNKNOWN`,message:e.message};il.value=Ft(n),al.value=N(n),sl.value=null;let r=Object.keys(il.value)[0];r!==void 0&&queueMicrotask(()=>{let e=document.getElementById(r);e!==null&&e.focus()})}else al.value=e instanceof Error?e.message:String(e)}finally{ol.value=!1}}function _l(e){if(e.defaultValue===void 0)return!1;let t=Yt(Z.value,e.path);return t!==void 0&&JSON.stringify(t)!==JSON.stringify(e.defaultValue)}function vl(e,t){let n=_l(t),r=fl.value.project.has(e)?`project`:fl.value.global.has(e)&&fl.value.project.size>0?`global`:void 0;return{modified:n,onReset:n&&t.defaultValue!==void 0?()=>{Z.value=Xt(Z.value,t.path,t.defaultValue)}:void 0,sourceLabel:r}}function yl(e,t){let n=t.toLowerCase();return e.path.join(`.`).toLowerCase().includes(n)||e.label.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n)}function bl(e){let t=ll.value.trim(),n=ul.value,r=e.path.join(`.`),i=dl.value[r]===!0,a=e.fields.filter(e=>e.kind!==`unsupported`);if(t!==``&&(a=a.filter(e=>yl(e,t))),n&&(a=a.filter(e=>_l(e))),t!==``||n)return a.length===0?null:{section:e,visible:a,hiddenAdvancedCount:0,expanded:i};let o=a.filter(e=>Tc(e.path.join(`.`))),s=a.filter(e=>!Tc(e.path.join(`.`))),c=i?[...o,...s]:o;return c.length===0&&s.length===0?null:{section:e,visible:c,hiddenAdvancedCount:i?0:s.length,expanded:i}}function xl(e){dl.value={...dl.value,[e]:dl.value[e]!==!0}}function Sl(){let e=Mt.value?.agentSwitchProfile;return e===void 0||e.active!==!0?null:P(`div`,{class:`ac-banner`,role:`status`,children:P(`span`,{children:[`Running under agent-switch profile `,P(`code`,{children:e.provider!==null&&e.profile!==null?`${e.provider}/${e.profile}`:`an unidentified profile`}),` — settings shown and saved here are profile-scoped. Switching profiles shows that profile's own settings; nothing is lost.`]})})}function Cl({block:e}){return P(`div`,{class:`ac-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`shared-write-title`,children:P(`div`,{class:`ac-modal__panel`,children:[P(`h2`,{id:`shared-write-title`,children:`Shared write — affects all profiles`}),P(`p`,{children:e.message}),P(`p`,{children:P(`code`,{children:e.sharedPath})}),P(`div`,{class:`ac-modal__actions`,children:[P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{cl.value=null},children:`Cancel`}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:ol.value,onClick:()=>{gl(!0)},children:ol.value?`Writing…`:`Write (affects all profiles)`})]})]})})}function wl({changes:e}){return P(`div`,{class:`ac-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`diff-title`,children:P(`div`,{class:`ac-modal__panel`,children:[P(`h2`,{id:`diff-title`,children:`Confirm changes`}),P(`ul`,{class:`ac-diff`,children:e.map(e=>P(`li`,{children:[P(`code`,{children:e.path}),P(`span`,{class:`ac-diff__before`,children:JSON.stringify(e.from)}),P(`span`,{class:`ac-diff__arrow`,children:`→`}),P(`span`,{class:`ac-diff__after`,children:JSON.stringify(e.to)})]},e.path))}),P(`div`,{class:`ac-modal__actions`,children:[P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{sl.value=null},children:`Cancel`}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:ol.value,onClick:()=>{gl()},children:ol.value?`Saving…`:`Save`})]})]})})}function Tl(){if(D(()=>{ml()},[]),!el.value||nl.value===null)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Settings`}),tl.value===null?P(`p`,{children:`Loading…`}):P(`p`,{class:`ac-banner ac-banner--error`,children:tl.value})]});let e=Jt(nl.value),t=e.map(bl).filter(e=>e!==null),n=e.flatMap(e=>e.fields).filter(e=>_l(e)).length,r=ll.value.trim()!==``||ul.value;return P(`div`,{class:`ac-page ac-settings-hub`,children:[P(`header`,{class:`ac-page__header`,children:[P(`h1`,{children:`Settings`}),P(`nav`,{class:`ac-page__nav`,children:P(`a`,{href:`#/settings/user`,children:`Edit .agent-user.yml →`})})]}),P($c,{}),P(Sl,{}),P(`div`,{class:`ac-settings-hub__toolbar`,role:`search`,children:[P(`input`,{class:`ac-input ac-settings-hub__search`,type:`search`,placeholder:`Search all settings (basic and advanced)…`,value:ll.value,onInput:e=>{ll.value=e.currentTarget.value}}),P(`button`,{type:`button`,class:`ac-chip-toggle${ul.value?` ac-chip-toggle--active`:``}`,"aria-pressed":ul.value,onClick:()=>{ul.value=!ul.value},children:[`@modified`,n>0?` (${n})`:``]})]}),al.value===null?null:P(`p`,{class:`ac-banner`,children:al.value}),P(`form`,{class:`ac-form`,onSubmit:e=>e.preventDefault(),children:[t.length===0?P(`p`,{class:`ac-settings-hub__empty`,children:`No settings match.`}):t.map(e=>{let t=e.section.path.join(`.`);return P(en,{section:{...e.section,fields:e.visible},values:Z.value,errors:il.value,onChange:e=>{Z.value=e},decorate:vl,footer:!r&&(e.hiddenAdvancedCount>0||e.expanded)?P(`button`,{type:`button`,class:`ac-settings-hub__disclosure`,"aria-expanded":e.expanded,onClick:()=>{xl(t)},children:e.expanded?`Hide advanced settings`:`Show ${e.hiddenAdvancedCount} advanced setting${e.hiddenAdvancedCount===1?``:`s`}`}):void 0},t)}),P(`div`,{class:`ac-form__actions`,children:[P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{ml()},children:`Reload`}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,onClick:()=>{hl()},children:`Preview & Save`})]})]}),sl.value===null?null:P(wl,{changes:sl.value}),cl.value===null?null:P(Cl,{block:cl.value})]})}var El=A(!1),Dl=A(null);async function Ol(){Ho.value=!0,Uo.value=null;try{let e=await M(`/api/v1/modules/detect`);Wo.value=e.candidates,Yo.value=e.project_root;let t={};for(let n of e.candidates)t[n.path]=!0;Go.value=t,Ko.value=e.proposed_block.enabled,qo.value=e.proposed_block.namespace_template??``,Jo.value=e.proposed_block.agent_folder??`agents`}catch(e){Uo.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}finally{Ho.value=!1,Vo.value=!0}}function kl(){let e=new Set(Wo.value.map(e=>e.path)),t=Go.value,n=Object.keys(t).filter(n=>t[n]===!0&&e.has(n));return{enabled:Ko.value,root_paths:n,namespace_template:qo.value,agent_folder:Jo.value||`agents`}}async function Al(){El.value=!0,Dl.value=null;try{let e=await M(`/api/v1/modules/apply`,{method:`POST`,body:kl()});Dl.value={message:e.appliedTo===null?`Saved project settings to ${e.projectRoot}.`:`Saved project settings to ${e.appliedTo}.`,tone:`success`}}catch(e){Dl.value={message:`Could not save project settings: ${e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}`,tone:`error`}}finally{El.value=!1}}function jl(){if(Ho.value)return P(`p`,{children:`Detecting module roots…`});if(Uo.value!==null)return P(`p`,{class:`ac-banner ac-banner--error`,children:[`Module detection failed: `,Uo.value]});let e=Wo.value,t=Go.value,n=Yo.value;return P(`div`,{class:`ac-section`,children:[n===null?null:P(`p`,{class:`ac-section__description`,children:[`Scanning `,P(`code`,{children:n}),`. Pick which detected roots the agent should treat as modules. These write to`,P(`code`,{children:` .agent-project-settings.yml`}),` in this repo only.`]}),P(`label`,{children:[P(`input`,{type:`checkbox`,checked:Ko.value,onChange:e=>{Ko.value=e.currentTarget.checked}}),` `,`Enable module discovery (writes `,P(`code`,{children:`modules.enabled`}),`)`]}),e.length===0?P(`p`,{children:[P(`em`,{children:`No module roots detected.`}),` The scan found no common module layouts (Laravel `,P(`code`,{children:`app/Modules/`}),`, Symfony`,P(`code`,{children:` src/Module/`}),`, Node `,P(`code`,{children:`packages/`}),`, Python`,P(`code`,{children:` src/`}),`, Go `,P(`code`,{children:`internal/`}),`).`]}):P(`ul`,{style:`list-style: none; padding-left: 0;`,children:e.map(e=>P(`li`,{children:P(`label`,{children:[P(`input`,{type:`checkbox`,checked:t[e.path]??!1,onChange:n=>{let r=n.currentTarget.checked;Go.value={...t,[e.path]:r}}}),` `,P(`code`,{children:e.path}),` — `,e.stack,` `,P(`small`,{children:[`(`,e.confidence,` confidence)`]})]})},e.path))}),P(`div`,{class:`ac-wizard__module-fields`,children:[P(`div`,{class:`ac-field`,children:[P(`label`,{class:`ac-field__label`,for:`ac-modules-namespace`,children:`Namespace template`}),P(`input`,{id:`ac-modules-namespace`,class:`ac-input`,type:`text`,value:qo.value,placeholder:`e.g. App\\\\Modules\\\\{ModuleName}\\\\App`,onInput:e=>{qo.value=e.currentTarget.value}}),P(`span`,{class:`ac-field__description`,children:`How a module path maps to its namespace. Leave blank to skip namespacing.`})]}),P(`div`,{class:`ac-field`,children:[P(`label`,{class:`ac-field__label`,for:`ac-modules-agent-folder`,children:`Agent folder`}),P(`input`,{id:`ac-modules-agent-folder`,class:`ac-input`,type:`text`,value:Jo.value,placeholder:`agents`,onInput:e=>{Jo.value=e.currentTarget.value}}),P(`span`,{class:`ac-field__description`,children:[`Folder name that holds per-module agent docs (default `,P(`code`,{children:`agents`}),`).`]})]})]})]})}function Ml(){return D(()=>{Ol()},[]),P(`div`,{class:`ac-page`,children:[P(`header`,{class:`ac-page__header`,children:[P(`h1`,{children:`Project settings`}),P(`p`,{class:`ac-section__description`,children:[`Configuration scoped to this repository — written to`,P(`code`,{children:` .agent-project-settings.yml`}),`, not the global tree.`]})]}),Dl.value===null?null:P(`p`,{class:`ac-banner ac-banner--${Dl.value.tone===`success`?`success`:`error`}`,children:Dl.value.message}),P(`section`,{class:`ac-section`,children:[P(`h2`,{class:`ac-section__title`,children:`Modules`}),P(jl,{})]}),P(`div`,{class:`ac-form__actions ac-wizard__nav`,children:P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:El.value||Ho.value,onClick:()=>{Al()},children:El.value?`Saving…`:`Save project settings`})})]})}var Nl=A([]),Pl=A([]),Fl=A([]),Il=A([]),Ll=A(null),Rl=A(!1),zl=A(null),Q=A(null),Bl=A(`plain`),Vl=A({}),Hl=A([]),Ul={"claude-code":`Claude Code`,codex:`Codex`,gemini:`Gemini`};function Wl(){try{return globalThis.sessionStorage?.getItem(`ac-workspace-host`)??`claude-code`}catch{return`claude-code`}}var Gl=A(Wl());function Kl(e){Gl.value=e;try{globalThis.sessionStorage?.setItem(`ac-workspace-host`,e)}catch{}}var ql=A([]),$=A(null),Jl=A({}),Yl=A(!1),Xl=A(null),Zl=A(``),Ql=A(!1),$l=A(!1),eu=A(null),tu=A(null),nu=A([]),ru=A(new Set),iu=`claude-code`,au=2e3;async function ou(){zl.value=null;try{let[e,t,n,r,i,a]=await Promise.all([M(`/api/v1/workspace/roles`),M(`/api/v1/workspace/sessions?limit=20`),M(`/api/v1/workspace/knowledge?limit=20`),M(`/api/v1/workspace/documents?limit=20`),M(`/api/v1/workspace/drive-health`).catch(()=>({health:{}})),M(`/api/v1/workspace/hosts`).catch(()=>({hosts:[]}))]);Nl.value=e.roles,Pl.value=t.sessions,Fl.value=n.chunks,Il.value=r.documents,Vl.value=i.health??{},Hl.value=a.hosts??[],Rl.value=!0}catch(e){zl.value=e instanceof j?e.body?.error?.message??e.message:e instanceof Error?e.message:String(e)}}async function su(e,t){try{ql.value=(await M(`/api/v1/workspace/roles/${e}/tasks`)).tasks}catch{ql.value=t}}async function cu(e){tu.value=e,ru.value=new Set;try{let t=await M(`/api/v1/workspace/sessions/${e}`);nu.value=Array.isArray(t.log)?t.log:[]}catch{nu.value=[]}}async function lu(e){Q.value=null,$l.value=!1,Zl.value=``,$.value=null,await cu(e)}async function uu(e,t,n){Q.value=null,Yl.value=!0,Zl.value=``,$l.value=!1,eu.value={role:e,task:t,inputs:n};try{let r=await M(`/api/v1/workspace/launch`,{method:`POST`,body:{role:e,task:t,inputs:n,host:Gl.value}});Xl.value=r,Q.value=mu(r),$.value=null,await cu(r.id),Pl.value=(await M(`/api/v1/workspace/sessions?limit=20`)).sessions,await fu()}catch(e){Xl.value=null,Q.value=e instanceof j?e.body?.error?.message??e.message:e instanceof Error?e.message:String(e)}finally{Yl.value=!1}}async function du(e,t){if(!(t.trim()===``||Ql.value)){Ql.value=!0,Q.value=null;try{let n=await M(`/api/v1/workspace/sessions/${e}/continue`,{method:`POST`,body:{prompt:t}});Xl.value=n,Q.value=mu(n),n.driven&&(Zl.value=``),await cu(e),Pl.value=(await M(`/api/v1/workspace/sessions?limit=20`)).sessions,await fu()}catch(e){e instanceof j&&e.status===410?($l.value=!0,Q.value=`Host session expired — start a new conversation.`):Q.value=e instanceof j?e.body?.error?.message??e.message:e instanceof Error?e.message:String(e)}finally{Ql.value=!1}}}async function fu(){try{Vl.value=(await M(`/api/v1/workspace/drive-health`)).health??{}}catch{}}async function pu(e){try{await M(`/api/v1/workspace/drive-health/${e}/reset`,{method:`POST`}),await fu()}catch{}}function mu(e){return e.driven?e.recovered===!0?`Host recovered — drove the turn for ${e.role} · ${e.task}.`:`Drove the turn for ${e.role} · ${e.task}.`:e.host_killed===!0?`Host ${iu} is paused after repeated failures — handed off to the inbox.`:e.error_kind===`render-error`?`Couldn't fill the prompt: ${e.error??`missing input`}.`:e.reason===`no-prompt-for-task`?`Recorded the session — this task has no runnable prompt yet.`:typeof e.handoff==`string`?`Prepared a hand-off — open ${e.handoff} and paste it into your host.`:`Recorded the session ${e.id} (${e.role} · ${e.task}).`}function hu({role:e}){let t=Ll.value===e.slug;return P(`button`,{type:`button`,class:`ac-workspace__role${t?` ac-workspace__role--active`:``}`,"aria-current":t?`true`:void 0,"aria-label":`Pick role ${e.display_name}`,onClick:()=>{Ll.value=e.slug,Q.value=null,Xl.value=null,$.value=null,Jl.value={},ql.value=e.first_tasks,su(e.slug,e.first_tasks)},children:[P(`span`,{class:`ac-workspace__role-name`,children:e.display_name}),P(`span`,{class:`ac-workspace__role-status`,"data-status":e.status,children:e.status}),P(`span`,{class:`ac-workspace__role-tagline`,children:e.tagline})]})}function gu({role:e,task:t}){let n=t.inputs??[],r=Jl.value,i=n.some(e=>e.required&&(r[e.name]??``).trim()===``);return P(`form`,{class:`ac-workspace__task-form`,onSubmit:n=>{n.preventDefault(),!i&&!Yl.value&&uu(e,t.name,Jl.value)},children:[n.length===0?P(`p`,{class:`ac-workspace__form-note`,children:`No inputs — runs the prompt as-is.`}):n.map(e=>P(`label`,{class:`ac-workspace__field`,children:[P(`span`,{class:`ac-workspace__field-label`,children:[e.name,e.required?P(`span`,{class:`ac-workspace__req`,"aria-hidden":`true`,children:` *`}):null]}),P(`textarea`,{class:`ac-workspace__field-input`,placeholder:e.shape,required:e.required,"aria-label":`${e.name}${e.required?` (required)`:``}`,value:r[e.name]??``,onInput:t=>{Jl.value={...Jl.value,[e.name]:t.target.value}}})]},e.name)),P(`div`,{class:`ac-workspace__form-actions`,children:[P(`button`,{type:`submit`,class:`ac-button ac-button--primary`,disabled:i||Yl.value,children:Yl.value?`Running…`:`Run task`}),P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{$.value=null},children:`Cancel`})]})]})}function _u(e){let t=[];for(let n of e){let e=n.data??{};if(n.kind===`launcher.input`)e.followup===!0?t.push({kind:`user`,text:typeof e.prompt==`string`?e.prompt:``}):t.push({kind:`task`,text:typeof e.task==`string`?e.task:``});else if(n.kind===`host.turn`){let n=e.usage,r=n==null?void 0:`${typeof e.model==`string`?e.model:iu} · in ${n.input_tokens??0} / out ${n.output_tokens??0} tokens`;t.push({kind:`assistant`,text:typeof e.text==`string`?e.text:``,meta:r})}else if(n.kind===`host.error`){let n=typeof e.error_kind==`string`?e.error_kind:`error`;t.push({kind:`error`,text:`${n}: ${typeof e.error==`string`?e.error:``}`})}}return t}function vu(){if(tu.value===null)return null;let e=_u(nu.value),t=nu.value.some(e=>e.kind===`host.turn`);return P(`section`,{class:`ac-workspace__thread`,"aria-label":`Conversation thread`,children:[P(`h2`,{class:`ac-workspace__heading`,children:`Conversation`}),e.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No turns yet.`}):P(`ol`,{class:`ac-workspace__thread-list`,children:e.map((e,t)=>{let n=e.kind===`assistant`&&e.text.length>au,r=ru.value.has(t),i=n&&!r?`${e.text.slice(0,au)}…`:e.text;return P(`li`,{class:`ac-workspace__thread-block ac-workspace__thread-block--${e.kind}`,children:[P(`span`,{class:`ac-workspace__thread-role`,children:e.kind===`task`?`Task`:e.kind===`user`?`You`:e.kind===`assistant`?`Host`:`Error`}),P(`pre`,{class:`ac-workspace__thread-text`,children:i}),n?P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{let e=new Set(ru.value);e.has(t)?e.delete(t):e.add(t),ru.value=e},children:r?`Show less`:`Show full`}):null,e.meta==null?null:P(`p`,{class:`ac-workspace__turn-meta`,children:e.meta})]},t)})}),$l.value?P(`div`,{class:`ac-workspace__followup-gone`,role:`status`,children:[P(`p`,{children:`Host session expired.`}),eu.value===null?P(`p`,{children:`Pick a task above to start a new conversation.`}):P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:Yl.value,onClick:()=>{let e=eu.value;e!==null&&uu(e.role,e.task,e.inputs)},children:Yl.value?`Starting…`:`Start a new conversation`})]}):t?P(`form`,{class:`ac-workspace__followup`,onSubmit:e=>{e.preventDefault(),tu.value!==null&&du(tu.value,Zl.value)},children:[P(`label`,{class:`ac-workspace__field`,children:[P(`span`,{class:`ac-workspace__field-label`,children:`Follow up`}),P(`textarea`,{class:`ac-workspace__field-input`,placeholder:`Continue this conversation — e.g. make it shorter`,"aria-label":`Follow-up prompt`,value:Zl.value,onInput:e=>{Zl.value=e.target.value}})]}),P(`button`,{type:`submit`,class:`ac-button ac-button--primary`,disabled:Zl.value.trim()===``||Ql.value,children:Ql.value?`Continuing…`:`Send follow-up`})]}):null]})}function yu({role:e}){let t=ql.value.length>0?ql.value:e.first_tasks;return P(`section`,{class:`ac-workspace__tasks`,"aria-labelledby":`task-heading`,children:[P(`h2`,{id:`task-heading`,class:`ac-workspace__heading`,children:[`First tasks · `,e.display_name]}),t.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No tasks scaffolded yet for this role.`}):P(`ul`,{class:`ac-workspace__task-list`,children:t.map(t=>P(`li`,{class:`ac-workspace__task`,children:[P(`div`,{class:`ac-workspace__task-head`,children:[P(`span`,{class:`ac-workspace__task-name`,children:t.name}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,"aria-expanded":$.value===t.name,onClick:()=>{$.value=$.value===t.name?null:t.name,Jl.value={},Xl.value=null,tu.value=null,nu.value=[]},children:$.value===t.name?`Close`:`Start session`})]}),P(`p`,{class:`ac-workspace__task-intent`,children:t.intent}),t.prompt===``?null:P(`code`,{class:`ac-workspace__task-prompt`,children:[`prompts/`,t.prompt]}),$.value===t.name?P(gu,{role:e.slug,task:t}):null]},t.name))}),e.skills.length>0?P(`details`,{class:`ac-workspace__skills`,children:[P(`summary`,{children:[`Skill shortlist (`,e.skills.length,`)`]}),P(`ul`,{class:`ac-workspace__skill-list`,children:[e.skills.slice(0,5).map(e=>P(`li`,{class:`ac-workspace__skill`,children:[P(`code`,{children:e.id}),` — `,e.why]},e.id)),e.skills.length>5?P(`li`,{class:`ac-workspace__skill-more`,children:[`+ `,e.skills.length-5,` more`]}):null]})]}):null]})}function bu(){return P(`section`,{class:`ac-workspace__sessions`,"aria-labelledby":`sessions-heading`,children:[P(`h2`,{id:`sessions-heading`,class:`ac-workspace__heading`,children:`Recent sessions`}),Pl.value.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No sessions yet — pick a role and start one.`}):P(`ul`,{class:`ac-workspace__session-list`,children:Pl.value.map(e=>P(`li`,{class:`ac-workspace__session`,children:P(`button`,{type:`button`,class:`ac-workspace__session-open${tu.value===e.id?` ac-workspace__session-open--active`:``}`,"aria-label":`Open session ${e.task}`,"aria-current":tu.value===e.id?`true`:void 0,onClick:()=>{lu(e.id)},children:[P(`span`,{class:`ac-workspace__session-id`,children:e.id.slice(0,16)}),P(`span`,{class:`ac-workspace__session-role`,children:e.role}),P(`span`,{class:`ac-workspace__session-task`,children:e.task})]})},e.id))})]})}function xu(){return P(`section`,{class:`ac-workspace__knowledge`,"aria-labelledby":`knowledge-heading`,children:[P(`h2`,{id:`knowledge-heading`,class:`ac-workspace__heading`,children:`Knowledge sources`}),Fl.value.length===0?P(`p`,{class:`ac-workspace__empty`,children:[`No sources yet. Run `,P(`code`,{children:`/knowledge:ingest <path>`}),` to add documents.`]}):P(`ol`,{class:`ac-workspace__citation-list`,children:Fl.value.map((e,t)=>P(`li`,{class:`ac-workspace__citation`,children:[P(`span`,{class:`ac-workspace__citation-marker`,"aria-label":`Citation ${t+1}`,children:[`[`,t+1,`]`]}),P(`a`,{href:`file://${e.source}`,class:`ac-workspace__citation-source`,title:`Open source in OS default app`,children:e.source.split(`/`).pop()??e.source}),e.pinned?P(`span`,{class:`ac-workspace__citation-pin`,"aria-label":`pinned`,children:`★`}):null,P(`p`,{class:`ac-workspace__citation-excerpt`,children:[e.excerpt.slice(0,200),e.excerpt.length>200?`…`:``]})]},e.id))})]})}function Su(){return P(`section`,{class:`ac-workspace__recent`,"aria-labelledby":`recent-heading`,children:[P(`h2`,{id:`recent-heading`,class:`ac-workspace__heading`,children:`Recent documents`}),Il.value.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No documents yet. Saved drafts land here.`}):P(`ul`,{class:`ac-workspace__doc-list`,children:Il.value.map(e=>P(`li`,{class:`ac-workspace__doc`,children:[P(`span`,{class:`ac-workspace__doc-type`,"data-type":e.type,children:e.type}),P(`span`,{class:`ac-workspace__doc-title`,children:e.title}),P(`time`,{class:`ac-workspace__doc-time`,dateTime:e.updated_at,children:e.updated_at.slice(0,10)})]},`${e.type}/${e.slug}`))})]})}function Cu(){let e=Object.values(Vl.value).filter(e=>e.killed||e.consecutive_failures>0);return P(`section`,{class:`ac-workspace__drive-health`,"aria-labelledby":`drive-health-heading`,children:[P(`h2`,{id:`drive-health-heading`,class:`ac-workspace__heading`,children:`Host health`}),e.length===0?P(`p`,{class:`ac-workspace__empty`,children:`All hosts healthy.`}):P(`ul`,{class:`ac-workspace__health-list`,children:Object.entries(Vl.value).filter(([,e])=>e.killed||e.consecutive_failures>0).map(([e,t])=>{let n=t.killed?t.kill_reason===`manual`?`paused (manual)`:`paused — auto-recovering`:`degraded`;return P(`li`,{class:`ac-workspace__health`,"data-killed":t.killed?`true`:`false`,children:[P(`span`,{class:`ac-workspace__health-host`,children:e}),P(`span`,{class:`ac-workspace__health-state`,children:n}),P(`span`,{class:`ac-workspace__health-meta`,children:[t.consecutive_failures,` fail streak`,t.last_error_kind==null?``:` · ${t.last_error_kind}`]}),t.killed?P(`button`,{type:`button`,class:`ac-button ac-workspace__health-reset`,"aria-label":`Reset ${e}`,onClick:()=>{pu(e)},children:`Reset`}):null]},e)})})]})}function wu(){let e=Bl.value;return P(`fieldset`,{class:`ac-workspace__explain`,children:[P(`legend`,{class:`ac-workspace__heading`,children:`Explanation style`}),P(`label`,{class:`ac-workspace__explain-option`,children:[P(`input`,{type:`radio`,name:`explain-mode`,value:`plain`,checked:e===`plain`,onChange:()=>{Bl.value=`plain`},"aria-label":`Plain language`}),P(`span`,{children:`Plain language`})]}),P(`label`,{class:`ac-workspace__explain-option`,children:[P(`input`,{type:`radio`,name:`explain-mode`,value:`technical`,checked:e===`technical`,onChange:()=>{Bl.value=`technical`},"aria-label":`Technical detail`}),P(`span`,{children:`Technical detail`})]}),P(`p`,{class:`ac-workspace__explain-hint`,children:e===`plain`?`Replies use everyday words. Toggle to see the technical view.`:`Replies keep the technical vocabulary. Toggle for the plain view.`})]})}function Tu(){let e=Hl.value,t=e.length>0?e.map(e=>e.id):Object.keys(Ul),n=new Map(e.map(e=>[e.id,e.cli_present]));return P(`label`,{class:`ac-workspace__host-picker`,children:[P(`span`,{class:`ac-workspace__host-label`,children:`Host`}),P(`select`,{class:`ac-workspace__host-select`,"aria-label":`Host agent`,value:Gl.value,onChange:e=>{Kl(e.target.value)},children:t.map(e=>{let t=n.get(e)!==!1,r=Ul[e]??e;return P(`option`,{value:e,disabled:!t,children:[r,` (`,e,`)`,t?``:` — not installed`]},e)})})]})}function Eu(){if(D(()=>{ou()},[]),zl.value!==null)return P(`div`,{class:`ac-page ac-page--error`,children:[P(`h1`,{children:`Workspace`}),P(`p`,{class:`ac-banner ac-banner--error`,children:zl.value})]});if(!Rl.value)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Workspace`}),P(`p`,{children:`Loading…`})]});let e=Ll.value===null?null:Nl.value.find(e=>e.slug===Ll.value)??null;return P(`div`,{class:`ac-page ac-workspace`,children:[P(`header`,{class:`ac-page__header`,children:[P(`h1`,{children:`Workspace`}),P(`p`,{class:`ac-page__subtitle`,children:`Pick a role, pick a first task, run it.`}),P(Tu,{})]}),Q.value===null?null:P(`p`,{class:`ac-banner`,role:`status`,children:Q.value}),P(`div`,{class:`ac-workspace__grid`,children:[P(`section`,{class:`ac-workspace__roles`,"aria-labelledby":`roles-heading`,children:[P(`h2`,{id:`roles-heading`,class:`ac-workspace__heading`,children:`Roles`}),Nl.value.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No roles installed.`}):P(`div`,{class:`ac-workspace__role-grid`,children:Nl.value.map(e=>P(hu,{role:e},e.slug))})]}),P(`main`,{class:`ac-workspace__main`,"aria-label":`Tasks and sessions`,children:[e===null?P(`p`,{class:`ac-workspace__empty`,children:`Pick a role on the left to see its first tasks.`}):P(yu,{role:e}),P(vu,{}),P(bu,{})]}),P(`aside`,{class:`ac-workspace__rail`,"aria-label":`Knowledge and documents`,children:[P(xu,{}),P(Su,{}),P(Cu,{}),P(wu,{})]})]})]})}var Du=`agent-config-theme`;function Ou(){return(typeof document<`u`?document.documentElement.getAttribute(`data-theme`):null)===`dark`?`dark`:`light`}var ku=A(Ou());function Au(){try{let e=localStorage.getItem(Du);return e===`light`||e===`dark`?e:null}catch{return null}}function ju(){if(typeof window>`u`)return null;try{let e=new URLSearchParams(window.location.search).get(`theme`);return e===`light`||e===`dark`?e:null}catch{return null}}function Mu(){return Au()===null&&ju()===null}function Nu(e){ku.value=e,document.documentElement.setAttribute(`data-theme`,e)}function Pu(){let e=ku.value===`dark`?`light`:`dark`;try{localStorage.setItem(Du,e)}catch{}Nu(e)}function Fu(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);typeof e.addEventListener==`function`&&e.addEventListener(`change`,()=>{Mu()&&Nu(e.matches?`dark`:`light`)})}function Iu(){return typeof window>`u`?!1:new URLSearchParams(window.location.search).get(`embed`)===`1`}var Lu=Iu(),Ru=[{id:`setup`,label:`Setup`,hashPath:`/setup`,matches:[`/setup`,`/wizard`]},{id:`settings`,label:`Settings`,hashPath:`/settings`,matches:[`/settings`]},{id:`project`,label:`Project`,hashPath:`/project`,matches:[`/project`]},{id:`workspace`,label:`Workspace`,hashPath:`/workspace`,matches:[`/workspace`]}];function zu(e){for(let t of Ru)for(let n of t.matches)if(e===n||e.startsWith(`${n}/`))return t.id;return null}function Bu(e){let t=Mt.value,n=zu(e);return Ru.filter(e=>e.id===`project`?t?.projectSurface===!0||n===`project`:e.id!==`workspace`||t?.devSurfaces===!0||n===`workspace`)}function Vu(){let e=Tt.value,t=zu(e);return P(`header`,{class:`ac-topnav`,children:P(`div`,{class:`ac-topnav__inner`,children:[P(`div`,{class:`ac-topnav__brand`,children:[P(`h1`,{class:`ac-topnav__title`,children:`@event4u/agent-config`}),P(`p`,{class:`ac-topnav__subtitle`,children:`Browser Wizard`})]}),P(`nav`,{class:`ac-topnav__tabs`,"aria-label":`Surfaces`,children:Bu(e).map(e=>P(`button`,{type:`button`,class:`ac-topnav__tab${t===e.id?` ac-topnav__tab--active`:``}`,"aria-current":t===e.id?`page`:void 0,onClick:()=>Et(e.hashPath),children:e.label},e.id))}),P(`button`,{type:`button`,class:`ac-topnav__theme`,"aria-label":ku.value===`dark`?`Switch to light theme`:`Switch to dark theme`,title:ku.value===`dark`?`Switch to light theme`:`Switch to dark theme`,onClick:()=>{Pu()},children:ku.value===`dark`?`☀`:`☾`})]})})}function Hu({path:e}){return P(`div`,{class:`ac-page ac-page--error`,children:[P(`h1`,{children:`Page not found`}),P(`p`,{children:[`Nothing routed to `,P(`code`,{children:e}),`. Try `,P(`a`,{href:`#/setup`,children:`Setup`}),`.`]})]})}function Uu(){let e=Mt.value;return e===null||e.dryRun!==!0?null:P(`div`,{class:`ac-dryrun-banner`,role:`status`,"aria-live":`polite`,children:[P(`strong`,{children:`DRY RUN`}),P(`span`,{children:` · no files will be written. Validation + rendering run normally; commits return a preview.`})]})}function Wu(e){return e===`/`||e===`/setup`||e.startsWith(`/setup/`)||e.startsWith(`/wizard`)?P(Cc,{path:e}):e===`/settings/changes`?P(Zc,{}):e===`/settings`||e.startsWith(`/settings/`)?P(Tl,{}):e===`/project`||e.startsWith(`/project/`)?P(Ml,{}):e===`/workspace`?P(Eu,{}):P(Hu,{path:e})}function Gu(){return D(()=>{Ot(),Tt.value===`/`&&Et(`/setup`),Nt()},[]),P(b,{children:[P(Uu,{}),Lu?null:P(Vu,{}),Wu(Tt.value)]})}var Ku=3e4,qu=18e5,Ju=null,Yu=!1;function Xu(e){if(!Yu&&(Yu=!0,typeof navigator<`u`&&typeof navigator.sendBeacon==`function`))try{navigator.sendBeacon(`/api/v1/shutdown?token=${encodeURIComponent(e)}`)}catch{}}function Zu(e){if(typeof window>`u`)return()=>{};let t=Date.now(),n=()=>{t=Date.now()},r=[`pointerdown`,`keydown`,`wheel`,`touchstart`];for(let e of r)window.addEventListener(e,n,{passive:!0});let i=()=>{document.hidden||n()};document.addEventListener(`visibilitychange`,i);let a=()=>{Ju!==null&&clearInterval(Ju),Ju=null;for(let e of r)window.removeEventListener(e,n);document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`pagehide`,o)};Ju=setInterval(()=>{if(!document.hidden){if(Date.now()-t>qu){Xu(e),a();return}M(`/api/v1/ping`).catch(()=>{})}},Ku);function o(){Xu(e)}return window.addEventListener(`pagehide`,o),a}function Qu(){if(typeof window>`u`||typeof window.history?.replaceState!=`function`)return;let e=new URLSearchParams(window.location.search);if(!e.has(`token`))return;e.delete(`token`);let t=e.toString(),n=window.location.pathname+(t?`?${t}`:``)+window.location.hash;window.history.replaceState(window.history.state,``,n)}function $u(){return new URLSearchParams(window.location.search).get(`token`)}function ed(){let e=document.getElementById(`app`);if(e===null)return;let t=$u();if(t===null){e.textContent="agent-config UI · missing token — re-open via `agent-config ui:serve`.";return}At(t),Qu(),Zu(t),Fu(),e.textContent=``,be(P(Gu,{}),e)}ed();
|
|
23
|
-
//# sourceMappingURL=index-
|
|
22
|
+
`,a);n!==-1&&(e=n);let r=t.slice(a,e);if(r.length>i&&r[0]!==` `&&/ [^ \t]/.test(r)&&(o=!0),n===-1)break;a=n+1}o?e.style=R.FOLDED_BLOCK:n&&(e.style=R.LITERAL_BLOCK)}function Da(e){e.style===R.PLAIN&&!ya(e.allowedStylesMask,R.PLAIN)&&(e.style=xa(e))}function Oa(e){ya(e.allowedStylesMask,e.style)||(e.style=R.DOUBLE_QUOTED)}var ka=`[\\x09\\x0A\\x0D\\x20-\\x7E\\x85\\xA0-\\uD7FF\\uE000-\\uFFFD\\u{10000}-\\u{10FFFF}]`,Aa=`[\\n\\r]`,ja=`\\uFEFF`,Ma=`[ \\t]`,Na=`(?:(?!(?:${Aa}|${ja}))${ka})`,Pa=`(?:(?!${Ma})${Na})`,Fa=`[\\x09\\x20-\\uD7FF\\uE000-\\uFFFF\\u{10000}-\\u{10FFFF}]`,Ia=`[-?:,\\[\\]{}#&*!|>'"%@\`]`,La=`[,\\[\\]{}]`,Ra=Pa,za=`(?:(?!${La})${Pa})`,Ba=`(?:(?:(?!${Ia})${Pa})|[?:-](?=${Ra}))`,Va=`(?:(?:(?!${Ia})${Pa})|[?:-](?=${za}))`,Ha=`(?:(?:(?![:#])${Ra})|:(?=${Ra}))#*`,Ua=`(?:(?:(?![:#])${za})|:(?=${za}))#*`,Wa=`(?:${Ma}*${Ha})*`,Ga=`(?:${Ma}*${Ua})*`,Ka=`${Ba}#*${Wa}`,qa=`${Va}#*${Ga}`,Ja=Ka,Ya=qa,Xa=`\\n+${Ha}${Wa}`,Za=`\\n+${Ua}${Ga}`,Qa=`${Ka}(?:${Xa})*`,$a=`${qa}(?:${Za})*`;RegExp(`^(?:${Qa})$`,`u`),RegExp(`^(?:${$a})$`,`u`),RegExp(`^(?:${Ja})$`,`u`),RegExp(`^(?:${Ya})$`,`u`),RegExp(`^(?:${Fa})*$`,`u`),RegExp(`^(?:${Fa}|\\n)*$`,`u`),RegExp(`^(?:${Na}|\\n)*$`,`u`),Object.keys(ba).map(e=>Reflect.get(ba,e)),L.DOCUMENT,L.SEQUENCE,L.MAPPING,L.SCALAR,L.ALIAS,L.POP,R.PLAIN,R.SINGLE_QUOTED,R.DOUBLE_QUOTED,R.LITERAL_BLOCK,R.FOLDED_BLOCK,Rr.BLOCK,Rr.FLOW,z.CLIP,z.STRIP,z.KEEP;function eo(e){if(e.trim()===``)return{};let t=va(e);if(t==null)return{};if(typeof t!=`object`||Array.isArray(t))throw Error(`.agent-user.yml must parse to an object`);return t}var to={id:`welcome`,title:`Welcome — who are you?`,navLabel:`You`,subtitle:`Your name and language. Stored in .agent-user.yml; we pre-fill what we can detect.`,kind:`welcome`},no={id:`profile`,title:`Which experience?`,navLabel:`Experience`,subtitle:"Pick the experience that fits you — developer · content · founder · agency · finance · ops. It selects your default command/skill surface and persona pre-selection. Cost tier is a secondary knob on a later step. You can switch later with `agent-config use --profile=<id>`.",kind:`form`,paths:[`profile.id`]},ro=[{id:`ai-tools`,title:`Which AI tools do you use?`,navLabel:`AI tools`,subtitle:`Pick the editors and CLIs that should pick up this config. Auto-detect runs first; you can override.`,kind:`aiTools`},{id:`roles`,title:`What do you work on?`,navLabel:`Roles`,subtitle:`Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in .agent-user.yml.`,kind:`roles`},{id:`packs`,title:`Which capability packs do you want?`,navLabel:`Packs`,subtitle:`Founder-strategy, finance-basic, gtm-sales, ops-people, ai-video — pick zero or more. You can change this later.`,kind:`packs`},{id:`legal-consent`,title:`Legal review-prep — not legal advice`,navLabel:`Legal consent`,subtitle:`Only relevant if you picked the legal-review-prep pack. It provides templates and general information, never legal advice — check the box to acknowledge before it activates. Leave unchecked otherwise; the pack stays inactive.`,kind:`form`,paths:[`legal_review_prep.acknowledged`]}],io=[{id:`identity`,title:`Editor & behaviour`,navLabel:`Preferences`,subtitle:`Your IDE plus how autonomously the agent works. rtk presence is auto-detected (see the rtk row). Your name lives in .agent-user.yml (later step).`,kind:`form`,paths:[`personal.ide`,`personal.open_edited_files`,`personal.autonomy`]},{id:`cost`,title:`Budgets, rules & cadence`,navLabel:`Budgets & cadence`,subtitle:`Independent levers: rule_loading_tier (how many behavioural rules load — token footprint), cost.budgets (optional USD ceilings), model.auto_switch (per-skill model tier), plus quality/roadmap cadence and memory redaction patterns.`,kind:`form`,paths:[`rule_loading_tier`,`cost.budgets.daily`,`cost.budgets.weekly`,`cost.budgets.monthly`,`cost.enforcement`,`model.auto_switch`,`roadmap.quality_cadence`,`quality.local_auto_run`,`memory.redact_patterns`]},{id:`user-md`,title:`Your .agent-user.yml`,navLabel:`User profile`,subtitle:`Identity, voice, preferences. Stored at agents/settings/.agent-user.yml. Skip to leave empty.`,kind:`userMd`},{id:`review`,title:`Review & finish`,navLabel:`Review`,subtitle:`These keys will change. Confirm to write .agent-settings.yml and .agent-user.yml atomically.`,kind:`review`}];io.length+2;function ao(e={}){return e.extended===!0?[to,no,...ro,...io]:[to,no,...io]}function oo(e,t={}){let n=ao(t);return n[Math.max(0,Math.min(n.length-1,e))]}function so(e){let t={},n=n=>{t[n]=!0;let r=e.clusterOf.get(n);r!==void 0&&(t[r]=!0)};for(let t of e.installed)n(t);for(let t of e.roleDefaults)n(t);for(let t of e.detected)n(t);return t}function co(e,t){let n=new Set(t);return e.filter(e=>e!==`engineering-base`&&!n.has(e)).sort()}function lo(e,t){let n={type:`object`,properties:{},...e.description===void 0?{}:{description:e.description}},r=n.properties,i=e.properties??{};for(let e of t){let t=e.split(`.`).filter(e=>e.length>0);if(t.length===0)continue;let[n,a,o]=t;if(n===void 0)continue;let s=i[n];if(s===void 0)continue;if(a===void 0){r[n]=s;continue}let c=s.properties?.[a];if(c===void 0)continue;let l=r[n]??{type:`object`,properties:{},...s.description===void 0?{}:{description:s.description}},u=l.properties??={};if(o===void 0){u[a]=c,r[n]=l;continue}let d=c.properties?.[o];if(d===void 0)continue;let f=u[a]??{type:`object`,properties:{},...c.description===void 0?{}:{description:c.description}},p=f.properties??={};p[o]=d,u[a]=f,r[n]=l}return n}function uo({current:e,total:t}){let n=Math.max(1,t),r=Math.max(0,Math.min(n-1,e)),i=Array.from({length:n},(e,t)=>t<=r),a=Math.round((r+1)/n*100);return P(`div`,{class:`ac-wizard__progress`,role:`progressbar`,"aria-valuenow":r+1,"aria-valuemin":1,"aria-valuemax":n,"aria-valuetext":`Step ${r+1} of ${n} (${a}%)`,children:i.map((e,t)=>P(`span`,{class:`ac-wizard__progress-segment${e?` ac-wizard__progress-segment--filled`:``}`,"aria-hidden":`true`},t))})}function fo({step:e,index:t,total:n}){return P(`header`,{class:`ac-page__header ac-wizard__header`,children:[P(`p`,{class:`ac-wizard__step-count`,children:[`Step `,t+1,` of `,n]}),P(`div`,{class:`ac-wizard__header-text`,children:[P(`h1`,{children:e.title}),P(`p`,{class:`ac-wizard__subtitle`,children:e.subtitle})]}),P(uo,{current:t,total:n})]})}function po(e){let t=e.canFinish??!0,n=e.completed??!1;return P(`div`,{class:`ac-form__actions ac-wizard__nav`,children:[P(`button`,{type:`button`,class:`ac-button`,disabled:!e.canGoPrev||e.busy,onClick:e.onPrev,children:`Back`}),e.canSkip&&e.onSkip!==void 0?P(`button`,{type:`button`,class:`ac-button ac-wizard__skip`,disabled:e.busy,onClick:e.onSkip,children:e.skipLabel??`Skip`}):null,e.isLast?n?null:P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:e.busy||!t,onClick:e.onFinish,children:e.busy?`Saving…`:`Finish & save`}):P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:!e.canGoNext||e.busy,onClick:e.onNext,children:e.nextLabel??`Next`})]})}function mo(e,t){return e.kind!==`form`||e.paths===void 0?!1:!!(e.paths.includes(t)||e.id===`cost`&&(t.startsWith(`telegraph.`)||t.startsWith(`verbosity.`)))}function ho(e,t){return e.kind===`userMd`?t===`body`||t.startsWith(`body.`):mo(e,t)}function go(e,t){for(let n of Object.keys(t.errors))if(ho(e,n))return!0;return!1}function _o(e,t){if(go(e,t))return{label:`needs attention`,tone:`error`};if(e.kind===`userMd`)return t.userMdChanged?{label:t.userMdAction===`create`?`will create`:`will replace`,tone:`changed`}:{label:``,tone:`idle`};if(e.kind===`form`){let n=t.changes.filter(t=>mo(e,t.path)).length;return n===0?{label:``,tone:`idle`}:{label:`${n} change${n===1?``:`s`}`,tone:`changed`}}if(e.kind===`aiTools`){let e=t.selectedToolsCount??0;return e===0?{label:``,tone:`idle`}:{label:`${e} tool${e===1?``:`s`}`,tone:`changed`}}if(e.kind===`packs`){let e=t.selectedPacksCount??0;return e===0?{label:``,tone:`idle`}:{label:`${e} pack${e===1?``:`s`}`,tone:`changed`}}return{label:``,tone:`idle`}}function vo(e){let t=e.steps.filter((t,n)=>n!==e.currentIndex),n=e.packRemovals??[],r=e.selectedToolIds??[],i=e.packAdditions??[],a=e.changes.length;return P(b,{children:[r.length>0||i.length>0||a>0||e.userMdChanged?P(`section`,{class:`ac-review-summary`,"aria-label":`What happens on Finish`,children:[P(`h2`,{class:`ac-review-summary__title`,children:`What happens on Finish`}),P(`ul`,{class:`ac-review-summary__list`,children:[a>0?P(`li`,{children:[P(`strong`,{children:a}),` setting`,a===1?``:`s`,` will change`,` `,`in `,P(`code`,{children:`.agent-settings.yml`}),`.`]}):P(`li`,{children:`No settings change.`}),e.userMdChanged?P(`li`,{children:[P(`code`,{children:`.agent-user.yml`}),` will be`,` `,e.userMdAction===`create`?`created`:`updated`,`.`]}):null,r.length>0?P(`li`,{children:[`Config is installed for `,r.length,` tool`,r.length===1?``:`s`,`:`,P(`span`,{class:`ac-review-summary__chips`,children:r.map(e=>P(`code`,{class:`ac-review-summary__chip`,children:e},e))})]}):null,i.length>0?P(`li`,{children:[`New pack`,i.length===1?``:`s`,`:`,P(`span`,{class:`ac-review-summary__chips`,children:i.map(e=>P(`code`,{class:`ac-review-summary__chip`,children:e},e))})]}):null]})]}):null,n.length>0?P(`div`,{class:`ac-review-removals`,role:`alert`,children:[P(`p`,{class:`ac-review-removals__title`,children:[`⚠️ `,n.length===1?`1 installed pack will be removed`:`${n.length} installed packs will be removed`]}),P(`ul`,{class:`ac-review-removals__list`,children:n.map(e=>P(`li`,{children:P(`code`,{children:e})},e))}),P(`label`,{class:`ac-review-removals__confirm`,children:[P(`input`,{type:`checkbox`,checked:e.removalsConfirmed??!1,onChange:t=>{e.onConfirmRemovals?.(t.currentTarget.checked)}}),P(`span`,{children:`I understand these packs will no longer be installed. Re-check them on the packs step to keep them.`})]})]}):null,P(`nav`,{class:`ac-wizard__review-nav`,"aria-label":`Jump back to a step`,children:[P(`p`,{class:`ac-wizard__review-nav-label`,children:`Jump back to a step:`}),P(`ul`,{class:`ac-wizard__review-nav-list`,children:t.map(t=>{let n=e.steps.indexOf(t),r=_o(t,e);return P(`li`,{children:P(`button`,{type:`button`,class:r.tone===`error`?`ac-wizard__review-nav-button ac-wizard__review-nav-button--error`:`ac-wizard__review-nav-button`,onClick:()=>{e.onJump(n)},children:[P(`span`,{class:`ac-wizard__review-nav-index`,children:n+1}),P(`span`,{class:`ac-wizard__review-nav-text`,children:t.navLabel}),r.label===``?null:P(`span`,{class:`ac-wizard__review-nav-status ac-wizard__review-nav-status--${r.tone}`,children:r.label})]})},t.id)})})]})]})}function yo(e){let t=e.abortedAt??`unknown time`,n=e.abortNote??`no further detail recorded`,r=e.writesSinceRollback;return P(`aside`,{class:`ac-banner ac-banner--recovery`,role:`alert`,children:[P(`strong`,{children:`Previous install was interrupted.`}),P(`p`,{children:[`Aborted at `,P(`code`,{children:t}),` — `,n,`. `,r,` write`,r===1?``:`s`,` landed before the abort marker.`]}),P(`p`,{children:`Pick how to recover before continuing. Resume reopens the wizard fresh, Rollback discards the abort state, Ignore hides this banner without touching the log.`}),P(`div`,{class:`ac-banner__actions`,children:[P(`button`,{type:`button`,disabled:e.busy,onClick:()=>e.onResume(),children:`Resume install`}),P(`button`,{type:`button`,disabled:e.busy,onClick:()=>e.onRollback(),children:`Rollback`}),P(`button`,{type:`button`,disabled:e.busy,onClick:()=>e.onIgnore(),children:`Ignore`})]})]})}function bo(){return P(`section`,{class:`ac-continue-screen`,"aria-labelledby":`ac-continue-title`,children:[P(`h2`,{id:`ac-continue-title`,children:`Install complete — continue with setup?`}),P(`p`,{children:`Your install selections (AI tools, roles, capability packs) are captured. Use the footer to continue:`}),P(`ul`,{children:[P(`li`,{children:[P(`strong`,{children:`Next`}),` — go through the remaining personalisation steps: editor + tooling, personality, cost profile, roadmap & quality, memory, your`,P(`code`,{children:` .agent-user.yml`}),`, and finally the project module roots.`]}),P(`li`,{children:[P(`strong`,{children:`Finish install here`}),` — skip the rest and write `,P(`code`,{children:`.agent-settings.yml`}),` with the install-only selections. You can re-run `,P(`code`,{children:`agent-config setup`}),`later to pick up the personalisation steps.`]})]})]})}function xo(e){let t=e.version??`unknown`;return P(`section`,{class:`ac-backup-screen`,"aria-labelledby":`ac-backup-title`,children:[P(`h2`,{id:`ac-backup-title`,children:`Existing v3 install detected`}),P(`p`,{children:[`Found a v3.x install at `,P(`code`,{children:e.sourcePath}),` `,`(VERSION: `,P(`code`,{children:t}),`). v4 is a hard-cut release with no auto-migration — settings, identity, and history layouts changed. The wizard can back up the v3 tree before writing the v4 layout so you can roll back manually if needed.`]}),e.error===null?null:P(`p`,{class:`ac-banner ac-banner--error`,children:[`Backup failed: `,e.error]}),P(`ul`,{children:[P(`li`,{children:[P(`strong`,{children:`Backup v3 and proceed`}),` — copies the tree to `,P(`code`,{children:e.backupTarget}),`, then runs the v4 install. Restore later with`,P(`code`,{children:[` mv `,e.backupTarget,` `,e.sourcePath]}),`.`]}),P(`li`,{children:[P(`strong`,{children:`Abort, uninstall v3 first`}),` — closes the wizard. You decide what to keep.`]})]}),P(`div`,{class:`ac-backup-screen__actions`,children:[P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:e.busy,onClick:()=>e.onBackupAndProceed(),children:e.busy?`Backing up…`:`Backup v3 and proceed`}),P(`button`,{type:`button`,class:`ac-button`,disabled:e.busy,onClick:()=>e.onAbort(),children:`Abort, uninstall v3 first`})]})]})}var So=[{title:`Restart your AI tools`,detail:`Editors and CLIs pick up the new skills, rules, and commands on their next start.`},{title:`Verify the installation`,detail:`A read-only health report — scope, deployed files, drift.`,command:`agent-config doctor`},{title:`Tune your settings any time`,detail:`Opens the configuration GUI (global settings; --project for a project).`,command:`agent-config config`},{title:`Initialize a project`,detail:`Adds the minimal agents/ bridge + .gitignore block to a repository.`,command:`agent-config init --project`},{title:`Stay up to date`,detail:`Upgrades the global install and additively syncs your settings.`,command:`agent-config upgrade`}];function Co({text:e}){let[t,n]=Ne(!1);return P(`button`,{type:`button`,class:`ac-button ac-checklist__copy`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>{n(!0),setTimeout(()=>{n(!1)},1500)})},children:t?`Copied ✓`:`Copy`})}function wo({message:e}){return P(`div`,{class:`ac-checklist`,children:[P(`div`,{class:`ac-checklist__hero`,children:[P(`h2`,{class:`ac-checklist__headline`,children:`Setup complete`}),e===null?null:P(`p`,{class:`ac-checklist__message`,children:e})]}),P(`ol`,{class:`ac-checklist__items`,children:So.map(e=>P(`li`,{class:`ac-checklist__item`,children:[P(`div`,{class:`ac-checklist__text`,children:[P(`span`,{class:`ac-checklist__item-title`,children:e.title}),P(`span`,{class:`ac-checklist__item-detail`,children:e.detail})]}),e.command===void 0?null:P(`div`,{class:`ac-checklist__cmd-row`,children:[P(`code`,{class:`ac-checklist__cmd`,children:e.command}),P(Co,{text:e.command})]})]},e.title))}),P(`p`,{class:`ac-checklist__close-hint`,children:`You can close this browser window — the local server shuts down on its own.`})]})}var To=A(!1),Eo=A(null),q=A(null),Do=A(!1),Oo=A(!1),ko=A(0),Ao=A(null),J=A({}),jo=A({}),Mo=A(0),No=A({}),Y=A(null),Po=A(null),Fo=A(!1),Io=A(!1),Lo=A(!1),Ro=A({}),zo=A([]);A(`global`);var Bo=A(!1),X=A(!1),Vo=A(!1),Ho=A(!1),Uo=A(null),Wo=A([]),Go=A({}),Ko=A(!0),qo=A(``),Jo=A(`agents`);A(!1);var Yo=A(null),Xo=[{id:`claude-code`,label:`Claude Code`},{id:`claude-desktop`,label:`Claude Desktop`},{id:`cursor`,label:`Cursor`},{id:`windsurf`,label:`Windsurf`},{id:`cline`,label:`Cline`},{id:`gemini-cli`,label:`Gemini CLI`},{id:`copilot`,label:`GitHub Copilot`},{id:`augment`,label:`Augment`},{id:`aider`,label:`Aider`},{id:`codex`,label:`Codex`},{id:`roocode`,label:`Roo Code`},{id:`continue`,label:`Continue`},{id:`kilocode`,label:`Kilo Code`},{id:`zed`,label:`Zed`},{id:`jetbrains`,label:`JetBrains`},{id:`kiro`,label:`Kiro`},{id:`qoder`,label:`Qoder`},{id:`opencode`,label:`OpenCode`},{id:`trae`,label:`Trae`},{id:`antigravity`,label:`Antigravity`},{id:`codebuddy`,label:`CodeBuddy`},{id:`droid`,label:`Droid`},{id:`warp`,label:`Warp`}],Zo=A(!1),Qo=A(!1),$o=A(null),es=A([]),ts=A([]),ns=A([]),rs=A(!1),is=A([]),as=A({}),os=A(!1),ss=A(!1),cs=A(!1),ls=A({}),us=A(!1),ds=A(null),fs=A(null),ps=A(null),ms=A(null),hs=A(null),gs=A(null),_s=A(`https://github.com/rtk-ai/rtk`),vs=A(!1),ys=A(null),bs=A(null),xs=A(null),Ss=A(`event4u-app/agent-switch`),Cs=A(!1);A(!1),A(null),A([]),A({}),A({});var ws=A({}),Ts=A({}),Es=A(!1),Ds=A(!1);A({}),A(null),A(null),A(!1),A(null);var Os=A(null),ks=A(!1),As=A(null),js=A(!1),Ms=A(!1),Ns=A(null),Ps=A(null),Fs=A(!1),Is=A(!1);function Ls(){return ao({extended:X.value})}function Rs(){return Ls().length}function zs(e){return e??new Date().toISOString()}function Bs(e){return Math.max(0,Math.min(Rs()-1,e))}function Vs(e){if(`$ref`in e&&e.$ref!==void 0&&`definitions`in e&&e.definitions!==void 0){let t=e.$ref.replace(`#/definitions/`,``),n=e.definitions[t];if(n!==void 0)return n}return e}async function Hs(){try{return await M(`/api/v1/settings`)}catch(e){if(e instanceof j&&e.status===404&&e.body.error?.code===`NOT_FOUND`){let t=e.body;return t.defaults!==void 0&&t.schema!==void 0?{values:t.defaults,lastModified:t.lastModified??0,path:t.path??`.agent-settings.yml`,schema:t.schema}:{values:{},lastModified:0,path:`.agent-settings.yml`,schema:(await M(`/api/v1/schema`)).settings}}throw e}}async function Us(){try{let e=await M(`/api/v1/install/recovery`);Os.value=e.incomplete?e:null}catch{Os.value=null}}async function Ws(){try{let e=await M(`/api/v1/install/legacy-v3`);As.value=e.present?e:null}catch{As.value=null}}async function Gs(){Ms.value=!0,Ns.value=null;try{await M(`/api/v1/install/backup-v3`,{method:`POST`}),js.value=!0}catch(e){Ns.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}finally{Ms.value=!1}}async function Ks(e){try{await M(`/api/v1/install/recovery/dismiss`,{method:`POST`,body:{reason:e}})}catch(e){q.value={message:e instanceof Error?e.message:String(e),tone:`error`};return}Os.value=null,ks.value=!0}async function qs(){Eo.value=null;try{Us(),Ws();let[e,t]=await Promise.all([M(`/api/v1/wizard/state`),Hs()]);Ao.value=Vs(t.schema),Mo.value=t.lastModified,jo.value=t.values,Ro.value=t.legacyHints??{},X.value=e.extendedSteps===!0,Ps.value=e.wizardMode??null,J.value=Object.keys(e.partial??{}).length>0?{...t.values,...e.partial}:t.values,ko.value=Bs(e.step),Bo.value=!1,To.value=!0;let n=oo(ko.value,{extended:X.value});(n.kind===`welcome`||n.kind===`userMd`||n.kind===`review`)&&Ys(),(n.kind===`roles`||n.kind===`aiTools`||n.kind===`packs`)&&Zs(),n.kind===`roles`&&oc(),n.kind===`aiTools`&&Qs(),n.id===`identity`&&($s(),ec()),n.kind===`review`&&nc()}catch(e){Eo.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}}function Js(e,t){return e.identity.name.trim()===``?{...e,identity:{...e.identity,name:t}}:e}async function Ys(){if(!Io.value)try{let e=await M(`/api/v1/user-md`);if(Fo.value=e.exists,e.exists&&e.identity!==null){let t=hn(e.identity);Po.value=t,Y.value=t}else{let e;try{e=hn(eo((await M(`/api/v1/user-md/template`)).body))}catch{e=ln()}let t=Ro.value.user_name;typeof t==`string`&&t.trim()!==``&&(e=Js(e,t)),Po.value=e,Y.value=e}}catch(e){q.value={message:e instanceof Error?e.message:String(e),tone:`error`}}finally{Io.value=!0}}var Xs=new Set([`python`]);async function Zs(){if(!(Zo.value||Qo.value)){Qo.value=!0,$o.value=null;try{let[e,t]=await Promise.all([M(`/api/v1/wizard/manifest`),M(`/api/v1/wizard/auto-detect`)]),n=(e.packs??[]).map(e=>({id:e.id,label:e.label??e.id,description:e.description??``,requires_hint:e.requires_hint,cluster:e.cluster??void 0,workspaces:e.workspaces}));es.value=n,is.value=(e.workspaces??[]).filter(e=>e.id!==`agent-config-maintainer`).map(e=>({id:e.id,label:e.label??e.id,description:e.description??``,default_packs:e.default_packs??[],optional_packs:e.optional_packs??[],...e.example_roles===void 0?{}:{example_roles:e.example_roles}}));let r=new Set(n.map(e=>e.id));ts.value=t.signals.map(e=>e.id.startsWith(`pack-`)?e.id.slice(5):e.id).filter(e=>r.has(e)).filter(e=>!Xs.has(e)),ns.value=(e.installedPacks??[]).filter(e=>r.has(e))}catch(e){$o.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}finally{Qo.value=!1,Zo.value=!0}}}async function Qs(){if(!(ss.value||cs.value)){cs.value=!0;try{let e=await M(`/api/v1/wizard/detect-tools`),t=e.tools??{},n=e.configured??[];if(ls.value=t,Object.keys(ws.value).length===0){let e={};if(n.length>0)for(let t of n)e[t]=!0;else for(let[n,r]of Object.entries(t))r&&(e[n]=!0);ws.value=e}}catch{}finally{cs.value=!1,ss.value=!0}}}async function $s(){if(!us.value){us.value=!0;try{let e=await M(`/api/v1/wizard/detect-rtk`),t=e.installed===!0;ds.value=t,fs.value=e.present===!0,ps.value=e.identity??null,ms.value=e.version??null,hs.value=e.installCommand??null,gs.value=e.installCommands??null,typeof e.repo==`string`&&(_s.value=e.repo);let n=J.value.personal??{};J.value={...J.value,personal:{...n,rtk_installed:t}}}catch{}}}async function ec(){if(!vs.value){vs.value=!0;try{let e=await M(`/api/v1/wizard/detect-agent-switch`);ys.value=e.installed===!0,bs.value=e.version??null,xs.value=e.installCommand??null,typeof e.repo==`string`&&(Ss.value=e.repo),Cs.value=e.dismissed===!0}catch{}}}async function tc(e,t){try{await M(`/api/v1/wizard/state`,{method:`POST`,body:{step:e,totalSteps:Rs(),partial:t,startedAt:zs(null)}})}catch(e){q.value={message:e instanceof Error?e.message:String(e),tone:`error`}}}async function nc(){Oo.value=!0;try{zo.value=(await M(`/api/v1/settings/diff`,{method:`POST`,body:{values:J.value,ifUnmodifiedSince:Mo.value}})).changes,No.value={}}catch(e){e instanceof j?(No.value=Ft(e.body.error??{code:`UNKNOWN`,message:e.message}),q.value={message:N(e.body.error??{code:`UNKNOWN`,message:e.message}),tone:`error`}):q.value={message:e instanceof Error?e.message:String(e),tone:`error`}}finally{Oo.value=!1}}function rc(){return Lo.value?!1:Y.value===null||Po.value===null?Y.value!==Po.value:JSON.stringify(Y.value)!==JSON.stringify(Po.value)}async function ic(e){let t=Bs(e);await tc(t,J.value),ko.value=t,q.value=null;let n=oo(t,{extended:X.value});(n.kind===`welcome`||n.kind===`userMd`)&&Ys(),(n.kind===`roles`||n.kind===`aiTools`||n.kind===`packs`)&&Zs(),n.kind===`roles`&&oc(),n.kind===`packs`&&sc(),n.kind===`aiTools`&&Qs(),n.id===`identity`&&($s(),ec()),n.kind===`review`&&nc()}function ac(){let e=Ts.value,t=new Map(es.value.map(e=>[e.id,e])),n=Object.entries(e).filter(([,e])=>e===!0).map(([e])=>e).filter(n=>{let r=t.get(n)?.cluster;return r===void 0||e[r]===!0}),r=new Set,i=e=>{if(!r.has(e)){r.add(e);for(let n of t.get(e)?.requires_hint??[])i(n)}};for(let e of n)i(e);return[...r].sort()}async function oc(){if(await Promise.all([Zs(),Ys()]),os.value||Object.values(as.value).some(Boolean))return;let e=Y.value?.role??[];if(e.length===0)return;let t=new Set(is.value.map(e=>e.id)),n={};for(let r of e)t.has(r)&&(n[r]=!0);Object.keys(n).length!==0&&(as.value=n,sc())}function sc(){if(Es.value)return;let e=Object.entries(as.value).filter(([,e])=>e===!0).map(([e])=>e),t=new Map(is.value.map(e=>[e.id,e])),n=[];for(let r of e)for(let e of t.get(r)?.default_packs??[])n.push(e);let r=new Map;for(let e of es.value)e.cluster!==void 0&&r.set(e.id,e.cluster);Ts.value=so({installed:ns.value,roleDefaults:n,detected:ts.value,clusterOf:r})}function cc(){let e=Object.entries(ws.value).filter(([,e])=>e===!0).map(([e])=>e);if(e.length===0)return null;let t={schema_version:`wizard-v2`,tools:e,packs:ac(),settings:J.value};return Mt.value?.dryRun===!0&&(t.dry_run=!0),t}async function lc(){Do.value=!0,q.value=null;try{let e={settings:J.value},t=Object.entries(as.value).filter(([,e])=>e===!0).map(([e])=>e),n=Y.value!==null&&typeof Y.value.identity?.name==`string`&&Y.value.identity.name.trim().length>0;Y.value!==null&&n&&(rc()||t.length>0)&&(e.identity=t.length>0?{...Y.value,role:t}:Y.value);let r=await M(`/api/v1/wizard/finish`,{method:`POST`,body:e}),i=r.dryRun===!0?`Dry-run complete — no files written. Settings would be saved.`:Array.isArray(r.writtenPaths)?`Saved (${r.writtenPaths.join(`, `)}). Wizard complete.`:`Wizard complete.`,a=X.value?cc():null,o=``;if(a!==null&&a.dry_run===!0)try{await M(`/api/v1/wizard/apply`,{method:`POST`,body:a}),o=` Installer preview OK (dry-run) — no files written.`}catch(e){o=` Installer preview failed: ${e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}.`}else if(a!==null)try{let e=null,t=0;await jt(`/api/v1/wizard/apply`,a,n=>{if(n.type===`error`)e=typeof n.message==`string`?n.message:`install failed`;else if(n.type===`done`){let e=n.summary;t=typeof e?.conflicts==`number`?e.conflicts:0}});let n=a.tools.length,r=a.packs.length;o=e===null?` Installer applied ${n} tool${n===1?``:`s`}`+(r>0?` and ${r} pack${r===1?``:`s`}.`:`.`)+(t>0?` ${t} file${t===1?``:`s`} you had edited ${t===1?`was`:`were`} kept; the new package content is staged alongside as *.agent-config.new. This installation is not current until you merge it.`:``):` Installer failed: ${e}. Settings were saved; re-run the wizard to retry.`}catch(e){o=` Installer bridge failed: ${e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}. Settings were saved; re-run the wizard to retry the install plan.`}q.value={message:`${i}${o} You can close this browser window now.`,tone:`success`},ko.value=Bs(Rs()-1),jo.value=J.value,Po.value=rc()?Y.value:Po.value,zo.value=[],Bo.value=!0}catch(e){e instanceof j?(No.value=Ft(e.body.error??{code:`UNKNOWN`,message:e.message}),q.value={message:N(e.body.error??{code:`UNKNOWN`,message:e.message}),tone:`error`}):q.value={message:e instanceof Error?e.message:String(e),tone:`error`}}finally{Do.value=!1}}async function uc(){Is.value=!0,await Promise.all([Zs(),Qs()]),await oc(),sc(),await ic(Rs()-1)}function dc(){D(()=>{Zs(),Qs()},[]);let e=Qo.value||cs.value||!Zo.value||!ss.value,t=Object.values(ls.value).filter(Boolean).length,n=ns.value.length,r=ts.value.filter(e=>!ns.value.includes(e)).length;return P(`div`,{class:`ac-start`,children:[P(`section`,{class:`ac-start__card ac-start__card--primary`,children:[P(`h2`,{class:`ac-start__title`,children:`Recommended setup`}),P(`p`,{class:`ac-start__desc`,children:`The fastest path — we pre-select everything we can detect and you confirm one review screen before anything is written.`}),P(`ul`,{class:`ac-start__facts`,children:[P(`li`,{children:e?`Detecting your AI tools…`:t===0?`No AI tools detected — pick them on the review screen.`:`${t} AI tool${t===1?``:`s`} detected and pre-selected.`}),P(`li`,{children:e?`Detecting capability packs…`:n>0?`${n} installed pack${n===1?``:`s`} kept${r>0?`, ${r} more auto-detected`:``}.`:r>0?`${r} capability pack${r===1?``:`s`} auto-detected.`:`No packs pre-selected — add them any time later.`}),P(`li`,{children:`Settings keep their current values (or safe defaults on a first run).`}),P(`li`,{children:`Nothing is written until you confirm the review screen.`})]}),P(`button`,{type:`button`,class:`ac-button ac-button--primary ac-start__cta`,disabled:e,onClick:()=>{uc()},children:e?`Detecting…`:`Use recommended setup`})]}),P(`section`,{class:`ac-start__card`,children:[P(`h2`,{class:`ac-start__title`,children:`Customize`}),P(`p`,{class:`ac-start__desc`,children:`Walk through every step — tools, roles, packs, behaviour, budgets — and tune each choice yourself.`}),P(`button`,{type:`button`,class:`ac-button ac-start__cta`,onClick:()=>{Is.value=!0},children:`Customize step by step`})]})]})}var fc=[`de`,`en`,`en-US`,`en-GB`,`fr`,`es`,`it`,`nl`,`pt`,`pt-BR`];function pc(){if(Ds.value)return;let e=Y.value;if(e===null)return;Ds.value=!0;let t=e;if(e.identity.name.trim()===``){let e=Mt.value?.systemUser;e!==void 0&&e.trim()!==``&&(t={...t,identity:{...t.identity,name:e}})}if(!Fo.value&&typeof navigator<`u`){let e=(navigator.language||``).split(`-`)[0];e.length>=2&&(t={...t,language:e})}t!==e&&(Y.value=t)}function mc(){let e=Y.value;if(D(()=>{pc()},[e]),e===null)return P(`p`,{children:`Loading…`});let t=e=>{Y.value={...e,last_updated:new Date().toISOString().slice(0,10)},Lo.value=!1};return P(`div`,{class:`ac-wizard-step-stub ac-wizard__module-fields`,children:[P(`p`,{children:[`Tell the agent who you are. We pre-filled what we could detect — adjust freely. Stored in `,P(`code`,{children:`.agent-user.yml`}),`.`]}),P(`div`,{class:`ac-field`,children:[P(`label`,{class:`ac-field__label`,for:`welcome-name`,children:`Name`}),P(`input`,{class:`ac-input`,id:`welcome-name`,type:`text`,placeholder:`How should the agent address you?`,value:e.identity.name,onInput:n=>t({...e,identity:{...e.identity,name:n.currentTarget.value}})})]}),P(`div`,{class:`ac-field`,children:[P(`label`,{class:`ac-field__label`,for:`welcome-lang`,children:`Language`}),P(`input`,{class:`ac-input`,id:`welcome-lang`,type:`text`,list:`welcome-lang-list`,placeholder:`BCP-47 code, e.g. de, en, en-US`,value:e.language,onInput:n=>t({...e,language:n.currentTarget.value})}),P(`datalist`,{id:`welcome-lang-list`,children:fc.map(e=>P(`option`,{value:e},e))})]})]})}function hc(){let e=ws.value,t=ls.value;return P(`div`,{class:`ac-wizard-step-stub`,children:[P(`p`,{children:`Pick the AI tools you use. Tools detected on this machine are pre-selected on first run. The installer wires each selected tool's surface (skills, rules, commands) on apply; you can change this list later by re-running the wizard.`}),P(`ul`,{class:`ac-wizard__tool-list`,children:Xo.map(n=>{let r=t[n.id]===!0;return P(`li`,{class:`ac-wizard__tool-row`,children:[P(`label`,{class:`ac-wizard__tool-label`,children:[P(`input`,{type:`checkbox`,checked:e[n.id]??!1,onChange:t=>{let r=t.currentTarget.checked;ws.value={...e,[n.id]:r}}}),` `,n.label]}),P(`span`,{class:`ac-badge ${r?`ac-badge--installed`:`ac-badge--missing`}`,title:r?`Detected on this machine`:`Not detected on this machine`,children:r?`installed`:`not installed`})]},n.id)})})]})}function gc(){if(Qo.value)return P(`p`,{children:`Loading roles…`});if($o.value!==null)return P(`div`,{class:`ac-wizard-step-stub`,children:P(`p`,{class:`ac-banner ac-banner--error`,children:[`Discovery failed: `,$o.value]})});let e=as.value,t=is.value,n=(e,t)=>{os.value=!0,as.value={...as.value,[e]:t},sc()};return P(`div`,{class:`ac-wizard-step-stub`,children:[P(`p`,{children:[`Pick the areas you work in. We use them to recommend capability packs on the next step, and they become your roles in`,P(`code`,{children:` .agent-user.yml`}),`.`]}),t.length===0?P(`p`,{children:P(`em`,{children:`No roles available in the manifest.`})}):P(`div`,{class:`ac-wizard__pack-grid`,children:t.map(t=>P(`section`,{class:`ac-pack-tile`,children:[P(`label`,{class:`ac-pack-tile__head`,children:[P(`input`,{type:`checkbox`,checked:e[t.id]??!1,onChange:e=>{n(t.id,e.currentTarget.checked)}}),P(`span`,{class:`ac-pack-tile__title`,children:t.label})]}),(t.example_roles??[]).length>0?P(`p`,{class:`ac-pack-tile__role`,children:[`e.g. `,(t.example_roles??[]).join(`, `)]}):null,t.description===``?null:P(`p`,{class:`ac-pack-tile__desc`,children:t.description})]},t.id))})]})}function _c(){if(Qo.value)return P(`p`,{children:`Loading discovery manifest…`});if($o.value!==null)return P(`div`,{class:`ac-wizard-step-stub`,children:[P(`p`,{class:`ac-banner ac-banner--error`,children:[`Discovery failed: `,$o.value]}),P(`p`,{children:`The manifest endpoint is gated on extended-mode. Re-run the server with extended steps enabled to populate this list.`})]});let e=Ts.value,t=new Set(ts.value),n=new Set(ns.value),r=e=>n.has(e)?P(`span`,{class:`ac-badge ac-badge--installed`,children:`installed`}):t.has(e)?P(`span`,{class:`ac-badge ac-badge--detected`,children:`auto-detected`}):null,i=new Map(is.value.map(e=>[e.id,e.label])),a=as.value,o=e=>{let t=(e??[]).filter(e=>e!==`agent-config-maintainer`);return t.length===0?null:P(`span`,{class:`ac-pack-tile__ws`,children:t.map(e=>P(`span`,{class:`ac-badge ac-badge--ws${a[e]===!0?` ac-badge--ws-active`:``}`,title:a[e]===!0?`Matches a role you picked`:`Workspace / area`,children:i.get(e)??e},e))})},s=es.value.filter(e=>e.id!==`engineering-base`),c=new Map;for(let e of s)if(e.cluster!==void 0){let t=c.get(e.cluster)??[];t.push(e),c.set(e.cluster,t)}let l=new Set(s.filter(e=>e.cluster!==void 0).map(e=>e.id)),u=s.filter(e=>!l.has(e.id)),d=(e,t)=>{Es.value=!0,Ts.value={...Ts.value,[e]:t}},f=(e,t)=>{Es.value=!0;let n={...Ts.value,[e]:t};if(t)for(let t of c.get(e)??[])n[t.id]===void 0&&(n[t.id]=!0);Ts.value=n};return P(`div`,{class:`ac-wizard-step-stub`,children:[P(`p`,{children:`Pick the capability packs to install. Auto-detected packs are pre-selected; engineering hygiene is included automatically when a pack needs it. A language tile expands to its frameworks — turn the language off to skip them all.`}),u.length===0?P(`p`,{children:P(`em`,{children:`No packs available in the manifest.`})}):P(`div`,{class:`ac-wizard__pack-grid`,children:u.map(t=>{let n=c.get(t.id)??[],i=n.length>0,a=e[t.id]??!1;return P(`section`,{class:`ac-pack-tile`,children:[P(`label`,{class:`ac-pack-tile__head`,children:[P(`input`,{type:`checkbox`,checked:a,onChange:e=>{let n=e.currentTarget.checked;i?f(t.id,n):d(t.id,n)}}),P(`span`,{class:`ac-pack-tile__title`,children:t.label}),r(t.id)]}),o(t.workspaces),t.description===``?null:P(`p`,{class:`ac-pack-tile__desc`,children:t.description}),i?P(`fieldset`,{class:`ac-pack-tile__children`,disabled:!a,children:n.map(t=>P(`label`,{class:`ac-pack-tile__child`,children:[P(`input`,{type:`checkbox`,checked:e[t.id]??!1,disabled:!a,onChange:e=>{d(t.id,e.currentTarget.checked)}}),P(`span`,{children:t.label}),r(t.id)]},t.id))}):null]},t.id)})})]})}function vc(){let e=ds.value,t=fs.value,n=ps.value,r=ms.value,i=gs.value,a=e===null?P(`span`,{class:`ac-badge ac-badge--missing`,children:`detecting…`}):e?P(`span`,{class:`ac-badge ac-badge--installed`,children:[`installed`,r===null?``:` (v${r})`]}):t===!0?P(`span`,{class:`ac-badge ac-badge--missing`,children:n===`unknown-rtk`?`different tool`:`unverified`}):P(`span`,{class:`ac-badge ac-badge--missing`,children:`not installed`});return P(`div`,{class:`ac-rtk-row`,children:[P(`div`,{class:`ac-rtk-row__head`,children:[P(`span`,{class:`ac-rtk-row__label`,children:[`rtk `,P(`small`,{children:`(Rust Token Killer — third-party, Apache-2.0)`})]}),a]}),t===!0&&n===`unknown-rtk`?P(`div`,{class:`ac-rtk-row__install`,children:[P(`p`,{class:`ac-field__description`,children:[`A binary named `,P(`code`,{children:`rtk`}),` is on PATH, but it is not Rust Token Killer — two unrelated projects share the name (the other is Rust Type Kit). The token-saving integration stays off. See the upstream name-collision guidance:`]}),P(`a`,{class:`ac-button`,href:`${_s.value}/blob/master/INSTALL.md`,target:`_blank`,rel:`noreferrer noopener`,children:`Open rtk install guide`})]}):null,t===!0&&n===`unverified`?P(`p`,{class:`ac-field__description`,children:[`rtk found but the identity check failed — verify manually with `,P(`code`,{children:`rtk gain`}),` (Rust Token Killer renders a token-savings dashboard; the colliding Rust Type Kit does not).`]}):null,t===!1?P(`div`,{class:`ac-rtk-row__install`,children:[P(`p`,{class:`ac-field__description`,children:`rtk wraps verbose CLI output — upstream reports 60–90% token savings (their estimate). Install it, then re-open the wizard to pick up detection:`}),i===null?hs.value===null?null:P(`code`,{class:`ac-rtk-row__cmd`,children:hs.value}):P(b,{children:[i.recommendedLabel===void 0?null:P(`p`,{class:`ac-field__description`,children:[i.recommendedLabel,`:`]}),P(`code`,{class:`ac-rtk-row__cmd`,children:i.recommended}),i.manual===void 0?null:P(b,{children:[P(`p`,{class:`ac-field__description`,children:[i.manualLabel??`Manual`,`:`]}),P(`code`,{class:`ac-rtk-row__cmd`,children:i.manual})]}),i.note===void 0?null:P(`p`,{class:`ac-field__description`,children:i.note})]}),P(`a`,{class:`ac-button`,href:_s.value,target:`_blank`,rel:`noreferrer noopener`,children:`Open rtk repo`})]}):null]})}async function yc(){try{await M(`/api/v1/wizard/dismiss-recommendation`,{method:`POST`,body:{id:`agent-switch`}})}catch(e){q.value={message:e instanceof Error?e.message:String(e),tone:`error`};return}Cs.value=!0}function bc(){return!vs.value||ys.value!==!1||Cs.value?null:P(`div`,{class:`ac-rtk-row`,children:[P(`div`,{class:`ac-rtk-row__head`,children:[P(`span`,{class:`ac-rtk-row__label`,children:[`agent-switch `,P(`small`,{children:`(third-party, MIT)`})]}),P(`span`,{class:`ac-badge ac-badge--missing`,children:`not installed`})]}),P(`div`,{class:`ac-rtk-row__install`,children:[P(`p`,{class:`ac-field__description`,children:[`agent-switch isolates multiple agent accounts into per-account profiles (`,P(`code`,{children:`CLAUDE_CONFIG_DIR`}),`) so switching accounts never requires a re-login. Free and MIT-licensed.`]}),xs.value===null?null:P(`code`,{class:`ac-rtk-row__cmd`,children:xs.value}),P(`a`,{class:`ac-button`,href:`https://github.com/${Ss.value}`,target:`_blank`,rel:`noreferrer noopener`,children:`Open agent-switch repo`}),P(`button`,{type:`button`,class:`ac-button ac-button--small`,onClick:()=>{yc()},children:`Don't show again`})]})]})}function xc(){let e=oo(ko.value,{extended:X.value});if(X.value&&Ps.value===`install`&&e.id===`identity`&&!Fs.value)return P(bo,{});if(e.kind===`form`){let t=lo(Ao.value,e.paths??[]);return P(b,{children:[e.id===`identity`?P(vc,{}):null,e.id===`identity`?P(bc,{}):null,P(tn,{schema:t,values:J.value,errors:No.value,onChange:e=>{J.value=e}})]})}return e.kind===`userMd`?!Io.value||Y.value===null?P(`p`,{children:`Loading .agent-user.yml…`}):P(cn,{value:Y.value,errors:No.value,hideRole:X.value&&Ps.value===`install`,hideIdentityBasics:X.value&&Ps.value===`install`,onChange:e=>{Y.value=e,Lo.value=!1}}):e.kind===`welcome`?P(mc,{}):e.kind===`aiTools`?P(hc,{}):e.kind===`roles`?P(gc,{}):e.kind===`packs`?P(_c,{}):P(vo,{steps:Ls(),currentIndex:ko.value,changes:zo.value,errors:No.value,userMdChanged:rc(),userMdAction:Fo.value?`replace`:`create`,loading:Oo.value,onJump:e=>{ic(e)},selectedToolsCount:Object.values(ws.value).filter(Boolean).length,selectedPacksCount:Object.values(Ts.value).filter(Boolean).length,packRemovals:Sc(),removalsConfirmed:rs.value,onConfirmRemovals:e=>{rs.value=e},selectedToolIds:Object.entries(ws.value).filter(([,e])=>e).map(([e])=>e),packAdditions:X.value?ac().filter(e=>e!==`engineering-base`&&!ns.value.includes(e)):[]})}function Sc(){return X.value?co(ns.value,ac()):[]}function Cc({path:e}){if(D(()=>{qs()},[]),!To.value||Ao.value===null)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Setup wizard`}),Eo.value===null?P(`p`,{children:`Loading…`}):P(`p`,{class:`ac-banner ac-banner--error`,children:Eo.value})]});let t=ko.value,n=Rs(),r=oo(t,{extended:X.value}),i=t===n-1,a=r.kind===`aiTools`&&Object.values(ws.value).filter(Boolean).length===0||r.kind===`roles`&&Object.values(as.value).filter(Boolean).length===0||r.kind===`packs`&&ac().length===0,o=X.value&&Ps.value===`install`&&r.id===`identity`&&!Fs.value,s=Os.value,c=s!==null&&!ks.value,l=As.value,u=l!==null&&l.present&&!js.value,d=X.value&&Ps.value===`install`&&t===0&&!Is.value&&!Bo.value;return u?P(`div`,{class:`ac-page`,children:P(xo,{sourcePath:l.path,backupTarget:l.backupTarget,version:l.version,busy:Ms.value,error:Ns.value,onBackupAndProceed:()=>{Gs()},onAbort:()=>{q.value={tone:`info`,message:"Aborted. Uninstall v3 manually, then re-run `agent-config install`."},js.value=!0}})}):d?P(`div`,{class:`ac-page`,children:[P(`header`,{class:`ac-page__header`,children:P(`h1`,{children:`Set up agent-config`})}),q.value===null?null:P(`p`,{class:`ac-banner${q.value.tone===`error`?` ac-banner--error`:``}`,children:q.value.message}),P(dc,{})]}):P(`div`,{class:`ac-page`,children:[P(fo,{step:r,index:t,total:n}),c?P(yo,{abortedAt:s.abortedAt,abortNote:s.abortNote,writesSinceRollback:s.writesSinceRollback,busy:Do.value,onResume:()=>{Ks(`resume`)},onRollback:()=>{Ks(`rollback`)},onIgnore:()=>{Ks(`ignore`)}}):null,q.value!==null&&!(Bo.value&&i&&q.value.tone===`success`)?P(`p`,{class:`ac-banner${q.value.tone===`error`?` ac-banner--error`:``}`,children:q.value.message}):null,P(`div`,{class:`ac-wizard__step`,children:Bo.value&&i?P(wo,{message:q.value?.tone===`success`?q.value.message:null}):P(xc,{})}),a?P(`p`,{class:`ac-wizard__hint`,children:r.kind===`aiTools`?`Select at least one AI tool to continue.`:r.kind===`roles`?`Select at least one role to continue.`:`Select at least one capability pack to continue.`}):null,P(po,{canGoPrev:t>0,canGoNext:!i&&!a,canSkip:o||r.kind===`userMd`,skipLabel:o?`Finish install here`:`Skip`,isLast:i,busy:Do.value||Oo.value,canFinish:(zo.value.length>0||rc()||Sc().length>0||X.value&&Object.values(ws.value).some(Boolean))&&(Sc().length===0||rs.value),completed:Bo.value,onPrev:()=>{ic(t-1)},onNext:()=>{if(o){Fs.value=!0;return}ic(t+1)},onSkip:()=>{if(o){Fs.value=!0,ic(Rs()-1);return}Lo.value=!0,ic(t+1)},onFinish:()=>{lc()}})]})}var wc=new Set([`profile.id`,`rule_loading_tier`,`discipline_profile`,`personal.ide`,`personal.open_edited_files`,`personal.autonomy`,`personal.pr_progress_comments`,`cost.budgets.daily`,`cost.budgets.weekly`,`cost.budgets.monthly`,`cost.enforcement`,`model.auto_switch`,`roadmap.quality_cadence`,`quality.local_auto_run`,`memory.redact_patterns`,`chat_history.enabled`,`update_check.enabled`,`legal_review_prep.acknowledged`]);function Tc(e){return wc.has(e)}function Ec(e,t){return JSON.stringify(e??null)===JSON.stringify(t??null)}function Dc(e,t){if(e.kind===`enum_removed`){let n=new Set(e.values??[]);return t!==void 0&&n.has(t)?`must_fix`:`info`}return e.kind===`type_changed`?`must_fix`:e.kind===`default_changed`?t===void 0||Ec(t,e.old?.default)?`adopt`:`review`:e.kind===`added`&&e.new?.default===void 0?`must_fix`:`info`}var Oc=A(!0),kc=A(null),Ac=A(!1),jc=A(null),Mc=A({}),Nc=A(0),Pc=A({}),Fc=A(null),Ic=A(!1),Lc=A(!1);function Rc(e){return`${e.key}:${e.kind}`}async function zc(){Oc.value=!0,kc.value=null,Ac.value=!1,Lc.value=!1;try{let e=await M(`/api/v1/settings/changes`),t=await M(`/api/v1/settings`);jc.value=e.delta,Mc.value=t.values,Nc.value=t.lastModified,Bc(e.delta,t.values)}catch(e){e instanceof j&&e.status===404?Ac.value=!0:kc.value=e instanceof Error?e.message:String(e)}finally{Oc.value=!1}}function Bc(e,t){let n={};for(let r of e.changes){let e=Dc(r,Yt(t,r.key.split(`.`)));e===`adopt`?n[Rc(r)]={mode:`adopt`}:e===`review`?n[Rc(r)]={mode:`keep`}:e===`must_fix`&&(n[Rc(r)]={mode:null})}Pc.value=n}function Vc(e){return Dc(e,Yt(Mc.value,e.key.split(`.`)))}function Hc(e,t){Pc.value={...Pc.value,[e]:t}}function Uc(){let e=jc.value;return e===null?[]:e.changes.filter(e=>{if(Vc(e)!==`must_fix`)return!1;let t=Pc.value[Rc(e)];return t===void 0||t.mode===null||t.mode===`custom`&&(t.value===void 0||t.value===``)})}function Wc(){let e=jc.value,t=Mc.value;if(e===null)return t;for(let n of e.changes){let e=Pc.value[Rc(n)];if(e===void 0||e.mode===null||e.mode===`keep`)continue;let r=n.key.split(`.`);e.mode===`adopt`&&n.new?.default!==void 0?t=Xt(t,r,n.new.default):e.mode===`custom`&&e.value!==void 0&&(t=Xt(t,r,e.value))}return t}async function Gc(){if(Ic.value)return;let e=Uc();if(e.length>0){Fc.value=`Resolve the ${e.length} “Must fix” item${e.length===1?``:`s`} first.`;return}Ic.value=!0,Fc.value=null;try{let e=Wc();if(JSON.stringify(e)!==JSON.stringify(Mc.value)){let t=await M(`/api/v1/settings`,{method:`PUT`,headers:{"If-Unmodified-Since":String(Nc.value)},body:{values:e}});Mc.value=e,Nc.value=t.lastModified}await M(`/api/v1/settings/changes/ack`,{method:`POST`}),Lc.value=!0}catch(e){Fc.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}finally{Ic.value=!1}}async function Kc(){if(!Ic.value){if(Uc().length>0){Fc.value=`Cannot dismiss — “Must fix” items would leave invalid values in place.`;return}Ic.value=!0;try{await M(`/api/v1/settings/changes/ack`,{method:`POST`}),Lc.value=!0}catch(e){Fc.value=e instanceof Error?e.message:String(e)}finally{Ic.value=!1}}}function qc(e){return e===void 0?`—`:typeof e==`string`?e:JSON.stringify(e)}function Jc({change:e,id:t}){let n=e.new,r=Pc.value[t]?.value;return n?.enum===void 0?n?.type===`boolean`?P(`select`,{class:`ac-input`,"aria-label":`New value for ${e.key}`,value:r===void 0?``:String(r),onChange:e=>{Hc(t,{mode:`custom`,value:e.currentTarget.value===`true`})},children:[P(`option`,{value:``,disabled:!0,children:`Choose…`}),P(`option`,{value:`true`,children:`true`}),P(`option`,{value:`false`,children:`false`})]}):P(`input`,{class:`ac-input`,type:n?.type===`number`||n?.type===`integer`?`number`:`text`,"aria-label":`New value for ${e.key}`,value:r===void 0?``:String(r),onInput:e=>{let r=e.currentTarget.value;Hc(t,{mode:`custom`,value:n?.type===`number`||n?.type===`integer`?Number(r):r})}}):P(`select`,{class:`ac-input`,"aria-label":`New value for ${e.key}`,value:r===void 0?``:String(r),onChange:e=>{let n=e.currentTarget.value;Hc(t,{mode:`custom`,value:n})},children:[P(`option`,{value:``,disabled:!0,children:`Choose a value…`}),n.enum.map(e=>P(`option`,{value:String(e),children:String(e)},String(e)))]})}function Yc({change:e}){let t=Vc(e),n=Rc(e),r=Pc.value[n],i=Yt(Mc.value,e.key.split(`.`));return P(`li`,{class:`ac-change-card ac-change-card--${t}`,"data-key":e.key,"data-kind":e.kind,children:[P(`div`,{class:`ac-change-card__head`,children:[P(`code`,{class:`ac-change-card__key`,children:e.key}),P(`span`,{class:`ac-change-card__badge ac-change-card__badge--${t}`,children:t===`must_fix`?`Must fix`:t===`adopt`?`New default`:t===`review`?`Review`:`Info`})]}),e.new?.description===void 0?null:P(`p`,{class:`ac-change-card__desc`,children:e.new.description}),e.kind===`default_changed`?P(b,{children:[P(`p`,{class:`ac-change-card__detail`,children:[`Default changed: `,P(`code`,{children:qc(e.old?.default)}),` → `,P(`code`,{children:qc(e.new?.default)}),t===`review`?P(b,{children:[` · your value: `,P(`code`,{children:qc(i)})]}):null]}),P(`div`,{class:`ac-change-card__choices`,role:`radiogroup`,"aria-label":`Resolution for ${e.key}`,children:[P(`label`,{class:`ac-change-card__choice`,children:[P(`input`,{type:`radio`,name:n,checked:r?.mode===`adopt`,onChange:()=>{Hc(n,{mode:`adopt`})}}),P(`span`,{children:[`Adopt new default (`,P(`code`,{children:qc(e.new?.default)}),`)`]})]}),P(`label`,{class:`ac-change-card__choice`,children:[P(`input`,{type:`radio`,name:n,checked:r?.mode===`keep`,onChange:()=>{Hc(n,{mode:`keep`})}}),P(`span`,{children:[`Keep current (`,P(`code`,{children:qc(i??e.old?.default)}),`)`]})]})]})]}):null,e.kind===`enum_removed`?t===`must_fix`?P(b,{children:[P(`p`,{class:`ac-change-card__detail`,children:[`Your value `,P(`code`,{children:qc(i)}),` is no longer valid — removed option`,(e.values?.length??0)===1?``:`s`,`: `,P(`code`,{children:(e.values??[]).join(`, `)}),`. Pick a replacement:`]}),P(Jc,{change:e,id:n})]}):P(`p`,{class:`ac-change-card__detail`,children:[`Removed option`,(e.values?.length??0)===1?``:`s`,`: `,P(`code`,{children:(e.values??[]).join(`, `)}),` — your value `,P(`code`,{children:qc(i??e.new?.default)}),` is unaffected.`]}):null,e.kind===`enum_added`?P(`p`,{class:`ac-change-card__detail`,children:[`New option`,(e.values?.length??0)===1?``:`s`,` available: `,P(`code`,{children:(e.values??[]).join(`, `)})]}):null,e.kind===`added`?t===`must_fix`?P(b,{children:[P(`p`,{class:`ac-change-card__detail`,children:`New setting without a shipped default — define a value:`}),P(Jc,{change:e,id:n})]}):P(`p`,{class:`ac-change-card__detail`,children:[`New setting · default: `,P(`code`,{children:qc(e.new?.default)}),e.new?.enum===void 0?null:P(b,{children:[` · options: `,P(`code`,{children:e.new.enum.join(`, `)})]})]}):null,e.kind===`removed`?P(`p`,{class:`ac-change-card__detail`,children:`This setting no longer exists. Your stored value is kept in place and ignored (nothing is deleted).`}):null,e.kind===`type_changed`?P(b,{children:[P(`p`,{class:`ac-change-card__detail`,children:[`Type changed: `,P(`code`,{children:e.old?.type}),` → `,P(`code`,{children:e.new?.type}),`. Define a new value:`]}),P(Jc,{change:e,id:n})]}):null]})}function Xc(e){let t=new Map;for(let n of e.changes){let e=Vc(n);t.set(e,[...t.get(e)??[],n])}let n=[],r=t.get(`must_fix`)??[];r.length>0&&n.push({title:`Must fix`,hint:`These stored values are invalid after the upgrade — saving is blocked until each has a valid value.`,changes:r});let i=[...t.get(`adopt`)??[],...t.get(`review`)??[]];i.length>0&&n.push({title:`Changed defaults`,hint:`Values you never customized are preselected to adopt the new default; customized values are kept unless you choose otherwise.`,changes:i});let a=t.get(`info`)??[],o=a.filter(e=>e.kind===`added`),s=a.filter(e=>e.kind===`enum_added`),c=a.filter(e=>e.kind!==`added`&&e.kind!==`enum_added`);return o.length>0&&n.push({title:`New settings`,changes:o}),s.length>0&&n.push({title:`New options`,changes:s}),c.length>0&&n.push({title:`Removed / other`,changes:c}),n}function Zc(){if(D(()=>{zc()},[]),Oc.value)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Settings changes`}),P(`p`,{children:`Loading…`})]});if(kc.value!==null)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Settings changes`}),P(`p`,{class:`ac-banner ac-banner--error`,children:kc.value})]});if(Lc.value||Ac.value)return P(`div`,{class:`ac-page ac-settings-changes`,children:[P(`h1`,{children:`Settings changes`}),P(`p`,{class:`ac-banner`,children:Lc.value?`Review complete — all changes resolved.`:`Nothing to review — your settings are up to date.`}),P(`button`,{type:`button`,class:`ac-button`,onClick:()=>Et(`/settings`),children:`Back to Settings`})]});let e=jc.value;if(e===null)return P(`div`,{class:`ac-page`,children:P(`h1`,{children:`Settings changes`})});let t=Xc(e),n=Uc().length;return P(`div`,{class:`ac-page ac-settings-changes`,children:[P(`header`,{class:`ac-page__header`,children:[P(`h1`,{children:`Settings changes`}),P(`p`,{class:`ac-page__lede`,children:[`The upgrade `,P(`code`,{children:e.oldVersion}),` → `,P(`code`,{children:e.newVersion}),` changed the available settings. Review below — nothing was changed automatically.`]})]}),Fc.value===null?null:P(`p`,{class:`ac-banner ac-banner--error`,role:`alert`,children:Fc.value}),t.map(e=>P(`section`,{class:`ac-settings-changes__group`,children:[P(`h2`,{children:[e.title,` `,P(`span`,{class:`ac-settings-changes__count`,children:[`(`,e.changes.length,`)`]})]}),e.hint===void 0?null:P(`p`,{class:`ac-settings-changes__hint`,children:e.hint}),P(`ul`,{class:`ac-settings-changes__list`,children:e.changes.map(e=>P(Yc,{change:e},Rc(e)))})]},e.title)),P(`div`,{class:`ac-form__actions`,children:[P(`button`,{type:`button`,class:`ac-button`,disabled:Ic.value,onClick:()=>{Kc()},children:`Dismiss (keep everything)`}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:Ic.value||n>0,title:n>0?`${n} “Must fix” item${n===1?``:`s`} unresolved`:void 0,onClick:()=>{Gc()},children:Ic.value?`Saving…`:`Apply & finish review`})]})]})}var Qc=A(null);function $c(){return D(()=>{(async()=>{try{Qc.value=(await M(`/api/v1/settings/changes`)).delta.changes.length}catch{Qc.value=null}})()},[]),Qc.value===null||Qc.value===0?null:P(`div`,{class:`ac-banner ac-banner--pending`,role:`status`,children:[P(`span`,{children:[`An upgrade changed `,Qc.value,` setting`,Qc.value===1?``:`s`,` — review recommended.`]}),P(`button`,{type:`button`,class:`ac-button ac-button--small`,onClick:()=>Et(`/settings/changes`),children:`Review changes`})]})}var el=A(!1),tl=A(null),Z=A({}),nl=A(null),rl=A(0),il=A({}),al=A(null),ol=A(!1),sl=A(null),cl=A(null),ll=A(``),ul=A(!1),dl=A({}),fl=A({global:new Set,project:new Set});function pl(e){if(`$ref`in e&&e.$ref!==void 0&&`definitions`in e&&e.definitions!==void 0){let t=e.$ref.replace(`#/definitions/`,``),n=e.definitions[t];if(n!==void 0)return n}return e}async function ml(){tl.value=null;try{let e=await M(`/api/v1/settings`);Z.value=e.values,nl.value=pl(e.schema),rl.value=e.lastModified,fl.value={global:new Set(e.sources?.global??[]),project:new Set(e.sources?.project??[])},el.value=!0}catch(e){if(e instanceof j&&e.status===404&&e.body.error?.code===`NOT_FOUND`){let t=e.body;if(t.defaults!==void 0&&t.schema!==void 0){Z.value=t.defaults,nl.value=pl(t.schema),rl.value=t.lastModified??0,el.value=!0;return}}tl.value=e instanceof Error?e.message:String(e)}}async function hl(){if(!ol.value){al.value=null,il.value={};try{let e=await M(`/api/v1/settings/diff`,{method:`POST`,body:{values:Z.value,ifUnmodifiedSince:rl.value}});if(e.changes.length===0){al.value=`No changes to save.`;return}sl.value=e.changes}catch(e){e instanceof j?(il.value=Ft(e.body.error??{code:`UNKNOWN`,message:e.message}),al.value=N(e.body.error??{code:`UNKNOWN`,message:e.message})):al.value=e instanceof Error?e.message:String(e)}}}async function gl(e=!1){ol.value=!0;try{let t=await M(`/api/v1/settings`,{method:`PUT`,headers:{"If-Unmodified-Since":String(rl.value)},body:e?{values:Z.value,confirmSharedWrite:!0}:{values:Z.value}});rl.value=t.lastModified,sl.value=null,cl.value=null,al.value=`Saved (${t.writtenPaths.join(`, `)}).`}catch(e){if(e instanceof j){let t=e.body;if(e.status===409&&t.error===`shared-write`){sl.value=null,cl.value={sharedPath:typeof t.sharedPath==`string`?t.sharedPath:``,message:typeof t.message==`string`?t.message:`This write affects a shared agent-switch profile.`};return}let n=e.body.error??{code:`UNKNOWN`,message:e.message};il.value=Ft(n),al.value=N(n),sl.value=null;let r=Object.keys(il.value)[0];r!==void 0&&queueMicrotask(()=>{let e=document.getElementById(r);e!==null&&e.focus()})}else al.value=e instanceof Error?e.message:String(e)}finally{ol.value=!1}}function _l(e){if(e.defaultValue===void 0)return!1;let t=Yt(Z.value,e.path);return t!==void 0&&JSON.stringify(t)!==JSON.stringify(e.defaultValue)}function vl(e,t){let n=_l(t),r=fl.value.project.has(e)?`project`:fl.value.global.has(e)&&fl.value.project.size>0?`global`:void 0;return{modified:n,onReset:n&&t.defaultValue!==void 0?()=>{Z.value=Xt(Z.value,t.path,t.defaultValue)}:void 0,sourceLabel:r}}function yl(e,t){let n=t.toLowerCase();return e.path.join(`.`).toLowerCase().includes(n)||e.label.toLowerCase().includes(n)||(e.description??``).toLowerCase().includes(n)}function bl(e){let t=ll.value.trim(),n=ul.value,r=e.path.join(`.`),i=dl.value[r]===!0,a=e.fields.filter(e=>e.kind!==`unsupported`);if(t!==``&&(a=a.filter(e=>yl(e,t))),n&&(a=a.filter(e=>_l(e))),t!==``||n)return a.length===0?null:{section:e,visible:a,hiddenAdvancedCount:0,expanded:i};let o=a.filter(e=>Tc(e.path.join(`.`))),s=a.filter(e=>!Tc(e.path.join(`.`))),c=i?[...o,...s]:o;return c.length===0&&s.length===0?null:{section:e,visible:c,hiddenAdvancedCount:i?0:s.length,expanded:i}}function xl(e){dl.value={...dl.value,[e]:dl.value[e]!==!0}}function Sl(){let e=Mt.value?.agentSwitchProfile;return e===void 0||e.active!==!0?null:P(`div`,{class:`ac-banner`,role:`status`,children:P(`span`,{children:[`Running under agent-switch profile `,P(`code`,{children:e.provider!==null&&e.profile!==null?`${e.provider}/${e.profile}`:`an unidentified profile`}),` — settings shown and saved here are profile-scoped. Switching profiles shows that profile's own settings; nothing is lost.`]})})}function Cl({block:e}){return P(`div`,{class:`ac-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`shared-write-title`,children:P(`div`,{class:`ac-modal__panel`,children:[P(`h2`,{id:`shared-write-title`,children:`Shared write — affects all profiles`}),P(`p`,{children:e.message}),P(`p`,{children:P(`code`,{children:e.sharedPath})}),P(`div`,{class:`ac-modal__actions`,children:[P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{cl.value=null},children:`Cancel`}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:ol.value,onClick:()=>{gl(!0)},children:ol.value?`Writing…`:`Write (affects all profiles)`})]})]})})}function wl({changes:e}){return P(`div`,{class:`ac-modal`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`diff-title`,children:P(`div`,{class:`ac-modal__panel`,children:[P(`h2`,{id:`diff-title`,children:`Confirm changes`}),P(`ul`,{class:`ac-diff`,children:e.map(e=>P(`li`,{children:[P(`code`,{children:e.path}),P(`span`,{class:`ac-diff__before`,children:JSON.stringify(e.from)}),P(`span`,{class:`ac-diff__arrow`,children:`→`}),P(`span`,{class:`ac-diff__after`,children:JSON.stringify(e.to)})]},e.path))}),P(`div`,{class:`ac-modal__actions`,children:[P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{sl.value=null},children:`Cancel`}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:ol.value,onClick:()=>{gl()},children:ol.value?`Saving…`:`Save`})]})]})})}function Tl(){if(D(()=>{ml()},[]),!el.value||nl.value===null)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Settings`}),tl.value===null?P(`p`,{children:`Loading…`}):P(`p`,{class:`ac-banner ac-banner--error`,children:tl.value})]});let e=Jt(nl.value),t=e.map(bl).filter(e=>e!==null),n=e.flatMap(e=>e.fields).filter(e=>_l(e)).length,r=ll.value.trim()!==``||ul.value;return P(`div`,{class:`ac-page ac-settings-hub`,children:[P(`header`,{class:`ac-page__header`,children:[P(`h1`,{children:`Settings`}),P(`nav`,{class:`ac-page__nav`,children:P(`a`,{href:`#/settings/user`,children:`Edit .agent-user.yml →`})})]}),P($c,{}),P(Sl,{}),P(`div`,{class:`ac-settings-hub__toolbar`,role:`search`,children:[P(`input`,{class:`ac-input ac-settings-hub__search`,type:`search`,placeholder:`Search all settings (basic and advanced)…`,value:ll.value,onInput:e=>{ll.value=e.currentTarget.value}}),P(`button`,{type:`button`,class:`ac-chip-toggle${ul.value?` ac-chip-toggle--active`:``}`,"aria-pressed":ul.value,onClick:()=>{ul.value=!ul.value},children:[`@modified`,n>0?` (${n})`:``]})]}),al.value===null?null:P(`p`,{class:`ac-banner`,children:al.value}),P(`form`,{class:`ac-form`,onSubmit:e=>e.preventDefault(),children:[t.length===0?P(`p`,{class:`ac-settings-hub__empty`,children:`No settings match.`}):t.map(e=>{let t=e.section.path.join(`.`);return P(en,{section:{...e.section,fields:e.visible},values:Z.value,errors:il.value,onChange:e=>{Z.value=e},decorate:vl,footer:!r&&(e.hiddenAdvancedCount>0||e.expanded)?P(`button`,{type:`button`,class:`ac-settings-hub__disclosure`,"aria-expanded":e.expanded,onClick:()=>{xl(t)},children:e.expanded?`Hide advanced settings`:`Show ${e.hiddenAdvancedCount} advanced setting${e.hiddenAdvancedCount===1?``:`s`}`}):void 0},t)}),P(`div`,{class:`ac-form__actions`,children:[P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{ml()},children:`Reload`}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,onClick:()=>{hl()},children:`Preview & Save`})]})]}),sl.value===null?null:P(wl,{changes:sl.value}),cl.value===null?null:P(Cl,{block:cl.value})]})}var El=A(!1),Dl=A(null);async function Ol(){Ho.value=!0,Uo.value=null;try{let e=await M(`/api/v1/modules/detect`);Wo.value=e.candidates,Yo.value=e.project_root;let t={};for(let n of e.candidates)t[n.path]=!0;Go.value=t,Ko.value=e.proposed_block.enabled,qo.value=e.proposed_block.namespace_template??``,Jo.value=e.proposed_block.agent_folder??`agents`}catch(e){Uo.value=e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}finally{Ho.value=!1,Vo.value=!0}}function kl(){let e=new Set(Wo.value.map(e=>e.path)),t=Go.value,n=Object.keys(t).filter(n=>t[n]===!0&&e.has(n));return{enabled:Ko.value,root_paths:n,namespace_template:qo.value,agent_folder:Jo.value||`agents`}}async function Al(){El.value=!0,Dl.value=null;try{let e=await M(`/api/v1/modules/apply`,{method:`POST`,body:kl()});Dl.value={message:e.appliedTo===null?`Saved project settings to ${e.projectRoot}.`:`Saved project settings to ${e.appliedTo}.`,tone:`success`}}catch(e){Dl.value={message:`Could not save project settings: ${e instanceof j?N(e.body.error??{code:`UNKNOWN`,message:e.message}):e instanceof Error?e.message:String(e)}`,tone:`error`}}finally{El.value=!1}}function jl(){if(Ho.value)return P(`p`,{children:`Detecting module roots…`});if(Uo.value!==null)return P(`p`,{class:`ac-banner ac-banner--error`,children:[`Module detection failed: `,Uo.value]});let e=Wo.value,t=Go.value,n=Yo.value;return P(`div`,{class:`ac-section`,children:[n===null?null:P(`p`,{class:`ac-section__description`,children:[`Scanning `,P(`code`,{children:n}),`. Pick which detected roots the agent should treat as modules. These write to`,P(`code`,{children:` .agent-project-settings.yml`}),` in this repo only.`]}),P(`label`,{children:[P(`input`,{type:`checkbox`,checked:Ko.value,onChange:e=>{Ko.value=e.currentTarget.checked}}),` `,`Enable module discovery (writes `,P(`code`,{children:`modules.enabled`}),`)`]}),e.length===0?P(`p`,{children:[P(`em`,{children:`No module roots detected.`}),` The scan found no common module layouts (Laravel `,P(`code`,{children:`app/Modules/`}),`, Symfony`,P(`code`,{children:` src/Module/`}),`, Node `,P(`code`,{children:`packages/`}),`, Python`,P(`code`,{children:` src/`}),`, Go `,P(`code`,{children:`internal/`}),`).`]}):P(`ul`,{style:`list-style: none; padding-left: 0;`,children:e.map(e=>P(`li`,{children:P(`label`,{children:[P(`input`,{type:`checkbox`,checked:t[e.path]??!1,onChange:n=>{let r=n.currentTarget.checked;Go.value={...t,[e.path]:r}}}),` `,P(`code`,{children:e.path}),` — `,e.stack,` `,P(`small`,{children:[`(`,e.confidence,` confidence)`]})]})},e.path))}),P(`div`,{class:`ac-wizard__module-fields`,children:[P(`div`,{class:`ac-field`,children:[P(`label`,{class:`ac-field__label`,for:`ac-modules-namespace`,children:`Namespace template`}),P(`input`,{id:`ac-modules-namespace`,class:`ac-input`,type:`text`,value:qo.value,placeholder:`e.g. App\\\\Modules\\\\{ModuleName}\\\\App`,onInput:e=>{qo.value=e.currentTarget.value}}),P(`span`,{class:`ac-field__description`,children:`How a module path maps to its namespace. Leave blank to skip namespacing.`})]}),P(`div`,{class:`ac-field`,children:[P(`label`,{class:`ac-field__label`,for:`ac-modules-agent-folder`,children:`Agent folder`}),P(`input`,{id:`ac-modules-agent-folder`,class:`ac-input`,type:`text`,value:Jo.value,placeholder:`agents`,onInput:e=>{Jo.value=e.currentTarget.value}}),P(`span`,{class:`ac-field__description`,children:[`Folder name that holds per-module agent docs (default `,P(`code`,{children:`agents`}),`).`]})]})]})]})}function Ml(){return D(()=>{Ol()},[]),P(`div`,{class:`ac-page`,children:[P(`header`,{class:`ac-page__header`,children:[P(`h1`,{children:`Project settings`}),P(`p`,{class:`ac-section__description`,children:[`Configuration scoped to this repository — written to`,P(`code`,{children:` .agent-project-settings.yml`}),`, not the global tree.`]})]}),Dl.value===null?null:P(`p`,{class:`ac-banner ac-banner--${Dl.value.tone===`success`?`success`:`error`}`,children:Dl.value.message}),P(`section`,{class:`ac-section`,children:[P(`h2`,{class:`ac-section__title`,children:`Modules`}),P(jl,{})]}),P(`div`,{class:`ac-form__actions ac-wizard__nav`,children:P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:El.value||Ho.value,onClick:()=>{Al()},children:El.value?`Saving…`:`Save project settings`})})]})}var Nl=A([]),Pl=A([]),Fl=A([]),Il=A([]),Ll=A(null),Rl=A(!1),zl=A(null),Q=A(null),Bl=A(`plain`),Vl=A({}),Hl=A([]),Ul={"claude-code":`Claude Code`,codex:`Codex`,gemini:`Gemini`};function Wl(){try{return globalThis.sessionStorage?.getItem(`ac-workspace-host`)??`claude-code`}catch{return`claude-code`}}var Gl=A(Wl());function Kl(e){Gl.value=e;try{globalThis.sessionStorage?.setItem(`ac-workspace-host`,e)}catch{}}var ql=A([]),$=A(null),Jl=A({}),Yl=A(!1),Xl=A(null),Zl=A(``),Ql=A(!1),$l=A(!1),eu=A(null),tu=A(null),nu=A([]),ru=A(new Set),iu=`claude-code`,au=2e3;async function ou(){zl.value=null;try{let[e,t,n,r,i,a]=await Promise.all([M(`/api/v1/workspace/roles`),M(`/api/v1/workspace/sessions?limit=20`),M(`/api/v1/workspace/knowledge?limit=20`),M(`/api/v1/workspace/documents?limit=20`),M(`/api/v1/workspace/drive-health`).catch(()=>({health:{}})),M(`/api/v1/workspace/hosts`).catch(()=>({hosts:[]}))]);Nl.value=e.roles,Pl.value=t.sessions,Fl.value=n.chunks,Il.value=r.documents,Vl.value=i.health??{},Hl.value=a.hosts??[],Rl.value=!0}catch(e){zl.value=e instanceof j?e.body?.error?.message??e.message:e instanceof Error?e.message:String(e)}}async function su(e,t){try{ql.value=(await M(`/api/v1/workspace/roles/${e}/tasks`)).tasks}catch{ql.value=t}}async function cu(e){tu.value=e,ru.value=new Set;try{let t=await M(`/api/v1/workspace/sessions/${e}`);nu.value=Array.isArray(t.log)?t.log:[]}catch{nu.value=[]}}async function lu(e){Q.value=null,$l.value=!1,Zl.value=``,$.value=null,await cu(e)}async function uu(e,t,n){Q.value=null,Yl.value=!0,Zl.value=``,$l.value=!1,eu.value={role:e,task:t,inputs:n};try{let r=await M(`/api/v1/workspace/launch`,{method:`POST`,body:{role:e,task:t,inputs:n,host:Gl.value}});Xl.value=r,Q.value=mu(r),$.value=null,await cu(r.id),Pl.value=(await M(`/api/v1/workspace/sessions?limit=20`)).sessions,await fu()}catch(e){Xl.value=null,Q.value=e instanceof j?e.body?.error?.message??e.message:e instanceof Error?e.message:String(e)}finally{Yl.value=!1}}async function du(e,t){if(!(t.trim()===``||Ql.value)){Ql.value=!0,Q.value=null;try{let n=await M(`/api/v1/workspace/sessions/${e}/continue`,{method:`POST`,body:{prompt:t}});Xl.value=n,Q.value=mu(n),n.driven&&(Zl.value=``),await cu(e),Pl.value=(await M(`/api/v1/workspace/sessions?limit=20`)).sessions,await fu()}catch(e){e instanceof j&&e.status===410?($l.value=!0,Q.value=`Host session expired — start a new conversation.`):Q.value=e instanceof j?e.body?.error?.message??e.message:e instanceof Error?e.message:String(e)}finally{Ql.value=!1}}}async function fu(){try{Vl.value=(await M(`/api/v1/workspace/drive-health`)).health??{}}catch{}}async function pu(e){try{await M(`/api/v1/workspace/drive-health/${e}/reset`,{method:`POST`}),await fu()}catch{}}function mu(e){return e.driven?e.recovered===!0?`Host recovered — drove the turn for ${e.role} · ${e.task}.`:`Drove the turn for ${e.role} · ${e.task}.`:e.host_killed===!0?`Host ${iu} is paused after repeated failures — handed off to the inbox.`:e.error_kind===`render-error`?`Couldn't fill the prompt: ${e.error??`missing input`}.`:e.reason===`no-prompt-for-task`?`Recorded the session — this task has no runnable prompt yet.`:typeof e.handoff==`string`?`Prepared a hand-off — open ${e.handoff} and paste it into your host.`:`Recorded the session ${e.id} (${e.role} · ${e.task}).`}function hu({role:e}){let t=Ll.value===e.slug;return P(`button`,{type:`button`,class:`ac-workspace__role${t?` ac-workspace__role--active`:``}`,"aria-current":t?`true`:void 0,"aria-label":`Pick role ${e.display_name}`,onClick:()=>{Ll.value=e.slug,Q.value=null,Xl.value=null,$.value=null,Jl.value={},ql.value=e.first_tasks,su(e.slug,e.first_tasks)},children:[P(`span`,{class:`ac-workspace__role-name`,children:e.display_name}),P(`span`,{class:`ac-workspace__role-status`,"data-status":e.status,children:e.status}),P(`span`,{class:`ac-workspace__role-tagline`,children:e.tagline})]})}function gu({role:e,task:t}){let n=t.inputs??[],r=Jl.value,i=n.some(e=>e.required&&(r[e.name]??``).trim()===``);return P(`form`,{class:`ac-workspace__task-form`,onSubmit:n=>{n.preventDefault(),!i&&!Yl.value&&uu(e,t.name,Jl.value)},children:[n.length===0?P(`p`,{class:`ac-workspace__form-note`,children:`No inputs — runs the prompt as-is.`}):n.map(e=>P(`label`,{class:`ac-workspace__field`,children:[P(`span`,{class:`ac-workspace__field-label`,children:[e.name,e.required?P(`span`,{class:`ac-workspace__req`,"aria-hidden":`true`,children:` *`}):null]}),P(`textarea`,{class:`ac-workspace__field-input`,placeholder:e.shape,required:e.required,"aria-label":`${e.name}${e.required?` (required)`:``}`,value:r[e.name]??``,onInput:t=>{Jl.value={...Jl.value,[e.name]:t.target.value}}})]},e.name)),P(`div`,{class:`ac-workspace__form-actions`,children:[P(`button`,{type:`submit`,class:`ac-button ac-button--primary`,disabled:i||Yl.value,children:Yl.value?`Running…`:`Run task`}),P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{$.value=null},children:`Cancel`})]})]})}function _u(e){let t=[];for(let n of e){let e=n.data??{};if(n.kind===`launcher.input`)e.followup===!0?t.push({kind:`user`,text:typeof e.prompt==`string`?e.prompt:``}):t.push({kind:`task`,text:typeof e.task==`string`?e.task:``});else if(n.kind===`host.turn`){let n=e.usage,r=n==null?void 0:`${typeof e.model==`string`?e.model:iu} · in ${n.input_tokens??0} / out ${n.output_tokens??0} tokens`;t.push({kind:`assistant`,text:typeof e.text==`string`?e.text:``,meta:r})}else if(n.kind===`host.error`){let n=typeof e.error_kind==`string`?e.error_kind:`error`;t.push({kind:`error`,text:`${n}: ${typeof e.error==`string`?e.error:``}`})}}return t}function vu(){if(tu.value===null)return null;let e=_u(nu.value),t=nu.value.some(e=>e.kind===`host.turn`);return P(`section`,{class:`ac-workspace__thread`,"aria-label":`Conversation thread`,children:[P(`h2`,{class:`ac-workspace__heading`,children:`Conversation`}),e.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No turns yet.`}):P(`ol`,{class:`ac-workspace__thread-list`,children:e.map((e,t)=>{let n=e.kind===`assistant`&&e.text.length>au,r=ru.value.has(t),i=n&&!r?`${e.text.slice(0,au)}…`:e.text;return P(`li`,{class:`ac-workspace__thread-block ac-workspace__thread-block--${e.kind}`,children:[P(`span`,{class:`ac-workspace__thread-role`,children:e.kind===`task`?`Task`:e.kind===`user`?`You`:e.kind===`assistant`?`Host`:`Error`}),P(`pre`,{class:`ac-workspace__thread-text`,children:i}),n?P(`button`,{type:`button`,class:`ac-button`,onClick:()=>{let e=new Set(ru.value);e.has(t)?e.delete(t):e.add(t),ru.value=e},children:r?`Show less`:`Show full`}):null,e.meta==null?null:P(`p`,{class:`ac-workspace__turn-meta`,children:e.meta})]},t)})}),$l.value?P(`div`,{class:`ac-workspace__followup-gone`,role:`status`,children:[P(`p`,{children:`Host session expired.`}),eu.value===null?P(`p`,{children:`Pick a task above to start a new conversation.`}):P(`button`,{type:`button`,class:`ac-button ac-button--primary`,disabled:Yl.value,onClick:()=>{let e=eu.value;e!==null&&uu(e.role,e.task,e.inputs)},children:Yl.value?`Starting…`:`Start a new conversation`})]}):t?P(`form`,{class:`ac-workspace__followup`,onSubmit:e=>{e.preventDefault(),tu.value!==null&&du(tu.value,Zl.value)},children:[P(`label`,{class:`ac-workspace__field`,children:[P(`span`,{class:`ac-workspace__field-label`,children:`Follow up`}),P(`textarea`,{class:`ac-workspace__field-input`,placeholder:`Continue this conversation — e.g. make it shorter`,"aria-label":`Follow-up prompt`,value:Zl.value,onInput:e=>{Zl.value=e.target.value}})]}),P(`button`,{type:`submit`,class:`ac-button ac-button--primary`,disabled:Zl.value.trim()===``||Ql.value,children:Ql.value?`Continuing…`:`Send follow-up`})]}):null]})}function yu({role:e}){let t=ql.value.length>0?ql.value:e.first_tasks;return P(`section`,{class:`ac-workspace__tasks`,"aria-labelledby":`task-heading`,children:[P(`h2`,{id:`task-heading`,class:`ac-workspace__heading`,children:[`First tasks · `,e.display_name]}),t.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No tasks scaffolded yet for this role.`}):P(`ul`,{class:`ac-workspace__task-list`,children:t.map(t=>P(`li`,{class:`ac-workspace__task`,children:[P(`div`,{class:`ac-workspace__task-head`,children:[P(`span`,{class:`ac-workspace__task-name`,children:t.name}),P(`button`,{type:`button`,class:`ac-button ac-button--primary`,"aria-expanded":$.value===t.name,onClick:()=>{$.value=$.value===t.name?null:t.name,Jl.value={},Xl.value=null,tu.value=null,nu.value=[]},children:$.value===t.name?`Close`:`Start session`})]}),P(`p`,{class:`ac-workspace__task-intent`,children:t.intent}),t.prompt===``?null:P(`code`,{class:`ac-workspace__task-prompt`,children:[`prompts/`,t.prompt]}),$.value===t.name?P(gu,{role:e.slug,task:t}):null]},t.name))}),e.skills.length>0?P(`details`,{class:`ac-workspace__skills`,children:[P(`summary`,{children:[`Skill shortlist (`,e.skills.length,`)`]}),P(`ul`,{class:`ac-workspace__skill-list`,children:[e.skills.slice(0,5).map(e=>P(`li`,{class:`ac-workspace__skill`,children:[P(`code`,{children:e.id}),` — `,e.why]},e.id)),e.skills.length>5?P(`li`,{class:`ac-workspace__skill-more`,children:[`+ `,e.skills.length-5,` more`]}):null]})]}):null]})}function bu(){return P(`section`,{class:`ac-workspace__sessions`,"aria-labelledby":`sessions-heading`,children:[P(`h2`,{id:`sessions-heading`,class:`ac-workspace__heading`,children:`Recent sessions`}),Pl.value.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No sessions yet — pick a role and start one.`}):P(`ul`,{class:`ac-workspace__session-list`,children:Pl.value.map(e=>P(`li`,{class:`ac-workspace__session`,children:P(`button`,{type:`button`,class:`ac-workspace__session-open${tu.value===e.id?` ac-workspace__session-open--active`:``}`,"aria-label":`Open session ${e.task}`,"aria-current":tu.value===e.id?`true`:void 0,onClick:()=>{lu(e.id)},children:[P(`span`,{class:`ac-workspace__session-id`,children:e.id.slice(0,16)}),P(`span`,{class:`ac-workspace__session-role`,children:e.role}),P(`span`,{class:`ac-workspace__session-task`,children:e.task})]})},e.id))})]})}function xu(){return P(`section`,{class:`ac-workspace__knowledge`,"aria-labelledby":`knowledge-heading`,children:[P(`h2`,{id:`knowledge-heading`,class:`ac-workspace__heading`,children:`Knowledge sources`}),Fl.value.length===0?P(`p`,{class:`ac-workspace__empty`,children:[`No sources yet. Run `,P(`code`,{children:`/knowledge:ingest <path>`}),` to add documents.`]}):P(`ol`,{class:`ac-workspace__citation-list`,children:Fl.value.map((e,t)=>P(`li`,{class:`ac-workspace__citation`,children:[P(`span`,{class:`ac-workspace__citation-marker`,"aria-label":`Citation ${t+1}`,children:[`[`,t+1,`]`]}),P(`a`,{href:`file://${e.source}`,class:`ac-workspace__citation-source`,title:`Open source in OS default app`,children:e.source.split(`/`).pop()??e.source}),e.pinned?P(`span`,{class:`ac-workspace__citation-pin`,"aria-label":`pinned`,children:`★`}):null,P(`p`,{class:`ac-workspace__citation-excerpt`,children:[e.excerpt.slice(0,200),e.excerpt.length>200?`…`:``]})]},e.id))})]})}function Su(){return P(`section`,{class:`ac-workspace__recent`,"aria-labelledby":`recent-heading`,children:[P(`h2`,{id:`recent-heading`,class:`ac-workspace__heading`,children:`Recent documents`}),Il.value.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No documents yet. Saved drafts land here.`}):P(`ul`,{class:`ac-workspace__doc-list`,children:Il.value.map(e=>P(`li`,{class:`ac-workspace__doc`,children:[P(`span`,{class:`ac-workspace__doc-type`,"data-type":e.type,children:e.type}),P(`span`,{class:`ac-workspace__doc-title`,children:e.title}),P(`time`,{class:`ac-workspace__doc-time`,dateTime:e.updated_at,children:e.updated_at.slice(0,10)})]},`${e.type}/${e.slug}`))})]})}function Cu(){let e=Object.values(Vl.value).filter(e=>e.killed||e.consecutive_failures>0);return P(`section`,{class:`ac-workspace__drive-health`,"aria-labelledby":`drive-health-heading`,children:[P(`h2`,{id:`drive-health-heading`,class:`ac-workspace__heading`,children:`Host health`}),e.length===0?P(`p`,{class:`ac-workspace__empty`,children:`All hosts healthy.`}):P(`ul`,{class:`ac-workspace__health-list`,children:Object.entries(Vl.value).filter(([,e])=>e.killed||e.consecutive_failures>0).map(([e,t])=>{let n=t.killed?t.kill_reason===`manual`?`paused (manual)`:`paused — auto-recovering`:`degraded`;return P(`li`,{class:`ac-workspace__health`,"data-killed":t.killed?`true`:`false`,children:[P(`span`,{class:`ac-workspace__health-host`,children:e}),P(`span`,{class:`ac-workspace__health-state`,children:n}),P(`span`,{class:`ac-workspace__health-meta`,children:[t.consecutive_failures,` fail streak`,t.last_error_kind==null?``:` · ${t.last_error_kind}`]}),t.killed?P(`button`,{type:`button`,class:`ac-button ac-workspace__health-reset`,"aria-label":`Reset ${e}`,onClick:()=>{pu(e)},children:`Reset`}):null]},e)})})]})}function wu(){let e=Bl.value;return P(`fieldset`,{class:`ac-workspace__explain`,children:[P(`legend`,{class:`ac-workspace__heading`,children:`Explanation style`}),P(`label`,{class:`ac-workspace__explain-option`,children:[P(`input`,{type:`radio`,name:`explain-mode`,value:`plain`,checked:e===`plain`,onChange:()=>{Bl.value=`plain`},"aria-label":`Plain language`}),P(`span`,{children:`Plain language`})]}),P(`label`,{class:`ac-workspace__explain-option`,children:[P(`input`,{type:`radio`,name:`explain-mode`,value:`technical`,checked:e===`technical`,onChange:()=>{Bl.value=`technical`},"aria-label":`Technical detail`}),P(`span`,{children:`Technical detail`})]}),P(`p`,{class:`ac-workspace__explain-hint`,children:e===`plain`?`Replies use everyday words. Toggle to see the technical view.`:`Replies keep the technical vocabulary. Toggle for the plain view.`})]})}function Tu(){let e=Hl.value,t=e.length>0?e.map(e=>e.id):Object.keys(Ul),n=new Map(e.map(e=>[e.id,e.cli_present]));return P(`label`,{class:`ac-workspace__host-picker`,children:[P(`span`,{class:`ac-workspace__host-label`,children:`Host`}),P(`select`,{class:`ac-workspace__host-select`,"aria-label":`Host agent`,value:Gl.value,onChange:e=>{Kl(e.target.value)},children:t.map(e=>{let t=n.get(e)!==!1,r=Ul[e]??e;return P(`option`,{value:e,disabled:!t,children:[r,` (`,e,`)`,t?``:` — not installed`]},e)})})]})}function Eu(){if(D(()=>{ou()},[]),zl.value!==null)return P(`div`,{class:`ac-page ac-page--error`,children:[P(`h1`,{children:`Workspace`}),P(`p`,{class:`ac-banner ac-banner--error`,children:zl.value})]});if(!Rl.value)return P(`div`,{class:`ac-page`,children:[P(`h1`,{children:`Workspace`}),P(`p`,{children:`Loading…`})]});let e=Ll.value===null?null:Nl.value.find(e=>e.slug===Ll.value)??null;return P(`div`,{class:`ac-page ac-workspace`,children:[P(`header`,{class:`ac-page__header`,children:[P(`h1`,{children:`Workspace`}),P(`p`,{class:`ac-page__subtitle`,children:`Pick a role, pick a first task, run it.`}),P(Tu,{})]}),Q.value===null?null:P(`p`,{class:`ac-banner`,role:`status`,children:Q.value}),P(`div`,{class:`ac-workspace__grid`,children:[P(`section`,{class:`ac-workspace__roles`,"aria-labelledby":`roles-heading`,children:[P(`h2`,{id:`roles-heading`,class:`ac-workspace__heading`,children:`Roles`}),Nl.value.length===0?P(`p`,{class:`ac-workspace__empty`,children:`No roles installed.`}):P(`div`,{class:`ac-workspace__role-grid`,children:Nl.value.map(e=>P(hu,{role:e},e.slug))})]}),P(`main`,{class:`ac-workspace__main`,"aria-label":`Tasks and sessions`,children:[e===null?P(`p`,{class:`ac-workspace__empty`,children:`Pick a role on the left to see its first tasks.`}):P(yu,{role:e}),P(vu,{}),P(bu,{})]}),P(`aside`,{class:`ac-workspace__rail`,"aria-label":`Knowledge and documents`,children:[P(xu,{}),P(Su,{}),P(Cu,{}),P(wu,{})]})]})]})}var Du=`agent-config-theme`;function Ou(){return(typeof document<`u`?document.documentElement.getAttribute(`data-theme`):null)===`dark`?`dark`:`light`}var ku=A(Ou());function Au(){try{let e=localStorage.getItem(Du);return e===`light`||e===`dark`?e:null}catch{return null}}function ju(){if(typeof window>`u`)return null;try{let e=new URLSearchParams(window.location.search).get(`theme`);return e===`light`||e===`dark`?e:null}catch{return null}}function Mu(){return Au()===null&&ju()===null}function Nu(e){ku.value=e,document.documentElement.setAttribute(`data-theme`,e)}function Pu(){let e=ku.value===`dark`?`light`:`dark`;try{localStorage.setItem(Du,e)}catch{}Nu(e)}function Fu(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);typeof e.addEventListener==`function`&&e.addEventListener(`change`,()=>{Mu()&&Nu(e.matches?`dark`:`light`)})}function Iu(){return typeof window>`u`?!1:new URLSearchParams(window.location.search).get(`embed`)===`1`}var Lu=Iu(),Ru=[{id:`setup`,label:`Setup`,hashPath:`/setup`,matches:[`/setup`,`/wizard`]},{id:`settings`,label:`Settings`,hashPath:`/settings`,matches:[`/settings`]},{id:`project`,label:`Project`,hashPath:`/project`,matches:[`/project`]},{id:`workspace`,label:`Workspace`,hashPath:`/workspace`,matches:[`/workspace`]}];function zu(e){for(let t of Ru)for(let n of t.matches)if(e===n||e.startsWith(`${n}/`))return t.id;return null}function Bu(e){let t=Mt.value,n=zu(e);return Ru.filter(e=>e.id===`project`?t?.projectSurface===!0||n===`project`:e.id!==`workspace`||t?.devSurfaces===!0||n===`workspace`)}function Vu(){let e=Tt.value,t=zu(e);return P(`header`,{class:`ac-topnav`,children:P(`div`,{class:`ac-topnav__inner`,children:[P(`div`,{class:`ac-topnav__brand`,children:[P(`h1`,{class:`ac-topnav__title`,children:`@event4u/agent-config`}),P(`p`,{class:`ac-topnav__subtitle`,children:`Browser Wizard`})]}),P(`nav`,{class:`ac-topnav__tabs`,"aria-label":`Surfaces`,children:Bu(e).map(e=>P(`button`,{type:`button`,class:`ac-topnav__tab${t===e.id?` ac-topnav__tab--active`:``}`,"aria-current":t===e.id?`page`:void 0,onClick:()=>Et(e.hashPath),children:e.label},e.id))}),P(`button`,{type:`button`,class:`ac-topnav__theme`,"aria-label":ku.value===`dark`?`Switch to light theme`:`Switch to dark theme`,title:ku.value===`dark`?`Switch to light theme`:`Switch to dark theme`,onClick:()=>{Pu()},children:ku.value===`dark`?`☀`:`☾`})]})})}function Hu({path:e}){return P(`div`,{class:`ac-page ac-page--error`,children:[P(`h1`,{children:`Page not found`}),P(`p`,{children:[`Nothing routed to `,P(`code`,{children:e}),`. Try `,P(`a`,{href:`#/setup`,children:`Setup`}),`.`]})]})}function Uu(){let e=Mt.value;return e===null||e.dryRun!==!0?null:P(`div`,{class:`ac-dryrun-banner`,role:`status`,"aria-live":`polite`,children:[P(`strong`,{children:`DRY RUN`}),P(`span`,{children:` · no files will be written. Validation + rendering run normally; commits return a preview.`})]})}function Wu(e){return e===`/`||e===`/setup`||e.startsWith(`/setup/`)||e.startsWith(`/wizard`)?P(Cc,{path:e}):e===`/settings/changes`?P(Zc,{}):e===`/settings`||e.startsWith(`/settings/`)?P(Tl,{}):e===`/project`||e.startsWith(`/project/`)?P(Ml,{}):e===`/workspace`?P(Eu,{}):P(Hu,{path:e})}function Gu(){return D(()=>{Ot(),Tt.value===`/`&&Et(`/setup`),Nt()},[]),P(b,{children:[P(Uu,{}),Lu?null:P(Vu,{}),Wu(Tt.value)]})}var Ku=3e4,qu=18e5,Ju=null,Yu=!1;function Xu(e){if(!Yu&&(Yu=!0,typeof navigator<`u`&&typeof navigator.sendBeacon==`function`))try{navigator.sendBeacon(`/api/v1/shutdown?token=${encodeURIComponent(e)}`)}catch{}}function Zu(e){if(typeof window>`u`)return()=>{};let t=Date.now(),n=()=>{t=Date.now()},r=[`pointerdown`,`keydown`,`wheel`,`touchstart`];for(let e of r)window.addEventListener(e,n,{passive:!0});let i=()=>{document.hidden||n()};document.addEventListener(`visibilitychange`,i);let a=()=>{Ju!==null&&clearInterval(Ju),Ju=null;for(let e of r)window.removeEventListener(e,n);document.removeEventListener(`visibilitychange`,i),window.removeEventListener(`pagehide`,o)};Ju=setInterval(()=>{if(!document.hidden){if(Date.now()-t>qu){Xu(e),a();return}M(`/api/v1/ping`).catch(()=>{})}},Ku);function o(){Xu(e)}return window.addEventListener(`pagehide`,o),a}function Qu(){if(typeof window>`u`||typeof window.history?.replaceState!=`function`)return;let e=new URLSearchParams(window.location.search);if(!e.has(`token`))return;e.delete(`token`);let t=e.toString(),n=window.location.pathname+(t?`?${t}`:``)+window.location.hash;window.history.replaceState(window.history.state,``,n)}function $u(){return new URLSearchParams(window.location.search).get(`token`)}function ed(){let e=document.getElementById(`app`);if(e===null)return;let t=$u();if(t===null){e.textContent="agent-config UI · missing token — re-open via `agent-config ui:serve`.";return}At(t),Qu(),Zu(t),Fu(),e.textContent=``,be(P(Gu,{}),e)}ed();
|
|
23
|
+
//# sourceMappingURL=index-C3djEJah.js.map
|
package/dist/ui/index.html
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
document.documentElement.setAttribute('data-theme', theme);
|
|
28
28
|
})();
|
|
29
29
|
</script>
|
|
30
|
-
<script type="module" crossorigin src="/assets/index-
|
|
30
|
+
<script type="module" crossorigin src="/assets/index-C3djEJah.js"></script>
|
|
31
31
|
<link rel="stylesheet" crossorigin href="/assets/index-Cyjy8bWO.css">
|
|
32
32
|
</head>
|
|
33
33
|
<body>
|
package/docs/MIGRATION.md
CHANGED
|
@@ -18,7 +18,7 @@ releaser here on every `release:major`.
|
|
|
18
18
|
|---|---|---|---|---|
|
|
19
19
|
| Free-text `compatibility` skill-frontmatter field (`src/scripts/schemas/skill.schema.json`) | 2026-08-14 | shipped 2026-08-14 — `deprecated: true` + superseded-by note in the schema; `harness_compat` lands beside it, additively | next major after the notice — **not pinned here** (removal date is maintainer-owned, same stance as the manifest `tier` entry, whose `sunset` shipped `null`) | The public Agent-Skills spec makes `compatibility` load-bearing for cross-host portability, or an external consumer is found reading it. `harness_compat` is package-local; `compatibility` mirrors the public spec, so keeping the mirror stays cheaply reversible. Superseded by `harness_compat` (class) + `runtime_requires` (probeable detail); both users (`docx-authoring`, `pdf-tools`) already carry both fields, so nothing breaks on removal day. |
|
|
20
20
|
| `code_graph` native code-graph engine (`code_graph.enabled`, the `code-intelligence` skill's native arm, `code_graph_nudge_hook`) | 2026-07-28 | next major after 9.x | **REVISED 2026-08-15 — no removal date; see below** | A consumer case the graph answers and disciplined grep cannot. Measured null: recall 0.365 vs grep 0.797 (`docs/CLAIMS.md` `code-graph-retrieval-null`), measured 2026-07-28 against a build predating the 2026-08-22 extractor repair. `enabled: false` stays the DEFAULT — "permanent" is retracted here on 2026-08-26, because this row's own revision below withdraws the removal commitment and a withdrawn schedule cannot leave a permanence behind it. **Revision (ADR-232 track, maintainer decision 2026-08-15).** The original row committed removal to 11.0; the tree reached 12.0.0 with the runtime paths still registered, i.e. the commitment was missed. Rather than quietly re-dating it, the commitment is withdrawn with its reason recorded, because the measurement changed what removal is worth: **the payload this deprecation existed for has already shipped** — the parser pair (`web-tree-sitter@0.24.7` / `tree-sitter-wasms@0.1.13`, ~51 MB unpacked) moved from `dependencies` to `devDependencies` ahead of schedule, so no consumer installed it. **REVERSED 2026-09-07 by ADR-259 (as amended) — this clause no longer holds and is kept only so the reversal is legible.** Delivery and measurement are decoupled: `web-tree-sitter` is a runtime `dependency` again and the three loadable grammars are vendored at `src/vendor/grammars/`, so a consumer now DOES install the engine. The measured null above is untouched and `enabled: false` stays the default — what changed is that the reopen trigger ("a consumer case the graph answers") became reachable at all, which it was not while no consumer could receive the engine. The install delta is recorded below under "14.21.x — the code-graph engine ships to consumers". What source removal would still free is ~112 K against a 27 M tree (0.4 %). Against that it costs a breaking change across four consumer-visible surfaces (CLI verb, `code-intelligence` skill, `external-code-graph-interop` rule, `hooks.code_graph.enabled`) plus one surface that is re-plumbing rather than deletion: `_lib/auto_dispatch.ts` routes the `definition` / `references` lookup classes to `primitive: 'code-graph-query'`, and `_lib/judgment_ladder.ts` calls that live at Rung 0. There is also no cheap middle — `code_graph/detect.ts` handles the `consumer` / `scip` / `native` source kinds in one type union, so stripping only the native engine while keeping consumer-index interop is a redesign. **New commitment:** the surfaces stay registered and disabled; removal happens when a concrete reason appears (a maintenance cost that bites, a conflicting redesign, or a consumer asking), not on a date. This row stays in the table so the decision is visible rather than forgotten — a withdrawn commitment recorded is not the folklore this table exists to prevent; an unrecorded one would be. |
|
|
21
|
-
| `telegraph-speak` condenser (`
|
|
21
|
+
| `telegraph-speak` condenser (`src/rules/telegraph-speak.md`, `src/scripts/_lib/compile_time_toggles.ts`, `src/scripts/validate_telegraph_carveouts.ts`; the `telegraph.speak` key was retired 2026-10-09) | 2026-07-29 | shipped 2026-07-29 — dormant by default, `speak` defaulted `false`; since 2026-10-09 the predicate is a fixed `false` | **not pinned here** — removal is authorized in principle and deliberately not executed (ADR `telegraph/0002` § Decision part 3), pending a `prose_only` bench (~$0.80). The date is maintainer-owned, same stance as the `compatibility` row above | An output-side bench clears the kill-criterion bar, at which point flipping the `telegraph-speak` predicate in `compile_time_toggles.ts` restores the feature intact (a package-level change — the per-install `telegraph.speak` key was retired on 2026-10-09). Measured basis for dormancy: median vs_terse **−9.27 %** (API) / −5.47 % (exact `cl100k_base`) — the condenser emits MORE than a plain "be terse". Tracked as a row rather than left dormant-and-unlisted: dormancy without a row is untracked in *both* directions, neither scheduled nor recorded as a keep. Deliberately NOT a due version (that would invent a commitment ADR 0002 declined to make) and NOT a permanent keep (that would contradict its authorized removal). |
|
|
22
22
|
|
|
23
23
|
### Row status — what is currently late, and who owns it
|
|
24
24
|
|
|
@@ -42,6 +42,77 @@ reason, which no arithmetic can.
|
|
|
42
42
|
or that promises a future breaking removal, gets a row here in the same commit
|
|
43
43
|
that makes the promise. A promise with no row is not tracked and will be missed.
|
|
44
44
|
|
|
45
|
+
## 16.2.0 — `doctor --json` reads the forge, and `--no-forge` opts out
|
|
46
|
+
|
|
47
|
+
💡 advisory · ✋ manual only if you scripted `doctor` as an offline diagnostic.
|
|
48
|
+
|
|
49
|
+
### What changed
|
|
50
|
+
|
|
51
|
+
Since 16.2.0, `agent-config doctor --json` fills its `forge_protection` block
|
|
52
|
+
from a **network read**: one `git ls-remote --get-url origin` (local) and then
|
|
53
|
+
several `gh api` calls against the repository's forge, under a 15 s budget. Any
|
|
54
|
+
failure — no GitHub remote, no `gh`, no credentials, a timeout — degrades to
|
|
55
|
+
five `unread` rows rather than an error. This reverses the earlier "`doctor`
|
|
56
|
+
does not reach the network" boundary; the supersession is recorded in
|
|
57
|
+
`road-to-adversarial-verification-and-long-runs` Phase 3.2. It shipped without
|
|
58
|
+
an entry here; this section is that entry, written after the fact.
|
|
59
|
+
|
|
60
|
+
### How to keep it offline
|
|
61
|
+
|
|
62
|
+
- **`--no-forge`** (alias **`--offline`**) — skips the read before anything
|
|
63
|
+
spawns. The block keeps its shape: five `unread` rows, `repository: null`.
|
|
64
|
+
- **`--check <id>`** — skips the read too, since no check id reads the block.
|
|
65
|
+
- **`AGENT_CONFIG_DOCTOR_NO_FORGE=1`** or **`AGENT_CONFIG_OFFLINE=1`** — the
|
|
66
|
+
environment switches that existed before the flag; both are read as the
|
|
67
|
+
literal `1` only.
|
|
68
|
+
|
|
69
|
+
## 16.4.0 — the default reverses: `doctor` is offline, `--online` opts in
|
|
70
|
+
|
|
71
|
+
⚠️ behavioural · ✋ manual if you relied on `doctor --json` filling
|
|
72
|
+
`forge_protection` without passing a flag.
|
|
73
|
+
|
|
74
|
+
### What changed
|
|
75
|
+
|
|
76
|
+
`agent-config doctor` no longer reaches the network by default. The
|
|
77
|
+
`forge_protection` block is filled only when **`--online`** is passed; without
|
|
78
|
+
it the block keeps the shape a failed read produces — five `unread` rows,
|
|
79
|
+
`repository: null` — and nothing spawns.
|
|
80
|
+
|
|
81
|
+
The reasoning, recorded in blocker `doctor-network-default` of
|
|
82
|
+
`road-to-findings-that-get-a-disposition` (AI council 2026-10-07, anthropic +
|
|
83
|
+
openai, 2/2; adopted 2026-10-08): a health command that reaches the network on
|
|
84
|
+
every run, including a single-check run, is the surprising default, and
|
|
85
|
+
`--online` costs one word to anyone who wants the read.
|
|
86
|
+
|
|
87
|
+
### What you have to do
|
|
88
|
+
|
|
89
|
+
- **Scripted `doctor --json` and read `forge_protection` rows?** Add
|
|
90
|
+
**`--online`**. Nothing else changes.
|
|
91
|
+
- **Scripted it as an offline diagnostic?** Nothing to do — and you may now
|
|
92
|
+
drop `--no-forge` / `--offline` if you only ever passed it for that reason.
|
|
93
|
+
Both still work and are still the more specific instruction: they beat
|
|
94
|
+
`--online` when both are given.
|
|
95
|
+
|
|
96
|
+
### How to tell the two apart in the output
|
|
97
|
+
|
|
98
|
+
The block gained a **`not_checked`** key, present on every run, so a consumer
|
|
99
|
+
can distinguish *nobody asked* from *asked and it failed*. Five `unread` rows
|
|
100
|
+
and no failures otherwise reads as a clean bill of health to anything summing
|
|
101
|
+
row states, which is the misreading this key exists to prevent.
|
|
102
|
+
|
|
103
|
+
| value | meaning |
|
|
104
|
+
|---|---|
|
|
105
|
+
| `null` | the read happened — the rows are a real measurement |
|
|
106
|
+
| `"online_not_requested"` | the new default; pass `--online` to read |
|
|
107
|
+
| `"offline_flag"` | `--no-forge` / `--offline` was passed |
|
|
108
|
+
| `"single_check"` | a `--check <id>` run; no check id reads this block |
|
|
109
|
+
|
|
110
|
+
`read_from_forge` keeps its meaning and is unchanged.
|
|
111
|
+
|
|
112
|
+
The flag is additive: a run that passes none of these reads the forge exactly
|
|
113
|
+
as before. Whether offline becomes the default is an open owner decision
|
|
114
|
+
(`road-to-findings-that-get-a-disposition`, blocker `doctor-network-default`).
|
|
115
|
+
|
|
45
116
|
## 16.0.0 — the stored standing-payload ceiling is deleted
|
|
46
117
|
|
|
47
118
|
💡 advisory · 🔄 automatic — **no consumer action.**
|