toolpack-sdk 3.0.0 → 3.2.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/README.md +57 -31
- package/dist/index.cjs +123 -137
- package/dist/index.d.cts +102 -23
- package/dist/index.d.ts +102 -23
- package/dist/index.js +130 -144
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -497,12 +497,6 @@ interface ModeConfig {
|
|
|
497
497
|
* Shorthand for "no tool calls at all".
|
|
498
498
|
*/
|
|
499
499
|
blockAllTools: boolean;
|
|
500
|
-
/**
|
|
501
|
-
* Whether to auto-inject relevant skill content into the system prompt
|
|
502
|
-
* via BM25 matching of the user's message (skill interceptor).
|
|
503
|
-
* Default: false — opt-in only. Set to true to enable auto-injection.
|
|
504
|
-
*/
|
|
505
|
-
skillInterceptor?: boolean;
|
|
506
500
|
/**
|
|
507
501
|
* Root directory for rule files.
|
|
508
502
|
* Auto-discovers:
|
|
@@ -579,7 +573,29 @@ interface ImageUrlPart {
|
|
|
579
573
|
};
|
|
580
574
|
}
|
|
581
575
|
type ImagePart = ImageDataPart | ImageFilePart | ImageUrlPart;
|
|
582
|
-
|
|
576
|
+
interface FilePart {
|
|
577
|
+
type: 'file';
|
|
578
|
+
file: {
|
|
579
|
+
/** Public or pre-signed bucket URL */
|
|
580
|
+
url: string;
|
|
581
|
+
/** MIME type, e.g. 'image/jpeg', 'application/pdf' */
|
|
582
|
+
mimeType: string;
|
|
583
|
+
/** Original filename, for display only */
|
|
584
|
+
name?: string;
|
|
585
|
+
/** File size in bytes — used for client-side validation */
|
|
586
|
+
size?: number;
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
declare const FILE_LIMITS: {
|
|
590
|
+
readonly image: {
|
|
591
|
+
readonly maxBytes: number;
|
|
592
|
+
};
|
|
593
|
+
readonly document: {
|
|
594
|
+
readonly maxBytes: number;
|
|
595
|
+
readonly maxPages: 20;
|
|
596
|
+
};
|
|
597
|
+
};
|
|
598
|
+
type MessageContent = string | (TextPart | ImagePart | FilePart)[] | null;
|
|
583
599
|
type MediaUploadStrategy = 'inline' | 'upload' | 'auto';
|
|
584
600
|
interface MediaOptions {
|
|
585
601
|
/** How to handle image payloads */
|
|
@@ -2035,9 +2051,10 @@ declare class ToolDiscoveryCache {
|
|
|
2035
2051
|
declare const TOOL_SEARCH_NAME = "tool.search";
|
|
2036
2052
|
declare const toolSearchDefinition: ToolDefinition;
|
|
2037
2053
|
/**
|
|
2038
|
-
* Get the tool.search schema
|
|
2054
|
+
* Get the tool.search schema, optionally with a dynamic category enum
|
|
2055
|
+
* derived from the currently registered tool categories.
|
|
2039
2056
|
*/
|
|
2040
|
-
declare function getToolSearchSchema(): ToolSchema;
|
|
2057
|
+
declare function getToolSearchSchema(categories?: string[]): ToolSchema;
|
|
2041
2058
|
/**
|
|
2042
2059
|
* Check if a tool name is the tool.search meta-tool.
|
|
2043
2060
|
*/
|
|
@@ -2548,12 +2565,6 @@ interface Skill {
|
|
|
2548
2565
|
examples?: string;
|
|
2549
2566
|
lastModified: number;
|
|
2550
2567
|
}
|
|
2551
|
-
interface SkillInterceptorOptions {
|
|
2552
|
-
dir?: string;
|
|
2553
|
-
maxSkills?: number;
|
|
2554
|
-
minScore?: number;
|
|
2555
|
-
onValidationError?: SkillValidationMode;
|
|
2556
|
-
}
|
|
2557
2568
|
interface SkillToolsOptions {
|
|
2558
2569
|
/** Skills directory. Default: '.toolpack/skills' */
|
|
2559
2570
|
dir?: string;
|
|
@@ -2674,11 +2685,6 @@ declare function createMode(config: {
|
|
|
2674
2685
|
enabled: boolean;
|
|
2675
2686
|
};
|
|
2676
2687
|
};
|
|
2677
|
-
/**
|
|
2678
|
-
* Enable auto-injection of BM25-matched skill content into the system prompt.
|
|
2679
|
-
* Default: false — opt-in only.
|
|
2680
|
-
*/
|
|
2681
|
-
skillInterceptor?: boolean;
|
|
2682
2688
|
/**
|
|
2683
2689
|
* Root directory for rule files for this mode.
|
|
2684
2690
|
* Auto-discovers __global__/ and <mode-name>/ subfolders within it.
|
|
@@ -3156,6 +3162,12 @@ interface ToolpackInitConfig {
|
|
|
3156
3162
|
region?: string;
|
|
3157
3163
|
/** Load built-in tools (fs, http, etc.)? Default: false */
|
|
3158
3164
|
tools?: boolean;
|
|
3165
|
+
/**
|
|
3166
|
+
* Tool projects that override built-in tools by name.
|
|
3167
|
+
* Loaded after built-ins, so any tool with the same name replaces the built-in version.
|
|
3168
|
+
* Also used to extend the tool.search category enum dynamically.
|
|
3169
|
+
*/
|
|
3170
|
+
toolOverrides?: ToolProject[];
|
|
3159
3171
|
/** Context window management configuration for automatic conversation pruning/summarization */
|
|
3160
3172
|
contextWindow?: ContextWindowConfig;
|
|
3161
3173
|
/**
|
|
@@ -3268,8 +3280,18 @@ declare class Toolpack extends EventEmitter {
|
|
|
3268
3280
|
customProviderNames: Set<string>;
|
|
3269
3281
|
private mcpToolProject;
|
|
3270
3282
|
private _interceptors;
|
|
3283
|
+
private _instanceRequestTools;
|
|
3271
3284
|
private constructor();
|
|
3272
|
-
private
|
|
3285
|
+
private _buildKnowledgeRequestTools;
|
|
3286
|
+
/**
|
|
3287
|
+
* Register tools that bypass mode filtering and are always available to the model.
|
|
3288
|
+
* Use this for tools that must be accessible regardless of allowedToolCategories —
|
|
3289
|
+
* the same mechanism used by knowledge, skill, and scheduler tools internally.
|
|
3290
|
+
*
|
|
3291
|
+
* Prefer `loadRequestToolProject` when you have a ToolProject; call this directly
|
|
3292
|
+
* when you have a plain RequestToolDefinition array.
|
|
3293
|
+
*/
|
|
3294
|
+
registerRequestTools(tools: RequestToolDefinition[]): void;
|
|
3273
3295
|
private prepareRequest;
|
|
3274
3296
|
/**
|
|
3275
3297
|
* Initialize the Toolpack SDK.
|
|
@@ -3327,6 +3349,32 @@ declare class Toolpack extends EventEmitter {
|
|
|
3327
3349
|
* Validates dependencies and registers all tools.
|
|
3328
3350
|
*/
|
|
3329
3351
|
loadToolProject(project: ToolProject): Promise<void>;
|
|
3352
|
+
/**
|
|
3353
|
+
* Load multiple tool projects at runtime, rebuilding the BM25 index once after all are registered.
|
|
3354
|
+
*/
|
|
3355
|
+
loadToolProjects(projects: ToolProject[]): Promise<void>;
|
|
3356
|
+
/**
|
|
3357
|
+
* Register a tool project's tools as request tools, bypassing mode filtering entirely.
|
|
3358
|
+
* Use this instead of loadToolProject when the tools must always be available regardless
|
|
3359
|
+
* of allowedToolCategories (analogous to how knowledge and mind tools bypass filtering).
|
|
3360
|
+
*/
|
|
3361
|
+
loadRequestToolProject(project: ToolProject): void;
|
|
3362
|
+
/**
|
|
3363
|
+
* Search registered tools using BM25. Returns parsed search results ranked by relevance.
|
|
3364
|
+
* Useful for inspecting what tools are available and verifiable in tests.
|
|
3365
|
+
*/
|
|
3366
|
+
searchTools(query: string, category?: string): {
|
|
3367
|
+
found: number;
|
|
3368
|
+
tools: {
|
|
3369
|
+
name: string;
|
|
3370
|
+
description: string;
|
|
3371
|
+
category: string;
|
|
3372
|
+
}[];
|
|
3373
|
+
};
|
|
3374
|
+
/**
|
|
3375
|
+
* Get all registered tool names. Useful for verifying tool registration in tests.
|
|
3376
|
+
*/
|
|
3377
|
+
getRegisteredToolNames(): string[];
|
|
3330
3378
|
/**
|
|
3331
3379
|
* Expose Toolpack's built-in tools as an MCP server.
|
|
3332
3380
|
*
|
|
@@ -3939,7 +3987,38 @@ interface McpServerCapabilities {
|
|
|
3939
3987
|
prompts?: Record<string, any>;
|
|
3940
3988
|
}
|
|
3941
3989
|
|
|
3942
|
-
|
|
3990
|
+
/**
|
|
3991
|
+
* BM25 (Best Matching 25) search engine.
|
|
3992
|
+
*
|
|
3993
|
+
* A lightweight, zero-dependency implementation of the BM25 ranking algorithm.
|
|
3994
|
+
* Parameters: k1=1.5, b=0.75 (standard BM25 defaults).
|
|
3995
|
+
*/
|
|
3996
|
+
interface BM25SearchResult {
|
|
3997
|
+
id: string;
|
|
3998
|
+
score: number;
|
|
3999
|
+
}
|
|
4000
|
+
declare class BM25Engine {
|
|
4001
|
+
private documents;
|
|
4002
|
+
private termFrequencies;
|
|
4003
|
+
private documentLengths;
|
|
4004
|
+
private avgDocLength;
|
|
4005
|
+
private readonly k1;
|
|
4006
|
+
private readonly b;
|
|
4007
|
+
constructor(k1?: number, b?: number);
|
|
4008
|
+
private tokenize;
|
|
4009
|
+
addDocument(id: string, content: string): void;
|
|
4010
|
+
clear(): void;
|
|
4011
|
+
get size(): number;
|
|
4012
|
+
private updateAvgDocLength;
|
|
4013
|
+
private idf;
|
|
4014
|
+
search(query: string, limit?: number): BM25SearchResult[];
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
/**
|
|
4018
|
+
* Parse a .skill.md file from its string content and absolute file path.
|
|
4019
|
+
* Returns a Skill object. Category is derived from subfolder between rootDir and file.
|
|
4020
|
+
*/
|
|
4021
|
+
declare function parseSkillFile(content: string, filePath: string, rootDir: string): Skill;
|
|
3943
4022
|
|
|
3944
4023
|
declare class RuleLoader {
|
|
3945
4024
|
private readonly cacheTtlMs;
|
|
@@ -3953,4 +4032,4 @@ declare class RuleLoader {
|
|
|
3953
4032
|
private readFile;
|
|
3954
4033
|
}
|
|
3955
4034
|
|
|
3956
|
-
export { AGENT_MODE, AGENT_PLANNING_PROMPT, AGENT_WORKFLOW, AIClient, type AIClientConfig, type AddBypassRuleOptions, AnthropicAdapter, AnthropicVertexAdapter, type AnthropicVertexConfig, type AssembledPrompt, type AssemblerOptions, AuthenticationError, BM25SearchEngine, BUILT_IN_MODES, type BypassRuleType, CHAT_MODE, CHAT_WORKFLOW, CODING_MODE, CODING_PLANNING_PROMPT, CODING_WORKFLOW, CONFIG_DIR_NAME, CONFIG_FILE_NAME, type CompletionChunk, type CompletionOptions, type CompletionRequest, type CompletionResponse, type ConfirmationDecision, type ConfirmationLevel$1 as ConfirmationLevel, ConnectionError, type ContextPrunedEvent, type ContextWindowConfig, ContextWindowConfigError, ContextWindowExceededError, type ContextWindowExceededEvent, type ContextWindowState, ContextWindowStateManager, type ContextWindowStrategy, type ContextWindowWarningEvent, ConversationNotFoundError, type ConversationScope, type ConversationSearchOptions, type ConversationStore, type ConversationSummarizedEvent, 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 GetOptions, type HitlConfig, type ImageDataPart, type ImageFilePart, type ImagePart, type ImageUrlPart, InMemoryConversationStore, type InMemoryConversationStoreConfig, InsufficientContextError, InvalidRequestError, type JsonRpcRequest, type JsonRpcResponse, type KnowledgeInstance, type McpAgentDefinition, type McpAuthConfig, McpClient, type McpClientConfig, McpConnectionError, type McpCustomAuthConfig, type McpJwtAuthConfig, type McpServerCapabilities, type McpServerConfig, type McpServerExposeConfig, type McpServerHandle, type McpStaticAuthConfig, McpTimeoutError, type McpTool, McpToolManager, type McpToolsConfig, type McpTransport, type MediaOptions, type MediaUploadStrategy, type Message, type MessageContent, type ModeBlockedHint, type ModeConfig, ModeRegistry, OllamaAdapter, type OllamaAdapterConfig, type OllamaModelInfo, OllamaProvider, type OllamaProviderEntry, type OnToolConfirmCallback, OpenAIAdapter, OpenRouterAdapter, type OpenRouterOptions, PageError, type Participant, type Plan, type PlanStep, Planner, type PromptMessage, ProviderAdapter, type ProviderConfig, ProviderError, type ProviderInfo, type ProviderModelInfo, type ProviderOptions, type PruneResult, RateLimitError, type RequestToolDefinition, type Role, RuleLoader, type RuntimeConfigStatus, SDKError, SQLiteConversationStore, type SQLiteConversationStoreConfig, type SearchHistoryEntry, type SearchOptions, type SearchResult, type Skill, type
|
|
4035
|
+
export { AGENT_MODE, AGENT_PLANNING_PROMPT, AGENT_WORKFLOW, AIClient, type AIClientConfig, type AddBypassRuleOptions, AnthropicAdapter, AnthropicVertexAdapter, type AnthropicVertexConfig, type AssembledPrompt, type AssemblerOptions, AuthenticationError, BM25Engine, BM25SearchEngine, type BM25SearchResult, BUILT_IN_MODES, type BypassRuleType, CHAT_MODE, CHAT_WORKFLOW, CODING_MODE, CODING_PLANNING_PROMPT, CODING_WORKFLOW, CONFIG_DIR_NAME, CONFIG_FILE_NAME, type CompletionChunk, type CompletionOptions, type CompletionRequest, type CompletionResponse, type ConfirmationDecision, type ConfirmationLevel$1 as ConfirmationLevel, ConnectionError, type ContextPrunedEvent, type ContextWindowConfig, ContextWindowConfigError, ContextWindowExceededError, type ContextWindowExceededEvent, type ContextWindowState, ContextWindowStateManager, type ContextWindowStrategy, type ContextWindowWarningEvent, ConversationNotFoundError, type ConversationScope, type ConversationSearchOptions, type ConversationStore, type ConversationSummarizedEvent, DEFAULT_MODE_NAME, DEFAULT_TOOLS_CONFIG, DEFAULT_TOOL_SEARCH_CONFIG, DEFAULT_WORKFLOW, DEFAULT_WORKFLOW_CONFIG, type EmbeddingRequest, type EmbeddingResponse, FILE_LIMITS, type FilePart, type FileUploadRequest, type FileUploadResponse, GeminiAdapter, type GetOptions, type HitlConfig, type ImageDataPart, type ImageFilePart, type ImagePart, type ImageUrlPart, InMemoryConversationStore, type InMemoryConversationStoreConfig, InsufficientContextError, InvalidRequestError, type JsonRpcRequest, type JsonRpcResponse, type KnowledgeInstance, type McpAgentDefinition, type McpAuthConfig, McpClient, type McpClientConfig, McpConnectionError, type McpCustomAuthConfig, type McpJwtAuthConfig, type McpServerCapabilities, type McpServerConfig, type McpServerExposeConfig, type McpServerHandle, type McpStaticAuthConfig, McpTimeoutError, type McpTool, McpToolManager, type McpToolsConfig, type McpTransport, type MediaOptions, type MediaUploadStrategy, type Message, type MessageContent, type ModeBlockedHint, type ModeConfig, ModeRegistry, OllamaAdapter, type OllamaAdapterConfig, type OllamaModelInfo, OllamaProvider, type OllamaProviderEntry, type OnToolConfirmCallback, OpenAIAdapter, OpenRouterAdapter, type OpenRouterOptions, PageError, type Participant, type Plan, type PlanStep, Planner, type PromptMessage, ProviderAdapter, type ProviderConfig, ProviderError, type ProviderInfo, type ProviderModelInfo, type ProviderOptions, type PruneResult, RateLimitError, type RequestToolDefinition, type Role, RuleLoader, type RuntimeConfigStatus, SDKError, SQLiteConversationStore, type SQLiteConversationStoreConfig, type SearchHistoryEntry, type SearchOptions, type SearchResult, type Skill, type SkillSection, type SkillToolsOptions, type SkillValidationMode, type SlmModelEntry, type StoredMessage, SummarizationError, type SummarizationOptions, type SummarizationResult, TOOLPACK_DIR_NAME, TOOL_SEARCH_NAME, type TextPart, TimeoutError, type ToolAnnotations, type ToolCall, type ToolCallFunction, type ToolCallMessage, type ToolCallRequest, type ToolCallResult, type ToolCategory, type ToolConfirmation, type ToolConfirmationRequestedEvent, type ToolConfirmationResolvedEvent, 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 ToolpackCredentials, type ToolpackInitConfig, type ToolpackInterceptor, type ToolpackMcpServerConfig, type ToolpackNextFunction, type ToolsConfig, type Usage, VertexAIAdapter, type VertexAIConfig, type WorkflowConfig, type WorkflowEvents, WorkflowExecutor, type WorkflowProgress, type WorkflowResult, addBypassRule, buildSummarizedHistory, cloudDeployTool, cloudListTool, cloudStatusTool, cloudToolsProject, codingExtractFunctionTool, codingFindReferencesTool, codingFindSymbolTool, codingGetCallHierarchyTool, codingGetDiagnosticsTool, codingGetExportsTool, codingGetImportsTool, codingGetOutlineTool, codingGetSymbolsTool, codingGoToDefinitionTool, codingMultiFileEditTool, codingRefactorRenameTool, codingToolsProject, countTokens, createContextWindowStateManager, createMcpToolProject, createMode, createSkillTools, createSummarizationReport, createSummarySystemMessage, createToolProject, dbCountTool, dbDeleteTool, dbInsertTool, dbQueryTool, dbSchemaTool, dbTablesTool, dbToolsProject, dbUpdateTool, diffApplyTool, diffCreateTool, diffPreviewTool, diffToolsProject, disconnectMcpToolProject, ensureGlobalConfigDir, ensureLocalConfigDir, estimateSummaryTokens, estimateTokenCount, execKillTool, execListProcessesTool, execReadOutputTool, execRunBackgroundTool, execRunBlockingTool, execRunShellTool, execRunTool, execTailOutputTool, execToolsProject, extractConversationKeypoints, fetchUrlAsBase64, fsAppendFileTool, fsBatchReadTool, fsBatchWriteTool, fsCopyTool, fsCreateDirTool, fsDeleteDirTool, fsDeleteFileTool, fsExistsTool, fsGlobTool, fsListDirTool, fsMoveTool, fsReadFileRangeTool, fsReadFileTool, fsReplaceInFileTool, fsSearchTool, fsStatTool, fsToolsProject, fsTreeTool, fsWriteFileTool, generateSummarizationPrompt, generateToolCategoriesPrompt, getContextWindowPercentage, getDefaultSlmModel, getGlobalConfigDir, getGlobalConfigPath, getGlobalToolpackDir, getLocalConfigDir, getLocalConfigPath, getLocalToolpackDir, getMessageStats, getMimeType, getOllamaBaseUrl, getOllamaProviderEntries, getRegisteredSlmModels, getRuntimeConfigStatus, getSafeOutputReserve, getToolSearchSchema, getToolpackConfig, getUserHomeDir, gitAddTool, gitBlameTool, gitBranchCreateTool, gitBranchListTool, gitCheckoutTool, gitCloneTool, gitCommitTool, gitDiffTool, gitLogTool, gitStatusTool, gitToolsProject, githubContentsGetTextTool, githubGraphqlExecuteTool, githubIssuesCommentsCreateTool, githubPrDiffGetTool, githubPrFilesListTool, githubPrReviewCommentsReplyTool, githubPrReviewThreadsListTool, githubPrReviewThreadsResolveTool, githubPrReviewsSubmitTool, githubToolsProject, groupMessagesByRole, handleContextWindowError, httpDeleteTool, httpDownloadTool, httpGetTool, httpPostTool, httpPutTool, httpToolsProject, initializeGlobalConfigIfFirstRun, isContextWindowError, isDataUri, isRegisteredSlm, isToolSearchTool, k8sApplyManifestTool, k8sDeleteResourceTool, k8sDescribeTool, k8sGetConfigMapTool, k8sGetLogsTool, k8sGetNamespacesTool, k8sListDeploymentsTool, k8sListPodsTool, k8sListServicesTool, k8sSwitchContextTool, k8sToolsProject, k8sWaitForDeploymentTool, loadFullConfig, loadRuntimeConfig, loadToolsConfig, mergeSummarizationResults, normalizeImagePart, ollamaRequest, ollamaStream, parseDataUri, parseSkillFile, parseSummarizationResponse, prepareSummarizationRequest, pruneMessages, readFileAsBase64, reloadToolpackConfig, removeBypassRule, saveToolsConfig, slackAuthTestTool, slackChatPostEphemeralTool, slackChatPostMessageTool, slackConversationsHistoryTool, slackConversationsRepliesTool, slackReactionsAddTool, slackToolsProject, systemCwdTool, systemDiskUsageTool, systemEnvTool, systemInfoTool, systemSetEnvTool, systemToolsProject, toDataUri, toolSearchDefinition, truncateMessage, validateSummarizationResult, webExtractLinksTool, webFeedTool, webFetchTool, webMapTool, webMetadataTool, webScrapeTool, webScreenshotTool, webSearchTool, webSitemapTool, webToolsProject, wouldExceedContextWindow };
|
package/dist/index.d.ts
CHANGED
|
@@ -497,12 +497,6 @@ interface ModeConfig {
|
|
|
497
497
|
* Shorthand for "no tool calls at all".
|
|
498
498
|
*/
|
|
499
499
|
blockAllTools: boolean;
|
|
500
|
-
/**
|
|
501
|
-
* Whether to auto-inject relevant skill content into the system prompt
|
|
502
|
-
* via BM25 matching of the user's message (skill interceptor).
|
|
503
|
-
* Default: false — opt-in only. Set to true to enable auto-injection.
|
|
504
|
-
*/
|
|
505
|
-
skillInterceptor?: boolean;
|
|
506
500
|
/**
|
|
507
501
|
* Root directory for rule files.
|
|
508
502
|
* Auto-discovers:
|
|
@@ -579,7 +573,29 @@ interface ImageUrlPart {
|
|
|
579
573
|
};
|
|
580
574
|
}
|
|
581
575
|
type ImagePart = ImageDataPart | ImageFilePart | ImageUrlPart;
|
|
582
|
-
|
|
576
|
+
interface FilePart {
|
|
577
|
+
type: 'file';
|
|
578
|
+
file: {
|
|
579
|
+
/** Public or pre-signed bucket URL */
|
|
580
|
+
url: string;
|
|
581
|
+
/** MIME type, e.g. 'image/jpeg', 'application/pdf' */
|
|
582
|
+
mimeType: string;
|
|
583
|
+
/** Original filename, for display only */
|
|
584
|
+
name?: string;
|
|
585
|
+
/** File size in bytes — used for client-side validation */
|
|
586
|
+
size?: number;
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
declare const FILE_LIMITS: {
|
|
590
|
+
readonly image: {
|
|
591
|
+
readonly maxBytes: number;
|
|
592
|
+
};
|
|
593
|
+
readonly document: {
|
|
594
|
+
readonly maxBytes: number;
|
|
595
|
+
readonly maxPages: 20;
|
|
596
|
+
};
|
|
597
|
+
};
|
|
598
|
+
type MessageContent = string | (TextPart | ImagePart | FilePart)[] | null;
|
|
583
599
|
type MediaUploadStrategy = 'inline' | 'upload' | 'auto';
|
|
584
600
|
interface MediaOptions {
|
|
585
601
|
/** How to handle image payloads */
|
|
@@ -2035,9 +2051,10 @@ declare class ToolDiscoveryCache {
|
|
|
2035
2051
|
declare const TOOL_SEARCH_NAME = "tool.search";
|
|
2036
2052
|
declare const toolSearchDefinition: ToolDefinition;
|
|
2037
2053
|
/**
|
|
2038
|
-
* Get the tool.search schema
|
|
2054
|
+
* Get the tool.search schema, optionally with a dynamic category enum
|
|
2055
|
+
* derived from the currently registered tool categories.
|
|
2039
2056
|
*/
|
|
2040
|
-
declare function getToolSearchSchema(): ToolSchema;
|
|
2057
|
+
declare function getToolSearchSchema(categories?: string[]): ToolSchema;
|
|
2041
2058
|
/**
|
|
2042
2059
|
* Check if a tool name is the tool.search meta-tool.
|
|
2043
2060
|
*/
|
|
@@ -2548,12 +2565,6 @@ interface Skill {
|
|
|
2548
2565
|
examples?: string;
|
|
2549
2566
|
lastModified: number;
|
|
2550
2567
|
}
|
|
2551
|
-
interface SkillInterceptorOptions {
|
|
2552
|
-
dir?: string;
|
|
2553
|
-
maxSkills?: number;
|
|
2554
|
-
minScore?: number;
|
|
2555
|
-
onValidationError?: SkillValidationMode;
|
|
2556
|
-
}
|
|
2557
2568
|
interface SkillToolsOptions {
|
|
2558
2569
|
/** Skills directory. Default: '.toolpack/skills' */
|
|
2559
2570
|
dir?: string;
|
|
@@ -2674,11 +2685,6 @@ declare function createMode(config: {
|
|
|
2674
2685
|
enabled: boolean;
|
|
2675
2686
|
};
|
|
2676
2687
|
};
|
|
2677
|
-
/**
|
|
2678
|
-
* Enable auto-injection of BM25-matched skill content into the system prompt.
|
|
2679
|
-
* Default: false — opt-in only.
|
|
2680
|
-
*/
|
|
2681
|
-
skillInterceptor?: boolean;
|
|
2682
2688
|
/**
|
|
2683
2689
|
* Root directory for rule files for this mode.
|
|
2684
2690
|
* Auto-discovers __global__/ and <mode-name>/ subfolders within it.
|
|
@@ -3156,6 +3162,12 @@ interface ToolpackInitConfig {
|
|
|
3156
3162
|
region?: string;
|
|
3157
3163
|
/** Load built-in tools (fs, http, etc.)? Default: false */
|
|
3158
3164
|
tools?: boolean;
|
|
3165
|
+
/**
|
|
3166
|
+
* Tool projects that override built-in tools by name.
|
|
3167
|
+
* Loaded after built-ins, so any tool with the same name replaces the built-in version.
|
|
3168
|
+
* Also used to extend the tool.search category enum dynamically.
|
|
3169
|
+
*/
|
|
3170
|
+
toolOverrides?: ToolProject[];
|
|
3159
3171
|
/** Context window management configuration for automatic conversation pruning/summarization */
|
|
3160
3172
|
contextWindow?: ContextWindowConfig;
|
|
3161
3173
|
/**
|
|
@@ -3268,8 +3280,18 @@ declare class Toolpack extends EventEmitter {
|
|
|
3268
3280
|
customProviderNames: Set<string>;
|
|
3269
3281
|
private mcpToolProject;
|
|
3270
3282
|
private _interceptors;
|
|
3283
|
+
private _instanceRequestTools;
|
|
3271
3284
|
private constructor();
|
|
3272
|
-
private
|
|
3285
|
+
private _buildKnowledgeRequestTools;
|
|
3286
|
+
/**
|
|
3287
|
+
* Register tools that bypass mode filtering and are always available to the model.
|
|
3288
|
+
* Use this for tools that must be accessible regardless of allowedToolCategories —
|
|
3289
|
+
* the same mechanism used by knowledge, skill, and scheduler tools internally.
|
|
3290
|
+
*
|
|
3291
|
+
* Prefer `loadRequestToolProject` when you have a ToolProject; call this directly
|
|
3292
|
+
* when you have a plain RequestToolDefinition array.
|
|
3293
|
+
*/
|
|
3294
|
+
registerRequestTools(tools: RequestToolDefinition[]): void;
|
|
3273
3295
|
private prepareRequest;
|
|
3274
3296
|
/**
|
|
3275
3297
|
* Initialize the Toolpack SDK.
|
|
@@ -3327,6 +3349,32 @@ declare class Toolpack extends EventEmitter {
|
|
|
3327
3349
|
* Validates dependencies and registers all tools.
|
|
3328
3350
|
*/
|
|
3329
3351
|
loadToolProject(project: ToolProject): Promise<void>;
|
|
3352
|
+
/**
|
|
3353
|
+
* Load multiple tool projects at runtime, rebuilding the BM25 index once after all are registered.
|
|
3354
|
+
*/
|
|
3355
|
+
loadToolProjects(projects: ToolProject[]): Promise<void>;
|
|
3356
|
+
/**
|
|
3357
|
+
* Register a tool project's tools as request tools, bypassing mode filtering entirely.
|
|
3358
|
+
* Use this instead of loadToolProject when the tools must always be available regardless
|
|
3359
|
+
* of allowedToolCategories (analogous to how knowledge and mind tools bypass filtering).
|
|
3360
|
+
*/
|
|
3361
|
+
loadRequestToolProject(project: ToolProject): void;
|
|
3362
|
+
/**
|
|
3363
|
+
* Search registered tools using BM25. Returns parsed search results ranked by relevance.
|
|
3364
|
+
* Useful for inspecting what tools are available and verifiable in tests.
|
|
3365
|
+
*/
|
|
3366
|
+
searchTools(query: string, category?: string): {
|
|
3367
|
+
found: number;
|
|
3368
|
+
tools: {
|
|
3369
|
+
name: string;
|
|
3370
|
+
description: string;
|
|
3371
|
+
category: string;
|
|
3372
|
+
}[];
|
|
3373
|
+
};
|
|
3374
|
+
/**
|
|
3375
|
+
* Get all registered tool names. Useful for verifying tool registration in tests.
|
|
3376
|
+
*/
|
|
3377
|
+
getRegisteredToolNames(): string[];
|
|
3330
3378
|
/**
|
|
3331
3379
|
* Expose Toolpack's built-in tools as an MCP server.
|
|
3332
3380
|
*
|
|
@@ -3939,7 +3987,38 @@ interface McpServerCapabilities {
|
|
|
3939
3987
|
prompts?: Record<string, any>;
|
|
3940
3988
|
}
|
|
3941
3989
|
|
|
3942
|
-
|
|
3990
|
+
/**
|
|
3991
|
+
* BM25 (Best Matching 25) search engine.
|
|
3992
|
+
*
|
|
3993
|
+
* A lightweight, zero-dependency implementation of the BM25 ranking algorithm.
|
|
3994
|
+
* Parameters: k1=1.5, b=0.75 (standard BM25 defaults).
|
|
3995
|
+
*/
|
|
3996
|
+
interface BM25SearchResult {
|
|
3997
|
+
id: string;
|
|
3998
|
+
score: number;
|
|
3999
|
+
}
|
|
4000
|
+
declare class BM25Engine {
|
|
4001
|
+
private documents;
|
|
4002
|
+
private termFrequencies;
|
|
4003
|
+
private documentLengths;
|
|
4004
|
+
private avgDocLength;
|
|
4005
|
+
private readonly k1;
|
|
4006
|
+
private readonly b;
|
|
4007
|
+
constructor(k1?: number, b?: number);
|
|
4008
|
+
private tokenize;
|
|
4009
|
+
addDocument(id: string, content: string): void;
|
|
4010
|
+
clear(): void;
|
|
4011
|
+
get size(): number;
|
|
4012
|
+
private updateAvgDocLength;
|
|
4013
|
+
private idf;
|
|
4014
|
+
search(query: string, limit?: number): BM25SearchResult[];
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
/**
|
|
4018
|
+
* Parse a .skill.md file from its string content and absolute file path.
|
|
4019
|
+
* Returns a Skill object. Category is derived from subfolder between rootDir and file.
|
|
4020
|
+
*/
|
|
4021
|
+
declare function parseSkillFile(content: string, filePath: string, rootDir: string): Skill;
|
|
3943
4022
|
|
|
3944
4023
|
declare class RuleLoader {
|
|
3945
4024
|
private readonly cacheTtlMs;
|
|
@@ -3953,4 +4032,4 @@ declare class RuleLoader {
|
|
|
3953
4032
|
private readFile;
|
|
3954
4033
|
}
|
|
3955
4034
|
|
|
3956
|
-
export { AGENT_MODE, AGENT_PLANNING_PROMPT, AGENT_WORKFLOW, AIClient, type AIClientConfig, type AddBypassRuleOptions, AnthropicAdapter, AnthropicVertexAdapter, type AnthropicVertexConfig, type AssembledPrompt, type AssemblerOptions, AuthenticationError, BM25SearchEngine, BUILT_IN_MODES, type BypassRuleType, CHAT_MODE, CHAT_WORKFLOW, CODING_MODE, CODING_PLANNING_PROMPT, CODING_WORKFLOW, CONFIG_DIR_NAME, CONFIG_FILE_NAME, type CompletionChunk, type CompletionOptions, type CompletionRequest, type CompletionResponse, type ConfirmationDecision, type ConfirmationLevel$1 as ConfirmationLevel, ConnectionError, type ContextPrunedEvent, type ContextWindowConfig, ContextWindowConfigError, ContextWindowExceededError, type ContextWindowExceededEvent, type ContextWindowState, ContextWindowStateManager, type ContextWindowStrategy, type ContextWindowWarningEvent, ConversationNotFoundError, type ConversationScope, type ConversationSearchOptions, type ConversationStore, type ConversationSummarizedEvent, 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 GetOptions, type HitlConfig, type ImageDataPart, type ImageFilePart, type ImagePart, type ImageUrlPart, InMemoryConversationStore, type InMemoryConversationStoreConfig, InsufficientContextError, InvalidRequestError, type JsonRpcRequest, type JsonRpcResponse, type KnowledgeInstance, type McpAgentDefinition, type McpAuthConfig, McpClient, type McpClientConfig, McpConnectionError, type McpCustomAuthConfig, type McpJwtAuthConfig, type McpServerCapabilities, type McpServerConfig, type McpServerExposeConfig, type McpServerHandle, type McpStaticAuthConfig, McpTimeoutError, type McpTool, McpToolManager, type McpToolsConfig, type McpTransport, type MediaOptions, type MediaUploadStrategy, type Message, type MessageContent, type ModeBlockedHint, type ModeConfig, ModeRegistry, OllamaAdapter, type OllamaAdapterConfig, type OllamaModelInfo, OllamaProvider, type OllamaProviderEntry, type OnToolConfirmCallback, OpenAIAdapter, OpenRouterAdapter, type OpenRouterOptions, PageError, type Participant, type Plan, type PlanStep, Planner, type PromptMessage, ProviderAdapter, type ProviderConfig, ProviderError, type ProviderInfo, type ProviderModelInfo, type ProviderOptions, type PruneResult, RateLimitError, type RequestToolDefinition, type Role, RuleLoader, type RuntimeConfigStatus, SDKError, SQLiteConversationStore, type SQLiteConversationStoreConfig, type SearchHistoryEntry, type SearchOptions, type SearchResult, type Skill, type
|
|
4035
|
+
export { AGENT_MODE, AGENT_PLANNING_PROMPT, AGENT_WORKFLOW, AIClient, type AIClientConfig, type AddBypassRuleOptions, AnthropicAdapter, AnthropicVertexAdapter, type AnthropicVertexConfig, type AssembledPrompt, type AssemblerOptions, AuthenticationError, BM25Engine, BM25SearchEngine, type BM25SearchResult, BUILT_IN_MODES, type BypassRuleType, CHAT_MODE, CHAT_WORKFLOW, CODING_MODE, CODING_PLANNING_PROMPT, CODING_WORKFLOW, CONFIG_DIR_NAME, CONFIG_FILE_NAME, type CompletionChunk, type CompletionOptions, type CompletionRequest, type CompletionResponse, type ConfirmationDecision, type ConfirmationLevel$1 as ConfirmationLevel, ConnectionError, type ContextPrunedEvent, type ContextWindowConfig, ContextWindowConfigError, ContextWindowExceededError, type ContextWindowExceededEvent, type ContextWindowState, ContextWindowStateManager, type ContextWindowStrategy, type ContextWindowWarningEvent, ConversationNotFoundError, type ConversationScope, type ConversationSearchOptions, type ConversationStore, type ConversationSummarizedEvent, DEFAULT_MODE_NAME, DEFAULT_TOOLS_CONFIG, DEFAULT_TOOL_SEARCH_CONFIG, DEFAULT_WORKFLOW, DEFAULT_WORKFLOW_CONFIG, type EmbeddingRequest, type EmbeddingResponse, FILE_LIMITS, type FilePart, type FileUploadRequest, type FileUploadResponse, GeminiAdapter, type GetOptions, type HitlConfig, type ImageDataPart, type ImageFilePart, type ImagePart, type ImageUrlPart, InMemoryConversationStore, type InMemoryConversationStoreConfig, InsufficientContextError, InvalidRequestError, type JsonRpcRequest, type JsonRpcResponse, type KnowledgeInstance, type McpAgentDefinition, type McpAuthConfig, McpClient, type McpClientConfig, McpConnectionError, type McpCustomAuthConfig, type McpJwtAuthConfig, type McpServerCapabilities, type McpServerConfig, type McpServerExposeConfig, type McpServerHandle, type McpStaticAuthConfig, McpTimeoutError, type McpTool, McpToolManager, type McpToolsConfig, type McpTransport, type MediaOptions, type MediaUploadStrategy, type Message, type MessageContent, type ModeBlockedHint, type ModeConfig, ModeRegistry, OllamaAdapter, type OllamaAdapterConfig, type OllamaModelInfo, OllamaProvider, type OllamaProviderEntry, type OnToolConfirmCallback, OpenAIAdapter, OpenRouterAdapter, type OpenRouterOptions, PageError, type Participant, type Plan, type PlanStep, Planner, type PromptMessage, ProviderAdapter, type ProviderConfig, ProviderError, type ProviderInfo, type ProviderModelInfo, type ProviderOptions, type PruneResult, RateLimitError, type RequestToolDefinition, type Role, RuleLoader, type RuntimeConfigStatus, SDKError, SQLiteConversationStore, type SQLiteConversationStoreConfig, type SearchHistoryEntry, type SearchOptions, type SearchResult, type Skill, type SkillSection, type SkillToolsOptions, type SkillValidationMode, type SlmModelEntry, type StoredMessage, SummarizationError, type SummarizationOptions, type SummarizationResult, TOOLPACK_DIR_NAME, TOOL_SEARCH_NAME, type TextPart, TimeoutError, type ToolAnnotations, type ToolCall, type ToolCallFunction, type ToolCallMessage, type ToolCallRequest, type ToolCallResult, type ToolCategory, type ToolConfirmation, type ToolConfirmationRequestedEvent, type ToolConfirmationResolvedEvent, 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 ToolpackCredentials, type ToolpackInitConfig, type ToolpackInterceptor, type ToolpackMcpServerConfig, type ToolpackNextFunction, type ToolsConfig, type Usage, VertexAIAdapter, type VertexAIConfig, type WorkflowConfig, type WorkflowEvents, WorkflowExecutor, type WorkflowProgress, type WorkflowResult, addBypassRule, buildSummarizedHistory, cloudDeployTool, cloudListTool, cloudStatusTool, cloudToolsProject, codingExtractFunctionTool, codingFindReferencesTool, codingFindSymbolTool, codingGetCallHierarchyTool, codingGetDiagnosticsTool, codingGetExportsTool, codingGetImportsTool, codingGetOutlineTool, codingGetSymbolsTool, codingGoToDefinitionTool, codingMultiFileEditTool, codingRefactorRenameTool, codingToolsProject, countTokens, createContextWindowStateManager, createMcpToolProject, createMode, createSkillTools, createSummarizationReport, createSummarySystemMessage, createToolProject, dbCountTool, dbDeleteTool, dbInsertTool, dbQueryTool, dbSchemaTool, dbTablesTool, dbToolsProject, dbUpdateTool, diffApplyTool, diffCreateTool, diffPreviewTool, diffToolsProject, disconnectMcpToolProject, ensureGlobalConfigDir, ensureLocalConfigDir, estimateSummaryTokens, estimateTokenCount, execKillTool, execListProcessesTool, execReadOutputTool, execRunBackgroundTool, execRunBlockingTool, execRunShellTool, execRunTool, execTailOutputTool, execToolsProject, extractConversationKeypoints, fetchUrlAsBase64, fsAppendFileTool, fsBatchReadTool, fsBatchWriteTool, fsCopyTool, fsCreateDirTool, fsDeleteDirTool, fsDeleteFileTool, fsExistsTool, fsGlobTool, fsListDirTool, fsMoveTool, fsReadFileRangeTool, fsReadFileTool, fsReplaceInFileTool, fsSearchTool, fsStatTool, fsToolsProject, fsTreeTool, fsWriteFileTool, generateSummarizationPrompt, generateToolCategoriesPrompt, getContextWindowPercentage, getDefaultSlmModel, getGlobalConfigDir, getGlobalConfigPath, getGlobalToolpackDir, getLocalConfigDir, getLocalConfigPath, getLocalToolpackDir, getMessageStats, getMimeType, getOllamaBaseUrl, getOllamaProviderEntries, getRegisteredSlmModels, getRuntimeConfigStatus, getSafeOutputReserve, getToolSearchSchema, getToolpackConfig, getUserHomeDir, gitAddTool, gitBlameTool, gitBranchCreateTool, gitBranchListTool, gitCheckoutTool, gitCloneTool, gitCommitTool, gitDiffTool, gitLogTool, gitStatusTool, gitToolsProject, githubContentsGetTextTool, githubGraphqlExecuteTool, githubIssuesCommentsCreateTool, githubPrDiffGetTool, githubPrFilesListTool, githubPrReviewCommentsReplyTool, githubPrReviewThreadsListTool, githubPrReviewThreadsResolveTool, githubPrReviewsSubmitTool, githubToolsProject, groupMessagesByRole, handleContextWindowError, httpDeleteTool, httpDownloadTool, httpGetTool, httpPostTool, httpPutTool, httpToolsProject, initializeGlobalConfigIfFirstRun, isContextWindowError, isDataUri, isRegisteredSlm, isToolSearchTool, k8sApplyManifestTool, k8sDeleteResourceTool, k8sDescribeTool, k8sGetConfigMapTool, k8sGetLogsTool, k8sGetNamespacesTool, k8sListDeploymentsTool, k8sListPodsTool, k8sListServicesTool, k8sSwitchContextTool, k8sToolsProject, k8sWaitForDeploymentTool, loadFullConfig, loadRuntimeConfig, loadToolsConfig, mergeSummarizationResults, normalizeImagePart, ollamaRequest, ollamaStream, parseDataUri, parseSkillFile, parseSummarizationResponse, prepareSummarizationRequest, pruneMessages, readFileAsBase64, reloadToolpackConfig, removeBypassRule, saveToolsConfig, slackAuthTestTool, slackChatPostEphemeralTool, slackChatPostMessageTool, slackConversationsHistoryTool, slackConversationsRepliesTool, slackReactionsAddTool, slackToolsProject, systemCwdTool, systemDiskUsageTool, systemEnvTool, systemInfoTool, systemSetEnvTool, systemToolsProject, toDataUri, toolSearchDefinition, truncateMessage, validateSummarizationResult, webExtractLinksTool, webFeedTool, webFetchTool, webMapTool, webMetadataTool, webScrapeTool, webScreenshotTool, webSearchTool, webSitemapTool, webToolsProject, wouldExceedContextWindow };
|