opencode-orchestrator 1.3.3 → 1.3.4
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/LICENSE +21 -21
- package/README.md +437 -386
- package/bin/orchestrator-linux-arm64 +0 -0
- package/bin/orchestrator-linux-x64 +0 -0
- package/dist/agents/commander.d.ts +0 -0
- package/dist/agents/definitions.d.ts +0 -0
- package/dist/agents/prompts/01_philosophy/anti_hallucination.d.ts +0 -0
- package/dist/agents/prompts/01_philosophy/core.d.ts +0 -0
- package/dist/agents/prompts/01_philosophy/execution_assurance.d.ts +0 -0
- package/dist/agents/prompts/01_philosophy/index.d.ts +0 -0
- package/dist/agents/prompts/01_philosophy/metadata.d.ts +0 -0
- package/dist/agents/prompts/01_philosophy/modularity.d.ts +0 -0
- package/dist/agents/prompts/02_discovery/agents/discovery_commander.d.ts +0 -0
- package/dist/agents/prompts/02_discovery/agents/discovery_planner.d.ts +0 -0
- package/dist/agents/prompts/02_discovery/agents/index.d.ts +0 -0
- package/dist/agents/prompts/02_discovery/discovery_core.d.ts +0 -0
- package/dist/agents/prompts/02_discovery/discovery_environment.d.ts +0 -0
- package/dist/agents/prompts/02_discovery/discovery_skills.d.ts +0 -0
- package/dist/agents/prompts/02_discovery/discovery_workspace.d.ts +0 -0
- package/dist/agents/prompts/02_discovery/index.d.ts +0 -0
- package/dist/agents/prompts/03_planning/agents/index.d.ts +0 -0
- package/dist/agents/prompts/03_planning/agents/planning_commander.d.ts +0 -0
- package/dist/agents/prompts/03_planning/agents/planning_planner.d.ts +0 -0
- package/dist/agents/prompts/03_planning/agents/planning_reviewer.d.ts +0 -0
- package/dist/agents/prompts/03_planning/index.d.ts +0 -0
- package/dist/agents/prompts/03_planning/planning_core.d.ts +0 -0
- package/dist/agents/prompts/03_planning/planning_decomposition.d.ts +0 -0
- package/dist/agents/prompts/03_planning/planning_file_planning.d.ts +0 -0
- package/dist/agents/prompts/03_planning/planning_parallel.d.ts +0 -0
- package/dist/agents/prompts/03_planning/planning_research.d.ts +0 -0
- package/dist/agents/prompts/03_planning/planning_todo_format.d.ts +0 -0
- package/dist/agents/prompts/03_planning/planning_todo_rules.d.ts +0 -0
- package/dist/agents/prompts/03_planning/planning_todo_sync.d.ts +0 -0
- package/dist/agents/prompts/04_execution/agents/execution_commander.d.ts +0 -0
- package/dist/agents/prompts/04_execution/agents/execution_worker.d.ts +0 -0
- package/dist/agents/prompts/04_execution/agents/index.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_core.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_delegation.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_error_handling.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_file_assignment.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_hyper_parallel.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_isolation.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_quality.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_strategy.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_tdd.d.ts +0 -0
- package/dist/agents/prompts/04_execution/execution_workflow.d.ts +0 -0
- package/dist/agents/prompts/04_execution/index.d.ts +0 -0
- package/dist/agents/prompts/05_verification/agents/index.d.ts +0 -0
- package/dist/agents/prompts/05_verification/agents/verification_commander.d.ts +0 -0
- package/dist/agents/prompts/05_verification/agents/verification_reviewer.d.ts +0 -0
- package/dist/agents/prompts/05_verification/index.d.ts +0 -0
- package/dist/agents/prompts/05_verification/verification_async_monitoring.d.ts +0 -0
- package/dist/agents/prompts/05_verification/verification_build.d.ts +0 -0
- package/dist/agents/prompts/05_verification/verification_core.d.ts +0 -0
- package/dist/agents/prompts/05_verification/verification_evidence.d.ts +0 -0
- package/dist/agents/prompts/05_verification/verification_integration.d.ts +0 -0
- package/dist/agents/prompts/05_verification/verification_strategy.d.ts +0 -0
- package/dist/agents/prompts/05_verification/verification_sync_check.d.ts +0 -0
- package/dist/agents/prompts/05_verification/verification_sync_handling.d.ts +0 -0
- package/dist/agents/prompts/05_verification/verification_test.d.ts +0 -0
- package/dist/agents/prompts/06_mission/agents/index.d.ts +0 -0
- package/dist/agents/prompts/06_mission/agents/mission_commander.d.ts +0 -0
- package/dist/agents/prompts/06_mission/index.d.ts +0 -0
- package/dist/agents/prompts/06_mission/mission_completion_conditions.d.ts +0 -0
- package/dist/agents/prompts/06_mission/mission_core.d.ts +0 -0
- package/dist/agents/prompts/06_mission/mission_lifecycle.d.ts +0 -0
- package/dist/agents/prompts/06_mission/mission_loop_continuation.d.ts +0 -0
- package/dist/agents/prompts/06_mission/mission_recovery.d.ts +0 -0
- package/dist/agents/prompts/06_mission/mission_status_tracking.d.ts +0 -0
- package/dist/agents/prompts/07_agents/commander/commander_forbidden.d.ts +0 -0
- package/dist/agents/prompts/07_agents/commander/commander_identity.d.ts +0 -0
- package/dist/agents/prompts/07_agents/commander/commander_mandate.d.ts +0 -0
- package/dist/agents/prompts/07_agents/commander/commander_required.d.ts +0 -0
- package/dist/agents/prompts/07_agents/commander/commander_role.d.ts +0 -0
- package/dist/agents/prompts/07_agents/commander/index.d.ts +0 -0
- package/dist/agents/prompts/07_agents/planner/index.d.ts +0 -0
- package/dist/agents/prompts/07_agents/planner/planner_forbidden.d.ts +0 -0
- package/dist/agents/prompts/07_agents/planner/planner_identity.d.ts +0 -0
- package/dist/agents/prompts/07_agents/planner/planner_mandate.d.ts +0 -0
- package/dist/agents/prompts/07_agents/planner/planner_required.d.ts +0 -0
- package/dist/agents/prompts/07_agents/reviewer/index.d.ts +0 -0
- package/dist/agents/prompts/07_agents/reviewer/reviewer_forbidden.d.ts +0 -0
- package/dist/agents/prompts/07_agents/reviewer/reviewer_identity.d.ts +0 -0
- package/dist/agents/prompts/07_agents/reviewer/reviewer_mandate.d.ts +0 -0
- package/dist/agents/prompts/07_agents/reviewer/reviewer_required.d.ts +0 -0
- package/dist/agents/prompts/07_agents/worker/index.d.ts +0 -0
- package/dist/agents/prompts/07_agents/worker/worker_forbidden.d.ts +0 -0
- package/dist/agents/prompts/07_agents/worker/worker_identity.d.ts +0 -0
- package/dist/agents/prompts/07_agents/worker/worker_mandate.d.ts +0 -0
- package/dist/agents/prompts/07_agents/worker/worker_required.d.ts +0 -0
- package/dist/agents/prompts/08_tools/agents/index.d.ts +0 -0
- package/dist/agents/prompts/08_tools/agents/tools_reviewer.d.ts +0 -0
- package/dist/agents/prompts/08_tools/agents/tools_worker.d.ts +0 -0
- package/dist/agents/prompts/08_tools/index.d.ts +0 -0
- package/dist/agents/prompts/08_tools/tools_ast.d.ts +0 -0
- package/dist/agents/prompts/08_tools/tools_code_editing.d.ts +0 -0
- package/dist/agents/prompts/08_tools/tools_core.d.ts +0 -0
- package/dist/agents/prompts/08_tools/tools_lsp.d.ts +0 -0
- package/dist/agents/prompts/08_tools/tools_search.d.ts +0 -0
- package/dist/agents/prompts/08_tools/tools_testing.d.ts +0 -0
- package/dist/agents/prompts/index.d.ts +0 -0
- package/dist/agents/subagents/planner.d.ts +0 -0
- package/dist/agents/subagents/reviewer.d.ts +0 -0
- package/dist/agents/subagents/worker.d.ts +0 -0
- package/dist/core/agents/agent-registry.d.ts +0 -0
- package/dist/core/agents/concurrency-config.d.ts +4 -0
- package/dist/core/agents/concurrency-token.d.ts +0 -0
- package/dist/core/agents/concurrency.d.ts +2 -0
- package/dist/core/agents/config.d.ts +0 -0
- package/dist/core/agents/consts/index.d.ts +0 -0
- package/dist/core/agents/consts/task-status.const.d.ts +0 -0
- package/dist/core/agents/format.d.ts +0 -0
- package/dist/core/agents/index.d.ts +0 -0
- package/dist/core/agents/interfaces/index.d.ts +0 -0
- package/dist/core/agents/interfaces/launch-input.interface.d.ts +0 -0
- package/dist/core/agents/interfaces/resume-input.interface.d.ts +0 -0
- package/dist/core/agents/interfaces/session-pool.interface.d.ts +0 -0
- package/dist/core/agents/logger.d.ts +0 -0
- package/dist/core/agents/manager/event-handler.d.ts +0 -0
- package/dist/core/agents/manager/index.d.ts +0 -0
- package/dist/core/agents/manager/task-cleaner.d.ts +0 -0
- package/dist/core/agents/manager/task-launcher.d.ts +0 -0
- package/dist/core/agents/manager/task-poller.d.ts +0 -0
- package/dist/core/agents/manager/task-resumer.d.ts +0 -0
- package/dist/core/agents/manager.d.ts +3 -1
- package/dist/core/agents/persistence/task-wal.d.ts +0 -0
- package/dist/core/agents/session-pool.d.ts +0 -0
- package/dist/core/agents/task-store.d.ts +0 -0
- package/dist/core/agents/types/index.d.ts +0 -0
- package/dist/core/agents/types/parallel-task-status.type.d.ts +0 -0
- package/dist/core/cache/constants.d.ts +0 -0
- package/dist/core/cache/document-cache.d.ts +0 -0
- package/dist/core/cache/index.d.ts +0 -0
- package/dist/core/cache/interfaces/cache-document-entry.d.ts +0 -0
- package/dist/core/cache/interfaces/cache-list-entry.d.ts +0 -0
- package/dist/core/cache/interfaces/cache-metadata.d.ts +0 -0
- package/dist/core/cache/interfaces/cache-stats.d.ts +0 -0
- package/dist/core/cache/interfaces/cached-document.d.ts +0 -0
- package/dist/core/cache/interfaces/index.d.ts +0 -0
- package/dist/core/cache/interfaces.d.ts +0 -0
- package/dist/core/cache/operations.d.ts +0 -0
- package/dist/core/cache/utils.d.ts +0 -0
- package/dist/core/cleanup/cleanup-scheduler.d.ts +0 -0
- package/dist/core/commands/index.d.ts +0 -0
- package/dist/core/commands/interfaces/background-task.d.ts +0 -0
- package/dist/core/commands/interfaces/index.d.ts +0 -0
- package/dist/core/commands/interfaces/run-background-options.d.ts +0 -0
- package/dist/core/commands/manager.d.ts +0 -0
- package/dist/core/commands/types/background-task-status.d.ts +0 -0
- package/dist/core/commands/types/index.d.ts +0 -0
- package/dist/core/config/plugin-options.d.ts +9 -0
- package/dist/core/context/context-window-monitor.d.ts +0 -0
- package/dist/core/context/index.d.ts +0 -0
- package/dist/core/knowledge/context-provider.d.ts +0 -0
- package/dist/core/knowledge/graph-parser.d.ts +0 -0
- package/dist/core/knowledge/hybrid-search.d.ts +0 -0
- package/dist/core/knowledge/index.d.ts +1 -0
- package/dist/core/knowledge/memory-consolidation.d.ts +0 -0
- package/dist/core/knowledge/mission-memory.d.ts +4 -0
- package/dist/core/knowledge/safety-guards.d.ts +0 -0
- package/dist/core/knowledge/scratchpad.d.ts +0 -0
- package/dist/core/knowledge/tag-indexer.d.ts +0 -0
- package/dist/core/loop/circuit-breaker.d.ts +0 -0
- package/dist/core/loop/compaction-guard.d.ts +0 -0
- package/dist/core/loop/formatters.d.ts +0 -0
- package/dist/core/loop/interfaces/index.d.ts +0 -0
- package/dist/core/loop/interfaces/todo-stats.d.ts +0 -0
- package/dist/core/loop/interfaces/todo.d.ts +0 -0
- package/dist/core/loop/interfaces.d.ts +0 -0
- package/dist/core/loop/mission-ledger.d.ts +17 -0
- package/dist/core/loop/mission-loop-handler.d.ts +0 -0
- package/dist/core/loop/mission-loop.d.ts +7 -1
- package/dist/core/loop/mission-runtime-options.d.ts +8 -0
- package/dist/core/loop/parser.d.ts +0 -0
- package/dist/core/loop/progress-tracker.d.ts +0 -0
- package/dist/core/loop/session-state-store.d.ts +0 -0
- package/dist/core/loop/stats.d.ts +0 -0
- package/dist/core/loop/todo-continuation.d.ts +0 -0
- package/dist/core/loop/todo-enforcer.d.ts +0 -0
- package/dist/core/loop/todo-manager.d.ts +0 -0
- package/dist/core/loop/types/index.d.ts +0 -0
- package/dist/core/loop/types/todo-priority.d.ts +0 -0
- package/dist/core/loop/types/todo-status.d.ts +0 -0
- package/dist/core/loop/verification.d.ts +0 -0
- package/dist/core/memory/interfaces.d.ts +0 -0
- package/dist/core/memory/memory-manager.d.ts +0 -0
- package/dist/core/metrics/collector.d.ts +0 -0
- package/dist/core/notification/os-notify/index.d.ts +0 -0
- package/dist/core/notification/os-notify/notifier.d.ts +0 -0
- package/dist/core/notification/os-notify/platform-resolver.d.ts +0 -0
- package/dist/core/notification/os-notify/platform.d.ts +0 -0
- package/dist/core/notification/os-notify/sound-player.d.ts +0 -0
- package/dist/core/notification/os-notify/todo-checker.d.ts +0 -0
- package/dist/core/notification/task-toast-manager.d.ts +0 -0
- package/dist/core/notification/toast-core.d.ts +0 -0
- package/dist/core/notification/toast-sanitizer.d.ts +0 -0
- package/dist/core/notification/toast.d.ts +0 -0
- package/dist/core/orchestrator/index.d.ts +0 -0
- package/dist/core/orchestrator/interfaces/index.d.ts +0 -0
- package/dist/core/orchestrator/interfaces/session-state.d.ts +0 -0
- package/dist/core/orchestrator/session-manager.d.ts +0 -0
- package/dist/core/orchestrator/state.d.ts +0 -0
- package/dist/core/orchestrator/types/index.d.ts +0 -0
- package/dist/core/orchestrator/types/task-status.d.ts +0 -0
- package/dist/core/plugins/interfaces.d.ts +0 -0
- package/dist/core/plugins/plugin-manager.d.ts +0 -0
- package/dist/core/pool/buffer-pool.d.ts +0 -0
- package/dist/core/pool/object-pool.d.ts +0 -0
- package/dist/core/pool/string-pool.d.ts +0 -0
- package/dist/core/pool/task-pool.d.ts +0 -0
- package/dist/core/progress/calculator.d.ts +0 -0
- package/dist/core/progress/formatters.d.ts +0 -0
- package/dist/core/progress/interfaces/index.d.ts +0 -0
- package/dist/core/progress/interfaces/progress-snapshot.d.ts +0 -0
- package/dist/core/progress/interfaces/snapshot-input.d.ts +0 -0
- package/dist/core/progress/interfaces/step-progress.d.ts +0 -0
- package/dist/core/progress/interfaces/task-progress.d.ts +0 -0
- package/dist/core/progress/interfaces/todo-progress.d.ts +0 -0
- package/dist/core/progress/interfaces.d.ts +0 -0
- package/dist/core/progress/progress-notifier.d.ts +0 -0
- package/dist/core/progress/state-broadcaster.d.ts +0 -0
- package/dist/core/progress/store.d.ts +0 -0
- package/dist/core/progress/tracker.d.ts +0 -0
- package/dist/core/queue/async-queue.d.ts +0 -0
- package/dist/core/queue/async-utils.d.ts +0 -0
- package/dist/core/queue/index.d.ts +0 -0
- package/dist/core/queue/work-pool.d.ts +0 -0
- package/dist/core/queue/work-stealing-deque.d.ts +0 -0
- package/dist/core/queue/worker-pool.d.ts +0 -0
- package/dist/core/recovery/auto-recovery.d.ts +0 -0
- package/dist/core/recovery/constants.d.ts +0 -0
- package/dist/core/recovery/handler.d.ts +0 -0
- package/dist/core/recovery/interfaces/error-context.d.ts +0 -0
- package/dist/core/recovery/interfaces/error-pattern.d.ts +0 -0
- package/dist/core/recovery/interfaces/index.d.ts +0 -0
- package/dist/core/recovery/interfaces/recovery-action.d.ts +0 -0
- package/dist/core/recovery/interfaces/recovery-record.d.ts +0 -0
- package/dist/core/recovery/interfaces/recovery-stats.d.ts +0 -0
- package/dist/core/recovery/interfaces.d.ts +0 -0
- package/dist/core/recovery/patterns.d.ts +0 -0
- package/dist/core/recovery/retry.d.ts +0 -0
- package/dist/core/recovery/session-recovery.d.ts +0 -0
- package/dist/core/session/interfaces/context-stats.d.ts +0 -0
- package/dist/core/session/interfaces/index.d.ts +0 -0
- package/dist/core/session/interfaces/shared-context.d.ts +0 -0
- package/dist/core/session/interfaces/shared-decision.d.ts +0 -0
- package/dist/core/session/interfaces/shared-document.d.ts +0 -0
- package/dist/core/session/interfaces/shared-finding.d.ts +0 -0
- package/dist/core/session/interfaces.d.ts +0 -0
- package/dist/core/session/shared-context.d.ts +0 -0
- package/dist/core/session/store.d.ts +0 -0
- package/dist/core/session/summary.d.ts +0 -0
- package/dist/core/sync/todo-parser.d.ts +0 -0
- package/dist/core/sync/todo-sync-service.d.ts +0 -0
- package/dist/core/task/interfaces/index.d.ts +0 -0
- package/dist/core/task/interfaces/task-hierarchy.d.ts +0 -0
- package/dist/core/task/interfaces/task-input.d.ts +0 -0
- package/dist/core/task/interfaces/task-node.d.ts +0 -0
- package/dist/core/task/interfaces/task-progress.d.ts +0 -0
- package/dist/core/task/interfaces.d.ts +0 -0
- package/dist/core/task/parser.d.ts +0 -0
- package/dist/core/task/scheduler.d.ts +0 -0
- package/dist/core/task/store.d.ts +0 -0
- package/dist/core/task/summary.d.ts +0 -0
- package/dist/core/task/task-decomposer.d.ts +0 -0
- package/dist/core/todo/todo-manager.d.ts +0 -0
- package/dist/hooks/compatibility/external-plugin.d.ts +0 -0
- package/dist/hooks/constants.d.ts +0 -0
- package/dist/hooks/custom/agent-ui.d.ts +0 -0
- package/dist/hooks/custom/memory-gate.d.ts +0 -0
- package/dist/hooks/custom/metrics.d.ts +0 -0
- package/dist/hooks/custom/resource-control.d.ts +0 -0
- package/dist/hooks/custom/secret-scanner.d.ts +0 -0
- package/dist/hooks/custom/strict-role-guard.d.ts +0 -0
- package/dist/hooks/custom/user-activity.d.ts +0 -0
- package/dist/hooks/features/mission-loop.d.ts +0 -0
- package/dist/hooks/features/sanity-check.d.ts +0 -0
- package/dist/hooks/index.d.ts +0 -0
- package/dist/hooks/registry.d.ts +0 -0
- package/dist/hooks/types.d.ts +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +719 -185
- package/dist/plugin-handlers/assistant-done-handler.d.ts +0 -0
- package/dist/plugin-handlers/chat-message-handler.d.ts +0 -0
- package/dist/plugin-handlers/config-handler.d.ts +8 -1
- package/dist/plugin-handlers/event-handler.d.ts +0 -0
- package/dist/plugin-handlers/index.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/assistant-done-context.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/chat-message-context.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/event-handler-context.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/index.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/orchestrator-state.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/session-compacting.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/session-state.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/system-transform.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/tool-execute-context.d.ts +0 -0
- package/dist/plugin-handlers/interfaces/tool-hook.d.ts +0 -0
- package/dist/plugin-handlers/session-compacting-handler.d.ts +0 -0
- package/dist/plugin-handlers/system-transform-handler.d.ts +0 -0
- package/dist/plugin-handlers/tool-execute-handler.d.ts +0 -0
- package/dist/plugin-handlers/tool-execute-pre-handler.d.ts +0 -0
- package/dist/shared/agent/constants/index.d.ts +0 -1
- package/dist/shared/agent/constants/names.d.ts +0 -0
- package/dist/shared/agent/index.d.ts +0 -0
- package/dist/shared/agent/interfaces/agent-definition.d.ts +0 -0
- package/dist/shared/agent/interfaces/concurrency-config.d.ts +0 -0
- package/dist/shared/agent/interfaces/index.d.ts +0 -0
- package/dist/shared/agent/types/agent-name.d.ts +0 -0
- package/dist/shared/agent/types/index.d.ts +0 -0
- package/dist/shared/agent/utils/index.d.ts +0 -0
- package/dist/shared/cache/constants/cache-actions.d.ts +0 -0
- package/dist/shared/cache/constants/cache.d.ts +0 -0
- package/dist/shared/cache/constants/filter-status.d.ts +0 -0
- package/dist/shared/cache/constants/index.d.ts +0 -0
- package/dist/shared/cache/index.d.ts +0 -0
- package/dist/shared/command/index.d.ts +0 -0
- package/dist/shared/command/interfaces/background-task.d.ts +0 -0
- package/dist/shared/command/interfaces/index.d.ts +0 -0
- package/dist/shared/command/interfaces/run-background-options.d.ts +0 -0
- package/dist/shared/command/types/background-task-status.d.ts +0 -0
- package/dist/shared/command/types/index.d.ts +0 -0
- package/dist/shared/constants/security-patterns.d.ts +0 -0
- package/dist/shared/constants/system-messages.d.ts +0 -0
- package/dist/shared/core/constants/cli.d.ts +0 -0
- package/dist/shared/core/constants/id-prefix.d.ts +0 -0
- package/dist/shared/core/constants/index.d.ts +0 -0
- package/dist/shared/core/constants/lifecycle.d.ts +0 -0
- package/dist/shared/core/constants/limits.d.ts +0 -0
- package/dist/shared/core/constants/logging.d.ts +0 -0
- package/dist/shared/core/constants/memory-hooks.d.ts +0 -0
- package/dist/shared/core/constants/memory-limits.d.ts +0 -0
- package/dist/shared/core/constants/paths.d.ts +0 -0
- package/dist/shared/core/constants/phases.d.ts +0 -0
- package/dist/shared/core/constants/status-labels.d.ts +0 -0
- package/dist/shared/core/constants/time.d.ts +0 -0
- package/dist/shared/core/constants/wal-actions.d.ts +0 -0
- package/dist/shared/core/index.d.ts +0 -0
- package/dist/shared/core/poolable.d.ts +0 -0
- package/dist/shared/errors/constants/error-patterns.d.ts +0 -0
- package/dist/shared/errors/constants/error-type.d.ts +0 -0
- package/dist/shared/errors/constants/index.d.ts +0 -0
- package/dist/shared/errors/detection.d.ts +0 -0
- package/dist/shared/errors/index.d.ts +0 -0
- package/dist/shared/errors/retry.d.ts +0 -0
- package/dist/shared/errors/types/error-pattern-type.d.ts +0 -0
- package/dist/shared/errors/types/index.d.ts +0 -0
- package/dist/shared/index.d.ts +0 -0
- package/dist/shared/lifecycle/index.d.ts +0 -0
- package/dist/shared/lifecycle/registration.d.ts +0 -0
- package/dist/shared/lifecycle/shutdown-manager.d.ts +0 -0
- package/dist/shared/loop/constants/index.d.ts +0 -0
- package/dist/shared/loop/constants/labels.d.ts +0 -0
- package/dist/shared/loop/constants/loop.d.ts +0 -0
- package/dist/shared/loop/constants/mission-control.d.ts +0 -0
- package/dist/shared/loop/constants/task-status.d.ts +0 -0
- package/dist/shared/loop/constants/todo-status.d.ts +0 -0
- package/dist/shared/loop/index.d.ts +0 -0
- package/dist/shared/loop/interfaces/index.d.ts +0 -0
- package/dist/shared/loop/interfaces/mission-loop.d.ts +8 -0
- package/dist/shared/loop/interfaces/todo-stats.d.ts +0 -0
- package/dist/shared/loop/interfaces/todo.d.ts +0 -0
- package/dist/shared/loop/types/index.d.ts +0 -0
- package/dist/shared/loop/types/todo-priority.d.ts +0 -0
- package/dist/shared/loop/types/todo-status.d.ts +0 -0
- package/dist/shared/message/constants/index.d.ts +0 -0
- package/dist/shared/message/constants/message-roles.d.ts +0 -0
- package/dist/shared/message/constants/part-types.d.ts +0 -0
- package/dist/shared/message/constants/plugin-hooks.d.ts +0 -0
- package/dist/shared/message/constants/prompts.d.ts +0 -0
- package/dist/shared/message/constants/slash-commands.d.ts +0 -0
- package/dist/shared/message/index.d.ts +0 -0
- package/dist/shared/notification/constants/index.d.ts +0 -0
- package/dist/shared/notification/constants/toast-duration.d.ts +0 -0
- package/dist/shared/notification/constants/toast-variants.d.ts +0 -0
- package/dist/shared/notification/constants/tui.const.d.ts +0 -0
- package/dist/shared/notification/index.d.ts +0 -0
- package/dist/shared/notification/interfaces/index.d.ts +0 -0
- package/dist/shared/notification/interfaces/task-toast.interface.d.ts +0 -0
- package/dist/shared/notification/interfaces/toast-message.d.ts +0 -0
- package/dist/shared/notification/interfaces/toast-options.d.ts +0 -0
- package/dist/shared/notification/os-notify/constants/index.d.ts +0 -0
- package/dist/shared/notification/os-notify/constants/notification-command-keys.d.ts +0 -0
- package/dist/shared/notification/os-notify/constants/notification-commands.d.ts +0 -0
- package/dist/shared/notification/os-notify/constants/notification-defaults.d.ts +0 -0
- package/dist/shared/notification/os-notify/index.d.ts +0 -0
- package/dist/shared/notification/os-notify/interfaces/index.d.ts +0 -0
- package/dist/shared/notification/os-notify/interfaces/notification-config.d.ts +0 -0
- package/dist/shared/notification/os-notify/interfaces/notification-state.d.ts +0 -0
- package/dist/shared/notification/os-notify/types/index.d.ts +0 -0
- package/dist/shared/notification/os-notify/types/notification-commands.d.ts +0 -0
- package/dist/shared/notification/presets/index.d.ts +0 -0
- package/dist/shared/notification/presets/mission.d.ts +0 -0
- package/dist/shared/notification/presets/parallel.d.ts +0 -0
- package/dist/shared/notification/presets/session.d.ts +0 -0
- package/dist/shared/notification/presets/task-lifecycle.d.ts +0 -0
- package/dist/shared/notification/presets/tools.d.ts +0 -0
- package/dist/shared/notification/presets/warnings.d.ts +0 -0
- package/dist/shared/notification/types/index.d.ts +0 -0
- package/dist/shared/notification/types/toast-variant.d.ts +0 -0
- package/dist/shared/os/constants/index.d.ts +0 -0
- package/dist/shared/os/constants/platform.d.ts +0 -0
- package/dist/shared/os/index.d.ts +0 -0
- package/dist/shared/os/types/index.d.ts +0 -0
- package/dist/shared/os/types/platform.d.ts +0 -0
- package/dist/shared/prompt/constants/architecture.d.ts +0 -0
- package/dist/shared/prompt/constants/index.d.ts +0 -0
- package/dist/shared/prompt/constants/mandates.d.ts +0 -0
- package/dist/shared/prompt/constants/philosophy.d.ts +0 -0
- package/dist/shared/prompt/constants/scouts.d.ts +0 -0
- package/dist/shared/prompt/constants/status.d.ts +0 -0
- package/dist/shared/prompt/constants/tags.d.ts +0 -0
- package/dist/shared/prompt/index.d.ts +0 -0
- package/dist/shared/recovery/constants/history.d.ts +0 -0
- package/dist/shared/recovery/constants/index.d.ts +0 -0
- package/dist/shared/recovery/constants/recovery-level.d.ts +0 -0
- package/dist/shared/recovery/constants/recovery.d.ts +0 -0
- package/dist/shared/recovery/index.d.ts +0 -0
- package/dist/shared/recovery/interfaces/error-context.d.ts +0 -0
- package/dist/shared/recovery/interfaces/index.d.ts +0 -0
- package/dist/shared/recovery/interfaces/recovery-record.d.ts +0 -0
- package/dist/shared/recovery/types/index.d.ts +0 -0
- package/dist/shared/recovery/types/recovery-action.d.ts +0 -0
- package/dist/shared/session/constants/events/document-events.d.ts +0 -0
- package/dist/shared/session/constants/events/index.d.ts +0 -0
- package/dist/shared/session/constants/events/message-events.d.ts +0 -0
- package/dist/shared/session/constants/events/mission-events.d.ts +0 -0
- package/dist/shared/session/constants/events/session-events.d.ts +0 -0
- package/dist/shared/session/constants/events/special-events.d.ts +0 -0
- package/dist/shared/session/constants/events/task-events.d.ts +0 -0
- package/dist/shared/session/constants/events/todo-events.d.ts +0 -0
- package/dist/shared/session/constants/index.d.ts +0 -0
- package/dist/shared/session/index.d.ts +0 -0
- package/dist/shared/task/base-task.d.ts +0 -0
- package/dist/shared/task/constants/background-status.d.ts +0 -0
- package/dist/shared/task/constants/background-task.d.ts +0 -0
- package/dist/shared/task/constants/index.d.ts +0 -0
- package/dist/shared/task/constants/metadata-keys.d.ts +0 -0
- package/dist/shared/task/constants/parallel-task.d.ts +0 -0
- package/dist/shared/task/index.d.ts +0 -0
- package/dist/shared/task/interfaces/index.d.ts +0 -0
- package/dist/shared/task/interfaces/launch-input.d.ts +0 -0
- package/dist/shared/task/interfaces/parallel-task.d.ts +0 -0
- package/dist/shared/task/interfaces/resume-input.d.ts +0 -0
- package/dist/shared/task/interfaces/task-progress.d.ts +0 -0
- package/dist/shared/task/types/index.d.ts +0 -0
- package/dist/shared/task/types/parallel-task-status.d.ts +0 -0
- package/dist/shared/tool/constants/common/index.d.ts +0 -0
- package/dist/shared/tool/constants/common/labels.d.ts +0 -0
- package/dist/shared/tool/constants/common/languages.d.ts +0 -0
- package/dist/shared/tool/constants/common/output-labels.d.ts +0 -0
- package/dist/shared/tool/constants/common/sources.d.ts +0 -0
- package/dist/shared/tool/constants/index.d.ts +0 -0
- package/dist/shared/tool/constants/lsp/index.d.ts +0 -0
- package/dist/shared/tool/constants/lsp/lsp-severity-labels.d.ts +0 -0
- package/dist/shared/tool/constants/lsp/lsp-severity.d.ts +0 -0
- package/dist/shared/tool/constants/parallel/index.d.ts +0 -0
- package/dist/shared/tool/constants/parallel/logging.d.ts +0 -0
- package/dist/shared/tool/constants/parallel/parameters.d.ts +0 -0
- package/dist/shared/tool/constants/tool-names.d.ts +0 -0
- package/dist/shared/tool/constants/tool-output.d.ts +0 -0
- package/dist/shared/tool/index.d.ts +0 -0
- package/dist/shared/tool/interfaces/ast/ast-replace-result.d.ts +0 -0
- package/dist/shared/tool/interfaces/ast/ast-search-result.d.ts +0 -0
- package/dist/shared/tool/interfaces/ast/index.d.ts +0 -0
- package/dist/shared/tool/interfaces/index.d.ts +0 -0
- package/dist/shared/tool/interfaces/lsp/index.d.ts +0 -0
- package/dist/shared/tool/interfaces/lsp/lsp-command-result.d.ts +0 -0
- package/dist/shared/tool/interfaces/lsp/lsp-diagnostic.d.ts +0 -0
- package/dist/shared/tool/interfaces/lsp/lsp-rename-location.d.ts +0 -0
- package/dist/shared/tool/interfaces/lsp/lsp-rename-result.d.ts +0 -0
- package/dist/shared/tool/interfaces/parallel/index.d.ts +0 -0
- package/dist/shared/tool/interfaces/parallel/poll-result.d.ts +0 -0
- package/dist/shared/tool/interfaces/parallel/session-client.d.ts +0 -0
- package/dist/shared/verification/constants/categories.d.ts +0 -0
- package/dist/shared/verification/constants/checklist.d.ts +0 -0
- package/dist/shared/verification/constants/index.d.ts +0 -0
- package/dist/shared/verification/constants/patterns.d.ts +0 -0
- package/dist/shared/verification/constants/signals.d.ts +0 -0
- package/dist/shared/verification/index.d.ts +0 -0
- package/dist/shared/verification/interfaces/checklist-item.d.ts +0 -0
- package/dist/shared/verification/interfaces/checklist-verification-result.d.ts +0 -0
- package/dist/shared/verification/interfaces/index.d.ts +0 -0
- package/dist/shared/verification/interfaces/verification-checklist.d.ts +0 -0
- package/dist/shared/verification/interfaces/verification-result.d.ts +0 -0
- package/dist/shared/verification/types/checklist-category.d.ts +0 -0
- package/dist/shared/verification/types/index.d.ts +0 -0
- package/dist/tools/ast/index.d.ts +0 -0
- package/dist/tools/background-cmd/check.d.ts +0 -0
- package/dist/tools/background-cmd/index.d.ts +0 -0
- package/dist/tools/background-cmd/kill.d.ts +0 -0
- package/dist/tools/background-cmd/list.d.ts +0 -0
- package/dist/tools/background-cmd/run.d.ts +0 -0
- package/dist/tools/callAgent.d.ts +0 -0
- package/dist/tools/lsp/diagnostics-cache.d.ts +0 -0
- package/dist/tools/lsp/index.d.ts +0 -0
- package/dist/tools/parallel/cancel-task.d.ts +0 -0
- package/dist/tools/parallel/delegate-task.d.ts +0 -0
- package/dist/tools/parallel/get-task-result.d.ts +0 -0
- package/dist/tools/parallel/index.d.ts +0 -0
- package/dist/tools/parallel/list-agents.d.ts +0 -0
- package/dist/tools/parallel/list-tasks.d.ts +0 -0
- package/dist/tools/parallel/show-metrics.d.ts +0 -0
- package/dist/tools/parallel/update-todo.d.ts +0 -0
- package/dist/tools/registry.d.ts +0 -0
- package/dist/tools/rust-pool.d.ts +32 -2
- package/dist/tools/rust.d.ts +0 -0
- package/dist/tools/search.d.ts +0 -0
- package/dist/tools/slashCommand.d.ts +0 -0
- package/dist/tools/web/cache-docs.d.ts +0 -0
- package/dist/tools/web/codesearch.d.ts +0 -0
- package/dist/tools/web/index.d.ts +0 -0
- package/dist/tools/web/webfetch.d.ts +0 -0
- package/dist/tools/web/websearch.d.ts +0 -0
- package/dist/utils/binary.d.ts +0 -0
- package/dist/utils/common.d.ts +0 -0
- package/dist/utils/compatibility/claude.d.ts +0 -0
- package/dist/utils/formatting/elapsed-time.d.ts +0 -0
- package/dist/utils/formatting/index.d.ts +0 -0
- package/dist/utils/formatting/timestamp.d.ts +0 -0
- package/dist/utils/parsing/index.d.ts +0 -0
- package/dist/utils/parsing/slash-command.d.ts +0 -0
- package/dist/utils/sanity/checker.d.ts +0 -0
- package/dist/utils/sanity/constants/escalation-prompt.d.ts +0 -0
- package/dist/utils/sanity/constants/index.d.ts +0 -0
- package/dist/utils/sanity/constants/recovery-prompt.d.ts +0 -0
- package/dist/utils/sanity/constants/severity.d.ts +0 -0
- package/dist/utils/sanity/index.d.ts +0 -0
- package/dist/utils/sanity/interfaces/index.d.ts +0 -0
- package/dist/utils/sanity/interfaces/sanity-result.d.ts +0 -0
- package/dist/utils/sanity/types/index.d.ts +0 -0
- package/dist/utils/sanity/types/severity.d.ts +0 -0
- package/package.json +89 -88
- package/scripts/run-install-hook.mjs +66 -66
- package/dist/shared/agent/constants/agent-tokens.d.ts +0 -11
package/dist/index.js
CHANGED
|
@@ -37,28 +37,11 @@ var init_names = __esm({
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
// src/shared/agent/constants/agent-tokens.ts
|
|
41
|
-
var AGENT_TOKENS;
|
|
42
|
-
var init_agent_tokens = __esm({
|
|
43
|
-
"src/shared/agent/constants/agent-tokens.ts"() {
|
|
44
|
-
"use strict";
|
|
45
|
-
AGENT_TOKENS = {
|
|
46
|
-
/** Primary agent (Commander) max tokens */
|
|
47
|
-
PRIMARY_MAX_TOKENS: 64e3,
|
|
48
|
-
/** Primary agent thinking budget */
|
|
49
|
-
PRIMARY_THINKING_BUDGET: 32e3,
|
|
50
|
-
/** Subagent max tokens */
|
|
51
|
-
SUBAGENT_MAX_TOKENS: 32e3
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
40
|
// src/shared/agent/constants/index.ts
|
|
57
41
|
var init_constants = __esm({
|
|
58
42
|
"src/shared/agent/constants/index.ts"() {
|
|
59
43
|
"use strict";
|
|
60
44
|
init_names();
|
|
61
|
-
init_agent_tokens();
|
|
62
45
|
}
|
|
63
46
|
});
|
|
64
47
|
|
|
@@ -4737,9 +4720,10 @@ You are ${AGENT_NAMES.COMMANDER}. Autonomous mission controller.
|
|
|
4737
4720
|
- You ADAPT your approach to what the project requires
|
|
4738
4721
|
|
|
4739
4722
|
## \u{1F680} AUTONOMOUS EXECUTION MODE
|
|
4740
|
-
- Complete the ENTIRE mission without
|
|
4723
|
+
- Complete the ENTIRE mission without routine user hand-holding
|
|
4741
4724
|
- Make decisions yourself - don't present options to user
|
|
4742
4725
|
- If uncertain, make the BEST choice and proceed
|
|
4726
|
+
- Ask a concise clarification only when truly blocked and the OpenCode question permission allows it
|
|
4743
4727
|
- Conclude ONLY after ${AGENT_NAMES.REVIEWER} verifies the full system
|
|
4744
4728
|
- Only stop when everything is verified or truly blocked
|
|
4745
4729
|
${PROMPT_TAGS.ROLE.close}`;
|
|
@@ -5514,6 +5498,9 @@ var ConcurrencyToken = class {
|
|
|
5514
5498
|
}, autoReleaseMs);
|
|
5515
5499
|
this.autoReleaseTimer.unref();
|
|
5516
5500
|
}
|
|
5501
|
+
controller;
|
|
5502
|
+
key;
|
|
5503
|
+
autoReleaseMs;
|
|
5517
5504
|
released = false;
|
|
5518
5505
|
autoReleaseTimer = null;
|
|
5519
5506
|
/**
|
|
@@ -5857,6 +5844,12 @@ var ConcurrencyController = class {
|
|
|
5857
5844
|
constructor(config3) {
|
|
5858
5845
|
this.config = config3 ?? {};
|
|
5859
5846
|
}
|
|
5847
|
+
configure(config3) {
|
|
5848
|
+
this.config = config3;
|
|
5849
|
+
}
|
|
5850
|
+
getConfig() {
|
|
5851
|
+
return this.config;
|
|
5852
|
+
}
|
|
5860
5853
|
setLimit(key, limit) {
|
|
5861
5854
|
this.limits.set(key, limit);
|
|
5862
5855
|
}
|
|
@@ -7783,7 +7776,7 @@ function $constructor(name, initializer5, params) {
|
|
|
7783
7776
|
Object.defineProperty(_, "name", { value: name });
|
|
7784
7777
|
return _;
|
|
7785
7778
|
}
|
|
7786
|
-
var $brand = Symbol("zod_brand");
|
|
7779
|
+
var $brand = /* @__PURE__ */ Symbol("zod_brand");
|
|
7787
7780
|
var $ZodAsyncError = class extends Error {
|
|
7788
7781
|
constructor() {
|
|
7789
7782
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -17526,8 +17519,8 @@ function yo_default() {
|
|
|
17526
17519
|
|
|
17527
17520
|
// node_modules/zod/v4/core/registries.js
|
|
17528
17521
|
var _a2;
|
|
17529
|
-
var $output = Symbol("ZodOutput");
|
|
17530
|
-
var $input = Symbol("ZodInput");
|
|
17522
|
+
var $output = /* @__PURE__ */ Symbol("ZodOutput");
|
|
17523
|
+
var $input = /* @__PURE__ */ Symbol("ZodInput");
|
|
17531
17524
|
var $ZodRegistry = class {
|
|
17532
17525
|
constructor() {
|
|
17533
17526
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
@@ -18564,7 +18557,7 @@ function _stringbool(Classes, _params) {
|
|
|
18564
18557
|
type: "pipe",
|
|
18565
18558
|
in: stringSchema,
|
|
18566
18559
|
out: booleanSchema,
|
|
18567
|
-
transform: (input, payload) => {
|
|
18560
|
+
transform: ((input, payload) => {
|
|
18568
18561
|
let data = input;
|
|
18569
18562
|
if (params.case !== "sensitive")
|
|
18570
18563
|
data = data.toLowerCase();
|
|
@@ -18583,14 +18576,14 @@ function _stringbool(Classes, _params) {
|
|
|
18583
18576
|
});
|
|
18584
18577
|
return {};
|
|
18585
18578
|
}
|
|
18586
|
-
},
|
|
18587
|
-
reverseTransform: (input, _payload) => {
|
|
18579
|
+
}),
|
|
18580
|
+
reverseTransform: ((input, _payload) => {
|
|
18588
18581
|
if (input === true) {
|
|
18589
18582
|
return truthyArray[0] || "true";
|
|
18590
18583
|
} else {
|
|
18591
18584
|
return falsyArray[0] || "false";
|
|
18592
18585
|
}
|
|
18593
|
-
},
|
|
18586
|
+
}),
|
|
18594
18587
|
error: params.error
|
|
18595
18588
|
});
|
|
18596
18589
|
return codec3;
|
|
@@ -21727,9 +21720,6 @@ var AgentDefinitionSchema = external_exports.object({
|
|
|
21727
21720
|
mode: external_exports.enum(["primary", "subagent"]).optional(),
|
|
21728
21721
|
color: external_exports.string().optional(),
|
|
21729
21722
|
hidden: external_exports.boolean().optional(),
|
|
21730
|
-
thinking: external_exports.boolean().optional(),
|
|
21731
|
-
maxTokens: external_exports.number().optional(),
|
|
21732
|
-
budgetTokens: external_exports.number().optional(),
|
|
21733
21723
|
canWrite: external_exports.boolean(),
|
|
21734
21724
|
// Required per interface
|
|
21735
21725
|
canBash: external_exports.boolean()
|
|
@@ -21786,7 +21776,7 @@ var AgentRegistry = class _AgentRegistry {
|
|
|
21786
21776
|
for (const [name, def] of Object.entries(customAgents)) {
|
|
21787
21777
|
const result = AgentDefinitionSchema.safeParse(def);
|
|
21788
21778
|
if (result.success) {
|
|
21789
|
-
this.registerAgent(name,
|
|
21779
|
+
this.registerAgent(name, result.data);
|
|
21790
21780
|
} else {
|
|
21791
21781
|
log(`[AgentRegistry] Invalid custom agent definition for: ${name}. Errors: ${result.error.message}`);
|
|
21792
21782
|
}
|
|
@@ -21812,6 +21802,13 @@ var TaskLauncher = class {
|
|
|
21812
21802
|
this.onTaskError = onTaskError;
|
|
21813
21803
|
this.startPolling = startPolling;
|
|
21814
21804
|
}
|
|
21805
|
+
client;
|
|
21806
|
+
directory;
|
|
21807
|
+
store;
|
|
21808
|
+
concurrency;
|
|
21809
|
+
sessionPool;
|
|
21810
|
+
onTaskError;
|
|
21811
|
+
startPolling;
|
|
21815
21812
|
/**
|
|
21816
21813
|
* Unified launch method - handles both single and multiple tasks efficiently.
|
|
21817
21814
|
* All session creations happen in parallel immediately.
|
|
@@ -21981,6 +21978,11 @@ var TaskResumer = class {
|
|
|
21981
21978
|
this.startPolling = startPolling;
|
|
21982
21979
|
this.notifyParentIfAllComplete = notifyParentIfAllComplete;
|
|
21983
21980
|
}
|
|
21981
|
+
client;
|
|
21982
|
+
store;
|
|
21983
|
+
findBySession;
|
|
21984
|
+
startPolling;
|
|
21985
|
+
notifyParentIfAllComplete;
|
|
21984
21986
|
async resume(input) {
|
|
21985
21987
|
const existingTask = this.findBySession(input.sessionId);
|
|
21986
21988
|
if (!existingTask) {
|
|
@@ -22135,6 +22137,13 @@ var TaskPoller = class {
|
|
|
22135
22137
|
this.pruneExpiredTasks = pruneExpiredTasks;
|
|
22136
22138
|
this.onTaskComplete = onTaskComplete;
|
|
22137
22139
|
}
|
|
22140
|
+
client;
|
|
22141
|
+
store;
|
|
22142
|
+
concurrency;
|
|
22143
|
+
notifyParentIfAllComplete;
|
|
22144
|
+
scheduleCleanup;
|
|
22145
|
+
pruneExpiredTasks;
|
|
22146
|
+
onTaskComplete;
|
|
22138
22147
|
pollingInterval;
|
|
22139
22148
|
messageCache = /* @__PURE__ */ new Map();
|
|
22140
22149
|
// Adaptive polling
|
|
@@ -22339,6 +22348,10 @@ var TaskCleaner = class {
|
|
|
22339
22348
|
this.concurrency = concurrency;
|
|
22340
22349
|
this.sessionPool = sessionPool2;
|
|
22341
22350
|
}
|
|
22351
|
+
client;
|
|
22352
|
+
store;
|
|
22353
|
+
concurrency;
|
|
22354
|
+
sessionPool;
|
|
22342
22355
|
pruneExpiredTasks() {
|
|
22343
22356
|
const now = Date.now();
|
|
22344
22357
|
for (const [taskId, task] of this.store.getAll().map((t) => [t.id, t])) {
|
|
@@ -22454,6 +22467,14 @@ var EventHandler = class {
|
|
|
22454
22467
|
this.validateSessionHasOutput = validateSessionHasOutput2;
|
|
22455
22468
|
this.onTaskComplete = onTaskComplete;
|
|
22456
22469
|
}
|
|
22470
|
+
client;
|
|
22471
|
+
store;
|
|
22472
|
+
concurrency;
|
|
22473
|
+
findBySession;
|
|
22474
|
+
notifyParentIfAllComplete;
|
|
22475
|
+
scheduleCleanup;
|
|
22476
|
+
validateSessionHasOutput;
|
|
22477
|
+
onTaskComplete;
|
|
22457
22478
|
/**
|
|
22458
22479
|
* Handle OpenCode session events for proper resource cleanup.
|
|
22459
22480
|
* Call this from your plugin's event hook.
|
|
@@ -22959,7 +22980,7 @@ var ParallelAgentManager = class _ParallelAgentManager {
|
|
|
22959
22980
|
store = new TaskStore();
|
|
22960
22981
|
client;
|
|
22961
22982
|
directory;
|
|
22962
|
-
concurrency
|
|
22983
|
+
concurrency;
|
|
22963
22984
|
sessionPool;
|
|
22964
22985
|
// Composed components
|
|
22965
22986
|
launcher;
|
|
@@ -22967,9 +22988,10 @@ var ParallelAgentManager = class _ParallelAgentManager {
|
|
|
22967
22988
|
poller;
|
|
22968
22989
|
cleaner;
|
|
22969
22990
|
eventHandler;
|
|
22970
|
-
constructor(client, directory) {
|
|
22991
|
+
constructor(client, directory, concurrencyConfig) {
|
|
22971
22992
|
this.client = client;
|
|
22972
22993
|
this.directory = directory;
|
|
22994
|
+
this.concurrency = new ConcurrencyController(concurrencyConfig);
|
|
22973
22995
|
const memory = MemoryManager.getInstance();
|
|
22974
22996
|
memory.add("system" /* SYSTEM */, CORE_PHILOSOPHY, 1);
|
|
22975
22997
|
memory.add("project" /* PROJECT */, `Working directory: ${directory}`, 0.9);
|
|
@@ -23021,12 +23043,12 @@ var ParallelAgentManager = class _ParallelAgentManager {
|
|
|
23021
23043
|
log("Recovery error:", err);
|
|
23022
23044
|
});
|
|
23023
23045
|
}
|
|
23024
|
-
static getInstance(client, directory) {
|
|
23046
|
+
static getInstance(client, directory, concurrencyConfig) {
|
|
23025
23047
|
if (!_ParallelAgentManager._instance) {
|
|
23026
23048
|
if (!client || !directory) {
|
|
23027
23049
|
throw new Error("ParallelAgentManager requires client and directory on first call");
|
|
23028
23050
|
}
|
|
23029
|
-
_ParallelAgentManager._instance = new _ParallelAgentManager(client, directory);
|
|
23051
|
+
_ParallelAgentManager._instance = new _ParallelAgentManager(client, directory, concurrencyConfig);
|
|
23030
23052
|
}
|
|
23031
23053
|
return _ParallelAgentManager._instance;
|
|
23032
23054
|
}
|
|
@@ -23095,6 +23117,9 @@ var ParallelAgentManager = class _ParallelAgentManager {
|
|
|
23095
23117
|
setConcurrencyLimit(agentType, limit) {
|
|
23096
23118
|
this.concurrency.setLimit(agentType, limit);
|
|
23097
23119
|
}
|
|
23120
|
+
configureConcurrency(config3) {
|
|
23121
|
+
this.concurrency.configure(config3);
|
|
23122
|
+
}
|
|
23098
23123
|
getPendingCount(parentSessionID) {
|
|
23099
23124
|
return this.store.getPendingCount(parentSessionID);
|
|
23100
23125
|
}
|
|
@@ -23723,7 +23748,7 @@ function $constructor2(name, initializer5, params) {
|
|
|
23723
23748
|
Object.defineProperty(_, "name", { value: name });
|
|
23724
23749
|
return _;
|
|
23725
23750
|
}
|
|
23726
|
-
var $brand2 = Symbol("zod_brand");
|
|
23751
|
+
var $brand2 = /* @__PURE__ */ Symbol("zod_brand");
|
|
23727
23752
|
var $ZodAsyncError2 = class extends Error {
|
|
23728
23753
|
constructor() {
|
|
23729
23754
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -23868,7 +23893,7 @@ function floatSafeRemainder2(val, step) {
|
|
|
23868
23893
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
23869
23894
|
return valInt % stepInt / 10 ** decCount;
|
|
23870
23895
|
}
|
|
23871
|
-
var EVALUATING2 = Symbol("evaluating");
|
|
23896
|
+
var EVALUATING2 = /* @__PURE__ */ Symbol("evaluating");
|
|
23872
23897
|
function defineLazy2(object3, key, getter) {
|
|
23873
23898
|
let value = void 0;
|
|
23874
23899
|
Object.defineProperty(object3, key, {
|
|
@@ -32713,8 +32738,8 @@ function yo_default2() {
|
|
|
32713
32738
|
}
|
|
32714
32739
|
|
|
32715
32740
|
// node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/registries.js
|
|
32716
|
-
var $output2 = Symbol("ZodOutput");
|
|
32717
|
-
var $input2 = Symbol("ZodInput");
|
|
32741
|
+
var $output2 = /* @__PURE__ */ Symbol("ZodOutput");
|
|
32742
|
+
var $input2 = /* @__PURE__ */ Symbol("ZodInput");
|
|
32718
32743
|
var $ZodRegistry2 = class {
|
|
32719
32744
|
constructor() {
|
|
32720
32745
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
@@ -33597,7 +33622,7 @@ function _stringbool2(Classes, _params) {
|
|
|
33597
33622
|
type: "pipe",
|
|
33598
33623
|
in: stringSchema,
|
|
33599
33624
|
out: booleanSchema,
|
|
33600
|
-
transform: (input, payload) => {
|
|
33625
|
+
transform: ((input, payload) => {
|
|
33601
33626
|
let data = input;
|
|
33602
33627
|
if (params.case !== "sensitive")
|
|
33603
33628
|
data = data.toLowerCase();
|
|
@@ -33616,14 +33641,14 @@ function _stringbool2(Classes, _params) {
|
|
|
33616
33641
|
});
|
|
33617
33642
|
return {};
|
|
33618
33643
|
}
|
|
33619
|
-
},
|
|
33620
|
-
reverseTransform: (input, _payload) => {
|
|
33644
|
+
}),
|
|
33645
|
+
reverseTransform: ((input, _payload) => {
|
|
33621
33646
|
if (input === true) {
|
|
33622
33647
|
return truthyArray[0] || "true";
|
|
33623
33648
|
} else {
|
|
33624
33649
|
return falsyArray[0] || "false";
|
|
33625
33650
|
}
|
|
33626
|
-
},
|
|
33651
|
+
}),
|
|
33627
33652
|
error: params.error
|
|
33628
33653
|
});
|
|
33629
33654
|
return codec3;
|
|
@@ -34583,10 +34608,10 @@ var ZodType2 = /* @__PURE__ */ $constructor2("ZodType", (inst, def) => {
|
|
|
34583
34608
|
};
|
|
34584
34609
|
inst.clone = (def2, params) => clone2(inst, def2, params);
|
|
34585
34610
|
inst.brand = () => inst;
|
|
34586
|
-
inst.register = (reg, meta3) => {
|
|
34611
|
+
inst.register = ((reg, meta3) => {
|
|
34587
34612
|
reg.add(inst, meta3);
|
|
34588
34613
|
return inst;
|
|
34589
|
-
};
|
|
34614
|
+
});
|
|
34590
34615
|
inst.parse = (data, params) => parse4(inst, data, params, { callee: inst.parse });
|
|
34591
34616
|
inst.safeParse = (data, params) => safeParse4(inst, data, params);
|
|
34592
34617
|
inst.parseAsync = async (data, params) => parseAsync4(inst, data, params, { callee: inst.parseAsync });
|
|
@@ -36413,8 +36438,8 @@ init_logger();
|
|
|
36413
36438
|
// src/core/loop/mission-loop.ts
|
|
36414
36439
|
init_logger();
|
|
36415
36440
|
init_shared();
|
|
36416
|
-
import { existsSync as
|
|
36417
|
-
import { join as
|
|
36441
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2, unlinkSync, mkdirSync as mkdirSync4 } from "node:fs";
|
|
36442
|
+
import { join as join6 } from "node:path";
|
|
36418
36443
|
|
|
36419
36444
|
// src/shared/constants/system-messages.ts
|
|
36420
36445
|
init_mission_control();
|
|
@@ -36522,19 +36547,199 @@ You must maintain a pristine workspace. **As part of your move**, perform these
|
|
|
36522
36547
|
</system_maintenance>
|
|
36523
36548
|
`;
|
|
36524
36549
|
|
|
36550
|
+
// src/core/knowledge/mission-memory.ts
|
|
36551
|
+
init_shared();
|
|
36552
|
+
import { mkdirSync as mkdirSync3, renameSync, writeFileSync } from "node:fs";
|
|
36553
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
36554
|
+
|
|
36555
|
+
// src/core/loop/mission-ledger.ts
|
|
36556
|
+
init_shared();
|
|
36557
|
+
import { appendFileSync, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync } from "node:fs";
|
|
36558
|
+
import { join as join4 } from "node:path";
|
|
36559
|
+
import { randomUUID } from "node:crypto";
|
|
36560
|
+
|
|
36561
|
+
// src/core/loop/mission-runtime-options.ts
|
|
36562
|
+
var DEFAULT_MISSION_RUNTIME_OPTIONS = {
|
|
36563
|
+
ledger: true,
|
|
36564
|
+
markdownMemory: true,
|
|
36565
|
+
maxEvidenceEvents: 20
|
|
36566
|
+
};
|
|
36567
|
+
var runtimeOptions = { ...DEFAULT_MISSION_RUNTIME_OPTIONS };
|
|
36568
|
+
function configureMissionRuntimeOptions(options) {
|
|
36569
|
+
runtimeOptions = { ...DEFAULT_MISSION_RUNTIME_OPTIONS, ...options };
|
|
36570
|
+
}
|
|
36571
|
+
function getMissionRuntimeOptions() {
|
|
36572
|
+
return runtimeOptions;
|
|
36573
|
+
}
|
|
36574
|
+
|
|
36575
|
+
// src/core/loop/mission-ledger.ts
|
|
36576
|
+
var LEDGER_FILE = "mission-ledger.jsonl";
|
|
36577
|
+
function getMissionLedgerPath(directory) {
|
|
36578
|
+
return join4(directory, PATHS.OPENCODE, LEDGER_FILE);
|
|
36579
|
+
}
|
|
36580
|
+
function appendMissionLedgerEvent(directory, input) {
|
|
36581
|
+
if (!getMissionRuntimeOptions().ledger) return null;
|
|
36582
|
+
const event = {
|
|
36583
|
+
id: randomUUID(),
|
|
36584
|
+
timestamp: input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
36585
|
+
type: input.type,
|
|
36586
|
+
sessionID: input.sessionID,
|
|
36587
|
+
iteration: input.iteration,
|
|
36588
|
+
objective: input.objective,
|
|
36589
|
+
summary: input.summary,
|
|
36590
|
+
reason: input.reason
|
|
36591
|
+
};
|
|
36592
|
+
try {
|
|
36593
|
+
const ledgerPath = getMissionLedgerPath(directory);
|
|
36594
|
+
mkdirSync2(join4(directory, PATHS.OPENCODE), { recursive: true });
|
|
36595
|
+
appendFileSync(ledgerPath, `${JSON.stringify(event)}
|
|
36596
|
+
`, "utf8");
|
|
36597
|
+
return event;
|
|
36598
|
+
} catch {
|
|
36599
|
+
return null;
|
|
36600
|
+
}
|
|
36601
|
+
}
|
|
36602
|
+
function readMissionLedger(directory, limit = 20) {
|
|
36603
|
+
const options = getMissionRuntimeOptions();
|
|
36604
|
+
if (!options.ledger) return [];
|
|
36605
|
+
const ledgerPath = getMissionLedgerPath(directory);
|
|
36606
|
+
if (!existsSync2(ledgerPath)) return [];
|
|
36607
|
+
try {
|
|
36608
|
+
const lines = readFileSync(ledgerPath, "utf8").split(/\r?\n/).filter(Boolean);
|
|
36609
|
+
const maxEvents = Math.max(1, Math.min(limit, options.maxEvidenceEvents));
|
|
36610
|
+
return lines.slice(Math.max(0, lines.length - maxEvents)).map(parseLedgerLine).filter((event) => event !== null);
|
|
36611
|
+
} catch {
|
|
36612
|
+
return [];
|
|
36613
|
+
}
|
|
36614
|
+
}
|
|
36615
|
+
function parseLedgerLine(line) {
|
|
36616
|
+
try {
|
|
36617
|
+
const value = JSON.parse(line);
|
|
36618
|
+
if (!value.id || !value.type || !value.timestamp || !value.sessionID) return null;
|
|
36619
|
+
return value;
|
|
36620
|
+
} catch {
|
|
36621
|
+
return null;
|
|
36622
|
+
}
|
|
36623
|
+
}
|
|
36624
|
+
|
|
36625
|
+
// src/core/knowledge/mission-memory.ts
|
|
36626
|
+
var BRAIN_DIR = join5(PATHS.DOCS, "brain");
|
|
36627
|
+
var SCRATCHPAD_FILE = "scratchpad.md";
|
|
36628
|
+
var CANVAS_FILE = "knowledge-map.canvas";
|
|
36629
|
+
var MAX_CANVAS_EVENTS = 3;
|
|
36630
|
+
var MAX_SCRATCHPAD_EVENTS = 6;
|
|
36631
|
+
function syncMissionMemory(directory, state2) {
|
|
36632
|
+
const options = getMissionRuntimeOptions();
|
|
36633
|
+
if (!options.markdownMemory) return false;
|
|
36634
|
+
const events = readMissionLedger(
|
|
36635
|
+
directory,
|
|
36636
|
+
Math.min(MAX_SCRATCHPAD_EVENTS, options.maxEvidenceEvents)
|
|
36637
|
+
);
|
|
36638
|
+
try {
|
|
36639
|
+
writeScratchpad(directory, state2, events);
|
|
36640
|
+
writeCanvas(directory, state2, events);
|
|
36641
|
+
return true;
|
|
36642
|
+
} catch {
|
|
36643
|
+
return false;
|
|
36644
|
+
}
|
|
36645
|
+
}
|
|
36646
|
+
function getMissionScratchpadPath(directory) {
|
|
36647
|
+
return join5(directory, BRAIN_DIR, SCRATCHPAD_FILE);
|
|
36648
|
+
}
|
|
36649
|
+
function getMissionCanvasPath(directory) {
|
|
36650
|
+
return join5(directory, BRAIN_DIR, CANVAS_FILE);
|
|
36651
|
+
}
|
|
36652
|
+
function writeScratchpad(directory, state2, events) {
|
|
36653
|
+
const content = [
|
|
36654
|
+
"---",
|
|
36655
|
+
"tags: [scratchpad, mission, orchestrator]",
|
|
36656
|
+
"keep: true",
|
|
36657
|
+
`title: "${escapeYaml(state2.objective ?? "Active Mission")}"`,
|
|
36658
|
+
"---",
|
|
36659
|
+
"# Orchestrator Mission Scratchpad",
|
|
36660
|
+
"",
|
|
36661
|
+
"## Focus",
|
|
36662
|
+
`- Objective: ${state2.objective ?? state2.prompt}`,
|
|
36663
|
+
`- Session: ${state2.sessionID}`,
|
|
36664
|
+
`- Status: ${state2.active ? "active" : "inactive"}`,
|
|
36665
|
+
`- Iteration: ${state2.iteration}/${state2.maxIterations}`,
|
|
36666
|
+
"",
|
|
36667
|
+
"## Runtime State",
|
|
36668
|
+
`- Last progress: ${state2.lastProgress ?? "unknown"}`,
|
|
36669
|
+
`- Last verification: ${state2.lastVerificationSummary ?? "unknown"}`,
|
|
36670
|
+
`- Last continuation reason: ${state2.lastContinuationReason ?? "unknown"}`,
|
|
36671
|
+
"",
|
|
36672
|
+
"## Recent Evidence",
|
|
36673
|
+
...formatEventLines(events),
|
|
36674
|
+
"",
|
|
36675
|
+
"## Open Questions",
|
|
36676
|
+
"- Keep this section short; unresolved blockers should be reflected in TODO or sync issues.",
|
|
36677
|
+
""
|
|
36678
|
+
].join("\n");
|
|
36679
|
+
atomicWrite(getMissionScratchpadPath(directory), content);
|
|
36680
|
+
}
|
|
36681
|
+
function writeCanvas(directory, state2, events) {
|
|
36682
|
+
const nodes = buildCanvasNodes(state2, events);
|
|
36683
|
+
const edges = buildCanvasEdges(nodes);
|
|
36684
|
+
atomicWrite(getMissionCanvasPath(directory), JSON.stringify({ nodes, edges }, null, 2));
|
|
36685
|
+
}
|
|
36686
|
+
function buildCanvasNodes(state2, events) {
|
|
36687
|
+
const nodes = [
|
|
36688
|
+
textNode("objective", `Objective
|
|
36689
|
+
${state2.objective ?? state2.prompt}`, 0, 0),
|
|
36690
|
+
textNode("runtime", `Runtime
|
|
36691
|
+
Iteration ${state2.iteration}/${state2.maxIterations}
|
|
36692
|
+
Progress ${state2.lastProgress ?? "unknown"}`, 420, 0),
|
|
36693
|
+
textNode("verification", `Verification
|
|
36694
|
+
${state2.lastVerificationSummary ?? "unknown"}`, 840, 0)
|
|
36695
|
+
];
|
|
36696
|
+
events.slice(-MAX_CANVAS_EVENTS).forEach((event, index) => {
|
|
36697
|
+
nodes.push(textNode(`event-${index}`, `${event.type}
|
|
36698
|
+
${event.summary ?? event.reason ?? event.timestamp}`, 420 * index, 260));
|
|
36699
|
+
});
|
|
36700
|
+
return nodes;
|
|
36701
|
+
}
|
|
36702
|
+
function buildCanvasEdges(nodes) {
|
|
36703
|
+
const edges = [
|
|
36704
|
+
{ id: "objective-runtime", fromNode: "objective", toNode: "runtime", label: "drives" },
|
|
36705
|
+
{ id: "runtime-verification", fromNode: "runtime", toNode: "verification", label: "checks" }
|
|
36706
|
+
];
|
|
36707
|
+
for (const node of nodes.filter((item) => item.id.startsWith("event-"))) {
|
|
36708
|
+
edges.push({ id: `verification-${node.id}`, fromNode: "verification", toNode: node.id, label: "evidence" });
|
|
36709
|
+
}
|
|
36710
|
+
return edges;
|
|
36711
|
+
}
|
|
36712
|
+
function textNode(id, text, x, y) {
|
|
36713
|
+
return { id, type: "text", text, x, y, width: 360, height: 180 };
|
|
36714
|
+
}
|
|
36715
|
+
function formatEventLines(events) {
|
|
36716
|
+
if (events.length === 0) return ["- No runtime evidence recorded yet."];
|
|
36717
|
+
return events.map((event) => `- ${event.timestamp} ${event.type}: ${event.summary ?? event.reason ?? "recorded"}`);
|
|
36718
|
+
}
|
|
36719
|
+
function atomicWrite(path11, content) {
|
|
36720
|
+
mkdirSync3(dirname2(path11), { recursive: true });
|
|
36721
|
+
const tempPath = `${path11}.tmp`;
|
|
36722
|
+
writeFileSync(tempPath, content, "utf8");
|
|
36723
|
+
renameSync(tempPath, path11);
|
|
36724
|
+
}
|
|
36725
|
+
function escapeYaml(value) {
|
|
36726
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
36727
|
+
}
|
|
36728
|
+
|
|
36525
36729
|
// src/core/loop/mission-loop.ts
|
|
36526
36730
|
var STATE_FILE = MISSION_CONTROL.STATE_FILE;
|
|
36527
36731
|
var DEFAULT_MAX_ITERATIONS = MISSION_CONTROL.DEFAULT_MAX_ITERATIONS;
|
|
36732
|
+
var UNKNOWN_STATUS = "unknown";
|
|
36528
36733
|
function getStateFilePath(directory) {
|
|
36529
|
-
return
|
|
36734
|
+
return join6(directory, PATHS.OPENCODE, STATE_FILE);
|
|
36530
36735
|
}
|
|
36531
36736
|
function readLoopState(directory) {
|
|
36532
36737
|
const filePath = getStateFilePath(directory);
|
|
36533
|
-
if (!
|
|
36738
|
+
if (!existsSync3(filePath)) {
|
|
36534
36739
|
return null;
|
|
36535
36740
|
}
|
|
36536
36741
|
try {
|
|
36537
|
-
const content =
|
|
36742
|
+
const content = readFileSync2(filePath, "utf-8");
|
|
36538
36743
|
return JSON.parse(content);
|
|
36539
36744
|
} catch (error95) {
|
|
36540
36745
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Failed to read state: ${error95}`);
|
|
@@ -36543,12 +36748,12 @@ function readLoopState(directory) {
|
|
|
36543
36748
|
}
|
|
36544
36749
|
function writeLoopState(directory, state2) {
|
|
36545
36750
|
const filePath = getStateFilePath(directory);
|
|
36546
|
-
const dirPath =
|
|
36751
|
+
const dirPath = join6(directory, PATHS.OPENCODE);
|
|
36547
36752
|
try {
|
|
36548
|
-
if (!
|
|
36549
|
-
|
|
36753
|
+
if (!existsSync3(dirPath)) {
|
|
36754
|
+
mkdirSync4(dirPath, { recursive: true });
|
|
36550
36755
|
}
|
|
36551
|
-
|
|
36756
|
+
writeFileSync2(filePath, JSON.stringify(state2, null, 2), "utf-8");
|
|
36552
36757
|
return true;
|
|
36553
36758
|
} catch (error95) {
|
|
36554
36759
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Failed to write state: ${error95}`);
|
|
@@ -36557,7 +36762,7 @@ function writeLoopState(directory, state2) {
|
|
|
36557
36762
|
}
|
|
36558
36763
|
function clearLoopState(directory) {
|
|
36559
36764
|
const filePath = getStateFilePath(directory);
|
|
36560
|
-
if (!
|
|
36765
|
+
if (!existsSync3(filePath)) {
|
|
36561
36766
|
return false;
|
|
36562
36767
|
}
|
|
36563
36768
|
try {
|
|
@@ -36578,17 +36783,30 @@ function incrementIteration(directory) {
|
|
|
36578
36783
|
}
|
|
36579
36784
|
return null;
|
|
36580
36785
|
}
|
|
36786
|
+
function deriveObjective(prompt) {
|
|
36787
|
+
const firstLine = prompt.split(/\r?\n/).find((line) => line.trim().length > 0);
|
|
36788
|
+
return firstLine?.trim() || prompt.trim() || "Continue the active mission";
|
|
36789
|
+
}
|
|
36581
36790
|
function startMissionLoop(directory, sessionID, prompt, options = {}) {
|
|
36582
36791
|
const state2 = {
|
|
36583
36792
|
active: true,
|
|
36584
36793
|
iteration: 1,
|
|
36585
36794
|
maxIterations: options.maxIterations ?? DEFAULT_MAX_ITERATIONS,
|
|
36586
36795
|
prompt,
|
|
36796
|
+
objective: deriveObjective(prompt),
|
|
36587
36797
|
sessionID,
|
|
36588
36798
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
36589
36799
|
};
|
|
36590
36800
|
const success3 = writeLoopState(directory, state2);
|
|
36591
36801
|
if (success3) {
|
|
36802
|
+
appendMissionLedgerEvent(directory, {
|
|
36803
|
+
type: "mission_started",
|
|
36804
|
+
sessionID,
|
|
36805
|
+
iteration: state2.iteration,
|
|
36806
|
+
objective: state2.objective,
|
|
36807
|
+
summary: "Mission loop started"
|
|
36808
|
+
});
|
|
36809
|
+
syncMissionMemory(directory, state2);
|
|
36592
36810
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Loop started`, {
|
|
36593
36811
|
sessionID,
|
|
36594
36812
|
maxIterations: state2.maxIterations
|
|
@@ -36603,6 +36821,19 @@ function cancelMissionLoop(directory, sessionID) {
|
|
|
36603
36821
|
}
|
|
36604
36822
|
const success3 = clearLoopState(directory);
|
|
36605
36823
|
if (success3) {
|
|
36824
|
+
const cancelledState = {
|
|
36825
|
+
...state2,
|
|
36826
|
+
active: false,
|
|
36827
|
+
lastContinuationReason: "cancelled"
|
|
36828
|
+
};
|
|
36829
|
+
appendMissionLedgerEvent(directory, {
|
|
36830
|
+
type: "mission_cancelled",
|
|
36831
|
+
sessionID,
|
|
36832
|
+
iteration: state2.iteration,
|
|
36833
|
+
objective: state2.objective,
|
|
36834
|
+
reason: "cancelled"
|
|
36835
|
+
});
|
|
36836
|
+
syncMissionMemory(directory, cancelledState);
|
|
36606
36837
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Loop cancelled`, { sessionID, iteration: state2.iteration });
|
|
36607
36838
|
}
|
|
36608
36839
|
return success3;
|
|
@@ -36611,26 +36842,48 @@ function isLoopActive(directory, sessionID) {
|
|
|
36611
36842
|
const state2 = readLoopState(directory);
|
|
36612
36843
|
return state2?.active === true && state2?.sessionID === sessionID;
|
|
36613
36844
|
}
|
|
36614
|
-
function generateMissionContinuationPrompt(state2,
|
|
36615
|
-
const
|
|
36616
|
-
[Verification Status]: ${verificationSummary}
|
|
36617
|
-
` : "";
|
|
36845
|
+
function generateMissionContinuationPrompt(state2, input) {
|
|
36846
|
+
const context = normalizeContinuationContext(state2, input);
|
|
36618
36847
|
let prompt = `${CONTINUE_INSTRUCTION}
|
|
36619
36848
|
|
|
36620
36849
|
<mission_loop iteration="${state2.iteration}" max="${state2.maxIterations}">
|
|
36621
|
-
|
|
36622
|
-
|
|
36850
|
+
MISSION NOT COMPLETE
|
|
36851
|
+
|
|
36852
|
+
Objective:
|
|
36853
|
+
${context.objective}
|
|
36623
36854
|
|
|
36624
|
-
|
|
36625
|
-
${
|
|
36855
|
+
Runtime status:
|
|
36856
|
+
- todo progress: ${context.progress}
|
|
36857
|
+
- verification: ${context.verification}
|
|
36858
|
+
- stagnation: ${context.stagnation}
|
|
36859
|
+
- continuation reason: ${context.reason}
|
|
36626
36860
|
|
|
36627
|
-
|
|
36861
|
+
Next action:
|
|
36862
|
+
1. Read the current TODO, checklist, and sync issue state.
|
|
36863
|
+
2. Execute or delegate only the next unblocked work.
|
|
36864
|
+
3. Verify the result with real file reads, build commands, tests, or tool output.
|
|
36865
|
+
4. Finish only when mission verification passes.
|
|
36866
|
+
|
|
36867
|
+
Completion rule:
|
|
36868
|
+
Do not declare success while TODO/checklist/sync verification is still failing.
|
|
36628
36869
|
</mission_loop>`;
|
|
36629
36870
|
if (state2.iteration > 1) {
|
|
36630
36871
|
prompt += "\n" + CLEANUP_INSTRUCTION.replace("%ITER%", state2.iteration.toString());
|
|
36631
36872
|
}
|
|
36632
36873
|
return prompt;
|
|
36633
36874
|
}
|
|
36875
|
+
function normalizeContinuationContext(state2, input) {
|
|
36876
|
+
const verificationSummary = typeof input === "string" ? input : input?.verificationSummary;
|
|
36877
|
+
const continuationReason = typeof input === "string" ? void 0 : input?.continuationReason;
|
|
36878
|
+
const stagnationCount = state2.stagnationCount ?? 0;
|
|
36879
|
+
return {
|
|
36880
|
+
objective: state2.objective || deriveObjective(state2.prompt),
|
|
36881
|
+
progress: state2.lastProgress ?? UNKNOWN_STATUS,
|
|
36882
|
+
verification: verificationSummary ?? state2.lastVerificationSummary ?? UNKNOWN_STATUS,
|
|
36883
|
+
reason: continuationReason ?? state2.lastContinuationReason ?? "verification_failed",
|
|
36884
|
+
stagnation: stagnationCount > 0 ? `${stagnationCount} unchanged check(s)` : "not detected"
|
|
36885
|
+
};
|
|
36886
|
+
}
|
|
36634
36887
|
|
|
36635
36888
|
// src/core/orchestrator/session-manager.ts
|
|
36636
36889
|
function ensureSessionInitialized(sessions, sessionID, directory) {
|
|
@@ -36954,8 +37207,8 @@ ${commandList}`;
|
|
|
36954
37207
|
// src/core/loop/verification.ts
|
|
36955
37208
|
init_shared();
|
|
36956
37209
|
init_logger();
|
|
36957
|
-
import { existsSync as
|
|
36958
|
-
import { join as
|
|
37210
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
37211
|
+
import { join as join7 } from "node:path";
|
|
36959
37212
|
var CHECKLIST_FILE = CHECKLIST.FILE;
|
|
36960
37213
|
function parseChecklistLine(line, currentCategory) {
|
|
36961
37214
|
const trimmedLine = line.trim();
|
|
@@ -37020,12 +37273,12 @@ function parseChecklist(content) {
|
|
|
37020
37273
|
return items;
|
|
37021
37274
|
}
|
|
37022
37275
|
function readChecklist(directory) {
|
|
37023
|
-
const filePath =
|
|
37024
|
-
if (!
|
|
37276
|
+
const filePath = join7(directory, CHECKLIST_FILE);
|
|
37277
|
+
if (!existsSync4(filePath)) {
|
|
37025
37278
|
return [];
|
|
37026
37279
|
}
|
|
37027
37280
|
try {
|
|
37028
|
-
const content =
|
|
37281
|
+
const content = readFileSync3(filePath, "utf-8");
|
|
37029
37282
|
return parseChecklist(content);
|
|
37030
37283
|
} catch (error95) {
|
|
37031
37284
|
log(`[checklist] Failed to read checklist: ${error95}`);
|
|
@@ -37042,8 +37295,8 @@ function verifyChecklist(directory) {
|
|
|
37042
37295
|
incompleteList: [],
|
|
37043
37296
|
errors: []
|
|
37044
37297
|
};
|
|
37045
|
-
const filePath =
|
|
37046
|
-
if (!
|
|
37298
|
+
const filePath = join7(directory, CHECKLIST_FILE);
|
|
37299
|
+
if (!existsSync4(filePath)) {
|
|
37047
37300
|
result.errors.push(`Verification checklist not found at ${CHECKLIST_FILE}`);
|
|
37048
37301
|
result.errors.push("Create checklist with at least: build, tests, and any environment-specific checks");
|
|
37049
37302
|
return result;
|
|
@@ -37119,10 +37372,10 @@ function verifyMissionCompletion(directory) {
|
|
|
37119
37372
|
result.errors.push(` ... and ${checklistResult.incompleteList.length - 5} more`);
|
|
37120
37373
|
}
|
|
37121
37374
|
}
|
|
37122
|
-
const todoPath =
|
|
37123
|
-
if (
|
|
37375
|
+
const todoPath = join7(directory, PATHS.TODO);
|
|
37376
|
+
if (existsSync4(todoPath)) {
|
|
37124
37377
|
try {
|
|
37125
|
-
const content =
|
|
37378
|
+
const content = readFileSync3(todoPath, "utf-8");
|
|
37126
37379
|
const incompleteCount = countMatches(content, TODO_INCOMPLETE_PATTERN);
|
|
37127
37380
|
const completeCount = countMatches(content, TODO_COMPLETE_PATTERN);
|
|
37128
37381
|
const total = incompleteCount + completeCount;
|
|
@@ -37144,10 +37397,10 @@ function verifyMissionCompletion(directory) {
|
|
|
37144
37397
|
} else if (!hasChecklist) {
|
|
37145
37398
|
result.errors.push(`TODO file not found at ${PATHS.TODO}`);
|
|
37146
37399
|
}
|
|
37147
|
-
const syncPath =
|
|
37148
|
-
if (
|
|
37400
|
+
const syncPath = join7(directory, PATHS.SYNC_ISSUES);
|
|
37401
|
+
if (existsSync4(syncPath)) {
|
|
37149
37402
|
try {
|
|
37150
|
-
const content =
|
|
37403
|
+
const content = readFileSync3(syncPath, "utf-8");
|
|
37151
37404
|
result.syncIssuesEmpty = !hasRealSyncIssues(content);
|
|
37152
37405
|
if (!result.syncIssuesEmpty) {
|
|
37153
37406
|
const issueLines = content.split("\n").filter(
|
|
@@ -37235,7 +37488,7 @@ function buildVerificationSummary(result) {
|
|
|
37235
37488
|
init_logger();
|
|
37236
37489
|
import { exec as exec2 } from "node:child_process";
|
|
37237
37490
|
import { promisify as promisify2 } from "node:util";
|
|
37238
|
-
import { readFileSync as
|
|
37491
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
37239
37492
|
|
|
37240
37493
|
// src/shared/notification/os-notify/constants/notification-commands.ts
|
|
37241
37494
|
var NOTIFICATION_COMMANDS = {
|
|
@@ -37313,7 +37566,7 @@ async function notifyDarwin(title, message) {
|
|
|
37313
37566
|
function isWSL() {
|
|
37314
37567
|
try {
|
|
37315
37568
|
if (process.env.WSL_DISTRO_NAME || process.env.WSLENV) return true;
|
|
37316
|
-
const procVersion =
|
|
37569
|
+
const procVersion = readFileSync4("/proc/version", "utf-8");
|
|
37317
37570
|
return /microsoft|WSL/i.test(procVersion);
|
|
37318
37571
|
} catch {
|
|
37319
37572
|
return false;
|
|
@@ -38789,9 +39042,9 @@ import * as path6 from "node:path";
|
|
|
38789
39042
|
|
|
38790
39043
|
// src/core/cache/utils.ts
|
|
38791
39044
|
import * as fs6 from "node:fs/promises";
|
|
38792
|
-
import { existsSync as
|
|
39045
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
38793
39046
|
async function ensureCacheDir() {
|
|
38794
|
-
if (!
|
|
39047
|
+
if (!existsSync6(CACHE_DIR)) {
|
|
38795
39048
|
await fs6.mkdir(CACHE_DIR, { recursive: true });
|
|
38796
39049
|
}
|
|
38797
39050
|
}
|
|
@@ -39293,15 +39546,15 @@ var backgroundTaskManager = BackgroundTaskManager.instance;
|
|
|
39293
39546
|
|
|
39294
39547
|
// src/tools/rust-pool.ts
|
|
39295
39548
|
import { spawn as spawn2 } from "child_process";
|
|
39296
|
-
import { existsSync as
|
|
39549
|
+
import { existsSync as existsSync9 } from "fs";
|
|
39297
39550
|
|
|
39298
39551
|
// src/utils/binary.ts
|
|
39299
39552
|
init_shared();
|
|
39300
|
-
import { join as
|
|
39553
|
+
import { join as join12, dirname as dirname5 } from "path";
|
|
39301
39554
|
import { fileURLToPath } from "url";
|
|
39302
39555
|
import { platform, arch } from "os";
|
|
39303
|
-
import { existsSync as
|
|
39304
|
-
var __dirname =
|
|
39556
|
+
import { existsSync as existsSync8 } from "fs";
|
|
39557
|
+
var __dirname = dirname5(fileURLToPath(import.meta.url));
|
|
39305
39558
|
function getPlatformBinaryName(os = platform(), cpu = arch()) {
|
|
39306
39559
|
if (os === PLATFORM.WIN32) {
|
|
39307
39560
|
return "orchestrator-windows-x64.exe";
|
|
@@ -39313,30 +39566,30 @@ function getPlatformBinaryName(os = platform(), cpu = arch()) {
|
|
|
39313
39566
|
}
|
|
39314
39567
|
function getCandidateBinDirs(moduleDir = __dirname) {
|
|
39315
39568
|
return [
|
|
39316
|
-
|
|
39317
|
-
|
|
39569
|
+
join12(moduleDir, "..", "bin"),
|
|
39570
|
+
join12(moduleDir, "..", "..", "bin")
|
|
39318
39571
|
];
|
|
39319
39572
|
}
|
|
39320
39573
|
function resolveBinaryPath(options = {}) {
|
|
39321
39574
|
const moduleDir = options.moduleDir ?? __dirname;
|
|
39322
39575
|
const os = options.os ?? platform();
|
|
39323
39576
|
const cpu = options.cpu ?? arch();
|
|
39324
|
-
const exists = options.exists ??
|
|
39577
|
+
const exists = options.exists ?? existsSync8;
|
|
39325
39578
|
const binaryName = getPlatformBinaryName(os, cpu);
|
|
39326
39579
|
for (const binDir of getCandidateBinDirs(moduleDir)) {
|
|
39327
|
-
const binaryPath =
|
|
39580
|
+
const binaryPath = join12(binDir, binaryName);
|
|
39328
39581
|
if (exists(binaryPath)) {
|
|
39329
39582
|
return binaryPath;
|
|
39330
39583
|
}
|
|
39331
39584
|
}
|
|
39332
39585
|
const fallbackName = os === PLATFORM.WIN32 ? "orchestrator.exe" : "orchestrator";
|
|
39333
39586
|
for (const binDir of getCandidateBinDirs(moduleDir)) {
|
|
39334
|
-
const fallbackPath =
|
|
39587
|
+
const fallbackPath = join12(binDir, fallbackName);
|
|
39335
39588
|
if (exists(fallbackPath)) {
|
|
39336
39589
|
return fallbackPath;
|
|
39337
39590
|
}
|
|
39338
39591
|
}
|
|
39339
|
-
return
|
|
39592
|
+
return join12(getCandidateBinDirs(moduleDir)[0], binaryName);
|
|
39340
39593
|
}
|
|
39341
39594
|
function getBinaryPath() {
|
|
39342
39595
|
return resolveBinaryPath();
|
|
@@ -39350,10 +39603,21 @@ var RustToolPool = class {
|
|
|
39350
39603
|
maxSize = 4;
|
|
39351
39604
|
idleTimeout = 3e4;
|
|
39352
39605
|
// 30 seconds
|
|
39606
|
+
processReadyDelay = 100;
|
|
39607
|
+
requestTimeout = 6e4;
|
|
39353
39608
|
cleanupInterval = null;
|
|
39609
|
+
binaryPath;
|
|
39610
|
+
exists;
|
|
39611
|
+
spawnProcess;
|
|
39354
39612
|
shuttingDown = false;
|
|
39355
|
-
constructor(maxSize = 4) {
|
|
39613
|
+
constructor(maxSize = 4, options = {}) {
|
|
39356
39614
|
this.maxSize = maxSize;
|
|
39615
|
+
this.binaryPath = options.binaryPath ?? getBinaryPath;
|
|
39616
|
+
this.exists = options.exists ?? existsSync9;
|
|
39617
|
+
this.idleTimeout = options.idleTimeoutMs ?? this.idleTimeout;
|
|
39618
|
+
this.processReadyDelay = options.processReadyDelayMs ?? this.processReadyDelay;
|
|
39619
|
+
this.requestTimeout = options.requestTimeoutMs ?? this.requestTimeout;
|
|
39620
|
+
this.spawnProcess = options.spawnProcess ?? spawn2;
|
|
39357
39621
|
this.startCleanupTimer();
|
|
39358
39622
|
}
|
|
39359
39623
|
/**
|
|
@@ -39363,16 +39627,13 @@ var RustToolPool = class {
|
|
|
39363
39627
|
if (this.shuttingDown) {
|
|
39364
39628
|
throw new Error("Pool is shutting down");
|
|
39365
39629
|
}
|
|
39366
|
-
const binary =
|
|
39367
|
-
if (!
|
|
39630
|
+
const binary = this.binaryPath();
|
|
39631
|
+
if (!this.exists(binary)) {
|
|
39368
39632
|
return JSON.stringify({ error: `Binary not found: ${binary}` });
|
|
39369
39633
|
}
|
|
39370
39634
|
let pooled = this.getAvailable();
|
|
39371
|
-
if (!pooled && this.processes.length < this.maxSize) {
|
|
39372
|
-
pooled = await this.createProcess(binary);
|
|
39373
|
-
}
|
|
39374
39635
|
if (!pooled) {
|
|
39375
|
-
pooled = await this.
|
|
39636
|
+
pooled = await this.createOrWaitForProcess(binary);
|
|
39376
39637
|
}
|
|
39377
39638
|
try {
|
|
39378
39639
|
return await this.sendRequest(pooled, name, args);
|
|
@@ -39387,15 +39648,29 @@ var RustToolPool = class {
|
|
|
39387
39648
|
return this.processes.find((p) => !p.busy) || null;
|
|
39388
39649
|
}
|
|
39389
39650
|
/**
|
|
39390
|
-
*
|
|
39651
|
+
* Create a process immediately, or wait until one is available/capacity opens.
|
|
39652
|
+
*/
|
|
39653
|
+
async createOrWaitForProcess(binary) {
|
|
39654
|
+
if (this.processes.length < this.maxSize) {
|
|
39655
|
+
return this.createProcess(binary);
|
|
39656
|
+
}
|
|
39657
|
+
return this.waitForAvailable(binary);
|
|
39658
|
+
}
|
|
39659
|
+
/**
|
|
39660
|
+
* Wait for a process to become available, or create one if capacity opens.
|
|
39391
39661
|
*/
|
|
39392
|
-
async waitForAvailable() {
|
|
39393
|
-
return new Promise((resolve) => {
|
|
39662
|
+
async waitForAvailable(binary) {
|
|
39663
|
+
return new Promise((resolve, reject) => {
|
|
39394
39664
|
const interval = setInterval(() => {
|
|
39395
39665
|
const available = this.getAvailable();
|
|
39396
39666
|
if (available) {
|
|
39397
39667
|
clearInterval(interval);
|
|
39398
39668
|
resolve(available);
|
|
39669
|
+
return;
|
|
39670
|
+
}
|
|
39671
|
+
if (this.processes.length < this.maxSize) {
|
|
39672
|
+
clearInterval(interval);
|
|
39673
|
+
this.createProcess(binary).then(resolve, reject);
|
|
39399
39674
|
}
|
|
39400
39675
|
}, 10);
|
|
39401
39676
|
});
|
|
@@ -39405,41 +39680,47 @@ var RustToolPool = class {
|
|
|
39405
39680
|
*/
|
|
39406
39681
|
async createProcess(binary) {
|
|
39407
39682
|
return new Promise((resolve, reject) => {
|
|
39408
|
-
const proc =
|
|
39683
|
+
const proc = this.spawnProcess(binary, ["serve"], {
|
|
39409
39684
|
stdio: ["pipe", "pipe", "pipe"],
|
|
39410
39685
|
detached: false
|
|
39411
39686
|
});
|
|
39412
|
-
let
|
|
39687
|
+
let startupSettled = false;
|
|
39688
|
+
let readyTimer = null;
|
|
39413
39689
|
const pooled = {
|
|
39414
39690
|
proc,
|
|
39415
|
-
busy:
|
|
39691
|
+
busy: true,
|
|
39692
|
+
destroyed: false,
|
|
39416
39693
|
lastUsed: Date.now(),
|
|
39417
39694
|
requestId: 0,
|
|
39418
39695
|
stdout: ""
|
|
39419
39696
|
};
|
|
39420
|
-
|
|
39421
|
-
|
|
39422
|
-
|
|
39423
|
-
started = true;
|
|
39697
|
+
const settleStartup = (callback) => {
|
|
39698
|
+
if (startupSettled) {
|
|
39699
|
+
return;
|
|
39424
39700
|
}
|
|
39425
|
-
|
|
39426
|
-
|
|
39427
|
-
|
|
39428
|
-
|
|
39429
|
-
this.processes.splice(index, 1);
|
|
39701
|
+
startupSettled = true;
|
|
39702
|
+
if (readyTimer) {
|
|
39703
|
+
clearTimeout(readyTimer);
|
|
39704
|
+
readyTimer = null;
|
|
39430
39705
|
}
|
|
39706
|
+
callback();
|
|
39707
|
+
};
|
|
39708
|
+
proc.on("close", () => {
|
|
39709
|
+
const error95 = new Error("Rust tool process closed before completing request");
|
|
39710
|
+
settleStartup(() => reject(error95));
|
|
39711
|
+
pooled.pendingReject?.(error95);
|
|
39712
|
+
this.removeProcess(pooled, false);
|
|
39431
39713
|
});
|
|
39432
39714
|
proc.on("error", (err) => {
|
|
39433
|
-
const
|
|
39434
|
-
|
|
39435
|
-
|
|
39436
|
-
|
|
39437
|
-
if (!started) {
|
|
39438
|
-
reject(err);
|
|
39439
|
-
}
|
|
39715
|
+
const error95 = err instanceof Error ? err : new Error(String(err));
|
|
39716
|
+
settleStartup(() => reject(error95));
|
|
39717
|
+
pooled.pendingReject?.(error95);
|
|
39718
|
+
this.removeProcess(pooled, false);
|
|
39440
39719
|
});
|
|
39441
39720
|
this.processes.push(pooled);
|
|
39442
|
-
setTimeout(() =>
|
|
39721
|
+
readyTimer = setTimeout(() => {
|
|
39722
|
+
settleStartup(() => resolve(pooled));
|
|
39723
|
+
}, this.processReadyDelay);
|
|
39443
39724
|
});
|
|
39444
39725
|
}
|
|
39445
39726
|
/**
|
|
@@ -39449,13 +39730,39 @@ var RustToolPool = class {
|
|
|
39449
39730
|
pooled.busy = true;
|
|
39450
39731
|
pooled.lastUsed = Date.now();
|
|
39451
39732
|
pooled.stdout = "";
|
|
39733
|
+
if (pooled.destroyed || !this.processes.includes(pooled)) {
|
|
39734
|
+
throw new Error("Rust tool process is unavailable");
|
|
39735
|
+
}
|
|
39452
39736
|
return new Promise((resolve, reject) => {
|
|
39453
39737
|
const requestId = ++pooled.requestId;
|
|
39738
|
+
let settled = false;
|
|
39739
|
+
const fail = (error95, kill) => {
|
|
39740
|
+
if (settled) {
|
|
39741
|
+
return;
|
|
39742
|
+
}
|
|
39743
|
+
settled = true;
|
|
39744
|
+
cleanup();
|
|
39745
|
+
this.removeProcess(pooled, kill);
|
|
39746
|
+
reject(error95);
|
|
39747
|
+
};
|
|
39748
|
+
const succeed = (text) => {
|
|
39749
|
+
if (settled) {
|
|
39750
|
+
return;
|
|
39751
|
+
}
|
|
39752
|
+
settled = true;
|
|
39753
|
+
cleanup();
|
|
39754
|
+
resolve(text);
|
|
39755
|
+
};
|
|
39454
39756
|
const timeout = setTimeout(() => {
|
|
39757
|
+
fail(new Error("Request timeout"), true);
|
|
39758
|
+
}, this.requestTimeout);
|
|
39759
|
+
const cleanup = () => {
|
|
39760
|
+
clearTimeout(timeout);
|
|
39455
39761
|
pooled.pendingResolve = void 0;
|
|
39456
39762
|
pooled.pendingReject = void 0;
|
|
39457
|
-
|
|
39458
|
-
|
|
39763
|
+
pooled.pendingCleanup = void 0;
|
|
39764
|
+
pooled.proc.stdout?.removeListener("data", onData);
|
|
39765
|
+
};
|
|
39459
39766
|
const onData = (data) => {
|
|
39460
39767
|
pooled.stdout += data.toString();
|
|
39461
39768
|
const lines = pooled.stdout.trim().split("\n");
|
|
@@ -39463,10 +39770,8 @@ var RustToolPool = class {
|
|
|
39463
39770
|
try {
|
|
39464
39771
|
const response = JSON.parse(lines[i]);
|
|
39465
39772
|
if (response.id === requestId && (response.result || response.error)) {
|
|
39466
|
-
clearTimeout(timeout);
|
|
39467
|
-
pooled.proc.stdout?.removeListener("data", onData);
|
|
39468
39773
|
const text = response?.result?.content?.[0]?.text;
|
|
39469
|
-
|
|
39774
|
+
succeed(text || JSON.stringify(response.result));
|
|
39470
39775
|
return;
|
|
39471
39776
|
}
|
|
39472
39777
|
} catch {
|
|
@@ -39474,6 +39779,8 @@ var RustToolPool = class {
|
|
|
39474
39779
|
}
|
|
39475
39780
|
}
|
|
39476
39781
|
};
|
|
39782
|
+
pooled.pendingReject = (error95) => fail(error95, false);
|
|
39783
|
+
pooled.pendingCleanup = cleanup;
|
|
39477
39784
|
pooled.proc.stdout?.on("data", onData);
|
|
39478
39785
|
const request = JSON.stringify({
|
|
39479
39786
|
jsonrpc: "2.0",
|
|
@@ -39482,11 +39789,13 @@ var RustToolPool = class {
|
|
|
39482
39789
|
params: { name, arguments: args }
|
|
39483
39790
|
});
|
|
39484
39791
|
try {
|
|
39485
|
-
pooled.proc.stdin?.write(request + "\n");
|
|
39792
|
+
const written = pooled.proc.stdin?.write(request + "\n");
|
|
39793
|
+
if (written === false || written === void 0) {
|
|
39794
|
+
fail(new Error("Failed to write request to Rust tool process"), true);
|
|
39795
|
+
}
|
|
39486
39796
|
} catch (err) {
|
|
39487
|
-
|
|
39488
|
-
|
|
39489
|
-
reject(err);
|
|
39797
|
+
const error95 = err instanceof Error ? err : new Error(String(err));
|
|
39798
|
+
fail(error95, true);
|
|
39490
39799
|
}
|
|
39491
39800
|
});
|
|
39492
39801
|
}
|
|
@@ -39494,9 +39803,29 @@ var RustToolPool = class {
|
|
|
39494
39803
|
* Release a process back to the pool
|
|
39495
39804
|
*/
|
|
39496
39805
|
release(pooled) {
|
|
39806
|
+
if (pooled.destroyed || !this.processes.includes(pooled)) {
|
|
39807
|
+
return;
|
|
39808
|
+
}
|
|
39497
39809
|
pooled.busy = false;
|
|
39498
39810
|
pooled.lastUsed = Date.now();
|
|
39499
39811
|
}
|
|
39812
|
+
/**
|
|
39813
|
+
* Remove a process from the pool, optionally terminating it first.
|
|
39814
|
+
*/
|
|
39815
|
+
removeProcess(pooled, kill) {
|
|
39816
|
+
pooled.destroyed = true;
|
|
39817
|
+
pooled.pendingCleanup?.();
|
|
39818
|
+
if (kill) {
|
|
39819
|
+
try {
|
|
39820
|
+
pooled.proc.kill();
|
|
39821
|
+
} catch {
|
|
39822
|
+
}
|
|
39823
|
+
}
|
|
39824
|
+
const index = this.processes.indexOf(pooled);
|
|
39825
|
+
if (index !== -1) {
|
|
39826
|
+
this.processes.splice(index, 1);
|
|
39827
|
+
}
|
|
39828
|
+
}
|
|
39500
39829
|
/**
|
|
39501
39830
|
* Start cleanup timer for idle processes
|
|
39502
39831
|
*/
|
|
@@ -39510,14 +39839,7 @@ var RustToolPool = class {
|
|
|
39510
39839
|
}
|
|
39511
39840
|
}
|
|
39512
39841
|
for (const pooled of toRemove) {
|
|
39513
|
-
|
|
39514
|
-
pooled.proc.kill();
|
|
39515
|
-
} catch {
|
|
39516
|
-
}
|
|
39517
|
-
const index = this.processes.indexOf(pooled);
|
|
39518
|
-
if (index !== -1) {
|
|
39519
|
-
this.processes.splice(index, 1);
|
|
39520
|
-
}
|
|
39842
|
+
this.removeProcess(pooled, true);
|
|
39521
39843
|
}
|
|
39522
39844
|
if (toRemove.length > 0) {
|
|
39523
39845
|
log(`[${LOG_PREFIX.RUST_POOL}] Cleaned up ${toRemove.length} idle processes`);
|
|
@@ -39534,11 +39856,8 @@ var RustToolPool = class {
|
|
|
39534
39856
|
clearInterval(this.cleanupInterval);
|
|
39535
39857
|
this.cleanupInterval = null;
|
|
39536
39858
|
}
|
|
39537
|
-
for (const pooled of this.processes) {
|
|
39538
|
-
|
|
39539
|
-
pooled.proc.kill();
|
|
39540
|
-
} catch {
|
|
39541
|
-
}
|
|
39859
|
+
for (const pooled of [...this.processes]) {
|
|
39860
|
+
this.removeProcess(pooled, true);
|
|
39542
39861
|
}
|
|
39543
39862
|
this.processes = [];
|
|
39544
39863
|
log(`[${LOG_PREFIX.RUST_POOL}] Shutdown complete`);
|
|
@@ -39556,18 +39875,39 @@ var RustToolPool = class {
|
|
|
39556
39875
|
}
|
|
39557
39876
|
};
|
|
39558
39877
|
var globalPool = null;
|
|
39878
|
+
var resetInFlight = null;
|
|
39559
39879
|
function getRustToolPool() {
|
|
39560
39880
|
if (!globalPool) {
|
|
39561
39881
|
globalPool = new RustToolPool();
|
|
39562
39882
|
}
|
|
39563
39883
|
return globalPool;
|
|
39564
39884
|
}
|
|
39565
|
-
async function
|
|
39566
|
-
|
|
39567
|
-
await
|
|
39885
|
+
async function resetRustToolPool(reason = "manual reset", expectedPool) {
|
|
39886
|
+
while (resetInFlight) {
|
|
39887
|
+
await resetInFlight;
|
|
39888
|
+
}
|
|
39889
|
+
const poolToReset = globalPool;
|
|
39890
|
+
if (!poolToReset) {
|
|
39891
|
+
return;
|
|
39892
|
+
}
|
|
39893
|
+
if (expectedPool && poolToReset !== expectedPool) {
|
|
39894
|
+
log(`[${LOG_PREFIX.RUST_POOL}] Skipped reset for stale pool: ${reason}`);
|
|
39895
|
+
return;
|
|
39896
|
+
}
|
|
39897
|
+
resetInFlight = (async () => {
|
|
39568
39898
|
globalPool = null;
|
|
39899
|
+
log(`[${LOG_PREFIX.RUST_POOL}] Resetting global pool: ${reason}`);
|
|
39900
|
+
await poolToReset.shutdown();
|
|
39901
|
+
})();
|
|
39902
|
+
try {
|
|
39903
|
+
await resetInFlight;
|
|
39904
|
+
} finally {
|
|
39905
|
+
resetInFlight = null;
|
|
39569
39906
|
}
|
|
39570
39907
|
}
|
|
39908
|
+
async function shutdownRustToolPool() {
|
|
39909
|
+
await resetRustToolPool("shutdown");
|
|
39910
|
+
}
|
|
39571
39911
|
|
|
39572
39912
|
// src/tools/callAgent.ts
|
|
39573
39913
|
init_shared();
|
|
@@ -39636,13 +39976,15 @@ ${PROMPT_TAGS.EXECUTION.close}
|
|
|
39636
39976
|
init_logger();
|
|
39637
39977
|
init_shared();
|
|
39638
39978
|
async function callRustTool(name, args) {
|
|
39979
|
+
const pool = getRustToolPool();
|
|
39639
39980
|
try {
|
|
39640
|
-
const pool = getRustToolPool();
|
|
39641
39981
|
return await pool.call(name, args);
|
|
39642
39982
|
} catch (err) {
|
|
39643
|
-
log(`[${LOG_PREFIX.RUST_TOOL}] Pool error: ${err}`);
|
|
39644
|
-
|
|
39983
|
+
log(`[${LOG_PREFIX.RUST_TOOL}] Pool error, resetting and retrying once: ${err}`);
|
|
39984
|
+
await resetRustToolPool(`transport error while calling ${name}`, pool);
|
|
39645
39985
|
}
|
|
39986
|
+
const retryPool = getRustToolPool();
|
|
39987
|
+
return retryPool.call(name, args);
|
|
39646
39988
|
}
|
|
39647
39989
|
|
|
39648
39990
|
// src/tools/search.ts
|
|
@@ -40788,6 +41130,92 @@ function registerAllTools(directory, asyncAgentTools, dynamicTools) {
|
|
|
40788
41130
|
// src/index.ts
|
|
40789
41131
|
init_shared();
|
|
40790
41132
|
|
|
41133
|
+
// src/core/agents/concurrency-config.ts
|
|
41134
|
+
var CONCURRENCY_KEYS = [
|
|
41135
|
+
"defaultConcurrency",
|
|
41136
|
+
"agentConcurrency",
|
|
41137
|
+
"providerConcurrency",
|
|
41138
|
+
"modelConcurrency"
|
|
41139
|
+
];
|
|
41140
|
+
function isRecord(value) {
|
|
41141
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41142
|
+
}
|
|
41143
|
+
function readLimitMap(value) {
|
|
41144
|
+
if (!isRecord(value)) return void 0;
|
|
41145
|
+
const result = {};
|
|
41146
|
+
for (const [key, limit] of Object.entries(value)) {
|
|
41147
|
+
if (typeof limit === "number" && Number.isFinite(limit) && limit >= 0) {
|
|
41148
|
+
result[key] = limit;
|
|
41149
|
+
}
|
|
41150
|
+
}
|
|
41151
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
41152
|
+
}
|
|
41153
|
+
function extractConcurrencyConfig(source) {
|
|
41154
|
+
if (!isRecord(source)) return {};
|
|
41155
|
+
const config3 = {};
|
|
41156
|
+
if (typeof source.defaultConcurrency === "number" && source.defaultConcurrency >= 0) {
|
|
41157
|
+
config3.defaultConcurrency = source.defaultConcurrency;
|
|
41158
|
+
}
|
|
41159
|
+
const agentConcurrency = readLimitMap(source.agentConcurrency);
|
|
41160
|
+
if (agentConcurrency) config3.agentConcurrency = agentConcurrency;
|
|
41161
|
+
const providerConcurrency = readLimitMap(source.providerConcurrency);
|
|
41162
|
+
if (providerConcurrency) config3.providerConcurrency = providerConcurrency;
|
|
41163
|
+
const modelConcurrency = readLimitMap(source.modelConcurrency);
|
|
41164
|
+
if (modelConcurrency) config3.modelConcurrency = modelConcurrency;
|
|
41165
|
+
return config3;
|
|
41166
|
+
}
|
|
41167
|
+
function hasConcurrencyConfig(source) {
|
|
41168
|
+
if (!isRecord(source)) return false;
|
|
41169
|
+
return CONCURRENCY_KEYS.some((key) => source[key] !== void 0);
|
|
41170
|
+
}
|
|
41171
|
+
function mergeConcurrencyConfig(base, override) {
|
|
41172
|
+
return {
|
|
41173
|
+
...base,
|
|
41174
|
+
...override,
|
|
41175
|
+
agentConcurrency: {
|
|
41176
|
+
...base.agentConcurrency,
|
|
41177
|
+
...override.agentConcurrency
|
|
41178
|
+
},
|
|
41179
|
+
providerConcurrency: {
|
|
41180
|
+
...base.providerConcurrency,
|
|
41181
|
+
...override.providerConcurrency
|
|
41182
|
+
},
|
|
41183
|
+
modelConcurrency: {
|
|
41184
|
+
...base.modelConcurrency,
|
|
41185
|
+
...override.modelConcurrency
|
|
41186
|
+
}
|
|
41187
|
+
};
|
|
41188
|
+
}
|
|
41189
|
+
|
|
41190
|
+
// src/core/config/plugin-options.ts
|
|
41191
|
+
function parseOrchestratorPluginOptions(options) {
|
|
41192
|
+
const source = isRecord2(options) ? options : {};
|
|
41193
|
+
return {
|
|
41194
|
+
concurrency: extractConcurrencyConfig(source),
|
|
41195
|
+
missionLoop: readMissionLoopOptions(source.missionLoop)
|
|
41196
|
+
};
|
|
41197
|
+
}
|
|
41198
|
+
function readMissionLoopOptions(value) {
|
|
41199
|
+
if (!isRecord2(value)) return DEFAULT_MISSION_RUNTIME_OPTIONS;
|
|
41200
|
+
return {
|
|
41201
|
+
ledger: readBoolean(value.ledger, DEFAULT_MISSION_RUNTIME_OPTIONS.ledger),
|
|
41202
|
+
markdownMemory: readBoolean(value.markdownMemory, DEFAULT_MISSION_RUNTIME_OPTIONS.markdownMemory),
|
|
41203
|
+
maxEvidenceEvents: readPositiveInteger(
|
|
41204
|
+
value.maxEvidenceEvents,
|
|
41205
|
+
DEFAULT_MISSION_RUNTIME_OPTIONS.maxEvidenceEvents
|
|
41206
|
+
)
|
|
41207
|
+
};
|
|
41208
|
+
}
|
|
41209
|
+
function readBoolean(value, fallback) {
|
|
41210
|
+
return typeof value === "boolean" ? value : fallback;
|
|
41211
|
+
}
|
|
41212
|
+
function readPositiveInteger(value, fallback) {
|
|
41213
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : fallback;
|
|
41214
|
+
}
|
|
41215
|
+
function isRecord2(value) {
|
|
41216
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41217
|
+
}
|
|
41218
|
+
|
|
40791
41219
|
// src/plugin-handlers/tool-execute-pre-handler.ts
|
|
40792
41220
|
init_logger();
|
|
40793
41221
|
function createToolExecuteBeforeHandler(ctx) {
|
|
@@ -40899,8 +41327,41 @@ This plugin runs in "Claude Code Compatibility Mode".
|
|
|
40899
41327
|
}
|
|
40900
41328
|
|
|
40901
41329
|
// src/plugin-handlers/config-handler.ts
|
|
40902
|
-
function
|
|
41330
|
+
function isRecord3(value) {
|
|
41331
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41332
|
+
}
|
|
41333
|
+
function isPermissionAction(value) {
|
|
41334
|
+
return value === "ask" || value === "allow" || value === "deny";
|
|
41335
|
+
}
|
|
41336
|
+
function mergePermission(globalPermission, agentPermission) {
|
|
41337
|
+
if (agentPermission === void 0) {
|
|
41338
|
+
return globalPermission;
|
|
41339
|
+
}
|
|
41340
|
+
if (isRecord3(globalPermission) && isRecord3(agentPermission)) {
|
|
41341
|
+
return { ...globalPermission, ...agentPermission };
|
|
41342
|
+
}
|
|
41343
|
+
if (isPermissionAction(globalPermission) && isRecord3(agentPermission)) {
|
|
41344
|
+
return { "*": globalPermission, ...agentPermission };
|
|
41345
|
+
}
|
|
41346
|
+
return agentPermission;
|
|
41347
|
+
}
|
|
41348
|
+
function defineAgent(existing, defaults, globalPermission) {
|
|
41349
|
+
const permission = mergePermission(globalPermission, existing?.permission);
|
|
41350
|
+
const agent = {
|
|
41351
|
+
...existing,
|
|
41352
|
+
...defaults
|
|
41353
|
+
};
|
|
41354
|
+
if (permission !== void 0) {
|
|
41355
|
+
agent.permission = permission;
|
|
41356
|
+
}
|
|
41357
|
+
return agent;
|
|
41358
|
+
}
|
|
41359
|
+
function createConfigHandler(options = {}) {
|
|
40903
41360
|
return async (config3) => {
|
|
41361
|
+
const mutableConfig = config3;
|
|
41362
|
+
if (hasConcurrencyConfig(config3)) {
|
|
41363
|
+
options.onConcurrencyConfig?.(extractConcurrencyConfig(config3));
|
|
41364
|
+
}
|
|
40904
41365
|
const claudeRules = findClaudeRules();
|
|
40905
41366
|
const injectRules = (prompt) => {
|
|
40906
41367
|
if (!claudeRules) return prompt;
|
|
@@ -40912,8 +41373,9 @@ ${claudeRules}`;
|
|
|
40912
41373
|
const plannerPrompt = injectRules(AGENTS[AGENT_NAMES.PLANNER]?.systemPrompt || "");
|
|
40913
41374
|
const workerPrompt = injectRules(AGENTS[AGENT_NAMES.WORKER]?.systemPrompt || "");
|
|
40914
41375
|
const reviewerPrompt = injectRules(AGENTS[AGENT_NAMES.REVIEWER]?.systemPrompt || "");
|
|
40915
|
-
const existingCommands =
|
|
40916
|
-
const existingAgents =
|
|
41376
|
+
const existingCommands = mutableConfig.command ?? {};
|
|
41377
|
+
const existingAgents = mutableConfig.agent ?? {};
|
|
41378
|
+
const globalPermission = mutableConfig.permission;
|
|
40917
41379
|
const orchestratorCommands = {};
|
|
40918
41380
|
for (const [name, cmd] of Object.entries(COMMANDS)) {
|
|
40919
41381
|
orchestratorCommands[name] = {
|
|
@@ -40924,39 +41386,34 @@ ${claudeRules}`;
|
|
|
40924
41386
|
}
|
|
40925
41387
|
const orchestratorAgents = {
|
|
40926
41388
|
// Primary agent - the main orchestrator
|
|
40927
|
-
[AGENT_NAMES.COMMANDER]: {
|
|
41389
|
+
[AGENT_NAMES.COMMANDER]: defineAgent(existingAgents[AGENT_NAMES.COMMANDER], {
|
|
40928
41390
|
description: "Autonomous orchestrator - executes until mission complete",
|
|
40929
41391
|
mode: "primary",
|
|
40930
41392
|
prompt: commanderPrompt,
|
|
40931
|
-
maxTokens: AGENT_TOKENS.PRIMARY_MAX_TOKENS,
|
|
40932
|
-
thinking: { type: "enabled", budgetTokens: AGENT_TOKENS.PRIMARY_THINKING_BUDGET },
|
|
40933
41393
|
color: "#ffea98"
|
|
40934
|
-
},
|
|
40935
|
-
// Subagents
|
|
40936
|
-
[AGENT_NAMES.PLANNER]: {
|
|
41394
|
+
}, globalPermission),
|
|
41395
|
+
// Subagents
|
|
41396
|
+
[AGENT_NAMES.PLANNER]: defineAgent(existingAgents[AGENT_NAMES.PLANNER], {
|
|
40937
41397
|
description: "Strategic planning and research specialist",
|
|
40938
41398
|
mode: "subagent",
|
|
40939
41399
|
hidden: true,
|
|
40940
41400
|
prompt: plannerPrompt,
|
|
40941
|
-
maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
|
|
40942
41401
|
color: "#9B59B6"
|
|
40943
|
-
},
|
|
40944
|
-
[AGENT_NAMES.WORKER]: {
|
|
41402
|
+
}, globalPermission),
|
|
41403
|
+
[AGENT_NAMES.WORKER]: defineAgent(existingAgents[AGENT_NAMES.WORKER], {
|
|
40945
41404
|
description: "Implementation and documentation specialist",
|
|
40946
41405
|
mode: "subagent",
|
|
40947
41406
|
hidden: true,
|
|
40948
41407
|
prompt: workerPrompt,
|
|
40949
|
-
maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
|
|
40950
41408
|
color: "#E67E22"
|
|
40951
|
-
},
|
|
40952
|
-
[AGENT_NAMES.REVIEWER]: {
|
|
41409
|
+
}, globalPermission),
|
|
41410
|
+
[AGENT_NAMES.REVIEWER]: defineAgent(existingAgents[AGENT_NAMES.REVIEWER], {
|
|
40953
41411
|
description: "Module-level verification specialist",
|
|
40954
41412
|
mode: "subagent",
|
|
40955
41413
|
hidden: true,
|
|
40956
41414
|
prompt: reviewerPrompt,
|
|
40957
|
-
maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
|
|
40958
41415
|
color: "#27AE60"
|
|
40959
|
-
}
|
|
41416
|
+
}, globalPermission)
|
|
40960
41417
|
};
|
|
40961
41418
|
const processedExistingAgents = { ...existingAgents };
|
|
40962
41419
|
if (processedExistingAgents.build) {
|
|
@@ -40972,9 +41429,9 @@ ${claudeRules}`;
|
|
|
40972
41429
|
mode: "subagent"
|
|
40973
41430
|
};
|
|
40974
41431
|
}
|
|
40975
|
-
|
|
40976
|
-
|
|
40977
|
-
|
|
41432
|
+
mutableConfig.command = { ...existingCommands, ...orchestratorCommands };
|
|
41433
|
+
mutableConfig.agent = { ...processedExistingAgents, ...orchestratorAgents };
|
|
41434
|
+
mutableConfig.default_agent = AGENT_NAMES.COMMANDER;
|
|
40978
41435
|
};
|
|
40979
41436
|
}
|
|
40980
41437
|
|
|
@@ -41432,7 +41889,11 @@ async function injectContinuation2(client, directory, sessionID, loopState, cust
|
|
|
41432
41889
|
return;
|
|
41433
41890
|
}
|
|
41434
41891
|
const summary = buildVerificationSummary(verification);
|
|
41435
|
-
|
|
41892
|
+
const continuationReason = customPrompt ? "stagnation_intervention" : loopState.lastContinuationReason;
|
|
41893
|
+
let prompt = generateMissionContinuationPrompt(loopState, {
|
|
41894
|
+
verificationSummary: summary,
|
|
41895
|
+
continuationReason
|
|
41896
|
+
});
|
|
41436
41897
|
if (customPrompt) {
|
|
41437
41898
|
prompt = `${customPrompt}
|
|
41438
41899
|
|
|
@@ -41445,12 +41906,35 @@ ${prompt}`;
|
|
|
41445
41906
|
parts: [{ type: PART_TYPES.TEXT, text: prompt }]
|
|
41446
41907
|
}
|
|
41447
41908
|
});
|
|
41909
|
+
appendMissionLedgerEvent(directory, {
|
|
41910
|
+
type: "prompt_injected",
|
|
41911
|
+
sessionID,
|
|
41912
|
+
iteration: loopState.iteration,
|
|
41913
|
+
objective: loopState.objective,
|
|
41914
|
+
summary,
|
|
41915
|
+
reason: continuationReason
|
|
41916
|
+
});
|
|
41917
|
+
syncMissionMemory(directory, loopState);
|
|
41448
41918
|
markInjectionPerformed(sessionID);
|
|
41449
41919
|
} catch (err) {
|
|
41450
41920
|
log("[mission-loop-handler] Failed to inject continuation prompt", { sessionID, error: err });
|
|
41451
41921
|
}
|
|
41452
41922
|
}
|
|
41453
41923
|
async function handleMissionComplete(client, directory, loopState) {
|
|
41924
|
+
const completedState = {
|
|
41925
|
+
...loopState,
|
|
41926
|
+
active: false,
|
|
41927
|
+
lastVerificationSummary: "Mission verification passed",
|
|
41928
|
+
lastContinuationReason: "mission_completed"
|
|
41929
|
+
};
|
|
41930
|
+
appendMissionLedgerEvent(directory, {
|
|
41931
|
+
type: "mission_completed",
|
|
41932
|
+
sessionID: loopState.sessionID,
|
|
41933
|
+
iteration: loopState.iteration,
|
|
41934
|
+
objective: loopState.objective,
|
|
41935
|
+
summary: "Mission verification passed"
|
|
41936
|
+
});
|
|
41937
|
+
syncMissionMemory(directory, completedState);
|
|
41454
41938
|
const cleared = clearLoopState(directory);
|
|
41455
41939
|
if (cleared) {
|
|
41456
41940
|
await showCompletedToast(client, loopState);
|
|
@@ -41503,6 +41987,20 @@ async function handleMissionIdle(client, directory, sessionID, mainSessionID) {
|
|
|
41503
41987
|
return;
|
|
41504
41988
|
}
|
|
41505
41989
|
if (shouldTripCircuit(sessionID)) {
|
|
41990
|
+
const verificationSummary2 = buildVerificationSummary(verification);
|
|
41991
|
+
appendMissionLedgerEvent(directory, {
|
|
41992
|
+
type: "circuit_open",
|
|
41993
|
+
sessionID,
|
|
41994
|
+
iteration: loopState.iteration,
|
|
41995
|
+
objective: loopState.objective,
|
|
41996
|
+
summary: verificationSummary2,
|
|
41997
|
+
reason: "stagnation_threshold"
|
|
41998
|
+
});
|
|
41999
|
+
syncMissionMemory(directory, {
|
|
42000
|
+
...loopState,
|
|
42001
|
+
lastVerificationSummary: verificationSummary2,
|
|
42002
|
+
lastContinuationReason: "circuit_open"
|
|
42003
|
+
});
|
|
41506
42004
|
log(`[${MISSION_CONTROL.LOG_SOURCE}-handler] Circuit breaker tripped for ${sessionID}`);
|
|
41507
42005
|
return;
|
|
41508
42006
|
}
|
|
@@ -41517,8 +42015,29 @@ async function handleMissionIdle(client, directory, sessionID, mainSessionID) {
|
|
|
41517
42015
|
const stagnant = isStagnant(sessionID, DEFAULT_STAGNATION_THRESHOLD);
|
|
41518
42016
|
const newState = incrementIteration(directory);
|
|
41519
42017
|
if (!newState) return;
|
|
42018
|
+
const verificationSummary = buildVerificationSummary(verification);
|
|
41520
42019
|
newState.lastProgress = currentProgress;
|
|
42020
|
+
newState.stagnationCount = stagnant ? (newState.stagnationCount ?? 0) + 1 : 0;
|
|
42021
|
+
newState.lastVerificationSummary = verificationSummary;
|
|
42022
|
+
newState.lastContinuationReason = stagnant ? "stagnation_intervention" : "verification_failed";
|
|
42023
|
+
newState.lastContinuationAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
41521
42024
|
writeLoopState(directory, newState);
|
|
42025
|
+
appendMissionLedgerEvent(directory, {
|
|
42026
|
+
type: "verification_failed",
|
|
42027
|
+
sessionID,
|
|
42028
|
+
iteration: newState.iteration,
|
|
42029
|
+
objective: newState.objective,
|
|
42030
|
+
summary: verificationSummary
|
|
42031
|
+
});
|
|
42032
|
+
appendMissionLedgerEvent(directory, {
|
|
42033
|
+
type: "continuation_scheduled",
|
|
42034
|
+
sessionID,
|
|
42035
|
+
iteration: newState.iteration,
|
|
42036
|
+
objective: newState.objective,
|
|
42037
|
+
summary: verificationSummary,
|
|
42038
|
+
reason: newState.lastContinuationReason
|
|
42039
|
+
});
|
|
42040
|
+
syncMissionMemory(directory, newState);
|
|
41522
42041
|
await showCountdownToast2(client, MISSION_CONTROL.DEFAULT_COUNTDOWN_SECONDS, newState.iteration, newState.maxIterations);
|
|
41523
42042
|
state2.countdownTimer = setTimeout(async () => {
|
|
41524
42043
|
sessionStateStore.cancelCountdown(sessionID);
|
|
@@ -41777,6 +42296,9 @@ function buildMissionContext(loopState) {
|
|
|
41777
42296
|
return `<mission_context>
|
|
41778
42297
|
ACTIVE MISSION LOOP:
|
|
41779
42298
|
- Status: Active (Iteration ${loopState.iteration}/${loopState.maxIterations})
|
|
42299
|
+
- Objective: ${loopState.objective ?? "Continue the active mission"}
|
|
42300
|
+
- Last Progress: ${loopState.lastProgress ?? "unknown"}
|
|
42301
|
+
- Last Verification: ${loopState.lastVerificationSummary ?? "unknown"}
|
|
41780
42302
|
- Started: ${loopState.startedAt}
|
|
41781
42303
|
- Original Task: ${loopState.prompt.slice(0, 500)}${loopState.prompt.length > 500 ? "..." : ""}
|
|
41782
42304
|
|
|
@@ -41817,7 +42339,7 @@ Wait for these tasks to complete before concluding the mission.
|
|
|
41817
42339
|
init_shared();
|
|
41818
42340
|
|
|
41819
42341
|
// src/core/knowledge/context-provider.ts
|
|
41820
|
-
import { existsSync as
|
|
42342
|
+
import { existsSync as existsSync10, readFileSync as readFileSync6, readdirSync } from "node:fs";
|
|
41821
42343
|
import path10 from "node:path";
|
|
41822
42344
|
|
|
41823
42345
|
// src/core/knowledge/graph-parser.ts
|
|
@@ -42111,7 +42633,7 @@ var HybridSearch = class {
|
|
|
42111
42633
|
};
|
|
42112
42634
|
|
|
42113
42635
|
// src/core/knowledge/tag-indexer.ts
|
|
42114
|
-
import { readFileSync as
|
|
42636
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
42115
42637
|
var TagIndexer = class {
|
|
42116
42638
|
tagMap = /* @__PURE__ */ new Map();
|
|
42117
42639
|
fileCache = /* @__PURE__ */ new Map();
|
|
@@ -42185,7 +42707,7 @@ var TagIndexer = class {
|
|
|
42185
42707
|
*/
|
|
42186
42708
|
indexFileFromDisk(filePath) {
|
|
42187
42709
|
try {
|
|
42188
|
-
const content =
|
|
42710
|
+
const content = readFileSync5(filePath, "utf8");
|
|
42189
42711
|
this.indexFile(filePath, content);
|
|
42190
42712
|
} catch {
|
|
42191
42713
|
this.clearIndexForFile(filePath);
|
|
@@ -42300,7 +42822,7 @@ var KnowledgeContextProvider = class {
|
|
|
42300
42822
|
const files = [];
|
|
42301
42823
|
for (const root of KNOWLEDGE_ROOTS) {
|
|
42302
42824
|
const fullRoot = path10.join(directory, root);
|
|
42303
|
-
if (!
|
|
42825
|
+
if (!existsSync10(fullRoot)) continue;
|
|
42304
42826
|
files.push(...this.walkDirectory(fullRoot));
|
|
42305
42827
|
}
|
|
42306
42828
|
return files.sort();
|
|
@@ -42328,7 +42850,7 @@ var KnowledgeContextProvider = class {
|
|
|
42328
42850
|
const noteToSnippet = /* @__PURE__ */ new Map();
|
|
42329
42851
|
for (const filePath of files) {
|
|
42330
42852
|
try {
|
|
42331
|
-
const content =
|
|
42853
|
+
const content = readFileSync6(filePath, "utf8");
|
|
42332
42854
|
const noteName = graphParser.getNoteName(filePath);
|
|
42333
42855
|
const { body } = tagIndexer.parseFrontmatter(content);
|
|
42334
42856
|
const normalizedBody = body.trim();
|
|
@@ -42388,7 +42910,7 @@ function createSystemTransformHandler(ctx) {
|
|
|
42388
42910
|
if (isActiveLoop && loopState) {
|
|
42389
42911
|
const { commander: commander2 } = await Promise.resolve().then(() => (init_commander(), commander_exports));
|
|
42390
42912
|
systemAdditions.push(commander2.systemPrompt);
|
|
42391
|
-
systemAdditions.push(buildMissionLoopSystemPrompt(loopState
|
|
42913
|
+
systemAdditions.push(buildMissionLoopSystemPrompt(loopState));
|
|
42392
42914
|
}
|
|
42393
42915
|
if (session?.active) {
|
|
42394
42916
|
systemAdditions.push(buildActiveSessionPrompt(session.step));
|
|
@@ -42420,18 +42942,25 @@ function buildKnowledgeContextPrompt(directory, missionPrompt, currentTask) {
|
|
|
42420
42942
|
const queryParts = [missionPrompt ?? "", currentTask ?? ""].filter(Boolean);
|
|
42421
42943
|
return knowledgeContextProvider.buildPrompt(directory, queryParts.join(" ").trim());
|
|
42422
42944
|
}
|
|
42423
|
-
function buildMissionLoopSystemPrompt(
|
|
42945
|
+
function buildMissionLoopSystemPrompt(loopState) {
|
|
42424
42946
|
return `<orchestrator_mission_loop>
|
|
42425
|
-
\u{1F3AF} MISSION LOOP ACTIVE: Iteration ${iteration}/${maxIterations}
|
|
42947
|
+
\u{1F3AF} MISSION LOOP ACTIVE: Iteration ${loopState.iteration}/${loopState.maxIterations}
|
|
42426
42948
|
|
|
42427
42949
|
You are in an autonomous mission loop. Continue working until ALL tasks are verified and 100% complete.
|
|
42428
42950
|
|
|
42951
|
+
ACTIVE OBJECTIVE:
|
|
42952
|
+
${loopState.objective ?? "Continue the active mission"}
|
|
42953
|
+
|
|
42954
|
+
RUNTIME MEMORY:
|
|
42955
|
+
- Last progress: ${loopState.lastProgress ?? "unknown"}
|
|
42956
|
+
- Last verification: ${loopState.lastVerificationSummary ?? "unknown"}
|
|
42957
|
+
|
|
42429
42958
|
COMPLETION CRITERIA:
|
|
42430
42959
|
- All hierarchical items in .opencode/todo.md are marked [x]
|
|
42431
42960
|
- .opencode/verification-checklist.md is fully checked off [x]
|
|
42432
42961
|
- All tests pass and builds succeed
|
|
42433
42962
|
|
|
42434
|
-
|
|
42963
|
+
Do not stop for routine permission or preference checks. Execute autonomously, and ask a concise clarification only when truly blocked and the OpenCode question permission allows it.
|
|
42435
42964
|
</orchestrator_mission_loop>`;
|
|
42436
42965
|
}
|
|
42437
42966
|
function buildActiveSessionPrompt(stepCount) {
|
|
@@ -42456,13 +42985,16 @@ Use \`delegate_task\` with background=true for parallel work.
|
|
|
42456
42985
|
// src/index.ts
|
|
42457
42986
|
var require2 = createRequire(import.meta.url);
|
|
42458
42987
|
var { version: PLUGIN_VERSION } = require2("../package.json");
|
|
42459
|
-
var OrchestratorPlugin = async (input) => {
|
|
42988
|
+
var OrchestratorPlugin = async (input, options) => {
|
|
42460
42989
|
const { directory, client } = input;
|
|
42990
|
+
const orchestratorOptions = parseOrchestratorPluginOptions(options);
|
|
42991
|
+
let concurrencyConfig = orchestratorOptions.concurrency;
|
|
42992
|
+
configureMissionRuntimeOptions(orchestratorOptions.missionLoop);
|
|
42461
42993
|
initializeHooks();
|
|
42462
42994
|
initToastClient(client);
|
|
42463
42995
|
const taskToastManager = initTaskToastManager(client);
|
|
42464
42996
|
const sessions = /* @__PURE__ */ new Map();
|
|
42465
|
-
const parallelAgentManager2 = ParallelAgentManager.getInstance(client, directory);
|
|
42997
|
+
const parallelAgentManager2 = ParallelAgentManager.getInstance(client, directory, concurrencyConfig);
|
|
42466
42998
|
const asyncAgentTools = createAsyncAgentTools(parallelAgentManager2, client);
|
|
42467
42999
|
const pluginManager = PluginManager.getInstance();
|
|
42468
43000
|
await pluginManager.initialize(directory);
|
|
@@ -42500,10 +43032,12 @@ var OrchestratorPlugin = async (input) => {
|
|
|
42500
43032
|
// -----------------------------------------------------------------
|
|
42501
43033
|
// Config hook - registers our commands and agents with OpenCode
|
|
42502
43034
|
// -----------------------------------------------------------------
|
|
42503
|
-
config: createConfigHandler(
|
|
42504
|
-
|
|
42505
|
-
|
|
42506
|
-
|
|
43035
|
+
config: createConfigHandler({
|
|
43036
|
+
onConcurrencyConfig: (config3) => {
|
|
43037
|
+
concurrencyConfig = mergeConcurrencyConfig(concurrencyConfig, config3);
|
|
43038
|
+
parallelAgentManager2.configureConcurrency(concurrencyConfig);
|
|
43039
|
+
}
|
|
43040
|
+
}),
|
|
42507
43041
|
// -----------------------------------------------------------------
|
|
42508
43042
|
// Event hook - handles OpenCode events
|
|
42509
43043
|
// -----------------------------------------------------------------
|
|
@@ -42539,9 +43073,9 @@ var OrchestratorPlugin = async (input) => {
|
|
|
42539
43073
|
// -----------------------------------------------------------------
|
|
42540
43074
|
[PLUGIN_HOOKS.EXPERIMENTAL_CHAT_SYSTEM_TRANSFORM]: createSystemTransformHandler(handlerContext),
|
|
42541
43075
|
// -----------------------------------------------------------------
|
|
42542
|
-
//
|
|
43076
|
+
// dispose hook - cleanup resources on plugin unload
|
|
42543
43077
|
// -----------------------------------------------------------------
|
|
42544
|
-
|
|
43078
|
+
dispose: async () => {
|
|
42545
43079
|
await shutdownManager.shutdown();
|
|
42546
43080
|
}
|
|
42547
43081
|
};
|