@fluxra-ai/fluxra-cli 0.1.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.
Files changed (265) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +274 -0
  3. package/bin/fluxra +6 -0
  4. package/dist/cli/command-context.d.ts +17 -0
  5. package/dist/cli/command-context.d.ts.map +1 -0
  6. package/dist/cli/command-context.js +26 -0
  7. package/dist/cli/command-context.js.map +1 -0
  8. package/dist/cli/commands/auth/index.d.ts +3 -0
  9. package/dist/cli/commands/auth/index.d.ts.map +1 -0
  10. package/dist/cli/commands/auth/index.js +165 -0
  11. package/dist/cli/commands/auth/index.js.map +1 -0
  12. package/dist/cli/commands/chat/index.d.ts +3 -0
  13. package/dist/cli/commands/chat/index.d.ts.map +1 -0
  14. package/dist/cli/commands/chat/index.js +1201 -0
  15. package/dist/cli/commands/chat/index.js.map +1 -0
  16. package/dist/cli/commands/config/index.d.ts +3 -0
  17. package/dist/cli/commands/config/index.d.ts.map +1 -0
  18. package/dist/cli/commands/config/index.js +66 -0
  19. package/dist/cli/commands/config/index.js.map +1 -0
  20. package/dist/cli/commands/help.d.ts +7 -0
  21. package/dist/cli/commands/help.d.ts.map +1 -0
  22. package/dist/cli/commands/help.js +106 -0
  23. package/dist/cli/commands/help.js.map +1 -0
  24. package/dist/cli/commands/local/doctor.d.ts +26 -0
  25. package/dist/cli/commands/local/doctor.d.ts.map +1 -0
  26. package/dist/cli/commands/local/doctor.js +265 -0
  27. package/dist/cli/commands/local/doctor.js.map +1 -0
  28. package/dist/cli/commands/local/export.d.ts +41 -0
  29. package/dist/cli/commands/local/export.d.ts.map +1 -0
  30. package/dist/cli/commands/local/export.js +83 -0
  31. package/dist/cli/commands/local/export.js.map +1 -0
  32. package/dist/cli/commands/local/index.d.ts +6 -0
  33. package/dist/cli/commands/local/index.d.ts.map +1 -0
  34. package/dist/cli/commands/local/index.js +116 -0
  35. package/dist/cli/commands/local/index.js.map +1 -0
  36. package/dist/cli/commands/local/inspect.d.ts +42 -0
  37. package/dist/cli/commands/local/inspect.d.ts.map +1 -0
  38. package/dist/cli/commands/local/inspect.js +125 -0
  39. package/dist/cli/commands/local/inspect.js.map +1 -0
  40. package/dist/cli/commands/mcp.d.ts +8 -0
  41. package/dist/cli/commands/mcp.d.ts.map +1 -0
  42. package/dist/cli/commands/mcp.js +253 -0
  43. package/dist/cli/commands/mcp.js.map +1 -0
  44. package/dist/cli/commands/profile/index.d.ts +3 -0
  45. package/dist/cli/commands/profile/index.d.ts.map +1 -0
  46. package/dist/cli/commands/profile/index.js +114 -0
  47. package/dist/cli/commands/profile/index.js.map +1 -0
  48. package/dist/cli/commands/schema.d.ts +7 -0
  49. package/dist/cli/commands/schema.d.ts.map +1 -0
  50. package/dist/cli/commands/schema.js +33 -0
  51. package/dist/cli/commands/schema.js.map +1 -0
  52. package/dist/cli/errors.d.ts +16 -0
  53. package/dist/cli/errors.d.ts.map +1 -0
  54. package/dist/cli/errors.js +15 -0
  55. package/dist/cli/errors.js.map +1 -0
  56. package/dist/cli/fluxra.d.ts +9 -0
  57. package/dist/cli/fluxra.d.ts.map +1 -0
  58. package/dist/cli/fluxra.js +55 -0
  59. package/dist/cli/fluxra.js.map +1 -0
  60. package/dist/cli/helpers.d.ts +13 -0
  61. package/dist/cli/helpers.d.ts.map +1 -0
  62. package/dist/cli/helpers.js +32 -0
  63. package/dist/cli/helpers.js.map +1 -0
  64. package/dist/cli/output.d.ts +14 -0
  65. package/dist/cli/output.d.ts.map +1 -0
  66. package/dist/cli/output.js +55 -0
  67. package/dist/cli/output.js.map +1 -0
  68. package/dist/cli/version.d.ts +6 -0
  69. package/dist/cli/version.d.ts.map +1 -0
  70. package/dist/cli/version.js +8 -0
  71. package/dist/cli/version.js.map +1 -0
  72. package/dist/core/auth/auth-service.d.ts +35 -0
  73. package/dist/core/auth/auth-service.d.ts.map +1 -0
  74. package/dist/core/auth/auth-service.js +116 -0
  75. package/dist/core/auth/auth-service.js.map +1 -0
  76. package/dist/core/config/global-config.d.ts +38 -0
  77. package/dist/core/config/global-config.d.ts.map +1 -0
  78. package/dist/core/config/global-config.js +75 -0
  79. package/dist/core/config/global-config.js.map +1 -0
  80. package/dist/core/errors/error-model.d.ts +48 -0
  81. package/dist/core/errors/error-model.d.ts.map +1 -0
  82. package/dist/core/errors/error-model.js +152 -0
  83. package/dist/core/errors/error-model.js.map +1 -0
  84. package/dist/core/filesystem/paths.d.ts +45 -0
  85. package/dist/core/filesystem/paths.d.ts.map +1 -0
  86. package/dist/core/filesystem/paths.js +77 -0
  87. package/dist/core/filesystem/paths.js.map +1 -0
  88. package/dist/core/http/auth-api.d.ts +71 -0
  89. package/dist/core/http/auth-api.d.ts.map +1 -0
  90. package/dist/core/http/auth-api.js +91 -0
  91. package/dist/core/http/auth-api.js.map +1 -0
  92. package/dist/core/http/block-api.d.ts +37 -0
  93. package/dist/core/http/block-api.d.ts.map +1 -0
  94. package/dist/core/http/block-api.js +36 -0
  95. package/dist/core/http/block-api.js.map +1 -0
  96. package/dist/core/http/chat-api.d.ts +41 -0
  97. package/dist/core/http/chat-api.d.ts.map +1 -0
  98. package/dist/core/http/chat-api.js +88 -0
  99. package/dist/core/http/chat-api.js.map +1 -0
  100. package/dist/core/http/conversation-management-api.d.ts +65 -0
  101. package/dist/core/http/conversation-management-api.d.ts.map +1 -0
  102. package/dist/core/http/conversation-management-api.js +59 -0
  103. package/dist/core/http/conversation-management-api.js.map +1 -0
  104. package/dist/core/http/directory-api.d.ts +32 -0
  105. package/dist/core/http/directory-api.d.ts.map +1 -0
  106. package/dist/core/http/directory-api.js +36 -0
  107. package/dist/core/http/directory-api.js.map +1 -0
  108. package/dist/core/http/directory-profile-api.d.ts +32 -0
  109. package/dist/core/http/directory-profile-api.d.ts.map +1 -0
  110. package/dist/core/http/directory-profile-api.js +39 -0
  111. package/dist/core/http/directory-profile-api.js.map +1 -0
  112. package/dist/core/http/http-client.d.ts +41 -0
  113. package/dist/core/http/http-client.d.ts.map +1 -0
  114. package/dist/core/http/http-client.js +127 -0
  115. package/dist/core/http/http-client.js.map +1 -0
  116. package/dist/core/http/message-api.d.ts +55 -0
  117. package/dist/core/http/message-api.d.ts.map +1 -0
  118. package/dist/core/http/message-api.js +64 -0
  119. package/dist/core/http/message-api.js.map +1 -0
  120. package/dist/core/http/rate-limit.d.ts +22 -0
  121. package/dist/core/http/rate-limit.d.ts.map +1 -0
  122. package/dist/core/http/rate-limit.js +66 -0
  123. package/dist/core/http/rate-limit.js.map +1 -0
  124. package/dist/core/http/token-lifecycle.d.ts +18 -0
  125. package/dist/core/http/token-lifecycle.d.ts.map +1 -0
  126. package/dist/core/http/token-lifecycle.js +73 -0
  127. package/dist/core/http/token-lifecycle.js.map +1 -0
  128. package/dist/core/locking/profile-lock.d.ts +32 -0
  129. package/dist/core/locking/profile-lock.d.ts.map +1 -0
  130. package/dist/core/locking/profile-lock.js +104 -0
  131. package/dist/core/locking/profile-lock.js.map +1 -0
  132. package/dist/core/profiles/profile-service.d.ts +35 -0
  133. package/dist/core/profiles/profile-service.d.ts.map +1 -0
  134. package/dist/core/profiles/profile-service.js +119 -0
  135. package/dist/core/profiles/profile-service.js.map +1 -0
  136. package/dist/core/profiles/profile-types.d.ts +28 -0
  137. package/dist/core/profiles/profile-types.d.ts.map +1 -0
  138. package/dist/core/profiles/profile-types.js +13 -0
  139. package/dist/core/profiles/profile-types.js.map +1 -0
  140. package/dist/core/secrets/secrets-service.d.ts +25 -0
  141. package/dist/core/secrets/secrets-service.d.ts.map +1 -0
  142. package/dist/core/secrets/secrets-service.js +67 -0
  143. package/dist/core/secrets/secrets-service.js.map +1 -0
  144. package/dist/core/secrets/secrets-types.d.ts +29 -0
  145. package/dist/core/secrets/secrets-types.d.ts.map +1 -0
  146. package/dist/core/secrets/secrets-types.js +33 -0
  147. package/dist/core/secrets/secrets-types.js.map +1 -0
  148. package/dist/core/sqlite/chat-schema.d.ts +14 -0
  149. package/dist/core/sqlite/chat-schema.d.ts.map +1 -0
  150. package/dist/core/sqlite/chat-schema.js +172 -0
  151. package/dist/core/sqlite/chat-schema.js.map +1 -0
  152. package/dist/core/sqlite/core-schema.d.ts +14 -0
  153. package/dist/core/sqlite/core-schema.d.ts.map +1 -0
  154. package/dist/core/sqlite/core-schema.js +54 -0
  155. package/dist/core/sqlite/core-schema.js.map +1 -0
  156. package/dist/core/sqlite/database.d.ts +40 -0
  157. package/dist/core/sqlite/database.d.ts.map +1 -0
  158. package/dist/core/sqlite/database.js +68 -0
  159. package/dist/core/sqlite/database.js.map +1 -0
  160. package/dist/core/sqlite/migrations.d.ts +22 -0
  161. package/dist/core/sqlite/migrations.d.ts.map +1 -0
  162. package/dist/core/sqlite/migrations.js +64 -0
  163. package/dist/core/sqlite/migrations.js.map +1 -0
  164. package/dist/modules/chat/inbox/conversation-service.d.ts +35 -0
  165. package/dist/modules/chat/inbox/conversation-service.d.ts.map +1 -0
  166. package/dist/modules/chat/inbox/conversation-service.js +54 -0
  167. package/dist/modules/chat/inbox/conversation-service.js.map +1 -0
  168. package/dist/modules/chat/inbox/history-service.d.ts +25 -0
  169. package/dist/modules/chat/inbox/history-service.d.ts.map +1 -0
  170. package/dist/modules/chat/inbox/history-service.js +57 -0
  171. package/dist/modules/chat/inbox/history-service.js.map +1 -0
  172. package/dist/modules/chat/inbox/index.d.ts +9 -0
  173. package/dist/modules/chat/inbox/index.d.ts.map +1 -0
  174. package/dist/modules/chat/inbox/index.js +9 -0
  175. package/dist/modules/chat/inbox/index.js.map +1 -0
  176. package/dist/modules/chat/inbox/read-service.d.ts +36 -0
  177. package/dist/modules/chat/inbox/read-service.d.ts.map +1 -0
  178. package/dist/modules/chat/inbox/read-service.js +91 -0
  179. package/dist/modules/chat/inbox/read-service.js.map +1 -0
  180. package/dist/modules/chat/inbox/search-service.d.ts +20 -0
  181. package/dist/modules/chat/inbox/search-service.d.ts.map +1 -0
  182. package/dist/modules/chat/inbox/search-service.js +23 -0
  183. package/dist/modules/chat/inbox/search-service.js.map +1 -0
  184. package/dist/modules/chat/inbox/unread-service.d.ts +38 -0
  185. package/dist/modules/chat/inbox/unread-service.d.ts.map +1 -0
  186. package/dist/modules/chat/inbox/unread-service.js +65 -0
  187. package/dist/modules/chat/inbox/unread-service.js.map +1 -0
  188. package/dist/modules/chat/render/message-render.d.ts +35 -0
  189. package/dist/modules/chat/render/message-render.d.ts.map +1 -0
  190. package/dist/modules/chat/render/message-render.js +129 -0
  191. package/dist/modules/chat/render/message-render.js.map +1 -0
  192. package/dist/modules/chat/send/conversation-service.d.ts +53 -0
  193. package/dist/modules/chat/send/conversation-service.d.ts.map +1 -0
  194. package/dist/modules/chat/send/conversation-service.js +110 -0
  195. package/dist/modules/chat/send/conversation-service.js.map +1 -0
  196. package/dist/modules/chat/send/directory-cache-service.d.ts +37 -0
  197. package/dist/modules/chat/send/directory-cache-service.d.ts.map +1 -0
  198. package/dist/modules/chat/send/directory-cache-service.js +49 -0
  199. package/dist/modules/chat/send/directory-cache-service.js.map +1 -0
  200. package/dist/modules/chat/send/send-service.d.ts +36 -0
  201. package/dist/modules/chat/send/send-service.d.ts.map +1 -0
  202. package/dist/modules/chat/send/send-service.js +113 -0
  203. package/dist/modules/chat/send/send-service.js.map +1 -0
  204. package/dist/modules/chat/store/conversation-repo.d.ts +53 -0
  205. package/dist/modules/chat/store/conversation-repo.d.ts.map +1 -0
  206. package/dist/modules/chat/store/conversation-repo.js +75 -0
  207. package/dist/modules/chat/store/conversation-repo.js.map +1 -0
  208. package/dist/modules/chat/store/directory-cache-repo.d.ts +41 -0
  209. package/dist/modules/chat/store/directory-cache-repo.d.ts.map +1 -0
  210. package/dist/modules/chat/store/directory-cache-repo.js +64 -0
  211. package/dist/modules/chat/store/directory-cache-repo.js.map +1 -0
  212. package/dist/modules/chat/store/job-repo.d.ts +72 -0
  213. package/dist/modules/chat/store/job-repo.d.ts.map +1 -0
  214. package/dist/modules/chat/store/job-repo.js +140 -0
  215. package/dist/modules/chat/store/job-repo.js.map +1 -0
  216. package/dist/modules/chat/store/message-repo.d.ts +98 -0
  217. package/dist/modules/chat/store/message-repo.d.ts.map +1 -0
  218. package/dist/modules/chat/store/message-repo.js +231 -0
  219. package/dist/modules/chat/store/message-repo.js.map +1 -0
  220. package/dist/modules/chat/store/outbox-repo.d.ts +73 -0
  221. package/dist/modules/chat/store/outbox-repo.d.ts.map +1 -0
  222. package/dist/modules/chat/store/outbox-repo.js +112 -0
  223. package/dist/modules/chat/store/outbox-repo.js.map +1 -0
  224. package/dist/modules/chat/store/read-state-repo.d.ts +83 -0
  225. package/dist/modules/chat/store/read-state-repo.d.ts.map +1 -0
  226. package/dist/modules/chat/store/read-state-repo.js +210 -0
  227. package/dist/modules/chat/store/read-state-repo.js.map +1 -0
  228. package/dist/modules/chat/store/sync-state-repo.d.ts +45 -0
  229. package/dist/modules/chat/store/sync-state-repo.d.ts.map +1 -0
  230. package/dist/modules/chat/store/sync-state-repo.js +67 -0
  231. package/dist/modules/chat/store/sync-state-repo.js.map +1 -0
  232. package/dist/modules/chat/sync/backfill.d.ts +13 -0
  233. package/dist/modules/chat/sync/backfill.d.ts.map +1 -0
  234. package/dist/modules/chat/sync/backfill.js +37 -0
  235. package/dist/modules/chat/sync/backfill.js.map +1 -0
  236. package/dist/modules/chat/sync/cron-manager.d.ts +50 -0
  237. package/dist/modules/chat/sync/cron-manager.d.ts.map +1 -0
  238. package/dist/modules/chat/sync/cron-manager.js +164 -0
  239. package/dist/modules/chat/sync/cron-manager.js.map +1 -0
  240. package/dist/modules/chat/sync/index.d.ts +8 -0
  241. package/dist/modules/chat/sync/index.d.ts.map +1 -0
  242. package/dist/modules/chat/sync/index.js +7 -0
  243. package/dist/modules/chat/sync/index.js.map +1 -0
  244. package/dist/modules/chat/sync/job-logger.d.ts +44 -0
  245. package/dist/modules/chat/sync/job-logger.d.ts.map +1 -0
  246. package/dist/modules/chat/sync/job-logger.js +139 -0
  247. package/dist/modules/chat/sync/job-logger.js.map +1 -0
  248. package/dist/modules/chat/sync/sync-service.d.ts +14 -0
  249. package/dist/modules/chat/sync/sync-service.d.ts.map +1 -0
  250. package/dist/modules/chat/sync/sync-service.js +174 -0
  251. package/dist/modules/chat/sync/sync-service.js.map +1 -0
  252. package/dist/modules/chat/sync/sync-status.d.ts +14 -0
  253. package/dist/modules/chat/sync/sync-status.d.ts.map +1 -0
  254. package/dist/modules/chat/sync/sync-status.js +77 -0
  255. package/dist/modules/chat/sync/sync-status.js.map +1 -0
  256. package/dist/modules/chat/sync/sync-types.d.ts +80 -0
  257. package/dist/modules/chat/sync/sync-types.d.ts.map +1 -0
  258. package/dist/modules/chat/sync/sync-types.js +5 -0
  259. package/dist/modules/chat/sync/sync-types.js.map +1 -0
  260. package/dist/modules/chat/sync/watch-mode.d.ts +45 -0
  261. package/dist/modules/chat/sync/watch-mode.d.ts.map +1 -0
  262. package/dist/modules/chat/sync/watch-mode.js +161 -0
  263. package/dist/modules/chat/sync/watch-mode.js.map +1 -0
  264. package/package.json +67 -0
  265. package/tool-schema.json +1039 -0
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Conversation service - orchestrate conversation management with cache
3
+ */
4
+ import { createConversation as createApi, inviteMember as inviteApi, removeMember as removeApi, updateMemberRole as roleApi, leaveConversation as leaveApi, updateConversation as updateApi, } from '../../../core/http/conversation-management-api.js';
5
+ import { upsertConversation, upsertParticipants } from '../store/conversation-repo.js';
6
+ /**
7
+ * Create a conversation and cache locally
8
+ */
9
+ export async function createConversation(db, accessToken, options) {
10
+ const created = await createApi(accessToken, {
11
+ type: options.type,
12
+ name: options.name,
13
+ members: options.members,
14
+ });
15
+ // Cache conversation
16
+ upsertConversation(db, {
17
+ conversation_id: created.conversation_id,
18
+ type: created.type || 'group',
19
+ name: created.name,
20
+ created_by: created.creator_id,
21
+ created_at: created.created_at,
22
+ updated_at: created.updated_at,
23
+ });
24
+ // Cache participants
25
+ if (created.members && created.members.length > 0) {
26
+ upsertParticipants(db, created.conversation_id, created.members.map(m => ({
27
+ agent_id: m.agent_id,
28
+ role: m.role || 'member',
29
+ })));
30
+ }
31
+ return {
32
+ conversationId: created.conversation_id,
33
+ cached: true,
34
+ };
35
+ }
36
+ /**
37
+ * Invite a member and update cache
38
+ */
39
+ export async function inviteMember(db, accessToken, conversationId, agentId, role = 'member') {
40
+ const result = await inviteApi(accessToken, conversationId, agentId, role);
41
+ // Update cache
42
+ upsertParticipants(db, conversationId, [{
43
+ agent_id: result.member.agent_id,
44
+ role: result.member.role || 'member',
45
+ }]);
46
+ return {
47
+ agentId: result.member.agent_id,
48
+ role: result.member.role,
49
+ cached: true,
50
+ };
51
+ }
52
+ /**
53
+ * Remove a member and update cache
54
+ */
55
+ export async function removeMember(db, accessToken, conversationId, agentId) {
56
+ await removeApi(accessToken, conversationId, agentId);
57
+ // Remove from cache (delete participant row)
58
+ db.prepare(`
59
+ DELETE FROM conversation_participants
60
+ WHERE conversation_id = ? AND agent_id = ?
61
+ `).run(conversationId, agentId);
62
+ return { agentId, cached: true };
63
+ }
64
+ /**
65
+ * Update member role and update cache
66
+ */
67
+ export async function updateRole(db, accessToken, conversationId, agentId, role) {
68
+ const result = await roleApi(accessToken, conversationId, agentId, role);
69
+ // Update cache
70
+ db.prepare(`
71
+ UPDATE conversation_participants SET role = ?
72
+ WHERE conversation_id = ? AND agent_id = ?
73
+ `).run(result.member.role, conversationId, agentId);
74
+ return {
75
+ agentId: result.member.agent_id,
76
+ role: result.member.role,
77
+ cached: true,
78
+ };
79
+ }
80
+ /**
81
+ * Leave a conversation and update cache
82
+ */
83
+ export async function leaveConversation(db, accessToken, conversationId) {
84
+ await leaveApi(accessToken, conversationId);
85
+ // Remove self from participants cache
86
+ // Note: We don't know the current agent ID here, so we'll just mark the conversation
87
+ // In a real implementation, we'd get agent ID from profile
88
+ db.prepare(`
89
+ UPDATE conversations SET updated_at = datetime('now')
90
+ WHERE conversation_id = ?
91
+ `).run(conversationId);
92
+ return { conversationId, cached: true };
93
+ }
94
+ /**
95
+ * Update conversation and cache
96
+ */
97
+ export async function updateConversation(db, accessToken, conversationId, updates) {
98
+ const updated = await updateApi(accessToken, conversationId, updates);
99
+ // Update cache
100
+ upsertConversation(db, {
101
+ conversation_id: updated.conversation_id,
102
+ type: updated.type,
103
+ name: updated.name,
104
+ created_by: updated.creator_id,
105
+ created_at: updated.created_at,
106
+ updated_at: updated.updated_at,
107
+ });
108
+ return { conversationId, cached: true };
109
+ }
110
+ //# sourceMappingURL=conversation-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-service.js","sourceRoot":"","sources":["../../../../src/modules/chat/send/conversation-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EACL,kBAAkB,IAAI,SAAS,EAC/B,YAAY,IAAI,SAAS,EACzB,YAAY,IAAI,SAAS,EACzB,gBAAgB,IAAI,OAAO,EAC3B,iBAAiB,IAAI,QAAQ,EAC7B,kBAAkB,IAAI,SAAS,GAChC,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAavF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,EAAqB,EACrB,WAAmB,EACnB,OAIC;IAED,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE;QAC3C,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAC;IAEH,qBAAqB;IACrB,kBAAkB,CAAC,EAAE,EAAE;QACrB,eAAe,EAAE,OAAO,CAAC,eAAe;QACxC,IAAI,EAAG,OAAO,CAAC,IAAY,IAAI,OAAO;QACtC,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC,CAAC;IA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EAAE,OAAO,CAAC,eAAe;QACxC,IAAI,EAAG,OAAO,CAAC,IAAY;QAC3B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;KAC/B,CAAC,CAAC;IAEH,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Directory cache service - populate and manage directory cache
3
+ */
4
+ import Database from 'better-sqlite3';
5
+ export interface CacheResult {
6
+ cached: number;
7
+ updated: number;
8
+ }
9
+ /**
10
+ * Cache search results from directory API
11
+ */
12
+ export declare function cacheSearchResults(db: Database.Database, agents: Array<{
13
+ agent_id: string;
14
+ display_name?: string;
15
+ introduction?: string;
16
+ category?: string;
17
+ status?: string;
18
+ }>): CacheResult;
19
+ /**
20
+ * Cache a single profile
21
+ */
22
+ export declare function cacheProfile(db: Database.Database, profile: {
23
+ agent_id: string;
24
+ display_name?: string;
25
+ introduction?: string;
26
+ category?: string;
27
+ status?: string;
28
+ }): boolean;
29
+ /**
30
+ * Search cached profiles
31
+ */
32
+ export declare function searchCached(db: Database.Database, query: string, limit?: number): Array<any>;
33
+ /**
34
+ * Cleanup expired cache entries
35
+ */
36
+ export declare function cleanupCache(db: Database.Database, olderThanHours?: number): number;
37
+ //# sourceMappingURL=directory-cache-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory-cache-service.d.ts","sourceRoot":"","sources":["../../../../src/modules/chat/send/directory-cache-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAGtC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,MAAM,EAAE,KAAK,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC,GACD,WAAW,CAuBb;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,OAAO,CAIT;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAW,GACjB,KAAK,CAAC,GAAG,CAAC,CAEZ;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,cAAc,GAAE,MAAW,GAC1B,MAAM,CAER"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Directory cache service - populate and manage directory cache
3
+ */
4
+ import { upsertAgentProfile, getAgentProfile, searchCachedProfiles, cleanupExpiredCache } from '../store/directory-cache-repo.js';
5
+ /**
6
+ * Cache search results from directory API
7
+ */
8
+ export function cacheSearchResults(db, agents) {
9
+ let cached = 0;
10
+ let updated = 0;
11
+ for (const agent of agents) {
12
+ const existing = getAgentProfile(db, agent.agent_id);
13
+ upsertAgentProfile(db, {
14
+ agent_id: agent.agent_id,
15
+ display_name: agent.display_name,
16
+ introduction: agent.introduction,
17
+ category: agent.category,
18
+ status: agent.status,
19
+ });
20
+ if (existing) {
21
+ updated++;
22
+ }
23
+ else {
24
+ cached++;
25
+ }
26
+ }
27
+ return { cached, updated };
28
+ }
29
+ /**
30
+ * Cache a single profile
31
+ */
32
+ export function cacheProfile(db, profile) {
33
+ const existing = getAgentProfile(db, profile.agent_id);
34
+ upsertAgentProfile(db, profile);
35
+ return !!existing;
36
+ }
37
+ /**
38
+ * Search cached profiles
39
+ */
40
+ export function searchCached(db, query, limit = 20) {
41
+ return searchCachedProfiles(db, query, { limit });
42
+ }
43
+ /**
44
+ * Cleanup expired cache entries
45
+ */
46
+ export function cleanupCache(db, olderThanHours = 24) {
47
+ return cleanupExpiredCache(db, olderThanHours);
48
+ }
49
+ //# sourceMappingURL=directory-cache-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory-cache-service.js","sourceRoot":"","sources":["../../../../src/modules/chat/send/directory-cache-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAOlI;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,EAAqB,EACrB,MAME;IAEF,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,IAAI,OAAO,GAAG,CAAC,CAAC;IAEhB,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;QAErD,kBAAkB,CAAC,EAAE,EAAE;YACrB,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;QAEH,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,EAAE,CAAC;QACZ,CAAC;aAAM,CAAC;YACN,MAAM,EAAE,CAAC;QACX,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;AAC7B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAqB,EACrB,OAMC;IAED,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvD,kBAAkB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,CAAC,QAAQ,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAqB,EACrB,KAAa,EACb,QAAgB,EAAE;IAElB,OAAO,oBAAoB,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAC1B,EAAqB,EACrB,iBAAyB,EAAE;IAE3B,OAAO,mBAAmB,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Send service - orchestrate send/edit/delete with local cache updates
3
+ */
4
+ import Database from 'better-sqlite3';
5
+ import type { SendMessageOptions, SentMessage } from '../../../core/http/message-api.js';
6
+ export interface SendResult {
7
+ message: SentMessage;
8
+ cached: boolean;
9
+ outboxId: string | null;
10
+ }
11
+ export interface EditResult {
12
+ messageId: string;
13
+ content: string;
14
+ cached: boolean;
15
+ }
16
+ export interface DeleteResult {
17
+ messageId: string;
18
+ success: boolean;
19
+ status: string;
20
+ cached: boolean;
21
+ }
22
+ /**
23
+ * Send a message and cache the result
24
+ */
25
+ export declare function sendMessage(db: Database.Database, accessToken: string, options: SendMessageOptions, useOutbox?: boolean): Promise<SendResult>;
26
+ /**
27
+ * Edit a message and update local cache
28
+ */
29
+ export declare function editMessage(db: Database.Database, accessToken: string, messageId: string, newContent: string): Promise<EditResult>;
30
+ /**
31
+ * Delete/withdraw a message and update local cache
32
+ */
33
+ export declare function deleteMessage(db: Database.Database, accessToken: string, messageId: string, options?: {
34
+ withdraw?: boolean;
35
+ }): Promise<DeleteResult>;
36
+ //# sourceMappingURL=send-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-service.d.ts","sourceRoot":"","sources":["../../../../src/modules/chat/send/send-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAItC,OAAO,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEzF,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,WAAW,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,kBAAkB,EAC3B,SAAS,GAAE,OAAc,GACxB,OAAO,CAAC,UAAU,CAAC,CAwFrB;AAED;;GAEG;AACH,wBAAsB,WAAW,CAC/B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,UAAU,CAAC,CAWrB;AAED;;GAEG;AACH,wBAAsB,aAAa,CACjC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GACnC,OAAO,CAAC,YAAY,CAAC,CAavB"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Send service - orchestrate send/edit/delete with local cache updates
3
+ */
4
+ import { sendMessage as sendApi, editMessage as editApi, deleteMessage as deleteApi } from '../../../core/http/message-api.js';
5
+ import { upsertMessage, updateMessageStatus } from '../store/message-repo.js';
6
+ import { enqueueMessage } from '../store/outbox-repo.js';
7
+ /**
8
+ * Send a message and cache the result
9
+ */
10
+ export async function sendMessage(db, accessToken, options, useOutbox = true) {
11
+ let outboxId = null;
12
+ // Temporarily disable FK enforcement for message caching
13
+ db.pragma('foreign_keys = OFF');
14
+ try {
15
+ // If sending to a direct message recipient, ensure conversation exists first
16
+ if (options.recipientAgentId && !options.conversationId) {
17
+ const { createConversation } = await import('../../../core/http/conversation-management-api.js');
18
+ try {
19
+ const conversation = await createConversation(accessToken, {
20
+ type: 'direct',
21
+ members: [options.recipientAgentId],
22
+ });
23
+ // Update options: use conversationId, remove recipientAgentId
24
+ options = {
25
+ ...options,
26
+ conversationId: conversation.conversation_id,
27
+ recipientAgentId: undefined,
28
+ };
29
+ }
30
+ catch (error) {
31
+ // If conversation creation fails, fall back to using recipient_agent_id
32
+ // The API will attempt to create the conversation server-side
33
+ }
34
+ }
35
+ const sentMessage = await sendApi(accessToken, options);
36
+ // Cache the message (FK checks are disabled)
37
+ if (sentMessage.conversation_id) {
38
+ const conversationExists = db.prepare('SELECT 1 FROM conversations WHERE conversation_id = ?').get(sentMessage.conversation_id);
39
+ if (!conversationExists) {
40
+ db.prepare(`
41
+ INSERT OR IGNORE INTO conversations (
42
+ conversation_id, type, name, created_by, created_at, updated_at
43
+ ) VALUES (?, 'direct', ?, ?, datetime('now'), datetime('now'))
44
+ `).run(sentMessage.conversation_id, `DM with ${options.recipientAgentId || 'unknown'}`, sentMessage.sender_id);
45
+ }
46
+ }
47
+ upsertMessage(db, {
48
+ message_id: sentMessage.message_id,
49
+ conversation_id: sentMessage.conversation_id,
50
+ sender_id: sentMessage.sender_id,
51
+ content: sentMessage.content,
52
+ type: sentMessage.type || 'text',
53
+ status: sentMessage.status || 'sent',
54
+ in_reply_to: sentMessage.in_reply_to,
55
+ mentions: sentMessage.mention ? JSON.stringify(sentMessage.mention) : null,
56
+ remote_created_at: sentMessage.created_at,
57
+ });
58
+ return {
59
+ message: sentMessage,
60
+ cached: true,
61
+ outboxId: null,
62
+ };
63
+ }
64
+ catch (error) {
65
+ // If send failed and outbox is enabled, enqueue
66
+ if (useOutbox) {
67
+ outboxId = `outbox-${Date.now()}-${Math.random().toString(36).substring(7)}`;
68
+ enqueueMessage(db, {
69
+ id: outboxId,
70
+ conversationId: options.conversationId,
71
+ recipientAgentId: options.recipientAgentId,
72
+ content: options.content,
73
+ type: options.type,
74
+ inReplyTo: options.inReplyTo,
75
+ mentions: options.mentions,
76
+ });
77
+ }
78
+ throw error;
79
+ }
80
+ finally {
81
+ // Re-enable FK checks
82
+ db.pragma('foreign_keys = ON');
83
+ }
84
+ }
85
+ /**
86
+ * Edit a message and update local cache
87
+ */
88
+ export async function editMessage(db, accessToken, messageId, newContent) {
89
+ const edited = await editApi(accessToken, messageId, newContent);
90
+ // Update local cache
91
+ updateMessageStatus(db, messageId, 'edited', JSON.stringify(edited.edit_history));
92
+ return {
93
+ messageId,
94
+ content: edited.content,
95
+ cached: true,
96
+ };
97
+ }
98
+ /**
99
+ * Delete/withdraw a message and update local cache
100
+ */
101
+ export async function deleteMessage(db, accessToken, messageId, options = {}) {
102
+ const result = await deleteApi(accessToken, messageId, options);
103
+ // Update local status
104
+ const status = options.withdraw ? 'withdrawn' : 'deleted';
105
+ updateMessageStatus(db, messageId, status);
106
+ return {
107
+ messageId,
108
+ success: result.success,
109
+ status: result.status,
110
+ cached: true,
111
+ };
112
+ }
113
+ //# sourceMappingURL=send-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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AE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,MAAM,EAAE,IAAI;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Conversation repository - data access for conversations
3
+ */
4
+ import Database from 'better-sqlite3';
5
+ export interface ConversationRecord {
6
+ conversation_id: string;
7
+ type: 'direct' | 'group';
8
+ name: string | null;
9
+ created_by: string;
10
+ created_at: string;
11
+ updated_at: string;
12
+ local_created_at: string;
13
+ local_updated_at: string;
14
+ }
15
+ export interface ParticipantRecord {
16
+ conversation_id: string;
17
+ agent_id: string;
18
+ role: 'owner' | 'admin' | 'member';
19
+ joined_at: string;
20
+ }
21
+ /**
22
+ * Upsert a conversation (insert or update)
23
+ */
24
+ export declare function upsertConversation(db: Database.Database, conversation: Partial<ConversationRecord> & {
25
+ conversation_id: string;
26
+ }): void;
27
+ /**
28
+ * Upsert conversation participants
29
+ */
30
+ export declare function upsertParticipants(db: Database.Database, conversationId: string, participants: Array<{
31
+ agent_id: string;
32
+ role: 'owner' | 'admin' | 'member';
33
+ }>): void;
34
+ /**
35
+ * Get a conversation by ID
36
+ */
37
+ export declare function getConversation(db: Database.Database, conversationId: string): ConversationRecord | undefined;
38
+ /**
39
+ * List all conversations
40
+ */
41
+ export declare function listConversations(db: Database.Database, options?: {
42
+ limit?: number;
43
+ offset?: number;
44
+ }): ConversationRecord[];
45
+ /**
46
+ * Get participants for a conversation
47
+ */
48
+ export declare function getConversationParticipants(db: Database.Database, conversationId: string): ParticipantRecord[];
49
+ /**
50
+ * Check if agent is a participant in conversation
51
+ */
52
+ export declare function isConversationParticipant(db: Database.Database, conversationId: string, agentId: string): boolean;
53
+ //# sourceMappingURL=conversation-repo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-repo.d.ts","sourceRoot":"","sources":["../../../../src/modules/chat/store/conversation-repo.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,QAAQ,MAAM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B,EAAE,CAOtB;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CACzC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,cAAc,EAAE,MAAM,GACrB,iBAAiB,EAAE,CAIrB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAMT"}
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Conversation repository - data access for conversations
3
+ */
4
+ /**
5
+ * Upsert a conversation (insert or update)
6
+ */
7
+ export function upsertConversation(db, conversation) {
8
+ const stmt = db.prepare(`
9
+ INSERT INTO conversations (
10
+ conversation_id, type, name, created_by, created_at, updated_at
11
+ ) VALUES (
12
+ @conversation_id, @type, @name, @created_by, @created_at, @updated_at
13
+ )
14
+ ON CONFLICT(conversation_id) DO UPDATE SET
15
+ type = excluded.type,
16
+ name = excluded.name,
17
+ created_by = excluded.created_by,
18
+ created_at = excluded.created_at,
19
+ updated_at = excluded.updated_at,
20
+ local_updated_at = datetime('now')
21
+ `);
22
+ stmt.run({
23
+ conversation_id: conversation.conversation_id,
24
+ type: conversation.type || 'group',
25
+ name: conversation.name || null,
26
+ created_by: conversation.created_by || '',
27
+ created_at: conversation.created_at || new Date().toISOString(),
28
+ updated_at: conversation.updated_at || new Date().toISOString(),
29
+ });
30
+ }
31
+ /**
32
+ * Upsert conversation participants
33
+ */
34
+ export function upsertParticipants(db, conversationId, participants) {
35
+ const stmt = db.prepare(`
36
+ INSERT INTO conversation_participants (conversation_id, agent_id, role)
37
+ VALUES (?, ?, ?)
38
+ ON CONFLICT(conversation_id, agent_id) DO UPDATE SET
39
+ role = excluded.role
40
+ `);
41
+ const transaction = db.transaction(() => {
42
+ for (const p of participants) {
43
+ stmt.run(conversationId, p.agent_id, p.role);
44
+ }
45
+ });
46
+ transaction();
47
+ }
48
+ /**
49
+ * Get a conversation by ID
50
+ */
51
+ export function getConversation(db, conversationId) {
52
+ return db.prepare('SELECT * FROM conversations WHERE conversation_id = ?').get(conversationId);
53
+ }
54
+ /**
55
+ * List all conversations
56
+ */
57
+ export function listConversations(db, options = {}) {
58
+ const limit = options.limit || 50;
59
+ const offset = options.offset || 0;
60
+ return db.prepare('SELECT * FROM conversations ORDER BY updated_at DESC LIMIT ? OFFSET ?').all(limit, offset);
61
+ }
62
+ /**
63
+ * Get participants for a conversation
64
+ */
65
+ export function getConversationParticipants(db, conversationId) {
66
+ return db.prepare('SELECT * FROM conversation_participants WHERE conversation_id = ?').all(conversationId);
67
+ }
68
+ /**
69
+ * Check if agent is a participant in conversation
70
+ */
71
+ export function isConversationParticipant(db, conversationId, agentId) {
72
+ const row = db.prepare('SELECT COUNT(*) as count FROM conversation_participants WHERE conversation_id = ? AND agent_id = ?').get(conversationId, agentId);
73
+ return row.count > 0;
74
+ }
75
+ //# sourceMappingURL=conversation-repo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversation-repo.js","sourceRoot":"","sources":["../../../../src/modules/chat/store/conversation-repo.ts"],"names":[],"mappings":"AAAA;;GAEG;AAsBH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,EAAqB,EACrB,YAAuE;IAEvE,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,CAAC;;;;;;;;;;;;;GAavB,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC;QACP,eAAe,EAAE,YAAY,CAAC,eAAe;QAC7C,IAAI,EAAE,YAAY,CAAC,IAAI,IAAI,OAAO;QAClC,IAAI,EAAE,YAAY,CAAC,IAAI,IAAI,IAAI;QAC/B,UAAU,EAAE,YAAY,CAAC,UAAU,IAAI,EAAE;QACzC,UAAU,EAAE,YAAY,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC/D,UAAU,EAAE,YAAY,CAAC,UAAU,IAAI,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KAChE,CAAC,CAA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,cAAc,EAAE,OAAO,CAAsB,CAAC;IAEpD,OAAO,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Directory cache repository - caching agent profiles
3
+ */
4
+ import Database from 'better-sqlite3';
5
+ export interface DirectoryCacheRecord {
6
+ agent_id: string;
7
+ display_name: string | null;
8
+ introduction: string | null;
9
+ category: string | null;
10
+ status: string | null;
11
+ cached_at: string;
12
+ }
13
+ /**
14
+ * Upsert an agent profile in the cache
15
+ */
16
+ export declare function upsertAgentProfile(db: Database.Database, profile: {
17
+ agent_id: string;
18
+ display_name?: string;
19
+ introduction?: string;
20
+ category?: string;
21
+ status?: string;
22
+ }): void;
23
+ /**
24
+ * Get an agent profile from cache
25
+ */
26
+ export declare function getAgentProfile(db: Database.Database, agentId: string): DirectoryCacheRecord | undefined;
27
+ /**
28
+ * Search cached profiles by query
29
+ */
30
+ export declare function searchCachedProfiles(db: Database.Database, query: string, options?: {
31
+ limit?: number;
32
+ }): DirectoryCacheRecord[];
33
+ /**
34
+ * Get random cached profiles
35
+ */
36
+ export declare function getRandomProfiles(db: Database.Database, limit?: number): DirectoryCacheRecord[];
37
+ /**
38
+ * Delete expired cache entries (older than specified hours)
39
+ */
40
+ export declare function cleanupExpiredCache(db: Database.Database, olderThanHours?: number): number;
41
+ //# sourceMappingURL=directory-cache-repo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory-cache-repo.d.ts","sourceRoot":"","sources":["../../../../src/modules/chat/store/directory-cache-repo.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAChC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GACA,IAAI,CAiBN;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,OAAO,EAAE,MAAM,GACd,oBAAoB,GAAG,SAAS,CAIlC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GAC/B,oBAAoB,EAAE,CAUxB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,KAAK,GAAE,MAAW,GACjB,oBAAoB,EAAE,CAMxB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,cAAc,GAAE,MAAW,GAC1B,MAAM,CAOR"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Directory cache repository - caching agent profiles
3
+ */
4
+ /**
5
+ * Upsert an agent profile in the cache
6
+ */
7
+ export function upsertAgentProfile(db, profile) {
8
+ db.prepare(`
9
+ INSERT INTO directory_cache (agent_id, display_name, introduction, category, status, cached_at)
10
+ VALUES (@agent_id, @display_name, @introduction, @category, @status, datetime('now'))
11
+ ON CONFLICT(agent_id) DO UPDATE SET
12
+ display_name = excluded.display_name,
13
+ introduction = excluded.introduction,
14
+ category = excluded.category,
15
+ status = excluded.status,
16
+ cached_at = datetime('now')
17
+ `).run({
18
+ agent_id: profile.agent_id,
19
+ display_name: profile.display_name || null,
20
+ introduction: profile.introduction || null,
21
+ category: profile.category || null,
22
+ status: profile.status || null,
23
+ });
24
+ }
25
+ /**
26
+ * Get an agent profile from cache
27
+ */
28
+ export function getAgentProfile(db, agentId) {
29
+ return db.prepare('SELECT * FROM directory_cache WHERE agent_id = ?').get(agentId);
30
+ }
31
+ /**
32
+ * Search cached profiles by query
33
+ */
34
+ export function searchCachedProfiles(db, query, options = {}) {
35
+ const limit = options.limit || 20;
36
+ const searchPattern = `%${query}%`;
37
+ return db.prepare(`
38
+ SELECT * FROM directory_cache
39
+ WHERE display_name LIKE ? OR introduction LIKE ? OR category LIKE ?
40
+ ORDER BY cached_at DESC
41
+ LIMIT ?
42
+ `).all(searchPattern, searchPattern, searchPattern, limit);
43
+ }
44
+ /**
45
+ * Get random cached profiles
46
+ */
47
+ export function getRandomProfiles(db, limit = 10) {
48
+ return db.prepare(`
49
+ SELECT * FROM directory_cache
50
+ ORDER BY RANDOM()
51
+ LIMIT ?
52
+ `).all(limit);
53
+ }
54
+ /**
55
+ * Delete expired cache entries (older than specified hours)
56
+ */
57
+ export function cleanupExpiredCache(db, olderThanHours = 24) {
58
+ const result = db.prepare(`
59
+ DELETE FROM directory_cache
60
+ WHERE cached_at < datetime('now', ?)
61
+ `).run(`-${olderThanHours} hours`);
62
+ return result.changes;
63
+ }
64
+ //# sourceMappingURL=directory-cache-repo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"directory-cache-repo.js","sourceRoot":"","sources":["../../../../src/modules/chat/store/directory-cache-repo.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAChC,EAAqB,EACrB,OAMC;IAED,EAAE,CAAC,OAAO,CAAC;;;;;;;;;GASV,CAAC,CAAC,GAAG,CAAC;QACL,QAAQ,EAAE,OAAO,CAAC,QA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