agentic-dev 0.1.0 → 0.2.1
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/.agent/prd.json +29 -0
- package/.agent/progress.txt +1 -0
- package/.agent/prompt.md +21 -0
- package/.agent/ralph-loop-state.json +13 -0
- package/.agent/ralph-supervisor-state.json +12 -0
- package/.agent/ralph-supervisor.sh +238 -0
- package/.agent/ralph.sh +305 -0
- package/.agent/runs/README.md +7 -0
- package/.agent/sdd-build-ast-audit.json +13 -0
- package/.claude/CLAUDE.md +44 -0
- package/.claude/agentic-dev.json +3 -0
- package/.claude/agents/ai-dev.md +27 -0
- package/.claude/agents/backend-dev.md +26 -0
- package/.claude/agents/db-dev.md +26 -0
- package/.claude/agents/devops.md +27 -0
- package/.claude/agents/frontend-dev.md +25 -0
- package/.claude/agents/github-ops.md +25 -0
- package/.claude/agents/test-dev.md +26 -0
- package/.claude/agents/uiux-designer.md +25 -0
- package/.claude/settings.json +49 -0
- package/.claude/settings.local.json +8 -0
- package/.claude/skills/commit/SKILL.md +37 -0
- package/.claude/skills/dev-browser/SKILL.md +30 -0
- package/.claude/skills/otro/SKILL.md +43 -0
- package/.claude/skills/planning-with-files/SKILL.md +37 -0
- package/.claude/skills/prd/SKILL.md +27 -0
- package/.claude/skills/ralph-loop/SKILL.md +42 -0
- package/.claude/skills/sdd/SKILL.md +13 -0
- package/.claude/skills/sdd-dev/SKILL.md +71 -0
- package/.claude/skills/sdd-development/SKILL.md +13 -0
- package/.claude/workspace-config.json +3 -0
- package/.codex/agentic-dev.json +3 -0
- package/.codex/agents/README.md +22 -0
- package/.codex/agents/api.toml +11 -0
- package/.codex/agents/architecture.toml +11 -0
- package/.codex/agents/ci.toml +11 -0
- package/.codex/agents/gitops.toml +11 -0
- package/.codex/agents/orchestrator.toml +11 -0
- package/.codex/agents/quality.toml +11 -0
- package/.codex/agents/runtime.toml +11 -0
- package/.codex/agents/security.toml +11 -0
- package/.codex/agents/specs.toml +11 -0
- package/.codex/agents/ui.toml +11 -0
- package/.codex/config.toml +46 -0
- package/.codex/skills/SKILL.md +13 -0
- package/.codex/skills/agents/openai.yaml +4 -0
- package/.codex/skills/commit/SKILL.md +219 -0
- package/.codex/skills/commit/references/commit_examples.md +292 -0
- package/.codex/skills/dev-browser/SKILL.md +211 -0
- package/.codex/skills/dev-browser/bun.lock +443 -0
- package/.codex/skills/dev-browser/package-lock.json +2988 -0
- package/.codex/skills/dev-browser/package.json +31 -0
- package/.codex/skills/dev-browser/references/scraping.md +155 -0
- package/.codex/skills/dev-browser/scripts/start-relay.ts +32 -0
- package/.codex/skills/dev-browser/scripts/start-server.ts +117 -0
- package/.codex/skills/dev-browser/server.sh +24 -0
- package/.codex/skills/dev-browser/src/client.ts +474 -0
- package/.codex/skills/dev-browser/src/index.ts +287 -0
- package/.codex/skills/dev-browser/src/relay.ts +731 -0
- package/.codex/skills/dev-browser/src/snapshot/__tests__/snapshot.test.ts +223 -0
- package/.codex/skills/dev-browser/src/snapshot/browser-script.ts +877 -0
- package/.codex/skills/dev-browser/src/snapshot/index.ts +14 -0
- package/.codex/skills/dev-browser/src/snapshot/inject.ts +13 -0
- package/.codex/skills/dev-browser/src/types.ts +34 -0
- package/.codex/skills/dev-browser/tsconfig.json +36 -0
- package/.codex/skills/dev-browser/vitest.config.ts +12 -0
- package/.codex/skills/otro/SKILL.md +74 -0
- package/.codex/skills/otro/agents/openai.yaml +4 -0
- package/.codex/skills/otro/references/agent-prompts.md +61 -0
- package/.codex/skills/otro/references/contracts.md +146 -0
- package/.codex/skills/otro/references/orchestration-loop.md +51 -0
- package/.codex/skills/otro/references/runtime.md +79 -0
- package/.codex/skills/otro/runs/README.md +11 -0
- package/.codex/skills/otro/schemas/step_plan.schema.json +289 -0
- package/.codex/skills/otro/schemas/task_result.schema.json +142 -0
- package/.codex/skills/otro/schemas/wave_plan.schema.json +4 -0
- package/.codex/skills/otro/scripts/README.md +38 -0
- package/.codex/skills/otro/scripts/bump_validation_header.py +179 -0
- package/.codex/skills/otro/scripts/check_validation_header.py +84 -0
- package/.codex/skills/otro/scripts/common.py +303 -0
- package/.codex/skills/otro/scripts/init_run.sh +68 -0
- package/.codex/skills/otro/scripts/plan_loop.py +8 -0
- package/.codex/skills/otro/scripts/plan_step.py +367 -0
- package/.codex/skills/otro/scripts/plan_wave.py +8 -0
- package/.codex/skills/otro/scripts/reconcile_loop.py +8 -0
- package/.codex/skills/otro/scripts/reconcile_step.py +37 -0
- package/.codex/skills/otro/scripts/reconcile_wave.py +8 -0
- package/.codex/skills/otro/scripts/run_loop.py +300 -0
- package/.codex/skills/otro/scripts/run_loop_step.py +8 -0
- package/.codex/skills/otro/scripts/run_step.py +246 -0
- package/.codex/skills/otro/scripts/run_wave.py +8 -0
- package/.codex/skills/otro/validation/validation.md +15 -0
- package/.codex/skills/planning-with-files/SKILL.md +42 -0
- package/.codex/skills/planning-with-files/agents/openai.yaml +4 -0
- package/.codex/skills/planning-with-files/assets/plan-template.md +37 -0
- package/.codex/skills/planning-with-files/references/plan-rules.md +35 -0
- package/.codex/skills/planning-with-files/scripts/new_plan.sh +65 -0
- package/.codex/skills/prd/SKILL.md +235 -0
- package/.codex/skills/ralph-loop/SKILL.md +46 -0
- package/.codex/skills/ralph-loop/agents/openai.yaml +4 -0
- package/.codex/skills/ralph-loop/references/failure-triage.md +32 -0
- package/.codex/skills/ralph-loop/scripts/loop_until_success.sh +97 -0
- package/.codex/skills/sdd/SKILL.md +184 -0
- package/.codex/skills/sdd/agents/openai.yaml +4 -0
- package/.codex/skills/sdd/references/section-map.md +67 -0
- package/.dockerignore +8 -0
- package/.env.example +50 -0
- package/.gitignore +16 -0
- package/AGENTS.md +78 -0
- package/README.md +83 -47
- package/SDD_SKILL.md +589 -0
- package/bin/agentic-dev.mjs +97 -0
- package/client/admin/.dockerignore +3 -0
- package/client/admin/.env.example +1 -0
- package/client/admin/Dockerfile +16 -0
- package/client/admin/Dockerfile.dev +18 -0
- package/client/admin/README.md +20 -0
- package/client/admin/index.html +12 -0
- package/client/admin/package.json +41 -0
- package/client/admin/postcss.config.js +6 -0
- package/client/admin/scripts/ui-parity-admin-adapter.mjs +65 -0
- package/client/admin/src/api/alerts.ts +33 -0
- package/client/admin/src/api/client.ts +71 -0
- package/client/admin/src/api/orders.ts +33 -0
- package/client/admin/src/api/support.ts +11 -0
- package/client/admin/src/app/App.tsx +23 -0
- package/client/admin/src/auth/AuthProvider.tsx +122 -0
- package/client/admin/src/auth/ProtectedRoute.tsx +22 -0
- package/client/admin/src/auth/auth-client.ts +38 -0
- package/client/admin/src/auth/types.ts +18 -0
- package/client/admin/src/components/AdminNotificationsDrawer.tsx +162 -0
- package/client/admin/src/components/AdminShell.tsx +76 -0
- package/client/admin/src/components/ui/button.tsx +34 -0
- package/client/admin/src/components/ui/input.tsx +21 -0
- package/client/admin/src/lib/cn.ts +6 -0
- package/client/admin/src/lib/specRouteCatalog.json +30 -0
- package/client/admin/src/lib/specScreens.json +22 -0
- package/client/admin/src/main.tsx +17 -0
- package/client/admin/src/pages/AdminDashboardPage.tsx +171 -0
- package/client/admin/src/pages/AdminLoginPage.tsx +75 -0
- package/client/admin/src/pages/AdminQueuePage.tsx +107 -0
- package/client/admin/src/pages/AdminSupportPage.tsx +61 -0
- package/client/admin/src/styles/globals.css +17 -0
- package/client/admin/src/theme-vars.ts +18 -0
- package/client/admin/src/theme.ts +25 -0
- package/client/admin/src/vite-env.d.ts +1 -0
- package/client/admin/tailwind.config.js +8 -0
- package/client/admin/tsconfig.json +25 -0
- package/client/admin/vite.config.ts +12 -0
- package/client/landing/.dockerignore +3 -0
- package/client/landing/.env.example +1 -0
- package/client/landing/Dockerfile +16 -0
- package/client/landing/Dockerfile.dev +18 -0
- package/client/landing/README.md +18 -0
- package/client/landing/index.html +12 -0
- package/client/landing/package.json +41 -0
- package/client/landing/postcss.config.js +6 -0
- package/client/landing/scripts/ui-parity-landing-adapter.mjs +65 -0
- package/client/landing/src/App.tsx +21 -0
- package/client/landing/src/api/catalog.ts +30 -0
- package/client/landing/src/api/client.ts +30 -0
- package/client/landing/src/auth/AuthProvider.tsx +122 -0
- package/client/landing/src/auth/ProtectedRoute.tsx +22 -0
- package/client/landing/src/auth/auth-client.ts +38 -0
- package/client/landing/src/auth/types.ts +18 -0
- package/client/landing/src/components/LandingShell.tsx +34 -0
- package/client/landing/src/lib/specRouteCatalog.json +23 -0
- package/client/landing/src/lib/specScreens.json +17 -0
- package/client/landing/src/main.tsx +17 -0
- package/client/landing/src/pages/LandingHomePage.tsx +215 -0
- package/client/landing/src/pages/LandingLoginPage.tsx +90 -0
- package/client/landing/src/pages/LandingWorkspacePage.tsx +126 -0
- package/client/landing/src/styles/globals.css +17 -0
- package/client/landing/src/theme-vars.ts +16 -0
- package/client/landing/src/theme.ts +21 -0
- package/client/landing/src/vite-env.d.ts +1 -0
- package/client/landing/tailwind.config.js +8 -0
- package/client/landing/tsconfig.json +25 -0
- package/client/landing/vite.config.ts +12 -0
- package/client/mobile/.dockerignore +2 -0
- package/client/mobile/.env.example +1 -0
- package/client/mobile/Dockerfile +16 -0
- package/client/mobile/Dockerfile.dev +18 -0
- package/client/mobile/README.md +19 -0
- package/client/mobile/index.html +12 -0
- package/client/mobile/package.json +42 -0
- package/client/mobile/postcss.config.js +6 -0
- package/client/mobile/scripts/ui-parity-mobile-adapter.mjs +67 -0
- package/client/mobile/src/App.tsx +1 -0
- package/client/mobile/src/api/client.ts +62 -0
- package/client/mobile/src/api/fulfillment.ts +55 -0
- package/client/mobile/src/api/shipping.ts +56 -0
- package/client/mobile/src/app/App.tsx +23 -0
- package/client/mobile/src/auth/AuthProvider.tsx +122 -0
- package/client/mobile/src/auth/ProtectedRoute.tsx +27 -0
- package/client/mobile/src/auth/auth-client.ts +38 -0
- package/client/mobile/src/auth/types.ts +18 -0
- package/client/mobile/src/components/InShell.tsx +74 -0
- package/client/mobile/src/components/ui/button.tsx +35 -0
- package/client/mobile/src/components/ui/card.tsx +15 -0
- package/client/mobile/src/components/ui/input.tsx +21 -0
- package/client/mobile/src/lib/cn.ts +6 -0
- package/client/mobile/src/lib/specRouteCatalog.json +26 -0
- package/client/mobile/src/lib/specScreens.json +22 -0
- package/client/mobile/src/lib/useSpeechRecognitionInput.ts +271 -0
- package/client/mobile/src/main.tsx +17 -0
- package/client/mobile/src/pages/DashboardPage.tsx +172 -0
- package/client/mobile/src/pages/FulfillmentPage.tsx +138 -0
- package/client/mobile/src/pages/LoginPage.tsx +74 -0
- package/client/mobile/src/pages/ShippingPage.tsx +338 -0
- package/client/mobile/src/styles/globals.css +23 -0
- package/client/mobile/src/theme-vars.ts +16 -0
- package/client/mobile/src/theme.ts +21 -0
- package/client/mobile/src/vite-env.d.ts +1 -0
- package/client/mobile/tailwind.config.js +8 -0
- package/client/mobile/tsconfig.json +25 -0
- package/client/mobile/vite.config.ts +12 -0
- package/client/platform/.dockerignore +3 -0
- package/client/platform/.env.example +1 -0
- package/client/platform/Dockerfile +16 -0
- package/client/platform/Dockerfile.dev +18 -0
- package/client/platform/README.md +47 -0
- package/client/platform/index.html +12 -0
- package/client/platform/package.json +42 -0
- package/client/platform/postcss.config.js +6 -0
- package/client/platform/scripts/ui-parity-platform-adapter.mjs +66 -0
- package/client/platform/src/api/client.ts +30 -0
- package/client/platform/src/api/orders.ts +42 -0
- package/client/platform/src/app/App.tsx +21 -0
- package/client/platform/src/auth/AuthProvider.tsx +122 -0
- package/client/platform/src/auth/ProtectedRoute.tsx +22 -0
- package/client/platform/src/auth/auth-client.ts +38 -0
- package/client/platform/src/auth/types.ts +18 -0
- package/client/platform/src/components/AppShell.tsx +59 -0
- package/client/platform/src/components/ui/button.tsx +35 -0
- package/client/platform/src/components/ui/card.tsx +7 -0
- package/client/platform/src/components/ui/input.tsx +21 -0
- package/client/platform/src/lib/cn.ts +6 -0
- package/client/platform/src/lib/specRouteCatalog.json +23 -0
- package/client/platform/src/lib/specScreens.json +17 -0
- package/client/platform/src/main.tsx +17 -0
- package/client/platform/src/pages/DashboardPage.tsx +158 -0
- package/client/platform/src/pages/LoginPage.tsx +72 -0
- package/client/platform/src/pages/OrdersPage.tsx +123 -0
- package/client/platform/src/styles/globals.css +17 -0
- package/client/platform/src/theme-vars.ts +18 -0
- package/client/platform/src/theme.ts +25 -0
- package/client/platform/src/vite-env.d.ts +1 -0
- package/client/platform/tailwind.config.js +8 -0
- package/client/platform/tsconfig.json +25 -0
- package/client/platform/vite.config.ts +12 -0
- package/compose.yml +206 -0
- package/infra/compose/.env.dev.example +28 -0
- package/infra/compose/.env.prod.example +29 -0
- package/infra/compose/README.md +35 -0
- package/infra/compose/dev.yml +125 -0
- package/infra/compose/prod.yml +126 -0
- package/infra/terraform/README.md +34 -0
- package/infra/terraform/aws/data/.terraform.lock.hcl +25 -0
- package/infra/terraform/aws/data/README.md +18 -0
- package/infra/terraform/aws/data/main.tf +147 -0
- package/infra/terraform/aws/data/outputs.tf +14 -0
- package/infra/terraform/aws/data/variables.tf +57 -0
- package/infra/terraform/aws/data/versions.tf +10 -0
- package/infra/terraform/aws/domain/.terraform.lock.hcl +25 -0
- package/infra/terraform/aws/domain/README.md +20 -0
- package/infra/terraform/aws/domain/env/dev.tfvars.example +6 -0
- package/infra/terraform/aws/domain/env/prod.tfvars.example +7 -0
- package/infra/terraform/aws/domain/main.tf +149 -0
- package/infra/terraform/aws/domain/outputs.tf +29 -0
- package/infra/terraform/aws/domain/variables.tf +58 -0
- package/infra/terraform/aws/domain/versions.tf +10 -0
- package/infra/terraform/openstack/README.md +38 -0
- package/infra/terraform/openstack/dev/.terraform.lock.hcl +24 -0
- package/infra/terraform/openstack/dev/README.md +18 -0
- package/infra/terraform/openstack/dev/main.tf +49 -0
- package/infra/terraform/openstack/dev/providers.tf +15 -0
- package/infra/terraform/openstack/dev/terraform.tfvars.example +54 -0
- package/infra/terraform/openstack/dev/variables.tf +210 -0
- package/infra/terraform/openstack/dev/versions.tf +10 -0
- package/infra/terraform/openstack/modules/environment_host/main.tf +143 -0
- package/infra/terraform/openstack/modules/environment_host/outputs.tf +25 -0
- package/infra/terraform/openstack/modules/environment_host/templates/docker-host-user-data.sh.tftpl +40 -0
- package/infra/terraform/openstack/modules/environment_host/variables.tf +145 -0
- package/infra/terraform/openstack/modules/environment_host/versions.tf +7 -0
- package/infra/terraform/openstack/prod/.terraform.lock.hcl +24 -0
- package/infra/terraform/openstack/prod/README.md +18 -0
- package/infra/terraform/openstack/prod/main.tf +49 -0
- package/infra/terraform/openstack/prod/providers.tf +15 -0
- package/infra/terraform/openstack/prod/terraform.tfvars.example +55 -0
- package/infra/terraform/openstack/prod/variables.tf +210 -0
- package/infra/terraform/openstack/prod/versions.tf +10 -0
- package/infra/terraform/openstack/server/.terraform.lock.hcl +45 -0
- package/infra/terraform/openstack/server/README.md +47 -0
- package/infra/terraform/openstack/server/main.tf +161 -0
- package/infra/terraform/openstack/server/outputs.tf +30 -0
- package/infra/terraform/openstack/server/providers.tf +30 -0
- package/infra/terraform/openstack/server/templates/server-user-data.sh.tftpl +50 -0
- package/infra/terraform/openstack/server/variables.tf +233 -0
- package/infra/terraform/openstack/server/zz_aspace.auto.tfvars.example.json +29 -0
- package/lib/scaffold.mjs +379 -0
- package/package.json +33 -12
- package/pnpm-workspace.yaml +2 -0
- package/scripts/dev/audit_sdd_build_ast.py +277 -0
- package/sdd/01_planning/01_feature/INDEX.md +16 -0
- package/sdd/01_planning/01_feature/README.md +76 -0
- package/sdd/01_planning/01_feature/alerts_feature_spec.md +55 -0
- package/sdd/01_planning/01_feature/auth_feature_spec.md +57 -0
- package/sdd/01_planning/01_feature/catalog_feature_spec.md +61 -0
- package/sdd/01_planning/01_feature/fulfillment_feature_spec.md +58 -0
- package/sdd/01_planning/01_feature/health_feature_spec.md +52 -0
- package/sdd/01_planning/01_feature/inventory_feature_spec.md +60 -0
- package/sdd/01_planning/01_feature/order_feature_spec.md +63 -0
- package/sdd/01_planning/01_feature/shipping_feature_spec.md +55 -0
- package/sdd/01_planning/01_feature/support_feature_spec.md +53 -0
- package/sdd/01_planning/01_feature/user_feature_spec.md +54 -0
- package/sdd/01_planning/02_screen/INDEX.md +13 -0
- package/sdd/01_planning/02_screen/README.md +41 -0
- package/sdd/01_planning/02_screen/admin_screen_spec.pdf +0 -0
- package/sdd/01_planning/02_screen/assets/README.md +16 -0
- package/sdd/01_planning/02_screen/assets/example/README.md +13 -0
- package/sdd/01_planning/02_screen/landing_screen_spec.pdf +0 -0
- package/sdd/01_planning/02_screen/mobile_screen_spec.pdf +0 -0
- package/sdd/01_planning/02_screen/platform_screen_spec.pdf +0 -0
- package/sdd/01_planning/03_architecture/INDEX.md +9 -0
- package/sdd/01_planning/03_architecture/README.md +25 -0
- package/sdd/01_planning/03_architecture/architecture_document_structure.md +77 -0
- package/sdd/01_planning/03_architecture/backend/README.md +10 -0
- package/sdd/01_planning/03_architecture/frontend/README.md +12 -0
- package/sdd/01_planning/03_architecture/infra/README.md +10 -0
- package/sdd/01_planning/03_architecture/tech-research/README.md +4 -0
- package/sdd/01_planning/03_architecture/templates_system_architecture.md +84 -0
- package/sdd/01_planning/04_data/INDEX.md +4 -0
- package/sdd/01_planning/04_data/README.md +10 -0
- package/sdd/01_planning/04_data/templates_data_modeling.md +119 -0
- package/sdd/01_planning/05_api/README.md +12 -0
- package/sdd/01_planning/05_api/templates_api_contract.md +90 -0
- package/sdd/01_planning/06_iac/README.md +11 -0
- package/sdd/01_planning/06_iac/templates_runtime_and_cicd_baseline.md +46 -0
- package/sdd/01_planning/07_integration/README.md +11 -0
- package/sdd/01_planning/07_integration/templates_frontend_api_integration.md +46 -0
- package/sdd/01_planning/08_nonfunctional/README.md +7 -0
- package/sdd/01_planning/09_security/README.md +7 -0
- package/sdd/01_planning/10_test/README.md +12 -0
- package/sdd/01_planning/10_test/templates_test_strategy.md +60 -0
- package/sdd/01_planning/INDEX.md +19 -0
- package/sdd/01_planning/README.md +17 -0
- package/sdd/02_plan/01_feature/README.md +34 -0
- package/sdd/02_plan/01_feature/_feature_todo_template.md +29 -0
- package/sdd/02_plan/02_screen/INDEX.md +19 -0
- package/sdd/02_plan/02_screen/README.md +39 -0
- package/sdd/02_plan/02_screen/_screen_todo_template.md +60 -0
- package/sdd/02_plan/03_architecture/README.md +23 -0
- package/sdd/02_plan/03_architecture/architecture_document_governance.md +40 -0
- package/sdd/02_plan/03_architecture/build_ast_runtime_tree_governance.md +53 -0
- package/sdd/02_plan/03_architecture/repository_governance.md +39 -0
- package/sdd/02_plan/03_architecture/runtime_and_structure_governance.md +38 -0
- package/sdd/02_plan/03_architecture/templates-hexagonal-template-architecture.md +9 -0
- package/sdd/02_plan/03_architecture/toolchain_governance.md +98 -0
- package/sdd/02_plan/04_data/README.md +5 -0
- package/sdd/02_plan/05_api/README.md +5 -0
- package/sdd/02_plan/06_iac/README.md +11 -0
- package/sdd/02_plan/06_iac/dev_runtime_delivery.md +36 -0
- package/sdd/02_plan/06_iac/template_runtime_delivery.md +50 -0
- package/sdd/02_plan/07_integration/README.md +5 -0
- package/sdd/02_plan/07_integration/frontend_live_integration.md +31 -0
- package/sdd/02_plan/08_nonfunctional/README.md +5 -0
- package/sdd/02_plan/08_nonfunctional/repository_hygiene.md +26 -0
- package/sdd/02_plan/09_security/README.md +5 -0
- package/sdd/02_plan/10_test/README.md +11 -0
- package/sdd/02_plan/10_test/regression_verification.md +39 -0
- package/sdd/02_plan/10_test/templates/README.md +8 -0
- package/sdd/02_plan/10_test/templates/ui_parity_platform_contract.template.yaml +23 -0
- package/sdd/02_plan/10_test/verification_strategy.md +43 -0
- package/sdd/02_plan/99_generated/from_planning/ui_parity/.gitkeep +1 -0
- package/sdd/02_plan/README.md +40 -0
- package/sdd/03_build/01_feature/README.md +20 -0
- package/sdd/03_build/01_feature/domain/README.md +3 -0
- package/sdd/03_build/01_feature/domain/account_and_access.md +20 -0
- package/sdd/03_build/01_feature/domain/catalog_and_inventory.md +20 -0
- package/sdd/03_build/01_feature/domain/ordering_and_fulfillment.md +21 -0
- package/sdd/03_build/01_feature/domain/support_and_observability.md +21 -0
- package/sdd/03_build/01_feature/domain_surfaces.md +28 -0
- package/sdd/03_build/01_feature/service/README.md +3 -0
- package/sdd/03_build/01_feature/service/admin_surface.md +15 -0
- package/sdd/03_build/01_feature/service/landing_surface.md +13 -0
- package/sdd/03_build/01_feature/service/mobile_surface.md +14 -0
- package/sdd/03_build/01_feature/service/platform_surface.md +14 -0
- package/sdd/03_build/02_screen/README.md +25 -0
- package/sdd/03_build/02_screen/_screen_build_template.md +26 -0
- package/sdd/03_build/02_screen/admin/README.md +5 -0
- package/sdd/03_build/02_screen/landing/README.md +5 -0
- package/sdd/03_build/02_screen/mobile/README.md +5 -0
- package/sdd/03_build/02_screen/platform/README.md +5 -0
- package/sdd/03_build/03_architecture/README.md +10 -0
- package/sdd/03_build/03_architecture/architecture_document_governance.md +30 -0
- package/sdd/03_build/03_architecture/build_ast_runtime_tree_governance.md +24 -0
- package/sdd/03_build/03_architecture/repository_governance.md +18 -0
- package/sdd/03_build/03_architecture/toolchain_governance.md +36 -0
- package/sdd/03_build/06_iac/README.md +3 -0
- package/sdd/03_build/06_iac/dev_runtime_delivery.md +10 -0
- package/sdd/03_build/06_iac/template_runtime_delivery.md +49 -0
- package/sdd/03_build/07_integration/README.md +3 -0
- package/sdd/03_build/07_integration/frontend_live_integration.md +11 -0
- package/sdd/03_build/08_nonfunctional/README.md +3 -0
- package/sdd/03_build/08_nonfunctional/repository_hygiene.md +10 -0
- package/sdd/03_build/10_test/README.md +9 -0
- package/sdd/03_build/10_test/regression_verification.md +16 -0
- package/sdd/03_build/10_test/verification_harness.md +11 -0
- package/sdd/03_build/README.md +35 -0
- package/sdd/04_verify/01_feature/README.md +5 -0
- package/sdd/04_verify/01_feature/domain_verification.md +14 -0
- package/sdd/04_verify/01_feature/service_verification.md +22 -0
- package/sdd/04_verify/02_screen/README.md +6 -0
- package/sdd/04_verify/02_screen/_screen_verify_template.md +20 -0
- package/sdd/04_verify/02_screen/admin/README.md +4 -0
- package/sdd/04_verify/02_screen/landing/README.md +4 -0
- package/sdd/04_verify/02_screen/mobile/README.md +4 -0
- package/sdd/04_verify/02_screen/platform/README.md +4 -0
- package/sdd/04_verify/03_architecture/README.md +10 -0
- package/sdd/04_verify/03_architecture/architecture_document_governance.md +15 -0
- package/sdd/04_verify/03_architecture/build_ast_runtime_tree_governance.md +28 -0
- package/sdd/04_verify/03_architecture/repository_governance.md +16 -0
- package/sdd/04_verify/03_architecture/toolchain_governance.md +58 -0
- package/sdd/04_verify/06_iac/README.md +3 -0
- package/sdd/04_verify/06_iac/dev_runtime_delivery.md +10 -0
- package/sdd/04_verify/06_iac/template_runtime_delivery.md +42 -0
- package/sdd/04_verify/07_integration/README.md +3 -0
- package/sdd/04_verify/07_integration/frontend_live_integration.md +16 -0
- package/sdd/04_verify/08_nonfunctional/README.md +3 -0
- package/sdd/04_verify/08_nonfunctional/repository_hygiene.md +14 -0
- package/sdd/04_verify/10_test/README.md +9 -0
- package/sdd/04_verify/10_test/regression_verification.md +16 -0
- package/sdd/04_verify/10_test/ui_parity/README.md +4 -0
- package/sdd/04_verify/10_test/ui_parity/loop_runs/.gitkeep +0 -0
- package/sdd/04_verify/10_test/ui_parity/reference/.gitkeep +0 -0
- package/sdd/04_verify/10_test/ui_parity/staged_runs/.gitkeep +0 -0
- package/sdd/04_verify/10_test/verification_harness.md +17 -0
- package/sdd/04_verify/README.md +22 -0
- package/sdd/05_operate/01_runbooks/.gitkeep +1 -0
- package/sdd/05_operate/01_runbooks/README.md +4 -0
- package/sdd/05_operate/02_delivery_status/README.md +4 -0
- package/sdd/05_operate/02_delivery_status/service_status.md +16 -0
- package/sdd/05_operate/README.md +12 -0
- package/sdd/99_toolchain/01_automation/.gitkeep +1 -0
- package/sdd/99_toolchain/01_automation/README.md +76 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/analyze_proof_results.py +132 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/analyze_route_gap.py +85 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/assets/repo-contract.template.json +75 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/bootstrap_frontend_parity.sh +84 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/init_frontend_parity.sh +33 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/init_repo_contract.sh +51 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/repo-contract.json +76 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/resolve_frontend_target.py +52 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/resolve_repo_contract.py +56 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/run_frontend_target.sh +100 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/run_repo_phase.sh +140 -0
- package/sdd/99_toolchain/01_automation/agentic-dev/validate_json_schema.py +39 -0
- package/sdd/99_toolchain/01_automation/agentic-parity-harness-design.md +291 -0
- package/sdd/99_toolchain/01_automation/assets/admin_screen_capture/dashboard.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/admin_screen_capture/login.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/admin_screen_capture/queue.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/admin_screen_capture/support.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/landing_screen_capture/home.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/landing_screen_capture/login.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/landing_screen_capture/workspace.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/mobile_screen_capture/dashboard.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/mobile_screen_capture/fulfillment.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/mobile_screen_capture/login.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/platform_screen_capture/dashboard.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/platform_screen_capture/login.png +0 -0
- package/sdd/99_toolchain/01_automation/assets/platform_screen_capture/orders.png +0 -0
- package/sdd/99_toolchain/01_automation/build_asset_recipes.py +10 -0
- package/sdd/99_toolchain/01_automation/build_screen_spec_pdf.py +427 -0
- package/sdd/99_toolchain/01_automation/capture_screen_assets.mjs +148 -0
- package/sdd/99_toolchain/01_automation/harness-layout.md +34 -0
- package/sdd/99_toolchain/01_automation/parity-execution-tooling-design.md +319 -0
- package/sdd/99_toolchain/01_automation/playwright_exactness_manifest.py +21 -0
- package/sdd/99_toolchain/01_automation/run_playwright_exactness.py +87 -0
- package/sdd/99_toolchain/01_automation/screen_spec_manifest.py +321 -0
- package/sdd/99_toolchain/01_automation/spec_asset_builder.py +274 -0
- package/sdd/99_toolchain/01_automation/ui-contract-projection.md +79 -0
- package/sdd/99_toolchain/01_automation/ui-parity/README.md +60 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/extract-reference-pages.mjs +2 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/materialize-reference-assets.mjs +58 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/normalize-reference-assets.mjs +2 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/route-gap-report.mjs +187 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/run-proof.mjs +50 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/scaffold-contract.mjs +62 -0
- package/sdd/99_toolchain/01_automation/ui-parity/cli/upload-parity1.mjs +2 -0
- package/sdd/99_toolchain/01_automation/ui-parity/contracts/collector-metadata.schema.json +33 -0
- package/sdd/99_toolchain/01_automation/ui-parity/contracts/proof-result.schema.json +76 -0
- package/sdd/99_toolchain/01_automation/ui-parity/contracts/route-gap-report.schema.json +95 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/capture-runner.mjs +55 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/load-adapter.mjs +25 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/load-contract.mjs +81 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/paths.mjs +23 -0
- package/sdd/99_toolchain/01_automation/ui-parity/core/proof-runner.mjs +255 -0
- package/sdd/99_toolchain/01_automation/ui-parity/interfaces/ui-parity-artifact-layout.md +23 -0
- package/sdd/99_toolchain/01_automation/ui-parity/interfaces/ui-parity-proof-interface.md +60 -0
- package/sdd/99_toolchain/01_automation/ui-parity/interfaces/ui-parity-route-gap-interface.md +82 -0
- package/sdd/99_toolchain/01_automation/ui-parity/runtime/playwright-runtime.mjs +16 -0
- package/sdd/99_toolchain/01_automation/ui-parity/runtime/static-runtime.mjs +6 -0
- package/sdd/99_toolchain/02_policies/.gitkeep +1 -0
- package/sdd/99_toolchain/02_policies/build-ast-governance-policy.md +22 -0
- package/sdd/99_toolchain/02_policies/compose-runtime-baseline-policy.md +24 -0
- package/sdd/99_toolchain/02_policies/convention-storage-policy.md +26 -0
- package/sdd/99_toolchain/02_policies/main-push-before-dev-deploy-policy.md +27 -0
- package/sdd/99_toolchain/02_policies/otro-orchestration-policy.md +30 -0
- package/sdd/99_toolchain/02_policies/regression-verification-policy.md +22 -0
- package/sdd/99_toolchain/03_templates/.gitkeep +1 -0
- package/sdd/99_toolchain/03_templates/asset_recipe_manifest.example.py +38 -0
- package/sdd/99_toolchain/03_templates/generated_assets/README.md +11 -0
- package/sdd/99_toolchain/03_templates/generated_assets/example-brand-lockup.svg +3 -0
- package/sdd/99_toolchain/03_templates/generated_assets/example-brand-mark.svg +3 -0
- package/sdd/99_toolchain/03_templates/generated_assets/example-brand-wordmark.svg +3 -0
- package/sdd/99_toolchain/03_templates/playwright_exactness_manifest.example.py +21 -0
- package/sdd/99_toolchain/README.md +23 -0
- package/sdd/README.md +21 -0
- package/server/.dockerignore +4 -0
- package/server/.env.example +19 -0
- package/server/Dockerfile +22 -0
- package/server/Dockerfile.dev +19 -0
- package/server/README.md +33 -0
- package/server/__init__.py +0 -0
- package/server/api/__init__.py +1 -0
- package/server/api/http/__init__.py +4 -0
- package/server/api/http/app.py +53 -0
- package/server/api/http/router.py +24 -0
- package/server/config.py +52 -0
- package/server/contexts/__init__.py +12 -0
- package/server/contexts/alerts/__init__.py +1 -0
- package/server/contexts/alerts/application/__init__.py +13 -0
- package/server/contexts/alerts/application/services.py +41 -0
- package/server/contexts/alerts/contracts/__init__.py +3 -0
- package/server/contexts/alerts/contracts/http/__init__.py +3 -0
- package/server/contexts/alerts/contracts/http/router.py +37 -0
- package/server/contexts/alerts/domain/__init__.py +15 -0
- package/server/contexts/alerts/domain/models.py +29 -0
- package/server/contexts/alerts/infrastructure/__init__.py +11 -0
- package/server/contexts/alerts/infrastructure/repository.py +41 -0
- package/server/contexts/auth/__init__.py +1 -0
- package/server/contexts/auth/application/__init__.py +3 -0
- package/server/contexts/auth/application/ports.py +10 -0
- package/server/contexts/auth/application/services.py +64 -0
- package/server/contexts/auth/contracts/__init__.py +4 -0
- package/server/contexts/auth/contracts/http/__init__.py +4 -0
- package/server/contexts/auth/contracts/http/dependencies.py +37 -0
- package/server/contexts/auth/contracts/http/router.py +19 -0
- package/server/contexts/auth/domain/__init__.py +3 -0
- package/server/contexts/auth/domain/models.py +24 -0
- package/server/contexts/auth/infrastructure/__init__.py +4 -0
- package/server/contexts/auth/infrastructure/adapters/memory.py +19 -0
- package/server/contexts/auth/infrastructure/adapters/mongodb.py +24 -0
- package/server/contexts/auth/infrastructure/adapters/sqlalchemy.py +74 -0
- package/server/contexts/auth/infrastructure/repository.py +28 -0
- package/server/contexts/catalog/__init__.py +1 -0
- package/server/contexts/catalog/application/__init__.py +28 -0
- package/server/contexts/catalog/application/ports.py +15 -0
- package/server/contexts/catalog/application/services.py +154 -0
- package/server/contexts/catalog/contracts/__init__.py +3 -0
- package/server/contexts/catalog/contracts/http/__init__.py +3 -0
- package/server/contexts/catalog/contracts/http/router.py +60 -0
- package/server/contexts/catalog/domain/__init__.py +45 -0
- package/server/contexts/catalog/domain/models.py +113 -0
- package/server/contexts/catalog/infrastructure/__init__.py +4 -0
- package/server/contexts/catalog/infrastructure/adapters/memory.py +62 -0
- package/server/contexts/catalog/infrastructure/repository.py +8 -0
- package/server/contexts/fulfillment/__init__.py +1 -0
- package/server/contexts/fulfillment/application/__init__.py +13 -0
- package/server/contexts/fulfillment/application/ports.py +20 -0
- package/server/contexts/fulfillment/application/services.py +85 -0
- package/server/contexts/fulfillment/contracts/__init__.py +3 -0
- package/server/contexts/fulfillment/contracts/http/__init__.py +3 -0
- package/server/contexts/fulfillment/contracts/http/router.py +40 -0
- package/server/contexts/fulfillment/domain/__init__.py +25 -0
- package/server/contexts/fulfillment/domain/models.py +73 -0
- package/server/contexts/fulfillment/infrastructure/__init__.py +13 -0
- package/server/contexts/fulfillment/infrastructure/adapters/memory.py +43 -0
- package/server/contexts/fulfillment/infrastructure/repository.py +97 -0
- package/server/contexts/health/__init__.py +1 -0
- package/server/contexts/health/application/__init__.py +3 -0
- package/server/contexts/health/application/services.py +2 -0
- package/server/contexts/health/contracts/__init__.py +3 -0
- package/server/contexts/health/contracts/http/__init__.py +3 -0
- package/server/contexts/health/contracts/http/router.py +10 -0
- package/server/contexts/inventory/__init__.py +1 -0
- package/server/contexts/inventory/application/__init__.py +28 -0
- package/server/contexts/inventory/application/ports.py +11 -0
- package/server/contexts/inventory/application/services.py +214 -0
- package/server/contexts/inventory/contracts/__init__.py +3 -0
- package/server/contexts/inventory/contracts/http/__init__.py +3 -0
- package/server/contexts/inventory/contracts/http/router.py +82 -0
- package/server/contexts/inventory/domain/__init__.py +33 -0
- package/server/contexts/inventory/domain/models.py +93 -0
- package/server/contexts/inventory/infrastructure/__init__.py +4 -0
- package/server/contexts/inventory/infrastructure/adapters/memory.py +24 -0
- package/server/contexts/inventory/infrastructure/repository.py +8 -0
- package/server/contexts/orders/__init__.py +1 -0
- package/server/contexts/orders/application/__init__.py +19 -0
- package/server/contexts/orders/application/services.py +127 -0
- package/server/contexts/orders/contracts/__init__.py +3 -0
- package/server/contexts/orders/contracts/http/__init__.py +3 -0
- package/server/contexts/orders/contracts/http/router.py +82 -0
- package/server/contexts/orders/domain/__init__.py +29 -0
- package/server/contexts/orders/domain/models.py +95 -0
- package/server/contexts/orders/infrastructure/__init__.py +7 -0
- package/server/contexts/orders/infrastructure/repository.py +104 -0
- package/server/contexts/shipping/__init__.py +1 -0
- package/server/contexts/shipping/application/__init__.py +13 -0
- package/server/contexts/shipping/application/services.py +92 -0
- package/server/contexts/shipping/contracts/__init__.py +3 -0
- package/server/contexts/shipping/contracts/http/__init__.py +3 -0
- package/server/contexts/shipping/contracts/http/router.py +40 -0
- package/server/contexts/shipping/domain/__init__.py +19 -0
- package/server/contexts/shipping/domain/models.py +48 -0
- package/server/contexts/shipping/infrastructure/__init__.py +9 -0
- package/server/contexts/shipping/infrastructure/repository.py +50 -0
- package/server/contexts/support/__init__.py +1 -0
- package/server/contexts/support/application/__init__.py +13 -0
- package/server/contexts/support/application/services.py +29 -0
- package/server/contexts/support/contracts/__init__.py +3 -0
- package/server/contexts/support/contracts/http/__init__.py +3 -0
- package/server/contexts/support/contracts/http/router.py +40 -0
- package/server/contexts/support/domain/__init__.py +13 -0
- package/server/contexts/support/domain/models.py +27 -0
- package/server/contexts/support/infrastructure/__init__.py +11 -0
- package/server/contexts/support/infrastructure/repository.py +70 -0
- package/server/contexts/user/__init__.py +1 -0
- package/server/contexts/user/application/__init__.py +3 -0
- package/server/contexts/user/application/ports.py +11 -0
- package/server/contexts/user/application/services.py +44 -0
- package/server/contexts/user/contracts/__init__.py +3 -0
- package/server/contexts/user/contracts/http/__init__.py +3 -0
- package/server/contexts/user/contracts/http/router.py +26 -0
- package/server/contexts/user/domain/__init__.py +3 -0
- package/server/contexts/user/domain/models.py +22 -0
- package/server/contexts/user/infrastructure/__init__.py +3 -0
- package/server/contexts/user/infrastructure/adapters/memory.py +27 -0
- package/server/contexts/user/infrastructure/adapters/mongodb.py +41 -0
- package/server/contexts/user/infrastructure/adapters/sqlalchemy.py +94 -0
- package/server/contexts/user/infrastructure/factory.py +28 -0
- package/server/data/README.md +24 -0
- package/server/data/bootstrap/alerts.json +38 -0
- package/server/data/bootstrap/auth_accounts.json +18 -0
- package/server/data/bootstrap/catalog_products.json +179 -0
- package/server/data/bootstrap/fulfillment_events.json +5 -0
- package/server/data/bootstrap/fulfillment_notes.json +5 -0
- package/server/data/bootstrap/fulfillment_tasks.json +50 -0
- package/server/data/bootstrap/inventory_levels.json +80 -0
- package/server/data/bootstrap/orders.json +62 -0
- package/server/data/bootstrap/shipping_shipments.json +50 -0
- package/server/data/bootstrap/support_faqs.json +26 -0
- package/server/data/bootstrap/users.json +20 -0
- package/server/data/bootstrap_loader.py +15 -0
- package/server/docker-entrypoint.sh +56 -0
- package/server/main.py +3 -0
- package/server/pyproject.toml +36 -0
- package/server/shared/__init__.py +1 -0
- package/server/shared/application/__init__.py +3 -0
- package/server/shared/application/health.py +2 -0
- package/server/shared/infrastructure/__init__.py +10 -0
- package/server/shared/infrastructure/runtime.py +6 -0
- package/server/shared/infrastructure/security.py +33 -0
- package/server/tests/e2e/test_domain_feature_flows.py +483 -0
- package/server/tests/test_health.py +49 -0
- package/server/uv.lock +1169 -0
- package/bin/agentic-dev.js +0 -9
- package/src/cli.js +0 -37
- package/src/init-command.js +0 -230
- package/src/lib/command.js +0 -14
- package/src/lib/fs.js +0 -92
- package/src/lib/git.js +0 -57
- package/src/lib/github.js +0 -77
- package/src/lib/prompt.js +0 -52
- package/src/lib/system.js +0 -15
- package/src/lib/template.js +0 -143
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { chromium, type Browser, type Page, type ElementHandle } from "playwright";
|
|
2
|
+
import type {
|
|
3
|
+
GetPageRequest,
|
|
4
|
+
GetPageResponse,
|
|
5
|
+
ListPagesResponse,
|
|
6
|
+
ServerInfoResponse,
|
|
7
|
+
ViewportSize,
|
|
8
|
+
} from "./types";
|
|
9
|
+
import { getSnapshotScript } from "./snapshot/browser-script";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Options for waiting for page load
|
|
13
|
+
*/
|
|
14
|
+
export interface WaitForPageLoadOptions {
|
|
15
|
+
/** Maximum time to wait in ms (default: 10000) */
|
|
16
|
+
timeout?: number;
|
|
17
|
+
/** How often to check page state in ms (default: 50) */
|
|
18
|
+
pollInterval?: number;
|
|
19
|
+
/** Minimum time to wait even if page appears ready in ms (default: 100) */
|
|
20
|
+
minimumWait?: number;
|
|
21
|
+
/** Wait for network to be idle (no pending requests) (default: true) */
|
|
22
|
+
waitForNetworkIdle?: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Result of waiting for page load
|
|
27
|
+
*/
|
|
28
|
+
export interface WaitForPageLoadResult {
|
|
29
|
+
/** Whether the page is considered loaded */
|
|
30
|
+
success: boolean;
|
|
31
|
+
/** Document ready state when finished */
|
|
32
|
+
readyState: string;
|
|
33
|
+
/** Number of pending network requests when finished */
|
|
34
|
+
pendingRequests: number;
|
|
35
|
+
/** Time spent waiting in ms */
|
|
36
|
+
waitTimeMs: number;
|
|
37
|
+
/** Whether timeout was reached */
|
|
38
|
+
timedOut: boolean;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface PageLoadState {
|
|
42
|
+
documentReadyState: string;
|
|
43
|
+
documentLoading: boolean;
|
|
44
|
+
pendingRequests: PendingRequest[];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface PendingRequest {
|
|
48
|
+
url: string;
|
|
49
|
+
loadingDurationMs: number;
|
|
50
|
+
resourceType: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Wait for a page to finish loading using document.readyState and performance API.
|
|
55
|
+
*
|
|
56
|
+
* Uses browser-use's approach of:
|
|
57
|
+
* - Checking document.readyState for 'complete'
|
|
58
|
+
* - Monitoring pending network requests via Performance API
|
|
59
|
+
* - Filtering out ads, tracking, and non-critical resources
|
|
60
|
+
* - Graceful timeout handling (continues even if timeout reached)
|
|
61
|
+
*/
|
|
62
|
+
export async function waitForPageLoad(
|
|
63
|
+
page: Page,
|
|
64
|
+
options: WaitForPageLoadOptions = {}
|
|
65
|
+
): Promise<WaitForPageLoadResult> {
|
|
66
|
+
const {
|
|
67
|
+
timeout = 10000,
|
|
68
|
+
pollInterval = 50,
|
|
69
|
+
minimumWait = 100,
|
|
70
|
+
waitForNetworkIdle = true,
|
|
71
|
+
} = options;
|
|
72
|
+
|
|
73
|
+
const startTime = Date.now();
|
|
74
|
+
let lastState: PageLoadState | null = null;
|
|
75
|
+
|
|
76
|
+
// Wait minimum time first
|
|
77
|
+
if (minimumWait > 0) {
|
|
78
|
+
await new Promise((resolve) => setTimeout(resolve, minimumWait));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Poll until ready or timeout
|
|
82
|
+
while (Date.now() - startTime < timeout) {
|
|
83
|
+
try {
|
|
84
|
+
lastState = await getPageLoadState(page);
|
|
85
|
+
|
|
86
|
+
// Check if document is complete
|
|
87
|
+
const documentReady = lastState.documentReadyState === "complete";
|
|
88
|
+
|
|
89
|
+
// Check if network is idle (no pending critical requests)
|
|
90
|
+
const networkIdle = !waitForNetworkIdle || lastState.pendingRequests.length === 0;
|
|
91
|
+
|
|
92
|
+
if (documentReady && networkIdle) {
|
|
93
|
+
return {
|
|
94
|
+
success: true,
|
|
95
|
+
readyState: lastState.documentReadyState,
|
|
96
|
+
pendingRequests: lastState.pendingRequests.length,
|
|
97
|
+
waitTimeMs: Date.now() - startTime,
|
|
98
|
+
timedOut: false,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
} catch {
|
|
102
|
+
// Page may be navigating, continue polling
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
await new Promise((resolve) => setTimeout(resolve, pollInterval));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Timeout reached - return current state
|
|
109
|
+
return {
|
|
110
|
+
success: false,
|
|
111
|
+
readyState: lastState?.documentReadyState ?? "unknown",
|
|
112
|
+
pendingRequests: lastState?.pendingRequests.length ?? 0,
|
|
113
|
+
waitTimeMs: Date.now() - startTime,
|
|
114
|
+
timedOut: true,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Get the current page load state including document ready state and pending requests.
|
|
120
|
+
* Filters out ads, tracking, and non-critical resources that shouldn't block loading.
|
|
121
|
+
*/
|
|
122
|
+
async function getPageLoadState(page: Page): Promise<PageLoadState> {
|
|
123
|
+
const result = await page.evaluate(() => {
|
|
124
|
+
// Access browser globals via globalThis for TypeScript compatibility
|
|
125
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
126
|
+
const g = globalThis as { document?: any; performance?: any };
|
|
127
|
+
/* eslint-enable @typescript-eslint/no-explicit-any */
|
|
128
|
+
const perf = g.performance!;
|
|
129
|
+
const doc = g.document!;
|
|
130
|
+
|
|
131
|
+
const now = perf.now();
|
|
132
|
+
const resources = perf.getEntriesByType("resource");
|
|
133
|
+
const pending: Array<{ url: string; loadingDurationMs: number; resourceType: string }> = [];
|
|
134
|
+
|
|
135
|
+
// Common ad/tracking domains and patterns to filter out
|
|
136
|
+
const adPatterns = [
|
|
137
|
+
"doubleclick.net",
|
|
138
|
+
"googlesyndication.com",
|
|
139
|
+
"googletagmanager.com",
|
|
140
|
+
"google-analytics.com",
|
|
141
|
+
"facebook.net",
|
|
142
|
+
"connect.facebook.net",
|
|
143
|
+
"analytics",
|
|
144
|
+
"ads",
|
|
145
|
+
"tracking",
|
|
146
|
+
"pixel",
|
|
147
|
+
"hotjar.com",
|
|
148
|
+
"clarity.ms",
|
|
149
|
+
"mixpanel.com",
|
|
150
|
+
"segment.com",
|
|
151
|
+
"newrelic.com",
|
|
152
|
+
"nr-data.net",
|
|
153
|
+
"/tracker/",
|
|
154
|
+
"/collector/",
|
|
155
|
+
"/beacon/",
|
|
156
|
+
"/telemetry/",
|
|
157
|
+
"/log/",
|
|
158
|
+
"/events/",
|
|
159
|
+
"/track.",
|
|
160
|
+
"/metrics/",
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
// Non-critical resource types
|
|
164
|
+
const nonCriticalTypes = ["img", "image", "icon", "font"];
|
|
165
|
+
|
|
166
|
+
for (const entry of resources) {
|
|
167
|
+
// Resources with responseEnd === 0 are still loading
|
|
168
|
+
if (entry.responseEnd === 0) {
|
|
169
|
+
const url = entry.name;
|
|
170
|
+
|
|
171
|
+
// Filter out ads and tracking
|
|
172
|
+
const isAd = adPatterns.some((pattern) => url.includes(pattern));
|
|
173
|
+
if (isAd) continue;
|
|
174
|
+
|
|
175
|
+
// Filter out data: URLs and very long URLs
|
|
176
|
+
if (url.startsWith("data:") || url.length > 500) continue;
|
|
177
|
+
|
|
178
|
+
const loadingDuration = now - entry.startTime;
|
|
179
|
+
|
|
180
|
+
// Skip requests loading > 10 seconds (likely stuck/polling)
|
|
181
|
+
if (loadingDuration > 10000) continue;
|
|
182
|
+
|
|
183
|
+
const resourceType = entry.initiatorType || "unknown";
|
|
184
|
+
|
|
185
|
+
// Filter out non-critical resources loading > 3 seconds
|
|
186
|
+
if (nonCriticalTypes.includes(resourceType) && loadingDuration > 3000) continue;
|
|
187
|
+
|
|
188
|
+
// Filter out image URLs even if type is unknown
|
|
189
|
+
const isImageUrl = /\.(jpg|jpeg|png|gif|webp|svg|ico)(\?|$)/i.test(url);
|
|
190
|
+
if (isImageUrl && loadingDuration > 3000) continue;
|
|
191
|
+
|
|
192
|
+
pending.push({
|
|
193
|
+
url,
|
|
194
|
+
loadingDurationMs: Math.round(loadingDuration),
|
|
195
|
+
resourceType,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return {
|
|
201
|
+
documentReadyState: doc.readyState,
|
|
202
|
+
documentLoading: doc.readyState !== "complete",
|
|
203
|
+
pendingRequests: pending,
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/** Server mode information */
|
|
211
|
+
export interface ServerInfo {
|
|
212
|
+
wsEndpoint: string;
|
|
213
|
+
mode: "launch" | "extension";
|
|
214
|
+
extensionConnected?: boolean;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Options for creating or getting a page
|
|
219
|
+
*/
|
|
220
|
+
export interface PageOptions {
|
|
221
|
+
/** Viewport size for new pages */
|
|
222
|
+
viewport?: ViewportSize;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
export interface DevBrowserClient {
|
|
226
|
+
page: (name: string, options?: PageOptions) => Promise<Page>;
|
|
227
|
+
list: () => Promise<string[]>;
|
|
228
|
+
close: (name: string) => Promise<void>;
|
|
229
|
+
disconnect: () => Promise<void>;
|
|
230
|
+
/**
|
|
231
|
+
* Get AI-friendly ARIA snapshot for a page.
|
|
232
|
+
* Returns YAML format with refs like [ref=e1], [ref=e2].
|
|
233
|
+
* Refs are stored on window.__devBrowserRefs for cross-connection persistence.
|
|
234
|
+
*/
|
|
235
|
+
getAISnapshot: (name: string) => Promise<string>;
|
|
236
|
+
/**
|
|
237
|
+
* Get an element handle by its ref from the last getAISnapshot call.
|
|
238
|
+
* Refs persist across Playwright connections.
|
|
239
|
+
*/
|
|
240
|
+
selectSnapshotRef: (name: string, ref: string) => Promise<ElementHandle | null>;
|
|
241
|
+
/**
|
|
242
|
+
* Get server information including mode and extension connection status.
|
|
243
|
+
*/
|
|
244
|
+
getServerInfo: () => Promise<ServerInfo>;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export async function connect(serverUrl = "http://localhost:9222"): Promise<DevBrowserClient> {
|
|
248
|
+
let browser: Browser | null = null;
|
|
249
|
+
let wsEndpoint: string | null = null;
|
|
250
|
+
let connectingPromise: Promise<Browser> | null = null;
|
|
251
|
+
|
|
252
|
+
async function ensureConnected(): Promise<Browser> {
|
|
253
|
+
// Return existing connection if still active
|
|
254
|
+
if (browser && browser.isConnected()) {
|
|
255
|
+
return browser;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// If already connecting, wait for that connection (prevents race condition)
|
|
259
|
+
if (connectingPromise) {
|
|
260
|
+
return connectingPromise;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Start new connection with mutex
|
|
264
|
+
connectingPromise = (async () => {
|
|
265
|
+
try {
|
|
266
|
+
// Fetch wsEndpoint from server
|
|
267
|
+
const res = await fetch(serverUrl);
|
|
268
|
+
if (!res.ok) {
|
|
269
|
+
throw new Error(`Server returned ${res.status}: ${await res.text()}`);
|
|
270
|
+
}
|
|
271
|
+
const info = (await res.json()) as ServerInfoResponse;
|
|
272
|
+
wsEndpoint = info.wsEndpoint;
|
|
273
|
+
|
|
274
|
+
// Connect to the browser via CDP
|
|
275
|
+
browser = await chromium.connectOverCDP(wsEndpoint);
|
|
276
|
+
return browser;
|
|
277
|
+
} finally {
|
|
278
|
+
connectingPromise = null;
|
|
279
|
+
}
|
|
280
|
+
})();
|
|
281
|
+
|
|
282
|
+
return connectingPromise;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Find page by CDP targetId - more reliable than JS globals
|
|
286
|
+
async function findPageByTargetId(b: Browser, targetId: string): Promise<Page | null> {
|
|
287
|
+
for (const context of b.contexts()) {
|
|
288
|
+
for (const page of context.pages()) {
|
|
289
|
+
let cdpSession;
|
|
290
|
+
try {
|
|
291
|
+
cdpSession = await context.newCDPSession(page);
|
|
292
|
+
const { targetInfo } = await cdpSession.send("Target.getTargetInfo");
|
|
293
|
+
if (targetInfo.targetId === targetId) {
|
|
294
|
+
return page;
|
|
295
|
+
}
|
|
296
|
+
} catch (err) {
|
|
297
|
+
// Only ignore "target closed" errors, log unexpected ones
|
|
298
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
299
|
+
if (!msg.includes("Target closed") && !msg.includes("Session closed")) {
|
|
300
|
+
console.warn(`Unexpected error checking page target: ${msg}`);
|
|
301
|
+
}
|
|
302
|
+
} finally {
|
|
303
|
+
if (cdpSession) {
|
|
304
|
+
try {
|
|
305
|
+
await cdpSession.detach();
|
|
306
|
+
} catch {
|
|
307
|
+
// Ignore detach errors - session may already be closed
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return null;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Helper to get a page by name (used by multiple methods)
|
|
317
|
+
async function getPage(name: string, options?: PageOptions): Promise<Page> {
|
|
318
|
+
// Request the page from server (creates if doesn't exist)
|
|
319
|
+
const res = await fetch(`${serverUrl}/pages`, {
|
|
320
|
+
method: "POST",
|
|
321
|
+
headers: { "Content-Type": "application/json" },
|
|
322
|
+
body: JSON.stringify({ name, viewport: options?.viewport } satisfies GetPageRequest),
|
|
323
|
+
});
|
|
324
|
+
|
|
325
|
+
if (!res.ok) {
|
|
326
|
+
throw new Error(`Failed to get page: ${await res.text()}`);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
const pageInfo = (await res.json()) as GetPageResponse & { url?: string };
|
|
330
|
+
const { targetId } = pageInfo;
|
|
331
|
+
|
|
332
|
+
// Connect to browser
|
|
333
|
+
const b = await ensureConnected();
|
|
334
|
+
|
|
335
|
+
// Check if we're in extension mode
|
|
336
|
+
const infoRes = await fetch(serverUrl);
|
|
337
|
+
const info = (await infoRes.json()) as { mode?: string };
|
|
338
|
+
const isExtensionMode = info.mode === "extension";
|
|
339
|
+
|
|
340
|
+
if (isExtensionMode) {
|
|
341
|
+
// In extension mode, DON'T use findPageByTargetId as it corrupts page state
|
|
342
|
+
// Instead, find page by URL or use the only available page
|
|
343
|
+
const allPages = b.contexts().flatMap((ctx) => ctx.pages());
|
|
344
|
+
|
|
345
|
+
if (allPages.length === 0) {
|
|
346
|
+
throw new Error(`No pages available in browser`);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (allPages.length === 1) {
|
|
350
|
+
return allPages[0]!;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// Multiple pages - try to match by URL if available
|
|
354
|
+
if (pageInfo.url) {
|
|
355
|
+
const matchingPage = allPages.find((p) => p.url() === pageInfo.url);
|
|
356
|
+
if (matchingPage) {
|
|
357
|
+
return matchingPage;
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
// Fall back to first page
|
|
362
|
+
if (!allPages[0]) {
|
|
363
|
+
throw new Error(`No pages available in browser`);
|
|
364
|
+
}
|
|
365
|
+
return allPages[0];
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// In launch mode, use the original targetId-based lookup
|
|
369
|
+
const page = await findPageByTargetId(b, targetId);
|
|
370
|
+
if (!page) {
|
|
371
|
+
throw new Error(`Page "${name}" not found in browser contexts`);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return page;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return {
|
|
378
|
+
page: getPage,
|
|
379
|
+
|
|
380
|
+
async list(): Promise<string[]> {
|
|
381
|
+
const res = await fetch(`${serverUrl}/pages`);
|
|
382
|
+
const data = (await res.json()) as ListPagesResponse;
|
|
383
|
+
return data.pages;
|
|
384
|
+
},
|
|
385
|
+
|
|
386
|
+
async close(name: string): Promise<void> {
|
|
387
|
+
const res = await fetch(`${serverUrl}/pages/${encodeURIComponent(name)}`, {
|
|
388
|
+
method: "DELETE",
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
if (!res.ok) {
|
|
392
|
+
throw new Error(`Failed to close page: ${await res.text()}`);
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
|
|
396
|
+
async disconnect(): Promise<void> {
|
|
397
|
+
// Just disconnect the CDP connection - pages persist on server
|
|
398
|
+
if (browser) {
|
|
399
|
+
await browser.close();
|
|
400
|
+
browser = null;
|
|
401
|
+
}
|
|
402
|
+
},
|
|
403
|
+
|
|
404
|
+
async getAISnapshot(name: string): Promise<string> {
|
|
405
|
+
// Get the page
|
|
406
|
+
const page = await getPage(name);
|
|
407
|
+
|
|
408
|
+
// Inject the snapshot script and call getAISnapshot
|
|
409
|
+
const snapshotScript = getSnapshotScript();
|
|
410
|
+
const snapshot = await page.evaluate((script: string) => {
|
|
411
|
+
// Inject script if not already present
|
|
412
|
+
// Note: page.evaluate runs in browser context where window exists
|
|
413
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
414
|
+
const w = globalThis as any;
|
|
415
|
+
if (!w.__devBrowser_getAISnapshot) {
|
|
416
|
+
// eslint-disable-next-line no-eval
|
|
417
|
+
eval(script);
|
|
418
|
+
}
|
|
419
|
+
return w.__devBrowser_getAISnapshot();
|
|
420
|
+
}, snapshotScript);
|
|
421
|
+
|
|
422
|
+
return snapshot;
|
|
423
|
+
},
|
|
424
|
+
|
|
425
|
+
async selectSnapshotRef(name: string, ref: string): Promise<ElementHandle | null> {
|
|
426
|
+
// Get the page
|
|
427
|
+
const page = await getPage(name);
|
|
428
|
+
|
|
429
|
+
// Find the element using the stored refs
|
|
430
|
+
const elementHandle = await page.evaluateHandle((refId: string) => {
|
|
431
|
+
// Note: page.evaluateHandle runs in browser context where globalThis is the window
|
|
432
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
433
|
+
const w = globalThis as any;
|
|
434
|
+
const refs = w.__devBrowserRefs;
|
|
435
|
+
if (!refs) {
|
|
436
|
+
throw new Error("No snapshot refs found. Call getAISnapshot first.");
|
|
437
|
+
}
|
|
438
|
+
const element = refs[refId];
|
|
439
|
+
if (!element) {
|
|
440
|
+
throw new Error(
|
|
441
|
+
`Ref "${refId}" not found. Available refs: ${Object.keys(refs).join(", ")}`
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
return element;
|
|
445
|
+
}, ref);
|
|
446
|
+
|
|
447
|
+
// Check if we got an element
|
|
448
|
+
const element = elementHandle.asElement();
|
|
449
|
+
if (!element) {
|
|
450
|
+
await elementHandle.dispose();
|
|
451
|
+
return null;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return element;
|
|
455
|
+
},
|
|
456
|
+
|
|
457
|
+
async getServerInfo(): Promise<ServerInfo> {
|
|
458
|
+
const res = await fetch(serverUrl);
|
|
459
|
+
if (!res.ok) {
|
|
460
|
+
throw new Error(`Server returned ${res.status}: ${await res.text()}`);
|
|
461
|
+
}
|
|
462
|
+
const info = (await res.json()) as {
|
|
463
|
+
wsEndpoint: string;
|
|
464
|
+
mode?: string;
|
|
465
|
+
extensionConnected?: boolean;
|
|
466
|
+
};
|
|
467
|
+
return {
|
|
468
|
+
wsEndpoint: info.wsEndpoint,
|
|
469
|
+
mode: (info.mode as "launch" | "extension") ?? "launch",
|
|
470
|
+
extensionConnected: info.extensionConnected,
|
|
471
|
+
};
|
|
472
|
+
},
|
|
473
|
+
};
|
|
474
|
+
}
|