@resolveio/server-lib 22.2.14 → 22.2.16

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.
@@ -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;
@@ -23,6 +80,7 @@ export type AiAssistantMongoReadInput = {
23
80
  };
24
81
  permissionView?: string;
25
82
  id_client?: string;
83
+ id_app?: string;
26
84
  mongo?: {
27
85
  database?: string;
28
86
  databases?: string[];
@@ -31,6 +89,7 @@ export type AiAssistantMongoReadInput = {
31
89
  };
32
90
  __assistantRetryState?: AiAssistantCollectionRetryState;
33
91
  __assistantRuntime?: AiAssistantRuntimeControl;
92
+ __assistantHints?: AiAssistantDirectiveHints;
34
93
  };
35
94
  export type AiAssistantMongoAggregateInput = {
36
95
  database?: string;
@@ -46,6 +105,7 @@ export type AiAssistantMongoAggregateInput = {
46
105
  };
47
106
  permissionView?: string;
48
107
  id_client?: string;
108
+ id_app?: string;
49
109
  mongo?: {
50
110
  database?: string;
51
111
  databases?: string[];
@@ -55,6 +115,7 @@ export type AiAssistantMongoAggregateInput = {
55
115
  __assistantMessage?: string;
56
116
  __assistantRetryState?: AiAssistantCollectionRetryState;
57
117
  __assistantRuntime?: AiAssistantRuntimeControl;
118
+ __assistantHints?: AiAssistantDirectiveHints;
58
119
  };
59
120
  type AiAssistantDisplayTable = {
60
121
  columns: string[];
@@ -101,7 +162,9 @@ export declare function loadAiTerminalMethods(methodManager: any): void;
101
162
  export declare function executeAiAssistantMongoRead(payload: AiAssistantMongoReadInput, context: any): Promise<any>;
102
163
  export declare function executeAiAssistantMongoAggregate(payload: AiAssistantMongoAggregateInput, context: any): Promise<any>;
103
164
  export declare function extractAssistantMongoDirective(content: string): AssistantMongoDirective | null;
165
+ export declare function buildAssistantToolRequest(directive: AssistantMongoDirective, payload: AiCodexRunInput, hints?: AiAssistantDirectiveHints): Record<string, any>;
104
166
  export declare function buildAssistantInvoiceCustomerLabelExpr(): Record<string, any>;
167
+ export declare function resolveAssistantHeuristicDirectiveForTesting(message: string, collectionHints: string[], collectionNames?: string[], appId?: string): any;
105
168
  export declare function buildAssistantDatedPivotDisplay(display: AiAssistantDisplayTable, expectedMonths?: string[]): AiAssistantDisplayTable | null;
106
169
  export declare function deriveAssistantCommandExecutionStatus(commandValue: any): string;
107
170
  export declare function normalizeIdsForTargetField(ids: any[], targetDocs: any[], targetFieldPath: string, targetFieldTypeOverride?: 'objectId' | 'string' | 'unknown'): any[];
@@ -130,6 +193,8 @@ export declare function normalizeAssistantAggregatePipeline(pipeline?: Array<Rec
130
193
  export declare function stripQueryFieldPathsDeep(query: any, fieldsToStrip: string[]): any;
131
194
  export declare function stripScopedFieldsFromPipeline(pipeline: any[], fieldsToStrip: string[]): any[];
132
195
  export declare function rewriteEmbeddedMatchObjects(query: any): any;
196
+ export declare function resolveAssistantAppCollectionHintCandidates(message: string, appId?: string): string[];
197
+ export declare function isAssistantDeterministicHeuristicEnabledForApp(heuristicId: string, appId?: string): boolean;
133
198
  export declare function resolveAssistantCollectionOverride(collectionRanking: Record<string, any> | null, currentCollection: string): {
134
199
  from: string;
135
200
  to: string;
@@ -155,6 +220,15 @@ export declare function evaluateAssistantFallbackDocumentsQuality(documents: any
155
220
  averageFillRate: number;
156
221
  };
157
222
  export declare function shouldAcceptAssistantFallbackDocuments(documents: any[], options?: AssistantFallbackAcceptanceOptions): boolean;
223
+ export declare function resolveAssistantReportBuilderBridgeCollection(collection: string, db?: any, dbName?: string, options?: {
224
+ requestHints?: AiAssistantDirectiveHints;
225
+ appId?: string;
226
+ }): Promise<{
227
+ collection: string;
228
+ fallbackFrom?: string;
229
+ mode: 'report-builder' | 'direct-mongo';
230
+ resolutionPath: string[];
231
+ }>;
158
232
  export declare function collectUserViewPermissions(user: any): string[];
159
233
  export declare function userHasInvoiceAccess(user: any): boolean;
160
234
  export declare function resolveAssistantUserAccessTier(user: any): 'super_admin' | 'customer_portal' | 'client_user';
@@ -176,6 +250,11 @@ export declare function shouldRunAssistantPlanner(params: {
176
250
  hasDeterministicHeuristicFastPath: boolean;
177
251
  }): boolean;
178
252
  export declare function shouldEnforceAssistantDatedDirective(message: string, plannerOutput: any, requestClassification: AssistantRequestClassification): boolean;
253
+ export declare function buildAssistantSchemaHints(collectionNames: string[], options?: {
254
+ maxCollections?: number;
255
+ maxFields?: number;
256
+ maxLookups?: number;
257
+ }): string[];
179
258
  export declare function collectAssistantAllowedRoutesForUser(user: any, allRoutes: string[], isSuperAdmin: boolean): string[];
180
259
  export declare function rankAssistantNavigationRoutes(message: string, routes: string[], limit?: number): string[];
181
260
  export declare function shouldUseAssistantNavigationFastPath(message: string, hasAttachments?: boolean): boolean;