@nuvin/nuvin-core 0.1.0 → 1.0.1
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/VERSION +2 -2
- package/dist/index.d.ts +167 -290
- package/dist/index.js +223 -607
- package/package.json +1 -1
package/dist/VERSION
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ type AgentTemplate = {
|
|
|
12
12
|
tools?: string[];
|
|
13
13
|
provider?: string;
|
|
14
14
|
model?: string;
|
|
15
|
-
apiKey?: string;
|
|
16
15
|
temperature?: number;
|
|
17
16
|
maxTokens?: number;
|
|
18
17
|
topP?: number;
|
|
@@ -331,6 +330,13 @@ interface LLMPort {
|
|
|
331
330
|
onStreamFinish?: (finishReason?: string, usage?: UsageData) => void;
|
|
332
331
|
}, signal?: AbortSignal): Promise<CompletionResult>;
|
|
333
332
|
}
|
|
333
|
+
type LLMConfig = {
|
|
334
|
+
provider?: string;
|
|
335
|
+
model?: string;
|
|
336
|
+
};
|
|
337
|
+
interface LLMFactory {
|
|
338
|
+
createLLM(config: LLMConfig): LLMPort;
|
|
339
|
+
}
|
|
334
340
|
type ToolDefinition = {
|
|
335
341
|
type: 'function';
|
|
336
342
|
function: {
|
|
@@ -356,9 +362,13 @@ type ToolExecutionResult = {
|
|
|
356
362
|
interface ToolPort {
|
|
357
363
|
getToolDefinitions(enabledTools: string[]): ToolDefinition[];
|
|
358
364
|
executeToolCalls(calls: ToolInvocation[], context?: Record<string, unknown>, maxConcurrent?: number, signal?: AbortSignal): Promise<ToolExecutionResult[]>;
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
365
|
+
}
|
|
366
|
+
interface AgentAwareToolPort {
|
|
367
|
+
setEnabledAgents(enabledAgents: Record<string, boolean>): void;
|
|
368
|
+
getAgentRegistry(): AgentRegistry | undefined;
|
|
369
|
+
}
|
|
370
|
+
interface OrchestratorAwareToolPort {
|
|
371
|
+
setOrchestrator(config: AgentConfig, tools: ToolPort, llmFactory?: LLMFactory, configResolver?: () => Partial<AgentConfig>): void;
|
|
362
372
|
}
|
|
363
373
|
type MemorySnapshot<T = unknown> = Record<string, T[]>;
|
|
364
374
|
interface MemoryPersistence<T = unknown> {
|
|
@@ -789,7 +799,7 @@ declare class SystemClock implements Clock {
|
|
|
789
799
|
}
|
|
790
800
|
|
|
791
801
|
declare class SimpleCost implements CostCalculator {
|
|
792
|
-
estimate(_model: string,
|
|
802
|
+
estimate(_model: string, usage?: UsageData): number | undefined;
|
|
793
803
|
}
|
|
794
804
|
|
|
795
805
|
declare class NoopReminders implements RemindersPort {
|
|
@@ -810,45 +820,6 @@ type TodoItem = {
|
|
|
810
820
|
updatedAt?: string;
|
|
811
821
|
};
|
|
812
822
|
|
|
813
|
-
declare class ToolRegistry implements ToolPort {
|
|
814
|
-
private tools;
|
|
815
|
-
private toolsMemory?;
|
|
816
|
-
private agentRegistry;
|
|
817
|
-
private assignTool?;
|
|
818
|
-
private enabledAgentsConfig;
|
|
819
|
-
constructor(opts?: {
|
|
820
|
-
todoMemory?: MemoryPort<TodoItem>;
|
|
821
|
-
toolsMemory?: MemoryPort<string>;
|
|
822
|
-
agentRegistry?: AgentRegistry;
|
|
823
|
-
});
|
|
824
|
-
private persistToolNames;
|
|
825
|
-
listRegisteredTools(): Promise<string[]>;
|
|
826
|
-
getToolDefinitions(enabledTools: string[]): ToolDefinition[];
|
|
827
|
-
/**
|
|
828
|
-
* Initialize AssignTool with orchestrator dependencies (lazy initialization)
|
|
829
|
-
*/
|
|
830
|
-
setOrchestrator(config: AgentConfig, llm: LLMPort, tools: ToolPort): void;
|
|
831
|
-
/**
|
|
832
|
-
* Get the agent registry
|
|
833
|
-
*/
|
|
834
|
-
getAgentRegistry(): AgentRegistry;
|
|
835
|
-
/**
|
|
836
|
-
* Update the enabled agents configuration for AssignTool
|
|
837
|
-
*/
|
|
838
|
-
setEnabledAgents(enabledAgents: Record<string, boolean>): void;
|
|
839
|
-
executeToolCalls(calls: ToolInvocation[], context?: Record<string, unknown>, maxConcurrent?: number, signal?: AbortSignal): Promise<ToolExecutionResult[]>;
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
declare class CompositeToolPort implements ToolPort {
|
|
843
|
-
private ports;
|
|
844
|
-
constructor(ports: ToolPort[]);
|
|
845
|
-
getToolDefinitions(enabledTools: string[]): ToolDefinition[];
|
|
846
|
-
executeToolCalls(calls: ToolInvocation[], context?: Record<string, unknown>, maxConcurrent?: number, signal?: AbortSignal): Promise<ToolExecutionResult[]>;
|
|
847
|
-
setEnabledAgents(enabledAgents: Record<string, boolean>): void;
|
|
848
|
-
getAgentRegistry(): AgentRegistry | undefined;
|
|
849
|
-
listRegisteredTools(): Promise<string[]>;
|
|
850
|
-
}
|
|
851
|
-
|
|
852
823
|
type ExecResult = Omit<ToolExecutionResult, 'id' | 'name'>;
|
|
853
824
|
type ToolExecutionContext = {
|
|
854
825
|
conversationId?: string;
|
|
@@ -867,81 +838,6 @@ interface FunctionTool<P = Record<string, unknown>, C = ToolExecutionContext> {
|
|
|
867
838
|
execute(params: P, context?: C): Promise<ExecResult> | ExecResult;
|
|
868
839
|
}
|
|
869
840
|
|
|
870
|
-
type BashParams = {
|
|
871
|
-
cmd: string;
|
|
872
|
-
cwd?: string;
|
|
873
|
-
timeoutMs?: number;
|
|
874
|
-
};
|
|
875
|
-
declare class BashTool implements FunctionTool<BashParams, ToolExecutionContext> {
|
|
876
|
-
name: "bash_tool";
|
|
877
|
-
parameters: {
|
|
878
|
-
readonly type: "object";
|
|
879
|
-
readonly properties: {
|
|
880
|
-
readonly description: {
|
|
881
|
-
readonly type: "string";
|
|
882
|
-
readonly description: "Explanation of what this command will do (e.g., \"Get git commit log\")";
|
|
883
|
-
};
|
|
884
|
-
readonly cmd: {
|
|
885
|
-
readonly type: "string";
|
|
886
|
-
readonly description: "Shell command to run.";
|
|
887
|
-
};
|
|
888
|
-
readonly cwd: {
|
|
889
|
-
readonly type: "string";
|
|
890
|
-
readonly description: "Working directory.";
|
|
891
|
-
};
|
|
892
|
-
readonly timeoutMs: {
|
|
893
|
-
readonly type: "integer";
|
|
894
|
-
readonly minimum: 1;
|
|
895
|
-
readonly description: "Timeout in ms. Default: 30000.";
|
|
896
|
-
};
|
|
897
|
-
};
|
|
898
|
-
readonly required: readonly ["cmd"];
|
|
899
|
-
};
|
|
900
|
-
definition(): ToolDefinition['function'];
|
|
901
|
-
execute(p: BashParams, ctx?: ToolExecutionContext): Promise<ExecResult>;
|
|
902
|
-
private execOnce;
|
|
903
|
-
private defaultShell;
|
|
904
|
-
private shellExists;
|
|
905
|
-
private shellArgs;
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
/**
|
|
909
|
-
* AgentManager - coordinates specialist agent execution for task delegation
|
|
910
|
-
*/
|
|
911
|
-
declare class AgentManager {
|
|
912
|
-
private delegatingConfig;
|
|
913
|
-
private delegatingLLM;
|
|
914
|
-
private delegatingTools;
|
|
915
|
-
private eventCallback?;
|
|
916
|
-
private activeAgents;
|
|
917
|
-
private eventCollectors;
|
|
918
|
-
constructor(delegatingConfig: AgentConfig, delegatingLLM: LLMPort, delegatingTools: ToolPort, eventCallback?: (event: AgentEvent) => void);
|
|
919
|
-
/**
|
|
920
|
-
* Create and execute a specialist agent for a specific task
|
|
921
|
-
*/
|
|
922
|
-
executeTask(config: SpecialistAgentConfig, signal?: AbortSignal): Promise<SpecialistAgentResult>;
|
|
923
|
-
/**
|
|
924
|
-
* Resolve which LLM to use (reuse delegating LLM or create new one)
|
|
925
|
-
*/
|
|
926
|
-
private resolveLLM;
|
|
927
|
-
/**
|
|
928
|
-
* Execute agent task with timeout
|
|
929
|
-
*/
|
|
930
|
-
private executeWithTimeout;
|
|
931
|
-
/**
|
|
932
|
-
* Get active specialist agent count
|
|
933
|
-
*/
|
|
934
|
-
getActiveAgentCount(): number;
|
|
935
|
-
/**
|
|
936
|
-
* Get events for a specific specialist agent
|
|
937
|
-
*/
|
|
938
|
-
getAgentEvents(agentId: string): AgentEvent[] | undefined;
|
|
939
|
-
/**
|
|
940
|
-
* Cleanup all active agents (emergency stop)
|
|
941
|
-
*/
|
|
942
|
-
cleanup(): void;
|
|
943
|
-
}
|
|
944
|
-
|
|
945
841
|
interface AgentCatalog {
|
|
946
842
|
list(): AgentTemplate[];
|
|
947
843
|
get(agentId: string): AgentTemplate | undefined;
|
|
@@ -1019,11 +915,51 @@ declare class DefaultSpecialistAgentFactory implements SpecialistAgentFactory {
|
|
|
1019
915
|
create(input: SpecialistAgentFactoryInput): SpecialistAgentConfig;
|
|
1020
916
|
}
|
|
1021
917
|
|
|
918
|
+
/**
|
|
919
|
+
* AgentManager - coordinates specialist agent execution for task delegation
|
|
920
|
+
*/
|
|
921
|
+
declare class AgentManager {
|
|
922
|
+
private delegatingConfig;
|
|
923
|
+
private delegatingTools;
|
|
924
|
+
private llmFactory?;
|
|
925
|
+
private eventCallback?;
|
|
926
|
+
private configResolver?;
|
|
927
|
+
private llmResolver;
|
|
928
|
+
private activeAgents;
|
|
929
|
+
private eventCollectors;
|
|
930
|
+
constructor(delegatingConfig: AgentConfig, delegatingTools: ToolPort, llmFactory?: LLMFactory, eventCallback?: (event: AgentEvent) => void, configResolver?: () => Partial<AgentConfig>);
|
|
931
|
+
/**
|
|
932
|
+
* Create and execute a specialist agent for a specific task
|
|
933
|
+
*/
|
|
934
|
+
executeTask(config: SpecialistAgentConfig, signal?: AbortSignal): Promise<SpecialistAgentResult>;
|
|
935
|
+
/**
|
|
936
|
+
* Resolve which LLM to use - creates fresh LLM instance via factory
|
|
937
|
+
*/
|
|
938
|
+
private resolveLLM;
|
|
939
|
+
/**
|
|
940
|
+
* Execute agent task with timeout
|
|
941
|
+
*/
|
|
942
|
+
private executeWithTimeout;
|
|
943
|
+
/**
|
|
944
|
+
* Get active specialist agent count
|
|
945
|
+
*/
|
|
946
|
+
getActiveAgentCount(): number;
|
|
947
|
+
/**
|
|
948
|
+
* Get events for a specific specialist agent
|
|
949
|
+
*/
|
|
950
|
+
getAgentEvents(agentId: string): AgentEvent[] | undefined;
|
|
951
|
+
/**
|
|
952
|
+
* Cleanup all active agents (emergency stop)
|
|
953
|
+
*/
|
|
954
|
+
cleanup(): void;
|
|
955
|
+
}
|
|
956
|
+
|
|
1022
957
|
declare class AgentManagerCommandRunner implements AgentCommandRunner {
|
|
1023
958
|
private readonly delegatingConfig;
|
|
1024
|
-
private readonly delegatingLLM;
|
|
1025
959
|
private readonly delegatingTools;
|
|
1026
|
-
|
|
960
|
+
private readonly llmFactory?;
|
|
961
|
+
private readonly configResolver?;
|
|
962
|
+
constructor(delegatingConfig: AgentConfig, delegatingTools: ToolPort, llmFactory?: LLMFactory, configResolver?: () => Partial<AgentConfig>);
|
|
1027
963
|
run(config: Parameters<AgentManager['executeTask']>[0], context?: ToolExecutionContext): Promise<SpecialistAgentResult>;
|
|
1028
964
|
}
|
|
1029
965
|
|
|
@@ -1054,6 +990,104 @@ declare class DefaultDelegationResultFormatter implements DelegationResultFormat
|
|
|
1054
990
|
formatError(error: unknown): string;
|
|
1055
991
|
}
|
|
1056
992
|
|
|
993
|
+
interface DelegationServiceConfig {
|
|
994
|
+
agentRegistry: AgentCatalog;
|
|
995
|
+
commandRunner: AgentCommandRunner;
|
|
996
|
+
agentListProvider?: () => Array<{
|
|
997
|
+
id: string;
|
|
998
|
+
name: string;
|
|
999
|
+
description: string;
|
|
1000
|
+
}>;
|
|
1001
|
+
}
|
|
1002
|
+
declare class DelegationServiceFactory {
|
|
1003
|
+
create(config: DelegationServiceConfig): DelegationService;
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
declare class LLMResolver {
|
|
1007
|
+
private factory;
|
|
1008
|
+
constructor(factory: LLMFactory);
|
|
1009
|
+
resolve(config: SpecialistAgentConfig): LLMPort;
|
|
1010
|
+
}
|
|
1011
|
+
|
|
1012
|
+
declare class ToolRegistry implements ToolPort, AgentAwareToolPort, OrchestratorAwareToolPort {
|
|
1013
|
+
private tools;
|
|
1014
|
+
private toolsMemory?;
|
|
1015
|
+
private agentRegistry;
|
|
1016
|
+
private delegationServiceFactory?;
|
|
1017
|
+
private assignTool?;
|
|
1018
|
+
private enabledAgentsConfig;
|
|
1019
|
+
constructor(opts?: {
|
|
1020
|
+
todoMemory?: MemoryPort<TodoItem>;
|
|
1021
|
+
toolsMemory?: MemoryPort<string>;
|
|
1022
|
+
agentRegistry?: AgentRegistry;
|
|
1023
|
+
delegationServiceFactory?: DelegationServiceFactory;
|
|
1024
|
+
});
|
|
1025
|
+
private persistToolNames;
|
|
1026
|
+
listRegisteredTools(): Promise<string[]>;
|
|
1027
|
+
getToolDefinitions(enabledTools: string[]): ToolDefinition[];
|
|
1028
|
+
/**
|
|
1029
|
+
* Initialize AssignTool with orchestrator dependencies (lazy initialization)
|
|
1030
|
+
*/
|
|
1031
|
+
setOrchestrator(config: AgentConfig, tools: ToolPort, llmFactory?: LLMFactory, configResolver?: () => Partial<AgentConfig>): void;
|
|
1032
|
+
/**
|
|
1033
|
+
* Get the agent registry
|
|
1034
|
+
*/
|
|
1035
|
+
getAgentRegistry(): AgentRegistry;
|
|
1036
|
+
/**
|
|
1037
|
+
* Update the enabled agents configuration for AssignTool
|
|
1038
|
+
*/
|
|
1039
|
+
setEnabledAgents(enabledAgents: Record<string, boolean>): void;
|
|
1040
|
+
executeToolCalls(calls: ToolInvocation[], context?: Record<string, unknown>, maxConcurrent?: number, signal?: AbortSignal): Promise<ToolExecutionResult[]>;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
declare class CompositeToolPort implements ToolPort {
|
|
1044
|
+
private ports;
|
|
1045
|
+
constructor(ports: ToolPort[]);
|
|
1046
|
+
getToolDefinitions(enabledTools: string[]): ToolDefinition[];
|
|
1047
|
+
executeToolCalls(calls: ToolInvocation[], context?: Record<string, unknown>, maxConcurrent?: number, signal?: AbortSignal): Promise<ToolExecutionResult[]>;
|
|
1048
|
+
setEnabledAgents(enabledAgents: Record<string, boolean>): void;
|
|
1049
|
+
getAgentRegistry(): AgentRegistry | undefined;
|
|
1050
|
+
listRegisteredTools(): Promise<string[]>;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1053
|
+
type BashParams = {
|
|
1054
|
+
cmd: string;
|
|
1055
|
+
cwd?: string;
|
|
1056
|
+
timeoutMs?: number;
|
|
1057
|
+
};
|
|
1058
|
+
declare class BashTool implements FunctionTool<BashParams, ToolExecutionContext> {
|
|
1059
|
+
name: "bash_tool";
|
|
1060
|
+
parameters: {
|
|
1061
|
+
readonly type: "object";
|
|
1062
|
+
readonly properties: {
|
|
1063
|
+
readonly description: {
|
|
1064
|
+
readonly type: "string";
|
|
1065
|
+
readonly description: "Explanation of what this command will do (e.g., \"Get git commit log\")";
|
|
1066
|
+
};
|
|
1067
|
+
readonly cmd: {
|
|
1068
|
+
readonly type: "string";
|
|
1069
|
+
readonly description: "Shell command to run.";
|
|
1070
|
+
};
|
|
1071
|
+
readonly cwd: {
|
|
1072
|
+
readonly type: "string";
|
|
1073
|
+
readonly description: "Working directory.";
|
|
1074
|
+
};
|
|
1075
|
+
readonly timeoutMs: {
|
|
1076
|
+
readonly type: "integer";
|
|
1077
|
+
readonly minimum: 1;
|
|
1078
|
+
readonly description: "Timeout in ms. Default: 30000.";
|
|
1079
|
+
};
|
|
1080
|
+
};
|
|
1081
|
+
readonly required: readonly ["cmd"];
|
|
1082
|
+
};
|
|
1083
|
+
definition(): ToolDefinition['function'];
|
|
1084
|
+
execute(p: BashParams, ctx?: ToolExecutionContext): Promise<ExecResult>;
|
|
1085
|
+
private execOnce;
|
|
1086
|
+
private defaultShell;
|
|
1087
|
+
private shellExists;
|
|
1088
|
+
private shellArgs;
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1057
1091
|
declare class EchoLLM implements LLMPort {
|
|
1058
1092
|
generateCompletion(params: CompletionParams): Promise<CompletionResult>;
|
|
1059
1093
|
private hasTool;
|
|
@@ -1117,42 +1151,6 @@ declare class GithubAuthTransport implements HttpTransport {
|
|
|
1117
1151
|
postStream(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<Response>;
|
|
1118
1152
|
}
|
|
1119
1153
|
|
|
1120
|
-
declare class OpenRouterAuthTransport implements HttpTransport {
|
|
1121
|
-
private readonly inner;
|
|
1122
|
-
private readonly apiKey?;
|
|
1123
|
-
private readonly baseUrl;
|
|
1124
|
-
constructor(inner: FetchTransport, apiKey?: string, baseUrl?: string);
|
|
1125
|
-
private buildFullUrl;
|
|
1126
|
-
private makeAuthHeaders;
|
|
1127
|
-
get(url: string, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1128
|
-
postJson(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1129
|
-
postStream(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<Response>;
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
declare class DeepInfraAuthTransport implements HttpTransport {
|
|
1133
|
-
private readonly inner;
|
|
1134
|
-
private readonly apiKey?;
|
|
1135
|
-
private readonly baseUrl;
|
|
1136
|
-
constructor(inner: FetchTransport, apiKey?: string, baseUrl?: string);
|
|
1137
|
-
private buildFullUrl;
|
|
1138
|
-
private makeAuthHeaders;
|
|
1139
|
-
get(url: string, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1140
|
-
postJson(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1141
|
-
postStream(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<Response>;
|
|
1142
|
-
}
|
|
1143
|
-
|
|
1144
|
-
declare class ZAIAuthTransport implements HttpTransport {
|
|
1145
|
-
private readonly inner;
|
|
1146
|
-
private readonly apiKey?;
|
|
1147
|
-
private readonly baseUrl;
|
|
1148
|
-
constructor(inner: FetchTransport, apiKey?: string, baseUrl?: string);
|
|
1149
|
-
private buildFullUrl;
|
|
1150
|
-
private makeAuthHeaders;
|
|
1151
|
-
get(url: string, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1152
|
-
postJson(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<TransportResponse>;
|
|
1153
|
-
postStream(url: string, body: unknown, headers?: HttpHeaders, signal?: AbortSignal): Promise<Response>;
|
|
1154
|
-
}
|
|
1155
|
-
|
|
1156
1154
|
declare class LLMError extends Error {
|
|
1157
1155
|
readonly statusCode?: number;
|
|
1158
1156
|
readonly isRetryable: boolean;
|
|
@@ -1188,138 +1186,6 @@ declare class GithubLLM extends BaseLLM implements LLMPort {
|
|
|
1188
1186
|
protected createTransport(): GithubAuthTransport;
|
|
1189
1187
|
}
|
|
1190
1188
|
|
|
1191
|
-
type OpenRouterOptions = {
|
|
1192
|
-
apiKey?: string;
|
|
1193
|
-
apiUrl?: string;
|
|
1194
|
-
httpLogFile?: string;
|
|
1195
|
-
enablePromptCaching?: boolean;
|
|
1196
|
-
includeUsage?: boolean;
|
|
1197
|
-
};
|
|
1198
|
-
type OpenRouterModel = {
|
|
1199
|
-
id: string;
|
|
1200
|
-
canonical_slug: string;
|
|
1201
|
-
hugging_face_id: string;
|
|
1202
|
-
name: string;
|
|
1203
|
-
created: number;
|
|
1204
|
-
description: string;
|
|
1205
|
-
context_length: number;
|
|
1206
|
-
architecture: {
|
|
1207
|
-
modality: string;
|
|
1208
|
-
input_modalities: string[];
|
|
1209
|
-
output_modalities: string[];
|
|
1210
|
-
tokenizer: string;
|
|
1211
|
-
instruct_type: string | null;
|
|
1212
|
-
};
|
|
1213
|
-
pricing: {
|
|
1214
|
-
prompt: string;
|
|
1215
|
-
completion: string;
|
|
1216
|
-
request: string;
|
|
1217
|
-
image: string;
|
|
1218
|
-
web_search: string;
|
|
1219
|
-
internal_reasoning: string;
|
|
1220
|
-
input_cache_read: string;
|
|
1221
|
-
};
|
|
1222
|
-
top_provider: {
|
|
1223
|
-
context_length: number;
|
|
1224
|
-
max_completion_tokens: number | null;
|
|
1225
|
-
is_moderated: boolean;
|
|
1226
|
-
};
|
|
1227
|
-
per_request_limits: {
|
|
1228
|
-
prompt_tokens: string;
|
|
1229
|
-
completion_tokens: string;
|
|
1230
|
-
} | null;
|
|
1231
|
-
supported_parameters: string[];
|
|
1232
|
-
default_parameters: {
|
|
1233
|
-
temperature: number | null;
|
|
1234
|
-
top_p: number | null;
|
|
1235
|
-
frequency_penalty: number | null;
|
|
1236
|
-
};
|
|
1237
|
-
};
|
|
1238
|
-
declare class OpenRouterLLM extends BaseLLM implements LLMPort {
|
|
1239
|
-
private readonly includeUsage;
|
|
1240
|
-
constructor(opts?: OpenRouterOptions);
|
|
1241
|
-
private readonly opts;
|
|
1242
|
-
protected createTransport(): OpenRouterAuthTransport;
|
|
1243
|
-
generateCompletion(params: CompletionParams, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1244
|
-
streamCompletion(params: CompletionParams, handlers?: {
|
|
1245
|
-
onChunk?: (delta: string, usage?: UsageData) => void;
|
|
1246
|
-
onToolCallDelta?: (tc: ToolCall) => void;
|
|
1247
|
-
onStreamFinish?: (finishReason?: string, usage?: UsageData) => void;
|
|
1248
|
-
}, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1249
|
-
getModels(signal?: AbortSignal): Promise<OpenRouterModel[]>;
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
type DeepInfraOptions = {
|
|
1253
|
-
apiKey?: string;
|
|
1254
|
-
apiUrl?: string;
|
|
1255
|
-
httpLogFile?: string;
|
|
1256
|
-
};
|
|
1257
|
-
type DeepInfraModel = {
|
|
1258
|
-
id: string;
|
|
1259
|
-
object: string;
|
|
1260
|
-
created: number;
|
|
1261
|
-
owned_by: string;
|
|
1262
|
-
root: string;
|
|
1263
|
-
parent: string | null;
|
|
1264
|
-
metadata: {
|
|
1265
|
-
description: string;
|
|
1266
|
-
context_length: number;
|
|
1267
|
-
max_tokens: number;
|
|
1268
|
-
pricing: {
|
|
1269
|
-
input_tokens: number;
|
|
1270
|
-
output_tokens: number;
|
|
1271
|
-
cache_read_tokens?: number;
|
|
1272
|
-
};
|
|
1273
|
-
tags: string[];
|
|
1274
|
-
};
|
|
1275
|
-
};
|
|
1276
|
-
declare class DeepInfraLLM extends BaseLLM implements LLMPort {
|
|
1277
|
-
private readonly opts;
|
|
1278
|
-
constructor(opts?: DeepInfraOptions);
|
|
1279
|
-
protected createTransport(): DeepInfraAuthTransport;
|
|
1280
|
-
getModels(signal?: AbortSignal): Promise<DeepInfraModel[]>;
|
|
1281
|
-
}
|
|
1282
|
-
|
|
1283
|
-
type ZaiOptions = {
|
|
1284
|
-
apiKey?: string;
|
|
1285
|
-
apiUrl?: string;
|
|
1286
|
-
httpLogFile?: string;
|
|
1287
|
-
};
|
|
1288
|
-
declare class ZaiLLM extends BaseLLM implements LLMPort {
|
|
1289
|
-
private readonly opts;
|
|
1290
|
-
constructor(opts?: ZaiOptions);
|
|
1291
|
-
protected createTransport(): ZAIAuthTransport;
|
|
1292
|
-
}
|
|
1293
|
-
|
|
1294
|
-
type AnthropicOptions = {
|
|
1295
|
-
apiKey?: string;
|
|
1296
|
-
oauth?: {
|
|
1297
|
-
type: 'oauth';
|
|
1298
|
-
access: string;
|
|
1299
|
-
refresh: string;
|
|
1300
|
-
expires: number;
|
|
1301
|
-
};
|
|
1302
|
-
apiUrl?: string;
|
|
1303
|
-
httpLogFile?: string;
|
|
1304
|
-
};
|
|
1305
|
-
declare class AnthropicLLM {
|
|
1306
|
-
private transport;
|
|
1307
|
-
private readonly opts;
|
|
1308
|
-
private readonly apiUrl;
|
|
1309
|
-
constructor(opts?: AnthropicOptions);
|
|
1310
|
-
private getTransport;
|
|
1311
|
-
private transformToAnthropicMessages;
|
|
1312
|
-
private transformTools;
|
|
1313
|
-
private transformToolChoice;
|
|
1314
|
-
private transformResponse;
|
|
1315
|
-
generateCompletion(params: CompletionParams, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1316
|
-
streamCompletion(params: CompletionParams, handlers?: {
|
|
1317
|
-
onChunk?: (delta: string, usage?: UsageData) => void;
|
|
1318
|
-
onToolCallDelta?: (tc: ToolCall) => void;
|
|
1319
|
-
onStreamFinish?: (finishReason?: string, usage?: UsageData) => void;
|
|
1320
|
-
}, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1321
|
-
}
|
|
1322
|
-
|
|
1323
1189
|
type AnthropicAISDKOptions = {
|
|
1324
1190
|
apiKey?: string;
|
|
1325
1191
|
oauth?: {
|
|
@@ -1360,6 +1226,17 @@ declare class AnthropicAISDKLLM {
|
|
|
1360
1226
|
}, signal?: AbortSignal): Promise<CompletionResult>;
|
|
1361
1227
|
}
|
|
1362
1228
|
|
|
1229
|
+
interface LLMOptions {
|
|
1230
|
+
apiKey?: string;
|
|
1231
|
+
apiUrl?: string;
|
|
1232
|
+
httpLogFile?: string;
|
|
1233
|
+
enablePromptCaching?: boolean;
|
|
1234
|
+
includeUsage?: boolean;
|
|
1235
|
+
}
|
|
1236
|
+
declare function createLLM(providerName: string, options?: LLMOptions): LLMPort;
|
|
1237
|
+
declare function getAvailableProviders(): string[];
|
|
1238
|
+
declare function supportsGetModels(providerName: string): boolean;
|
|
1239
|
+
|
|
1363
1240
|
type MCPHttpOptions = {
|
|
1364
1241
|
type: 'http';
|
|
1365
1242
|
url: string;
|
|
@@ -1449,4 +1326,4 @@ declare function resolveBackspaces(s: string): string;
|
|
|
1449
1326
|
declare function stripAnsiAndControls(s: string): string;
|
|
1450
1327
|
declare function canonicalizeTerminalPaste(raw: string): string;
|
|
1451
1328
|
|
|
1452
|
-
export { AGENT_CREATOR_SYSTEM_PROMPT, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentTemplate, AnthropicAISDKLLM,
|
|
1329
|
+
export { AGENT_CREATOR_SYSTEM_PROMPT, type AgentAwareToolPort, type AgentCatalog, type AgentConfig, type AgentEvent, AgentEventTypes, AgentFilePersistence, AgentManager, AgentManagerCommandRunner, AgentOrchestrator, AgentRegistry, type AgentTemplate, AnthropicAISDKLLM, type AssignParams, BashTool, CompositeToolPort, type Conversation, ConversationContext, type ConversationMetadata, type ConversationSnapshot, ConversationStore, CoreMCPClient, DefaultDelegationPolicy, DefaultDelegationResultFormatter, DefaultDelegationService, DefaultSpecialistAgentFactory, type DelegationService, type DelegationServiceConfig, DelegationServiceFactory, EchoLLM, type FolderTreeOptions, GithubLLM, InMemoryMemory, InMemoryMetadata, JsonFileMemoryPersistence, type LLMConfig, LLMError, type LLMFactory, type LLMOptions, type LLMPort, LLMResolver, type MCPConfig, type MCPServerConfig, MCPToolPort, type MemoryPort, MemoryPortMetadataAdapter, type Message, type MessageContent, type MessageContentPart, type MetadataPort, NoopReminders, type OrchestratorAwareToolPort, PersistedMemory, PersistingConsoleEventPort, RuntimeEnv, type SendMessageOptions, SimpleContextBuilder, SimpleCost, SimpleId, type SpecialistAgentConfig, type SpecialistAgentResult, SystemClock, type ToolApprovalDecision, type ToolCall, type ToolExecutionResult, type ToolPort, ToolRegistry, type UserAttachment, type UserMessagePayload, buildAgentCreationPrompt, buildInjectedSystem, canonicalizeTerminalPaste, createLLM, generateFolderTree, getAvailableProviders, loadMCPConfig, normalizeNewlines, renderTemplate, resolveBackspaces, resolveCarriageReturns, stripAnsiAndControls, supportsGetModels };
|