@cortex-agent/server 2026.10.2 → 2026.10.6
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/README.md +31 -31
- package/defaults/AGENTS.md +3 -3
- package/defaults/config/{thread-templates/agents/direct.json → environments/main.json} +2 -2
- package/defaults/context/AGENTS.md +0 -2
- package/defaults/context/projects/AGENTS.md +0 -2
- package/defaults/context/user/AGENTS.md +1 -1
- package/defaults/hooks/cortex-hook-api.mjs +1 -3
- package/defaults/hooks/new-session-hook.mjs +2 -3
- package/defaults/hooks/status-md-guard.mjs +5 -5
- package/defaults/plugins/cortex-system/.claude-plugin/plugin.json +2 -2
- package/defaults/plugins/cortex-system/plugin.json +2 -2
- package/defaults/plugins/cortex-system/skills/project-init/SKILL.md +4 -4
- package/defaults/plugins/cortex-system/skills/schedule/SKILL.md +11 -13
- package/defaults/plugins/cortex-system/skills/user-learn/SKILL.md +1 -1
- package/defaults/prompts/systemPrompts/web-opus-4-6.md +2 -2
- package/defaults/prompts/systemPrompts/web-sonnet-4-6.md +2 -2
- package/defaults/rules/issues-md.md +2 -2
- package/defaults/rules/meta-conventions.md +1 -2
- package/defaults/rules/mission-md.md +1 -1
- package/defaults/rules/overview-md.md +1 -1
- package/defaults/rules/roadmap-md.md +1 -1
- package/defaults/rules/status-md.md +4 -4
- package/dist/agent-adapter/claude/adapter.d.ts +6 -1
- package/dist/agent-adapter/claude/adapter.js +15 -4
- package/dist/agent-adapter/claude/compact-window.d.ts +11 -3
- package/dist/agent-adapter/claude/compact-window.js +12 -3
- package/dist/agent-adapter/claude/defaults.d.ts +0 -1
- package/dist/agent-adapter/claude/defaults.js +0 -1
- package/dist/agent-adapter/claude/event-translator.d.ts +2 -2
- package/dist/agent-adapter/claude/event-translator.js +2 -1
- package/dist/agent-adapter/claude/hooks-builder.d.ts +0 -5
- package/dist/agent-adapter/claude/hooks-builder.js +0 -13
- package/dist/agent-adapter/claude/spawn-args.d.ts +5 -12
- package/dist/agent-adapter/claude/spawn-args.js +45 -38
- package/dist/agent-adapter/claude/turn-machine.d.ts +2 -2
- package/dist/agent-adapter/claude/turn-machine.js +6 -3
- package/dist/agent-adapter/continuation-phase.js +2 -1
- package/dist/agent-adapter/normalize/event-types.d.ts +4 -1
- package/dist/agent-adapter/normalize/tool-result-images.d.ts +11 -0
- package/dist/agent-adapter/normalize/tool-result-images.js +32 -0
- package/dist/agent-adapter/pi/child-events.js +3 -0
- package/dist/agent-adapter/pi/child-runner.d.ts +1 -2
- package/dist/agent-adapter/pi/child-runner.js +6 -6
- package/dist/agent-adapter/pi/child-session.d.ts +1 -1
- package/dist/agent-adapter/pi/event-parser.d.ts +13 -2
- package/dist/agent-adapter/pi/event-parser.js +38 -11
- package/dist/agent-adapter/pi/mcp-bridge-logic.d.ts +0 -1
- package/dist/agent-adapter/pi/mcp-bridge-logic.js +0 -3
- package/dist/agent-adapter/pi/mcp-bridge.js +4 -4
- package/dist/agent-adapter/pi/pi-session.d.ts +4 -2
- package/dist/agent-adapter/pi/pi-session.js +18 -9
- package/dist/agent-adapter/pi/runtime-settings.d.ts +7 -0
- package/dist/agent-adapter/pi/runtime-settings.js +23 -0
- package/dist/agent-adapter/pi/runtime.d.ts +2 -3
- package/dist/agent-adapter/pi/session-options.d.ts +4 -1
- package/dist/agent-adapter/pi/session-options.js +13 -21
- package/dist/agent-adapter/pi/session-support.d.ts +2 -0
- package/dist/agent-adapter/run-events.d.ts +3 -1
- package/dist/agent-adapter/types.d.ts +6 -12
- package/dist/agent-adapter/types.js +2 -4
- package/dist/core/agents/roles.d.ts +1 -1
- package/dist/core/agents/subagent/attribution.js +1 -0
- package/dist/core/agents/subagent/catalog.d.ts +8 -0
- package/dist/core/agents/subagent/catalog.js +21 -10
- package/dist/core/agents/subagent/types.d.ts +4 -1
- package/dist/core/config-generator.d.ts +0 -6
- package/dist/core/config-generator.js +1 -35
- package/dist/core/icons.d.ts +33 -33
- package/dist/core/locales/en.d.ts +863 -1030
- package/dist/core/locales/slices/commands.d.ts +282 -349
- package/dist/core/locales/slices/commands.js +20 -160
- package/dist/core/locales/slices/init.d.ts +152 -152
- package/dist/core/locales/slices/interactions.d.ts +44 -45
- package/dist/core/locales/slices/interactions.js +0 -4
- package/dist/core/locales/slices/lang.d.ts +5 -5
- package/dist/core/locales/slices/notices.d.ts +75 -118
- package/dist/core/locales/slices/notices.js +13 -99
- package/dist/core/locales/slices/scheduling.d.ts +31 -31
- package/dist/core/locales/slices/startup.d.ts +5 -5
- package/dist/core/locales/slices/status.d.ts +43 -43
- package/dist/core/locales/slices/tui.d.ts +91 -114
- package/dist/core/locales/slices/tui.js +0 -46
- package/dist/core/locales/slices/uiextra.d.ts +41 -61
- package/dist/core/locales/slices/uiextra.js +11 -51
- package/dist/core/locales/slices/uimsg.d.ts +86 -99
- package/dist/core/locales/slices/uimsg.js +6 -32
- package/dist/core/mcp-bundles.d.ts +1 -1
- package/dist/core/mcp-bundles.js +7 -5
- package/dist/core/mcp-tool-gate.js +8 -5
- package/dist/core/platform-settings-spec.d.ts +3 -3
- package/dist/core/production-benchmark-evidence.d.ts +1 -9
- package/dist/core/production-benchmark-evidence.js +0 -22
- package/dist/core/rebuild-progress.d.ts +3 -2
- package/dist/core/rebuild-progress.js +5 -2
- package/dist/core/run-registry.d.ts +7 -28
- package/dist/core/run-registry.js +6 -51
- package/dist/core/session-retention-liveness.d.ts +0 -2
- package/dist/core/session-retention-liveness.js +0 -13
- package/dist/core/session-state.d.ts +1 -2
- package/dist/core/session-state.js +2 -3
- package/dist/core/settings-spec.d.ts +19 -60
- package/dist/core/settings-spec.js +30 -60
- package/dist/core/status-format.d.ts +0 -14
- package/dist/core/status-format.js +2 -24
- package/dist/core/types/agent-types.d.ts +26 -9
- package/dist/core/types/benchmark-types.d.ts +17 -0
- package/dist/core/types/environment-types.d.ts +64 -0
- package/dist/core/types/environment-types.js +1 -0
- package/dist/core/utils.d.ts +14 -4
- package/dist/core/utils.js +32 -6
- package/dist/domain/agents/agent-switch.js +2 -4
- package/dist/domain/agents/config.js +1 -1
- package/dist/domain/agents/environments/entities.d.ts +49 -0
- package/dist/domain/agents/environments/entities.js +94 -0
- package/dist/domain/agents/environments/file-refs.d.ts +19 -0
- package/dist/domain/agents/environments/file-refs.js +48 -0
- package/dist/domain/agents/environments/index.d.ts +6 -0
- package/dist/domain/agents/environments/index.js +8 -0
- package/dist/domain/agents/environments/paths.d.ts +7 -0
- package/dist/domain/agents/environments/paths.js +9 -0
- package/dist/domain/{threads/template-resolver.js → agents/environments/prompt-includes.js} +2 -2
- package/dist/domain/agents/environments/registry.d.ts +17 -0
- package/dist/domain/agents/environments/registry.js +159 -0
- package/dist/domain/agents/environments/schema.d.ts +68 -0
- package/dist/domain/agents/environments/schema.js +111 -0
- package/dist/domain/agents/environments/schema.parity.d.ts +1 -0
- package/dist/domain/agents/environments/schema.parity.js +7 -0
- package/dist/domain/agents/environments/slot-config.d.ts +14 -0
- package/dist/domain/agents/environments/slot-config.js +78 -0
- package/dist/domain/agents/model-selection.d.ts +3 -0
- package/dist/domain/agents/model-selection.js +1 -1
- package/dist/domain/agents/subagent/runner.js +3 -2
- package/dist/domain/benchmark/accounting-reconciliation.d.ts +1 -1
- package/dist/domain/benchmark/atif.d.ts +4 -4
- package/dist/domain/benchmark/atif.js +7 -7
- package/dist/domain/benchmark/attempt-record.d.ts +16 -55
- package/dist/domain/benchmark/attempt-record.js +3 -17
- package/dist/domain/benchmark/composite-manifest.d.ts +4 -4
- package/dist/domain/benchmark/composite-manifest.js +5 -11
- package/dist/domain/benchmark/journal.d.ts +6 -4
- package/dist/domain/benchmark/journal.js +6 -4
- package/dist/domain/benchmark/manifest-contract.d.ts +1 -1
- package/dist/domain/benchmark/production-attempt-identity.d.ts +11 -16
- package/dist/domain/benchmark/production-attempt-identity.js +31 -94
- package/dist/domain/benchmark/production-attempt-journal.js +14 -7
- package/dist/domain/benchmark/production-evidence-journal.js +8 -6
- package/dist/domain/benchmark/production-evidence-projection.d.ts +1 -11
- package/dist/domain/benchmark/production-evidence-projection.js +32 -143
- package/dist/domain/benchmark/session-evidence.d.ts +6 -0
- package/dist/domain/benchmark/session-evidence.js +27 -0
- package/dist/domain/costs/cost-tracker.d.ts +1 -7
- package/dist/domain/costs/cost-tracker.js +0 -4
- package/dist/domain/costs/resume-registry.d.ts +9 -20
- package/dist/domain/costs/resume-registry.js +24 -39
- package/dist/domain/executions/registry.d.ts +3 -18
- package/dist/domain/executions/registry.js +4 -158
- package/dist/domain/mcp/bundled-server.js +20 -27
- package/dist/domain/mcp/tools/commission-tools.js +0 -1
- package/dist/domain/mcp/tools/context.d.ts +2 -9
- package/dist/domain/mcp/tools/context.js +2 -7
- package/dist/domain/mcp/tools/executions.js +6 -19
- package/dist/domain/mcp/tools/interaction-ask.js +0 -1
- package/dist/domain/mcp/tools/interaction-plan.d.ts +0 -1
- package/dist/domain/mcp/tools/interaction-plan.js +0 -2
- package/dist/domain/mcp/tools/{task-ops.d.ts → remote-ops.d.ts} +1 -1
- package/dist/domain/mcp/tools/{task-ops.js → remote-ops.js} +1 -1
- package/dist/domain/mcp/tools/schedule.d.ts +3 -3
- package/dist/domain/mcp/tools/schedule.js +10 -32
- package/dist/domain/mcp/tools/subagent.d.ts +4 -0
- package/dist/domain/mcp/tools/subagent.js +10 -8
- package/dist/domain/mcp/tools/ui-view.js +3 -2
- package/dist/domain/mcp/tools/waitpoint.js +2 -3
- package/dist/domain/mcp/tools/{thread-ops.d.ts → workers.d.ts} +1 -1
- package/dist/domain/mcp/tools/workers.js +84 -0
- package/dist/domain/memory/user-context.d.ts +2 -3
- package/dist/domain/memory/user-context.js +2 -3
- package/dist/domain/monitor/gpu-monitor.js +1 -1
- package/dist/domain/pi-providers/custom-provider-model.d.ts +1 -1
- package/dist/domain/projects/project-store.d.ts +1 -2
- package/dist/domain/projects/project-store.js +1 -9
- package/dist/domain/remote/client-manager.d.ts +1 -1
- package/dist/domain/remote/client-manager.js +1 -1
- package/dist/domain/remote/client-remove.d.ts +1 -1
- package/dist/domain/remote/machine-registry.d.ts +54 -0
- package/dist/domain/{tasks/dispatch-utils.js → remote/machine-registry.js} +1 -61
- package/dist/domain/runs/attempt.js +3 -8
- package/dist/domain/runs/builders.d.ts +2 -3
- package/dist/domain/runs/builders.js +2 -3
- package/dist/domain/runs/engine-spec.js +3 -10
- package/dist/domain/runs/fallback.d.ts +1 -3
- package/dist/domain/runs/fallback.js +1 -3
- package/dist/domain/runs/observers/resume-recorder.d.ts +0 -15
- package/dist/domain/runs/observers/resume-recorder.js +0 -17
- package/dist/domain/runs/prompt.d.ts +23 -8
- package/dist/domain/runs/prompt.js +31 -5
- package/dist/domain/runs/request.d.ts +6 -15
- package/dist/domain/runs/run.js +0 -2
- package/dist/domain/runs/service.js +0 -2
- package/dist/domain/runs/spec-loader.d.ts +4 -6
- package/dist/domain/runs/spec-loader.js +3 -5
- package/dist/domain/scheduling/builtin-job-migration.js +3 -3
- package/dist/domain/scheduling/builtin-jobs.js +0 -13
- package/dist/domain/scheduling/job-registry.d.ts +12 -27
- package/dist/domain/scheduling/job-registry.js +2 -3
- package/dist/domain/scheduling/jobs/scheduled-task.d.ts +18 -6
- package/dist/domain/scheduling/jobs/scheduled-task.js +66 -125
- package/dist/domain/scheduling/run-guards.d.ts +6 -0
- package/dist/domain/scheduling/run-guards.js +18 -0
- package/dist/domain/scheduling/runner.d.ts +0 -1
- package/dist/domain/scheduling/runner.js +0 -1
- package/dist/domain/scheduling/schedule-cli.js +1 -1
- package/dist/domain/scheduling/scheduler.d.ts +0 -4
- package/dist/domain/scheduling/scheduler.js +2 -6
- package/dist/domain/sessions/session-hooks.d.ts +2 -2
- package/dist/domain/sessions/session-lifecycle.d.ts +23 -9
- package/dist/domain/sessions/session-lifecycle.js +27 -15
- package/dist/domain/sessions/session-retention.d.ts +8 -0
- package/dist/domain/sessions/session-retention.js +139 -34
- package/dist/domain/sessions/team.d.ts +18 -0
- package/dist/domain/sessions/team.js +21 -0
- package/dist/domain/system/install-cli.js +5 -5
- package/dist/domain/system/rebuild-hold.d.ts +1 -1
- package/dist/domain/system/server-update-check.js +2 -1
- package/dist/domain/ui-service/app-router.d.ts +41 -154
- package/dist/domain/ui-service/app-router.js +9 -30
- package/dist/domain/ui-service/input-schemas.d.ts +64 -205
- package/dist/domain/ui-service/input-schemas.js +26 -71
- package/dist/domain/ui-service/mutate/environments.d.ts +23 -0
- package/dist/domain/ui-service/mutate/environments.js +51 -0
- package/dist/domain/ui-service/mutate/plugin-packages.js +3 -9
- package/dist/domain/ui-service/mutate/plugins.js +7 -109
- package/dist/domain/ui-service/mutate/schedules.js +1 -2
- package/dist/domain/ui-service/plugins-shared.d.ts +0 -3
- package/dist/domain/ui-service/plugins-shared.js +0 -14
- package/dist/domain/ui-service/query/config.js +10 -13
- package/dist/domain/ui-service/query/environments.d.ts +12 -0
- package/dist/domain/ui-service/query/environments.js +72 -0
- package/dist/domain/ui-service/query/executions.js +1 -1
- package/dist/domain/ui-service/query/hooks.d.ts +1 -1
- package/dist/domain/ui-service/query/hooks.js +13 -24
- package/dist/domain/ui-service/query/memory.js +1 -1
- package/dist/domain/ui-service/query/plugins.js +6 -82
- package/dist/domain/ui-service/query/schedules.js +0 -1
- package/dist/domain/ui-service/query/sessions.js +23 -5
- package/dist/domain/ui-service/query/system.js +0 -1
- package/dist/domain/ui-service/query-input-schemas.d.ts +5 -26
- package/dist/domain/ui-service/query-input-schemas.js +0 -18
- package/dist/domain/ui-service/types.d.ts +68 -330
- package/dist/domain/ui-service/ui-service.js +7 -23
- package/dist/domain/waitpoints/notices.d.ts +1 -1
- package/dist/domain/waitpoints/notices.js +1 -1
- package/dist/entry/app.js +70 -146
- package/dist/entry/cli-help.js +0 -1
- package/dist/entry/cli.js +1 -6
- package/dist/entry/daemon.d.ts +27 -23
- package/dist/entry/daemon.js +61 -49
- package/dist/entry/fast-install.d.ts +13 -2
- package/dist/entry/fast-install.js +43 -11
- package/dist/entry/hook-cli.d.ts +0 -1
- package/dist/entry/hook-cli.js +20 -49
- package/dist/entry/init.js +8 -11
- package/dist/entry/local-ui.d.ts +1 -1
- package/dist/entry/platform-connect.d.ts +23 -0
- package/dist/entry/platform-connect.js +94 -0
- package/dist/entry/production-evidence-export-cli.js +0 -2
- package/dist/events/event-logger.js +1 -0
- package/dist/events/event-types.d.ts +13 -62
- package/dist/hooks/cortex-hook-api.mjs +1 -3
- package/dist/hooks/new-session-hook.mjs +2 -3
- package/dist/hooks/status-md-guard.mjs +5 -5
- package/dist/orchestration/agent-runner.d.ts +3 -0
- package/dist/orchestration/agent-runner.js +21 -19
- package/dist/orchestration/agent-view-send.d.ts +7 -0
- package/dist/orchestration/agent-view-send.js +12 -0
- package/dist/orchestration/benchmark-session-webhook.d.ts +19 -0
- package/dist/orchestration/benchmark-session-webhook.js +130 -0
- package/dist/orchestration/conversation-request.d.ts +39 -1
- package/dist/orchestration/conversation-request.js +71 -15
- package/dist/orchestration/interactions/answer-question.d.ts +16 -0
- package/dist/orchestration/interactions/answer-question.js +38 -0
- package/dist/orchestration/interactions/ask-user-question.d.ts +2 -3
- package/dist/orchestration/interactions/ask-user-question.js +1 -3
- package/dist/orchestration/interactions/ask-user-resume.d.ts +1 -3
- package/dist/orchestration/interactions/ask-user-resume.js +2 -14
- package/dist/orchestration/interactions/interaction-handlers.js +6 -35
- package/dist/orchestration/interactions/plan-response.d.ts +2 -1
- package/dist/orchestration/interactions/plan-response.js +2 -2
- package/dist/orchestration/orchestrator.d.ts +1 -7
- package/dist/orchestration/orchestrator.js +2 -11
- package/dist/orchestration/resume-dispatcher.d.ts +0 -22
- package/dist/orchestration/resume-dispatcher.js +8 -72
- package/dist/orchestration/routing/commands/cancel.d.ts +1 -7
- package/dist/orchestration/routing/commands/cancel.js +17 -37
- package/dist/orchestration/routing/commands/channel.js +1 -1
- package/dist/orchestration/routing/commands/device.js +1 -1
- package/dist/orchestration/routing/commands/index.d.ts +0 -7
- package/dist/orchestration/routing/commands/index.js +1 -9
- package/dist/orchestration/routing/commands/mode.js +7 -7
- package/dist/orchestration/routing/commands/nvtop.js +1 -1
- package/dist/orchestration/routing/commands/sendfile.js +1 -1
- package/dist/orchestration/routing/commands/status.js +8 -14
- package/dist/orchestration/routing/hook-bridge-subscribers.d.ts +4 -1
- package/dist/orchestration/routing/hook-bridge-subscribers.js +19 -12
- package/dist/orchestration/routing/hook-bridge.d.ts +3 -3
- package/dist/orchestration/routing/hook-bridge.js +9 -9
- package/dist/orchestration/routing/message-router.js +2 -25
- package/dist/orchestration/routing/webhook.js +24 -350
- package/dist/orchestration/session-events.d.ts +13 -0
- package/dist/orchestration/session-events.js +8 -0
- package/dist/orchestration/session-gateway.d.ts +4 -2
- package/dist/orchestration/session-gateway.js +17 -12
- package/dist/orchestration/session-retention-controller.d.ts +5 -2
- package/dist/orchestration/session-retention-controller.js +7 -4
- package/dist/orchestration/status-helpers.d.ts +1 -4
- package/dist/orchestration/status-helpers.js +3 -5
- package/dist/orchestration/team-delivery.d.ts +64 -0
- package/dist/orchestration/team-delivery.js +224 -0
- package/dist/orchestration/team-state.d.ts +48 -0
- package/dist/orchestration/team-state.js +146 -0
- package/dist/orchestration/team-webhook.d.ts +48 -0
- package/dist/orchestration/team-webhook.js +295 -0
- package/dist/orchestration/transcript-sink.d.ts +18 -4
- package/dist/orchestration/transcript-sink.js +31 -3
- package/dist/orchestration/turn/background-hold.d.ts +2 -2
- package/dist/orchestration/turn/background-hold.js +1 -1
- package/dist/orchestration/turn/hold-render-platform.d.ts +2 -2
- package/dist/orchestration/turn/hold-render-platform.js +2 -2
- package/dist/orchestration/turn/hold-render-web.d.ts +3 -3
- package/dist/orchestration/turn/hold-render-web.js +2 -2
- package/dist/orchestration/turn/terminal.d.ts +5 -2
- package/dist/orchestration/turn/terminal.js +11 -10
- package/dist/orchestration/turn/turn.d.ts +13 -1
- package/dist/orchestration/turn/turn.js +58 -15
- package/dist/platform/adapters/composite-adapter.d.ts +2 -0
- package/dist/platform/adapters/composite-adapter.js +7 -4
- package/dist/platform/adapters/feishu.d.ts +6 -0
- package/dist/platform/adapters/feishu.js +50 -4
- package/dist/platform/index.d.ts +1 -1
- package/dist/platform/index.js +1 -1
- package/dist/platform/tui/protocol.d.ts +2 -2
- package/dist/platform/types.d.ts +3 -3
- package/dist/platform/types.js +3 -3
- package/dist/store/conversation-history-reader.js +17 -3
- package/dist/store/conversation-history-repo.d.ts +18 -4
- package/dist/store/conversation-history-repo.js +14 -5
- package/dist/store/conversation-ledger-repo.js +1 -16
- package/dist/store/execution-repo.d.ts +17 -40
- package/dist/store/execution-repo.js +46 -116
- package/dist/store/hook-registry.d.ts +4 -16
- package/dist/store/hook-registry.js +5 -65
- package/dist/store/plugin-sync.js +4 -0
- package/dist/store/profile-repo.js +1 -1
- package/dist/store/prompt-migration-replacements.d.ts +0 -1
- package/dist/store/prompt-migration-replacements.js +0 -49
- package/dist/store/retention-candidate-repo.d.ts +2 -0
- package/dist/store/retention-candidate-repo.js +5 -0
- package/dist/store/schedule-repo.d.ts +3 -15
- package/dist/store/schedule-repo.js +18 -4
- package/dist/store/session-registry-journal.d.ts +15 -0
- package/dist/store/session-registry-journal.js +68 -10
- package/dist/store/session-registry-repo.d.ts +13 -0
- package/dist/store/session-registry-repo.js +74 -21
- package/dist/store/session-totals.d.ts +3 -3
- package/dist/store/session-totals.js +3 -3
- package/dist/store/team-outbox-repo.d.ts +20 -0
- package/dist/store/team-outbox-repo.js +39 -0
- package/dist/store/tool-image-files.d.ts +12 -0
- package/dist/store/tool-image-files.js +40 -0
- package/dist/store/version-migrations.d.ts +31 -8
- package/dist/store/version-migrations.js +307 -87
- package/dist/store/waitpoint-repo.d.ts +0 -2
- package/dist/tui/App.js +1 -1
- package/dist/tui/components/Dashboard.js +0 -8
- package/dist/tui/components/InputBox.js +1 -7
- package/dist/tui/components/StatusLine.js +1 -1
- package/dist/tui/hooks/useDashboardData.d.ts +1 -1
- package/dist/tui/hooks/useDashboardData.js +0 -4
- package/dist/tui/hooks/useNotifications.d.ts +1 -1
- package/dist/tui/slash-commands.js +1 -4
- package/package.json +4 -5
- package/web/dist/assets/index-BU_kY1rV.js +449 -0
- package/web/dist/assets/{index-zvUjPRjt.js → index-CDjsmgsy.js} +1 -1
- package/web/dist/assets/index-DzPDbcY1.css +1 -0
- package/web/dist/index.html +2 -2
- package/defaults/config/hooks/02-tasks-yaml-guard.json +0 -11
- package/defaults/config/hooks/11-task-status-check.json +0 -14
- package/defaults/config/thread-templates/agents/coder-reviewer.json +0 -17
- package/defaults/config/thread-templates/agents/coder.json +0 -17
- package/defaults/config/thread-templates/agents/direct-review.json +0 -14
- package/defaults/config/thread-templates/agents/direct-web.json +0 -14
- package/defaults/config/thread-templates/agents/director.json +0 -11
- package/defaults/config/thread-templates/agents/doc-reviewer.json +0 -13
- package/defaults/config/thread-templates/agents/doc-writer.json +0 -24
- package/defaults/config/thread-templates/agents/executor-reviewer.json +0 -13
- package/defaults/config/thread-templates/agents/executor.json +0 -24
- package/defaults/config/thread-templates/agents/main.json +0 -14
- package/defaults/config/thread-templates/agents/manager.json +0 -14
- package/defaults/config/thread-templates/agents/scheduler-main.json +0 -13
- package/defaults/config/thread-templates/shells/worker-review.json +0 -12
- package/defaults/config/thread-templates/templates/coder-review.json +0 -20
- package/defaults/config/thread-templates/templates/default.json +0 -10
- package/defaults/config/thread-templates/templates/doc-review.json +0 -6
- package/defaults/config/thread-templates/templates/execute-review.json +0 -6
- package/defaults/config/thread-templates/templates/manager.json +0 -11
- package/defaults/config/thread-templates/templates/scheduler.json +0 -10
- package/defaults/hooks/task-status-check.mjs +0 -166
- package/defaults/hooks/tasks-yaml-guard.mjs +0 -225
- package/defaults/plugins/cortex-system/skills/task/SKILL.md +0 -547
- package/defaults/plugins/cortex-system/skills/thread/SKILL.md +0 -505
- package/defaults/prompts/directives/coder-reviewer.md +0 -7
- package/defaults/prompts/directives/coder.md +0 -7
- package/defaults/prompts/directives/director.md +0 -7
- package/defaults/prompts/directives/doc-reviewer.md +0 -6
- package/defaults/prompts/directives/doc-writer.md +0 -7
- package/defaults/prompts/directives/executor-reviewer.md +0 -6
- package/defaults/prompts/directives/executor.md +0 -7
- package/defaults/prompts/directives/manager.md +0 -24
- package/defaults/prompts/systemPrompts/coder.md +0 -10
- package/defaults/prompts/systemPrompts/worker.md +0 -10
- package/defaults/rules/task-system.md +0 -53
- package/dist/core/task-node.d.ts +0 -7
- package/dist/core/task-node.js +0 -21
- package/dist/core/task-parser.d.ts +0 -86
- package/dist/core/task-parser.js +0 -436
- package/dist/core/types/thread-types.d.ts +0 -506
- package/dist/domain/benchmark/production-evidence-topology.d.ts +0 -14
- package/dist/domain/benchmark/production-evidence-topology.js +0 -257
- package/dist/domain/mcp/tools/manager-qa.d.ts +0 -4
- package/dist/domain/mcp/tools/manager-qa.js +0 -63
- package/dist/domain/mcp/tools/task-monitor.d.ts +0 -3
- package/dist/domain/mcp/tools/task-monitor.js +0 -92
- package/dist/domain/mcp/tools/thread-ops.js +0 -73
- package/dist/domain/scheduling/jobs/register-thread-session.d.ts +0 -15
- package/dist/domain/scheduling/jobs/register-thread-session.js +0 -32
- package/dist/domain/scheduling/jobs/target-dispatch.d.ts +0 -30
- package/dist/domain/scheduling/jobs/target-dispatch.js +0 -33
- package/dist/domain/scheduling/jobs/task-archive.d.ts +0 -2
- package/dist/domain/scheduling/jobs/task-archive.js +0 -16
- package/dist/domain/scheduling/jobs/task-dispatch.d.ts +0 -12
- package/dist/domain/scheduling/jobs/task-dispatch.js +0 -402
- package/dist/domain/tasks/acceptance-ledger.d.ts +0 -39
- package/dist/domain/tasks/acceptance-ledger.js +0 -133
- package/dist/domain/tasks/archiver.d.ts +0 -10
- package/dist/domain/tasks/archiver.js +0 -133
- package/dist/domain/tasks/claim-recovery.d.ts +0 -9
- package/dist/domain/tasks/claim-recovery.js +0 -54
- package/dist/domain/tasks/dispatch-utils.d.ts +0 -117
- package/dist/domain/tasks/dispatcher.d.ts +0 -49
- package/dist/domain/tasks/dispatcher.js +0 -305
- package/dist/domain/tasks/lint.d.ts +0 -12
- package/dist/domain/tasks/lint.js +0 -130
- package/dist/domain/tasks/mutator.d.ts +0 -39
- package/dist/domain/tasks/mutator.js +0 -176
- package/dist/domain/tasks/production-topology-ledger.d.ts +0 -106
- package/dist/domain/tasks/production-topology-ledger.js +0 -161
- package/dist/domain/tasks/system/task-cli.d.ts +0 -7
- package/dist/domain/tasks/system/task-cli.js +0 -991
- package/dist/domain/tasks/system/task-completion.d.ts +0 -44
- package/dist/domain/tasks/system/task-completion.js +0 -262
- package/dist/domain/tasks/system/task-file-input.d.ts +0 -10
- package/dist/domain/tasks/system/task-file-input.js +0 -53
- package/dist/domain/tasks/system/task-id-utils.d.ts +0 -24
- package/dist/domain/tasks/system/task-id-utils.js +0 -90
- package/dist/domain/tasks/system/task-lifecycle-edit.d.ts +0 -40
- package/dist/domain/tasks/system/task-lifecycle-edit.js +0 -419
- package/dist/domain/tasks/system/task-lock.d.ts +0 -44
- package/dist/domain/tasks/system/task-lock.js +0 -137
- package/dist/domain/tasks/system/task-mutations.d.ts +0 -86
- package/dist/domain/tasks/system/task-mutations.js +0 -336
- package/dist/domain/tasks/system/task-state.d.ts +0 -140
- package/dist/domain/tasks/system/task-state.js +0 -287
- package/dist/domain/threads/artifact-io.d.ts +0 -4
- package/dist/domain/threads/artifact-io.js +0 -57
- package/dist/domain/threads/contract.d.ts +0 -17
- package/dist/domain/threads/contract.js +0 -54
- package/dist/domain/threads/evidence-context.d.ts +0 -2
- package/dist/domain/threads/evidence-context.js +0 -40
- package/dist/domain/threads/hook-runner.d.ts +0 -7
- package/dist/domain/threads/hook-runner.js +0 -237
- package/dist/domain/threads/index.d.ts +0 -7
- package/dist/domain/threads/index.js +0 -13
- package/dist/domain/threads/pending-user-inputs.d.ts +0 -3
- package/dist/domain/threads/pending-user-inputs.js +0 -33
- package/dist/domain/threads/prompt-builder.d.ts +0 -55
- package/dist/domain/threads/prompt-builder.js +0 -245
- package/dist/domain/threads/runner.d.ts +0 -150
- package/dist/domain/threads/runner.js +0 -832
- package/dist/domain/threads/shell-templates.d.ts +0 -9
- package/dist/domain/threads/shell-templates.js +0 -108
- package/dist/domain/threads/state-machine.d.ts +0 -96
- package/dist/domain/threads/state-machine.js +0 -646
- package/dist/domain/threads/template-loader.d.ts +0 -37
- package/dist/domain/threads/template-loader.js +0 -487
- package/dist/domain/threads/template-validate.d.ts +0 -287
- package/dist/domain/threads/template-validate.js +0 -575
- package/dist/domain/threads/template-validate.parity.d.ts +0 -1
- package/dist/domain/threads/template-validate.parity.js +0 -39
- package/dist/domain/threads/template-writer.d.ts +0 -57
- package/dist/domain/threads/template-writer.js +0 -126
- package/dist/domain/threads/thread-transcript.d.ts +0 -60
- package/dist/domain/threads/thread-transcript.js +0 -117
- package/dist/domain/threads/tree.d.ts +0 -46
- package/dist/domain/threads/tree.js +0 -196
- package/dist/domain/threads/utils.d.ts +0 -24
- package/dist/domain/threads/utils.js +0 -55
- package/dist/domain/ui-service/mutate/tasks.d.ts +0 -23
- package/dist/domain/ui-service/mutate/tasks.js +0 -58
- package/dist/domain/ui-service/mutate/thread-templates.d.ts +0 -4
- package/dist/domain/ui-service/mutate/thread-templates.js +0 -46
- package/dist/domain/ui-service/mutate/threads.d.ts +0 -4
- package/dist/domain/ui-service/mutate/threads.js +0 -19
- package/dist/domain/ui-service/query/task-verification.d.ts +0 -2
- package/dist/domain/ui-service/query/task-verification.js +0 -58
- package/dist/domain/ui-service/query/tasks.d.ts +0 -3
- package/dist/domain/ui-service/query/tasks.js +0 -73
- package/dist/domain/ui-service/query/thread-template-detail.d.ts +0 -2
- package/dist/domain/ui-service/query/thread-template-detail.js +0 -57
- package/dist/domain/ui-service/query/thread-templates.d.ts +0 -15
- package/dist/domain/ui-service/query/thread-templates.js +0 -79
- package/dist/domain/ui-service/query/threads.d.ts +0 -3
- package/dist/domain/ui-service/query/threads.js +0 -180
- package/dist/hooks/task-status-check.mjs +0 -166
- package/dist/hooks/tasks-yaml-guard.mjs +0 -225
- package/dist/orchestration/dispatch-reconciler.d.ts +0 -1
- package/dist/orchestration/dispatch-reconciler.js +0 -19
- package/dist/orchestration/human-answer-backstop.d.ts +0 -36
- package/dist/orchestration/human-answer-backstop.js +0 -69
- package/dist/orchestration/manager-qa.d.ts +0 -66
- package/dist/orchestration/manager-qa.js +0 -356
- package/dist/orchestration/routing/commands/dispatch.d.ts +0 -2
- package/dist/orchestration/routing/commands/dispatch.js +0 -48
- package/dist/orchestration/routing/commands/task.d.ts +0 -4
- package/dist/orchestration/routing/commands/task.js +0 -140
- package/dist/orchestration/routing/commands/thread-handlers.d.ts +0 -2
- package/dist/orchestration/routing/commands/thread-handlers.js +0 -152
- package/dist/orchestration/thread-callback.d.ts +0 -107
- package/dist/orchestration/thread-callback.js +0 -555
- package/dist/orchestration/thread-delivery.d.ts +0 -40
- package/dist/orchestration/thread-delivery.js +0 -76
- package/dist/orchestration/thread-executor.d.ts +0 -25
- package/dist/orchestration/thread-executor.js +0 -180
- package/dist/orchestration/thread-input.d.ts +0 -15
- package/dist/orchestration/thread-input.js +0 -50
- package/dist/orchestration/thread-notices.d.ts +0 -43
- package/dist/orchestration/thread-notices.js +0 -195
- package/dist/orchestration/thread-run/index.d.ts +0 -3
- package/dist/orchestration/thread-run/index.js +0 -2
- package/dist/orchestration/thread-run/render-summary.d.ts +0 -57
- package/dist/orchestration/thread-run/render-summary.js +0 -109
- package/dist/orchestration/thread-run/render-task.d.ts +0 -94
- package/dist/orchestration/thread-run/render-task.js +0 -154
- package/dist/orchestration/thread-run/settle.d.ts +0 -11
- package/dist/orchestration/thread-run/settle.js +0 -18
- package/dist/orchestration/thread-run/thread-run.d.ts +0 -114
- package/dist/orchestration/thread-run/thread-run.js +0 -181
- package/dist/orchestration/thread-run/thread-surface.d.ts +0 -41
- package/dist/orchestration/thread-run/thread-surface.js +0 -23
- package/dist/orchestration/thread-run/verdict.d.ts +0 -11
- package/dist/orchestration/thread-run/verdict.js +0 -20
- package/dist/store/plugin-retirement.d.ts +0 -37
- package/dist/store/plugin-retirement.js +0 -144
- package/dist/store/task-repo.d.ts +0 -43
- package/dist/store/task-repo.js +0 -143
- package/dist/store/thread-repo.d.ts +0 -65
- package/dist/store/thread-repo.js +0 -294
- package/dist/tui/components/DashboardTasksTab.d.ts +0 -12
- package/dist/tui/components/DashboardTasksTab.js +0 -196
- package/dist/tui/components/DashboardThreadsTab.d.ts +0 -11
- package/dist/tui/components/DashboardThreadsTab.js +0 -96
- package/web/dist/assets/index-C9sEss8T.css +0 -1
- package/web/dist/assets/index-fVf_wSMQ.js +0 -447
- /package/defaults/config/{thread-templates/agents → environments}/creative.json +0 -0
- /package/dist/core/types/{thread-types.js → benchmark-types.js} +0 -0
- /package/dist/domain/{threads/template-resolver.d.ts → agents/environments/prompt-includes.d.ts} +0 -0
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
paths:
|
|
3
|
-
- "context/projects/*/TASKS.yaml"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Task System — Executing Agent Guide
|
|
7
|
-
|
|
8
|
-
You are reading a TASKS.yaml file. This is a structured task queue, and you have been dispatched to execute specific tasks within it.
|
|
9
|
-
|
|
10
|
-
## TASKS.yaml Format
|
|
11
|
-
|
|
12
|
-
```yaml
|
|
13
|
-
tasks:
|
|
14
|
-
- id: c8a2
|
|
15
|
-
text: "Task description starting with a verb"
|
|
16
|
-
why: "Why this task needs to be done"
|
|
17
|
-
done-when: "Verifiable completion condition"
|
|
18
|
-
priority: medium # high | medium | low
|
|
19
|
-
status: open # open | done
|
|
20
|
-
template: <thread-template-name>
|
|
21
|
-
plan: path/to/design-doc.md
|
|
22
|
-
# Optional fields (defaults apply when omitted)
|
|
23
|
-
depends-on: [a1b2]
|
|
24
|
-
gpu: <machine-name> # optional: target machine for GPU tasks
|
|
25
|
-
blocked-by: "Blocking reason"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## Status Update
|
|
29
|
-
|
|
30
|
-
Use the single CLI `cortex-task` to update task status, **do not manually edit TASKS.yaml**:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
# Claim task
|
|
34
|
-
cortex-task claim --project <project> --task-id <id>
|
|
35
|
-
# Complete task
|
|
36
|
-
cortex-task complete --project <project> --task-id <id> --note "Completion note"
|
|
37
|
-
# Mark blocked
|
|
38
|
-
cortex-task block --project <project> --task-id <id> --reason "Blocking reason"
|
|
39
|
-
# Unblock
|
|
40
|
-
cortex-task unblock --project <project> --task-id <id>
|
|
41
|
-
# Query
|
|
42
|
-
cortex-task query --project <project> --status actionable --json
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
Run `cortex-task --help` for the full list of commands and parameters.
|
|
46
|
-
|
|
47
|
-
## Partial Completion
|
|
48
|
-
|
|
49
|
-
Never set status to done + "(partial)". If work is only partially completed:
|
|
50
|
-
- Keep status: open and update the description to reflect remaining work
|
|
51
|
-
- Or split into completed subtask + new open task
|
|
52
|
-
|
|
53
|
-
status: done is a terminal state — the task selector treats it as completed and never revisits it.
|
package/dist/core/task-node.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** Durable home of a composite task node: context/projects/{project}/manager/{taskId}/. */
|
|
2
|
-
export declare function managerNodeDir(project: string, taskId: string): string;
|
|
3
|
-
/** The task-keyed manager artifact (truth layer for checkpoints — DR-0017 D2). */
|
|
4
|
-
export declare function taskArtifactPath(project: string, taskId: string): string;
|
|
5
|
-
/** Create the node dir + artifact if missing. NEVER truncates an existing artifact —
|
|
6
|
-
* a new manager incarnation must inherit the previous checkpoint (rotation/rehydration). */
|
|
7
|
-
export declare function ensureTaskArtifact(project: string, taskId: string): string;
|
package/dist/core/task-node.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Task-node (composite/manager task) filesystem locations — DR-0017 W1.
|
|
2
|
-
import { mkdirSync, writeFileSync, existsSync } from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
|
-
import { PROJECTS_DIR } from './paths.js';
|
|
5
|
-
/** Durable home of a composite task node: context/projects/{project}/manager/{taskId}/. */
|
|
6
|
-
export function managerNodeDir(project, taskId) {
|
|
7
|
-
return path.join(PROJECTS_DIR, project, 'manager', taskId);
|
|
8
|
-
}
|
|
9
|
-
/** The task-keyed manager artifact (truth layer for checkpoints — DR-0017 D2). */
|
|
10
|
-
export function taskArtifactPath(project, taskId) {
|
|
11
|
-
return path.join(managerNodeDir(project, taskId), 'artifact.md');
|
|
12
|
-
}
|
|
13
|
-
/** Create the node dir + artifact if missing. NEVER truncates an existing artifact —
|
|
14
|
-
* a new manager incarnation must inherit the previous checkpoint (rotation/rehydration). */
|
|
15
|
-
export function ensureTaskArtifact(project, taskId) {
|
|
16
|
-
mkdirSync(managerNodeDir(project, taskId), { recursive: true });
|
|
17
|
-
const p = taskArtifactPath(project, taskId);
|
|
18
|
-
if (!existsSync(p))
|
|
19
|
-
writeFileSync(p, '');
|
|
20
|
-
return p;
|
|
21
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
export interface Task {
|
|
2
|
-
id: string;
|
|
3
|
-
text: string;
|
|
4
|
-
why: string;
|
|
5
|
-
done_when: string;
|
|
6
|
-
priority: 'high' | 'medium' | 'low';
|
|
7
|
-
status: 'open' | 'done' | 'pending';
|
|
8
|
-
template: string;
|
|
9
|
-
plan: string;
|
|
10
|
-
project: string;
|
|
11
|
-
/** Parent task id (DR-0014 task tree). Children created by decompose --keep-parent point
|
|
12
|
-
* at the retained parent, which becomes the join/acceptance node via depends_on. */
|
|
13
|
-
parent: string | null;
|
|
14
|
-
depends_on: string[];
|
|
15
|
-
gpu: string | null;
|
|
16
|
-
gpu_count: number;
|
|
17
|
-
blocked_by: string | null;
|
|
18
|
-
claimed_by: string | null;
|
|
19
|
-
claimed_at: string | null;
|
|
20
|
-
/** Opaque dispatch incarnation retained through valid automated completion for callback fencing. */
|
|
21
|
-
dispatch_generation: string | null;
|
|
22
|
-
paused: boolean;
|
|
23
|
-
approval_needed: boolean;
|
|
24
|
-
approved_at: string | null;
|
|
25
|
-
not_before: string | null;
|
|
26
|
-
completed_at: string | null;
|
|
27
|
-
completed_note: string | null;
|
|
28
|
-
pending_at: string | null;
|
|
29
|
-
/** Provenance for session→task wake (Problem 1). Captured from CORTEX_* / channel env when a
|
|
30
|
-
* task is created from within a running session or agent. On task.completed, if origin_channel
|
|
31
|
-
* is set (and no thread is waiting on this task), the originating session is woken. */
|
|
32
|
-
origin_session_id: string | null;
|
|
33
|
-
origin_channel: string | null;
|
|
34
|
-
origin_thread_id: string | null;
|
|
35
|
-
}
|
|
36
|
-
export interface TaskGenerationExpectation {
|
|
37
|
-
generation: string | null;
|
|
38
|
-
}
|
|
39
|
-
export interface LockState {
|
|
40
|
-
owner: string;
|
|
41
|
-
acquired_at: string;
|
|
42
|
-
expires_at: string;
|
|
43
|
-
note?: string;
|
|
44
|
-
}
|
|
45
|
-
declare const PRIORITY_ORDER: Record<string, number>;
|
|
46
|
-
declare const VALID_STATUSES: Set<string>;
|
|
47
|
-
declare function rawToTask(raw: any, project: string): Task;
|
|
48
|
-
declare function parseTasksFile(content: string, project: string): Task[];
|
|
49
|
-
declare function parseTasksFileWithLock(content: string, project: string): {
|
|
50
|
-
tasks: Task[];
|
|
51
|
-
lock: LockState | null;
|
|
52
|
-
};
|
|
53
|
-
declare function taskToYamlObj(task: Task): Record<string, any>;
|
|
54
|
-
declare function serializeTasksFileWithLock({ tasks, lock }: {
|
|
55
|
-
tasks: Task[];
|
|
56
|
-
lock?: LockState | null;
|
|
57
|
-
}): string;
|
|
58
|
-
declare function getTasksYamlPath(project: string): string;
|
|
59
|
-
/** Test seam: cumulative cache hit/miss counters for the scanAllTasks content cache. */
|
|
60
|
-
declare function _tasksFileCacheStats(): {
|
|
61
|
-
hits: number;
|
|
62
|
-
misses: number;
|
|
63
|
-
};
|
|
64
|
-
declare function scanAllTasks(project?: string | null): Task[];
|
|
65
|
-
declare function completedHashSet(tasks: Task[]): Set<string>;
|
|
66
|
-
declare function isActionable(task: Task, completedHashes?: Set<string> | null): boolean;
|
|
67
|
-
declare function scanAvailableTasks(): Task[];
|
|
68
|
-
declare function getTaskStats(): any;
|
|
69
|
-
declare function taskStatuses(task: Task, completedHashes?: Set<string> | null): Set<string>;
|
|
70
|
-
declare function filterTasks(tasks: Task[], args: any, completedHashes?: Set<string> | null): Task[];
|
|
71
|
-
declare function getTaskStatsFromTasks(tasks: Task[]): any;
|
|
72
|
-
declare function printTaskListToString(tasks: Task[], actionableHeader?: boolean, showDeps?: boolean): string;
|
|
73
|
-
declare function printStatsText(stats: any): string;
|
|
74
|
-
declare function showPayload(task: Task, tasks: Task[]): {
|
|
75
|
-
task: Task;
|
|
76
|
-
actionable: boolean;
|
|
77
|
-
dependents: string[];
|
|
78
|
-
depends_on: Task[];
|
|
79
|
-
};
|
|
80
|
-
declare function depsPayload(task: Task, tasks: Task[]): {
|
|
81
|
-
task: Task;
|
|
82
|
-
actionable: boolean;
|
|
83
|
-
dependents: string[];
|
|
84
|
-
depends_on: Task[];
|
|
85
|
-
};
|
|
86
|
-
export { PRIORITY_ORDER, VALID_STATUSES, completedHashSet, depsPayload, filterTasks, getTaskStats, getTaskStatsFromTasks, getTasksYamlPath, isActionable, parseTasksFile, parseTasksFileWithLock, printStatsText, printTaskListToString, rawToTask, scanAllTasks, scanAvailableTasks, _tasksFileCacheStats, serializeTasksFileWithLock, showPayload, taskToYamlObj, taskStatuses, };
|
package/dist/core/task-parser.js
DELETED
|
@@ -1,436 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs';
|
|
2
|
-
import * as path from 'node:path';
|
|
3
|
-
import { parse as yamlParse, stringify as yamlStringify } from 'yaml';
|
|
4
|
-
import { PROJECTS_DIR, CONTEXT_DIR } from './paths.js';
|
|
5
|
-
import { listProjectDirs } from './utils.js';
|
|
6
|
-
// ── YAML key mapping (kebab-case ↔ snake_case) ──
|
|
7
|
-
const YAML_TO_TS = {
|
|
8
|
-
'done-when': 'done_when',
|
|
9
|
-
'depends-on': 'depends_on',
|
|
10
|
-
'gpu-count': 'gpu_count',
|
|
11
|
-
'blocked-by': 'blocked_by',
|
|
12
|
-
'claimed-by': 'claimed_by',
|
|
13
|
-
'claimed-at': 'claimed_at',
|
|
14
|
-
'dispatch-generation': 'dispatch_generation',
|
|
15
|
-
'approval-needed': 'approval_needed',
|
|
16
|
-
'approved-at': 'approved_at',
|
|
17
|
-
'not-before': 'not_before',
|
|
18
|
-
'completed-at': 'completed_at',
|
|
19
|
-
'completed-note': 'completed_note',
|
|
20
|
-
'pending-at': 'pending_at',
|
|
21
|
-
'origin-session-id': 'origin_session_id',
|
|
22
|
-
'origin-channel': 'origin_channel',
|
|
23
|
-
'origin-thread-id': 'origin_thread_id',
|
|
24
|
-
};
|
|
25
|
-
const TS_TO_YAML = Object.fromEntries(Object.entries(YAML_TO_TS).map(([k, v]) => [v, k]));
|
|
26
|
-
function yamlKeyToTs(key) {
|
|
27
|
-
return YAML_TO_TS[key] ?? key;
|
|
28
|
-
}
|
|
29
|
-
function tsKeyToYaml(key) {
|
|
30
|
-
return TS_TO_YAML[key] ?? key;
|
|
31
|
-
}
|
|
32
|
-
// ── Constants ──
|
|
33
|
-
const OVERVIEW_PRIORITY_MAP = { '主线': 3, '高': 3, '中': 2, '低': 1 };
|
|
34
|
-
const PRIORITY_ORDER = { high: 3, medium: 2, low: 1 };
|
|
35
|
-
const VALID_STATUSES = new Set([
|
|
36
|
-
'actionable', 'open', 'blocked', 'in-progress', 'paused',
|
|
37
|
-
'pending', 'completed', 'approval-needed', 'approved',
|
|
38
|
-
]);
|
|
39
|
-
const TASK_DEFAULTS = {
|
|
40
|
-
parent: null,
|
|
41
|
-
depends_on: [],
|
|
42
|
-
gpu: null,
|
|
43
|
-
gpu_count: 1,
|
|
44
|
-
blocked_by: null,
|
|
45
|
-
claimed_by: null,
|
|
46
|
-
claimed_at: null,
|
|
47
|
-
dispatch_generation: null,
|
|
48
|
-
paused: false,
|
|
49
|
-
approval_needed: false,
|
|
50
|
-
approved_at: null,
|
|
51
|
-
not_before: null,
|
|
52
|
-
completed_at: null,
|
|
53
|
-
completed_note: null,
|
|
54
|
-
pending_at: null,
|
|
55
|
-
origin_session_id: null,
|
|
56
|
-
origin_channel: null,
|
|
57
|
-
origin_thread_id: null,
|
|
58
|
-
};
|
|
59
|
-
// ── Parsing ──
|
|
60
|
-
function rawToTask(raw, project) {
|
|
61
|
-
const mapped = {};
|
|
62
|
-
for (const [key, value] of Object.entries(raw)) {
|
|
63
|
-
mapped[yamlKeyToTs(key)] = value;
|
|
64
|
-
}
|
|
65
|
-
return {
|
|
66
|
-
id: String(mapped.id ?? ''),
|
|
67
|
-
text: String(mapped.text ?? ''),
|
|
68
|
-
why: String(mapped.why ?? ''),
|
|
69
|
-
done_when: String(mapped.done_when ?? ''),
|
|
70
|
-
priority: PRIORITY_ORDER[mapped.priority] ? mapped.priority : 'medium',
|
|
71
|
-
status: (mapped.status === 'done' || mapped.status === 'pending') ? mapped.status : 'open',
|
|
72
|
-
template: String(mapped.template ?? ''),
|
|
73
|
-
plan: String(mapped.plan ?? ''),
|
|
74
|
-
project,
|
|
75
|
-
parent: mapped.parent != null ? String(mapped.parent) : null,
|
|
76
|
-
depends_on: Array.isArray(mapped.depends_on) ? mapped.depends_on.map(String) : [],
|
|
77
|
-
gpu: mapped.gpu != null ? String(mapped.gpu) : null,
|
|
78
|
-
gpu_count: typeof mapped.gpu_count === 'number' ? mapped.gpu_count : 1,
|
|
79
|
-
blocked_by: mapped.blocked_by != null ? String(mapped.blocked_by) : null,
|
|
80
|
-
claimed_by: mapped.claimed_by != null ? String(mapped.claimed_by) : null,
|
|
81
|
-
claimed_at: mapped.claimed_at != null ? String(mapped.claimed_at) : null,
|
|
82
|
-
dispatch_generation: mapped.dispatch_generation != null ? String(mapped.dispatch_generation) : null,
|
|
83
|
-
paused: Boolean(mapped.paused),
|
|
84
|
-
approval_needed: Boolean(mapped.approval_needed),
|
|
85
|
-
approved_at: mapped.approved_at != null ? String(mapped.approved_at) : null,
|
|
86
|
-
not_before: mapped.not_before != null ? String(mapped.not_before) : null,
|
|
87
|
-
completed_at: mapped.completed_at != null ? String(mapped.completed_at) : null,
|
|
88
|
-
completed_note: mapped.completed_note != null ? String(mapped.completed_note) : null,
|
|
89
|
-
pending_at: mapped.pending_at != null ? String(mapped.pending_at) : null,
|
|
90
|
-
origin_session_id: mapped.origin_session_id != null ? String(mapped.origin_session_id) : null,
|
|
91
|
-
origin_channel: mapped.origin_channel != null ? String(mapped.origin_channel) : null,
|
|
92
|
-
origin_thread_id: mapped.origin_thread_id != null ? String(mapped.origin_thread_id) : null,
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function parseTasksFile(content, project) {
|
|
96
|
-
return parseTasksFileWithLock(content, project).tasks;
|
|
97
|
-
}
|
|
98
|
-
function parseTasksFileWithLock(content, project) {
|
|
99
|
-
if (!content.trim())
|
|
100
|
-
return { tasks: [], lock: null };
|
|
101
|
-
let parsed;
|
|
102
|
-
try {
|
|
103
|
-
parsed = yamlParse(content);
|
|
104
|
-
}
|
|
105
|
-
catch {
|
|
106
|
-
return { tasks: [], lock: null };
|
|
107
|
-
}
|
|
108
|
-
if (!parsed || typeof parsed !== 'object')
|
|
109
|
-
return { tasks: [], lock: null };
|
|
110
|
-
let lock = null;
|
|
111
|
-
if (parsed.lock && typeof parsed.lock === 'object') {
|
|
112
|
-
const l = parsed.lock;
|
|
113
|
-
if (typeof l.owner === 'string' && typeof l.acquired_at === 'string' && typeof l.expires_at === 'string') {
|
|
114
|
-
lock = {
|
|
115
|
-
owner: l.owner,
|
|
116
|
-
acquired_at: l.acquired_at,
|
|
117
|
-
expires_at: l.expires_at,
|
|
118
|
-
note: typeof l.note === 'string' ? l.note : undefined,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
const tasks = Array.isArray(parsed.tasks) ? parsed.tasks.map((raw) => rawToTask(raw, project)) : [];
|
|
123
|
-
return { tasks, lock };
|
|
124
|
-
}
|
|
125
|
-
// ── Serialization ──
|
|
126
|
-
const REQUIRED_KEYS = ['id', 'text', 'why', 'done_when', 'priority', 'status', 'template', 'plan'];
|
|
127
|
-
const OPTIONAL_KEY_ORDER = [
|
|
128
|
-
'parent', 'depends_on', 'gpu', 'gpu_count', 'blocked_by', 'claimed_by', 'claimed_at',
|
|
129
|
-
'dispatch_generation', 'paused', 'approval_needed', 'approved_at', 'not_before', 'pending_at',
|
|
130
|
-
'completed_at', 'completed_note',
|
|
131
|
-
'origin_session_id', 'origin_channel', 'origin_thread_id',
|
|
132
|
-
];
|
|
133
|
-
function isDefault(key, value) {
|
|
134
|
-
const def = TASK_DEFAULTS[key];
|
|
135
|
-
if (def === undefined)
|
|
136
|
-
return false;
|
|
137
|
-
if (Array.isArray(def))
|
|
138
|
-
return Array.isArray(value) && value.length === 0;
|
|
139
|
-
return value === def;
|
|
140
|
-
}
|
|
141
|
-
function taskToYamlObj(task) {
|
|
142
|
-
const obj = {};
|
|
143
|
-
for (const key of REQUIRED_KEYS) {
|
|
144
|
-
obj[tsKeyToYaml(key)] = task[key];
|
|
145
|
-
}
|
|
146
|
-
for (const key of OPTIONAL_KEY_ORDER) {
|
|
147
|
-
const value = task[key];
|
|
148
|
-
if (!isDefault(key, value)) {
|
|
149
|
-
obj[tsKeyToYaml(key)] = value;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return obj;
|
|
153
|
-
}
|
|
154
|
-
function serializeTasksFileWithLock({ tasks, lock }) {
|
|
155
|
-
if (tasks.length === 0 && !lock)
|
|
156
|
-
return 'tasks: []\n';
|
|
157
|
-
const objs = tasks.map(taskToYamlObj);
|
|
158
|
-
if (lock) {
|
|
159
|
-
return yamlStringify({ lock, tasks: objs }, { lineWidth: 0 });
|
|
160
|
-
}
|
|
161
|
-
return yamlStringify({ tasks: objs }, { lineWidth: 0 });
|
|
162
|
-
}
|
|
163
|
-
// ── Scanning ──
|
|
164
|
-
function getTasksYamlPath(project) {
|
|
165
|
-
return path.join(PROJECTS_DIR, project, 'TASKS.yaml');
|
|
166
|
-
}
|
|
167
|
-
/** Content-keyed parse cache. YAML parsing dominates scan cost (seconds across projects on the
|
|
168
|
-
* dispatch hot path); the raw read is cheap. Keyed by exact file content, so edits from ANY
|
|
169
|
-
* process (CLI, git pull, other threads) invalidate naturally — no mtime-granularity races.
|
|
170
|
-
* Results are structuredClone'd on the way out so callers can never mutate the cached copy. */
|
|
171
|
-
const tasksFileCache = new Map();
|
|
172
|
-
let tasksCacheHits = 0;
|
|
173
|
-
let tasksCacheMisses = 0;
|
|
174
|
-
function parseTasksFileCached(tasksPath, project) {
|
|
175
|
-
const content = fs.readFileSync(tasksPath, 'utf8');
|
|
176
|
-
const hit = tasksFileCache.get(tasksPath);
|
|
177
|
-
if (hit && hit.content === content) {
|
|
178
|
-
tasksCacheHits++;
|
|
179
|
-
return structuredClone(hit.tasks);
|
|
180
|
-
}
|
|
181
|
-
tasksCacheMisses++;
|
|
182
|
-
const tasks = parseTasksFile(content, project);
|
|
183
|
-
tasksFileCache.set(tasksPath, { content, tasks });
|
|
184
|
-
return structuredClone(tasks);
|
|
185
|
-
}
|
|
186
|
-
/** Test seam: cumulative cache hit/miss counters for the scanAllTasks content cache. */
|
|
187
|
-
function _tasksFileCacheStats() {
|
|
188
|
-
return { hits: tasksCacheHits, misses: tasksCacheMisses };
|
|
189
|
-
}
|
|
190
|
-
function scanAllTasks(project = null) {
|
|
191
|
-
if (!fs.existsSync(PROJECTS_DIR))
|
|
192
|
-
return [];
|
|
193
|
-
const tasks = [];
|
|
194
|
-
for (const projectName of listProjectDirs()) {
|
|
195
|
-
if (project && projectName !== project)
|
|
196
|
-
continue;
|
|
197
|
-
const tasksPath = getTasksYamlPath(projectName);
|
|
198
|
-
if (!fs.existsSync(tasksPath))
|
|
199
|
-
continue;
|
|
200
|
-
tasks.push(...parseTasksFileCached(tasksPath, projectName));
|
|
201
|
-
}
|
|
202
|
-
return tasks;
|
|
203
|
-
}
|
|
204
|
-
// ── Query helpers ──
|
|
205
|
-
function parseProjectPriorities() {
|
|
206
|
-
const overviewPath = path.join(CONTEXT_DIR, 'OVERVIEW.md');
|
|
207
|
-
if (!fs.existsSync(overviewPath))
|
|
208
|
-
return {};
|
|
209
|
-
const lines = fs.readFileSync(overviewPath, 'utf8').split('\n');
|
|
210
|
-
const priorities = {};
|
|
211
|
-
let headerFound = false;
|
|
212
|
-
for (const line of lines) {
|
|
213
|
-
const stripped = line.trim();
|
|
214
|
-
if (!stripped.startsWith('|')) {
|
|
215
|
-
if (headerFound)
|
|
216
|
-
break;
|
|
217
|
-
continue;
|
|
218
|
-
}
|
|
219
|
-
const columns = stripped.split('|').slice(1, -1).map((col) => col.trim());
|
|
220
|
-
if (columns.length < 3)
|
|
221
|
-
continue;
|
|
222
|
-
if (!headerFound) {
|
|
223
|
-
headerFound = columns[0].toLowerCase() === 'project';
|
|
224
|
-
continue;
|
|
225
|
-
}
|
|
226
|
-
if (columns[0].startsWith('-'))
|
|
227
|
-
continue;
|
|
228
|
-
priorities[columns[0]] = OVERVIEW_PRIORITY_MAP[columns[2].replace(/\*\*/g, '')] || 0;
|
|
229
|
-
}
|
|
230
|
-
return priorities;
|
|
231
|
-
}
|
|
232
|
-
function completedHashSet(tasks) {
|
|
233
|
-
return new Set(tasks.filter((t) => t.status === 'done' && t.id).map((t) => t.id));
|
|
234
|
-
}
|
|
235
|
-
function isActionable(task, completedHashes = null) {
|
|
236
|
-
const hasUnmetDeps = completedHashes
|
|
237
|
-
? task.depends_on.some((dep) => !completedHashes.has(dep))
|
|
238
|
-
: task.depends_on.length > 0;
|
|
239
|
-
const today = new Date().toISOString().slice(0, 10);
|
|
240
|
-
return !(task.status === 'done'
|
|
241
|
-
|| task.status === 'pending'
|
|
242
|
-
|| task.paused
|
|
243
|
-
|| task.claimed_by
|
|
244
|
-
|| task.blocked_by
|
|
245
|
-
|| (task.approval_needed && !task.approved_at)
|
|
246
|
-
|| hasUnmetDeps
|
|
247
|
-
|| (task.not_before && task.not_before > today));
|
|
248
|
-
}
|
|
249
|
-
function taskSortKey(task, projectPriorities) {
|
|
250
|
-
return [
|
|
251
|
-
projectPriorities[task.project] || 0,
|
|
252
|
-
task.done_when ? 1 : 0,
|
|
253
|
-
PRIORITY_ORDER[task.priority] || 0,
|
|
254
|
-
];
|
|
255
|
-
}
|
|
256
|
-
function compareSortKey(left, right) {
|
|
257
|
-
for (let i = 0; i < left.length; i++) {
|
|
258
|
-
if (left[i] !== right[i])
|
|
259
|
-
return right[i] - left[i];
|
|
260
|
-
}
|
|
261
|
-
return 0;
|
|
262
|
-
}
|
|
263
|
-
function scanAvailableTasks() {
|
|
264
|
-
const projectPriorities = parseProjectPriorities();
|
|
265
|
-
const allTasks = scanAllTasks();
|
|
266
|
-
const completed = completedHashSet(allTasks);
|
|
267
|
-
return allTasks
|
|
268
|
-
.filter((task) => isActionable(task, completed))
|
|
269
|
-
.sort((a, b) => compareSortKey(taskSortKey(a, projectPriorities), taskSortKey(b, projectPriorities)));
|
|
270
|
-
}
|
|
271
|
-
function getTaskStats() {
|
|
272
|
-
return getTaskStatsFromTasks(scanAllTasks());
|
|
273
|
-
}
|
|
274
|
-
const TASK_STATUS_CHECKS = [
|
|
275
|
-
['blocked', (t) => t.blocked_by],
|
|
276
|
-
['in-progress', (t) => t.claimed_by],
|
|
277
|
-
['paused', (t) => t.paused],
|
|
278
|
-
['approval-needed', (t) => t.approval_needed],
|
|
279
|
-
['approved', (t) => t.approved_at],
|
|
280
|
-
];
|
|
281
|
-
function taskStatuses(task, completedHashes = null) {
|
|
282
|
-
const statuses = new Set(task.status === 'done' ? ['completed'] : ['open']);
|
|
283
|
-
if (isActionable(task, completedHashes))
|
|
284
|
-
statuses.add('actionable');
|
|
285
|
-
for (const [name, check] of TASK_STATUS_CHECKS) {
|
|
286
|
-
if (check(task))
|
|
287
|
-
statuses.add(name);
|
|
288
|
-
}
|
|
289
|
-
return statuses;
|
|
290
|
-
}
|
|
291
|
-
function filterTasks(tasks, args, completedHashes = null) {
|
|
292
|
-
let filtered = tasks;
|
|
293
|
-
if (args.project)
|
|
294
|
-
filtered = filtered.filter((t) => t.project === args.project);
|
|
295
|
-
if (args.taskId)
|
|
296
|
-
filtered = filtered.filter((t) => t.id === args.taskId);
|
|
297
|
-
if (args.status)
|
|
298
|
-
filtered = filtered.filter((t) => taskStatuses(t, completedHashes).has(args.status));
|
|
299
|
-
if (args.priority)
|
|
300
|
-
filtered = filtered.filter((t) => t.priority === args.priority);
|
|
301
|
-
if (args.text) {
|
|
302
|
-
const needle = args.text.toLowerCase();
|
|
303
|
-
filtered = filtered.filter((t) => t.text.toLowerCase().includes(needle));
|
|
304
|
-
}
|
|
305
|
-
if (args.hasDeps)
|
|
306
|
-
filtered = filtered.filter((t) => t.depends_on.length > 0);
|
|
307
|
-
if (args.noDeps)
|
|
308
|
-
filtered = filtered.filter((t) => t.depends_on.length === 0);
|
|
309
|
-
return filtered;
|
|
310
|
-
}
|
|
311
|
-
// ── Stats ──
|
|
312
|
-
function computeProjectStats(projectTasks, completed) {
|
|
313
|
-
return {
|
|
314
|
-
actionable: projectTasks.filter((t) => isActionable(t, completed)).length,
|
|
315
|
-
blocked: projectTasks.filter((t) => t.blocked_by).length,
|
|
316
|
-
in_progress: projectTasks.filter((t) => t.claimed_by).length,
|
|
317
|
-
paused: projectTasks.filter((t) => t.paused).length,
|
|
318
|
-
completed: projectTasks.filter((t) => t.status === 'done').length,
|
|
319
|
-
total: projectTasks.length,
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
function getTaskStatsFromTasks(tasks) {
|
|
323
|
-
const completed = completedHashSet(tasks);
|
|
324
|
-
const stats = {
|
|
325
|
-
projects: {},
|
|
326
|
-
total: { actionable: 0, blocked: 0, in_progress: 0, paused: 0, completed: 0, total: 0 },
|
|
327
|
-
};
|
|
328
|
-
for (const project of [...new Set(tasks.map((t) => t.project))].sort()) {
|
|
329
|
-
const projectTasks = tasks.filter((t) => t.project === project);
|
|
330
|
-
const projectStats = computeProjectStats(projectTasks, completed);
|
|
331
|
-
stats.projects[project] = projectStats;
|
|
332
|
-
for (const key of Object.keys(stats.total))
|
|
333
|
-
stats.total[key] += projectStats[key];
|
|
334
|
-
}
|
|
335
|
-
return stats;
|
|
336
|
-
}
|
|
337
|
-
// ── Display ──
|
|
338
|
-
function taskDisplayTags(task) {
|
|
339
|
-
const tags = [];
|
|
340
|
-
if (task.claimed_by)
|
|
341
|
-
tags.push(`in-progress:${task.claimed_at || task.claimed_by}`);
|
|
342
|
-
if (task.paused)
|
|
343
|
-
tags.push('paused');
|
|
344
|
-
if (task.blocked_by)
|
|
345
|
-
tags.push(`blocked:${task.blocked_by}`);
|
|
346
|
-
if (task.depends_on.length > 0)
|
|
347
|
-
tags.push(`depends-on:${task.depends_on.join(',')}`);
|
|
348
|
-
if (task.gpu)
|
|
349
|
-
tags.push(`gpu:${task.gpu}`);
|
|
350
|
-
if (task.not_before)
|
|
351
|
-
tags.push(`not-before:${task.not_before}`);
|
|
352
|
-
return tags;
|
|
353
|
-
}
|
|
354
|
-
function formatTaskVerbose(task, index, tags) {
|
|
355
|
-
const idText = task.id ? ` #${task.id}` : '';
|
|
356
|
-
const tagText = tags.length > 0 ? ` [${tags.join(', ')}]` : '';
|
|
357
|
-
const lines = [`\n${index + 1}.${idText} [${task.project}] ${task.text}${tagText}`];
|
|
358
|
-
lines.push(` Priority: ${task.priority}`);
|
|
359
|
-
if (task.done_when)
|
|
360
|
-
lines.push(` Done when: ${task.done_when}`);
|
|
361
|
-
if (task.why)
|
|
362
|
-
lines.push(` Why: ${task.why}`);
|
|
363
|
-
return lines;
|
|
364
|
-
}
|
|
365
|
-
function formatTaskCompact(task, tags) {
|
|
366
|
-
const status = task.status === 'done' ? '[x]' : '[ ]';
|
|
367
|
-
const idText = task.id ? ` #${task.id}` : '';
|
|
368
|
-
const compactTags = tags.length > 0 ? ` (${tags.join(', ')})` : '';
|
|
369
|
-
return `${status}${idText} [${task.project}] ${task.text} [P:${task.priority}]${compactTags}`;
|
|
370
|
-
}
|
|
371
|
-
function printTaskListToString(tasks, actionableHeader = false, showDeps = false) {
|
|
372
|
-
const out = [];
|
|
373
|
-
if (actionableHeader) {
|
|
374
|
-
out.push('Actionable Tasks (sorted by priority)');
|
|
375
|
-
out.push('='.repeat(50));
|
|
376
|
-
}
|
|
377
|
-
for (const task of tasks) {
|
|
378
|
-
const tags = taskDisplayTags(task);
|
|
379
|
-
let line;
|
|
380
|
-
if (actionableHeader) {
|
|
381
|
-
line = formatTaskVerbose(task, tasks.indexOf(task), tags).join('\n');
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
line = formatTaskCompact(task, tags);
|
|
385
|
-
}
|
|
386
|
-
if (showDeps && task.depends_on.length > 0) {
|
|
387
|
-
line += ` → [${task.depends_on.join(', ')}]`;
|
|
388
|
-
}
|
|
389
|
-
out.push(line);
|
|
390
|
-
}
|
|
391
|
-
return out.join('\n');
|
|
392
|
-
}
|
|
393
|
-
function printStatsText(stats) {
|
|
394
|
-
const lines = ['Task Supply Statistics', '='.repeat(40)];
|
|
395
|
-
for (const [project, projectStats] of Object.entries(stats.projects)) {
|
|
396
|
-
const s = projectStats;
|
|
397
|
-
lines.push(`\n${project}:`);
|
|
398
|
-
lines.push(` Actionable: ${s.actionable}`);
|
|
399
|
-
lines.push(` Blocked: ${s.blocked}`);
|
|
400
|
-
lines.push(` In-progress:${s.in_progress}`);
|
|
401
|
-
lines.push(` Paused: ${s.paused}`);
|
|
402
|
-
lines.push(` Completed: ${s.completed}`);
|
|
403
|
-
lines.push(` Total: ${s.total}`);
|
|
404
|
-
}
|
|
405
|
-
lines.push(`\nTotal actionable: ${stats.total.actionable}`);
|
|
406
|
-
return lines.join('\n');
|
|
407
|
-
}
|
|
408
|
-
function showPayload(task, tasks) {
|
|
409
|
-
const byId = Object.fromEntries(tasks.filter((t) => t.id).map((t) => [t.id, t]));
|
|
410
|
-
const completed = completedHashSet(tasks);
|
|
411
|
-
const depMap = {};
|
|
412
|
-
for (const t of tasks) {
|
|
413
|
-
for (const dep of t.depends_on) {
|
|
414
|
-
if (!depMap[dep])
|
|
415
|
-
depMap[dep] = [];
|
|
416
|
-
depMap[dep].push(t);
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
const dependents = (depMap[task.id] || []).map((d) => d.id).filter(Boolean);
|
|
420
|
-
const dependsOn = task.depends_on.filter((d) => byId[d]).map((d) => byId[d]);
|
|
421
|
-
return { task, actionable: isActionable(task, completed), dependents, depends_on: dependsOn };
|
|
422
|
-
}
|
|
423
|
-
function depsPayload(task, tasks) {
|
|
424
|
-
const payload = showPayload(task, tasks);
|
|
425
|
-
const depMap = {};
|
|
426
|
-
for (const t of tasks) {
|
|
427
|
-
for (const dep of t.depends_on) {
|
|
428
|
-
if (!depMap[dep])
|
|
429
|
-
depMap[dep] = [];
|
|
430
|
-
depMap[dep].push(t);
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
payload.dependents = depMap[task.id] || [];
|
|
434
|
-
return payload;
|
|
435
|
-
}
|
|
436
|
-
export { PRIORITY_ORDER, VALID_STATUSES, completedHashSet, depsPayload, filterTasks, getTaskStats, getTaskStatsFromTasks, getTasksYamlPath, isActionable, parseTasksFile, parseTasksFileWithLock, printStatsText, printTaskListToString, rawToTask, scanAllTasks, scanAvailableTasks, _tasksFileCacheStats, serializeTasksFileWithLock, showPayload, taskToYamlObj, taskStatuses, };
|