@memberjunction/server 2.103.0 → 2.105.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/agents/skip-agent.d.ts +29 -0
- package/dist/agents/skip-agent.d.ts.map +1 -0
- package/dist/agents/skip-agent.js +1308 -0
- package/dist/agents/skip-agent.js.map +1 -0
- package/dist/agents/skip-sdk.d.ts +47 -0
- package/dist/agents/skip-sdk.d.ts.map +1 -0
- package/dist/agents/skip-sdk.js +269 -0
- package/dist/agents/skip-sdk.js.map +1 -0
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -0
- package/dist/config.js.map +1 -1
- package/dist/generated/generated.d.ts +3660 -3386
- package/dist/generated/generated.d.ts.map +1 -1
- package/dist/generated/generated.js +22009 -20223
- package/dist/generated/generated.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -18
- package/dist/index.js.map +1 -1
- package/dist/resolvers/AskSkipResolver.d.ts.map +1 -1
- package/dist/resolvers/AskSkipResolver.js +24 -9
- package/dist/resolvers/AskSkipResolver.js.map +1 -1
- package/dist/resolvers/ComponentRegistryResolver.d.ts +19 -0
- package/dist/resolvers/ComponentRegistryResolver.d.ts.map +1 -1
- package/dist/resolvers/ComponentRegistryResolver.js +140 -2
- package/dist/resolvers/ComponentRegistryResolver.js.map +1 -1
- package/dist/resolvers/CreateQueryResolver.d.ts +2 -2
- package/dist/resolvers/CreateQueryResolver.d.ts.map +1 -1
- package/dist/resolvers/CreateQueryResolver.js +12 -12
- package/dist/resolvers/CreateQueryResolver.js.map +1 -1
- package/dist/resolvers/EntityResolver.d.ts +2 -2
- package/dist/resolvers/EntityResolver.d.ts.map +1 -1
- package/dist/resolvers/EntityResolver.js +4 -4
- package/dist/resolvers/EntityResolver.js.map +1 -1
- package/dist/resolvers/FileCategoryResolver.d.ts +1 -1
- package/dist/resolvers/FileCategoryResolver.d.ts.map +1 -1
- package/dist/resolvers/FileCategoryResolver.js +2 -2
- package/dist/resolvers/FileCategoryResolver.js.map +1 -1
- package/dist/resolvers/FileResolver.d.ts +6 -6
- package/dist/resolvers/FileResolver.d.ts.map +1 -1
- package/dist/resolvers/FileResolver.js +14 -14
- package/dist/resolvers/FileResolver.js.map +1 -1
- package/dist/resolvers/PotentialDuplicateRecordResolver.d.ts.map +1 -1
- package/dist/resolvers/PotentialDuplicateRecordResolver.js +0 -2
- package/dist/resolvers/PotentialDuplicateRecordResolver.js.map +1 -1
- package/dist/resolvers/RunAIAgentResolver.d.ts +3 -3
- package/dist/resolvers/RunAIAgentResolver.d.ts.map +1 -1
- package/dist/resolvers/RunAIAgentResolver.js +28 -21
- package/dist/resolvers/RunAIAgentResolver.js.map +1 -1
- package/dist/resolvers/RunTemplateResolver.d.ts.map +1 -1
- package/dist/resolvers/RunTemplateResolver.js.map +1 -1
- package/dist/resolvers/TaskResolver.d.ts +18 -0
- package/dist/resolvers/TaskResolver.d.ts.map +1 -0
- package/dist/resolvers/TaskResolver.js +138 -0
- package/dist/resolvers/TaskResolver.js.map +1 -0
- package/dist/resolvers/UserFavoriteResolver.d.ts +2 -2
- package/dist/resolvers/UserFavoriteResolver.d.ts.map +1 -1
- package/dist/resolvers/UserFavoriteResolver.js +5 -5
- package/dist/resolvers/UserFavoriteResolver.js.map +1 -1
- package/dist/resolvers/UserResolver.d.ts +2 -2
- package/dist/resolvers/UserResolver.d.ts.map +1 -1
- package/dist/resolvers/UserResolver.js +7 -7
- package/dist/resolvers/UserResolver.js.map +1 -1
- package/dist/resolvers/UserViewResolver.d.ts +2 -2
- package/dist/resolvers/UserViewResolver.d.ts.map +1 -1
- package/dist/resolvers/UserViewResolver.js +8 -8
- package/dist/resolvers/UserViewResolver.js.map +1 -1
- package/dist/services/TaskOrchestrator.d.ts +52 -0
- package/dist/services/TaskOrchestrator.d.ts.map +1 -0
- package/dist/services/TaskOrchestrator.js +486 -0
- package/dist/services/TaskOrchestrator.js.map +1 -0
- package/package.json +30 -38
- package/src/agents/skip-agent.ts +1433 -0
- package/src/agents/skip-sdk.ts +541 -0
- package/src/config.ts +3 -2
- package/src/generated/generated.ts +7948 -6811
- package/src/index.ts +7 -21
- package/src/resolvers/AskSkipResolver.ts +32 -10
- package/src/resolvers/ComponentRegistryResolver.ts +133 -4
- package/src/resolvers/CreateQueryResolver.ts +6 -6
- package/src/resolvers/EntityResolver.ts +4 -4
- package/src/resolvers/FileCategoryResolver.ts +2 -2
- package/src/resolvers/FileResolver.ts +12 -12
- package/src/resolvers/PotentialDuplicateRecordResolver.ts +2 -3
- package/src/resolvers/RunAIAgentResolver.ts +23 -10
- package/src/resolvers/RunTemplateResolver.ts +1 -2
- package/src/resolvers/TaskResolver.ts +142 -0
- package/src/resolvers/UserFavoriteResolver.ts +5 -5
- package/src/resolvers/UserResolver.ts +7 -7
- package/src/resolvers/UserViewResolver.ts +8 -8
- package/src/services/TaskOrchestration-Integration.md +188 -0
- package/src/services/TaskOrchestrator.ts +756 -0
package/src/index.ts
CHANGED
|
@@ -44,28 +44,10 @@ LoadAgentManagementActions();
|
|
|
44
44
|
import { resolve } from 'node:path';
|
|
45
45
|
import { DataSourceInfo, raiseEvent } from './types.js';
|
|
46
46
|
import { LoadAIEngine } from '@memberjunction/aiengine';
|
|
47
|
-
import {
|
|
48
|
-
|
|
49
|
-
import { LoadGroqLLM } from '@memberjunction/ai-groq';
|
|
50
|
-
import { LoadCerebrasLLM } from '@memberjunction/ai-cerebras';
|
|
51
|
-
import { LoadMistralLLM } from '@memberjunction/ai-mistral';
|
|
52
|
-
import { LoadLMStudioLLM } from '@memberjunction/ai-lmstudio';
|
|
53
|
-
import { LoadOpenRouterLLM } from '@memberjunction/ai-openrouter';
|
|
54
|
-
import { LoadOllamaLLM } from '@memberjunction/ai-ollama';
|
|
55
|
-
import { LoadLocalEmbedding } from '@memberjunction/ai-local-embeddings';
|
|
56
|
-
// Load AI LLMs and Base AI Engine
|
|
57
|
-
// These imports are necessary to ensure the LLMs are registered in the MemberJunction AI
|
|
58
|
-
// system. They are not tree-shaken because they are dynamically loaded at runtime.
|
|
47
|
+
import { LoadAIProviders } from '@memberjunction/ai-provider-bundle';
|
|
48
|
+
// Load AI Engine and all providers to prevent tree shaking
|
|
59
49
|
LoadAIEngine();
|
|
60
|
-
|
|
61
|
-
LoadAnthropicLLM();
|
|
62
|
-
LoadGroqLLM();
|
|
63
|
-
LoadCerebrasLLM();
|
|
64
|
-
LoadMistralLLM();
|
|
65
|
-
LoadLMStudioLLM();
|
|
66
|
-
LoadOpenRouterLLM();
|
|
67
|
-
LoadOllamaLLM();
|
|
68
|
-
LoadLocalEmbedding();
|
|
50
|
+
LoadAIProviders();
|
|
69
51
|
|
|
70
52
|
import { ExternalChangeDetectorEngine } from '@memberjunction/external-change-detection';
|
|
71
53
|
|
|
@@ -86,10 +68,14 @@ export * from './generic/RunViewResolver.js';
|
|
|
86
68
|
export * from './resolvers/RunTemplateResolver.js';
|
|
87
69
|
export * from './resolvers/RunAIPromptResolver.js';
|
|
88
70
|
export * from './resolvers/RunAIAgentResolver.js';
|
|
71
|
+
export * from './resolvers/TaskResolver.js';
|
|
89
72
|
export * from './generic/KeyValuePairInput.js';
|
|
90
73
|
export * from './generic/KeyInputOutputTypes.js';
|
|
91
74
|
export * from './generic/DeleteOptionsInput.js';
|
|
92
75
|
|
|
76
|
+
export * from './agents/skip-agent.js';
|
|
77
|
+
export * from './agents/skip-sdk.js';
|
|
78
|
+
|
|
93
79
|
export * from './resolvers/AskSkipResolver.js';
|
|
94
80
|
export * from './resolvers/ColorResolver.js';
|
|
95
81
|
export * from './resolvers/ComponentRegistryResolver.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Arg, Ctx, Field, Mutation, ObjectType, PubSub, PubSubEngine, Query, Resolver } from 'type-graphql';
|
|
1
|
+
import { Arg, Ctx, Field, InputType, Mutation, ObjectType, PubSub, PubSubEngine, Query, Resolver } from 'type-graphql';
|
|
2
2
|
import { LogError, LogStatus, Metadata, RunView, UserInfo, CompositeKey, EntityFieldInfo, EntityInfo, EntityRelationshipInfo, EntitySaveOptions, EntityDeleteOptions, IMetadataProvider } from '@memberjunction/core';
|
|
3
3
|
import { AppContext, UserPayload, MJ_SERVER_EVENT_CODE } from '../types.js';
|
|
4
4
|
import { BehaviorSubject } from 'rxjs';
|
|
@@ -66,6 +66,18 @@ import { AIEngine } from '@memberjunction/aiengine';
|
|
|
66
66
|
import { deleteAccessToken, GetDataAccessToken, registerAccessToken, tokenExists } from './GetDataResolver.js';
|
|
67
67
|
import e from 'express';
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Skip API Endpoints Configuration
|
|
71
|
+
* Defines all available endpoints for the Skip API
|
|
72
|
+
*/
|
|
73
|
+
const SKIP_API_ENDPOINTS = {
|
|
74
|
+
CHAT: '/chat',
|
|
75
|
+
LEARNING: '/learning',
|
|
76
|
+
FEEDBACK_COMPONENT: '/feedback/component',
|
|
77
|
+
REGISTRY: '/registry',
|
|
78
|
+
// Add more endpoints as needed
|
|
79
|
+
} as const;
|
|
80
|
+
|
|
69
81
|
/**
|
|
70
82
|
* Store for active conversation streams
|
|
71
83
|
* Maps conversationID to the last status message received
|
|
@@ -368,7 +380,9 @@ function initializeSkipLearningCycleScheduler() {
|
|
|
368
380
|
}
|
|
369
381
|
|
|
370
382
|
// Check if we have a valid endpoint when cycles are enabled
|
|
371
|
-
|
|
383
|
+
const hasLearningEndpoint = (skipConfigInfo.url && skipConfigInfo.url.trim().length > 0) ||
|
|
384
|
+
(skipConfigInfo.learningCycleURL && skipConfigInfo.learningCycleURL.trim().length > 0);
|
|
385
|
+
if (!hasLearningEndpoint) {
|
|
372
386
|
LogError('Skip AI Learning cycle scheduler not started: Learning cycles are enabled but no Learning Cycle API endpoint is configured');
|
|
373
387
|
return;
|
|
374
388
|
}
|
|
@@ -577,7 +591,9 @@ export class AskSkipResolver {
|
|
|
577
591
|
}
|
|
578
592
|
|
|
579
593
|
// Check if we have a valid endpoint when cycles are enabled
|
|
580
|
-
|
|
594
|
+
const hasLearningEndpoint = (skipConfigInfo.url && skipConfigInfo.url.trim().length > 0) ||
|
|
595
|
+
(skipConfigInfo.learningCycleURL && skipConfigInfo.learningCycleURL.trim().length > 0);
|
|
596
|
+
if (!hasLearningEndpoint) {
|
|
581
597
|
return {
|
|
582
598
|
success: false,
|
|
583
599
|
error: 'Learning cycle API endpoint is not configured',
|
|
@@ -729,9 +745,10 @@ export class AskSkipResolver {
|
|
|
729
745
|
userPayload: UserPayload
|
|
730
746
|
): Promise<SkipAPILearningCycleResponse> {
|
|
731
747
|
const skipConfigInfo = configInfo.askSkip;
|
|
732
|
-
|
|
748
|
+
const learningURL = skipConfigInfo.url ? `${skipConfigInfo.url}${SKIP_API_ENDPOINTS.LEARNING}` : skipConfigInfo.learningCycleURL;
|
|
749
|
+
LogStatus(` >>> HandleSimpleSkipLearningPostRequest Sending request to Skip API: ${learningURL}`);
|
|
733
750
|
|
|
734
|
-
const response = await sendPostRequest(
|
|
751
|
+
const response = await sendPostRequest(learningURL, input, true, this.buildSkipPostHeaders());
|
|
735
752
|
|
|
736
753
|
if (response && response.length > 0) {
|
|
737
754
|
// the last object in the response array is the final response from the Skip API
|
|
@@ -789,10 +806,11 @@ export class AskSkipResolver {
|
|
|
789
806
|
userPayload: UserPayload = null
|
|
790
807
|
): Promise<AskSkipResultType> {
|
|
791
808
|
const skipConfigInfo = configInfo.askSkip;
|
|
792
|
-
|
|
809
|
+
const chatURL = skipConfigInfo.url ? `${skipConfigInfo.url}${SKIP_API_ENDPOINTS.CHAT}` : skipConfigInfo.chatURL;
|
|
810
|
+
LogStatus(` >>> HandleSimpleSkipChatPostRequest Sending request to Skip API: ${chatURL}`);
|
|
793
811
|
|
|
794
812
|
try {
|
|
795
|
-
const response = await sendPostRequest(
|
|
813
|
+
const response = await sendPostRequest(chatURL, input, true, this.buildSkipPostHeaders());
|
|
796
814
|
|
|
797
815
|
if (response && response.length > 0) {
|
|
798
816
|
// the last object in the response array is the final response from the Skip API
|
|
@@ -2428,7 +2446,8 @@ cycle.`);
|
|
|
2428
2446
|
startTime: Date
|
|
2429
2447
|
): Promise<AskSkipResultType> {
|
|
2430
2448
|
const skipConfigInfo = configInfo.askSkip;
|
|
2431
|
-
|
|
2449
|
+
const chatURL = skipConfigInfo.url ? `${skipConfigInfo.url}${SKIP_API_ENDPOINTS.CHAT}` : skipConfigInfo.chatURL;
|
|
2450
|
+
LogStatus(` >>> HandleSkipRequest: Sending request to Skip API: ${chatURL}`);
|
|
2432
2451
|
|
|
2433
2452
|
if (conversationDetailCount > 10) {
|
|
2434
2453
|
// Set status of conversation to Available since we still want to allow the user to ask questions
|
|
@@ -2459,7 +2478,7 @@ cycle.`);
|
|
|
2459
2478
|
let response;
|
|
2460
2479
|
try {
|
|
2461
2480
|
response = await sendPostRequest(
|
|
2462
|
-
|
|
2481
|
+
chatURL,
|
|
2463
2482
|
input,
|
|
2464
2483
|
true,
|
|
2465
2484
|
this.buildSkipPostHeaders(),
|
|
@@ -3259,7 +3278,9 @@ cycle.`);
|
|
|
3259
3278
|
}
|
|
3260
3279
|
|
|
3261
3280
|
// Check if we have a valid endpoint when cycles are enabled
|
|
3262
|
-
|
|
3281
|
+
const hasLearningEndpoint = (skipConfigInfo.url && skipConfigInfo.url.trim().length > 0) ||
|
|
3282
|
+
(skipConfigInfo.learningCycleURL && skipConfigInfo.learningCycleURL.trim().length > 0);
|
|
3283
|
+
if (!hasLearningEndpoint) {
|
|
3263
3284
|
return {
|
|
3264
3285
|
Success: false,
|
|
3265
3286
|
Message: 'Learning cycle API endpoint is not configured'
|
|
@@ -3394,6 +3415,7 @@ cycle.`);
|
|
|
3394
3415
|
};
|
|
3395
3416
|
}
|
|
3396
3417
|
}
|
|
3418
|
+
|
|
3397
3419
|
}
|
|
3398
3420
|
|
|
3399
3421
|
export default AskSkipResolver;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { Arg, Ctx, Field, InputType, ObjectType, Query, Resolver } from 'type-graphql';
|
|
1
|
+
import { Arg, Ctx, Field, InputType, ObjectType, Query, Mutation, Resolver } from 'type-graphql';
|
|
2
2
|
import { UserInfo, Metadata, LogError, LogStatus } from '@memberjunction/core';
|
|
3
3
|
import { UserCache } from '@memberjunction/sqlserver-dataprovider';
|
|
4
4
|
import { ComponentEntity, ComponentRegistryEntity, ComponentMetadataEngine } from '@memberjunction/core-entities';
|
|
5
5
|
import { ComponentSpec } from '@memberjunction/interactive-component-types';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
7
|
ComponentRegistryClient,
|
|
8
8
|
ComponentResponse,
|
|
9
9
|
ComponentSearchResult,
|
|
10
10
|
DependencyTree,
|
|
11
11
|
RegistryError,
|
|
12
|
-
RegistryErrorCode
|
|
12
|
+
RegistryErrorCode,
|
|
13
|
+
ComponentFeedbackParams as SDKComponentFeedbackParams,
|
|
14
|
+
ComponentFeedbackResponse as SDKComponentFeedbackResponse
|
|
13
15
|
} from '@memberjunction/component-registry-client-sdk';
|
|
14
16
|
import { AppContext } from '../types.js';
|
|
15
17
|
import { configInfo } from '../config.js';
|
|
@@ -96,6 +98,61 @@ class ComponentDependencyTreeType {
|
|
|
96
98
|
dependencies?: ComponentDependencyTreeType[];
|
|
97
99
|
}
|
|
98
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Input type for submitting component feedback
|
|
103
|
+
* Registry-agnostic feedback collection for any component from any registry
|
|
104
|
+
*/
|
|
105
|
+
@InputType()
|
|
106
|
+
class ComponentFeedbackInput {
|
|
107
|
+
@Field()
|
|
108
|
+
componentName: string;
|
|
109
|
+
|
|
110
|
+
@Field()
|
|
111
|
+
componentNamespace: string;
|
|
112
|
+
|
|
113
|
+
@Field({ nullable: true })
|
|
114
|
+
componentVersion?: string;
|
|
115
|
+
|
|
116
|
+
@Field({ nullable: true })
|
|
117
|
+
registryName?: string;
|
|
118
|
+
|
|
119
|
+
@Field()
|
|
120
|
+
rating: number;
|
|
121
|
+
|
|
122
|
+
@Field({ nullable: true })
|
|
123
|
+
feedbackType?: string;
|
|
124
|
+
|
|
125
|
+
@Field({ nullable: true })
|
|
126
|
+
comments?: string;
|
|
127
|
+
|
|
128
|
+
@Field({ nullable: true })
|
|
129
|
+
conversationID?: string;
|
|
130
|
+
|
|
131
|
+
@Field({ nullable: true })
|
|
132
|
+
conversationDetailID?: string;
|
|
133
|
+
|
|
134
|
+
@Field({ nullable: true })
|
|
135
|
+
reportID?: string;
|
|
136
|
+
|
|
137
|
+
@Field({ nullable: true })
|
|
138
|
+
dashboardID?: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Response type for component feedback submission
|
|
143
|
+
*/
|
|
144
|
+
@ObjectType()
|
|
145
|
+
class ComponentFeedbackResponse {
|
|
146
|
+
@Field()
|
|
147
|
+
success: boolean;
|
|
148
|
+
|
|
149
|
+
@Field({ nullable: true })
|
|
150
|
+
feedbackID?: string;
|
|
151
|
+
|
|
152
|
+
@Field({ nullable: true })
|
|
153
|
+
error?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
99
156
|
/**
|
|
100
157
|
* Resolver for Component Registry operations
|
|
101
158
|
*
|
|
@@ -153,7 +210,8 @@ export class ComponentRegistryExtendedResolver {
|
|
|
153
210
|
namespace,
|
|
154
211
|
name,
|
|
155
212
|
version: version || 'latest',
|
|
156
|
-
hash: hash
|
|
213
|
+
hash: hash,
|
|
214
|
+
userEmail: user.Email
|
|
157
215
|
});
|
|
158
216
|
|
|
159
217
|
// If not modified (304), return response with notModified flag
|
|
@@ -532,4 +590,75 @@ export class ComponentRegistryExtendedResolver {
|
|
|
532
590
|
limit: result.limit
|
|
533
591
|
};
|
|
534
592
|
}
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Send feedback for a component from any registry
|
|
596
|
+
* This is a registry-agnostic mutation that allows feedback collection
|
|
597
|
+
* for components from any source registry (Skip, MJ Central, etc.)
|
|
598
|
+
*/
|
|
599
|
+
@Mutation(() => ComponentFeedbackResponse)
|
|
600
|
+
async SendComponentFeedback(
|
|
601
|
+
@Arg('feedback') feedback: ComponentFeedbackInput,
|
|
602
|
+
@Ctx() { userPayload }: AppContext
|
|
603
|
+
): Promise<ComponentFeedbackResponse> {
|
|
604
|
+
try {
|
|
605
|
+
// Get user from cache
|
|
606
|
+
const user = UserCache.Instance.Users.find((u) => u.Email.trim().toLowerCase() === userPayload.email?.trim().toLowerCase());
|
|
607
|
+
if (!user) {
|
|
608
|
+
return {
|
|
609
|
+
success: false,
|
|
610
|
+
error: `User ${userPayload.email} not found in UserCache`
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
// Registry name is required for feedback submission
|
|
615
|
+
if (!feedback.registryName) {
|
|
616
|
+
return {
|
|
617
|
+
success: false,
|
|
618
|
+
error: 'Registry name is required for feedback submission'
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
// Get registry configuration
|
|
623
|
+
const registry = await this.getRegistryByName(feedback.registryName, user);
|
|
624
|
+
if (!registry) {
|
|
625
|
+
return {
|
|
626
|
+
success: false,
|
|
627
|
+
error: `Registry not found: ${feedback.registryName}`
|
|
628
|
+
};
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
// Check user permissions
|
|
632
|
+
await this.checkUserAccess(user, registry.ID);
|
|
633
|
+
|
|
634
|
+
// Create client using the same pattern as GetRegistryComponent
|
|
635
|
+
// This respects REGISTRY_URI_OVERRIDE_* and REGISTRY_API_KEY_* environment variables
|
|
636
|
+
const registryClient = this.createClientForRegistry(registry);
|
|
637
|
+
|
|
638
|
+
const sdkParams: SDKComponentFeedbackParams = {
|
|
639
|
+
componentName: feedback.componentName,
|
|
640
|
+
componentNamespace: feedback.componentNamespace,
|
|
641
|
+
componentVersion: feedback.componentVersion,
|
|
642
|
+
registryName: feedback.registryName,
|
|
643
|
+
rating: feedback.rating,
|
|
644
|
+
feedbackType: feedback.feedbackType,
|
|
645
|
+
comments: feedback.comments,
|
|
646
|
+
conversationID: feedback.conversationID,
|
|
647
|
+
conversationDetailID: feedback.conversationDetailID,
|
|
648
|
+
reportID: feedback.reportID,
|
|
649
|
+
dashboardID: feedback.dashboardID,
|
|
650
|
+
userEmail: user.Email // Pass the authenticated user's email to the registry
|
|
651
|
+
};
|
|
652
|
+
|
|
653
|
+
const result = await registryClient.submitFeedback(sdkParams);
|
|
654
|
+
|
|
655
|
+
return result;
|
|
656
|
+
} catch (error) {
|
|
657
|
+
LogError(error);
|
|
658
|
+
return {
|
|
659
|
+
success: false,
|
|
660
|
+
error: error instanceof Error ? error.message : 'Unknown error'
|
|
661
|
+
};
|
|
662
|
+
}
|
|
663
|
+
}
|
|
535
664
|
}
|
|
@@ -3,7 +3,7 @@ import { AppContext } from '../types.js';
|
|
|
3
3
|
import { LogError, Metadata, RunView, UserInfo, CompositeKey, DatabaseProviderBase } from '@memberjunction/core';
|
|
4
4
|
import { RequireSystemUser } from '../directives/RequireSystemUser.js';
|
|
5
5
|
import { QueryCategoryEntity, QueryPermissionEntity } from '@memberjunction/core-entities';
|
|
6
|
-
import {
|
|
6
|
+
import { MJQueryResolver } from '../generated/generated.js';
|
|
7
7
|
import { GetReadOnlyProvider, GetReadWriteProvider } from '../util.js';
|
|
8
8
|
import { DeleteOptionsInput } from '../generic/DeleteOptionsInput.js';
|
|
9
9
|
import { QueryEntityExtended } from '@memberjunction/core-entities-server';
|
|
@@ -294,7 +294,7 @@ export class DeleteQueryResultType {
|
|
|
294
294
|
}
|
|
295
295
|
|
|
296
296
|
@Resolver()
|
|
297
|
-
export class
|
|
297
|
+
export class MJQueryResolverExtended extends MJQueryResolver {
|
|
298
298
|
/**
|
|
299
299
|
* Creates a new query with the provided attributes. This mutation is restricted to system users only.
|
|
300
300
|
* @param input - CreateQuerySystemUserInput containing all the query attributes
|
|
@@ -373,7 +373,7 @@ export class QueryResolverExtended extends QueryResolver {
|
|
|
373
373
|
LogError(err);
|
|
374
374
|
return {
|
|
375
375
|
Success: false,
|
|
376
|
-
ErrorMessage: `
|
|
376
|
+
ErrorMessage: `MJQueryResolverExtended::CreateQuerySystemUser --- Error creating query: ${err instanceof Error ? err.message : String(err)}`
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
379
|
}
|
|
@@ -553,7 +553,7 @@ export class QueryResolverExtended extends QueryResolver {
|
|
|
553
553
|
LogError(err);
|
|
554
554
|
return {
|
|
555
555
|
Success: false,
|
|
556
|
-
ErrorMessage: `
|
|
556
|
+
ErrorMessage: `MJQueryResolverExtended::UpdateQuerySystemUser --- Error updating query: ${err instanceof Error ? err.message : String(err)}`
|
|
557
557
|
};
|
|
558
558
|
}
|
|
559
559
|
}
|
|
@@ -578,7 +578,7 @@ export class QueryResolverExtended extends QueryResolver {
|
|
|
578
578
|
if (!ID || ID.trim() === '') {
|
|
579
579
|
return {
|
|
580
580
|
Success: false,
|
|
581
|
-
ErrorMessage: '
|
|
581
|
+
ErrorMessage: 'MJQueryResolverExtended::DeleteQuerySystemResolver --- Invalid query ID: ID cannot be null or empty'
|
|
582
582
|
};
|
|
583
583
|
}
|
|
584
584
|
|
|
@@ -610,7 +610,7 @@ export class QueryResolverExtended extends QueryResolver {
|
|
|
610
610
|
LogError(err);
|
|
611
611
|
return {
|
|
612
612
|
Success: false,
|
|
613
|
-
ErrorMessage: `
|
|
613
|
+
ErrorMessage: `MJQueryResolverExtended::DeleteQuerySystemResolver --- Error deleting query: ${err instanceof Error ? err.message : String(err)}`
|
|
614
614
|
};
|
|
615
615
|
}
|
|
616
616
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { EntityPermissionType, IRunViewProvider } from '@memberjunction/core';
|
|
2
2
|
import { AppContext } from '../types.js';
|
|
3
3
|
import { Arg, Ctx, Query, Resolver, InputType, Field } from 'type-graphql';
|
|
4
|
-
import {
|
|
4
|
+
import { MJEntity_, MJEntityResolverBase } from '../generated/generated.js';
|
|
5
5
|
import sql from 'mssql';
|
|
6
6
|
import { GetReadOnlyProvider } from '../util.js';
|
|
7
7
|
|
|
8
|
-
@Resolver(
|
|
9
|
-
export class EntityResolver extends
|
|
10
|
-
@Query(() => [
|
|
8
|
+
@Resolver(MJEntity_)
|
|
9
|
+
export class EntityResolver extends MJEntityResolverBase {
|
|
10
|
+
@Query(() => [MJEntity_])
|
|
11
11
|
async EntitiesBySchemas(
|
|
12
12
|
@Ctx() { providers, userPayload }: AppContext,
|
|
13
13
|
@Arg('IncludeSchemas', () => [String], { nullable: true }) IncludeSchemas?: string[],
|
|
@@ -2,13 +2,13 @@ import { CompositeKey, EntityDeleteOptions, EntityPermissionType, EntitySaveOpti
|
|
|
2
2
|
import { FileCategoryEntity, FileEntity } from '@memberjunction/core-entities';
|
|
3
3
|
import { AppContext, Arg, Ctx, DeleteOptionsInput, Int, Mutation } from '@memberjunction/server';
|
|
4
4
|
import { mj_core_schema } from '../config.js';
|
|
5
|
-
import {
|
|
5
|
+
import { MJFileCategoryResolver as FileCategoryResolverBase, MJFileCategory_ } from '../generated/generated.js';
|
|
6
6
|
import sql from 'mssql';
|
|
7
7
|
import { SQLServerDataProvider } from '@memberjunction/sqlserver-dataprovider';
|
|
8
8
|
import { GetReadWriteProvider } from '../util.js';
|
|
9
9
|
|
|
10
10
|
export class FileResolver extends FileCategoryResolverBase {
|
|
11
|
-
@Mutation(() =>
|
|
11
|
+
@Mutation(() => MJFileCategory_)
|
|
12
12
|
async DeleteFileCategory(
|
|
13
13
|
@Arg('ID', () => String) ID: string,
|
|
14
14
|
@Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
Root,
|
|
18
18
|
} from '@memberjunction/server';
|
|
19
19
|
import { createDownloadUrl, createUploadUrl, deleteObject, moveObject } from '@memberjunction/storage';
|
|
20
|
-
import {
|
|
20
|
+
import { CreateMJFileInput, MJFileResolver as FileResolverBase, MJFile_, UpdateMJFileInput } from '../generated/generated.js';
|
|
21
21
|
import { FieldMapper } from '@memberjunction/graphql-dataprovider';
|
|
22
22
|
import { GetReadOnlyProvider } from '../util.js';
|
|
23
23
|
|
|
@@ -29,8 +29,8 @@ export class CreateUploadURLInput {
|
|
|
29
29
|
|
|
30
30
|
@ObjectType()
|
|
31
31
|
export class CreateFilePayload {
|
|
32
|
-
@Field(() =>
|
|
33
|
-
File:
|
|
32
|
+
@Field(() => MJFile_)
|
|
33
|
+
File: MJFile_;
|
|
34
34
|
@Field(() => String)
|
|
35
35
|
UploadUrl: string;
|
|
36
36
|
@Field(() => Boolean)
|
|
@@ -38,16 +38,16 @@ export class CreateFilePayload {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
@ObjectType()
|
|
41
|
-
export class FileExt extends
|
|
41
|
+
export class FileExt extends MJFile_ {
|
|
42
42
|
@Field(() => String)
|
|
43
43
|
DownloadUrl: string;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
@Resolver(
|
|
46
|
+
@Resolver(MJFile_)
|
|
47
47
|
export class FileResolver extends FileResolverBase {
|
|
48
48
|
@Mutation(() => CreateFilePayload)
|
|
49
49
|
async CreateFile(
|
|
50
|
-
@Arg('input', () =>
|
|
50
|
+
@Arg('input', () => CreateMJFileInput) input: CreateMJFileInput,
|
|
51
51
|
@Ctx() context: AppContext,
|
|
52
52
|
@PubSub() pubSub: PubSubEngine
|
|
53
53
|
) {
|
|
@@ -86,7 +86,7 @@ export class FileResolver extends FileResolverBase {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
@FieldResolver(() => String)
|
|
89
|
-
async DownloadUrl(@Root() file:
|
|
89
|
+
async DownloadUrl(@Root() file: MJFile_, @Ctx() { userPayload }: AppContext) {
|
|
90
90
|
const md = new Metadata();
|
|
91
91
|
const user = this.GetUserFromPayload(userPayload);
|
|
92
92
|
const fileEntity = await md.GetEntityObject<FileEntity>('Files', user);
|
|
@@ -100,9 +100,9 @@ export class FileResolver extends FileResolverBase {
|
|
|
100
100
|
return url;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
@Mutation(() =>
|
|
103
|
+
@Mutation(() => MJFile_)
|
|
104
104
|
async UpdateFile(
|
|
105
|
-
@Arg('input', () =>
|
|
105
|
+
@Arg('input', () => UpdateMJFileInput) input: UpdateMJFileInput,
|
|
106
106
|
@Ctx() context: AppContext,
|
|
107
107
|
@PubSub() pubSub: PubSubEngine
|
|
108
108
|
) {
|
|
@@ -124,11 +124,11 @@ export class FileResolver extends FileResolverBase {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
const updatedFile = await super.
|
|
127
|
+
const updatedFile = await super.UpdateMJFile(input, context, pubSub);
|
|
128
128
|
return updatedFile;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
@Mutation(() =>
|
|
131
|
+
@Mutation(() => MJFile_)
|
|
132
132
|
async DeleteFile(
|
|
133
133
|
@Arg('ID', () => String) ID: string,
|
|
134
134
|
@Arg('options___', () => DeleteOptionsInput) options: DeleteOptionsInput,
|
|
@@ -152,6 +152,6 @@ export class FileResolver extends FileResolverBase {
|
|
|
152
152
|
await deleteObject(providerEntity, fileEntity.ProviderKey ?? fileEntity.Name);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
return super.
|
|
155
|
+
return super.DeleteMJFile(ID, options, context, pubSub);
|
|
156
156
|
}
|
|
157
157
|
}
|
|
@@ -10,12 +10,11 @@ import {
|
|
|
10
10
|
import { AppContext } from '../types.js';
|
|
11
11
|
import { UserCache } from '@memberjunction/sqlserver-dataprovider';
|
|
12
12
|
|
|
13
|
-
//load the default vectorDB
|
|
14
|
-
import { LoadMistralEmbedding } from '@memberjunction/ai-mistral';
|
|
13
|
+
//load the default vectorDB
|
|
15
14
|
import { LoadPineconeVectorDB } from '@memberjunction/ai-vectors-pinecone';
|
|
16
15
|
import { CompositeKeyInputType, CompositeKeyOutputType, KeyValuePairOutputType } from '../generic/KeyInputOutputTypes.js';
|
|
17
16
|
import { GetReadOnlyProvider } from '../util.js';
|
|
18
|
-
|
|
17
|
+
// AI provider loading now handled by @memberjunction/aiengine
|
|
19
18
|
LoadPineconeVectorDB();
|
|
20
19
|
|
|
21
20
|
@InputType()
|
|
@@ -9,6 +9,7 @@ import { ResolverBase } from '../generic/ResolverBase.js';
|
|
|
9
9
|
import { PUSH_STATUS_UPDATES_TOPIC } from '../generic/PushStatusResolver.js';
|
|
10
10
|
import { RequireSystemUser } from '../directives/RequireSystemUser.js';
|
|
11
11
|
import { GetReadWriteProvider } from '../util.js';
|
|
12
|
+
import { SafeJSONParse } from '@memberjunction/global';
|
|
12
13
|
|
|
13
14
|
@ObjectType()
|
|
14
15
|
export class AIAgentRunResult {
|
|
@@ -22,7 +23,7 @@ export class AIAgentRunResult {
|
|
|
22
23
|
executionTimeMs?: number;
|
|
23
24
|
|
|
24
25
|
@Field()
|
|
25
|
-
|
|
26
|
+
result: string; // JSON serialized ExecuteAgentResult with scalars only
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
@ObjectType()
|
|
@@ -312,10 +313,12 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
312
313
|
sessionId: string,
|
|
313
314
|
pubSub: PubSubEngine,
|
|
314
315
|
data?: string,
|
|
316
|
+
payload?: string,
|
|
315
317
|
templateData?: string,
|
|
316
318
|
lastRunId?: string,
|
|
317
319
|
autoPopulateLastRunPayload?: boolean,
|
|
318
|
-
configurationId?: string
|
|
320
|
+
configurationId?: string,
|
|
321
|
+
conversationDetailId?: string
|
|
319
322
|
): Promise<AIAgentRunResult> {
|
|
320
323
|
const startTime = Date.now();
|
|
321
324
|
|
|
@@ -355,13 +358,15 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
355
358
|
const result = await agentRunner.RunAgent({
|
|
356
359
|
agent: agentEntity,
|
|
357
360
|
conversationMessages: parsedMessages,
|
|
361
|
+
payload: payload ? SafeJSONParse(payload) : undefined,
|
|
358
362
|
contextUser: currentUser,
|
|
359
363
|
onProgress: this.createProgressCallback(pubSub, sessionId, userPayload, agentRunRef),
|
|
360
364
|
onStreaming: this.createStreamingCallback(pubSub, sessionId, userPayload, agentRunRef),
|
|
361
365
|
lastRunId: lastRunId,
|
|
362
366
|
autoPopulateLastRunPayload: autoPopulateLastRunPayload,
|
|
363
367
|
configurationId: configurationId,
|
|
364
|
-
data: parsedData
|
|
368
|
+
data: parsedData,
|
|
369
|
+
conversationDetailId: conversationDetailId,
|
|
365
370
|
});
|
|
366
371
|
|
|
367
372
|
// Update agent run ref once available
|
|
@@ -376,7 +381,7 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
376
381
|
|
|
377
382
|
// Create sanitized payload for JSON serialization
|
|
378
383
|
const sanitizedResult = this.sanitizeAgentResult(result);
|
|
379
|
-
const
|
|
384
|
+
const returnResult = JSON.stringify(sanitizedResult);
|
|
380
385
|
|
|
381
386
|
// Log completion
|
|
382
387
|
if (result.success) {
|
|
@@ -389,7 +394,7 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
389
394
|
success: result.success,
|
|
390
395
|
errorMessage: result.agentRun?.ErrorMessage || undefined,
|
|
391
396
|
executionTimeMs: executionTime,
|
|
392
|
-
|
|
397
|
+
result: returnResult
|
|
393
398
|
};
|
|
394
399
|
|
|
395
400
|
} catch (error) {
|
|
@@ -407,7 +412,7 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
407
412
|
success: false,
|
|
408
413
|
errorMessage: errorResult.errorMessage,
|
|
409
414
|
executionTimeMs: executionTime,
|
|
410
|
-
|
|
415
|
+
result: JSON.stringify(errorResult)
|
|
411
416
|
};
|
|
412
417
|
}
|
|
413
418
|
}
|
|
@@ -462,10 +467,12 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
462
467
|
@Arg('sessionId') sessionId: string,
|
|
463
468
|
@PubSub() pubSub: PubSubEngine,
|
|
464
469
|
@Arg('data', { nullable: true }) data?: string,
|
|
470
|
+
@Arg('payload', { nullable: true }) payload?: string,
|
|
465
471
|
@Arg('templateData', { nullable: true }) templateData?: string,
|
|
466
472
|
@Arg('lastRunId', { nullable: true }) lastRunId?: string,
|
|
467
473
|
@Arg('autoPopulateLastRunPayload', { nullable: true }) autoPopulateLastRunPayload?: boolean,
|
|
468
|
-
@Arg('configurationId', { nullable: true }) configurationId?: string
|
|
474
|
+
@Arg('configurationId', { nullable: true }) configurationId?: string,
|
|
475
|
+
@Arg('conversationDetailId', { nullable: true }) conversationDetailId?: string
|
|
469
476
|
): Promise<AIAgentRunResult> {
|
|
470
477
|
const p = GetReadWriteProvider(providers);
|
|
471
478
|
return this.executeAIAgent(
|
|
@@ -476,10 +483,12 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
476
483
|
sessionId,
|
|
477
484
|
pubSub,
|
|
478
485
|
data,
|
|
486
|
+
payload,
|
|
479
487
|
templateData,
|
|
480
488
|
lastRunId,
|
|
481
489
|
autoPopulateLastRunPayload,
|
|
482
|
-
configurationId
|
|
490
|
+
configurationId,
|
|
491
|
+
conversationDetailId
|
|
483
492
|
);
|
|
484
493
|
}
|
|
485
494
|
|
|
@@ -496,10 +505,12 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
496
505
|
@Arg('sessionId') sessionId: string,
|
|
497
506
|
@PubSub() pubSub: PubSubEngine,
|
|
498
507
|
@Arg('data', { nullable: true }) data?: string,
|
|
508
|
+
@Arg('payload', { nullable: true }) payload?: string,
|
|
499
509
|
@Arg('templateData', { nullable: true }) templateData?: string,
|
|
500
510
|
@Arg('lastRunId', { nullable: true }) lastRunId?: string,
|
|
501
511
|
@Arg('autoPopulateLastRunPayload', { nullable: true }) autoPopulateLastRunPayload?: boolean,
|
|
502
|
-
@Arg('configurationId', { nullable: true }) configurationId?: string
|
|
512
|
+
@Arg('configurationId', { nullable: true }) configurationId?: string,
|
|
513
|
+
@Arg('conversationDetailId', { nullable: true }) conversationDetailId?: string
|
|
503
514
|
): Promise<AIAgentRunResult> {
|
|
504
515
|
const p = GetReadWriteProvider(providers);
|
|
505
516
|
return this.executeAIAgent(
|
|
@@ -510,10 +521,12 @@ export class RunAIAgentResolver extends ResolverBase {
|
|
|
510
521
|
sessionId,
|
|
511
522
|
pubSub,
|
|
512
523
|
data,
|
|
524
|
+
payload,
|
|
513
525
|
templateData,
|
|
514
526
|
lastRunId,
|
|
515
527
|
autoPopulateLastRunPayload,
|
|
516
|
-
configurationId
|
|
528
|
+
configurationId,
|
|
529
|
+
conversationDetailId
|
|
517
530
|
);
|
|
518
531
|
}
|
|
519
532
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Resolver, Mutation, Arg, Ctx, ObjectType, Field } from 'type-graphql';
|
|
2
2
|
import { AppContext, UserPayload } from '../types.js';
|
|
3
3
|
import { LogError, LogStatus, Metadata, RunView } from '@memberjunction/core';
|
|
4
|
-
import { TemplateContentEntity } from '@memberjunction/core-entities';
|
|
4
|
+
import { TemplateContentEntity, TemplateEntityExtended } from '@memberjunction/core-entities';
|
|
5
5
|
import { TemplateEngineServer } from '@memberjunction/templates';
|
|
6
|
-
import { TemplateEntityExtended } from '@memberjunction/templates-base-types';
|
|
7
6
|
import { ResolverBase } from '../generic/ResolverBase.js';
|
|
8
7
|
import { GetReadWriteProvider } from '../util.js';
|
|
9
8
|
|