cognova 0.2.10 → 0.2.12

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 (114) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/_nuxt/builds/latest.json +1 -1
  3. package/.output/public/_nuxt/builds/meta/a892969f-e07d-4f44-8d7e-57a4b7f33d94.json +1 -0
  4. package/.output/server/chunks/build/CodeIcon-CWD5HcV7.mjs +1 -1
  5. package/.output/server/chunks/build/DropdownMenu-BBrV9nXz.mjs +1 -1
  6. package/.output/server/chunks/build/EditorToolbar-DIfb5arC.mjs +1 -1
  7. package/.output/server/chunks/build/Img-CWLmvN1t.mjs +1 -1
  8. package/.output/server/chunks/build/MDC-Dx0YPDhe.mjs +1 -1
  9. package/.output/server/chunks/build/Select-BB1oLrCD.mjs +1 -1
  10. package/.output/server/chunks/build/SelectMenu-DPssg6zD.mjs +1 -1
  11. package/.output/server/chunks/build/Table-DCwTlhCj.mjs +1 -1
  12. package/.output/server/chunks/build/Tooltip-TRyl6dje.mjs +1 -1
  13. package/.output/server/chunks/build/Tree-DUhXKd8y.mjs +1 -1
  14. package/.output/server/chunks/build/_uuid_-DfJaumTE.mjs +1 -1
  15. package/.output/server/chunks/build/cookie-C_iulBi6.mjs +1 -1
  16. package/.output/server/chunks/build/dashboard-CiVTAZuF.mjs +1 -1
  17. package/.output/server/chunks/build/docs-ChGwOPg5.mjs +1 -1
  18. package/.output/server/chunks/build/fetch-BB7Qzkwe.mjs +1 -1
  19. package/.output/server/chunks/build/index-CxDxc9fm.mjs +1 -1
  20. package/.output/server/chunks/build/server.mjs +1 -1
  21. package/.output/server/chunks/build/settings-B2KXoGcz.mjs +1 -1
  22. package/.output/server/chunks/build/styles.mjs +2 -2
  23. package/.output/server/chunks/build/useNotificationBus-BG5JNQf1.mjs +1 -1
  24. package/.output/server/chunks/build/view-n2sYa4Zh.mjs +1 -1
  25. package/.output/server/chunks/nitro/nitro.mjs +238 -217
  26. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  27. package/.output/server/chunks/routes/_ws/chat.mjs +1 -1
  28. package/.output/server/chunks/routes/api/bridges/_id/contacts.get.mjs +84 -0
  29. package/.output/server/chunks/routes/api/bridges/_id/contacts.get.mjs.map +1 -0
  30. package/.output/server/chunks/routes/api/bridges/_id/send.post.mjs +70 -0
  31. package/.output/server/chunks/routes/api/bridges/_id/send.post.mjs.map +1 -0
  32. package/.output/server/chunks/routes/api/bridges/context.get.mjs +19 -18
  33. package/.output/server/chunks/routes/api/bridges/context.get.mjs.map +1 -1
  34. package/.output/server/chunks/routes/api/conversations/_id_.delete.mjs +1 -1
  35. package/.output/server/chunks/routes/api/conversations/_id_.get.mjs +1 -1
  36. package/.output/server/chunks/routes/api/dashboard/overview.get.mjs +1 -1
  37. package/.output/server/chunks/routes/api/documents/_id/public.get.mjs +1 -1
  38. package/.output/server/chunks/routes/api/documents/_id/restore.post.mjs +1 -1
  39. package/.output/server/chunks/routes/api/documents/by-path.post.mjs +1 -1
  40. package/.output/server/chunks/routes/api/documents/index.delete.mjs +1 -1
  41. package/.output/server/chunks/routes/api/documents/index.put.mjs +1 -1
  42. package/.output/server/chunks/routes/api/fs/delete.post.mjs +1 -1
  43. package/.output/server/chunks/routes/api/fs/list.get.mjs +1 -1
  44. package/.output/server/chunks/routes/api/fs/mkdir.post.mjs +1 -1
  45. package/.output/server/chunks/routes/api/fs/move.post.mjs +1 -1
  46. package/.output/server/chunks/routes/api/fs/read.post.mjs +1 -1
  47. package/.output/server/chunks/routes/api/fs/rename.post.mjs +1 -1
  48. package/.output/server/chunks/routes/api/fs/write.post.mjs +1 -1
  49. package/.output/server/chunks/routes/api/health.get.mjs +1 -1
  50. package/.output/server/chunks/routes/api/home.get.mjs +1 -1
  51. package/.output/server/chunks/routes/api/hooks/index.get.mjs +1 -1
  52. package/.output/server/chunks/routes/api/hooks/index.post.mjs +1 -1
  53. package/.output/server/chunks/routes/api/hooks/stats.get.mjs +1 -1
  54. package/.output/server/chunks/routes/api/index.get10.mjs +1 -1
  55. package/.output/server/chunks/routes/api/index.get3.mjs +1 -1
  56. package/.output/server/chunks/routes/api/index.get4.mjs +1 -1
  57. package/.output/server/chunks/routes/api/index.get5.mjs +1 -1
  58. package/.output/server/chunks/routes/api/index.get6.mjs +1 -1
  59. package/.output/server/chunks/routes/api/index.get7.mjs +1 -1
  60. package/.output/server/chunks/routes/api/index.get8.mjs +1 -1
  61. package/.output/server/chunks/routes/api/index.get9.mjs +1 -1
  62. package/.output/server/chunks/routes/api/index.post3.mjs +1 -1
  63. package/.output/server/chunks/routes/api/index.post4.mjs +1 -1
  64. package/.output/server/chunks/routes/api/index.post5.mjs +1 -1
  65. package/.output/server/chunks/routes/api/index.put.mjs +1 -1
  66. package/.output/server/chunks/routes/api/memory/_id_.delete.mjs +1 -1
  67. package/.output/server/chunks/routes/api/memory/context.get.mjs +1 -1
  68. package/.output/server/chunks/routes/api/memory/extract.post.mjs +1 -1
  69. package/.output/server/chunks/routes/api/memory/search.get.mjs +1 -1
  70. package/.output/server/chunks/routes/api/memory/store.post.mjs +1 -1
  71. package/.output/server/chunks/routes/api/projects/index.delete.mjs +1 -1
  72. package/.output/server/chunks/routes/api/projects/index.get.mjs +1 -1
  73. package/.output/server/chunks/routes/api/projects/index.put.mjs +1 -1
  74. package/.output/server/chunks/routes/api/secrets/_key_.delete.mjs +1 -1
  75. package/.output/server/chunks/routes/api/secrets/_key_.get.mjs +1 -1
  76. package/.output/server/chunks/routes/api/secrets/_key_.put.mjs +1 -1
  77. package/.output/server/chunks/routes/api/skills/_name/delete.post.mjs +1 -1
  78. package/.output/server/chunks/routes/api/skills/_name/export.get.mjs +1 -1
  79. package/.output/server/chunks/routes/api/skills/_name/files/create.post.mjs +1 -1
  80. package/.output/server/chunks/routes/api/skills/_name/files/delete.post.mjs +1 -1
  81. package/.output/server/chunks/routes/api/skills/_name/files/read.post.mjs +1 -1
  82. package/.output/server/chunks/routes/api/skills/_name/files/write.post.mjs +1 -1
  83. package/.output/server/chunks/routes/api/skills/_name/index.get.mjs +1 -1
  84. package/.output/server/chunks/routes/api/skills/_name/rename.post.mjs +1 -1
  85. package/.output/server/chunks/routes/api/skills/_name/toggle.post.mjs +1 -1
  86. package/.output/server/chunks/routes/api/skills/create.post.mjs +1 -1
  87. package/.output/server/chunks/routes/api/skills/generate.post.mjs +1 -1
  88. package/.output/server/chunks/routes/api/skills/import.post.mjs +1 -1
  89. package/.output/server/chunks/routes/api/skills/index.get.mjs +1 -1
  90. package/.output/server/chunks/routes/api/skills/index.get2.mjs +1 -1
  91. package/.output/server/chunks/routes/api/skills/library/check-updates.get.mjs +1 -1
  92. package/.output/server/chunks/routes/api/skills/library/install.post.mjs +1 -1
  93. package/.output/server/chunks/routes/api/tasks/_id/restore.post.mjs +1 -1
  94. package/.output/server/chunks/routes/api/tasks/index.delete.mjs +1 -1
  95. package/.output/server/chunks/routes/api/tasks/index.put.mjs +1 -1
  96. package/.output/server/chunks/routes/api/tasks/tags.get.mjs +1 -1
  97. package/.output/server/chunks/routes/api/usage/stats.get.mjs +1 -1
  98. package/.output/server/chunks/routes/api/user/email.patch.mjs +1 -1
  99. package/.output/server/chunks/routes/api/webhooks/bluebubbles.post.mjs +1 -1
  100. package/.output/server/chunks/routes/api/webhooks/telegram.post.mjs +1 -1
  101. package/.output/server/chunks/routes/notifications.mjs +1 -1
  102. package/.output/server/chunks/routes/renderer.mjs +1 -1
  103. package/.output/server/chunks/routes/terminal.mjs +1 -1
  104. package/.output/server/index.mjs +1 -1
  105. package/.output/server/package.json +1 -1
  106. package/Claude/hooks/session-start.py +23 -0
  107. package/Claude/skills/bridge/SKILL.md +25 -1
  108. package/Claude/skills/bridge/bridge.py +64 -0
  109. package/package.json +1 -1
  110. package/server/api/bridges/[id]/contacts.get.ts +57 -0
  111. package/server/api/bridges/[id]/send.post.ts +40 -0
  112. package/server/api/bridges/context.get.ts +19 -18
  113. package/server/bridge/responder.ts +32 -4
  114. package/.output/public/_nuxt/builds/meta/def74b99-d70c-4f30-aa29-70248cbeac7d.json +0 -1
@@ -19,20 +19,22 @@ const platformLabels: Record<BridgePlatform, string> = {
19
19
 
20
20
  const allPlatforms: BridgePlatform[] = ['telegram', 'discord', 'imessage', 'google', 'email']
21
21
 
22
- function formatTelegramContext(config: TelegramBridgeConfig | null): string {
22
+ function formatTelegramContext(config: TelegramBridgeConfig | null, bridgeId: string): string {
23
23
  const lines = [
24
24
  'You can send and receive Telegram messages.',
25
- '- Incoming messages from Telegram users are routed to you as conversations.',
26
- '- To send a message, use the bridge API or /bridge skill.'
25
+ '- Incoming messages are routed to you automatically.',
26
+ `- To send a message: use \`/bridge\` skill → \`contacts ${bridgeId}\` to find the recipient, then \`send ${bridgeId} -r <ID> -t "message"\``,
27
+ `- To list contacts: \`/bridge\` skill → \`contacts ${bridgeId}\``
27
28
  ]
28
29
  if (config?.botUsername)
29
30
  lines.push(`- Bot username: @${config.botUsername}`)
30
31
  return lines.join('\n')
31
32
  }
32
33
 
33
- function formatDiscordContext(config: DiscordBridgeConfig | null): string {
34
+ function formatDiscordContext(config: DiscordBridgeConfig | null, bridgeId: string): string {
34
35
  const lines = [
35
- 'You can send and receive Discord messages.'
36
+ 'You can send and receive Discord messages.',
37
+ `- To send: \`/bridge\` skill → \`contacts ${bridgeId}\` to find recipient, then \`send ${bridgeId} -r <ID> -t "message"\``
36
38
  ]
37
39
  const mode = config?.listenMode || 'mentions'
38
40
  if (mode === 'dm')
@@ -44,17 +46,16 @@ function formatDiscordContext(config: DiscordBridgeConfig | null): string {
44
46
  return lines.join('\n')
45
47
  }
46
48
 
47
- function formatIMessageContext(config: IMessageBridgeConfig | null): string {
49
+ function formatIMessageContext(config: IMessageBridgeConfig | null, bridgeId: string): string {
48
50
  const strategy = config?.strategy || 'imsg'
49
51
  const lines = [
50
52
  `You can send and receive iMessages (via ${strategy === 'imsg' ? 'local imsg CLI' : 'remote BlueBubbles'}).`,
51
- '- Incoming iMessages are routed to you as conversations.'
53
+ '- Incoming iMessages are routed to you automatically.'
52
54
  ]
53
- if (strategy === 'imsg') {
55
+ if (strategy === 'imsg')
54
56
  lines.push('- Send via: `imsg send "<number>" "<message>"`')
55
- } else {
56
- lines.push('- Send via the bridge API (BlueBubbles REST).')
57
- }
57
+ else
58
+ lines.push(`- To send: \`/bridge\` skill \`contacts ${bridgeId}\` to find recipient, then \`send ${bridgeId} -r <ID> -t "message"\``)
58
59
  return lines.join('\n')
59
60
  }
60
61
 
@@ -84,11 +85,11 @@ function formatGoogleContext(config: GoogleBridgeConfig | null): string {
84
85
  return lines.join('\n')
85
86
  }
86
87
 
87
- function formatEmailContext(): string {
88
+ function formatEmailContext(bridgeId: string): string {
88
89
  return [
89
90
  'You can send and receive email via IMAP/SMTP.',
90
- '- Incoming emails are routed to you as conversations.',
91
- '- Send via the bridge API.'
91
+ '- Incoming emails are routed to you automatically.',
92
+ `- To send: \`/bridge\` skill → \`contacts ${bridgeId}\` to find recipient, then \`send ${bridgeId} -r <ID> -t "message"\``
92
93
  ].join('\n')
93
94
  }
94
95
 
@@ -114,19 +115,19 @@ export default defineEventHandler(async (event) => {
114
115
 
115
116
  switch (bridge.platform) {
116
117
  case 'telegram':
117
- details = formatTelegramContext(config)
118
+ details = formatTelegramContext(config, bridge.id)
118
119
  break
119
120
  case 'discord':
120
- details = formatDiscordContext(config)
121
+ details = formatDiscordContext(config, bridge.id)
121
122
  break
122
123
  case 'imessage':
123
- details = formatIMessageContext(config)
124
+ details = formatIMessageContext(config, bridge.id)
124
125
  break
125
126
  case 'google':
126
127
  details = formatGoogleContext(config)
127
128
  break
128
129
  case 'email':
129
- details = formatEmailContext()
130
+ details = formatEmailContext(bridge.id)
130
131
  break
131
132
  }
132
133
 
@@ -1,6 +1,6 @@
1
1
  import { randomUUID } from 'crypto'
2
2
  import { query } from '@anthropic-ai/claude-agent-sdk'
3
- import { eq } from 'drizzle-orm'
3
+ import { desc, eq } from 'drizzle-orm'
4
4
  import { getDb, schema } from '~~/server/db'
5
5
  import { logTokenUsage } from '~~/server/utils/log-token-usage'
6
6
  import { sendOutboundMessage } from './router'
@@ -35,6 +35,30 @@ async function getOrCreateMainChat() {
35
35
  return created!
36
36
  }
37
37
 
38
+ /**
39
+ * Load memory context directly from DB so the bridge prompt
40
+ * includes user preferences/facts even if the session-start hook
41
+ * can't reach the API (avoids false onboarding).
42
+ */
43
+ async function loadMemoryContext(): Promise<string> {
44
+ try {
45
+ const db = getDb()
46
+ const memories = await db.select()
47
+ .from(schema.memoryChunks)
48
+ .orderBy(desc(schema.memoryChunks.relevanceScore), desc(schema.memoryChunks.createdAt))
49
+ .limit(10)
50
+
51
+ if (memories.length === 0) return ''
52
+
53
+ const lines = ['[Memory context from previous sessions]']
54
+ for (const m of memories)
55
+ lines.push(`- ${m.content}`)
56
+ return lines.join('\n')
57
+ } catch {
58
+ return ''
59
+ }
60
+ }
61
+
38
62
  // SDK result shape (same as agent-executor.ts)
39
63
  interface SDKResult {
40
64
  subtype: string
@@ -87,9 +111,13 @@ export async function generateBridgeResponse(
87
111
  source: message.platform
88
112
  })
89
113
 
90
- // Build the prompt with platform context
91
- const senderLabel = message.senderName || message.sender
92
- const prompt = `[${message.platform} message from ${senderLabel}]: ${message.text}`
114
+ // Build the prompt frame as direct conversation, not a notification
115
+ const memoryContext = await loadMemoryContext()
116
+ const parts: string[] = []
117
+ if (memoryContext) parts.push(memoryContext)
118
+ parts.push(`The user is messaging you via ${message.platform}. Respond directly to them. Keep responses concise (suitable for chat/messaging). Do not ask what to reply — you ARE the one replying.`)
119
+ parts.push(message.text)
120
+ const prompt = parts.join('\n\n')
93
121
 
94
122
  // Update status
95
123
  await db.update(schema.conversations)
@@ -1 +0,0 @@
1
- {"id":"def74b99-d70c-4f30-aa29-70248cbeac7d","timestamp":1771737065743,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}