@cortask/core 0.2.37 → 0.2.39
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.ts +65 -1
- package/dist/index.js +684 -108
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.d.ts
CHANGED
|
@@ -162,6 +162,47 @@ declare const AVAILABLE_PROVIDERS: ProviderInfo[];
|
|
|
162
162
|
declare function getProviderInfo(id: ProviderId): ProviderInfo | undefined;
|
|
163
163
|
declare function createProvider(id: ProviderId, apiKey: string): LLMProvider;
|
|
164
164
|
|
|
165
|
+
interface MemoryEntry {
|
|
166
|
+
id: string;
|
|
167
|
+
content: string;
|
|
168
|
+
source: "conversation" | "manual" | "agent";
|
|
169
|
+
sessionId?: string;
|
|
170
|
+
createdAt: string;
|
|
171
|
+
metadata: Record<string, unknown>;
|
|
172
|
+
}
|
|
173
|
+
interface MemorySearchResult {
|
|
174
|
+
entry: MemoryEntry;
|
|
175
|
+
score: number;
|
|
176
|
+
matchType: "vector" | "fts" | "hybrid";
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface LocalEmbeddingProvider {
|
|
180
|
+
id: "local";
|
|
181
|
+
model: string;
|
|
182
|
+
embedQuery(text: string): Promise<number[]>;
|
|
183
|
+
embedBatch(texts: string[]): Promise<number[][]>;
|
|
184
|
+
dispose(): void;
|
|
185
|
+
}
|
|
186
|
+
declare function createLocalEmbeddingProvider(modelPath?: string): Promise<LocalEmbeddingProvider>;
|
|
187
|
+
|
|
188
|
+
declare class MemoryManager {
|
|
189
|
+
private store;
|
|
190
|
+
private embeddingService;
|
|
191
|
+
constructor(opts: {
|
|
192
|
+
dbPath: string;
|
|
193
|
+
apiProvider?: LLMProvider;
|
|
194
|
+
localProvider?: LocalEmbeddingProvider;
|
|
195
|
+
embeddingModel?: string;
|
|
196
|
+
});
|
|
197
|
+
index(entries: MemoryEntry[]): Promise<void>;
|
|
198
|
+
search(query: string, limit?: number): Promise<MemorySearchResult[]>;
|
|
199
|
+
list(limit?: number): Promise<MemoryEntry[]>;
|
|
200
|
+
delete(id: string): Promise<void>;
|
|
201
|
+
clearEmbeddings(): Promise<void>;
|
|
202
|
+
clear(): Promise<void>;
|
|
203
|
+
close(): void;
|
|
204
|
+
}
|
|
205
|
+
|
|
165
206
|
interface Attachment {
|
|
166
207
|
mimeType: string;
|
|
167
208
|
base64: string;
|
|
@@ -170,6 +211,7 @@ interface Attachment {
|
|
|
170
211
|
interface AgentRunParams {
|
|
171
212
|
prompt: string;
|
|
172
213
|
attachments?: Attachment[];
|
|
214
|
+
fileReferences?: string[];
|
|
173
215
|
sessionId?: string;
|
|
174
216
|
workspaceId?: string;
|
|
175
217
|
signal?: AbortSignal;
|
|
@@ -236,8 +278,10 @@ interface ToolExecutionContext {
|
|
|
236
278
|
dataDir: string;
|
|
237
279
|
sessionId: string;
|
|
238
280
|
runId: string;
|
|
281
|
+
workspaceId?: string;
|
|
239
282
|
requestPermission: (req: PermissionRequest) => Promise<boolean>;
|
|
240
283
|
requestQuestionnaire: (req: QuestionnaireRequest) => Promise<QuestionnaireResponse>;
|
|
284
|
+
memoryManager?: MemoryManager;
|
|
241
285
|
}
|
|
242
286
|
|
|
243
287
|
interface AgentRunnerConfig {
|
|
@@ -257,6 +301,7 @@ interface AgentRunnerDeps {
|
|
|
257
301
|
getSkillPrompts: () => string[];
|
|
258
302
|
getSessionMessages: (sessionId: string) => Promise<Message[]>;
|
|
259
303
|
saveSessionMessages: (sessionId: string, messages: Message[]) => Promise<void>;
|
|
304
|
+
memoryManager?: MemoryManager;
|
|
260
305
|
channel?: {
|
|
261
306
|
type: string;
|
|
262
307
|
chatId: string;
|
|
@@ -271,6 +316,7 @@ declare class AgentRunner {
|
|
|
271
316
|
private getToolHandler;
|
|
272
317
|
private buildSystemPromptText;
|
|
273
318
|
private createToolContext;
|
|
319
|
+
private readFileReferences;
|
|
274
320
|
run(params: AgentRunParams): Promise<AgentRunResult>;
|
|
275
321
|
runStream(params: AgentRunParams): AsyncIterable<AgentStreamEvent>;
|
|
276
322
|
}
|
|
@@ -717,6 +763,16 @@ declare const cortaskConfigSchema: z.ZodObject<{
|
|
|
717
763
|
}, {
|
|
718
764
|
dirs?: string[] | undefined;
|
|
719
765
|
}>>;
|
|
766
|
+
memory: z.ZodDefault<z.ZodObject<{
|
|
767
|
+
embeddingProvider: z.ZodDefault<z.ZodEnum<["local", "openai", "google", "ollama"]>>;
|
|
768
|
+
embeddingModel: z.ZodOptional<z.ZodString>;
|
|
769
|
+
}, "strip", z.ZodTypeAny, {
|
|
770
|
+
embeddingProvider: "openai" | "google" | "ollama" | "local";
|
|
771
|
+
embeddingModel?: string | undefined;
|
|
772
|
+
}, {
|
|
773
|
+
embeddingProvider?: "openai" | "google" | "ollama" | "local" | undefined;
|
|
774
|
+
embeddingModel?: string | undefined;
|
|
775
|
+
}>>;
|
|
720
776
|
server: z.ZodDefault<z.ZodObject<{
|
|
721
777
|
port: z.ZodDefault<z.ZodNumber>;
|
|
722
778
|
host: z.ZodDefault<z.ZodString>;
|
|
@@ -779,6 +835,10 @@ declare const cortaskConfigSchema: z.ZodObject<{
|
|
|
779
835
|
allowedUsers: string[];
|
|
780
836
|
};
|
|
781
837
|
};
|
|
838
|
+
memory: {
|
|
839
|
+
embeddingProvider: "openai" | "google" | "ollama" | "local";
|
|
840
|
+
embeddingModel?: string | undefined;
|
|
841
|
+
};
|
|
782
842
|
server: {
|
|
783
843
|
port: number;
|
|
784
844
|
host: string;
|
|
@@ -835,6 +895,10 @@ declare const cortaskConfigSchema: z.ZodObject<{
|
|
|
835
895
|
allowedUsers?: string[] | undefined;
|
|
836
896
|
} | undefined;
|
|
837
897
|
} | undefined;
|
|
898
|
+
memory?: {
|
|
899
|
+
embeddingProvider?: "openai" | "google" | "ollama" | "local" | undefined;
|
|
900
|
+
embeddingModel?: string | undefined;
|
|
901
|
+
} | undefined;
|
|
838
902
|
server?: {
|
|
839
903
|
port?: number | undefined;
|
|
840
904
|
host?: string | undefined;
|
|
@@ -1217,4 +1281,4 @@ declare class Logger {
|
|
|
1217
1281
|
}
|
|
1218
1282
|
declare const logger: Logger;
|
|
1219
1283
|
|
|
1220
|
-
export { AVAILABLE_PROVIDERS, type AgentRunParams, type AgentRunResult, AgentRunner, type AgentRunnerConfig, type AgentRunnerDeps, type AgentStreamEvent, AnthropicProvider, type Artifact, ArtifactStore, type Attachment, type ChannelType, type ContentPart, type CortaskConfig, type CredentialDefinition, type CredentialSchema, type CredentialStore, type CronDelivery, type CronEvent, type CronJob, type CronJobCreate, type CronJobState, type CronSchedule, CronService, type EmbedParams, type EmbedResult, type EnabledModel, EncryptedCredentialStore, type GenerateTextParams, type GenerateTextResult, GoogleProvider, GrokProvider, type LLMProvider, type LogLevel, MODEL_DEFINITIONS, type Message, MiniMaxProvider, type ModelInfo, ModelStore, MoonshotProvider, OllamaProvider, type OnboardingData, type OnboardingStatus, OpenAICompatibleProvider, OpenAIProvider, OpenRouterProvider, type PermissionRequest, type PromptTemplate, type ProviderId, type ProviderInfo, type ProviderValidationResult, type QuestionnaireQuestion, type QuestionnaireRequest, type QuestionnaireResponse, SUBAGENT_DEFAULTS, type Session, SessionStore, type SessionWithMessages, type SkillCodeTool, type SkillEntry, type SkillManifest, type SkillSource, type SkillToolTemplate, type StreamChunk, type SubagentRunRecord, TemplateStore, type ToolCall, type ToolDefinition, type ToolExecutionContext, type ToolHandler, type ToolResult, type UsageRecord, UsageStore, type UsageSummary, type Workspace, WorkspaceManager, buildSkillOAuth2AuthUrl, buildSkillTools, buildSystemPrompt, builtinTools, cancelChildrenOfSession, cancelSubagentRun, cleanupSubagentRecords, clearSkillCache, completeSubagentRun, computeNextRunAtMs, cortaskConfigSchema, countActiveChildren, createArtifactTool, createBrowserTool, createCronTool, createProvider, createSkill, createSkillTool, createSubagentTool, createSwitchWorkspaceTool, credentialKey, ensureInstalled as ensureBrowserInstalled, estimateCost, exchangeSkillOAuth2Code, getCredentialStorageKey, getDataDir, getDepthForSession, getEligibleSkills, getModelDefinitions, getOAuth2StorageKeys, getOrCreateSecret, getProviderInfo, getSubagentRun, installSkillFromGit, loadConfig, loadSkills, logger, migrateAllWorkspaces, migrateSessionDatabase, readSkillFile, registerSubagentRun, removeSkill, revokeSkillOAuth2, saveConfig, setSubagentRunner, updateSkill, validateCronExpr, validateProvider, validateSkillName };
|
|
1284
|
+
export { AVAILABLE_PROVIDERS, type AgentRunParams, type AgentRunResult, AgentRunner, type AgentRunnerConfig, type AgentRunnerDeps, type AgentStreamEvent, AnthropicProvider, type Artifact, ArtifactStore, type Attachment, type ChannelType, type ContentPart, type CortaskConfig, type CredentialDefinition, type CredentialSchema, type CredentialStore, type CronDelivery, type CronEvent, type CronJob, type CronJobCreate, type CronJobState, type CronSchedule, CronService, type EmbedParams, type EmbedResult, type EnabledModel, EncryptedCredentialStore, type GenerateTextParams, type GenerateTextResult, GoogleProvider, GrokProvider, type LLMProvider, type LocalEmbeddingProvider, type LogLevel, MODEL_DEFINITIONS, type MemoryEntry, MemoryManager, type MemorySearchResult, type Message, MiniMaxProvider, type ModelInfo, ModelStore, MoonshotProvider, OllamaProvider, type OnboardingData, type OnboardingStatus, OpenAICompatibleProvider, OpenAIProvider, OpenRouterProvider, type PermissionRequest, type PromptTemplate, type ProviderId, type ProviderInfo, type ProviderValidationResult, type QuestionnaireQuestion, type QuestionnaireRequest, type QuestionnaireResponse, SUBAGENT_DEFAULTS, type Session, SessionStore, type SessionWithMessages, type SkillCodeTool, type SkillEntry, type SkillManifest, type SkillSource, type SkillToolTemplate, type StreamChunk, type SubagentRunRecord, TemplateStore, type ToolCall, type ToolDefinition, type ToolExecutionContext, type ToolHandler, type ToolResult, type UsageRecord, UsageStore, type UsageSummary, type Workspace, WorkspaceManager, buildSkillOAuth2AuthUrl, buildSkillTools, buildSystemPrompt, builtinTools, cancelChildrenOfSession, cancelSubagentRun, cleanupSubagentRecords, clearSkillCache, completeSubagentRun, computeNextRunAtMs, cortaskConfigSchema, countActiveChildren, createArtifactTool, createBrowserTool, createCronTool, createLocalEmbeddingProvider, createProvider, createSkill, createSkillTool, createSubagentTool, createSwitchWorkspaceTool, credentialKey, ensureInstalled as ensureBrowserInstalled, estimateCost, exchangeSkillOAuth2Code, getCredentialStorageKey, getDataDir, getDepthForSession, getEligibleSkills, getModelDefinitions, getOAuth2StorageKeys, getOrCreateSecret, getProviderInfo, getSubagentRun, installSkillFromGit, loadConfig, loadSkills, logger, migrateAllWorkspaces, migrateSessionDatabase, readSkillFile, registerSubagentRun, removeSkill, revokeSkillOAuth2, saveConfig, setSubagentRunner, updateSkill, validateCronExpr, validateProvider, validateSkillName };
|