opencode-orchestrator 1.3.3 → 1.3.5
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 +148 -391
- 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 +1 -1
- 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 +1 -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 +844 -214
- 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 +3 -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/scripts/postinstall.js +21 -10
- package/dist/scripts/preuninstall.js +20 -11
- 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 +1 -1
- 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 +1 -1
- package/dist/shared/loop/constants/mission-control.d.ts +2 -2
- 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 +9 -1
- 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 +2 -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 +3 -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
|
|
|
@@ -216,7 +199,7 @@ var init_limits = __esm({
|
|
|
216
199
|
"use strict";
|
|
217
200
|
LIMITS = {
|
|
218
201
|
/** Maximum mission loop iterations */
|
|
219
|
-
MAX_ITERATIONS:
|
|
202
|
+
MAX_ITERATIONS: 1e9,
|
|
220
203
|
/** Default scan limit for file listing */
|
|
221
204
|
DEFAULT_SCAN_LIMIT: 20,
|
|
222
205
|
/** Max message history to check for conclusion */
|
|
@@ -1494,6 +1477,9 @@ var init_session_events = __esm({
|
|
|
1494
1477
|
"use strict";
|
|
1495
1478
|
SESSION_EVENTS = {
|
|
1496
1479
|
IDLE: "session.idle",
|
|
1480
|
+
STATUS: "session.status",
|
|
1481
|
+
UPDATED: "session.updated",
|
|
1482
|
+
COMPACTED: "session.compacted",
|
|
1497
1483
|
BUSY: "session.busy",
|
|
1498
1484
|
ERROR: "session.error",
|
|
1499
1485
|
DELETED: "session.deleted",
|
|
@@ -4737,9 +4723,10 @@ You are ${AGENT_NAMES.COMMANDER}. Autonomous mission controller.
|
|
|
4737
4723
|
- You ADAPT your approach to what the project requires
|
|
4738
4724
|
|
|
4739
4725
|
## \u{1F680} AUTONOMOUS EXECUTION MODE
|
|
4740
|
-
- Complete the ENTIRE mission without
|
|
4726
|
+
- Complete the ENTIRE mission without routine user hand-holding
|
|
4741
4727
|
- Make decisions yourself - don't present options to user
|
|
4742
4728
|
- If uncertain, make the BEST choice and proceed
|
|
4729
|
+
- Ask a concise clarification only when truly blocked and the OpenCode question permission allows it
|
|
4743
4730
|
- Conclude ONLY after ${AGENT_NAMES.REVIEWER} verifies the full system
|
|
4744
4731
|
- Only stop when everything is verified or truly blocked
|
|
4745
4732
|
${PROMPT_TAGS.ROLE.close}`;
|
|
@@ -5514,6 +5501,9 @@ var ConcurrencyToken = class {
|
|
|
5514
5501
|
}, autoReleaseMs);
|
|
5515
5502
|
this.autoReleaseTimer.unref();
|
|
5516
5503
|
}
|
|
5504
|
+
controller;
|
|
5505
|
+
key;
|
|
5506
|
+
autoReleaseMs;
|
|
5517
5507
|
released = false;
|
|
5518
5508
|
autoReleaseTimer = null;
|
|
5519
5509
|
/**
|
|
@@ -5857,6 +5847,12 @@ var ConcurrencyController = class {
|
|
|
5857
5847
|
constructor(config3) {
|
|
5858
5848
|
this.config = config3 ?? {};
|
|
5859
5849
|
}
|
|
5850
|
+
configure(config3) {
|
|
5851
|
+
this.config = config3;
|
|
5852
|
+
}
|
|
5853
|
+
getConfig() {
|
|
5854
|
+
return this.config;
|
|
5855
|
+
}
|
|
5860
5856
|
setLimit(key, limit) {
|
|
5861
5857
|
this.limits.set(key, limit);
|
|
5862
5858
|
}
|
|
@@ -7783,7 +7779,7 @@ function $constructor(name, initializer5, params) {
|
|
|
7783
7779
|
Object.defineProperty(_, "name", { value: name });
|
|
7784
7780
|
return _;
|
|
7785
7781
|
}
|
|
7786
|
-
var $brand = Symbol("zod_brand");
|
|
7782
|
+
var $brand = /* @__PURE__ */ Symbol("zod_brand");
|
|
7787
7783
|
var $ZodAsyncError = class extends Error {
|
|
7788
7784
|
constructor() {
|
|
7789
7785
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -17526,8 +17522,8 @@ function yo_default() {
|
|
|
17526
17522
|
|
|
17527
17523
|
// node_modules/zod/v4/core/registries.js
|
|
17528
17524
|
var _a2;
|
|
17529
|
-
var $output = Symbol("ZodOutput");
|
|
17530
|
-
var $input = Symbol("ZodInput");
|
|
17525
|
+
var $output = /* @__PURE__ */ Symbol("ZodOutput");
|
|
17526
|
+
var $input = /* @__PURE__ */ Symbol("ZodInput");
|
|
17531
17527
|
var $ZodRegistry = class {
|
|
17532
17528
|
constructor() {
|
|
17533
17529
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
@@ -18564,7 +18560,7 @@ function _stringbool(Classes, _params) {
|
|
|
18564
18560
|
type: "pipe",
|
|
18565
18561
|
in: stringSchema,
|
|
18566
18562
|
out: booleanSchema,
|
|
18567
|
-
transform: (input, payload) => {
|
|
18563
|
+
transform: ((input, payload) => {
|
|
18568
18564
|
let data = input;
|
|
18569
18565
|
if (params.case !== "sensitive")
|
|
18570
18566
|
data = data.toLowerCase();
|
|
@@ -18583,14 +18579,14 @@ function _stringbool(Classes, _params) {
|
|
|
18583
18579
|
});
|
|
18584
18580
|
return {};
|
|
18585
18581
|
}
|
|
18586
|
-
},
|
|
18587
|
-
reverseTransform: (input, _payload) => {
|
|
18582
|
+
}),
|
|
18583
|
+
reverseTransform: ((input, _payload) => {
|
|
18588
18584
|
if (input === true) {
|
|
18589
18585
|
return truthyArray[0] || "true";
|
|
18590
18586
|
} else {
|
|
18591
18587
|
return falsyArray[0] || "false";
|
|
18592
18588
|
}
|
|
18593
|
-
},
|
|
18589
|
+
}),
|
|
18594
18590
|
error: params.error
|
|
18595
18591
|
});
|
|
18596
18592
|
return codec3;
|
|
@@ -21727,9 +21723,6 @@ var AgentDefinitionSchema = external_exports.object({
|
|
|
21727
21723
|
mode: external_exports.enum(["primary", "subagent"]).optional(),
|
|
21728
21724
|
color: external_exports.string().optional(),
|
|
21729
21725
|
hidden: external_exports.boolean().optional(),
|
|
21730
|
-
thinking: external_exports.boolean().optional(),
|
|
21731
|
-
maxTokens: external_exports.number().optional(),
|
|
21732
|
-
budgetTokens: external_exports.number().optional(),
|
|
21733
21726
|
canWrite: external_exports.boolean(),
|
|
21734
21727
|
// Required per interface
|
|
21735
21728
|
canBash: external_exports.boolean()
|
|
@@ -21786,7 +21779,7 @@ var AgentRegistry = class _AgentRegistry {
|
|
|
21786
21779
|
for (const [name, def] of Object.entries(customAgents)) {
|
|
21787
21780
|
const result = AgentDefinitionSchema.safeParse(def);
|
|
21788
21781
|
if (result.success) {
|
|
21789
|
-
this.registerAgent(name,
|
|
21782
|
+
this.registerAgent(name, result.data);
|
|
21790
21783
|
} else {
|
|
21791
21784
|
log(`[AgentRegistry] Invalid custom agent definition for: ${name}. Errors: ${result.error.message}`);
|
|
21792
21785
|
}
|
|
@@ -21812,6 +21805,13 @@ var TaskLauncher = class {
|
|
|
21812
21805
|
this.onTaskError = onTaskError;
|
|
21813
21806
|
this.startPolling = startPolling;
|
|
21814
21807
|
}
|
|
21808
|
+
client;
|
|
21809
|
+
directory;
|
|
21810
|
+
store;
|
|
21811
|
+
concurrency;
|
|
21812
|
+
sessionPool;
|
|
21813
|
+
onTaskError;
|
|
21814
|
+
startPolling;
|
|
21815
21815
|
/**
|
|
21816
21816
|
* Unified launch method - handles both single and multiple tasks efficiently.
|
|
21817
21817
|
* All session creations happen in parallel immediately.
|
|
@@ -21981,6 +21981,11 @@ var TaskResumer = class {
|
|
|
21981
21981
|
this.startPolling = startPolling;
|
|
21982
21982
|
this.notifyParentIfAllComplete = notifyParentIfAllComplete;
|
|
21983
21983
|
}
|
|
21984
|
+
client;
|
|
21985
|
+
store;
|
|
21986
|
+
findBySession;
|
|
21987
|
+
startPolling;
|
|
21988
|
+
notifyParentIfAllComplete;
|
|
21984
21989
|
async resume(input) {
|
|
21985
21990
|
const existingTask = this.findBySession(input.sessionId);
|
|
21986
21991
|
if (!existingTask) {
|
|
@@ -22135,6 +22140,13 @@ var TaskPoller = class {
|
|
|
22135
22140
|
this.pruneExpiredTasks = pruneExpiredTasks;
|
|
22136
22141
|
this.onTaskComplete = onTaskComplete;
|
|
22137
22142
|
}
|
|
22143
|
+
client;
|
|
22144
|
+
store;
|
|
22145
|
+
concurrency;
|
|
22146
|
+
notifyParentIfAllComplete;
|
|
22147
|
+
scheduleCleanup;
|
|
22148
|
+
pruneExpiredTasks;
|
|
22149
|
+
onTaskComplete;
|
|
22138
22150
|
pollingInterval;
|
|
22139
22151
|
messageCache = /* @__PURE__ */ new Map();
|
|
22140
22152
|
// Adaptive polling
|
|
@@ -22339,6 +22351,10 @@ var TaskCleaner = class {
|
|
|
22339
22351
|
this.concurrency = concurrency;
|
|
22340
22352
|
this.sessionPool = sessionPool2;
|
|
22341
22353
|
}
|
|
22354
|
+
client;
|
|
22355
|
+
store;
|
|
22356
|
+
concurrency;
|
|
22357
|
+
sessionPool;
|
|
22342
22358
|
pruneExpiredTasks() {
|
|
22343
22359
|
const now = Date.now();
|
|
22344
22360
|
for (const [taskId, task] of this.store.getAll().map((t) => [t.id, t])) {
|
|
@@ -22454,6 +22470,14 @@ var EventHandler = class {
|
|
|
22454
22470
|
this.validateSessionHasOutput = validateSessionHasOutput2;
|
|
22455
22471
|
this.onTaskComplete = onTaskComplete;
|
|
22456
22472
|
}
|
|
22473
|
+
client;
|
|
22474
|
+
store;
|
|
22475
|
+
concurrency;
|
|
22476
|
+
findBySession;
|
|
22477
|
+
notifyParentIfAllComplete;
|
|
22478
|
+
scheduleCleanup;
|
|
22479
|
+
validateSessionHasOutput;
|
|
22480
|
+
onTaskComplete;
|
|
22457
22481
|
/**
|
|
22458
22482
|
* Handle OpenCode session events for proper resource cleanup.
|
|
22459
22483
|
* Call this from your plugin's event hook.
|
|
@@ -22959,7 +22983,7 @@ var ParallelAgentManager = class _ParallelAgentManager {
|
|
|
22959
22983
|
store = new TaskStore();
|
|
22960
22984
|
client;
|
|
22961
22985
|
directory;
|
|
22962
|
-
concurrency
|
|
22986
|
+
concurrency;
|
|
22963
22987
|
sessionPool;
|
|
22964
22988
|
// Composed components
|
|
22965
22989
|
launcher;
|
|
@@ -22967,9 +22991,10 @@ var ParallelAgentManager = class _ParallelAgentManager {
|
|
|
22967
22991
|
poller;
|
|
22968
22992
|
cleaner;
|
|
22969
22993
|
eventHandler;
|
|
22970
|
-
constructor(client, directory) {
|
|
22994
|
+
constructor(client, directory, concurrencyConfig) {
|
|
22971
22995
|
this.client = client;
|
|
22972
22996
|
this.directory = directory;
|
|
22997
|
+
this.concurrency = new ConcurrencyController(concurrencyConfig);
|
|
22973
22998
|
const memory = MemoryManager.getInstance();
|
|
22974
22999
|
memory.add("system" /* SYSTEM */, CORE_PHILOSOPHY, 1);
|
|
22975
23000
|
memory.add("project" /* PROJECT */, `Working directory: ${directory}`, 0.9);
|
|
@@ -23021,12 +23046,12 @@ var ParallelAgentManager = class _ParallelAgentManager {
|
|
|
23021
23046
|
log("Recovery error:", err);
|
|
23022
23047
|
});
|
|
23023
23048
|
}
|
|
23024
|
-
static getInstance(client, directory) {
|
|
23049
|
+
static getInstance(client, directory, concurrencyConfig) {
|
|
23025
23050
|
if (!_ParallelAgentManager._instance) {
|
|
23026
23051
|
if (!client || !directory) {
|
|
23027
23052
|
throw new Error("ParallelAgentManager requires client and directory on first call");
|
|
23028
23053
|
}
|
|
23029
|
-
_ParallelAgentManager._instance = new _ParallelAgentManager(client, directory);
|
|
23054
|
+
_ParallelAgentManager._instance = new _ParallelAgentManager(client, directory, concurrencyConfig);
|
|
23030
23055
|
}
|
|
23031
23056
|
return _ParallelAgentManager._instance;
|
|
23032
23057
|
}
|
|
@@ -23095,6 +23120,9 @@ var ParallelAgentManager = class _ParallelAgentManager {
|
|
|
23095
23120
|
setConcurrencyLimit(agentType, limit) {
|
|
23096
23121
|
this.concurrency.setLimit(agentType, limit);
|
|
23097
23122
|
}
|
|
23123
|
+
configureConcurrency(config3) {
|
|
23124
|
+
this.concurrency.configure(config3);
|
|
23125
|
+
}
|
|
23098
23126
|
getPendingCount(parentSessionID) {
|
|
23099
23127
|
return this.store.getPendingCount(parentSessionID);
|
|
23100
23128
|
}
|
|
@@ -23723,7 +23751,7 @@ function $constructor2(name, initializer5, params) {
|
|
|
23723
23751
|
Object.defineProperty(_, "name", { value: name });
|
|
23724
23752
|
return _;
|
|
23725
23753
|
}
|
|
23726
|
-
var $brand2 = Symbol("zod_brand");
|
|
23754
|
+
var $brand2 = /* @__PURE__ */ Symbol("zod_brand");
|
|
23727
23755
|
var $ZodAsyncError2 = class extends Error {
|
|
23728
23756
|
constructor() {
|
|
23729
23757
|
super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
|
|
@@ -23868,7 +23896,7 @@ function floatSafeRemainder2(val, step) {
|
|
|
23868
23896
|
const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
|
|
23869
23897
|
return valInt % stepInt / 10 ** decCount;
|
|
23870
23898
|
}
|
|
23871
|
-
var EVALUATING2 = Symbol("evaluating");
|
|
23899
|
+
var EVALUATING2 = /* @__PURE__ */ Symbol("evaluating");
|
|
23872
23900
|
function defineLazy2(object3, key, getter) {
|
|
23873
23901
|
let value = void 0;
|
|
23874
23902
|
Object.defineProperty(object3, key, {
|
|
@@ -32713,8 +32741,8 @@ function yo_default2() {
|
|
|
32713
32741
|
}
|
|
32714
32742
|
|
|
32715
32743
|
// node_modules/@opencode-ai/plugin/node_modules/zod/v4/core/registries.js
|
|
32716
|
-
var $output2 = Symbol("ZodOutput");
|
|
32717
|
-
var $input2 = Symbol("ZodInput");
|
|
32744
|
+
var $output2 = /* @__PURE__ */ Symbol("ZodOutput");
|
|
32745
|
+
var $input2 = /* @__PURE__ */ Symbol("ZodInput");
|
|
32718
32746
|
var $ZodRegistry2 = class {
|
|
32719
32747
|
constructor() {
|
|
32720
32748
|
this._map = /* @__PURE__ */ new WeakMap();
|
|
@@ -33597,7 +33625,7 @@ function _stringbool2(Classes, _params) {
|
|
|
33597
33625
|
type: "pipe",
|
|
33598
33626
|
in: stringSchema,
|
|
33599
33627
|
out: booleanSchema,
|
|
33600
|
-
transform: (input, payload) => {
|
|
33628
|
+
transform: ((input, payload) => {
|
|
33601
33629
|
let data = input;
|
|
33602
33630
|
if (params.case !== "sensitive")
|
|
33603
33631
|
data = data.toLowerCase();
|
|
@@ -33616,14 +33644,14 @@ function _stringbool2(Classes, _params) {
|
|
|
33616
33644
|
});
|
|
33617
33645
|
return {};
|
|
33618
33646
|
}
|
|
33619
|
-
},
|
|
33620
|
-
reverseTransform: (input, _payload) => {
|
|
33647
|
+
}),
|
|
33648
|
+
reverseTransform: ((input, _payload) => {
|
|
33621
33649
|
if (input === true) {
|
|
33622
33650
|
return truthyArray[0] || "true";
|
|
33623
33651
|
} else {
|
|
33624
33652
|
return falsyArray[0] || "false";
|
|
33625
33653
|
}
|
|
33626
|
-
},
|
|
33654
|
+
}),
|
|
33627
33655
|
error: params.error
|
|
33628
33656
|
});
|
|
33629
33657
|
return codec3;
|
|
@@ -34583,10 +34611,10 @@ var ZodType2 = /* @__PURE__ */ $constructor2("ZodType", (inst, def) => {
|
|
|
34583
34611
|
};
|
|
34584
34612
|
inst.clone = (def2, params) => clone2(inst, def2, params);
|
|
34585
34613
|
inst.brand = () => inst;
|
|
34586
|
-
inst.register = (reg, meta3) => {
|
|
34614
|
+
inst.register = ((reg, meta3) => {
|
|
34587
34615
|
reg.add(inst, meta3);
|
|
34588
34616
|
return inst;
|
|
34589
|
-
};
|
|
34617
|
+
});
|
|
34590
34618
|
inst.parse = (data, params) => parse4(inst, data, params, { callee: inst.parse });
|
|
34591
34619
|
inst.safeParse = (data, params) => safeParse4(inst, data, params);
|
|
34592
34620
|
inst.parseAsync = async (data, params) => parseAsync4(inst, data, params, { callee: inst.parseAsync });
|
|
@@ -36413,8 +36441,8 @@ init_logger();
|
|
|
36413
36441
|
// src/core/loop/mission-loop.ts
|
|
36414
36442
|
init_logger();
|
|
36415
36443
|
init_shared();
|
|
36416
|
-
import { existsSync as
|
|
36417
|
-
import { join as
|
|
36444
|
+
import { existsSync as existsSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2, unlinkSync, mkdirSync as mkdirSync4 } from "node:fs";
|
|
36445
|
+
import { join as join6 } from "node:path";
|
|
36418
36446
|
|
|
36419
36447
|
// src/shared/constants/system-messages.ts
|
|
36420
36448
|
init_mission_control();
|
|
@@ -36522,19 +36550,199 @@ You must maintain a pristine workspace. **As part of your move**, perform these
|
|
|
36522
36550
|
</system_maintenance>
|
|
36523
36551
|
`;
|
|
36524
36552
|
|
|
36553
|
+
// src/core/knowledge/mission-memory.ts
|
|
36554
|
+
init_shared();
|
|
36555
|
+
import { mkdirSync as mkdirSync3, renameSync, writeFileSync } from "node:fs";
|
|
36556
|
+
import { dirname as dirname2, join as join5 } from "node:path";
|
|
36557
|
+
|
|
36558
|
+
// src/core/loop/mission-ledger.ts
|
|
36559
|
+
init_shared();
|
|
36560
|
+
import { appendFileSync, existsSync as existsSync2, mkdirSync as mkdirSync2, readFileSync } from "node:fs";
|
|
36561
|
+
import { join as join4 } from "node:path";
|
|
36562
|
+
import { randomUUID } from "node:crypto";
|
|
36563
|
+
|
|
36564
|
+
// src/core/loop/mission-runtime-options.ts
|
|
36565
|
+
var DEFAULT_MISSION_RUNTIME_OPTIONS = {
|
|
36566
|
+
ledger: true,
|
|
36567
|
+
markdownMemory: true,
|
|
36568
|
+
maxEvidenceEvents: 20
|
|
36569
|
+
};
|
|
36570
|
+
var runtimeOptions = { ...DEFAULT_MISSION_RUNTIME_OPTIONS };
|
|
36571
|
+
function configureMissionRuntimeOptions(options) {
|
|
36572
|
+
runtimeOptions = { ...DEFAULT_MISSION_RUNTIME_OPTIONS, ...options };
|
|
36573
|
+
}
|
|
36574
|
+
function getMissionRuntimeOptions() {
|
|
36575
|
+
return runtimeOptions;
|
|
36576
|
+
}
|
|
36577
|
+
|
|
36578
|
+
// src/core/loop/mission-ledger.ts
|
|
36579
|
+
var LEDGER_FILE = "mission-ledger.jsonl";
|
|
36580
|
+
function getMissionLedgerPath(directory) {
|
|
36581
|
+
return join4(directory, PATHS.OPENCODE, LEDGER_FILE);
|
|
36582
|
+
}
|
|
36583
|
+
function appendMissionLedgerEvent(directory, input) {
|
|
36584
|
+
if (!getMissionRuntimeOptions().ledger) return null;
|
|
36585
|
+
const event = {
|
|
36586
|
+
id: randomUUID(),
|
|
36587
|
+
timestamp: input.timestamp ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
36588
|
+
type: input.type,
|
|
36589
|
+
sessionID: input.sessionID,
|
|
36590
|
+
iteration: input.iteration,
|
|
36591
|
+
objective: input.objective,
|
|
36592
|
+
summary: input.summary,
|
|
36593
|
+
reason: input.reason
|
|
36594
|
+
};
|
|
36595
|
+
try {
|
|
36596
|
+
const ledgerPath = getMissionLedgerPath(directory);
|
|
36597
|
+
mkdirSync2(join4(directory, PATHS.OPENCODE), { recursive: true });
|
|
36598
|
+
appendFileSync(ledgerPath, `${JSON.stringify(event)}
|
|
36599
|
+
`, "utf8");
|
|
36600
|
+
return event;
|
|
36601
|
+
} catch {
|
|
36602
|
+
return null;
|
|
36603
|
+
}
|
|
36604
|
+
}
|
|
36605
|
+
function readMissionLedger(directory, limit = 20) {
|
|
36606
|
+
const options = getMissionRuntimeOptions();
|
|
36607
|
+
if (!options.ledger) return [];
|
|
36608
|
+
const ledgerPath = getMissionLedgerPath(directory);
|
|
36609
|
+
if (!existsSync2(ledgerPath)) return [];
|
|
36610
|
+
try {
|
|
36611
|
+
const lines = readFileSync(ledgerPath, "utf8").split(/\r?\n/).filter(Boolean);
|
|
36612
|
+
const maxEvents = Math.max(1, Math.min(limit, options.maxEvidenceEvents));
|
|
36613
|
+
return lines.slice(Math.max(0, lines.length - maxEvents)).map(parseLedgerLine).filter((event) => event !== null);
|
|
36614
|
+
} catch {
|
|
36615
|
+
return [];
|
|
36616
|
+
}
|
|
36617
|
+
}
|
|
36618
|
+
function parseLedgerLine(line) {
|
|
36619
|
+
try {
|
|
36620
|
+
const value = JSON.parse(line);
|
|
36621
|
+
if (!value.id || !value.type || !value.timestamp || !value.sessionID) return null;
|
|
36622
|
+
return value;
|
|
36623
|
+
} catch {
|
|
36624
|
+
return null;
|
|
36625
|
+
}
|
|
36626
|
+
}
|
|
36627
|
+
|
|
36628
|
+
// src/core/knowledge/mission-memory.ts
|
|
36629
|
+
var BRAIN_DIR = join5(PATHS.DOCS, "brain");
|
|
36630
|
+
var SCRATCHPAD_FILE = "scratchpad.md";
|
|
36631
|
+
var CANVAS_FILE = "knowledge-map.canvas";
|
|
36632
|
+
var MAX_CANVAS_EVENTS = 3;
|
|
36633
|
+
var MAX_SCRATCHPAD_EVENTS = 6;
|
|
36634
|
+
function syncMissionMemory(directory, state2) {
|
|
36635
|
+
const options = getMissionRuntimeOptions();
|
|
36636
|
+
if (!options.markdownMemory) return false;
|
|
36637
|
+
const events = readMissionLedger(
|
|
36638
|
+
directory,
|
|
36639
|
+
Math.min(MAX_SCRATCHPAD_EVENTS, options.maxEvidenceEvents)
|
|
36640
|
+
);
|
|
36641
|
+
try {
|
|
36642
|
+
writeScratchpad(directory, state2, events);
|
|
36643
|
+
writeCanvas(directory, state2, events);
|
|
36644
|
+
return true;
|
|
36645
|
+
} catch {
|
|
36646
|
+
return false;
|
|
36647
|
+
}
|
|
36648
|
+
}
|
|
36649
|
+
function getMissionScratchpadPath(directory) {
|
|
36650
|
+
return join5(directory, BRAIN_DIR, SCRATCHPAD_FILE);
|
|
36651
|
+
}
|
|
36652
|
+
function getMissionCanvasPath(directory) {
|
|
36653
|
+
return join5(directory, BRAIN_DIR, CANVAS_FILE);
|
|
36654
|
+
}
|
|
36655
|
+
function writeScratchpad(directory, state2, events) {
|
|
36656
|
+
const content = [
|
|
36657
|
+
"---",
|
|
36658
|
+
"tags: [scratchpad, mission, orchestrator]",
|
|
36659
|
+
"keep: true",
|
|
36660
|
+
`title: "${escapeYaml(state2.objective ?? "Active Mission")}"`,
|
|
36661
|
+
"---",
|
|
36662
|
+
"# Orchestrator Mission Scratchpad",
|
|
36663
|
+
"",
|
|
36664
|
+
"## Focus",
|
|
36665
|
+
`- Objective: ${state2.objective ?? state2.prompt}`,
|
|
36666
|
+
`- Session: ${state2.sessionID}`,
|
|
36667
|
+
`- Status: ${state2.active ? "active" : "inactive"}`,
|
|
36668
|
+
`- Iteration: ${state2.iteration}/${state2.maxIterations}`,
|
|
36669
|
+
"",
|
|
36670
|
+
"## Runtime State",
|
|
36671
|
+
`- Last progress: ${state2.lastProgress ?? "unknown"}`,
|
|
36672
|
+
`- Last verification: ${state2.lastVerificationSummary ?? "unknown"}`,
|
|
36673
|
+
`- Last continuation reason: ${state2.lastContinuationReason ?? "unknown"}`,
|
|
36674
|
+
"",
|
|
36675
|
+
"## Recent Evidence",
|
|
36676
|
+
...formatEventLines(events),
|
|
36677
|
+
"",
|
|
36678
|
+
"## Open Questions",
|
|
36679
|
+
"- Keep this section short; unresolved blockers should be reflected in TODO or sync issues.",
|
|
36680
|
+
""
|
|
36681
|
+
].join("\n");
|
|
36682
|
+
atomicWrite(getMissionScratchpadPath(directory), content);
|
|
36683
|
+
}
|
|
36684
|
+
function writeCanvas(directory, state2, events) {
|
|
36685
|
+
const nodes = buildCanvasNodes(state2, events);
|
|
36686
|
+
const edges = buildCanvasEdges(nodes);
|
|
36687
|
+
atomicWrite(getMissionCanvasPath(directory), JSON.stringify({ nodes, edges }, null, 2));
|
|
36688
|
+
}
|
|
36689
|
+
function buildCanvasNodes(state2, events) {
|
|
36690
|
+
const nodes = [
|
|
36691
|
+
textNode("objective", `Objective
|
|
36692
|
+
${state2.objective ?? state2.prompt}`, 0, 0),
|
|
36693
|
+
textNode("runtime", `Runtime
|
|
36694
|
+
Iteration ${state2.iteration}/${state2.maxIterations}
|
|
36695
|
+
Progress ${state2.lastProgress ?? "unknown"}`, 420, 0),
|
|
36696
|
+
textNode("verification", `Verification
|
|
36697
|
+
${state2.lastVerificationSummary ?? "unknown"}`, 840, 0)
|
|
36698
|
+
];
|
|
36699
|
+
events.slice(-MAX_CANVAS_EVENTS).forEach((event, index) => {
|
|
36700
|
+
nodes.push(textNode(`event-${index}`, `${event.type}
|
|
36701
|
+
${event.summary ?? event.reason ?? event.timestamp}`, 420 * index, 260));
|
|
36702
|
+
});
|
|
36703
|
+
return nodes;
|
|
36704
|
+
}
|
|
36705
|
+
function buildCanvasEdges(nodes) {
|
|
36706
|
+
const edges = [
|
|
36707
|
+
{ id: "objective-runtime", fromNode: "objective", toNode: "runtime", label: "drives" },
|
|
36708
|
+
{ id: "runtime-verification", fromNode: "runtime", toNode: "verification", label: "checks" }
|
|
36709
|
+
];
|
|
36710
|
+
for (const node of nodes.filter((item) => item.id.startsWith("event-"))) {
|
|
36711
|
+
edges.push({ id: `verification-${node.id}`, fromNode: "verification", toNode: node.id, label: "evidence" });
|
|
36712
|
+
}
|
|
36713
|
+
return edges;
|
|
36714
|
+
}
|
|
36715
|
+
function textNode(id, text, x, y) {
|
|
36716
|
+
return { id, type: "text", text, x, y, width: 360, height: 180 };
|
|
36717
|
+
}
|
|
36718
|
+
function formatEventLines(events) {
|
|
36719
|
+
if (events.length === 0) return ["- No runtime evidence recorded yet."];
|
|
36720
|
+
return events.map((event) => `- ${event.timestamp} ${event.type}: ${event.summary ?? event.reason ?? "recorded"}`);
|
|
36721
|
+
}
|
|
36722
|
+
function atomicWrite(path11, content) {
|
|
36723
|
+
mkdirSync3(dirname2(path11), { recursive: true });
|
|
36724
|
+
const tempPath = `${path11}.tmp`;
|
|
36725
|
+
writeFileSync(tempPath, content, "utf8");
|
|
36726
|
+
renameSync(tempPath, path11);
|
|
36727
|
+
}
|
|
36728
|
+
function escapeYaml(value) {
|
|
36729
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
36730
|
+
}
|
|
36731
|
+
|
|
36525
36732
|
// src/core/loop/mission-loop.ts
|
|
36526
36733
|
var STATE_FILE = MISSION_CONTROL.STATE_FILE;
|
|
36527
36734
|
var DEFAULT_MAX_ITERATIONS = MISSION_CONTROL.DEFAULT_MAX_ITERATIONS;
|
|
36735
|
+
var UNKNOWN_STATUS = "unknown";
|
|
36528
36736
|
function getStateFilePath(directory) {
|
|
36529
|
-
return
|
|
36737
|
+
return join6(directory, PATHS.OPENCODE, STATE_FILE);
|
|
36530
36738
|
}
|
|
36531
36739
|
function readLoopState(directory) {
|
|
36532
36740
|
const filePath = getStateFilePath(directory);
|
|
36533
|
-
if (!
|
|
36741
|
+
if (!existsSync3(filePath)) {
|
|
36534
36742
|
return null;
|
|
36535
36743
|
}
|
|
36536
36744
|
try {
|
|
36537
|
-
const content =
|
|
36745
|
+
const content = readFileSync2(filePath, "utf-8");
|
|
36538
36746
|
return JSON.parse(content);
|
|
36539
36747
|
} catch (error95) {
|
|
36540
36748
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Failed to read state: ${error95}`);
|
|
@@ -36543,12 +36751,12 @@ function readLoopState(directory) {
|
|
|
36543
36751
|
}
|
|
36544
36752
|
function writeLoopState(directory, state2) {
|
|
36545
36753
|
const filePath = getStateFilePath(directory);
|
|
36546
|
-
const dirPath =
|
|
36754
|
+
const dirPath = join6(directory, PATHS.OPENCODE);
|
|
36547
36755
|
try {
|
|
36548
|
-
if (!
|
|
36549
|
-
|
|
36756
|
+
if (!existsSync3(dirPath)) {
|
|
36757
|
+
mkdirSync4(dirPath, { recursive: true });
|
|
36550
36758
|
}
|
|
36551
|
-
|
|
36759
|
+
writeFileSync2(filePath, JSON.stringify(state2, null, 2), "utf-8");
|
|
36552
36760
|
return true;
|
|
36553
36761
|
} catch (error95) {
|
|
36554
36762
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Failed to write state: ${error95}`);
|
|
@@ -36557,7 +36765,7 @@ function writeLoopState(directory, state2) {
|
|
|
36557
36765
|
}
|
|
36558
36766
|
function clearLoopState(directory) {
|
|
36559
36767
|
const filePath = getStateFilePath(directory);
|
|
36560
|
-
if (!
|
|
36768
|
+
if (!existsSync3(filePath)) {
|
|
36561
36769
|
return false;
|
|
36562
36770
|
}
|
|
36563
36771
|
try {
|
|
@@ -36578,17 +36786,30 @@ function incrementIteration(directory) {
|
|
|
36578
36786
|
}
|
|
36579
36787
|
return null;
|
|
36580
36788
|
}
|
|
36789
|
+
function deriveObjective(prompt) {
|
|
36790
|
+
const firstLine = prompt.split(/\r?\n/).find((line) => line.trim().length > 0);
|
|
36791
|
+
return firstLine?.trim() || prompt.trim() || "Continue the active mission";
|
|
36792
|
+
}
|
|
36581
36793
|
function startMissionLoop(directory, sessionID, prompt, options = {}) {
|
|
36582
36794
|
const state2 = {
|
|
36583
36795
|
active: true,
|
|
36584
36796
|
iteration: 1,
|
|
36585
36797
|
maxIterations: options.maxIterations ?? DEFAULT_MAX_ITERATIONS,
|
|
36586
36798
|
prompt,
|
|
36799
|
+
objective: deriveObjective(prompt),
|
|
36587
36800
|
sessionID,
|
|
36588
36801
|
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
36589
36802
|
};
|
|
36590
36803
|
const success3 = writeLoopState(directory, state2);
|
|
36591
36804
|
if (success3) {
|
|
36805
|
+
appendMissionLedgerEvent(directory, {
|
|
36806
|
+
type: "mission_started",
|
|
36807
|
+
sessionID,
|
|
36808
|
+
iteration: state2.iteration,
|
|
36809
|
+
objective: state2.objective,
|
|
36810
|
+
summary: "Mission loop started"
|
|
36811
|
+
});
|
|
36812
|
+
syncMissionMemory(directory, state2);
|
|
36592
36813
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Loop started`, {
|
|
36593
36814
|
sessionID,
|
|
36594
36815
|
maxIterations: state2.maxIterations
|
|
@@ -36603,6 +36824,19 @@ function cancelMissionLoop(directory, sessionID) {
|
|
|
36603
36824
|
}
|
|
36604
36825
|
const success3 = clearLoopState(directory);
|
|
36605
36826
|
if (success3) {
|
|
36827
|
+
const cancelledState = {
|
|
36828
|
+
...state2,
|
|
36829
|
+
active: false,
|
|
36830
|
+
lastContinuationReason: "cancelled"
|
|
36831
|
+
};
|
|
36832
|
+
appendMissionLedgerEvent(directory, {
|
|
36833
|
+
type: "mission_cancelled",
|
|
36834
|
+
sessionID,
|
|
36835
|
+
iteration: state2.iteration,
|
|
36836
|
+
objective: state2.objective,
|
|
36837
|
+
reason: "cancelled"
|
|
36838
|
+
});
|
|
36839
|
+
syncMissionMemory(directory, cancelledState);
|
|
36606
36840
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Loop cancelled`, { sessionID, iteration: state2.iteration });
|
|
36607
36841
|
}
|
|
36608
36842
|
return success3;
|
|
@@ -36611,26 +36845,48 @@ function isLoopActive(directory, sessionID) {
|
|
|
36611
36845
|
const state2 = readLoopState(directory);
|
|
36612
36846
|
return state2?.active === true && state2?.sessionID === sessionID;
|
|
36613
36847
|
}
|
|
36614
|
-
function generateMissionContinuationPrompt(state2,
|
|
36615
|
-
const
|
|
36616
|
-
[Verification Status]: ${verificationSummary}
|
|
36617
|
-
` : "";
|
|
36848
|
+
function generateMissionContinuationPrompt(state2, input) {
|
|
36849
|
+
const context = normalizeContinuationContext(state2, input);
|
|
36618
36850
|
let prompt = `${CONTINUE_INSTRUCTION}
|
|
36619
36851
|
|
|
36620
36852
|
<mission_loop iteration="${state2.iteration}" max="${state2.maxIterations}">
|
|
36621
|
-
|
|
36622
|
-
|
|
36853
|
+
MISSION NOT COMPLETE
|
|
36854
|
+
|
|
36855
|
+
Objective:
|
|
36856
|
+
${context.objective}
|
|
36623
36857
|
|
|
36624
|
-
|
|
36625
|
-
${
|
|
36858
|
+
Runtime status:
|
|
36859
|
+
- todo progress: ${context.progress}
|
|
36860
|
+
- verification: ${context.verification}
|
|
36861
|
+
- stagnation: ${context.stagnation}
|
|
36862
|
+
- continuation reason: ${context.reason}
|
|
36626
36863
|
|
|
36627
|
-
|
|
36864
|
+
Next action:
|
|
36865
|
+
1. Read the current TODO, checklist, and sync issue state.
|
|
36866
|
+
2. Execute or delegate only the next unblocked work.
|
|
36867
|
+
3. Verify the result with real file reads, build commands, tests, or tool output.
|
|
36868
|
+
4. Finish only when mission verification passes.
|
|
36869
|
+
|
|
36870
|
+
Completion rule:
|
|
36871
|
+
Do not declare success while TODO/checklist/sync verification is still failing.
|
|
36628
36872
|
</mission_loop>`;
|
|
36629
36873
|
if (state2.iteration > 1) {
|
|
36630
36874
|
prompt += "\n" + CLEANUP_INSTRUCTION.replace("%ITER%", state2.iteration.toString());
|
|
36631
36875
|
}
|
|
36632
36876
|
return prompt;
|
|
36633
36877
|
}
|
|
36878
|
+
function normalizeContinuationContext(state2, input) {
|
|
36879
|
+
const verificationSummary = typeof input === "string" ? input : input?.verificationSummary;
|
|
36880
|
+
const continuationReason = typeof input === "string" ? void 0 : input?.continuationReason;
|
|
36881
|
+
const stagnationCount = state2.stagnationCount ?? 0;
|
|
36882
|
+
return {
|
|
36883
|
+
objective: state2.objective || deriveObjective(state2.prompt),
|
|
36884
|
+
progress: state2.lastProgress ?? UNKNOWN_STATUS,
|
|
36885
|
+
verification: verificationSummary ?? state2.lastVerificationSummary ?? UNKNOWN_STATUS,
|
|
36886
|
+
reason: continuationReason ?? state2.lastContinuationReason ?? "verification_failed",
|
|
36887
|
+
stagnation: stagnationCount > 0 ? `${stagnationCount} unchanged check(s)` : "not detected"
|
|
36888
|
+
};
|
|
36889
|
+
}
|
|
36634
36890
|
|
|
36635
36891
|
// src/core/orchestrator/session-manager.ts
|
|
36636
36892
|
function ensureSessionInitialized(sessions, sessionID, directory) {
|
|
@@ -36643,6 +36899,9 @@ function ensureSessionInitialized(sessions, sessionID, directory) {
|
|
|
36643
36899
|
startTime: now,
|
|
36644
36900
|
lastStepTime: now,
|
|
36645
36901
|
lastCompletedMessageID: void 0,
|
|
36902
|
+
lastUserMessageAt: void 0,
|
|
36903
|
+
lastAssistantCompletedAt: void 0,
|
|
36904
|
+
lastAbortAt: void 0,
|
|
36646
36905
|
tokens: { totalInput: 0, totalOutput: 0, estimatedCost: 0 }
|
|
36647
36906
|
};
|
|
36648
36907
|
if (directory) {
|
|
@@ -36697,6 +36956,14 @@ function isMissionActive(sessionID, directory) {
|
|
|
36697
36956
|
}
|
|
36698
36957
|
return false;
|
|
36699
36958
|
}
|
|
36959
|
+
function deactivateMissionState(sessionID) {
|
|
36960
|
+
const stateSession = state.sessions.get(sessionID);
|
|
36961
|
+
if (stateSession) {
|
|
36962
|
+
stateSession.enabled = false;
|
|
36963
|
+
}
|
|
36964
|
+
state.missionActive = false;
|
|
36965
|
+
log(`[SessionManager] Mission Deactivated: ${sessionID}`);
|
|
36966
|
+
}
|
|
36700
36967
|
var COST_PER_1K_INPUT = 3e-3;
|
|
36701
36968
|
var COST_PER_1K_OUTPUT = 0.015;
|
|
36702
36969
|
function updateSessionTokens(sessions, sessionID, inputLen, outputLen) {
|
|
@@ -36954,8 +37221,8 @@ ${commandList}`;
|
|
|
36954
37221
|
// src/core/loop/verification.ts
|
|
36955
37222
|
init_shared();
|
|
36956
37223
|
init_logger();
|
|
36957
|
-
import { existsSync as
|
|
36958
|
-
import { join as
|
|
37224
|
+
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
37225
|
+
import { join as join7 } from "node:path";
|
|
36959
37226
|
var CHECKLIST_FILE = CHECKLIST.FILE;
|
|
36960
37227
|
function parseChecklistLine(line, currentCategory) {
|
|
36961
37228
|
const trimmedLine = line.trim();
|
|
@@ -37020,12 +37287,12 @@ function parseChecklist(content) {
|
|
|
37020
37287
|
return items;
|
|
37021
37288
|
}
|
|
37022
37289
|
function readChecklist(directory) {
|
|
37023
|
-
const filePath =
|
|
37024
|
-
if (!
|
|
37290
|
+
const filePath = join7(directory, CHECKLIST_FILE);
|
|
37291
|
+
if (!existsSync4(filePath)) {
|
|
37025
37292
|
return [];
|
|
37026
37293
|
}
|
|
37027
37294
|
try {
|
|
37028
|
-
const content =
|
|
37295
|
+
const content = readFileSync3(filePath, "utf-8");
|
|
37029
37296
|
return parseChecklist(content);
|
|
37030
37297
|
} catch (error95) {
|
|
37031
37298
|
log(`[checklist] Failed to read checklist: ${error95}`);
|
|
@@ -37042,8 +37309,8 @@ function verifyChecklist(directory) {
|
|
|
37042
37309
|
incompleteList: [],
|
|
37043
37310
|
errors: []
|
|
37044
37311
|
};
|
|
37045
|
-
const filePath =
|
|
37046
|
-
if (!
|
|
37312
|
+
const filePath = join7(directory, CHECKLIST_FILE);
|
|
37313
|
+
if (!existsSync4(filePath)) {
|
|
37047
37314
|
result.errors.push(`Verification checklist not found at ${CHECKLIST_FILE}`);
|
|
37048
37315
|
result.errors.push("Create checklist with at least: build, tests, and any environment-specific checks");
|
|
37049
37316
|
return result;
|
|
@@ -37119,10 +37386,10 @@ function verifyMissionCompletion(directory) {
|
|
|
37119
37386
|
result.errors.push(` ... and ${checklistResult.incompleteList.length - 5} more`);
|
|
37120
37387
|
}
|
|
37121
37388
|
}
|
|
37122
|
-
const todoPath =
|
|
37123
|
-
if (
|
|
37389
|
+
const todoPath = join7(directory, PATHS.TODO);
|
|
37390
|
+
if (existsSync4(todoPath)) {
|
|
37124
37391
|
try {
|
|
37125
|
-
const content =
|
|
37392
|
+
const content = readFileSync3(todoPath, "utf-8");
|
|
37126
37393
|
const incompleteCount = countMatches(content, TODO_INCOMPLETE_PATTERN);
|
|
37127
37394
|
const completeCount = countMatches(content, TODO_COMPLETE_PATTERN);
|
|
37128
37395
|
const total = incompleteCount + completeCount;
|
|
@@ -37144,10 +37411,10 @@ function verifyMissionCompletion(directory) {
|
|
|
37144
37411
|
} else if (!hasChecklist) {
|
|
37145
37412
|
result.errors.push(`TODO file not found at ${PATHS.TODO}`);
|
|
37146
37413
|
}
|
|
37147
|
-
const syncPath =
|
|
37148
|
-
if (
|
|
37414
|
+
const syncPath = join7(directory, PATHS.SYNC_ISSUES);
|
|
37415
|
+
if (existsSync4(syncPath)) {
|
|
37149
37416
|
try {
|
|
37150
|
-
const content =
|
|
37417
|
+
const content = readFileSync3(syncPath, "utf-8");
|
|
37151
37418
|
result.syncIssuesEmpty = !hasRealSyncIssues(content);
|
|
37152
37419
|
if (!result.syncIssuesEmpty) {
|
|
37153
37420
|
const issueLines = content.split("\n").filter(
|
|
@@ -37235,7 +37502,7 @@ function buildVerificationSummary(result) {
|
|
|
37235
37502
|
init_logger();
|
|
37236
37503
|
import { exec as exec2 } from "node:child_process";
|
|
37237
37504
|
import { promisify as promisify2 } from "node:util";
|
|
37238
|
-
import { readFileSync as
|
|
37505
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
37239
37506
|
|
|
37240
37507
|
// src/shared/notification/os-notify/constants/notification-commands.ts
|
|
37241
37508
|
var NOTIFICATION_COMMANDS = {
|
|
@@ -37313,7 +37580,7 @@ async function notifyDarwin(title, message) {
|
|
|
37313
37580
|
function isWSL() {
|
|
37314
37581
|
try {
|
|
37315
37582
|
if (process.env.WSL_DISTRO_NAME || process.env.WSLENV) return true;
|
|
37316
|
-
const procVersion =
|
|
37583
|
+
const procVersion = readFileSync4("/proc/version", "utf-8");
|
|
37317
37584
|
return /microsoft|WSL/i.test(procVersion);
|
|
37318
37585
|
} catch {
|
|
37319
37586
|
return false;
|
|
@@ -37459,7 +37726,12 @@ var MissionControlHook = class {
|
|
|
37459
37726
|
// -------------------------------------------------------------------------------
|
|
37460
37727
|
async handleChatCommand(ctx, message) {
|
|
37461
37728
|
const parsed = detectSlashCommand(message);
|
|
37462
|
-
if (!parsed
|
|
37729
|
+
if (!parsed) return null;
|
|
37730
|
+
if (parsed.command === COMMAND_NAMES.CANCEL || parsed.command === COMMAND_NAMES.STOP) {
|
|
37731
|
+
await this.cancelMission(ctx);
|
|
37732
|
+
return { action: HOOK_ACTIONS.INTERCEPT };
|
|
37733
|
+
}
|
|
37734
|
+
if (parsed.command !== COMMAND_NAMES.TASK) return null;
|
|
37463
37735
|
const command = COMMANDS[parsed.command];
|
|
37464
37736
|
const { sessionID, sessions, directory } = ctx;
|
|
37465
37737
|
log(MISSION_MESSAGES.START_LOG);
|
|
@@ -37477,6 +37749,17 @@ var MissionControlHook = class {
|
|
|
37477
37749
|
}
|
|
37478
37750
|
return { action: HOOK_ACTIONS.PROCESS };
|
|
37479
37751
|
}
|
|
37752
|
+
async cancelMission(ctx) {
|
|
37753
|
+
const { sessionID, sessions, directory } = ctx;
|
|
37754
|
+
log(MISSION_MESSAGES.CANCEL_LOG);
|
|
37755
|
+
await cancelMissionLoop(directory, sessionID);
|
|
37756
|
+
deactivateMissionState(sessionID);
|
|
37757
|
+
clearSession2(sessionID);
|
|
37758
|
+
const session = sessions.get(sessionID);
|
|
37759
|
+
if (isRecord(session)) {
|
|
37760
|
+
session.active = false;
|
|
37761
|
+
}
|
|
37762
|
+
}
|
|
37480
37763
|
// -------------------------------------------------------------------------------
|
|
37481
37764
|
// 2. Done Logic: Check Completion & Auto-Continue
|
|
37482
37765
|
// -------------------------------------------------------------------------------
|
|
@@ -37529,6 +37812,9 @@ var MissionControlHook = class {
|
|
|
37529
37812
|
// 4. Helper: Build Continuation Response
|
|
37530
37813
|
// -------------------------------------------------------------------------------
|
|
37531
37814
|
buildContinuationResponse(session, sessionID) {
|
|
37815
|
+
if (!isMissionSessionState(session)) {
|
|
37816
|
+
return { action: HOOK_ACTIONS.CONTINUE };
|
|
37817
|
+
}
|
|
37532
37818
|
const now = Date.now();
|
|
37533
37819
|
const stepDuration = formatElapsedTime(session.lastStepTime, now);
|
|
37534
37820
|
const totalElapsed = formatElapsedTime(session.startTime, now);
|
|
@@ -37586,6 +37872,12 @@ var MissionControlHook = class {
|
|
|
37586
37872
|
}
|
|
37587
37873
|
}
|
|
37588
37874
|
};
|
|
37875
|
+
function isRecord(value) {
|
|
37876
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
37877
|
+
}
|
|
37878
|
+
function isMissionSessionState(value) {
|
|
37879
|
+
return isRecord(value) && typeof value.step === "number" && typeof value.startTime === "number" && typeof value.lastStepTime === "number";
|
|
37880
|
+
}
|
|
37589
37881
|
|
|
37590
37882
|
// src/hooks/custom/strict-role-guard.ts
|
|
37591
37883
|
init_shared();
|
|
@@ -38304,6 +38596,13 @@ function handleSessionError2(sessionID, error95) {
|
|
|
38304
38596
|
}
|
|
38305
38597
|
cancelCountdown(sessionID);
|
|
38306
38598
|
}
|
|
38599
|
+
function handleAbort(sessionID) {
|
|
38600
|
+
const state2 = getState3(sessionID);
|
|
38601
|
+
state2.isAborting = true;
|
|
38602
|
+
state2.abortDetectedAt = Date.now();
|
|
38603
|
+
cancelCountdown(sessionID);
|
|
38604
|
+
log("[todo-continuation] Marked as aborting", { sessionID });
|
|
38605
|
+
}
|
|
38307
38606
|
function cleanupSession2(sessionID) {
|
|
38308
38607
|
cancelCountdown(sessionID);
|
|
38309
38608
|
sessionStates2.delete(sessionID);
|
|
@@ -38789,9 +39088,9 @@ import * as path6 from "node:path";
|
|
|
38789
39088
|
|
|
38790
39089
|
// src/core/cache/utils.ts
|
|
38791
39090
|
import * as fs6 from "node:fs/promises";
|
|
38792
|
-
import { existsSync as
|
|
39091
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
38793
39092
|
async function ensureCacheDir() {
|
|
38794
|
-
if (!
|
|
39093
|
+
if (!existsSync6(CACHE_DIR)) {
|
|
38795
39094
|
await fs6.mkdir(CACHE_DIR, { recursive: true });
|
|
38796
39095
|
}
|
|
38797
39096
|
}
|
|
@@ -39293,15 +39592,15 @@ var backgroundTaskManager = BackgroundTaskManager.instance;
|
|
|
39293
39592
|
|
|
39294
39593
|
// src/tools/rust-pool.ts
|
|
39295
39594
|
import { spawn as spawn2 } from "child_process";
|
|
39296
|
-
import { existsSync as
|
|
39595
|
+
import { existsSync as existsSync9 } from "fs";
|
|
39297
39596
|
|
|
39298
39597
|
// src/utils/binary.ts
|
|
39299
39598
|
init_shared();
|
|
39300
|
-
import { join as
|
|
39599
|
+
import { join as join12, dirname as dirname5 } from "path";
|
|
39301
39600
|
import { fileURLToPath } from "url";
|
|
39302
39601
|
import { platform, arch } from "os";
|
|
39303
|
-
import { existsSync as
|
|
39304
|
-
var __dirname =
|
|
39602
|
+
import { existsSync as existsSync8 } from "fs";
|
|
39603
|
+
var __dirname = dirname5(fileURLToPath(import.meta.url));
|
|
39305
39604
|
function getPlatformBinaryName(os = platform(), cpu = arch()) {
|
|
39306
39605
|
if (os === PLATFORM.WIN32) {
|
|
39307
39606
|
return "orchestrator-windows-x64.exe";
|
|
@@ -39313,30 +39612,30 @@ function getPlatformBinaryName(os = platform(), cpu = arch()) {
|
|
|
39313
39612
|
}
|
|
39314
39613
|
function getCandidateBinDirs(moduleDir = __dirname) {
|
|
39315
39614
|
return [
|
|
39316
|
-
|
|
39317
|
-
|
|
39615
|
+
join12(moduleDir, "..", "bin"),
|
|
39616
|
+
join12(moduleDir, "..", "..", "bin")
|
|
39318
39617
|
];
|
|
39319
39618
|
}
|
|
39320
39619
|
function resolveBinaryPath(options = {}) {
|
|
39321
39620
|
const moduleDir = options.moduleDir ?? __dirname;
|
|
39322
39621
|
const os = options.os ?? platform();
|
|
39323
39622
|
const cpu = options.cpu ?? arch();
|
|
39324
|
-
const exists = options.exists ??
|
|
39623
|
+
const exists = options.exists ?? existsSync8;
|
|
39325
39624
|
const binaryName = getPlatformBinaryName(os, cpu);
|
|
39326
39625
|
for (const binDir of getCandidateBinDirs(moduleDir)) {
|
|
39327
|
-
const binaryPath =
|
|
39626
|
+
const binaryPath = join12(binDir, binaryName);
|
|
39328
39627
|
if (exists(binaryPath)) {
|
|
39329
39628
|
return binaryPath;
|
|
39330
39629
|
}
|
|
39331
39630
|
}
|
|
39332
39631
|
const fallbackName = os === PLATFORM.WIN32 ? "orchestrator.exe" : "orchestrator";
|
|
39333
39632
|
for (const binDir of getCandidateBinDirs(moduleDir)) {
|
|
39334
|
-
const fallbackPath =
|
|
39633
|
+
const fallbackPath = join12(binDir, fallbackName);
|
|
39335
39634
|
if (exists(fallbackPath)) {
|
|
39336
39635
|
return fallbackPath;
|
|
39337
39636
|
}
|
|
39338
39637
|
}
|
|
39339
|
-
return
|
|
39638
|
+
return join12(getCandidateBinDirs(moduleDir)[0], binaryName);
|
|
39340
39639
|
}
|
|
39341
39640
|
function getBinaryPath() {
|
|
39342
39641
|
return resolveBinaryPath();
|
|
@@ -39350,10 +39649,21 @@ var RustToolPool = class {
|
|
|
39350
39649
|
maxSize = 4;
|
|
39351
39650
|
idleTimeout = 3e4;
|
|
39352
39651
|
// 30 seconds
|
|
39652
|
+
processReadyDelay = 100;
|
|
39653
|
+
requestTimeout = 6e4;
|
|
39353
39654
|
cleanupInterval = null;
|
|
39655
|
+
binaryPath;
|
|
39656
|
+
exists;
|
|
39657
|
+
spawnProcess;
|
|
39354
39658
|
shuttingDown = false;
|
|
39355
|
-
constructor(maxSize = 4) {
|
|
39659
|
+
constructor(maxSize = 4, options = {}) {
|
|
39356
39660
|
this.maxSize = maxSize;
|
|
39661
|
+
this.binaryPath = options.binaryPath ?? getBinaryPath;
|
|
39662
|
+
this.exists = options.exists ?? existsSync9;
|
|
39663
|
+
this.idleTimeout = options.idleTimeoutMs ?? this.idleTimeout;
|
|
39664
|
+
this.processReadyDelay = options.processReadyDelayMs ?? this.processReadyDelay;
|
|
39665
|
+
this.requestTimeout = options.requestTimeoutMs ?? this.requestTimeout;
|
|
39666
|
+
this.spawnProcess = options.spawnProcess ?? spawn2;
|
|
39357
39667
|
this.startCleanupTimer();
|
|
39358
39668
|
}
|
|
39359
39669
|
/**
|
|
@@ -39363,16 +39673,13 @@ var RustToolPool = class {
|
|
|
39363
39673
|
if (this.shuttingDown) {
|
|
39364
39674
|
throw new Error("Pool is shutting down");
|
|
39365
39675
|
}
|
|
39366
|
-
const binary =
|
|
39367
|
-
if (!
|
|
39676
|
+
const binary = this.binaryPath();
|
|
39677
|
+
if (!this.exists(binary)) {
|
|
39368
39678
|
return JSON.stringify({ error: `Binary not found: ${binary}` });
|
|
39369
39679
|
}
|
|
39370
39680
|
let pooled = this.getAvailable();
|
|
39371
|
-
if (!pooled && this.processes.length < this.maxSize) {
|
|
39372
|
-
pooled = await this.createProcess(binary);
|
|
39373
|
-
}
|
|
39374
39681
|
if (!pooled) {
|
|
39375
|
-
pooled = await this.
|
|
39682
|
+
pooled = await this.createOrWaitForProcess(binary);
|
|
39376
39683
|
}
|
|
39377
39684
|
try {
|
|
39378
39685
|
return await this.sendRequest(pooled, name, args);
|
|
@@ -39387,15 +39694,29 @@ var RustToolPool = class {
|
|
|
39387
39694
|
return this.processes.find((p) => !p.busy) || null;
|
|
39388
39695
|
}
|
|
39389
39696
|
/**
|
|
39390
|
-
*
|
|
39697
|
+
* Create a process immediately, or wait until one is available/capacity opens.
|
|
39698
|
+
*/
|
|
39699
|
+
async createOrWaitForProcess(binary) {
|
|
39700
|
+
if (this.processes.length < this.maxSize) {
|
|
39701
|
+
return this.createProcess(binary);
|
|
39702
|
+
}
|
|
39703
|
+
return this.waitForAvailable(binary);
|
|
39704
|
+
}
|
|
39705
|
+
/**
|
|
39706
|
+
* Wait for a process to become available, or create one if capacity opens.
|
|
39391
39707
|
*/
|
|
39392
|
-
async waitForAvailable() {
|
|
39393
|
-
return new Promise((resolve) => {
|
|
39708
|
+
async waitForAvailable(binary) {
|
|
39709
|
+
return new Promise((resolve, reject) => {
|
|
39394
39710
|
const interval = setInterval(() => {
|
|
39395
39711
|
const available = this.getAvailable();
|
|
39396
39712
|
if (available) {
|
|
39397
39713
|
clearInterval(interval);
|
|
39398
39714
|
resolve(available);
|
|
39715
|
+
return;
|
|
39716
|
+
}
|
|
39717
|
+
if (this.processes.length < this.maxSize) {
|
|
39718
|
+
clearInterval(interval);
|
|
39719
|
+
this.createProcess(binary).then(resolve, reject);
|
|
39399
39720
|
}
|
|
39400
39721
|
}, 10);
|
|
39401
39722
|
});
|
|
@@ -39405,41 +39726,47 @@ var RustToolPool = class {
|
|
|
39405
39726
|
*/
|
|
39406
39727
|
async createProcess(binary) {
|
|
39407
39728
|
return new Promise((resolve, reject) => {
|
|
39408
|
-
const proc =
|
|
39729
|
+
const proc = this.spawnProcess(binary, ["serve"], {
|
|
39409
39730
|
stdio: ["pipe", "pipe", "pipe"],
|
|
39410
39731
|
detached: false
|
|
39411
39732
|
});
|
|
39412
|
-
let
|
|
39733
|
+
let startupSettled = false;
|
|
39734
|
+
let readyTimer = null;
|
|
39413
39735
|
const pooled = {
|
|
39414
39736
|
proc,
|
|
39415
|
-
busy:
|
|
39737
|
+
busy: true,
|
|
39738
|
+
destroyed: false,
|
|
39416
39739
|
lastUsed: Date.now(),
|
|
39417
39740
|
requestId: 0,
|
|
39418
39741
|
stdout: ""
|
|
39419
39742
|
};
|
|
39420
|
-
|
|
39421
|
-
|
|
39422
|
-
|
|
39423
|
-
started = true;
|
|
39743
|
+
const settleStartup = (callback) => {
|
|
39744
|
+
if (startupSettled) {
|
|
39745
|
+
return;
|
|
39424
39746
|
}
|
|
39425
|
-
|
|
39426
|
-
|
|
39427
|
-
|
|
39428
|
-
|
|
39429
|
-
this.processes.splice(index, 1);
|
|
39747
|
+
startupSettled = true;
|
|
39748
|
+
if (readyTimer) {
|
|
39749
|
+
clearTimeout(readyTimer);
|
|
39750
|
+
readyTimer = null;
|
|
39430
39751
|
}
|
|
39752
|
+
callback();
|
|
39753
|
+
};
|
|
39754
|
+
proc.on("close", () => {
|
|
39755
|
+
const error95 = new Error("Rust tool process closed before completing request");
|
|
39756
|
+
settleStartup(() => reject(error95));
|
|
39757
|
+
pooled.pendingReject?.(error95);
|
|
39758
|
+
this.removeProcess(pooled, false);
|
|
39431
39759
|
});
|
|
39432
39760
|
proc.on("error", (err) => {
|
|
39433
|
-
const
|
|
39434
|
-
|
|
39435
|
-
|
|
39436
|
-
|
|
39437
|
-
if (!started) {
|
|
39438
|
-
reject(err);
|
|
39439
|
-
}
|
|
39761
|
+
const error95 = err instanceof Error ? err : new Error(String(err));
|
|
39762
|
+
settleStartup(() => reject(error95));
|
|
39763
|
+
pooled.pendingReject?.(error95);
|
|
39764
|
+
this.removeProcess(pooled, false);
|
|
39440
39765
|
});
|
|
39441
39766
|
this.processes.push(pooled);
|
|
39442
|
-
setTimeout(() =>
|
|
39767
|
+
readyTimer = setTimeout(() => {
|
|
39768
|
+
settleStartup(() => resolve(pooled));
|
|
39769
|
+
}, this.processReadyDelay);
|
|
39443
39770
|
});
|
|
39444
39771
|
}
|
|
39445
39772
|
/**
|
|
@@ -39449,13 +39776,39 @@ var RustToolPool = class {
|
|
|
39449
39776
|
pooled.busy = true;
|
|
39450
39777
|
pooled.lastUsed = Date.now();
|
|
39451
39778
|
pooled.stdout = "";
|
|
39779
|
+
if (pooled.destroyed || !this.processes.includes(pooled)) {
|
|
39780
|
+
throw new Error("Rust tool process is unavailable");
|
|
39781
|
+
}
|
|
39452
39782
|
return new Promise((resolve, reject) => {
|
|
39453
39783
|
const requestId = ++pooled.requestId;
|
|
39784
|
+
let settled = false;
|
|
39785
|
+
const fail = (error95, kill) => {
|
|
39786
|
+
if (settled) {
|
|
39787
|
+
return;
|
|
39788
|
+
}
|
|
39789
|
+
settled = true;
|
|
39790
|
+
cleanup();
|
|
39791
|
+
this.removeProcess(pooled, kill);
|
|
39792
|
+
reject(error95);
|
|
39793
|
+
};
|
|
39794
|
+
const succeed = (text) => {
|
|
39795
|
+
if (settled) {
|
|
39796
|
+
return;
|
|
39797
|
+
}
|
|
39798
|
+
settled = true;
|
|
39799
|
+
cleanup();
|
|
39800
|
+
resolve(text);
|
|
39801
|
+
};
|
|
39454
39802
|
const timeout = setTimeout(() => {
|
|
39803
|
+
fail(new Error("Request timeout"), true);
|
|
39804
|
+
}, this.requestTimeout);
|
|
39805
|
+
const cleanup = () => {
|
|
39806
|
+
clearTimeout(timeout);
|
|
39455
39807
|
pooled.pendingResolve = void 0;
|
|
39456
39808
|
pooled.pendingReject = void 0;
|
|
39457
|
-
|
|
39458
|
-
|
|
39809
|
+
pooled.pendingCleanup = void 0;
|
|
39810
|
+
pooled.proc.stdout?.removeListener("data", onData);
|
|
39811
|
+
};
|
|
39459
39812
|
const onData = (data) => {
|
|
39460
39813
|
pooled.stdout += data.toString();
|
|
39461
39814
|
const lines = pooled.stdout.trim().split("\n");
|
|
@@ -39463,10 +39816,8 @@ var RustToolPool = class {
|
|
|
39463
39816
|
try {
|
|
39464
39817
|
const response = JSON.parse(lines[i]);
|
|
39465
39818
|
if (response.id === requestId && (response.result || response.error)) {
|
|
39466
|
-
clearTimeout(timeout);
|
|
39467
|
-
pooled.proc.stdout?.removeListener("data", onData);
|
|
39468
39819
|
const text = response?.result?.content?.[0]?.text;
|
|
39469
|
-
|
|
39820
|
+
succeed(text || JSON.stringify(response.result));
|
|
39470
39821
|
return;
|
|
39471
39822
|
}
|
|
39472
39823
|
} catch {
|
|
@@ -39474,6 +39825,8 @@ var RustToolPool = class {
|
|
|
39474
39825
|
}
|
|
39475
39826
|
}
|
|
39476
39827
|
};
|
|
39828
|
+
pooled.pendingReject = (error95) => fail(error95, false);
|
|
39829
|
+
pooled.pendingCleanup = cleanup;
|
|
39477
39830
|
pooled.proc.stdout?.on("data", onData);
|
|
39478
39831
|
const request = JSON.stringify({
|
|
39479
39832
|
jsonrpc: "2.0",
|
|
@@ -39482,11 +39835,13 @@ var RustToolPool = class {
|
|
|
39482
39835
|
params: { name, arguments: args }
|
|
39483
39836
|
});
|
|
39484
39837
|
try {
|
|
39485
|
-
pooled.proc.stdin?.write(request + "\n");
|
|
39838
|
+
const written = pooled.proc.stdin?.write(request + "\n");
|
|
39839
|
+
if (written === false || written === void 0) {
|
|
39840
|
+
fail(new Error("Failed to write request to Rust tool process"), true);
|
|
39841
|
+
}
|
|
39486
39842
|
} catch (err) {
|
|
39487
|
-
|
|
39488
|
-
|
|
39489
|
-
reject(err);
|
|
39843
|
+
const error95 = err instanceof Error ? err : new Error(String(err));
|
|
39844
|
+
fail(error95, true);
|
|
39490
39845
|
}
|
|
39491
39846
|
});
|
|
39492
39847
|
}
|
|
@@ -39494,9 +39849,29 @@ var RustToolPool = class {
|
|
|
39494
39849
|
* Release a process back to the pool
|
|
39495
39850
|
*/
|
|
39496
39851
|
release(pooled) {
|
|
39852
|
+
if (pooled.destroyed || !this.processes.includes(pooled)) {
|
|
39853
|
+
return;
|
|
39854
|
+
}
|
|
39497
39855
|
pooled.busy = false;
|
|
39498
39856
|
pooled.lastUsed = Date.now();
|
|
39499
39857
|
}
|
|
39858
|
+
/**
|
|
39859
|
+
* Remove a process from the pool, optionally terminating it first.
|
|
39860
|
+
*/
|
|
39861
|
+
removeProcess(pooled, kill) {
|
|
39862
|
+
pooled.destroyed = true;
|
|
39863
|
+
pooled.pendingCleanup?.();
|
|
39864
|
+
if (kill) {
|
|
39865
|
+
try {
|
|
39866
|
+
pooled.proc.kill();
|
|
39867
|
+
} catch {
|
|
39868
|
+
}
|
|
39869
|
+
}
|
|
39870
|
+
const index = this.processes.indexOf(pooled);
|
|
39871
|
+
if (index !== -1) {
|
|
39872
|
+
this.processes.splice(index, 1);
|
|
39873
|
+
}
|
|
39874
|
+
}
|
|
39500
39875
|
/**
|
|
39501
39876
|
* Start cleanup timer for idle processes
|
|
39502
39877
|
*/
|
|
@@ -39510,14 +39885,7 @@ var RustToolPool = class {
|
|
|
39510
39885
|
}
|
|
39511
39886
|
}
|
|
39512
39887
|
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
|
-
}
|
|
39888
|
+
this.removeProcess(pooled, true);
|
|
39521
39889
|
}
|
|
39522
39890
|
if (toRemove.length > 0) {
|
|
39523
39891
|
log(`[${LOG_PREFIX.RUST_POOL}] Cleaned up ${toRemove.length} idle processes`);
|
|
@@ -39534,11 +39902,8 @@ var RustToolPool = class {
|
|
|
39534
39902
|
clearInterval(this.cleanupInterval);
|
|
39535
39903
|
this.cleanupInterval = null;
|
|
39536
39904
|
}
|
|
39537
|
-
for (const pooled of this.processes) {
|
|
39538
|
-
|
|
39539
|
-
pooled.proc.kill();
|
|
39540
|
-
} catch {
|
|
39541
|
-
}
|
|
39905
|
+
for (const pooled of [...this.processes]) {
|
|
39906
|
+
this.removeProcess(pooled, true);
|
|
39542
39907
|
}
|
|
39543
39908
|
this.processes = [];
|
|
39544
39909
|
log(`[${LOG_PREFIX.RUST_POOL}] Shutdown complete`);
|
|
@@ -39556,18 +39921,39 @@ var RustToolPool = class {
|
|
|
39556
39921
|
}
|
|
39557
39922
|
};
|
|
39558
39923
|
var globalPool = null;
|
|
39924
|
+
var resetInFlight = null;
|
|
39559
39925
|
function getRustToolPool() {
|
|
39560
39926
|
if (!globalPool) {
|
|
39561
39927
|
globalPool = new RustToolPool();
|
|
39562
39928
|
}
|
|
39563
39929
|
return globalPool;
|
|
39564
39930
|
}
|
|
39565
|
-
async function
|
|
39566
|
-
|
|
39567
|
-
await
|
|
39931
|
+
async function resetRustToolPool(reason = "manual reset", expectedPool) {
|
|
39932
|
+
while (resetInFlight) {
|
|
39933
|
+
await resetInFlight;
|
|
39934
|
+
}
|
|
39935
|
+
const poolToReset = globalPool;
|
|
39936
|
+
if (!poolToReset) {
|
|
39937
|
+
return;
|
|
39938
|
+
}
|
|
39939
|
+
if (expectedPool && poolToReset !== expectedPool) {
|
|
39940
|
+
log(`[${LOG_PREFIX.RUST_POOL}] Skipped reset for stale pool: ${reason}`);
|
|
39941
|
+
return;
|
|
39942
|
+
}
|
|
39943
|
+
resetInFlight = (async () => {
|
|
39568
39944
|
globalPool = null;
|
|
39945
|
+
log(`[${LOG_PREFIX.RUST_POOL}] Resetting global pool: ${reason}`);
|
|
39946
|
+
await poolToReset.shutdown();
|
|
39947
|
+
})();
|
|
39948
|
+
try {
|
|
39949
|
+
await resetInFlight;
|
|
39950
|
+
} finally {
|
|
39951
|
+
resetInFlight = null;
|
|
39569
39952
|
}
|
|
39570
39953
|
}
|
|
39954
|
+
async function shutdownRustToolPool() {
|
|
39955
|
+
await resetRustToolPool("shutdown");
|
|
39956
|
+
}
|
|
39571
39957
|
|
|
39572
39958
|
// src/tools/callAgent.ts
|
|
39573
39959
|
init_shared();
|
|
@@ -39636,13 +40022,15 @@ ${PROMPT_TAGS.EXECUTION.close}
|
|
|
39636
40022
|
init_logger();
|
|
39637
40023
|
init_shared();
|
|
39638
40024
|
async function callRustTool(name, args) {
|
|
40025
|
+
const pool = getRustToolPool();
|
|
39639
40026
|
try {
|
|
39640
|
-
const pool = getRustToolPool();
|
|
39641
40027
|
return await pool.call(name, args);
|
|
39642
40028
|
} catch (err) {
|
|
39643
|
-
log(`[${LOG_PREFIX.RUST_TOOL}] Pool error: ${err}`);
|
|
39644
|
-
|
|
40029
|
+
log(`[${LOG_PREFIX.RUST_TOOL}] Pool error, resetting and retrying once: ${err}`);
|
|
40030
|
+
await resetRustToolPool(`transport error while calling ${name}`, pool);
|
|
39645
40031
|
}
|
|
40032
|
+
const retryPool = getRustToolPool();
|
|
40033
|
+
return retryPool.call(name, args);
|
|
39646
40034
|
}
|
|
39647
40035
|
|
|
39648
40036
|
// src/tools/search.ts
|
|
@@ -40788,6 +41176,92 @@ function registerAllTools(directory, asyncAgentTools, dynamicTools) {
|
|
|
40788
41176
|
// src/index.ts
|
|
40789
41177
|
init_shared();
|
|
40790
41178
|
|
|
41179
|
+
// src/core/agents/concurrency-config.ts
|
|
41180
|
+
var CONCURRENCY_KEYS = [
|
|
41181
|
+
"defaultConcurrency",
|
|
41182
|
+
"agentConcurrency",
|
|
41183
|
+
"providerConcurrency",
|
|
41184
|
+
"modelConcurrency"
|
|
41185
|
+
];
|
|
41186
|
+
function isRecord2(value) {
|
|
41187
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41188
|
+
}
|
|
41189
|
+
function readLimitMap(value) {
|
|
41190
|
+
if (!isRecord2(value)) return void 0;
|
|
41191
|
+
const result = {};
|
|
41192
|
+
for (const [key, limit] of Object.entries(value)) {
|
|
41193
|
+
if (typeof limit === "number" && Number.isFinite(limit) && limit >= 0) {
|
|
41194
|
+
result[key] = limit;
|
|
41195
|
+
}
|
|
41196
|
+
}
|
|
41197
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
41198
|
+
}
|
|
41199
|
+
function extractConcurrencyConfig(source) {
|
|
41200
|
+
if (!isRecord2(source)) return {};
|
|
41201
|
+
const config3 = {};
|
|
41202
|
+
if (typeof source.defaultConcurrency === "number" && source.defaultConcurrency >= 0) {
|
|
41203
|
+
config3.defaultConcurrency = source.defaultConcurrency;
|
|
41204
|
+
}
|
|
41205
|
+
const agentConcurrency = readLimitMap(source.agentConcurrency);
|
|
41206
|
+
if (agentConcurrency) config3.agentConcurrency = agentConcurrency;
|
|
41207
|
+
const providerConcurrency = readLimitMap(source.providerConcurrency);
|
|
41208
|
+
if (providerConcurrency) config3.providerConcurrency = providerConcurrency;
|
|
41209
|
+
const modelConcurrency = readLimitMap(source.modelConcurrency);
|
|
41210
|
+
if (modelConcurrency) config3.modelConcurrency = modelConcurrency;
|
|
41211
|
+
return config3;
|
|
41212
|
+
}
|
|
41213
|
+
function hasConcurrencyConfig(source) {
|
|
41214
|
+
if (!isRecord2(source)) return false;
|
|
41215
|
+
return CONCURRENCY_KEYS.some((key) => source[key] !== void 0);
|
|
41216
|
+
}
|
|
41217
|
+
function mergeConcurrencyConfig(base, override) {
|
|
41218
|
+
return {
|
|
41219
|
+
...base,
|
|
41220
|
+
...override,
|
|
41221
|
+
agentConcurrency: {
|
|
41222
|
+
...base.agentConcurrency,
|
|
41223
|
+
...override.agentConcurrency
|
|
41224
|
+
},
|
|
41225
|
+
providerConcurrency: {
|
|
41226
|
+
...base.providerConcurrency,
|
|
41227
|
+
...override.providerConcurrency
|
|
41228
|
+
},
|
|
41229
|
+
modelConcurrency: {
|
|
41230
|
+
...base.modelConcurrency,
|
|
41231
|
+
...override.modelConcurrency
|
|
41232
|
+
}
|
|
41233
|
+
};
|
|
41234
|
+
}
|
|
41235
|
+
|
|
41236
|
+
// src/core/config/plugin-options.ts
|
|
41237
|
+
function parseOrchestratorPluginOptions(options) {
|
|
41238
|
+
const source = isRecord3(options) ? options : {};
|
|
41239
|
+
return {
|
|
41240
|
+
concurrency: extractConcurrencyConfig(source),
|
|
41241
|
+
missionLoop: readMissionLoopOptions(source.missionLoop)
|
|
41242
|
+
};
|
|
41243
|
+
}
|
|
41244
|
+
function readMissionLoopOptions(value) {
|
|
41245
|
+
if (!isRecord3(value)) return DEFAULT_MISSION_RUNTIME_OPTIONS;
|
|
41246
|
+
return {
|
|
41247
|
+
ledger: readBoolean(value.ledger, DEFAULT_MISSION_RUNTIME_OPTIONS.ledger),
|
|
41248
|
+
markdownMemory: readBoolean(value.markdownMemory, DEFAULT_MISSION_RUNTIME_OPTIONS.markdownMemory),
|
|
41249
|
+
maxEvidenceEvents: readPositiveInteger(
|
|
41250
|
+
value.maxEvidenceEvents,
|
|
41251
|
+
DEFAULT_MISSION_RUNTIME_OPTIONS.maxEvidenceEvents
|
|
41252
|
+
)
|
|
41253
|
+
};
|
|
41254
|
+
}
|
|
41255
|
+
function readBoolean(value, fallback) {
|
|
41256
|
+
return typeof value === "boolean" ? value : fallback;
|
|
41257
|
+
}
|
|
41258
|
+
function readPositiveInteger(value, fallback) {
|
|
41259
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : fallback;
|
|
41260
|
+
}
|
|
41261
|
+
function isRecord3(value) {
|
|
41262
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41263
|
+
}
|
|
41264
|
+
|
|
40791
41265
|
// src/plugin-handlers/tool-execute-pre-handler.ts
|
|
40792
41266
|
init_logger();
|
|
40793
41267
|
function createToolExecuteBeforeHandler(ctx) {
|
|
@@ -40831,6 +41305,7 @@ function createChatMessageHandler(ctx) {
|
|
|
40831
41305
|
const sessionID = msgInput.sessionID;
|
|
40832
41306
|
const agentName = (msgInput.agent || "").toLowerCase();
|
|
40833
41307
|
log("[chat-message-handler] hook triggered", { sessionID, agent: agentName, textLength: originalText.length });
|
|
41308
|
+
markUserMessage(sessions, sessionID);
|
|
40834
41309
|
if (sessionID && !sessions.has(sessionID)) {
|
|
40835
41310
|
}
|
|
40836
41311
|
const hooks = HookRegistry.getInstance();
|
|
@@ -40841,6 +41316,7 @@ function createChatMessageHandler(ctx) {
|
|
|
40841
41316
|
};
|
|
40842
41317
|
const hookResult = await hooks.executeChat(hookContext, originalText);
|
|
40843
41318
|
if (hookResult.action === HOOK_ACTIONS.INTERCEPT) {
|
|
41319
|
+
parts.splice(0, parts.length);
|
|
40844
41320
|
return;
|
|
40845
41321
|
}
|
|
40846
41322
|
if (hookResult.modifiedMessage) {
|
|
@@ -40848,6 +41324,11 @@ function createChatMessageHandler(ctx) {
|
|
|
40848
41324
|
}
|
|
40849
41325
|
};
|
|
40850
41326
|
}
|
|
41327
|
+
function markUserMessage(sessions, sessionID) {
|
|
41328
|
+
const session = sessions.get(sessionID);
|
|
41329
|
+
if (!session) return;
|
|
41330
|
+
session.lastUserMessageAt = Date.now();
|
|
41331
|
+
}
|
|
40851
41332
|
|
|
40852
41333
|
// src/plugin-handlers/config-handler.ts
|
|
40853
41334
|
init_shared();
|
|
@@ -40899,8 +41380,41 @@ This plugin runs in "Claude Code Compatibility Mode".
|
|
|
40899
41380
|
}
|
|
40900
41381
|
|
|
40901
41382
|
// src/plugin-handlers/config-handler.ts
|
|
40902
|
-
function
|
|
41383
|
+
function isRecord4(value) {
|
|
41384
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
41385
|
+
}
|
|
41386
|
+
function isPermissionAction(value) {
|
|
41387
|
+
return value === "ask" || value === "allow" || value === "deny";
|
|
41388
|
+
}
|
|
41389
|
+
function mergePermission(globalPermission, agentPermission) {
|
|
41390
|
+
if (agentPermission === void 0) {
|
|
41391
|
+
return globalPermission;
|
|
41392
|
+
}
|
|
41393
|
+
if (isRecord4(globalPermission) && isRecord4(agentPermission)) {
|
|
41394
|
+
return { ...globalPermission, ...agentPermission };
|
|
41395
|
+
}
|
|
41396
|
+
if (isPermissionAction(globalPermission) && isRecord4(agentPermission)) {
|
|
41397
|
+
return { "*": globalPermission, ...agentPermission };
|
|
41398
|
+
}
|
|
41399
|
+
return agentPermission;
|
|
41400
|
+
}
|
|
41401
|
+
function defineAgent(existing, defaults, globalPermission) {
|
|
41402
|
+
const permission = mergePermission(globalPermission, existing?.permission);
|
|
41403
|
+
const agent = {
|
|
41404
|
+
...existing,
|
|
41405
|
+
...defaults
|
|
41406
|
+
};
|
|
41407
|
+
if (permission !== void 0) {
|
|
41408
|
+
agent.permission = permission;
|
|
41409
|
+
}
|
|
41410
|
+
return agent;
|
|
41411
|
+
}
|
|
41412
|
+
function createConfigHandler(options = {}) {
|
|
40903
41413
|
return async (config3) => {
|
|
41414
|
+
const mutableConfig = config3;
|
|
41415
|
+
if (hasConcurrencyConfig(config3)) {
|
|
41416
|
+
options.onConcurrencyConfig?.(extractConcurrencyConfig(config3));
|
|
41417
|
+
}
|
|
40904
41418
|
const claudeRules = findClaudeRules();
|
|
40905
41419
|
const injectRules = (prompt) => {
|
|
40906
41420
|
if (!claudeRules) return prompt;
|
|
@@ -40912,8 +41426,9 @@ ${claudeRules}`;
|
|
|
40912
41426
|
const plannerPrompt = injectRules(AGENTS[AGENT_NAMES.PLANNER]?.systemPrompt || "");
|
|
40913
41427
|
const workerPrompt = injectRules(AGENTS[AGENT_NAMES.WORKER]?.systemPrompt || "");
|
|
40914
41428
|
const reviewerPrompt = injectRules(AGENTS[AGENT_NAMES.REVIEWER]?.systemPrompt || "");
|
|
40915
|
-
const existingCommands =
|
|
40916
|
-
const existingAgents =
|
|
41429
|
+
const existingCommands = mutableConfig.command ?? {};
|
|
41430
|
+
const existingAgents = mutableConfig.agent ?? {};
|
|
41431
|
+
const globalPermission = mutableConfig.permission;
|
|
40917
41432
|
const orchestratorCommands = {};
|
|
40918
41433
|
for (const [name, cmd] of Object.entries(COMMANDS)) {
|
|
40919
41434
|
orchestratorCommands[name] = {
|
|
@@ -40924,39 +41439,34 @@ ${claudeRules}`;
|
|
|
40924
41439
|
}
|
|
40925
41440
|
const orchestratorAgents = {
|
|
40926
41441
|
// Primary agent - the main orchestrator
|
|
40927
|
-
[AGENT_NAMES.COMMANDER]: {
|
|
41442
|
+
[AGENT_NAMES.COMMANDER]: defineAgent(existingAgents[AGENT_NAMES.COMMANDER], {
|
|
40928
41443
|
description: "Autonomous orchestrator - executes until mission complete",
|
|
40929
41444
|
mode: "primary",
|
|
40930
41445
|
prompt: commanderPrompt,
|
|
40931
|
-
maxTokens: AGENT_TOKENS.PRIMARY_MAX_TOKENS,
|
|
40932
|
-
thinking: { type: "enabled", budgetTokens: AGENT_TOKENS.PRIMARY_THINKING_BUDGET },
|
|
40933
41446
|
color: "#ffea98"
|
|
40934
|
-
},
|
|
40935
|
-
// Subagents
|
|
40936
|
-
[AGENT_NAMES.PLANNER]: {
|
|
41447
|
+
}, globalPermission),
|
|
41448
|
+
// Subagents
|
|
41449
|
+
[AGENT_NAMES.PLANNER]: defineAgent(existingAgents[AGENT_NAMES.PLANNER], {
|
|
40937
41450
|
description: "Strategic planning and research specialist",
|
|
40938
41451
|
mode: "subagent",
|
|
40939
41452
|
hidden: true,
|
|
40940
41453
|
prompt: plannerPrompt,
|
|
40941
|
-
maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
|
|
40942
41454
|
color: "#9B59B6"
|
|
40943
|
-
},
|
|
40944
|
-
[AGENT_NAMES.WORKER]: {
|
|
41455
|
+
}, globalPermission),
|
|
41456
|
+
[AGENT_NAMES.WORKER]: defineAgent(existingAgents[AGENT_NAMES.WORKER], {
|
|
40945
41457
|
description: "Implementation and documentation specialist",
|
|
40946
41458
|
mode: "subagent",
|
|
40947
41459
|
hidden: true,
|
|
40948
41460
|
prompt: workerPrompt,
|
|
40949
|
-
maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
|
|
40950
41461
|
color: "#E67E22"
|
|
40951
|
-
},
|
|
40952
|
-
[AGENT_NAMES.REVIEWER]: {
|
|
41462
|
+
}, globalPermission),
|
|
41463
|
+
[AGENT_NAMES.REVIEWER]: defineAgent(existingAgents[AGENT_NAMES.REVIEWER], {
|
|
40953
41464
|
description: "Module-level verification specialist",
|
|
40954
41465
|
mode: "subagent",
|
|
40955
41466
|
hidden: true,
|
|
40956
41467
|
prompt: reviewerPrompt,
|
|
40957
|
-
maxTokens: AGENT_TOKENS.SUBAGENT_MAX_TOKENS,
|
|
40958
41468
|
color: "#27AE60"
|
|
40959
|
-
}
|
|
41469
|
+
}, globalPermission)
|
|
40960
41470
|
};
|
|
40961
41471
|
const processedExistingAgents = { ...existingAgents };
|
|
40962
41472
|
if (processedExistingAgents.build) {
|
|
@@ -40972,9 +41482,9 @@ ${claudeRules}`;
|
|
|
40972
41482
|
mode: "subagent"
|
|
40973
41483
|
};
|
|
40974
41484
|
}
|
|
40975
|
-
|
|
40976
|
-
|
|
40977
|
-
|
|
41485
|
+
mutableConfig.command = { ...existingCommands, ...orchestratorCommands };
|
|
41486
|
+
mutableConfig.agent = { ...processedExistingAgents, ...orchestratorAgents };
|
|
41487
|
+
mutableConfig.default_agent = AGENT_NAMES.COMMANDER;
|
|
40978
41488
|
};
|
|
40979
41489
|
}
|
|
40980
41490
|
|
|
@@ -41432,7 +41942,11 @@ async function injectContinuation2(client, directory, sessionID, loopState, cust
|
|
|
41432
41942
|
return;
|
|
41433
41943
|
}
|
|
41434
41944
|
const summary = buildVerificationSummary(verification);
|
|
41435
|
-
|
|
41945
|
+
const continuationReason = customPrompt ? "stagnation_intervention" : loopState.lastContinuationReason;
|
|
41946
|
+
let prompt = generateMissionContinuationPrompt(loopState, {
|
|
41947
|
+
verificationSummary: summary,
|
|
41948
|
+
continuationReason
|
|
41949
|
+
});
|
|
41436
41950
|
if (customPrompt) {
|
|
41437
41951
|
prompt = `${customPrompt}
|
|
41438
41952
|
|
|
@@ -41445,12 +41959,35 @@ ${prompt}`;
|
|
|
41445
41959
|
parts: [{ type: PART_TYPES.TEXT, text: prompt }]
|
|
41446
41960
|
}
|
|
41447
41961
|
});
|
|
41962
|
+
appendMissionLedgerEvent(directory, {
|
|
41963
|
+
type: "prompt_injected",
|
|
41964
|
+
sessionID,
|
|
41965
|
+
iteration: loopState.iteration,
|
|
41966
|
+
objective: loopState.objective,
|
|
41967
|
+
summary,
|
|
41968
|
+
reason: continuationReason
|
|
41969
|
+
});
|
|
41970
|
+
syncMissionMemory(directory, loopState);
|
|
41448
41971
|
markInjectionPerformed(sessionID);
|
|
41449
41972
|
} catch (err) {
|
|
41450
41973
|
log("[mission-loop-handler] Failed to inject continuation prompt", { sessionID, error: err });
|
|
41451
41974
|
}
|
|
41452
41975
|
}
|
|
41453
41976
|
async function handleMissionComplete(client, directory, loopState) {
|
|
41977
|
+
const completedState = {
|
|
41978
|
+
...loopState,
|
|
41979
|
+
active: false,
|
|
41980
|
+
lastVerificationSummary: "Mission verification passed",
|
|
41981
|
+
lastContinuationReason: "mission_completed"
|
|
41982
|
+
};
|
|
41983
|
+
appendMissionLedgerEvent(directory, {
|
|
41984
|
+
type: "mission_completed",
|
|
41985
|
+
sessionID: loopState.sessionID,
|
|
41986
|
+
iteration: loopState.iteration,
|
|
41987
|
+
objective: loopState.objective,
|
|
41988
|
+
summary: "Mission verification passed"
|
|
41989
|
+
});
|
|
41990
|
+
syncMissionMemory(directory, completedState);
|
|
41454
41991
|
const cleared = clearLoopState(directory);
|
|
41455
41992
|
if (cleared) {
|
|
41456
41993
|
await showCompletedToast(client, loopState);
|
|
@@ -41503,6 +42040,20 @@ async function handleMissionIdle(client, directory, sessionID, mainSessionID) {
|
|
|
41503
42040
|
return;
|
|
41504
42041
|
}
|
|
41505
42042
|
if (shouldTripCircuit(sessionID)) {
|
|
42043
|
+
const verificationSummary2 = buildVerificationSummary(verification);
|
|
42044
|
+
appendMissionLedgerEvent(directory, {
|
|
42045
|
+
type: "circuit_open",
|
|
42046
|
+
sessionID,
|
|
42047
|
+
iteration: loopState.iteration,
|
|
42048
|
+
objective: loopState.objective,
|
|
42049
|
+
summary: verificationSummary2,
|
|
42050
|
+
reason: "stagnation_threshold"
|
|
42051
|
+
});
|
|
42052
|
+
syncMissionMemory(directory, {
|
|
42053
|
+
...loopState,
|
|
42054
|
+
lastVerificationSummary: verificationSummary2,
|
|
42055
|
+
lastContinuationReason: "circuit_open"
|
|
42056
|
+
});
|
|
41506
42057
|
log(`[${MISSION_CONTROL.LOG_SOURCE}-handler] Circuit breaker tripped for ${sessionID}`);
|
|
41507
42058
|
return;
|
|
41508
42059
|
}
|
|
@@ -41517,8 +42068,29 @@ async function handleMissionIdle(client, directory, sessionID, mainSessionID) {
|
|
|
41517
42068
|
const stagnant = isStagnant(sessionID, DEFAULT_STAGNATION_THRESHOLD);
|
|
41518
42069
|
const newState = incrementIteration(directory);
|
|
41519
42070
|
if (!newState) return;
|
|
42071
|
+
const verificationSummary = buildVerificationSummary(verification);
|
|
41520
42072
|
newState.lastProgress = currentProgress;
|
|
42073
|
+
newState.stagnationCount = stagnant ? (newState.stagnationCount ?? 0) + 1 : 0;
|
|
42074
|
+
newState.lastVerificationSummary = verificationSummary;
|
|
42075
|
+
newState.lastContinuationReason = stagnant ? "stagnation_intervention" : "verification_failed";
|
|
42076
|
+
newState.lastContinuationAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
41521
42077
|
writeLoopState(directory, newState);
|
|
42078
|
+
appendMissionLedgerEvent(directory, {
|
|
42079
|
+
type: "verification_failed",
|
|
42080
|
+
sessionID,
|
|
42081
|
+
iteration: newState.iteration,
|
|
42082
|
+
objective: newState.objective,
|
|
42083
|
+
summary: verificationSummary
|
|
42084
|
+
});
|
|
42085
|
+
appendMissionLedgerEvent(directory, {
|
|
42086
|
+
type: "continuation_scheduled",
|
|
42087
|
+
sessionID,
|
|
42088
|
+
iteration: newState.iteration,
|
|
42089
|
+
objective: newState.objective,
|
|
42090
|
+
summary: verificationSummary,
|
|
42091
|
+
reason: newState.lastContinuationReason
|
|
42092
|
+
});
|
|
42093
|
+
syncMissionMemory(directory, newState);
|
|
41522
42094
|
await showCountdownToast2(client, MISSION_CONTROL.DEFAULT_COUNTDOWN_SECONDS, newState.iteration, newState.maxIterations);
|
|
41523
42095
|
state2.countdownTimer = setTimeout(async () => {
|
|
41524
42096
|
sessionStateStore.cancelCountdown(sessionID);
|
|
@@ -41526,9 +42098,11 @@ async function handleMissionIdle(client, directory, sessionID, mainSessionID) {
|
|
|
41526
42098
|
}, MISSION_CONTROL.DEFAULT_COUNTDOWN_SECONDS * 1e3);
|
|
41527
42099
|
}
|
|
41528
42100
|
function handleUserMessage2(sessionID) {
|
|
42101
|
+
const state2 = sessionStateStore.getState(sessionID);
|
|
42102
|
+
state2.isAborting = false;
|
|
41529
42103
|
sessionStateStore.cancelCountdown(sessionID);
|
|
41530
42104
|
}
|
|
41531
|
-
function
|
|
42105
|
+
function handleAbort2(sessionID) {
|
|
41532
42106
|
const state2 = sessionStateStore.getState(sessionID);
|
|
41533
42107
|
state2.isAborting = true;
|
|
41534
42108
|
sessionStateStore.cancelCountdown(sessionID);
|
|
@@ -41629,7 +42203,7 @@ function createEventHandler(ctx) {
|
|
|
41629
42203
|
const error95 = event.properties?.error;
|
|
41630
42204
|
if (sessionID) {
|
|
41631
42205
|
handleSessionError2(sessionID, error95);
|
|
41632
|
-
|
|
42206
|
+
handleAbort2(sessionID);
|
|
41633
42207
|
}
|
|
41634
42208
|
if (sessionID && error95) {
|
|
41635
42209
|
const recovered = await handleSessionError(
|
|
@@ -41656,6 +42230,7 @@ function createEventHandler(ctx) {
|
|
|
41656
42230
|
if (sessionID && role === MESSAGE_ROLES.ASSISTANT) {
|
|
41657
42231
|
markRecoveryComplete(sessionID);
|
|
41658
42232
|
if (messageInfo?.id && messageInfo.time?.completed) {
|
|
42233
|
+
markAssistantCompleted(sessions, sessionID);
|
|
41659
42234
|
await handleCompletedAssistantMessage(ctx, sessionID, messageInfo.id);
|
|
41660
42235
|
}
|
|
41661
42236
|
}
|
|
@@ -41667,35 +42242,75 @@ function createEventHandler(ctx) {
|
|
|
41667
42242
|
if (event.type === SESSION_EVENTS.IDLE) {
|
|
41668
42243
|
const sessionID = event.properties?.sessionID || "";
|
|
41669
42244
|
if (sessionID) {
|
|
41670
|
-
|
|
41671
|
-
|
|
41672
|
-
|
|
41673
|
-
|
|
41674
|
-
|
|
41675
|
-
|
|
41676
|
-
|
|
41677
|
-
|
|
41678
|
-
directory,
|
|
41679
|
-
sessionID,
|
|
41680
|
-
sessionID
|
|
41681
|
-
).catch(() => {
|
|
41682
|
-
});
|
|
41683
|
-
} else {
|
|
41684
|
-
await handleSessionIdle(
|
|
41685
|
-
client,
|
|
41686
|
-
directory,
|
|
41687
|
-
sessionID,
|
|
41688
|
-
sessionID
|
|
41689
|
-
).catch(() => {
|
|
41690
|
-
});
|
|
41691
|
-
}
|
|
41692
|
-
}
|
|
41693
|
-
}, 500);
|
|
41694
|
-
}
|
|
42245
|
+
scheduleIdleContinuation(ctx, sessionID);
|
|
42246
|
+
}
|
|
42247
|
+
}
|
|
42248
|
+
if (event.type === SESSION_EVENTS.STATUS) {
|
|
42249
|
+
const properties = event.properties;
|
|
42250
|
+
const sessionID = properties?.sessionID ?? "";
|
|
42251
|
+
if (sessionID && properties?.status?.type === "idle") {
|
|
42252
|
+
scheduleIdleContinuation(ctx, sessionID);
|
|
41695
42253
|
}
|
|
41696
42254
|
}
|
|
41697
42255
|
};
|
|
41698
42256
|
}
|
|
42257
|
+
function markAssistantCompleted(sessions, sessionID) {
|
|
42258
|
+
const session = sessions.get(sessionID);
|
|
42259
|
+
if (!session) return;
|
|
42260
|
+
session.lastAssistantCompletedAt = Date.now();
|
|
42261
|
+
}
|
|
42262
|
+
function shouldContinueAfterIdle(session) {
|
|
42263
|
+
if (!session?.active || !session.lastAssistantCompletedAt) {
|
|
42264
|
+
return false;
|
|
42265
|
+
}
|
|
42266
|
+
if (session.lastUserMessageAt && session.lastAssistantCompletedAt < session.lastUserMessageAt) {
|
|
42267
|
+
return false;
|
|
42268
|
+
}
|
|
42269
|
+
if (session.lastAbortAt && session.lastAssistantCompletedAt < session.lastAbortAt) {
|
|
42270
|
+
return false;
|
|
42271
|
+
}
|
|
42272
|
+
return true;
|
|
42273
|
+
}
|
|
42274
|
+
function markAbort(sessions, sessionID) {
|
|
42275
|
+
const session = sessions.get(sessionID);
|
|
42276
|
+
if (session) {
|
|
42277
|
+
session.lastAbortAt = Date.now();
|
|
42278
|
+
}
|
|
42279
|
+
handleAbort(sessionID);
|
|
42280
|
+
handleAbort2(sessionID);
|
|
42281
|
+
}
|
|
42282
|
+
function scheduleIdleContinuation(ctx, sessionID) {
|
|
42283
|
+
const { client, directory, sessions } = ctx;
|
|
42284
|
+
if (!sessions.has(sessionID)) return;
|
|
42285
|
+
setTimeout(async () => {
|
|
42286
|
+
const session = sessions.get(sessionID);
|
|
42287
|
+
if (!shouldContinueAfterIdle(session)) {
|
|
42288
|
+
markAbort(sessions, sessionID);
|
|
42289
|
+
return;
|
|
42290
|
+
}
|
|
42291
|
+
if (isLoopActive(directory, sessionID)) {
|
|
42292
|
+
try {
|
|
42293
|
+
await handleMissionIdle(
|
|
42294
|
+
client,
|
|
42295
|
+
directory,
|
|
42296
|
+
sessionID,
|
|
42297
|
+
sessionID
|
|
42298
|
+
);
|
|
42299
|
+
} catch {
|
|
42300
|
+
}
|
|
42301
|
+
return;
|
|
42302
|
+
}
|
|
42303
|
+
try {
|
|
42304
|
+
await handleSessionIdle(
|
|
42305
|
+
client,
|
|
42306
|
+
directory,
|
|
42307
|
+
sessionID,
|
|
42308
|
+
sessionID
|
|
42309
|
+
);
|
|
42310
|
+
} catch {
|
|
42311
|
+
}
|
|
42312
|
+
}, 500);
|
|
42313
|
+
}
|
|
41699
42314
|
|
|
41700
42315
|
// src/plugin-handlers/tool-execute-handler.ts
|
|
41701
42316
|
init_logger();
|
|
@@ -41777,6 +42392,9 @@ function buildMissionContext(loopState) {
|
|
|
41777
42392
|
return `<mission_context>
|
|
41778
42393
|
ACTIVE MISSION LOOP:
|
|
41779
42394
|
- Status: Active (Iteration ${loopState.iteration}/${loopState.maxIterations})
|
|
42395
|
+
- Objective: ${loopState.objective ?? "Continue the active mission"}
|
|
42396
|
+
- Last Progress: ${loopState.lastProgress ?? "unknown"}
|
|
42397
|
+
- Last Verification: ${loopState.lastVerificationSummary ?? "unknown"}
|
|
41780
42398
|
- Started: ${loopState.startedAt}
|
|
41781
42399
|
- Original Task: ${loopState.prompt.slice(0, 500)}${loopState.prompt.length > 500 ? "..." : ""}
|
|
41782
42400
|
|
|
@@ -41817,7 +42435,7 @@ Wait for these tasks to complete before concluding the mission.
|
|
|
41817
42435
|
init_shared();
|
|
41818
42436
|
|
|
41819
42437
|
// src/core/knowledge/context-provider.ts
|
|
41820
|
-
import { existsSync as
|
|
42438
|
+
import { existsSync as existsSync10, readFileSync as readFileSync6, readdirSync } from "node:fs";
|
|
41821
42439
|
import path10 from "node:path";
|
|
41822
42440
|
|
|
41823
42441
|
// src/core/knowledge/graph-parser.ts
|
|
@@ -42111,7 +42729,7 @@ var HybridSearch = class {
|
|
|
42111
42729
|
};
|
|
42112
42730
|
|
|
42113
42731
|
// src/core/knowledge/tag-indexer.ts
|
|
42114
|
-
import { readFileSync as
|
|
42732
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
42115
42733
|
var TagIndexer = class {
|
|
42116
42734
|
tagMap = /* @__PURE__ */ new Map();
|
|
42117
42735
|
fileCache = /* @__PURE__ */ new Map();
|
|
@@ -42185,7 +42803,7 @@ var TagIndexer = class {
|
|
|
42185
42803
|
*/
|
|
42186
42804
|
indexFileFromDisk(filePath) {
|
|
42187
42805
|
try {
|
|
42188
|
-
const content =
|
|
42806
|
+
const content = readFileSync5(filePath, "utf8");
|
|
42189
42807
|
this.indexFile(filePath, content);
|
|
42190
42808
|
} catch {
|
|
42191
42809
|
this.clearIndexForFile(filePath);
|
|
@@ -42300,7 +42918,7 @@ var KnowledgeContextProvider = class {
|
|
|
42300
42918
|
const files = [];
|
|
42301
42919
|
for (const root of KNOWLEDGE_ROOTS) {
|
|
42302
42920
|
const fullRoot = path10.join(directory, root);
|
|
42303
|
-
if (!
|
|
42921
|
+
if (!existsSync10(fullRoot)) continue;
|
|
42304
42922
|
files.push(...this.walkDirectory(fullRoot));
|
|
42305
42923
|
}
|
|
42306
42924
|
return files.sort();
|
|
@@ -42328,7 +42946,7 @@ var KnowledgeContextProvider = class {
|
|
|
42328
42946
|
const noteToSnippet = /* @__PURE__ */ new Map();
|
|
42329
42947
|
for (const filePath of files) {
|
|
42330
42948
|
try {
|
|
42331
|
-
const content =
|
|
42949
|
+
const content = readFileSync6(filePath, "utf8");
|
|
42332
42950
|
const noteName = graphParser.getNoteName(filePath);
|
|
42333
42951
|
const { body } = tagIndexer.parseFrontmatter(content);
|
|
42334
42952
|
const normalizedBody = body.trim();
|
|
@@ -42388,7 +43006,7 @@ function createSystemTransformHandler(ctx) {
|
|
|
42388
43006
|
if (isActiveLoop && loopState) {
|
|
42389
43007
|
const { commander: commander2 } = await Promise.resolve().then(() => (init_commander(), commander_exports));
|
|
42390
43008
|
systemAdditions.push(commander2.systemPrompt);
|
|
42391
|
-
systemAdditions.push(buildMissionLoopSystemPrompt(loopState
|
|
43009
|
+
systemAdditions.push(buildMissionLoopSystemPrompt(loopState));
|
|
42392
43010
|
}
|
|
42393
43011
|
if (session?.active) {
|
|
42394
43012
|
systemAdditions.push(buildActiveSessionPrompt(session.step));
|
|
@@ -42420,18 +43038,25 @@ function buildKnowledgeContextPrompt(directory, missionPrompt, currentTask) {
|
|
|
42420
43038
|
const queryParts = [missionPrompt ?? "", currentTask ?? ""].filter(Boolean);
|
|
42421
43039
|
return knowledgeContextProvider.buildPrompt(directory, queryParts.join(" ").trim());
|
|
42422
43040
|
}
|
|
42423
|
-
function buildMissionLoopSystemPrompt(
|
|
43041
|
+
function buildMissionLoopSystemPrompt(loopState) {
|
|
42424
43042
|
return `<orchestrator_mission_loop>
|
|
42425
|
-
\u{1F3AF} MISSION LOOP ACTIVE: Iteration ${iteration}/${maxIterations}
|
|
43043
|
+
\u{1F3AF} MISSION LOOP ACTIVE: Iteration ${loopState.iteration}/${loopState.maxIterations}
|
|
42426
43044
|
|
|
42427
43045
|
You are in an autonomous mission loop. Continue working until ALL tasks are verified and 100% complete.
|
|
42428
43046
|
|
|
43047
|
+
ACTIVE OBJECTIVE:
|
|
43048
|
+
${loopState.objective ?? "Continue the active mission"}
|
|
43049
|
+
|
|
43050
|
+
RUNTIME MEMORY:
|
|
43051
|
+
- Last progress: ${loopState.lastProgress ?? "unknown"}
|
|
43052
|
+
- Last verification: ${loopState.lastVerificationSummary ?? "unknown"}
|
|
43053
|
+
|
|
42429
43054
|
COMPLETION CRITERIA:
|
|
42430
43055
|
- All hierarchical items in .opencode/todo.md are marked [x]
|
|
42431
43056
|
- .opencode/verification-checklist.md is fully checked off [x]
|
|
42432
43057
|
- All tests pass and builds succeed
|
|
42433
43058
|
|
|
42434
|
-
|
|
43059
|
+
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
43060
|
</orchestrator_mission_loop>`;
|
|
42436
43061
|
}
|
|
42437
43062
|
function buildActiveSessionPrompt(stepCount) {
|
|
@@ -42456,13 +43081,16 @@ Use \`delegate_task\` with background=true for parallel work.
|
|
|
42456
43081
|
// src/index.ts
|
|
42457
43082
|
var require2 = createRequire(import.meta.url);
|
|
42458
43083
|
var { version: PLUGIN_VERSION } = require2("../package.json");
|
|
42459
|
-
var OrchestratorPlugin = async (input) => {
|
|
43084
|
+
var OrchestratorPlugin = async (input, options) => {
|
|
42460
43085
|
const { directory, client } = input;
|
|
43086
|
+
const orchestratorOptions = parseOrchestratorPluginOptions(options);
|
|
43087
|
+
let concurrencyConfig = orchestratorOptions.concurrency;
|
|
43088
|
+
configureMissionRuntimeOptions(orchestratorOptions.missionLoop);
|
|
42461
43089
|
initializeHooks();
|
|
42462
43090
|
initToastClient(client);
|
|
42463
43091
|
const taskToastManager = initTaskToastManager(client);
|
|
42464
43092
|
const sessions = /* @__PURE__ */ new Map();
|
|
42465
|
-
const parallelAgentManager2 = ParallelAgentManager.getInstance(client, directory);
|
|
43093
|
+
const parallelAgentManager2 = ParallelAgentManager.getInstance(client, directory, concurrencyConfig);
|
|
42466
43094
|
const asyncAgentTools = createAsyncAgentTools(parallelAgentManager2, client);
|
|
42467
43095
|
const pluginManager = PluginManager.getInstance();
|
|
42468
43096
|
await pluginManager.initialize(directory);
|
|
@@ -42500,10 +43128,12 @@ var OrchestratorPlugin = async (input) => {
|
|
|
42500
43128
|
// -----------------------------------------------------------------
|
|
42501
43129
|
// Config hook - registers our commands and agents with OpenCode
|
|
42502
43130
|
// -----------------------------------------------------------------
|
|
42503
|
-
config: createConfigHandler(
|
|
42504
|
-
|
|
42505
|
-
|
|
42506
|
-
|
|
43131
|
+
config: createConfigHandler({
|
|
43132
|
+
onConcurrencyConfig: (config3) => {
|
|
43133
|
+
concurrencyConfig = mergeConcurrencyConfig(concurrencyConfig, config3);
|
|
43134
|
+
parallelAgentManager2.configureConcurrency(concurrencyConfig);
|
|
43135
|
+
}
|
|
43136
|
+
}),
|
|
42507
43137
|
// -----------------------------------------------------------------
|
|
42508
43138
|
// Event hook - handles OpenCode events
|
|
42509
43139
|
// -----------------------------------------------------------------
|
|
@@ -42539,9 +43169,9 @@ var OrchestratorPlugin = async (input) => {
|
|
|
42539
43169
|
// -----------------------------------------------------------------
|
|
42540
43170
|
[PLUGIN_HOOKS.EXPERIMENTAL_CHAT_SYSTEM_TRANSFORM]: createSystemTransformHandler(handlerContext),
|
|
42541
43171
|
// -----------------------------------------------------------------
|
|
42542
|
-
//
|
|
43172
|
+
// dispose hook - cleanup resources on plugin unload
|
|
42543
43173
|
// -----------------------------------------------------------------
|
|
42544
|
-
|
|
43174
|
+
dispose: async () => {
|
|
42545
43175
|
await shutdownManager.shutdown();
|
|
42546
43176
|
}
|
|
42547
43177
|
};
|