@defai.digital/ax-cli 4.4.7 → 4.4.11
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/bin/ax-cli +1 -5
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +158 -9
- package/dist/index.js.map +1 -1
- package/dist/setup.d.ts +27 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +591 -0
- package/dist/setup.js.map +1 -0
- package/package.json +43 -135
- package/LICENSE +0 -22
- package/README.md +0 -420
- package/config-defaults/messages.yaml +0 -75
- package/config-defaults/models.yaml +0 -57
- package/config-defaults/prompts.yaml +0 -948
- package/config-defaults/settings.yaml +0 -157
- package/dist/agent/agent-executor.d.ts +0 -61
- package/dist/agent/agent-executor.js +0 -194
- package/dist/agent/agent-executor.js.map +0 -1
- package/dist/agent/agent-router.d.ts +0 -68
- package/dist/agent/agent-router.js +0 -242
- package/dist/agent/agent-router.js.map +0 -1
- package/dist/agent/context-manager.d.ts +0 -122
- package/dist/agent/context-manager.js +0 -406
- package/dist/agent/context-manager.js.map +0 -1
- package/dist/agent/core/index.d.ts +0 -8
- package/dist/agent/core/index.js +0 -9
- package/dist/agent/core/index.js.map +0 -1
- package/dist/agent/core/types.d.ts +0 -92
- package/dist/agent/core/types.js +0 -11
- package/dist/agent/core/types.js.map +0 -1
- package/dist/agent/dependency-resolver.d.ts +0 -90
- package/dist/agent/dependency-resolver.js +0 -366
- package/dist/agent/dependency-resolver.js.map +0 -1
- package/dist/agent/execution/index.d.ts +0 -9
- package/dist/agent/execution/index.js +0 -9
- package/dist/agent/execution/index.js.map +0 -1
- package/dist/agent/execution/tool-executor.d.ts +0 -93
- package/dist/agent/execution/tool-executor.js +0 -552
- package/dist/agent/execution/tool-executor.js.map +0 -1
- package/dist/agent/index.d.ts +0 -14
- package/dist/agent/index.js +0 -145
- package/dist/agent/index.js.map +0 -1
- package/dist/agent/llm-agent.d.ts +0 -368
- package/dist/agent/llm-agent.js +0 -1931
- package/dist/agent/llm-agent.js.map +0 -1
- package/dist/agent/loop-detector.d.ts +0 -72
- package/dist/agent/loop-detector.js +0 -335
- package/dist/agent/loop-detector.js.map +0 -1
- package/dist/agent/parallel-tools.d.ts +0 -69
- package/dist/agent/parallel-tools.js +0 -188
- package/dist/agent/parallel-tools.js.map +0 -1
- package/dist/agent/planning/index.d.ts +0 -9
- package/dist/agent/planning/index.js +0 -9
- package/dist/agent/planning/index.js.map +0 -1
- package/dist/agent/planning/plan-executor.d.ts +0 -79
- package/dist/agent/planning/plan-executor.js +0 -240
- package/dist/agent/planning/plan-executor.js.map +0 -1
- package/dist/agent/progress-tracker.d.ts +0 -94
- package/dist/agent/progress-tracker.js +0 -225
- package/dist/agent/progress-tracker.js.map +0 -1
- package/dist/agent/specialized/analysis-agent.d.ts +0 -11
- package/dist/agent/specialized/analysis-agent.js +0 -24
- package/dist/agent/specialized/analysis-agent.js.map +0 -1
- package/dist/agent/specialized/debug-agent.d.ts +0 -11
- package/dist/agent/specialized/debug-agent.js +0 -46
- package/dist/agent/specialized/debug-agent.js.map +0 -1
- package/dist/agent/specialized/documentation-agent.d.ts +0 -11
- package/dist/agent/specialized/documentation-agent.js +0 -24
- package/dist/agent/specialized/documentation-agent.js.map +0 -1
- package/dist/agent/specialized/index.d.ts +0 -11
- package/dist/agent/specialized/index.js +0 -12
- package/dist/agent/specialized/index.js.map +0 -1
- package/dist/agent/specialized/performance-agent.d.ts +0 -11
- package/dist/agent/specialized/performance-agent.js +0 -24
- package/dist/agent/specialized/performance-agent.js.map +0 -1
- package/dist/agent/specialized/refactoring-agent.d.ts +0 -11
- package/dist/agent/specialized/refactoring-agent.js +0 -24
- package/dist/agent/specialized/refactoring-agent.js.map +0 -1
- package/dist/agent/specialized/testing-agent.d.ts +0 -11
- package/dist/agent/specialized/testing-agent.js +0 -24
- package/dist/agent/specialized/testing-agent.js.map +0 -1
- package/dist/agent/status-reporter.d.ts +0 -114
- package/dist/agent/status-reporter.js +0 -335
- package/dist/agent/status-reporter.js.map +0 -1
- package/dist/agent/streaming/index.d.ts +0 -9
- package/dist/agent/streaming/index.js +0 -9
- package/dist/agent/streaming/index.js.map +0 -1
- package/dist/agent/streaming/stream-handler.d.ts +0 -62
- package/dist/agent/streaming/stream-handler.js +0 -217
- package/dist/agent/streaming/stream-handler.js.map +0 -1
- package/dist/agent/subagent-orchestrator.d.ts +0 -166
- package/dist/agent/subagent-orchestrator.js +0 -487
- package/dist/agent/subagent-orchestrator.js.map +0 -1
- package/dist/agent/subagent-types.d.ts +0 -261
- package/dist/agent/subagent-types.js +0 -257
- package/dist/agent/subagent-types.js.map +0 -1
- package/dist/agent/subagent.d.ts +0 -116
- package/dist/agent/subagent.js +0 -507
- package/dist/agent/subagent.js.map +0 -1
- package/dist/checkpoint/index.d.ts +0 -9
- package/dist/checkpoint/index.js +0 -11
- package/dist/checkpoint/index.js.map +0 -1
- package/dist/checkpoint/manager.d.ts +0 -101
- package/dist/checkpoint/manager.js +0 -407
- package/dist/checkpoint/manager.js.map +0 -1
- package/dist/checkpoint/storage.d.ts +0 -39
- package/dist/checkpoint/storage.js +0 -350
- package/dist/checkpoint/storage.js.map +0 -1
- package/dist/checkpoint/types.d.ts +0 -111
- package/dist/checkpoint/types.js +0 -17
- package/dist/checkpoint/types.js.map +0 -1
- package/dist/commands/cache.d.ts +0 -7
- package/dist/commands/cache.js +0 -284
- package/dist/commands/cache.js.map +0 -1
- package/dist/commands/custom-commands.d.ts +0 -77
- package/dist/commands/custom-commands.js +0 -251
- package/dist/commands/custom-commands.js.map +0 -1
- package/dist/commands/design.d.ts +0 -18
- package/dist/commands/design.js +0 -511
- package/dist/commands/design.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -6
- package/dist/commands/doctor.js +0 -773
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/frontend.d.ts +0 -9
- package/dist/commands/frontend.js +0 -645
- package/dist/commands/frontend.js.map +0 -1
- package/dist/commands/init/wizard.d.ts +0 -55
- package/dist/commands/init/wizard.js +0 -189
- package/dist/commands/init/wizard.js.map +0 -1
- package/dist/commands/init.d.ts +0 -8
- package/dist/commands/init.js +0 -195
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/mcp-migrate.d.ts +0 -9
- package/dist/commands/mcp-migrate.js +0 -175
- package/dist/commands/mcp-migrate.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -2
- package/dist/commands/mcp.js +0 -1292
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/memory.d.ts +0 -6
- package/dist/commands/memory.js +0 -555
- package/dist/commands/memory.js.map +0 -1
- package/dist/commands/models.d.ts +0 -5
- package/dist/commands/models.js +0 -213
- package/dist/commands/models.js.map +0 -1
- package/dist/commands/plan.d.ts +0 -43
- package/dist/commands/plan.js +0 -362
- package/dist/commands/plan.js.map +0 -1
- package/dist/commands/rewind.d.ts +0 -19
- package/dist/commands/rewind.js +0 -221
- package/dist/commands/rewind.js.map +0 -1
- package/dist/commands/setup.d.ts +0 -14
- package/dist/commands/setup.js +0 -733
- package/dist/commands/setup.js.map +0 -1
- package/dist/commands/status.d.ts +0 -7
- package/dist/commands/status.js +0 -437
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/templates.d.ts +0 -5
- package/dist/commands/templates.js +0 -245
- package/dist/commands/templates.js.map +0 -1
- package/dist/commands/update.d.ts +0 -49
- package/dist/commands/update.js +0 -366
- package/dist/commands/update.js.map +0 -1
- package/dist/commands/usage.d.ts +0 -8
- package/dist/commands/usage.js +0 -264
- package/dist/commands/usage.js.map +0 -1
- package/dist/commands/vscode.d.ts +0 -7
- package/dist/commands/vscode.js +0 -419
- package/dist/commands/vscode.js.map +0 -1
- package/dist/constants.d.ts +0 -236
- package/dist/constants.js +0 -288
- package/dist/constants.js.map +0 -1
- package/dist/design/figma-alias.d.ts +0 -170
- package/dist/design/figma-alias.js +0 -577
- package/dist/design/figma-alias.js.map +0 -1
- package/dist/design/figma-audit.d.ts +0 -40
- package/dist/design/figma-audit.js +0 -383
- package/dist/design/figma-audit.js.map +0 -1
- package/dist/design/figma-client.d.ts +0 -131
- package/dist/design/figma-client.js +0 -369
- package/dist/design/figma-client.js.map +0 -1
- package/dist/design/figma-map.d.ts +0 -29
- package/dist/design/figma-map.js +0 -346
- package/dist/design/figma-map.js.map +0 -1
- package/dist/design/figma-tokens.d.ts +0 -73
- package/dist/design/figma-tokens.js +0 -448
- package/dist/design/figma-tokens.js.map +0 -1
- package/dist/design/index.d.ts +0 -13
- package/dist/design/index.js +0 -20
- package/dist/design/index.js.map +0 -1
- package/dist/design/types.d.ts +0 -98
- package/dist/design/types.js +0 -9
- package/dist/design/types.js.map +0 -1
- package/dist/hooks/hook-runner.d.ts +0 -142
- package/dist/hooks/hook-runner.js +0 -436
- package/dist/hooks/hook-runner.js.map +0 -1
- package/dist/hooks/index.d.ts +0 -9
- package/dist/hooks/index.js +0 -10
- package/dist/hooks/index.js.map +0 -1
- package/dist/hooks/manager.d.ts +0 -84
- package/dist/hooks/manager.js +0 -348
- package/dist/hooks/manager.js.map +0 -1
- package/dist/hooks/types.d.ts +0 -134
- package/dist/hooks/types.js +0 -9
- package/dist/hooks/types.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/ipc/index.d.ts +0 -9
- package/dist/ipc/index.js +0 -10
- package/dist/ipc/index.js.map +0 -1
- package/dist/ipc/vscode-client.d.ts +0 -200
- package/dist/ipc/vscode-client.js +0 -495
- package/dist/ipc/vscode-client.js.map +0 -1
- package/dist/llm/client.d.ts +0 -205
- package/dist/llm/client.js +0 -735
- package/dist/llm/client.js.map +0 -1
- package/dist/llm/tools.d.ts +0 -102
- package/dist/llm/tools.js +0 -275
- package/dist/llm/tools.js.map +0 -1
- package/dist/llm/types.d.ts +0 -428
- package/dist/llm/types.js +0 -194
- package/dist/llm/types.js.map +0 -1
- package/dist/mcp/automatosx-auto-discovery.d.ts +0 -66
- package/dist/mcp/automatosx-auto-discovery.js +0 -169
- package/dist/mcp/automatosx-auto-discovery.js.map +0 -1
- package/dist/mcp/automatosx-loader.d.ts +0 -99
- package/dist/mcp/automatosx-loader.js +0 -250
- package/dist/mcp/automatosx-loader.js.map +0 -1
- package/dist/mcp/cancellation.d.ts +0 -182
- package/dist/mcp/cancellation.js +0 -275
- package/dist/mcp/cancellation.js.map +0 -1
- package/dist/mcp/client-v2.d.ts +0 -500
- package/dist/mcp/client-v2.js +0 -1433
- package/dist/mcp/client-v2.js.map +0 -1
- package/dist/mcp/client.d.ts +0 -170
- package/dist/mcp/client.js +0 -232
- package/dist/mcp/client.js.map +0 -1
- package/dist/mcp/config-detector.d.ts +0 -90
- package/dist/mcp/config-detector.js +0 -250
- package/dist/mcp/config-detector.js.map +0 -1
- package/dist/mcp/config-migrator.d.ts +0 -68
- package/dist/mcp/config-migrator.js +0 -291
- package/dist/mcp/config-migrator.js.map +0 -1
- package/dist/mcp/config.d.ts +0 -24
- package/dist/mcp/config.js +0 -273
- package/dist/mcp/config.js.map +0 -1
- package/dist/mcp/constants.d.ts +0 -66
- package/dist/mcp/constants.js +0 -85
- package/dist/mcp/constants.js.map +0 -1
- package/dist/mcp/content-length-transport.d.ts +0 -106
- package/dist/mcp/content-length-transport.js +0 -413
- package/dist/mcp/content-length-transport.js.map +0 -1
- package/dist/mcp/debug.d.ts +0 -211
- package/dist/mcp/debug.js +0 -404
- package/dist/mcp/debug.js.map +0 -1
- package/dist/mcp/error-formatter.d.ts +0 -40
- package/dist/mcp/error-formatter.js +0 -207
- package/dist/mcp/error-formatter.js.map +0 -1
- package/dist/mcp/error-remediation.d.ts +0 -45
- package/dist/mcp/error-remediation.js +0 -291
- package/dist/mcp/error-remediation.js.map +0 -1
- package/dist/mcp/health.d.ts +0 -120
- package/dist/mcp/health.js +0 -267
- package/dist/mcp/health.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -56
- package/dist/mcp/index.js +0 -89
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/invariants.d.ts +0 -141
- package/dist/mcp/invariants.js +0 -243
- package/dist/mcp/invariants.js.map +0 -1
- package/dist/mcp/mutex-safe.d.ts +0 -151
- package/dist/mcp/mutex-safe.js +0 -260
- package/dist/mcp/mutex-safe.js.map +0 -1
- package/dist/mcp/progress.d.ts +0 -155
- package/dist/mcp/progress.js +0 -252
- package/dist/mcp/progress.js.map +0 -1
- package/dist/mcp/prompts.d.ts +0 -68
- package/dist/mcp/prompts.js +0 -129
- package/dist/mcp/prompts.js.map +0 -1
- package/dist/mcp/provider-mcp-loader.d.ts +0 -130
- package/dist/mcp/provider-mcp-loader.js +0 -292
- package/dist/mcp/provider-mcp-loader.js.map +0 -1
- package/dist/mcp/reconnection.d.ts +0 -101
- package/dist/mcp/reconnection.js +0 -253
- package/dist/mcp/reconnection.js.map +0 -1
- package/dist/mcp/registry.d.ts +0 -75
- package/dist/mcp/registry.js +0 -276
- package/dist/mcp/registry.js.map +0 -1
- package/dist/mcp/resources.d.ts +0 -58
- package/dist/mcp/resources.js +0 -144
- package/dist/mcp/resources.js.map +0 -1
- package/dist/mcp/schema-validator.d.ts +0 -82
- package/dist/mcp/schema-validator.js +0 -161
- package/dist/mcp/schema-validator.js.map +0 -1
- package/dist/mcp/ssrf-protection.d.ts +0 -86
- package/dist/mcp/ssrf-protection.js +0 -311
- package/dist/mcp/ssrf-protection.js.map +0 -1
- package/dist/mcp/subscriptions.d.ts +0 -168
- package/dist/mcp/subscriptions.js +0 -248
- package/dist/mcp/subscriptions.js.map +0 -1
- package/dist/mcp/templates.d.ts +0 -52
- package/dist/mcp/templates.js +0 -627
- package/dist/mcp/templates.js.map +0 -1
- package/dist/mcp/transports.d.ts +0 -80
- package/dist/mcp/transports.js +0 -237
- package/dist/mcp/transports.js.map +0 -1
- package/dist/mcp/type-safety.d.ts +0 -225
- package/dist/mcp/type-safety.js +0 -237
- package/dist/mcp/type-safety.js.map +0 -1
- package/dist/mcp/validation.d.ts +0 -29
- package/dist/mcp/validation.js +0 -339
- package/dist/mcp/validation.js.map +0 -1
- package/dist/mcp/zai-detector.d.ts +0 -63
- package/dist/mcp/zai-detector.js +0 -193
- package/dist/mcp/zai-detector.js.map +0 -1
- package/dist/mcp/zai-templates.d.ts +0 -90
- package/dist/mcp/zai-templates.js +0 -157
- package/dist/mcp/zai-templates.js.map +0 -1
- package/dist/memory/context-generator.d.ts +0 -84
- package/dist/memory/context-generator.js +0 -546
- package/dist/memory/context-generator.js.map +0 -1
- package/dist/memory/context-injector.d.ts +0 -97
- package/dist/memory/context-injector.js +0 -159
- package/dist/memory/context-injector.js.map +0 -1
- package/dist/memory/context-store.d.ts +0 -103
- package/dist/memory/context-store.js +0 -264
- package/dist/memory/context-store.js.map +0 -1
- package/dist/memory/index.d.ts +0 -43
- package/dist/memory/index.js +0 -49
- package/dist/memory/index.js.map +0 -1
- package/dist/memory/provider-context-store.d.ts +0 -127
- package/dist/memory/provider-context-store.js +0 -385
- package/dist/memory/provider-context-store.js.map +0 -1
- package/dist/memory/schemas.d.ts +0 -118
- package/dist/memory/schemas.js +0 -106
- package/dist/memory/schemas.js.map +0 -1
- package/dist/memory/stats-collector.d.ts +0 -73
- package/dist/memory/stats-collector.js +0 -170
- package/dist/memory/stats-collector.js.map +0 -1
- package/dist/memory/types.d.ts +0 -177
- package/dist/memory/types.js +0 -73
- package/dist/memory/types.js.map +0 -1
- package/dist/permissions/index.d.ts +0 -6
- package/dist/permissions/index.js +0 -7
- package/dist/permissions/index.js.map +0 -1
- package/dist/permissions/permission-manager.d.ts +0 -149
- package/dist/permissions/permission-manager.js +0 -410
- package/dist/permissions/permission-manager.js.map +0 -1
- package/dist/planner/dependency-resolver.d.ts +0 -72
- package/dist/planner/dependency-resolver.js +0 -272
- package/dist/planner/dependency-resolver.js.map +0 -1
- package/dist/planner/index.d.ts +0 -12
- package/dist/planner/index.js +0 -28
- package/dist/planner/index.js.map +0 -1
- package/dist/planner/plan-generator.d.ts +0 -74
- package/dist/planner/plan-generator.js +0 -244
- package/dist/planner/plan-generator.js.map +0 -1
- package/dist/planner/plan-storage.d.ts +0 -113
- package/dist/planner/plan-storage.js +0 -398
- package/dist/planner/plan-storage.js.map +0 -1
- package/dist/planner/prompts/planning-prompt.d.ts +0 -62
- package/dist/planner/prompts/planning-prompt.js +0 -414
- package/dist/planner/prompts/planning-prompt.js.map +0 -1
- package/dist/planner/task-planner.d.ts +0 -139
- package/dist/planner/task-planner.js +0 -532
- package/dist/planner/task-planner.js.map +0 -1
- package/dist/planner/token-estimator.d.ts +0 -63
- package/dist/planner/token-estimator.js +0 -295
- package/dist/planner/token-estimator.js.map +0 -1
- package/dist/planner/types.d.ts +0 -425
- package/dist/planner/types.js +0 -213
- package/dist/planner/types.js.map +0 -1
- package/dist/provider/config.d.ts +0 -227
- package/dist/provider/config.js +0 -430
- package/dist/provider/config.js.map +0 -1
- package/dist/schemas/api-schemas.d.ts +0 -45
- package/dist/schemas/api-schemas.js +0 -129
- package/dist/schemas/api-schemas.js.map +0 -1
- package/dist/schemas/confirmation-schemas.d.ts +0 -39
- package/dist/schemas/confirmation-schemas.js +0 -48
- package/dist/schemas/confirmation-schemas.js.map +0 -1
- package/dist/schemas/index-unified.d.ts +0 -12
- package/dist/schemas/index-unified.js +0 -17
- package/dist/schemas/index-unified.js.map +0 -1
- package/dist/schemas/index.d.ts +0 -83
- package/dist/schemas/index.js +0 -139
- package/dist/schemas/index.js.map +0 -1
- package/dist/schemas/settings-schemas.d.ts +0 -186
- package/dist/schemas/settings-schemas.js +0 -324
- package/dist/schemas/settings-schemas.js.map +0 -1
- package/dist/schemas/tool-schemas.d.ts +0 -127
- package/dist/schemas/tool-schemas.js +0 -84
- package/dist/schemas/tool-schemas.js.map +0 -1
- package/dist/schemas/yaml-schemas.d.ts +0 -231
- package/dist/schemas/yaml-schemas.js +0 -199
- package/dist/schemas/yaml-schemas.js.map +0 -1
- package/dist/sdk/errors.d.ts +0 -100
- package/dist/sdk/errors.js +0 -138
- package/dist/sdk/errors.js.map +0 -1
- package/dist/sdk/index.d.ts +0 -901
- package/dist/sdk/index.js +0 -1272
- package/dist/sdk/index.js.map +0 -1
- package/dist/sdk/progress-reporter.d.ts +0 -123
- package/dist/sdk/progress-reporter.js +0 -220
- package/dist/sdk/progress-reporter.js.map +0 -1
- package/dist/sdk/testing.d.ts +0 -427
- package/dist/sdk/testing.js +0 -725
- package/dist/sdk/testing.js.map +0 -1
- package/dist/sdk/tool-registry.d.ts +0 -194
- package/dist/sdk/tool-registry.js +0 -326
- package/dist/sdk/tool-registry.js.map +0 -1
- package/dist/sdk/types.d.ts +0 -53
- package/dist/sdk/types.js +0 -8
- package/dist/sdk/types.js.map +0 -1
- package/dist/sdk/unified-logger.d.ts +0 -173
- package/dist/sdk/unified-logger.js +0 -327
- package/dist/sdk/unified-logger.js.map +0 -1
- package/dist/sdk/version.d.ts +0 -163
- package/dist/sdk/version.js +0 -205
- package/dist/sdk/version.js.map +0 -1
- package/dist/tools/ask-user.d.ts +0 -126
- package/dist/tools/ask-user.js +0 -290
- package/dist/tools/ask-user.js.map +0 -1
- package/dist/tools/ax-agent.d.ts +0 -71
- package/dist/tools/ax-agent.js +0 -283
- package/dist/tools/ax-agent.js.map +0 -1
- package/dist/tools/bash-output.d.ts +0 -25
- package/dist/tools/bash-output.js +0 -146
- package/dist/tools/bash-output.js.map +0 -1
- package/dist/tools/bash.d.ts +0 -67
- package/dist/tools/bash.js +0 -522
- package/dist/tools/bash.js.map +0 -1
- package/dist/tools/confirmation-tool.d.ts +0 -16
- package/dist/tools/confirmation-tool.js +0 -76
- package/dist/tools/confirmation-tool.js.map +0 -1
- package/dist/tools/definitions/ask-user.d.ts +0 -8
- package/dist/tools/definitions/ask-user.js +0 -168
- package/dist/tools/definitions/ask-user.js.map +0 -1
- package/dist/tools/definitions/ax-agent.d.ts +0 -8
- package/dist/tools/definitions/ax-agent.js +0 -276
- package/dist/tools/definitions/ax-agent.js.map +0 -1
- package/dist/tools/definitions/bash-output.d.ts +0 -7
- package/dist/tools/definitions/bash-output.js +0 -78
- package/dist/tools/definitions/bash-output.js.map +0 -1
- package/dist/tools/definitions/bash.d.ts +0 -8
- package/dist/tools/definitions/bash.js +0 -152
- package/dist/tools/definitions/bash.js.map +0 -1
- package/dist/tools/definitions/create-file.d.ts +0 -7
- package/dist/tools/definitions/create-file.js +0 -129
- package/dist/tools/definitions/create-file.js.map +0 -1
- package/dist/tools/definitions/design.d.ts +0 -12
- package/dist/tools/definitions/design.js +0 -368
- package/dist/tools/definitions/design.js.map +0 -1
- package/dist/tools/definitions/index.d.ts +0 -49
- package/dist/tools/definitions/index.js +0 -87
- package/dist/tools/definitions/index.js.map +0 -1
- package/dist/tools/definitions/multi-edit.d.ts +0 -7
- package/dist/tools/definitions/multi-edit.js +0 -123
- package/dist/tools/definitions/multi-edit.js.map +0 -1
- package/dist/tools/definitions/search.d.ts +0 -7
- package/dist/tools/definitions/search.js +0 -159
- package/dist/tools/definitions/search.js.map +0 -1
- package/dist/tools/definitions/str-replace-editor.d.ts +0 -7
- package/dist/tools/definitions/str-replace-editor.js +0 -145
- package/dist/tools/definitions/str-replace-editor.js.map +0 -1
- package/dist/tools/definitions/todo.d.ts +0 -8
- package/dist/tools/definitions/todo.js +0 -261
- package/dist/tools/definitions/todo.js.map +0 -1
- package/dist/tools/definitions/view-file.d.ts +0 -7
- package/dist/tools/definitions/view-file.js +0 -111
- package/dist/tools/definitions/view-file.js.map +0 -1
- package/dist/tools/design-tool.d.ts +0 -68
- package/dist/tools/design-tool.js +0 -299
- package/dist/tools/design-tool.js.map +0 -1
- package/dist/tools/format-generators.d.ts +0 -62
- package/dist/tools/format-generators.js +0 -291
- package/dist/tools/format-generators.js.map +0 -1
- package/dist/tools/index.d.ts +0 -8
- package/dist/tools/index.js +0 -11
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/priority-registry.d.ts +0 -124
- package/dist/tools/priority-registry.js +0 -401
- package/dist/tools/priority-registry.js.map +0 -1
- package/dist/tools/priority.d.ts +0 -158
- package/dist/tools/priority.js +0 -350
- package/dist/tools/priority.js.map +0 -1
- package/dist/tools/registry.d.ts +0 -146
- package/dist/tools/registry.js +0 -171
- package/dist/tools/registry.js.map +0 -1
- package/dist/tools/search.d.ts +0 -85
- package/dist/tools/search.js +0 -430
- package/dist/tools/search.js.map +0 -1
- package/dist/tools/text-editor.d.ts +0 -87
- package/dist/tools/text-editor.js +0 -1369
- package/dist/tools/text-editor.js.map +0 -1
- package/dist/tools/todo-tool.d.ts +0 -20
- package/dist/tools/todo-tool.js +0 -186
- package/dist/tools/todo-tool.js.map +0 -1
- package/dist/tools/types.d.ts +0 -175
- package/dist/tools/types.js +0 -11
- package/dist/tools/types.js.map +0 -1
- package/dist/types/index.d.ts +0 -30
- package/dist/types/index.js +0 -2
- package/dist/types/index.js.map +0 -1
- package/dist/types/project-analysis.d.ts +0 -84
- package/dist/types/project-analysis.js +0 -5
- package/dist/types/project-analysis.js.map +0 -1
- package/dist/types/template.d.ts +0 -53
- package/dist/types/template.js +0 -5
- package/dist/types/template.js.map +0 -1
- package/dist/ui/app.d.ts +0 -7
- package/dist/ui/app.js +0 -102
- package/dist/ui/app.js.map +0 -1
- package/dist/ui/components/api-key-input.d.ts +0 -7
- package/dist/ui/components/api-key-input.js +0 -92
- package/dist/ui/components/api-key-input.js.map +0 -1
- package/dist/ui/components/chat-history.d.ts +0 -12
- package/dist/ui/components/chat-history.js +0 -391
- package/dist/ui/components/chat-history.js.map +0 -1
- package/dist/ui/components/chat-input.d.ts +0 -13
- package/dist/ui/components/chat-input.js +0 -179
- package/dist/ui/components/chat-input.js.map +0 -1
- package/dist/ui/components/chat-interface.d.ts +0 -11
- package/dist/ui/components/chat-interface.js +0 -830
- package/dist/ui/components/chat-interface.js.map +0 -1
- package/dist/ui/components/collapsible-tool-result.d.ts +0 -42
- package/dist/ui/components/collapsible-tool-result.js +0 -216
- package/dist/ui/components/collapsible-tool-result.js.map +0 -1
- package/dist/ui/components/command-suggestions.d.ts +0 -29
- package/dist/ui/components/command-suggestions.js +0 -88
- package/dist/ui/components/command-suggestions.js.map +0 -1
- package/dist/ui/components/confirmation-dialog.d.ts +0 -11
- package/dist/ui/components/confirmation-dialog.js +0 -100
- package/dist/ui/components/confirmation-dialog.js.map +0 -1
- package/dist/ui/components/context-breakdown.d.ts +0 -23
- package/dist/ui/components/context-breakdown.js +0 -124
- package/dist/ui/components/context-breakdown.js.map +0 -1
- package/dist/ui/components/diff-renderer.d.ts +0 -13
- package/dist/ui/components/diff-renderer.js +0 -192
- package/dist/ui/components/diff-renderer.js.map +0 -1
- package/dist/ui/components/index.d.ts +0 -18
- package/dist/ui/components/index.js +0 -20
- package/dist/ui/components/index.js.map +0 -1
- package/dist/ui/components/keyboard-help.d.ts +0 -17
- package/dist/ui/components/keyboard-help.js +0 -122
- package/dist/ui/components/keyboard-help.js.map +0 -1
- package/dist/ui/components/keyboard-hints.d.ts +0 -35
- package/dist/ui/components/keyboard-hints.js +0 -142
- package/dist/ui/components/keyboard-hints.js.map +0 -1
- package/dist/ui/components/loading-spinner.d.ts +0 -9
- package/dist/ui/components/loading-spinner.js +0 -120
- package/dist/ui/components/loading-spinner.js.map +0 -1
- package/dist/ui/components/mcp-dashboard.d.ts +0 -15
- package/dist/ui/components/mcp-dashboard.js +0 -520
- package/dist/ui/components/mcp-dashboard.js.map +0 -1
- package/dist/ui/components/mcp-status.d.ts +0 -5
- package/dist/ui/components/mcp-status.js +0 -58
- package/dist/ui/components/mcp-status.js.map +0 -1
- package/dist/ui/components/model-selection.d.ts +0 -12
- package/dist/ui/components/model-selection.js +0 -17
- package/dist/ui/components/model-selection.js.map +0 -1
- package/dist/ui/components/phase-progress.d.ts +0 -21
- package/dist/ui/components/phase-progress.js +0 -185
- package/dist/ui/components/phase-progress.js.map +0 -1
- package/dist/ui/components/question-dialog.d.ts +0 -17
- package/dist/ui/components/question-dialog.js +0 -181
- package/dist/ui/components/question-dialog.js.map +0 -1
- package/dist/ui/components/quick-actions.d.ts +0 -12
- package/dist/ui/components/quick-actions.js +0 -171
- package/dist/ui/components/quick-actions.js.map +0 -1
- package/dist/ui/components/reasoning-display.d.ts +0 -36
- package/dist/ui/components/reasoning-display.js +0 -46
- package/dist/ui/components/reasoning-display.js.map +0 -1
- package/dist/ui/components/status-bar.d.ts +0 -47
- package/dist/ui/components/status-bar.js +0 -310
- package/dist/ui/components/status-bar.js.map +0 -1
- package/dist/ui/components/subagent-monitor.d.ts +0 -41
- package/dist/ui/components/subagent-monitor.js +0 -122
- package/dist/ui/components/subagent-monitor.js.map +0 -1
- package/dist/ui/components/toast-notification.d.ts +0 -197
- package/dist/ui/components/toast-notification.js +0 -190
- package/dist/ui/components/toast-notification.js.map +0 -1
- package/dist/ui/components/tool-group-display.d.ts +0 -19
- package/dist/ui/components/tool-group-display.js +0 -222
- package/dist/ui/components/tool-group-display.js.map +0 -1
- package/dist/ui/components/virtualized-chat-history.d.ts +0 -33
- package/dist/ui/components/virtualized-chat-history.js +0 -182
- package/dist/ui/components/virtualized-chat-history.js.map +0 -1
- package/dist/ui/components/welcome-panel.d.ts +0 -11
- package/dist/ui/components/welcome-panel.js +0 -225
- package/dist/ui/components/welcome-panel.js.map +0 -1
- package/dist/ui/hooks/use-chat-reducer.d.ts +0 -69
- package/dist/ui/hooks/use-chat-reducer.js +0 -118
- package/dist/ui/hooks/use-chat-reducer.js.map +0 -1
- package/dist/ui/hooks/use-enhanced-input.d.ts +0 -53
- package/dist/ui/hooks/use-enhanced-input.js +0 -1275
- package/dist/ui/hooks/use-enhanced-input.js.map +0 -1
- package/dist/ui/hooks/use-input-handler.d.ts +0 -79
- package/dist/ui/hooks/use-input-handler.js +0 -2251
- package/dist/ui/hooks/use-input-handler.js.map +0 -1
- package/dist/ui/hooks/use-input-history.d.ts +0 -9
- package/dist/ui/hooks/use-input-history.js +0 -168
- package/dist/ui/hooks/use-input-history.js.map +0 -1
- package/dist/ui/shared/max-sized-box.d.ts +0 -17
- package/dist/ui/shared/max-sized-box.js +0 -14
- package/dist/ui/shared/max-sized-box.js.map +0 -1
- package/dist/ui/themes/index.d.ts +0 -5
- package/dist/ui/themes/index.js +0 -5
- package/dist/ui/themes/index.js.map +0 -1
- package/dist/ui/themes/theme-registry.d.ts +0 -55
- package/dist/ui/themes/theme-registry.js +0 -202
- package/dist/ui/themes/theme-registry.js.map +0 -1
- package/dist/ui/utils/bracketed-paste-handler.d.ts +0 -97
- package/dist/ui/utils/bracketed-paste-handler.js +0 -322
- package/dist/ui/utils/bracketed-paste-handler.js.map +0 -1
- package/dist/ui/utils/change-summarizer.d.ts +0 -20
- package/dist/ui/utils/change-summarizer.js +0 -282
- package/dist/ui/utils/change-summarizer.js.map +0 -1
- package/dist/ui/utils/code-colorizer.d.ts +0 -9
- package/dist/ui/utils/code-colorizer.js +0 -13
- package/dist/ui/utils/code-colorizer.js.map +0 -1
- package/dist/ui/utils/colors.d.ts +0 -41
- package/dist/ui/utils/colors.js +0 -80
- package/dist/ui/utils/colors.js.map +0 -1
- package/dist/ui/utils/image-handler.d.ts +0 -29
- package/dist/ui/utils/image-handler.js +0 -129
- package/dist/ui/utils/image-handler.js.map +0 -1
- package/dist/ui/utils/markdown-renderer.d.ts +0 -4
- package/dist/ui/utils/markdown-renderer.js +0 -40
- package/dist/ui/utils/markdown-renderer.js.map +0 -1
- package/dist/ui/utils/semantic-action-detector.d.ts +0 -49
- package/dist/ui/utils/semantic-action-detector.js +0 -339
- package/dist/ui/utils/semantic-action-detector.js.map +0 -1
- package/dist/ui/utils/tool-grouper.d.ts +0 -94
- package/dist/ui/utils/tool-grouper.js +0 -618
- package/dist/ui/utils/tool-grouper.js.map +0 -1
- package/dist/utils/api-error.d.ts +0 -61
- package/dist/utils/api-error.js +0 -176
- package/dist/utils/api-error.js.map +0 -1
- package/dist/utils/audit-logger.d.ts +0 -206
- package/dist/utils/audit-logger.js +0 -286
- package/dist/utils/audit-logger.js.map +0 -1
- package/dist/utils/auto-accept-logger.d.ts +0 -175
- package/dist/utils/auto-accept-logger.js +0 -423
- package/dist/utils/auto-accept-logger.js.map +0 -1
- package/dist/utils/automatosx-detector.d.ts +0 -19
- package/dist/utils/automatosx-detector.js +0 -52
- package/dist/utils/automatosx-detector.js.map +0 -1
- package/dist/utils/background-task-manager.d.ts +0 -114
- package/dist/utils/background-task-manager.js +0 -470
- package/dist/utils/background-task-manager.js.map +0 -1
- package/dist/utils/cache.d.ts +0 -77
- package/dist/utils/cache.js +0 -180
- package/dist/utils/cache.js.map +0 -1
- package/dist/utils/command-security.d.ts +0 -85
- package/dist/utils/command-security.js +0 -210
- package/dist/utils/command-security.js.map +0 -1
- package/dist/utils/config-loader.d.ts +0 -190
- package/dist/utils/config-loader.js +0 -108
- package/dist/utils/config-loader.js.map +0 -1
- package/dist/utils/confirmation-service.d.ts +0 -51
- package/dist/utils/confirmation-service.js +0 -220
- package/dist/utils/confirmation-service.js.map +0 -1
- package/dist/utils/console-messenger.d.ts +0 -80
- package/dist/utils/console-messenger.js +0 -142
- package/dist/utils/console-messenger.js.map +0 -1
- package/dist/utils/custom-instructions.d.ts +0 -1
- package/dist/utils/custom-instructions.js +0 -24
- package/dist/utils/custom-instructions.js.map +0 -1
- package/dist/utils/encryption.d.ts +0 -86
- package/dist/utils/encryption.js +0 -236
- package/dist/utils/encryption.js.map +0 -1
- package/dist/utils/enhanced-error-messages.d.ts +0 -33
- package/dist/utils/enhanced-error-messages.js +0 -440
- package/dist/utils/enhanced-error-messages.js.map +0 -1
- package/dist/utils/error-handler.d.ts +0 -65
- package/dist/utils/error-handler.js +0 -148
- package/dist/utils/error-handler.js.map +0 -1
- package/dist/utils/error-translator.d.ts +0 -25
- package/dist/utils/error-translator.js +0 -203
- package/dist/utils/error-translator.js.map +0 -1
- package/dist/utils/external-editor.d.ts +0 -47
- package/dist/utils/external-editor.js +0 -179
- package/dist/utils/external-editor.js.map +0 -1
- package/dist/utils/file-cache.d.ts +0 -148
- package/dist/utils/file-cache.js +0 -413
- package/dist/utils/file-cache.js.map +0 -1
- package/dist/utils/file-lock.d.ts +0 -141
- package/dist/utils/file-lock.js +0 -554
- package/dist/utils/file-lock.js.map +0 -1
- package/dist/utils/file-mentions.d.ts +0 -68
- package/dist/utils/file-mentions.js +0 -225
- package/dist/utils/file-mentions.js.map +0 -1
- package/dist/utils/history-manager.d.ts +0 -52
- package/dist/utils/history-manager.js +0 -211
- package/dist/utils/history-manager.js.map +0 -1
- package/dist/utils/history-migration.d.ts +0 -9
- package/dist/utils/history-migration.js +0 -37
- package/dist/utils/history-migration.js.map +0 -1
- package/dist/utils/image-processor.d.ts +0 -33
- package/dist/utils/image-processor.js +0 -124
- package/dist/utils/image-processor.js.map +0 -1
- package/dist/utils/index.d.ts +0 -92
- package/dist/utils/index.js +0 -111
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/init-previewer.d.ts +0 -56
- package/dist/utils/init-previewer.js +0 -239
- package/dist/utils/init-previewer.js.map +0 -1
- package/dist/utils/init-validator.d.ts +0 -65
- package/dist/utils/init-validator.js +0 -252
- package/dist/utils/init-validator.js.map +0 -1
- package/dist/utils/input-sanitizer.d.ts +0 -210
- package/dist/utils/input-sanitizer.js +0 -362
- package/dist/utils/input-sanitizer.js.map +0 -1
- package/dist/utils/instruction-generator.d.ts +0 -21
- package/dist/utils/instruction-generator.js +0 -233
- package/dist/utils/instruction-generator.js.map +0 -1
- package/dist/utils/json-utils.d.ts +0 -72
- package/dist/utils/json-utils.js +0 -226
- package/dist/utils/json-utils.js.map +0 -1
- package/dist/utils/llm-optimized-instruction-generator.d.ts +0 -36
- package/dist/utils/llm-optimized-instruction-generator.js +0 -365
- package/dist/utils/llm-optimized-instruction-generator.js.map +0 -1
- package/dist/utils/message-optimizer.d.ts +0 -100
- package/dist/utils/message-optimizer.js +0 -297
- package/dist/utils/message-optimizer.js.map +0 -1
- package/dist/utils/onboarding-manager.d.ts +0 -45
- package/dist/utils/onboarding-manager.js +0 -131
- package/dist/utils/onboarding-manager.js.map +0 -1
- package/dist/utils/parallel-analyzer.d.ts +0 -123
- package/dist/utils/parallel-analyzer.js +0 -241
- package/dist/utils/parallel-analyzer.js.map +0 -1
- package/dist/utils/paste-utils.d.ts +0 -99
- package/dist/utils/paste-utils.js +0 -295
- package/dist/utils/paste-utils.js.map +0 -1
- package/dist/utils/path-helpers.d.ts +0 -8
- package/dist/utils/path-helpers.js +0 -35
- package/dist/utils/path-helpers.js.map +0 -1
- package/dist/utils/path-security.d.ts +0 -92
- package/dist/utils/path-security.js +0 -300
- package/dist/utils/path-security.js.map +0 -1
- package/dist/utils/path-utils.d.ts +0 -83
- package/dist/utils/path-utils.js +0 -122
- package/dist/utils/path-utils.js.map +0 -1
- package/dist/utils/path-validator.d.ts +0 -66
- package/dist/utils/path-validator.js +0 -141
- package/dist/utils/path-validator.js.map +0 -1
- package/dist/utils/performance.d.ts +0 -74
- package/dist/utils/performance.js +0 -133
- package/dist/utils/performance.js.map +0 -1
- package/dist/utils/process-pool.d.ts +0 -109
- package/dist/utils/process-pool.js +0 -332
- package/dist/utils/process-pool.js.map +0 -1
- package/dist/utils/progress-tracker.d.ts +0 -51
- package/dist/utils/progress-tracker.js +0 -152
- package/dist/utils/progress-tracker.js.map +0 -1
- package/dist/utils/project-analyzer.d.ts +0 -49
- package/dist/utils/project-analyzer.js +0 -396
- package/dist/utils/project-analyzer.js.map +0 -1
- package/dist/utils/prompt-builder.d.ts +0 -14
- package/dist/utils/prompt-builder.js +0 -100
- package/dist/utils/prompt-builder.js.map +0 -1
- package/dist/utils/provider-context.d.ts +0 -243
- package/dist/utils/provider-context.js +0 -421
- package/dist/utils/provider-context.js.map +0 -1
- package/dist/utils/provider-file-cache.d.ts +0 -91
- package/dist/utils/provider-file-cache.js +0 -165
- package/dist/utils/provider-file-cache.js.map +0 -1
- package/dist/utils/provider-settings.d.ts +0 -181
- package/dist/utils/provider-settings.js +0 -450
- package/dist/utils/provider-settings.js.map +0 -1
- package/dist/utils/rate-limiter.d.ts +0 -222
- package/dist/utils/rate-limiter.js +0 -338
- package/dist/utils/rate-limiter.js.map +0 -1
- package/dist/utils/retry-helper.d.ts +0 -81
- package/dist/utils/retry-helper.js +0 -244
- package/dist/utils/retry-helper.js.map +0 -1
- package/dist/utils/safety-rules.d.ts +0 -64
- package/dist/utils/safety-rules.js +0 -225
- package/dist/utils/safety-rules.js.map +0 -1
- package/dist/utils/settings-manager.d.ts +0 -256
- package/dist/utils/settings-manager.js +0 -967
- package/dist/utils/settings-manager.js.map +0 -1
- package/dist/utils/setup-validator.d.ts +0 -47
- package/dist/utils/setup-validator.js +0 -304
- package/dist/utils/setup-validator.js.map +0 -1
- package/dist/utils/string-utils.d.ts +0 -19
- package/dist/utils/string-utils.js +0 -28
- package/dist/utils/string-utils.js.map +0 -1
- package/dist/utils/template-manager.d.ts +0 -62
- package/dist/utils/template-manager.js +0 -366
- package/dist/utils/template-manager.js.map +0 -1
- package/dist/utils/text-utils.d.ts +0 -82
- package/dist/utils/text-utils.js +0 -203
- package/dist/utils/text-utils.js.map +0 -1
- package/dist/utils/token-counter.d.ts +0 -76
- package/dist/utils/token-counter.js +0 -231
- package/dist/utils/token-counter.js.map +0 -1
- package/dist/utils/usage-tracker.d.ts +0 -78
- package/dist/utils/usage-tracker.js +0 -126
- package/dist/utils/usage-tracker.js.map +0 -1
- package/dist/utils/version.d.ts +0 -14
- package/dist/utils/version.js +0 -70
- package/dist/utils/version.js.map +0 -1
|
@@ -1,830 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect, useRef, useMemo, useCallback } from "react";
|
|
2
|
-
import { Box } from "ink";
|
|
3
|
-
import { useInputHandler } from "../hooks/use-input-handler.js";
|
|
4
|
-
import { LoadingSpinner } from "./loading-spinner.js";
|
|
5
|
-
import { CommandSuggestions } from "./command-suggestions.js";
|
|
6
|
-
import { ChatHistory } from "./chat-history.js";
|
|
7
|
-
import { ChatInput } from "./chat-input.js";
|
|
8
|
-
import { StatusBar } from "./status-bar.js";
|
|
9
|
-
import { QuickActions } from "./quick-actions.js";
|
|
10
|
-
import { WelcomePanel } from "./welcome-panel.js";
|
|
11
|
-
import ConfirmationDialog from "./confirmation-dialog.js";
|
|
12
|
-
import QuestionDialog from "./question-dialog.js";
|
|
13
|
-
import { KeyboardHelp } from "./keyboard-help.js";
|
|
14
|
-
import { ContextBreakdown } from "./context-breakdown.js";
|
|
15
|
-
import { MCPDashboard } from "./mcp-dashboard.js";
|
|
16
|
-
import { ToastContainer, useToasts, TOAST_MESSAGES } from "./toast-notification.js";
|
|
17
|
-
import { ConfirmationService, } from "../../utils/confirmation-service.js";
|
|
18
|
-
import { getAskUserService, } from "../../tools/ask-user.js";
|
|
19
|
-
import ApiKeyInput from "./api-key-input.js";
|
|
20
|
-
import { getVersion } from "../../utils/version.js";
|
|
21
|
-
import { getHistoryManager } from "../../utils/history-manager.js";
|
|
22
|
-
import { getMcpConnectionCount } from "../../llm/tools.js";
|
|
23
|
-
import { BackgroundTaskManager } from "../../utils/background-task-manager.js";
|
|
24
|
-
import { isAutomatosXAvailable } from "../../utils/automatosx-detector.js";
|
|
25
|
-
import { routeToAgent } from "../../agent/agent-router.js";
|
|
26
|
-
import { PhaseProgress } from "./phase-progress.js";
|
|
27
|
-
import { GLM_MODELS } from "../../constants.js";
|
|
28
|
-
import { getSettingsManager } from "../../utils/settings-manager.js";
|
|
29
|
-
import clipboardy from "clipboardy";
|
|
30
|
-
import path from "path";
|
|
31
|
-
// Get current project folder name
|
|
32
|
-
function getCurrentProjectName() {
|
|
33
|
-
return path.basename(process.cwd());
|
|
34
|
-
}
|
|
35
|
-
function calculateContextBreakdown(totalTokens) {
|
|
36
|
-
// Guard against division by zero
|
|
37
|
-
if (totalTokens <= 0) {
|
|
38
|
-
return [
|
|
39
|
-
{ label: "System Instructions", tokens: 0, percentage: 0, color: "blue" },
|
|
40
|
-
{ label: "CLAUDE.md", tokens: 0, percentage: 0, color: "magenta" },
|
|
41
|
-
{ label: "Conversation History", tokens: 0, percentage: 0, color: "cyan" },
|
|
42
|
-
{ label: "Tool Definitions", tokens: 0, percentage: 0, color: "yellow" },
|
|
43
|
-
];
|
|
44
|
-
}
|
|
45
|
-
// Estimates based on typical usage patterns
|
|
46
|
-
const systemInstructions = Math.floor(totalTokens * 0.15);
|
|
47
|
-
const claudeMd = Math.floor(totalTokens * 0.05);
|
|
48
|
-
const toolDefinitions = Math.floor(totalTokens * 0.05);
|
|
49
|
-
const conversationHistory = totalTokens - systemInstructions - claudeMd - toolDefinitions;
|
|
50
|
-
return [
|
|
51
|
-
{
|
|
52
|
-
label: "System Instructions",
|
|
53
|
-
tokens: systemInstructions,
|
|
54
|
-
percentage: (systemInstructions / totalTokens) * 100,
|
|
55
|
-
color: "blue",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
label: "CLAUDE.md",
|
|
59
|
-
tokens: claudeMd,
|
|
60
|
-
percentage: (claudeMd / totalTokens) * 100,
|
|
61
|
-
color: "magenta",
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: "Conversation History",
|
|
65
|
-
tokens: conversationHistory,
|
|
66
|
-
percentage: (conversationHistory / totalTokens) * 100,
|
|
67
|
-
color: "cyan",
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
label: "Tool Definitions",
|
|
71
|
-
tokens: toolDefinitions,
|
|
72
|
-
percentage: (toolDefinitions / totalTokens) * 100,
|
|
73
|
-
color: "yellow",
|
|
74
|
-
},
|
|
75
|
-
];
|
|
76
|
-
}
|
|
77
|
-
// Main chat component that handles input when agent is available
|
|
78
|
-
function ChatInterfaceWithAgent({ agent, initialMessage, loadPreviousHistory = false, agentFirstDisabled = false, forcedAgent, }) {
|
|
79
|
-
// Memoize history manager to avoid unnecessary function calls on every render
|
|
80
|
-
const historyManager = useMemo(() => getHistoryManager(), []);
|
|
81
|
-
const [chatHistory, setChatHistory] = useState(() => {
|
|
82
|
-
// Load saved history on mount (for --continue flag)
|
|
83
|
-
return loadPreviousHistory ? historyManager.loadHistory() : [];
|
|
84
|
-
});
|
|
85
|
-
// Command history (up/down arrows) is handled separately in use-input-history.ts
|
|
86
|
-
const [isProcessing, setIsProcessing] = useState(false);
|
|
87
|
-
const [processingTime, setProcessingTime] = useState(0);
|
|
88
|
-
const [tokenCount, setTokenCount] = useState(0);
|
|
89
|
-
const [isStreaming, setIsStreaming] = useState(false);
|
|
90
|
-
const [contextPercentage, setContextPercentage] = useState(0);
|
|
91
|
-
const [showAutoPrune, setShowAutoPrune] = useState(false);
|
|
92
|
-
const [confirmationOptions, setConfirmationOptions] = useState(null);
|
|
93
|
-
const [questionRequest, setQuestionRequest] = useState(null);
|
|
94
|
-
const [showQuickActions, setShowQuickActions] = useState(false);
|
|
95
|
-
const [showKeyboardHelp, setShowKeyboardHelp] = useState(false);
|
|
96
|
-
const [showContextBreakdown, setShowContextBreakdown] = useState(false);
|
|
97
|
-
const [showMcpDashboard, setShowMcpDashboard] = useState(false);
|
|
98
|
-
// Flash states for mode toggle visual feedback
|
|
99
|
-
const [flashAutoEdit, setFlashAutoEdit] = useState(false);
|
|
100
|
-
const [flashVerbose, setFlashVerbose] = useState(false);
|
|
101
|
-
const [flashBackground, setFlashBackground] = useState(false);
|
|
102
|
-
const [flashThinkingMode, setFlashThinkingMode] = useState(false);
|
|
103
|
-
const [isThinking, setIsThinking] = useState(false);
|
|
104
|
-
const [axEnabled, setAxEnabled] = useState(false);
|
|
105
|
-
const [activeAgent, setActiveAgent] = useState(forcedAgent || null);
|
|
106
|
-
const [activeAgents, setActiveAgents] = useState([]);
|
|
107
|
-
const [currentPlan, setCurrentPlan] = useState(null);
|
|
108
|
-
// BUG FIX: Removed unused scrollRef - Ink Box doesn't support DOM scroll APIs
|
|
109
|
-
const processingStartTime = useRef(0);
|
|
110
|
-
const lastPercentageRef = useRef(0); // Store last percentage value
|
|
111
|
-
const lastPercentageUpdateTime = useRef(0); // Store last update timestamp
|
|
112
|
-
const contextLowWarningShown = useRef(false); // Track if low context warning was shown
|
|
113
|
-
const flashTimersRef = useRef([]); // Track flash timers for cleanup
|
|
114
|
-
const chatHistoryRef = useRef(chatHistory); // Track current chat history
|
|
115
|
-
// Toast notification system
|
|
116
|
-
const { toasts, removeToast, addToast } = useToasts();
|
|
117
|
-
const confirmationService = ConfirmationService.getInstance();
|
|
118
|
-
const projectName = getCurrentProjectName();
|
|
119
|
-
const version = getVersion();
|
|
120
|
-
// Check AutomatosX availability on mount
|
|
121
|
-
useEffect(() => {
|
|
122
|
-
const checkAx = async () => {
|
|
123
|
-
const available = await isAutomatosXAvailable();
|
|
124
|
-
setAxEnabled(available);
|
|
125
|
-
};
|
|
126
|
-
void checkAx();
|
|
127
|
-
}, []);
|
|
128
|
-
// Flash effect helper - triggers a brief highlight then clears
|
|
129
|
-
const triggerFlash = useCallback((setter) => {
|
|
130
|
-
setter(true);
|
|
131
|
-
const timeoutId = setTimeout(() => {
|
|
132
|
-
setter(false);
|
|
133
|
-
// Remove completed timer from array to prevent unbounded growth
|
|
134
|
-
const idx = flashTimersRef.current.indexOf(timeoutId);
|
|
135
|
-
if (idx !== -1)
|
|
136
|
-
flashTimersRef.current.splice(idx, 1);
|
|
137
|
-
}, 300);
|
|
138
|
-
flashTimersRef.current.push(timeoutId);
|
|
139
|
-
}, []);
|
|
140
|
-
// Cleanup flash timers on unmount to prevent memory leaks
|
|
141
|
-
useEffect(() => {
|
|
142
|
-
return () => {
|
|
143
|
-
flashTimersRef.current.forEach(timer => clearTimeout(timer));
|
|
144
|
-
flashTimersRef.current = [];
|
|
145
|
-
};
|
|
146
|
-
}, []);
|
|
147
|
-
// NEW: Listen for plan events from agent for real-time phase progress tracking
|
|
148
|
-
useEffect(() => {
|
|
149
|
-
// BUG FIX: Track plan timeouts for cleanup to prevent setState on unmounted component
|
|
150
|
-
const planTimers = [];
|
|
151
|
-
const handlePlanCreated = (data) => {
|
|
152
|
-
setCurrentPlan(data.plan);
|
|
153
|
-
};
|
|
154
|
-
const handlePlanCompleted = () => {
|
|
155
|
-
// Keep plan visible briefly after completion to show success
|
|
156
|
-
// BUG FIX: Track timer for cleanup
|
|
157
|
-
const timer = setTimeout(() => setCurrentPlan(null), 3000);
|
|
158
|
-
planTimers.push(timer);
|
|
159
|
-
};
|
|
160
|
-
const handlePlanFailed = () => {
|
|
161
|
-
// Keep plan visible longer to show failure state
|
|
162
|
-
// BUG FIX: Track timer for cleanup
|
|
163
|
-
const timer = setTimeout(() => setCurrentPlan(null), 5000);
|
|
164
|
-
planTimers.push(timer);
|
|
165
|
-
};
|
|
166
|
-
const handlePhaseStarted = (data) => {
|
|
167
|
-
// Update current phase index for visual progress
|
|
168
|
-
setCurrentPlan((prevPlan) => {
|
|
169
|
-
if (!prevPlan || prevPlan.id !== data.planId)
|
|
170
|
-
return prevPlan;
|
|
171
|
-
return {
|
|
172
|
-
...prevPlan,
|
|
173
|
-
currentPhaseIndex: data.phase.index,
|
|
174
|
-
phases: prevPlan.phases.map(p => p.id === data.phase.id ? { ...p, status: data.phase.status } : p),
|
|
175
|
-
};
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
const handlePhaseCompleted = (data) => {
|
|
179
|
-
// Update phase status and duration
|
|
180
|
-
setCurrentPlan((prevPlan) => {
|
|
181
|
-
if (!prevPlan || prevPlan.id !== data.planId)
|
|
182
|
-
return prevPlan;
|
|
183
|
-
return {
|
|
184
|
-
...prevPlan,
|
|
185
|
-
phasesCompleted: prevPlan.phasesCompleted + 1,
|
|
186
|
-
phases: prevPlan.phases.map(p => p.id === data.phase.id
|
|
187
|
-
? { ...p, status: data.phase.status, duration: data.phase.duration }
|
|
188
|
-
: p),
|
|
189
|
-
};
|
|
190
|
-
});
|
|
191
|
-
};
|
|
192
|
-
const handlePhaseFailed = (data) => {
|
|
193
|
-
// Update phase status with error
|
|
194
|
-
setCurrentPlan((prevPlan) => {
|
|
195
|
-
if (!prevPlan || prevPlan.id !== data.planId)
|
|
196
|
-
return prevPlan;
|
|
197
|
-
return {
|
|
198
|
-
...prevPlan,
|
|
199
|
-
phasesFailed: prevPlan.phasesFailed + 1,
|
|
200
|
-
phases: prevPlan.phases.map(p => p.id === data.phase.id
|
|
201
|
-
? { ...p, status: data.phase.status, error: data.error }
|
|
202
|
-
: p),
|
|
203
|
-
};
|
|
204
|
-
});
|
|
205
|
-
};
|
|
206
|
-
// Subagent event handlers for tracking active agents
|
|
207
|
-
const handleSubagentSpawn = (data) => {
|
|
208
|
-
setActiveAgents((prev) => [...prev, data.role]);
|
|
209
|
-
};
|
|
210
|
-
const handleSubagentComplete = (data) => {
|
|
211
|
-
if (!data.role)
|
|
212
|
-
return;
|
|
213
|
-
// Remove first occurrence of completed agent's role
|
|
214
|
-
setActiveAgents((prev) => {
|
|
215
|
-
const idx = prev.indexOf(data.role);
|
|
216
|
-
return idx === -1 ? prev : prev.toSpliced(idx, 1);
|
|
217
|
-
});
|
|
218
|
-
};
|
|
219
|
-
const handleSubagentTerminate = () => {
|
|
220
|
-
setActiveAgents([]);
|
|
221
|
-
};
|
|
222
|
-
// ax_agent tool event handlers for status bar display
|
|
223
|
-
const handleAxAgentStart = (data) => {
|
|
224
|
-
setActiveAgents((prev) => [...prev, data.agent]);
|
|
225
|
-
};
|
|
226
|
-
const handleAxAgentEnd = (data) => {
|
|
227
|
-
setActiveAgents((prev) => {
|
|
228
|
-
const idx = prev.indexOf(data.agent);
|
|
229
|
-
return idx === -1 ? prev : prev.toSpliced(idx, 1);
|
|
230
|
-
});
|
|
231
|
-
};
|
|
232
|
-
// Register event listeners
|
|
233
|
-
agent.on('plan:created', handlePlanCreated);
|
|
234
|
-
agent.on('plan:completed', handlePlanCompleted);
|
|
235
|
-
agent.on('plan:failed', handlePlanFailed);
|
|
236
|
-
agent.on('phase:started', handlePhaseStarted);
|
|
237
|
-
agent.on('phase:completed', handlePhaseCompleted);
|
|
238
|
-
agent.on('phase:failed', handlePhaseFailed);
|
|
239
|
-
agent.on('subagent:spawn', handleSubagentSpawn);
|
|
240
|
-
agent.on('subagent:complete', handleSubagentComplete);
|
|
241
|
-
agent.on('subagent:terminate', handleSubagentTerminate);
|
|
242
|
-
agent.on('ax_agent:start', handleAxAgentStart);
|
|
243
|
-
agent.on('ax_agent:end', handleAxAgentEnd);
|
|
244
|
-
// Cleanup on unmount
|
|
245
|
-
return () => {
|
|
246
|
-
// BUG FIX: Clear all plan timers to prevent setState on unmounted component
|
|
247
|
-
planTimers.forEach(timer => clearTimeout(timer));
|
|
248
|
-
// Remove event listeners
|
|
249
|
-
agent.off('plan:created', handlePlanCreated);
|
|
250
|
-
agent.off('plan:completed', handlePlanCompleted);
|
|
251
|
-
agent.off('plan:failed', handlePlanFailed);
|
|
252
|
-
agent.off('phase:started', handlePhaseStarted);
|
|
253
|
-
agent.off('phase:completed', handlePhaseCompleted);
|
|
254
|
-
agent.off('phase:failed', handlePhaseFailed);
|
|
255
|
-
agent.off('subagent:spawn', handleSubagentSpawn);
|
|
256
|
-
agent.off('subagent:complete', handleSubagentComplete);
|
|
257
|
-
agent.off('subagent:terminate', handleSubagentTerminate);
|
|
258
|
-
agent.off('ax_agent:start', handleAxAgentStart);
|
|
259
|
-
agent.off('ax_agent:end', handleAxAgentEnd);
|
|
260
|
-
};
|
|
261
|
-
}, [agent]);
|
|
262
|
-
// Mode toggle handlers with toast feedback
|
|
263
|
-
const handleVerboseModeChange = useCallback((enabled) => {
|
|
264
|
-
triggerFlash(setFlashVerbose);
|
|
265
|
-
addToast(enabled ? TOAST_MESSAGES.verboseOn : TOAST_MESSAGES.verboseOff);
|
|
266
|
-
}, [triggerFlash, addToast]);
|
|
267
|
-
const handleBackgroundModeChange = useCallback((enabled) => {
|
|
268
|
-
triggerFlash(setFlashBackground);
|
|
269
|
-
addToast(enabled ? TOAST_MESSAGES.backgroundOn : TOAST_MESSAGES.backgroundOff);
|
|
270
|
-
}, [triggerFlash, addToast]);
|
|
271
|
-
const handleAutoEditModeChange = useCallback((enabled) => {
|
|
272
|
-
triggerFlash(setFlashAutoEdit);
|
|
273
|
-
addToast(enabled ? TOAST_MESSAGES.autoEditOn : TOAST_MESSAGES.autoEditOff);
|
|
274
|
-
}, [triggerFlash, addToast]);
|
|
275
|
-
// Thinking mode toggle handler
|
|
276
|
-
const handleThinkingModeChange = useCallback((enabled) => {
|
|
277
|
-
triggerFlash(setFlashThinkingMode);
|
|
278
|
-
addToast(enabled ? TOAST_MESSAGES.thinkingOn : TOAST_MESSAGES.thinkingOff);
|
|
279
|
-
}, [triggerFlash, addToast]);
|
|
280
|
-
const handleEditorOpening = useCallback((editorName) => {
|
|
281
|
-
addToast(TOAST_MESSAGES.editorOpening(editorName));
|
|
282
|
-
}, [addToast]);
|
|
283
|
-
const handleEditorSuccess = useCallback(() => {
|
|
284
|
-
addToast(TOAST_MESSAGES.editorSuccess);
|
|
285
|
-
}, [addToast]);
|
|
286
|
-
const handleEditorCancelled = useCallback(() => {
|
|
287
|
-
addToast(TOAST_MESSAGES.editorCancelled);
|
|
288
|
-
}, [addToast]);
|
|
289
|
-
const handleEditorError = useCallback((error) => {
|
|
290
|
-
addToast(TOAST_MESSAGES.editorError(error));
|
|
291
|
-
}, [addToast]);
|
|
292
|
-
const handleTaskMovedToBackground = useCallback((taskId) => {
|
|
293
|
-
addToast(TOAST_MESSAGES.taskMoved(taskId));
|
|
294
|
-
}, [addToast]);
|
|
295
|
-
const handleOperationInterrupted = useCallback(() => {
|
|
296
|
-
addToast(TOAST_MESSAGES.interrupted);
|
|
297
|
-
}, [addToast]);
|
|
298
|
-
const handleChatCleared = useCallback(() => {
|
|
299
|
-
addToast(TOAST_MESSAGES.cleared);
|
|
300
|
-
}, [addToast]);
|
|
301
|
-
const handleLargePaste = useCallback((charCount) => {
|
|
302
|
-
// Only show warning toast if not truncating (allowLargePaste = true)
|
|
303
|
-
// Otherwise the truncation toast will be more informative
|
|
304
|
-
addToast(TOAST_MESSAGES.pasteTruncationDisabled(charCount));
|
|
305
|
-
}, [addToast]);
|
|
306
|
-
const handlePasteTruncated = useCallback((originalLength, truncatedLength) => {
|
|
307
|
-
addToast(TOAST_MESSAGES.pasteTruncated(originalLength, truncatedLength));
|
|
308
|
-
}, [addToast]);
|
|
309
|
-
// Keep chatHistoryRef in sync
|
|
310
|
-
useEffect(() => {
|
|
311
|
-
chatHistoryRef.current = chatHistory;
|
|
312
|
-
}, [chatHistory]);
|
|
313
|
-
const handleCopyLastResponse = useCallback(() => {
|
|
314
|
-
// Use ref to get current chatHistory without causing callback re-creation
|
|
315
|
-
// This prevents unnecessary re-renders when chatHistory changes
|
|
316
|
-
const lastAssistantEntry = [...chatHistoryRef.current].reverse().find(entry => entry.type === "assistant");
|
|
317
|
-
if (lastAssistantEntry && lastAssistantEntry.content) {
|
|
318
|
-
try {
|
|
319
|
-
clipboardy.writeSync(lastAssistantEntry.content);
|
|
320
|
-
addToast(TOAST_MESSAGES.copied);
|
|
321
|
-
}
|
|
322
|
-
catch {
|
|
323
|
-
addToast({ message: "Failed to copy to clipboard", type: "error", icon: "❌" });
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
else {
|
|
327
|
-
addToast({ message: "No response to copy", type: "info", icon: "ℹ" });
|
|
328
|
-
}
|
|
329
|
-
}, [addToast]);
|
|
330
|
-
const handleMemoryWarmed = useCallback((tokens) => {
|
|
331
|
-
addToast(TOAST_MESSAGES.memoryWarmed(tokens));
|
|
332
|
-
}, [addToast]);
|
|
333
|
-
const handleMemoryRefreshed = useCallback(() => {
|
|
334
|
-
addToast(TOAST_MESSAGES.memoryRefreshed);
|
|
335
|
-
}, [addToast]);
|
|
336
|
-
const handleCheckpointCreated = useCallback(() => {
|
|
337
|
-
addToast(TOAST_MESSAGES.checkpointCreated);
|
|
338
|
-
}, [addToast]);
|
|
339
|
-
const handleCheckpointRestored = useCallback(() => {
|
|
340
|
-
addToast(TOAST_MESSAGES.checkpointRestored);
|
|
341
|
-
}, [addToast]);
|
|
342
|
-
const { input, cursorPosition, showCommandSuggestions, selectedCommandIndex, commandSuggestions, resourceSuggestions, suggestionMode, autoEditEnabled, verboseMode, verbosityLevel, backgroundMode, thinkingModeEnabled, pastedBlocks, currentBlockAtCursor, isPasting, toggleVerbosity, toggleAutoEdit, toggleThinkingMode, toggleBackgroundMode, } = useInputHandler({
|
|
343
|
-
agent,
|
|
344
|
-
chatHistory,
|
|
345
|
-
setChatHistory,
|
|
346
|
-
setIsProcessing,
|
|
347
|
-
setIsStreaming,
|
|
348
|
-
setTokenCount,
|
|
349
|
-
setProcessingTime,
|
|
350
|
-
processingStartTime,
|
|
351
|
-
isProcessing,
|
|
352
|
-
isStreaming,
|
|
353
|
-
isConfirmationActive: !!confirmationOptions || !!questionRequest || showMcpDashboard,
|
|
354
|
-
onQuickActionsToggle: () => setShowQuickActions((prev) => !prev),
|
|
355
|
-
onVerboseModeChange: handleVerboseModeChange,
|
|
356
|
-
onBackgroundModeChange: handleBackgroundModeChange,
|
|
357
|
-
onAutoEditModeChange: handleAutoEditModeChange,
|
|
358
|
-
onThinkingModeChange: handleThinkingModeChange,
|
|
359
|
-
onTaskMovedToBackground: handleTaskMovedToBackground,
|
|
360
|
-
onOperationInterrupted: handleOperationInterrupted,
|
|
361
|
-
onChatCleared: handleChatCleared,
|
|
362
|
-
onCopyLastResponse: handleCopyLastResponse,
|
|
363
|
-
onMemoryWarmed: handleMemoryWarmed,
|
|
364
|
-
onMemoryRefreshed: handleMemoryRefreshed,
|
|
365
|
-
onCheckpointCreated: handleCheckpointCreated,
|
|
366
|
-
onCheckpointRestored: handleCheckpointRestored,
|
|
367
|
-
onLargePaste: handleLargePaste,
|
|
368
|
-
onPasteTruncated: handlePasteTruncated,
|
|
369
|
-
onKeyboardHelp: () => setShowKeyboardHelp((prev) => !prev),
|
|
370
|
-
onMcpDashboardToggle: () => setShowMcpDashboard((prev) => !prev),
|
|
371
|
-
onEditorOpening: handleEditorOpening,
|
|
372
|
-
onEditorSuccess: handleEditorSuccess,
|
|
373
|
-
onEditorCancelled: handleEditorCancelled,
|
|
374
|
-
onEditorError: handleEditorError,
|
|
375
|
-
// Agent-First Mode props
|
|
376
|
-
agentFirstDisabled,
|
|
377
|
-
forcedAgent,
|
|
378
|
-
onAgentSelected: setActiveAgent,
|
|
379
|
-
});
|
|
380
|
-
useEffect(() => {
|
|
381
|
-
// Only clear console on non-Windows platforms or if not PowerShell
|
|
382
|
-
// Windows PowerShell can have issues with console.clear() causing flickering
|
|
383
|
-
const isWindows = process.platform === "win32";
|
|
384
|
-
const isPowerShell = process.env.ComSpec?.toLowerCase().includes("powershell") ||
|
|
385
|
-
process.env.PSModulePath !== undefined;
|
|
386
|
-
if (!isWindows || !isPowerShell) {
|
|
387
|
-
console.clear();
|
|
388
|
-
}
|
|
389
|
-
// Welcome text is now displayed in WelcomePanel component
|
|
390
|
-
// Don't clear history on mount since we loaded it from disk
|
|
391
|
-
}, []);
|
|
392
|
-
// Process initial message if provided (streaming for faster feedback)
|
|
393
|
-
useEffect(() => {
|
|
394
|
-
if (!initialMessage || !agent) {
|
|
395
|
-
return;
|
|
396
|
-
}
|
|
397
|
-
// Agent-First Mode: Set active agent for initial message
|
|
398
|
-
// Note: The actual agent execution happens in useInputHandler for subsequent messages
|
|
399
|
-
// For initial message, we just set the badge - execution goes through LLMAgent
|
|
400
|
-
if (forcedAgent) {
|
|
401
|
-
setActiveAgent(forcedAgent);
|
|
402
|
-
}
|
|
403
|
-
else if (!agentFirstDisabled) {
|
|
404
|
-
const settings = getSettingsManager();
|
|
405
|
-
const agentFirstSettings = settings.getAgentFirstSettings();
|
|
406
|
-
if (agentFirstSettings.enabled) {
|
|
407
|
-
const routerConfig = {
|
|
408
|
-
enabled: agentFirstSettings.enabled,
|
|
409
|
-
defaultAgent: agentFirstSettings.defaultAgent,
|
|
410
|
-
confidenceThreshold: agentFirstSettings.confidenceThreshold,
|
|
411
|
-
excludedAgents: agentFirstSettings.excludedAgents,
|
|
412
|
-
};
|
|
413
|
-
const routingResult = routeToAgent(initialMessage, routerConfig);
|
|
414
|
-
if (routingResult.agent) {
|
|
415
|
-
setActiveAgent(routingResult.agent);
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
const userEntry = {
|
|
420
|
-
type: "user",
|
|
421
|
-
content: initialMessage,
|
|
422
|
-
timestamp: new Date(),
|
|
423
|
-
};
|
|
424
|
-
setChatHistory([userEntry]);
|
|
425
|
-
let cancelled = false;
|
|
426
|
-
const processInitialMessage = async () => {
|
|
427
|
-
setIsProcessing(true);
|
|
428
|
-
setIsStreaming(true);
|
|
429
|
-
try {
|
|
430
|
-
let streamingEntry = null;
|
|
431
|
-
for await (const chunk of agent.processUserMessageStream(initialMessage)) {
|
|
432
|
-
if (cancelled)
|
|
433
|
-
break;
|
|
434
|
-
switch (chunk.type) {
|
|
435
|
-
case "reasoning":
|
|
436
|
-
// Handle reasoning content from GLM-4.6 thinking mode
|
|
437
|
-
if (chunk.reasoningContent) {
|
|
438
|
-
setIsThinking(true);
|
|
439
|
-
if (!streamingEntry) {
|
|
440
|
-
const newStreamingEntry = {
|
|
441
|
-
type: "assistant",
|
|
442
|
-
content: "",
|
|
443
|
-
timestamp: new Date(),
|
|
444
|
-
isStreaming: true,
|
|
445
|
-
reasoningContent: chunk.reasoningContent,
|
|
446
|
-
isReasoningStreaming: true,
|
|
447
|
-
};
|
|
448
|
-
setChatHistory((prev) => [...prev, newStreamingEntry]);
|
|
449
|
-
streamingEntry = newStreamingEntry;
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
setChatHistory((prev) => prev.map((entry, idx) => idx === prev.length - 1 && entry.isStreaming
|
|
453
|
-
? {
|
|
454
|
-
...entry,
|
|
455
|
-
reasoningContent: (entry.reasoningContent || "") + chunk.reasoningContent,
|
|
456
|
-
isReasoningStreaming: true,
|
|
457
|
-
}
|
|
458
|
-
: entry));
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
break;
|
|
462
|
-
case "content":
|
|
463
|
-
if (chunk.content) {
|
|
464
|
-
if (!streamingEntry) {
|
|
465
|
-
const newStreamingEntry = {
|
|
466
|
-
type: "assistant",
|
|
467
|
-
content: chunk.content,
|
|
468
|
-
timestamp: new Date(),
|
|
469
|
-
isStreaming: true,
|
|
470
|
-
};
|
|
471
|
-
setChatHistory((prev) => [...prev, newStreamingEntry]);
|
|
472
|
-
streamingEntry = newStreamingEntry;
|
|
473
|
-
}
|
|
474
|
-
else {
|
|
475
|
-
setChatHistory((prev) => prev.map((entry, idx) => idx === prev.length - 1 && entry.isStreaming
|
|
476
|
-
? {
|
|
477
|
-
...entry,
|
|
478
|
-
content: entry.content + chunk.content,
|
|
479
|
-
isReasoningStreaming: false, // Stop reasoning streaming when content starts
|
|
480
|
-
}
|
|
481
|
-
: entry));
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
break;
|
|
485
|
-
case "token_count":
|
|
486
|
-
if (chunk.tokenCount !== undefined) {
|
|
487
|
-
setTokenCount(chunk.tokenCount);
|
|
488
|
-
}
|
|
489
|
-
break;
|
|
490
|
-
case "tool_calls":
|
|
491
|
-
if (chunk.toolCalls) {
|
|
492
|
-
// Stop streaming for the current assistant message
|
|
493
|
-
setChatHistory((prev) => prev.map((entry) => entry.isStreaming
|
|
494
|
-
? {
|
|
495
|
-
...entry,
|
|
496
|
-
isStreaming: false,
|
|
497
|
-
toolCalls: chunk.toolCalls,
|
|
498
|
-
}
|
|
499
|
-
: entry));
|
|
500
|
-
streamingEntry = null;
|
|
501
|
-
// Add individual tool call entries to show tools are being executed
|
|
502
|
-
chunk.toolCalls.forEach((toolCall) => {
|
|
503
|
-
const toolCallEntry = {
|
|
504
|
-
type: "tool_call",
|
|
505
|
-
content: "Executing...",
|
|
506
|
-
timestamp: new Date(),
|
|
507
|
-
toolCall: toolCall,
|
|
508
|
-
};
|
|
509
|
-
setChatHistory((prev) => [...prev, toolCallEntry]);
|
|
510
|
-
});
|
|
511
|
-
}
|
|
512
|
-
break;
|
|
513
|
-
case "tool_result":
|
|
514
|
-
if (chunk.toolCall && chunk.toolResult) {
|
|
515
|
-
setChatHistory((prev) => prev.map((entry) => {
|
|
516
|
-
if (entry.isStreaming) {
|
|
517
|
-
return { ...entry, isStreaming: false };
|
|
518
|
-
}
|
|
519
|
-
if (entry.type === "tool_call" &&
|
|
520
|
-
entry.toolCall?.id === chunk.toolCall?.id) {
|
|
521
|
-
return {
|
|
522
|
-
...entry,
|
|
523
|
-
type: "tool_result",
|
|
524
|
-
content: chunk.toolResult?.success
|
|
525
|
-
? chunk.toolResult?.output || "Success"
|
|
526
|
-
: chunk.toolResult?.error || "Error occurred",
|
|
527
|
-
toolResult: chunk.toolResult,
|
|
528
|
-
executionDurationMs: chunk.executionDurationMs,
|
|
529
|
-
};
|
|
530
|
-
}
|
|
531
|
-
return entry;
|
|
532
|
-
}));
|
|
533
|
-
streamingEntry = null;
|
|
534
|
-
}
|
|
535
|
-
break;
|
|
536
|
-
case "done":
|
|
537
|
-
setIsThinking(false);
|
|
538
|
-
if (streamingEntry) {
|
|
539
|
-
setChatHistory((prev) => prev.map((entry) => entry.isStreaming ? { ...entry, isStreaming: false } : entry));
|
|
540
|
-
}
|
|
541
|
-
setIsStreaming(false);
|
|
542
|
-
break;
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
catch (error) {
|
|
547
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
548
|
-
const errorEntry = {
|
|
549
|
-
type: "assistant",
|
|
550
|
-
content: `Error: ${errorMessage}`,
|
|
551
|
-
timestamp: new Date(),
|
|
552
|
-
};
|
|
553
|
-
setChatHistory((prev) => [...prev, errorEntry]);
|
|
554
|
-
setIsStreaming(false);
|
|
555
|
-
setIsThinking(false);
|
|
556
|
-
}
|
|
557
|
-
setIsProcessing(false);
|
|
558
|
-
processingStartTime.current = 0;
|
|
559
|
-
};
|
|
560
|
-
void processInitialMessage();
|
|
561
|
-
return () => {
|
|
562
|
-
cancelled = true;
|
|
563
|
-
};
|
|
564
|
-
}, [initialMessage, agent]);
|
|
565
|
-
useEffect(() => {
|
|
566
|
-
const handleConfirmationRequest = (options) => {
|
|
567
|
-
setConfirmationOptions(options);
|
|
568
|
-
};
|
|
569
|
-
confirmationService.on("confirmation-requested", handleConfirmationRequest);
|
|
570
|
-
return () => {
|
|
571
|
-
confirmationService.off("confirmation-requested", handleConfirmationRequest);
|
|
572
|
-
};
|
|
573
|
-
}, [confirmationService]);
|
|
574
|
-
// Listen for question requests from AskUserService
|
|
575
|
-
useEffect(() => {
|
|
576
|
-
const askUserService = getAskUserService();
|
|
577
|
-
const handleQuestionRequest = (request) => {
|
|
578
|
-
setQuestionRequest(request);
|
|
579
|
-
};
|
|
580
|
-
askUserService.on("question-requested", handleQuestionRequest);
|
|
581
|
-
return () => {
|
|
582
|
-
askUserService.off("question-requested", handleQuestionRequest);
|
|
583
|
-
};
|
|
584
|
-
}, []);
|
|
585
|
-
useEffect(() => {
|
|
586
|
-
if (!isProcessing && !isStreaming) {
|
|
587
|
-
setProcessingTime(0);
|
|
588
|
-
processingStartTime.current = 0; // Reset baseline so next run starts from zero
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
if (processingStartTime.current === 0) {
|
|
592
|
-
processingStartTime.current = Date.now();
|
|
593
|
-
}
|
|
594
|
-
const interval = setInterval(() => {
|
|
595
|
-
setProcessingTime(Math.floor((Date.now() - processingStartTime.current) / 1000));
|
|
596
|
-
}, 1000);
|
|
597
|
-
return () => clearInterval(interval);
|
|
598
|
-
}, [isProcessing, isStreaming]);
|
|
599
|
-
// Update context percentage only when conversation state changes
|
|
600
|
-
// Optimized context percentage calculation with throttling
|
|
601
|
-
// Best practice: Calculate only when needed, throttle updates, use setImmediate for non-blocking
|
|
602
|
-
useEffect(() => {
|
|
603
|
-
// Skip during streaming - avoid mid-stream overhead
|
|
604
|
-
if (isStreaming)
|
|
605
|
-
return;
|
|
606
|
-
// Throttle: Only update every 500ms to prevent excessive recalculations
|
|
607
|
-
const now = Date.now();
|
|
608
|
-
const timeSinceLastUpdate = now - lastPercentageUpdateTime.current;
|
|
609
|
-
if (timeSinceLastUpdate < 500) {
|
|
610
|
-
return; // Skip if updated less than 500ms ago
|
|
611
|
-
}
|
|
612
|
-
// Use setImmediate for non-blocking, async UI updates (Node.js equivalent of RAF)
|
|
613
|
-
// Track setTimeout for proper cleanup to prevent memory leaks
|
|
614
|
-
// Use object to allow mutation from inside setImmediate while accessible in cleanup
|
|
615
|
-
const timeoutState = { autoPruneTimeoutId: null, cancelled: false };
|
|
616
|
-
const immediateId = setImmediate(() => {
|
|
617
|
-
// Check if cleanup already ran (component unmounted)
|
|
618
|
-
if (timeoutState.cancelled)
|
|
619
|
-
return;
|
|
620
|
-
const percentage = agent.getContextPercentage();
|
|
621
|
-
// Detect auto-prune: if percentage increases by more than 10%, pruning happened
|
|
622
|
-
// (With countdown from 100%, prune causes percentage to go UP as more space becomes available)
|
|
623
|
-
if (lastPercentageRef.current > 0 &&
|
|
624
|
-
percentage > lastPercentageRef.current + 10) {
|
|
625
|
-
setShowAutoPrune(true);
|
|
626
|
-
// Hide "auto-prune" after 3 seconds
|
|
627
|
-
timeoutState.autoPruneTimeoutId = setTimeout(() => setShowAutoPrune(false), 3000);
|
|
628
|
-
// Reset low warning flag after prune (context recovered)
|
|
629
|
-
contextLowWarningShown.current = false;
|
|
630
|
-
}
|
|
631
|
-
// Show one-time warning when context drops below 20%
|
|
632
|
-
if (percentage <= 20 && !contextLowWarningShown.current && lastPercentageRef.current > 20) {
|
|
633
|
-
addToast(TOAST_MESSAGES.contextLow);
|
|
634
|
-
contextLowWarningShown.current = true;
|
|
635
|
-
}
|
|
636
|
-
lastPercentageRef.current = percentage; // Store percentage value
|
|
637
|
-
lastPercentageUpdateTime.current = now; // Store timestamp
|
|
638
|
-
setContextPercentage(percentage);
|
|
639
|
-
});
|
|
640
|
-
return () => {
|
|
641
|
-
timeoutState.cancelled = true;
|
|
642
|
-
clearImmediate(immediateId);
|
|
643
|
-
// Clean up auto-prune timeout to prevent memory leaks on unmount
|
|
644
|
-
if (timeoutState.autoPruneTimeoutId)
|
|
645
|
-
clearTimeout(timeoutState.autoPruneTimeoutId);
|
|
646
|
-
};
|
|
647
|
-
}, [agent, chatHistory.length, isStreaming, addToast]); // Only when length changes and not streaming
|
|
648
|
-
// Save history whenever it changes (debounced)
|
|
649
|
-
// Only save when NOT streaming to avoid constant disk I/O during active conversation
|
|
650
|
-
useEffect(() => {
|
|
651
|
-
// Skip saving while streaming - wait until conversation pauses
|
|
652
|
-
if (isStreaming)
|
|
653
|
-
return;
|
|
654
|
-
const timeoutId = setTimeout(() => {
|
|
655
|
-
historyManager.saveHistory(chatHistory);
|
|
656
|
-
}, 3000); // Increased debounce to 3 seconds to reduce disk writes
|
|
657
|
-
return () => clearTimeout(timeoutId);
|
|
658
|
-
}, [chatHistory.length, isStreaming, historyManager]); // Only trigger on length change, not content updates
|
|
659
|
-
const handleConfirmation = (dontAskAgain) => {
|
|
660
|
-
confirmationService.confirmOperation(true, dontAskAgain);
|
|
661
|
-
setConfirmationOptions(null);
|
|
662
|
-
};
|
|
663
|
-
const handleRejection = (feedback) => {
|
|
664
|
-
confirmationService.rejectOperation(feedback);
|
|
665
|
-
setConfirmationOptions(null);
|
|
666
|
-
// Reset processing states when operation is cancelled
|
|
667
|
-
setIsProcessing(false);
|
|
668
|
-
setIsStreaming(false);
|
|
669
|
-
setTokenCount(0);
|
|
670
|
-
setProcessingTime(0);
|
|
671
|
-
processingStartTime.current = 0;
|
|
672
|
-
};
|
|
673
|
-
// Question dialog handlers
|
|
674
|
-
const handleQuestionSubmit = (answers, customInput) => {
|
|
675
|
-
const askUserService = getAskUserService();
|
|
676
|
-
askUserService.submitAnswer(answers, customInput);
|
|
677
|
-
// The service will emit another question-requested event if there are more questions
|
|
678
|
-
// or it will resolve the promise and close automatically
|
|
679
|
-
// We clear the current question to prepare for the next one
|
|
680
|
-
setQuestionRequest(null);
|
|
681
|
-
};
|
|
682
|
-
const handleQuestionCancel = () => {
|
|
683
|
-
const askUserService = getAskUserService();
|
|
684
|
-
askUserService.cancelQuestions("Questions cancelled by user");
|
|
685
|
-
setQuestionRequest(null);
|
|
686
|
-
// Reset processing states when operation is cancelled
|
|
687
|
-
setIsProcessing(false);
|
|
688
|
-
setIsStreaming(false);
|
|
689
|
-
setTokenCount(0);
|
|
690
|
-
setProcessingTime(0);
|
|
691
|
-
processingStartTime.current = 0;
|
|
692
|
-
};
|
|
693
|
-
// Get MCP server count safely
|
|
694
|
-
// MCP server count - only calculate once on mount
|
|
695
|
-
// MCP servers are configured at startup and rarely change during session
|
|
696
|
-
const mcpServerCount = useMemo(() => {
|
|
697
|
-
try {
|
|
698
|
-
return getMcpConnectionCount();
|
|
699
|
-
}
|
|
700
|
-
catch {
|
|
701
|
-
return 0;
|
|
702
|
-
}
|
|
703
|
-
}, []); // Only calculate once
|
|
704
|
-
// Get background task count (running tasks)
|
|
705
|
-
const [backgroundTaskCount, setBackgroundTaskCount] = useState(0);
|
|
706
|
-
// Listen for background task events
|
|
707
|
-
// Memoize handlers to prevent event listener leaks
|
|
708
|
-
const handleTaskComplete = useCallback(({ taskId, status }) => {
|
|
709
|
-
const manager = BackgroundTaskManager.getInstance();
|
|
710
|
-
const taskInfo = manager.getTaskInfo(taskId);
|
|
711
|
-
const command = taskInfo?.command || taskId;
|
|
712
|
-
if (status === 'completed') {
|
|
713
|
-
addToast(TOAST_MESSAGES.taskCompleted(taskId, command));
|
|
714
|
-
}
|
|
715
|
-
else {
|
|
716
|
-
addToast(TOAST_MESSAGES.taskFailed(taskId, command));
|
|
717
|
-
}
|
|
718
|
-
// Update running count
|
|
719
|
-
setBackgroundTaskCount(manager.listTasks().filter(t => t.status === 'running').length);
|
|
720
|
-
}, [addToast]);
|
|
721
|
-
const handleTaskStarted = useCallback(() => {
|
|
722
|
-
const manager = BackgroundTaskManager.getInstance();
|
|
723
|
-
setBackgroundTaskCount(manager.listTasks().filter(t => t.status === 'running').length);
|
|
724
|
-
}, []);
|
|
725
|
-
const handleTaskKilled = useCallback(() => {
|
|
726
|
-
const manager = BackgroundTaskManager.getInstance();
|
|
727
|
-
setBackgroundTaskCount(manager.listTasks().filter(t => t.status === 'running').length);
|
|
728
|
-
}, []);
|
|
729
|
-
useEffect(() => {
|
|
730
|
-
const manager = BackgroundTaskManager.getInstance();
|
|
731
|
-
// Initial count
|
|
732
|
-
setBackgroundTaskCount(manager.listTasks().filter(t => t.status === 'running').length);
|
|
733
|
-
manager.on('taskComplete', handleTaskComplete);
|
|
734
|
-
manager.on('taskStarted', handleTaskStarted);
|
|
735
|
-
manager.on('taskAdopted', handleTaskStarted);
|
|
736
|
-
manager.on('taskKilled', handleTaskKilled);
|
|
737
|
-
return () => {
|
|
738
|
-
manager.off('taskComplete', handleTaskComplete);
|
|
739
|
-
manager.off('taskStarted', handleTaskStarted);
|
|
740
|
-
manager.off('taskAdopted', handleTaskStarted);
|
|
741
|
-
manager.off('taskKilled', handleTaskKilled);
|
|
742
|
-
};
|
|
743
|
-
}, [handleTaskComplete, handleTaskStarted, handleTaskKilled]);
|
|
744
|
-
// Handler for quick action selection
|
|
745
|
-
const handleQuickActionSelect = (command) => {
|
|
746
|
-
setShowQuickActions(false);
|
|
747
|
-
// Process the command by simulating user input
|
|
748
|
-
if (command === "exit") {
|
|
749
|
-
process.exit(0);
|
|
750
|
-
}
|
|
751
|
-
if (command === "toggle:verbosity") {
|
|
752
|
-
toggleVerbosity();
|
|
753
|
-
return;
|
|
754
|
-
}
|
|
755
|
-
if (command === "toggle:autoedit") {
|
|
756
|
-
toggleAutoEdit();
|
|
757
|
-
return;
|
|
758
|
-
}
|
|
759
|
-
if (command === "toggle:thinking") {
|
|
760
|
-
toggleThinkingMode();
|
|
761
|
-
return;
|
|
762
|
-
}
|
|
763
|
-
if (command === "toggle:background") {
|
|
764
|
-
toggleBackgroundMode();
|
|
765
|
-
return;
|
|
766
|
-
}
|
|
767
|
-
if (command === "show:keyboard-shortcuts") {
|
|
768
|
-
setShowKeyboardHelp(true);
|
|
769
|
-
return;
|
|
770
|
-
}
|
|
771
|
-
if (command === "show:quick-actions") {
|
|
772
|
-
setShowQuickActions(true);
|
|
773
|
-
return;
|
|
774
|
-
}
|
|
775
|
-
if (command === "jump:latest") {
|
|
776
|
-
// BUG FIX: Ink Box doesn't support scrollTo (DOM API), so this command is not functional.
|
|
777
|
-
// Terminal scrolling is handled by the terminal emulator, not the app.
|
|
778
|
-
// Show a toast instead of silently doing nothing.
|
|
779
|
-
addToast({ message: "Use terminal scroll (Shift+PgUp/PgDn) to navigate", type: "info", icon: "ℹ" });
|
|
780
|
-
return;
|
|
781
|
-
}
|
|
782
|
-
if (command === "/context") {
|
|
783
|
-
setShowContextBreakdown(true);
|
|
784
|
-
return;
|
|
785
|
-
}
|
|
786
|
-
// For slash commands, we'll need to trigger processing
|
|
787
|
-
// This can be done by directly calling the input handler or agent
|
|
788
|
-
};
|
|
789
|
-
return (React.createElement(Box, { flexDirection: "column", paddingX: 2 },
|
|
790
|
-
chatHistory.length === 0 && !confirmationOptions && !questionRequest && !showQuickActions && !showKeyboardHelp && !showContextBreakdown && !showMcpDashboard && (React.createElement(WelcomePanel, { projectName: projectName })),
|
|
791
|
-
currentPlan && !confirmationOptions && (React.createElement(Box, { marginBottom: 1 },
|
|
792
|
-
React.createElement(PhaseProgress, { plan: currentPlan, compact: true }))),
|
|
793
|
-
React.createElement(Box, { flexDirection: "column" },
|
|
794
|
-
React.createElement(ChatHistory, { entries: chatHistory, isConfirmationActive: !!confirmationOptions, verboseMode: verboseMode, verbosityLevel: verbosityLevel })),
|
|
795
|
-
showQuickActions && (React.createElement(QuickActions, { isVisible: showQuickActions, onSelect: handleQuickActionSelect, onClose: () => setShowQuickActions(false) })),
|
|
796
|
-
showKeyboardHelp && (React.createElement(KeyboardHelp, { onClose: () => setShowKeyboardHelp(false), verbosityLevel: verbosityLevel, backgroundMode: backgroundMode, autoEditEnabled: autoEditEnabled })),
|
|
797
|
-
showContextBreakdown && (() => {
|
|
798
|
-
// Calculate current and max tokens
|
|
799
|
-
const settingsManager = getSettingsManager();
|
|
800
|
-
const model = settingsManager.getCurrentModel();
|
|
801
|
-
const modelConfig = GLM_MODELS[model];
|
|
802
|
-
const maxTokens = modelConfig?.contextWindow || 200000;
|
|
803
|
-
const currentTokens = Math.floor(maxTokens * (1 - contextPercentage / 100));
|
|
804
|
-
const categories = calculateContextBreakdown(currentTokens);
|
|
805
|
-
return (React.createElement(ContextBreakdown, { onClose: () => setShowContextBreakdown(false), currentTokens: currentTokens, maxTokens: maxTokens, categories: categories }));
|
|
806
|
-
})(),
|
|
807
|
-
showMcpDashboard && (React.createElement(MCPDashboard, { isVisible: showMcpDashboard, onClose: () => setShowMcpDashboard(false), onRefresh: () => addToast({ message: "MCP servers refreshed", type: "success", icon: "🔄" }) })),
|
|
808
|
-
confirmationOptions && (React.createElement(ConfirmationDialog, { operation: confirmationOptions.operation, filename: confirmationOptions.filename, showVSCodeOpen: confirmationOptions.showVSCodeOpen, content: confirmationOptions.content, onConfirm: handleConfirmation, onReject: handleRejection })),
|
|
809
|
-
questionRequest && questionRequest.questions[questionRequest.currentQuestionIndex] && (React.createElement(QuestionDialog, { question: questionRequest.questions[questionRequest.currentQuestionIndex], questionNumber: questionRequest.currentQuestionIndex + 1, totalQuestions: questionRequest.questions.length, onSubmit: handleQuestionSubmit, onCancel: handleQuestionCancel })),
|
|
810
|
-
!confirmationOptions && !questionRequest && !showQuickActions && !showKeyboardHelp && !showContextBreakdown && !showMcpDashboard && (React.createElement(React.Fragment, null,
|
|
811
|
-
React.createElement(LoadingSpinner, { isActive: isProcessing || isStreaming, processingTime: processingTime, tokenCount: tokenCount }),
|
|
812
|
-
React.createElement(ChatInput, { input: input, cursorPosition: cursorPosition, isProcessing: isProcessing, isStreaming: isStreaming, pastedBlocks: pastedBlocks, currentBlockAtCursor: currentBlockAtCursor, isPasting: isPasting }),
|
|
813
|
-
toasts.length > 0 && (React.createElement(ToastContainer, { toasts: toasts, onDismiss: removeToast, maxVisible: 2 })),
|
|
814
|
-
React.createElement(StatusBar, { projectName: projectName, version: version, model: agent.getCurrentModel(), contextPercentage: contextPercentage, showAutoPrune: showAutoPrune, autoEditEnabled: autoEditEnabled, verboseMode: verboseMode, verbosityLevel: verbosityLevel, backgroundMode: backgroundMode, mcpServerCount: mcpServerCount, backgroundTaskCount: backgroundTaskCount, isProcessing: isProcessing || isStreaming, processingTime: processingTime, tokenCount: tokenCount, flashAutoEdit: flashAutoEdit, flashVerbose: flashVerbose, flashBackground: flashBackground, axEnabled: axEnabled, activeAgent: activeAgent, activeAgents: activeAgents, thinkingModeEnabled: thinkingModeEnabled, flashThinkingMode: flashThinkingMode, isThinking: isThinking }),
|
|
815
|
-
React.createElement(CommandSuggestions, { suggestions: suggestionMode === "resource"
|
|
816
|
-
? resourceSuggestions.map((r) => ({ command: r.reference, description: r.description || r.name }))
|
|
817
|
-
: commandSuggestions, input: suggestionMode === "resource" ? input.match(/@mcp:[^\s]*$/)?.[0] || "" : input, selectedIndex: selectedCommandIndex, isVisible: showCommandSuggestions })))));
|
|
818
|
-
}
|
|
819
|
-
// Main component that handles API key input or chat interface
|
|
820
|
-
export default function ChatInterface({ agent, initialMessage, loadPreviousHistory = false, agentFirstDisabled = false, forcedAgent, }) {
|
|
821
|
-
const [currentAgent, setCurrentAgent] = useState(agent || null);
|
|
822
|
-
const handleApiKeySet = (newAgent) => {
|
|
823
|
-
setCurrentAgent(newAgent);
|
|
824
|
-
};
|
|
825
|
-
if (!currentAgent) {
|
|
826
|
-
return React.createElement(ApiKeyInput, { onApiKeySet: handleApiKeySet });
|
|
827
|
-
}
|
|
828
|
-
return (React.createElement(ChatInterfaceWithAgent, { agent: currentAgent, initialMessage: initialMessage, loadPreviousHistory: loadPreviousHistory, agentFirstDisabled: agentFirstDisabled, forcedAgent: forcedAgent }));
|
|
829
|
-
}
|
|
830
|
-
//# sourceMappingURL=chat-interface.js.map
|