@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,260 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* QueueScheduler — background mission queue poller for the autonomous
|
|
4
|
+
* daemon profile.
|
|
5
|
+
*
|
|
6
|
+
* Story 6.3 — OpenLife v1.2 Royal Stack.
|
|
7
|
+
*
|
|
8
|
+
* Reads `.openlife/agent-queue.json`, picks the next `pending` mission,
|
|
9
|
+
* acquires a per-mission DistributedLock, marks it `running`, runs an
|
|
10
|
+
* injected MissionExecutor, marks the terminal state, and persists the
|
|
11
|
+
* queue via AtomicWriter. Concurrency capped by maxConcurrent (default 3).
|
|
12
|
+
*
|
|
13
|
+
* Opt-in via OPENLIFE_QUEUE_POLL_INTERVAL_MS env var or explicit
|
|
14
|
+
* `start({pollIntervalMs})`. Off by default — `start --daemon` gateway
|
|
15
|
+
* passes `--enable-queue` to flip it on. Keeps the existing Gateway
|
|
16
|
+
* event-driven path unchanged.
|
|
17
|
+
*
|
|
18
|
+
* Crash semantics: a process restart finds `running` items orphaned (no
|
|
19
|
+
* lock holder, no executing process). `reconcileOrphans()` on start
|
|
20
|
+
* resets those back to `pending` so the next worker picks them up.
|
|
21
|
+
*/
|
|
22
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
25
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
26
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(o, k2, desc);
|
|
29
|
+
}) : (function(o, m, k, k2) {
|
|
30
|
+
if (k2 === undefined) k2 = k;
|
|
31
|
+
o[k2] = m[k];
|
|
32
|
+
}));
|
|
33
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
34
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
35
|
+
}) : function(o, v) {
|
|
36
|
+
o["default"] = v;
|
|
37
|
+
});
|
|
38
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
39
|
+
var ownKeys = function(o) {
|
|
40
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
41
|
+
var ar = [];
|
|
42
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
43
|
+
return ar;
|
|
44
|
+
};
|
|
45
|
+
return ownKeys(o);
|
|
46
|
+
};
|
|
47
|
+
return function (mod) {
|
|
48
|
+
if (mod && mod.__esModule) return mod;
|
|
49
|
+
var result = {};
|
|
50
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
51
|
+
__setModuleDefault(result, mod);
|
|
52
|
+
return result;
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
55
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
56
|
+
exports.QueueScheduler = exports.NoopMissionExecutor = void 0;
|
|
57
|
+
const fs = __importStar(require("fs"));
|
|
58
|
+
const path = __importStar(require("path"));
|
|
59
|
+
const AtomicWriter_1 = require("./util/AtomicWriter");
|
|
60
|
+
const DistributedLock_1 = require("./util/DistributedLock");
|
|
61
|
+
class NoopMissionExecutor {
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/require-await
|
|
63
|
+
async execute() {
|
|
64
|
+
return { status: 'completed' };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
exports.NoopMissionExecutor = NoopMissionExecutor;
|
|
68
|
+
class QueueScheduler {
|
|
69
|
+
queueFile;
|
|
70
|
+
pollIntervalMs;
|
|
71
|
+
maxConcurrent;
|
|
72
|
+
executor;
|
|
73
|
+
lock;
|
|
74
|
+
maxAttempts;
|
|
75
|
+
timer = null;
|
|
76
|
+
running = new Set();
|
|
77
|
+
pollPromise = null;
|
|
78
|
+
shuttingDown = false;
|
|
79
|
+
constructor(opts = {}) {
|
|
80
|
+
const stateDir = process.env.OPENLIFE_STATE_DIR || path.join(process.cwd(), '.openlife');
|
|
81
|
+
this.queueFile = opts.queueFile || path.join(stateDir, 'agent-queue.json');
|
|
82
|
+
this.pollIntervalMs = opts.pollIntervalMs ?? Number(process.env.OPENLIFE_QUEUE_POLL_INTERVAL_MS || 10_000);
|
|
83
|
+
this.maxConcurrent = opts.maxConcurrent ?? 3;
|
|
84
|
+
this.executor = opts.executor || new NoopMissionExecutor();
|
|
85
|
+
this.lock = opts.lock || new DistributedLock_1.DistributedLock();
|
|
86
|
+
this.maxAttempts = opts.maxAttempts ?? 5;
|
|
87
|
+
}
|
|
88
|
+
/** Add a mission to the queue. Atomic. */
|
|
89
|
+
enqueue(spec) {
|
|
90
|
+
const q = this.read();
|
|
91
|
+
const mission = {
|
|
92
|
+
...spec,
|
|
93
|
+
enqueuedAt: new Date().toISOString(),
|
|
94
|
+
status: 'pending',
|
|
95
|
+
attempts: 0,
|
|
96
|
+
};
|
|
97
|
+
q.items.push(mission);
|
|
98
|
+
this.write(q);
|
|
99
|
+
return mission;
|
|
100
|
+
}
|
|
101
|
+
/** Inspect the queue without modification. */
|
|
102
|
+
list() {
|
|
103
|
+
return this.read().items;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Reset any 'running' missions back to 'pending'. Call on boot to
|
|
107
|
+
* recover from a previous crash that left missions mid-flight.
|
|
108
|
+
*/
|
|
109
|
+
reconcileOrphans() {
|
|
110
|
+
const q = this.read();
|
|
111
|
+
let reset = 0;
|
|
112
|
+
for (const item of q.items) {
|
|
113
|
+
if (item.status === 'running') {
|
|
114
|
+
item.status = 'pending';
|
|
115
|
+
item.startedAt = undefined;
|
|
116
|
+
reset += 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (reset > 0)
|
|
120
|
+
this.write(q);
|
|
121
|
+
return reset;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Start the poll loop. Performs an immediate reconcileOrphans() then
|
|
125
|
+
* schedules periodic ticks. Idempotent.
|
|
126
|
+
*/
|
|
127
|
+
start() {
|
|
128
|
+
if (this.timer)
|
|
129
|
+
return;
|
|
130
|
+
this.reconcileOrphans();
|
|
131
|
+
// Immediate tick + interval
|
|
132
|
+
void this.tick();
|
|
133
|
+
this.timer = setInterval(() => { void this.tick(); }, this.pollIntervalMs);
|
|
134
|
+
if (typeof this.timer.unref === 'function')
|
|
135
|
+
this.timer.unref();
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Gracefully stop. Awaits the current tick to settle (no new picks)
|
|
139
|
+
* but does not wait for in-flight missions to finish — those continue
|
|
140
|
+
* on their own promises. Idempotent.
|
|
141
|
+
*/
|
|
142
|
+
async stop() {
|
|
143
|
+
this.shuttingDown = true;
|
|
144
|
+
if (this.timer) {
|
|
145
|
+
clearInterval(this.timer);
|
|
146
|
+
this.timer = null;
|
|
147
|
+
}
|
|
148
|
+
if (this.pollPromise) {
|
|
149
|
+
try {
|
|
150
|
+
await this.pollPromise;
|
|
151
|
+
}
|
|
152
|
+
catch { /* swallow */ }
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** Force one poll iteration (used by tests). */
|
|
156
|
+
async tick() {
|
|
157
|
+
if (this.shuttingDown)
|
|
158
|
+
return;
|
|
159
|
+
if (this.pollPromise)
|
|
160
|
+
return; // already polling
|
|
161
|
+
this.pollPromise = (async () => {
|
|
162
|
+
try {
|
|
163
|
+
await this.poll();
|
|
164
|
+
}
|
|
165
|
+
finally {
|
|
166
|
+
this.pollPromise = null;
|
|
167
|
+
}
|
|
168
|
+
})();
|
|
169
|
+
return this.pollPromise;
|
|
170
|
+
}
|
|
171
|
+
// ─────────────────────────────────────────────────────────
|
|
172
|
+
// Internals
|
|
173
|
+
// ─────────────────────────────────────────────────────────
|
|
174
|
+
async poll() {
|
|
175
|
+
const q = this.read();
|
|
176
|
+
const slots = this.maxConcurrent - this.running.size;
|
|
177
|
+
if (slots <= 0)
|
|
178
|
+
return;
|
|
179
|
+
let picked = 0;
|
|
180
|
+
for (const item of q.items) {
|
|
181
|
+
if (picked >= slots)
|
|
182
|
+
break;
|
|
183
|
+
if (item.status !== 'pending')
|
|
184
|
+
continue;
|
|
185
|
+
if (this.running.has(item.id))
|
|
186
|
+
continue;
|
|
187
|
+
// Attempt to acquire the per-mission lock
|
|
188
|
+
const acq = this.lock.acquire(`mission:${item.id}`, this.pollIntervalMs * 4, { startHeartbeat: true });
|
|
189
|
+
if (!acq.ok)
|
|
190
|
+
continue;
|
|
191
|
+
item.status = 'running';
|
|
192
|
+
item.startedAt = new Date().toISOString();
|
|
193
|
+
item.attempts += 1;
|
|
194
|
+
this.running.add(item.id);
|
|
195
|
+
picked += 1;
|
|
196
|
+
// Persist the running transition before dispatching
|
|
197
|
+
this.writeItems(q.items);
|
|
198
|
+
// Fire-and-track the execution without blocking the poll loop
|
|
199
|
+
void this.runMission(item, acq.lockId);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
async runMission(item, lockId) {
|
|
203
|
+
let result;
|
|
204
|
+
try {
|
|
205
|
+
result = await this.executor.execute(item);
|
|
206
|
+
}
|
|
207
|
+
catch (err) {
|
|
208
|
+
result = { status: 'failed', error: err instanceof Error ? err.message : String(err) };
|
|
209
|
+
}
|
|
210
|
+
const q = this.read();
|
|
211
|
+
const ref = q.items.find((m) => m.id === item.id);
|
|
212
|
+
if (ref) {
|
|
213
|
+
if (result.status === 'completed') {
|
|
214
|
+
ref.status = 'completed';
|
|
215
|
+
ref.completedAt = new Date().toISOString();
|
|
216
|
+
ref.lastError = undefined;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
ref.lastError = result.error;
|
|
220
|
+
if (ref.attempts >= this.maxAttempts) {
|
|
221
|
+
ref.status = 'failed';
|
|
222
|
+
ref.completedAt = new Date().toISOString();
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
// Re-queue for another attempt
|
|
226
|
+
ref.status = 'pending';
|
|
227
|
+
ref.startedAt = undefined;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
this.writeItems(q.items);
|
|
231
|
+
}
|
|
232
|
+
this.lock.release(lockId);
|
|
233
|
+
this.running.delete(item.id);
|
|
234
|
+
}
|
|
235
|
+
read() {
|
|
236
|
+
if (!fs.existsSync(this.queueFile))
|
|
237
|
+
return { items: [] };
|
|
238
|
+
try {
|
|
239
|
+
const raw = JSON.parse(fs.readFileSync(this.queueFile, 'utf-8'));
|
|
240
|
+
if (Array.isArray(raw.items))
|
|
241
|
+
return raw;
|
|
242
|
+
return { items: [] };
|
|
243
|
+
}
|
|
244
|
+
catch {
|
|
245
|
+
return { items: [] };
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
write(payload) {
|
|
249
|
+
payload.lastFlushedAt = new Date().toISOString();
|
|
250
|
+
(0, AtomicWriter_1.writeJsonAtomic)(this.queueFile, payload);
|
|
251
|
+
}
|
|
252
|
+
writeItems(items) {
|
|
253
|
+
this.write({ items, lastFlushedAt: new Date().toISOString() });
|
|
254
|
+
}
|
|
255
|
+
/** Exposed for tests. */
|
|
256
|
+
_queueFile() {
|
|
257
|
+
return this.queueFile;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
exports.QueueScheduler = QueueScheduler;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReleaseGate = void 0;
|
|
4
|
+
const SystemDoctor_1 = require("./SystemDoctor");
|
|
5
|
+
const TestHarness_1 = require("./TestHarness");
|
|
6
|
+
const ReleaseWorkflow_1 = require("./ReleaseWorkflow");
|
|
7
|
+
const OperatingSystem_1 = require("./OperatingSystem");
|
|
8
|
+
class ReleaseGate {
|
|
9
|
+
doctor;
|
|
10
|
+
harness;
|
|
11
|
+
workflow;
|
|
12
|
+
operatingSystem;
|
|
13
|
+
constructor() {
|
|
14
|
+
this.doctor = new SystemDoctor_1.SystemDoctor();
|
|
15
|
+
this.harness = new TestHarness_1.TestHarness();
|
|
16
|
+
this.workflow = new ReleaseWorkflow_1.ReleaseWorkflow();
|
|
17
|
+
this.operatingSystem = new OperatingSystem_1.OperatingSystem();
|
|
18
|
+
}
|
|
19
|
+
async run(releaseId, missionId) {
|
|
20
|
+
const staticChecks = this.doctor.run();
|
|
21
|
+
const runtimeChecks = await this.doctor.runRuntimeChecks();
|
|
22
|
+
const harnessChecks = await this.harness.runPhase1Checks();
|
|
23
|
+
const checks = [
|
|
24
|
+
...staticChecks.map((check) => ({ name: `doctor:${check.name}`, ok: check.ok })),
|
|
25
|
+
...runtimeChecks.map((check) => ({ name: `runtime:${check.name}`, ok: check.ok })),
|
|
26
|
+
...harnessChecks.map((check) => ({ name: `harness:${check.name}`, ok: check.ok }))
|
|
27
|
+
];
|
|
28
|
+
if (missionId) {
|
|
29
|
+
const decision = this.operatingSystem.decide(missionId);
|
|
30
|
+
checks.push({ name: `ops:shouldRelease`, ok: decision.shouldRelease });
|
|
31
|
+
checks.push({ name: `ops:noBlockers`, ok: decision.blockers.length === 0 });
|
|
32
|
+
}
|
|
33
|
+
return this.workflow.create(releaseId, checks);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.ReleaseGate = ReleaseGate;
|
|
@@ -0,0 +1,68 @@
|
|
|
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.ReleaseWorkflow = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
class ReleaseWorkflow {
|
|
40
|
+
filePath;
|
|
41
|
+
constructor() {
|
|
42
|
+
this.filePath = path.join(process.cwd(), '.artifacts', 'release-checklists.json');
|
|
43
|
+
fs.mkdirSync(path.dirname(this.filePath), { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
create(releaseId, checks) {
|
|
46
|
+
const checklist = {
|
|
47
|
+
releaseId,
|
|
48
|
+
checks,
|
|
49
|
+
approved: checks.every((check) => check.ok),
|
|
50
|
+
createdAt: new Date().toISOString()
|
|
51
|
+
};
|
|
52
|
+
const all = this.getAll();
|
|
53
|
+
all.push(checklist);
|
|
54
|
+
fs.writeFileSync(this.filePath, JSON.stringify(all, null, 2), 'utf-8');
|
|
55
|
+
return checklist;
|
|
56
|
+
}
|
|
57
|
+
getAll() {
|
|
58
|
+
if (!fs.existsSync(this.filePath))
|
|
59
|
+
return [];
|
|
60
|
+
try {
|
|
61
|
+
return JSON.parse(fs.readFileSync(this.filePath, 'utf-8'));
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.ReleaseWorkflow = ReleaseWorkflow;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* RemotePublisher — Story 14.1 (v1.5)
|
|
4
|
+
*
|
|
5
|
+
* Pushes a sealed asset (Squad or Skill) to a remote registry over HTTPS.
|
|
6
|
+
* OpenLife does not yet bundle a registry of its own — this module ships
|
|
7
|
+
* the client-side surface so any HTTPS endpoint that accepts an
|
|
8
|
+
* authenticated PUT can serve as the registry.
|
|
9
|
+
*
|
|
10
|
+
* Wire-up:
|
|
11
|
+
* • Activate by setting OPENLIFE_REMOTE_PUBLISH_URL (base URL).
|
|
12
|
+
* • Optional OPENLIFE_REMOTE_PUBLISH_TOKEN — sent as `Authorization: Bearer ...`.
|
|
13
|
+
* • Each publish request is: PUT <base>/<kind>/<id>/<sha256>.md
|
|
14
|
+
* with the asset markdown as the request body and the SHA-256 in
|
|
15
|
+
* the `X-Asset-Sha256` header so the server can verify integrity.
|
|
16
|
+
*
|
|
17
|
+
* Failure shape: never throws. Returns
|
|
18
|
+
* { ok: false, error: '<stable-code>', detail?: '<short>' }
|
|
19
|
+
* with stable codes:
|
|
20
|
+
* • 'remote_publish_not_configured' — no URL env var set
|
|
21
|
+
* • 'invalid_url' — base URL is malformed
|
|
22
|
+
* • 'fetch_error' — network / abort
|
|
23
|
+
* • 'http_<status>' — non-2xx response
|
|
24
|
+
* • 'asset_not_found' — local file disappeared mid-flight
|
|
25
|
+
* • 'sha_mismatch_local' — local re-hash != provided sha256
|
|
26
|
+
*/
|
|
27
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
30
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
31
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
32
|
+
}
|
|
33
|
+
Object.defineProperty(o, k2, desc);
|
|
34
|
+
}) : (function(o, m, k, k2) {
|
|
35
|
+
if (k2 === undefined) k2 = k;
|
|
36
|
+
o[k2] = m[k];
|
|
37
|
+
}));
|
|
38
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
39
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
40
|
+
}) : function(o, v) {
|
|
41
|
+
o["default"] = v;
|
|
42
|
+
});
|
|
43
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
44
|
+
var ownKeys = function(o) {
|
|
45
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
46
|
+
var ar = [];
|
|
47
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
48
|
+
return ar;
|
|
49
|
+
};
|
|
50
|
+
return ownKeys(o);
|
|
51
|
+
};
|
|
52
|
+
return function (mod) {
|
|
53
|
+
if (mod && mod.__esModule) return mod;
|
|
54
|
+
var result = {};
|
|
55
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
56
|
+
__setModuleDefault(result, mod);
|
|
57
|
+
return result;
|
|
58
|
+
};
|
|
59
|
+
})();
|
|
60
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
61
|
+
exports.RemotePublisher = void 0;
|
|
62
|
+
const fs = __importStar(require("fs"));
|
|
63
|
+
class RemotePublisher {
|
|
64
|
+
baseUrl;
|
|
65
|
+
token;
|
|
66
|
+
fetchImpl;
|
|
67
|
+
timeoutMs;
|
|
68
|
+
constructor(opts = {}) {
|
|
69
|
+
this.baseUrl = opts.baseUrl ?? (process.env.OPENLIFE_REMOTE_PUBLISH_URL || '');
|
|
70
|
+
this.token = opts.token ?? (process.env.OPENLIFE_REMOTE_PUBLISH_TOKEN || '');
|
|
71
|
+
this.fetchImpl = opts.fetchImpl ?? globalThis.fetch;
|
|
72
|
+
this.timeoutMs = opts.timeoutMs ?? 15_000;
|
|
73
|
+
}
|
|
74
|
+
isConfigured() {
|
|
75
|
+
return this.baseUrl.trim().length > 0;
|
|
76
|
+
}
|
|
77
|
+
async publishAsset(kind, id, sha256, file) {
|
|
78
|
+
if (!this.isConfigured()) {
|
|
79
|
+
return { ok: false, error: 'remote_publish_not_configured', detail: 'set OPENLIFE_REMOTE_PUBLISH_URL' };
|
|
80
|
+
}
|
|
81
|
+
const url = this.buildUrl(kind, id, sha256);
|
|
82
|
+
if (!url)
|
|
83
|
+
return { ok: false, error: 'invalid_url' };
|
|
84
|
+
if (!fs.existsSync(file))
|
|
85
|
+
return { ok: false, error: 'asset_not_found', detail: file };
|
|
86
|
+
let body;
|
|
87
|
+
try {
|
|
88
|
+
body = fs.readFileSync(file, 'utf-8');
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
return { ok: false, error: 'asset_not_found', detail: err instanceof Error ? err.message : String(err) };
|
|
92
|
+
}
|
|
93
|
+
// Defensive: re-hash locally to make sure the caller didn't drift.
|
|
94
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
95
|
+
const crypto = require('crypto');
|
|
96
|
+
const computed = crypto.createHash('sha256').update(body).digest('hex');
|
|
97
|
+
if (computed !== sha256) {
|
|
98
|
+
return { ok: false, error: 'sha_mismatch_local', detail: `expected=${sha256.slice(0, 12)}… computed=${computed.slice(0, 12)}…` };
|
|
99
|
+
}
|
|
100
|
+
const headers = {
|
|
101
|
+
'Content-Type': 'text/markdown',
|
|
102
|
+
'X-Asset-Sha256': sha256,
|
|
103
|
+
'X-Asset-Kind': kind,
|
|
104
|
+
'X-Asset-Id': id,
|
|
105
|
+
};
|
|
106
|
+
if (this.token)
|
|
107
|
+
headers.Authorization = `Bearer ${this.token}`;
|
|
108
|
+
const ac = new AbortController();
|
|
109
|
+
const timer = setTimeout(() => ac.abort(), this.timeoutMs);
|
|
110
|
+
try {
|
|
111
|
+
const response = await this.fetchImpl(url, { method: 'PUT', headers, body, signal: ac.signal });
|
|
112
|
+
const status = response.status;
|
|
113
|
+
const etag = response.headers.get?.('etag') || undefined;
|
|
114
|
+
if (status < 200 || status >= 300) {
|
|
115
|
+
return { ok: false, url, status, error: `http_${status}` };
|
|
116
|
+
}
|
|
117
|
+
return { ok: true, url, status, etag };
|
|
118
|
+
}
|
|
119
|
+
catch (err) {
|
|
120
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
121
|
+
return { ok: false, error: 'fetch_error', detail };
|
|
122
|
+
}
|
|
123
|
+
finally {
|
|
124
|
+
clearTimeout(timer);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
buildUrl(kind, id, sha256) {
|
|
128
|
+
try {
|
|
129
|
+
const base = new URL(this.baseUrl);
|
|
130
|
+
// Always append a clean path; ignore any base path hidden in baseUrl
|
|
131
|
+
const trimmed = base.toString().replace(/\/+$/, '');
|
|
132
|
+
return `${trimmed}/${encodeURIComponent(kind)}/${encodeURIComponent(id)}/${encodeURIComponent(sha256)}.md`;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
exports.RemotePublisher = RemotePublisher;
|
|
@@ -0,0 +1,89 @@
|
|
|
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.ReuseEngine = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
class ReuseEngine {
|
|
40
|
+
memoryFile;
|
|
41
|
+
promotedDir;
|
|
42
|
+
constructor() {
|
|
43
|
+
this.memoryFile = path.join(process.cwd(), '.artifacts', 'operational-memory.json');
|
|
44
|
+
this.promotedDir = path.join(process.cwd(), '.openlife', 'promoted-assets');
|
|
45
|
+
}
|
|
46
|
+
findHints(goal) {
|
|
47
|
+
const normalized = goal.toLowerCase();
|
|
48
|
+
const hints = [];
|
|
49
|
+
if (fs.existsSync(this.memoryFile)) {
|
|
50
|
+
try {
|
|
51
|
+
const entries = JSON.parse(fs.readFileSync(this.memoryFile, 'utf-8'));
|
|
52
|
+
for (const entry of entries) {
|
|
53
|
+
const blob = `${entry.goal || ''} ${entry.summary || ''} ${(entry.lessons || []).join(' ')}`.toLowerCase();
|
|
54
|
+
if (blob.includes(normalized.slice(0, 20)) || normalized.includes((entry.goal || '').toLowerCase().slice(0, 20))) {
|
|
55
|
+
hints.push({
|
|
56
|
+
source: 'operational-memory',
|
|
57
|
+
summary: entry.summary || entry.goal || 'memory hit',
|
|
58
|
+
filePath: this.memoryFile
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch { }
|
|
64
|
+
}
|
|
65
|
+
if (fs.existsSync(this.promotedDir)) {
|
|
66
|
+
const files = fs.readdirSync(this.promotedDir).map(f => path.join(this.promotedDir, f));
|
|
67
|
+
for (const file of files) {
|
|
68
|
+
try {
|
|
69
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
70
|
+
if (content.toLowerCase().includes(normalized.slice(0, 20))) {
|
|
71
|
+
hints.push({
|
|
72
|
+
source: 'promoted-asset',
|
|
73
|
+
summary: content.slice(0, 200),
|
|
74
|
+
filePath: file
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch { }
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return hints.slice(0, 5);
|
|
82
|
+
}
|
|
83
|
+
enrichAgents(agents, hints) {
|
|
84
|
+
if (!hints.length)
|
|
85
|
+
return agents;
|
|
86
|
+
return agents.map(agent => ({ ...agent, priority: agent.priority + 1 }));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
exports.ReuseEngine = ReuseEngine;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReviewerAgent = void 0;
|
|
4
|
+
class ReviewerAgent {
|
|
5
|
+
brain;
|
|
6
|
+
constructor(brain) {
|
|
7
|
+
this.brain = brain;
|
|
8
|
+
}
|
|
9
|
+
async review(goal, executorOutput, successCriteria) {
|
|
10
|
+
const prompt = `
|
|
11
|
+
Você é o Reviewer do OpenLife.
|
|
12
|
+
|
|
13
|
+
Objetivo:
|
|
14
|
+
${goal}
|
|
15
|
+
|
|
16
|
+
Critérios de sucesso:
|
|
17
|
+
${successCriteria.join('\n- ')}
|
|
18
|
+
|
|
19
|
+
Output do executor:
|
|
20
|
+
${executorOutput}
|
|
21
|
+
|
|
22
|
+
Responda em JSON com:
|
|
23
|
+
- approved (boolean)
|
|
24
|
+
- critique (string curta)
|
|
25
|
+
- nextAction ('refine' ou 'finish')
|
|
26
|
+
- score (0 a 10)
|
|
27
|
+
`;
|
|
28
|
+
const raw = await this.brain.think('Faça uma revisão crítica, objetiva e curta.', prompt);
|
|
29
|
+
try {
|
|
30
|
+
const jsonStart = raw.indexOf('{');
|
|
31
|
+
const parsed = JSON.parse(jsonStart >= 0 ? raw.slice(jsonStart) : raw);
|
|
32
|
+
return {
|
|
33
|
+
approved: !!parsed.approved,
|
|
34
|
+
critique: parsed.critique || 'Sem crítica específica.',
|
|
35
|
+
nextAction: parsed.nextAction === 'finish' ? 'finish' : 'refine',
|
|
36
|
+
score: typeof parsed.score === 'number' ? parsed.score : 7
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return {
|
|
41
|
+
approved: true,
|
|
42
|
+
critique: 'Revisão fallback: output aceitável.',
|
|
43
|
+
nextAction: 'finish',
|
|
44
|
+
score: 7
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.ReviewerAgent = ReviewerAgent;
|