@resolveio/server-lib 22.1.1 → 22.1.2
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/collections/ai-terminal-issue-report.collection.d.ts +2 -0
- package/collections/ai-terminal-issue-report.collection.js +148 -0
- package/collections/ai-terminal-issue-report.collection.js.map +1 -0
- package/methods/ai-terminal.d.ts +8 -0
- package/methods/ai-terminal.js +1481 -559
- package/methods/ai-terminal.js.map +1 -1
- package/methods.ts +3 -0
- package/models/ai-terminal-issue-report.model.d.ts +19 -0
- package/models/ai-terminal-issue-report.model.js +4 -0
- package/models/ai-terminal-issue-report.model.js.map +1 -0
- package/package.json +5 -2
- package/public_api.d.ts +2 -0
- package/public_api.js +2 -0
- package/public_api.js.map +1 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { AiTerminalIssueReportModel } from '../models/ai-terminal-issue-report.model';
|
|
2
|
+
export declare const AiTerminalIssueReports: import("../managers/mongo.manager").MongoManagerCollection<AiTerminalIssueReportModel> | import("../managers/mongo.manager").MongoManagerUserCollection<AiTerminalIssueReportModel>;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.AiTerminalIssueReports = void 0;
|
|
40
|
+
var mongo_manager_1 = require("../managers/mongo.manager");
|
|
41
|
+
var schema = {
|
|
42
|
+
_id: {
|
|
43
|
+
type: String,
|
|
44
|
+
optional: true
|
|
45
|
+
},
|
|
46
|
+
__v: {
|
|
47
|
+
type: Number,
|
|
48
|
+
optional: true
|
|
49
|
+
},
|
|
50
|
+
createdAt: {
|
|
51
|
+
type: Date,
|
|
52
|
+
optional: true
|
|
53
|
+
},
|
|
54
|
+
updatedAt: {
|
|
55
|
+
type: Date,
|
|
56
|
+
optional: true
|
|
57
|
+
},
|
|
58
|
+
id_conversation: {
|
|
59
|
+
type: String
|
|
60
|
+
},
|
|
61
|
+
id_message: {
|
|
62
|
+
type: String,
|
|
63
|
+
optional: true
|
|
64
|
+
},
|
|
65
|
+
id_client: {
|
|
66
|
+
type: String,
|
|
67
|
+
optional: true
|
|
68
|
+
},
|
|
69
|
+
id_app: {
|
|
70
|
+
type: String,
|
|
71
|
+
optional: true
|
|
72
|
+
},
|
|
73
|
+
id_user: {
|
|
74
|
+
type: String,
|
|
75
|
+
optional: true
|
|
76
|
+
},
|
|
77
|
+
status: {
|
|
78
|
+
type: String
|
|
79
|
+
},
|
|
80
|
+
source: {
|
|
81
|
+
type: String
|
|
82
|
+
},
|
|
83
|
+
reason: {
|
|
84
|
+
type: String
|
|
85
|
+
},
|
|
86
|
+
expected_outcome: {
|
|
87
|
+
type: String,
|
|
88
|
+
optional: true
|
|
89
|
+
},
|
|
90
|
+
user_prompt: {
|
|
91
|
+
type: String,
|
|
92
|
+
optional: true
|
|
93
|
+
},
|
|
94
|
+
assistant_content: {
|
|
95
|
+
type: String,
|
|
96
|
+
optional: true
|
|
97
|
+
},
|
|
98
|
+
request_id: {
|
|
99
|
+
type: String,
|
|
100
|
+
optional: true
|
|
101
|
+
},
|
|
102
|
+
tool_type: {
|
|
103
|
+
type: String,
|
|
104
|
+
optional: true
|
|
105
|
+
},
|
|
106
|
+
tool_collection: {
|
|
107
|
+
type: String,
|
|
108
|
+
optional: true
|
|
109
|
+
},
|
|
110
|
+
metadata: {
|
|
111
|
+
type: Object,
|
|
112
|
+
optional: true,
|
|
113
|
+
blackbox: true
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
var model = mongo_manager_1.MongoManagerModel.create({
|
|
117
|
+
collectionName: 'ai-terminal-issue-reports',
|
|
118
|
+
schema: schema,
|
|
119
|
+
useVersionCollection: false,
|
|
120
|
+
useReportBuilder: false,
|
|
121
|
+
reportBuilderLookupTables: [],
|
|
122
|
+
timestamps: true,
|
|
123
|
+
createLogs: false,
|
|
124
|
+
checkSchema: true,
|
|
125
|
+
collectionOptions: null
|
|
126
|
+
});
|
|
127
|
+
exports.AiTerminalIssueReports = model.collection_main;
|
|
128
|
+
setTimeout(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
129
|
+
return __generator(this, function (_a) {
|
|
130
|
+
switch (_a.label) {
|
|
131
|
+
case 0: return [4 /*yield*/, exports.AiTerminalIssueReports.createIndex({ id_conversation: 1, createdAt: -1 })];
|
|
132
|
+
case 1:
|
|
133
|
+
_a.sent();
|
|
134
|
+
return [4 /*yield*/, exports.AiTerminalIssueReports.createIndex({ id_client: 1, createdAt: -1 })];
|
|
135
|
+
case 2:
|
|
136
|
+
_a.sent();
|
|
137
|
+
return [4 /*yield*/, exports.AiTerminalIssueReports.createIndex({ status: 1, createdAt: -1 })];
|
|
138
|
+
case 3:
|
|
139
|
+
_a.sent();
|
|
140
|
+
return [4 /*yield*/, exports.AiTerminalIssueReports.createIndex({ id_message: 1 })];
|
|
141
|
+
case 4:
|
|
142
|
+
_a.sent();
|
|
143
|
+
return [2 /*return*/];
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}); }, 5000);
|
|
147
|
+
|
|
148
|
+
//# sourceMappingURL=ai-terminal-issue-report.collection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/collections/ai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EAAE;QAChB,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;KACd;IACD,QAAQ,EAAE;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,IAAI;QACd,QAAQ,EAAE,IAAI;KACd;CACD,CAAC;AAEF,IAAM,KAAK,GAAG,iCAAiB,CAAC,MAAM,CAA6B;IAClE,cAAc,EAAE,2BAA2B;IAC3C,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,KAAK;IAC3B,gBAAgB,EAAE,KAAK;IACvB,yBAAyB,EAAE,EAAE;IAC7B,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,IAAI;CACvB,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,KAAK,CAAC,eAAe,CAAC;AAE5D,UAAU,CAAC;;;oBACV,qBAAM,8BAAsB,CAAC,WAAW,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAA;;gBAA/E,SAA+E,CAAC;gBAChF,qBAAM,8BAAsB,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAA;;gBAAzE,SAAyE,CAAC;gBAC1E,qBAAM,8BAAsB,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,CAAC,EAAA;;gBAAtE,SAAsE,CAAC;gBACvE,qBAAM,8BAAsB,CAAC,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,EAAA;;gBAA3D,SAA2D,CAAC;;;;KAC5D,EAAE,IAAI,CAAC,CAAC","file":"ai-terminal-issue-report.collection.js","sourcesContent":["import { MongoManagerModel } from '../managers/mongo.manager';\nimport { AiTerminalIssueReportModel } from '../models/ai-terminal-issue-report.model';\n\nconst schema: any = {\n\t_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\t__v: {\n\t\ttype: Number,\n\t\toptional: true\n\t},\n\tcreatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tupdatedAt: {\n\t\ttype: Date,\n\t\toptional: true\n\t},\n\tid_conversation: {\n\t\ttype: String\n\t},\n\tid_message: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tid_client: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tid_app: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tid_user: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tstatus: {\n\t\ttype: String\n\t},\n\tsource: {\n\t\ttype: String\n\t},\n\treason: {\n\t\ttype: String\n\t},\n\texpected_outcome: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tuser_prompt: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tassistant_content: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\trequest_id: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\ttool_type: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\ttool_collection: {\n\t\ttype: String,\n\t\toptional: true\n\t},\n\tmetadata: {\n\t\ttype: Object,\n\t\toptional: true,\n\t\tblackbox: true\n\t}\n};\n\nconst model = MongoManagerModel.create<AiTerminalIssueReportModel>({\n\tcollectionName: 'ai-terminal-issue-reports',\n\tschema: schema,\n\tuseVersionCollection: false,\n\tuseReportBuilder: false,\n\treportBuilderLookupTables: [],\n\ttimestamps: true,\n\tcreateLogs: false,\n\tcheckSchema: true,\n\tcollectionOptions: null\n});\n\nexport const AiTerminalIssueReports = model.collection_main;\n\nsetTimeout(async () => {\n\tawait AiTerminalIssueReports.createIndex({ id_conversation: 1, createdAt: -1 });\n\tawait AiTerminalIssueReports.createIndex({ id_client: 1, createdAt: -1 });\n\tawait AiTerminalIssueReports.createIndex({ status: 1, createdAt: -1 });\n\tawait AiTerminalIssueReports.createIndex({ id_message: 1 });\n}, 5000);\n"]}
|
package/methods/ai-terminal.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
type AiAssistantCollectionRetryState = {
|
|
2
|
+
triedCollections?: string[];
|
|
3
|
+
disableCrossCollectionRetry?: boolean;
|
|
4
|
+
rootCollection?: string;
|
|
5
|
+
};
|
|
1
6
|
export type AiAssistantMongoReadInput = {
|
|
2
7
|
database?: string;
|
|
3
8
|
collection?: string;
|
|
@@ -19,6 +24,7 @@ export type AiAssistantMongoReadInput = {
|
|
|
19
24
|
access?: string;
|
|
20
25
|
readonly?: boolean;
|
|
21
26
|
};
|
|
27
|
+
__assistantRetryState?: AiAssistantCollectionRetryState;
|
|
22
28
|
};
|
|
23
29
|
export type AiAssistantMongoAggregateInput = {
|
|
24
30
|
database?: string;
|
|
@@ -40,6 +46,7 @@ export type AiAssistantMongoAggregateInput = {
|
|
|
40
46
|
access?: string;
|
|
41
47
|
readonly?: boolean;
|
|
42
48
|
};
|
|
49
|
+
__assistantRetryState?: AiAssistantCollectionRetryState;
|
|
43
50
|
};
|
|
44
51
|
type AiAssistantDisplayTable = {
|
|
45
52
|
columns: string[];
|
|
@@ -116,6 +123,7 @@ export declare function resolveAssistantCollectionOverride(collectionRanking: Re
|
|
|
116
123
|
toScore: number;
|
|
117
124
|
reason: string;
|
|
118
125
|
} | null;
|
|
126
|
+
export declare function resolveAssistantCrossCollectionFallbackCandidates(collection: string): string[];
|
|
119
127
|
export declare function collectUserViewPermissions(user: any): string[];
|
|
120
128
|
export declare function userHasInvoiceAccess(user: any): boolean;
|
|
121
129
|
export declare function resolveAssistantUserAccessTier(user: any): 'super_admin' | 'customer_portal' | 'client_user';
|