@openlife/cli 1.7.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/INSTALL.md +266 -0
- package/LICENSE +21 -0
- package/README.md +142 -0
- package/bin/openlife.js +3 -0
- package/dist/admin_panel_server.js +66 -0
- package/dist/cli/AgentManager.js +109 -0
- package/dist/cli/AutonomousInstaller.js +134 -0
- package/dist/cli/DreamOrganizer.js +88 -0
- package/dist/cli/HostInstaller.js +426 -0
- package/dist/cli/InstallBanner.js +16 -0
- package/dist/cli/InstallFlow.js +256 -0
- package/dist/cli/InstallHeadless.js +47 -0
- package/dist/cli/InstallModules.js +148 -0
- package/dist/cli/InstallStateStore.js +75 -0
- package/dist/cli/InstallWizard.js +364 -0
- package/dist/cli/ProfileManager.js +163 -0
- package/dist/cli/SystemInstaller.js +89 -0
- package/dist/cli/WorldClassCommands.js +208 -0
- package/dist/design/DesignMdImporter.js +82 -0
- package/dist/design/DesignMdMode.js +93 -0
- package/dist/design/DesignMdRegistry.js +67 -0
- package/dist/index.js +2575 -0
- package/dist/memory/ConversationMemory.js +33 -0
- package/dist/memory/LocalMemoryProvider.js +86 -0
- package/dist/memory/Mem0Provider.js +16 -0
- package/dist/memory/MemoryNamespacePolicy.js +27 -0
- package/dist/memory/MemoryOrchestrator.js +65 -0
- package/dist/memory/MemoryPromotionFlow.js +32 -0
- package/dist/memory/MemoryProvider.js +2 -0
- package/dist/memory/MemoryProviderRegistry.js +27 -0
- package/dist/memory/MemoryRetentionPolicy.js +60 -0
- package/dist/memory/MempalaceProvider.js +72 -0
- package/dist/memory/OmniMemory.js +106 -0
- package/dist/memory/RedisAgentMemoryProvider.js +16 -0
- package/dist/memory/SessionManager.js +86 -0
- package/dist/memory/ZepGraphitiProvider.js +16 -0
- package/dist/orchestrator/AgentRegistry.js +56 -0
- package/dist/orchestrator/AgentScoring.js +82 -0
- package/dist/orchestrator/AgentTeam.js +22 -0
- package/dist/orchestrator/ArbitrationAgent.js +43 -0
- package/dist/orchestrator/ArbitrationScorecard.js +17 -0
- package/dist/orchestrator/AssetPromotionEngine.js +65 -0
- package/dist/orchestrator/AssetReuseRouter.js +63 -0
- package/dist/orchestrator/BenchmarkEngine.js +75 -0
- package/dist/orchestrator/Brain.js +298 -0
- package/dist/orchestrator/CadenceEngine.js +76 -0
- package/dist/orchestrator/CapabilityRouter.js +36 -0
- package/dist/orchestrator/CommandLanguage.js +27 -0
- package/dist/orchestrator/CommandRouter.js +70 -0
- package/dist/orchestrator/ConsequenceForecaster.js +286 -0
- package/dist/orchestrator/CronManager.js +286 -0
- package/dist/orchestrator/DynamicAgentBuilder.js +48 -0
- package/dist/orchestrator/DynamicAgentExecutor.js +15 -0
- package/dist/orchestrator/EnterpriseAgenticCore.js +276 -0
- package/dist/orchestrator/ExecutionBoard.js +86 -0
- package/dist/orchestrator/ExecutionIntent.js +13 -0
- package/dist/orchestrator/ExecutionModePolicy.js +48 -0
- package/dist/orchestrator/ExecutionRouter.js +9 -0
- package/dist/orchestrator/ExecutionState.js +20 -0
- package/dist/orchestrator/ExecutorHealth.js +86 -0
- package/dist/orchestrator/ExternalCatalogRegistry.js +83 -0
- package/dist/orchestrator/Gatekeeper.js +414 -0
- package/dist/orchestrator/Gateway.js +508 -0
- package/dist/orchestrator/GovernanceConsentStore.js +66 -0
- package/dist/orchestrator/GovernanceLayer.js +179 -0
- package/dist/orchestrator/GovernancePolicyStore.js +53 -0
- package/dist/orchestrator/GovernanceScopeLedger.js +134 -0
- package/dist/orchestrator/GovernanceScopePolicy.js +67 -0
- package/dist/orchestrator/IntentClassifier.js +45 -0
- package/dist/orchestrator/JobLifecycle.js +91 -0
- package/dist/orchestrator/LearningRouter.js +24 -0
- package/dist/orchestrator/MediaManager.js +92 -0
- package/dist/orchestrator/MemoryCuratorAgent.js +41 -0
- package/dist/orchestrator/MissionState.js +155 -0
- package/dist/orchestrator/ModelManager.js +84 -0
- package/dist/orchestrator/OperatingSystem.js +71 -0
- package/dist/orchestrator/OperationalMemoryStore.js +94 -0
- package/dist/orchestrator/OptimizationLoop.js +72 -0
- package/dist/orchestrator/OrchestrationLoop.js +905 -0
- package/dist/orchestrator/OrgStructure.js +88 -0
- package/dist/orchestrator/OutcomeSimulator.js +46 -0
- package/dist/orchestrator/ParallelOrchestrationLoop.js +36 -0
- package/dist/orchestrator/PerformanceScorecard.js +105 -0
- package/dist/orchestrator/PlannerAgent.js +46 -0
- package/dist/orchestrator/ProcessSandbox.js +129 -0
- package/dist/orchestrator/PromotionPipeline.js +74 -0
- package/dist/orchestrator/PromotionReviewGate.js +11 -0
- package/dist/orchestrator/QueueScheduler.js +260 -0
- package/dist/orchestrator/ReleaseGate.js +36 -0
- package/dist/orchestrator/ReleaseWorkflow.js +68 -0
- package/dist/orchestrator/RemotePublisher.js +139 -0
- package/dist/orchestrator/ReuseEngine.js +89 -0
- package/dist/orchestrator/ReviewerAgent.js +49 -0
- package/dist/orchestrator/RoleHandoff.js +65 -0
- package/dist/orchestrator/RuntimeHealthMonitor.js +143 -0
- package/dist/orchestrator/RuntimePolicy.js +105 -0
- package/dist/orchestrator/RuntimeProbe.js +97 -0
- package/dist/orchestrator/RuntimeRegistry.js +73 -0
- package/dist/orchestrator/SandboxPolicy.js +22 -0
- package/dist/orchestrator/SecurityDownloadGuard.js +169 -0
- package/dist/orchestrator/SecurityEventStore.js +58 -0
- package/dist/orchestrator/ServiceCompletionPolicy.js +36 -0
- package/dist/orchestrator/ServiceState.js +195 -0
- package/dist/orchestrator/SkillCreator.js +404 -0
- package/dist/orchestrator/SkillLearningLoop.js +57 -0
- package/dist/orchestrator/SkillManager.js +75 -0
- package/dist/orchestrator/SkillNetwork.js +29 -0
- package/dist/orchestrator/SkillRegistryV2.js +28 -0
- package/dist/orchestrator/SkillScoring.js +70 -0
- package/dist/orchestrator/SquadAutoCreator.js +64 -0
- package/dist/orchestrator/SquadCreator.js +727 -0
- package/dist/orchestrator/SquadRegistry.js +28 -0
- package/dist/orchestrator/SquadRouter.js +33 -0
- package/dist/orchestrator/SquadScoring.js +70 -0
- package/dist/orchestrator/SubagentLifecycle.js +90 -0
- package/dist/orchestrator/SynthesizerAgent.js +48 -0
- package/dist/orchestrator/SystemDoctor.js +224 -0
- package/dist/orchestrator/TaskExecutor.js +422 -0
- package/dist/orchestrator/TeammateBoard.js +61 -0
- package/dist/orchestrator/TestHarness.js +184 -0
- package/dist/orchestrator/VoiceManager.js +203 -0
- package/dist/orchestrator/VoiceRouter.js +89 -0
- package/dist/orchestrator/capability/CapabilityGenesisEngine.js +278 -0
- package/dist/orchestrator/capability/CapabilityPackParser.js +223 -0
- package/dist/orchestrator/capability/CapabilityPackSchema.js +62 -0
- package/dist/orchestrator/capability/CapabilityPackState.js +163 -0
- package/dist/orchestrator/providers/AgentProvider.js +2 -0
- package/dist/orchestrator/providers/CapabilityProvider.js +12 -0
- package/dist/orchestrator/providers/CloudAgentProvider.js +55 -0
- package/dist/orchestrator/providers/CloudSkillProvider.js +55 -0
- package/dist/orchestrator/providers/CloudSquadProvider.js +55 -0
- package/dist/orchestrator/providers/CompositeAgentProvider.js +16 -0
- package/dist/orchestrator/providers/CompositeCapabilityProvider.js +25 -0
- package/dist/orchestrator/providers/CompositeSkillProvider.js +16 -0
- package/dist/orchestrator/providers/CompositeSquadProvider.js +16 -0
- package/dist/orchestrator/providers/CompositeWorkflowProvider.js +46 -0
- package/dist/orchestrator/providers/FileAgentProvider.js +105 -0
- package/dist/orchestrator/providers/FileCapabilityProvider.js +106 -0
- package/dist/orchestrator/providers/FileSkillProvider.js +65 -0
- package/dist/orchestrator/providers/FileSquadProvider.js +69 -0
- package/dist/orchestrator/providers/FileWorkflowProvider.js +103 -0
- package/dist/orchestrator/providers/SkillProvider.js +2 -0
- package/dist/orchestrator/providers/SquadProvider.js +2 -0
- package/dist/orchestrator/toolset/ToolsetGuard.js +69 -0
- package/dist/orchestrator/toolset/ToolsetRegistry.js +65 -0
- package/dist/orchestrator/toolset/ToolsetSchema.js +21 -0
- package/dist/orchestrator/util/AtomicWriter.js +204 -0
- package/dist/orchestrator/util/DistributedLock.js +232 -0
- package/dist/orchestrator/util/TemplateRenderer.js +87 -0
- package/dist/orchestrator/util/WatchdogHeartbeat.js +116 -0
- package/dist/orchestrator/workflow/ConditionParser.js +232 -0
- package/dist/orchestrator/workflow/WorkflowEngine.js +379 -0
- package/dist/orchestrator/workflow/WorkflowParser.js +368 -0
- package/dist/orchestrator/workflow/WorkflowSchema.js +65 -0
- package/dist/orchestrator/workflow/WorkflowState.js +11 -0
- package/dist/reversa/ReversaAgent.js +134 -0
- package/dist/reversa/ReversaContracts.js +62 -0
- package/dist/reversa/ReversaExecutors.js +65 -0
- package/dist/skills/SkillRegistry.js +71 -0
- package/dist/squads/SquadManager.js +87 -0
- package/dist/test_admin_teams_networks.js +54 -0
- package/dist/test_agent_team_skill_network.js +15 -0
- package/dist/test_aiobuilder_cli_parity.js +169 -0
- package/dist/test_ask_exit.js +73 -0
- package/dist/test_atomic_writer.js +209 -0
- package/dist/test_autonomous_soak.js +141 -0
- package/dist/test_benchmark_engine.js +41 -0
- package/dist/test_brain_error_diagnostics.js +51 -0
- package/dist/test_brain_fallback_chain.js +93 -0
- package/dist/test_capability_genesis_engine.js +225 -0
- package/dist/test_capability_pack_schema.js +214 -0
- package/dist/test_catalog_quality.js +150 -0
- package/dist/test_cli_crud_roundtrip.js +154 -0
- package/dist/test_cli_diagnostics.js +131 -0
- package/dist/test_cli_doc_parity.js +126 -0
- package/dist/test_cli_help_surface.js +106 -0
- package/dist/test_cli_service_commands.js +83 -0
- package/dist/test_consequence_forecast_brain.js +165 -0
- package/dist/test_consequence_forecaster.js +24 -0
- package/dist/test_conversation_memory.js +36 -0
- package/dist/test_create_entities.js +54 -0
- package/dist/test_creator_placeholders_completed.js +177 -0
- package/dist/test_cron_manager.js +123 -0
- package/dist/test_daemon_sigterm.js +72 -0
- package/dist/test_deep_research_capability.js +87 -0
- package/dist/test_designmd_import_registry.js +16 -0
- package/dist/test_designmd_mode.js +50 -0
- package/dist/test_designmd_mode_workspace.js +13 -0
- package/dist/test_dist_templates_layout.js +135 -0
- package/dist/test_distributed_lock.js +201 -0
- package/dist/test_distribution_installability.js +67 -0
- package/dist/test_doctor_sandbox_check.js +44 -0
- package/dist/test_dream_organizer.js +25 -0
- package/dist/test_dual_mode.js +15 -0
- package/dist/test_enterprise_agentic_core.js +128 -0
- package/dist/test_forecast_brain_wiring.js +87 -0
- package/dist/test_gateway_telegram_guardrails.js +52 -0
- package/dist/test_governance.js +34 -0
- package/dist/test_governance_advanced.js +75 -0
- package/dist/test_governance_scope_ledger.js +147 -0
- package/dist/test_governance_v13_policies.js +44 -0
- package/dist/test_guided_creator_cli.js +100 -0
- package/dist/test_host_install_e2e.js +324 -0
- package/dist/test_host_installer.js +259 -0
- package/dist/test_host_installers_gemini_codex.js +95 -0
- package/dist/test_host_uninstaller.js +295 -0
- package/dist/test_install_flow.js +70 -0
- package/dist/test_install_flow_host_validation.js +143 -0
- package/dist/test_install_wizard.js +272 -0
- package/dist/test_integration_gemini_live.js +95 -0
- package/dist/test_integration_http_trigger_live.js +154 -0
- package/dist/test_integration_telegram_live.js +102 -0
- package/dist/test_job_lifecycle.js +16 -0
- package/dist/test_memory_orchestrator.js +33 -0
- package/dist/test_memory_promotion.js +36 -0
- package/dist/test_memory_retention.js +37 -0
- package/dist/test_mission_checkpoint.js +204 -0
- package/dist/test_multi_host_docs_parity.js +125 -0
- package/dist/test_openlife_auto_creator_routing.js +69 -0
- package/dist/test_openlife_evolution_surface.js +77 -0
- package/dist/test_openlife_gatekeeper_routing.js +15 -0
- package/dist/test_openlife_routing_surface.js +27 -0
- package/dist/test_openlife_runtime_source_truth.js +25 -0
- package/dist/test_operating_system.js +45 -0
- package/dist/test_optimization_loop.js +38 -0
- package/dist/test_orchestration_assets_lifecycle.js +78 -0
- package/dist/test_outcome_simulator.js +38 -0
- package/dist/test_performance_latency.js +215 -0
- package/dist/test_performance_scorecard.js +38 -0
- package/dist/test_phase1_check_exit.js +103 -0
- package/dist/test_phase6_board.js +31 -0
- package/dist/test_phase6_cadence.js +29 -0
- package/dist/test_phase6_ops.js +37 -0
- package/dist/test_post_mission_evaluation.js +190 -0
- package/dist/test_process_sandbox.js +88 -0
- package/dist/test_profile_toolset_mcp.js +125 -0
- package/dist/test_queue_scheduler.js +239 -0
- package/dist/test_release_gate.js +23 -0
- package/dist/test_remote_publish.js +193 -0
- package/dist/test_reversa_contracts_e2e.js +48 -0
- package/dist/test_reversa_export_and_strict.js +51 -0
- package/dist/test_reversa_full_execution.js +12 -0
- package/dist/test_reversa_lite.js +9 -0
- package/dist/test_royal_stack_golden.js +179 -0
- package/dist/test_runtime_health_backoff.js +154 -0
- package/dist/test_runtime_policy.js +26 -0
- package/dist/test_runtime_probe.js +19 -0
- package/dist/test_runtime_profile_oauth_only.js +262 -0
- package/dist/test_runtime_registry.js +11 -0
- package/dist/test_security_download_and_scan.js +103 -0
- package/dist/test_security_download_guard.js +14 -0
- package/dist/test_service_command_surface.js +12 -0
- package/dist/test_service_completion_policy.js +32 -0
- package/dist/test_service_guardrails_delete.js +12 -0
- package/dist/test_service_mode_explicit_only.js +174 -0
- package/dist/test_sources_import_ref.js +46 -0
- package/dist/test_sources_scaffold.js +43 -0
- package/dist/test_squad_skill_creator.js +305 -0
- package/dist/test_squad_skill_design_llm.js +176 -0
- package/dist/test_subsystems_org_state.js +271 -0
- package/dist/test_subsystems_promotion_memory_assets.js +343 -0
- package/dist/test_subsystems_routing_governance.js +234 -0
- package/dist/test_task_executor_sandbox_optin.js +127 -0
- package/dist/test_teammate_learning.js +15 -0
- package/dist/test_telegram_delete_guardrail.js +21 -0
- package/dist/test_toolset_enforcement.js +188 -0
- package/dist/test_trigger_basic_auth.js +112 -0
- package/dist/test_util/doc_parity.js +120 -0
- package/dist/test_v15_e2e_integration.js +207 -0
- package/dist/test_watchdog_heartbeat.js +152 -0
- package/dist/test_workflow_condition_parser.js +63 -0
- package/dist/test_workflow_e2e.js +240 -0
- package/dist/test_workflow_engine.js +330 -0
- package/dist/test_workflow_parser.js +245 -0
- package/dist/test_workflow_schema_backward_compat.js +197 -0
- package/dist-templates/README.md +91 -0
- package/dist-templates/claude-code/agents/openlife-atlas.md +52 -0
- package/dist-templates/claude-code/agents/openlife-forge.md +42 -0
- package/dist-templates/claude-code/agents/openlife-genesis.md +59 -0
- package/dist-templates/claude-code/agents/openlife-lyra.md +40 -0
- package/dist-templates/claude-code/agents/openlife-maestro.md +45 -0
- package/dist-templates/claude-code/commands/openlife/ask.md +14 -0
- package/dist-templates/claude-code/commands/openlife/doctor.md +19 -0
- package/dist-templates/claude-code/commands/openlife/dream.md +20 -0
- package/dist-templates/claude-code/commands/openlife/status.md +14 -0
- package/dist-templates/claude-code/mcp/openlife-orchestrator.json +46 -0
- package/dist-templates/codex/README.md +7 -0
- package/dist-templates/codex/agents/openlife-atlas.md +52 -0
- package/dist-templates/codex/agents/openlife-forge.md +42 -0
- package/dist-templates/codex/agents/openlife-genesis.md +59 -0
- package/dist-templates/codex/agents/openlife-lyra.md +40 -0
- package/dist-templates/codex/agents/openlife-maestro.md +45 -0
- package/dist-templates/codex/commands/openlife/ask.md +14 -0
- package/dist-templates/codex/commands/openlife/doctor.md +19 -0
- package/dist-templates/codex/commands/openlife/dream.md +20 -0
- package/dist-templates/codex/commands/openlife/status.md +14 -0
- package/dist-templates/codex/mcp/openlife-orchestrator.json +46 -0
- package/dist-templates/gemini-cli/README.md +8 -0
- package/dist-templates/gemini-cli/agents/openlife-atlas.md +52 -0
- package/dist-templates/gemini-cli/agents/openlife-forge.md +42 -0
- package/dist-templates/gemini-cli/agents/openlife-genesis.md +59 -0
- package/dist-templates/gemini-cli/agents/openlife-lyra.md +40 -0
- package/dist-templates/gemini-cli/agents/openlife-maestro.md +45 -0
- package/dist-templates/gemini-cli/commands/openlife/ask.md +14 -0
- package/dist-templates/gemini-cli/commands/openlife/doctor.md +19 -0
- package/dist-templates/gemini-cli/commands/openlife/dream.md +20 -0
- package/dist-templates/gemini-cli/commands/openlife/status.md +14 -0
- package/dist-templates/gemini-cli/mcp/openlife-orchestrator.json +46 -0
- package/dist-templates/skill-template/README.md +34 -0
- package/dist-templates/skill-template/SKILL.md.template +59 -0
- package/dist-templates/squad-template/README.md +82 -0
- package/dist-templates/squad-template/SQUAD.md.template +51 -0
- package/dist-templates/squad-template/agent-template.md +51 -0
- package/dist-templates/squad-template/checklist-template.md +25 -0
- package/dist-templates/squad-template/task-template.md +36 -0
- package/dist-templates/workflows/PORTED_WORKFLOWS.md +60 -0
- package/dist-templates/workflows/brownfield-discovery.yaml +137 -0
- package/dist-templates/workflows/greenfield-fullstack.yaml +132 -0
- package/dist-templates/workflows/qa-loop.yaml +125 -0
- package/dist-templates/workflows/story-development-cycle.yaml +80 -0
- package/docs/CHANGELOG_FEATURE_ROLLOUT_DESIGNMD.md +43 -0
- package/docs/EXTERNAL_SOURCES_AND_SECURITY_GUARD.md +33 -0
- package/docs/OPENLIFE_AUDIT_2026-05-06.md +170 -0
- package/docs/OPENLIFE_CONSOLIDATED_PLAN_2026-05-06.md +299 -0
- package/docs/OPENLIFE_DUAL_MODE_IMPLEMENTATION_PLAN.md +205 -0
- package/docs/OPENLIFE_EVOLUTION_SURFACE_2026-05-07.md +53 -0
- package/docs/OPENLIFE_SKILLS_IMPORT_2026-05-07.json +223 -0
- package/docs/OPENLIFE_SQUADS_IMPORT_2026-05-07.json +184 -0
- package/docs/PAPERCLIP_OPENLIFE_INVESTIGATION.md +85 -0
- package/docs/README.md +28 -0
- package/docs/RELEASE_ORGANIZATION_PLAN.md +164 -0
- package/docs/audit/CLI-EXECUTION-RESULTS.md +113 -0
- package/docs/audit/CLI-MATRIX.md +556 -0
- package/docs/audit/DOC-PARITY-GAPS.md +351 -0
- package/docs/audit/ORCHESTRATOR-MATRIX.md +136 -0
- package/docs/audit/TEST-COVERAGE-GAPS.md +334 -0
- package/docs/audit/integrations/SKIPPED.md +101 -0
- package/docs/autonomous-install.md +79 -0
- package/docs/capability-genesis.md +137 -0
- package/docs/capability-pack-schema.md +157 -0
- package/docs/commands.md +82 -0
- package/docs/deep-research-capability.md +114 -0
- package/docs/development/typescript-conventions.md +95 -0
- package/docs/host-installers.md +68 -0
- package/docs/install/aiobuilder.md +70 -0
- package/docs/install/claude-code.md +83 -0
- package/docs/install/codex.md +64 -0
- package/docs/install/gemini-cli.md +64 -0
- package/docs/install/runtime-profiles.md +83 -0
- package/docs/openlife-agent-os-blueprint.md +114 -0
- package/docs/openlife-install-backlog.md +115 -0
- package/docs/openlife-install-spec.md +306 -0
- package/docs/operations/CLOUD_CUTOVER_AUDIT.md +37 -0
- package/docs/operations/PHASE_PROGRESS_CONTINUATION.md +24 -0
- package/docs/performance-benchmarks.md +83 -0
- package/docs/planning/v1.3-capability-genesis.md +157 -0
- package/docs/plans/2026-05-05-admin-interface-professional-dark-premium-plan.md +84 -0
- package/docs/plans/2026-05-05-openlife-autonomous-domain-marketplace-masterplan.md +122 -0
- package/docs/quickstart.md +60 -0
- package/docs/release-process.md +236 -0
- package/docs/roadmap/OPENLIFE_MASTER_PLAN_CLOUD_V3.md +97 -0
- package/docs/sandboxing-research.md +117 -0
- package/docs/stories/epic-feature-audit/1.1.story.md +84 -0
- package/docs/stories/epic-feature-audit/1.2.story.md +102 -0
- package/docs/stories/epic-feature-audit/1.3.story.md +93 -0
- package/docs/stories/epic-feature-audit/1.5.story.md +121 -0
- package/docs/stories/epic-feature-audit/1.6.story.md +80 -0
- package/docs/stories/epic-feature-completeness/2.1.story.md +70 -0
- package/docs/stories/epic-feature-completeness/2.2.story.md +49 -0
- package/docs/stories/epic-feature-completeness/2.3.story.md +74 -0
- package/docs/stories/epic-feature-completeness/2.4.story.md +71 -0
- package/docs/stories/epic-feature-completeness/3.1.story.md +56 -0
- package/docs/stories/epic-feature-completeness/3.2.story.md +80 -0
- package/docs/stories/epic-feature-completeness/3.3.story.md +68 -0
- package/docs/stories/epic-feature-completeness/3.4.story.md +71 -0
- package/docs/stories/epic-feature-completeness/3.5.story.md +72 -0
- package/docs/stories/epic-feature-completeness/3.6.story.md +69 -0
- package/docs/stories/epic-feature-completeness/3.7.story.md +68 -0
- package/docs/stories/epic-feature-completeness/3.8.story.md +57 -0
- package/docs/toolset-enforcement.md +122 -0
- package/docs/v1.4-changelog.md +159 -0
- package/docs/v1.5-changelog.md +106 -0
- package/docs/v1.5-roadmap.md +121 -0
- package/docs/v1.6-changelog.md +67 -0
- package/docs/v1.6-roadmap.md +89 -0
- package/docs/v1.7-changelog.md +98 -0
- package/docs/workflow-schema.md +177 -0
- package/package.json +177 -0
- package/scripts/clean-test-pollution.js +61 -0
- package/scripts/openlife-agent-start.sh +6 -0
- package/scripts/openlife-agent.service.example +13 -0
- package/scripts/openlife-agent.supervisord.conf.example +8 -0
- package/scripts/openlife-autonomous-install.sh +29 -0
- package/scripts/postinstall-check.sh +37 -0
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TaskExecutor = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const child_process = __importStar(require("child_process"));
|
|
40
|
+
const ToolsetGuard_1 = require("./toolset/ToolsetGuard");
|
|
41
|
+
const ProcessSandbox_1 = require("./ProcessSandbox");
|
|
42
|
+
class TaskExecutor {
|
|
43
|
+
artifactsDir;
|
|
44
|
+
commandTimeoutMs = 10 * 60 * 1000;
|
|
45
|
+
constructor() {
|
|
46
|
+
this.artifactsDir = path.join(process.cwd(), '.artifacts');
|
|
47
|
+
if (!fs.existsSync(this.artifactsDir)) {
|
|
48
|
+
fs.mkdirSync(this.artifactsDir, { recursive: true });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
async execute(kind, prompt, projectName) {
|
|
52
|
+
switch (kind) {
|
|
53
|
+
case 'gemini':
|
|
54
|
+
return this.executeWithGemini(prompt, projectName);
|
|
55
|
+
case 'claude':
|
|
56
|
+
return this.executeWithClaude(prompt, projectName, 'claude');
|
|
57
|
+
case 'openclaude':
|
|
58
|
+
return this.executeWithClaude(prompt, projectName, 'openclaude');
|
|
59
|
+
default:
|
|
60
|
+
return this.executeWithCodex(prompt, projectName);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async executeWithCodex(prompt, projectName) {
|
|
64
|
+
(0, ToolsetGuard_1.assertToolsetAllowed)('delegation', 'TaskExecutor.executeWithCodex');
|
|
65
|
+
const artifactDir = this.ensureArtifactDir(projectName);
|
|
66
|
+
const cwd = process.cwd();
|
|
67
|
+
const outputFile = path.join(artifactDir, 'codex-last-message.txt');
|
|
68
|
+
const stdoutFile = path.join(artifactDir, 'codex-stdout.jsonl');
|
|
69
|
+
const stderrFile = path.join(artifactDir, 'codex-stderr.txt');
|
|
70
|
+
const shellCommand = `cd ${JSON.stringify(cwd)} && codex exec --skip-git-repo-check --model gpt-5.4 --json --output-last-message ${JSON.stringify(outputFile)} ${JSON.stringify(prompt)} > ${JSON.stringify(stdoutFile)} 2> ${JSON.stringify(stderrFile)}`;
|
|
71
|
+
const startedAt = new Date().toISOString();
|
|
72
|
+
const startedMs = Date.now();
|
|
73
|
+
const result = await this.runShellCommand(shellCommand, cwd);
|
|
74
|
+
const finishedAt = new Date().toISOString();
|
|
75
|
+
const durationMs = Date.now() - startedMs;
|
|
76
|
+
const stdout = this.safeRead(stdoutFile);
|
|
77
|
+
const stderr = this.safeRead(stderrFile);
|
|
78
|
+
const finalMessage = fs.existsSync(outputFile) ? this.safeRead(outputFile).trim() : this.extractCodexFinalMessage(stdout);
|
|
79
|
+
if (result.code === 0 && finalMessage) {
|
|
80
|
+
const artifactPath = path.join(artifactDir, 'codex-result.txt');
|
|
81
|
+
fs.writeFileSync(artifactPath, finalMessage, 'utf-8');
|
|
82
|
+
const maskedStdout = this.maskSensitiveText(finalMessage);
|
|
83
|
+
const maskedStderr = this.maskSensitiveText(stderr);
|
|
84
|
+
const metadataPath = this.writeExecutionMetadata(artifactDir, {
|
|
85
|
+
executor: 'codex', ok: true, status: 'success', fallbackUsed: false, providerUnavailable: false, initRan: false,
|
|
86
|
+
projectName, artifactPath, stdout: maskedStdout, stderr: maskedStderr, command: ['/bin/bash', '-lc', shellCommand],
|
|
87
|
+
commandProvenance: shellCommand,
|
|
88
|
+
exitCode: result.code, signal: result.signal, startedAt, finishedAt, durationMs
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
executor: 'codex',
|
|
92
|
+
ok: true,
|
|
93
|
+
projectName,
|
|
94
|
+
artifactPath,
|
|
95
|
+
stdout: maskedStdout,
|
|
96
|
+
stderr: maskedStderr,
|
|
97
|
+
command: ['/bin/bash', '-lc', shellCommand],
|
|
98
|
+
commandProvenance: shellCommand,
|
|
99
|
+
exitCode: result.code,
|
|
100
|
+
signal: result.signal,
|
|
101
|
+
startedAt,
|
|
102
|
+
finishedAt,
|
|
103
|
+
durationMs,
|
|
104
|
+
metadataPath,
|
|
105
|
+
status: 'success',
|
|
106
|
+
fallbackUsed: false,
|
|
107
|
+
providerUnavailable: false,
|
|
108
|
+
initRan: false
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
const artifactPath = path.join(artifactDir, 'codex-error.txt');
|
|
112
|
+
fs.writeFileSync(artifactPath, `${finalMessage || stdout}\n\n${stderr}`, 'utf-8');
|
|
113
|
+
const maskedStdout = this.maskSensitiveText(finalMessage || stdout);
|
|
114
|
+
const maskedStderr = this.maskSensitiveText(stderr);
|
|
115
|
+
const metadataPath = this.writeExecutionMetadata(artifactDir, {
|
|
116
|
+
executor: 'codex', ok: false, status: 'failed', fallbackUsed: false, providerUnavailable: false, initRan: false,
|
|
117
|
+
projectName, artifactPath, stdout: maskedStdout, stderr: maskedStderr, command: ['/bin/bash', '-lc', shellCommand],
|
|
118
|
+
commandProvenance: shellCommand,
|
|
119
|
+
exitCode: result.code, signal: result.signal, startedAt, finishedAt, durationMs
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
executor: 'codex',
|
|
123
|
+
ok: false,
|
|
124
|
+
projectName,
|
|
125
|
+
artifactPath,
|
|
126
|
+
stdout: maskedStdout,
|
|
127
|
+
stderr: maskedStderr,
|
|
128
|
+
command: ['/bin/bash', '-lc', shellCommand],
|
|
129
|
+
commandProvenance: shellCommand,
|
|
130
|
+
exitCode: result.code,
|
|
131
|
+
signal: result.signal,
|
|
132
|
+
startedAt,
|
|
133
|
+
finishedAt,
|
|
134
|
+
durationMs,
|
|
135
|
+
metadataPath,
|
|
136
|
+
status: 'failed',
|
|
137
|
+
fallbackUsed: false,
|
|
138
|
+
providerUnavailable: false,
|
|
139
|
+
initRan: false
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
async executeWithGemini(prompt, projectName) {
|
|
143
|
+
(0, ToolsetGuard_1.assertToolsetAllowed)('delegation', 'TaskExecutor.executeWithGemini');
|
|
144
|
+
const artifactDir = this.ensureArtifactDir(projectName);
|
|
145
|
+
const cwd = process.cwd();
|
|
146
|
+
const stdoutFile = path.join(artifactDir, 'gemini-stdout.txt');
|
|
147
|
+
const stderrFile = path.join(artifactDir, 'gemini-stderr.txt');
|
|
148
|
+
const resultFile = path.join(artifactDir, 'gemini-result.txt');
|
|
149
|
+
const shellCommand = `cd ${JSON.stringify(cwd)} && gemini -o json -m gemini-2.5-pro -p ${JSON.stringify(prompt)} -y > ${JSON.stringify(stdoutFile)} 2> ${JSON.stringify(stderrFile)}`;
|
|
150
|
+
const startedAt = new Date().toISOString();
|
|
151
|
+
const startedMs = Date.now();
|
|
152
|
+
const result = await this.runShellCommand(shellCommand, cwd);
|
|
153
|
+
const finishedAt = new Date().toISOString();
|
|
154
|
+
const durationMs = Date.now() - startedMs;
|
|
155
|
+
const stdout = this.safeRead(stdoutFile);
|
|
156
|
+
const stderr = this.safeRead(stderrFile);
|
|
157
|
+
const finalMessage = this.extractGeminiFinalMessage(stdout);
|
|
158
|
+
if (result.code === 0 && finalMessage) {
|
|
159
|
+
fs.writeFileSync(resultFile, finalMessage, 'utf-8');
|
|
160
|
+
const maskedStdout = this.maskSensitiveText(finalMessage);
|
|
161
|
+
const maskedStderr = this.maskSensitiveText(stderr);
|
|
162
|
+
const metadataPath = this.writeExecutionMetadata(artifactDir, {
|
|
163
|
+
executor: 'gemini', ok: true, status: 'success', fallbackUsed: false, providerUnavailable: false, initRan: false,
|
|
164
|
+
projectName, artifactPath: resultFile, stdout: maskedStdout, stderr: maskedStderr, command: ['/bin/bash', '-lc', shellCommand],
|
|
165
|
+
commandProvenance: shellCommand,
|
|
166
|
+
exitCode: result.code, signal: result.signal, startedAt, finishedAt, durationMs
|
|
167
|
+
});
|
|
168
|
+
return {
|
|
169
|
+
executor: 'gemini',
|
|
170
|
+
ok: true,
|
|
171
|
+
projectName,
|
|
172
|
+
artifactPath: resultFile,
|
|
173
|
+
stdout: maskedStdout,
|
|
174
|
+
stderr: maskedStderr,
|
|
175
|
+
command: ['/bin/bash', '-lc', shellCommand],
|
|
176
|
+
commandProvenance: shellCommand,
|
|
177
|
+
exitCode: result.code,
|
|
178
|
+
signal: result.signal,
|
|
179
|
+
startedAt,
|
|
180
|
+
finishedAt,
|
|
181
|
+
durationMs,
|
|
182
|
+
metadataPath,
|
|
183
|
+
status: 'success',
|
|
184
|
+
fallbackUsed: false,
|
|
185
|
+
providerUnavailable: false,
|
|
186
|
+
initRan: false
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const artifactPath = path.join(artifactDir, 'gemini-error.txt');
|
|
190
|
+
fs.writeFileSync(artifactPath, `${stdout}\n\n${stderr}`, 'utf-8');
|
|
191
|
+
const providerUnavailable = /quota_exhausted|status 429|exhausted your capacity|retry with backoff/i.test(stderr);
|
|
192
|
+
const maskedStdout = this.maskSensitiveText(stdout);
|
|
193
|
+
const maskedStderr = this.maskSensitiveText(stderr);
|
|
194
|
+
const metadataPath = this.writeExecutionMetadata(artifactDir, {
|
|
195
|
+
executor: 'gemini', ok: false, status: providerUnavailable ? 'partial' : 'failed', fallbackUsed: false, providerUnavailable, initRan: false,
|
|
196
|
+
projectName, artifactPath, stdout: maskedStdout, stderr: maskedStderr, command: ['/bin/bash', '-lc', shellCommand],
|
|
197
|
+
commandProvenance: shellCommand,
|
|
198
|
+
exitCode: result.code, signal: result.signal, startedAt, finishedAt, durationMs
|
|
199
|
+
});
|
|
200
|
+
return {
|
|
201
|
+
executor: 'gemini',
|
|
202
|
+
ok: false,
|
|
203
|
+
projectName,
|
|
204
|
+
artifactPath,
|
|
205
|
+
stdout: maskedStdout,
|
|
206
|
+
stderr: maskedStderr,
|
|
207
|
+
command: ['/bin/bash', '-lc', shellCommand],
|
|
208
|
+
commandProvenance: shellCommand,
|
|
209
|
+
exitCode: result.code,
|
|
210
|
+
signal: result.signal,
|
|
211
|
+
startedAt,
|
|
212
|
+
finishedAt,
|
|
213
|
+
durationMs,
|
|
214
|
+
metadataPath,
|
|
215
|
+
status: providerUnavailable ? 'partial' : 'failed',
|
|
216
|
+
fallbackUsed: false,
|
|
217
|
+
providerUnavailable,
|
|
218
|
+
initRan: false
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
async executeWithClaude(prompt, projectName, cliName) {
|
|
222
|
+
const artifactDir = this.ensureArtifactDir(projectName);
|
|
223
|
+
const cwd = process.cwd();
|
|
224
|
+
const stdoutFile = path.join(artifactDir, `${cliName}-stdout.txt`);
|
|
225
|
+
const stderrFile = path.join(artifactDir, `${cliName}-stderr.txt`);
|
|
226
|
+
const resultFile = path.join(artifactDir, `${cliName}-result.txt`);
|
|
227
|
+
const initMetaFile = path.join(artifactDir, `${cliName}-init-meta.json`);
|
|
228
|
+
const initInstruction = this.buildClaudeInitInstruction(projectName);
|
|
229
|
+
const initCommand = this.buildClaudeInitCommand(cwd, cliName, initInstruction, stdoutFile, stderrFile);
|
|
230
|
+
const shouldInit = !this.hasClaudeInit(cwd);
|
|
231
|
+
if (shouldInit) {
|
|
232
|
+
const initResult = await this.runShellCommand(initCommand, cwd);
|
|
233
|
+
fs.writeFileSync(initMetaFile, JSON.stringify({ initialized: initResult.code === 0, cliName, cwd }, null, 2), 'utf-8');
|
|
234
|
+
}
|
|
235
|
+
const shellCommand = this.buildClaudeExecCommand(cwd, cliName, prompt, stdoutFile, stderrFile);
|
|
236
|
+
const startedAt = new Date().toISOString();
|
|
237
|
+
const startedMs = Date.now();
|
|
238
|
+
const result = await this.runShellCommand(shellCommand, cwd);
|
|
239
|
+
const finishedAt = new Date().toISOString();
|
|
240
|
+
const durationMs = Date.now() - startedMs;
|
|
241
|
+
const stdout = this.safeRead(stdoutFile);
|
|
242
|
+
const stderr = this.safeRead(stderrFile);
|
|
243
|
+
const finalMessage = stdout.trim();
|
|
244
|
+
if (result.code === 0 && finalMessage) {
|
|
245
|
+
fs.writeFileSync(resultFile, finalMessage, 'utf-8');
|
|
246
|
+
const maskedStdout = this.maskSensitiveText(finalMessage);
|
|
247
|
+
const maskedStderr = this.maskSensitiveText(stderr);
|
|
248
|
+
const metadataPath = this.writeExecutionMetadata(artifactDir, {
|
|
249
|
+
executor: cliName, ok: true, status: 'success', fallbackUsed: false, providerUnavailable: false, initRan: shouldInit,
|
|
250
|
+
projectName, artifactPath: resultFile, stdout: maskedStdout, stderr: maskedStderr, command: ['/bin/bash', '-lc', shellCommand],
|
|
251
|
+
commandProvenance: shellCommand,
|
|
252
|
+
exitCode: result.code, signal: result.signal, startedAt, finishedAt, durationMs
|
|
253
|
+
});
|
|
254
|
+
return {
|
|
255
|
+
executor: cliName,
|
|
256
|
+
ok: true,
|
|
257
|
+
projectName,
|
|
258
|
+
artifactPath: resultFile,
|
|
259
|
+
stdout: maskedStdout,
|
|
260
|
+
stderr: maskedStderr,
|
|
261
|
+
command: ['/bin/bash', '-lc', shellCommand],
|
|
262
|
+
commandProvenance: shellCommand,
|
|
263
|
+
exitCode: result.code,
|
|
264
|
+
signal: result.signal,
|
|
265
|
+
startedAt,
|
|
266
|
+
finishedAt,
|
|
267
|
+
durationMs,
|
|
268
|
+
metadataPath,
|
|
269
|
+
status: 'success',
|
|
270
|
+
fallbackUsed: false,
|
|
271
|
+
providerUnavailable: false,
|
|
272
|
+
initRan: shouldInit
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
const artifactPath = path.join(artifactDir, `${cliName}-error.txt`);
|
|
276
|
+
fs.writeFileSync(artifactPath, `${stdout}\n\n${stderr}`, 'utf-8');
|
|
277
|
+
const maskedStdout = this.maskSensitiveText(stdout);
|
|
278
|
+
const maskedStderr = this.maskSensitiveText(stderr);
|
|
279
|
+
const metadataPath = this.writeExecutionMetadata(artifactDir, {
|
|
280
|
+
executor: cliName, ok: false, status: 'failed', fallbackUsed: false, providerUnavailable: false, initRan: shouldInit,
|
|
281
|
+
projectName, artifactPath, stdout: maskedStdout, stderr: maskedStderr, command: ['/bin/bash', '-lc', shellCommand],
|
|
282
|
+
commandProvenance: shellCommand,
|
|
283
|
+
exitCode: result.code, signal: result.signal, startedAt, finishedAt, durationMs
|
|
284
|
+
});
|
|
285
|
+
return {
|
|
286
|
+
executor: cliName,
|
|
287
|
+
ok: false,
|
|
288
|
+
projectName,
|
|
289
|
+
artifactPath,
|
|
290
|
+
stdout: maskedStdout,
|
|
291
|
+
stderr: maskedStderr,
|
|
292
|
+
command: ['/bin/bash', '-lc', shellCommand],
|
|
293
|
+
commandProvenance: shellCommand,
|
|
294
|
+
exitCode: result.code,
|
|
295
|
+
signal: result.signal,
|
|
296
|
+
startedAt,
|
|
297
|
+
finishedAt,
|
|
298
|
+
durationMs,
|
|
299
|
+
metadataPath,
|
|
300
|
+
status: 'failed',
|
|
301
|
+
fallbackUsed: false,
|
|
302
|
+
providerUnavailable: false,
|
|
303
|
+
initRan: shouldInit
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
ensureArtifactDir(projectName) {
|
|
307
|
+
const artifactDir = path.join(this.artifactsDir, projectName);
|
|
308
|
+
if (!fs.existsSync(artifactDir)) {
|
|
309
|
+
fs.mkdirSync(artifactDir, { recursive: true });
|
|
310
|
+
}
|
|
311
|
+
return artifactDir;
|
|
312
|
+
}
|
|
313
|
+
safeRead(filePath) {
|
|
314
|
+
return fs.existsSync(filePath) ? fs.readFileSync(filePath, 'utf-8') : '';
|
|
315
|
+
}
|
|
316
|
+
async runShellCommand(shellCommand, cwd) {
|
|
317
|
+
(0, ToolsetGuard_1.assertToolsetAllowed)('terminal', 'TaskExecutor.runShellCommand');
|
|
318
|
+
// Story 18.2 (v1.6) — opt-in route through ProcessSandbox so the spawn
|
|
319
|
+
// path is consistent across the codebase and produces a structured
|
|
320
|
+
// telemetry envelope (enforced state, applied flags, captured stdout).
|
|
321
|
+
// For /bin/bash this is currently a pass-through — Node's --permission
|
|
322
|
+
// only applies when spawning Node itself — but the wiring is in place
|
|
323
|
+
// for the v1.7 work that will route node-script steps through the
|
|
324
|
+
// wrapper with real enforcement.
|
|
325
|
+
if ((process.env.OPENLIFE_PROCESS_SANDBOX || '').toLowerCase() === 'on') {
|
|
326
|
+
const sandbox = new ProcessSandbox_1.ProcessSandbox({ allowFsRead: [cwd], allowFsWrite: [path.join(cwd, '.artifacts')] });
|
|
327
|
+
const result = await sandbox.spawn('/bin/bash', ['-lc', shellCommand], { cwd, timeout: this.commandTimeoutMs });
|
|
328
|
+
return { code: result.code, signal: result.signal };
|
|
329
|
+
}
|
|
330
|
+
return new Promise((resolve) => {
|
|
331
|
+
const child = child_process.spawn('/bin/bash', ['-lc', shellCommand], {
|
|
332
|
+
cwd,
|
|
333
|
+
stdio: 'ignore'
|
|
334
|
+
});
|
|
335
|
+
const timer = setTimeout(() => {
|
|
336
|
+
child.kill('SIGTERM');
|
|
337
|
+
}, this.commandTimeoutMs);
|
|
338
|
+
child.on('close', (code, signal) => {
|
|
339
|
+
clearTimeout(timer);
|
|
340
|
+
resolve({ code, signal });
|
|
341
|
+
});
|
|
342
|
+
child.on('error', () => {
|
|
343
|
+
clearTimeout(timer);
|
|
344
|
+
resolve({ code: 1, signal: null });
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
hasClaudeInit(cwd) {
|
|
349
|
+
return fs.existsSync(path.join(cwd, 'CLAUDE.md')) || fs.existsSync(path.join(cwd, 'Claude.md'));
|
|
350
|
+
}
|
|
351
|
+
buildClaudeInitInstruction(projectName) {
|
|
352
|
+
return [
|
|
353
|
+
'/init',
|
|
354
|
+
'',
|
|
355
|
+
`Projeto: ${projectName}`,
|
|
356
|
+
'Gere o contexto inicial do projeto neste repositório.',
|
|
357
|
+
'Inclua também regras úteis de execução, arquitetura e comportamento do projeto.',
|
|
358
|
+
'Se este projeto já tiver Claude.md/CLAUDE.md, não regenere do zero desnecessariamente.'
|
|
359
|
+
].join('\n');
|
|
360
|
+
}
|
|
361
|
+
buildClaudeInitCommand(cwd, cliName, prompt, stdoutFile, stderrFile) {
|
|
362
|
+
if (cliName === 'claude') {
|
|
363
|
+
return `cd ${JSON.stringify(cwd)} && claude --dangerously-skip-permissions --print ${JSON.stringify(prompt)} > ${JSON.stringify(stdoutFile)} 2> ${JSON.stringify(stderrFile)}`;
|
|
364
|
+
}
|
|
365
|
+
return `cd ${JSON.stringify(cwd)} && openclaude ${JSON.stringify(prompt)} > ${JSON.stringify(stdoutFile)} 2> ${JSON.stringify(stderrFile)}`;
|
|
366
|
+
}
|
|
367
|
+
buildClaudeExecCommand(cwd, cliName, prompt, stdoutFile, stderrFile) {
|
|
368
|
+
if (cliName === 'claude') {
|
|
369
|
+
return `cd ${JSON.stringify(cwd)} && claude --dangerously-skip-permissions --print ${JSON.stringify(prompt)} > ${JSON.stringify(stdoutFile)} 2> ${JSON.stringify(stderrFile)}`;
|
|
370
|
+
}
|
|
371
|
+
return `cd ${JSON.stringify(cwd)} && openclaude ${JSON.stringify(prompt)} > ${JSON.stringify(stdoutFile)} 2> ${JSON.stringify(stderrFile)}`;
|
|
372
|
+
}
|
|
373
|
+
writeExecutionMetadata(artifactDir, payload) {
|
|
374
|
+
const metadataPath = path.join(artifactDir, 'execution-meta.json');
|
|
375
|
+
fs.writeFileSync(metadataPath, JSON.stringify(payload, null, 2), 'utf-8');
|
|
376
|
+
return metadataPath;
|
|
377
|
+
}
|
|
378
|
+
extractCodexFinalMessage(stdoutJsonl) {
|
|
379
|
+
const lines = stdoutJsonl.split('\n').map(l => l.trim()).filter(Boolean);
|
|
380
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
381
|
+
try {
|
|
382
|
+
const parsed = JSON.parse(lines[i]);
|
|
383
|
+
if (typeof parsed?.item?.text === 'string' && parsed.item.text.trim())
|
|
384
|
+
return parsed.item.text.trim();
|
|
385
|
+
if (typeof parsed?.message === 'string' && parsed.message.trim())
|
|
386
|
+
return parsed.message.trim();
|
|
387
|
+
if (typeof parsed?.content === 'string' && parsed.content.trim())
|
|
388
|
+
return parsed.content.trim();
|
|
389
|
+
}
|
|
390
|
+
catch {
|
|
391
|
+
continue;
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
return '';
|
|
395
|
+
}
|
|
396
|
+
extractGeminiFinalMessage(stdout) {
|
|
397
|
+
const trimmed = stdout.trim();
|
|
398
|
+
if (!trimmed)
|
|
399
|
+
return '';
|
|
400
|
+
const jsonStart = trimmed.indexOf('{');
|
|
401
|
+
if (jsonStart !== -1) {
|
|
402
|
+
try {
|
|
403
|
+
const parsed = JSON.parse(trimmed.slice(jsonStart));
|
|
404
|
+
if (typeof parsed?.response === 'string' && parsed.response.trim())
|
|
405
|
+
return parsed.response.trim();
|
|
406
|
+
if (typeof parsed?.text === 'string' && parsed.text.trim())
|
|
407
|
+
return parsed.text.trim();
|
|
408
|
+
}
|
|
409
|
+
catch {
|
|
410
|
+
// fallback abaixo
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return trimmed;
|
|
414
|
+
}
|
|
415
|
+
maskSensitiveText(text) {
|
|
416
|
+
return text
|
|
417
|
+
.replace(/\b(sk|ghp|sbp|hf|fc|rnd|vcp|gsk|sm)_[A-Za-z0-9\-_]+\b/g, '[REDACTED_TOKEN]')
|
|
418
|
+
.replace(/\bAIza[0-9A-Za-z\-_]{20,}\b/g, '[REDACTED_GOOGLE_KEY]')
|
|
419
|
+
.replace(/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g, '[REDACTED_EMAIL]');
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
exports.TaskExecutor = TaskExecutor;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TeammateBoardStore = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const AtomicWriter_1 = require("./util/AtomicWriter");
|
|
40
|
+
class TeammateBoardStore {
|
|
41
|
+
workspaceId;
|
|
42
|
+
filePath;
|
|
43
|
+
constructor(workspaceId = 'default') {
|
|
44
|
+
this.workspaceId = workspaceId;
|
|
45
|
+
this.filePath = path.join(process.cwd(), '.artifacts', 'workspaces', workspaceId, 'teammate-board.json');
|
|
46
|
+
fs.mkdirSync(path.dirname(this.filePath), { recursive: true });
|
|
47
|
+
}
|
|
48
|
+
list() { if (!fs.existsSync(this.filePath))
|
|
49
|
+
return []; return JSON.parse(fs.readFileSync(this.filePath, 'utf-8')); }
|
|
50
|
+
save(cards) { (0, AtomicWriter_1.writeJsonAtomic)(this.filePath, cards); }
|
|
51
|
+
upsert(card) {
|
|
52
|
+
const cards = this.list();
|
|
53
|
+
const idx = cards.findIndex((c) => c.id === card.id);
|
|
54
|
+
if (idx >= 0)
|
|
55
|
+
cards[idx] = card;
|
|
56
|
+
else
|
|
57
|
+
cards.push(card);
|
|
58
|
+
this.save(cards);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.TeammateBoardStore = TeammateBoardStore;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.TestHarness = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
const Brain_1 = require("./Brain");
|
|
40
|
+
const Gatekeeper_1 = require("./Gatekeeper");
|
|
41
|
+
const IntentClassifier_1 = require("./IntentClassifier");
|
|
42
|
+
const VoiceManager_1 = require("./VoiceManager");
|
|
43
|
+
const ModelManager_1 = require("./ModelManager");
|
|
44
|
+
const Gateway_1 = require("./Gateway");
|
|
45
|
+
const RuntimeProbe_1 = require("./RuntimeProbe");
|
|
46
|
+
const RuntimePolicy_1 = require("./RuntimePolicy");
|
|
47
|
+
class TestHarness {
|
|
48
|
+
brain = new Brain_1.Brain();
|
|
49
|
+
gatekeeper = new Gatekeeper_1.Gatekeeper();
|
|
50
|
+
voiceManager = new VoiceManager_1.VoiceManager();
|
|
51
|
+
modelManager = new ModelManager_1.ModelManager();
|
|
52
|
+
gateway = new Gateway_1.Gateway();
|
|
53
|
+
runtimeProbe = new RuntimeProbe_1.RuntimeProbe();
|
|
54
|
+
runtimePolicy = new RuntimePolicy_1.RuntimePolicy();
|
|
55
|
+
async runPhase1Checks() {
|
|
56
|
+
const results = [];
|
|
57
|
+
results.push(await this.checkModelConfig());
|
|
58
|
+
results.push(await this.checkRuntimeExecutors());
|
|
59
|
+
results.push(await this.checkRuntimePolicyChain());
|
|
60
|
+
results.push(await this.checkBrainPrimary());
|
|
61
|
+
results.push(await this.checkFastPathMemory());
|
|
62
|
+
results.push(await this.checkVoiceTts());
|
|
63
|
+
results.push(await this.checkGatewayText());
|
|
64
|
+
results.push(await this.checkGatewayImage());
|
|
65
|
+
return results;
|
|
66
|
+
}
|
|
67
|
+
async checkModelConfig() {
|
|
68
|
+
const config = this.modelManager.getModelConfig();
|
|
69
|
+
const deduped = [config.primary, ...config.fallbacks].map(m => m.raw);
|
|
70
|
+
const unique = new Set(deduped);
|
|
71
|
+
if (deduped.length !== unique.size) {
|
|
72
|
+
return { name: 'model-config', ok: false, detail: 'Há modelos duplicados na cadeia de fallback.' };
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
name: 'model-config',
|
|
76
|
+
ok: true,
|
|
77
|
+
detail: `Primário: ${config.primary.raw} | Fallbacks: ${config.fallbacks.map(f => f.raw).join(', ') || 'nenhum'}`
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
async checkRuntimeExecutors() {
|
|
81
|
+
try {
|
|
82
|
+
const probes = await this.runtimeProbe.probeAll();
|
|
83
|
+
const okCount = probes.filter((probe) => probe.available).length;
|
|
84
|
+
return {
|
|
85
|
+
name: 'runtime-executors',
|
|
86
|
+
ok: okCount >= 1,
|
|
87
|
+
detail: probes.map((probe) => `${probe.executor}:${probe.available ? 'ok' : 'fail'}:${probe.category}`).join(' | ')
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
return { name: 'runtime-executors', ok: false, detail: error instanceof Error ? error.message : String(error) };
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async checkRuntimePolicyChain() {
|
|
95
|
+
try {
|
|
96
|
+
const research = this.runtimePolicy.decide('RESEARCH_ANALYSIS');
|
|
97
|
+
const engineering = this.runtimePolicy.decide('ENGINEERING_BUILD');
|
|
98
|
+
const ok = research.preferred.length > 0 && engineering.preferred.length > 0;
|
|
99
|
+
return {
|
|
100
|
+
name: 'runtime-policy-chain',
|
|
101
|
+
ok,
|
|
102
|
+
detail: `research=${research.preferred.join('>')} | engineering=${engineering.preferred.join('>')}`
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
return { name: 'runtime-policy-chain', ok: false, detail: error instanceof Error ? error.message : String(error) };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
async checkBrainPrimary() {
|
|
110
|
+
try {
|
|
111
|
+
const response = await this.brain.think('Responda apenas com OK_BRAIN', 'OK_BRAIN');
|
|
112
|
+
const ok = response.includes('OK_BRAIN');
|
|
113
|
+
return {
|
|
114
|
+
name: 'brain-primary',
|
|
115
|
+
ok,
|
|
116
|
+
detail: ok ? 'Brain respondeu via runtime principal.' : `Resposta inesperada: ${response}`
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
return { name: 'brain-primary', ok: false, detail: error instanceof Error ? error.message : String(error) };
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
async checkFastPathMemory() {
|
|
124
|
+
try {
|
|
125
|
+
const response = await this.gatekeeper.routeTask({ intent: IntentClassifier_1.TaskIntent.KNOWLEDGE_RETRIEVAL, budgetLimit: 0.1, requiresHarness: false }, 'Responda apenas OK_MEMORY', 'phase1-test-user');
|
|
126
|
+
const ok = typeof response === 'string' && response.length > 0;
|
|
127
|
+
return {
|
|
128
|
+
name: 'fastpath-memory',
|
|
129
|
+
ok,
|
|
130
|
+
detail: ok ? `Gatekeeper respondeu (${response.slice(0, 120)})` : 'Gatekeeper não respondeu.'
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
return { name: 'fastpath-memory', ok: false, detail: error instanceof Error ? error.message : String(error) };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async checkVoiceTts() {
|
|
138
|
+
try {
|
|
139
|
+
const outputPath = await this.voiceManager.generateSpeech('Teste de voz do OpenLife.');
|
|
140
|
+
const exists = fs.existsSync(outputPath);
|
|
141
|
+
return {
|
|
142
|
+
name: 'voice-tts',
|
|
143
|
+
ok: exists,
|
|
144
|
+
detail: exists ? `Áudio gerado em ${path.basename(outputPath)}` : 'Arquivo de áudio não foi criado.'
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
return { name: 'voice-tts', ok: false, detail: error instanceof Error ? error.message : String(error) };
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
async checkGatewayText() {
|
|
152
|
+
try {
|
|
153
|
+
const response = await this.gateway.processTextForTest('phase1-gateway-user', 'Responda apenas OK_GATEWAY');
|
|
154
|
+
const ok = typeof response === 'string' && response.length > 0;
|
|
155
|
+
return {
|
|
156
|
+
name: 'gateway-text',
|
|
157
|
+
ok,
|
|
158
|
+
detail: ok ? `Gateway respondeu (${response.slice(0, 120)})` : 'Gateway não retornou resposta.'
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
return { name: 'gateway-text', ok: false, detail: error instanceof Error ? error.message : String(error) };
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
async checkGatewayImage() {
|
|
166
|
+
try {
|
|
167
|
+
const imagePath = path.join(process.cwd(), '.temp_images', 'AgACAgEAAxkBAAMcadbcsuXT9sQEbNGuKEEPX1fiMLEAAkgMaxtdRbhGvMTAvX1tmS8BAAMCAAN5AAM7BA.jpg');
|
|
168
|
+
if (!fs.existsSync(imagePath)) {
|
|
169
|
+
return { name: 'gateway-image', ok: true, detail: 'Imagem de teste ausente; check multimodal pulado explicitamente. Adicione fixture em .temp_images para validar visão completa.' };
|
|
170
|
+
}
|
|
171
|
+
const response = await this.gateway.processImageForTest('phase1-image-user', imagePath, 'Descreva esta imagem em uma frase.');
|
|
172
|
+
const ok = typeof response === 'string' && response.length > 0 && !response.includes('CRITICAL ERROR');
|
|
173
|
+
return {
|
|
174
|
+
name: 'gateway-image',
|
|
175
|
+
ok,
|
|
176
|
+
detail: ok ? `Gateway imagem respondeu (${response.slice(0, 120)})` : `Resposta inválida: ${response}`
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
return { name: 'gateway-image', ok: false, detail: error instanceof Error ? error.message : String(error) };
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
exports.TestHarness = TestHarness;
|