@m6d/cortex-server 1.6.0 → 1.8.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/index.d.ts +1 -1
- package/dist/src/{adapters → lib/adapters}/database.d.ts +16 -1
- package/dist/src/lib/ai/context/compressor.d.ts +18 -0
- package/dist/src/{ai → lib/ai}/context/index.d.ts +2 -1
- package/dist/src/lib/ai/context/intra-turn-compressor.d.ts +24 -0
- package/dist/src/{ai → lib/ai}/context/types.d.ts +2 -0
- package/dist/src/lib/config.d.ts +153 -0
- package/dist/src/{db → lib/db}/schema.d.ts +104 -1
- package/dist/src/{index.d.ts → lib/index.d.ts} +2 -2
- package/dist/src/{types.d.ts → lib/types.d.ts} +15 -14
- package/index.ts +1 -1
- package/package.json +8 -3
- package/src/{adapters → lib/adapters}/database.ts +20 -1
- package/src/{adapters → lib/adapters}/minio.ts +2 -1
- package/src/{adapters → lib/adapters}/mssql.ts +38 -2
- package/src/lib/ai/context/compressor.ts +259 -0
- package/src/{ai → lib/ai}/context/index.ts +6 -1
- package/src/lib/ai/context/intra-turn-compressor.ts +264 -0
- package/src/{ai → lib/ai}/context/types.ts +4 -1
- package/src/{ai → lib/ai}/index.ts +114 -13
- package/src/lib/ai/prompt.ts +354 -0
- package/src/{ai → lib/ai}/tools/execute-code.tool.ts +5 -2
- package/src/{auth → lib/auth}/middleware.ts +7 -0
- package/src/lib/config.ts +181 -0
- package/src/{db/migrations/20260309012148_cloudy_maria_hill → lib/db/migrations/20260326231647_nice_speedball}/migration.sql +12 -0
- package/src/{db/migrations/20260309012148_cloudy_maria_hill → lib/db/migrations/20260326231647_nice_speedball}/snapshot.json +106 -1
- package/src/{db → lib/db}/schema.ts +15 -2
- package/src/{factory.ts → lib/factory.ts} +1 -0
- package/src/{index.ts → lib/index.ts} +3 -1
- package/src/{routes → lib/routes}/files.ts +9 -2
- package/src/{routes → lib/routes}/threads.ts +8 -1
- package/src/{types.ts → lib/types.ts} +16 -15
- package/src/sample/db/client.ts +9 -0
- package/src/sample/db/migrations/20260411023125_rich_purple_man/migration.sql +5 -0
- package/src/sample/db/migrations/20260411023125_rich_purple_man/snapshot.json +50 -0
- package/src/sample/db/schema.ts +10 -0
- package/src/sample/domains/account/concepts/session.concept.ts +17 -0
- package/src/sample/domains/account/endpoints/listCurrentSessions.endpoint.ts +31 -0
- package/src/sample/domains/account/endpoints/revokeAllOtherSessions.endpoint.ts +22 -0
- package/src/sample/domains/account/endpoints/revokeCurrentSession.endpoint.ts +33 -0
- package/src/sample/domains/account/index.ts +18 -0
- package/src/sample/domains/appraisals/concepts/appraisalCycle.concept.ts +15 -0
- package/src/sample/domains/appraisals/concepts/appraisalRecord.concept.ts +20 -0
- package/src/sample/domains/appraisals/concepts/appraisalRecordCompetency.concept.ts +10 -0
- package/src/sample/domains/appraisals/concepts/appraisalRecordFunctionalRequirement.concept.ts +10 -0
- package/src/sample/domains/appraisals/concepts/appraisalRecordGoal.concept.ts +17 -0
- package/src/sample/domains/appraisals/endpoints/getAppraisalRecordById.endpoint.ts +321 -0
- package/src/sample/domains/appraisals/endpoints/getAppraisalRecordCompetencies.endpoint.ts +120 -0
- package/src/sample/domains/appraisals/endpoints/getAppraisalRecordFunctionalRequirements.endpoint.ts +126 -0
- package/src/sample/domains/appraisals/endpoints/getAppraisalRecordGoals.endpoint.ts +104 -0
- package/src/sample/domains/appraisals/endpoints/getAppraisalRecordScore.endpoint.ts +58 -0
- package/src/sample/domains/appraisals/endpoints/listAppraisalCyclesSimple.endpoint.ts +52 -0
- package/src/sample/domains/appraisals/endpoints/listAppraisalRecords.endpoint.ts +245 -0
- package/src/sample/domains/appraisals/endpoints/listAppraisalTemplatesSimple.endpoint.ts +52 -0
- package/src/sample/domains/appraisals/index.ts +40 -0
- package/src/sample/domains/appraisals/rules/appraisalRecordScoping.rule.ts +7 -0
- package/src/sample/domains/attendance/concepts/attendancePermission.concept.ts +17 -0
- package/src/sample/domains/attendance/concepts/attendanceTransaction.concept.ts +17 -0
- package/src/sample/domains/attendance/concepts/publicHoliday.concept.ts +10 -0
- package/src/sample/domains/attendance/concepts/punch.concept.ts +19 -0
- package/src/sample/domains/attendance/endpoints/getAttendanceTransactionById.endpoint.ts +444 -0
- package/src/sample/domains/attendance/endpoints/getCurrentAttendanceProfile.endpoint.ts +886 -0
- package/src/sample/domains/attendance/endpoints/getCurrentAttendanceStatistics.endpoint.ts +49 -0
- package/src/sample/domains/attendance/endpoints/listAttendancePermissions.endpoint.ts +176 -0
- package/src/sample/domains/attendance/endpoints/listAttendanceTransactionStates.endpoint.ts +26 -0
- package/src/sample/domains/attendance/endpoints/listAttendanceTransactions.endpoint.ts +373 -0
- package/src/sample/domains/attendance/endpoints/listPublicHolidaysSimple.endpoint.ts +52 -0
- package/src/sample/domains/attendance/endpoints/listPunchTypes.endpoint.ts +25 -0
- package/src/sample/domains/attendance/endpoints/listPunches.endpoint.ts +178 -0
- package/src/sample/domains/attendance/index.ts +41 -0
- package/src/sample/domains/attendance/services/attendancePermissions.service.ts +15 -0
- package/src/sample/domains/employees/concepts/employee.concept.ts +20 -0
- package/src/sample/domains/employees/concepts/employeeBankAccount.concept.ts +19 -0
- package/src/sample/domains/employees/concepts/employeeChild.concept.ts +19 -0
- package/src/sample/domains/employees/concepts/employeeDocument.concept.ts +21 -0
- package/src/sample/domains/employees/concepts/employeeEvent.concept.ts +21 -0
- package/src/sample/domains/employees/concepts/employeeExperience.concept.ts +18 -0
- package/src/sample/domains/employees/concepts/employeeJobLevelChange.concept.ts +21 -0
- package/src/sample/domains/employees/concepts/employeeMedal.concept.ts +20 -0
- package/src/sample/domains/employees/concepts/employeeQualification.concept.ts +20 -0
- package/src/sample/domains/employees/concepts/employeeSpouse.concept.ts +21 -0
- package/src/sample/domains/employees/concepts/employeeViolation.concept.ts +19 -0
- package/src/sample/domains/employees/endpoints/getCurrentEmployee.endpoint.ts +1651 -0
- package/src/sample/domains/employees/endpoints/getCurrentIdentity.endpoint.ts +197 -0
- package/src/sample/domains/employees/endpoints/getCurrentManagers.endpoint.ts +142 -0
- package/src/sample/domains/employees/endpoints/getEmployeeById.endpoint.ts +1659 -0
- package/src/sample/domains/employees/endpoints/getEmployeeStatistics.endpoint.ts +43 -0
- package/src/sample/domains/employees/endpoints/listBankAccounts.endpoint.ts +223 -0
- package/src/sample/domains/employees/endpoints/listChildren.endpoint.ts +211 -0
- package/src/sample/domains/employees/endpoints/listDocuments.endpoint.ts +222 -0
- package/src/sample/domains/employees/endpoints/listEmployeesSimple.endpoint.ts +156 -0
- package/src/sample/domains/employees/endpoints/listEvents.endpoint.ts +120 -0
- package/src/sample/domains/employees/endpoints/listExperiences.endpoint.ts +188 -0
- package/src/sample/domains/employees/endpoints/listJobLevelChanges.endpoint.ts +240 -0
- package/src/sample/domains/employees/endpoints/listMedals.endpoint.ts +266 -0
- package/src/sample/domains/employees/endpoints/listQualifications.endpoint.ts +265 -0
- package/src/sample/domains/employees/endpoints/listSpouses.endpoint.ts +278 -0
- package/src/sample/domains/employees/endpoints/listViolations.endpoint.ts +245 -0
- package/src/sample/domains/employees/index.ts +75 -0
- package/src/sample/domains/employees/services/employees.service.ts +181 -0
- package/src/sample/domains/index.ts +10 -0
- package/src/sample/domains/leaves/concepts/leave.concept.ts +21 -0
- package/src/sample/domains/leaves/concepts/leaveBalance.concept.ts +17 -0
- package/src/sample/domains/leaves/concepts/leaveBalanceTransaction.concept.ts +16 -0
- package/src/sample/domains/leaves/concepts/leaveType.concept.ts +13 -0
- package/src/sample/domains/leaves/concepts/leaveTypes.concept.ts +205 -0
- package/src/sample/domains/leaves/endpoints/getBalance.endpoint.ts +53 -0
- package/src/sample/domains/leaves/endpoints/getLeaveById.endpoint.ts +53 -0
- package/src/sample/domains/leaves/endpoints/listBalanceTransactions.endpoint.ts +196 -0
- package/src/sample/domains/leaves/endpoints/listBalanceTypes.endpoint.ts +26 -0
- package/src/sample/domains/leaves/endpoints/listBalances.endpoint.ts +201 -0
- package/src/sample/domains/leaves/endpoints/listLeaveTypes.endpoint.ts +28 -0
- package/src/sample/domains/leaves/endpoints/listLeaves.endpoint.ts +234 -0
- package/src/sample/domains/leaves/index.ts +38 -0
- package/src/sample/domains/leaves/services/leaveRequests.service.ts +232 -0
- package/src/sample/domains/notifications/concepts/notification.concept.ts +19 -0
- package/src/sample/domains/notifications/endpoints/countMyNotifications.endpoint.ts +21 -0
- package/src/sample/domains/notifications/endpoints/getMyNotification.endpoint.ts +57 -0
- package/src/sample/domains/notifications/endpoints/listMyNotifications.endpoint.ts +59 -0
- package/src/sample/domains/notifications/endpoints/markMyNotificationAsRead.endpoint.ts +32 -0
- package/src/sample/domains/notifications/index.ts +20 -0
- package/src/sample/domains/payroll/concepts/payslip.concept.ts +18 -0
- package/src/sample/domains/payroll/concepts/salaryCertificate.concept.ts +17 -0
- package/src/sample/domains/payroll/concepts/salaryCertificateRequestingEntity.concept.ts +8 -0
- package/src/sample/domains/payroll/endpoints/getPayslipById.endpoint.ts +238 -0
- package/src/sample/domains/payroll/endpoints/listPayslips.endpoint.ts +216 -0
- package/src/sample/domains/payroll/endpoints/listSalaryCertificateLanguages.endpoint.ts +25 -0
- package/src/sample/domains/payroll/endpoints/listSalaryCertificateRequestingEntities.endpoint.ts +62 -0
- package/src/sample/domains/payroll/endpoints/listSalaryCertificateTypes.endpoint.ts +24 -0
- package/src/sample/domains/payroll/endpoints/listSalaryCertificates.endpoint.ts +122 -0
- package/src/sample/domains/payroll/endpoints/previewSalaryCertificate.endpoint.ts +45 -0
- package/src/sample/domains/payroll/index.ts +32 -0
- package/src/sample/domains/payroll/rules/payrollEmployeeContext.rule.ts +7 -0
- package/src/sample/domains/payroll/services/salaryCertificates.service.ts +15 -0
- package/src/sample/domains/servicing/concepts/service.concept.ts +6 -0
- package/src/sample/domains/servicing/concepts/serviceRequest.concept.ts +12 -0
- package/src/sample/domains/servicing/concepts/serviceRequestApproval.concept.ts +9 -0
- package/src/sample/domains/servicing/endpoints/cancelServiceRequest.endpoint.ts +21 -0
- package/src/sample/domains/servicing/endpoints/createServiceRequest.endpoint.ts +511 -0
- package/src/sample/domains/servicing/endpoints/getServiceRequest.endpoint.ts +352 -0
- package/src/sample/domains/servicing/endpoints/getServiceRequestFormItems.endpoint.ts +219 -0
- package/src/sample/domains/servicing/endpoints/getServiceRequestTransactionFormItems.endpoint.ts +216 -0
- package/src/sample/domains/servicing/endpoints/getServiceStates.endpoint.ts +47 -0
- package/src/sample/domains/servicing/endpoints/invokeServiceRequestAction.endpoint.ts +139 -0
- package/src/sample/domains/servicing/endpoints/listServiceRequests.endpoint.ts +292 -0
- package/src/sample/domains/servicing/endpoints/listServices.endpoint.ts +108 -0
- package/src/sample/domains/servicing/endpoints/updateServiceRequest.endpoint.ts +355 -0
- package/src/sample/domains/servicing/index.ts +44 -0
- package/src/sample/domains/servicing/rules/checkValidActions.rule.ts +7 -0
- package/src/sample/domains/servicing/rules/createServiceRequest.rule.ts +7 -0
- package/src/sample/domains/servicing/rules/filterServiceRequestsByState.rule.ts +7 -0
- package/src/sample/domains/servicing/rules/passingOptionFields.rule.ts +7 -0
- package/src/sample/domains/shared/rules/pagination.rule.ts +7 -0
- package/src/sample/domains/suggestions/concepts/suggestion.concept.ts +19 -0
- package/src/sample/domains/suggestions/concepts/suggestionCategory.concept.ts +7 -0
- package/src/sample/domains/suggestions/concepts/suggestionImpactLevel.concept.ts +7 -0
- package/src/sample/domains/suggestions/endpoints/createSuggestion.endpoint.ts +705 -0
- package/src/sample/domains/suggestions/endpoints/deleteSuggestion.endpoint.ts +32 -0
- package/src/sample/domains/suggestions/endpoints/getSuggestionById.endpoint.ts +635 -0
- package/src/sample/domains/suggestions/endpoints/listSuggestionCategories.endpoint.ts +62 -0
- package/src/sample/domains/suggestions/endpoints/listSuggestionImpactLevels.endpoint.ts +62 -0
- package/src/sample/domains/suggestions/endpoints/listSuggestionStates.endpoint.ts +24 -0
- package/src/sample/domains/suggestions/endpoints/listSuggestions.endpoint.ts +132 -0
- package/src/sample/domains/suggestions/endpoints/updateSuggestion.endpoint.ts +690 -0
- package/src/sample/domains/suggestions/endpoints/updateSuggestionState.endpoint.ts +39 -0
- package/src/sample/domains/suggestions/index.ts +34 -0
- package/src/sample/domains/suggestions/rules/suggestionScope.rule.ts +7 -0
- package/src/sample/domains/surveys/concepts/survey.concept.ts +10 -0
- package/src/sample/domains/surveys/concepts/surveyResponse.concept.ts +14 -0
- package/src/sample/domains/surveys/endpoints/getSurveyResponseById.endpoint.ts +131 -0
- package/src/sample/domains/surveys/endpoints/getTargetedSurvey.endpoint.ts +129 -0
- package/src/sample/domains/surveys/endpoints/listTargetedSurveys.endpoint.ts +160 -0
- package/src/sample/domains/surveys/endpoints/respondToSurvey.endpoint.ts +144 -0
- package/src/sample/domains/surveys/index.ts +21 -0
- package/src/sample/drizzle.config.ts +11 -0
- package/src/sample/index.bak.ts +341 -0
- package/src/sample/index.ts +318 -0
- package/src/sample/official-statements/defaults.ts +57 -0
- package/src/sample/official-statements/routes.ts +137 -0
- package/src/sample/official-statements/service.ts +148 -0
- package/src/sample/official-statements/types.ts +23 -0
- package/dist/src/ai/context/compressor.d.ts +0 -7
- package/dist/src/ai/tools/call-endpoint.tool.d.ts +0 -7
- package/dist/src/config.d.ts +0 -159
- package/src/ai/context/compressor.ts +0 -47
- package/src/ai/prompt.ts +0 -126
- package/src/ai/tools/call-endpoint.tool.ts +0 -89
- package/src/config.ts +0 -164
- package/src/db/migrations/20260315000000_add_context_meta/migration.sql +0 -1
- package/dist/src/{adapters → lib/adapters}/minio.d.ts +0 -0
- package/dist/src/{adapters → lib/adapters}/mssql.d.ts +0 -0
- package/dist/src/{adapters → lib/adapters}/storage.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/active-streams.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/context/builder.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/context/summarizer.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/context/token-estimator.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/fetch.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/helpers.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/index.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/interceptors/request-interceptor.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/prompt.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/tools/capture-files.tool.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/tools/execute-code.tool.d.ts +0 -0
- package/dist/src/{ai → lib/ai}/tools/query-graph.tool.d.ts +0 -0
- package/dist/src/{auth → lib/auth}/middleware.d.ts +0 -0
- package/dist/src/{cli → lib/cli}/extract-endpoints.d.ts +0 -0
- package/dist/src/{db → lib/db}/migrate.d.ts +0 -0
- package/dist/src/{factory.d.ts → lib/factory.d.ts} +0 -0
- package/dist/src/{graph → lib/graph}/expand-domains.d.ts +0 -0
- package/dist/src/{graph → lib/graph}/generate-cypher.d.ts +0 -0
- package/dist/src/{graph → lib/graph}/helpers.d.ts +2 -2
- /package/dist/src/{graph → lib/graph}/index.d.ts +0 -0
- /package/dist/src/{graph → lib/graph}/neo4j.d.ts +0 -0
- /package/dist/src/{graph → lib/graph}/resolver.d.ts +0 -0
- /package/dist/src/{graph → lib/graph}/seed.d.ts +0 -0
- /package/dist/src/{graph → lib/graph}/types.d.ts +0 -0
- /package/dist/src/{graph → lib/graph}/validate.d.ts +0 -0
- /package/dist/src/{routes → lib/routes}/chat.d.ts +0 -0
- /package/dist/src/{routes → lib/routes}/files.d.ts +0 -0
- /package/dist/src/{routes → lib/routes}/index.d.ts +0 -0
- /package/dist/src/{routes → lib/routes}/threads.d.ts +0 -0
- /package/dist/src/{routes → lib/routes}/ws.d.ts +0 -0
- /package/dist/src/{ws → lib/ws}/connections.d.ts +0 -0
- /package/dist/src/{ws → lib/ws}/events.d.ts +0 -0
- /package/dist/src/{ws → lib/ws}/index.d.ts +0 -0
- /package/dist/src/{ws → lib/ws}/notify.d.ts +0 -0
- /package/src/{adapters → lib/adapters}/storage.ts +0 -0
- /package/src/{ai → lib/ai}/active-streams.ts +0 -0
- /package/src/{ai → lib/ai}/context/builder.ts +0 -0
- /package/src/{ai → lib/ai}/context/summarizer.ts +0 -0
- /package/src/{ai → lib/ai}/context/token-estimator.ts +0 -0
- /package/src/{ai → lib/ai}/fetch.ts +0 -0
- /package/src/{ai → lib/ai}/helpers.ts +0 -0
- /package/src/{ai → lib/ai}/interceptors/request-interceptor.ts +0 -0
- /package/src/{ai → lib/ai}/tools/capture-files.tool.ts +0 -0
- /package/src/{ai → lib/ai}/tools/query-graph.tool.ts +0 -0
- /package/src/{cli → lib/cli}/extract-endpoints.ts +0 -0
- /package/src/{db → lib/db}/migrate.ts +0 -0
- /package/src/{graph → lib/graph}/expand-domains.ts +0 -0
- /package/src/{graph → lib/graph}/generate-cypher.ts +0 -0
- /package/src/{graph → lib/graph}/helpers.ts +0 -0
- /package/src/{graph → lib/graph}/index.ts +0 -0
- /package/src/{graph → lib/graph}/neo4j.ts +0 -0
- /package/src/{graph → lib/graph}/resolver.ts +0 -0
- /package/src/{graph → lib/graph}/seed.ts +0 -0
- /package/src/{graph → lib/graph}/types.ts +0 -0
- /package/src/{graph → lib/graph}/validate.ts +0 -0
- /package/src/{routes → lib/routes}/chat.ts +0 -0
- /package/src/{routes → lib/routes}/index.ts +0 -0
- /package/src/{routes → lib/routes}/ws.ts +0 -0
- /package/src/{ws → lib/ws}/connections.ts +0 -0
- /package/src/{ws → lib/ws}/events.ts +0 -0
- /package/src/{ws → lib/ws}/index.ts +0 -0
- /package/src/{ws → lib/ws}/notify.ts +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type OfficialStatementDeclarant = {
|
|
2
|
+
fullName: string;
|
|
3
|
+
address: string;
|
|
4
|
+
contactMethod: string;
|
|
5
|
+
contactNumber: string;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export type OfficialStatementQA = {
|
|
9
|
+
question: string;
|
|
10
|
+
answer: string;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type OfficialStatementData = {
|
|
14
|
+
reference: string;
|
|
15
|
+
caseType: string;
|
|
16
|
+
dateOfRecord: string;
|
|
17
|
+
timeOfRecord: string;
|
|
18
|
+
declarant: OfficialStatementDeclarant;
|
|
19
|
+
investigation: OfficialStatementQA[];
|
|
20
|
+
declarantName: string;
|
|
21
|
+
officerName: string;
|
|
22
|
+
locked: boolean;
|
|
23
|
+
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { UIMessage } from "ai";
|
|
2
|
-
import type { MessageMetadata } from "src/types.ts";
|
|
3
|
-
/**
|
|
4
|
-
* Returns a new array of messages with large tool outputs truncated
|
|
5
|
-
* to `maxTokensPerResult`. Does not mutate the input messages.
|
|
6
|
-
*/
|
|
7
|
-
export declare function compressToolResults(messages: UIMessage<MessageMetadata>[], maxTokensPerResult: number): UIMessage<MessageMetadata, import("ai").UIDataTypes, import("ai").UITools>[];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ResolvedCortexAgentConfig } from "../../config.ts";
|
|
2
|
-
export declare function createCallEndpointTool(backendFetch: NonNullable<ResolvedCortexAgentConfig["backendFetch"]>, token: string): import("ai").Tool<{
|
|
3
|
-
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
4
|
-
path: string;
|
|
5
|
-
body?: string | undefined;
|
|
6
|
-
queryParams?: string | undefined;
|
|
7
|
-
}, string>;
|
package/dist/src/config.d.ts
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import type { ToolSet, UIMessage } from "ai";
|
|
2
|
-
import type { DatabaseAdapter } from "./adapters/database";
|
|
3
|
-
import type { StorageAdapter } from "./adapters/storage";
|
|
4
|
-
import type { DomainDef } from "./graph/types.ts";
|
|
5
|
-
import type { RequestInterceptorOptions } from "./ai/interceptors/request-interceptor.ts";
|
|
6
|
-
import type { ContextConfig } from "./ai/context/types.ts";
|
|
7
|
-
export type KnowledgeConfig = {
|
|
8
|
-
swagger?: {
|
|
9
|
-
url: string;
|
|
10
|
-
};
|
|
11
|
-
domains?: Record<string, DomainDef>;
|
|
12
|
-
};
|
|
13
|
-
export type PromptContext = {
|
|
14
|
-
session: Record<string, unknown> | null;
|
|
15
|
-
requestContext: Record<string, unknown>;
|
|
16
|
-
};
|
|
17
|
-
export type DatabaseConfig = {
|
|
18
|
-
type: "mssql";
|
|
19
|
-
connectionString: string;
|
|
20
|
-
};
|
|
21
|
-
export type StorageConfig = {
|
|
22
|
-
endPoint: string;
|
|
23
|
-
port: number;
|
|
24
|
-
useSSL: boolean;
|
|
25
|
-
accessKey: string;
|
|
26
|
-
secretKey: string;
|
|
27
|
-
bucketName?: string;
|
|
28
|
-
};
|
|
29
|
-
export type CortexAgentDefinition = {
|
|
30
|
-
systemPrompt: string | ((context: PromptContext) => string | Promise<string>);
|
|
31
|
-
tools?: ToolSet;
|
|
32
|
-
backendFetch?: {
|
|
33
|
-
baseUrl: string;
|
|
34
|
-
apiKey: string;
|
|
35
|
-
headers?: Record<string, string>;
|
|
36
|
-
transformRequestBody?: (body: Record<string, unknown>, context: {
|
|
37
|
-
token: string;
|
|
38
|
-
}) => Promise<Record<string, unknown>>;
|
|
39
|
-
interceptor?: RequestInterceptorOptions;
|
|
40
|
-
};
|
|
41
|
-
loadSessionData?: (token: string) => Promise<Record<string, unknown>>;
|
|
42
|
-
resolveRequestContext?: (request: Request) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
43
|
-
onToolCall?: (toolCall: {
|
|
44
|
-
toolName: string;
|
|
45
|
-
toolCallId: string;
|
|
46
|
-
args: Record<string, unknown>;
|
|
47
|
-
}) => void;
|
|
48
|
-
onStreamFinish?: (result: {
|
|
49
|
-
messages: UIMessage[];
|
|
50
|
-
isAborted: boolean;
|
|
51
|
-
}) => void;
|
|
52
|
-
model?: {
|
|
53
|
-
baseURL: string;
|
|
54
|
-
apiKey: string;
|
|
55
|
-
modelName: string;
|
|
56
|
-
providerName?: string;
|
|
57
|
-
};
|
|
58
|
-
embedding?: {
|
|
59
|
-
baseURL: string;
|
|
60
|
-
apiKey: string;
|
|
61
|
-
modelName: string;
|
|
62
|
-
dimension: number;
|
|
63
|
-
};
|
|
64
|
-
neo4j?: {
|
|
65
|
-
url: string;
|
|
66
|
-
user: string;
|
|
67
|
-
password: string;
|
|
68
|
-
};
|
|
69
|
-
reranker?: {
|
|
70
|
-
url: string;
|
|
71
|
-
apiKey: string;
|
|
72
|
-
};
|
|
73
|
-
context?: Partial<ContextConfig>;
|
|
74
|
-
knowledge?: KnowledgeConfig | null;
|
|
75
|
-
};
|
|
76
|
-
export type ResolvedCortexAgentConfig = {
|
|
77
|
-
db: DatabaseAdapter;
|
|
78
|
-
storage: StorageAdapter;
|
|
79
|
-
model: {
|
|
80
|
-
baseURL: string;
|
|
81
|
-
apiKey: string;
|
|
82
|
-
modelName: string;
|
|
83
|
-
providerName?: string;
|
|
84
|
-
};
|
|
85
|
-
embedding: {
|
|
86
|
-
baseURL: string;
|
|
87
|
-
apiKey: string;
|
|
88
|
-
modelName: string;
|
|
89
|
-
dimension: number;
|
|
90
|
-
};
|
|
91
|
-
neo4j: {
|
|
92
|
-
url: string;
|
|
93
|
-
user: string;
|
|
94
|
-
password: string;
|
|
95
|
-
};
|
|
96
|
-
reranker?: {
|
|
97
|
-
url: string;
|
|
98
|
-
apiKey: string;
|
|
99
|
-
};
|
|
100
|
-
systemPrompt: string | ((context: PromptContext) => string | Promise<string>);
|
|
101
|
-
tools?: ToolSet;
|
|
102
|
-
backendFetch?: {
|
|
103
|
-
baseUrl: string;
|
|
104
|
-
apiKey: string;
|
|
105
|
-
headers?: Record<string, string>;
|
|
106
|
-
transformRequestBody?: (body: Record<string, unknown>, context: {
|
|
107
|
-
token: string;
|
|
108
|
-
}) => Promise<Record<string, unknown>>;
|
|
109
|
-
interceptor?: RequestInterceptorOptions;
|
|
110
|
-
};
|
|
111
|
-
loadSessionData?: (token: string) => Promise<Record<string, unknown>>;
|
|
112
|
-
resolveRequestContext?: (request: Request) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
113
|
-
onToolCall?: (toolCall: {
|
|
114
|
-
toolName: string;
|
|
115
|
-
toolCallId: string;
|
|
116
|
-
args: Record<string, unknown>;
|
|
117
|
-
}) => void;
|
|
118
|
-
onStreamFinish?: (result: {
|
|
119
|
-
messages: UIMessage[];
|
|
120
|
-
isAborted: boolean;
|
|
121
|
-
}) => void;
|
|
122
|
-
context: ContextConfig;
|
|
123
|
-
knowledge?: KnowledgeConfig;
|
|
124
|
-
};
|
|
125
|
-
export type CortexConfig = {
|
|
126
|
-
port?: number;
|
|
127
|
-
database: DatabaseConfig;
|
|
128
|
-
storage: StorageConfig;
|
|
129
|
-
auth: {
|
|
130
|
-
jwksUri: string;
|
|
131
|
-
issuer: string;
|
|
132
|
-
tokenExtractor?: (req: Request) => string | null;
|
|
133
|
-
cookieName?: string;
|
|
134
|
-
};
|
|
135
|
-
model: {
|
|
136
|
-
baseURL: string;
|
|
137
|
-
apiKey: string;
|
|
138
|
-
modelName: string;
|
|
139
|
-
providerName?: string;
|
|
140
|
-
};
|
|
141
|
-
embedding: {
|
|
142
|
-
baseURL: string;
|
|
143
|
-
apiKey: string;
|
|
144
|
-
modelName: string;
|
|
145
|
-
dimension: number;
|
|
146
|
-
};
|
|
147
|
-
neo4j: {
|
|
148
|
-
url: string;
|
|
149
|
-
user: string;
|
|
150
|
-
password: string;
|
|
151
|
-
};
|
|
152
|
-
reranker?: {
|
|
153
|
-
url: string;
|
|
154
|
-
apiKey: string;
|
|
155
|
-
};
|
|
156
|
-
context?: Partial<ContextConfig>;
|
|
157
|
-
knowledge?: KnowledgeConfig;
|
|
158
|
-
agents: Record<string, CortexAgentDefinition>;
|
|
159
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import type { UIMessage } from "ai";
|
|
2
|
-
import { estimateTokens, CHARS_PER_TOKEN } from "./token-estimator.ts";
|
|
3
|
-
import type { MessageMetadata } from "src/types.ts";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Returns a new array of messages with large tool outputs truncated
|
|
7
|
-
* to `maxTokensPerResult`. Does not mutate the input messages.
|
|
8
|
-
*/
|
|
9
|
-
export function compressToolResults(
|
|
10
|
-
messages: UIMessage<MessageMetadata>[],
|
|
11
|
-
maxTokensPerResult: number,
|
|
12
|
-
) {
|
|
13
|
-
return messages.map((message) => {
|
|
14
|
-
let hasLargeToolOutput = false;
|
|
15
|
-
|
|
16
|
-
for (const part of message.parts) {
|
|
17
|
-
if ("toolCallId" in part && "output" in part && part.output != null) {
|
|
18
|
-
const outputTokens = estimateTokens(JSON.stringify(part.output));
|
|
19
|
-
if (outputTokens > maxTokensPerResult) {
|
|
20
|
-
hasLargeToolOutput = true;
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (!hasLargeToolOutput) return message;
|
|
27
|
-
|
|
28
|
-
const compressedParts = message.parts.map((part) => {
|
|
29
|
-
if (!("toolCallId" in part) || !("output" in part) || part.output == null) {
|
|
30
|
-
return part;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const outputStr = JSON.stringify(part.output);
|
|
34
|
-
const outputTokens = estimateTokens(outputStr);
|
|
35
|
-
|
|
36
|
-
if (outputTokens <= maxTokensPerResult) return part;
|
|
37
|
-
|
|
38
|
-
// Convert token budget back to character budget
|
|
39
|
-
const charBudget = maxTokensPerResult * CHARS_PER_TOKEN;
|
|
40
|
-
const truncatedOutput = outputStr.slice(0, charBudget) + "\n[...truncated]";
|
|
41
|
-
|
|
42
|
-
return { ...part, output: truncatedOutput } as typeof part;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return { ...message, parts: compressedParts };
|
|
46
|
-
});
|
|
47
|
-
}
|
package/src/ai/prompt.ts
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import type { ResolvedContext } from "../graph/resolver.ts";
|
|
2
|
-
import type { PromptContext, ResolvedCortexAgentConfig } from "../config.ts";
|
|
3
|
-
import type { Thread } from "../types.ts";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Resolves session data for the thread, loading from the configured
|
|
7
|
-
* session loader if not already cached on the thread.
|
|
8
|
-
*/
|
|
9
|
-
export async function resolveSession(
|
|
10
|
-
config: ResolvedCortexAgentConfig,
|
|
11
|
-
thread: Thread,
|
|
12
|
-
token: string,
|
|
13
|
-
) {
|
|
14
|
-
let session = thread.session;
|
|
15
|
-
|
|
16
|
-
if (!session && config.loadSessionData) {
|
|
17
|
-
session = await config.loadSessionData(token);
|
|
18
|
-
// Persist to DB for future cache hits
|
|
19
|
-
await config.db.threads.updateSession(thread.id, session);
|
|
20
|
-
thread.session = session;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return session;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export async function buildSystemPrompt(
|
|
27
|
-
config: ResolvedCortexAgentConfig,
|
|
28
|
-
resolved: ResolvedContext | null,
|
|
29
|
-
promptContext: PromptContext,
|
|
30
|
-
) {
|
|
31
|
-
// Resolve the consumer's base system prompt
|
|
32
|
-
let basePrompt: string;
|
|
33
|
-
if (typeof config.systemPrompt === "function") {
|
|
34
|
-
basePrompt = await config.systemPrompt(promptContext);
|
|
35
|
-
} else {
|
|
36
|
-
basePrompt = config.systemPrompt;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
const sections: string[] = [basePrompt];
|
|
40
|
-
|
|
41
|
-
// Pre-resolved endpoints from knowledge graph
|
|
42
|
-
if (resolved) {
|
|
43
|
-
sections.push(buildResolvedSection(resolved));
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
return sections.join("\n");
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function buildResolvedSection(resolved: ResolvedContext) {
|
|
50
|
-
const parts: string[] = [
|
|
51
|
-
`
|
|
52
|
-
## Pre-resolved API Endpoints
|
|
53
|
-
The following endpoints were automatically matched to the user's message.`,
|
|
54
|
-
];
|
|
55
|
-
|
|
56
|
-
for (const ep of resolved.readEndpoints) {
|
|
57
|
-
const rules = ep.rules.length > 0 ? `\n Rules: ${ep.rules.join("; ")}` : "";
|
|
58
|
-
const deps =
|
|
59
|
-
ep.dependencies.length > 0
|
|
60
|
-
? "\n Dependencies:\n" +
|
|
61
|
-
ep.dependencies
|
|
62
|
-
.map(
|
|
63
|
-
(d) =>
|
|
64
|
-
` - Call ${d.depMethod} ${d.depPath} first → use its "${d.fromField}" as "${d.paramName}"`,
|
|
65
|
-
)
|
|
66
|
-
.join("\n")
|
|
67
|
-
: "";
|
|
68
|
-
const meta = ep.metadata !== "{}" ? `\n- Metadata: ${ep.metadata}` : "";
|
|
69
|
-
parts.push(
|
|
70
|
-
`
|
|
71
|
-
### ${ep.concept} (read)
|
|
72
|
-
- Endpoint: ${ep.name}
|
|
73
|
-
- ${ep.method} ${ep.path}
|
|
74
|
-
- Params: ${ep.params}
|
|
75
|
-
- Body: ${ep.body}
|
|
76
|
-
- Response: ${ep.response}${rules}${deps}${meta}`,
|
|
77
|
-
);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
for (const ep of resolved.writeEndpoints) {
|
|
81
|
-
const rules = ep.rules.length > 0 ? `\n Rules: ${ep.rules.join("; ")}` : "";
|
|
82
|
-
const deps =
|
|
83
|
-
ep.dependencies.length > 0
|
|
84
|
-
? "\n Dependencies:\n" +
|
|
85
|
-
ep.dependencies
|
|
86
|
-
.map(
|
|
87
|
-
(d) =>
|
|
88
|
-
` - Call ${d.depMethod} ${d.depPath} first → use its "${d.fromField}" as "${d.paramName}"`,
|
|
89
|
-
)
|
|
90
|
-
.join("\n")
|
|
91
|
-
: "";
|
|
92
|
-
const meta = ep.metadata !== "{}" ? `\n- Metadata: ${ep.metadata}` : "";
|
|
93
|
-
parts.push(
|
|
94
|
-
`
|
|
95
|
-
### ${ep.concept} (write)
|
|
96
|
-
- Endpoint: ${ep.name}
|
|
97
|
-
- ${ep.method} ${ep.path}
|
|
98
|
-
- Params: ${ep.params}
|
|
99
|
-
- Body: ${ep.body}
|
|
100
|
-
- Response: ${ep.response}${rules}${deps}${meta}`,
|
|
101
|
-
);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
for (const svc of resolved.services) {
|
|
105
|
-
const rules = svc.rules.length > 0 ? `\n Rules: ${svc.rules.join("; ")}` : "";
|
|
106
|
-
const meta = svc.metadata !== "{}" ? `\n- Metadata: ${svc.metadata}` : "";
|
|
107
|
-
parts.push(
|
|
108
|
-
`
|
|
109
|
-
### ${svc.concept} via ${svc.serviceName} (service)
|
|
110
|
-
- Built-in ID: ${svc.builtInId}
|
|
111
|
-
- Description: ${svc.description || "N/A"}${rules}${meta}`,
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (
|
|
116
|
-
resolved.readEndpoints.length === 0 &&
|
|
117
|
-
resolved.writeEndpoints.length === 0 &&
|
|
118
|
-
resolved.services.length === 0
|
|
119
|
-
) {
|
|
120
|
-
parts.push(
|
|
121
|
-
"\nNo matching endpoints found. Use queryGraph to search the knowledge graph manually.",
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
return parts.join("");
|
|
126
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { tool } from "ai";
|
|
2
|
-
import z from "zod";
|
|
3
|
-
import type { ResolvedCortexAgentConfig } from "../../config.ts";
|
|
4
|
-
import { fetchBackend } from "../fetch.ts";
|
|
5
|
-
|
|
6
|
-
export function createCallEndpointTool(
|
|
7
|
-
backendFetch: NonNullable<ResolvedCortexAgentConfig["backendFetch"]>,
|
|
8
|
-
token: string,
|
|
9
|
-
) {
|
|
10
|
-
return tool({
|
|
11
|
-
title: "Call an API endpoint",
|
|
12
|
-
description:
|
|
13
|
-
"Call an API endpoint on the backend. Use queryGraph first to discover the correct endpoint, parameters, and business rules. For write operations (POST/PUT/DELETE), ALWAYS get explicit user confirmation before calling.",
|
|
14
|
-
inputSchema: z.object({
|
|
15
|
-
path: z
|
|
16
|
-
.string()
|
|
17
|
-
.describe(
|
|
18
|
-
'The API path including path parameters. Example: "/items/list" or "/resources/{id}"',
|
|
19
|
-
),
|
|
20
|
-
method: z.enum(["GET", "POST", "PUT", "DELETE"]).describe("The HTTP method"),
|
|
21
|
-
queryParams: z
|
|
22
|
-
.string()
|
|
23
|
-
.optional()
|
|
24
|
-
.describe("Optional JSON-encoded string of query parameters."),
|
|
25
|
-
body: z
|
|
26
|
-
.string()
|
|
27
|
-
.optional()
|
|
28
|
-
.describe(
|
|
29
|
-
"Optional JSON-encoded string of request body for POST/PUT. For parameters of type file, use `capturedFile#[uploadId]` as the value.",
|
|
30
|
-
),
|
|
31
|
-
}),
|
|
32
|
-
execute: async ({ path, method, queryParams, body }) => {
|
|
33
|
-
let fullPath = path;
|
|
34
|
-
if (queryParams) {
|
|
35
|
-
const params = JSON.parse(queryParams) as Record<string, unknown>;
|
|
36
|
-
const searchParams = new URLSearchParams();
|
|
37
|
-
for (const [key, value] of Object.entries(params)) {
|
|
38
|
-
if (value == null || value === "") continue;
|
|
39
|
-
if (Array.isArray(value)) {
|
|
40
|
-
for (const item of value) {
|
|
41
|
-
searchParams.append(key, String(item));
|
|
42
|
-
}
|
|
43
|
-
} else {
|
|
44
|
-
searchParams.set(key, String(value));
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
const qs = searchParams.toString();
|
|
48
|
-
if (qs) fullPath += `?${qs}`;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const options: RequestInit = { method };
|
|
52
|
-
if (body && (method === "POST" || method === "PUT")) {
|
|
53
|
-
options.body = body;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const response = await fetchBackend(fullPath, backendFetch, token, options);
|
|
57
|
-
|
|
58
|
-
if (!response.ok) {
|
|
59
|
-
let message: string;
|
|
60
|
-
let details: unknown = undefined;
|
|
61
|
-
try {
|
|
62
|
-
const errorBody = (await response.json()) as Record<string, unknown>;
|
|
63
|
-
message =
|
|
64
|
-
(errorBody.message as string) ||
|
|
65
|
-
(errorBody.title as string) ||
|
|
66
|
-
JSON.stringify(errorBody);
|
|
67
|
-
if (errorBody.errors) {
|
|
68
|
-
details = errorBody.errors;
|
|
69
|
-
}
|
|
70
|
-
} catch {
|
|
71
|
-
message = `Request failed with status ${response.status}`;
|
|
72
|
-
}
|
|
73
|
-
return JSON.stringify({
|
|
74
|
-
error: true,
|
|
75
|
-
status: response.status,
|
|
76
|
-
message,
|
|
77
|
-
...(details ? { details } : {}),
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
if (response.status === 204) {
|
|
82
|
-
return JSON.stringify({ success: true });
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const data = await response.json();
|
|
86
|
-
return JSON.stringify(data);
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
}
|
package/src/config.ts
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import type { Tool, ToolSet, UIMessage } from "ai";
|
|
2
|
-
import type { DatabaseAdapter } from "./adapters/database";
|
|
3
|
-
import type { StorageAdapter } from "./adapters/storage";
|
|
4
|
-
import type { DomainDef } from "./graph/types.ts";
|
|
5
|
-
import type { RequestInterceptorOptions } from "./ai/interceptors/request-interceptor.ts";
|
|
6
|
-
import type { ContextConfig } from "./ai/context/types.ts";
|
|
7
|
-
|
|
8
|
-
export type KnowledgeConfig = {
|
|
9
|
-
swagger?: { url: string };
|
|
10
|
-
domains?: Record<string, DomainDef>;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export type PromptContext = {
|
|
14
|
-
session: Record<string, unknown> | null;
|
|
15
|
-
requestContext: Record<string, unknown>;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
export type DatabaseConfig = {
|
|
19
|
-
type: "mssql";
|
|
20
|
-
connectionString: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export type StorageConfig = {
|
|
24
|
-
endPoint: string;
|
|
25
|
-
port: number;
|
|
26
|
-
useSSL: boolean;
|
|
27
|
-
accessKey: string;
|
|
28
|
-
secretKey: string;
|
|
29
|
-
bucketName?: string;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type CortexAgentDefinition = {
|
|
33
|
-
systemPrompt: string | ((context: PromptContext) => string | Promise<string>);
|
|
34
|
-
tools?: ToolSet;
|
|
35
|
-
backendFetch?: {
|
|
36
|
-
baseUrl: string;
|
|
37
|
-
apiKey: string;
|
|
38
|
-
headers?: Record<string, string>;
|
|
39
|
-
transformRequestBody?: (
|
|
40
|
-
body: Record<string, unknown>,
|
|
41
|
-
context: { token: string },
|
|
42
|
-
) => Promise<Record<string, unknown>>;
|
|
43
|
-
interceptor?: RequestInterceptorOptions;
|
|
44
|
-
};
|
|
45
|
-
loadSessionData?: (token: string) => Promise<Record<string, unknown>>;
|
|
46
|
-
resolveRequestContext?: (
|
|
47
|
-
request: Request,
|
|
48
|
-
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
49
|
-
onToolCall?: (toolCall: {
|
|
50
|
-
toolName: string;
|
|
51
|
-
toolCallId: string;
|
|
52
|
-
args: Record<string, unknown>;
|
|
53
|
-
}) => void;
|
|
54
|
-
onStreamFinish?: (result: { messages: UIMessage[]; isAborted: boolean }) => void;
|
|
55
|
-
model?: {
|
|
56
|
-
baseURL: string;
|
|
57
|
-
apiKey: string;
|
|
58
|
-
modelName: string;
|
|
59
|
-
providerName?: string;
|
|
60
|
-
};
|
|
61
|
-
embedding?: {
|
|
62
|
-
baseURL: string;
|
|
63
|
-
apiKey: string;
|
|
64
|
-
modelName: string;
|
|
65
|
-
dimension: number;
|
|
66
|
-
};
|
|
67
|
-
neo4j?: {
|
|
68
|
-
url: string;
|
|
69
|
-
user: string;
|
|
70
|
-
password: string;
|
|
71
|
-
};
|
|
72
|
-
reranker?: {
|
|
73
|
-
url: string;
|
|
74
|
-
apiKey: string;
|
|
75
|
-
};
|
|
76
|
-
context?: Partial<ContextConfig>;
|
|
77
|
-
knowledge?: KnowledgeConfig | null;
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export type ResolvedCortexAgentConfig = {
|
|
81
|
-
db: DatabaseAdapter;
|
|
82
|
-
storage: StorageAdapter;
|
|
83
|
-
model: {
|
|
84
|
-
baseURL: string;
|
|
85
|
-
apiKey: string;
|
|
86
|
-
modelName: string;
|
|
87
|
-
providerName?: string;
|
|
88
|
-
};
|
|
89
|
-
embedding: {
|
|
90
|
-
baseURL: string;
|
|
91
|
-
apiKey: string;
|
|
92
|
-
modelName: string;
|
|
93
|
-
dimension: number;
|
|
94
|
-
};
|
|
95
|
-
neo4j: {
|
|
96
|
-
url: string;
|
|
97
|
-
user: string;
|
|
98
|
-
password: string;
|
|
99
|
-
};
|
|
100
|
-
reranker?: {
|
|
101
|
-
url: string;
|
|
102
|
-
apiKey: string;
|
|
103
|
-
};
|
|
104
|
-
systemPrompt: string | ((context: PromptContext) => string | Promise<string>);
|
|
105
|
-
tools?: ToolSet;
|
|
106
|
-
backendFetch?: {
|
|
107
|
-
baseUrl: string;
|
|
108
|
-
apiKey: string;
|
|
109
|
-
headers?: Record<string, string>;
|
|
110
|
-
transformRequestBody?: (
|
|
111
|
-
body: Record<string, unknown>,
|
|
112
|
-
context: { token: string },
|
|
113
|
-
) => Promise<Record<string, unknown>>;
|
|
114
|
-
interceptor?: RequestInterceptorOptions;
|
|
115
|
-
};
|
|
116
|
-
loadSessionData?: (token: string) => Promise<Record<string, unknown>>;
|
|
117
|
-
resolveRequestContext?: (
|
|
118
|
-
request: Request,
|
|
119
|
-
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
120
|
-
onToolCall?: (toolCall: {
|
|
121
|
-
toolName: string;
|
|
122
|
-
toolCallId: string;
|
|
123
|
-
args: Record<string, unknown>;
|
|
124
|
-
}) => void;
|
|
125
|
-
onStreamFinish?: (result: { messages: UIMessage[]; isAborted: boolean }) => void;
|
|
126
|
-
context: ContextConfig;
|
|
127
|
-
knowledge?: KnowledgeConfig;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export type CortexConfig = {
|
|
131
|
-
port?: number;
|
|
132
|
-
database: DatabaseConfig;
|
|
133
|
-
storage: StorageConfig;
|
|
134
|
-
auth: {
|
|
135
|
-
jwksUri: string;
|
|
136
|
-
issuer: string;
|
|
137
|
-
tokenExtractor?: (req: Request) => string | null;
|
|
138
|
-
cookieName?: string;
|
|
139
|
-
};
|
|
140
|
-
model: {
|
|
141
|
-
baseURL: string;
|
|
142
|
-
apiKey: string;
|
|
143
|
-
modelName: string;
|
|
144
|
-
providerName?: string;
|
|
145
|
-
};
|
|
146
|
-
embedding: {
|
|
147
|
-
baseURL: string;
|
|
148
|
-
apiKey: string;
|
|
149
|
-
modelName: string;
|
|
150
|
-
dimension: number;
|
|
151
|
-
};
|
|
152
|
-
neo4j: {
|
|
153
|
-
url: string;
|
|
154
|
-
user: string;
|
|
155
|
-
password: string;
|
|
156
|
-
};
|
|
157
|
-
reranker?: {
|
|
158
|
-
url: string;
|
|
159
|
-
apiKey: string;
|
|
160
|
-
};
|
|
161
|
-
context?: Partial<ContextConfig>;
|
|
162
|
-
knowledge?: KnowledgeConfig;
|
|
163
|
-
agents: Record<string, CortexAgentDefinition>;
|
|
164
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
ALTER TABLE [ai].[threads] ADD [context_meta] nvarchar(max);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|