@everworker/oneringai 0.4.3 → 0.4.5
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 +113 -13
- package/dist/capabilities/agents/index.d.cts +1 -1
- package/dist/capabilities/agents/index.d.ts +1 -1
- package/dist/capabilities/images/index.cjs.map +1 -1
- package/dist/capabilities/images/index.js.map +1 -1
- package/dist/{index-CzGnmqOs.d.ts → index-C6ApwIzB.d.ts} +323 -1
- package/dist/{index-CEjKTeSb.d.cts → index-CsQOVhqe.d.cts} +323 -1
- package/dist/index.cjs +2880 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +568 -18
- package/dist/index.d.ts +568 -18
- package/dist/index.js +2864 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -742,6 +742,319 @@ interface ContextStorageListOptions {
|
|
|
742
742
|
offset?: number;
|
|
743
743
|
}
|
|
744
744
|
|
|
745
|
+
/**
|
|
746
|
+
* ToolCatalogRegistry - Static Global Registry for Tool Categories
|
|
747
|
+
*
|
|
748
|
+
* The single source of truth for all tool categories and their tools.
|
|
749
|
+
* Library users register their own categories and tools at app startup.
|
|
750
|
+
*
|
|
751
|
+
* Built-in tools are auto-registered from registry.generated.ts on first access.
|
|
752
|
+
*
|
|
753
|
+
* @example
|
|
754
|
+
* ```typescript
|
|
755
|
+
* // Register custom category
|
|
756
|
+
* ToolCatalogRegistry.registerCategory({
|
|
757
|
+
* name: 'knowledge',
|
|
758
|
+
* displayName: 'Knowledge Graph',
|
|
759
|
+
* description: 'Search entities, get facts, manage references',
|
|
760
|
+
* });
|
|
761
|
+
*
|
|
762
|
+
* // Register tools in category
|
|
763
|
+
* ToolCatalogRegistry.registerTools('knowledge', [
|
|
764
|
+
* { name: 'entity_search', displayName: 'Entity Search', description: 'Search people/orgs', tool: entitySearch, safeByDefault: true },
|
|
765
|
+
* ]);
|
|
766
|
+
*
|
|
767
|
+
* // Query
|
|
768
|
+
* const categories = ToolCatalogRegistry.getCategories();
|
|
769
|
+
* const tools = ToolCatalogRegistry.getToolsInCategory('knowledge');
|
|
770
|
+
* const found = ToolCatalogRegistry.findTool('entity_search');
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
|
|
774
|
+
/**
|
|
775
|
+
* Definition of a tool category in the catalog.
|
|
776
|
+
*/
|
|
777
|
+
interface ToolCategoryDefinition {
|
|
778
|
+
/** Unique category name (e.g., 'filesystem', 'knowledge', 'connector:github') */
|
|
779
|
+
name: string;
|
|
780
|
+
/** Human-readable display name (e.g., 'File System') */
|
|
781
|
+
displayName: string;
|
|
782
|
+
/** Description shown in catalog metatool display */
|
|
783
|
+
description: string;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* A single tool entry in the catalog.
|
|
787
|
+
*/
|
|
788
|
+
interface CatalogToolEntry {
|
|
789
|
+
/** The actual tool function (optional when createTool factory is provided) */
|
|
790
|
+
tool?: ToolFunction;
|
|
791
|
+
/** Tool name (matches definition.function.name) */
|
|
792
|
+
name: string;
|
|
793
|
+
/** Human-readable display name */
|
|
794
|
+
displayName: string;
|
|
795
|
+
/** Brief description */
|
|
796
|
+
description: string;
|
|
797
|
+
/** Whether this tool is safe to execute without user approval */
|
|
798
|
+
safeByDefault: boolean;
|
|
799
|
+
/** Whether this tool requires a connector to function */
|
|
800
|
+
requiresConnector?: boolean;
|
|
801
|
+
/** Factory for runtime tool creation (e.g., browser tools needing context) */
|
|
802
|
+
createTool?: (ctx: Record<string, unknown>) => ToolFunction;
|
|
803
|
+
/** Source identifier (e.g., 'oneringai', 'hosea', 'custom') */
|
|
804
|
+
source?: string;
|
|
805
|
+
/** Connector name (for connector-originated tools) */
|
|
806
|
+
connectorName?: string;
|
|
807
|
+
/** Service type (e.g., 'github', 'slack') */
|
|
808
|
+
serviceType?: string;
|
|
809
|
+
/** Supported connector service types */
|
|
810
|
+
connectorServiceTypes?: string[];
|
|
811
|
+
}
|
|
812
|
+
/**
|
|
813
|
+
* Entry format from the generated tool registry (registry.generated.ts).
|
|
814
|
+
* Used by initializeFromRegistry() and registerFromToolRegistry().
|
|
815
|
+
*/
|
|
816
|
+
interface ToolRegistryEntry {
|
|
817
|
+
name: string;
|
|
818
|
+
displayName: string;
|
|
819
|
+
category: string;
|
|
820
|
+
description: string;
|
|
821
|
+
tool: ToolFunction;
|
|
822
|
+
safeByDefault: boolean;
|
|
823
|
+
requiresConnector?: boolean;
|
|
824
|
+
}
|
|
825
|
+
/**
|
|
826
|
+
* Scope for filtering which categories are visible/allowed.
|
|
827
|
+
*
|
|
828
|
+
* - `string[]` — shorthand allowlist (only these categories)
|
|
829
|
+
* - `{ include: string[] }` — explicit allowlist
|
|
830
|
+
* - `{ exclude: string[] }` — blocklist (all except these)
|
|
831
|
+
* - `undefined` — all categories allowed
|
|
832
|
+
*/
|
|
833
|
+
type ToolCategoryScope = string[] | {
|
|
834
|
+
include: string[];
|
|
835
|
+
} | {
|
|
836
|
+
exclude: string[];
|
|
837
|
+
};
|
|
838
|
+
/**
|
|
839
|
+
* Connector category metadata returned by discoverConnectorCategories().
|
|
840
|
+
*/
|
|
841
|
+
interface ConnectorCategoryInfo {
|
|
842
|
+
/** Category name in 'connector:<name>' format */
|
|
843
|
+
name: string;
|
|
844
|
+
/** Human-readable display name */
|
|
845
|
+
displayName: string;
|
|
846
|
+
/** Description */
|
|
847
|
+
description: string;
|
|
848
|
+
/** Number of tools */
|
|
849
|
+
toolCount: number;
|
|
850
|
+
/** Resolved tools */
|
|
851
|
+
tools: ToolFunction[];
|
|
852
|
+
}
|
|
853
|
+
/**
|
|
854
|
+
* Static global registry for tool categories and their tools.
|
|
855
|
+
*
|
|
856
|
+
* Like Connector and StorageRegistry, this is a static class that acts
|
|
857
|
+
* as a single source of truth. App code registers categories at startup,
|
|
858
|
+
* and plugins/agents query them at runtime.
|
|
859
|
+
*/
|
|
860
|
+
declare class ToolCatalogRegistry {
|
|
861
|
+
/** Category definitions: name → definition */
|
|
862
|
+
private static _categories;
|
|
863
|
+
/** Tools per category: category name → tool entries */
|
|
864
|
+
private static _tools;
|
|
865
|
+
/** Whether built-in tools have been registered */
|
|
866
|
+
private static _initialized;
|
|
867
|
+
/** Lazy-loaded ConnectorTools module. null = not attempted, false = failed */
|
|
868
|
+
private static _connectorToolsModule;
|
|
869
|
+
private static readonly BUILTIN_DESCRIPTIONS;
|
|
870
|
+
/**
|
|
871
|
+
* Convert a hyphenated or plain name to a display name.
|
|
872
|
+
* E.g., 'custom-tools' → 'Custom Tools', 'filesystem' → 'Filesystem'
|
|
873
|
+
*/
|
|
874
|
+
static toDisplayName(name: string): string;
|
|
875
|
+
/**
|
|
876
|
+
* Parse a connector category name, returning the connector name or null.
|
|
877
|
+
* E.g., 'connector:github' → 'github', 'filesystem' → null
|
|
878
|
+
*/
|
|
879
|
+
static parseConnectorCategory(category: string): string | null;
|
|
880
|
+
/**
|
|
881
|
+
* Get the ConnectorTools module (lazy-loaded, cached).
|
|
882
|
+
* Returns null if ConnectorTools is not available.
|
|
883
|
+
* Uses false sentinel to prevent retrying after first failure.
|
|
884
|
+
*
|
|
885
|
+
* NOTE: The dynamic require() path fails in bundled environments (Meteor, Webpack).
|
|
886
|
+
* Call setConnectorToolsModule() at app startup to inject the module explicitly.
|
|
887
|
+
*/
|
|
888
|
+
static getConnectorToolsModule(): {
|
|
889
|
+
ConnectorTools: any;
|
|
890
|
+
} | null;
|
|
891
|
+
/**
|
|
892
|
+
* Explicitly set the ConnectorTools module reference.
|
|
893
|
+
*
|
|
894
|
+
* Use this in bundled environments (Meteor, Webpack, etc.) where the lazy
|
|
895
|
+
* require('../../tools/connector/ConnectorTools.js') fails due to path resolution.
|
|
896
|
+
*
|
|
897
|
+
* @example
|
|
898
|
+
* ```typescript
|
|
899
|
+
* import { ToolCatalogRegistry, ConnectorTools } from '@everworker/oneringai';
|
|
900
|
+
* ToolCatalogRegistry.setConnectorToolsModule({ ConnectorTools });
|
|
901
|
+
* ```
|
|
902
|
+
*/
|
|
903
|
+
static setConnectorToolsModule(mod: {
|
|
904
|
+
ConnectorTools: any;
|
|
905
|
+
}): void;
|
|
906
|
+
/**
|
|
907
|
+
* Register a tool category.
|
|
908
|
+
* If the category already exists, updates its metadata.
|
|
909
|
+
* @throws Error if name is empty or whitespace
|
|
910
|
+
*/
|
|
911
|
+
static registerCategory(def: ToolCategoryDefinition): void;
|
|
912
|
+
/**
|
|
913
|
+
* Register multiple tools in a category.
|
|
914
|
+
* The category is auto-created if it doesn't exist (with a generic description).
|
|
915
|
+
* @throws Error if category name is empty or whitespace
|
|
916
|
+
*/
|
|
917
|
+
static registerTools(category: string, tools: CatalogToolEntry[]): void;
|
|
918
|
+
/**
|
|
919
|
+
* Register a single tool in a category.
|
|
920
|
+
*/
|
|
921
|
+
static registerTool(category: string, tool: CatalogToolEntry): void;
|
|
922
|
+
/**
|
|
923
|
+
* Unregister a category and all its tools.
|
|
924
|
+
*/
|
|
925
|
+
static unregisterCategory(category: string): boolean;
|
|
926
|
+
/**
|
|
927
|
+
* Unregister a single tool from a category.
|
|
928
|
+
*/
|
|
929
|
+
static unregisterTool(category: string, toolName: string): boolean;
|
|
930
|
+
/**
|
|
931
|
+
* Get all registered categories.
|
|
932
|
+
*/
|
|
933
|
+
static getCategories(): ToolCategoryDefinition[];
|
|
934
|
+
/**
|
|
935
|
+
* Get a single category by name.
|
|
936
|
+
*/
|
|
937
|
+
static getCategory(name: string): ToolCategoryDefinition | undefined;
|
|
938
|
+
/**
|
|
939
|
+
* Check if a category exists.
|
|
940
|
+
*/
|
|
941
|
+
static hasCategory(name: string): boolean;
|
|
942
|
+
/**
|
|
943
|
+
* Get all tools in a category.
|
|
944
|
+
*/
|
|
945
|
+
static getToolsInCategory(category: string): CatalogToolEntry[];
|
|
946
|
+
/**
|
|
947
|
+
* Get all catalog tools across all categories.
|
|
948
|
+
*/
|
|
949
|
+
static getAllCatalogTools(): CatalogToolEntry[];
|
|
950
|
+
/**
|
|
951
|
+
* Find a tool by name across all categories.
|
|
952
|
+
*/
|
|
953
|
+
static findTool(name: string): {
|
|
954
|
+
category: string;
|
|
955
|
+
entry: CatalogToolEntry;
|
|
956
|
+
} | undefined;
|
|
957
|
+
/**
|
|
958
|
+
* Filter categories by scope.
|
|
959
|
+
*/
|
|
960
|
+
static filterCategories(scope?: ToolCategoryScope): ToolCategoryDefinition[];
|
|
961
|
+
/**
|
|
962
|
+
* Check if a category is allowed by a scope.
|
|
963
|
+
*/
|
|
964
|
+
static isCategoryAllowed(name: string, scope?: ToolCategoryScope): boolean;
|
|
965
|
+
/**
|
|
966
|
+
* Discover all connector categories with their tools.
|
|
967
|
+
* Calls ConnectorTools.discoverAll() and filters by scope/identities.
|
|
968
|
+
*
|
|
969
|
+
* @param options - Optional filtering
|
|
970
|
+
* @returns Array of connector category info
|
|
971
|
+
*/
|
|
972
|
+
static discoverConnectorCategories(options?: {
|
|
973
|
+
scope?: ToolCategoryScope;
|
|
974
|
+
identities?: Array<{
|
|
975
|
+
connector: string;
|
|
976
|
+
}>;
|
|
977
|
+
}): ConnectorCategoryInfo[];
|
|
978
|
+
/**
|
|
979
|
+
* Resolve tools for a specific connector category.
|
|
980
|
+
*
|
|
981
|
+
* @param category - Category name in 'connector:<name>' format
|
|
982
|
+
* @returns Array of resolved tools with names
|
|
983
|
+
*/
|
|
984
|
+
static resolveConnectorCategoryTools(category: string): Array<{
|
|
985
|
+
tool: ToolFunction;
|
|
986
|
+
name: string;
|
|
987
|
+
}>;
|
|
988
|
+
/**
|
|
989
|
+
* Resolve tool names to ToolFunction[].
|
|
990
|
+
*
|
|
991
|
+
* Searches registered categories and (optionally) connector tools.
|
|
992
|
+
* Used by app-level executors (e.g., V25's OneRingAgentExecutor).
|
|
993
|
+
*
|
|
994
|
+
* @param toolNames - Array of tool names to resolve
|
|
995
|
+
* @param options - Resolution options
|
|
996
|
+
* @returns Resolved tool functions (skips unresolvable names with warning)
|
|
997
|
+
*/
|
|
998
|
+
static resolveTools(toolNames: string[], options?: {
|
|
999
|
+
includeConnectors?: boolean;
|
|
1000
|
+
userId?: string;
|
|
1001
|
+
context?: Record<string, unknown>;
|
|
1002
|
+
}): ToolFunction[];
|
|
1003
|
+
/**
|
|
1004
|
+
* Resolve tools grouped by connector name.
|
|
1005
|
+
*
|
|
1006
|
+
* Tools with a `connectorName` go into `byConnector`; all others go into `plain`.
|
|
1007
|
+
* Supports factory-based tool creation via `createTool` when context is provided.
|
|
1008
|
+
*
|
|
1009
|
+
* @param toolNames - Array of tool names to resolve
|
|
1010
|
+
* @param context - Optional context passed to createTool factories
|
|
1011
|
+
* @param options - Resolution options
|
|
1012
|
+
* @returns Grouped tools: plain + byConnector map
|
|
1013
|
+
*/
|
|
1014
|
+
static resolveToolsGrouped(toolNames: string[], context?: Record<string, unknown>, options?: {
|
|
1015
|
+
includeConnectors?: boolean;
|
|
1016
|
+
}): {
|
|
1017
|
+
plain: ToolFunction[];
|
|
1018
|
+
byConnector: Map<string, ToolFunction[]>;
|
|
1019
|
+
};
|
|
1020
|
+
/**
|
|
1021
|
+
* Resolve a tool from a CatalogToolEntry, using factory if available.
|
|
1022
|
+
* Returns null if neither tool nor createTool is available.
|
|
1023
|
+
*/
|
|
1024
|
+
private static resolveEntryTool;
|
|
1025
|
+
/**
|
|
1026
|
+
* Search connector tools by name (uses lazy accessor).
|
|
1027
|
+
*/
|
|
1028
|
+
private static findConnectorTool;
|
|
1029
|
+
/**
|
|
1030
|
+
* Ensure built-in tools from registry.generated.ts are registered.
|
|
1031
|
+
* Called lazily on first query.
|
|
1032
|
+
*
|
|
1033
|
+
* In ESM environments, call `initializeFromRegistry(toolRegistry)` explicitly
|
|
1034
|
+
* from your app startup instead of relying on auto-initialization.
|
|
1035
|
+
*/
|
|
1036
|
+
static ensureInitialized(): void;
|
|
1037
|
+
/**
|
|
1038
|
+
* Explicitly initialize from the generated tool registry.
|
|
1039
|
+
* Call this at app startup in ESM environments where lazy require() doesn't work.
|
|
1040
|
+
*
|
|
1041
|
+
* @example
|
|
1042
|
+
* ```typescript
|
|
1043
|
+
* import { toolRegistry } from './tools/registry.generated.js';
|
|
1044
|
+
* ToolCatalogRegistry.initializeFromRegistry(toolRegistry);
|
|
1045
|
+
* ```
|
|
1046
|
+
*/
|
|
1047
|
+
static initializeFromRegistry(registry: ToolRegistryEntry[]): void;
|
|
1048
|
+
/**
|
|
1049
|
+
* Internal: register tools from a tool registry array.
|
|
1050
|
+
*/
|
|
1051
|
+
private static registerFromToolRegistry;
|
|
1052
|
+
/**
|
|
1053
|
+
* Reset the registry. Primarily for testing.
|
|
1054
|
+
*/
|
|
1055
|
+
static reset(): void;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
745
1058
|
/**
|
|
746
1059
|
* AgentContextNextGen - Type Definitions
|
|
747
1060
|
*
|
|
@@ -1166,6 +1479,8 @@ interface ContextFeatures {
|
|
|
1166
1479
|
persistentInstructions?: boolean;
|
|
1167
1480
|
/** Enable UserInfo plugin (default: false) */
|
|
1168
1481
|
userInfo?: boolean;
|
|
1482
|
+
/** Enable ToolCatalog plugin for dynamic tool loading/unloading (default: false) */
|
|
1483
|
+
toolCatalog?: boolean;
|
|
1169
1484
|
}
|
|
1170
1485
|
/**
|
|
1171
1486
|
* Default feature configuration
|
|
@@ -1198,6 +1513,11 @@ interface PluginConfigs {
|
|
|
1198
1513
|
* See UserInfoPluginConfig for full options.
|
|
1199
1514
|
*/
|
|
1200
1515
|
userInfo?: Record<string, unknown>;
|
|
1516
|
+
/**
|
|
1517
|
+
* Tool catalog plugin config (used when features.toolCatalog=true).
|
|
1518
|
+
* See ToolCatalogPluginConfig for full options.
|
|
1519
|
+
*/
|
|
1520
|
+
toolCatalog?: Record<string, unknown>;
|
|
1201
1521
|
}
|
|
1202
1522
|
/**
|
|
1203
1523
|
* AgentContextNextGen configuration
|
|
@@ -1238,6 +1558,8 @@ interface AgentContextNextGenConfig {
|
|
|
1238
1558
|
tools?: ToolFunction[];
|
|
1239
1559
|
/** Storage for session persistence */
|
|
1240
1560
|
storage?: IContextStorage;
|
|
1561
|
+
/** Restrict tool catalog to specific categories */
|
|
1562
|
+
toolCategories?: ToolCategoryScope;
|
|
1241
1563
|
/** Plugin-specific configurations (used with features flags) */
|
|
1242
1564
|
plugins?: PluginConfigs;
|
|
1243
1565
|
/**
|
|
@@ -2249,4 +2571,4 @@ declare class HookManager {
|
|
|
2249
2571
|
getDisabledHooks(): string[];
|
|
2250
2572
|
}
|
|
2251
2573
|
|
|
2252
|
-
export {
|
|
2574
|
+
export { StreamEventType as $, type AgentContextNextGenConfig as A, type BeforeCompactionCallback as B, type ContextFeatures as C, type HookName as D, ExecutionContext as E, type FunctionToolDefinition as F, type ITokenEstimator as G, type HookConfig as H, type IContextStorage as I, type ToolCategoryScope as J, type CompactionContext as K, type LLMResponse as L, type MemoryEntry as M, type CompactionResult as N, type OutputItem as O, type PriorityCalculator as P, type StaleEntryInfo as Q, type PriorityContext as R, type SerializedContextState as S, type Tool as T, type MemoryIndex as U, type TaskStatusForMemory as V, type WorkingMemoryConfig as W, type WorkingMemoryAccess as X, type ContextStorageListOptions as Y, type ContextSessionSummary as Z, type TokenUsage as _, type MemoryScope as a, getToolCallDescription as a$, type TextGenerateOptions as a0, type ModelCapabilities as a1, MessageRole as a2, type AfterToolContext as a3, type AgentEventName as a4, type AgenticLoopEventName as a5, type AgenticLoopEvents as a6, type ApprovalResult as a7, type ApproveToolContext as a8, type BeforeToolContext as a9, type OversizedInputResult as aA, type PluginConfigs as aB, type ReasoningDeltaEvent as aC, type ReasoningDoneEvent as aD, type ReasoningItem as aE, type ResponseCompleteEvent as aF, type ResponseCreatedEvent as aG, type ResponseInProgressEvent as aH, type SimpleScope as aI, type TaskAwareScope as aJ, type ThinkingContent as aK, type ToolCallArgumentsDeltaEvent as aL, type ToolCallArgumentsDoneEvent as aM, type ToolCallStartEvent as aN, ToolCallState as aO, ToolCatalogRegistry as aP, type ToolCategoryDefinition as aQ, type ToolExecutionContext as aR, type ToolExecutionDoneEvent as aS, type ToolExecutionStartEvent as aT, type ToolModification as aU, type ToolResultContent as aV, type ToolUseContent as aW, calculateEntrySize as aX, defaultDescribeCall as aY, forPlan as aZ, forTasks as a_, type BuiltInTool as aa, CONTEXT_SESSION_FORMAT_VERSION as ab, type ToolRegistryEntry as ac, type CatalogToolEntry as ad, type CompactionItem as ae, type ConnectorCategoryInfo as af, ContentType as ag, DEFAULT_CONFIG as ah, DEFAULT_FEATURES as ai, DEFAULT_MEMORY_CONFIG as aj, type ErrorEvent as ak, type ExecutionConfig as al, type Hook as am, HookManager as an, type InputImageContent as ao, type InputTextContent as ap, type IterationCompleteEvent$1 as aq, type JSONSchema as ar, MEMORY_PRIORITY_VALUES as as, type MemoryEntryInput as at, type MemoryIndexEntry as au, type Message as av, type ModifyingHook as aw, type OutputTextContent as ax, type OutputTextDeltaEvent as ay, type OutputTextDoneEvent as az, type ToolFunction as b, isErrorEvent as b0, isOutputTextDelta as b1, isReasoningDelta as b2, isReasoningDone as b3, isResponseComplete as b4, isSimpleScope as b5, isStreamEvent as b6, isTaskAwareScope as b7, isTerminalMemoryStatus as b8, isToolCallArgumentsDelta as b9, isToolCallArgumentsDone as ba, isToolCallStart as bb, scopeEquals as bc, scopeMatches as bd, type ExecutionCompleteEvent as be, type ExecutionStartEvent as bf, type LLMRequestEvent as bg, type LLMResponseEvent as bh, type ToolCompleteEvent as bi, type ToolStartEvent as bj, type ToolContext as c, type ToolPermissionConfig as d, type ContextBudget as e, type ToolCall as f, type IContextPluginNextGen as g, type MemoryPriority as h, type MemoryTier as i, type ContextEvents as j, type AuthIdentity as k, type ICompactionStrategy as l, type InputItem as m, type Content as n, type PreparedContext as o, type ToolResult as p, type ConsolidationResult as q, type StoredContextSession as r, type ITextProvider as s, type ContextSessionMetadata as t, type StreamEvent as u, type HistoryMode as v, type AgentEvents as w, type AgentResponse as x, type ExecutionMetrics as y, type AuditEntry as z };
|