@resolveio/server-lib 22.2.13 → 22.2.15
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/managers/mongo.manager.d.ts +3 -0
- package/managers/mongo.manager.js +756 -653
- package/managers/mongo.manager.js.map +1 -1
- package/methods/ai-terminal.d.ts +71 -0
- package/methods/ai-terminal.js +748 -234
- package/methods/ai-terminal.js.map +1 -1
- package/package.json +2 -1
package/methods/ai-terminal.d.ts
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
type AttachmentInput = {
|
|
2
|
+
id?: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
local_path?: string;
|
|
7
|
+
};
|
|
8
|
+
type AiCodexRunInput = {
|
|
9
|
+
id_conversation?: string;
|
|
10
|
+
id_client?: string;
|
|
11
|
+
id_app?: string;
|
|
12
|
+
message: string;
|
|
13
|
+
request_id?: string;
|
|
14
|
+
guardrails?: boolean;
|
|
15
|
+
config?: {
|
|
16
|
+
mode?: string;
|
|
17
|
+
model?: string;
|
|
18
|
+
fallback_model?: string;
|
|
19
|
+
fallback_models?: string[] | string;
|
|
20
|
+
fallbackModel?: string;
|
|
21
|
+
fallbackModels?: string[] | string;
|
|
22
|
+
guardrails?: boolean;
|
|
23
|
+
planner_enabled?: boolean;
|
|
24
|
+
plannerEnabled?: boolean;
|
|
25
|
+
fast_mode?: boolean;
|
|
26
|
+
fastMode?: boolean;
|
|
27
|
+
always_allow_probe?: boolean;
|
|
28
|
+
alwaysAllowProbe?: boolean;
|
|
29
|
+
run_budget_ms?: number;
|
|
30
|
+
runBudgetMs?: number;
|
|
31
|
+
mongo_max_time_ms?: number;
|
|
32
|
+
mongoMaxTimeMs?: number;
|
|
33
|
+
system_prompt?: string;
|
|
34
|
+
systemPrompt?: string;
|
|
35
|
+
user_prompt_template?: string;
|
|
36
|
+
userPromptTemplate?: string;
|
|
37
|
+
};
|
|
38
|
+
context?: {
|
|
39
|
+
mode?: string;
|
|
40
|
+
route?: string;
|
|
41
|
+
};
|
|
42
|
+
mongo?: {
|
|
43
|
+
database?: string;
|
|
44
|
+
databases?: string[];
|
|
45
|
+
access?: string;
|
|
46
|
+
readonly?: boolean;
|
|
47
|
+
};
|
|
48
|
+
attachments?: AttachmentInput[];
|
|
49
|
+
delete_files_after_run?: boolean;
|
|
50
|
+
max_history?: number;
|
|
51
|
+
};
|
|
1
52
|
type AiAssistantCollectionRetryState = {
|
|
2
53
|
triedCollections?: string[];
|
|
3
54
|
disableCrossCollectionRetry?: boolean;
|
|
@@ -8,6 +59,12 @@ type AiAssistantRuntimeControl = {
|
|
|
8
59
|
deadlineMs?: number;
|
|
9
60
|
maxTimeMS?: number;
|
|
10
61
|
};
|
|
62
|
+
type AiAssistantDirectiveHints = {
|
|
63
|
+
collectionHints?: string[];
|
|
64
|
+
rankedCollections?: string[];
|
|
65
|
+
fieldHints?: string[];
|
|
66
|
+
schemaHints?: string[];
|
|
67
|
+
};
|
|
11
68
|
export type AiAssistantMongoReadInput = {
|
|
12
69
|
database?: string;
|
|
13
70
|
collection?: string;
|
|
@@ -31,6 +88,7 @@ export type AiAssistantMongoReadInput = {
|
|
|
31
88
|
};
|
|
32
89
|
__assistantRetryState?: AiAssistantCollectionRetryState;
|
|
33
90
|
__assistantRuntime?: AiAssistantRuntimeControl;
|
|
91
|
+
__assistantHints?: AiAssistantDirectiveHints;
|
|
34
92
|
};
|
|
35
93
|
export type AiAssistantMongoAggregateInput = {
|
|
36
94
|
database?: string;
|
|
@@ -55,6 +113,7 @@ export type AiAssistantMongoAggregateInput = {
|
|
|
55
113
|
__assistantMessage?: string;
|
|
56
114
|
__assistantRetryState?: AiAssistantCollectionRetryState;
|
|
57
115
|
__assistantRuntime?: AiAssistantRuntimeControl;
|
|
116
|
+
__assistantHints?: AiAssistantDirectiveHints;
|
|
58
117
|
};
|
|
59
118
|
type AiAssistantDisplayTable = {
|
|
60
119
|
columns: string[];
|
|
@@ -101,6 +160,7 @@ export declare function loadAiTerminalMethods(methodManager: any): void;
|
|
|
101
160
|
export declare function executeAiAssistantMongoRead(payload: AiAssistantMongoReadInput, context: any): Promise<any>;
|
|
102
161
|
export declare function executeAiAssistantMongoAggregate(payload: AiAssistantMongoAggregateInput, context: any): Promise<any>;
|
|
103
162
|
export declare function extractAssistantMongoDirective(content: string): AssistantMongoDirective | null;
|
|
163
|
+
export declare function buildAssistantToolRequest(directive: AssistantMongoDirective, payload: AiCodexRunInput, hints?: AiAssistantDirectiveHints): Record<string, any>;
|
|
104
164
|
export declare function buildAssistantInvoiceCustomerLabelExpr(): Record<string, any>;
|
|
105
165
|
export declare function buildAssistantDatedPivotDisplay(display: AiAssistantDisplayTable, expectedMonths?: string[]): AiAssistantDisplayTable | null;
|
|
106
166
|
export declare function deriveAssistantCommandExecutionStatus(commandValue: any): string;
|
|
@@ -155,6 +215,12 @@ export declare function evaluateAssistantFallbackDocumentsQuality(documents: any
|
|
|
155
215
|
averageFillRate: number;
|
|
156
216
|
};
|
|
157
217
|
export declare function shouldAcceptAssistantFallbackDocuments(documents: any[], options?: AssistantFallbackAcceptanceOptions): boolean;
|
|
218
|
+
export declare function resolveAssistantReportBuilderBridgeCollection(collection: string, db?: any, dbName?: string): Promise<{
|
|
219
|
+
collection: string;
|
|
220
|
+
fallbackFrom?: string;
|
|
221
|
+
mode: 'report-builder' | 'direct-mongo';
|
|
222
|
+
resolutionPath: string[];
|
|
223
|
+
}>;
|
|
158
224
|
export declare function collectUserViewPermissions(user: any): string[];
|
|
159
225
|
export declare function userHasInvoiceAccess(user: any): boolean;
|
|
160
226
|
export declare function resolveAssistantUserAccessTier(user: any): 'super_admin' | 'customer_portal' | 'client_user';
|
|
@@ -176,6 +242,11 @@ export declare function shouldRunAssistantPlanner(params: {
|
|
|
176
242
|
hasDeterministicHeuristicFastPath: boolean;
|
|
177
243
|
}): boolean;
|
|
178
244
|
export declare function shouldEnforceAssistantDatedDirective(message: string, plannerOutput: any, requestClassification: AssistantRequestClassification): boolean;
|
|
245
|
+
export declare function buildAssistantSchemaHints(collectionNames: string[], options?: {
|
|
246
|
+
maxCollections?: number;
|
|
247
|
+
maxFields?: number;
|
|
248
|
+
maxLookups?: number;
|
|
249
|
+
}): string[];
|
|
179
250
|
export declare function collectAssistantAllowedRoutesForUser(user: any, allRoutes: string[], isSuperAdmin: boolean): string[];
|
|
180
251
|
export declare function rankAssistantNavigationRoutes(message: string, routes: string[], limit?: number): string[];
|
|
181
252
|
export declare function shouldUseAssistantNavigationFastPath(message: string, hasAttachments?: boolean): boolean;
|