@codeguide/core 0.0.29 → 0.0.35
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/codespace/codespace-v2.test.ts +53 -0
- package/__tests__/services/usage/usage-service.test.ts +138 -119
- package/codeguide.ts +3 -0
- package/dist/codeguide.d.ts +2 -1
- package/dist/codeguide.js +1 -0
- package/dist/index.d.ts +1 -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/codespace/codespace-service.d.ts +11 -2
- package/dist/services/codespace/codespace-service.js +18 -3
- package/dist/services/codespace/codespace-types.d.ts +21 -0
- package/dist/services/codespace/index.d.ts +1 -1
- 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 +95 -0
- package/dist/services/index.d.ts +4 -0
- package/dist/services/index.js +7 -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 +24 -1
- 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/subscriptions/subscription-service.d.ts +11 -1
- package/dist/services/subscriptions/subscription-service.js +14 -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 +119 -45
- package/dist/types.d.ts +18 -2
- package/index.ts +3 -0
- package/package.json +2 -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/codespace/codespace-service.ts +25 -3
- package/services/codespace/codespace-types.ts +33 -0
- package/services/codespace/index.ts +6 -1
- package/services/generation/generation-service.ts +40 -0
- package/services/generation/generation-types.ts +110 -0
- package/services/index.ts +4 -0
- package/services/projects/README.md +54 -0
- package/services/projects/project-service.ts +20 -1
- package/services/projects/project-types.ts +27 -1
- 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/subscriptions/subscription-service.ts +23 -5
- 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 +128 -49
- package/types.ts +22 -2
package/index.ts
CHANGED
|
@@ -19,6 +19,9 @@ export type {
|
|
|
19
19
|
GetProjectsRequest,
|
|
20
20
|
PaginatedProjectsRequest,
|
|
21
21
|
PaginatedProjectsResponse,
|
|
22
|
+
AITool,
|
|
23
|
+
GetAiToolsRequest,
|
|
24
|
+
GetAiToolsResponse,
|
|
22
25
|
} from './services/projects/project-types'
|
|
23
26
|
export type {
|
|
24
27
|
CreateCodespaceTaskRequestV2 as CreateCodespaceTaskRequest,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codeguide/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"description": "Core package for code guidance with programmatic API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"test": "jest --config=jest.config.json",
|
|
19
19
|
"test:watch": "jest --config=jest.config.json --watch",
|
|
20
20
|
"test:coverage": "jest --config=jest.config.json --coverage",
|
|
21
|
+
"dev:link": "npm run build && npm link",
|
|
21
22
|
"docs:dev": "cd docs && npm run dev",
|
|
22
23
|
"docs:build": "cd docs && npm run build",
|
|
23
24
|
"docs:preview": "cd docs && npm run preview",
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { BaseService } from '../base/base-service'
|
|
2
|
+
import {
|
|
3
|
+
GetDocumentTypesRequest,
|
|
4
|
+
GetDocumentTypesResponse,
|
|
5
|
+
GetChatsByDocumentTypeRequest,
|
|
6
|
+
GetChatsByDocumentTypeResponse,
|
|
7
|
+
GetChatHistoryRequest,
|
|
8
|
+
GetChatHistoryResponse,
|
|
9
|
+
ListDocumentChatsRequest,
|
|
10
|
+
ListDocumentChatsResponse,
|
|
11
|
+
GetChatByDocumentIdRequest,
|
|
12
|
+
GetChatByDocumentIdResponse,
|
|
13
|
+
} from './chat-types'
|
|
14
|
+
|
|
15
|
+
export class ChatService extends BaseService {
|
|
16
|
+
/**
|
|
17
|
+
* 1. GET /chat/document/types/{project_id}
|
|
18
|
+
* Get document types for UI grouping
|
|
19
|
+
*
|
|
20
|
+
* @param request - Project ID to get document types for
|
|
21
|
+
* @returns Document types available for the project
|
|
22
|
+
*/
|
|
23
|
+
async getDocumentTypes(request: GetDocumentTypesRequest): Promise<GetDocumentTypesResponse> {
|
|
24
|
+
return this.get<GetDocumentTypesResponse>(`/chat/document/types/${request.project_id}`)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 2. GET /chat/document/by-type/{project_id}/{document_type}
|
|
29
|
+
* List all chats for a specific document type (PRIMARY endpoint for UI)
|
|
30
|
+
*
|
|
31
|
+
* @param request - Filter parameters for document type chats
|
|
32
|
+
* @returns Paginated list of document chats for the specified type
|
|
33
|
+
*/
|
|
34
|
+
async getChatsByDocumentType(
|
|
35
|
+
request: GetChatsByDocumentTypeRequest
|
|
36
|
+
): Promise<GetChatsByDocumentTypeResponse> {
|
|
37
|
+
const { project_id, document_type, chat_status = 'active', limit = 50, offset = 0 } = request
|
|
38
|
+
|
|
39
|
+
// Build query parameters
|
|
40
|
+
const params = new URLSearchParams()
|
|
41
|
+
if (chat_status) params.append('chat_status', chat_status)
|
|
42
|
+
if (limit !== undefined) params.append('limit', limit.toString())
|
|
43
|
+
if (offset !== undefined) params.append('offset', offset.toString())
|
|
44
|
+
|
|
45
|
+
const queryString = params.toString()
|
|
46
|
+
const url = `/chat/document/by-type/${project_id}/${document_type}${queryString ? `?${queryString}` : ''}`
|
|
47
|
+
|
|
48
|
+
return this.get<GetChatsByDocumentTypeResponse>(url)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* 3. GET /chat/document/history/{conversation_id}
|
|
53
|
+
* Get full chat history with messages
|
|
54
|
+
*
|
|
55
|
+
* @param request - Conversation ID to get history for
|
|
56
|
+
* @returns Conversation details with all messages
|
|
57
|
+
*/
|
|
58
|
+
async getChatHistory(request: GetChatHistoryRequest): Promise<GetChatHistoryResponse> {
|
|
59
|
+
return this.get<GetChatHistoryResponse>(`/chat/document/history/${request.conversation_id}`)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 4. GET /chat/document/list
|
|
64
|
+
* List all chats for current user (with optional filters)
|
|
65
|
+
*
|
|
66
|
+
* @param request - Filter parameters for listing chats
|
|
67
|
+
* @returns Paginated list of all document chats for the user
|
|
68
|
+
*/
|
|
69
|
+
async listDocumentChats(
|
|
70
|
+
request: ListDocumentChatsRequest = {}
|
|
71
|
+
): Promise<ListDocumentChatsResponse> {
|
|
72
|
+
const {
|
|
73
|
+
project_id,
|
|
74
|
+
document_type,
|
|
75
|
+
template,
|
|
76
|
+
chat_status = 'active',
|
|
77
|
+
limit = 50,
|
|
78
|
+
offset = 0,
|
|
79
|
+
} = request
|
|
80
|
+
|
|
81
|
+
// Build query parameters
|
|
82
|
+
const params = new URLSearchParams()
|
|
83
|
+
if (project_id) params.append('project_id', project_id)
|
|
84
|
+
if (document_type) params.append('document_type', document_type)
|
|
85
|
+
if (template) params.append('template', template)
|
|
86
|
+
if (chat_status) params.append('chat_status', chat_status)
|
|
87
|
+
if (limit !== undefined) params.append('limit', limit.toString())
|
|
88
|
+
if (offset !== undefined) params.append('offset', offset.toString())
|
|
89
|
+
|
|
90
|
+
const queryString = params.toString()
|
|
91
|
+
const url = `/chat/document/list${queryString ? `?${queryString}` : ''}`
|
|
92
|
+
|
|
93
|
+
return this.get<ListDocumentChatsResponse>(url)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 5. GET /chat/document/by-document/{document_id}
|
|
98
|
+
* Get chat by specific document version ID (Legacy)
|
|
99
|
+
*
|
|
100
|
+
* @param request - Document ID to get chat for
|
|
101
|
+
* @returns Conversation and messages for the specific document
|
|
102
|
+
*/
|
|
103
|
+
async getChatByDocumentId(
|
|
104
|
+
request: GetChatByDocumentIdRequest
|
|
105
|
+
): Promise<GetChatByDocumentIdResponse> {
|
|
106
|
+
return this.get<GetChatByDocumentIdResponse>(
|
|
107
|
+
`/chat/document/by-document/${request.document_id}`
|
|
108
|
+
)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// Document Chat GET Endpoint Types
|
|
3
|
+
// ============================================================================
|
|
4
|
+
|
|
5
|
+
// ============================================================================
|
|
6
|
+
// 1. GET /chat/document/types/{project_id}
|
|
7
|
+
// Get document types for UI grouping
|
|
8
|
+
// ============================================================================
|
|
9
|
+
|
|
10
|
+
export interface GetDocumentTypesRequest {
|
|
11
|
+
project_id: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface GetDocumentTypesResponse {
|
|
15
|
+
project_id: string
|
|
16
|
+
project_name: string
|
|
17
|
+
document_types: DocumentType[]
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type DocumentType =
|
|
21
|
+
| 'project_requirements_document'
|
|
22
|
+
| 'app_flow_document'
|
|
23
|
+
| 'tech_stack_document'
|
|
24
|
+
| 'frontend_guidelines_document'
|
|
25
|
+
| 'database_schema_document'
|
|
26
|
+
| 'api_documentation_document'
|
|
27
|
+
| 'deployment_document'
|
|
28
|
+
| 'testing_document'
|
|
29
|
+
| 'custom_document'
|
|
30
|
+
|
|
31
|
+
// ============================================================================
|
|
32
|
+
// 2. GET /chat/document/by-type/{project_id}/{document_type}
|
|
33
|
+
// List all chats for a specific document type (PRIMARY endpoint for UI)
|
|
34
|
+
// ============================================================================
|
|
35
|
+
|
|
36
|
+
export interface GetChatsByDocumentTypeRequest {
|
|
37
|
+
project_id: string
|
|
38
|
+
document_type: DocumentType
|
|
39
|
+
chat_status?: ChatStatus
|
|
40
|
+
limit?: number
|
|
41
|
+
offset?: number
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface GetChatsByDocumentTypeResponse {
|
|
45
|
+
chats: DocumentChatSummary[]
|
|
46
|
+
count: number
|
|
47
|
+
project_id: string
|
|
48
|
+
document_type: DocumentType
|
|
49
|
+
limit: number
|
|
50
|
+
offset: number
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ============================================================================
|
|
54
|
+
// 3. GET /chat/document/history/{conversation_id}
|
|
55
|
+
// Get full chat history with messages
|
|
56
|
+
// ============================================================================
|
|
57
|
+
|
|
58
|
+
export interface GetChatHistoryRequest {
|
|
59
|
+
conversation_id: string
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface GetChatHistoryResponse {
|
|
63
|
+
conversation: DocumentConversation
|
|
64
|
+
messages: ChatMessage[]
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ============================================================================
|
|
68
|
+
// 4. GET /chat/document/list
|
|
69
|
+
// List all chats for current user (with optional filters)
|
|
70
|
+
// ============================================================================
|
|
71
|
+
|
|
72
|
+
export interface ListDocumentChatsRequest {
|
|
73
|
+
project_id?: string
|
|
74
|
+
document_type?: DocumentType
|
|
75
|
+
template?: 'blueprint' | 'wireframe'
|
|
76
|
+
chat_status?: ChatStatus
|
|
77
|
+
limit?: number
|
|
78
|
+
offset?: number
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface ListDocumentChatsResponse {
|
|
82
|
+
chats: DocumentChatSummary[]
|
|
83
|
+
count: number
|
|
84
|
+
limit: number
|
|
85
|
+
offset: number
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ============================================================================
|
|
89
|
+
// 5. GET /chat/document/by-document/{document_id}
|
|
90
|
+
// Get chat by specific document version ID (Legacy)
|
|
91
|
+
// ============================================================================
|
|
92
|
+
|
|
93
|
+
export interface GetChatByDocumentIdRequest {
|
|
94
|
+
document_id: string
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface GetChatByDocumentIdResponse {
|
|
98
|
+
conversation: DocumentConversation
|
|
99
|
+
messages: ChatMessage[]
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ============================================================================
|
|
103
|
+
// Common Types
|
|
104
|
+
// ============================================================================
|
|
105
|
+
|
|
106
|
+
export type ChatStatus = 'active' | 'archived' | 'deleted'
|
|
107
|
+
|
|
108
|
+
export interface DocumentChatSummary {
|
|
109
|
+
id: string
|
|
110
|
+
project_id: string
|
|
111
|
+
document_type: DocumentType
|
|
112
|
+
title: string
|
|
113
|
+
template: 'blueprint' | 'wireframe'
|
|
114
|
+
status: ChatStatus
|
|
115
|
+
last_message_at: string
|
|
116
|
+
metadata?: Record<string, any>
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface DocumentConversation {
|
|
120
|
+
id: string
|
|
121
|
+
project_id: string
|
|
122
|
+
document_type: DocumentType
|
|
123
|
+
title: string
|
|
124
|
+
template: 'blueprint' | 'wireframe'
|
|
125
|
+
status: ChatStatus
|
|
126
|
+
created_at: string
|
|
127
|
+
last_message_at: string
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface ChatMessage {
|
|
131
|
+
id: string
|
|
132
|
+
role: 'user' | 'assistant' | 'system'
|
|
133
|
+
content: string
|
|
134
|
+
tool_calls?: ChatToolCall[]
|
|
135
|
+
created_at: string
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface ChatToolCall {
|
|
139
|
+
id: string
|
|
140
|
+
type: string
|
|
141
|
+
function?: {
|
|
142
|
+
name: string
|
|
143
|
+
arguments: string
|
|
144
|
+
}
|
|
145
|
+
}
|
|
@@ -36,6 +36,9 @@ import {
|
|
|
36
36
|
CodespaceTaskLogsResponse,
|
|
37
37
|
StreamCodespaceTaskLogsRequest,
|
|
38
38
|
CodespaceLogStreamEvent,
|
|
39
|
+
// Project Summary Types
|
|
40
|
+
GetCodespaceProjectSummaryRequest,
|
|
41
|
+
GetCodespaceProjectSummaryResponse,
|
|
39
42
|
} from './codespace-types'
|
|
40
43
|
|
|
41
44
|
export class CodespaceService extends BaseService {
|
|
@@ -107,6 +110,25 @@ export class CodespaceService extends BaseService {
|
|
|
107
110
|
return this.get<GetCodespaceTasksByProjectResponse>(url)
|
|
108
111
|
}
|
|
109
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Get aggregated statistics for all codespace tasks within a project
|
|
115
|
+
*
|
|
116
|
+
* GET /codespace/project/{project_id}/summary
|
|
117
|
+
*
|
|
118
|
+
* @param params - Request parameters including project_id
|
|
119
|
+
* @returns Promise resolving to aggregated task statistics by status
|
|
120
|
+
*/
|
|
121
|
+
async getCodespaceProjectSummary(
|
|
122
|
+
params: GetCodespaceProjectSummaryRequest
|
|
123
|
+
): Promise<GetCodespaceProjectSummaryResponse> {
|
|
124
|
+
if (!params.project_id) {
|
|
125
|
+
throw new Error('project_id is required')
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const url = `/codespace/project/${params.project_id}/summary`
|
|
129
|
+
return this.get<GetCodespaceProjectSummaryResponse>(url)
|
|
130
|
+
}
|
|
131
|
+
|
|
110
132
|
async getCodespaceTaskDetailed(codespaceTaskId: string): Promise<CodespaceTaskDetailedResponse> {
|
|
111
133
|
if (!codespaceTaskId) {
|
|
112
134
|
throw new Error('codespace_task_id is required')
|
|
@@ -145,7 +167,7 @@ export class CodespaceService extends BaseService {
|
|
|
145
167
|
queryParams.append('sort_order', params.sort_order)
|
|
146
168
|
}
|
|
147
169
|
|
|
148
|
-
const url = `/tasks/by-codespace-id/${params.codespace_task_id}${
|
|
170
|
+
const url = `/codespace/tasks/by-codespace-id/${params.codespace_task_id}${
|
|
149
171
|
queryParams.toString() ? `?${queryParams.toString()}` : ''
|
|
150
172
|
}`
|
|
151
173
|
|
|
@@ -193,7 +215,7 @@ export class CodespaceService extends BaseService {
|
|
|
193
215
|
/**
|
|
194
216
|
* Update the final report popup state for a codespace task
|
|
195
217
|
*
|
|
196
|
-
* PATCH /task/{codespace_task_id}/final-report-popup-state
|
|
218
|
+
* PATCH /codespace/task/{codespace_task_id}/final-report-popup-state
|
|
197
219
|
*
|
|
198
220
|
* @param codespaceTaskId - The ID of the codespace task
|
|
199
221
|
* @param request - The request body containing the new popup state
|
|
@@ -213,7 +235,7 @@ export class CodespaceService extends BaseService {
|
|
|
213
235
|
}
|
|
214
236
|
|
|
215
237
|
return this.patch<UpdateFinalReportPopupStateResponse>(
|
|
216
|
-
`/task/${codespaceTaskId}/final-report-popup-state`,
|
|
238
|
+
`/codespace/task/${codespaceTaskId}/final-report-popup-state`,
|
|
217
239
|
request
|
|
218
240
|
)
|
|
219
241
|
}
|
|
@@ -497,3 +497,36 @@ export type CodespaceLogStreamEvent =
|
|
|
497
497
|
| StreamTimeoutEvent
|
|
498
498
|
| StreamErrorEvent
|
|
499
499
|
|
|
500
|
+
// ============================================================================
|
|
501
|
+
// Project Summary Endpoint Types
|
|
502
|
+
// ============================================================================
|
|
503
|
+
|
|
504
|
+
// Request parameters for project codespace summary
|
|
505
|
+
export interface GetCodespaceProjectSummaryRequest {
|
|
506
|
+
project_id: string
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// Status summary interface
|
|
510
|
+
export interface CodespaceStatusSummary {
|
|
511
|
+
pending: number
|
|
512
|
+
in_progress: number
|
|
513
|
+
completed: number
|
|
514
|
+
failed: number
|
|
515
|
+
blocked: number
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// Response data structure for project summary
|
|
519
|
+
export interface CodespaceProjectSummaryData {
|
|
520
|
+
project_id: string
|
|
521
|
+
total_codespace_tasks: number
|
|
522
|
+
status_summary: CodespaceStatusSummary
|
|
523
|
+
latest_task_created_at: string
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
// Response for project codespace summary endpoint
|
|
527
|
+
export interface GetCodespaceProjectSummaryResponse {
|
|
528
|
+
status: string
|
|
529
|
+
data: CodespaceProjectSummaryData
|
|
530
|
+
message: string
|
|
531
|
+
}
|
|
532
|
+
|
|
@@ -40,5 +40,10 @@ export type {
|
|
|
40
40
|
CodespaceLogStreamEvent,
|
|
41
41
|
// GET /tasks/by-codespace-id Types
|
|
42
42
|
GetTasksByCodespaceIdRequest,
|
|
43
|
-
GetTasksByCodespaceIdResponse
|
|
43
|
+
GetTasksByCodespaceIdResponse,
|
|
44
|
+
// Project Summary Types
|
|
45
|
+
GetCodespaceProjectSummaryRequest,
|
|
46
|
+
GetCodespaceProjectSummaryResponse,
|
|
47
|
+
CodespaceStatusSummary,
|
|
48
|
+
CodespaceProjectSummaryData
|
|
44
49
|
} from './codespace-types'
|
|
@@ -18,9 +18,21 @@ import {
|
|
|
18
18
|
GenerateMultipleDocumentsResponse,
|
|
19
19
|
GenerateMissingDocumentsRequest,
|
|
20
20
|
GenerateMissingDocumentsResponse,
|
|
21
|
+
GenerateTechSpecRequest,
|
|
22
|
+
CustomDocumentResponse,
|
|
21
23
|
BackgroundGenerationRequest,
|
|
22
24
|
BackgroundGenerationResponse,
|
|
23
25
|
BackgroundGenerationStatusResponse,
|
|
26
|
+
GenerateAnswersRequest,
|
|
27
|
+
GenerateAnswersResponse,
|
|
28
|
+
GenerateProjectOutlineRequest,
|
|
29
|
+
GenerateProjectOutlineResponse,
|
|
30
|
+
GenerateCoreFeaturesRequest,
|
|
31
|
+
GenerateCoreFeaturesResponse,
|
|
32
|
+
GenerateTechStackRequest,
|
|
33
|
+
GenerateTechStackResponse,
|
|
34
|
+
GenerateAppFlowRequest,
|
|
35
|
+
GenerateAppFlowResponse,
|
|
24
36
|
} from './generation-types'
|
|
25
37
|
|
|
26
38
|
export class GenerationService extends BaseService {
|
|
@@ -78,4 +90,32 @@ export class GenerationService extends BaseService {
|
|
|
78
90
|
async getBackgroundGenerationStatus(jobId: string): Promise<BackgroundGenerationStatusResponse> {
|
|
79
91
|
return this.get<BackgroundGenerationStatusResponse>(`/generate/background/${jobId}/status`)
|
|
80
92
|
}
|
|
93
|
+
|
|
94
|
+
async generateTechSpec(request: GenerateTechSpecRequest): Promise<CustomDocumentResponse> {
|
|
95
|
+
return this.post<CustomDocumentResponse>('/generate/tech-spec', request)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
async generateAnswers(request: GenerateAnswersRequest): Promise<GenerateAnswersResponse> {
|
|
99
|
+
return this.post<GenerateAnswersResponse>('/generate/answers', request)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async generateProjectOutline(
|
|
103
|
+
request: GenerateProjectOutlineRequest
|
|
104
|
+
): Promise<GenerateProjectOutlineResponse> {
|
|
105
|
+
return this.post<GenerateProjectOutlineResponse>('/generate/project-outline', request)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async generateCoreFeatures(
|
|
109
|
+
request: GenerateCoreFeaturesRequest
|
|
110
|
+
): Promise<GenerateCoreFeaturesResponse> {
|
|
111
|
+
return this.post<GenerateCoreFeaturesResponse>('/generate/core-features', request)
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async generateTechStack(request: GenerateTechStackRequest): Promise<GenerateTechStackResponse> {
|
|
115
|
+
return this.post<GenerateTechStackResponse>('/generate/tech-stack', request)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async generateAppFlow(request: GenerateAppFlowRequest): Promise<GenerateAppFlowResponse> {
|
|
119
|
+
return this.post<GenerateAppFlowResponse>('/generate/app-flow', request)
|
|
120
|
+
}
|
|
81
121
|
}
|
|
@@ -65,6 +65,7 @@ export interface GenerateOutlineResponse {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export interface GenerateDocumentRequest {
|
|
68
|
+
project_id?: string
|
|
68
69
|
project_type?: string
|
|
69
70
|
description: string
|
|
70
71
|
selected_tools: string[]
|
|
@@ -129,3 +130,112 @@ export interface GenerateMissingDocumentsResponse {
|
|
|
129
130
|
error?: string
|
|
130
131
|
generated_documents?: string[]
|
|
131
132
|
}
|
|
133
|
+
|
|
134
|
+
export interface GenerateTechSpecRequest {
|
|
135
|
+
project_id: string
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface CustomDocumentResponse {
|
|
139
|
+
content: string
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export interface GenerateAnswersRequest {
|
|
143
|
+
title: string
|
|
144
|
+
description: string
|
|
145
|
+
questions: Array<{
|
|
146
|
+
question: string
|
|
147
|
+
answer: string
|
|
148
|
+
}>
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export interface GenerateAnswersResponse {
|
|
152
|
+
answers: Array<{
|
|
153
|
+
question: string
|
|
154
|
+
answer: string
|
|
155
|
+
}>
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export interface GenerateProjectOutlineRequest {
|
|
159
|
+
description: string
|
|
160
|
+
project_type: string
|
|
161
|
+
title?: string
|
|
162
|
+
selected_tools?: string[]
|
|
163
|
+
answers?: Record<string, any>
|
|
164
|
+
project_id?: string
|
|
165
|
+
category_id?: string
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface GenerateProjectOutlineResponse {
|
|
169
|
+
outline: string
|
|
170
|
+
project_id: string
|
|
171
|
+
project_created: boolean
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export interface CoreFeature {
|
|
175
|
+
id: number
|
|
176
|
+
title: string
|
|
177
|
+
description: string
|
|
178
|
+
icon_key: string
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export interface GenerateCoreFeaturesRequest {
|
|
182
|
+
context: string
|
|
183
|
+
project_id?: string
|
|
184
|
+
existing_features?: Array<{
|
|
185
|
+
id: number
|
|
186
|
+
title: string
|
|
187
|
+
description: string
|
|
188
|
+
}>
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface GenerateCoreFeaturesResponse {
|
|
192
|
+
core_features: CoreFeature[]
|
|
193
|
+
project_id: string | null
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export interface TechStackItem {
|
|
197
|
+
id: number
|
|
198
|
+
type: string
|
|
199
|
+
name: string
|
|
200
|
+
icon_key: string
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface GenerateTechStackRequest {
|
|
204
|
+
context: string
|
|
205
|
+
project_id?: string
|
|
206
|
+
existing_items?: Array<{
|
|
207
|
+
id: number
|
|
208
|
+
type: string
|
|
209
|
+
name: string
|
|
210
|
+
}>
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface GenerateTechStackResponse {
|
|
214
|
+
tech_stack: TechStackItem[]
|
|
215
|
+
project_id: string | null
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface AppFlowItem {
|
|
219
|
+
id: number
|
|
220
|
+
title: string
|
|
221
|
+
page: string
|
|
222
|
+
description: string
|
|
223
|
+
index: number
|
|
224
|
+
icon_key: string
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface GenerateAppFlowRequest {
|
|
228
|
+
context: string
|
|
229
|
+
project_id?: string
|
|
230
|
+
existing_items?: Array<{
|
|
231
|
+
id: number
|
|
232
|
+
title: string
|
|
233
|
+
page: string
|
|
234
|
+
description: string
|
|
235
|
+
}>
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
export interface GenerateAppFlowResponse {
|
|
239
|
+
app_flow: AppFlowItem[]
|
|
240
|
+
project_id: string | null
|
|
241
|
+
}
|
package/services/index.ts
CHANGED
|
@@ -21,6 +21,8 @@ export { ExternalTokenService } from './external-tokens'
|
|
|
21
21
|
export { SecurityKeysService } from './security-keys'
|
|
22
22
|
export { UserService } from './users'
|
|
23
23
|
export { StarterKitsService } from './starter-kits'
|
|
24
|
+
export { StreamingService } from './streaming'
|
|
25
|
+
export { ChatService } from './chat'
|
|
24
26
|
|
|
25
27
|
// Re-export all types for convenience
|
|
26
28
|
export * from './generation'
|
|
@@ -36,3 +38,5 @@ export * from './external-tokens'
|
|
|
36
38
|
export * from './security-keys'
|
|
37
39
|
export * from './users'
|
|
38
40
|
export * from './starter-kits'
|
|
41
|
+
export * from './streaming'
|
|
42
|
+
export * from './chat'
|
|
@@ -122,6 +122,60 @@ interface Project {
|
|
|
122
122
|
}
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
+
### Project Creation
|
|
126
|
+
|
|
127
|
+
#### `CreateProjectRequest`
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
interface CreateProjectRequest {
|
|
131
|
+
title?: string // Optional - will be auto-generated if not provided
|
|
132
|
+
description: string
|
|
133
|
+
status?: 'prompt' | 'draft' | 'in_progress' | 'completed'
|
|
134
|
+
category_id?: string
|
|
135
|
+
starter_kit_id?: string
|
|
136
|
+
ai_questionaire?: {
|
|
137
|
+
experience_level?: string
|
|
138
|
+
timeline?: string
|
|
139
|
+
team_size?: number
|
|
140
|
+
}
|
|
141
|
+
tools_selected?: string[]
|
|
142
|
+
project_outline?: {
|
|
143
|
+
features?: string[]
|
|
144
|
+
architecture?: string
|
|
145
|
+
}
|
|
146
|
+
codie_tool_id?: string
|
|
147
|
+
existing_project_repo_url?: string
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### Automatic Title Generation
|
|
152
|
+
|
|
153
|
+
The API now supports automatic title generation when creating projects without a title. The system generates titles using this priority order:
|
|
154
|
+
|
|
155
|
+
1. **Project description** (highest priority)
|
|
156
|
+
2. **AI questionnaire** responses
|
|
157
|
+
3. **Project outline** information
|
|
158
|
+
4. **"Untitled Project"** (fallback when no context is available)
|
|
159
|
+
|
|
160
|
+
#### Usage Examples
|
|
161
|
+
|
|
162
|
+
```typescript
|
|
163
|
+
// Create project without title - API will auto-generate
|
|
164
|
+
const newProject = await codeGuide.project.createProject({
|
|
165
|
+
description: "A todo app built with React and Node.js",
|
|
166
|
+
tools_selected: ["React", "Node.js", "MongoDB"]
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
// The API will generate a title like "React Node.js Todo Application"
|
|
170
|
+
console.log(newProject.title) // Auto-generated title
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### Generated Title Examples
|
|
174
|
+
|
|
175
|
+
- Input: "A todo app built with React and Node.js" → "React Node.js Todo Application"
|
|
176
|
+
- Input: "Mobile banking app with biometric authentication" → "Mobile Banking App Biometric Authentication"
|
|
177
|
+
- Empty description with questionnaire → "Untitled Project" (fallback)
|
|
178
|
+
|
|
125
179
|
## Usage Examples
|
|
126
180
|
|
|
127
181
|
### Basic Filtering
|
|
@@ -12,6 +12,8 @@ import {
|
|
|
12
12
|
GetProjectDocumentsResponse,
|
|
13
13
|
ConnectRepositoryRequest,
|
|
14
14
|
ConnectRepositoryResponse,
|
|
15
|
+
GetAiToolsRequest,
|
|
16
|
+
GetAiToolsResponse,
|
|
15
17
|
} from './project-types'
|
|
16
18
|
|
|
17
19
|
export class ProjectService extends BaseService {
|
|
@@ -49,7 +51,7 @@ export class ProjectService extends BaseService {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
async createProject(request: CreateProjectRequest): Promise<Project> {
|
|
52
|
-
const response = await this.post<ProjectResponse>('/projects', request)
|
|
54
|
+
const response = await this.post<ProjectResponse>('/projects/', request)
|
|
53
55
|
return response.data
|
|
54
56
|
}
|
|
55
57
|
|
|
@@ -76,6 +78,13 @@ export class ProjectService extends BaseService {
|
|
|
76
78
|
return this.get<GetProjectDocumentsResponse>(url)
|
|
77
79
|
}
|
|
78
80
|
|
|
81
|
+
async getDocumentsByType(
|
|
82
|
+
projectId: string,
|
|
83
|
+
documentType: string
|
|
84
|
+
): Promise<GetProjectDocumentsResponse> {
|
|
85
|
+
return this.get<GetProjectDocumentsResponse>(`/projects/${projectId}/documents/type/${documentType}`)
|
|
86
|
+
}
|
|
87
|
+
|
|
79
88
|
async connectRepository(
|
|
80
89
|
projectId: string,
|
|
81
90
|
request: ConnectRepositoryRequest
|
|
@@ -110,4 +119,14 @@ export class ProjectService extends BaseService {
|
|
|
110
119
|
throw new Error('GitHub token must be a valid personal access token')
|
|
111
120
|
}
|
|
112
121
|
}
|
|
122
|
+
|
|
123
|
+
async getAiTools(params?: GetAiToolsRequest): Promise<GetAiToolsResponse> {
|
|
124
|
+
const queryParams = new URLSearchParams()
|
|
125
|
+
|
|
126
|
+
if (params?.key) queryParams.append('key', params.key)
|
|
127
|
+
if (params?.category) queryParams.append('category', params.category)
|
|
128
|
+
|
|
129
|
+
const url = `/ai-tools${queryParams.toString() ? `?${queryParams.toString()}` : ''}`
|
|
130
|
+
return this.get<GetAiToolsResponse>(url)
|
|
131
|
+
}
|
|
113
132
|
}
|