@codeguide/core 0.0.33 → 0.0.36
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/__tests__/services/usage/usage-service.test.ts +53 -29
- package/codeguide.ts +9 -0
- package/dist/codeguide.d.ts +4 -1
- package/dist/codeguide.js +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/services/chat/chat-service.d.ts +44 -0
- package/dist/services/chat/chat-service.js +85 -0
- package/dist/services/chat/chat-types.d.ts +88 -0
- package/dist/services/chat/chat-types.js +5 -0
- package/dist/services/chat/index.d.ts +2 -0
- package/dist/services/chat/index.js +20 -0
- package/dist/services/data-management/data-management-service.d.ts +53 -0
- package/dist/services/data-management/data-management-service.js +66 -0
- package/dist/services/data-management/data-management-types.d.ts +149 -0
- package/dist/services/data-management/data-management-types.js +7 -0
- package/dist/services/data-management/index.d.ts +2 -0
- package/dist/services/data-management/index.js +20 -0
- package/dist/services/generation/generation-service.d.ts +7 -1
- package/dist/services/generation/generation-service.js +18 -0
- package/dist/services/generation/generation-types.d.ts +123 -0
- package/dist/services/index.d.ts +8 -0
- package/dist/services/index.js +13 -1
- package/dist/services/projects/project-service.d.ts +3 -1
- package/dist/services/projects/project-service.js +13 -1
- package/dist/services/projects/project-types.d.ts +85 -8
- package/dist/services/prompt-generations/index.d.ts +2 -0
- package/dist/services/prompt-generations/index.js +20 -0
- package/dist/services/prompt-generations/prompt-generations-service.d.ts +47 -0
- package/dist/services/prompt-generations/prompt-generations-service.js +58 -0
- package/dist/services/prompt-generations/prompt-generations-types.d.ts +94 -0
- package/dist/services/prompt-generations/prompt-generations-types.js +2 -0
- package/dist/services/streaming/index.d.ts +2 -0
- package/dist/services/streaming/index.js +20 -0
- package/dist/services/streaming/streaming-service.d.ts +30 -0
- package/dist/services/streaming/streaming-service.js +107 -0
- package/dist/services/streaming/streaming-types.d.ts +14 -0
- package/dist/services/streaming/streaming-types.js +2 -0
- package/dist/services/tasks/task-service.d.ts +3 -1
- package/dist/services/tasks/task-service.js +8 -0
- package/dist/services/tasks/task-types.d.ts +15 -0
- package/dist/services/usage/usage-service.d.ts +35 -1
- package/dist/services/usage/usage-service.js +68 -0
- package/dist/services/usage/usage-types.d.ts +109 -33
- package/dist/services/users/user-service.d.ts +9 -1
- package/dist/services/users/user-service.js +10 -0
- package/dist/services/users/user-types.d.ts +14 -0
- package/index.ts +10 -0
- package/package.json +1 -1
- package/services/chat/chat-service.ts +110 -0
- package/services/chat/chat-types.ts +145 -0
- package/services/chat/index.ts +2 -0
- package/services/data-management/data-management-service.ts +74 -0
- package/services/data-management/data-management-types.ts +163 -0
- package/services/data-management/index.ts +2 -0
- package/services/generation/generation-service.ts +40 -0
- package/services/generation/generation-types.ts +140 -0
- package/services/index.ts +8 -0
- package/services/projects/README.md +54 -0
- package/services/projects/project-service.ts +20 -1
- package/services/projects/project-types.ts +88 -8
- package/services/prompt-generations/index.ts +2 -0
- package/services/prompt-generations/prompt-generations-service.ts +75 -0
- package/services/prompt-generations/prompt-generations-types.ts +101 -0
- package/services/streaming/index.ts +2 -0
- package/services/streaming/streaming-service.ts +123 -0
- package/services/streaming/streaming-types.ts +15 -0
- package/services/tasks/task-service.ts +30 -2
- package/services/tasks/task-types.ts +19 -1
- package/services/usage/usage-service.ts +81 -0
- package/services/usage/usage-types.ts +117 -36
- package/services/users/user-service.ts +15 -1
- package/services/users/user-types.ts +16 -0
|
@@ -326,7 +326,7 @@ describe('UsageService', () => {
|
|
|
326
326
|
expect(result.data.subscription).not.toBeNull()
|
|
327
327
|
expect(result.data.subscription?.plan_name).toBe('Monthly Plan')
|
|
328
328
|
expect(result.data.codespace_task_limit).toBeNull()
|
|
329
|
-
expect(result.data.plan_limits
|
|
329
|
+
expect(result.data.plan_limits?.limits.codespace_tasks.is_unlimited).toBe(true)
|
|
330
330
|
})
|
|
331
331
|
})
|
|
332
332
|
|
|
@@ -706,25 +706,37 @@ describe('UsageService', () => {
|
|
|
706
706
|
const response: UsageSummaryResponse = {
|
|
707
707
|
status: 'success',
|
|
708
708
|
data: {
|
|
709
|
-
|
|
709
|
+
period: {
|
|
710
|
+
start: '2024-01-25',
|
|
711
|
+
end: '2024-01-31',
|
|
712
|
+
},
|
|
713
|
+
usage: {
|
|
710
714
|
credits_consumed: 13870,
|
|
711
715
|
cost_usd: 41.61,
|
|
712
716
|
requests_count: 142,
|
|
713
717
|
},
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
},
|
|
719
|
-
billing_cycle: {
|
|
720
|
-
total_allotted: 50000,
|
|
721
|
-
total_consumed: 28450,
|
|
722
|
-
remaining_credits: 21550,
|
|
718
|
+
breakdown: {
|
|
719
|
+
docs: 5230,
|
|
720
|
+
chat: 4120,
|
|
721
|
+
codespace_task: 4520,
|
|
723
722
|
},
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
723
|
+
service_breakdown: [
|
|
724
|
+
{
|
|
725
|
+
service_type: 'docs',
|
|
726
|
+
credits_consumed: 5230,
|
|
727
|
+
requests_count: 58,
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
service_type: 'chat',
|
|
731
|
+
credits_consumed: 4120,
|
|
732
|
+
requests_count: 47,
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
service_type: 'codespace_task',
|
|
736
|
+
credits_consumed: 4520,
|
|
737
|
+
requests_count: 37,
|
|
738
|
+
},
|
|
739
|
+
],
|
|
728
740
|
},
|
|
729
741
|
}
|
|
730
742
|
|
|
@@ -744,25 +756,37 @@ describe('UsageService', () => {
|
|
|
744
756
|
const response: UsageSummaryResponse = {
|
|
745
757
|
status: 'success',
|
|
746
758
|
data: {
|
|
747
|
-
|
|
759
|
+
period: {
|
|
760
|
+
start: '2024-01-01',
|
|
761
|
+
end: '2024-01-31',
|
|
762
|
+
},
|
|
763
|
+
usage: {
|
|
748
764
|
credits_consumed: 25000,
|
|
749
765
|
cost_usd: 75.0,
|
|
750
766
|
requests_count: 300,
|
|
751
767
|
},
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
},
|
|
757
|
-
billing_cycle: {
|
|
758
|
-
total_allotted: 50000,
|
|
759
|
-
total_consumed: 47000,
|
|
760
|
-
remaining_credits: 3000,
|
|
768
|
+
breakdown: {
|
|
769
|
+
docs: 10000,
|
|
770
|
+
chat: 8000,
|
|
771
|
+
codespace_task: 7000,
|
|
761
772
|
},
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
773
|
+
service_breakdown: [
|
|
774
|
+
{
|
|
775
|
+
service_type: 'docs',
|
|
776
|
+
credits_consumed: 10000,
|
|
777
|
+
requests_count: 120,
|
|
778
|
+
},
|
|
779
|
+
{
|
|
780
|
+
service_type: 'chat',
|
|
781
|
+
credits_consumed: 8000,
|
|
782
|
+
requests_count: 95,
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
service_type: 'codespace_task',
|
|
786
|
+
credits_consumed: 7000,
|
|
787
|
+
requests_count: 85,
|
|
788
|
+
},
|
|
789
|
+
],
|
|
766
790
|
},
|
|
767
791
|
}
|
|
768
792
|
|
package/codeguide.ts
CHANGED
|
@@ -20,6 +20,9 @@ import {
|
|
|
20
20
|
SecurityKeysService,
|
|
21
21
|
UserService,
|
|
22
22
|
StarterKitsService,
|
|
23
|
+
ChatService,
|
|
24
|
+
DataManagementService,
|
|
25
|
+
PromptGenerationsService,
|
|
23
26
|
} from './services'
|
|
24
27
|
import { APIServiceConfig, CodeGuideOptions } from './types'
|
|
25
28
|
|
|
@@ -37,6 +40,9 @@ export class CodeGuide {
|
|
|
37
40
|
public securityKeys: SecurityKeysService
|
|
38
41
|
public users: UserService
|
|
39
42
|
public starterKits: StarterKitsService
|
|
43
|
+
public chat: ChatService
|
|
44
|
+
public dataManagement: DataManagementService
|
|
45
|
+
public promptGenerations: PromptGenerationsService
|
|
40
46
|
private options: CodeGuideOptions
|
|
41
47
|
|
|
42
48
|
constructor(config: APIServiceConfig, options: CodeGuideOptions = {}) {
|
|
@@ -56,6 +62,9 @@ export class CodeGuide {
|
|
|
56
62
|
this.securityKeys = new SecurityKeysService(config)
|
|
57
63
|
this.users = new UserService(config)
|
|
58
64
|
this.starterKits = new StarterKitsService(config)
|
|
65
|
+
this.chat = new ChatService(config)
|
|
66
|
+
this.dataManagement = new DataManagementService(config)
|
|
67
|
+
this.promptGenerations = new PromptGenerationsService(config)
|
|
59
68
|
}
|
|
60
69
|
|
|
61
70
|
// Convenience method for backward compatibility
|
package/dist/codeguide.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GenerationService, ProjectService, UsageService, RepositoryAnalysisService, TaskService, ApiKeyEnhancedService, SubscriptionService, CancellationFunnelService, CodespaceService, ExternalTokenService, SecurityKeysService, UserService, StarterKitsService } from './services';
|
|
1
|
+
import { GenerationService, ProjectService, UsageService, RepositoryAnalysisService, TaskService, ApiKeyEnhancedService, SubscriptionService, CancellationFunnelService, CodespaceService, ExternalTokenService, SecurityKeysService, UserService, StarterKitsService, ChatService, DataManagementService, PromptGenerationsService } from './services';
|
|
2
2
|
import { APIServiceConfig, CodeGuideOptions } from './types';
|
|
3
3
|
export declare class CodeGuide {
|
|
4
4
|
generation: GenerationService;
|
|
@@ -14,6 +14,9 @@ export declare class CodeGuide {
|
|
|
14
14
|
securityKeys: SecurityKeysService;
|
|
15
15
|
users: UserService;
|
|
16
16
|
starterKits: StarterKitsService;
|
|
17
|
+
chat: ChatService;
|
|
18
|
+
dataManagement: DataManagementService;
|
|
19
|
+
promptGenerations: PromptGenerationsService;
|
|
17
20
|
private options;
|
|
18
21
|
constructor(config: APIServiceConfig, options?: CodeGuideOptions);
|
|
19
22
|
getGuidance(prompt: string): Promise<any>;
|
package/dist/codeguide.js
CHANGED
|
@@ -29,6 +29,9 @@ class CodeGuide {
|
|
|
29
29
|
this.securityKeys = new services_1.SecurityKeysService(config);
|
|
30
30
|
this.users = new services_1.UserService(config);
|
|
31
31
|
this.starterKits = new services_1.StarterKitsService(config);
|
|
32
|
+
this.chat = new services_1.ChatService(config);
|
|
33
|
+
this.dataManagement = new services_1.DataManagementService(config);
|
|
34
|
+
this.promptGenerations = new services_1.PromptGenerationsService(config);
|
|
32
35
|
}
|
|
33
36
|
// Convenience method for backward compatibility
|
|
34
37
|
async getGuidance(prompt) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { CodeGuide } from './codeguide';
|
|
2
2
|
export * from './services';
|
|
3
3
|
export * from './types';
|
|
4
|
-
export type { ConnectRepositoryRequest, ConnectRepositoryResponse, ProjectRepository, GetProjectsRequest, PaginatedProjectsRequest, PaginatedProjectsResponse, } from './services/projects/project-types';
|
|
4
|
+
export type { ConnectRepositoryRequest, ConnectRepositoryResponse, ProjectRepository, GetProjectsRequest, PaginatedProjectsRequest, PaginatedProjectsResponse, AITool, GetAiToolsRequest, GetAiToolsResponse, } from './services/projects/project-types';
|
|
5
5
|
export type { CreateCodespaceTaskRequestV2 as CreateCodespaceTaskRequest, CreateCodespaceTaskResponseV2 as CreateCodespaceTaskResponse, CreateBackgroundCodespaceTaskRequest, CreateBackgroundCodespaceTaskResponse, ModelApiKey, Attachment, GetCodespaceTaskResponse, CodespaceTaskData, TechnicalDocument, GetProjectTasksByCodespaceResponse, } from './services/codespace/codespace-types';
|
|
6
6
|
export type { StoreExternalTokenRequest, StoreExternalTokenResponse, ListTokensQuery, ListTokensResponse, ValidateTokenRequest, ValidateTokenResponse, FindBestMatchRequest, FindBestMatchResponse, Platform, TokenType, } from './services/external-tokens/external-tokens-types';
|
|
7
7
|
export type { StarterKit, StarterKitMetadata, GetStarterKitsRequest, GetStarterKitsResponse, } from './services/starter-kits/starter-kits-types';
|
|
8
|
+
export type { DataStatsResponse, DeleteAllDataRequest, DeleteAllDataResponse, } from './services/data-management/data-management-types';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseService } from '../base/base-service';
|
|
2
|
+
import { GetDocumentTypesRequest, GetDocumentTypesResponse, GetChatsByDocumentTypeRequest, GetChatsByDocumentTypeResponse, GetChatHistoryRequest, GetChatHistoryResponse, ListDocumentChatsRequest, ListDocumentChatsResponse, GetChatByDocumentIdRequest, GetChatByDocumentIdResponse } from './chat-types';
|
|
3
|
+
export declare class ChatService extends BaseService {
|
|
4
|
+
/**
|
|
5
|
+
* 1. GET /chat/document/types/{project_id}
|
|
6
|
+
* Get document types for UI grouping
|
|
7
|
+
*
|
|
8
|
+
* @param request - Project ID to get document types for
|
|
9
|
+
* @returns Document types available for the project
|
|
10
|
+
*/
|
|
11
|
+
getDocumentTypes(request: GetDocumentTypesRequest): Promise<GetDocumentTypesResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* 2. GET /chat/document/by-type/{project_id}/{document_type}
|
|
14
|
+
* List all chats for a specific document type (PRIMARY endpoint for UI)
|
|
15
|
+
*
|
|
16
|
+
* @param request - Filter parameters for document type chats
|
|
17
|
+
* @returns Paginated list of document chats for the specified type
|
|
18
|
+
*/
|
|
19
|
+
getChatsByDocumentType(request: GetChatsByDocumentTypeRequest): Promise<GetChatsByDocumentTypeResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* 3. GET /chat/document/history/{conversation_id}
|
|
22
|
+
* Get full chat history with messages
|
|
23
|
+
*
|
|
24
|
+
* @param request - Conversation ID to get history for
|
|
25
|
+
* @returns Conversation details with all messages
|
|
26
|
+
*/
|
|
27
|
+
getChatHistory(request: GetChatHistoryRequest): Promise<GetChatHistoryResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* 4. GET /chat/document/list
|
|
30
|
+
* List all chats for current user (with optional filters)
|
|
31
|
+
*
|
|
32
|
+
* @param request - Filter parameters for listing chats
|
|
33
|
+
* @returns Paginated list of all document chats for the user
|
|
34
|
+
*/
|
|
35
|
+
listDocumentChats(request?: ListDocumentChatsRequest): Promise<ListDocumentChatsResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* 5. GET /chat/document/by-document/{document_id}
|
|
38
|
+
* Get chat by specific document version ID (Legacy)
|
|
39
|
+
*
|
|
40
|
+
* @param request - Document ID to get chat for
|
|
41
|
+
* @returns Conversation and messages for the specific document
|
|
42
|
+
*/
|
|
43
|
+
getChatByDocumentId(request: GetChatByDocumentIdRequest): Promise<GetChatByDocumentIdResponse>;
|
|
44
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatService = void 0;
|
|
4
|
+
const base_service_1 = require("../base/base-service");
|
|
5
|
+
class ChatService extends base_service_1.BaseService {
|
|
6
|
+
/**
|
|
7
|
+
* 1. GET /chat/document/types/{project_id}
|
|
8
|
+
* Get document types for UI grouping
|
|
9
|
+
*
|
|
10
|
+
* @param request - Project ID to get document types for
|
|
11
|
+
* @returns Document types available for the project
|
|
12
|
+
*/
|
|
13
|
+
async getDocumentTypes(request) {
|
|
14
|
+
return this.get(`/chat/document/types/${request.project_id}`);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 2. GET /chat/document/by-type/{project_id}/{document_type}
|
|
18
|
+
* List all chats for a specific document type (PRIMARY endpoint for UI)
|
|
19
|
+
*
|
|
20
|
+
* @param request - Filter parameters for document type chats
|
|
21
|
+
* @returns Paginated list of document chats for the specified type
|
|
22
|
+
*/
|
|
23
|
+
async getChatsByDocumentType(request) {
|
|
24
|
+
const { project_id, document_type, chat_status = 'active', limit = 50, offset = 0 } = request;
|
|
25
|
+
// Build query parameters
|
|
26
|
+
const params = new URLSearchParams();
|
|
27
|
+
if (chat_status)
|
|
28
|
+
params.append('chat_status', chat_status);
|
|
29
|
+
if (limit !== undefined)
|
|
30
|
+
params.append('limit', limit.toString());
|
|
31
|
+
if (offset !== undefined)
|
|
32
|
+
params.append('offset', offset.toString());
|
|
33
|
+
const queryString = params.toString();
|
|
34
|
+
const url = `/chat/document/by-type/${project_id}/${document_type}${queryString ? `?${queryString}` : ''}`;
|
|
35
|
+
return this.get(url);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 3. GET /chat/document/history/{conversation_id}
|
|
39
|
+
* Get full chat history with messages
|
|
40
|
+
*
|
|
41
|
+
* @param request - Conversation ID to get history for
|
|
42
|
+
* @returns Conversation details with all messages
|
|
43
|
+
*/
|
|
44
|
+
async getChatHistory(request) {
|
|
45
|
+
return this.get(`/chat/document/history/${request.conversation_id}`);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* 4. GET /chat/document/list
|
|
49
|
+
* List all chats for current user (with optional filters)
|
|
50
|
+
*
|
|
51
|
+
* @param request - Filter parameters for listing chats
|
|
52
|
+
* @returns Paginated list of all document chats for the user
|
|
53
|
+
*/
|
|
54
|
+
async listDocumentChats(request = {}) {
|
|
55
|
+
const { project_id, document_type, template, chat_status = 'active', limit = 50, offset = 0, } = request;
|
|
56
|
+
// Build query parameters
|
|
57
|
+
const params = new URLSearchParams();
|
|
58
|
+
if (project_id)
|
|
59
|
+
params.append('project_id', project_id);
|
|
60
|
+
if (document_type)
|
|
61
|
+
params.append('document_type', document_type);
|
|
62
|
+
if (template)
|
|
63
|
+
params.append('template', template);
|
|
64
|
+
if (chat_status)
|
|
65
|
+
params.append('chat_status', chat_status);
|
|
66
|
+
if (limit !== undefined)
|
|
67
|
+
params.append('limit', limit.toString());
|
|
68
|
+
if (offset !== undefined)
|
|
69
|
+
params.append('offset', offset.toString());
|
|
70
|
+
const queryString = params.toString();
|
|
71
|
+
const url = `/chat/document/list${queryString ? `?${queryString}` : ''}`;
|
|
72
|
+
return this.get(url);
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* 5. GET /chat/document/by-document/{document_id}
|
|
76
|
+
* Get chat by specific document version ID (Legacy)
|
|
77
|
+
*
|
|
78
|
+
* @param request - Document ID to get chat for
|
|
79
|
+
* @returns Conversation and messages for the specific document
|
|
80
|
+
*/
|
|
81
|
+
async getChatByDocumentId(request) {
|
|
82
|
+
return this.get(`/chat/document/by-document/${request.document_id}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.ChatService = ChatService;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export interface GetDocumentTypesRequest {
|
|
2
|
+
project_id: string;
|
|
3
|
+
}
|
|
4
|
+
export interface GetDocumentTypesResponse {
|
|
5
|
+
project_id: string;
|
|
6
|
+
project_name: string;
|
|
7
|
+
document_types: DocumentType[];
|
|
8
|
+
}
|
|
9
|
+
export type DocumentType = 'project_requirements_document' | 'app_flow_document' | 'tech_stack_document' | 'frontend_guidelines_document' | 'database_schema_document' | 'api_documentation_document' | 'deployment_document' | 'testing_document' | 'custom_document';
|
|
10
|
+
export interface GetChatsByDocumentTypeRequest {
|
|
11
|
+
project_id: string;
|
|
12
|
+
document_type: DocumentType;
|
|
13
|
+
chat_status?: ChatStatus;
|
|
14
|
+
limit?: number;
|
|
15
|
+
offset?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface GetChatsByDocumentTypeResponse {
|
|
18
|
+
chats: DocumentChatSummary[];
|
|
19
|
+
count: number;
|
|
20
|
+
project_id: string;
|
|
21
|
+
document_type: DocumentType;
|
|
22
|
+
limit: number;
|
|
23
|
+
offset: number;
|
|
24
|
+
}
|
|
25
|
+
export interface GetChatHistoryRequest {
|
|
26
|
+
conversation_id: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GetChatHistoryResponse {
|
|
29
|
+
conversation: DocumentConversation;
|
|
30
|
+
messages: ChatMessage[];
|
|
31
|
+
}
|
|
32
|
+
export interface ListDocumentChatsRequest {
|
|
33
|
+
project_id?: string;
|
|
34
|
+
document_type?: DocumentType;
|
|
35
|
+
template?: 'blueprint' | 'wireframe';
|
|
36
|
+
chat_status?: ChatStatus;
|
|
37
|
+
limit?: number;
|
|
38
|
+
offset?: number;
|
|
39
|
+
}
|
|
40
|
+
export interface ListDocumentChatsResponse {
|
|
41
|
+
chats: DocumentChatSummary[];
|
|
42
|
+
count: number;
|
|
43
|
+
limit: number;
|
|
44
|
+
offset: number;
|
|
45
|
+
}
|
|
46
|
+
export interface GetChatByDocumentIdRequest {
|
|
47
|
+
document_id: string;
|
|
48
|
+
}
|
|
49
|
+
export interface GetChatByDocumentIdResponse {
|
|
50
|
+
conversation: DocumentConversation;
|
|
51
|
+
messages: ChatMessage[];
|
|
52
|
+
}
|
|
53
|
+
export type ChatStatus = 'active' | 'archived' | 'deleted';
|
|
54
|
+
export interface DocumentChatSummary {
|
|
55
|
+
id: string;
|
|
56
|
+
project_id: string;
|
|
57
|
+
document_type: DocumentType;
|
|
58
|
+
title: string;
|
|
59
|
+
template: 'blueprint' | 'wireframe';
|
|
60
|
+
status: ChatStatus;
|
|
61
|
+
last_message_at: string;
|
|
62
|
+
metadata?: Record<string, any>;
|
|
63
|
+
}
|
|
64
|
+
export interface DocumentConversation {
|
|
65
|
+
id: string;
|
|
66
|
+
project_id: string;
|
|
67
|
+
document_type: DocumentType;
|
|
68
|
+
title: string;
|
|
69
|
+
template: 'blueprint' | 'wireframe';
|
|
70
|
+
status: ChatStatus;
|
|
71
|
+
created_at: string;
|
|
72
|
+
last_message_at: string;
|
|
73
|
+
}
|
|
74
|
+
export interface ChatMessage {
|
|
75
|
+
id: string;
|
|
76
|
+
role: 'user' | 'assistant' | 'system';
|
|
77
|
+
content: string;
|
|
78
|
+
tool_calls?: ChatToolCall[];
|
|
79
|
+
created_at: string;
|
|
80
|
+
}
|
|
81
|
+
export interface ChatToolCall {
|
|
82
|
+
id: string;
|
|
83
|
+
type: string;
|
|
84
|
+
function?: {
|
|
85
|
+
name: string;
|
|
86
|
+
arguments: string;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ============================================================================
|
|
3
|
+
// Document Chat GET Endpoint Types
|
|
4
|
+
// ============================================================================
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.ChatService = void 0;
|
|
18
|
+
var chat_service_1 = require("./chat-service");
|
|
19
|
+
Object.defineProperty(exports, "ChatService", { enumerable: true, get: function () { return chat_service_1.ChatService; } });
|
|
20
|
+
__exportStar(require("./chat-types"), exports);
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { BaseService } from '../base/base-service';
|
|
2
|
+
import { DataStatsResponse, DeleteAllDataRequest, DeleteAllDataResponse, DataExportResponse } from './data-management-types';
|
|
3
|
+
export declare class DataManagementService extends BaseService {
|
|
4
|
+
/**
|
|
5
|
+
* Get comprehensive statistics of all user data
|
|
6
|
+
*
|
|
7
|
+
* Calls GET /data/stats to retrieve aggregate counts of:
|
|
8
|
+
* - Projects
|
|
9
|
+
* - Project documents
|
|
10
|
+
* - Project repositories
|
|
11
|
+
* - Project tasks
|
|
12
|
+
* - Task groups
|
|
13
|
+
* - Chat conversations
|
|
14
|
+
* - Chat messages
|
|
15
|
+
* - Codespace tasks
|
|
16
|
+
*
|
|
17
|
+
* @returns Promise resolving to DataStatsResponse with counts for each entity type
|
|
18
|
+
*/
|
|
19
|
+
getDataStats(): Promise<DataStatsResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* Export all user data
|
|
22
|
+
*
|
|
23
|
+
* Calls GET /data/export to retrieve complete export of all user data.
|
|
24
|
+
* This includes all projects, documents, repositories, tasks, conversations,
|
|
25
|
+
* messages, and codespace tasks with their full details.
|
|
26
|
+
*
|
|
27
|
+
* Use this for:
|
|
28
|
+
* - Creating backups
|
|
29
|
+
* - Migrating data to another system
|
|
30
|
+
* - Data analysis
|
|
31
|
+
* - Compliance and auditing
|
|
32
|
+
*
|
|
33
|
+
* @returns Promise resolving to DataExportResponse with complete user data
|
|
34
|
+
*/
|
|
35
|
+
exportData(): Promise<DataExportResponse>;
|
|
36
|
+
/**
|
|
37
|
+
* Delete all user data with explicit confirmation
|
|
38
|
+
*
|
|
39
|
+
* Calls DELETE /data/all to perform bulk deletion of all user data.
|
|
40
|
+
* This operation requires confirmation to prevent accidental data loss.
|
|
41
|
+
*
|
|
42
|
+
* The deletion will affect:
|
|
43
|
+
* - All projects (including documents and repositories)
|
|
44
|
+
* - All task groups and project tasks
|
|
45
|
+
* - All chat conversations and messages
|
|
46
|
+
* - All codespace tasks
|
|
47
|
+
*
|
|
48
|
+
* @param request - DeleteAllDataRequest with confirm flag set to true
|
|
49
|
+
* @returns Promise resolving to DeleteAllDataResponse with deletion summary
|
|
50
|
+
* @throws Error if confirmation is not true
|
|
51
|
+
*/
|
|
52
|
+
deleteAllData(request: DeleteAllDataRequest): Promise<DeleteAllDataResponse>;
|
|
53
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DataManagementService = void 0;
|
|
4
|
+
const base_service_1 = require("../base/base-service");
|
|
5
|
+
class DataManagementService extends base_service_1.BaseService {
|
|
6
|
+
/**
|
|
7
|
+
* Get comprehensive statistics of all user data
|
|
8
|
+
*
|
|
9
|
+
* Calls GET /data/stats to retrieve aggregate counts of:
|
|
10
|
+
* - Projects
|
|
11
|
+
* - Project documents
|
|
12
|
+
* - Project repositories
|
|
13
|
+
* - Project tasks
|
|
14
|
+
* - Task groups
|
|
15
|
+
* - Chat conversations
|
|
16
|
+
* - Chat messages
|
|
17
|
+
* - Codespace tasks
|
|
18
|
+
*
|
|
19
|
+
* @returns Promise resolving to DataStatsResponse with counts for each entity type
|
|
20
|
+
*/
|
|
21
|
+
async getDataStats() {
|
|
22
|
+
return this.get('/data/stats');
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Export all user data
|
|
26
|
+
*
|
|
27
|
+
* Calls GET /data/export to retrieve complete export of all user data.
|
|
28
|
+
* This includes all projects, documents, repositories, tasks, conversations,
|
|
29
|
+
* messages, and codespace tasks with their full details.
|
|
30
|
+
*
|
|
31
|
+
* Use this for:
|
|
32
|
+
* - Creating backups
|
|
33
|
+
* - Migrating data to another system
|
|
34
|
+
* - Data analysis
|
|
35
|
+
* - Compliance and auditing
|
|
36
|
+
*
|
|
37
|
+
* @returns Promise resolving to DataExportResponse with complete user data
|
|
38
|
+
*/
|
|
39
|
+
async exportData() {
|
|
40
|
+
return this.get('/data/export');
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Delete all user data with explicit confirmation
|
|
44
|
+
*
|
|
45
|
+
* Calls DELETE /data/all to perform bulk deletion of all user data.
|
|
46
|
+
* This operation requires confirmation to prevent accidental data loss.
|
|
47
|
+
*
|
|
48
|
+
* The deletion will affect:
|
|
49
|
+
* - All projects (including documents and repositories)
|
|
50
|
+
* - All task groups and project tasks
|
|
51
|
+
* - All chat conversations and messages
|
|
52
|
+
* - All codespace tasks
|
|
53
|
+
*
|
|
54
|
+
* @param request - DeleteAllDataRequest with confirm flag set to true
|
|
55
|
+
* @returns Promise resolving to DeleteAllDataResponse with deletion summary
|
|
56
|
+
* @throws Error if confirmation is not true
|
|
57
|
+
*/
|
|
58
|
+
async deleteAllData(request) {
|
|
59
|
+
// Validate confirmation flag to prevent accidental deletion
|
|
60
|
+
if (!request.confirm) {
|
|
61
|
+
throw new Error('Confirmation required. Set confirm: true to delete all data. This action cannot be undone.');
|
|
62
|
+
}
|
|
63
|
+
return this.delete('/data/all');
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.DataManagementService = DataManagementService;
|