toolpack-sdk 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -592,6 +592,10 @@ interface Plan {
592
592
  }
593
593
 
594
594
  interface WorkflowConfig {
595
+ /**
596
+ * Workflow name for display purposes.
597
+ */
598
+ name?: string;
595
599
  /**
596
600
  * Planning phase configuration.
597
601
  * If enabled, AI generates a plan before executing.
@@ -621,6 +625,8 @@ interface WorkflowConfig {
621
625
  allowDynamicSteps?: boolean;
622
626
  /** Maximum total steps (including dynamic). Default: 50 */
623
627
  maxTotalSteps?: number;
628
+ /** Custom step execution prompt. Default: uses built-in STEP_EXECUTION_PROMPT */
629
+ stepPrompt?: string;
624
630
  };
625
631
  /**
626
632
  * Progress reporting configuration.
@@ -636,9 +642,19 @@ interface WorkflowConfig {
636
642
  */
637
643
  onFailure?: {
638
644
  /** Strategy when a step fails after all retries. Default: 'abort' */
639
- strategy: 'abort' | 'skip' | 'ask_user' | 'try_alternative';
640
- /** If 'try_alternative', allow AI to choose a different approach */
641
- allowAlternativePath?: boolean;
645
+ strategy: 'abort' | 'skip' | 'ask_user';
646
+ };
647
+ /**
648
+ * Query complexity routing configuration.
649
+ * Routes simple queries to faster execution paths based on query classification.
650
+ */
651
+ complexityRouting?: {
652
+ /** Enable complexity-based routing. Default: false (opt-in) */
653
+ enabled: boolean;
654
+ /** Routing strategy for simple queries. Default: 'single-step' */
655
+ strategy: 'single-step' | 'bypass' | 'disabled';
656
+ /** Confidence threshold for routing analytical queries. Default: 0.6 */
657
+ confidenceThreshold?: number;
642
658
  };
643
659
  }
644
660
  /**
@@ -772,6 +788,33 @@ interface ModeBlockedHint {
772
788
  suggestedMode: string;
773
789
  }
774
790
 
791
+ /**
792
+ * Query Classifier for Tool Orchestration
793
+ *
794
+ * Classifies user queries into analytical, action, or conversational types
795
+ * to optimize tool execution strategy (e.g., adjust maxToolRounds).
796
+ */
797
+ type QueryType = 'analytical' | 'action' | 'conversational';
798
+ interface QueryClassification {
799
+ type: QueryType;
800
+ confidence: number;
801
+ reasoning?: string;
802
+ }
803
+ declare class QueryClassifier {
804
+ private analyticalPatterns;
805
+ private actionPatterns;
806
+ /**
807
+ * Classify a user query based on pattern matching.
808
+ * Returns the query type and confidence score.
809
+ */
810
+ classify(userMessage: string): QueryClassification;
811
+ /**
812
+ * Get recommended maxToolRounds adjustment based on query type.
813
+ * Returns a multiplier or bonus rounds.
814
+ */
815
+ getToolRoundsAdjustment(classification: QueryClassification, baseRounds: number): number;
816
+ }
817
+
775
818
  interface AIClientConfig {
776
819
  providers: Record<string, ProviderAdapter>;
777
820
  defaultProvider?: string;
@@ -835,6 +878,10 @@ declare class AIClient extends EventEmitter {
835
878
  * Get the currently active mode.
836
879
  */
837
880
  getMode(): ModeConfig | null;
881
+ /**
882
+ * Get the query classifier instance.
883
+ */
884
+ getQueryClassifier(): QueryClassifier;
838
885
  /**
839
886
  * Re-index tools for BM25 search.
840
887
  * Call this after adding/removing tools from the registry.
@@ -1861,7 +1908,10 @@ declare const CHAT_MODE: ModeConfig;
1861
1908
  /**
1862
1909
  * All built-in modes.
1863
1910
  *
1864
- * Two modes: Agent (full access + workflow) and Chat (web access only)
1911
+ * Three modes:
1912
+ * - Agent (full access + workflow)
1913
+ * - Coding (concise, coding-focused workflow)
1914
+ * - Chat (web access only)
1865
1915
  */
1866
1916
  declare const BUILT_IN_MODES: readonly ModeConfig[];
1867
1917
  /**
@@ -1877,10 +1927,6 @@ declare class Planner {
1877
1927
  * Create a detailed step-by-step plan from the user's request.
1878
1928
  */
1879
1929
  createPlan(request: CompletionRequest, providerName?: string): Promise<Plan>;
1880
- /**
1881
- * Create a lightweight implicit plan when steps are enabled but planning phase is skipped.
1882
- */
1883
- createImplicitPlan(request: CompletionRequest, providerName?: string): Promise<Plan>;
1884
1930
  private parsePlan;
1885
1931
  private createFallbackPlan;
1886
1932
  }
@@ -1918,8 +1964,9 @@ declare class WorkflowExecutor extends EventEmitter {
1918
1964
  private config;
1919
1965
  private planner;
1920
1966
  private stepExecutor;
1967
+ private queryClassifier;
1921
1968
  private pendingApprovals;
1922
- constructor(client: AIClient, config: WorkflowConfig);
1969
+ constructor(client: AIClient, config: WorkflowConfig, queryClassifier?: QueryClassifier);
1923
1970
  /**
1924
1971
  * Get the active configuration.
1925
1972
  */
@@ -1928,6 +1975,11 @@ declare class WorkflowExecutor extends EventEmitter {
1928
1975
  * Update the configuration.
1929
1976
  */
1930
1977
  setConfig(config: WorkflowConfig): void;
1978
+ /**
1979
+ * Determine if a query should bypass full workflow and use direct execution.
1980
+ * Routes simple queries to single-step execution for performance optimization.
1981
+ */
1982
+ private shouldRouteSimpleQuery;
1931
1983
  /**
1932
1984
  * Execute a request using the configured workflow.
1933
1985
  */
@@ -1961,8 +2013,9 @@ declare class WorkflowExecutor extends EventEmitter {
1961
2013
  */
1962
2014
  private summarizePlanResult;
1963
2015
  /**
1964
- * Extract the final output from the last completed step.
1965
- * Returns the actual AI response instead of a workflow summary.
2016
+ * Extract the final output from the plan.
2017
+ * For plans with synthesis step: returns last step output.
2018
+ * For plans without synthesis: concatenates all step outputs.
1966
2019
  */
1967
2020
  private extractFinalOutput;
1968
2021
  /**
@@ -2004,6 +2057,47 @@ declare class WorkflowExecutor extends EventEmitter {
2004
2057
  rejectPlan(planId: string): void;
2005
2058
  }
2006
2059
 
2060
+ /**
2061
+ * Agent planning prompt.
2062
+ * Full detailed planning for general autonomous tasks.
2063
+ */
2064
+ declare const AGENT_PLANNING_PROMPT = "\nYou are a planning assistant. Given a user request, create a detailed step-by-step plan.\n\nRules:\n1. Break the task into clear, actionable steps\n2. Each step should be independently executable WITHOUT requiring additional user input\n3. Order steps by dependencies (what must happen first)\n4. Be specific about what each step will accomplish\n5. Estimate which tools will be needed for each step\n6. If the user's request is ambiguous, make reasonable assumptions and proceed - do NOT create steps that ask for clarification\n7. Steps should produce concrete outputs, not ask questions or wait for user input\n8. ALWAYS include at least one step, even for simple questions. For simple factual questions, create a single step like \"Provide the answer to [question]\"\n9. When a step uses information gathered by a previous step, set \"dependsOn\" to that step's number and phrase the description as \"Using the [data] from step N, [do something]\" instead of gathering it again\n10. For plans with MORE than 2 steps, the final step must synthesize the workflow's results into a concise deliverable, avoiding redundant word-for-word repetition of earlier step outputs. For plans with 1-2 steps, no synthesis step is needed.\n11. The exact result MUST be valid JSON matching this schema:\n{\n \"summary\": \"Brief description of the overall goal\",\n \"steps\": [\n {\n \"number\": 1,\n \"description\": \"What this step does\",\n \"expectedTools\": [\"tool.name\"],\n \"dependsOn\": []\n }\n ]\n}\n";
2065
+ /**
2066
+ * Agent step execution prompt.
2067
+ * Standard execution with detailed instructions.
2068
+ */
2069
+ declare const AGENT_STEP_PROMPT = "\nYou are executing step {stepNumber} of a plan.\n\nPlan summary: {planSummary}\n\nCurrent step: {stepDescription}\n\nPrevious steps completed:\n{previousStepsResults}\n\nExecute this step now. Use the available tools as needed to accomplish this specific step.\nMake reasonable assumptions if any details are ambiguous - do NOT ask the user for clarification or additional input.\nProduce concrete results based on the information available.\nIf you cannot complete this step, explain why.\n\nIMPORTANT: Your response should be written as if you are directly answering the user.\nDo NOT mention steps, plans, workflow details, or internal process in your response.\nDo NOT say things like \"Step 1 is complete\" or \"proceeding to the next step\".\nJust provide the actual answer or result naturally.\n";
2070
+ /**
2071
+ * Default workflow configuration.
2072
+ * Direct execution with no planning or steps.
2073
+ */
2074
+ declare const DEFAULT_WORKFLOW: WorkflowConfig;
2075
+ /**
2076
+ * Agent workflow configuration.
2077
+ * Full planning and step execution with dynamic steps disabled.
2078
+ */
2079
+ declare const AGENT_WORKFLOW: WorkflowConfig;
2080
+ /**
2081
+ * Concise planning prompt for coding tasks.
2082
+ * Minimal rules focused on actionable code changes.
2083
+ */
2084
+ declare const CODING_PLANNING_PROMPT = "\nCreate a step-by-step plan for this coding task.\n\nRules:\n1. Break into actionable steps using tools (read/write files, search code)\n2. Each step executes independently without user input\n3. Order by dependencies\n4. Individual steps: be concise and technical. No conversational filler.\n5. For >2 steps, final step summarizes changes with conversational explanation\n6. Output valid JSON: {\"summary\": \"...\", \"steps\": [{...}]}\n\nJSON Schema:\n{\n \"summary\": \"Brief description of the overall goal\",\n \"steps\": [\n {\n \"number\": 1,\n \"description\": \"What this step does\",\n \"expectedTools\": [\"tool.name\"],\n \"dependsOn\": []\n }\n ]\n}\n";
2085
+ /**
2086
+ * Concise step execution prompt for coding tasks.
2087
+ * No meta-commentary, focused on tool usage.
2088
+ */
2089
+ declare const CODING_STEP_PROMPT = "\nExecute step {stepNumber}: {stepDescription}\n\nPlan: {planSummary}\n\nPrevious: {previousStepsResults}\n\nUse tools. Be concise. Show code changes clearly.\nNo meta-commentary about steps or workflow.\n";
2090
+ /**
2091
+ * Coding workflow configuration.
2092
+ * Concise prompts optimized for software development tasks.
2093
+ */
2094
+ declare const CODING_WORKFLOW: WorkflowConfig;
2095
+ /**
2096
+ * Chat workflow configuration.
2097
+ * No planning or steps - direct conversational responses.
2098
+ */
2099
+ declare const CHAT_WORKFLOW: WorkflowConfig;
2100
+
2007
2101
  interface ProviderOptions {
2008
2102
  /**
2009
2103
  * API key for the provider.
@@ -2273,4 +2367,4 @@ interface McpServerCapabilities {
2273
2367
  prompts?: Record<string, any>;
2274
2368
  }
2275
2369
 
2276
- export { AGENT_MODE, AIClient, type AIClientConfig, AnthropicAdapter, AuthenticationError, BM25SearchEngine, BUILT_IN_MODES, CHAT_MODE, CONFIG_DIR_NAME, CONFIG_FILE_NAME, type CompletionChunk, type CompletionOptions, type CompletionRequest, type CompletionResponse, ConnectionError, DEFAULT_MODE_NAME, DEFAULT_TOOLS_CONFIG, DEFAULT_TOOL_SEARCH_CONFIG, DEFAULT_WORKFLOW_CONFIG, type EmbeddingRequest, type EmbeddingResponse, type FileUploadRequest, type FileUploadResponse, GeminiAdapter, type ImageDataPart, type ImageFilePart, type ImagePart, type ImageUrlPart, type IntelligentToolDetectionConfig, InvalidRequestError, type JsonRpcRequest, type JsonRpcResponse, type KnowledgeInstance, McpClient, type McpClientConfig, McpConnectionError, type McpServerCapabilities, type McpServerConfig, McpTimeoutError, type McpTool, McpToolManager, type McpToolsConfig, type MediaOptions, type MediaUploadStrategy, type Message, type MessageContent, type ModeBlockedHint, type ModeConfig, ModeRegistry, OllamaAdapter, type OllamaAdapterConfig, type OllamaModelInfo, OllamaProvider, type OllamaProviderEntry, OpenAIAdapter, PageError, type Plan, type PlanStep, Planner, ProviderAdapter, type ProviderConfig, ProviderError, type ProviderInfo, type ProviderModelInfo, type ProviderOptions, RateLimitError, type Role, type RuntimeConfigStatus, SDKError, type SearchHistoryEntry, type SearchOptions, type SearchResult, type SlmModelEntry, StepExecutor, TOOLPACK_DIR_NAME, TOOL_SEARCH_NAME, type TextPart, TimeoutError, type ToolCall, type ToolCallFunction, type ToolCallMessage, type ToolCallRequest, type ToolCallResult, type ToolCategory, type ToolContext, type ToolDefinition, ToolDiscoveryCache, type ToolLogEvent, type ToolParameterProperty, type ToolParameters, type ToolProgressEvent, type ToolProject, type ToolProjectDependencies, type ToolProjectManifest, ToolRegistry, type ToolResult, ToolRouter, type ToolSchema, type ToolSearchConfig, Toolpack, type ToolpackConfig, type ToolpackInitConfig, type ToolsConfig, type Usage, type WorkflowConfig, type WorkflowEvents, WorkflowExecutor, type WorkflowProgress, type WorkflowResult, cloudDeployTool, cloudListTool, cloudStatusTool, cloudToolsProject, codingFindSymbolTool, codingGetImportsTool, codingGetSymbolsTool, codingToolsProject, createMcpToolProject, createMode, createToolProject, dbCountTool, dbDeleteTool, dbInsertTool, dbQueryTool, dbSchemaTool, dbTablesTool, dbToolsProject, dbUpdateTool, diffApplyTool, diffCreateTool, diffPreviewTool, diffToolsProject, disconnectMcpToolProject, ensureGlobalConfigDir, ensureLocalConfigDir, execKillTool, execListProcessesTool, execReadOutputTool, execRunBackgroundTool, execRunShellTool, execRunTool, execToolsProject, fetchUrlAsBase64, fsAppendFileTool, fsCopyTool, fsCreateDirTool, fsDeleteFileTool, fsExistsTool, fsListDirTool, fsMoveTool, fsReadFileRangeTool, fsReadFileTool, fsReplaceInFileTool, fsSearchTool, fsStatTool, fsToolsProject, fsTreeTool, fsWriteFileTool, generateToolCategoriesPrompt, getDefaultSlmModel, getGlobalConfigDir, getGlobalConfigPath, getGlobalToolpackDir, getLocalConfigDir, getLocalConfigPath, getLocalToolpackDir, getMimeType, getOllamaBaseUrl, getOllamaProviderEntries, getRegisteredSlmModels, getRuntimeConfigStatus, getToolSearchSchema, getToolpackConfig, getUserHomeDir, gitAddTool, gitBlameTool, gitBranchCreateTool, gitBranchListTool, gitCheckoutTool, gitCommitTool, gitDiffTool, gitLogTool, gitStatusTool, gitToolsProject, httpDeleteTool, httpDownloadTool, httpGetTool, httpPostTool, httpPutTool, httpToolsProject, initializeGlobalConfigIfFirstRun, isDataUri, isRegisteredSlm, isToolSearchTool, loadFullConfig, loadRuntimeConfig, loadToolsConfig, normalizeImagePart, ollamaRequest, ollamaStream, parseDataUri, readFileAsBase64, reloadToolpackConfig, saveToolsConfig, systemCwdTool, systemDiskUsageTool, systemEnvTool, systemInfoTool, systemSetEnvTool, systemToolsProject, toDataUri, toolSearchDefinition, webExtractLinksTool, webFetchTool, webScrapeTool, webSearchTool, webToolsProject };
2370
+ export { AGENT_MODE, AGENT_PLANNING_PROMPT, AGENT_STEP_PROMPT, AGENT_WORKFLOW, AIClient, type AIClientConfig, AnthropicAdapter, AuthenticationError, BM25SearchEngine, BUILT_IN_MODES, CHAT_MODE, CHAT_WORKFLOW, CODING_PLANNING_PROMPT, CODING_STEP_PROMPT, CODING_WORKFLOW, CONFIG_DIR_NAME, CONFIG_FILE_NAME, type CompletionChunk, type CompletionOptions, type CompletionRequest, type CompletionResponse, ConnectionError, DEFAULT_MODE_NAME, DEFAULT_TOOLS_CONFIG, DEFAULT_TOOL_SEARCH_CONFIG, DEFAULT_WORKFLOW, DEFAULT_WORKFLOW_CONFIG, type EmbeddingRequest, type EmbeddingResponse, type FileUploadRequest, type FileUploadResponse, GeminiAdapter, type ImageDataPart, type ImageFilePart, type ImagePart, type ImageUrlPart, type IntelligentToolDetectionConfig, InvalidRequestError, type JsonRpcRequest, type JsonRpcResponse, type KnowledgeInstance, McpClient, type McpClientConfig, McpConnectionError, type McpServerCapabilities, type McpServerConfig, McpTimeoutError, type McpTool, McpToolManager, type McpToolsConfig, type MediaOptions, type MediaUploadStrategy, type Message, type MessageContent, type ModeBlockedHint, type ModeConfig, ModeRegistry, OllamaAdapter, type OllamaAdapterConfig, type OllamaModelInfo, OllamaProvider, type OllamaProviderEntry, OpenAIAdapter, PageError, type Plan, type PlanStep, Planner, ProviderAdapter, type ProviderConfig, ProviderError, type ProviderInfo, type ProviderModelInfo, type ProviderOptions, RateLimitError, type Role, type RuntimeConfigStatus, SDKError, type SearchHistoryEntry, type SearchOptions, type SearchResult, type SlmModelEntry, StepExecutor, TOOLPACK_DIR_NAME, TOOL_SEARCH_NAME, type TextPart, TimeoutError, type ToolCall, type ToolCallFunction, type ToolCallMessage, type ToolCallRequest, type ToolCallResult, type ToolCategory, type ToolContext, type ToolDefinition, ToolDiscoveryCache, type ToolLogEvent, type ToolParameterProperty, type ToolParameters, type ToolProgressEvent, type ToolProject, type ToolProjectDependencies, type ToolProjectManifest, ToolRegistry, type ToolResult, ToolRouter, type ToolSchema, type ToolSearchConfig, Toolpack, type ToolpackConfig, type ToolpackInitConfig, type ToolsConfig, type Usage, type WorkflowConfig, type WorkflowEvents, WorkflowExecutor, type WorkflowProgress, type WorkflowResult, cloudDeployTool, cloudListTool, cloudStatusTool, cloudToolsProject, codingFindSymbolTool, codingGetImportsTool, codingGetSymbolsTool, codingToolsProject, createMcpToolProject, createMode, createToolProject, dbCountTool, dbDeleteTool, dbInsertTool, dbQueryTool, dbSchemaTool, dbTablesTool, dbToolsProject, dbUpdateTool, diffApplyTool, diffCreateTool, diffPreviewTool, diffToolsProject, disconnectMcpToolProject, ensureGlobalConfigDir, ensureLocalConfigDir, execKillTool, execListProcessesTool, execReadOutputTool, execRunBackgroundTool, execRunShellTool, execRunTool, execToolsProject, fetchUrlAsBase64, fsAppendFileTool, fsCopyTool, fsCreateDirTool, fsDeleteFileTool, fsExistsTool, fsListDirTool, fsMoveTool, fsReadFileRangeTool, fsReadFileTool, fsReplaceInFileTool, fsSearchTool, fsStatTool, fsToolsProject, fsTreeTool, fsWriteFileTool, generateToolCategoriesPrompt, getDefaultSlmModel, getGlobalConfigDir, getGlobalConfigPath, getGlobalToolpackDir, getLocalConfigDir, getLocalConfigPath, getLocalToolpackDir, getMimeType, getOllamaBaseUrl, getOllamaProviderEntries, getRegisteredSlmModels, getRuntimeConfigStatus, getToolSearchSchema, getToolpackConfig, getUserHomeDir, gitAddTool, gitBlameTool, gitBranchCreateTool, gitBranchListTool, gitCheckoutTool, gitCommitTool, gitDiffTool, gitLogTool, gitStatusTool, gitToolsProject, httpDeleteTool, httpDownloadTool, httpGetTool, httpPostTool, httpPutTool, httpToolsProject, initializeGlobalConfigIfFirstRun, isDataUri, isRegisteredSlm, isToolSearchTool, loadFullConfig, loadRuntimeConfig, loadToolsConfig, normalizeImagePart, ollamaRequest, ollamaStream, parseDataUri, readFileAsBase64, reloadToolpackConfig, saveToolsConfig, systemCwdTool, systemDiskUsageTool, systemEnvTool, systemInfoTool, systemSetEnvTool, systemToolsProject, toDataUri, toolSearchDefinition, webExtractLinksTool, webFetchTool, webScrapeTool, webSearchTool, webToolsProject };
package/dist/index.d.ts CHANGED
@@ -592,6 +592,10 @@ interface Plan {
592
592
  }
593
593
 
594
594
  interface WorkflowConfig {
595
+ /**
596
+ * Workflow name for display purposes.
597
+ */
598
+ name?: string;
595
599
  /**
596
600
  * Planning phase configuration.
597
601
  * If enabled, AI generates a plan before executing.
@@ -621,6 +625,8 @@ interface WorkflowConfig {
621
625
  allowDynamicSteps?: boolean;
622
626
  /** Maximum total steps (including dynamic). Default: 50 */
623
627
  maxTotalSteps?: number;
628
+ /** Custom step execution prompt. Default: uses built-in STEP_EXECUTION_PROMPT */
629
+ stepPrompt?: string;
624
630
  };
625
631
  /**
626
632
  * Progress reporting configuration.
@@ -636,9 +642,19 @@ interface WorkflowConfig {
636
642
  */
637
643
  onFailure?: {
638
644
  /** Strategy when a step fails after all retries. Default: 'abort' */
639
- strategy: 'abort' | 'skip' | 'ask_user' | 'try_alternative';
640
- /** If 'try_alternative', allow AI to choose a different approach */
641
- allowAlternativePath?: boolean;
645
+ strategy: 'abort' | 'skip' | 'ask_user';
646
+ };
647
+ /**
648
+ * Query complexity routing configuration.
649
+ * Routes simple queries to faster execution paths based on query classification.
650
+ */
651
+ complexityRouting?: {
652
+ /** Enable complexity-based routing. Default: false (opt-in) */
653
+ enabled: boolean;
654
+ /** Routing strategy for simple queries. Default: 'single-step' */
655
+ strategy: 'single-step' | 'bypass' | 'disabled';
656
+ /** Confidence threshold for routing analytical queries. Default: 0.6 */
657
+ confidenceThreshold?: number;
642
658
  };
643
659
  }
644
660
  /**
@@ -772,6 +788,33 @@ interface ModeBlockedHint {
772
788
  suggestedMode: string;
773
789
  }
774
790
 
791
+ /**
792
+ * Query Classifier for Tool Orchestration
793
+ *
794
+ * Classifies user queries into analytical, action, or conversational types
795
+ * to optimize tool execution strategy (e.g., adjust maxToolRounds).
796
+ */
797
+ type QueryType = 'analytical' | 'action' | 'conversational';
798
+ interface QueryClassification {
799
+ type: QueryType;
800
+ confidence: number;
801
+ reasoning?: string;
802
+ }
803
+ declare class QueryClassifier {
804
+ private analyticalPatterns;
805
+ private actionPatterns;
806
+ /**
807
+ * Classify a user query based on pattern matching.
808
+ * Returns the query type and confidence score.
809
+ */
810
+ classify(userMessage: string): QueryClassification;
811
+ /**
812
+ * Get recommended maxToolRounds adjustment based on query type.
813
+ * Returns a multiplier or bonus rounds.
814
+ */
815
+ getToolRoundsAdjustment(classification: QueryClassification, baseRounds: number): number;
816
+ }
817
+
775
818
  interface AIClientConfig {
776
819
  providers: Record<string, ProviderAdapter>;
777
820
  defaultProvider?: string;
@@ -835,6 +878,10 @@ declare class AIClient extends EventEmitter {
835
878
  * Get the currently active mode.
836
879
  */
837
880
  getMode(): ModeConfig | null;
881
+ /**
882
+ * Get the query classifier instance.
883
+ */
884
+ getQueryClassifier(): QueryClassifier;
838
885
  /**
839
886
  * Re-index tools for BM25 search.
840
887
  * Call this after adding/removing tools from the registry.
@@ -1861,7 +1908,10 @@ declare const CHAT_MODE: ModeConfig;
1861
1908
  /**
1862
1909
  * All built-in modes.
1863
1910
  *
1864
- * Two modes: Agent (full access + workflow) and Chat (web access only)
1911
+ * Three modes:
1912
+ * - Agent (full access + workflow)
1913
+ * - Coding (concise, coding-focused workflow)
1914
+ * - Chat (web access only)
1865
1915
  */
1866
1916
  declare const BUILT_IN_MODES: readonly ModeConfig[];
1867
1917
  /**
@@ -1877,10 +1927,6 @@ declare class Planner {
1877
1927
  * Create a detailed step-by-step plan from the user's request.
1878
1928
  */
1879
1929
  createPlan(request: CompletionRequest, providerName?: string): Promise<Plan>;
1880
- /**
1881
- * Create a lightweight implicit plan when steps are enabled but planning phase is skipped.
1882
- */
1883
- createImplicitPlan(request: CompletionRequest, providerName?: string): Promise<Plan>;
1884
1930
  private parsePlan;
1885
1931
  private createFallbackPlan;
1886
1932
  }
@@ -1918,8 +1964,9 @@ declare class WorkflowExecutor extends EventEmitter {
1918
1964
  private config;
1919
1965
  private planner;
1920
1966
  private stepExecutor;
1967
+ private queryClassifier;
1921
1968
  private pendingApprovals;
1922
- constructor(client: AIClient, config: WorkflowConfig);
1969
+ constructor(client: AIClient, config: WorkflowConfig, queryClassifier?: QueryClassifier);
1923
1970
  /**
1924
1971
  * Get the active configuration.
1925
1972
  */
@@ -1928,6 +1975,11 @@ declare class WorkflowExecutor extends EventEmitter {
1928
1975
  * Update the configuration.
1929
1976
  */
1930
1977
  setConfig(config: WorkflowConfig): void;
1978
+ /**
1979
+ * Determine if a query should bypass full workflow and use direct execution.
1980
+ * Routes simple queries to single-step execution for performance optimization.
1981
+ */
1982
+ private shouldRouteSimpleQuery;
1931
1983
  /**
1932
1984
  * Execute a request using the configured workflow.
1933
1985
  */
@@ -1961,8 +2013,9 @@ declare class WorkflowExecutor extends EventEmitter {
1961
2013
  */
1962
2014
  private summarizePlanResult;
1963
2015
  /**
1964
- * Extract the final output from the last completed step.
1965
- * Returns the actual AI response instead of a workflow summary.
2016
+ * Extract the final output from the plan.
2017
+ * For plans with synthesis step: returns last step output.
2018
+ * For plans without synthesis: concatenates all step outputs.
1966
2019
  */
1967
2020
  private extractFinalOutput;
1968
2021
  /**
@@ -2004,6 +2057,47 @@ declare class WorkflowExecutor extends EventEmitter {
2004
2057
  rejectPlan(planId: string): void;
2005
2058
  }
2006
2059
 
2060
+ /**
2061
+ * Agent planning prompt.
2062
+ * Full detailed planning for general autonomous tasks.
2063
+ */
2064
+ declare const AGENT_PLANNING_PROMPT = "\nYou are a planning assistant. Given a user request, create a detailed step-by-step plan.\n\nRules:\n1. Break the task into clear, actionable steps\n2. Each step should be independently executable WITHOUT requiring additional user input\n3. Order steps by dependencies (what must happen first)\n4. Be specific about what each step will accomplish\n5. Estimate which tools will be needed for each step\n6. If the user's request is ambiguous, make reasonable assumptions and proceed - do NOT create steps that ask for clarification\n7. Steps should produce concrete outputs, not ask questions or wait for user input\n8. ALWAYS include at least one step, even for simple questions. For simple factual questions, create a single step like \"Provide the answer to [question]\"\n9. When a step uses information gathered by a previous step, set \"dependsOn\" to that step's number and phrase the description as \"Using the [data] from step N, [do something]\" instead of gathering it again\n10. For plans with MORE than 2 steps, the final step must synthesize the workflow's results into a concise deliverable, avoiding redundant word-for-word repetition of earlier step outputs. For plans with 1-2 steps, no synthesis step is needed.\n11. The exact result MUST be valid JSON matching this schema:\n{\n \"summary\": \"Brief description of the overall goal\",\n \"steps\": [\n {\n \"number\": 1,\n \"description\": \"What this step does\",\n \"expectedTools\": [\"tool.name\"],\n \"dependsOn\": []\n }\n ]\n}\n";
2065
+ /**
2066
+ * Agent step execution prompt.
2067
+ * Standard execution with detailed instructions.
2068
+ */
2069
+ declare const AGENT_STEP_PROMPT = "\nYou are executing step {stepNumber} of a plan.\n\nPlan summary: {planSummary}\n\nCurrent step: {stepDescription}\n\nPrevious steps completed:\n{previousStepsResults}\n\nExecute this step now. Use the available tools as needed to accomplish this specific step.\nMake reasonable assumptions if any details are ambiguous - do NOT ask the user for clarification or additional input.\nProduce concrete results based on the information available.\nIf you cannot complete this step, explain why.\n\nIMPORTANT: Your response should be written as if you are directly answering the user.\nDo NOT mention steps, plans, workflow details, or internal process in your response.\nDo NOT say things like \"Step 1 is complete\" or \"proceeding to the next step\".\nJust provide the actual answer or result naturally.\n";
2070
+ /**
2071
+ * Default workflow configuration.
2072
+ * Direct execution with no planning or steps.
2073
+ */
2074
+ declare const DEFAULT_WORKFLOW: WorkflowConfig;
2075
+ /**
2076
+ * Agent workflow configuration.
2077
+ * Full planning and step execution with dynamic steps disabled.
2078
+ */
2079
+ declare const AGENT_WORKFLOW: WorkflowConfig;
2080
+ /**
2081
+ * Concise planning prompt for coding tasks.
2082
+ * Minimal rules focused on actionable code changes.
2083
+ */
2084
+ declare const CODING_PLANNING_PROMPT = "\nCreate a step-by-step plan for this coding task.\n\nRules:\n1. Break into actionable steps using tools (read/write files, search code)\n2. Each step executes independently without user input\n3. Order by dependencies\n4. Individual steps: be concise and technical. No conversational filler.\n5. For >2 steps, final step summarizes changes with conversational explanation\n6. Output valid JSON: {\"summary\": \"...\", \"steps\": [{...}]}\n\nJSON Schema:\n{\n \"summary\": \"Brief description of the overall goal\",\n \"steps\": [\n {\n \"number\": 1,\n \"description\": \"What this step does\",\n \"expectedTools\": [\"tool.name\"],\n \"dependsOn\": []\n }\n ]\n}\n";
2085
+ /**
2086
+ * Concise step execution prompt for coding tasks.
2087
+ * No meta-commentary, focused on tool usage.
2088
+ */
2089
+ declare const CODING_STEP_PROMPT = "\nExecute step {stepNumber}: {stepDescription}\n\nPlan: {planSummary}\n\nPrevious: {previousStepsResults}\n\nUse tools. Be concise. Show code changes clearly.\nNo meta-commentary about steps or workflow.\n";
2090
+ /**
2091
+ * Coding workflow configuration.
2092
+ * Concise prompts optimized for software development tasks.
2093
+ */
2094
+ declare const CODING_WORKFLOW: WorkflowConfig;
2095
+ /**
2096
+ * Chat workflow configuration.
2097
+ * No planning or steps - direct conversational responses.
2098
+ */
2099
+ declare const CHAT_WORKFLOW: WorkflowConfig;
2100
+
2007
2101
  interface ProviderOptions {
2008
2102
  /**
2009
2103
  * API key for the provider.
@@ -2273,4 +2367,4 @@ interface McpServerCapabilities {
2273
2367
  prompts?: Record<string, any>;
2274
2368
  }
2275
2369
 
2276
- export { AGENT_MODE, AIClient, type AIClientConfig, AnthropicAdapter, AuthenticationError, BM25SearchEngine, BUILT_IN_MODES, CHAT_MODE, CONFIG_DIR_NAME, CONFIG_FILE_NAME, type CompletionChunk, type CompletionOptions, type CompletionRequest, type CompletionResponse, ConnectionError, DEFAULT_MODE_NAME, DEFAULT_TOOLS_CONFIG, DEFAULT_TOOL_SEARCH_CONFIG, DEFAULT_WORKFLOW_CONFIG, type EmbeddingRequest, type EmbeddingResponse, type FileUploadRequest, type FileUploadResponse, GeminiAdapter, type ImageDataPart, type ImageFilePart, type ImagePart, type ImageUrlPart, type IntelligentToolDetectionConfig, InvalidRequestError, type JsonRpcRequest, type JsonRpcResponse, type KnowledgeInstance, McpClient, type McpClientConfig, McpConnectionError, type McpServerCapabilities, type McpServerConfig, McpTimeoutError, type McpTool, McpToolManager, type McpToolsConfig, type MediaOptions, type MediaUploadStrategy, type Message, type MessageContent, type ModeBlockedHint, type ModeConfig, ModeRegistry, OllamaAdapter, type OllamaAdapterConfig, type OllamaModelInfo, OllamaProvider, type OllamaProviderEntry, OpenAIAdapter, PageError, type Plan, type PlanStep, Planner, ProviderAdapter, type ProviderConfig, ProviderError, type ProviderInfo, type ProviderModelInfo, type ProviderOptions, RateLimitError, type Role, type RuntimeConfigStatus, SDKError, type SearchHistoryEntry, type SearchOptions, type SearchResult, type SlmModelEntry, StepExecutor, TOOLPACK_DIR_NAME, TOOL_SEARCH_NAME, type TextPart, TimeoutError, type ToolCall, type ToolCallFunction, type ToolCallMessage, type ToolCallRequest, type ToolCallResult, type ToolCategory, type ToolContext, type ToolDefinition, ToolDiscoveryCache, type ToolLogEvent, type ToolParameterProperty, type ToolParameters, type ToolProgressEvent, type ToolProject, type ToolProjectDependencies, type ToolProjectManifest, ToolRegistry, type ToolResult, ToolRouter, type ToolSchema, type ToolSearchConfig, Toolpack, type ToolpackConfig, type ToolpackInitConfig, type ToolsConfig, type Usage, type WorkflowConfig, type WorkflowEvents, WorkflowExecutor, type WorkflowProgress, type WorkflowResult, cloudDeployTool, cloudListTool, cloudStatusTool, cloudToolsProject, codingFindSymbolTool, codingGetImportsTool, codingGetSymbolsTool, codingToolsProject, createMcpToolProject, createMode, createToolProject, dbCountTool, dbDeleteTool, dbInsertTool, dbQueryTool, dbSchemaTool, dbTablesTool, dbToolsProject, dbUpdateTool, diffApplyTool, diffCreateTool, diffPreviewTool, diffToolsProject, disconnectMcpToolProject, ensureGlobalConfigDir, ensureLocalConfigDir, execKillTool, execListProcessesTool, execReadOutputTool, execRunBackgroundTool, execRunShellTool, execRunTool, execToolsProject, fetchUrlAsBase64, fsAppendFileTool, fsCopyTool, fsCreateDirTool, fsDeleteFileTool, fsExistsTool, fsListDirTool, fsMoveTool, fsReadFileRangeTool, fsReadFileTool, fsReplaceInFileTool, fsSearchTool, fsStatTool, fsToolsProject, fsTreeTool, fsWriteFileTool, generateToolCategoriesPrompt, getDefaultSlmModel, getGlobalConfigDir, getGlobalConfigPath, getGlobalToolpackDir, getLocalConfigDir, getLocalConfigPath, getLocalToolpackDir, getMimeType, getOllamaBaseUrl, getOllamaProviderEntries, getRegisteredSlmModels, getRuntimeConfigStatus, getToolSearchSchema, getToolpackConfig, getUserHomeDir, gitAddTool, gitBlameTool, gitBranchCreateTool, gitBranchListTool, gitCheckoutTool, gitCommitTool, gitDiffTool, gitLogTool, gitStatusTool, gitToolsProject, httpDeleteTool, httpDownloadTool, httpGetTool, httpPostTool, httpPutTool, httpToolsProject, initializeGlobalConfigIfFirstRun, isDataUri, isRegisteredSlm, isToolSearchTool, loadFullConfig, loadRuntimeConfig, loadToolsConfig, normalizeImagePart, ollamaRequest, ollamaStream, parseDataUri, readFileAsBase64, reloadToolpackConfig, saveToolsConfig, systemCwdTool, systemDiskUsageTool, systemEnvTool, systemInfoTool, systemSetEnvTool, systemToolsProject, toDataUri, toolSearchDefinition, webExtractLinksTool, webFetchTool, webScrapeTool, webSearchTool, webToolsProject };
2370
+ export { AGENT_MODE, AGENT_PLANNING_PROMPT, AGENT_STEP_PROMPT, AGENT_WORKFLOW, AIClient, type AIClientConfig, AnthropicAdapter, AuthenticationError, BM25SearchEngine, BUILT_IN_MODES, CHAT_MODE, CHAT_WORKFLOW, CODING_PLANNING_PROMPT, CODING_STEP_PROMPT, CODING_WORKFLOW, CONFIG_DIR_NAME, CONFIG_FILE_NAME, type CompletionChunk, type CompletionOptions, type CompletionRequest, type CompletionResponse, ConnectionError, DEFAULT_MODE_NAME, DEFAULT_TOOLS_CONFIG, DEFAULT_TOOL_SEARCH_CONFIG, DEFAULT_WORKFLOW, DEFAULT_WORKFLOW_CONFIG, type EmbeddingRequest, type EmbeddingResponse, type FileUploadRequest, type FileUploadResponse, GeminiAdapter, type ImageDataPart, type ImageFilePart, type ImagePart, type ImageUrlPart, type IntelligentToolDetectionConfig, InvalidRequestError, type JsonRpcRequest, type JsonRpcResponse, type KnowledgeInstance, McpClient, type McpClientConfig, McpConnectionError, type McpServerCapabilities, type McpServerConfig, McpTimeoutError, type McpTool, McpToolManager, type McpToolsConfig, type MediaOptions, type MediaUploadStrategy, type Message, type MessageContent, type ModeBlockedHint, type ModeConfig, ModeRegistry, OllamaAdapter, type OllamaAdapterConfig, type OllamaModelInfo, OllamaProvider, type OllamaProviderEntry, OpenAIAdapter, PageError, type Plan, type PlanStep, Planner, ProviderAdapter, type ProviderConfig, ProviderError, type ProviderInfo, type ProviderModelInfo, type ProviderOptions, RateLimitError, type Role, type RuntimeConfigStatus, SDKError, type SearchHistoryEntry, type SearchOptions, type SearchResult, type SlmModelEntry, StepExecutor, TOOLPACK_DIR_NAME, TOOL_SEARCH_NAME, type TextPart, TimeoutError, type ToolCall, type ToolCallFunction, type ToolCallMessage, type ToolCallRequest, type ToolCallResult, type ToolCategory, type ToolContext, type ToolDefinition, ToolDiscoveryCache, type ToolLogEvent, type ToolParameterProperty, type ToolParameters, type ToolProgressEvent, type ToolProject, type ToolProjectDependencies, type ToolProjectManifest, ToolRegistry, type ToolResult, ToolRouter, type ToolSchema, type ToolSearchConfig, Toolpack, type ToolpackConfig, type ToolpackInitConfig, type ToolsConfig, type Usage, type WorkflowConfig, type WorkflowEvents, WorkflowExecutor, type WorkflowProgress, type WorkflowResult, cloudDeployTool, cloudListTool, cloudStatusTool, cloudToolsProject, codingFindSymbolTool, codingGetImportsTool, codingGetSymbolsTool, codingToolsProject, createMcpToolProject, createMode, createToolProject, dbCountTool, dbDeleteTool, dbInsertTool, dbQueryTool, dbSchemaTool, dbTablesTool, dbToolsProject, dbUpdateTool, diffApplyTool, diffCreateTool, diffPreviewTool, diffToolsProject, disconnectMcpToolProject, ensureGlobalConfigDir, ensureLocalConfigDir, execKillTool, execListProcessesTool, execReadOutputTool, execRunBackgroundTool, execRunShellTool, execRunTool, execToolsProject, fetchUrlAsBase64, fsAppendFileTool, fsCopyTool, fsCreateDirTool, fsDeleteFileTool, fsExistsTool, fsListDirTool, fsMoveTool, fsReadFileRangeTool, fsReadFileTool, fsReplaceInFileTool, fsSearchTool, fsStatTool, fsToolsProject, fsTreeTool, fsWriteFileTool, generateToolCategoriesPrompt, getDefaultSlmModel, getGlobalConfigDir, getGlobalConfigPath, getGlobalToolpackDir, getLocalConfigDir, getLocalConfigPath, getLocalToolpackDir, getMimeType, getOllamaBaseUrl, getOllamaProviderEntries, getRegisteredSlmModels, getRuntimeConfigStatus, getToolSearchSchema, getToolpackConfig, getUserHomeDir, gitAddTool, gitBlameTool, gitBranchCreateTool, gitBranchListTool, gitCheckoutTool, gitCommitTool, gitDiffTool, gitLogTool, gitStatusTool, gitToolsProject, httpDeleteTool, httpDownloadTool, httpGetTool, httpPostTool, httpPutTool, httpToolsProject, initializeGlobalConfigIfFirstRun, isDataUri, isRegisteredSlm, isToolSearchTool, loadFullConfig, loadRuntimeConfig, loadToolsConfig, normalizeImagePart, ollamaRequest, ollamaStream, parseDataUri, readFileAsBase64, reloadToolpackConfig, saveToolsConfig, systemCwdTool, systemDiskUsageTool, systemEnvTool, systemInfoTool, systemSetEnvTool, systemToolsProject, toDataUri, toolSearchDefinition, webExtractLinksTool, webFetchTool, webScrapeTool, webSearchTool, webToolsProject };