@compass-ai/nova 1.0.74 → 1.0.76
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/dist/cli.js +557 -555
- package/dist/index.js +10 -8
- package/package.json +1 -1
- package/dist/acp/agent.d.ts +0 -318
- package/dist/acp/agent.d.ts.map +0 -1
- package/dist/acp/agent.js +0 -795
- package/dist/acp/agent.js.map +0 -1
- package/dist/acp/backpressure-writer.d.ts +0 -49
- package/dist/acp/backpressure-writer.d.ts.map +0 -1
- package/dist/acp/backpressure-writer.js +0 -153
- package/dist/acp/backpressure-writer.js.map +0 -1
- package/dist/acp/event-adapter.d.ts +0 -242
- package/dist/acp/event-adapter.d.ts.map +0 -1
- package/dist/acp/event-adapter.js +0 -456
- package/dist/acp/event-adapter.js.map +0 -1
- package/dist/acp/index.d.ts +0 -30
- package/dist/acp/index.d.ts.map +0 -1
- package/dist/acp/index.js +0 -36
- package/dist/acp/index.js.map +0 -1
- package/dist/acp/modes.d.ts +0 -56
- package/dist/acp/modes.d.ts.map +0 -1
- package/dist/acp/modes.js +0 -135
- package/dist/acp/modes.js.map +0 -1
- package/dist/acp/session-manager.d.ts +0 -170
- package/dist/acp/session-manager.d.ts.map +0 -1
- package/dist/acp/session-manager.js +0 -381
- package/dist/acp/session-manager.js.map +0 -1
- package/dist/acp/text-coalescer.d.ts +0 -45
- package/dist/acp/text-coalescer.d.ts.map +0 -1
- package/dist/acp/text-coalescer.js +0 -110
- package/dist/acp/text-coalescer.js.map +0 -1
- package/dist/acp/tool-bridge.d.ts +0 -156
- package/dist/acp/tool-bridge.d.ts.map +0 -1
- package/dist/acp/tool-bridge.js +0 -381
- package/dist/acp/tool-bridge.js.map +0 -1
- package/dist/acp/types.d.ts +0 -314
- package/dist/acp/types.d.ts.map +0 -1
- package/dist/acp/types.js +0 -8
- package/dist/acp/types.js.map +0 -1
- package/dist/cli.d.ts +0 -9
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/commands/acp.d.ts +0 -26
- package/dist/commands/acp.d.ts.map +0 -1
- package/dist/commands/acp.js +0 -492
- package/dist/commands/acp.js.map +0 -1
- package/dist/commands/cache.d.ts +0 -33
- package/dist/commands/cache.d.ts.map +0 -1
- package/dist/commands/cache.js +0 -537
- package/dist/commands/cache.js.map +0 -1
- package/dist/commands/config.d.ts +0 -10
- package/dist/commands/config.d.ts.map +0 -1
- package/dist/commands/config.js +0 -367
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/consent.d.ts +0 -21
- package/dist/commands/consent.d.ts.map +0 -1
- package/dist/commands/consent.js +0 -334
- package/dist/commands/consent.js.map +0 -1
- package/dist/commands/data.d.ts +0 -24
- package/dist/commands/data.d.ts.map +0 -1
- package/dist/commands/data.js +0 -586
- package/dist/commands/data.js.map +0 -1
- package/dist/commands/index.d.ts +0 -145
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -210
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/init.d.ts +0 -106
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -349
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/logs.d.ts +0 -13
- package/dist/commands/logs.d.ts.map +0 -1
- package/dist/commands/logs.js +0 -359
- package/dist/commands/logs.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -20
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -687
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/reset.d.ts +0 -20
- package/dist/commands/reset.d.ts.map +0 -1
- package/dist/commands/reset.js +0 -372
- package/dist/commands/reset.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -74
- package/dist/commands/setup.d.ts.map +0 -1
- package/dist/commands/setup.js +0 -863
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/slash/agents.d.ts +0 -40
- package/dist/commands/slash/agents.d.ts.map +0 -1
- package/dist/commands/slash/agents.js +0 -519
- package/dist/commands/slash/agents.js.map +0 -1
- package/dist/commands/slash/approve.d.ts +0 -46
- package/dist/commands/slash/approve.d.ts.map +0 -1
- package/dist/commands/slash/approve.js +0 -239
- package/dist/commands/slash/approve.js.map +0 -1
- package/dist/commands/slash/attach.d.ts +0 -70
- package/dist/commands/slash/attach.d.ts.map +0 -1
- package/dist/commands/slash/attach.js +0 -333
- package/dist/commands/slash/attach.js.map +0 -1
- package/dist/commands/slash/clear.d.ts +0 -47
- package/dist/commands/slash/clear.d.ts.map +0 -1
- package/dist/commands/slash/clear.js +0 -261
- package/dist/commands/slash/clear.js.map +0 -1
- package/dist/commands/slash/commit.d.ts +0 -40
- package/dist/commands/slash/commit.d.ts.map +0 -1
- package/dist/commands/slash/commit.js +0 -337
- package/dist/commands/slash/commit.js.map +0 -1
- package/dist/commands/slash/compact.d.ts +0 -48
- package/dist/commands/slash/compact.d.ts.map +0 -1
- package/dist/commands/slash/compact.js +0 -288
- package/dist/commands/slash/compact.js.map +0 -1
- package/dist/commands/slash/config.d.ts +0 -20
- package/dist/commands/slash/config.d.ts.map +0 -1
- package/dist/commands/slash/config.js +0 -136
- package/dist/commands/slash/config.js.map +0 -1
- package/dist/commands/slash/context.d.ts +0 -49
- package/dist/commands/slash/context.d.ts.map +0 -1
- package/dist/commands/slash/context.js +0 -430
- package/dist/commands/slash/context.js.map +0 -1
- package/dist/commands/slash/cost.d.ts +0 -34
- package/dist/commands/slash/cost.d.ts.map +0 -1
- package/dist/commands/slash/cost.js +0 -312
- package/dist/commands/slash/cost.js.map +0 -1
- package/dist/commands/slash/custom.d.ts +0 -41
- package/dist/commands/slash/custom.d.ts.map +0 -1
- package/dist/commands/slash/custom.js +0 -126
- package/dist/commands/slash/custom.js.map +0 -1
- package/dist/commands/slash/exit.d.ts +0 -25
- package/dist/commands/slash/exit.d.ts.map +0 -1
- package/dist/commands/slash/exit.js +0 -186
- package/dist/commands/slash/exit.js.map +0 -1
- package/dist/commands/slash/export.d.ts +0 -27
- package/dist/commands/slash/export.d.ts.map +0 -1
- package/dist/commands/slash/export.js +0 -318
- package/dist/commands/slash/export.js.map +0 -1
- package/dist/commands/slash/files.d.ts +0 -47
- package/dist/commands/slash/files.d.ts.map +0 -1
- package/dist/commands/slash/files.js +0 -521
- package/dist/commands/slash/files.js.map +0 -1
- package/dist/commands/slash/help.d.ts +0 -50
- package/dist/commands/slash/help.d.ts.map +0 -1
- package/dist/commands/slash/help.js +0 -282
- package/dist/commands/slash/help.js.map +0 -1
- package/dist/commands/slash/index-cmd.d.ts +0 -41
- package/dist/commands/slash/index-cmd.d.ts.map +0 -1
- package/dist/commands/slash/index-cmd.js +0 -349
- package/dist/commands/slash/index-cmd.js.map +0 -1
- package/dist/commands/slash/index.d.ts +0 -97
- package/dist/commands/slash/index.d.ts.map +0 -1
- package/dist/commands/slash/index.js +0 -251
- package/dist/commands/slash/index.js.map +0 -1
- package/dist/commands/slash/login.d.ts +0 -23
- package/dist/commands/slash/login.d.ts.map +0 -1
- package/dist/commands/slash/login.js +0 -175
- package/dist/commands/slash/login.js.map +0 -1
- package/dist/commands/slash/logout.d.ts +0 -23
- package/dist/commands/slash/logout.d.ts.map +0 -1
- package/dist/commands/slash/logout.js +0 -153
- package/dist/commands/slash/logout.js.map +0 -1
- package/dist/commands/slash/logs.d.ts +0 -29
- package/dist/commands/slash/logs.d.ts.map +0 -1
- package/dist/commands/slash/logs.js +0 -423
- package/dist/commands/slash/logs.js.map +0 -1
- package/dist/commands/slash/mcp.d.ts +0 -29
- package/dist/commands/slash/mcp.d.ts.map +0 -1
- package/dist/commands/slash/mcp.js +0 -1026
- package/dist/commands/slash/mcp.js.map +0 -1
- package/dist/commands/slash/model.d.ts +0 -60
- package/dist/commands/slash/model.d.ts.map +0 -1
- package/dist/commands/slash/model.js +0 -466
- package/dist/commands/slash/model.js.map +0 -1
- package/dist/commands/slash/personality.d.ts +0 -40
- package/dist/commands/slash/personality.d.ts.map +0 -1
- package/dist/commands/slash/personality.js +0 -272
- package/dist/commands/slash/personality.js.map +0 -1
- package/dist/commands/slash/purge.d.ts +0 -42
- package/dist/commands/slash/purge.d.ts.map +0 -1
- package/dist/commands/slash/purge.js +0 -233
- package/dist/commands/slash/purge.js.map +0 -1
- package/dist/commands/slash/reset.d.ts +0 -44
- package/dist/commands/slash/reset.d.ts.map +0 -1
- package/dist/commands/slash/reset.js +0 -326
- package/dist/commands/slash/reset.js.map +0 -1
- package/dist/commands/slash/skills.d.ts +0 -40
- package/dist/commands/slash/skills.d.ts.map +0 -1
- package/dist/commands/slash/skills.js +0 -207
- package/dist/commands/slash/skills.js.map +0 -1
- package/dist/commands/slash/tokens.d.ts +0 -34
- package/dist/commands/slash/tokens.d.ts.map +0 -1
- package/dist/commands/slash/tokens.js +0 -205
- package/dist/commands/slash/tokens.js.map +0 -1
- package/dist/commands/slash/unleash.d.ts +0 -50
- package/dist/commands/slash/unleash.d.ts.map +0 -1
- package/dist/commands/slash/unleash.js +0 -262
- package/dist/commands/slash/unleash.js.map +0 -1
- package/dist/commands/slash/update.d.ts +0 -34
- package/dist/commands/slash/update.d.ts.map +0 -1
- package/dist/commands/slash/update.js +0 -364
- package/dist/commands/slash/update.js.map +0 -1
- package/dist/commands/slash/wrap.d.ts +0 -18
- package/dist/commands/slash/wrap.d.ts.map +0 -1
- package/dist/commands/slash/wrap.js +0 -21
- package/dist/commands/slash/wrap.js.map +0 -1
- package/dist/commands/tokens.d.ts +0 -26
- package/dist/commands/tokens.d.ts.map +0 -1
- package/dist/commands/tokens.js +0 -245
- package/dist/commands/tokens.js.map +0 -1
- package/dist/constants/builtin-agents.d.ts +0 -27
- package/dist/constants/builtin-agents.d.ts.map +0 -1
- package/dist/constants/builtin-agents.js +0 -710
- package/dist/constants/builtin-agents.js.map +0 -1
- package/dist/constants/builtin-skills.d.ts +0 -32
- package/dist/constants/builtin-skills.d.ts.map +0 -1
- package/dist/constants/builtin-skills.js +0 -389
- package/dist/constants/builtin-skills.js.map +0 -1
- package/dist/constants/defaults.d.ts +0 -448
- package/dist/constants/defaults.d.ts.map +0 -1
- package/dist/constants/defaults.js +0 -829
- package/dist/constants/defaults.js.map +0 -1
- package/dist/constants/index.d.ts +0 -27
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/index.js +0 -85
- package/dist/constants/index.js.map +0 -1
- package/dist/constants/install-hints.d.ts +0 -7
- package/dist/constants/install-hints.d.ts.map +0 -1
- package/dist/constants/install-hints.js +0 -123
- package/dist/constants/install-hints.js.map +0 -1
- package/dist/constants/models.d.ts +0 -255
- package/dist/constants/models.d.ts.map +0 -1
- package/dist/constants/models.js +0 -596
- package/dist/constants/models.js.map +0 -1
- package/dist/constants/schedule.d.ts +0 -43
- package/dist/constants/schedule.d.ts.map +0 -1
- package/dist/constants/schedule.js +0 -110
- package/dist/constants/schedule.js.map +0 -1
- package/dist/constants/system-utilities.d.ts +0 -57
- package/dist/constants/system-utilities.d.ts.map +0 -1
- package/dist/constants/system-utilities.js +0 -421
- package/dist/constants/system-utilities.js.map +0 -1
- package/dist/constants/token-limits.d.ts +0 -102
- package/dist/constants/token-limits.d.ts.map +0 -1
- package/dist/constants/token-limits.js +0 -286
- package/dist/constants/token-limits.js.map +0 -1
- package/dist/core/autocomplete.d.ts +0 -132
- package/dist/core/autocomplete.d.ts.map +0 -1
- package/dist/core/autocomplete.js +0 -653
- package/dist/core/autocomplete.js.map +0 -1
- package/dist/core/command-parser.d.ts +0 -301
- package/dist/core/command-parser.d.ts.map +0 -1
- package/dist/core/command-parser.js +0 -526
- package/dist/core/command-parser.js.map +0 -1
- package/dist/core/context-builder.d.ts +0 -264
- package/dist/core/context-builder.d.ts.map +0 -1
- package/dist/core/context-builder.js +0 -1018
- package/dist/core/context-builder.js.map +0 -1
- package/dist/core/event-emitter.d.ts +0 -411
- package/dist/core/event-emitter.d.ts.map +0 -1
- package/dist/core/event-emitter.js +0 -138
- package/dist/core/event-emitter.js.map +0 -1
- package/dist/core/history-manager.d.ts +0 -62
- package/dist/core/history-manager.d.ts.map +0 -1
- package/dist/core/history-manager.js +0 -151
- package/dist/core/history-manager.js.map +0 -1
- package/dist/core/slash-command-handler.d.ts +0 -352
- package/dist/core/slash-command-handler.d.ts.map +0 -1
- package/dist/core/slash-command-handler.js +0 -563
- package/dist/core/slash-command-handler.js.map +0 -1
- package/dist/core/task-processor.d.ts +0 -179
- package/dist/core/task-processor.d.ts.map +0 -1
- package/dist/core/task-processor.js +0 -519
- package/dist/core/task-processor.js.map +0 -1
- package/dist/index.d.ts +0 -90
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/prompts/agent-prompt-generator.d.ts +0 -26
- package/dist/prompts/agent-prompt-generator.d.ts.map +0 -1
- package/dist/prompts/agent-prompt-generator.js +0 -244
- package/dist/prompts/agent-prompt-generator.js.map +0 -1
- package/dist/prompts/commit-message.d.ts +0 -35
- package/dist/prompts/commit-message.d.ts.map +0 -1
- package/dist/prompts/commit-message.js +0 -187
- package/dist/prompts/commit-message.js.map +0 -1
- package/dist/prompts/conversation.d.ts +0 -51
- package/dist/prompts/conversation.d.ts.map +0 -1
- package/dist/prompts/conversation.js +0 -115
- package/dist/prompts/conversation.js.map +0 -1
- package/dist/prompts/index.d.ts +0 -39
- package/dist/prompts/index.d.ts.map +0 -1
- package/dist/prompts/index.js +0 -74
- package/dist/prompts/index.js.map +0 -1
- package/dist/prompts/memory.d.ts +0 -6
- package/dist/prompts/memory.d.ts.map +0 -1
- package/dist/prompts/memory.js +0 -29
- package/dist/prompts/memory.js.map +0 -1
- package/dist/prompts/personality.d.ts +0 -77
- package/dist/prompts/personality.d.ts.map +0 -1
- package/dist/prompts/personality.js +0 -393
- package/dist/prompts/personality.js.map +0 -1
- package/dist/prompts/plan-generator.d.ts +0 -144
- package/dist/prompts/plan-generator.d.ts.map +0 -1
- package/dist/prompts/plan-generator.js +0 -553
- package/dist/prompts/plan-generator.js.map +0 -1
- package/dist/prompts/system.d.ts +0 -95
- package/dist/prompts/system.d.ts.map +0 -1
- package/dist/prompts/system.js +0 -461
- package/dist/prompts/system.js.map +0 -1
- package/dist/prompts/task-processor.d.ts +0 -94
- package/dist/prompts/task-processor.d.ts.map +0 -1
- package/dist/prompts/task-processor.js +0 -554
- package/dist/prompts/task-processor.js.map +0 -1
- package/dist/prompts/unguarded.d.ts +0 -78
- package/dist/prompts/unguarded.d.ts.map +0 -1
- package/dist/prompts/unguarded.js +0 -418
- package/dist/prompts/unguarded.js.map +0 -1
- package/dist/prompts/utils.d.ts +0 -73
- package/dist/prompts/utils.d.ts.map +0 -1
- package/dist/prompts/utils.js +0 -114
- package/dist/prompts/utils.js.map +0 -1
- package/dist/prompts/workflow.d.ts +0 -241
- package/dist/prompts/workflow.d.ts.map +0 -1
- package/dist/prompts/workflow.js +0 -608
- package/dist/prompts/workflow.js.map +0 -1
- package/dist/services/action-logger.d.ts +0 -383
- package/dist/services/action-logger.d.ts.map +0 -1
- package/dist/services/action-logger.js +0 -544
- package/dist/services/action-logger.js.map +0 -1
- package/dist/services/agent-budget-allocator.d.ts +0 -111
- package/dist/services/agent-budget-allocator.d.ts.map +0 -1
- package/dist/services/agent-budget-allocator.js +0 -278
- package/dist/services/agent-budget-allocator.js.map +0 -1
- package/dist/services/agent-manager.d.ts +0 -181
- package/dist/services/agent-manager.d.ts.map +0 -1
- package/dist/services/agent-manager.js +0 -749
- package/dist/services/agent-manager.js.map +0 -1
- package/dist/services/agent-spawner.d.ts +0 -138
- package/dist/services/agent-spawner.d.ts.map +0 -1
- package/dist/services/agent-spawner.js +0 -748
- package/dist/services/agent-spawner.js.map +0 -1
- package/dist/services/agent-state-service.d.ts +0 -145
- package/dist/services/agent-state-service.d.ts.map +0 -1
- package/dist/services/agent-state-service.js +0 -247
- package/dist/services/agent-state-service.js.map +0 -1
- package/dist/services/anthropic-client.d.ts +0 -357
- package/dist/services/anthropic-client.d.ts.map +0 -1
- package/dist/services/anthropic-client.js +0 -1451
- package/dist/services/anthropic-client.js.map +0 -1
- package/dist/services/approval-manager.d.ts +0 -385
- package/dist/services/approval-manager.d.ts.map +0 -1
- package/dist/services/approval-manager.js +0 -1044
- package/dist/services/approval-manager.js.map +0 -1
- package/dist/services/audit-logger.d.ts +0 -245
- package/dist/services/audit-logger.d.ts.map +0 -1
- package/dist/services/audit-logger.js +0 -324
- package/dist/services/audit-logger.js.map +0 -1
- package/dist/services/backup-manager.d.ts +0 -136
- package/dist/services/backup-manager.d.ts.map +0 -1
- package/dist/services/backup-manager.js +0 -260
- package/dist/services/backup-manager.js.map +0 -1
- package/dist/services/cache-service.d.ts +0 -247
- package/dist/services/cache-service.d.ts.map +0 -1
- package/dist/services/cache-service.js +0 -558
- package/dist/services/cache-service.js.map +0 -1
- package/dist/services/chat-archival-service.d.ts +0 -108
- package/dist/services/chat-archival-service.d.ts.map +0 -1
- package/dist/services/chat-archival-service.js +0 -465
- package/dist/services/chat-archival-service.js.map +0 -1
- package/dist/services/codebase-indexer.d.ts +0 -272
- package/dist/services/codebase-indexer.d.ts.map +0 -1
- package/dist/services/codebase-indexer.js +0 -863
- package/dist/services/codebase-indexer.js.map +0 -1
- package/dist/services/compass-auth-service.d.ts +0 -204
- package/dist/services/compass-auth-service.d.ts.map +0 -1
- package/dist/services/compass-auth-service.js +0 -391
- package/dist/services/compass-auth-service.js.map +0 -1
- package/dist/services/complexity-classifier.d.ts +0 -208
- package/dist/services/complexity-classifier.d.ts.map +0 -1
- package/dist/services/complexity-classifier.js +0 -1410
- package/dist/services/complexity-classifier.js.map +0 -1
- package/dist/services/config-manager.d.ts +0 -278
- package/dist/services/config-manager.d.ts.map +0 -1
- package/dist/services/config-manager.js +0 -651
- package/dist/services/config-manager.js.map +0 -1
- package/dist/services/consent-manager.d.ts +0 -239
- package/dist/services/consent-manager.d.ts.map +0 -1
- package/dist/services/consent-manager.js +0 -516
- package/dist/services/consent-manager.js.map +0 -1
- package/dist/services/conversation-compactor.d.ts +0 -223
- package/dist/services/conversation-compactor.d.ts.map +0 -1
- package/dist/services/conversation-compactor.js +0 -750
- package/dist/services/conversation-compactor.js.map +0 -1
- package/dist/services/cost-tracker.d.ts +0 -167
- package/dist/services/cost-tracker.d.ts.map +0 -1
- package/dist/services/cost-tracker.js +0 -199
- package/dist/services/cost-tracker.js.map +0 -1
- package/dist/services/credential-store.d.ts +0 -273
- package/dist/services/credential-store.d.ts.map +0 -1
- package/dist/services/credential-store.js +0 -877
- package/dist/services/credential-store.js.map +0 -1
- package/dist/services/custom-command-service.d.ts +0 -112
- package/dist/services/custom-command-service.d.ts.map +0 -1
- package/dist/services/custom-command-service.js +0 -464
- package/dist/services/custom-command-service.js.map +0 -1
- package/dist/services/default-statusline-renderer.d.ts +0 -60
- package/dist/services/default-statusline-renderer.d.ts.map +0 -1
- package/dist/services/default-statusline-renderer.js +0 -110
- package/dist/services/default-statusline-renderer.js.map +0 -1
- package/dist/services/enhanced-context-gatherer.d.ts +0 -116
- package/dist/services/enhanced-context-gatherer.d.ts.map +0 -1
- package/dist/services/enhanced-context-gatherer.js +0 -605
- package/dist/services/enhanced-context-gatherer.js.map +0 -1
- package/dist/services/file-hash-tracker.d.ts +0 -95
- package/dist/services/file-hash-tracker.d.ts.map +0 -1
- package/dist/services/file-hash-tracker.js +0 -199
- package/dist/services/file-hash-tracker.js.map +0 -1
- package/dist/services/file-service.d.ts +0 -274
- package/dist/services/file-service.d.ts.map +0 -1
- package/dist/services/file-service.js +0 -876
- package/dist/services/file-service.js.map +0 -1
- package/dist/services/git-service.d.ts +0 -536
- package/dist/services/git-service.d.ts.map +0 -1
- package/dist/services/git-service.js +0 -1215
- package/dist/services/git-service.js.map +0 -1
- package/dist/services/hook-service.d.ts +0 -148
- package/dist/services/hook-service.d.ts.map +0 -1
- package/dist/services/hook-service.js +0 -705
- package/dist/services/hook-service.js.map +0 -1
- package/dist/services/ide-state-service.d.ts +0 -114
- package/dist/services/ide-state-service.d.ts.map +0 -1
- package/dist/services/ide-state-service.js +0 -204
- package/dist/services/ide-state-service.js.map +0 -1
- package/dist/services/interactive-clarifier.d.ts +0 -90
- package/dist/services/interactive-clarifier.d.ts.map +0 -1
- package/dist/services/interactive-clarifier.js +0 -446
- package/dist/services/interactive-clarifier.js.map +0 -1
- package/dist/services/iteration-scoper.d.ts +0 -225
- package/dist/services/iteration-scoper.d.ts.map +0 -1
- package/dist/services/iteration-scoper.js +0 -387
- package/dist/services/iteration-scoper.js.map +0 -1
- package/dist/services/llm-plan-generator.d.ts +0 -44
- package/dist/services/llm-plan-generator.d.ts.map +0 -1
- package/dist/services/llm-plan-generator.js +0 -863
- package/dist/services/llm-plan-generator.js.map +0 -1
- package/dist/services/llm-system-prompt-generator.d.ts +0 -85
- package/dist/services/llm-system-prompt-generator.d.ts.map +0 -1
- package/dist/services/llm-system-prompt-generator.js +0 -257
- package/dist/services/llm-system-prompt-generator.js.map +0 -1
- package/dist/services/log-interpreter.d.ts +0 -190
- package/dist/services/log-interpreter.d.ts.map +0 -1
- package/dist/services/log-interpreter.js +0 -520
- package/dist/services/log-interpreter.js.map +0 -1
- package/dist/services/mcp-config-manager.d.ts +0 -141
- package/dist/services/mcp-config-manager.d.ts.map +0 -1
- package/dist/services/mcp-config-manager.js +0 -678
- package/dist/services/mcp-config-manager.js.map +0 -1
- package/dist/services/mcp-oauth-service.d.ts +0 -170
- package/dist/services/mcp-oauth-service.d.ts.map +0 -1
- package/dist/services/mcp-oauth-service.js +0 -892
- package/dist/services/mcp-oauth-service.js.map +0 -1
- package/dist/services/mcp-plugin-support.d.ts +0 -81
- package/dist/services/mcp-plugin-support.d.ts.map +0 -1
- package/dist/services/mcp-plugin-support.js +0 -305
- package/dist/services/mcp-plugin-support.js.map +0 -1
- package/dist/services/mcp-server-manager.d.ts +0 -134
- package/dist/services/mcp-server-manager.d.ts.map +0 -1
- package/dist/services/mcp-server-manager.js +0 -613
- package/dist/services/mcp-server-manager.js.map +0 -1
- package/dist/services/mcp-tool-integration.d.ts +0 -119
- package/dist/services/mcp-tool-integration.d.ts.map +0 -1
- package/dist/services/mcp-tool-integration.js +0 -381
- package/dist/services/mcp-tool-integration.js.map +0 -1
- package/dist/services/mcp-transport.d.ts +0 -105
- package/dist/services/mcp-transport.d.ts.map +0 -1
- package/dist/services/mcp-transport.js +0 -1316
- package/dist/services/mcp-transport.js.map +0 -1
- package/dist/services/memory-service.d.ts +0 -55
- package/dist/services/memory-service.d.ts.map +0 -1
- package/dist/services/memory-service.js +0 -251
- package/dist/services/memory-service.js.map +0 -1
- package/dist/services/model-availability.d.ts +0 -64
- package/dist/services/model-availability.d.ts.map +0 -1
- package/dist/services/model-availability.js +0 -114
- package/dist/services/model-availability.js.map +0 -1
- package/dist/services/plan-generator.d.ts +0 -98
- package/dist/services/plan-generator.d.ts.map +0 -1
- package/dist/services/plan-generator.js +0 -658
- package/dist/services/plan-generator.js.map +0 -1
- package/dist/services/plan-mode-fallback.d.ts +0 -80
- package/dist/services/plan-mode-fallback.d.ts.map +0 -1
- package/dist/services/plan-mode-fallback.js +0 -307
- package/dist/services/plan-mode-fallback.js.map +0 -1
- package/dist/services/plan-mode-handler.d.ts +0 -42
- package/dist/services/plan-mode-handler.d.ts.map +0 -1
- package/dist/services/plan-mode-handler.js +0 -388
- package/dist/services/plan-mode-handler.js.map +0 -1
- package/dist/services/plan-persistence.d.ts +0 -203
- package/dist/services/plan-persistence.d.ts.map +0 -1
- package/dist/services/plan-persistence.js +0 -538
- package/dist/services/plan-persistence.js.map +0 -1
- package/dist/services/prompt-preprocessor.d.ts +0 -73
- package/dist/services/prompt-preprocessor.d.ts.map +0 -1
- package/dist/services/prompt-preprocessor.js +0 -146
- package/dist/services/prompt-preprocessor.js.map +0 -1
- package/dist/services/rating-service.d.ts +0 -84
- package/dist/services/rating-service.d.ts.map +0 -1
- package/dist/services/rating-service.js +0 -171
- package/dist/services/rating-service.js.map +0 -1
- package/dist/services/rating-state-manager.d.ts +0 -131
- package/dist/services/rating-state-manager.d.ts.map +0 -1
- package/dist/services/rating-state-manager.js +0 -270
- package/dist/services/rating-state-manager.js.map +0 -1
- package/dist/services/sdk-runner.d.ts +0 -113
- package/dist/services/sdk-runner.d.ts.map +0 -1
- package/dist/services/sdk-runner.js +0 -1424
- package/dist/services/sdk-runner.js.map +0 -1
- package/dist/services/session-manager.d.ts +0 -528
- package/dist/services/session-manager.d.ts.map +0 -1
- package/dist/services/session-manager.js +0 -1184
- package/dist/services/session-manager.js.map +0 -1
- package/dist/services/shell-executor.d.ts +0 -337
- package/dist/services/shell-executor.d.ts.map +0 -1
- package/dist/services/shell-executor.js +0 -1201
- package/dist/services/shell-executor.js.map +0 -1
- package/dist/services/skill-service.d.ts +0 -149
- package/dist/services/skill-service.d.ts.map +0 -1
- package/dist/services/skill-service.js +0 -594
- package/dist/services/skill-service.js.map +0 -1
- package/dist/services/statusline-executor.d.ts +0 -102
- package/dist/services/statusline-executor.d.ts.map +0 -1
- package/dist/services/statusline-executor.js +0 -305
- package/dist/services/statusline-executor.js.map +0 -1
- package/dist/services/step-tracker.d.ts +0 -356
- package/dist/services/step-tracker.d.ts.map +0 -1
- package/dist/services/step-tracker.js +0 -634
- package/dist/services/step-tracker.js.map +0 -1
- package/dist/services/system-event-logger.d.ts +0 -473
- package/dist/services/system-event-logger.d.ts.map +0 -1
- package/dist/services/system-event-logger.js +0 -790
- package/dist/services/system-event-logger.js.map +0 -1
- package/dist/services/system-utility-detector.d.ts +0 -91
- package/dist/services/system-utility-detector.d.ts.map +0 -1
- package/dist/services/system-utility-detector.js +0 -238
- package/dist/services/system-utility-detector.js.map +0 -1
- package/dist/services/team-context-store.d.ts +0 -100
- package/dist/services/team-context-store.d.ts.map +0 -1
- package/dist/services/team-context-store.js +0 -513
- package/dist/services/team-context-store.js.map +0 -1
- package/dist/services/temp-file-service.d.ts +0 -164
- package/dist/services/temp-file-service.d.ts.map +0 -1
- package/dist/services/temp-file-service.js +0 -303
- package/dist/services/temp-file-service.js.map +0 -1
- package/dist/services/token-limit-enforcer.d.ts +0 -53
- package/dist/services/token-limit-enforcer.d.ts.map +0 -1
- package/dist/services/token-limit-enforcer.js +0 -90
- package/dist/services/token-limit-enforcer.js.map +0 -1
- package/dist/services/token-limit-store.d.ts +0 -105
- package/dist/services/token-limit-store.d.ts.map +0 -1
- package/dist/services/token-limit-store.js +0 -288
- package/dist/services/token-limit-store.js.map +0 -1
- package/dist/services/token-tracker.d.ts +0 -290
- package/dist/services/token-tracker.d.ts.map +0 -1
- package/dist/services/token-tracker.js +0 -751
- package/dist/services/token-tracker.js.map +0 -1
- package/dist/services/tool-registry.d.ts +0 -302
- package/dist/services/tool-registry.d.ts.map +0 -1
- package/dist/services/tool-registry.js +0 -606
- package/dist/services/tool-registry.js.map +0 -1
- package/dist/services/tools-logger.d.ts +0 -152
- package/dist/services/tools-logger.d.ts.map +0 -1
- package/dist/services/tools-logger.js +0 -222
- package/dist/services/tools-logger.js.map +0 -1
- package/dist/services/update-plan-handler.d.ts +0 -56
- package/dist/services/update-plan-handler.d.ts.map +0 -1
- package/dist/services/update-plan-handler.js +0 -372
- package/dist/services/update-plan-handler.js.map +0 -1
- package/dist/services/update-service.d.ts +0 -197
- package/dist/services/update-service.d.ts.map +0 -1
- package/dist/services/update-service.js +0 -749
- package/dist/services/update-service.js.map +0 -1
- package/dist/services/verifier.d.ts +0 -113
- package/dist/services/verifier.d.ts.map +0 -1
- package/dist/services/verifier.js +0 -541
- package/dist/services/verifier.js.map +0 -1
- package/dist/services/workflow-manager.d.ts +0 -277
- package/dist/services/workflow-manager.d.ts.map +0 -1
- package/dist/services/workflow-manager.js +0 -616
- package/dist/services/workflow-manager.js.map +0 -1
- package/dist/services/workflow-orchestrator.d.ts +0 -148
- package/dist/services/workflow-orchestrator.d.ts.map +0 -1
- package/dist/services/workflow-orchestrator.js +0 -617
- package/dist/services/workflow-orchestrator.js.map +0 -1
- package/dist/services/worktree-manager.d.ts +0 -36
- package/dist/services/worktree-manager.d.ts.map +0 -1
- package/dist/services/worktree-manager.js +0 -185
- package/dist/services/worktree-manager.js.map +0 -1
- package/dist/templates/ascii-art.d.ts +0 -136
- package/dist/templates/ascii-art.d.ts.map +0 -1
- package/dist/templates/ascii-art.js +0 -286
- package/dist/templates/ascii-art.js.map +0 -1
- package/dist/templates/help.d.ts +0 -186
- package/dist/templates/help.d.ts.map +0 -1
- package/dist/templates/help.js +0 -588
- package/dist/templates/help.js.map +0 -1
- package/dist/templates/prompts/workflow-prompts.d.ts +0 -9
- package/dist/templates/prompts/workflow-prompts.d.ts.map +0 -1
- package/dist/templates/prompts/workflow-prompts.js +0 -9
- package/dist/templates/prompts/workflow-prompts.js.map +0 -1
- package/dist/tools/agent-tools.d.ts +0 -9
- package/dist/tools/agent-tools.d.ts.map +0 -1
- package/dist/tools/agent-tools.js +0 -349
- package/dist/tools/agent-tools.js.map +0 -1
- package/dist/tools/edit-replacers.d.ts +0 -90
- package/dist/tools/edit-replacers.d.ts.map +0 -1
- package/dist/tools/edit-replacers.js +0 -553
- package/dist/tools/edit-replacers.js.map +0 -1
- package/dist/tools/file-tools.d.ts +0 -13
- package/dist/tools/file-tools.d.ts.map +0 -1
- package/dist/tools/file-tools.js +0 -954
- package/dist/tools/file-tools.js.map +0 -1
- package/dist/tools/git-tools.d.ts +0 -9
- package/dist/tools/git-tools.d.ts.map +0 -1
- package/dist/tools/git-tools.js +0 -261
- package/dist/tools/git-tools.js.map +0 -1
- package/dist/tools/index.d.ts +0 -13
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -70
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/network-tools.d.ts +0 -8
- package/dist/tools/network-tools.d.ts.map +0 -1
- package/dist/tools/network-tools.js +0 -261
- package/dist/tools/network-tools.js.map +0 -1
- package/dist/tools/openai-tools.d.ts +0 -16
- package/dist/tools/openai-tools.d.ts.map +0 -1
- package/dist/tools/openai-tools.js +0 -385
- package/dist/tools/openai-tools.js.map +0 -1
- package/dist/tools/plan-tools.d.ts +0 -9
- package/dist/tools/plan-tools.d.ts.map +0 -1
- package/dist/tools/plan-tools.js +0 -223
- package/dist/tools/plan-tools.js.map +0 -1
- package/dist/tools/schedule-tools.d.ts +0 -9
- package/dist/tools/schedule-tools.d.ts.map +0 -1
- package/dist/tools/schedule-tools.js +0 -405
- package/dist/tools/schedule-tools.js.map +0 -1
- package/dist/tools/search-tools.d.ts +0 -8
- package/dist/tools/search-tools.d.ts.map +0 -1
- package/dist/tools/search-tools.js +0 -357
- package/dist/tools/search-tools.js.map +0 -1
- package/dist/tools/shared-utils.d.ts +0 -91
- package/dist/tools/shared-utils.d.ts.map +0 -1
- package/dist/tools/shared-utils.js +0 -385
- package/dist/tools/shared-utils.js.map +0 -1
- package/dist/tools/shell-tools.d.ts +0 -9
- package/dist/tools/shell-tools.d.ts.map +0 -1
- package/dist/tools/shell-tools.js +0 -409
- package/dist/tools/shell-tools.js.map +0 -1
- package/dist/tools/skill-tools.d.ts +0 -13
- package/dist/tools/skill-tools.d.ts.map +0 -1
- package/dist/tools/skill-tools.js +0 -244
- package/dist/tools/skill-tools.js.map +0 -1
- package/dist/tools/swarm-tools.d.ts +0 -9
- package/dist/tools/swarm-tools.d.ts.map +0 -1
- package/dist/tools/swarm-tools.js +0 -422
- package/dist/tools/swarm-tools.js.map +0 -1
- package/dist/tools/user-tools.d.ts +0 -13
- package/dist/tools/user-tools.d.ts.map +0 -1
- package/dist/tools/user-tools.js +0 -232
- package/dist/tools/user-tools.js.map +0 -1
- package/dist/types/agent-process.d.ts +0 -244
- package/dist/types/agent-process.d.ts.map +0 -1
- package/dist/types/agent-process.js +0 -93
- package/dist/types/agent-process.js.map +0 -1
- package/dist/types/agent.d.ts +0 -358
- package/dist/types/agent.d.ts.map +0 -1
- package/dist/types/agent.js +0 -171
- package/dist/types/agent.js.map +0 -1
- package/dist/types/anthropic.d.ts +0 -438
- package/dist/types/anthropic.d.ts.map +0 -1
- package/dist/types/anthropic.js +0 -9
- package/dist/types/anthropic.js.map +0 -1
- package/dist/types/approval.d.ts +0 -332
- package/dist/types/approval.d.ts.map +0 -1
- package/dist/types/approval.js +0 -44
- package/dist/types/approval.js.map +0 -1
- package/dist/types/autocomplete.d.ts +0 -57
- package/dist/types/autocomplete.d.ts.map +0 -1
- package/dist/types/autocomplete.js +0 -7
- package/dist/types/autocomplete.js.map +0 -1
- package/dist/types/chat-archive.d.ts +0 -161
- package/dist/types/chat-archive.d.ts.map +0 -1
- package/dist/types/chat-archive.js +0 -36
- package/dist/types/chat-archive.js.map +0 -1
- package/dist/types/config.d.ts +0 -268
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js +0 -188
- package/dist/types/config.js.map +0 -1
- package/dist/types/consent.d.ts +0 -191
- package/dist/types/consent.d.ts.map +0 -1
- package/dist/types/consent.js +0 -119
- package/dist/types/consent.js.map +0 -1
- package/dist/types/custom-command.d.ts +0 -139
- package/dist/types/custom-command.d.ts.map +0 -1
- package/dist/types/custom-command.js +0 -7
- package/dist/types/custom-command.js.map +0 -1
- package/dist/types/git.d.ts +0 -20
- package/dist/types/git.d.ts.map +0 -1
- package/dist/types/git.js +0 -2
- package/dist/types/git.js.map +0 -1
- package/dist/types/hook.d.ts +0 -342
- package/dist/types/hook.d.ts.map +0 -1
- package/dist/types/hook.js +0 -84
- package/dist/types/hook.js.map +0 -1
- package/dist/types/index.d.ts +0 -86
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -71
- package/dist/types/index.js.map +0 -1
- package/dist/types/mcp.d.ts +0 -456
- package/dist/types/mcp.d.ts.map +0 -1
- package/dist/types/mcp.js +0 -94
- package/dist/types/mcp.js.map +0 -1
- package/dist/types/rating.d.ts +0 -110
- package/dist/types/rating.d.ts.map +0 -1
- package/dist/types/rating.js +0 -53
- package/dist/types/rating.js.map +0 -1
- package/dist/types/schedule.d.ts +0 -91
- package/dist/types/schedule.d.ts.map +0 -1
- package/dist/types/schedule.js +0 -8
- package/dist/types/schedule.js.map +0 -1
- package/dist/types/session.d.ts +0 -361
- package/dist/types/session.d.ts.map +0 -1
- package/dist/types/session.js +0 -9
- package/dist/types/session.js.map +0 -1
- package/dist/types/skill.d.ts +0 -258
- package/dist/types/skill.d.ts.map +0 -1
- package/dist/types/skill.js +0 -79
- package/dist/types/skill.js.map +0 -1
- package/dist/types/statusline.d.ts +0 -212
- package/dist/types/statusline.d.ts.map +0 -1
- package/dist/types/statusline.js +0 -8
- package/dist/types/statusline.js.map +0 -1
- package/dist/types/stream.d.ts +0 -61
- package/dist/types/stream.d.ts.map +0 -1
- package/dist/types/stream.js +0 -17
- package/dist/types/stream.js.map +0 -1
- package/dist/types/swarm.d.ts +0 -132
- package/dist/types/swarm.d.ts.map +0 -1
- package/dist/types/swarm.js +0 -21
- package/dist/types/swarm.js.map +0 -1
- package/dist/types/token-limits.d.ts +0 -107
- package/dist/types/token-limits.d.ts.map +0 -1
- package/dist/types/token-limits.js +0 -57
- package/dist/types/token-limits.js.map +0 -1
- package/dist/types/token.d.ts +0 -329
- package/dist/types/token.d.ts.map +0 -1
- package/dist/types/token.js +0 -9
- package/dist/types/token.js.map +0 -1
- package/dist/types/update.d.ts +0 -189
- package/dist/types/update.d.ts.map +0 -1
- package/dist/types/update.js +0 -55
- package/dist/types/update.js.map +0 -1
- package/dist/types/workflow.d.ts +0 -396
- package/dist/types/workflow.d.ts.map +0 -1
- package/dist/types/workflow.js +0 -46
- package/dist/types/workflow.js.map +0 -1
- package/dist/ui/App.d.ts +0 -62
- package/dist/ui/App.d.ts.map +0 -1
- package/dist/ui/App.js +0 -511
- package/dist/ui/App.js.map +0 -1
- package/dist/ui/InteractiveSession.d.ts +0 -34
- package/dist/ui/InteractiveSession.d.ts.map +0 -1
- package/dist/ui/InteractiveSession.js +0 -3611
- package/dist/ui/InteractiveSession.js.map +0 -1
- package/dist/ui/MCPApprovalPrompt.d.ts +0 -27
- package/dist/ui/MCPApprovalPrompt.d.ts.map +0 -1
- package/dist/ui/MCPApprovalPrompt.js +0 -51
- package/dist/ui/MCPApprovalPrompt.js.map +0 -1
- package/dist/ui/SetupWizard.d.ts +0 -26
- package/dist/ui/SetupWizard.d.ts.map +0 -1
- package/dist/ui/SetupWizard.js +0 -396
- package/dist/ui/SetupWizard.js.map +0 -1
- package/dist/ui/components/AgentCreationWizard.d.ts +0 -36
- package/dist/ui/components/AgentCreationWizard.d.ts.map +0 -1
- package/dist/ui/components/AgentCreationWizard.js +0 -619
- package/dist/ui/components/AgentCreationWizard.js.map +0 -1
- package/dist/ui/components/AgentManager.d.ts +0 -41
- package/dist/ui/components/AgentManager.d.ts.map +0 -1
- package/dist/ui/components/AgentManager.js +0 -343
- package/dist/ui/components/AgentManager.js.map +0 -1
- package/dist/ui/components/ApprovalDialog.d.ts +0 -18
- package/dist/ui/components/ApprovalDialog.d.ts.map +0 -1
- package/dist/ui/components/ApprovalDialog.js +0 -439
- package/dist/ui/components/ApprovalDialog.js.map +0 -1
- package/dist/ui/components/AsciiArt.d.ts +0 -54
- package/dist/ui/components/AsciiArt.d.ts.map +0 -1
- package/dist/ui/components/AsciiArt.js +0 -89
- package/dist/ui/components/AsciiArt.js.map +0 -1
- package/dist/ui/components/ClarificationWizard.d.ts +0 -36
- package/dist/ui/components/ClarificationWizard.d.ts.map +0 -1
- package/dist/ui/components/ClarificationWizard.js +0 -407
- package/dist/ui/components/ClarificationWizard.js.map +0 -1
- package/dist/ui/components/CompassSpinner.d.ts +0 -15
- package/dist/ui/components/CompassSpinner.d.ts.map +0 -1
- package/dist/ui/components/CompassSpinner.js +0 -50
- package/dist/ui/components/CompassSpinner.js.map +0 -1
- package/dist/ui/components/ConfirmationSelector.d.ts +0 -45
- package/dist/ui/components/ConfirmationSelector.d.ts.map +0 -1
- package/dist/ui/components/ConfirmationSelector.js +0 -106
- package/dist/ui/components/ConfirmationSelector.js.map +0 -1
- package/dist/ui/components/ContextUsage.d.ts +0 -76
- package/dist/ui/components/ContextUsage.d.ts.map +0 -1
- package/dist/ui/components/ContextUsage.js +0 -188
- package/dist/ui/components/ContextUsage.js.map +0 -1
- package/dist/ui/components/DiffPreview.d.ts +0 -13
- package/dist/ui/components/DiffPreview.d.ts.map +0 -1
- package/dist/ui/components/DiffPreview.js +0 -30
- package/dist/ui/components/DiffPreview.js.map +0 -1
- package/dist/ui/components/ExecutionModeSelector.d.ts +0 -45
- package/dist/ui/components/ExecutionModeSelector.d.ts.map +0 -1
- package/dist/ui/components/ExecutionModeSelector.js +0 -120
- package/dist/ui/components/ExecutionModeSelector.js.map +0 -1
- package/dist/ui/components/FileTree.d.ts +0 -47
- package/dist/ui/components/FileTree.d.ts.map +0 -1
- package/dist/ui/components/FileTree.js +0 -258
- package/dist/ui/components/FileTree.js.map +0 -1
- package/dist/ui/components/HelpMenu.d.ts +0 -49
- package/dist/ui/components/HelpMenu.d.ts.map +0 -1
- package/dist/ui/components/HelpMenu.js +0 -91
- package/dist/ui/components/HelpMenu.js.map +0 -1
- package/dist/ui/components/InterleavedStream.d.ts +0 -42
- package/dist/ui/components/InterleavedStream.d.ts.map +0 -1
- package/dist/ui/components/InterleavedStream.js +0 -1500
- package/dist/ui/components/InterleavedStream.js.map +0 -1
- package/dist/ui/components/ModelSelector.d.ts +0 -81
- package/dist/ui/components/ModelSelector.d.ts.map +0 -1
- package/dist/ui/components/ModelSelector.js +0 -305
- package/dist/ui/components/ModelSelector.js.map +0 -1
- package/dist/ui/components/PlanApprovalDialog.d.ts +0 -21
- package/dist/ui/components/PlanApprovalDialog.d.ts.map +0 -1
- package/dist/ui/components/PlanApprovalDialog.js +0 -189
- package/dist/ui/components/PlanApprovalDialog.js.map +0 -1
- package/dist/ui/components/PlanExecutionTracker.d.ts +0 -53
- package/dist/ui/components/PlanExecutionTracker.d.ts.map +0 -1
- package/dist/ui/components/PlanExecutionTracker.js +0 -113
- package/dist/ui/components/PlanExecutionTracker.js.map +0 -1
- package/dist/ui/components/ProgressIndicator.d.ts +0 -151
- package/dist/ui/components/ProgressIndicator.d.ts.map +0 -1
- package/dist/ui/components/ProgressIndicator.js +0 -171
- package/dist/ui/components/ProgressIndicator.js.map +0 -1
- package/dist/ui/components/Prompt.d.ts +0 -47
- package/dist/ui/components/Prompt.d.ts.map +0 -1
- package/dist/ui/components/Prompt.js +0 -632
- package/dist/ui/components/Prompt.js.map +0 -1
- package/dist/ui/components/RatingPanel.d.ts +0 -45
- package/dist/ui/components/RatingPanel.d.ts.map +0 -1
- package/dist/ui/components/RatingPanel.js +0 -119
- package/dist/ui/components/RatingPanel.js.map +0 -1
- package/dist/ui/components/StatusLine.d.ts +0 -43
- package/dist/ui/components/StatusLine.d.ts.map +0 -1
- package/dist/ui/components/StatusLine.js +0 -44
- package/dist/ui/components/StatusLine.js.map +0 -1
- package/dist/ui/components/StreamingResponse.d.ts +0 -45
- package/dist/ui/components/StreamingResponse.d.ts.map +0 -1
- package/dist/ui/components/StreamingResponse.js +0 -56
- package/dist/ui/components/StreamingResponse.js.map +0 -1
- package/dist/ui/components/TokenUsage.d.ts +0 -89
- package/dist/ui/components/TokenUsage.d.ts.map +0 -1
- package/dist/ui/components/TokenUsage.js +0 -99
- package/dist/ui/components/TokenUsage.js.map +0 -1
- package/dist/ui/components/ToolSummary.d.ts +0 -77
- package/dist/ui/components/ToolSummary.d.ts.map +0 -1
- package/dist/ui/components/ToolSummary.js +0 -162
- package/dist/ui/components/ToolSummary.js.map +0 -1
- package/dist/ui/components/UpdateNotification.d.ts +0 -65
- package/dist/ui/components/UpdateNotification.d.ts.map +0 -1
- package/dist/ui/components/UpdateNotification.js +0 -166
- package/dist/ui/components/UpdateNotification.js.map +0 -1
- package/dist/ui/diff-renderer.d.ts +0 -18
- package/dist/ui/diff-renderer.d.ts.map +0 -1
- package/dist/ui/diff-renderer.js +0 -206
- package/dist/ui/diff-renderer.js.map +0 -1
- package/dist/ui/themes/markdown-theme.d.ts +0 -48
- package/dist/ui/themes/markdown-theme.d.ts.map +0 -1
- package/dist/ui/themes/markdown-theme.js +0 -79
- package/dist/ui/themes/markdown-theme.js.map +0 -1
- package/dist/ui/themes/ui-theme.d.ts +0 -301
- package/dist/ui/themes/ui-theme.d.ts.map +0 -1
- package/dist/ui/themes/ui-theme.js +0 -204
- package/dist/ui/themes/ui-theme.js.map +0 -1
- package/dist/utils/attachment-handler.d.ts +0 -129
- package/dist/utils/attachment-handler.d.ts.map +0 -1
- package/dist/utils/attachment-handler.js +0 -280
- package/dist/utils/attachment-handler.js.map +0 -1
- package/dist/utils/backup-cleanup.d.ts +0 -28
- package/dist/utils/backup-cleanup.d.ts.map +0 -1
- package/dist/utils/backup-cleanup.js +0 -99
- package/dist/utils/backup-cleanup.js.map +0 -1
- package/dist/utils/clipboard-handler.d.ts +0 -82
- package/dist/utils/clipboard-handler.d.ts.map +0 -1
- package/dist/utils/clipboard-handler.js +0 -311
- package/dist/utils/clipboard-handler.js.map +0 -1
- package/dist/utils/cloud-detection.d.ts +0 -14
- package/dist/utils/cloud-detection.d.ts.map +0 -1
- package/dist/utils/cloud-detection.js +0 -92
- package/dist/utils/cloud-detection.js.map +0 -1
- package/dist/utils/command-parser.d.ts +0 -56
- package/dist/utils/command-parser.d.ts.map +0 -1
- package/dist/utils/command-parser.js +0 -206
- package/dist/utils/command-parser.js.map +0 -1
- package/dist/utils/console-capture.d.ts +0 -30
- package/dist/utils/console-capture.d.ts.map +0 -1
- package/dist/utils/console-capture.js +0 -88
- package/dist/utils/console-capture.js.map +0 -1
- package/dist/utils/cron-parser.d.ts +0 -52
- package/dist/utils/cron-parser.d.ts.map +0 -1
- package/dist/utils/cron-parser.js +0 -455
- package/dist/utils/cron-parser.js.map +0 -1
- package/dist/utils/crypto.d.ts +0 -351
- package/dist/utils/crypto.d.ts.map +0 -1
- package/dist/utils/crypto.js +0 -615
- package/dist/utils/crypto.js.map +0 -1
- package/dist/utils/diff.d.ts +0 -311
- package/dist/utils/diff.d.ts.map +0 -1
- package/dist/utils/diff.js +0 -566
- package/dist/utils/diff.js.map +0 -1
- package/dist/utils/editor.d.ts +0 -12
- package/dist/utils/editor.d.ts.map +0 -1
- package/dist/utils/editor.js +0 -30
- package/dist/utils/editor.js.map +0 -1
- package/dist/utils/file-system.d.ts +0 -512
- package/dist/utils/file-system.d.ts.map +0 -1
- package/dist/utils/file-system.js +0 -798
- package/dist/utils/file-system.js.map +0 -1
- package/dist/utils/format.d.ts +0 -318
- package/dist/utils/format.d.ts.map +0 -1
- package/dist/utils/format.js +0 -587
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/ignore-patterns.d.ts +0 -93
- package/dist/utils/ignore-patterns.d.ts.map +0 -1
- package/dist/utils/ignore-patterns.js +0 -710
- package/dist/utils/ignore-patterns.js.map +0 -1
- package/dist/utils/log-cleanup.d.ts +0 -16
- package/dist/utils/log-cleanup.d.ts.map +0 -1
- package/dist/utils/log-cleanup.js +0 -51
- package/dist/utils/log-cleanup.js.map +0 -1
- package/dist/utils/logger.d.ts +0 -305
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -447
- package/dist/utils/logger.js.map +0 -1
- package/dist/utils/path.d.ts +0 -406
- package/dist/utils/path.d.ts.map +0 -1
- package/dist/utils/path.js +0 -549
- package/dist/utils/path.js.map +0 -1
- package/dist/utils/schedule-file.d.ts +0 -63
- package/dist/utils/schedule-file.d.ts.map +0 -1
- package/dist/utils/schedule-file.js +0 -244
- package/dist/utils/schedule-file.js.map +0 -1
- package/dist/utils/task-id.d.ts +0 -29
- package/dist/utils/task-id.d.ts.map +0 -1
- package/dist/utils/task-id.js +0 -53
- package/dist/utils/task-id.js.map +0 -1
- package/dist/utils/temp-cleanup.d.ts +0 -46
- package/dist/utils/temp-cleanup.d.ts.map +0 -1
- package/dist/utils/temp-cleanup.js +0 -95
- package/dist/utils/temp-cleanup.js.map +0 -1
- package/dist/utils/terminal-output.d.ts +0 -34
- package/dist/utils/terminal-output.d.ts.map +0 -1
- package/dist/utils/terminal-output.js +0 -40
- package/dist/utils/terminal-output.js.map +0 -1
- package/dist/utils/token-counter.d.ts +0 -224
- package/dist/utils/token-counter.d.ts.map +0 -1
- package/dist/utils/token-counter.js +0 -332
- package/dist/utils/token-counter.js.map +0 -1
- package/dist/utils/tool-mapper.d.ts +0 -70
- package/dist/utils/tool-mapper.d.ts.map +0 -1
- package/dist/utils/tool-mapper.js +0 -234
- package/dist/utils/tool-mapper.js.map +0 -1
|
@@ -1,1410 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Complexity classification service for determining execution mode.
|
|
3
|
-
*
|
|
4
|
-
* This service analyzes the user request and gathered context to determine:
|
|
5
|
-
* - DIRECT: Simple changes that can be executed immediately
|
|
6
|
-
* - CLARIFICATION: Requires user input to clarify requirements
|
|
7
|
-
* - PLAN: Complex changes requiring a full implementation plan
|
|
8
|
-
*/
|
|
9
|
-
import { logger } from '../utils/logger.js';
|
|
10
|
-
import { getSystemEventLogger } from './system-event-logger.js';
|
|
11
|
-
import { getAnthropicClient } from './anthropic-client.js';
|
|
12
|
-
import { WorkflowPromptHelpers } from '../prompts/index.js';
|
|
13
|
-
import { getMCPToolIntegration } from './mcp-tool-integration.js';
|
|
14
|
-
import { formatAgentsForPrompt } from './agent-manager.js';
|
|
15
|
-
import { ExecutionMode as ExecMode } from '../types/workflow.js';
|
|
16
|
-
import { DEFAULT_PERSONALITY_MODE, DEFAULT_CLASSIFIER_MODELS_BY_PROVIDER } from '../constants/index.js';
|
|
17
|
-
import { getModelConfig } from '../constants/models.js';
|
|
18
|
-
/**
|
|
19
|
-
* JSON Schema for LLMFirstClassificationResponse.
|
|
20
|
-
* This enforces the structure when using the beta parse API.
|
|
21
|
-
*/
|
|
22
|
-
const LLM_FIRST_CLASSIFICATION_SCHEMA = {
|
|
23
|
-
type: 'object',
|
|
24
|
-
properties: {
|
|
25
|
-
mode: {
|
|
26
|
-
type: 'string',
|
|
27
|
-
enum: ['NO_ACTION', 'DIRECT', 'TODO_LIST', 'PLAN', 'PLAN_ADOPT', 'SPAWN_AGENT'],
|
|
28
|
-
description: 'The execution mode to use for this task'
|
|
29
|
-
},
|
|
30
|
-
confidence: {
|
|
31
|
-
type: 'number',
|
|
32
|
-
minimum: 0,
|
|
33
|
-
maximum: 100,
|
|
34
|
-
description: 'Confidence level in the classification (0-100)'
|
|
35
|
-
},
|
|
36
|
-
reasoning: {
|
|
37
|
-
type: 'string',
|
|
38
|
-
description: 'Brief explanation of the classification decision'
|
|
39
|
-
},
|
|
40
|
-
filesActuallyRelevant: {
|
|
41
|
-
type: 'number',
|
|
42
|
-
minimum: 0,
|
|
43
|
-
description: 'Number of files that are truly relevant to the task'
|
|
44
|
-
},
|
|
45
|
-
clarificationQuestions: {
|
|
46
|
-
type: 'array',
|
|
47
|
-
items: {
|
|
48
|
-
type: 'object',
|
|
49
|
-
properties: {
|
|
50
|
-
id: { type: 'string' },
|
|
51
|
-
question: { type: 'string' },
|
|
52
|
-
context: { type: 'string' },
|
|
53
|
-
category: { type: 'string' },
|
|
54
|
-
answerType: {
|
|
55
|
-
type: 'string',
|
|
56
|
-
enum: ['single_choice', 'multiple_choice', 'free_text', 'yes_no']
|
|
57
|
-
},
|
|
58
|
-
options: {
|
|
59
|
-
type: 'array',
|
|
60
|
-
items: {
|
|
61
|
-
type: 'object',
|
|
62
|
-
properties: {
|
|
63
|
-
id: { type: 'string' },
|
|
64
|
-
label: { type: 'string' },
|
|
65
|
-
description: { type: 'string' },
|
|
66
|
-
recommended: { type: 'boolean' }
|
|
67
|
-
},
|
|
68
|
-
required: ['id', 'label']
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
required: ['id', 'question', 'context', 'category']
|
|
73
|
-
},
|
|
74
|
-
description: 'Questions to ask when mode is CLARIFICATION'
|
|
75
|
-
},
|
|
76
|
-
adoptedPlanSummary: {
|
|
77
|
-
type: 'string',
|
|
78
|
-
description: 'Summary of detected plan structure when mode is PLAN_ADOPT'
|
|
79
|
-
},
|
|
80
|
-
noActionExplanation: {
|
|
81
|
-
type: 'string',
|
|
82
|
-
description: 'Explanation for why no action is needed (only when mode is NO_ACTION)'
|
|
83
|
-
},
|
|
84
|
-
mcpToolsRelevant: {
|
|
85
|
-
type: 'array',
|
|
86
|
-
items: { type: 'string' },
|
|
87
|
-
description: 'MCP tools that are relevant for accomplishing this task'
|
|
88
|
-
},
|
|
89
|
-
spawnAgentName: {
|
|
90
|
-
type: 'string',
|
|
91
|
-
description: 'Sub-agent name to spawn (only when mode is SPAWN_AGENT)'
|
|
92
|
-
},
|
|
93
|
-
spawnAgentTask: {
|
|
94
|
-
type: 'string',
|
|
95
|
-
description: 'Refined task description for the spawned agent (only when mode is SPAWN_AGENT)'
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
required: ['mode', 'confidence', 'reasoning', 'filesActuallyRelevant']
|
|
99
|
-
};
|
|
100
|
-
/**
|
|
101
|
-
* Keywords that trigger fast-path DIRECT classification (skip LLM).
|
|
102
|
-
*/
|
|
103
|
-
const FAST_PATH_DIRECT_KEYWORDS = [
|
|
104
|
-
'typo', 'spelling', 'fix typo', 'rename', 'add log', 'add comment',
|
|
105
|
-
'update text', 'change label', 'fix import', 'remove unused',
|
|
106
|
-
];
|
|
107
|
-
/**
|
|
108
|
-
* Keywords that indicate informational requests (no code changes).
|
|
109
|
-
*/
|
|
110
|
-
const INFORMATIONAL_KEYWORDS = [
|
|
111
|
-
'help me understand', 'explain', 'what does', 'how does', 'where is',
|
|
112
|
-
'show me', 'find', 'search for', 'list all', 'what are',
|
|
113
|
-
];
|
|
114
|
-
/**
|
|
115
|
-
* Keywords that should skip fast-path and always use LLM.
|
|
116
|
-
*/
|
|
117
|
-
const SKIP_FAST_PATH_KEYWORDS = [
|
|
118
|
-
'refactor', 'migrate', 'redesign', 'restructure', 'architecture',
|
|
119
|
-
'breaking', 'major change', 'rewrite', 'overhaul',
|
|
120
|
-
];
|
|
121
|
-
/**
|
|
122
|
-
* Keywords indicating architectural or breaking changes
|
|
123
|
-
*/
|
|
124
|
-
const ARCHITECTURAL_KEYWORDS = [
|
|
125
|
-
'architecture', 'redesign', 'refactor', 'restructure', 'migrate', 'migration',
|
|
126
|
-
'overhaul', 'rewrite', 'replace', 'rearchitect', 'framework', 'database',
|
|
127
|
-
'authentication', 'authorization', 'security', 'infrastructure', 'deploy',
|
|
128
|
-
'microservice', 'monolith', 'api', 'schema', 'orm', 'state management',
|
|
129
|
-
];
|
|
130
|
-
const BREAKING_CHANGE_KEYWORDS = [
|
|
131
|
-
'breaking', 'deprecate', 'remove', 'delete', 'rename', 'change interface',
|
|
132
|
-
'change api', 'change signature', 'incompatible', 'major version',
|
|
133
|
-
];
|
|
134
|
-
const SIMPLE_TASK_KEYWORDS = [
|
|
135
|
-
'typo', 'spelling', 'comment', 'log', 'console', 'print', 'debug',
|
|
136
|
-
'style', 'format', 'lint', 'whitespace', 'indent', 'color', 'text',
|
|
137
|
-
'label', 'tooltip', 'placeholder', 'message', 'string', 'copy',
|
|
138
|
-
];
|
|
139
|
-
/**
|
|
140
|
-
* Keywords indicating genuine ambiguity or uncertainty.
|
|
141
|
-
* Note: "should" was removed - it's RFC-style requirement language ("SHOULD" = recommended)
|
|
142
|
-
* Note: "or" was removed - too many false positives ("this or that feature")
|
|
143
|
-
*/
|
|
144
|
-
const AMBIGUOUS_KEYWORDS = [
|
|
145
|
-
'maybe', 'possibly', 'could', 'might', 'either',
|
|
146
|
-
'perhaps', 'not sure', 'uncertain', 'unclear',
|
|
147
|
-
'various', 'different options', 'multiple ways',
|
|
148
|
-
'best approach', 'better way', 'optimal solution', 'recommended approach',
|
|
149
|
-
'what do you think', 'your suggestion', 'advise',
|
|
150
|
-
];
|
|
151
|
-
/**
|
|
152
|
-
* Keywords indicating project creation or greenfield development
|
|
153
|
-
*/
|
|
154
|
-
const PROJECT_CREATION_KEYWORDS = [
|
|
155
|
-
'create a project', 'create project', 'new project', 'build a project',
|
|
156
|
-
'scaffold', 'from scratch', 'implement from', 'generate project',
|
|
157
|
-
'setup project', 'initialize project', 'bootstrap', 'starter',
|
|
158
|
-
'create an app', 'create app', 'build an app', 'new app',
|
|
159
|
-
'create a cli', 'create cli', 'build a cli',
|
|
160
|
-
'based on the following', 'according to this spec', 'following spec',
|
|
161
|
-
'implement this', 'build this', 'create this',
|
|
162
|
-
// Greenfield program patterns
|
|
163
|
-
'a python program', 'a program that', 'a script that', 'a tool that',
|
|
164
|
-
'write a program', 'write a script', 'write a tool',
|
|
165
|
-
'make a program', 'make a script', 'make a tool',
|
|
166
|
-
'develop a', 'build a game', 'create a game',
|
|
167
|
-
];
|
|
168
|
-
/**
|
|
169
|
-
* Minimum request length (characters) that suggests complexity
|
|
170
|
-
*/
|
|
171
|
-
const COMPLEX_REQUEST_LENGTH_THRESHOLD = 500;
|
|
172
|
-
/**
|
|
173
|
-
* Question templates for common clarification needs
|
|
174
|
-
*/
|
|
175
|
-
const QUESTION_TEMPLATES = {
|
|
176
|
-
scope: {
|
|
177
|
-
id: 'scope',
|
|
178
|
-
question: 'What is the scope of this change?',
|
|
179
|
-
context: 'Understanding the scope helps determine the right approach.',
|
|
180
|
-
answerType: 'single_choice',
|
|
181
|
-
options: [
|
|
182
|
-
{ id: 'minimal', label: 'Minimal', description: 'Just the specific feature/fix mentioned' },
|
|
183
|
-
{ id: 'moderate', label: 'Moderate', description: 'Include related components and tests' },
|
|
184
|
-
{ id: 'comprehensive', label: 'Comprehensive', description: 'Full implementation with edge cases and documentation' },
|
|
185
|
-
],
|
|
186
|
-
category: 'scope',
|
|
187
|
-
},
|
|
188
|
-
approach: {
|
|
189
|
-
id: 'approach',
|
|
190
|
-
question: 'Which implementation approach do you prefer?',
|
|
191
|
-
context: 'Multiple valid approaches exist for this task.',
|
|
192
|
-
answerType: 'single_choice',
|
|
193
|
-
options: [
|
|
194
|
-
{ id: 'simple', label: 'Simple & Direct', description: 'Fastest to implement, less flexible', recommended: true },
|
|
195
|
-
{ id: 'flexible', label: 'Flexible & Extensible', description: 'More abstraction, easier to extend later' },
|
|
196
|
-
{ id: 'performant', label: 'Performance-focused', description: 'Optimized for speed, may be more complex' },
|
|
197
|
-
],
|
|
198
|
-
category: 'approach',
|
|
199
|
-
},
|
|
200
|
-
testing: {
|
|
201
|
-
id: 'testing',
|
|
202
|
-
question: 'What level of testing should be included?',
|
|
203
|
-
context: 'Testing requirements affect implementation time and coverage.',
|
|
204
|
-
answerType: 'single_choice',
|
|
205
|
-
options: [
|
|
206
|
-
{ id: 'none', label: 'Skip for now', description: 'No tests, implement later' },
|
|
207
|
-
{ id: 'unit', label: 'Unit tests only', description: 'Test individual functions/components' },
|
|
208
|
-
{ id: 'integration', label: 'Unit + Integration', description: 'Full test coverage', recommended: true },
|
|
209
|
-
],
|
|
210
|
-
category: 'testing',
|
|
211
|
-
},
|
|
212
|
-
existing_data: {
|
|
213
|
-
id: 'existing_data',
|
|
214
|
-
question: 'How should existing data be handled?',
|
|
215
|
-
context: 'This change may affect existing data or state.',
|
|
216
|
-
answerType: 'single_choice',
|
|
217
|
-
options: [
|
|
218
|
-
{ id: 'migrate', label: 'Auto-migrate', description: 'Automatically migrate existing data' },
|
|
219
|
-
{ id: 'manual', label: 'Manual migration', description: 'Provide migration script to run manually' },
|
|
220
|
-
{ id: 'dual', label: 'Support both formats', description: 'Backwards compatible with old and new' },
|
|
221
|
-
],
|
|
222
|
-
category: 'data',
|
|
223
|
-
},
|
|
224
|
-
feature_flag: {
|
|
225
|
-
id: 'feature_flag',
|
|
226
|
-
question: 'Should this be behind a feature flag?',
|
|
227
|
-
context: 'Feature flags allow gradual rollout and easy rollback.',
|
|
228
|
-
answerType: 'yes_no',
|
|
229
|
-
category: 'deployment',
|
|
230
|
-
},
|
|
231
|
-
default_behavior: {
|
|
232
|
-
id: 'default_behavior',
|
|
233
|
-
question: 'Should this new feature be enabled by default?',
|
|
234
|
-
context: 'Affects how existing users experience the change.',
|
|
235
|
-
answerType: 'yes_no',
|
|
236
|
-
category: 'behavior',
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
/**
|
|
240
|
-
* ComplexityClassifier analyzes requests and determines the execution mode.
|
|
241
|
-
*/
|
|
242
|
-
class ComplexityClassifier {
|
|
243
|
-
/**
|
|
244
|
-
* Gets the appropriate classifier model for the given model/provider.
|
|
245
|
-
* Validates that the classifier model is from the same provider as the current model.
|
|
246
|
-
* Falls back to Anthropic's haiku if provider cannot be determined or validation fails.
|
|
247
|
-
*
|
|
248
|
-
* @param currentModel - The current model ID or alias
|
|
249
|
-
* @returns The classifier model to use
|
|
250
|
-
*/
|
|
251
|
-
getClassifierModelForProvider(currentModel) {
|
|
252
|
-
if (!currentModel) {
|
|
253
|
-
// No model specified, use default Anthropic classifier
|
|
254
|
-
logger.debug('No model specified, using default Anthropic classifier');
|
|
255
|
-
return DEFAULT_CLASSIFIER_MODELS_BY_PROVIDER.anthropic;
|
|
256
|
-
}
|
|
257
|
-
// Get the model config to determine the provider
|
|
258
|
-
const modelConfig = getModelConfig(currentModel);
|
|
259
|
-
if (!modelConfig) {
|
|
260
|
-
logger.warn(`Unknown model ${currentModel}, falling back to Anthropic classifier`);
|
|
261
|
-
return DEFAULT_CLASSIFIER_MODELS_BY_PROVIDER.anthropic;
|
|
262
|
-
}
|
|
263
|
-
// Get the provider-specific classifier model
|
|
264
|
-
const provider = (modelConfig.provider || 'anthropic');
|
|
265
|
-
const classifierModelId = DEFAULT_CLASSIFIER_MODELS_BY_PROVIDER[provider];
|
|
266
|
-
// Validate that the classifier model exists and supports classification
|
|
267
|
-
const classifierConfig = getModelConfig(classifierModelId);
|
|
268
|
-
if (!classifierConfig) {
|
|
269
|
-
logger.warn(`Classifier model '${classifierModelId}' not found for provider '${provider}', ` +
|
|
270
|
-
`falling back to Anthropic classifier`);
|
|
271
|
-
return DEFAULT_CLASSIFIER_MODELS_BY_PROVIDER.anthropic;
|
|
272
|
-
}
|
|
273
|
-
// Validate that the classifier model is from the same provider
|
|
274
|
-
const classifierProvider = (classifierConfig.provider || 'anthropic');
|
|
275
|
-
if (classifierProvider !== provider) {
|
|
276
|
-
logger.warn(`Classifier model '${classifierModelId}' (provider: ${classifierProvider}) does not match ` +
|
|
277
|
-
`current model provider '${provider}', falling back to Anthropic classifier`);
|
|
278
|
-
return DEFAULT_CLASSIFIER_MODELS_BY_PROVIDER.anthropic;
|
|
279
|
-
}
|
|
280
|
-
// Validate that the classifier model supports classification
|
|
281
|
-
if (!classifierConfig.capabilities.complexityClassification) {
|
|
282
|
-
logger.warn(`Classifier model '${classifierModelId}' does not support classification, ` +
|
|
283
|
-
`falling back to Anthropic classifier`);
|
|
284
|
-
return DEFAULT_CLASSIFIER_MODELS_BY_PROVIDER.anthropic;
|
|
285
|
-
}
|
|
286
|
-
logger.debug(`Using classifier model '${classifierModelId}' (${classifierConfig.name}) ` +
|
|
287
|
-
`for provider '${provider}'`);
|
|
288
|
-
return classifierModelId;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Classifies the complexity of a user request based on gathered context.
|
|
292
|
-
*/
|
|
293
|
-
classify(userRequest, context) {
|
|
294
|
-
const startTime = Date.now();
|
|
295
|
-
logger.debug('Classifying complexity for request');
|
|
296
|
-
const factors = this.analyzeFactors(userRequest, context);
|
|
297
|
-
const mode = this.determineMode(factors);
|
|
298
|
-
const confidence = this.calculateConfidence(factors, mode);
|
|
299
|
-
const reasoning = this.generateReasoning(factors, mode);
|
|
300
|
-
const potentialQuestions = this.generateQuestions(factors, userRequest, context);
|
|
301
|
-
const effortEstimate = this.estimateEffort(factors);
|
|
302
|
-
// Log the complexity analysis result
|
|
303
|
-
const systemEventLogger = getSystemEventLogger();
|
|
304
|
-
systemEventLogger.logComplexityAnalyzed({
|
|
305
|
-
query: userRequest.substring(0, 100), // Truncate for logging
|
|
306
|
-
mode,
|
|
307
|
-
confidence,
|
|
308
|
-
factors: Object.entries(factors)
|
|
309
|
-
.filter(([, v]) => v === true || (typeof v === 'number' && v > 1))
|
|
310
|
-
.map(([k]) => k),
|
|
311
|
-
duration_ms: Date.now() - startTime,
|
|
312
|
-
});
|
|
313
|
-
return {
|
|
314
|
-
mode,
|
|
315
|
-
factors,
|
|
316
|
-
confidence,
|
|
317
|
-
reasoning,
|
|
318
|
-
potentialQuestions: mode === ExecMode.CLARIFICATION ? potentialQuestions : undefined,
|
|
319
|
-
effortEstimate,
|
|
320
|
-
};
|
|
321
|
-
}
|
|
322
|
-
/**
|
|
323
|
-
* Classifies complexity using LLM for the final decision.
|
|
324
|
-
*
|
|
325
|
-
* This method:
|
|
326
|
-
* 1. Runs all existing heuristic factor analysis (preserving that value)
|
|
327
|
-
* 2. Gets the heuristic suggestion as a baseline
|
|
328
|
-
* 3. Calls the LLM with all gathered context for final decision
|
|
329
|
-
* 4. Falls back to heuristic if LLM fails
|
|
330
|
-
*
|
|
331
|
-
* The LLM can override the heuristic when it detects nuances that rules miss.
|
|
332
|
-
*/
|
|
333
|
-
async classifyWithLLM(userRequest, context, options = {}) {
|
|
334
|
-
const startTime = Date.now();
|
|
335
|
-
const { fallbackToHeuristic = true } = options;
|
|
336
|
-
logger.debug('Starting LLM-enhanced complexity classification');
|
|
337
|
-
// Step 1: Run existing heuristic analysis (KEEP ALL THIS VALUE!)
|
|
338
|
-
const factors = this.analyzeFactors(userRequest, context);
|
|
339
|
-
const heuristicMode = this.determineMode(factors);
|
|
340
|
-
const heuristicConfidence = this.calculateConfidence(factors, heuristicMode);
|
|
341
|
-
const heuristicReasoning = this.generateReasoning(factors, heuristicMode);
|
|
342
|
-
const heuristicQuestions = this.generateQuestions(factors, userRequest, context);
|
|
343
|
-
const effortEstimate = this.estimateEffort(factors);
|
|
344
|
-
try {
|
|
345
|
-
// Step 2: Get AnthropicClient
|
|
346
|
-
const client = options.client || await getAnthropicClient();
|
|
347
|
-
if (!client.isInitialized()) {
|
|
348
|
-
await client.initialize();
|
|
349
|
-
}
|
|
350
|
-
// Step 3: Build the LLM prompt with all context
|
|
351
|
-
const prompt = this.buildLLMClassificationPrompt(userRequest, factors, heuristicMode, heuristicConfidence, heuristicReasoning, context);
|
|
352
|
-
// Step 4: Call LLM for final decision
|
|
353
|
-
logger.debug('Calling LLM for complexity classification decision');
|
|
354
|
-
const classifierModel = this.getClassifierModelForProvider(options.currentModel);
|
|
355
|
-
const llmResult = await client.sendStructuredMessage([{ role: 'user', content: prompt }], {
|
|
356
|
-
maxTokens: 2048, // Bumped from 1024 — clarification responses with options can exceed 1k tokens
|
|
357
|
-
temperature: 0.1, // Low temperature for consistent classification
|
|
358
|
-
abortSignal: options.abortSignal,
|
|
359
|
-
model: classifierModel,
|
|
360
|
-
});
|
|
361
|
-
// Step 5: Parse LLM response
|
|
362
|
-
const llmDecision = this.parseLLMResponse(llmResult.content);
|
|
363
|
-
if (!llmDecision) {
|
|
364
|
-
logger.warn('Failed to parse LLM classification response, falling back to heuristic');
|
|
365
|
-
logger.debug('LLM response content:', llmResult.content);
|
|
366
|
-
return this.buildHeuristicResult(factors, heuristicMode, heuristicConfidence, heuristicReasoning, heuristicQuestions, effortEstimate, startTime, userRequest, 'heuristic_llm_parse_failed');
|
|
367
|
-
}
|
|
368
|
-
// Step 6: Build result from LLM decision
|
|
369
|
-
const mode = this.mapLLMMode(llmDecision.mode);
|
|
370
|
-
const questions = llmDecision.clarificationQuestions
|
|
371
|
-
? this.mapLLMQuestions(llmDecision.clarificationQuestions)
|
|
372
|
-
: heuristicQuestions;
|
|
373
|
-
// Log the classification result
|
|
374
|
-
const systemEventLogger = getSystemEventLogger();
|
|
375
|
-
systemEventLogger.logComplexityAnalyzed({
|
|
376
|
-
query: userRequest.substring(0, 100),
|
|
377
|
-
mode,
|
|
378
|
-
confidence: llmDecision.confidence,
|
|
379
|
-
factors: Object.entries(factors)
|
|
380
|
-
.filter(([, v]) => v === true || (typeof v === 'number' && v > 1))
|
|
381
|
-
.map(([k]) => k),
|
|
382
|
-
duration_ms: Date.now() - startTime,
|
|
383
|
-
});
|
|
384
|
-
// Log if LLM disagreed with heuristic
|
|
385
|
-
if (!llmDecision.agreesWithHeuristic) {
|
|
386
|
-
logger.info(`LLM overrode heuristic: ${heuristicMode} → ${mode}. Reason: ${llmDecision.reasoning}`);
|
|
387
|
-
}
|
|
388
|
-
// Log full LLM response for CLARIFICATION mode to help debug question generation
|
|
389
|
-
if (mode === ExecMode.CLARIFICATION) {
|
|
390
|
-
logger.debug('LLM CLARIFICATION response:', llmResult.content);
|
|
391
|
-
logger.debug('Parsed clarification questions:', {
|
|
392
|
-
count: questions.length,
|
|
393
|
-
questions: questions.map(q => ({ id: q.id, question: q.question })),
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
return {
|
|
397
|
-
mode,
|
|
398
|
-
factors,
|
|
399
|
-
confidence: llmDecision.confidence,
|
|
400
|
-
reasoning: llmDecision.reasoning,
|
|
401
|
-
potentialQuestions: mode === ExecMode.CLARIFICATION ? questions : undefined,
|
|
402
|
-
effortEstimate,
|
|
403
|
-
};
|
|
404
|
-
}
|
|
405
|
-
catch (error) {
|
|
406
|
-
logger.error('LLM classification failed', error);
|
|
407
|
-
if (fallbackToHeuristic) {
|
|
408
|
-
logger.info('Falling back to heuristic classification');
|
|
409
|
-
return this.buildHeuristicResult(factors, heuristicMode, heuristicConfidence, heuristicReasoning, heuristicQuestions, effortEstimate, startTime, userRequest, 'heuristic_llm_error');
|
|
410
|
-
}
|
|
411
|
-
throw error;
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
/**
|
|
415
|
-
* Classifies complexity with LLM as the primary decision maker.
|
|
416
|
-
*
|
|
417
|
-
* This method:
|
|
418
|
-
* 1. Checks for fast-path (obviously trivial tasks skip LLM)
|
|
419
|
-
* 2. Extracts code snippets from relevant files
|
|
420
|
-
* 3. Sends snippets to LLM for semantic analysis
|
|
421
|
-
* 4. LLM makes decision based on actual code relationships, not heuristics
|
|
422
|
-
*
|
|
423
|
-
* The LLM can see real code and understand that 20 files with the same
|
|
424
|
-
* simple change is easier than 3 files with complex interdependencies.
|
|
425
|
-
*/
|
|
426
|
-
async classifyWithLLMFirst(userRequest, context, options = {}) {
|
|
427
|
-
const startTime = Date.now();
|
|
428
|
-
const { fallbackToHeuristic = true, personalityMode = DEFAULT_PERSONALITY_MODE } = options;
|
|
429
|
-
const requestLower = userRequest.toLowerCase();
|
|
430
|
-
logger.debug('Starting LLM-first complexity classification');
|
|
431
|
-
// Step 1: Check for fast-path (balanced approach)
|
|
432
|
-
const fastPathResult = this.checkFastPath(requestLower);
|
|
433
|
-
if (fastPathResult) {
|
|
434
|
-
logger.info(`Fast-path classification: ${fastPathResult.mode} - ${fastPathResult.reasoning}`);
|
|
435
|
-
return this.buildFastPathResult(fastPathResult, startTime, userRequest);
|
|
436
|
-
}
|
|
437
|
-
try {
|
|
438
|
-
// Step 2: Get AnthropicClient
|
|
439
|
-
const client = options.client || await getAnthropicClient();
|
|
440
|
-
if (!client.isInitialized()) {
|
|
441
|
-
await client.initialize();
|
|
442
|
-
}
|
|
443
|
-
// Step 3: Get available MCP tools for context (short descriptions only)
|
|
444
|
-
const mcpIntegration = getMCPToolIntegration();
|
|
445
|
-
const mcpToolDefs = mcpIntegration.getMCPToolDefinitions();
|
|
446
|
-
// Use short tool names for system prompt - extract just the tool name without full description
|
|
447
|
-
const availableMCPToolsForSystem = mcpToolDefs.length > 0
|
|
448
|
-
? `The following external tools are available:\n${mcpToolDefs.map(t => `- **${t.name}** (${t.server})`).join('\n')}`
|
|
449
|
-
: 'No external tools currently connected. If the task requires external services, consider asking if the user wants to connect an MCP server.';
|
|
450
|
-
// Step 4: Build LLM-first prompt (no heuristic anchoring)
|
|
451
|
-
const prompt = WorkflowPromptHelpers.buildLLMFirstClassificationPrompt({
|
|
452
|
-
userRequest,
|
|
453
|
-
projectType: context.projectType,
|
|
454
|
-
languages: context.languages.join(', '),
|
|
455
|
-
fileCount: String(context.relevantFiles.length),
|
|
456
|
-
affectedAreas: context.affectedAreas.join(', ') || 'Unknown',
|
|
457
|
-
});
|
|
458
|
-
// Step 6: Call LLM for analysis
|
|
459
|
-
logger.debug('Calling LLM for code-aware complexity classification');
|
|
460
|
-
// Get available sub-agents for prompt injection
|
|
461
|
-
const availableSubAgents = await formatAgentsForPrompt();
|
|
462
|
-
// Build system prompt with personality mode, directory structure, MCP tools, and sub-agents
|
|
463
|
-
// This enables system prompt caching for better token efficiency
|
|
464
|
-
const systemPrompt = WorkflowPromptHelpers.buildClassifierSystemPrompt({
|
|
465
|
-
personalityMode,
|
|
466
|
-
directoryTree: context.directoryTree || 'Directory structure not available',
|
|
467
|
-
availableMCPTools: availableMCPToolsForSystem,
|
|
468
|
-
availableSubAgents,
|
|
469
|
-
});
|
|
470
|
-
// Build messages array with recent conversation history (last 2 turns) if available
|
|
471
|
-
const recentHistory = (options.conversationHistory || []).slice(-4);
|
|
472
|
-
const messages = [
|
|
473
|
-
...recentHistory,
|
|
474
|
-
{ role: 'user', content: prompt }
|
|
475
|
-
];
|
|
476
|
-
const classifierModel = this.getClassifierModelForProvider(options.currentModel);
|
|
477
|
-
const llmResult = await client.sendMessage(messages, {
|
|
478
|
-
system: systemPrompt,
|
|
479
|
-
maxTokens: 2048,
|
|
480
|
-
temperature: 0.1,
|
|
481
|
-
abortSignal: options.abortSignal,
|
|
482
|
-
outputFormat: LLM_FIRST_CLASSIFICATION_SCHEMA,
|
|
483
|
-
model: classifierModel,
|
|
484
|
-
});
|
|
485
|
-
// Step 6: Parse LLM response
|
|
486
|
-
const llmDecision = this.parseLLMFirstResponse(llmResult.content);
|
|
487
|
-
if (!llmDecision) {
|
|
488
|
-
logger.warn('Failed to parse LLM-first classification response, falling back to heuristic');
|
|
489
|
-
logger.debug('LLM response content:', llmResult.content);
|
|
490
|
-
if (fallbackToHeuristic) {
|
|
491
|
-
return this.classify(userRequest, context);
|
|
492
|
-
}
|
|
493
|
-
throw new Error('LLM response parsing failed');
|
|
494
|
-
}
|
|
495
|
-
// Step 7: Build result
|
|
496
|
-
const mode = this.mapLLMMode(llmDecision.mode);
|
|
497
|
-
const questions = llmDecision.clarificationQuestions
|
|
498
|
-
? this.mapLLMQuestions(llmDecision.clarificationQuestions)
|
|
499
|
-
: [];
|
|
500
|
-
// Log the classification result
|
|
501
|
-
const systemEventLogger = getSystemEventLogger();
|
|
502
|
-
systemEventLogger.logComplexityAnalyzed({
|
|
503
|
-
query: userRequest.substring(0, 100),
|
|
504
|
-
mode,
|
|
505
|
-
confidence: llmDecision.confidence,
|
|
506
|
-
factors: [`llm_first`, `files_relevant: ${llmDecision.filesActuallyRelevant}`],
|
|
507
|
-
duration_ms: Date.now() - startTime,
|
|
508
|
-
});
|
|
509
|
-
logger.info(`LLM-first classification: ${mode} (${llmDecision.confidence}% confidence). ` +
|
|
510
|
-
`${llmDecision.filesActuallyRelevant}/${context.relevantFiles.length} files actually relevant. ` +
|
|
511
|
-
`Reason: ${llmDecision.reasoning}`);
|
|
512
|
-
// Log full LLM response for CLARIFICATION mode to help debug question generation
|
|
513
|
-
if (mode === ExecMode.CLARIFICATION) {
|
|
514
|
-
logger.debug('LLM CLARIFICATION response:', llmResult.content);
|
|
515
|
-
logger.debug('Parsed clarification questions:', {
|
|
516
|
-
count: questions.length,
|
|
517
|
-
questions: questions.map(q => ({ id: q.id, question: q.question })),
|
|
518
|
-
});
|
|
519
|
-
}
|
|
520
|
-
// Log NO_ACTION mode details
|
|
521
|
-
if (mode === ExecMode.NO_ACTION) {
|
|
522
|
-
logger.info('LLM NO_ACTION response:', {
|
|
523
|
-
explanation: llmDecision.noActionExplanation,
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
// Generate minimal factors for compatibility
|
|
527
|
-
const factors = this.generateMinimalFactors(llmDecision, context);
|
|
528
|
-
return {
|
|
529
|
-
mode,
|
|
530
|
-
factors,
|
|
531
|
-
confidence: llmDecision.confidence,
|
|
532
|
-
reasoning: llmDecision.reasoning,
|
|
533
|
-
potentialQuestions: mode === ExecMode.CLARIFICATION ? questions : undefined,
|
|
534
|
-
effortEstimate: this.estimateEffort(factors),
|
|
535
|
-
noActionExplanation: llmDecision.noActionExplanation,
|
|
536
|
-
mcpToolsRelevant: llmDecision.mcpToolsRelevant,
|
|
537
|
-
spawnAgentName: llmDecision.spawnAgentName,
|
|
538
|
-
spawnAgentTask: llmDecision.spawnAgentTask,
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
catch (error) {
|
|
542
|
-
logger.error('LLM-first classification failed', error);
|
|
543
|
-
if (fallbackToHeuristic) {
|
|
544
|
-
logger.info('Falling back to heuristic classification');
|
|
545
|
-
return this.classify(userRequest, context);
|
|
546
|
-
}
|
|
547
|
-
throw error;
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Checks if the request qualifies for fast-path (skip LLM).
|
|
552
|
-
* Uses balanced approach: only skip for obviously trivial tasks.
|
|
553
|
-
*/
|
|
554
|
-
checkFastPath(requestLower) {
|
|
555
|
-
const wordCount = requestLower.split(/\s+/).length;
|
|
556
|
-
// Skip fast-path for complex keywords
|
|
557
|
-
if (SKIP_FAST_PATH_KEYWORDS.some(k => requestLower.includes(k))) {
|
|
558
|
-
return null;
|
|
559
|
-
}
|
|
560
|
-
// Skip fast-path for longer requests
|
|
561
|
-
if (requestLower.length > 100 || wordCount > 20) {
|
|
562
|
-
return null;
|
|
563
|
-
}
|
|
564
|
-
// Skip fast-path if request has question marks (seeking guidance)
|
|
565
|
-
if (requestLower.includes('?')) {
|
|
566
|
-
return null;
|
|
567
|
-
}
|
|
568
|
-
// Check for informational requests (no code changes needed)
|
|
569
|
-
if (INFORMATIONAL_KEYWORDS.some(k => requestLower.includes(k))) {
|
|
570
|
-
return {
|
|
571
|
-
mode: ExecMode.DIRECT,
|
|
572
|
-
reasoning: 'Informational request - no code changes needed',
|
|
573
|
-
};
|
|
574
|
-
}
|
|
575
|
-
// Check for trivial change keywords (short request + simple intent)
|
|
576
|
-
if (wordCount <= 10 && FAST_PATH_DIRECT_KEYWORDS.some(k => requestLower.includes(k))) {
|
|
577
|
-
return {
|
|
578
|
-
mode: ExecMode.DIRECT,
|
|
579
|
-
reasoning: 'Simple, focused change with clear intent',
|
|
580
|
-
};
|
|
581
|
-
}
|
|
582
|
-
return null;
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* Builds a result for fast-path classification.
|
|
586
|
-
*/
|
|
587
|
-
buildFastPathResult(fastPath, startTime, userRequest) {
|
|
588
|
-
const systemEventLogger = getSystemEventLogger();
|
|
589
|
-
systemEventLogger.logComplexityAnalyzed({
|
|
590
|
-
query: userRequest.substring(0, 100),
|
|
591
|
-
mode: fastPath.mode,
|
|
592
|
-
confidence: 90,
|
|
593
|
-
factors: ['fast_path'],
|
|
594
|
-
duration_ms: Date.now() - startTime,
|
|
595
|
-
});
|
|
596
|
-
return {
|
|
597
|
-
mode: fastPath.mode,
|
|
598
|
-
factors: {
|
|
599
|
-
filesAffected: 1,
|
|
600
|
-
linesChanged: 10,
|
|
601
|
-
createsAbstractions: false,
|
|
602
|
-
architecturalChange: false,
|
|
603
|
-
breakingChanges: false,
|
|
604
|
-
crossCuttingConcerns: false,
|
|
605
|
-
requirementsClear: true,
|
|
606
|
-
implementationApproaches: 1,
|
|
607
|
-
requiresMigration: false,
|
|
608
|
-
riskLevel: 1,
|
|
609
|
-
contextSufficiency: 'high', // Fast-path implies sufficient context
|
|
610
|
-
},
|
|
611
|
-
confidence: 90,
|
|
612
|
-
reasoning: `[Fast-path] ${fastPath.reasoning}`,
|
|
613
|
-
effortEstimate: 'Quick change (few minutes)',
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
/**
|
|
617
|
-
* Parses the LLM-first response JSON.
|
|
618
|
-
*/
|
|
619
|
-
parseLLMFirstResponse(content) {
|
|
620
|
-
try {
|
|
621
|
-
const jsonMatch = content.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
622
|
-
const jsonStr = jsonMatch ? jsonMatch[1].trim() : content.trim();
|
|
623
|
-
const parsed = JSON.parse(jsonStr);
|
|
624
|
-
// Validate required fields
|
|
625
|
-
if (!parsed.mode || typeof parsed.confidence !== 'number' || !parsed.reasoning) {
|
|
626
|
-
logger.warn('LLM-first response missing required fields', {
|
|
627
|
-
hasMode: !!parsed.mode,
|
|
628
|
-
confidenceType: typeof parsed.confidence,
|
|
629
|
-
hasReasoning: !!parsed.reasoning,
|
|
630
|
-
});
|
|
631
|
-
return null;
|
|
632
|
-
}
|
|
633
|
-
// Validate mode value
|
|
634
|
-
if (!['NO_ACTION', 'DIRECT', 'CLARIFICATION', 'TODO_LIST', 'PLAN', 'PLAN_ADOPT', 'SPAWN_AGENT'].includes(parsed.mode)) {
|
|
635
|
-
logger.warn(`Invalid mode in LLM-first response: ${parsed.mode}`);
|
|
636
|
-
return null;
|
|
637
|
-
}
|
|
638
|
-
// Validate SPAWN_AGENT mode requirements
|
|
639
|
-
if (parsed.mode === 'SPAWN_AGENT') {
|
|
640
|
-
if (!parsed.spawnAgentName || !parsed.spawnAgentTask) {
|
|
641
|
-
logger.warn('SPAWN_AGENT mode requires spawnAgentName and spawnAgentTask fields');
|
|
642
|
-
return null;
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
return parsed;
|
|
646
|
-
}
|
|
647
|
-
catch (error) {
|
|
648
|
-
logger.error('Failed to parse LLM-first classification response', error);
|
|
649
|
-
logger.error('Raw LLM response that failed to parse:', content);
|
|
650
|
-
return null;
|
|
651
|
-
}
|
|
652
|
-
}
|
|
653
|
-
/**
|
|
654
|
-
* Generates minimal complexity factors from LLM decision.
|
|
655
|
-
* Used for compatibility with downstream code that expects factors.
|
|
656
|
-
*/
|
|
657
|
-
generateMinimalFactors(llmDecision, context) {
|
|
658
|
-
const mode = llmDecision.mode;
|
|
659
|
-
// Map mode to estimated values
|
|
660
|
-
const linesChangedMap = {
|
|
661
|
-
DIRECT: 50,
|
|
662
|
-
CLARIFICATION: 100,
|
|
663
|
-
TODO_LIST: 150,
|
|
664
|
-
PLAN: 300,
|
|
665
|
-
PLAN_ADOPT: 300,
|
|
666
|
-
SPAWN_AGENT: 0, // Agent spawning doesn't directly change lines
|
|
667
|
-
NO_ACTION: 0,
|
|
668
|
-
};
|
|
669
|
-
const riskLevelMap = {
|
|
670
|
-
DIRECT: 2,
|
|
671
|
-
CLARIFICATION: 4,
|
|
672
|
-
TODO_LIST: 5,
|
|
673
|
-
PLAN: 6,
|
|
674
|
-
PLAN_ADOPT: 6,
|
|
675
|
-
SPAWN_AGENT: 1, // Low risk, isolated execution
|
|
676
|
-
NO_ACTION: 0,
|
|
677
|
-
};
|
|
678
|
-
// Determine context sufficiency based on mode and available context
|
|
679
|
-
const hasGoodContext = context.relevantFiles.filter(f => f.relevanceScore >= 70).length >= 1;
|
|
680
|
-
const contextSufficiency = mode === 'DIRECT' ? 'high' :
|
|
681
|
-
mode === 'TODO_LIST' ? (hasGoodContext ? 'high' : 'medium') :
|
|
682
|
-
mode === 'CLARIFICATION' ? 'low' :
|
|
683
|
-
'medium';
|
|
684
|
-
return {
|
|
685
|
-
filesAffected: llmDecision.filesActuallyRelevant || context.relevantFiles.length,
|
|
686
|
-
linesChanged: linesChangedMap[mode] || 150,
|
|
687
|
-
createsAbstractions: mode === 'PLAN' || mode === 'PLAN_ADOPT',
|
|
688
|
-
architecturalChange: mode === 'PLAN' || mode === 'PLAN_ADOPT',
|
|
689
|
-
breakingChanges: false,
|
|
690
|
-
crossCuttingConcerns: context.affectedAreas.length >= 3,
|
|
691
|
-
requirementsClear: mode !== 'CLARIFICATION',
|
|
692
|
-
implementationApproaches: mode === 'CLARIFICATION' ? 2 : 1,
|
|
693
|
-
requiresMigration: false,
|
|
694
|
-
riskLevel: riskLevelMap[mode] || 5,
|
|
695
|
-
contextSufficiency,
|
|
696
|
-
};
|
|
697
|
-
}
|
|
698
|
-
/**
|
|
699
|
-
* Builds the prompt for LLM classification with all gathered context.
|
|
700
|
-
*/
|
|
701
|
-
buildLLMClassificationPrompt(userRequest, factors, heuristicMode, heuristicConfidence, heuristicReasoning, context) {
|
|
702
|
-
// Format relevant files as a summary
|
|
703
|
-
const relevantFilesSummary = context.relevantFiles
|
|
704
|
-
.filter(f => f.relevanceScore >= 40)
|
|
705
|
-
.slice(0, 10)
|
|
706
|
-
.map(f => `${f.path} (relevance: ${f.relevanceScore}%)`)
|
|
707
|
-
.join(', ') || 'None identified';
|
|
708
|
-
return WorkflowPromptHelpers.buildLLMComplexityClassificationPrompt({
|
|
709
|
-
userRequest,
|
|
710
|
-
filesAffected: String(factors.filesAffected),
|
|
711
|
-
linesChanged: String(factors.linesChanged),
|
|
712
|
-
requirementsClear: String(factors.requirementsClear),
|
|
713
|
-
contextSufficiency: factors.contextSufficiency,
|
|
714
|
-
architecturalChange: String(factors.architecturalChange),
|
|
715
|
-
breakingChanges: String(factors.breakingChanges),
|
|
716
|
-
crossCuttingConcerns: String(factors.crossCuttingConcerns),
|
|
717
|
-
createsAbstractions: String(factors.createsAbstractions),
|
|
718
|
-
requiresMigration: String(factors.requiresMigration),
|
|
719
|
-
implementationApproaches: String(factors.implementationApproaches),
|
|
720
|
-
riskLevel: String(factors.riskLevel),
|
|
721
|
-
heuristicMode: heuristicMode.toUpperCase(),
|
|
722
|
-
heuristicConfidence: String(heuristicConfidence),
|
|
723
|
-
heuristicReasoning,
|
|
724
|
-
affectedAreas: context.affectedAreas.join(', ') || 'Unknown',
|
|
725
|
-
relevantFiles: relevantFilesSummary,
|
|
726
|
-
});
|
|
727
|
-
}
|
|
728
|
-
/**
|
|
729
|
-
* Parses the LLM response JSON.
|
|
730
|
-
*/
|
|
731
|
-
parseLLMResponse(content) {
|
|
732
|
-
try {
|
|
733
|
-
// Extract JSON from markdown code block if present
|
|
734
|
-
const jsonMatch = content.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
735
|
-
const jsonStr = jsonMatch ? jsonMatch[1].trim() : content.trim();
|
|
736
|
-
const parsed = JSON.parse(jsonStr);
|
|
737
|
-
// Validate required fields
|
|
738
|
-
if (!parsed.mode || typeof parsed.confidence !== 'number' || !parsed.reasoning) {
|
|
739
|
-
logger.warn('LLM response missing required fields', {
|
|
740
|
-
hasMode: !!parsed.mode,
|
|
741
|
-
confidenceType: typeof parsed.confidence,
|
|
742
|
-
hasReasoning: !!parsed.reasoning,
|
|
743
|
-
});
|
|
744
|
-
return null;
|
|
745
|
-
}
|
|
746
|
-
// Validate mode value
|
|
747
|
-
if (!['NO_ACTION', 'DIRECT', 'CLARIFICATION', 'TODO_LIST', 'PLAN', 'PLAN_ADOPT'].includes(parsed.mode)) {
|
|
748
|
-
logger.warn(`Invalid mode in LLM response: ${parsed.mode}`);
|
|
749
|
-
return null;
|
|
750
|
-
}
|
|
751
|
-
return parsed;
|
|
752
|
-
}
|
|
753
|
-
catch (error) {
|
|
754
|
-
logger.error('Failed to parse LLM classification response', error);
|
|
755
|
-
logger.error('Raw LLM response that failed to parse:', content);
|
|
756
|
-
return null;
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
/**
|
|
760
|
-
* Maps LLM mode string to ExecutionMode enum.
|
|
761
|
-
*/
|
|
762
|
-
mapLLMMode(mode) {
|
|
763
|
-
switch (mode.toUpperCase()) {
|
|
764
|
-
case 'NO_ACTION':
|
|
765
|
-
return ExecMode.NO_ACTION;
|
|
766
|
-
case 'DIRECT':
|
|
767
|
-
return ExecMode.DIRECT;
|
|
768
|
-
case 'CLARIFICATION':
|
|
769
|
-
return ExecMode.CLARIFICATION;
|
|
770
|
-
case 'TODO_LIST':
|
|
771
|
-
return ExecMode.TODO_LIST;
|
|
772
|
-
case 'PLAN':
|
|
773
|
-
return ExecMode.PLAN;
|
|
774
|
-
case 'PLAN_ADOPT':
|
|
775
|
-
return ExecMode.PLAN_ADOPT;
|
|
776
|
-
case 'SPAWN_AGENT':
|
|
777
|
-
return ExecMode.SPAWN_AGENT;
|
|
778
|
-
default:
|
|
779
|
-
return ExecMode.PLAN; // Safe default
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
/**
|
|
783
|
-
* Maps LLM clarification questions to ClarificationQuestion format.
|
|
784
|
-
*/
|
|
785
|
-
mapLLMQuestions(llmQuestions) {
|
|
786
|
-
return llmQuestions.map(q => {
|
|
787
|
-
// Determine answerType intelligently
|
|
788
|
-
let answerType;
|
|
789
|
-
if (q.answerType) {
|
|
790
|
-
// Use LLM-provided answerType
|
|
791
|
-
answerType = q.answerType;
|
|
792
|
-
}
|
|
793
|
-
else if (q.options && q.options.length > 0) {
|
|
794
|
-
// If options provided but no answerType, default to single_choice
|
|
795
|
-
answerType = 'single_choice';
|
|
796
|
-
}
|
|
797
|
-
else {
|
|
798
|
-
// No options, use free_text
|
|
799
|
-
answerType = 'free_text';
|
|
800
|
-
}
|
|
801
|
-
// Map options to ClarificationOption format
|
|
802
|
-
const options = q.options?.map(opt => ({
|
|
803
|
-
id: opt.id,
|
|
804
|
-
label: opt.label,
|
|
805
|
-
description: opt.description || opt.label, // Default description to label if not provided
|
|
806
|
-
recommended: opt.recommended,
|
|
807
|
-
}));
|
|
808
|
-
return {
|
|
809
|
-
id: q.id,
|
|
810
|
-
question: q.question,
|
|
811
|
-
context: q.context,
|
|
812
|
-
answerType,
|
|
813
|
-
options,
|
|
814
|
-
category: q.category,
|
|
815
|
-
};
|
|
816
|
-
});
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* Builds a heuristic-based result (used as fallback or when LLM is unavailable).
|
|
820
|
-
*/
|
|
821
|
-
buildHeuristicResult(factors, mode, confidence, reasoning, questions, effortEstimate, startTime, userRequest, source) {
|
|
822
|
-
const systemEventLogger = getSystemEventLogger();
|
|
823
|
-
systemEventLogger.logComplexityAnalyzed({
|
|
824
|
-
query: userRequest.substring(0, 100),
|
|
825
|
-
mode,
|
|
826
|
-
confidence,
|
|
827
|
-
factors: Object.entries(factors)
|
|
828
|
-
.filter(([, v]) => v === true || (typeof v === 'number' && v > 1))
|
|
829
|
-
.map(([k]) => k),
|
|
830
|
-
duration_ms: Date.now() - startTime,
|
|
831
|
-
});
|
|
832
|
-
logger.debug(`Using ${source} classification: ${mode}`);
|
|
833
|
-
return {
|
|
834
|
-
mode,
|
|
835
|
-
factors,
|
|
836
|
-
confidence,
|
|
837
|
-
reasoning: `[Heuristic] ${reasoning}`,
|
|
838
|
-
potentialQuestions: mode === ExecMode.CLARIFICATION ? questions : undefined,
|
|
839
|
-
effortEstimate,
|
|
840
|
-
};
|
|
841
|
-
}
|
|
842
|
-
/**
|
|
843
|
-
* Analyzes complexity factors from the request and context.
|
|
844
|
-
*/
|
|
845
|
-
analyzeFactors(userRequest, context) {
|
|
846
|
-
const requestLower = userRequest.toLowerCase();
|
|
847
|
-
// Check for project creation scenario (greenfield)
|
|
848
|
-
const isProjectCreation = this.detectsProjectCreation(requestLower);
|
|
849
|
-
const isLongRequest = userRequest.length >= COMPLEX_REQUEST_LENGTH_THRESHOLD;
|
|
850
|
-
// Estimate files affected
|
|
851
|
-
let filesAffected = this.estimateFilesAffected(context);
|
|
852
|
-
// For project creation, estimate based on request content
|
|
853
|
-
if (isProjectCreation || (filesAffected === 0 && isLongRequest)) {
|
|
854
|
-
filesAffected = this.estimateFilesFromRequest(requestLower);
|
|
855
|
-
}
|
|
856
|
-
// Estimate lines changed
|
|
857
|
-
let linesChanged = this.estimateLinesChanged(userRequest, context);
|
|
858
|
-
// For project creation, bump up the estimate
|
|
859
|
-
if (isProjectCreation) {
|
|
860
|
-
linesChanged = Math.max(linesChanged, 200);
|
|
861
|
-
}
|
|
862
|
-
if (isLongRequest) {
|
|
863
|
-
linesChanged = Math.max(linesChanged, 100);
|
|
864
|
-
}
|
|
865
|
-
// Check for architectural patterns
|
|
866
|
-
const createsAbstractions = this.detectsAbstractionCreation(requestLower);
|
|
867
|
-
let architecturalChange = this.detectsArchitecturalChange(requestLower, context);
|
|
868
|
-
// Project creation is inherently architectural
|
|
869
|
-
if (isProjectCreation) {
|
|
870
|
-
architecturalChange = true;
|
|
871
|
-
}
|
|
872
|
-
const breakingChanges = this.detectsBreakingChanges(requestLower);
|
|
873
|
-
const crossCuttingConcerns = this.detectsCrossCuttingConcerns(context);
|
|
874
|
-
// Analyze requirement clarity
|
|
875
|
-
const requirementsClear = this.assessRequirementClarity(requestLower);
|
|
876
|
-
let implementationApproaches = this.countImplementationApproaches(requestLower, context);
|
|
877
|
-
// Long detailed specs often have multiple valid approaches
|
|
878
|
-
if (isLongRequest && implementationApproaches === 1) {
|
|
879
|
-
implementationApproaches = 2;
|
|
880
|
-
}
|
|
881
|
-
// Check for migration needs
|
|
882
|
-
const requiresMigration = this.detectsMigrationNeed(requestLower, context);
|
|
883
|
-
// Calculate overall risk
|
|
884
|
-
let riskLevel = this.calculateRiskLevel(filesAffected, architecturalChange, breakingChanges, crossCuttingConcerns);
|
|
885
|
-
// Project creation has inherent risk
|
|
886
|
-
if (isProjectCreation) {
|
|
887
|
-
riskLevel = Math.max(riskLevel, 5);
|
|
888
|
-
}
|
|
889
|
-
// Calculate context sufficiency based on available information
|
|
890
|
-
const contextSufficiency = this.calculateContextSufficiency(context, requirementsClear);
|
|
891
|
-
return {
|
|
892
|
-
filesAffected,
|
|
893
|
-
linesChanged,
|
|
894
|
-
createsAbstractions,
|
|
895
|
-
architecturalChange,
|
|
896
|
-
breakingChanges,
|
|
897
|
-
crossCuttingConcerns,
|
|
898
|
-
requirementsClear,
|
|
899
|
-
implementationApproaches,
|
|
900
|
-
requiresMigration,
|
|
901
|
-
riskLevel,
|
|
902
|
-
contextSufficiency,
|
|
903
|
-
};
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* Calculates context sufficiency based on available code context and relevance scores.
|
|
907
|
-
* High sufficiency means we have enough information to proceed without clarification.
|
|
908
|
-
*/
|
|
909
|
-
calculateContextSufficiency(context, requirementsClear) {
|
|
910
|
-
let score = 0;
|
|
911
|
-
// High-relevance files provide strong context
|
|
912
|
-
const highRelevanceFiles = context.relevantFiles.filter(f => f.relevanceScore >= 70);
|
|
913
|
-
const mediumRelevanceFiles = context.relevantFiles.filter(f => f.relevanceScore >= 40 && f.relevanceScore < 70);
|
|
914
|
-
// Score based on relevant files found
|
|
915
|
-
if (highRelevanceFiles.length >= 3) {
|
|
916
|
-
score += 3;
|
|
917
|
-
}
|
|
918
|
-
else if (highRelevanceFiles.length >= 1) {
|
|
919
|
-
score += 2;
|
|
920
|
-
}
|
|
921
|
-
if (mediumRelevanceFiles.length >= 2) {
|
|
922
|
-
score += 1;
|
|
923
|
-
}
|
|
924
|
-
// Token count indicates how much code we've gathered
|
|
925
|
-
if (context.totalTokens >= 2000) {
|
|
926
|
-
score += 2;
|
|
927
|
-
}
|
|
928
|
-
else if (context.totalTokens >= 500) {
|
|
929
|
-
score += 1;
|
|
930
|
-
}
|
|
931
|
-
// Clear requirements boost sufficiency
|
|
932
|
-
if (requirementsClear) {
|
|
933
|
-
score += 2;
|
|
934
|
-
}
|
|
935
|
-
// Identified affected areas help
|
|
936
|
-
if (context.affectedAreas.length >= 1 && context.affectedAreas[0] !== 'unknown') {
|
|
937
|
-
score += 1;
|
|
938
|
-
}
|
|
939
|
-
// Formatted context with actual code snippets is valuable
|
|
940
|
-
if (context.formattedContext && context.formattedContext.length > 500) {
|
|
941
|
-
score += 1;
|
|
942
|
-
}
|
|
943
|
-
// Map score to sufficiency level
|
|
944
|
-
if (score >= 7) {
|
|
945
|
-
return 'high';
|
|
946
|
-
}
|
|
947
|
-
else if (score >= 4) {
|
|
948
|
-
return 'medium';
|
|
949
|
-
}
|
|
950
|
-
return 'low';
|
|
951
|
-
}
|
|
952
|
-
/**
|
|
953
|
-
* Detects if this is a project creation / greenfield scenario.
|
|
954
|
-
*/
|
|
955
|
-
detectsProjectCreation(request) {
|
|
956
|
-
return PROJECT_CREATION_KEYWORDS.some(k => request.includes(k));
|
|
957
|
-
}
|
|
958
|
-
/**
|
|
959
|
-
* Estimates files that will be created based on request content.
|
|
960
|
-
* Used when there are no existing files to analyze.
|
|
961
|
-
*/
|
|
962
|
-
estimateFilesFromRequest(request) {
|
|
963
|
-
let estimate = 0;
|
|
964
|
-
// Count file extension mentions
|
|
965
|
-
const fileExtensions = ['.ts', '.js', '.tsx', '.jsx', '.py', '.go', '.rs', '.java', '.css', '.scss', '.html', '.json', '.yaml', '.yml', '.md'];
|
|
966
|
-
for (const ext of fileExtensions) {
|
|
967
|
-
const matches = request.match(new RegExp(`\\${ext}`, 'gi')) || [];
|
|
968
|
-
estimate += matches.length;
|
|
969
|
-
}
|
|
970
|
-
// Count component/module mentions
|
|
971
|
-
const componentPatterns = [
|
|
972
|
-
/\bcomponent\b/gi, /\bmodule\b/gi, /\bservice\b/gi, /\bcontroller\b/gi,
|
|
973
|
-
/\bmodel\b/gi, /\bview\b/gi, /\broute\b/gi, /\bapi\b/gi, /\bendpoint\b/gi,
|
|
974
|
-
/\bpage\b/gi, /\bscreen\b/gi, /\butil\b/gi, /\bhelper\b/gi, /\btest\b/gi,
|
|
975
|
-
];
|
|
976
|
-
for (const pattern of componentPatterns) {
|
|
977
|
-
const matches = request.match(pattern) || [];
|
|
978
|
-
estimate += Math.ceil(matches.length / 2); // Dedupe similar mentions
|
|
979
|
-
}
|
|
980
|
-
// Minimum estimate for project creation
|
|
981
|
-
return Math.max(estimate, 5);
|
|
982
|
-
}
|
|
983
|
-
/**
|
|
984
|
-
* Estimates the number of files that will be affected.
|
|
985
|
-
*/
|
|
986
|
-
estimateFilesAffected(context) {
|
|
987
|
-
// Use relevant files as a proxy
|
|
988
|
-
const highRelevance = context.relevantFiles.filter(f => f.relevanceScore >= 50).length;
|
|
989
|
-
const mediumRelevance = context.relevantFiles.filter(f => f.relevanceScore >= 30 && f.relevanceScore < 50).length;
|
|
990
|
-
return highRelevance + Math.ceil(mediumRelevance / 2);
|
|
991
|
-
}
|
|
992
|
-
/**
|
|
993
|
-
* Estimates lines of code that will change.
|
|
994
|
-
*/
|
|
995
|
-
estimateLinesChanged(userRequest, context) {
|
|
996
|
-
const requestLower = userRequest.toLowerCase();
|
|
997
|
-
// Simple heuristics based on task type
|
|
998
|
-
if (SIMPLE_TASK_KEYWORDS.some(k => requestLower.includes(k))) {
|
|
999
|
-
return 10;
|
|
1000
|
-
}
|
|
1001
|
-
if (ARCHITECTURAL_KEYWORDS.some(k => requestLower.includes(k))) {
|
|
1002
|
-
return 500;
|
|
1003
|
-
}
|
|
1004
|
-
// Base estimate on relevant files
|
|
1005
|
-
const filesAffected = context.relevantFiles.filter(f => f.relevanceScore >= 40).length;
|
|
1006
|
-
return Math.max(20, filesAffected * 30);
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
|
-
* Detects if the request involves creating new abstractions.
|
|
1010
|
-
*/
|
|
1011
|
-
detectsAbstractionCreation(request) {
|
|
1012
|
-
const abstractionKeywords = [
|
|
1013
|
-
'abstract', 'interface', 'base class', 'generic', 'factory',
|
|
1014
|
-
'pattern', 'wrapper', 'adapter', 'decorator', 'strategy',
|
|
1015
|
-
'plugin', 'hook', 'middleware', 'provider', 'context',
|
|
1016
|
-
];
|
|
1017
|
-
return abstractionKeywords.some(k => request.includes(k));
|
|
1018
|
-
}
|
|
1019
|
-
/**
|
|
1020
|
-
* Detects if the request involves architectural changes.
|
|
1021
|
-
*/
|
|
1022
|
-
detectsArchitecturalChange(request, context) {
|
|
1023
|
-
if (ARCHITECTURAL_KEYWORDS.some(k => request.includes(k))) {
|
|
1024
|
-
return true;
|
|
1025
|
-
}
|
|
1026
|
-
// Check if multiple major areas are affected
|
|
1027
|
-
const majorAreas = ['backend', 'api', 'database', 'ui'];
|
|
1028
|
-
const affectedMajorAreas = context.affectedAreas.filter(a => majorAreas.includes(a));
|
|
1029
|
-
return affectedMajorAreas.length >= 2;
|
|
1030
|
-
}
|
|
1031
|
-
/**
|
|
1032
|
-
* Detects if the request may cause breaking changes.
|
|
1033
|
-
*/
|
|
1034
|
-
detectsBreakingChanges(request) {
|
|
1035
|
-
return BREAKING_CHANGE_KEYWORDS.some(k => request.includes(k));
|
|
1036
|
-
}
|
|
1037
|
-
/**
|
|
1038
|
-
* Detects if changes affect multiple subsystems.
|
|
1039
|
-
*/
|
|
1040
|
-
detectsCrossCuttingConcerns(context) {
|
|
1041
|
-
// More than 3 distinct areas suggests cross-cutting concerns
|
|
1042
|
-
const uniqueAreas = new Set(context.affectedAreas);
|
|
1043
|
-
uniqueAreas.delete('unknown');
|
|
1044
|
-
return uniqueAreas.size >= 3;
|
|
1045
|
-
}
|
|
1046
|
-
/**
|
|
1047
|
-
* Assesses how clear and unambiguous the requirements are.
|
|
1048
|
-
*/
|
|
1049
|
-
assessRequirementClarity(request) {
|
|
1050
|
-
// Check for ambiguous language
|
|
1051
|
-
const hasAmbiguity = AMBIGUOUS_KEYWORDS.some(k => request.includes(k));
|
|
1052
|
-
// Check for specific details
|
|
1053
|
-
const hasSpecifics = /\d+/.test(request) || // Contains numbers
|
|
1054
|
-
/`[^`]+`/.test(request) || // Contains code references
|
|
1055
|
-
/["'][^"']+["']/.test(request); // Contains quoted text
|
|
1056
|
-
// Short, vague requests are unclear
|
|
1057
|
-
const wordCount = request.split(/\s+/).length;
|
|
1058
|
-
const isTooVague = wordCount < 5;
|
|
1059
|
-
return !hasAmbiguity && (hasSpecifics || !isTooVague);
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* Counts potential implementation approaches.
|
|
1063
|
-
*/
|
|
1064
|
-
countImplementationApproaches(request, context) {
|
|
1065
|
-
let approaches = 1;
|
|
1066
|
-
// Check if library/package is mentioned as a choice (not a constraint)
|
|
1067
|
-
// Constraints: "use X only", "only use X", "must use X", "with X library"
|
|
1068
|
-
const hasLibraryMention = request.includes('library') || request.includes('package');
|
|
1069
|
-
const isLibraryConstraint = /\b(only|must use|use .+ only|with .+ library)\b/i.test(request);
|
|
1070
|
-
if (hasLibraryMention && !isLibraryConstraint) {
|
|
1071
|
-
// Library mentioned without constraint suggests choice
|
|
1072
|
-
approaches += 1;
|
|
1073
|
-
}
|
|
1074
|
-
// Multiple areas affected suggests multiple approaches
|
|
1075
|
-
if (context.affectedAreas.length > 2) {
|
|
1076
|
-
approaches += 1;
|
|
1077
|
-
}
|
|
1078
|
-
// Architectural keywords suggest multiple approaches
|
|
1079
|
-
if (ARCHITECTURAL_KEYWORDS.some(k => request.includes(k))) {
|
|
1080
|
-
approaches += 2;
|
|
1081
|
-
}
|
|
1082
|
-
// Explicit choice indicators
|
|
1083
|
-
const choicePatterns = [
|
|
1084
|
-
/which (library|framework|approach|method)/i,
|
|
1085
|
-
/choose between/i,
|
|
1086
|
-
/\bor\b.*\bor\b/i, // Multiple "or"s suggest enumeration
|
|
1087
|
-
/option[s]?\s*[:]/i,
|
|
1088
|
-
];
|
|
1089
|
-
if (choicePatterns.some(p => p.test(request))) {
|
|
1090
|
-
approaches += 1;
|
|
1091
|
-
}
|
|
1092
|
-
return approaches;
|
|
1093
|
-
}
|
|
1094
|
-
/**
|
|
1095
|
-
* Detects if a migration will be needed.
|
|
1096
|
-
*/
|
|
1097
|
-
detectsMigrationNeed(request, context) {
|
|
1098
|
-
const migrationKeywords = ['migrate', 'migration', 'upgrade', 'convert', 'transform', 'schema'];
|
|
1099
|
-
if (migrationKeywords.some(k => request.includes(k))) {
|
|
1100
|
-
return true;
|
|
1101
|
-
}
|
|
1102
|
-
// Database area changes often need migrations
|
|
1103
|
-
return context.affectedAreas.includes('database');
|
|
1104
|
-
}
|
|
1105
|
-
/**
|
|
1106
|
-
* Calculates overall risk level (1-10).
|
|
1107
|
-
*/
|
|
1108
|
-
calculateRiskLevel(filesAffected, architecturalChange, breakingChanges, crossCuttingConcerns) {
|
|
1109
|
-
let risk = 1;
|
|
1110
|
-
// File count risk
|
|
1111
|
-
if (filesAffected > 10)
|
|
1112
|
-
risk += 2;
|
|
1113
|
-
else if (filesAffected > 5)
|
|
1114
|
-
risk += 1;
|
|
1115
|
-
// Architectural changes are risky
|
|
1116
|
-
if (architecturalChange)
|
|
1117
|
-
risk += 3;
|
|
1118
|
-
// Breaking changes are very risky
|
|
1119
|
-
if (breakingChanges)
|
|
1120
|
-
risk += 3;
|
|
1121
|
-
// Cross-cutting concerns add risk
|
|
1122
|
-
if (crossCuttingConcerns)
|
|
1123
|
-
risk += 1;
|
|
1124
|
-
return Math.min(10, risk);
|
|
1125
|
-
}
|
|
1126
|
-
/**
|
|
1127
|
-
* Determines the execution mode based on factors.
|
|
1128
|
-
*
|
|
1129
|
-
* Priority order (revised for better balance):
|
|
1130
|
-
* 1. DIRECT - Simple, straightforward tasks
|
|
1131
|
-
* 2. TODO_LIST (for non-greenfield with context) - Medium complexity with sufficient context
|
|
1132
|
-
* 3. CLARIFICATION - Only when genuinely needed and context is insufficient
|
|
1133
|
-
* 4. PLAN - Complex architectural changes
|
|
1134
|
-
*/
|
|
1135
|
-
determineMode(factors) {
|
|
1136
|
-
const hasHighContext = factors.contextSufficiency === 'high';
|
|
1137
|
-
const hasMediumContext = factors.contextSufficiency === 'medium' || hasHighContext;
|
|
1138
|
-
// DIRECT mode criteria
|
|
1139
|
-
const isSimple = factors.filesAffected <= 3 &&
|
|
1140
|
-
factors.linesChanged <= 50 &&
|
|
1141
|
-
!factors.createsAbstractions &&
|
|
1142
|
-
!factors.architecturalChange &&
|
|
1143
|
-
!factors.breakingChanges &&
|
|
1144
|
-
factors.requirementsClear &&
|
|
1145
|
-
factors.implementationApproaches === 1 &&
|
|
1146
|
-
factors.riskLevel <= 3;
|
|
1147
|
-
if (isSimple) {
|
|
1148
|
-
return ExecMode.DIRECT;
|
|
1149
|
-
}
|
|
1150
|
-
// Greenfield detection: no existing files means we're creating, not modifying
|
|
1151
|
-
const isGreenfield = factors.filesAffected <= 1;
|
|
1152
|
-
// TODO_LIST mode criteria - RELAXED constraints for better coverage
|
|
1153
|
-
// Now checked BEFORE clarification for non-greenfield tasks with context
|
|
1154
|
-
const isTodoListCandidate = factors.filesAffected >= 2 && // Lowered from 3
|
|
1155
|
-
factors.filesAffected <= 8 && // Raised from 6
|
|
1156
|
-
factors.linesChanged >= 30 && // Lowered from 50
|
|
1157
|
-
factors.linesChanged <= 200 && // Raised from 150
|
|
1158
|
-
!factors.architecturalChange &&
|
|
1159
|
-
!factors.breakingChanges &&
|
|
1160
|
-
(factors.requirementsClear || hasMediumContext) && // Context can substitute for clarity
|
|
1161
|
-
factors.riskLevel <= 6; // Raised from 5
|
|
1162
|
-
// For non-greenfield tasks with sufficient context, prefer TODO_LIST over CLARIFICATION
|
|
1163
|
-
if (!isGreenfield && isTodoListCandidate && hasMediumContext) {
|
|
1164
|
-
return ExecMode.TODO_LIST;
|
|
1165
|
-
}
|
|
1166
|
-
// CLARIFICATION mode criteria - TIGHTENED to avoid over-triggering
|
|
1167
|
-
// Only trigger when genuinely ambiguous AND context is insufficient
|
|
1168
|
-
const needsClarification = (!factors.requirementsClear && !hasHighContext) || // Skip if high context compensates
|
|
1169
|
-
(factors.implementationApproaches > 2) || // Raised threshold from > 1
|
|
1170
|
-
(factors.filesAffected >= 4 && factors.filesAffected <= 8 &&
|
|
1171
|
-
!factors.architecturalChange && !hasMediumContext); // Only if no context
|
|
1172
|
-
// For greenfield projects, only use CLARIFICATION if requirements are truly unclear
|
|
1173
|
-
// (Softened: no longer automatic for all greenfield)
|
|
1174
|
-
if (isGreenfield && !factors.requirementsClear && !factors.breakingChanges) {
|
|
1175
|
-
return ExecMode.CLARIFICATION;
|
|
1176
|
-
}
|
|
1177
|
-
// For non-greenfield, use CLARIFICATION only when genuinely needed
|
|
1178
|
-
if (needsClarification && !factors.breakingChanges && !factors.architecturalChange) {
|
|
1179
|
-
return ExecMode.CLARIFICATION;
|
|
1180
|
-
}
|
|
1181
|
-
// Check TODO_LIST again for any remaining candidates (greenfield with context)
|
|
1182
|
-
if (isTodoListCandidate) {
|
|
1183
|
-
return ExecMode.TODO_LIST;
|
|
1184
|
-
}
|
|
1185
|
-
// PLAN mode for modifying existing complex codebases
|
|
1186
|
-
return ExecMode.PLAN;
|
|
1187
|
-
}
|
|
1188
|
-
/**
|
|
1189
|
-
* Calculates confidence in the classification.
|
|
1190
|
-
* For PLAN mode, strong complexity signals INCREASE confidence.
|
|
1191
|
-
* For DIRECT mode, simple signals increase confidence.
|
|
1192
|
-
*/
|
|
1193
|
-
calculateConfidence(factors, mode) {
|
|
1194
|
-
let confidence = 60; // Base confidence
|
|
1195
|
-
if (mode === ExecMode.PLAN) {
|
|
1196
|
-
// For PLAN mode: complexity indicators INCREASE confidence
|
|
1197
|
-
if (factors.architecturalChange) {
|
|
1198
|
-
confidence += 20;
|
|
1199
|
-
}
|
|
1200
|
-
if (factors.filesAffected >= 5) {
|
|
1201
|
-
confidence += 15;
|
|
1202
|
-
}
|
|
1203
|
-
else if (factors.filesAffected >= 3) {
|
|
1204
|
-
confidence += 10;
|
|
1205
|
-
}
|
|
1206
|
-
if (factors.linesChanged >= 200) {
|
|
1207
|
-
confidence += 10;
|
|
1208
|
-
}
|
|
1209
|
-
if (factors.riskLevel >= 5) {
|
|
1210
|
-
confidence += 10;
|
|
1211
|
-
}
|
|
1212
|
-
if (factors.breakingChanges) {
|
|
1213
|
-
confidence += 15;
|
|
1214
|
-
}
|
|
1215
|
-
if (factors.crossCuttingConcerns) {
|
|
1216
|
-
confidence += 10;
|
|
1217
|
-
}
|
|
1218
|
-
if (factors.implementationApproaches > 1) {
|
|
1219
|
-
confidence += 5 * factors.implementationApproaches;
|
|
1220
|
-
}
|
|
1221
|
-
if (!factors.requirementsClear) {
|
|
1222
|
-
confidence += 5; // Unclear requirements strengthen case for planning
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
else if (mode === ExecMode.DIRECT) {
|
|
1226
|
-
// For DIRECT mode: simplicity indicators increase confidence
|
|
1227
|
-
if (factors.requirementsClear) {
|
|
1228
|
-
confidence += 15;
|
|
1229
|
-
}
|
|
1230
|
-
if (factors.implementationApproaches === 1) {
|
|
1231
|
-
confidence += 10;
|
|
1232
|
-
}
|
|
1233
|
-
if (factors.riskLevel <= 3) {
|
|
1234
|
-
confidence += 10;
|
|
1235
|
-
}
|
|
1236
|
-
if (factors.filesAffected <= 2) {
|
|
1237
|
-
confidence += 10;
|
|
1238
|
-
}
|
|
1239
|
-
if (factors.linesChanged <= 30) {
|
|
1240
|
-
confidence += 5;
|
|
1241
|
-
}
|
|
1242
|
-
}
|
|
1243
|
-
else if (mode === ExecMode.TODO_LIST) {
|
|
1244
|
-
// For TODO_LIST mode: medium complexity with clear requirements or good context
|
|
1245
|
-
if (factors.requirementsClear) {
|
|
1246
|
-
confidence += 15;
|
|
1247
|
-
}
|
|
1248
|
-
if (factors.filesAffected >= 2 && factors.filesAffected <= 8) {
|
|
1249
|
-
confidence += 10;
|
|
1250
|
-
}
|
|
1251
|
-
if (factors.riskLevel <= 6) {
|
|
1252
|
-
confidence += 10;
|
|
1253
|
-
}
|
|
1254
|
-
if (!factors.architecturalChange) {
|
|
1255
|
-
confidence += 10;
|
|
1256
|
-
}
|
|
1257
|
-
if (factors.implementationApproaches === 1) {
|
|
1258
|
-
confidence += 5;
|
|
1259
|
-
}
|
|
1260
|
-
// NEW: Context sufficiency boost - good context means we can proceed confidently
|
|
1261
|
-
if (factors.contextSufficiency === 'high') {
|
|
1262
|
-
confidence += 15;
|
|
1263
|
-
}
|
|
1264
|
-
else if (factors.contextSufficiency === 'medium') {
|
|
1265
|
-
confidence += 10;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
else {
|
|
1269
|
-
// CLARIFICATION mode
|
|
1270
|
-
if (!factors.requirementsClear) {
|
|
1271
|
-
confidence += 15;
|
|
1272
|
-
}
|
|
1273
|
-
if (factors.implementationApproaches > 2) { // Raised threshold
|
|
1274
|
-
confidence += 10;
|
|
1275
|
-
}
|
|
1276
|
-
// NEW: Reduce confidence if context is sufficient (shouldn't be in CLARIFICATION)
|
|
1277
|
-
if (factors.contextSufficiency === 'high') {
|
|
1278
|
-
confidence -= 10;
|
|
1279
|
-
}
|
|
1280
|
-
else if (factors.contextSufficiency === 'medium') {
|
|
1281
|
-
confidence -= 5;
|
|
1282
|
-
}
|
|
1283
|
-
}
|
|
1284
|
-
return Math.max(30, Math.min(95, confidence));
|
|
1285
|
-
}
|
|
1286
|
-
/**
|
|
1287
|
-
* Generates human-readable reasoning for the classification.
|
|
1288
|
-
*/
|
|
1289
|
-
generateReasoning(factors, mode) {
|
|
1290
|
-
const reasons = [];
|
|
1291
|
-
switch (mode) {
|
|
1292
|
-
case ExecMode.DIRECT:
|
|
1293
|
-
reasons.push('This is a simple, focused change');
|
|
1294
|
-
reasons.push(`Affects ${factors.filesAffected} file(s)`);
|
|
1295
|
-
if (factors.requirementsClear) {
|
|
1296
|
-
reasons.push('Requirements are clear and unambiguous');
|
|
1297
|
-
}
|
|
1298
|
-
break;
|
|
1299
|
-
case ExecMode.CLARIFICATION:
|
|
1300
|
-
if (!factors.requirementsClear) {
|
|
1301
|
-
reasons.push('Requirements need clarification');
|
|
1302
|
-
}
|
|
1303
|
-
if (factors.implementationApproaches > 1) {
|
|
1304
|
-
reasons.push(`${factors.implementationApproaches} valid approaches identified`);
|
|
1305
|
-
}
|
|
1306
|
-
reasons.push('A few questions will help determine the best approach');
|
|
1307
|
-
break;
|
|
1308
|
-
case ExecMode.TODO_LIST:
|
|
1309
|
-
reasons.push('This is a medium complexity task with clear requirements');
|
|
1310
|
-
reasons.push(`Affects ${factors.filesAffected} file(s)`);
|
|
1311
|
-
if (factors.requirementsClear) {
|
|
1312
|
-
reasons.push('Requirements are clear');
|
|
1313
|
-
}
|
|
1314
|
-
reasons.push('A simple to-do list will help track progress');
|
|
1315
|
-
break;
|
|
1316
|
-
case ExecMode.PLAN:
|
|
1317
|
-
if (factors.filesAffected > 8) {
|
|
1318
|
-
reasons.push(`Significant scope: ${factors.filesAffected}+ files affected`);
|
|
1319
|
-
}
|
|
1320
|
-
if (factors.architecturalChange) {
|
|
1321
|
-
reasons.push('Involves architectural changes');
|
|
1322
|
-
}
|
|
1323
|
-
if (factors.breakingChanges) {
|
|
1324
|
-
reasons.push('May introduce breaking changes');
|
|
1325
|
-
}
|
|
1326
|
-
if (factors.crossCuttingConcerns) {
|
|
1327
|
-
reasons.push('Affects multiple subsystems');
|
|
1328
|
-
}
|
|
1329
|
-
if (factors.requiresMigration) {
|
|
1330
|
-
reasons.push('Requires data migration');
|
|
1331
|
-
}
|
|
1332
|
-
reasons.push('A detailed plan is recommended before implementation');
|
|
1333
|
-
break;
|
|
1334
|
-
}
|
|
1335
|
-
return reasons.join('. ') + '.';
|
|
1336
|
-
}
|
|
1337
|
-
/**
|
|
1338
|
-
* Generates clarification questions based on the analysis.
|
|
1339
|
-
*/
|
|
1340
|
-
generateQuestions(factors, userRequest, context) {
|
|
1341
|
-
const questions = [];
|
|
1342
|
-
const requestLower = userRequest.toLowerCase();
|
|
1343
|
-
// Scope question if unclear
|
|
1344
|
-
if (!factors.requirementsClear) {
|
|
1345
|
-
questions.push(QUESTION_TEMPLATES.scope);
|
|
1346
|
-
}
|
|
1347
|
-
// Approach question if multiple approaches
|
|
1348
|
-
if (factors.implementationApproaches > 1) {
|
|
1349
|
-
questions.push(QUESTION_TEMPLATES.approach);
|
|
1350
|
-
}
|
|
1351
|
-
// Testing question for non-trivial changes
|
|
1352
|
-
if (factors.filesAffected >= 2 && !requestLower.includes('test')) {
|
|
1353
|
-
questions.push(QUESTION_TEMPLATES.testing);
|
|
1354
|
-
}
|
|
1355
|
-
// Data handling question if database involved
|
|
1356
|
-
if (context.affectedAreas.includes('database') || factors.requiresMigration) {
|
|
1357
|
-
questions.push(QUESTION_TEMPLATES.existing_data);
|
|
1358
|
-
}
|
|
1359
|
-
// Feature flag question for user-facing changes
|
|
1360
|
-
if (context.affectedAreas.includes('ui') || context.affectedAreas.includes('api')) {
|
|
1361
|
-
if (factors.riskLevel >= 5) {
|
|
1362
|
-
questions.push(QUESTION_TEMPLATES.feature_flag);
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
// Default behavior question for new features
|
|
1366
|
-
if (requestLower.includes('add') || requestLower.includes('new') || requestLower.includes('feature')) {
|
|
1367
|
-
questions.push(QUESTION_TEMPLATES.default_behavior);
|
|
1368
|
-
}
|
|
1369
|
-
// Limit to 5 questions
|
|
1370
|
-
return questions.slice(0, 5);
|
|
1371
|
-
}
|
|
1372
|
-
/**
|
|
1373
|
-
* Generates an effort estimate description.
|
|
1374
|
-
*/
|
|
1375
|
-
estimateEffort(factors) {
|
|
1376
|
-
const { filesAffected, linesChanged, riskLevel, architecturalChange } = factors;
|
|
1377
|
-
if (filesAffected <= 2 && linesChanged <= 30) {
|
|
1378
|
-
return 'Quick change (few minutes)';
|
|
1379
|
-
}
|
|
1380
|
-
if (filesAffected <= 5 && linesChanged <= 100 && riskLevel <= 4) {
|
|
1381
|
-
return 'Small task (under an hour)';
|
|
1382
|
-
}
|
|
1383
|
-
if (filesAffected <= 10 && linesChanged <= 300 && !architecturalChange) {
|
|
1384
|
-
return 'Medium task (a few hours)';
|
|
1385
|
-
}
|
|
1386
|
-
if (architecturalChange || riskLevel >= 7) {
|
|
1387
|
-
return 'Large task requiring careful planning';
|
|
1388
|
-
}
|
|
1389
|
-
return 'Moderate task (half day or more)';
|
|
1390
|
-
}
|
|
1391
|
-
}
|
|
1392
|
-
// Singleton instance
|
|
1393
|
-
let complexityClassifierInstance = null;
|
|
1394
|
-
/**
|
|
1395
|
-
* Gets the singleton ComplexityClassifier instance.
|
|
1396
|
-
*/
|
|
1397
|
-
export function getComplexityClassifier() {
|
|
1398
|
-
if (!complexityClassifierInstance) {
|
|
1399
|
-
complexityClassifierInstance = new ComplexityClassifier();
|
|
1400
|
-
}
|
|
1401
|
-
return complexityClassifierInstance;
|
|
1402
|
-
}
|
|
1403
|
-
/**
|
|
1404
|
-
* Creates a new ComplexityClassifier instance.
|
|
1405
|
-
*/
|
|
1406
|
-
export function createComplexityClassifier() {
|
|
1407
|
-
return new ComplexityClassifier();
|
|
1408
|
-
}
|
|
1409
|
-
export { ComplexityClassifier };
|
|
1410
|
-
//# sourceMappingURL=complexity-classifier.js.map
|