@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
package/dist/utils/cache.js
DELETED
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generic LRU Cache implementation for performance optimization
|
|
3
|
-
* Provides consistent caching across the application
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* ```typescript
|
|
7
|
-
* const cache = new LRUCache<string, number>({ maxSize: 100 });
|
|
8
|
-
* cache.set('key', 42);
|
|
9
|
-
* const value = cache.get('key'); // 42
|
|
10
|
-
* ```
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Least Recently Used (LRU) Cache with optional TTL
|
|
14
|
-
*/
|
|
15
|
-
export class LRUCache {
|
|
16
|
-
cache;
|
|
17
|
-
maxSize;
|
|
18
|
-
ttl;
|
|
19
|
-
constructor(options = {}) {
|
|
20
|
-
this.cache = new Map();
|
|
21
|
-
this.maxSize = options.maxSize || 1000;
|
|
22
|
-
this.ttl = options.ttl;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Get value from cache
|
|
26
|
-
* Returns undefined if not found or expired
|
|
27
|
-
*/
|
|
28
|
-
get(key) {
|
|
29
|
-
const entry = this.cache.get(key);
|
|
30
|
-
if (!entry) {
|
|
31
|
-
return undefined;
|
|
32
|
-
}
|
|
33
|
-
// Check if expired
|
|
34
|
-
if (this.ttl && Date.now() - entry.timestamp > this.ttl) {
|
|
35
|
-
this.cache.delete(key);
|
|
36
|
-
return undefined;
|
|
37
|
-
}
|
|
38
|
-
// Move to end (most recently used)
|
|
39
|
-
this.cache.delete(key);
|
|
40
|
-
this.cache.set(key, entry);
|
|
41
|
-
return entry.value;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Set value in cache with LRU eviction
|
|
45
|
-
*/
|
|
46
|
-
set(key, value) {
|
|
47
|
-
// Remove if already exists (to update position)
|
|
48
|
-
this.cache.delete(key);
|
|
49
|
-
// Evict oldest if at max size
|
|
50
|
-
if (this.cache.size >= this.maxSize) {
|
|
51
|
-
const firstKey = this.cache.keys().next().value;
|
|
52
|
-
if (firstKey !== undefined) {
|
|
53
|
-
this.cache.delete(firstKey);
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
// Add new entry
|
|
57
|
-
this.cache.set(key, {
|
|
58
|
-
value,
|
|
59
|
-
timestamp: Date.now(),
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Check if key exists and is not expired
|
|
64
|
-
* Unlike get(), this properly handles cached undefined values
|
|
65
|
-
*/
|
|
66
|
-
has(key) {
|
|
67
|
-
const entry = this.cache.get(key);
|
|
68
|
-
if (!entry) {
|
|
69
|
-
return false;
|
|
70
|
-
}
|
|
71
|
-
// Check if expired
|
|
72
|
-
if (this.ttl && Date.now() - entry.timestamp > this.ttl) {
|
|
73
|
-
this.cache.delete(key);
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Delete entry from cache
|
|
80
|
-
*/
|
|
81
|
-
delete(key) {
|
|
82
|
-
return this.cache.delete(key);
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Clear all entries
|
|
86
|
-
*/
|
|
87
|
-
clear() {
|
|
88
|
-
this.cache.clear();
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Get cache size
|
|
92
|
-
*/
|
|
93
|
-
size() {
|
|
94
|
-
return this.cache.size;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Get all keys (in LRU order)
|
|
98
|
-
*/
|
|
99
|
-
keys() {
|
|
100
|
-
return Array.from(this.cache.keys());
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Get cache statistics
|
|
104
|
-
*/
|
|
105
|
-
stats() {
|
|
106
|
-
return {
|
|
107
|
-
size: this.cache.size,
|
|
108
|
-
maxSize: this.maxSize,
|
|
109
|
-
ttl: this.ttl,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Create a memoized version of an async function with caching
|
|
115
|
-
* Prevents cache stampede by tracking pending promises
|
|
116
|
-
*/
|
|
117
|
-
export function memoizeAsync(fn, options = {}) {
|
|
118
|
-
const cache = new LRUCache(options);
|
|
119
|
-
const pending = new Map();
|
|
120
|
-
const keyFn = options.keyFn || ((...args) => {
|
|
121
|
-
try {
|
|
122
|
-
return JSON.stringify(args);
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
// Fallback for circular references or non-serializable values
|
|
126
|
-
return args.map((arg, i) => `${i}:${String(arg)}`).join('|');
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
return async (...args) => {
|
|
130
|
-
const key = keyFn(...args);
|
|
131
|
-
// Check cache first using has() to properly handle cached undefined values
|
|
132
|
-
if (cache.has(key)) {
|
|
133
|
-
return cache.get(key);
|
|
134
|
-
}
|
|
135
|
-
// Check if already pending to prevent cache stampede
|
|
136
|
-
const existingPromise = pending.get(key);
|
|
137
|
-
if (existingPromise) {
|
|
138
|
-
return existingPromise;
|
|
139
|
-
}
|
|
140
|
-
// Create new promise and track it
|
|
141
|
-
const promise = fn(...args)
|
|
142
|
-
.then((result) => {
|
|
143
|
-
cache.set(key, result);
|
|
144
|
-
pending.delete(key);
|
|
145
|
-
return result;
|
|
146
|
-
})
|
|
147
|
-
.catch((error) => {
|
|
148
|
-
pending.delete(key);
|
|
149
|
-
throw error;
|
|
150
|
-
});
|
|
151
|
-
pending.set(key, promise);
|
|
152
|
-
return promise;
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Create a memoized version of a sync function with caching
|
|
157
|
-
*/
|
|
158
|
-
export function memoize(fn, options = {}) {
|
|
159
|
-
const cache = new LRUCache(options);
|
|
160
|
-
const keyFn = options.keyFn || ((...args) => {
|
|
161
|
-
try {
|
|
162
|
-
return JSON.stringify(args);
|
|
163
|
-
}
|
|
164
|
-
catch {
|
|
165
|
-
// Fallback for circular references or non-serializable values
|
|
166
|
-
return args.map((arg, i) => `${i}:${String(arg)}`).join('|');
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
return (...args) => {
|
|
170
|
-
const key = keyFn(...args);
|
|
171
|
-
// Check cache first using has() to properly handle cached undefined values
|
|
172
|
-
if (cache.has(key)) {
|
|
173
|
-
return cache.get(key);
|
|
174
|
-
}
|
|
175
|
-
const result = fn(...args);
|
|
176
|
-
cache.set(key, result);
|
|
177
|
-
return result;
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
//# sourceMappingURL=cache.js.map
|
package/dist/utils/cache.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"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AI,CAAC,CAAC;QAC3B,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACvB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Command Security Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides secure command execution with whitelisting and validation.
|
|
5
|
-
* Prevents command injection vulnerabilities (REQ-SEC-001).
|
|
6
|
-
*
|
|
7
|
-
* @module command-security
|
|
8
|
-
*/
|
|
9
|
-
import type { ToolResult } from '../types/index.js';
|
|
10
|
-
/**
|
|
11
|
-
* Whitelist of safe commands allowed for execution.
|
|
12
|
-
* Only these commands can be executed via the BashTool.
|
|
13
|
-
*
|
|
14
|
-
* CRITICAL: Do not add arbitrary commands without security review.
|
|
15
|
-
*/
|
|
16
|
-
export declare const SAFE_COMMANDS: readonly ["ls", "grep", "find", "cat", "head", "tail", "wc", "sort", "uniq", "cut", "awk", "sed", "pwd", "echo", "date", "whoami", "hostname", "git", "rg", "fd", "rm", "mkdir", "touch", "cp", "mv"];
|
|
17
|
-
export type SafeCommand = typeof SAFE_COMMANDS[number];
|
|
18
|
-
/**
|
|
19
|
-
* Parsed command structure
|
|
20
|
-
*/
|
|
21
|
-
export interface ParsedCommand {
|
|
22
|
-
command: SafeCommand;
|
|
23
|
-
args: string[];
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Command execution options
|
|
27
|
-
*/
|
|
28
|
-
export interface CommandExecutionOptions {
|
|
29
|
-
cwd?: string;
|
|
30
|
-
timeout?: number;
|
|
31
|
-
maxBuffer?: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Sanitize environment variables for child process.
|
|
35
|
-
* Only includes safe environment variables to prevent injection.
|
|
36
|
-
*
|
|
37
|
-
* @param env - Original process environment
|
|
38
|
-
* @returns Sanitized environment object
|
|
39
|
-
*/
|
|
40
|
-
export declare function sanitizeEnv(env: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
41
|
-
/**
|
|
42
|
-
* Parse a command string into command and arguments.
|
|
43
|
-
* Validates that the command is in the whitelist.
|
|
44
|
-
*
|
|
45
|
-
* @param commandString - Full command string (e.g., "ls -la /tmp")
|
|
46
|
-
* @returns Parsed command structure
|
|
47
|
-
* @throws Error if command is not whitelisted
|
|
48
|
-
*/
|
|
49
|
-
export declare function parseCommand(commandString: string): ParsedCommand;
|
|
50
|
-
/**
|
|
51
|
-
* Validate command arguments for shell metacharacters.
|
|
52
|
-
* Prevents command injection via argument injection.
|
|
53
|
-
*
|
|
54
|
-
* @param args - Command arguments to validate
|
|
55
|
-
* @returns Validation result
|
|
56
|
-
*/
|
|
57
|
-
export declare function validateArguments(args: string[]): {
|
|
58
|
-
valid: boolean;
|
|
59
|
-
errors: string[];
|
|
60
|
-
};
|
|
61
|
-
/**
|
|
62
|
-
* Execute a safe command with validation.
|
|
63
|
-
* Uses execFile to avoid shell invocation and command injection.
|
|
64
|
-
*
|
|
65
|
-
* SECURITY: This function uses execFile instead of spawn('bash', ['-c'])
|
|
66
|
-
* to prevent command injection attacks.
|
|
67
|
-
*
|
|
68
|
-
* @param commandString - Command to execute
|
|
69
|
-
* @param options - Execution options
|
|
70
|
-
* @returns Tool result with output or error
|
|
71
|
-
*/
|
|
72
|
-
export declare function executeSafeCommand(commandString: string, options?: CommandExecutionOptions): Promise<ToolResult>;
|
|
73
|
-
/**
|
|
74
|
-
* Check if a command is safe to execute.
|
|
75
|
-
*
|
|
76
|
-
* @param command - Command name to check
|
|
77
|
-
* @returns True if command is in whitelist
|
|
78
|
-
*/
|
|
79
|
-
export declare function isSafeCommand(command: string): command is SafeCommand;
|
|
80
|
-
/**
|
|
81
|
-
* Get list of safe commands (for documentation/help).
|
|
82
|
-
*
|
|
83
|
-
* @returns Array of safe command names
|
|
84
|
-
*/
|
|
85
|
-
export declare function getSafeCommands(): readonly string[];
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Command Security Utilities
|
|
3
|
-
*
|
|
4
|
-
* Provides secure command execution with whitelisting and validation.
|
|
5
|
-
* Prevents command injection vulnerabilities (REQ-SEC-001).
|
|
6
|
-
*
|
|
7
|
-
* @module command-security
|
|
8
|
-
*/
|
|
9
|
-
import { execFile } from 'child_process';
|
|
10
|
-
import { promisify } from 'util';
|
|
11
|
-
const execFileAsync = promisify(execFile);
|
|
12
|
-
/**
|
|
13
|
-
* Whitelist of safe commands allowed for execution.
|
|
14
|
-
* Only these commands can be executed via the BashTool.
|
|
15
|
-
*
|
|
16
|
-
* CRITICAL: Do not add arbitrary commands without security review.
|
|
17
|
-
*/
|
|
18
|
-
export const SAFE_COMMANDS = [
|
|
19
|
-
'ls',
|
|
20
|
-
'grep',
|
|
21
|
-
'find',
|
|
22
|
-
'cat',
|
|
23
|
-
'head',
|
|
24
|
-
'tail',
|
|
25
|
-
'wc',
|
|
26
|
-
'sort',
|
|
27
|
-
'uniq',
|
|
28
|
-
'cut',
|
|
29
|
-
'awk',
|
|
30
|
-
'sed',
|
|
31
|
-
'pwd',
|
|
32
|
-
'echo',
|
|
33
|
-
'date',
|
|
34
|
-
'whoami',
|
|
35
|
-
'hostname',
|
|
36
|
-
'git',
|
|
37
|
-
'rg',
|
|
38
|
-
'fd',
|
|
39
|
-
'rm', // File deletion (safe with validation)
|
|
40
|
-
'mkdir', // Directory creation
|
|
41
|
-
'touch', // File creation
|
|
42
|
-
'cp', // File copy
|
|
43
|
-
'mv', // File move/rename
|
|
44
|
-
];
|
|
45
|
-
/**
|
|
46
|
-
* Environment variables safe to pass to child processes.
|
|
47
|
-
* Only these will be included in the child process environment.
|
|
48
|
-
*/
|
|
49
|
-
const SAFE_ENV_VARS = [
|
|
50
|
-
'PATH',
|
|
51
|
-
'HOME',
|
|
52
|
-
'USER',
|
|
53
|
-
'LANG',
|
|
54
|
-
'LC_ALL',
|
|
55
|
-
'TERM',
|
|
56
|
-
'TMPDIR',
|
|
57
|
-
'PWD',
|
|
58
|
-
];
|
|
59
|
-
/**
|
|
60
|
-
* Shell metacharacters that are forbidden in command arguments.
|
|
61
|
-
* These could enable command injection if not properly validated.
|
|
62
|
-
*/
|
|
63
|
-
const SHELL_METACHARACTERS = /[;&|`$(){}[\]<>'"\\*?~!#]/;
|
|
64
|
-
/**
|
|
65
|
-
* Sanitize environment variables for child process.
|
|
66
|
-
* Only includes safe environment variables to prevent injection.
|
|
67
|
-
*
|
|
68
|
-
* @param env - Original process environment
|
|
69
|
-
* @returns Sanitized environment object
|
|
70
|
-
*/
|
|
71
|
-
export function sanitizeEnv(env) {
|
|
72
|
-
const sanitized = {};
|
|
73
|
-
for (const key of SAFE_ENV_VARS) {
|
|
74
|
-
if (env[key]) {
|
|
75
|
-
sanitized[key] = env[key];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return sanitized;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Parse a command string into command and arguments.
|
|
82
|
-
* Validates that the command is in the whitelist.
|
|
83
|
-
*
|
|
84
|
-
* @param commandString - Full command string (e.g., "ls -la /tmp")
|
|
85
|
-
* @returns Parsed command structure
|
|
86
|
-
* @throws Error if command is not whitelisted
|
|
87
|
-
*/
|
|
88
|
-
export function parseCommand(commandString) {
|
|
89
|
-
const trimmed = commandString.trim();
|
|
90
|
-
if (!trimmed) {
|
|
91
|
-
throw new Error('Empty command string');
|
|
92
|
-
}
|
|
93
|
-
// Simple split by whitespace
|
|
94
|
-
const parts = trimmed.split(/\s+/);
|
|
95
|
-
const command = parts[0];
|
|
96
|
-
const args = parts.slice(1);
|
|
97
|
-
// Validate command is in whitelist
|
|
98
|
-
if (!SAFE_COMMANDS.includes(command)) {
|
|
99
|
-
throw new Error(`Command '${command}' not in whitelist. Allowed commands: ${SAFE_COMMANDS.join(', ')}`);
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
command: command,
|
|
103
|
-
args,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Validate command arguments for shell metacharacters.
|
|
108
|
-
* Prevents command injection via argument injection.
|
|
109
|
-
*
|
|
110
|
-
* @param args - Command arguments to validate
|
|
111
|
-
* @returns Validation result
|
|
112
|
-
*/
|
|
113
|
-
export function validateArguments(args) {
|
|
114
|
-
const errors = [];
|
|
115
|
-
// BUG FIX: Track cumulative argument size to prevent exceeding OS limits
|
|
116
|
-
// Most Unix systems have ARG_MAX around 128KB-2MB, use conservative limit
|
|
117
|
-
const MAX_TOTAL_ARG_SIZE = 131072; // 128KB - safe for most systems
|
|
118
|
-
let totalArgSize = 0;
|
|
119
|
-
for (let i = 0; i < args.length; i++) {
|
|
120
|
-
const arg = args[i];
|
|
121
|
-
// Check for shell metacharacters
|
|
122
|
-
if (SHELL_METACHARACTERS.test(arg)) {
|
|
123
|
-
errors.push(`Argument ${i} contains forbidden shell metacharacters: "${arg}"`);
|
|
124
|
-
}
|
|
125
|
-
// Check for null bytes
|
|
126
|
-
if (arg.includes('\0')) {
|
|
127
|
-
errors.push(`Argument ${i} contains null byte`);
|
|
128
|
-
}
|
|
129
|
-
// Check length (prevent buffer overflow)
|
|
130
|
-
if (arg.length > 10000) {
|
|
131
|
-
errors.push(`Argument ${i} exceeds maximum length (10000 chars)`);
|
|
132
|
-
}
|
|
133
|
-
// BUG FIX: Accumulate total size (including null terminator for each arg)
|
|
134
|
-
totalArgSize += arg.length + 1;
|
|
135
|
-
}
|
|
136
|
-
// BUG FIX: Check cumulative argument size
|
|
137
|
-
if (totalArgSize > MAX_TOTAL_ARG_SIZE) {
|
|
138
|
-
errors.push(`Total argument size (${totalArgSize} bytes) exceeds safe limit (${MAX_TOTAL_ARG_SIZE} bytes)`);
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
valid: errors.length === 0,
|
|
142
|
-
errors,
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Execute a safe command with validation.
|
|
147
|
-
* Uses execFile to avoid shell invocation and command injection.
|
|
148
|
-
*
|
|
149
|
-
* SECURITY: This function uses execFile instead of spawn('bash', ['-c'])
|
|
150
|
-
* to prevent command injection attacks.
|
|
151
|
-
*
|
|
152
|
-
* @param commandString - Command to execute
|
|
153
|
-
* @param options - Execution options
|
|
154
|
-
* @returns Tool result with output or error
|
|
155
|
-
*/
|
|
156
|
-
export async function executeSafeCommand(commandString, options = {}) {
|
|
157
|
-
try {
|
|
158
|
-
// 1. Parse command into command + args
|
|
159
|
-
const parsed = parseCommand(commandString);
|
|
160
|
-
// 2. Validate arguments
|
|
161
|
-
const validation = validateArguments(parsed.args);
|
|
162
|
-
if (!validation.valid) {
|
|
163
|
-
return {
|
|
164
|
-
success: false,
|
|
165
|
-
error: `Command validation failed:\n${validation.errors.join('\n')}`,
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
// 3. Prepare execution options
|
|
169
|
-
const execOptions = {
|
|
170
|
-
cwd: options.cwd || process.cwd(),
|
|
171
|
-
env: sanitizeEnv(process.env),
|
|
172
|
-
timeout: options.timeout || 30000, // 30 second default
|
|
173
|
-
maxBuffer: options.maxBuffer || 1024 * 1024, // 1MB default
|
|
174
|
-
};
|
|
175
|
-
// 4. Execute using execFile (no shell invocation)
|
|
176
|
-
const { stdout, stderr } = await execFileAsync(parsed.command, parsed.args, execOptions);
|
|
177
|
-
// 5. Return successful result
|
|
178
|
-
return {
|
|
179
|
-
success: true,
|
|
180
|
-
output: stdout || stderr || 'Command completed successfully',
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
catch (error) {
|
|
184
|
-
// Handle execution errors
|
|
185
|
-
const errorMessage = error.message || String(error);
|
|
186
|
-
const exitCode = error.code || 'unknown';
|
|
187
|
-
return {
|
|
188
|
-
success: false,
|
|
189
|
-
error: `Command execution failed (exit code: ${exitCode}): ${errorMessage}`,
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Check if a command is safe to execute.
|
|
195
|
-
*
|
|
196
|
-
* @param command - Command name to check
|
|
197
|
-
* @returns True if command is in whitelist
|
|
198
|
-
*/
|
|
199
|
-
export function isSafeCommand(command) {
|
|
200
|
-
return SAFE_COMMANDS.includes(command);
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Get list of safe commands (for documentation/help).
|
|
204
|
-
*
|
|
205
|
-
* @returns Array of safe command names
|
|
206
|
-
*/
|
|
207
|
-
export function getSafeCommands() {
|
|
208
|
-
return SAFE_COMMANDS;
|
|
209
|
-
}
|
|
210
|
-
//# sourceMappingURL=command-security.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-security.js","sourceRoot":"","sources":["../../src/utils/command-security.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAGjC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAAK;IACL,MAAM;IACN,MAAM;IACN,IAAI;IACJ,MAAM;IACN,MAAM;IACN,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,QAAQ;IACR,UAAU;IACV,KAAK;IACL,IAAI;IACJ,IAAI;IACJ,IAAI,EAAO,uCAAuC;IAClD,OAAO,EAAI,qBAAqB;IAChC,OAAO,EAAI,gBAAgB;IAC3B,IAAI,EAAO,YAAY;IACvB,IAAI,EAAO,mBAAmB;CACtB,CAAC;AAIX;;;GAGG;AACH,MAAM,aAAa,GAAG;IACpB,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,QAAQ;IACR,MAAM;IACN,QAAQ;IACR,KAAK;CACG,CAAC;AAEX;;;G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Aa,CAAC;AACvB,CAAC"}
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* YAML Configuration Loader
|
|
3
|
-
* Loads and caches configuration from YAML files with Zod validation
|
|
4
|
-
*/
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
/**
|
|
7
|
-
* Load a YAML configuration file with optional schema validation
|
|
8
|
-
*/
|
|
9
|
-
export declare function loadYamlConfig<T = any>(filename: string, schema?: z.ZodSchema<T>): T;
|
|
10
|
-
/**
|
|
11
|
-
* Clear the configuration cache
|
|
12
|
-
* Useful for testing or reloading configs
|
|
13
|
-
*/
|
|
14
|
-
export declare function clearConfigCache(): void;
|
|
15
|
-
/**
|
|
16
|
-
* Load model configurations
|
|
17
|
-
*/
|
|
18
|
-
export interface ModelConfig {
|
|
19
|
-
name: string;
|
|
20
|
-
context_window: number;
|
|
21
|
-
max_output_tokens: number;
|
|
22
|
-
default_max_tokens: number;
|
|
23
|
-
supports_thinking: boolean;
|
|
24
|
-
supports_vision?: boolean;
|
|
25
|
-
default_temperature: number;
|
|
26
|
-
temperature_range: {
|
|
27
|
-
min: number;
|
|
28
|
-
max: number;
|
|
29
|
-
};
|
|
30
|
-
token_efficiency: number;
|
|
31
|
-
}
|
|
32
|
-
export interface ModelsYaml {
|
|
33
|
-
default_model: string;
|
|
34
|
-
models: Record<string, ModelConfig>;
|
|
35
|
-
}
|
|
36
|
-
export declare function loadModelsConfig(): ModelsYaml;
|
|
37
|
-
/**
|
|
38
|
-
* Load application settings
|
|
39
|
-
*/
|
|
40
|
-
export interface SettingsYaml {
|
|
41
|
-
agent: {
|
|
42
|
-
max_tool_rounds: number;
|
|
43
|
-
default_timeout: number;
|
|
44
|
-
default_max_tokens: number;
|
|
45
|
-
max_recent_tool_calls: number;
|
|
46
|
-
max_messages?: number;
|
|
47
|
-
loop_detection_threshold: number;
|
|
48
|
-
enable_loop_detection: boolean;
|
|
49
|
-
};
|
|
50
|
-
subagent?: {
|
|
51
|
-
general_max_tool_rounds?: number;
|
|
52
|
-
testing_max_tool_rounds?: number;
|
|
53
|
-
documentation_max_tool_rounds?: number;
|
|
54
|
-
refactoring_max_tool_rounds?: number;
|
|
55
|
-
analysis_max_tool_rounds?: number;
|
|
56
|
-
debug_max_tool_rounds?: number;
|
|
57
|
-
performance_max_tool_rounds?: number;
|
|
58
|
-
default_context_depth?: number;
|
|
59
|
-
deep_context_depth?: number;
|
|
60
|
-
shallow_context_depth?: number;
|
|
61
|
-
max_concurrent_agents?: number;
|
|
62
|
-
max_concurrent_tools?: number;
|
|
63
|
-
};
|
|
64
|
-
file: {
|
|
65
|
-
max_file_size: number;
|
|
66
|
-
max_buffer_size: number;
|
|
67
|
-
diff_context_lines: number;
|
|
68
|
-
};
|
|
69
|
-
history: {
|
|
70
|
-
max_history_size: number;
|
|
71
|
-
};
|
|
72
|
-
mcp: {
|
|
73
|
-
client_name: string;
|
|
74
|
-
client_version: string;
|
|
75
|
-
default_timeout: number;
|
|
76
|
-
health_check_interval?: number;
|
|
77
|
-
reconnect_max_delay?: number;
|
|
78
|
-
token_warning_threshold: number;
|
|
79
|
-
token_hard_limit: number;
|
|
80
|
-
truncation_enabled: boolean;
|
|
81
|
-
};
|
|
82
|
-
timeouts?: {
|
|
83
|
-
bash_default?: number;
|
|
84
|
-
search_default?: number;
|
|
85
|
-
hook_default?: number;
|
|
86
|
-
streaming_first_chunk?: number;
|
|
87
|
-
streaming_idle?: number;
|
|
88
|
-
process_execution?: number;
|
|
89
|
-
process_idle?: number;
|
|
90
|
-
paste_timeout?: number;
|
|
91
|
-
cache_ttl?: number;
|
|
92
|
-
settings_cache_ttl?: number;
|
|
93
|
-
api_health_check?: number;
|
|
94
|
-
command_check?: number;
|
|
95
|
-
mcp_init?: number;
|
|
96
|
-
shutdown?: number;
|
|
97
|
-
npm_list?: number;
|
|
98
|
-
npm_view?: number;
|
|
99
|
-
update_install?: number;
|
|
100
|
-
notification_display?: number;
|
|
101
|
-
tool_approval?: number;
|
|
102
|
-
context_cleanup_interval?: number;
|
|
103
|
-
confirmation_timeout?: number;
|
|
104
|
-
};
|
|
105
|
-
ui: {
|
|
106
|
-
status_update_interval: number;
|
|
107
|
-
processing_timer_interval: number;
|
|
108
|
-
verbosity_level?: string;
|
|
109
|
-
group_tool_calls?: boolean;
|
|
110
|
-
max_group_size?: number;
|
|
111
|
-
group_time_window?: number;
|
|
112
|
-
/** Enable semantic grouping (Claude Code-style) */
|
|
113
|
-
semantic_grouping?: boolean;
|
|
114
|
-
/** Max operations in a semantic group */
|
|
115
|
-
max_semantic_group_size?: number;
|
|
116
|
-
/** Max visible tool lines for rolling display (Claude Code-style) */
|
|
117
|
-
max_visible_tool_lines?: number;
|
|
118
|
-
};
|
|
119
|
-
token: {
|
|
120
|
-
tokens_per_message: number;
|
|
121
|
-
tokens_for_reply_priming: number;
|
|
122
|
-
default_model: string;
|
|
123
|
-
default_encoding: string;
|
|
124
|
-
cache_max_size: number;
|
|
125
|
-
chars_per_token_estimate: number;
|
|
126
|
-
};
|
|
127
|
-
cache: {
|
|
128
|
-
default_max_size: number;
|
|
129
|
-
default_ttl: number;
|
|
130
|
-
tool_args_cache_max_size?: number;
|
|
131
|
-
tool_args_cache_prune_count?: number;
|
|
132
|
-
};
|
|
133
|
-
performance: {
|
|
134
|
-
debounce_delay: number;
|
|
135
|
-
throttle_limit: number;
|
|
136
|
-
slow_operation_threshold: number;
|
|
137
|
-
};
|
|
138
|
-
tool_names: Record<string, string>;
|
|
139
|
-
}
|
|
140
|
-
export declare function loadSettingsConfig(): SettingsYaml;
|
|
141
|
-
/**
|
|
142
|
-
* Load prompt configurations
|
|
143
|
-
*/
|
|
144
|
-
export interface PromptSection {
|
|
145
|
-
title?: string;
|
|
146
|
-
content?: string;
|
|
147
|
-
rules?: string[];
|
|
148
|
-
steps?: string[];
|
|
149
|
-
guidelines?: string[];
|
|
150
|
-
}
|
|
151
|
-
export interface PromptsYaml {
|
|
152
|
-
system_prompt: {
|
|
153
|
-
identity: string;
|
|
154
|
-
professional_objectivity?: PromptSection;
|
|
155
|
-
core_principles?: PromptSection;
|
|
156
|
-
tools_header: string;
|
|
157
|
-
tools: Array<{
|
|
158
|
-
name: string;
|
|
159
|
-
description: string;
|
|
160
|
-
optional?: boolean;
|
|
161
|
-
}>;
|
|
162
|
-
sections: Record<string, PromptSection>;
|
|
163
|
-
closing: string;
|
|
164
|
-
};
|
|
165
|
-
custom_instructions_prefix: string;
|
|
166
|
-
custom_instructions_suffix: string;
|
|
167
|
-
}
|
|
168
|
-
export declare function loadPromptsConfig(): PromptsYaml;
|
|
169
|
-
/**
|
|
170
|
-
* Load message templates
|
|
171
|
-
*/
|
|
172
|
-
export interface MessagesYaml {
|
|
173
|
-
errors: Record<string, string>;
|
|
174
|
-
warnings: Record<string, string>;
|
|
175
|
-
success: Record<string, string>;
|
|
176
|
-
info: Record<string, string>;
|
|
177
|
-
ui?: {
|
|
178
|
-
api_key_input?: Record<string, string>;
|
|
179
|
-
[key: string]: Record<string, string> | undefined;
|
|
180
|
-
};
|
|
181
|
-
mcp_commands?: Record<string, string>;
|
|
182
|
-
migration?: Record<string, string>;
|
|
183
|
-
}
|
|
184
|
-
export declare function loadMessagesConfig(): MessagesYaml;
|
|
185
|
-
/**
|
|
186
|
-
* Format a message template with variables
|
|
187
|
-
* Supports alphanumeric keys with hyphens and underscores
|
|
188
|
-
* Example: formatMessage("Tool {tool-name} not found", { "tool-name": "bash" })
|
|
189
|
-
*/
|
|
190
|
-
export declare function formatMessage(template: string, variables: Record<string, string | number>): string;
|