@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,404 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SkillCreator — authoring system for skills under `.catalog/skills/`.
|
|
4
|
+
*
|
|
5
|
+
* Story 5.2 — OpenLife v1.2 Royal Stack.
|
|
6
|
+
*
|
|
7
|
+
* Parallel to SquadCreator (Story 5.1) but simpler: a skill is a single
|
|
8
|
+
* SKILL.md file rendered from `dist-templates/skill-template/`. No
|
|
9
|
+
* sub-directories, no nested agents.
|
|
10
|
+
*
|
|
11
|
+
* v1.2 implements 4 of 8 methods. The remaining 4 (design, migrate,
|
|
12
|
+
* extend, publish) are v1.3 placeholders with stable signatures.
|
|
13
|
+
*/
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.SkillCreator = void 0;
|
|
49
|
+
const fs = __importStar(require("fs"));
|
|
50
|
+
const path = __importStar(require("path"));
|
|
51
|
+
const crypto = __importStar(require("crypto"));
|
|
52
|
+
const AtomicWriter_1 = require("./util/AtomicWriter");
|
|
53
|
+
const TemplateRenderer_1 = require("./util/TemplateRenderer");
|
|
54
|
+
class SkillCreator {
|
|
55
|
+
catalogRoot;
|
|
56
|
+
templateRoot;
|
|
57
|
+
constructor(opts = {}) {
|
|
58
|
+
this.catalogRoot = opts.catalogRoot || path.join(process.cwd(), '.catalog', 'skills');
|
|
59
|
+
this.templateRoot = opts.templateRoot || path.resolve(__dirname, '..', '..', 'dist-templates', 'skill-template');
|
|
60
|
+
}
|
|
61
|
+
create(proposal) {
|
|
62
|
+
if (!/^[a-z0-9][a-z0-9._-]+$/i.test(proposal.id)) {
|
|
63
|
+
return { ok: false, error: 'invalid_skill_id' };
|
|
64
|
+
}
|
|
65
|
+
const skillDir = path.join(this.catalogRoot, proposal.id);
|
|
66
|
+
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
67
|
+
if (fs.existsSync(skillDir)) {
|
|
68
|
+
return { ok: false, error: 'skill_already_exists', detail: skillDir };
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
fs.mkdirSync(skillDir, { recursive: true });
|
|
72
|
+
const vars = this.buildVars(proposal);
|
|
73
|
+
const content = (0, TemplateRenderer_1.renderTemplateFile)(path.join(this.templateRoot, 'SKILL.md.template'), vars);
|
|
74
|
+
(0, AtomicWriter_1.writeStringAtomic)(skillFile, content);
|
|
75
|
+
return { ok: true, skillId: proposal.id, skillDir, filePath: skillFile };
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
try {
|
|
79
|
+
fs.rmSync(skillDir, { recursive: true, force: true });
|
|
80
|
+
}
|
|
81
|
+
catch { /* ignore */ }
|
|
82
|
+
return { ok: false, error: 'render_failed', detail: err instanceof Error ? err.message : String(err) };
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
validate(skillId) {
|
|
86
|
+
const errors = [];
|
|
87
|
+
const warnings = [];
|
|
88
|
+
const skillFile = path.join(this.catalogRoot, skillId, 'SKILL.md');
|
|
89
|
+
if (!fs.existsSync(skillFile)) {
|
|
90
|
+
errors.push(`SKILL.md not found for ${skillId}`);
|
|
91
|
+
return { ok: false, skillId, errors, warnings };
|
|
92
|
+
}
|
|
93
|
+
const content = fs.readFileSync(skillFile, 'utf-8');
|
|
94
|
+
const fm = this.parseFrontmatter(content);
|
|
95
|
+
if (!fm.id)
|
|
96
|
+
errors.push('frontmatter missing id');
|
|
97
|
+
if (!fm.name)
|
|
98
|
+
errors.push('frontmatter missing name');
|
|
99
|
+
if (fm.id && fm.id !== skillId) {
|
|
100
|
+
errors.push(`frontmatter id '${fm.id}' does not match directory '${skillId}'`);
|
|
101
|
+
}
|
|
102
|
+
if (!/##\s+Procedure/.test(content))
|
|
103
|
+
warnings.push('missing ## Procedure section');
|
|
104
|
+
if (!/##\s+When to use/.test(content))
|
|
105
|
+
warnings.push('missing ## When to use section');
|
|
106
|
+
return { ok: errors.length === 0, skillId, errors, warnings };
|
|
107
|
+
}
|
|
108
|
+
list(filter) {
|
|
109
|
+
if (!fs.existsSync(this.catalogRoot))
|
|
110
|
+
return [];
|
|
111
|
+
const out = [];
|
|
112
|
+
for (const entry of fs.readdirSync(this.catalogRoot)) {
|
|
113
|
+
const skillFile = path.join(this.catalogRoot, entry, 'SKILL.md');
|
|
114
|
+
if (!fs.existsSync(skillFile))
|
|
115
|
+
continue;
|
|
116
|
+
const fm = this.parseFrontmatter(fs.readFileSync(skillFile, 'utf-8'));
|
|
117
|
+
const item = { id: fm.id || entry, name: fm.name || entry, status: fm.status || 'unknown' };
|
|
118
|
+
if (filter?.status && item.status !== filter.status)
|
|
119
|
+
continue;
|
|
120
|
+
out.push(item);
|
|
121
|
+
}
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
124
|
+
analyze(skillId) {
|
|
125
|
+
const skillFile = path.join(this.catalogRoot, skillId, 'SKILL.md');
|
|
126
|
+
if (!fs.existsSync(skillFile))
|
|
127
|
+
return null;
|
|
128
|
+
const content = fs.readFileSync(skillFile, 'utf-8');
|
|
129
|
+
const result = {
|
|
130
|
+
skillId,
|
|
131
|
+
hasWhenToUse: /##\s+When to use/.test(content) && content.split('##')[1] !== undefined,
|
|
132
|
+
hasProcedure: /##\s+Procedure/.test(content),
|
|
133
|
+
hasValidation: /##\s+Validation/.test(content),
|
|
134
|
+
hasGuardrails: /##\s+Guardrails/.test(content),
|
|
135
|
+
hasExamples: /##\s+Examples/.test(content),
|
|
136
|
+
hasReferences: /##\s+References/.test(content),
|
|
137
|
+
suggestions: [],
|
|
138
|
+
};
|
|
139
|
+
if (!result.hasWhenToUse)
|
|
140
|
+
result.suggestions.push('add a ## When to use section');
|
|
141
|
+
if (!result.hasProcedure)
|
|
142
|
+
result.suggestions.push('add a ## Procedure section');
|
|
143
|
+
if (!result.hasValidation)
|
|
144
|
+
result.suggestions.push('add a ## Validation section');
|
|
145
|
+
if (!result.hasGuardrails)
|
|
146
|
+
result.suggestions.push('add a ## Guardrails section');
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
// v1.3 — heuristic skill proposal from a free-text brief (Story 3.1).
|
|
150
|
+
// Brain-driven proposal lands in v1.4; signature stays stable.
|
|
151
|
+
design(brief, opts = {}) {
|
|
152
|
+
const trimmed = (brief || '').trim();
|
|
153
|
+
if (!trimmed)
|
|
154
|
+
return { ok: false, error: 'invalid_brief' };
|
|
155
|
+
const id = opts.id || trimmed.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 50);
|
|
156
|
+
if (!/^[a-z0-9][a-z0-9._-]+$/i.test(id))
|
|
157
|
+
return { ok: false, error: 'invalid_skill_id' };
|
|
158
|
+
const mode = opts.mode || 'professional';
|
|
159
|
+
const procedure = mode === 'quick'
|
|
160
|
+
? [`Read the brief: ${trimmed}`, 'Execute the core action', 'Return the result']
|
|
161
|
+
: [`Read the brief: ${trimmed}`, 'Plan the approach', 'Execute the action', 'Validate the output'];
|
|
162
|
+
const proposal = {
|
|
163
|
+
id,
|
|
164
|
+
name: id,
|
|
165
|
+
description: trimmed,
|
|
166
|
+
whenToUse: [trimmed],
|
|
167
|
+
procedure,
|
|
168
|
+
version: '0.1.0',
|
|
169
|
+
status: 'draft',
|
|
170
|
+
source: 'skill-creator.design',
|
|
171
|
+
};
|
|
172
|
+
return { ok: true, proposal };
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Story 8.2 — LLM-driven design.
|
|
176
|
+
*
|
|
177
|
+
* Mirrors SquadCreator.designWithBrain. If a Brain provider is configured,
|
|
178
|
+
* asks the Brain for a structured JSON proposal. On any failure, falls
|
|
179
|
+
* back to the heuristic `design()`.
|
|
180
|
+
*/
|
|
181
|
+
async designWithBrain(brain, brief, opts = {}) {
|
|
182
|
+
if (!brain.isAnyProviderAvailable()) {
|
|
183
|
+
const r = this.design(brief, opts);
|
|
184
|
+
return r.ok ? { ok: true, proposal: r.proposal, source: 'heuristic' } : r;
|
|
185
|
+
}
|
|
186
|
+
const trimmed = (brief || '').trim();
|
|
187
|
+
if (!trimmed)
|
|
188
|
+
return { ok: false, error: 'invalid_brief' };
|
|
189
|
+
const id = opts.id || trimmed.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 50);
|
|
190
|
+
if (!/^[a-z0-9][a-z0-9._-]+$/i.test(id))
|
|
191
|
+
return { ok: false, error: 'invalid_skill_id' };
|
|
192
|
+
const mode = opts.mode || 'professional';
|
|
193
|
+
const systemPrompt = `You are SkillCreator. Given a brief and an authoring mode (quick|professional|elite), return a STRICT JSON object describing a reusable skill. The output MUST be a single JSON object — no prose, no markdown fences. Shape:
|
|
194
|
+
{
|
|
195
|
+
"description": "<one-line summary>",
|
|
196
|
+
"whenToUse": ["<bullet1>", "<bullet2>", "..."],
|
|
197
|
+
"procedure": ["step 1", "step 2", "..."],
|
|
198
|
+
"validation": ["check 1", "check 2"],
|
|
199
|
+
"guardrails": ["rule 1", "rule 2"]
|
|
200
|
+
}
|
|
201
|
+
Rules:
|
|
202
|
+
- quick: 3 procedure steps, 1 whenToUse, no validation/guardrails
|
|
203
|
+
- professional: 4-5 steps, 2-3 whenToUse, 1-2 validations
|
|
204
|
+
- elite: 5-7 steps, 2-3 whenToUse, 3+ validations, 2+ guardrails`;
|
|
205
|
+
const userMessage = `Brief: ${trimmed}\nMode: ${mode}\nSkill id: ${id}`;
|
|
206
|
+
try {
|
|
207
|
+
const { extractFirstJson } = require('./SquadCreator');
|
|
208
|
+
const raw = await brain.think(systemPrompt, userMessage);
|
|
209
|
+
const parsed = extractFirstJson(raw);
|
|
210
|
+
if (!parsed || typeof parsed !== 'object')
|
|
211
|
+
throw new Error('no_json_in_response');
|
|
212
|
+
const p = parsed;
|
|
213
|
+
if (!Array.isArray(p.procedure) || p.procedure.length < 1)
|
|
214
|
+
throw new Error('missing_procedure');
|
|
215
|
+
const proposal = {
|
|
216
|
+
id, name: id,
|
|
217
|
+
description: p.description || trimmed,
|
|
218
|
+
whenToUse: Array.isArray(p.whenToUse) ? p.whenToUse : [trimmed],
|
|
219
|
+
procedure: p.procedure,
|
|
220
|
+
validations: Array.isArray(p.validation) ? p.validation : undefined,
|
|
221
|
+
guardrails: Array.isArray(p.guardrails) ? p.guardrails : undefined,
|
|
222
|
+
version: '0.1.0',
|
|
223
|
+
status: 'draft',
|
|
224
|
+
source: 'skill-creator.designWithBrain',
|
|
225
|
+
};
|
|
226
|
+
return { ok: true, proposal, source: 'brain' };
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
const r = this.design(brief, opts);
|
|
230
|
+
return r.ok ? { ok: true, proposal: r.proposal, source: 'heuristic' } : r;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// ─────────────────────────────────────────────────────────
|
|
234
|
+
// migrate — rewrite SKILL.md frontmatter version atomically
|
|
235
|
+
// ─────────────────────────────────────────────────────────
|
|
236
|
+
migrate(skillId, fromVersion, toVersion) {
|
|
237
|
+
if (!/^[a-z0-9][a-z0-9._-]+$/i.test(skillId))
|
|
238
|
+
return { ok: false, skillId, error: 'invalid_skill_id' };
|
|
239
|
+
if (!/^\d+\.\d+(\.\d+)?$/.test(fromVersion) || !/^\d+\.\d+(\.\d+)?$/.test(toVersion)) {
|
|
240
|
+
return { ok: false, skillId, error: 'invalid_version' };
|
|
241
|
+
}
|
|
242
|
+
const skillFile = path.join(this.catalogRoot, skillId, 'SKILL.md');
|
|
243
|
+
if (!fs.existsSync(skillFile))
|
|
244
|
+
return { ok: false, skillId, error: 'skill_not_found' };
|
|
245
|
+
const content = fs.readFileSync(skillFile, 'utf-8');
|
|
246
|
+
const fm = this.parseFrontmatter(content);
|
|
247
|
+
if (fm.version && fm.version !== fromVersion) {
|
|
248
|
+
return { ok: false, skillId, error: 'version_mismatch', detail: `current=${fm.version} expected=${fromVersion}` };
|
|
249
|
+
}
|
|
250
|
+
const next = this.rewriteFrontmatterField(content, 'version', toVersion);
|
|
251
|
+
(0, AtomicWriter_1.writeStringAtomic)(skillFile, next);
|
|
252
|
+
return { ok: true, skillId, fromVersion, toVersion, filesChanged: [skillFile] };
|
|
253
|
+
}
|
|
254
|
+
// ─────────────────────────────────────────────────────────
|
|
255
|
+
// extend — append bullet items to a known SKILL.md section
|
|
256
|
+
// ─────────────────────────────────────────────────────────
|
|
257
|
+
extend(skillId, patch) {
|
|
258
|
+
if (!/^[a-z0-9][a-z0-9._-]+$/i.test(skillId))
|
|
259
|
+
return { ok: false, skillId, error: 'invalid_skill_id' };
|
|
260
|
+
if (!patch || !patch.items?.length)
|
|
261
|
+
return { ok: false, skillId, error: 'empty_patch' };
|
|
262
|
+
const skillFile = path.join(this.catalogRoot, skillId, 'SKILL.md');
|
|
263
|
+
if (!fs.existsSync(skillFile))
|
|
264
|
+
return { ok: false, skillId, error: 'skill_not_found' };
|
|
265
|
+
const heading = {
|
|
266
|
+
whenToUse: 'When to use',
|
|
267
|
+
procedure: 'Procedure',
|
|
268
|
+
guardrails: 'Guardrails',
|
|
269
|
+
validation: 'Validation',
|
|
270
|
+
references: 'References',
|
|
271
|
+
};
|
|
272
|
+
const sectionHeading = heading[patch.section];
|
|
273
|
+
if (!sectionHeading)
|
|
274
|
+
return { ok: false, skillId, error: 'unknown_section' };
|
|
275
|
+
const content = fs.readFileSync(skillFile, 'utf-8');
|
|
276
|
+
const updated = this.appendItemsToSection(content, sectionHeading, patch.section === 'procedure' ? 'numbered' : 'bullet', patch.items);
|
|
277
|
+
(0, AtomicWriter_1.writeStringAtomic)(skillFile, updated);
|
|
278
|
+
return { ok: true, skillId, section: patch.section, itemsAdded: patch.items.length };
|
|
279
|
+
}
|
|
280
|
+
// ─────────────────────────────────────────────────────────
|
|
281
|
+
// publish — hash + ledger append + status flip to active
|
|
282
|
+
// ─────────────────────────────────────────────────────────
|
|
283
|
+
publish(skillId) {
|
|
284
|
+
if (!/^[a-z0-9][a-z0-9._-]+$/i.test(skillId))
|
|
285
|
+
return { ok: false, skillId, error: 'invalid_skill_id' };
|
|
286
|
+
const skillFile = path.join(this.catalogRoot, skillId, 'SKILL.md');
|
|
287
|
+
if (!fs.existsSync(skillFile))
|
|
288
|
+
return { ok: false, skillId, error: 'skill_not_found' };
|
|
289
|
+
let content = fs.readFileSync(skillFile, 'utf-8');
|
|
290
|
+
const fm = this.parseFrontmatter(content);
|
|
291
|
+
if (fm.status === 'archived')
|
|
292
|
+
return { ok: false, skillId, error: 'skill_archived' };
|
|
293
|
+
if (fm.status !== 'active') {
|
|
294
|
+
content = this.rewriteFrontmatterField(content, 'status', 'active');
|
|
295
|
+
(0, AtomicWriter_1.writeStringAtomic)(skillFile, content);
|
|
296
|
+
}
|
|
297
|
+
const sha256 = crypto.createHash('sha256').update(content).digest('hex');
|
|
298
|
+
const stateDir = process.env.OPENLIFE_STATE_DIR || path.join(process.cwd(), '.openlife');
|
|
299
|
+
fs.mkdirSync(stateDir, { recursive: true });
|
|
300
|
+
const ledger = path.join(stateDir, 'published-assets.jsonl');
|
|
301
|
+
const entry = JSON.stringify({ kind: 'skill', id: skillId, sha256, file: skillFile, publishedAt: new Date().toISOString() }) + '\n';
|
|
302
|
+
fs.appendFileSync(ledger, entry, 'utf-8');
|
|
303
|
+
return { ok: true, skillId, sha256, ledgerEntry: entry.trim(), status: 'active' };
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Story 14.1 (v1.5) — Publish + push to a remote registry.
|
|
307
|
+
* Mirror of SquadCreator.publishWithRemote. Local seal first, then
|
|
308
|
+
* RemotePublisher.publishAsset; the remote outcome lives on the
|
|
309
|
+
* returned envelope's `remote` field.
|
|
310
|
+
*/
|
|
311
|
+
async publishWithRemote(skillId) {
|
|
312
|
+
const local = this.publish(skillId);
|
|
313
|
+
if (!local.ok || !local.sha256)
|
|
314
|
+
return local;
|
|
315
|
+
const skillFile = path.join(this.catalogRoot, skillId, 'SKILL.md');
|
|
316
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
317
|
+
const { RemotePublisher } = require('./RemotePublisher');
|
|
318
|
+
const remote = await new RemotePublisher().publishAsset('skill', skillId, local.sha256, skillFile);
|
|
319
|
+
return { ...local, remote };
|
|
320
|
+
}
|
|
321
|
+
// ─────────────────────────────────────────────────────────
|
|
322
|
+
// Helpers
|
|
323
|
+
// ─────────────────────────────────────────────────────────
|
|
324
|
+
rewriteFrontmatterField(content, field, value) {
|
|
325
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n/);
|
|
326
|
+
if (!fmMatch)
|
|
327
|
+
return `---\n${field}: ${value}\n---\n${content}`;
|
|
328
|
+
const lines = fmMatch[1].split('\n');
|
|
329
|
+
const idx = lines.findIndex((l) => l.match(new RegExp(`^${field}:`)));
|
|
330
|
+
if (idx >= 0)
|
|
331
|
+
lines[idx] = `${field}: ${value}`;
|
|
332
|
+
else
|
|
333
|
+
lines.push(`${field}: ${value}`);
|
|
334
|
+
return content.replace(fmMatch[0], `---\n${lines.join('\n')}\n---\n`);
|
|
335
|
+
}
|
|
336
|
+
appendItemsToSection(content, sectionHeading, listKind, items) {
|
|
337
|
+
const heading = `## ${sectionHeading}`;
|
|
338
|
+
const idx = content.indexOf(heading);
|
|
339
|
+
if (idx < 0) {
|
|
340
|
+
// Section missing — append a new section at end.
|
|
341
|
+
const block = [`\n${heading}\n`, ...this.renderItems(listKind, items, 1)].join('');
|
|
342
|
+
return content + block;
|
|
343
|
+
}
|
|
344
|
+
// Find the start of the next ## heading (or end-of-file)
|
|
345
|
+
const after = content.indexOf('\n## ', idx + heading.length);
|
|
346
|
+
const end = after < 0 ? content.length : after;
|
|
347
|
+
const sectionBody = content.slice(idx, end).replace(/\n+$/, '');
|
|
348
|
+
// For numbered lists, find current max number to continue counting.
|
|
349
|
+
let startNum = 1;
|
|
350
|
+
if (listKind === 'numbered') {
|
|
351
|
+
const matches = [...sectionBody.matchAll(/^(\d+)\.\s/gm)];
|
|
352
|
+
if (matches.length)
|
|
353
|
+
startNum = Math.max(...matches.map((m) => Number(m[1]))) + 1;
|
|
354
|
+
}
|
|
355
|
+
const newItems = this.renderItems(listKind, items, startNum).join('');
|
|
356
|
+
return content.slice(0, end).replace(/\n+$/, '') + '\n' + newItems + content.slice(end);
|
|
357
|
+
}
|
|
358
|
+
renderItems(listKind, items, startNum) {
|
|
359
|
+
if (listKind === 'numbered') {
|
|
360
|
+
return items.map((item, i) => `${startNum + i}. ${item}\n`);
|
|
361
|
+
}
|
|
362
|
+
return items.map((item) => `- ${item}\n`);
|
|
363
|
+
}
|
|
364
|
+
buildVars(p) {
|
|
365
|
+
return {
|
|
366
|
+
SKILL_ID: p.id,
|
|
367
|
+
SKILL_NAME: p.name,
|
|
368
|
+
SOURCE: p.source || 'aiobuilder-built',
|
|
369
|
+
STATUS: p.status || 'draft',
|
|
370
|
+
VERSION: p.version || '1.0.0',
|
|
371
|
+
DESCRIPTION: p.description,
|
|
372
|
+
WHEN_1: p.whenToUse[0] || 'TBD',
|
|
373
|
+
WHEN_2: p.whenToUse[1] || 'TBD',
|
|
374
|
+
WHEN_3: p.whenToUse[2] || 'TBD',
|
|
375
|
+
STEP_1: p.procedure[0] || 'TBD',
|
|
376
|
+
STEP_2: p.procedure[1] || 'TBD',
|
|
377
|
+
STEP_3: p.procedure[2] || 'TBD',
|
|
378
|
+
STEP_4: p.procedure[3] || 'TBD',
|
|
379
|
+
INPUT_1: p.inputs?.[0] || 'TBD',
|
|
380
|
+
INPUT_2: p.inputs?.[1] || 'TBD',
|
|
381
|
+
OUTPUT_1: p.outputs?.[0] || 'TBD',
|
|
382
|
+
OUTPUT_2: p.outputs?.[1] || 'TBD',
|
|
383
|
+
VALIDATION_1: p.validations?.[0] || 'TBD',
|
|
384
|
+
VALIDATION_2: p.validations?.[1] || 'TBD',
|
|
385
|
+
GUARDRAIL_1: p.guardrails?.[0] || 'No secrets in skill body',
|
|
386
|
+
GUARDRAIL_2: p.guardrails?.[1] || 'Promote draft→active only after real use',
|
|
387
|
+
EXAMPLES: p.examples || '_TBD_',
|
|
388
|
+
REFERENCES: p.references || '_TBD_',
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
parseFrontmatter(content) {
|
|
392
|
+
const match = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
393
|
+
if (!match)
|
|
394
|
+
return {};
|
|
395
|
+
const out = {};
|
|
396
|
+
for (const line of match[1].split('\n')) {
|
|
397
|
+
const m = line.match(/^([\w-]+):\s*(.*)$/);
|
|
398
|
+
if (m)
|
|
399
|
+
out[m[1]] = m[2].trim();
|
|
400
|
+
}
|
|
401
|
+
return out;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
exports.SkillCreator = SkillCreator;
|
|
@@ -0,0 +1,57 @@
|
|
|
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.SkillLearningLoopStore = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
class SkillLearningLoopStore {
|
|
40
|
+
workspaceId;
|
|
41
|
+
filePath;
|
|
42
|
+
constructor(workspaceId = 'default') {
|
|
43
|
+
this.workspaceId = workspaceId;
|
|
44
|
+
this.filePath = path.join(process.cwd(), '.artifacts', 'workspaces', workspaceId, 'skill-learning-candidates.json');
|
|
45
|
+
fs.mkdirSync(path.dirname(this.filePath), { recursive: true });
|
|
46
|
+
}
|
|
47
|
+
list() { if (!fs.existsSync(this.filePath))
|
|
48
|
+
return []; return JSON.parse(fs.readFileSync(this.filePath, 'utf-8')); }
|
|
49
|
+
add(sourceTaskId, summary) {
|
|
50
|
+
const item = { id: `slc_${Date.now()}`, workspaceId: this.workspaceId, sourceTaskId, summary, approved: summary.length > 30, createdAt: new Date().toISOString() };
|
|
51
|
+
const cur = this.list();
|
|
52
|
+
cur.push(item);
|
|
53
|
+
fs.writeFileSync(this.filePath, JSON.stringify(cur, null, 2), 'utf-8');
|
|
54
|
+
return item;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
exports.SkillLearningLoopStore = SkillLearningLoopStore;
|
|
@@ -0,0 +1,75 @@
|
|
|
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.SkillManager = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const ToolsetGuard_1 = require("./toolset/ToolsetGuard");
|
|
39
|
+
class SkillManager {
|
|
40
|
+
cloudFile;
|
|
41
|
+
constructor(cloudFile = process.env.OPENLIFE_CLOUD_SKILLS_FILE || '.artifacts/cloud-skills.json') {
|
|
42
|
+
this.cloudFile = cloudFile;
|
|
43
|
+
}
|
|
44
|
+
readAll() {
|
|
45
|
+
if (!fs.existsSync(this.cloudFile))
|
|
46
|
+
return [];
|
|
47
|
+
try {
|
|
48
|
+
const raw = JSON.parse(fs.readFileSync(this.cloudFile, 'utf-8'));
|
|
49
|
+
return Array.isArray(raw) ? raw : [];
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return [];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
writeAll(skills) {
|
|
56
|
+
fs.mkdirSync(require('path').dirname(this.cloudFile), { recursive: true });
|
|
57
|
+
fs.writeFileSync(this.cloudFile, JSON.stringify(skills, null, 2), 'utf-8');
|
|
58
|
+
}
|
|
59
|
+
list() { return this.readAll(); }
|
|
60
|
+
create(skill) {
|
|
61
|
+
(0, ToolsetGuard_1.assertToolsetAllowed)('skills', 'SkillManager.create');
|
|
62
|
+
const all = this.readAll().filter(s => s.id !== skill.id);
|
|
63
|
+
all.push({ ...skill, updatedAt: new Date().toISOString() });
|
|
64
|
+
this.writeAll(all);
|
|
65
|
+
}
|
|
66
|
+
patch(id, content) {
|
|
67
|
+
const all = this.readAll().map(s => s.id === id ? { ...s, content, updatedAt: new Date().toISOString() } : s);
|
|
68
|
+
this.writeAll(all);
|
|
69
|
+
}
|
|
70
|
+
setStatus(id, status) {
|
|
71
|
+
const all = this.readAll().map(s => s.id === id ? { ...s, status, updatedAt: new Date().toISOString() } : s);
|
|
72
|
+
this.writeAll(all);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.SkillManager = SkillManager;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkillNetworkRegistry = void 0;
|
|
4
|
+
class SkillNetworkRegistry {
|
|
5
|
+
networks = [];
|
|
6
|
+
constructor(seed) {
|
|
7
|
+
if (seed?.length)
|
|
8
|
+
this.networks = seed;
|
|
9
|
+
}
|
|
10
|
+
list() { return [...this.networks]; }
|
|
11
|
+
upsert(network) {
|
|
12
|
+
const idx = this.networks.findIndex(n => n.id === network.id);
|
|
13
|
+
if (idx >= 0)
|
|
14
|
+
this.networks[idx] = network;
|
|
15
|
+
else
|
|
16
|
+
this.networks.push(network);
|
|
17
|
+
}
|
|
18
|
+
resolveCapabilities(domain, goal) {
|
|
19
|
+
const net = this.networks.find(n => n.domain === domain);
|
|
20
|
+
if (!net)
|
|
21
|
+
return [];
|
|
22
|
+
const normalized = goal.toLowerCase();
|
|
23
|
+
return net.nodes
|
|
24
|
+
.filter(node => node.capabilities.some(c => normalized.includes(c.toLowerCase())))
|
|
25
|
+
.flatMap(node => node.capabilities)
|
|
26
|
+
.slice(0, 20);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.SkillNetworkRegistry = SkillNetworkRegistry;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SkillRegistryV2 = void 0;
|
|
4
|
+
const FileSkillProvider_1 = require("./providers/FileSkillProvider");
|
|
5
|
+
const CloudSkillProvider_1 = require("./providers/CloudSkillProvider");
|
|
6
|
+
const CompositeSkillProvider_1 = require("./providers/CompositeSkillProvider");
|
|
7
|
+
class SkillRegistryV2 {
|
|
8
|
+
provider;
|
|
9
|
+
skills = [];
|
|
10
|
+
constructor(provider = new CompositeSkillProvider_1.CompositeSkillProvider(new CloudSkillProvider_1.CloudSkillProvider(process.env.OPENLIFE_CLOUD_SKILLS_FILE || ''), new FileSkillProvider_1.FileSkillProvider(process.env.OPENLIFE_SKILL_ROOTS
|
|
11
|
+
? process.env.OPENLIFE_SKILL_ROOTS.split(':').filter(Boolean)
|
|
12
|
+
: [process.env.OPENLIFE_SKILL_ROOT || `${process.cwd()}/.catalog/skills`]))) {
|
|
13
|
+
this.provider = provider;
|
|
14
|
+
this.load();
|
|
15
|
+
}
|
|
16
|
+
load() {
|
|
17
|
+
this.skills = this.provider.load();
|
|
18
|
+
}
|
|
19
|
+
all() {
|
|
20
|
+
return this.skills;
|
|
21
|
+
}
|
|
22
|
+
findByCapability(capability) {
|
|
23
|
+
const normalized = capability.toLowerCase();
|
|
24
|
+
return this.skills.filter(skill => skill.capabilities.some(cap => cap.toLowerCase().includes(normalized)) ||
|
|
25
|
+
skill.name.toLowerCase().includes(normalized));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.SkillRegistryV2 = SkillRegistryV2;
|
|
@@ -0,0 +1,70 @@
|
|
|
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.SkillScoring = void 0;
|
|
37
|
+
const fs = __importStar(require("fs"));
|
|
38
|
+
const path = __importStar(require("path"));
|
|
39
|
+
class SkillScoring {
|
|
40
|
+
filePath;
|
|
41
|
+
constructor() {
|
|
42
|
+
this.filePath = path.join(process.cwd(), '.artifacts', 'skill-scores.json');
|
|
43
|
+
}
|
|
44
|
+
record(skillId, status) {
|
|
45
|
+
const all = this.getAll();
|
|
46
|
+
const current = all[skillId] || { skillId, successes: 0, partials: 0, failures: 0, score: 0, updatedAt: new Date().toISOString() };
|
|
47
|
+
if (status === 'success')
|
|
48
|
+
current.successes += 1;
|
|
49
|
+
if (status === 'partial')
|
|
50
|
+
current.partials += 1;
|
|
51
|
+
if (status === 'failed')
|
|
52
|
+
current.failures += 1;
|
|
53
|
+
current.score = current.successes * 2 + current.partials * 0.5 - current.failures * 1.5;
|
|
54
|
+
current.updatedAt = new Date().toISOString();
|
|
55
|
+
all[skillId] = current;
|
|
56
|
+
fs.mkdirSync(path.dirname(this.filePath), { recursive: true });
|
|
57
|
+
fs.writeFileSync(this.filePath, JSON.stringify(all, null, 2), 'utf-8');
|
|
58
|
+
}
|
|
59
|
+
getAll() {
|
|
60
|
+
if (!fs.existsSync(this.filePath))
|
|
61
|
+
return {};
|
|
62
|
+
try {
|
|
63
|
+
return JSON.parse(fs.readFileSync(this.filePath, 'utf-8'));
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.SkillScoring = SkillScoring;
|