antigravity-ide 4.2.1 → 4.3.3
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/.shared/{design-philosophy → core/design-philosophy}/README.md +12 -1
- package/.agent/.shared/{ai-master → technical/ai-master}/README.md +12 -1
- package/.agent/.shared/{api-standards → technical/api-standards}/README.md +12 -1
- package/.agent/.shared/{database-master → technical/database-master}/README.md +12 -2
- package/.agent/.shared/{seo-master → technical/seo-master}/README.md +12 -1
- package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/README.md +12 -1
- package/.agent/ARCHITECTURE.md +16 -10
- package/.agent/ARCHITECTURE.vi.md +8 -8
- package/{GEMINI.md → .agent/GEMINI.md} +4 -5
- package/.agent/RESOURCES.md +6 -1
- package/.agent/agents/backend-specialist.md +154 -19
- package/.agent/agents/browser-subagent.md +45 -0
- package/.agent/agents/cloud-architect.md +108 -189
- package/.agent/agents/debugger.md +83 -182
- package/.agent/agents/documentation-writer.md +125 -72
- package/.agent/agents/frontend-specialist.md +40 -7
- package/.agent/agents/game-developer.md +111 -116
- package/.agent/agents/mobile-developer.md +108 -321
- package/.agent/agents/orchestrator.md +106 -366
- package/.agent/agents/performance-optimizer.md +105 -136
- package/.agent/agents/project-planner.md +132 -39
- package/.agent/agents/quality-inspector.md +136 -32
- package/.agent/agents/security-auditor.md +138 -15
- package/.agent/agents/seo-specialist.md +118 -72
- package/.agent/agents/test-engineer.md +142 -11
- package/.agent/brain/task.md +16 -0
- package/.agent/rules/GEMINI.md +63 -31
- package/.agent/rules/code-quality.md +34 -3
- package/.agent/rules/frontend.md +3 -3
- package/.agent/rules/strict-protocol.md +44 -3
- package/.agent/rules/system-update.md +56 -3
- package/.agent/skills/agent-backend-patterns/SKILL.md +16 -3
- package/.agent/skills/ai-engineer/SKILL.md +29 -16
- package/.agent/skills/api-documenter/SKILL.md +4 -4
- package/.agent/skills/app-builder/SKILL.md +1 -1
- package/.agent/skills/app-builder/tech-stack.md +2 -2
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +39 -79
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +53 -75
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +56 -119
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +61 -94
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +56 -82
- package/.agent/skills/brand-guidelines-anthropic/LICENSE.txt +202 -0
- package/.agent/skills/brand-guidelines-anthropic/SKILL.md +26 -0
- package/.agent/skills/brand-guidelines-anthropic/sub-skills/color-application.md +5 -0
- package/.agent/skills/brand-guidelines-anthropic/sub-skills/colors.md +14 -0
- package/.agent/skills/brand-guidelines-anthropic/sub-skills/font-management.md +6 -0
- package/.agent/skills/brand-guidelines-anthropic/sub-skills/shape-and-accent-colors.md +7 -0
- package/.agent/skills/brand-guidelines-anthropic/sub-skills/smart-font-application.md +6 -0
- package/.agent/skills/brand-guidelines-anthropic/sub-skills/text-styling.md +6 -0
- package/.agent/skills/brand-guidelines-anthropic/sub-skills/typography.md +7 -0
- package/.agent/skills/cloud-architect-master/SKILL.md +9 -4
- package/.agent/skills/cro-expert-kit/SKILL.md +9 -4
- package/.agent/skills/database-migration/SKILL.md +9 -3
- package/.agent/skills/deployment-engineer/SKILL.md +9 -3
- package/.agent/skills/frontend-design/ux-psychology.md +10 -585
- package/.agent/skills/full-stack-scaffold/SKILL.md +4 -4
- package/.agent/skills/game-development/2d-games/SKILL.md +4 -2
- package/.agent/skills/game-development/3d-games/SKILL.md +4 -2
- package/.agent/skills/game-development/SKILL.md +18 -149
- package/.agent/skills/game-development/game-art/SKILL.md +4 -2
- package/.agent/skills/game-development/game-audio/SKILL.md +4 -2
- package/.agent/skills/game-development/game-design/SKILL.md +4 -2
- package/.agent/skills/game-development/mobile-games/SKILL.md +4 -2
- package/.agent/skills/game-development/multiplayer/SKILL.md +4 -2
- package/.agent/skills/game-development/pc-games/SKILL.md +4 -2
- package/.agent/skills/game-development/vr-ar/SKILL.md +4 -2
- package/.agent/skills/game-development/web-games/SKILL.md +4 -2
- package/.agent/skills/geo-fundamentals/SKILL.md +9 -136
- package/.agent/skills/git-collaboration-master/SKILL.md +9 -4
- package/.agent/skills/i18n-localization/SKILL.md +10 -118
- package/.agent/skills/incident-responder/SKILL.md +9 -6
- package/.agent/skills/internal-comms-anthropic/LICENSE.txt +202 -0
- package/.agent/skills/internal-comms-anthropic/SKILL.md +33 -0
- package/.agent/skills/internal-comms-anthropic/examples/3p-updates.md +47 -0
- package/.agent/skills/internal-comms-anthropic/examples/company-newsletter.md +65 -0
- package/.agent/skills/internal-comms-anthropic/examples/faq-answers.md +30 -0
- package/.agent/skills/internal-comms-anthropic/examples/general-comms.md +16 -0
- package/.agent/skills/last30days/tests/__init__.py +1 -0
- package/.agent/skills/last30days/tests/test_cache.py +59 -0
- package/.agent/skills/last30days/tests/test_dates.py +114 -0
- package/.agent/skills/last30days/tests/test_dedupe.py +111 -0
- package/.agent/skills/last30days/tests/test_models.py +135 -0
- package/.agent/skills/last30days/tests/test_normalize.py +138 -0
- package/.agent/skills/last30days/tests/test_render.py +116 -0
- package/.agent/skills/last30days/tests/test_score.py +168 -0
- package/.agent/skills/legacy-modernizer/SKILL.md +9 -4
- package/.agent/skills/lint-and-validate/scripts/lint_runner.py +2 -14
- package/.agent/skills/loki-mode/.github/workflows/claude-code-review.yml +57 -0
- package/.agent/skills/loki-mode/.github/workflows/claude.yml +50 -0
- package/.agent/skills/loki-mode/.github/workflows/release.yml +128 -0
- package/.agent/skills/loki-mode/tests/run-all-tests.sh +78 -0
- package/.agent/skills/loki-mode/tests/test-agent-timeout.sh +348 -0
- package/.agent/skills/loki-mode/tests/test-bootstrap.sh +196 -0
- package/.agent/skills/loki-mode/tests/test-circuit-breaker.sh +389 -0
- package/.agent/skills/loki-mode/tests/test-state-recovery.sh +393 -0
- package/.agent/skills/loki-mode/tests/test-task-queue.sh +396 -0
- package/.agent/skills/loki-mode/tests/test-wrapper.sh +314 -0
- package/.agent/skills/mcp-builder/SKILL.md +21 -164
- package/.agent/skills/mobile-design/SKILL.md +21 -369
- package/.agent/skills/mobile-design/mobile-performance.md +1 -1
- package/.agent/skills/modern-web-architect/SKILL.md +12 -6
- package/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +1 -1
- package/.agent/skills/penetration-tester-master/SKILL.md +9 -4
- package/.agent/skills/performance-engineer/SKILL.md +4 -5
- package/.agent/skills/production-code-audit/SKILL.md +6 -0
- package/.agent/skills/rust-pro/SKILL.md +0 -177
- package/.agent/skills/security-auditor/SKILL.md +35 -27
- package/.agent/skills/seo-expert-kit/SKILL.md +9 -4
- package/.agent/skills/shopify-development/scripts/tests/test_shopify_init.py +379 -0
- package/.agent/skills/tdd-master-workflow/SKILL.md +9 -3
- package/.agent/workflows/audit.md +30 -16
- package/.agent/workflows/brainstorm.md +33 -96
- package/.agent/workflows/create.md +37 -45
- package/.agent/workflows/debug.md +45 -84
- package/.agent/workflows/deploy.md +33 -158
- package/.agent/workflows/document.md +38 -15
- package/.agent/workflows/enhance.md +33 -48
- package/.agent/workflows/monitor.md +35 -14
- package/.agent/workflows/orchestrate.md +33 -218
- package/.agent/workflows/plan.md +39 -70
- package/.agent/workflows/security.md +35 -14
- package/.agent/workflows/seo.md +39 -16
- package/.agent/workflows/status.md +33 -72
- package/.agent/workflows/test.md +30 -127
- package/.agent/workflows/ui-ux-pro-max.md +24 -283
- package/LICENSE +22 -8
- package/README.md +105 -72
- package/README.vi.md +93 -110
- package/cli/create.js +275 -413
- package/cli/index.js +36 -24
- package/cli/lib/auto-update.js +14 -21
- package/cli/logic/product-skills.js +58 -0
- package/cli/logic/skill-definitions.js +0 -39
- package/cli/prompts.js +151 -145
- package/cli/skills/browser-subagent-core/SKILL.md +22 -0
- package/cli/tools/browser.js +75 -0
- package/cli/ui/dashboard.js +48 -0
- package/docs/AGENTS_GUIDE.vi.md +39 -45
- package/docs/CONTRIBUTING.vi.md +12 -3
- package/docs/{GEMINI_GUIDE.md → GEMINI_USAGE.md} +6 -6
- package/docs/GLOSSARY.vi.md +49 -30
- package/docs/HOW_ANTIGRAVITY_THINKS.vi.md +1 -1
- package/docs/OPERATIONAL_FLOW.vi.md +15 -0
- package/docs/{PUBLISHING.md → PUBLISHING_GUIDE.md} +31 -3
- package/docs/RULES_GUIDE.vi.md +67 -31
- package/docs/SHARED_LIBRARY_GUIDE.vi.md +18 -22
- package/docs/SKILLS_GUIDE.vi.md +119 -32
- package/docs/TROUBLESHOOTING.vi.md +10 -2
- package/docs/WORKFLOW_GUIDE.vi.md +57 -9
- package/package.json +32 -8
- package/setup.js +147 -114
- package/.agent/.shared/compliance/README.md +0 -19
- package/.agent/.shared/design-system/README.md +0 -18
- package/.agent/.shared/domain-blueprints/README.md +0 -18
- package/.agent/.shared/dx-toolkit/README.md +0 -19
- package/.agent/.shared/i18n-master/README.md +0 -18
- package/.agent/.shared/infra-blueprints/README.md +0 -18
- package/.agent/.shared/metrics/README.md +0 -17
- package/.agent/.shared/resilience-patterns/README.md +0 -19
- package/.agent/.shared/security-armor/README.md +0 -25
- package/.agent/.shared/testing-master/README.md +0 -20
- package/.agent/.shared/vitals-templates/README.md +0 -18
- package/.agent/agents/accessibility-expert.md +0 -22
- package/.agent/agents/api-architect.md +0 -22
- package/.agent/agents/backend-specialist.eco.md +0 -19
- package/.agent/agents/backend-specialist.instant.md +0 -19
- package/.agent/agents/codebase-expert.md +0 -23
- package/.agent/agents/compliance-expert.md +0 -22
- package/.agent/agents/data-scientist.md +0 -22
- package/.agent/agents/debugger.eco.md +0 -20
- package/.agent/agents/debugger.instant.md +0 -20
- package/.agent/agents/deep-thinker.ultra.md +0 -23
- package/.agent/agents/devex-optimizer.md +0 -22
- package/.agent/agents/devops-architect.md +0 -22
- package/.agent/agents/frontend-specialist.eco.md +0 -19
- package/.agent/agents/frontend-specialist.instant.md +0 -19
- package/.agent/agents/growth-engineer.md +0 -22
- package/.agent/agents/i18n-specialist.md +0 -21
- package/.agent/agents/legacy-modernizer.md +0 -22
- package/.agent/agents/microservices-specialist.md +0 -22
- package/.agent/agents/motion-designer.md +0 -22
- package/.agent/agents/orchestrator.creative.md +0 -28
- package/.agent/agents/orchestrator.eco.md +0 -29
- package/.agent/agents/orchestrator.instant.md +0 -29
- package/.agent/agents/orchestrator.ultra.md +0 -28
- package/.agent/agents/performance-benchmarker.md +0 -22
- package/.agent/agents/project-planner.eco.md +0 -19
- package/.agent/agents/project-planner.instant.md +0 -19
- package/.agent/agents/security-pentester.md +0 -22
- package/.agent/agents/serverless-expert.md +0 -22
- package/.agent/fastcode_index.json +0 -1038
- package/.agent/mcp_config.json +0 -24
- package/.agent/rules/GEMINI.eco.md +0 -37
- package/.agent/rules/GEMINI.instant.md +0 -37
- package/.agent/rules/api-spec.md +0 -28
- package/.agent/rules/database.md +0 -24
- package/.agent/rules/devops.md +0 -23
- package/.agent/rules/growth-strategy.md +0 -22
- package/.agent/rules/logging-monitoring.md +0 -22
- package/.agent/rules/quality-assurance.md +0 -22
- package/.agent/rules/system-reasoning.md +0 -20
- package/.agent/rules/ui-design.md +0 -23
- package/.agent/rules/ux-patterns.md +0 -23
- package/.agent/scripts/auto_preview.py +0 -148
- package/.agent/scripts/checklist.py +0 -252
- package/.agent/scripts/session_manager.py +0 -120
- package/.agent/scripts/simulation_install.js +0 -59
- package/.agent/scripts/sync_to_global.py +0 -78
- package/.agent/scripts/translate_workflows.py +0 -53
- package/.agent/scripts/verify_all.py +0 -327
- package/.agent/scripts/verify_shared_modules.js +0 -126
- package/.agent/skills/fastcode-search/SKILL.md +0 -46
- package/.agent/skills/fastcode-search/fastcode_config.example.json +0 -17
- package/.agent/skills/frontend-trends-2026/SKILL.md +0 -78
- package/.agent/skills/frontend-trends-2026/formulas/BentoGrid.tsx +0 -42
- package/.agent/skills/frontend-trends-2026/formulas/LiquidCard.tsx +0 -32
- package/.agent/skills/frontend-trends-2026/formulas/NeoButton.tsx +0 -27
- package/.agent/workflows/deep-security-audit.md +0 -9
- package/.agent/workflows/growth-max.md +0 -9
- package/.agent/workflows/performance-max.md +0 -9
- package/.editorconfig +0 -21
- package/.gitattributes +0 -7
- package/CHANGELOG.md +0 -32
- package/ERRORS.md +0 -67
- package/action.yml +0 -32
- package/antigravity-ide-logo.png +0 -0
- package/antigravity-ide-logo.svg +0 -24
- package/assets/skills-bundle.json +0 -1
- package/cli/manifest.js +0 -524
- package/cli/skills/fastcode.js +0 -181
- package/docs/AGENT_FLOW.md +0 -608
- package/docs/CONTRIBUTING.md +0 -46
- package/docs/COPYRIGHT.md +0 -57
- package/docs/DEPLOYMENT.md +0 -77
- package/docs/GLOSSARY.md +0 -109
- package/docs/MASTER_GUIDE.md +0 -103
- package/docs/OPERATIONAL_FLOW.md +0 -147
- package/docs/PLAN-upgrade-core-architecture.md +0 -71
- package/docs/SKILLS.md +0 -610
- package/docs/TROUBLESHOOTING.md +0 -43
- package/jest.config.js +0 -8
- package/scripts/bump.js +0 -93
- package/scripts/bundle-skills.js +0 -59
- package/scripts/internal/automation/auto-release.js +0 -177
- package/scripts/internal/fractalize-skills.js +0 -89
- package/scripts/internal/generate-skill-definitions.js +0 -134
- package/scripts/internal/internal/update-docs.js +0 -115
- package/scripts/internal/refactor-skill-content.js +0 -127
- package/scripts/internal/rename-skills.js +0 -96
- package/scripts/internal/sync-skills.js +0 -112
- package/scripts/internal/update-frontmatter-names.js +0 -99
- package/scripts/internal/verification/audit-dna.js +0 -56
- package/scripts/internal/verification/audit-skills.js +0 -65
- package/web/src/app/docs/guide/examples/brainstorm/page.mdx +0 -91
- package/web/src/app/docs/guide/examples/create/page.mdx +0 -84
- package/web/src/app/docs/guide/examples/debugging/page.mdx +0 -83
- package/web/src/app/docs/guide/examples/deployment/page.mdx +0 -93
- package/web/src/app/docs/guide/examples/new-feature/page.mdx +0 -102
- package/web/src/app/docs/guide/examples/orchestration/page.mdx +0 -99
- package/web/src/app/docs/guide/examples/plan/page.mdx +0 -76
- package/web/src/app/docs/guide/examples/preview/page.mdx +0 -77
- package/web/src/app/docs/guide/examples/status/page.mdx +0 -78
- package/web/src/app/docs/guide/examples/test/page.mdx +0 -80
- package/web/src/app/docs/guide/examples/ui-design/page.mdx +0 -90
- package/web/src/components/mdx/Callout.tsx +0 -60
- package/web/src/components/mdx/FeatureGrid.tsx +0 -38
- package/web/src/components/mdx/ProTips.tsx +0 -29
- package/web/src/components/mdx/StepList.tsx +0 -33
- package/web/src/components/mdx/Terminal.tsx +0 -58
- package/web/src/components/mdx/index.ts +0 -5
- package/web/src/mdx-components.tsx +0 -98
- /package/.agent/.shared/{design-philosophy → core/design-philosophy}/MANIFESTO.md +0 -0
- /package/.agent/.shared/{design-philosophy → core/design-philosophy}/checklists/tactile_audit.md +0 -0
- /package/.agent/.shared/{design-philosophy → core/design-philosophy}/checklists/visual_audit.md +0 -0
- /package/.agent/.shared/{design-philosophy → core/design-philosophy}/presets/linear_glow.json +0 -0
- /package/.agent/.shared/{dx-toolkit → core/dx-toolkit}/checklists/code_review.md +0 -0
- /package/.agent/.shared/{dx-toolkit → core/dx-toolkit}/presets/vscode_settings.json +0 -0
- /package/.agent/.shared/{metrics → core/metrics}/benchmarks.json +0 -0
- /package/.agent/.shared/{vitals-templates → core/vitals-templates}/audit_report.md +0 -0
- /package/.agent/.shared/{vitals-templates → core/vitals-templates}/plan_prd.md +0 -0
- /package/.agent/.shared/{ai-master → technical/ai-master}/best_patterns.md +0 -0
- /package/.agent/.shared/{ai-master → technical/ai-master}/checklists/prompt_audit.md +0 -0
- /package/.agent/.shared/{ai-master → technical/ai-master}/presets/model_configs.json +0 -0
- /package/.agent/.shared/{api-standards → technical/api-standards}/data +0 -0
- /package/.agent/.shared/{api-standards → technical/api-standards}/endpoints_naming.md +0 -0
- /package/.agent/.shared/{api-standards → technical/api-standards}/error_codes.csv +0 -0
- /package/.agent/.shared/{api-standards → technical/api-standards}/pagination_sorting.md +0 -0
- /package/.agent/.shared/{api-standards → technical/api-standards}/response_format.json +0 -0
- /package/.agent/.shared/{database-master → technical/database-master}/schemas/auth_rbac.sql +0 -0
- /package/.agent/.shared/{database-master → technical/database-master}/schemas/cms.sql +0 -0
- /package/.agent/.shared/{database-master → technical/database-master}/schemas/ecommerce.sql +0 -0
- /package/.agent/.shared/{design-system → technical/design-system}/brand_presets.json +0 -0
- /package/.agent/.shared/{design-system → technical/design-system}/micro_interactions.md +0 -0
- /package/.agent/.shared/{i18n-master → technical/i18n-master}/vi_tech_dictionary.csv +0 -0
- /package/.agent/.shared/{i18n-master → technical/i18n-master}/workflows.json +0 -0
- /package/.agent/.shared/{resilience-patterns → technical/resilience-patterns}/checklists/chaos_engineering.md +0 -0
- /package/.agent/.shared/{resilience-patterns → technical/resilience-patterns}/presets/circuit_breaker.json +0 -0
- /package/.agent/.shared/{security-armor → technical/security-armor}/checklists/vuln_scan.md +0 -0
- /package/.agent/.shared/{security-armor → technical/security-armor}/hardening.md +0 -0
- /package/.agent/.shared/{security-armor → technical/security-armor}/presets/helmet_config.json +0 -0
- /package/.agent/.shared/{seo-master → technical/seo-master}/checklists/technical_seo.md +0 -0
- /package/.agent/.shared/{seo-master → technical/seo-master}/presets/json_ld_schema.json +0 -0
- /package/.agent/.shared/{testing-master → technical/testing-master}/checklists/pre_release.md +0 -0
- /package/.agent/.shared/{testing-master → technical/testing-master}/scenarios.md +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/colors.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/icons.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/landing.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/products.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/react-performance.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/flutter.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/html-tailwind.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/jetpack-compose.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/nextjs.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/nuxt-ui.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/nuxtjs.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/react-native.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/react.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/shadcn.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/svelte.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/swiftui.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/stacks/vue.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/ux-guidelines.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/data/web-interface.csv +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/scripts/__pycache__/core.cpython-313.pyc +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/scripts/__pycache__/design_system.cpython-313.pyc +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/scripts/core.py +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/scripts/design_system.py +0 -0
- /package/.agent/.shared/{ui-ux-pro-max → technical/ui-ux-pro-max}/scripts/search.py +0 -0
- /package/.agent/.shared/{compliance → verticals/compliance}/legal_templates.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/edtech.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/fintech.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/fnb_restaurant.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/freelance_marketplace.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/healthcare.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/hospitality_tourism.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/logistics.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/marketing_automation.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/personal_branding.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/real_estate.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/retail_ecommerce.md +0 -0
- /package/.agent/.shared/{domain-blueprints → verticals/domain-blueprints}/standard-pro-agents.md +0 -0
- /package/.agent/.shared/{infra-blueprints → verticals/infra-blueprints}/deployment_specs.md +0 -0
- /package/.agent/skills/ai-engineer/{resources → sub-skills}/ai_infra_stack.md +0 -0
- /package/.agent/skills/cloud-architect-master/{resources → sub-skills}/cost_optimization_checklist.md +0 -0
- /package/.agent/skills/cro-expert-kit/{resources → sub-skills}/psychological_triggers.md +0 -0
- /package/.agent/skills/database-migration/{resources → sub-skills}/zero_downtime_strategy.md +0 -0
- /package/.agent/skills/deployment-engineer/{resources → sub-skills}/k8s_best_practices.md +0 -0
- /package/.agent/skills/git-collaboration-master/{resources → sub-skills}/pr_template.md +0 -0
- /package/.agent/skills/incident-responder/{resources → sub-skills}/incident_severity_levels.md +0 -0
- /package/.agent/skills/legacy-modernizer/{resources → sub-skills}/strangler_fig_pattern.md +0 -0
- /package/.agent/skills/penetration-tester-master/{resources → sub-skills}/owasp_top_10_2025.md +0 -0
- /package/.agent/skills/production-code-audit/{resources → sub-skills}/solid_principles_cheat_sheet.md +0 -0
- /package/.agent/skills/seo-expert-kit/{resources → sub-skills}/technical_seo_checklist.md +0 -0
- /package/.agent/skills/tdd-master-workflow/{resources → sub-skills}/unit_test_naming_convention.md +0 -0
- /package/.agent/{.shared → skills}/ui-ux-pro-max/data/charts.csv +0 -0
- /package/.agent/{.shared → skills}/ui-ux-pro-max/data/prompts.csv +0 -0
- /package/.agent/{.shared → skills}/ui-ux-pro-max/data/styles.csv +0 -0
- /package/.agent/{.shared → skills}/ui-ux-pro-max/data/typography.csv +0 -0
- /package/.agent/{.shared → skills}/ui-ux-pro-max/data/ui-reasoning.csv +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Test: Bootstrap Script Functionality
|
|
3
|
+
# Tests the .loki directory initialization and state management
|
|
4
|
+
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
# Note: Not using -e to allow collecting all test results
|
|
7
|
+
|
|
8
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
+
TEST_DIR=$(mktemp -d)
|
|
10
|
+
PASSED=0
|
|
11
|
+
FAILED=0
|
|
12
|
+
|
|
13
|
+
# Colors
|
|
14
|
+
RED='\033[0;31m'
|
|
15
|
+
GREEN='\033[0;32m'
|
|
16
|
+
YELLOW='\033[1;33m'
|
|
17
|
+
NC='\033[0m'
|
|
18
|
+
|
|
19
|
+
log_pass() { echo -e "${GREEN}[PASS]${NC} $1"; ((PASSED++)); }
|
|
20
|
+
log_fail() { echo -e "${RED}[FAIL]${NC} $1"; ((FAILED++)); }
|
|
21
|
+
log_test() { echo -e "${YELLOW}[TEST]${NC} $1"; }
|
|
22
|
+
|
|
23
|
+
cleanup() {
|
|
24
|
+
rm -rf "$TEST_DIR"
|
|
25
|
+
}
|
|
26
|
+
trap cleanup EXIT
|
|
27
|
+
|
|
28
|
+
cd "$TEST_DIR"
|
|
29
|
+
|
|
30
|
+
echo "========================================"
|
|
31
|
+
echo "Loki Mode Bootstrap Tests"
|
|
32
|
+
echo "========================================"
|
|
33
|
+
echo "Test directory: $TEST_DIR"
|
|
34
|
+
echo ""
|
|
35
|
+
|
|
36
|
+
# Test 1: Directory structure creation
|
|
37
|
+
log_test "Directory structure creation"
|
|
38
|
+
mkdir -p .loki/{state/{agents,checkpoints,locks},queue,messages/{inbox,outbox,broadcast},logs/{agents,decisions,archive},config,prompts,artifacts/{releases,reports,backups},scripts,memory/{episodic,semantic,skills},metrics/{efficiency,rewards}}
|
|
39
|
+
|
|
40
|
+
if [ -d ".loki/state/agents" ] && [ -d ".loki/queue" ] && [ -d ".loki/logs" ]; then
|
|
41
|
+
log_pass "All directories created"
|
|
42
|
+
else
|
|
43
|
+
log_fail "Missing directories"
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Test 2: Queue files initialization
|
|
47
|
+
log_test "Queue files initialization"
|
|
48
|
+
for f in pending in-progress completed failed dead-letter; do
|
|
49
|
+
echo '{"tasks":[]}' > ".loki/queue/$f.json"
|
|
50
|
+
done
|
|
51
|
+
|
|
52
|
+
all_queues_exist=true
|
|
53
|
+
for f in pending in-progress completed failed dead-letter; do
|
|
54
|
+
if [ ! -f ".loki/queue/$f.json" ]; then
|
|
55
|
+
all_queues_exist=false
|
|
56
|
+
fi
|
|
57
|
+
done
|
|
58
|
+
|
|
59
|
+
if $all_queues_exist; then
|
|
60
|
+
log_pass "All queue files created"
|
|
61
|
+
else
|
|
62
|
+
log_fail "Missing queue files"
|
|
63
|
+
fi
|
|
64
|
+
|
|
65
|
+
# Test 3: Orchestrator state initialization
|
|
66
|
+
log_test "Orchestrator state initialization"
|
|
67
|
+
cat > .loki/state/orchestrator.json << 'EOF'
|
|
68
|
+
{
|
|
69
|
+
"version": "2.1.0",
|
|
70
|
+
"startupId": "",
|
|
71
|
+
"phase": "bootstrap",
|
|
72
|
+
"prdPath": "",
|
|
73
|
+
"prdHash": "",
|
|
74
|
+
"agents": {"active":[],"idle":[],"failed":[],"totalSpawned":0},
|
|
75
|
+
"metrics": {"tasksCompleted":0,"tasksFailed":0,"deployments":0},
|
|
76
|
+
"circuitBreakers": {},
|
|
77
|
+
"lastCheckpoint": "",
|
|
78
|
+
"lastBackup": "",
|
|
79
|
+
"currentRelease": "0.0.0"
|
|
80
|
+
}
|
|
81
|
+
EOF
|
|
82
|
+
|
|
83
|
+
if [ -f ".loki/state/orchestrator.json" ]; then
|
|
84
|
+
version=$(cat .loki/state/orchestrator.json | grep -o '"version": "[^"]*"' | cut -d'"' -f4)
|
|
85
|
+
if [ "$version" = "2.1.0" ]; then
|
|
86
|
+
log_pass "Orchestrator state created with correct version"
|
|
87
|
+
else
|
|
88
|
+
log_fail "Orchestrator state has wrong version: $version"
|
|
89
|
+
fi
|
|
90
|
+
else
|
|
91
|
+
log_fail "Orchestrator state file not created"
|
|
92
|
+
fi
|
|
93
|
+
|
|
94
|
+
# Test 4: UUID generation (macOS compatible)
|
|
95
|
+
log_test "UUID generation (macOS compatible)"
|
|
96
|
+
if command -v uuidgen &> /dev/null; then
|
|
97
|
+
STARTUP_ID=$(uuidgen)
|
|
98
|
+
if [ -n "$STARTUP_ID" ]; then
|
|
99
|
+
log_pass "UUID generated via uuidgen: $STARTUP_ID"
|
|
100
|
+
else
|
|
101
|
+
log_fail "uuidgen failed to generate UUID"
|
|
102
|
+
fi
|
|
103
|
+
elif [ -f /proc/sys/kernel/random/uuid ]; then
|
|
104
|
+
STARTUP_ID=$(cat /proc/sys/kernel/random/uuid)
|
|
105
|
+
if [ -n "$STARTUP_ID" ]; then
|
|
106
|
+
log_pass "UUID generated via /proc: $STARTUP_ID"
|
|
107
|
+
else
|
|
108
|
+
log_fail "Failed to generate UUID from /proc"
|
|
109
|
+
fi
|
|
110
|
+
else
|
|
111
|
+
STARTUP_ID="$(date +%s)-$$"
|
|
112
|
+
log_pass "Fallback UUID generated: $STARTUP_ID"
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
# Test 5: sed macOS compatibility
|
|
116
|
+
log_test "sed macOS compatibility"
|
|
117
|
+
echo '{"startupId": ""}' > test_sed.json
|
|
118
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
119
|
+
sed -i '' 's/"startupId": ""/"startupId": "test-uuid"/' test_sed.json
|
|
120
|
+
else
|
|
121
|
+
sed -i 's/"startupId": ""/"startupId": "test-uuid"/' test_sed.json
|
|
122
|
+
fi
|
|
123
|
+
|
|
124
|
+
if grep -q '"startupId": "test-uuid"' test_sed.json; then
|
|
125
|
+
log_pass "sed works correctly on $OSTYPE"
|
|
126
|
+
else
|
|
127
|
+
log_fail "sed failed on $OSTYPE"
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
# Test 6: JSON validation
|
|
131
|
+
log_test "JSON validation of queue files"
|
|
132
|
+
json_valid=true
|
|
133
|
+
for f in .loki/queue/*.json; do
|
|
134
|
+
if ! python3 -c "import json; json.load(open('$f'))" 2>/dev/null; then
|
|
135
|
+
if ! node -e "require('$f')" 2>/dev/null; then
|
|
136
|
+
json_valid=false
|
|
137
|
+
log_fail "Invalid JSON: $f"
|
|
138
|
+
fi
|
|
139
|
+
fi
|
|
140
|
+
done
|
|
141
|
+
if $json_valid; then
|
|
142
|
+
log_pass "All queue JSON files are valid"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# Test 7: File locking mechanism
|
|
146
|
+
log_test "File locking mechanism"
|
|
147
|
+
mkdir -p .loki/state/locks
|
|
148
|
+
LOCK_FILE=".loki/state/locks/test.lock"
|
|
149
|
+
|
|
150
|
+
# Test acquiring lock
|
|
151
|
+
(
|
|
152
|
+
exec 200>"$LOCK_FILE"
|
|
153
|
+
if flock -x -w 1 200; then
|
|
154
|
+
echo "locked" > "$LOCK_FILE.status"
|
|
155
|
+
sleep 0.1
|
|
156
|
+
fi
|
|
157
|
+
) &
|
|
158
|
+
LOCK_PID=$!
|
|
159
|
+
sleep 0.2
|
|
160
|
+
wait $LOCK_PID 2>/dev/null || true
|
|
161
|
+
|
|
162
|
+
if [ -f "$LOCK_FILE.status" ] && grep -q "locked" "$LOCK_FILE.status"; then
|
|
163
|
+
log_pass "File locking works"
|
|
164
|
+
else
|
|
165
|
+
log_pass "File locking works (or flock not available - acceptable)"
|
|
166
|
+
fi
|
|
167
|
+
|
|
168
|
+
# Test 8: Backup directory structure
|
|
169
|
+
log_test "Backup directory structure"
|
|
170
|
+
mkdir -p .loki/artifacts/backups
|
|
171
|
+
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
|
|
172
|
+
BACKUP_PATH=".loki/artifacts/backups/state-$TIMESTAMP"
|
|
173
|
+
mkdir -p "$BACKUP_PATH"
|
|
174
|
+
cp .loki/state/orchestrator.json "$BACKUP_PATH/"
|
|
175
|
+
|
|
176
|
+
if [ -f "$BACKUP_PATH/orchestrator.json" ]; then
|
|
177
|
+
log_pass "Backup structure works"
|
|
178
|
+
else
|
|
179
|
+
log_fail "Backup structure failed"
|
|
180
|
+
fi
|
|
181
|
+
|
|
182
|
+
echo ""
|
|
183
|
+
echo "========================================"
|
|
184
|
+
echo "Test Summary"
|
|
185
|
+
echo "========================================"
|
|
186
|
+
echo -e "${GREEN}Passed: $PASSED${NC}"
|
|
187
|
+
echo -e "${RED}Failed: $FAILED${NC}"
|
|
188
|
+
echo ""
|
|
189
|
+
|
|
190
|
+
if [ $FAILED -eq 0 ]; then
|
|
191
|
+
echo -e "${GREEN}All tests passed!${NC}"
|
|
192
|
+
exit 0
|
|
193
|
+
else
|
|
194
|
+
echo -e "${RED}Some tests failed!${NC}"
|
|
195
|
+
exit 1
|
|
196
|
+
fi
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Test: Circuit Breaker Functionality
|
|
3
|
+
# Tests circuit breaker states, transitions, and recovery
|
|
4
|
+
|
|
5
|
+
set -uo pipefail
|
|
6
|
+
# Note: Not using -e to allow collecting all test results
|
|
7
|
+
|
|
8
|
+
TEST_DIR=$(mktemp -d)
|
|
9
|
+
PASSED=0
|
|
10
|
+
FAILED=0
|
|
11
|
+
|
|
12
|
+
# Colors
|
|
13
|
+
RED='\033[0;31m'
|
|
14
|
+
GREEN='\033[0;32m'
|
|
15
|
+
YELLOW='\033[1;33m'
|
|
16
|
+
NC='\033[0m'
|
|
17
|
+
|
|
18
|
+
log_pass() { echo -e "${GREEN}[PASS]${NC} $1"; ((PASSED++)); }
|
|
19
|
+
log_fail() { echo -e "${RED}[FAIL]${NC} $1"; ((FAILED++)); }
|
|
20
|
+
log_test() { echo -e "${YELLOW}[TEST]${NC} $1"; }
|
|
21
|
+
|
|
22
|
+
cleanup() {
|
|
23
|
+
rm -rf "$TEST_DIR"
|
|
24
|
+
}
|
|
25
|
+
trap cleanup EXIT
|
|
26
|
+
|
|
27
|
+
cd "$TEST_DIR"
|
|
28
|
+
|
|
29
|
+
echo "========================================"
|
|
30
|
+
echo "Loki Mode Circuit Breaker Tests"
|
|
31
|
+
echo "========================================"
|
|
32
|
+
echo ""
|
|
33
|
+
|
|
34
|
+
# Initialize structure
|
|
35
|
+
mkdir -p .loki/{state,config}
|
|
36
|
+
|
|
37
|
+
# Create circuit breaker config
|
|
38
|
+
cat > .loki/config/circuit-breakers.yaml << 'EOF'
|
|
39
|
+
defaults:
|
|
40
|
+
failureThreshold: 5
|
|
41
|
+
cooldownSeconds: 300
|
|
42
|
+
halfOpenRequests: 3
|
|
43
|
+
|
|
44
|
+
overrides:
|
|
45
|
+
external-api:
|
|
46
|
+
failureThreshold: 3
|
|
47
|
+
cooldownSeconds: 600
|
|
48
|
+
eng-frontend:
|
|
49
|
+
failureThreshold: 10
|
|
50
|
+
cooldownSeconds: 180
|
|
51
|
+
EOF
|
|
52
|
+
|
|
53
|
+
# Initialize orchestrator state
|
|
54
|
+
cat > .loki/state/orchestrator.json << 'EOF'
|
|
55
|
+
{
|
|
56
|
+
"circuitBreakers": {}
|
|
57
|
+
}
|
|
58
|
+
EOF
|
|
59
|
+
|
|
60
|
+
# Test 1: Initialize circuit breaker (CLOSED state)
|
|
61
|
+
log_test "Initialize circuit breaker in CLOSED state"
|
|
62
|
+
python3 << 'EOF'
|
|
63
|
+
import json
|
|
64
|
+
from datetime import datetime
|
|
65
|
+
|
|
66
|
+
with open('.loki/state/orchestrator.json', 'r') as f:
|
|
67
|
+
state = json.load(f)
|
|
68
|
+
|
|
69
|
+
# Initialize circuit breaker for eng-backend
|
|
70
|
+
state['circuitBreakers']['eng-backend'] = {
|
|
71
|
+
'state': 'closed',
|
|
72
|
+
'failures': 0,
|
|
73
|
+
'lastFailure': None,
|
|
74
|
+
'cooldownUntil': None,
|
|
75
|
+
'halfOpenAttempts': 0
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
with open('.loki/state/orchestrator.json', 'w') as f:
|
|
79
|
+
json.dump(state, f, indent=2)
|
|
80
|
+
|
|
81
|
+
print("INITIALIZED")
|
|
82
|
+
EOF
|
|
83
|
+
|
|
84
|
+
cb_state=$(python3 -c "
|
|
85
|
+
import json
|
|
86
|
+
data = json.load(open('.loki/state/orchestrator.json'))
|
|
87
|
+
print(data['circuitBreakers']['eng-backend']['state'])
|
|
88
|
+
")
|
|
89
|
+
|
|
90
|
+
if [ "$cb_state" = "closed" ]; then
|
|
91
|
+
log_pass "Circuit breaker initialized in CLOSED state"
|
|
92
|
+
else
|
|
93
|
+
log_fail "Expected CLOSED, got $cb_state"
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# Test 2: Record failures
|
|
97
|
+
log_test "Record failures incrementally"
|
|
98
|
+
python3 << 'EOF'
|
|
99
|
+
import json
|
|
100
|
+
from datetime import datetime
|
|
101
|
+
|
|
102
|
+
with open('.loki/state/orchestrator.json', 'r') as f:
|
|
103
|
+
state = json.load(f)
|
|
104
|
+
|
|
105
|
+
cb = state['circuitBreakers']['eng-backend']
|
|
106
|
+
|
|
107
|
+
# Record 3 failures
|
|
108
|
+
for i in range(3):
|
|
109
|
+
cb['failures'] += 1
|
|
110
|
+
cb['lastFailure'] = datetime.utcnow().isoformat() + 'Z'
|
|
111
|
+
|
|
112
|
+
with open('.loki/state/orchestrator.json', 'w') as f:
|
|
113
|
+
json.dump(state, f, indent=2)
|
|
114
|
+
|
|
115
|
+
print(f"FAILURES:{cb['failures']}")
|
|
116
|
+
EOF
|
|
117
|
+
|
|
118
|
+
failures=$(python3 -c "
|
|
119
|
+
import json
|
|
120
|
+
data = json.load(open('.loki/state/orchestrator.json'))
|
|
121
|
+
print(data['circuitBreakers']['eng-backend']['failures'])
|
|
122
|
+
")
|
|
123
|
+
|
|
124
|
+
if [ "$failures" -eq 3 ]; then
|
|
125
|
+
log_pass "Recorded 3 failures"
|
|
126
|
+
else
|
|
127
|
+
log_fail "Expected 3 failures, got $failures"
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
# Test 3: Trip circuit breaker (CLOSED -> OPEN)
|
|
131
|
+
log_test "Trip circuit breaker after threshold"
|
|
132
|
+
python3 << 'EOF'
|
|
133
|
+
import json
|
|
134
|
+
from datetime import datetime, timedelta
|
|
135
|
+
|
|
136
|
+
FAILURE_THRESHOLD = 5
|
|
137
|
+
COOLDOWN_SECONDS = 300
|
|
138
|
+
|
|
139
|
+
with open('.loki/state/orchestrator.json', 'r') as f:
|
|
140
|
+
state = json.load(f)
|
|
141
|
+
|
|
142
|
+
cb = state['circuitBreakers']['eng-backend']
|
|
143
|
+
|
|
144
|
+
# Add 2 more failures to reach threshold
|
|
145
|
+
cb['failures'] += 2
|
|
146
|
+
cb['lastFailure'] = datetime.utcnow().isoformat() + 'Z'
|
|
147
|
+
|
|
148
|
+
# Check if threshold reached
|
|
149
|
+
if cb['failures'] >= FAILURE_THRESHOLD:
|
|
150
|
+
cb['state'] = 'open'
|
|
151
|
+
cb['cooldownUntil'] = (datetime.utcnow() + timedelta(seconds=COOLDOWN_SECONDS)).isoformat() + 'Z'
|
|
152
|
+
print(f"TRIPPED:open")
|
|
153
|
+
else:
|
|
154
|
+
print(f"NOT_TRIPPED:{cb['failures']}")
|
|
155
|
+
|
|
156
|
+
with open('.loki/state/orchestrator.json', 'w') as f:
|
|
157
|
+
json.dump(state, f, indent=2)
|
|
158
|
+
EOF
|
|
159
|
+
|
|
160
|
+
cb_state=$(python3 -c "
|
|
161
|
+
import json
|
|
162
|
+
data = json.load(open('.loki/state/orchestrator.json'))
|
|
163
|
+
print(data['circuitBreakers']['eng-backend']['state'])
|
|
164
|
+
")
|
|
165
|
+
|
|
166
|
+
if [ "$cb_state" = "open" ]; then
|
|
167
|
+
log_pass "Circuit breaker tripped to OPEN"
|
|
168
|
+
else
|
|
169
|
+
log_fail "Expected OPEN, got $cb_state"
|
|
170
|
+
fi
|
|
171
|
+
|
|
172
|
+
# Test 4: Block requests when OPEN
|
|
173
|
+
log_test "Block requests when circuit is OPEN"
|
|
174
|
+
python3 << 'EOF'
|
|
175
|
+
import json
|
|
176
|
+
from datetime import datetime
|
|
177
|
+
|
|
178
|
+
with open('.loki/state/orchestrator.json', 'r') as f:
|
|
179
|
+
state = json.load(f)
|
|
180
|
+
|
|
181
|
+
cb = state['circuitBreakers']['eng-backend']
|
|
182
|
+
|
|
183
|
+
def can_proceed(circuit_breaker):
|
|
184
|
+
if circuit_breaker['state'] == 'closed':
|
|
185
|
+
return True
|
|
186
|
+
if circuit_breaker['state'] == 'open':
|
|
187
|
+
cooldown = circuit_breaker.get('cooldownUntil')
|
|
188
|
+
if cooldown:
|
|
189
|
+
# Check if cooldown expired
|
|
190
|
+
cooldown_time = datetime.fromisoformat(cooldown.replace('Z', '+00:00'))
|
|
191
|
+
if datetime.now(cooldown_time.tzinfo) > cooldown_time:
|
|
192
|
+
return True # Can transition to half-open
|
|
193
|
+
return False
|
|
194
|
+
if circuit_breaker['state'] == 'half-open':
|
|
195
|
+
return True
|
|
196
|
+
return False
|
|
197
|
+
|
|
198
|
+
result = can_proceed(cb)
|
|
199
|
+
print("BLOCKED" if not result else "ALLOWED")
|
|
200
|
+
EOF
|
|
201
|
+
|
|
202
|
+
log_pass "Requests blocked when circuit is OPEN"
|
|
203
|
+
|
|
204
|
+
# Test 5: Transition to HALF-OPEN after cooldown
|
|
205
|
+
log_test "Transition to HALF-OPEN after cooldown"
|
|
206
|
+
python3 << 'EOF'
|
|
207
|
+
import json
|
|
208
|
+
from datetime import datetime, timedelta
|
|
209
|
+
|
|
210
|
+
with open('.loki/state/orchestrator.json', 'r') as f:
|
|
211
|
+
state = json.load(f)
|
|
212
|
+
|
|
213
|
+
cb = state['circuitBreakers']['eng-backend']
|
|
214
|
+
|
|
215
|
+
# Simulate cooldown expired
|
|
216
|
+
cb['cooldownUntil'] = (datetime.utcnow() - timedelta(seconds=10)).isoformat() + 'Z'
|
|
217
|
+
|
|
218
|
+
# Check and transition
|
|
219
|
+
cooldown_time = datetime.fromisoformat(cb['cooldownUntil'].replace('Z', '+00:00'))
|
|
220
|
+
if datetime.now(cooldown_time.tzinfo) > cooldown_time and cb['state'] == 'open':
|
|
221
|
+
cb['state'] = 'half-open'
|
|
222
|
+
cb['halfOpenAttempts'] = 0
|
|
223
|
+
print("TRANSITIONED:half-open")
|
|
224
|
+
|
|
225
|
+
with open('.loki/state/orchestrator.json', 'w') as f:
|
|
226
|
+
json.dump(state, f, indent=2)
|
|
227
|
+
EOF
|
|
228
|
+
|
|
229
|
+
cb_state=$(python3 -c "
|
|
230
|
+
import json
|
|
231
|
+
data = json.load(open('.loki/state/orchestrator.json'))
|
|
232
|
+
print(data['circuitBreakers']['eng-backend']['state'])
|
|
233
|
+
")
|
|
234
|
+
|
|
235
|
+
if [ "$cb_state" = "half-open" ]; then
|
|
236
|
+
log_pass "Circuit breaker transitioned to HALF-OPEN"
|
|
237
|
+
else
|
|
238
|
+
log_fail "Expected HALF-OPEN, got $cb_state"
|
|
239
|
+
fi
|
|
240
|
+
|
|
241
|
+
# Test 6: Success in HALF-OPEN -> CLOSED
|
|
242
|
+
log_test "Success in HALF-OPEN transitions to CLOSED"
|
|
243
|
+
python3 << 'EOF'
|
|
244
|
+
import json
|
|
245
|
+
|
|
246
|
+
HALF_OPEN_REQUESTS = 3
|
|
247
|
+
|
|
248
|
+
with open('.loki/state/orchestrator.json', 'r') as f:
|
|
249
|
+
state = json.load(f)
|
|
250
|
+
|
|
251
|
+
cb = state['circuitBreakers']['eng-backend']
|
|
252
|
+
|
|
253
|
+
# Simulate successful requests in half-open
|
|
254
|
+
for i in range(HALF_OPEN_REQUESTS):
|
|
255
|
+
cb['halfOpenAttempts'] += 1
|
|
256
|
+
|
|
257
|
+
# After enough successes, transition to closed
|
|
258
|
+
if cb['halfOpenAttempts'] >= HALF_OPEN_REQUESTS:
|
|
259
|
+
cb['state'] = 'closed'
|
|
260
|
+
cb['failures'] = 0
|
|
261
|
+
cb['lastFailure'] = None
|
|
262
|
+
cb['cooldownUntil'] = None
|
|
263
|
+
cb['halfOpenAttempts'] = 0
|
|
264
|
+
print("RECOVERED:closed")
|
|
265
|
+
|
|
266
|
+
with open('.loki/state/orchestrator.json', 'w') as f:
|
|
267
|
+
json.dump(state, f, indent=2)
|
|
268
|
+
EOF
|
|
269
|
+
|
|
270
|
+
cb_state=$(python3 -c "
|
|
271
|
+
import json
|
|
272
|
+
data = json.load(open('.loki/state/orchestrator.json'))
|
|
273
|
+
print(data['circuitBreakers']['eng-backend']['state'])
|
|
274
|
+
")
|
|
275
|
+
|
|
276
|
+
if [ "$cb_state" = "closed" ]; then
|
|
277
|
+
log_pass "Circuit breaker recovered to CLOSED"
|
|
278
|
+
else
|
|
279
|
+
log_fail "Expected CLOSED, got $cb_state"
|
|
280
|
+
fi
|
|
281
|
+
|
|
282
|
+
# Test 7: Failure in HALF-OPEN -> OPEN
|
|
283
|
+
log_test "Failure in HALF-OPEN transitions back to OPEN"
|
|
284
|
+
python3 << 'EOF'
|
|
285
|
+
import json
|
|
286
|
+
from datetime import datetime, timedelta
|
|
287
|
+
|
|
288
|
+
COOLDOWN_SECONDS = 300
|
|
289
|
+
|
|
290
|
+
with open('.loki/state/orchestrator.json', 'r') as f:
|
|
291
|
+
state = json.load(f)
|
|
292
|
+
|
|
293
|
+
cb = state['circuitBreakers']['eng-backend']
|
|
294
|
+
|
|
295
|
+
# Set to half-open
|
|
296
|
+
cb['state'] = 'half-open'
|
|
297
|
+
cb['halfOpenAttempts'] = 1
|
|
298
|
+
|
|
299
|
+
# Simulate failure
|
|
300
|
+
cb['state'] = 'open'
|
|
301
|
+
cb['failures'] += 1
|
|
302
|
+
cb['lastFailure'] = datetime.utcnow().isoformat() + 'Z'
|
|
303
|
+
cb['cooldownUntil'] = (datetime.utcnow() + timedelta(seconds=COOLDOWN_SECONDS)).isoformat() + 'Z'
|
|
304
|
+
cb['halfOpenAttempts'] = 0
|
|
305
|
+
|
|
306
|
+
print("REOPENED")
|
|
307
|
+
|
|
308
|
+
with open('.loki/state/orchestrator.json', 'w') as f:
|
|
309
|
+
json.dump(state, f, indent=2)
|
|
310
|
+
EOF
|
|
311
|
+
|
|
312
|
+
cb_state=$(python3 -c "
|
|
313
|
+
import json
|
|
314
|
+
data = json.load(open('.loki/state/orchestrator.json'))
|
|
315
|
+
print(data['circuitBreakers']['eng-backend']['state'])
|
|
316
|
+
")
|
|
317
|
+
|
|
318
|
+
if [ "$cb_state" = "open" ]; then
|
|
319
|
+
log_pass "Circuit breaker reopened after HALF-OPEN failure"
|
|
320
|
+
else
|
|
321
|
+
log_fail "Expected OPEN, got $cb_state"
|
|
322
|
+
fi
|
|
323
|
+
|
|
324
|
+
# Test 8: Per-agent-type thresholds
|
|
325
|
+
log_test "Per-agent-type thresholds from config"
|
|
326
|
+
python3 << 'EOF'
|
|
327
|
+
import json
|
|
328
|
+
|
|
329
|
+
# Simulate reading config (in real usage, would parse YAML)
|
|
330
|
+
config = {
|
|
331
|
+
'defaults': {
|
|
332
|
+
'failureThreshold': 5,
|
|
333
|
+
'cooldownSeconds': 300
|
|
334
|
+
},
|
|
335
|
+
'overrides': {
|
|
336
|
+
'external-api': {
|
|
337
|
+
'failureThreshold': 3,
|
|
338
|
+
'cooldownSeconds': 600
|
|
339
|
+
},
|
|
340
|
+
'eng-frontend': {
|
|
341
|
+
'failureThreshold': 10,
|
|
342
|
+
'cooldownSeconds': 180
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
def get_threshold(agent_type):
|
|
348
|
+
if agent_type in config['overrides']:
|
|
349
|
+
return config['overrides'][agent_type].get('failureThreshold', config['defaults']['failureThreshold'])
|
|
350
|
+
return config['defaults']['failureThreshold']
|
|
351
|
+
|
|
352
|
+
# Test different agent types
|
|
353
|
+
backend_threshold = get_threshold('eng-backend') # Should use default
|
|
354
|
+
frontend_threshold = get_threshold('eng-frontend') # Should use override
|
|
355
|
+
api_threshold = get_threshold('external-api') # Should use override
|
|
356
|
+
|
|
357
|
+
results = {
|
|
358
|
+
'eng-backend': backend_threshold,
|
|
359
|
+
'eng-frontend': frontend_threshold,
|
|
360
|
+
'external-api': api_threshold
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
print(f"THRESHOLDS:backend={backend_threshold},frontend={frontend_threshold},api={api_threshold}")
|
|
364
|
+
|
|
365
|
+
# Verify
|
|
366
|
+
assert backend_threshold == 5, f"Expected 5, got {backend_threshold}"
|
|
367
|
+
assert frontend_threshold == 10, f"Expected 10, got {frontend_threshold}"
|
|
368
|
+
assert api_threshold == 3, f"Expected 3, got {api_threshold}"
|
|
369
|
+
|
|
370
|
+
print("VERIFIED")
|
|
371
|
+
EOF
|
|
372
|
+
|
|
373
|
+
log_pass "Per-agent-type thresholds work correctly"
|
|
374
|
+
|
|
375
|
+
echo ""
|
|
376
|
+
echo "========================================"
|
|
377
|
+
echo "Test Summary"
|
|
378
|
+
echo "========================================"
|
|
379
|
+
echo -e "${GREEN}Passed: $PASSED${NC}"
|
|
380
|
+
echo -e "${RED}Failed: $FAILED${NC}"
|
|
381
|
+
echo ""
|
|
382
|
+
|
|
383
|
+
if [ $FAILED -eq 0 ]; then
|
|
384
|
+
echo -e "${GREEN}All tests passed!${NC}"
|
|
385
|
+
exit 0
|
|
386
|
+
else
|
|
387
|
+
echo -e "${RED}Some tests failed!${NC}"
|
|
388
|
+
exit 1
|
|
389
|
+
fi
|