@dubeyvishal/orbital-cli 1.0.3 → 1.0.4

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.
Files changed (38) hide show
  1. package/README.md +13 -0
  2. package/package.json +10 -7
  3. package/server/{src/cli/ai → ai}/googleService.js +1 -1
  4. package/server/{src/cli/chat → chat}/chat-with-ai-agent.js +21 -22
  5. package/server/{src/cli/chat → chat}/chat-with-ai-tools.js +22 -21
  6. package/server/{src/cli/chat → chat}/chat-with-ai.js +21 -18
  7. package/server/{src/cli/commands → commands}/General/openApp.js +8 -30
  8. package/server/{src/cli/commands → commands}/ai/wakeUp.js +19 -28
  9. package/server/{src/cli/commands → commands}/auth/aboutMe.js +1 -1
  10. package/server/{src/cli/commands → commands}/auth/login.js +1 -1
  11. package/server/{src/cli/commands → commands}/auth/logout.js +1 -1
  12. package/server/{src/cli/commands → commands}/config/setkey.js +1 -1
  13. package/server/config/env.js +20 -0
  14. package/server/{src/cli/main.js → main.js} +2 -2
  15. package/server/utils/apiClient.js +40 -0
  16. package/server/utils/chatServiceClient.js +73 -0
  17. package/server/prisma/migrations/20260105143219_test_migration/migration.sql +0 -7
  18. package/server/prisma/migrations/20260105151026_authentication/migration.sql +0 -78
  19. package/server/prisma/migrations/20260114105919_add_devicecode_conversation_message/migration.sql +0 -50
  20. package/server/prisma/migrations/migration_lock.toml +0 -3
  21. package/server/prisma/schema.prisma +0 -117
  22. package/server/src/config/env.js +0 -100
  23. package/server/src/index.js +0 -102
  24. package/server/src/lib/auth.js +0 -37
  25. package/server/src/lib/db.js +0 -18
  26. package/server/src/lib/dbHealth.js +0 -106
  27. package/server/src/prisma/migrations/20260107093841_device_flow/migration.sql +0 -94
  28. package/server/src/prisma/migrations/migration_lock.toml +0 -3
  29. package/server/src/prisma/schema.prisma +0 -115
  30. package/server/src/service/chatService.js +0 -156
  31. /package/server/{src/cli/commands → commands}/General/playSong.js +0 -0
  32. /package/server/{src/cli/commands → commands}/General/searchYoutube.js +0 -0
  33. /package/server/{src/config → config}/agentConfig.js +0 -0
  34. /package/server/{src/config → config}/googleConfig.js +0 -0
  35. /package/server/{src/config → config}/toolConfig.js +0 -0
  36. /package/server/{src/cli/generalApp → generalApp}/Apps.js +0 -0
  37. /package/server/{src/lib → utils}/orbitalConfig.js +0 -0
  38. /package/server/{src/lib → utils}/token.js +0 -0
@@ -1,115 +0,0 @@
1
-
2
- generator client {
3
- provider = "prisma-client-js"
4
- }
5
-
6
- datasource db {
7
- provider = "postgresql"
8
- url = env("DATABASE_URL")
9
- directUrl = env("DIRECT_DATABASE_URL")
10
- }
11
-
12
- model User {
13
- id String @id
14
- name String
15
- email String
16
- emailVerified Boolean @default(false)
17
- image String?
18
- createdAt DateTime @default(now())
19
- updatedAt DateTime @updatedAt
20
- sessions Session[]
21
- accounts Account[]
22
-
23
- conversation Conversation
24
-
25
- @@unique([email])
26
- @@map("user")
27
- }
28
-
29
- model Session {
30
- id String @id
31
- expiresAt DateTime
32
- token String
33
- createdAt DateTime @default(now())
34
- updatedAt DateTime @updatedAt
35
- ipAddress String?
36
- userAgent String?
37
- userId String
38
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
39
-
40
- @@unique([token])
41
- @@index([userId])
42
- @@map("session")
43
- }
44
-
45
- model Account {
46
- id String @id
47
- accountId String
48
- providerId String
49
- userId String
50
- user User @relation(fields: [userId], references: [id], onDelete: Cascade)
51
- accessToken String?
52
- refreshToken String?
53
- idToken String?
54
- accessTokenExpiresAt DateTime?
55
- refreshTokenExpiresAt DateTime?
56
- scope String?
57
- password String?
58
- createdAt DateTime @default(now())
59
- updatedAt DateTime @updatedAt
60
-
61
- @@index([userId])
62
- @@map("account")
63
- }
64
-
65
- model Verification {
66
- id String @id
67
- identifier String
68
- value String
69
- expiresAt DateTime
70
- createdAt DateTime @default(now())
71
- updatedAt DateTime @updatedAt
72
-
73
- @@index([identifier])
74
- @@map("verification")
75
- }
76
-
77
- model DeviceCode {
78
- id String @id
79
- deviceCode String
80
- userCode String
81
- userId String?
82
- expiresAt DateTime
83
- status String
84
- lastPolledAt DateTime?
85
- pollingInterval Int?
86
- clientId String?
87
- scope String?
88
-
89
- @@map("deviceCode")
90
- }
91
-
92
- model Conversation {
93
- id String @id @default(cuid())
94
- userId String
95
- title String
96
- mode String @default("chat")
97
- createdAt DateTime @default(now())
98
- updatedAt DateTime @default(now()) @updatedAt
99
-
100
- user User @relation(fields: [userId] , references : [id] , onDelete : Cascade)
101
- messages Message[]
102
- }
103
-
104
- model Message{
105
- id String @id @default(cuid())
106
- conversationId String
107
- role String
108
- content String
109
- createdAt DateTime() @default(now())
110
-
111
- conversation Conversation @relation(fields: [conversationId], references: [id], onDelete: Cascade)
112
-
113
-
114
- @@index([conversationId])
115
- }
@@ -1,156 +0,0 @@
1
- import prisma from "../lib/db.js";
2
-
3
- export class ChatService{
4
-
5
- /**
6
- * Create a new conversation
7
- * @param {string} userId - user id
8
- * @param {string} mode - chat tool , or agent
9
- * @param {string} title - Optional conversation title
10
- */
11
-
12
- async createConversation(userId , mode ="chat" , title=null){
13
- return prisma.conversation.create({
14
- data : {
15
- userId ,
16
- mode ,
17
- title : title || `New ${mode} conversation`
18
- }
19
- });
20
- }
21
-
22
- /**
23
- * get or create a new conversation for user
24
- * @param {string} userId - user id
25
- * @param {string} conversationalId - Optional conversation id
26
- * @param {string} mode - chat , tool or agent
27
- */
28
-
29
- async getOrCreateConversation(userId , conversationId =null , mode="chat"){
30
- if(conversationId){
31
- const conversation = await prisma.conversation.findFirst({
32
- where : {
33
- id: conversationId ,
34
- userId
35
- },
36
- include : {
37
- messages : {
38
- orderBy :{
39
- createdAt : "asc"
40
- }
41
- }
42
- }
43
- });
44
-
45
- if(conversation){
46
- return conversation ;
47
- }
48
- }
49
- return await this.createConversation(userId , mode)
50
- }
51
-
52
- /**
53
- * Add a new message to conversation
54
- * @param {string} conversationalId - conversation id
55
- * @param {string} role - user , assistant , system ,tool
56
- * @param {string | object} content - message content
57
- */
58
-
59
- async addMessage(conversationId , role , content){
60
-
61
- const contentStr = typeof content === "string" ? content :
62
- JSON.stringify(content);
63
-
64
- return await prisma.message.create({
65
- data :{
66
- conversationId ,
67
- role ,
68
- content : contentStr
69
- }
70
- })
71
- }
72
-
73
- /**
74
- * Get conversion messages
75
- * @param {string} conversationId - conversational -id
76
- */
77
-
78
- async getMessages(conversationId){
79
- const messages = await prisma.message.findMany({
80
- where : {conversationId},
81
- orderBy : {createdAt : "asc"}
82
- });
83
-
84
- return messages.map((msg) => ({
85
- ...msg,
86
- content: this.parseContent(msg.content),
87
- }));
88
- }
89
-
90
- /**
91
- * @param {string} userI - user id
92
- */
93
-
94
- async getUserConversation(userId){
95
- return await prisma.conversation.findMany({
96
- where : {userId} ,
97
- orderBy :{updatedAt : "desc"},
98
- include :{
99
- messages : {
100
- take : 1,
101
- orderBy : {createdAt : "desc"}
102
- },
103
- },
104
- });
105
- }
106
-
107
- /**
108
- * @param {string} conversationId - Conversation ID
109
- * @param {string} userId - User ID
110
- */
111
-
112
- async deleteConversation(conversationId , userId){
113
- return await prisma.conversation.deleteMany({
114
- where : {
115
- id : conversationId ,
116
- userId
117
- },
118
- });
119
- }
120
-
121
- /**
122
- * @param {string} conversationId - Conversation ID
123
- * @param {string} title - User ID
124
- */
125
-
126
- async updateTitle(conversationId , title){
127
- return await prisma.conversation.update({
128
- where : {id : conversationId},
129
- data : {title}
130
- });
131
- }
132
-
133
- /**
134
- * Helper to parse content ( json to string)
135
- */
136
-
137
- parseContent(content){
138
- try{
139
- return JSON.parse(content);
140
- }
141
- catch{
142
- return content
143
- }
144
- }
145
-
146
- /**
147
- * @param {Array} messages - database messages
148
- */
149
-
150
- formatMessageForAI(messages){
151
- return messages.map((msg)=>({
152
- role : msg.role ,
153
- content : typeof msg.content === "string" ? msg.content : JSON.stringify(msg.content),
154
- }));
155
- }
156
- }
File without changes
File without changes
File without changes
File without changes
File without changes