@exulu/backend 4.3.3 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-D4PCOOL5.js → chunk-MUR4WZLA.js} +9396 -3056
- package/dist/{convert-exulu-tools-to-ai-sdk-tools-AHRL4TN4.js → convert-exulu-tools-to-ai-sdk-tools-IFENSB7J.js} +1 -1
- package/dist/index.cjs +26409 -21708
- package/dist/index.d.cts +178 -2
- package/dist/index.d.ts +178 -2
- package/dist/index.js +8951 -10968
- package/ee/agentic-retrieval/pipeline/config.test.ts +15 -0
- package/ee/agentic-retrieval/pipeline/config.ts +6 -0
- package/ee/agentic-retrieval/pipeline/index.test.ts +99 -3
- package/ee/agentic-retrieval/pipeline/index.ts +50 -16
- package/ee/agentic-retrieval/pipeline/memory.test.ts +40 -28
- package/ee/agentic-retrieval/pipeline/memory.ts +8 -138
- package/ee/agentic-retrieval/pipeline/search.ts +8 -1
- package/ee/invoke-skills/create-sandbox.audit.test.ts +78 -0
- package/ee/invoke-skills/create-sandbox.env.test.ts +32 -0
- package/ee/invoke-skills/create-sandbox.ts +132 -29
- package/ee/invoke-skills/skill-env.test.ts +110 -0
- package/ee/invoke-skills/skill-env.ts +72 -0
- package/ee/invoke-skills/variable-grants.test.ts +52 -0
- package/ee/invoke-skills/variable-grants.ts +59 -0
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -113,6 +113,8 @@ interface ExuluAgent {
|
|
|
113
113
|
provider?: string;
|
|
114
114
|
source: "code" | "database";
|
|
115
115
|
memory?: string;
|
|
116
|
+
/** Memory behaviour (retrieval limit, visibility preselect, guest display). null = defaults. */
|
|
117
|
+
memory_config?: Record<string, unknown> | string | null;
|
|
116
118
|
welcomemessage?: string;
|
|
117
119
|
defaultagent?: boolean;
|
|
118
120
|
type: "agent";
|
|
@@ -902,6 +904,15 @@ declare class ExuluTool {
|
|
|
902
904
|
type: ToolType;
|
|
903
905
|
tool: Tool;
|
|
904
906
|
needsApproval: boolean;
|
|
907
|
+
/**
|
|
908
|
+
* Dynamic approval check (memory tools): decides per call whether the
|
|
909
|
+
* approval card is shown. When set, the AI SDK wrapper uses it instead of
|
|
910
|
+
* the boolean and never applies the "Allow for this chat" shortcut.
|
|
911
|
+
*/
|
|
912
|
+
needsApprovalFn?: (input: unknown, options: {
|
|
913
|
+
toolCallId: string;
|
|
914
|
+
messages: unknown[];
|
|
915
|
+
}) => Promise<boolean>;
|
|
905
916
|
authentication?: ExuluAuthConfig;
|
|
906
917
|
config: {
|
|
907
918
|
name: string;
|
|
@@ -909,7 +920,7 @@ declare class ExuluTool {
|
|
|
909
920
|
type: "boolean" | "string" | "number" | "variable" | "json";
|
|
910
921
|
default?: string | boolean | number | object;
|
|
911
922
|
}[];
|
|
912
|
-
constructor({ id, name, description, category, inputSchema, type, execute, config, needsApproval, authentication, }: {
|
|
923
|
+
constructor({ id, name, description, category, inputSchema, type, execute, config, needsApproval, needsApprovalFn, authentication, }: {
|
|
913
924
|
id: string;
|
|
914
925
|
name: string;
|
|
915
926
|
description: string;
|
|
@@ -923,6 +934,10 @@ declare class ExuluTool {
|
|
|
923
934
|
default?: string | boolean | number | object;
|
|
924
935
|
}[];
|
|
925
936
|
needsApproval?: boolean;
|
|
937
|
+
needsApprovalFn?: (input: unknown, options: {
|
|
938
|
+
toolCallId: string;
|
|
939
|
+
messages: unknown[];
|
|
940
|
+
}) => Promise<boolean>;
|
|
926
941
|
authentication?: ExuluAuthConfig;
|
|
927
942
|
execute: (inputs: any, options?: any) => Promise<{
|
|
928
943
|
result?: string;
|
|
@@ -985,6 +1000,9 @@ type AuditConfig = {
|
|
|
985
1000
|
include?: string[];
|
|
986
1001
|
exclude?: string[];
|
|
987
1002
|
};
|
|
1003
|
+
skillSandbox?: {
|
|
1004
|
+
enabled?: boolean;
|
|
1005
|
+
};
|
|
988
1006
|
};
|
|
989
1007
|
};
|
|
990
1008
|
|
|
@@ -1072,6 +1090,7 @@ interface AuditLogger {
|
|
|
1072
1090
|
failClosed: boolean;
|
|
1073
1091
|
isBuiltin: (id: string) => boolean;
|
|
1074
1092
|
shouldAuditTool: (id: string) => boolean;
|
|
1093
|
+
shouldAuditSkillSandbox: () => boolean;
|
|
1075
1094
|
record: (event: AuditEvent) => void;
|
|
1076
1095
|
recordToolCall: (ctx: AuditToolCallInput) => Promise<void>;
|
|
1077
1096
|
flush: () => Promise<void>;
|
|
@@ -1858,6 +1877,91 @@ declare function postgresClient(): Promise<{
|
|
|
1858
1877
|
db: Knex;
|
|
1859
1878
|
}>;
|
|
1860
1879
|
|
|
1880
|
+
type RecallSource = "prefetch" | "knowledge_search";
|
|
1881
|
+
type MemoryItemRow = {
|
|
1882
|
+
id: string;
|
|
1883
|
+
name?: string | null;
|
|
1884
|
+
information?: string | null;
|
|
1885
|
+
description?: string | null;
|
|
1886
|
+
type?: string | null;
|
|
1887
|
+
rights_mode?: string | null;
|
|
1888
|
+
created_by?: number | string | null;
|
|
1889
|
+
createdAt?: string | Date | null;
|
|
1890
|
+
updatedAt?: string | Date | null;
|
|
1891
|
+
};
|
|
1892
|
+
type RecalledMemory = {
|
|
1893
|
+
id: string;
|
|
1894
|
+
contextId: string;
|
|
1895
|
+
title: string;
|
|
1896
|
+
information: string;
|
|
1897
|
+
type?: string;
|
|
1898
|
+
rights_mode: ExuluRightsMode;
|
|
1899
|
+
createdBy: {
|
|
1900
|
+
id: number;
|
|
1901
|
+
name: string;
|
|
1902
|
+
} | null;
|
|
1903
|
+
createdAt: string;
|
|
1904
|
+
updatedAt: string;
|
|
1905
|
+
source: RecallSource;
|
|
1906
|
+
};
|
|
1907
|
+
type UserRow = {
|
|
1908
|
+
id: number;
|
|
1909
|
+
firstname?: string | null;
|
|
1910
|
+
lastname?: string | null;
|
|
1911
|
+
email?: string | null;
|
|
1912
|
+
};
|
|
1913
|
+
/**
|
|
1914
|
+
* Request-scoped collector of memories the model was given this turn
|
|
1915
|
+
* (spec §3.1). Item rows come through the caller's RBAC-scoped loader, so a
|
|
1916
|
+
* chunk the user may not see never produces an entry.
|
|
1917
|
+
*/
|
|
1918
|
+
declare class RecallCollector {
|
|
1919
|
+
private readonly deps;
|
|
1920
|
+
private readonly items;
|
|
1921
|
+
private readonly creators;
|
|
1922
|
+
constructor(deps: {
|
|
1923
|
+
contextId: string;
|
|
1924
|
+
loadItems: (ids: string[]) => Promise<MemoryItemRow[]>;
|
|
1925
|
+
loadUsers: (ids: number[]) => Promise<UserRow[]>;
|
|
1926
|
+
});
|
|
1927
|
+
addFromChunks(chunks: VectorSearchChunkResult[], source: RecallSource): Promise<void>;
|
|
1928
|
+
addRows(rows: MemoryItemRow[], source: RecallSource): Promise<void>;
|
|
1929
|
+
list(): RecalledMemory[];
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
type RecallResult = {
|
|
1933
|
+
collector: RecallCollector | undefined;
|
|
1934
|
+
memoryItems: VectorSearchChunkResult[] | undefined;
|
|
1935
|
+
promptBlock: string;
|
|
1936
|
+
};
|
|
1937
|
+
/**
|
|
1938
|
+
* Memory pre-fetch shared by generateSync and generateStream (spec §3.1):
|
|
1939
|
+
* user-scoped hybrid search over the agent's memory context, limited by
|
|
1940
|
+
* memory_config, feeding the recall collector and the model-visible block.
|
|
1941
|
+
*/
|
|
1942
|
+
declare function recallMemories({ agent, contexts, query, user, db, previousUserTurns }: {
|
|
1943
|
+
agent: ExuluAgent | undefined;
|
|
1944
|
+
contexts: ExuluContext[] | undefined;
|
|
1945
|
+
query: string | undefined;
|
|
1946
|
+
user: User | undefined;
|
|
1947
|
+
db: any;
|
|
1948
|
+
previousUserTurns?: string[];
|
|
1949
|
+
}): Promise<RecallResult>;
|
|
1950
|
+
|
|
1951
|
+
type MemoryBaseCheck = {
|
|
1952
|
+
ok: boolean;
|
|
1953
|
+
missing: string[];
|
|
1954
|
+
};
|
|
1955
|
+
type FieldLike = {
|
|
1956
|
+
name: string;
|
|
1957
|
+
type: string;
|
|
1958
|
+
enumValues?: string[] | null;
|
|
1959
|
+
};
|
|
1960
|
+
type ContextLike = {
|
|
1961
|
+
fields?: FieldLike[];
|
|
1962
|
+
} | null | undefined;
|
|
1963
|
+
declare function checkMemoryBase(context: ContextLike): MemoryBaseCheck;
|
|
1964
|
+
|
|
1861
1965
|
/**
|
|
1862
1966
|
* Switch this process into LiteLLM *client* mode: it connects to an
|
|
1863
1967
|
* externally-managed proxy (spawned by the Exulu HTTP server process, or a
|
|
@@ -2566,6 +2670,78 @@ declare const ExuluRecall: {
|
|
|
2566
2670
|
getRecordingVideoUrl: (recordingId: string) => Promise<string | null>;
|
|
2567
2671
|
};
|
|
2568
2672
|
|
|
2673
|
+
type StoredProjection = {
|
|
2674
|
+
context: string;
|
|
2675
|
+
dims: number;
|
|
2676
|
+
components: number;
|
|
2677
|
+
mean: number[];
|
|
2678
|
+
basis: number[][];
|
|
2679
|
+
map: number[][];
|
|
2680
|
+
intercept: number[];
|
|
2681
|
+
method: string;
|
|
2682
|
+
version: number;
|
|
2683
|
+
sample_size: number;
|
|
2684
|
+
residual: number;
|
|
2685
|
+
fitted_at: Date;
|
|
2686
|
+
};
|
|
2687
|
+
type FitResult = {
|
|
2688
|
+
fitted: boolean;
|
|
2689
|
+
reason?: string;
|
|
2690
|
+
sampleSize: number;
|
|
2691
|
+
components: number;
|
|
2692
|
+
residual: number;
|
|
2693
|
+
written: number;
|
|
2694
|
+
/** Vectors withheld from the solve the `residual` was scored on; 0 means the
|
|
2695
|
+
* sample was too small to hold any out and the number is in-sample. */
|
|
2696
|
+
heldOut: number;
|
|
2697
|
+
/** Named regions stored for the base; 0 when nothing was written. */
|
|
2698
|
+
topics: number;
|
|
2699
|
+
};
|
|
2700
|
+
type UmapLike = {
|
|
2701
|
+
fit: (rows: number[][]) => number[][];
|
|
2702
|
+
};
|
|
2703
|
+
/** Every context with a chunks table, for `--all`. Contexts live in the consuming app, so this reads the database. */
|
|
2704
|
+
declare function listFittableContexts(db: any): Promise<string[]>;
|
|
2705
|
+
/**
|
|
2706
|
+
* Fits a context's projection (spec §3) and backfills chunk coordinates.
|
|
2707
|
+
* Id-only: everything it needs is in the database. `umapFactory` is injectable
|
|
2708
|
+
* so tests never run a real layout.
|
|
2709
|
+
*/
|
|
2710
|
+
declare function fitContextProjection({ db, contextId, sample, components, dryRun, umapFactory, log, }: {
|
|
2711
|
+
db: any;
|
|
2712
|
+
contextId: string;
|
|
2713
|
+
sample?: number;
|
|
2714
|
+
components?: number;
|
|
2715
|
+
dryRun?: boolean;
|
|
2716
|
+
umapFactory?: (seed: number, n: number) => UmapLike;
|
|
2717
|
+
log?: (line: string) => void;
|
|
2718
|
+
}): Promise<FitResult>;
|
|
2719
|
+
/**
|
|
2720
|
+
* Streams every embedded chunk of the context and writes its coordinates.
|
|
2721
|
+
*
|
|
2722
|
+
* `layout` carries the true layout position of each chunk the fit sampled, and
|
|
2723
|
+
* is preferred wherever it has one; the linear map places the rest, which is
|
|
2724
|
+
* what it was learned for. It is optional because this is exported from the
|
|
2725
|
+
* package entry point: given none, every row goes through the map, exactly as
|
|
2726
|
+
* before.
|
|
2727
|
+
*
|
|
2728
|
+
* Calling it that way on a base that has ALREADY been fitted is destructive:
|
|
2729
|
+
* nothing but px/py/pz persists a sampled chunk's true layout position, so
|
|
2730
|
+
* every one of them is overwritten with the map's linear estimate and only a
|
|
2731
|
+
* refit brings them back.
|
|
2732
|
+
*/
|
|
2733
|
+
declare function backfillCoordinates({ db, contextId, projection, layout, batch, log, }: {
|
|
2734
|
+
db: any;
|
|
2735
|
+
contextId: string;
|
|
2736
|
+
projection: StoredProjection;
|
|
2737
|
+
layout?: Map<string, [number, number, number]>;
|
|
2738
|
+
batch?: number;
|
|
2739
|
+
log?: (line: string) => void;
|
|
2740
|
+
}): Promise<number>;
|
|
2741
|
+
|
|
2742
|
+
/** Vector map (3c-1) knobs. One place; nothing else hardcodes them. */
|
|
2743
|
+
declare const PROJECTION_VERSION = 1;
|
|
2744
|
+
|
|
2569
2745
|
declare const ExuluJobs: {
|
|
2570
2746
|
redis: typeof redisClient;
|
|
2571
2747
|
};
|
|
@@ -2641,4 +2817,4 @@ declare const ExuluPython: {
|
|
|
2641
2817
|
instructions: typeof getPythonSetupInstructions;
|
|
2642
2818
|
};
|
|
2643
2819
|
|
|
2644
|
-
export { type AuditConfig, type AuditEvent, type AuditLogger, type ChunkerOperation, type ChunkerResponse, type CredentialField, CredentialInvalidError, type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, type ExuluAgent, ExuluApp, type ExuluAuthConfig, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder, type ExuluCredentialsToolContext, ExuluDatabase, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluModels, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluRecall, ExuluReranker, ExuluTool, type ExuluUserCredentialsConfig, ExuluVariables, type VectorSearchChunkResult, defaultChunker, enableLiteLLMClientMode, postgresClient };
|
|
2820
|
+
export { type AuditConfig, type AuditEvent, type AuditLogger, type ChunkerOperation, type ChunkerResponse, type CredentialField, CredentialInvalidError, type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, type ExuluAgent, ExuluApp, type ExuluAuthConfig, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder, type ExuluCredentialsToolContext, ExuluDatabase, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluModels, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluRecall, ExuluReranker, ExuluTool, type ExuluUserCredentialsConfig, ExuluVariables, PROJECTION_VERSION, type VectorSearchChunkResult, backfillCoordinates, checkMemoryBase, defaultChunker, enableLiteLLMClientMode, fitContextProjection, listFittableContexts, postgresClient, recallMemories };
|
package/dist/index.d.ts
CHANGED
|
@@ -113,6 +113,8 @@ interface ExuluAgent {
|
|
|
113
113
|
provider?: string;
|
|
114
114
|
source: "code" | "database";
|
|
115
115
|
memory?: string;
|
|
116
|
+
/** Memory behaviour (retrieval limit, visibility preselect, guest display). null = defaults. */
|
|
117
|
+
memory_config?: Record<string, unknown> | string | null;
|
|
116
118
|
welcomemessage?: string;
|
|
117
119
|
defaultagent?: boolean;
|
|
118
120
|
type: "agent";
|
|
@@ -902,6 +904,15 @@ declare class ExuluTool {
|
|
|
902
904
|
type: ToolType;
|
|
903
905
|
tool: Tool;
|
|
904
906
|
needsApproval: boolean;
|
|
907
|
+
/**
|
|
908
|
+
* Dynamic approval check (memory tools): decides per call whether the
|
|
909
|
+
* approval card is shown. When set, the AI SDK wrapper uses it instead of
|
|
910
|
+
* the boolean and never applies the "Allow for this chat" shortcut.
|
|
911
|
+
*/
|
|
912
|
+
needsApprovalFn?: (input: unknown, options: {
|
|
913
|
+
toolCallId: string;
|
|
914
|
+
messages: unknown[];
|
|
915
|
+
}) => Promise<boolean>;
|
|
905
916
|
authentication?: ExuluAuthConfig;
|
|
906
917
|
config: {
|
|
907
918
|
name: string;
|
|
@@ -909,7 +920,7 @@ declare class ExuluTool {
|
|
|
909
920
|
type: "boolean" | "string" | "number" | "variable" | "json";
|
|
910
921
|
default?: string | boolean | number | object;
|
|
911
922
|
}[];
|
|
912
|
-
constructor({ id, name, description, category, inputSchema, type, execute, config, needsApproval, authentication, }: {
|
|
923
|
+
constructor({ id, name, description, category, inputSchema, type, execute, config, needsApproval, needsApprovalFn, authentication, }: {
|
|
913
924
|
id: string;
|
|
914
925
|
name: string;
|
|
915
926
|
description: string;
|
|
@@ -923,6 +934,10 @@ declare class ExuluTool {
|
|
|
923
934
|
default?: string | boolean | number | object;
|
|
924
935
|
}[];
|
|
925
936
|
needsApproval?: boolean;
|
|
937
|
+
needsApprovalFn?: (input: unknown, options: {
|
|
938
|
+
toolCallId: string;
|
|
939
|
+
messages: unknown[];
|
|
940
|
+
}) => Promise<boolean>;
|
|
926
941
|
authentication?: ExuluAuthConfig;
|
|
927
942
|
execute: (inputs: any, options?: any) => Promise<{
|
|
928
943
|
result?: string;
|
|
@@ -985,6 +1000,9 @@ type AuditConfig = {
|
|
|
985
1000
|
include?: string[];
|
|
986
1001
|
exclude?: string[];
|
|
987
1002
|
};
|
|
1003
|
+
skillSandbox?: {
|
|
1004
|
+
enabled?: boolean;
|
|
1005
|
+
};
|
|
988
1006
|
};
|
|
989
1007
|
};
|
|
990
1008
|
|
|
@@ -1072,6 +1090,7 @@ interface AuditLogger {
|
|
|
1072
1090
|
failClosed: boolean;
|
|
1073
1091
|
isBuiltin: (id: string) => boolean;
|
|
1074
1092
|
shouldAuditTool: (id: string) => boolean;
|
|
1093
|
+
shouldAuditSkillSandbox: () => boolean;
|
|
1075
1094
|
record: (event: AuditEvent) => void;
|
|
1076
1095
|
recordToolCall: (ctx: AuditToolCallInput) => Promise<void>;
|
|
1077
1096
|
flush: () => Promise<void>;
|
|
@@ -1858,6 +1877,91 @@ declare function postgresClient(): Promise<{
|
|
|
1858
1877
|
db: Knex;
|
|
1859
1878
|
}>;
|
|
1860
1879
|
|
|
1880
|
+
type RecallSource = "prefetch" | "knowledge_search";
|
|
1881
|
+
type MemoryItemRow = {
|
|
1882
|
+
id: string;
|
|
1883
|
+
name?: string | null;
|
|
1884
|
+
information?: string | null;
|
|
1885
|
+
description?: string | null;
|
|
1886
|
+
type?: string | null;
|
|
1887
|
+
rights_mode?: string | null;
|
|
1888
|
+
created_by?: number | string | null;
|
|
1889
|
+
createdAt?: string | Date | null;
|
|
1890
|
+
updatedAt?: string | Date | null;
|
|
1891
|
+
};
|
|
1892
|
+
type RecalledMemory = {
|
|
1893
|
+
id: string;
|
|
1894
|
+
contextId: string;
|
|
1895
|
+
title: string;
|
|
1896
|
+
information: string;
|
|
1897
|
+
type?: string;
|
|
1898
|
+
rights_mode: ExuluRightsMode;
|
|
1899
|
+
createdBy: {
|
|
1900
|
+
id: number;
|
|
1901
|
+
name: string;
|
|
1902
|
+
} | null;
|
|
1903
|
+
createdAt: string;
|
|
1904
|
+
updatedAt: string;
|
|
1905
|
+
source: RecallSource;
|
|
1906
|
+
};
|
|
1907
|
+
type UserRow = {
|
|
1908
|
+
id: number;
|
|
1909
|
+
firstname?: string | null;
|
|
1910
|
+
lastname?: string | null;
|
|
1911
|
+
email?: string | null;
|
|
1912
|
+
};
|
|
1913
|
+
/**
|
|
1914
|
+
* Request-scoped collector of memories the model was given this turn
|
|
1915
|
+
* (spec §3.1). Item rows come through the caller's RBAC-scoped loader, so a
|
|
1916
|
+
* chunk the user may not see never produces an entry.
|
|
1917
|
+
*/
|
|
1918
|
+
declare class RecallCollector {
|
|
1919
|
+
private readonly deps;
|
|
1920
|
+
private readonly items;
|
|
1921
|
+
private readonly creators;
|
|
1922
|
+
constructor(deps: {
|
|
1923
|
+
contextId: string;
|
|
1924
|
+
loadItems: (ids: string[]) => Promise<MemoryItemRow[]>;
|
|
1925
|
+
loadUsers: (ids: number[]) => Promise<UserRow[]>;
|
|
1926
|
+
});
|
|
1927
|
+
addFromChunks(chunks: VectorSearchChunkResult[], source: RecallSource): Promise<void>;
|
|
1928
|
+
addRows(rows: MemoryItemRow[], source: RecallSource): Promise<void>;
|
|
1929
|
+
list(): RecalledMemory[];
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1932
|
+
type RecallResult = {
|
|
1933
|
+
collector: RecallCollector | undefined;
|
|
1934
|
+
memoryItems: VectorSearchChunkResult[] | undefined;
|
|
1935
|
+
promptBlock: string;
|
|
1936
|
+
};
|
|
1937
|
+
/**
|
|
1938
|
+
* Memory pre-fetch shared by generateSync and generateStream (spec §3.1):
|
|
1939
|
+
* user-scoped hybrid search over the agent's memory context, limited by
|
|
1940
|
+
* memory_config, feeding the recall collector and the model-visible block.
|
|
1941
|
+
*/
|
|
1942
|
+
declare function recallMemories({ agent, contexts, query, user, db, previousUserTurns }: {
|
|
1943
|
+
agent: ExuluAgent | undefined;
|
|
1944
|
+
contexts: ExuluContext[] | undefined;
|
|
1945
|
+
query: string | undefined;
|
|
1946
|
+
user: User | undefined;
|
|
1947
|
+
db: any;
|
|
1948
|
+
previousUserTurns?: string[];
|
|
1949
|
+
}): Promise<RecallResult>;
|
|
1950
|
+
|
|
1951
|
+
type MemoryBaseCheck = {
|
|
1952
|
+
ok: boolean;
|
|
1953
|
+
missing: string[];
|
|
1954
|
+
};
|
|
1955
|
+
type FieldLike = {
|
|
1956
|
+
name: string;
|
|
1957
|
+
type: string;
|
|
1958
|
+
enumValues?: string[] | null;
|
|
1959
|
+
};
|
|
1960
|
+
type ContextLike = {
|
|
1961
|
+
fields?: FieldLike[];
|
|
1962
|
+
} | null | undefined;
|
|
1963
|
+
declare function checkMemoryBase(context: ContextLike): MemoryBaseCheck;
|
|
1964
|
+
|
|
1861
1965
|
/**
|
|
1862
1966
|
* Switch this process into LiteLLM *client* mode: it connects to an
|
|
1863
1967
|
* externally-managed proxy (spawned by the Exulu HTTP server process, or a
|
|
@@ -2566,6 +2670,78 @@ declare const ExuluRecall: {
|
|
|
2566
2670
|
getRecordingVideoUrl: (recordingId: string) => Promise<string | null>;
|
|
2567
2671
|
};
|
|
2568
2672
|
|
|
2673
|
+
type StoredProjection = {
|
|
2674
|
+
context: string;
|
|
2675
|
+
dims: number;
|
|
2676
|
+
components: number;
|
|
2677
|
+
mean: number[];
|
|
2678
|
+
basis: number[][];
|
|
2679
|
+
map: number[][];
|
|
2680
|
+
intercept: number[];
|
|
2681
|
+
method: string;
|
|
2682
|
+
version: number;
|
|
2683
|
+
sample_size: number;
|
|
2684
|
+
residual: number;
|
|
2685
|
+
fitted_at: Date;
|
|
2686
|
+
};
|
|
2687
|
+
type FitResult = {
|
|
2688
|
+
fitted: boolean;
|
|
2689
|
+
reason?: string;
|
|
2690
|
+
sampleSize: number;
|
|
2691
|
+
components: number;
|
|
2692
|
+
residual: number;
|
|
2693
|
+
written: number;
|
|
2694
|
+
/** Vectors withheld from the solve the `residual` was scored on; 0 means the
|
|
2695
|
+
* sample was too small to hold any out and the number is in-sample. */
|
|
2696
|
+
heldOut: number;
|
|
2697
|
+
/** Named regions stored for the base; 0 when nothing was written. */
|
|
2698
|
+
topics: number;
|
|
2699
|
+
};
|
|
2700
|
+
type UmapLike = {
|
|
2701
|
+
fit: (rows: number[][]) => number[][];
|
|
2702
|
+
};
|
|
2703
|
+
/** Every context with a chunks table, for `--all`. Contexts live in the consuming app, so this reads the database. */
|
|
2704
|
+
declare function listFittableContexts(db: any): Promise<string[]>;
|
|
2705
|
+
/**
|
|
2706
|
+
* Fits a context's projection (spec §3) and backfills chunk coordinates.
|
|
2707
|
+
* Id-only: everything it needs is in the database. `umapFactory` is injectable
|
|
2708
|
+
* so tests never run a real layout.
|
|
2709
|
+
*/
|
|
2710
|
+
declare function fitContextProjection({ db, contextId, sample, components, dryRun, umapFactory, log, }: {
|
|
2711
|
+
db: any;
|
|
2712
|
+
contextId: string;
|
|
2713
|
+
sample?: number;
|
|
2714
|
+
components?: number;
|
|
2715
|
+
dryRun?: boolean;
|
|
2716
|
+
umapFactory?: (seed: number, n: number) => UmapLike;
|
|
2717
|
+
log?: (line: string) => void;
|
|
2718
|
+
}): Promise<FitResult>;
|
|
2719
|
+
/**
|
|
2720
|
+
* Streams every embedded chunk of the context and writes its coordinates.
|
|
2721
|
+
*
|
|
2722
|
+
* `layout` carries the true layout position of each chunk the fit sampled, and
|
|
2723
|
+
* is preferred wherever it has one; the linear map places the rest, which is
|
|
2724
|
+
* what it was learned for. It is optional because this is exported from the
|
|
2725
|
+
* package entry point: given none, every row goes through the map, exactly as
|
|
2726
|
+
* before.
|
|
2727
|
+
*
|
|
2728
|
+
* Calling it that way on a base that has ALREADY been fitted is destructive:
|
|
2729
|
+
* nothing but px/py/pz persists a sampled chunk's true layout position, so
|
|
2730
|
+
* every one of them is overwritten with the map's linear estimate and only a
|
|
2731
|
+
* refit brings them back.
|
|
2732
|
+
*/
|
|
2733
|
+
declare function backfillCoordinates({ db, contextId, projection, layout, batch, log, }: {
|
|
2734
|
+
db: any;
|
|
2735
|
+
contextId: string;
|
|
2736
|
+
projection: StoredProjection;
|
|
2737
|
+
layout?: Map<string, [number, number, number]>;
|
|
2738
|
+
batch?: number;
|
|
2739
|
+
log?: (line: string) => void;
|
|
2740
|
+
}): Promise<number>;
|
|
2741
|
+
|
|
2742
|
+
/** Vector map (3c-1) knobs. One place; nothing else hardcodes them. */
|
|
2743
|
+
declare const PROJECTION_VERSION = 1;
|
|
2744
|
+
|
|
2569
2745
|
declare const ExuluJobs: {
|
|
2570
2746
|
redis: typeof redisClient;
|
|
2571
2747
|
};
|
|
@@ -2641,4 +2817,4 @@ declare const ExuluPython: {
|
|
|
2641
2817
|
instructions: typeof getPythonSetupInstructions;
|
|
2642
2818
|
};
|
|
2643
2819
|
|
|
2644
|
-
export { type AuditConfig, type AuditEvent, type AuditLogger, type ChunkerOperation, type ChunkerResponse, type CredentialField, CredentialInvalidError, type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, type ExuluAgent, ExuluApp, type ExuluAuthConfig, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder, type ExuluCredentialsToolContext, ExuluDatabase, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluModels, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluRecall, ExuluReranker, ExuluTool, type ExuluUserCredentialsConfig, ExuluVariables, type VectorSearchChunkResult, defaultChunker, enableLiteLLMClientMode, postgresClient };
|
|
2820
|
+
export { type AuditConfig, type AuditEvent, type AuditLogger, type ChunkerOperation, type ChunkerResponse, type CredentialField, CredentialInvalidError, type JOB_STATUS as EXULU_JOB_STATUS, JOB_STATUS_ENUM as EXULU_JOB_STATUS_ENUM, type STATISTICS_TYPE as EXULU_STATISTICS_TYPE, STATISTICS_TYPE_ENUM as EXULU_STATISTICS_TYPE_ENUM, type ExuluAgent, ExuluApp, type ExuluAuthConfig, ExuluAuthentication, ExuluChunkers, ExuluContext, type ExuluContextEmbedder, type ExuluCredentialsToolContext, ExuluDatabase, ExuluDefaultTools, ExuluDocumentProcessor, ExuluEval, type Item as ExuluItem, ExuluJobs, ExuluModels, type ExuluOauthConfig, type ExuluOauthToolContext, ExuluOtel, ExuluPython, queues as ExuluQueues, ExuluReadApi, ExuluRecall, ExuluReranker, ExuluTool, type ExuluUserCredentialsConfig, ExuluVariables, PROJECTION_VERSION, type VectorSearchChunkResult, backfillCoordinates, checkMemoryBase, defaultChunker, enableLiteLLMClientMode, fitContextProjection, listFittableContexts, postgresClient, recallMemories };
|