@zaip-ai/cli 2.2.0 → 2.6.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/dist/services/adapters.d.ts +1 -1
- package/dist/services/adapters.d.ts.map +1 -1
- package/dist/services/adapters.js +23 -9
- package/dist/services/adapters.js.map +1 -1
- package/dist/services/agent-adapters.js +25 -9
- package/dist/services/agent-adapters.js.map +1 -1
- package/dist/services/agent-discovery.d.ts +27 -0
- package/dist/services/agent-discovery.d.ts.map +1 -0
- package/dist/services/agent-discovery.js +73 -0
- package/dist/services/agent-discovery.js.map +1 -0
- package/dist/services/codex-conversation-lifecycle-hook.d.ts.map +1 -1
- package/dist/services/codex-conversation-lifecycle-hook.js +153 -24
- package/dist/services/codex-conversation-lifecycle-hook.js.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.d.ts.map +1 -1
- package/dist/services/codex-pre-tool-hook-template.js +146 -72
- package/dist/services/codex-pre-tool-hook-template.js.map +1 -1
- package/dist/services/codex-rules.d.ts +1 -1
- package/dist/services/codex-rules.d.ts.map +1 -1
- package/dist/services/codex-rules.js +3 -3
- package/dist/services/codex-subagent-hook-template.d.ts +1 -1
- package/dist/services/codex-subagent-hook-template.d.ts.map +1 -1
- package/dist/services/codex-subagent-hook-template.js +117 -66
- package/dist/services/codex-subagent-hook-template.js.map +1 -1
- package/dist/services/install-agents-template.d.ts.map +1 -1
- package/dist/services/install-agents-template.js +56 -6
- package/dist/services/install-agents-template.js.map +1 -1
- package/dist/services/logger.js +1 -1
- package/dist/services/logger.js.map +1 -1
- package/dist/services/logger.test.js +22 -1
- package/dist/services/logger.test.js.map +1 -1
- package/dist/services/runtime-template.test.js +129 -0
- package/dist/services/runtime-template.test.js.map +1 -1
- package/package.json +1 -1
- package/templates/.agents/.env.example +9 -3
- package/templates/.agents/README-ENG.md +30 -5
- package/templates/.agents/README.md +30 -7
- package/templates/.agents/architecture/software-architecture.md +1 -59
- package/templates/.agents/branding/brandbook.md +3 -0
- package/templates/.agents/config/agents/catalog.yaml +22 -10
- package/templates/.agents/config/agents/discovery.json +319 -0
- package/templates/.agents/config/clients/codex/agents/zaip-agent-backend.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-builder.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-cloud-engineer.toml +11 -8
- package/templates/.agents/config/clients/codex/agents/zaip-agent-designer.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-frontend.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-task-executor.toml +2 -2
- package/templates/.agents/config/clients/codex/agents/zaip-agent-website-developer.toml +2 -2
- package/templates/.agents/config/pricing/models.json +9 -5
- package/templates/.agents/config/project.yaml +12 -1
- package/templates/.agents/dashboard/.zaip-managed.json +375 -95
- package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-CGxeQak4.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{DashboardHelpDialog-DaSllaJp.js → DashboardHelpDialog-tzS7YxYB.js} +57 -33
- package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-DEbCi1gP.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-1L7Qw-Gq.js +3 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-EInWr641.css +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-t1Om0Abw.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-B6aZfo5f.js +68 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{icons-vendor-TPUT2IUt.js → icons-vendor-DiGC-dsJ.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-DgTmNHN5.js +2 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/{react-vendor-Ct48XHGL.js → react-vendor-kPO6yNed.js} +1 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/rolldown-runtime-Bh1tDfsg.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-DQpKX9c1.js +1 -0
- package/templates/.agents/dashboard/apps/frontend/dist/index.html +6 -6
- package/templates/.agents/dashboard/apps/frontend/package.json +1 -1
- package/templates/.agents/dashboard/apps/frontend/src/App.tsx +3 -1264
- package/templates/.agents/dashboard/apps/frontend/src/AppDashboardContent.tsx +363 -0
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.dom.test.ts +99 -0
- package/templates/.agents/dashboard/apps/frontend/src/ProjectSettingsPage.tsx +62 -6
- package/templates/.agents/dashboard/apps/frontend/src/ProjectStackEditor.tsx +3 -1
- package/templates/.agents/dashboard/apps/frontend/src/__tests__/app-composition-support.ts +7 -0
- package/templates/.agents/dashboard/apps/frontend/src/cost-period-refresh.test.ts +9 -7
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api-settings.ts +151 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-api.ts +28 -153
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-app-shell.tsx +33 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-cost-facts.ts +30 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-project-overview.ts +7 -1
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-retry.ts +17 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-setup-route.ts +29 -0
- package/templates/.agents/dashboard/apps/frontend/src/dashboard-view-actions.ts +66 -0
- package/templates/.agents/dashboard/apps/frontend/src/operations-period-render.test.ts +3 -2
- package/templates/.agents/dashboard/apps/frontend/src/overview-status-page.test.ts +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/project-installation-status.test.ts +48 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-installation-status.ts +29 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-settings-page.css +68 -0
- package/templates/.agents/dashboard/apps/frontend/src/project-settings.test.ts +2 -2
- package/templates/.agents/dashboard/apps/frontend/src/sao-paulo-day-rollover.test.ts +36 -0
- package/templates/.agents/dashboard/apps/frontend/src/sao-paulo-day-rollover.ts +30 -0
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-banner-semantics.test.ts +2 -5
- package/templates/.agents/dashboard/apps/frontend/src/snapshot-coherence.test.ts +30 -19
- package/templates/.agents/dashboard/apps/frontend/src/use-app-effects.ts +9 -1
- package/templates/.agents/dashboard/apps/frontend/src/use-app-trace-task-pagination.ts +77 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-app-work-board.ts +397 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-dashboard-app-model.tsx +782 -0
- package/templates/.agents/dashboard/apps/frontend/src/use-snapshot-notice.tsx +49 -0
- package/templates/.agents/dashboard/modules/cost-monitor/package.json +1 -1
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostDeveloperPanelSlot.tsx +16 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostGroupsTable.tsx +459 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.test.ts +27 -17
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorPage.tsx +62 -186
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostMonitorRunDialog.tsx +20 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables-hides-calls-that-have-no-collected.test.ts +80 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables-keeps-legacy-codex-identity-fields-blank.test.ts +455 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.test.ts +18 -525
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/CostTables.tsx +32 -508
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-export-sources.ts +74 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-actions.ts +19 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-monitor-page-selectors.ts +49 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/react/cost-table-formatters.ts +115 -0
- package/templates/.agents/dashboard/modules/cost-monitor/src/server/build-cost-monitor-projection.test-fixtures.ts +2 -0
- package/templates/.agents/dashboard/modules/operations/package.json +1 -1
- package/templates/.agents/dashboard/modules/operations/src/contracts.ts +4 -0
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTableBadges.tsx +34 -0
- package/templates/.agents/dashboard/modules/operations/src/react/EntityTables.tsx +8 -38
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview-keeps-structure-classes-mutually-exclusive.test.ts +243 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.test.ts +27 -275
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverview.tsx +70 -247
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewCharts.tsx +171 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsOverviewPanels.tsx +64 -0
- package/templates/.agents/dashboard/modules/operations/src/react/OperationsPage.tsx +4 -3
- package/templates/.agents/dashboard/modules/operations/src/react/PrdDocumentDialog.test.tsx +2 -1
- package/templates/.agents/dashboard/modules/operations/src/react/manual-work-priority.test.ts +2 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-coverage-toast.test.ts +6 -2
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview-period-filter.test.ts +6 -14
- package/templates/.agents/dashboard/modules/operations/src/react/operations-overview.status-cards.test.ts +3 -1
- package/templates/.agents/dashboard/modules/operations/src/react/operations-page-contract.ts +2 -0
- package/templates/.agents/dashboard/modules/operations/src/react/overview-metric-format.ts +32 -0
- package/templates/.agents/dashboard/modules/traceability/package.json +1 -1
- package/templates/.agents/dashboard/packages/branding/package.json +1 -1
- package/templates/.agents/dashboard/packages/branding/src/index.ts +1 -1
- package/templates/.agents/dashboard/packages/contracts/package.json +1 -1
- package/templates/.agents/dashboard/packages/data-export/package.json +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/dist/server.cjs +1458 -1458
- package/templates/.agents/dashboard/packages/local-runtime/dist/sqlite-read-model.cjs +1425 -1425
- package/templates/.agents/dashboard/packages/local-runtime/package.json +2 -1
- package/templates/.agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs +7 -3
- package/templates/.agents/dashboard/packages/local-runtime/server.mjs +1458 -1459
- package/templates/.agents/dashboard/packages/local-runtime/src/active-codex-telemetry.ts +25 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/agent-catalog-settings.test.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.test.ts +53 -8
- package/templates/.agents/dashboard/packages/local-runtime/src/project-settings.ts +79 -24
- package/templates/.agents/dashboard/packages/local-runtime/src/projection-refresh-diagnostics.ts +35 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-costs-routes.ts +168 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-dual-reads-manifest-summaries-without-losing.test.ts +344 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-http-contracts.ts +31 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-operations-routes.ts +345 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-read-projections.ts +461 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-reconciliation-refresh.test.ts +78 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-route-context.ts +13 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.test.ts +18 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot-synchronization.ts +19 -3
- package/templates/.agents/dashboard/packages/local-runtime/src/server-snapshot.test.ts +22 -21
- package/templates/.agents/dashboard/packages/local-runtime/src/server-sqlite-view-allowlist.test.ts +25 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-trace-routes.ts +64 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.test.ts +2 -30
- package/templates/.agents/dashboard/packages/local-runtime/src/server-work-reconciliation.ts +6 -23
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test-fixtures.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/server.test.ts +2 -330
- package/templates/.agents/dashboard/packages/local-runtime/src/server.ts +73 -1060
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-first-fold.ts +78 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-projections.ts +561 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-materialize-runs.ts +600 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-metric-contract.test.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-agent-dimension.ts +269 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-context.ts +32 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-entity-group.ts +244 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-filtered-dimension.ts +292 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-financial.ts +547 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-model-dimension.ts +360 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-provider-dimension.ts +169 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-summary.ts +475 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-temporal-dimension.ts +132 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-timing.ts +299 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-query-view-page.ts +692 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-counts-every-root-execution-day-returns.test.ts +739 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-does-not-convert-delayed-historical-finalizer.test.ts +706 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-filesystem.ts +748 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-first-fold-types.ts +1 -1
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-keeps-orphan-telemetry-out-kanban-without.test.ts +710 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-marks-token-cost-telemetry-unavailable-when.test.ts +618 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuild.ts +755 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-rebuilds-disposable-snapshot-serves-zaip-records.test.ts +276 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-schema.ts +193 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model-types.ts +123 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.test.ts +1 -2805
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-read-model.ts +17 -6930
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-base-views.ts +385 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/sqlite-schema-dashboard-views.ts +412 -0
- package/templates/.agents/dashboard/packages/local-runtime/src/work-priority-contract.test.ts +4 -3
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-build.mjs +195 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-lifecycle.test.mjs +2 -7
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-logging.mjs +35 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-navigation.mjs +114 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard-paths.mjs +90 -0
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.mjs +89 -418
- package/templates/.agents/dashboard/packages/local-runtime/start-dashboard.test.mjs +22 -12
- package/templates/.agents/dashboard/packages/ui/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/package.json +1 -1
- package/templates/.agents/dashboard/tests/e2e/playwright.config.ts +4 -1
- package/templates/.agents/design/.zaip-managed.json +5 -5
- package/templates/.agents/design/DESIGN.md +2 -186
- package/templates/.agents/design/README.md +12 -2
- package/templates/.agents/design/apps/catalog/package.json +1 -1
- package/templates/.agents/design/packages/local-runtime/package.json +1 -1
- package/templates/.agents/growth/strategy.md +3 -0
- package/templates/.agents/marketing/strategy.md +3 -0
- package/templates/.agents/requirements/autonomous-assurance.md +2 -1
- package/templates/.agents/requirements/cloud-hostinger-autonomy.md +1 -1
- package/templates/.agents/requirements/comparative-audit.md +1 -1
- package/templates/.agents/requirements/context-engine.md +1 -1
- package/templates/.agents/requirements/cost-observability.md +1 -1
- package/templates/.agents/requirements/dashboard-launch.md +1 -1
- package/templates/.agents/requirements/data-export.md +1 -1
- package/templates/.agents/requirements/design-system.md +13 -4
- package/templates/.agents/requirements/execution-engine.md +1 -1
- package/templates/.agents/requirements/kanban-dashboard.md +1 -1
- package/templates/.agents/requirements/model-orchestration.md +1 -1
- package/templates/.agents/requirements/public-distribution.md +4 -2
- package/templates/.agents/requirements/software-architecture.md +1 -1
- package/templates/.agents/requirements/strategic-improvements.md +1 -1
- package/templates/.agents/requirements/work-lifecycle.md +3 -3
- package/templates/.agents/requirements/zaip-strategic-95.md +1 -1
- package/templates/.agents/rules/architecture.md +2 -0
- package/templates/.agents/rules/astra-diagnostic.md +1 -1
- package/templates/.agents/rules/autonomy-decision.md +3 -1
- package/templates/.agents/rules/cloud-hostinger-autonomy.md +2 -0
- package/templates/.agents/rules/context.md +2 -1
- package/templates/.agents/rules/core.md +3 -3
- package/templates/.agents/rules/design-system-central-contract.md +17 -0
- package/templates/.agents/rules/evolution.md +3 -1
- package/templates/.agents/rules/frontend-lite.md +3 -1
- package/templates/.agents/rules/local-sqlite-storage.md +2 -2
- package/templates/.agents/rules/meta-mcp.md +3 -1
- package/templates/.agents/rules/model-orchestration.md +1 -1
- package/templates/.agents/rules/run-lifecycle-closure.md +6 -4
- package/templates/.agents/rules/security.md +3 -1
- package/templates/.agents/rules/specialist-routing.md +3 -1
- package/templates/.agents/rules/text-writing-utf8.md +1 -1
- package/templates/.agents/rules/workflow.md +7 -5
- package/templates/.agents/runtime/VERSION +1 -1
- package/templates/.agents/runtime/bin/zaip.mjs +519 -247
- package/templates/.agents/runtime/checksums.sha256 +6 -6
- package/templates/.agents/runtime/manifest.json +1 -1
- package/templates/.agents/runtime/pnpm-lock.sha256 +1 -1
- package/templates/.agents/runtime/provenance.json +5 -5
- package/templates/.agents/runtime/sbom.cdx.json +1 -1
- package/templates/.agents/sales/playbook.md +3 -0
- package/templates/.agents/skills/zaip-aios/SKILL.md +5 -3
- package/templates/.agents/skills/zaip-skill-adapt-stack/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-api-contracts/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-api-contracts/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-application-observability/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-application-observability/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-application-observability/references/signal-design.md +3 -0
- package/templates/.agents/skills/zaip-skill-application-readiness/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-application-readiness/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-application-readiness/references/evidence-matrix.md +3 -0
- package/templates/.agents/skills/zaip-skill-architecture-design/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-architecture-design/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-async-jobs/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-async-jobs/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/references/data-access-paths.md +9 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/references/worker-scenario.md +5 -0
- package/templates/.agents/skills/zaip-skill-auth-tenancy/scripts/worker-contract.test.mjs +27 -0
- package/templates/.agents/skills/zaip-skill-author-skills/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-author-skills/references/engineering-skill-index.md +9 -0
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/audit-skill-catalog.mjs +5 -3
- package/templates/.agents/skills/zaip-skill-author-skills/scripts/author-skill-scripts.test.mjs +27 -0
- package/templates/.agents/skills/zaip-skill-backend/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-backend/references/deployment-environments.md +75 -0
- package/templates/.agents/skills/zaip-skill-backend/references/supabase-migration-contract.md +23 -0
- package/templates/.agents/skills/zaip-skill-brand-governance/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-cache-strategy/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-cache-strategy/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-change/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-cloud-engineering/SKILL.md +7 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/SKILL.md +37 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/agents/openai.yaml +6 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/references/workers-static-assets.md +26 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/references/workflow-templates.md +71 -0
- package/templates/.agents/skills/zaip-skill-cloudflare-github-deploy/scripts/cloudflare-github-deploy-contract.test.mjs +77 -0
- package/templates/.agents/skills/zaip-skill-config/SKILL.md +21 -11
- package/templates/.agents/skills/zaip-skill-config/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-container-runtime/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-container-runtime/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-context/SKILL.md +6 -1
- package/templates/.agents/skills/zaip-skill-context/references/prd-spec-task-handoff.md +10 -0
- package/templates/.agents/skills/zaip-skill-context/references/rule-selection.md +20 -0
- package/templates/.agents/skills/zaip-skill-cqrs/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/SKILL.md +18 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/references/audit-contract.md +94 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/scripts/score-audit.mjs +185 -0
- package/templates/.agents/skills/zaip-skill-cybersecurity/scripts/score-audit.test.mjs +101 -0
- package/templates/.agents/skills/zaip-skill-data-modeling/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-data-modeling/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/SKILL.md +20 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/references/manual-mode.md +15 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/references/promotion-example.md +5 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/scripts/export-manual-sql.mjs +145 -0
- package/templates/.agents/skills/zaip-skill-database-migrations/scripts/export-manual-sql.test.mjs +178 -0
- package/templates/.agents/skills/zaip-skill-dependency-upgrade/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-dependency-upgrade/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-deployment-pipeline/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-deployment-pipeline/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-deployment-pipeline/references/runtime-shapes.md +3 -0
- package/templates/.agents/skills/zaip-skill-design-system/SKILL.md +20 -9
- package/templates/.agents/skills/zaip-skill-dev-environment/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-dev-environment/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-dev-environment/references/inventory-contract.md +7 -0
- package/templates/.agents/skills/zaip-skill-dev-environment/scripts/inventory.mjs +77 -0
- package/templates/.agents/skills/zaip-skill-disaster-recovery/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-disaster-recovery/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-disaster-recovery/references/recovery-scope.md +3 -0
- package/templates/.agents/skills/zaip-skill-execution/SKILL.md +3 -3
- package/templates/.agents/skills/zaip-skill-execution/references/correction-cycle.md +7 -0
- package/templates/.agents/skills/zaip-skill-execution/references/runtime-governance.md +1 -5
- package/templates/.agents/skills/zaip-skill-external-integrations/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-external-integrations/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-frontend/SKILL.md +4 -0
- package/templates/.agents/skills/zaip-skill-frontend-componentization/SKILL.md +44 -0
- package/templates/.agents/skills/zaip-skill-frontend-componentization/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-frontend-data-flows/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-frontend-data-flows/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-general-operations/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/SKILL.md +36 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/cloudflare-pages.md +33 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/github.md +63 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/hostinger-vps.md +55 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/references/npm.md +30 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/check-skill.mjs +55 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/verify-cloudflare.mjs +61 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/verify-cloudflare.test.mjs +128 -0
- package/templates/.agents/skills/zaip-skill-github-actions-setup/scripts/verify-ssh.integration.test.mjs +106 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/SKILL.md +43 -76
- package/templates/.agents/skills/zaip-skill-github-deploy/references/deployment-workflow.md +131 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/github-release-workflow-template.md +31 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-gate-matrix.md +24 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-identity.md +44 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/references/release-notes.md +134 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/consumer-release-preparation.mjs +389 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/consumer-release-preparation.test.mjs +134 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-deploy-contract.test.mjs +25 -2
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-readiness-api.test.mjs +134 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-readiness.mjs +98 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/github-readiness.test.mjs +25 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/install-github-readiness-workflow.mjs +159 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/install-github-readiness-workflow.test.mjs +160 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.mjs +149 -12
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/preflight.test.mjs +64 -5
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/release-notes-coverage.test.mjs +126 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/resolve-release-identity.mjs +78 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/resolve-release-identity.test.mjs +51 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/validate-release-notes.mjs +184 -0
- package/templates/.agents/skills/zaip-skill-github-deploy/scripts/validate-release-notes.test.mjs +109 -0
- package/templates/.agents/skills/zaip-skill-growth-strategy-revops/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/SKILL.md +18 -10
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/agents/openai.yaml +3 -4
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/aws-cli-terraform.md +62 -0
- package/templates/.agents/skills/zaip-skill-hostinger-cloudflare-terraform/references/guia-iniciante-hostinger-vps.md +183 -0
- package/templates/.agents/skills/zaip-skill-marketing/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/references/scaffold-contract.md +9 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/scripts/helpers.test.mjs +121 -0
- package/templates/.agents/skills/zaip-skill-module-scaffold/scripts/scaffold.mjs +169 -0
- package/templates/.agents/skills/zaip-skill-move-prd/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-move-spec/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-performance-engineering/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-performance-engineering/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-prd/SKILL.md +1 -1
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-local-telemetry.mjs +1 -0
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.mjs +26 -9
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-lib.test.mjs +39 -13
- package/templates/.agents/skills/zaip-skill-reconcile-telemetry/scripts/reconcile-telemetry-remeasurement.mjs +1 -0
- package/templates/.agents/skills/zaip-skill-refactor-landing-page/SKILL.md +66 -0
- package/templates/.agents/skills/zaip-skill-refactor-landing-page/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-refactor-landing-page/references/behavioral-dry-run.md +23 -0
- package/templates/.agents/skills/zaip-skill-release-qualification/SKILL.md +40 -1
- package/templates/.agents/skills/zaip-skill-release-qualification/references/local-preparation.md +98 -0
- package/templates/.agents/skills/zaip-skill-review/SKILL.md +1 -0
- package/templates/.agents/skills/zaip-skill-rules/SKILL.md +3 -3
- package/templates/.agents/skills/zaip-skill-sales-methodology/SKILL.md +2 -0
- package/templates/.agents/skills/zaip-skill-setup/SKILL.md +19 -21
- package/templates/.agents/skills/zaip-skill-setup/agents/openai.yaml +2 -2
- package/templates/.agents/skills/zaip-skill-spec/SKILL.md +3 -2
- package/templates/.agents/skills/zaip-skill-storage-uploads/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-storage-uploads/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-systematic-debugging/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-systematic-debugging/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-task/SKILL.md +16 -7
- package/templates/.agents/skills/zaip-skill-task/references/commit-policy.md +25 -0
- package/templates/.agents/skills/zaip-skill-test-data/SKILL.md +14 -0
- package/templates/.agents/skills/zaip-skill-test-data/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-test-data/scripts/generate.mjs +72 -0
- package/templates/.agents/skills/zaip-skill-testing-strategy/SKILL.md +15 -0
- package/templates/.agents/skills/zaip-skill-testing-strategy/agents/openai.yaml +4 -0
- package/templates/.agents/skills/zaip-skill-testing-strategy/references/example-map.md +3 -0
- package/templates/.agents/skills/zaip-skill-website-readiness/SKILL.md +8 -0
- package/templates/.agents/zaip-aios/VERSION +1 -1
- package/templates/.agents/zaip-aios/guides/10-seguranca.md +2 -1
- package/templates/.agents/zaip-aios/guides/20-instalacao-detalhada.md +5 -3
- package/templates/scripts/validate-cloud-hostinger-contract.mjs +34 -0
- package/templates/template-manifest.json +955 -211
- package/templates/.agents/branding/.gitkeep +0 -0
- package/templates/.agents/dashboard/apps/frontend/dist/assets/CostCalculationGuidePage-snUCQYTC.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/PricingSettingsDialog-BPtVUGgs.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-3Awyaovx.js +0 -3
- package/templates/.agents/dashboard/apps/frontend/dist/assets/ProjectSettingsPage-GgzpZ_PY.css +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/TraceabilityWorkspace-BCvZFMEf.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/cost-monitor-DbaLbU2q.js +0 -68
- package/templates/.agents/dashboard/apps/frontend/dist/assets/index-_MEktQNM.js +0 -2
- package/templates/.agents/dashboard/apps/frontend/dist/assets/rolldown-runtime-D9-fqq9M.js +0 -1
- package/templates/.agents/dashboard/apps/frontend/dist/assets/traceability-BDe4_Ubl.js +0 -1
- package/templates/.agents/growth/.gitkeep +0 -0
- package/templates/.agents/marketing/.gitkeep +0 -0
- package/templates/.agents/sales/.gitkeep +0 -0
|
@@ -1,9 +1,88 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
dashboardHealthUrl,
|
|
3
|
+
dashboardUrl,
|
|
4
|
+
findAvailablePortWithFallback,
|
|
5
|
+
openBrowser,
|
|
6
|
+
preferredPort,
|
|
7
|
+
} from "./start-dashboard-navigation.mjs";
|
|
8
|
+
|
|
9
|
+
export {
|
|
10
|
+
browserLaunchCommands,
|
|
11
|
+
dashboardHealthUrl,
|
|
12
|
+
dashboardUrl,
|
|
13
|
+
findAvailablePort,
|
|
14
|
+
findAvailablePortWithFallback,
|
|
15
|
+
openBrowser,
|
|
16
|
+
preferredPort,
|
|
17
|
+
} from "./start-dashboard-navigation.mjs";
|
|
18
|
+
|
|
19
|
+
import {
|
|
20
|
+
dashboardServerPathForWorkspace,
|
|
21
|
+
ensureFreshDashboardBuild,
|
|
22
|
+
} from "./start-dashboard-build.mjs";
|
|
23
|
+
import {
|
|
24
|
+
appendLauncherLog,
|
|
25
|
+
formatLauncherError,
|
|
26
|
+
stripTerminalControlCodes,
|
|
27
|
+
} from "./start-dashboard-logging.mjs";
|
|
28
|
+
import {
|
|
29
|
+
claimLockPath,
|
|
30
|
+
claimLockStaleMs,
|
|
31
|
+
claimLockTimeoutMs,
|
|
32
|
+
frontendRoot,
|
|
33
|
+
healthPath,
|
|
34
|
+
host,
|
|
35
|
+
launchPath,
|
|
36
|
+
lockHeartbeatFloorMs,
|
|
37
|
+
lockPath,
|
|
38
|
+
lockTimeoutMs,
|
|
39
|
+
maxPortAttempts,
|
|
40
|
+
maxPortHistory,
|
|
41
|
+
maxServerStartAttempts,
|
|
42
|
+
nodeCompileCacheDirectory,
|
|
43
|
+
packageRoot,
|
|
44
|
+
portRegistryPath,
|
|
45
|
+
runtimeKind,
|
|
46
|
+
sessionDirectory,
|
|
47
|
+
sessionPath,
|
|
48
|
+
sqliteReadModelPath,
|
|
49
|
+
staleLockMs,
|
|
50
|
+
workspaceKey,
|
|
51
|
+
workspaceRoot,
|
|
52
|
+
} from "./start-dashboard-paths.mjs";
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
dashboardServerPathForWorkspace,
|
|
56
|
+
inspectDashboardBuildTarget,
|
|
57
|
+
isDashboardSourceWorkspace,
|
|
58
|
+
latestModifiedAt,
|
|
59
|
+
refreshDashboardBuildTargets,
|
|
60
|
+
} from "./start-dashboard-build.mjs";
|
|
61
|
+
export {
|
|
62
|
+
appendLauncherLog,
|
|
63
|
+
formatLauncherError,
|
|
64
|
+
stripTerminalControlCodes,
|
|
65
|
+
} from "./start-dashboard-logging.mjs";
|
|
66
|
+
export {
|
|
67
|
+
dashboardBuildTargets,
|
|
68
|
+
defaultPort,
|
|
69
|
+
host,
|
|
70
|
+
launcherLogPath,
|
|
71
|
+
launchPath,
|
|
72
|
+
lockPath,
|
|
73
|
+
maxPortAttempts,
|
|
74
|
+
portRegistryPath,
|
|
75
|
+
runtimeKind,
|
|
76
|
+
sessionDirectory,
|
|
77
|
+
sessionPath,
|
|
78
|
+
workspaceKey,
|
|
79
|
+
workspaceRoot,
|
|
80
|
+
} from "./start-dashboard-paths.mjs";
|
|
81
|
+
|
|
2
82
|
import { createHash, randomBytes } from "node:crypto";
|
|
3
|
-
import {
|
|
4
|
-
import { mkdir, readdir, readFile, rename, rm, stat, utimes, writeFile } from "node:fs/promises";
|
|
83
|
+
import { mkdir, readFile, rename, rm, stat, utimes, writeFile } from "node:fs/promises";
|
|
5
84
|
import { tmpdir } from "node:os";
|
|
6
|
-
import { dirname, join, resolve
|
|
85
|
+
import { dirname, join, resolve } from "node:path";
|
|
7
86
|
import process from "node:process";
|
|
8
87
|
import { fileURLToPath } from "node:url";
|
|
9
88
|
import { collectPreviousDashboardSessions } from "./start-dashboard-history.mjs";
|
|
@@ -22,15 +101,7 @@ import {
|
|
|
22
101
|
stopProcessTree,
|
|
23
102
|
teardownWarning,
|
|
24
103
|
} from "./start-dashboard-processes.mjs";
|
|
25
|
-
import {
|
|
26
|
-
assertInstalledDashboardArtifacts,
|
|
27
|
-
isDashboardSourceWorkspace as hasDashboardSourceWorkspace,
|
|
28
|
-
dashboardServerPathForWorkspace as selectDashboardServerPath,
|
|
29
|
-
} from "./start-dashboard-runtime-selection.mjs";
|
|
30
|
-
import {
|
|
31
|
-
isPortFree,
|
|
32
|
-
startDashboardServer as launchDashboardServer,
|
|
33
|
-
} from "./start-dashboard-server.mjs";
|
|
104
|
+
import { startDashboardServer as launchDashboardServer } from "./start-dashboard-server.mjs";
|
|
34
105
|
|
|
35
106
|
export {
|
|
36
107
|
isAncestorProcess,
|
|
@@ -39,144 +110,19 @@ export {
|
|
|
39
110
|
stopOwnedDashboardProcess,
|
|
40
111
|
teardownWarning,
|
|
41
112
|
} from "./start-dashboard-processes.mjs";
|
|
42
|
-
|
|
43
|
-
export const defaultPort = 4417;
|
|
44
|
-
export const maxPortAttempts = 25;
|
|
45
|
-
export const runtimeKind = "zaip-dashboard-sqlite-runtime";
|
|
46
|
-
const packageRoot = dirname(fileURLToPath(import.meta.url));
|
|
47
|
-
export const workspaceRoot = resolve(packageRoot, "../../../..");
|
|
48
|
-
export const workspaceKey = createHash("sha256")
|
|
49
|
-
.update(`${workspaceRoot}:dashboard-sqlite`)
|
|
50
|
-
.digest("hex")
|
|
51
|
-
.slice(0, 16);
|
|
52
|
-
export const sessionDirectory = join(tmpdir(), "zaip-aios", `dashboard-sqlite-${workspaceKey}`);
|
|
53
|
-
export const sessionPath = join(sessionDirectory, "dashboard-sqlite-session.json");
|
|
113
|
+
|
|
54
114
|
// This small, token-free record is the observable ownership contract while a
|
|
55
115
|
// dashboard is still preparing. It deliberately does not replace the active
|
|
56
116
|
// runtime session, so a newer click can take priority without losing the PID
|
|
57
117
|
// needed to stop the older runtime.
|
|
58
|
-
|
|
59
|
-
const claimLockPath = join(sessionDirectory, "dashboard-sqlite-claim.lock");
|
|
60
|
-
const claimLockTimeoutMs = 5_000;
|
|
61
|
-
const claimLockStaleMs = 30_000;
|
|
62
|
-
export const portRegistryPath = join(sessionDirectory, "dashboard-sqlite-ports.json");
|
|
63
|
-
export const lockPath = join(sessionDirectory, "dashboard-sqlite-launcher.lock");
|
|
64
|
-
export const launcherLogPath = join(sessionDirectory, "dashboard-sqlite-launcher.log");
|
|
65
|
-
const frontendRoot = resolve(workspaceRoot, ".agents/dashboard/apps/frontend/dist");
|
|
66
|
-
const sqliteReadModelDirectory = resolve(workspaceRoot, ".local", "sqlite");
|
|
67
|
-
const sqliteReadModelPath = join(sqliteReadModelDirectory, "zaip-aios-dashboard.sqlite");
|
|
118
|
+
|
|
68
119
|
// Bytecode is disposable session data, separate from the persistent database.
|
|
69
|
-
|
|
70
|
-
const installedServer = resolve(packageRoot, "server.mjs");
|
|
71
|
-
const sourceServer = resolve(packageRoot, "dist/server.cjs");
|
|
72
|
-
const healthPath = "/api/v2/health";
|
|
120
|
+
|
|
73
121
|
// Keep the preparation lock through a full build so concurrent clicks coalesce safely.
|
|
74
|
-
|
|
75
|
-
const staleLockMs = 30_000;
|
|
76
|
-
const lockHeartbeatFloorMs = 10;
|
|
77
|
-
const maxServerStartAttempts = 4;
|
|
78
|
-
const maxPortHistory = 50;
|
|
122
|
+
|
|
79
123
|
// Keep each build invalidation scoped to the artifact it can actually change.
|
|
80
124
|
// The runtime bundle includes the server-side dashboard modules, workspace
|
|
81
125
|
// packages, settings and build scripts. Browser-only changes never rebuild it.
|
|
82
|
-
export const dashboardBuildTargets = {
|
|
83
|
-
frontend: {
|
|
84
|
-
artifacts: [resolve(frontendRoot, "index.html")],
|
|
85
|
-
sourceRoots: [
|
|
86
|
-
resolve(workspaceRoot, ".agents/dashboard/apps/frontend/src"),
|
|
87
|
-
resolve(workspaceRoot, ".agents/dashboard/apps/frontend/public"),
|
|
88
|
-
resolve(workspaceRoot, ".agents/dashboard/apps/frontend/index.html"),
|
|
89
|
-
resolve(workspaceRoot, ".agents/dashboard/modules/operations/src"),
|
|
90
|
-
resolve(workspaceRoot, ".agents/dashboard/modules/cost-monitor/src"),
|
|
91
|
-
resolve(workspaceRoot, ".agents/dashboard/modules/traceability/src"),
|
|
92
|
-
resolve(workspaceRoot, ".agents/dashboard/modules/operations/src/contracts.ts"),
|
|
93
|
-
resolve(workspaceRoot, ".agents/dashboard/modules/cost-monitor/src/contracts.ts"),
|
|
94
|
-
resolve(workspaceRoot, ".agents/dashboard/modules/traceability/src/contracts.ts"),
|
|
95
|
-
resolve(workspaceRoot, ".agents/dashboard/packages/contracts/src"),
|
|
96
|
-
resolve(workspaceRoot, ".agents/dashboard/packages/ui/src"),
|
|
97
|
-
resolve(workspaceRoot, ".agents/dashboard/apps/frontend/vite.config.ts"),
|
|
98
|
-
resolve(workspaceRoot, ".agents/dashboard/apps/frontend/package.json"),
|
|
99
|
-
resolve(workspaceRoot, ".agents/dashboard/apps/frontend/tsconfig.json"),
|
|
100
|
-
resolve(workspaceRoot, "tsconfig.base.json"),
|
|
101
|
-
resolve(workspaceRoot, "pnpm-lock.yaml"),
|
|
102
|
-
resolve(workspaceRoot, "README.md"),
|
|
103
|
-
],
|
|
104
|
-
excludedSourcePaths: ["/server/"],
|
|
105
|
-
},
|
|
106
|
-
runtime: {
|
|
107
|
-
artifacts: [
|
|
108
|
-
sourceServer,
|
|
109
|
-
resolve(packageRoot, "dist/server.js"),
|
|
110
|
-
resolve(packageRoot, "dist/sqlite-read-model.cjs"),
|
|
111
|
-
installedServer,
|
|
112
|
-
],
|
|
113
|
-
sourceRoots: [
|
|
114
|
-
resolve(packageRoot, "src"),
|
|
115
|
-
resolve(packageRoot, "scripts"),
|
|
116
|
-
resolve(packageRoot, "package.json"),
|
|
117
|
-
resolve(packageRoot, "tsconfig.json"),
|
|
118
|
-
resolve(workspaceRoot, ".agents/dashboard/modules/operations/src"),
|
|
119
|
-
resolve(workspaceRoot, ".agents/dashboard/modules/cost-monitor/src"),
|
|
120
|
-
resolve(workspaceRoot, ".agents/dashboard/modules/traceability/src"),
|
|
121
|
-
resolve(workspaceRoot, ".agents/dashboard/packages/contracts/src"),
|
|
122
|
-
resolve(workspaceRoot, ".agents/dashboard/packages/data-export/src"),
|
|
123
|
-
resolve(workspaceRoot, "packages/core/src"),
|
|
124
|
-
resolve(workspaceRoot, "packages/costs/src"),
|
|
125
|
-
resolve(workspaceRoot, "packages/decisions/src"),
|
|
126
|
-
resolve(workspaceRoot, "packages/lifecycle-manifests/src"),
|
|
127
|
-
resolve(workspaceRoot, "packages/specs/src"),
|
|
128
|
-
resolve(workspaceRoot, "packages/tasks/src"),
|
|
129
|
-
resolve(workspaceRoot, "package.json"),
|
|
130
|
-
resolve(workspaceRoot, "pnpm-workspace.yaml"),
|
|
131
|
-
resolve(workspaceRoot, "pnpm-lock.yaml"),
|
|
132
|
-
resolve(workspaceRoot, "tsconfig.base.json"),
|
|
133
|
-
],
|
|
134
|
-
excludedSourcePaths: ["/react/"],
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
export function preferredPort(value = process.env.ZAIP_SERVER_PORT) {
|
|
138
|
-
const parsed = Number.parseInt(value ?? "", 10);
|
|
139
|
-
return Number.isInteger(parsed) && parsed > 0 && parsed <= 65_535 ? parsed : defaultPort;
|
|
140
|
-
}
|
|
141
|
-
export function dashboardHealthUrl(port) {
|
|
142
|
-
return `http://${host}:${port}${healthPath}`;
|
|
143
|
-
}
|
|
144
|
-
export function dashboardUrl(port, token, snapshotUpdating = false) {
|
|
145
|
-
return `http://${host}:${port}/?token=${encodeURIComponent(token)}${snapshotUpdating ? "&snapshot=updating" : ""}`;
|
|
146
|
-
}
|
|
147
|
-
export function appendLauncherLog(message) {
|
|
148
|
-
try {
|
|
149
|
-
mkdirSync(sessionDirectory, { recursive: true });
|
|
150
|
-
appendFileSync(
|
|
151
|
-
launcherLogPath,
|
|
152
|
-
`[${new Date().toISOString()}] ${stripTerminalControlCodes(message)}\n`,
|
|
153
|
-
"utf8",
|
|
154
|
-
);
|
|
155
|
-
} catch {
|
|
156
|
-
// Best-effort diagnostics must not hide the launcher failure.
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
export function stripTerminalControlCodes(value) {
|
|
160
|
-
const escapeCode = String.fromCharCode(27);
|
|
161
|
-
const bell = String.fromCharCode(7);
|
|
162
|
-
const operatingSystemCommand = new RegExp(
|
|
163
|
-
`${escapeCode}\\][^${bell}]*(?:${bell}|${escapeCode}\\\\)`,
|
|
164
|
-
"g",
|
|
165
|
-
);
|
|
166
|
-
const controlSequenceIntroducer = new RegExp(`${escapeCode}\\[[0-?]*[ -/]*[@-~]`, "g");
|
|
167
|
-
return String(value)
|
|
168
|
-
.replace(operatingSystemCommand, "")
|
|
169
|
-
.replace(controlSequenceIntroducer, "")
|
|
170
|
-
.replace(/\r/g, "")
|
|
171
|
-
.trim();
|
|
172
|
-
}
|
|
173
|
-
export function formatLauncherError(value, maximumLength = 3_600) {
|
|
174
|
-
const message = stripTerminalControlCodes(value);
|
|
175
|
-
if (message.length <= maximumLength) return message;
|
|
176
|
-
const firstHalf = Math.floor(maximumLength / 2);
|
|
177
|
-
const lastHalf = maximumLength - firstHalf;
|
|
178
|
-
return `${message.slice(0, firstHalf)}\n\n… detalhes reduzidos; consulte o log temporário …\n\n${message.slice(-lastHalf)}`;
|
|
179
|
-
}
|
|
180
126
|
|
|
181
127
|
export async function readDashboardSession(path = sessionPath) {
|
|
182
128
|
try {
|
|
@@ -413,7 +359,6 @@ export async function findReusableDashboardSession({
|
|
|
413
359
|
const port = matches.find((candidate) => candidate !== null);
|
|
414
360
|
return port === undefined ? null : { ...session, port };
|
|
415
361
|
}
|
|
416
|
-
|
|
417
362
|
export function requestBackgroundProjectionRefresh(session, fetchImpl = fetch) {
|
|
418
363
|
return fetchImpl(`http://${host}:${session.port}/api/v2/refresh-projection`, {
|
|
419
364
|
method: "POST",
|
|
@@ -422,182 +367,6 @@ export function requestBackgroundProjectionRefresh(session, fetchImpl = fetch) {
|
|
|
422
367
|
}).catch(() => undefined);
|
|
423
368
|
}
|
|
424
369
|
|
|
425
|
-
export async function latestModifiedAt(paths, excludedSourcePaths = []) {
|
|
426
|
-
let latest = 0;
|
|
427
|
-
for (const path of paths) {
|
|
428
|
-
const details = await stat(path).catch(() => null);
|
|
429
|
-
if (details === null) continue;
|
|
430
|
-
if (!details.isDirectory()) {
|
|
431
|
-
if (isBuildInputPath(path, excludedSourcePaths)) latest = Math.max(latest, details.mtimeMs);
|
|
432
|
-
continue;
|
|
433
|
-
}
|
|
434
|
-
// Retain included directory mtimes so removing or renaming a source file
|
|
435
|
-
// after a build still invalidates its artifact. Excluded trees stay out.
|
|
436
|
-
if (isBuildInputPath(path, excludedSourcePaths)) latest = Math.max(latest, details.mtimeMs);
|
|
437
|
-
const entries = await readdir(path, { withFileTypes: true }).catch(() => []);
|
|
438
|
-
latest = Math.max(
|
|
439
|
-
latest,
|
|
440
|
-
await latestModifiedAt(
|
|
441
|
-
entries
|
|
442
|
-
.filter((entry) => isBuildInputPath(join(path, entry.name), excludedSourcePaths))
|
|
443
|
-
.map((entry) => join(path, entry.name)),
|
|
444
|
-
excludedSourcePaths,
|
|
445
|
-
),
|
|
446
|
-
);
|
|
447
|
-
}
|
|
448
|
-
return latest;
|
|
449
|
-
}
|
|
450
|
-
function isBuildInputPath(path, excludedSourcePaths) {
|
|
451
|
-
const normalized = path.replaceAll("\\", "/");
|
|
452
|
-
const name = normalized.slice(normalized.lastIndexOf("/") + 1);
|
|
453
|
-
if (new Set(["dist", "node_modules", ".turbo"]).has(name)) return false;
|
|
454
|
-
if (/\.(?:test|spec)\.[cm]?[jt]sx?$/.test(name)) return false;
|
|
455
|
-
return !excludedSourcePaths.some(
|
|
456
|
-
(excluded) => normalized.includes(excluded) || normalized.endsWith(excluded.slice(0, -1)),
|
|
457
|
-
);
|
|
458
|
-
}
|
|
459
|
-
async function runSqliteBuild(target) {
|
|
460
|
-
const frontend = target === "frontend";
|
|
461
|
-
const command = process.execPath;
|
|
462
|
-
const args = frontend
|
|
463
|
-
? [resolve(workspaceRoot, "node_modules/vite/bin/vite.js"), "build"]
|
|
464
|
-
: [
|
|
465
|
-
resolve(
|
|
466
|
-
workspaceRoot,
|
|
467
|
-
".agents/dashboard/packages/local-runtime/scripts/build-sqlite-runtime.mjs",
|
|
468
|
-
),
|
|
469
|
-
];
|
|
470
|
-
const output = await new Promise((resolveBuild, rejectBuild) => {
|
|
471
|
-
const child = spawn(command, args, {
|
|
472
|
-
cwd: frontend ? resolve(workspaceRoot, ".agents/dashboard/apps/frontend") : packageRoot,
|
|
473
|
-
windowsHide: true,
|
|
474
|
-
stdio: "pipe",
|
|
475
|
-
});
|
|
476
|
-
let outputText = "";
|
|
477
|
-
const appendOutput = (chunk) => {
|
|
478
|
-
outputText = `${outputText}${chunk}`.slice(-8_000);
|
|
479
|
-
};
|
|
480
|
-
child.stdout?.setEncoding("utf8");
|
|
481
|
-
child.stdout?.on("data", appendOutput);
|
|
482
|
-
child.stderr?.setEncoding("utf8");
|
|
483
|
-
child.stderr?.on("data", appendOutput);
|
|
484
|
-
child.once("error", rejectBuild);
|
|
485
|
-
child.once("exit", (code) => {
|
|
486
|
-
if (code === 0) resolveBuild();
|
|
487
|
-
else
|
|
488
|
-
rejectBuild(
|
|
489
|
-
new Error(
|
|
490
|
-
`SQLite dashboard ${target} build failed (${code}): ${formatLauncherError(outputText)}`,
|
|
491
|
-
),
|
|
492
|
-
);
|
|
493
|
-
});
|
|
494
|
-
});
|
|
495
|
-
return output;
|
|
496
|
-
}
|
|
497
|
-
export async function inspectDashboardBuildTarget(target) {
|
|
498
|
-
const artifactStats = await Promise.all(
|
|
499
|
-
target.artifacts.map(async (path) => ({ path, details: await stat(path).catch(() => null) })),
|
|
500
|
-
);
|
|
501
|
-
const missingArtifacts = artifactStats
|
|
502
|
-
.filter(({ details }) => details === null)
|
|
503
|
-
.map(({ path }) => path);
|
|
504
|
-
const artifactsModifiedAt = Math.min(
|
|
505
|
-
...artifactStats.map(({ details }) => details?.mtimeMs ?? 0),
|
|
506
|
-
);
|
|
507
|
-
const sourcesModifiedAt = await latestModifiedAt(target.sourceRoots, target.excludedSourcePaths);
|
|
508
|
-
return { artifactsModifiedAt, missingArtifacts, sourcesModifiedAt };
|
|
509
|
-
}
|
|
510
|
-
function buildProgress(onProgress, percent, phase, detail) {
|
|
511
|
-
onProgress({ percent, phase, detail });
|
|
512
|
-
}
|
|
513
|
-
export async function refreshDashboardBuildTargets({
|
|
514
|
-
targets = dashboardBuildTargets,
|
|
515
|
-
forceRebuild = process.env.ZAIP_DASHBOARD_FORCE_REBUILD === "1",
|
|
516
|
-
inspectTarget = inspectDashboardBuildTarget,
|
|
517
|
-
runBuild = runSqliteBuild,
|
|
518
|
-
onProgress = () => {},
|
|
519
|
-
} = {}) {
|
|
520
|
-
const builtTargets = [];
|
|
521
|
-
for (const [name, target] of Object.entries(targets)) {
|
|
522
|
-
buildProgress(
|
|
523
|
-
onProgress,
|
|
524
|
-
name === "frontend" ? 30 : 35,
|
|
525
|
-
`Verificando ${name === "frontend" ? "a interface" : "o runtime local"}`,
|
|
526
|
-
"Conferindo somente as dependências que geram este artefato.",
|
|
527
|
-
);
|
|
528
|
-
const state = await inspectTarget(target);
|
|
529
|
-
const needsBuild =
|
|
530
|
-
forceRebuild ||
|
|
531
|
-
state.missingArtifacts.length > 0 ||
|
|
532
|
-
state.artifactsModifiedAt < state.sourcesModifiedAt;
|
|
533
|
-
if (!needsBuild) {
|
|
534
|
-
buildProgress(
|
|
535
|
-
onProgress,
|
|
536
|
-
name === "frontend" ? 33 : 39,
|
|
537
|
-
`${name === "frontend" ? "Interface" : "Runtime local"} já está atualizado`,
|
|
538
|
-
"O artefato existente corresponde às dependências verificadas.",
|
|
539
|
-
);
|
|
540
|
-
continue;
|
|
541
|
-
}
|
|
542
|
-
const reason = forceRebuild
|
|
543
|
-
? "A atualização foi solicitada explicitamente."
|
|
544
|
-
: state.missingArtifacts.length > 0
|
|
545
|
-
? "Um artefato necessário está ausente."
|
|
546
|
-
: "Uma dependência deste artefato foi modificada.";
|
|
547
|
-
buildProgress(
|
|
548
|
-
onProgress,
|
|
549
|
-
name === "frontend" ? 33 : 39,
|
|
550
|
-
`Atualizando ${name === "frontend" ? "a interface" : "o runtime local"}`,
|
|
551
|
-
reason,
|
|
552
|
-
);
|
|
553
|
-
await runBuild(name);
|
|
554
|
-
builtTargets.push(name);
|
|
555
|
-
buildProgress(
|
|
556
|
-
onProgress,
|
|
557
|
-
name === "frontend" ? 35 : 42,
|
|
558
|
-
`${name === "frontend" ? "Interface" : "Runtime local"} atualizado`,
|
|
559
|
-
"O artefato foi gerado com as dependências atuais.",
|
|
560
|
-
);
|
|
561
|
-
}
|
|
562
|
-
return { artifacts: Object.values(targets).flatMap((target) => target.artifacts), builtTargets };
|
|
563
|
-
}
|
|
564
|
-
async function ensureFreshDashboardBuild(onProgress = () => {}) {
|
|
565
|
-
if (!(await hasDashboardSourceWorkspace(workspaceRoot))) {
|
|
566
|
-
const packagedArtifacts = [installedServer, resolve(frontendRoot, "index.html")];
|
|
567
|
-
await assertInstalledDashboardArtifacts(packagedArtifacts);
|
|
568
|
-
buildProgress(
|
|
569
|
-
onProgress,
|
|
570
|
-
39,
|
|
571
|
-
"Usando runtime empacotado",
|
|
572
|
-
"O pacote npm já inclui o dashboard pronto; nenhuma instalação de desenvolvimento é necessária.",
|
|
573
|
-
);
|
|
574
|
-
const signature = await Promise.all(
|
|
575
|
-
[...packagedArtifacts, resolve(packageRoot, "start-dashboard.mjs")].map(async (path) => {
|
|
576
|
-
const details = await stat(path);
|
|
577
|
-
return `${path}:${details.size}:${details.mtimeMs}`;
|
|
578
|
-
}),
|
|
579
|
-
);
|
|
580
|
-
return createHash("sha256").update(signature.join("|")).digest("hex");
|
|
581
|
-
}
|
|
582
|
-
const { artifacts } = await refreshDashboardBuildTargets({ onProgress });
|
|
583
|
-
const artifactFingerprint = await Promise.all(
|
|
584
|
-
[...artifacts, resolve(packageRoot, "start-dashboard.mjs")].map(async (path) => {
|
|
585
|
-
const details = await stat(path);
|
|
586
|
-
return `${path}:${details.size}:${details.mtimeMs}`;
|
|
587
|
-
}),
|
|
588
|
-
);
|
|
589
|
-
return createHash("sha256").update(artifactFingerprint.join("|")).digest("hex");
|
|
590
|
-
}
|
|
591
|
-
export async function isDashboardSourceWorkspace(root = workspaceRoot) {
|
|
592
|
-
return hasDashboardSourceWorkspace(root);
|
|
593
|
-
}
|
|
594
|
-
export async function dashboardServerPathForWorkspace({
|
|
595
|
-
root = workspaceRoot,
|
|
596
|
-
sourcePath = sourceServer,
|
|
597
|
-
installedPath = installedServer,
|
|
598
|
-
} = {}) {
|
|
599
|
-
return selectDashboardServerPath({ root, sourcePath, installedPath });
|
|
600
|
-
}
|
|
601
370
|
export async function withLauncherLock(
|
|
602
371
|
action,
|
|
603
372
|
{
|
|
@@ -652,104 +421,7 @@ export async function withLauncherLock(
|
|
|
652
421
|
}
|
|
653
422
|
throw new Error("Timed out waiting for the ZAIP dashboard launcher lock");
|
|
654
423
|
}
|
|
655
|
-
|
|
656
|
-
for (let port = startPort; port < Math.min(startPort + maxPortAttempts, 65_536); port += 1) {
|
|
657
|
-
if (await isPortFree(host, port)) return port;
|
|
658
|
-
}
|
|
659
|
-
throw new Error(
|
|
660
|
-
`No free dashboard port found between ${startPort} and ${Math.min(startPort + maxPortAttempts - 1, 65_535)}`,
|
|
661
|
-
);
|
|
662
|
-
}
|
|
663
|
-
export async function findAvailablePortWithFallback({
|
|
664
|
-
preferred = preferredPort(),
|
|
665
|
-
excludedPorts = [],
|
|
666
|
-
} = {}) {
|
|
667
|
-
const excluded = new Set(excludedPorts.filter(Number.isInteger));
|
|
668
|
-
const fallbackStarts = [preferred, defaultPort + 1_000, defaultPort + 4_000].filter(
|
|
669
|
-
(port, index, ports) => port <= 65_535 && ports.indexOf(port) === index,
|
|
670
|
-
);
|
|
671
|
-
for (const startPort of fallbackStarts) {
|
|
672
|
-
for (let port = startPort; port < Math.min(startPort + maxPortAttempts, 65_536); port += 1) {
|
|
673
|
-
if (!excluded.has(port) && (await isPortFree(host, port))) return port;
|
|
674
|
-
}
|
|
675
|
-
}
|
|
676
|
-
for (let attempt = 0; attempt < 5; attempt += 1) {
|
|
677
|
-
const ephemeralPort = await findEphemeralPort();
|
|
678
|
-
if (!excluded.has(ephemeralPort)) return ephemeralPort;
|
|
679
|
-
}
|
|
680
|
-
throw new Error(
|
|
681
|
-
"No free dashboard port was found in the preferred, fallback, or ephemeral ranges",
|
|
682
|
-
);
|
|
683
|
-
}
|
|
684
|
-
async function findEphemeralPort() {
|
|
685
|
-
return new Promise((resolvePort, rejectPort) => {
|
|
686
|
-
const server = createServer();
|
|
687
|
-
server.unref();
|
|
688
|
-
server.once("error", rejectPort);
|
|
689
|
-
server.listen({ host, port: 0 }, () => {
|
|
690
|
-
const address = server.address();
|
|
691
|
-
const port = typeof address === "object" && address !== null ? address.port : null;
|
|
692
|
-
server.close(() => {
|
|
693
|
-
if (Number.isInteger(port)) resolvePort(port);
|
|
694
|
-
else rejectPort(new Error("The operating system did not allocate an ephemeral port"));
|
|
695
|
-
});
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
}
|
|
699
|
-
export function browserLaunchCommands(
|
|
700
|
-
target,
|
|
701
|
-
platform = process.platform,
|
|
702
|
-
environment = process.env,
|
|
703
|
-
) {
|
|
704
|
-
if (platform === "win32") {
|
|
705
|
-
const systemRoot = environment.SystemRoot ?? "C:\\Windows";
|
|
706
|
-
return [
|
|
707
|
-
[
|
|
708
|
-
win32.resolve(systemRoot, "System32", "rundll32.exe"),
|
|
709
|
-
["url.dll,FileProtocolHandler", target],
|
|
710
|
-
],
|
|
711
|
-
[
|
|
712
|
-
environment.ComSpec ?? win32.resolve(systemRoot, "System32", "cmd.exe"),
|
|
713
|
-
["/d", "/c", "start", "", target],
|
|
714
|
-
],
|
|
715
|
-
];
|
|
716
|
-
}
|
|
717
|
-
return platform === "darwin"
|
|
718
|
-
? [["open", [target]]]
|
|
719
|
-
: [
|
|
720
|
-
["xdg-open", [target]],
|
|
721
|
-
["gio", ["open", target]],
|
|
722
|
-
];
|
|
723
|
-
}
|
|
724
|
-
export async function openBrowser(target, spawnImpl = spawn) {
|
|
725
|
-
if (process.env.ZAIP_UI_NO_BROWSER === "1") return true;
|
|
726
|
-
const commands = browserLaunchCommands(target);
|
|
727
|
-
for (const [command, args] of commands) {
|
|
728
|
-
const launched = await new Promise((resolveLaunch) => {
|
|
729
|
-
let settled = false;
|
|
730
|
-
const settle = (value) => {
|
|
731
|
-
if (settled) return;
|
|
732
|
-
settled = true;
|
|
733
|
-
resolveLaunch(value);
|
|
734
|
-
};
|
|
735
|
-
try {
|
|
736
|
-
const browser = spawnImpl(command, args, {
|
|
737
|
-
detached: true,
|
|
738
|
-
stdio: "ignore",
|
|
739
|
-
windowsHide: true,
|
|
740
|
-
});
|
|
741
|
-
browser.once("spawn", () => settle(true));
|
|
742
|
-
browser.once("error", () => settle(false));
|
|
743
|
-
browser.unref();
|
|
744
|
-
} catch {
|
|
745
|
-
settle(false);
|
|
746
|
-
}
|
|
747
|
-
});
|
|
748
|
-
if (launched) return true;
|
|
749
|
-
}
|
|
750
|
-
appendLauncherLog(`Could not dispatch the dashboard URL to the default browser: ${target}`);
|
|
751
|
-
return false;
|
|
752
|
-
}
|
|
424
|
+
|
|
753
425
|
export function startDashboardLaunchPage(port) {
|
|
754
426
|
return createDashboardLaunchPage({ port, host, runtimeKind, healthPath, delay });
|
|
755
427
|
}
|
|
@@ -839,7 +511,6 @@ async function startDashboardServer(
|
|
|
839
511
|
appendLog: appendLauncherLog,
|
|
840
512
|
});
|
|
841
513
|
}
|
|
842
|
-
|
|
843
514
|
async function main() {
|
|
844
515
|
let ownedChild = null;
|
|
845
516
|
let currentSession = null;
|
|
@@ -42,7 +42,7 @@ afterEach(async () => {
|
|
|
42
42
|
|
|
43
43
|
describe("dashboard executable session", () => {
|
|
44
44
|
it("imports teardown bindings for the launcher implementation", async () => {
|
|
45
|
-
const source = await
|
|
45
|
+
const source = await readLauncherComposition();
|
|
46
46
|
|
|
47
47
|
expect(source).toContain("stopProcessTree,");
|
|
48
48
|
expect(source).toContain("teardownWarning,");
|
|
@@ -56,7 +56,7 @@ describe("dashboard executable session", () => {
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
it("shows preparation before validating dashboard prerequisites", async () => {
|
|
59
|
-
const source = await
|
|
59
|
+
const source = await readLauncherComposition();
|
|
60
60
|
|
|
61
61
|
expect(source).toContain('from "./start-dashboard-prerequisites.mjs";');
|
|
62
62
|
expect(source).toContain("await assertDashboardPrerequisites(workspaceRoot);");
|
|
@@ -74,7 +74,7 @@ describe("dashboard executable session", () => {
|
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
it("makes the newest executable click replace a healthy runtime instead of reusing it", async () => {
|
|
77
|
-
const source = await
|
|
77
|
+
const source = await readLauncherComposition();
|
|
78
78
|
expect(source).toContain("newestClickWins: true,");
|
|
79
79
|
expect(source).toContain("const previousSessions = await previousDashboardSessions();");
|
|
80
80
|
expect(source).toContain("await stopOwnedDashboard(previous);");
|
|
@@ -157,7 +157,7 @@ describe("dashboard executable session", () => {
|
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
it("keeps factual build milestones wired to the preparation page", async () => {
|
|
160
|
-
const source = await
|
|
160
|
+
const source = await readLauncherComposition();
|
|
161
161
|
|
|
162
162
|
expect(source).toContain("export const dashboardBuildTargets = {");
|
|
163
163
|
expect(source).toContain('resolve(workspaceRoot, "packages/core/src")');
|
|
@@ -219,7 +219,7 @@ describe("dashboard executable session", () => {
|
|
|
219
219
|
});
|
|
220
220
|
|
|
221
221
|
it("opens preparation before checking freshness and keeps it through server health", async () => {
|
|
222
|
-
const source = await
|
|
222
|
+
const source = await readLauncherComposition();
|
|
223
223
|
const lock = source.indexOf("await withLauncherLock(");
|
|
224
224
|
const preparation = source.indexOf("launchPage = await startDashboardLaunchPage(0);");
|
|
225
225
|
const freshness = source.indexOf(
|
|
@@ -238,7 +238,7 @@ describe("dashboard executable session", () => {
|
|
|
238
238
|
});
|
|
239
239
|
|
|
240
240
|
it("reports real readiness failures without imposing a wall-clock limit on a cold rebuild", async () => {
|
|
241
|
-
const source = await
|
|
241
|
+
const source = await readLauncherComposition();
|
|
242
242
|
const wait = source.slice(
|
|
243
243
|
source.indexOf("async function waitForDashboard"),
|
|
244
244
|
source.indexOf("function exists"),
|
|
@@ -263,7 +263,7 @@ describe("dashboard executable session", () => {
|
|
|
263
263
|
});
|
|
264
264
|
|
|
265
265
|
it("uses the official persistent database without reusing a previous runtime", async () => {
|
|
266
|
-
const source = await
|
|
266
|
+
const source = await readLauncherComposition();
|
|
267
267
|
expect(source).toContain(
|
|
268
268
|
'const sqliteReadModelDirectory = resolve(workspaceRoot, ".local", "sqlite");',
|
|
269
269
|
);
|
|
@@ -305,7 +305,7 @@ describe("dashboard executable session", () => {
|
|
|
305
305
|
});
|
|
306
306
|
|
|
307
307
|
it("tears down prior owned sessions before the newest generation starts", async () => {
|
|
308
|
-
const source = await
|
|
308
|
+
const source = await readLauncherComposition();
|
|
309
309
|
const server = source.indexOf(
|
|
310
310
|
"const { child, port, dbPath, snapshotCache } = await startDashboardServer(",
|
|
311
311
|
);
|
|
@@ -388,7 +388,7 @@ describe("dashboard executable session", () => {
|
|
|
388
388
|
});
|
|
389
389
|
|
|
390
390
|
it("publishes ok only after Node observed both health and readiness", async () => {
|
|
391
|
-
const source = await
|
|
391
|
+
const source = await readLauncherComposition();
|
|
392
392
|
const wait = source.slice(
|
|
393
393
|
source.indexOf("async function waitForDashboard"),
|
|
394
394
|
source.indexOf("function exists"),
|
|
@@ -402,7 +402,7 @@ describe("dashboard executable session", () => {
|
|
|
402
402
|
});
|
|
403
403
|
|
|
404
404
|
it("records prior-port cleanup warnings while still publishing an ok handoff", async () => {
|
|
405
|
-
const source = await
|
|
405
|
+
const source = await readLauncherComposition();
|
|
406
406
|
const cleanup = source.indexOf("const status = await stopOwnedDashboard(previous);");
|
|
407
407
|
const warning = source.indexOf("Dashboard launched on port ${port}; prior-port cleanup:");
|
|
408
408
|
const success = source.indexOf('await writeLauncherStatus("ok");', cleanup);
|
|
@@ -731,7 +731,7 @@ describe("dashboard executable session", () => {
|
|
|
731
731
|
});
|
|
732
732
|
|
|
733
733
|
it("opens preparation before the newest-click lock and then starts a new generation", async () => {
|
|
734
|
-
const source = await
|
|
734
|
+
const source = await readLauncherComposition();
|
|
735
735
|
const preparation = source.indexOf("launchPage = await startDashboardLaunchPage(0);");
|
|
736
736
|
const lock = source.indexOf("await withLauncherLock(");
|
|
737
737
|
const buildSignature = source.indexOf(
|
|
@@ -757,7 +757,7 @@ describe("dashboard executable session", () => {
|
|
|
757
757
|
});
|
|
758
758
|
|
|
759
759
|
it("binds preparation atomically instead of reserving a probe-selected port", async () => {
|
|
760
|
-
const source = await
|
|
760
|
+
const source = await readLauncherComposition();
|
|
761
761
|
const preparationStart = source.indexOf("launchPage = await startDashboardLaunchPage(0);");
|
|
762
762
|
const lock = source.indexOf("await withLauncherLock(async () => {");
|
|
763
763
|
const beforeLock = source.slice(preparationStart, lock);
|
|
@@ -784,3 +784,13 @@ async function temporaryDirectory() {
|
|
|
784
784
|
temporaryDirectories.push(path);
|
|
785
785
|
return path;
|
|
786
786
|
}
|
|
787
|
+
|
|
788
|
+
async function readLauncherComposition() {
|
|
789
|
+
return (
|
|
790
|
+
await Promise.all(
|
|
791
|
+
["start-dashboard.mjs", "start-dashboard-build.mjs", "start-dashboard-paths.mjs"].map(
|
|
792
|
+
(path) => readFile(new URL(`./${path}`, import.meta.url), "utf8"),
|
|
793
|
+
),
|
|
794
|
+
)
|
|
795
|
+
).join("\n");
|
|
796
|
+
}
|