cognova 0.2.26 → 0.2.28
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{CxNJcty6.js → -XfM4jpu.js} +1 -1
- package/.output/public/_nuxt/0L-9iIbm.js +1 -0
- package/.output/public/_nuxt/{RIAd5Wd1.js → 0mcDe5Hg.js} +1 -1
- package/.output/public/_nuxt/{DLfV22bF.js → 4Nlt-3Ix.js} +1 -1
- package/.output/public/_nuxt/{C_hl3kCw.js → 5FVMuLeh.js} +1 -1
- package/.output/public/_nuxt/{C4Ii8cYC.js → 5qkiDtwf.js} +1 -1
- package/.output/public/_nuxt/{n_Arasow.js → 6_fEEpaq.js} +1 -1
- package/.output/public/_nuxt/{BZjMzGZM.js → 944smzho.js} +1 -1
- package/.output/public/_nuxt/{C-tfM08H.js → B03oRqJe.js} +1 -1
- package/.output/public/_nuxt/{CGgHmnnS.js → B06CcGVK.js} +3 -3
- package/.output/public/_nuxt/{FmfogFAR.js → B0UpgYEt.js} +1 -1
- package/.output/public/_nuxt/{CcJ0pNID.js → B0YLhHra.js} +1 -1
- package/.output/public/_nuxt/B0v0agy0.js +1 -0
- package/.output/public/_nuxt/{DmGbOc_e.js → B1A26hhf.js} +1 -1
- package/.output/public/_nuxt/{B38X0n2w.js → B592hx40.js} +1 -1
- package/.output/public/_nuxt/B5l6QVGz.js +1 -0
- package/.output/public/_nuxt/{BD07a6OS.js → B6BF2w8r.js} +3 -3
- package/.output/public/_nuxt/{rY0W1r76.js → B6m5ExpJ.js} +2 -2
- package/.output/public/_nuxt/{iTZxBLAr.js → B91qlTSF.js} +3 -3
- package/.output/public/_nuxt/B9sXHKws.js +1 -0
- package/.output/public/_nuxt/{eB60bVen.js → BAh-k-y8.js} +1 -1
- package/.output/public/_nuxt/{wSCSxjgr.js → BDQ6hxO7.js} +1 -1
- package/.output/public/_nuxt/{DEmzTuCa.js → BGytjslk.js} +1 -1
- package/.output/public/_nuxt/{CZQeFnOf.js → BIoHE1oQ.js} +1 -1
- package/.output/public/_nuxt/{BHcVB9Fo.js → BNXyokAF.js} +1 -1
- package/.output/public/_nuxt/{Irw5CrIe.js → BNxg8OvE.js} +1 -1
- package/.output/public/_nuxt/{C1wI_STa.js → BPBLcBHM.js} +2 -2
- package/.output/public/_nuxt/{BGV4_re9.js → BQeDYnyj.js} +1 -1
- package/.output/public/_nuxt/{pJF5jz72.js → BUfJTKJk.js} +1 -1
- package/.output/public/_nuxt/{B27NM422.js → BVJkcOi4.js} +1 -1
- package/.output/public/_nuxt/{B8fLdQfp.js → BVNZYpXH.js} +1 -1
- package/.output/public/_nuxt/{Dc_VwXJs.js → BZ3u3Znq.js} +1 -1
- package/.output/public/_nuxt/{CjkXqgrT.js → B_V_KZmg.js} +1 -1
- package/.output/public/_nuxt/{DB0uzc_1.js → BaTcZylh.js} +1 -1
- package/.output/public/_nuxt/{zvDhkxQS.js → BbdFZa4U.js} +1 -1
- package/.output/public/_nuxt/{DmHn_Ae8.js → BeAxkmtt.js} +1 -1
- package/.output/public/_nuxt/{CruI_TS3.js → BfiU8B4M.js} +1 -1
- package/.output/public/_nuxt/{DuH9QzIG.js → BhOf69HZ.js} +1 -1
- package/.output/public/_nuxt/{lfg-J79K.js → BlKgmZLh.js} +1 -1
- package/.output/public/_nuxt/{Cfce_cVw.js → BlplwzgB.js} +1 -1
- package/.output/public/_nuxt/{D5IKvGig.js → BnmZcuhY.js} +1 -1
- package/.output/public/_nuxt/{DfAWgXhg.js → BpExBTyC.js} +1 -1
- package/.output/public/_nuxt/{DIMnGgEU.js → BuURpKT4.js} +1 -1
- package/.output/public/_nuxt/{B5oEzB-M.js → Bvqgc_wA.js} +1 -1
- package/.output/public/_nuxt/{Dfi2mj_-.js → C0FuVjdX.js} +1 -1
- package/.output/public/_nuxt/{QNqSZCYh.js → C1RFLzd_.js} +1 -1
- package/.output/public/_nuxt/{DMCE1Up6.js → C4MrxKnP.js} +1 -1
- package/.output/public/_nuxt/{D5AjrkGO.js → C4ui9LWq.js} +1 -1
- package/.output/public/_nuxt/{iVfmia7K.js → C7RIYfkH.js} +1 -1
- package/.output/public/_nuxt/{D4wS6gzr.js → C7hn68Tp.js} +1 -1
- package/.output/public/_nuxt/{BHAaeL5L.js → C8gC5cUj.js} +1 -1
- package/.output/public/_nuxt/{CBJQYyqD.js → CAJH0xMY.js} +1 -1
- package/.output/public/_nuxt/{Bk_mzzQ3.js → CBpuaar1.js} +1 -1
- package/.output/public/_nuxt/{m9zGH_2s.js → CDP4J5em.js} +1 -1
- package/.output/public/_nuxt/{NNQizITf.js → CGTQGJ_c.js} +1 -1
- package/.output/public/_nuxt/{Ehiy7Wkv.js → CHd8mdNy.js} +1 -1
- package/.output/public/_nuxt/{BtVAOj3K.js → CHn6tbtE.js} +1 -1
- package/.output/public/_nuxt/{B1ea1Zc2.js → CKfAI3Hb.js} +1 -1
- package/.output/public/_nuxt/{CbLvLXmb.js → CLm_rHHY.js} +1 -1
- package/.output/public/_nuxt/{DFPu4h4a.js → CLzxl_Kg.js} +1 -1
- package/.output/public/_nuxt/{C3dJrgZH.js → CNVj60PG.js} +1 -1
- package/.output/public/_nuxt/{VRRYjCaC.js → CNi_mvQS.js} +1 -1
- package/.output/public/_nuxt/{46eRQaVv.js → COMJZX17.js} +1 -1
- package/.output/public/_nuxt/{Brmj91Ns.js → CQcJNYmv.js} +1 -1
- package/.output/public/_nuxt/{BMTKvzsm.js → CT8T1FW9.js} +1 -1
- package/.output/public/_nuxt/{B02JOKtW.js → CTJDAjdO.js} +1 -1
- package/.output/public/_nuxt/{w3RSHXA6.js → CTXxmwx3.js} +1 -1
- package/.output/public/_nuxt/{CIMG8oEU.js → CV92g0qz.js} +1 -1
- package/.output/public/_nuxt/{DEBOaUgW.js → CVwzer_Y.js} +1 -1
- package/.output/public/_nuxt/{6k0gxaWW.js → CXRkSVkD.js} +1 -1
- package/.output/public/_nuxt/{C7Wu2u5C.js → CamCmKfq.js} +1 -1
- package/.output/public/_nuxt/{DM9s28TO.js → CaohnGAD.js} +1 -1
- package/.output/public/_nuxt/{BqyI8nU4.js → Cg8k3_b4.js} +1 -1
- package/.output/public/_nuxt/{rVZcJ6Pz.js → CiQJYbKL.js} +1 -1
- package/.output/public/_nuxt/{Co86ycpI.js → Cjj-eCEV.js} +1 -1
- package/.output/public/_nuxt/{B3TXSB_R.js → CkfP4uja.js} +1 -1
- package/.output/public/_nuxt/{81-iumfM.js → CoUQ3qpL.js} +1 -1
- package/.output/public/_nuxt/{CPb6IrVT.js → CopZwjN8.js} +1 -1
- package/.output/public/_nuxt/{FGRiZ9J1.js → Cpyrc9BG.js} +1 -1
- package/.output/public/_nuxt/{6DKJrPTD.js → CtLfbSRS.js} +1 -1
- package/.output/public/_nuxt/{CVTUqEcr.js → CtyKXJ-J.js} +1 -1
- package/.output/public/_nuxt/{By5L5Smf.js → CvaD7s2l.js} +1 -1
- package/.output/public/_nuxt/{QmdcFt0E.js → Cw2TcJMF.js} +1 -1
- package/.output/public/_nuxt/{ByXbV9Xa.js → Cwel2ykQ.js} +1 -1
- package/.output/public/_nuxt/{CLmiWiqr.js → CyZlzytZ.js} +1 -1
- package/.output/public/_nuxt/{DXAD_aZW.js → Cygjd4rF.js} +1 -1
- package/.output/public/_nuxt/{DoSrePUc.js → CzxGRepV.js} +1 -1
- package/.output/public/_nuxt/{Dkpxacka.js → D0fJg-Y2.js} +1 -1
- package/.output/public/_nuxt/{BW-7wimi.js → D12yGpMq.js} +1 -1
- package/.output/public/_nuxt/{uCsI7fpg.js → D7Bxfxio.js} +1 -1
- package/.output/public/_nuxt/{D_1GDAlv.js → DEl5RR7R.js} +1 -1
- package/.output/public/_nuxt/{3hFj0Mf_.js → DFVXHy0C.js} +1 -1
- package/.output/public/_nuxt/{7msxmF5v.js → DFW8HOVB.js} +1 -1
- package/.output/public/_nuxt/{CD6r4z4e.js → DH2yWNbZ.js} +1 -1
- package/.output/public/_nuxt/{AMPsjNHJ.js → DIDjR8Ry.js} +1 -1
- package/.output/public/_nuxt/{B8na0pik.js → DKHJBr2m.js} +1 -1
- package/.output/public/_nuxt/{CDKJK4wW.js → DKd2_wBj.js} +1 -1
- package/.output/public/_nuxt/{CD_jDSWh.js → DKrd1pCW.js} +1 -1
- package/.output/public/_nuxt/{gTGPvkTX.js → DOcEwtqN.js} +1 -1
- package/.output/public/_nuxt/{B0_Iu2zi.js → DSQ9bpNJ.js} +1 -1
- package/.output/public/_nuxt/{BigIAhcT.js → DWG9jKCo.js} +1 -1
- package/.output/public/_nuxt/{Cj3gDP-y.js → DY78sr_b.js} +1 -1
- package/.output/public/_nuxt/{Cwdn7ZtG.js → DZQxxfue.js} +1 -1
- package/.output/public/_nuxt/{DN5cHXGS.js → DZpgj5sA.js} +1 -1
- package/.output/public/_nuxt/{CZ5B974o.js → Dc8vLBQN.js} +1 -1
- package/.output/public/_nuxt/{9vdFTPZC.js → DcT64MxD.js} +1 -1
- package/.output/public/_nuxt/{BwLYFg9w.js → DdmLHNRP.js} +1 -1
- package/.output/public/_nuxt/{Bn175bDC.js → Dg19_qAK.js} +1 -1
- package/.output/public/_nuxt/{BTImkTzA.js → DhIZvLeI.js} +1 -1
- package/.output/public/_nuxt/{DOTIy97K.js → DjaEQQhf.js} +1 -1
- package/.output/public/_nuxt/{CJLlvuDm.js → DkUMlRf8.js} +1 -1
- package/.output/public/_nuxt/{BTs0cu3F.js → DkjKiJOq.js} +1 -1
- package/.output/public/_nuxt/{CIDjuJ7I.js → DlR5hUi3.js} +1 -1
- package/.output/public/_nuxt/{P3qGksT8.js → DnfG5RzJ.js} +1 -1
- package/.output/public/_nuxt/{DOs_ozN6.js → DohhIeRk.js} +1 -1
- package/.output/public/_nuxt/{lA6pb86B.js → Dom1vIen.js} +1 -1
- package/.output/public/_nuxt/{BGa5KqPj.js → Ds97nj0P.js} +1 -1
- package/.output/public/_nuxt/{v-LIF5tR.js → DxT3YmAC.js} +1 -1
- package/.output/public/_nuxt/{UQIfAAmf.js → DxcN7Uv7.js} +1 -1
- package/.output/public/_nuxt/{qI8JV5dU.js → DxcbYcrE.js} +1 -1
- package/.output/public/_nuxt/{DfP6jcEM.js → DyVUuE07.js} +1 -1
- package/.output/public/_nuxt/{DoGLYOlq.js → Dz-vwDzE.js} +1 -1
- package/.output/public/_nuxt/{CrHLmWKE.js → EeCE4NvG.js} +1 -1
- package/.output/public/_nuxt/{BVkPh7-9.js → EnGykH_X.js} +1 -1
- package/.output/public/_nuxt/{By6urPVf.js → GJMyZaby.js} +1 -1
- package/.output/public/_nuxt/{mLs_Q7_U.js → I7OHJVxg.js} +1 -1
- package/.output/public/_nuxt/{bHsFNLQP.js → K0RZW9fp.js} +1 -1
- package/.output/public/_nuxt/{CSyssKl8.js → K1o4brLx.js} +1 -1
- package/.output/public/_nuxt/{CZvTOsiz.js → OKVQJ7yj.js} +1 -1
- package/.output/public/_nuxt/{3AgfIirx.js → Q3QJAuZ2.js} +1 -1
- package/.output/public/_nuxt/{D57E8FC4.js → Tirj2rC0.js} +1 -1
- package/.output/public/_nuxt/{BVcLiEDk.js → VcsszHDj.js} +1 -1
- package/.output/public/_nuxt/WG3LXN-9.js +1 -0
- package/.output/public/_nuxt/{CCmSsj4q.js → aUYaYlYl.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/7de5e0df-2e0a-435c-a2e3-fc2312beb6ad.json +1 -0
- package/.output/public/_nuxt/{swgNRlWy.js → cGEbEAGz.js} +1 -1
- package/.output/public/_nuxt/{BaHB7JKe.js → ds0WOZHj.js} +1 -1
- package/.output/public/_nuxt/{IIvTjJqa.js → e4zQkzJm.js} +1 -1
- package/.output/public/_nuxt/{D45gWhSU.js → eFu2sWbl.js} +1 -1
- package/.output/public/_nuxt/entry.B0qcqYYu.css +1 -0
- package/.output/public/_nuxt/{ChIzYvpz.js → ggWK6BEa.js} +1 -1
- package/.output/public/_nuxt/{pFPRVtL-.js → hkCaWCzP.js} +1 -1
- package/.output/public/_nuxt/{BW0bq0Nu.js → jF9FNyOl.js} +1 -1
- package/.output/public/_nuxt/{CjVBL0o-.js → jenjyHml.js} +1 -1
- package/.output/public/_nuxt/{CtNN2F57.js → kMwuhvCf.js} +1 -1
- package/.output/public/_nuxt/{1_nO5SO6.js → oWO88tvt.js} +1 -1
- package/.output/public/_nuxt/{d85YwuyC.js → olSL1K5t.js} +1 -1
- package/.output/public/_nuxt/{DwEfItxe.js → ptAR8AWT.js} +1 -1
- package/.output/public/_nuxt/{Dbv2gAYq.js → rTscsMvH.js} +1 -1
- package/.output/public/_nuxt/{Bxs6RCfp.js → xooRr3tW.js} +1 -1
- package/.output/public/_nuxt/{n5X4vNX9.js → zApTn6EM.js} +2 -2
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/{memories-BqA719O1.mjs → memories-DLa6uEfV.mjs} +2 -31
- package/.output/server/chunks/build/memories-DLa6uEfV.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +944 -922
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/{terminal.mjs → _ws/terminal.mjs} +39 -28
- package/.output/server/chunks/routes/_ws/terminal.mjs.map +1 -0
- package/.output/server/chunks/routes/api/memory/context.get.mjs +13 -9
- package/.output/server/chunks/routes/api/memory/context.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/memory/extract.post.mjs +4 -7
- package/.output/server/chunks/routes/api/memory/extract.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/memory/search.get.mjs +22 -25
- package/.output/server/chunks/routes/api/memory/search.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/memory/store.post.mjs +1 -3
- package/.output/server/chunks/routes/api/memory/store.post.mjs.map +1 -1
- package/.output/server/chunks/routes/notifications.mjs +1 -1
- package/.output/server/package.json +1 -1
- package/Claude/skills/memory/memory.py +1 -7
- package/app/composables/useTerminal.ts +1 -1
- package/app/pages/memories.vue +0 -15
- package/dist/cli/index.js +1 -0
- package/package.json +1 -1
- package/server/api/memory/context.get.ts +19 -15
- package/server/api/memory/extract.post.ts +1 -2
- package/server/api/memory/search.get.ts +29 -34
- package/server/api/memory/store.post.ts +1 -2
- package/server/bridge/responder.ts +10 -5
- package/server/db/schema.ts +1 -2
- package/server/drizzle/migrations/0017_unusual_landau.sql +1 -0
- package/server/drizzle/migrations/meta/0017_snapshot.json +1965 -0
- package/server/drizzle/migrations/meta/_journal.json +7 -0
- package/server/routes/_ws/terminal.ts +111 -0
- package/server/services/memory-extractor.ts +3 -6
- package/server/utils/document-sync.ts +27 -20
- package/server/utils/pty-manager.ts +12 -3
- package/shared/types/index.ts +1 -4
- package/.output/public/_nuxt/BhtKu4xV.js +0 -1
- package/.output/public/_nuxt/CNB4wNeh.js +0 -1
- package/.output/public/_nuxt/CnB-ybCZ.js +0 -1
- package/.output/public/_nuxt/DAjV9Cip.js +0 -1
- package/.output/public/_nuxt/Suor9Vto.js +0 -1
- package/.output/public/_nuxt/builds/meta/d37c41da-8cec-4479-a3ac-3097aa4fb2e0.json +0 -1
- package/.output/public/_nuxt/entry.ZJxWCrU6.css +0 -1
- package/.output/server/chunks/build/memories-BqA719O1.mjs.map +0 -1
- package/.output/server/chunks/routes/terminal.mjs.map +0 -1
- package/server/routes/terminal.ts +0 -98
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getOrCreatePtySession,
|
|
3
|
+
getOutputBuffer,
|
|
4
|
+
resizePty,
|
|
5
|
+
writeToPty,
|
|
6
|
+
getPtySession
|
|
7
|
+
} from '~~/server/utils/pty-manager'
|
|
8
|
+
import { auth } from '~~/server/utils/auth'
|
|
9
|
+
|
|
10
|
+
interface TerminalMessage {
|
|
11
|
+
type: 'input' | 'resize' | 'ping'
|
|
12
|
+
data?: string
|
|
13
|
+
cols?: number
|
|
14
|
+
rows?: number
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
function send(peer: any, data: object) {
|
|
19
|
+
try {
|
|
20
|
+
peer.send(JSON.stringify(data))
|
|
21
|
+
} catch {
|
|
22
|
+
// Client disconnected
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export default defineWebSocketHandler({
|
|
27
|
+
async open(peer) {
|
|
28
|
+
// Validate auth from upgrade request cookies (middleware is bypassed for /_ws)
|
|
29
|
+
const headers = peer.request?.headers
|
|
30
|
+
if (headers) {
|
|
31
|
+
try {
|
|
32
|
+
const session = await auth.api.getSession({ headers })
|
|
33
|
+
if (!session) {
|
|
34
|
+
send(peer, { type: 'error', data: 'Unauthorized\r\n' })
|
|
35
|
+
peer.close(1008, 'Unauthorized')
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
} catch (e) {
|
|
39
|
+
console.error('[terminal] Auth check failed:', e)
|
|
40
|
+
send(peer, { type: 'error', data: 'Authentication failed\r\n' })
|
|
41
|
+
peer.close(1008, 'Authentication failed')
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const sessionId = 'default'
|
|
47
|
+
const cols = 80
|
|
48
|
+
const rows = 24
|
|
49
|
+
|
|
50
|
+
console.log(`[terminal] WebSocket opened: ${peer.id}`)
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
const { isNew } = getOrCreatePtySession(sessionId, cols, rows)
|
|
54
|
+
|
|
55
|
+
// If reconnecting, replay buffer
|
|
56
|
+
if (!isNew) {
|
|
57
|
+
const buffer = getOutputBuffer(sessionId)
|
|
58
|
+
if (buffer.length > 0) {
|
|
59
|
+
send(peer, { type: 'output', data: buffer.join('') })
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Forward PTY output to client
|
|
64
|
+
const session = getPtySession(sessionId)
|
|
65
|
+
if (session) {
|
|
66
|
+
session.pty.onData((data: string) => {
|
|
67
|
+
send(peer, { type: 'output', data })
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
} catch (error) {
|
|
71
|
+
const msg = error instanceof Error ? error.message : 'Unknown error'
|
|
72
|
+
const stack = error instanceof Error ? error.stack : ''
|
|
73
|
+
console.error('[terminal] Failed to create PTY session:', msg, stack)
|
|
74
|
+
send(peer, { type: 'error', data: `Failed to start terminal: ${msg}\r\n` })
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
message(peer, message) {
|
|
79
|
+
const sessionId = 'default'
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
const msg = JSON.parse(message.text()) as TerminalMessage
|
|
83
|
+
|
|
84
|
+
switch (msg.type) {
|
|
85
|
+
case 'input':
|
|
86
|
+
if (msg.data)
|
|
87
|
+
writeToPty(sessionId, msg.data)
|
|
88
|
+
break
|
|
89
|
+
|
|
90
|
+
case 'resize':
|
|
91
|
+
if (msg.cols && msg.rows)
|
|
92
|
+
resizePty(sessionId, msg.cols, msg.rows)
|
|
93
|
+
break
|
|
94
|
+
|
|
95
|
+
case 'ping':
|
|
96
|
+
send(peer, { type: 'pong' })
|
|
97
|
+
break
|
|
98
|
+
}
|
|
99
|
+
} catch (e) {
|
|
100
|
+
console.error('[terminal] Message error:', e)
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
close(peer) {
|
|
105
|
+
console.log(`[terminal] WebSocket closed: ${peer.id}`)
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
error(peer, error) {
|
|
109
|
+
console.error(`[terminal] WebSocket error for ${peer.id}:`, error)
|
|
110
|
+
}
|
|
111
|
+
})
|
|
@@ -5,7 +5,7 @@ import { logTokenUsage } from '../utils/log-token-usage'
|
|
|
5
5
|
const EXTRACTION_PROMPT = `You are a memory extraction assistant. Analyze this conversation excerpt and extract key memories worth preserving for future reference.
|
|
6
6
|
|
|
7
7
|
Output ONLY a JSON array with this exact structure (no markdown, no code blocks, no explanation):
|
|
8
|
-
[{"type": "decision|fact|solution|pattern|preference", "content": "concise statement"
|
|
8
|
+
[{"type": "decision|fact|solution|pattern|preference", "content": "concise statement"}]
|
|
9
9
|
|
|
10
10
|
Memory types:
|
|
11
11
|
- decision: Choices made about implementation, architecture, or approach
|
|
@@ -19,7 +19,6 @@ Rules:
|
|
|
19
19
|
- Skip routine acknowledgments ("I'll do that", "Sure", "Let me...")
|
|
20
20
|
- Skip obvious facts already in code, debugging steps, greetings
|
|
21
21
|
- Content max 100 characters
|
|
22
|
-
- relevance: 1.0 = highly important, 0.5 = moderately useful, 0.1 = minor detail
|
|
23
22
|
- If nothing worth extracting, return []
|
|
24
23
|
|
|
25
24
|
Conversation to analyze:
|
|
@@ -90,15 +89,13 @@ export async function extractMemories(transcript: string): Promise<ExtractedMemo
|
|
|
90
89
|
const memories = JSON.parse(jsonMatch[0]) as Array<{
|
|
91
90
|
type: string
|
|
92
91
|
content: string
|
|
93
|
-
relevance: number
|
|
94
92
|
}>
|
|
95
93
|
|
|
96
94
|
return memories
|
|
97
|
-
.filter(m => isValidMemoryType(m.type) && m.content
|
|
95
|
+
.filter(m => isValidMemoryType(m.type) && m.content)
|
|
98
96
|
.map(m => ({
|
|
99
97
|
type: m.type as MemoryChunkType,
|
|
100
|
-
content: m.content.slice(0, 200)
|
|
101
|
-
relevance: Math.max(0, Math.min(1, m.relevance))
|
|
98
|
+
content: m.content.slice(0, 200)
|
|
102
99
|
}))
|
|
103
100
|
} catch (error) {
|
|
104
101
|
console.error('[memory-extractor] Failed to extract memories:', error)
|
|
@@ -4,7 +4,7 @@ import { eq, isNull } from 'drizzle-orm'
|
|
|
4
4
|
import { getDb } from '~~/server/db'
|
|
5
5
|
import * as schema from '~~/server/db/schema'
|
|
6
6
|
import { getVaultRoot, toRelativePath } from './path-validator'
|
|
7
|
-
import { parseFrontmatter, stringifyFrontmatter, extractTitle, computeContentHash, isBinaryFile, getMimeType } from './frontmatter'
|
|
7
|
+
import { parseFrontmatter, stringifyFrontmatter, extractTitle, computeContentHash, isBinaryFile, getFileType, getMimeType } from './frontmatter'
|
|
8
8
|
import { isDbAvailable } from './db-state'
|
|
9
9
|
|
|
10
10
|
// Default frontmatter values for new documents
|
|
@@ -62,27 +62,34 @@ export async function syncDocument(absolutePath: string): Promise<SyncResult> {
|
|
|
62
62
|
return 'unchanged'
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
const title = extractTitle(metadata, bodyContent, filename)
|
|
65
|
+
const fileType = getFileType(filename)
|
|
66
|
+
const isMarkdown = fileType === 'markdown'
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
68
|
+
let metadata: Record<string, unknown> = {}
|
|
69
|
+
let bodyContent = fileContent
|
|
71
70
|
|
|
72
|
-
if (
|
|
73
|
-
|
|
74
|
-
metadata =
|
|
71
|
+
if (isMarkdown) {
|
|
72
|
+
const parsed = parseFrontmatter(fileContent)
|
|
73
|
+
metadata = parsed.metadata
|
|
74
|
+
bodyContent = parsed.body
|
|
75
75
|
|
|
76
|
-
//
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
76
|
+
// For new markdown documents without frontmatter, add defaults
|
|
77
|
+
const needsDefaults = !existing && Object.keys(metadata).length === 0
|
|
78
|
+
|
|
79
|
+
if (needsDefaults) {
|
|
80
|
+
metadata = { ...DEFAULT_FRONTMATTER }
|
|
81
|
+
|
|
82
|
+
const newContent = stringifyFrontmatter(metadata, bodyContent)
|
|
83
|
+
try {
|
|
84
|
+
await writeFile(absolutePath, newContent, 'utf-8')
|
|
85
|
+
fileContent = newContent
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.error(`[sync] Failed to write frontmatter to ${relativePath}:`, err)
|
|
88
|
+
}
|
|
83
89
|
}
|
|
84
90
|
}
|
|
85
91
|
|
|
92
|
+
const title = extractTitle(metadata, bodyContent, filename)
|
|
86
93
|
const contentHash = computeContentHash(fileContent)
|
|
87
94
|
|
|
88
95
|
if (existing) {
|
|
@@ -95,7 +102,7 @@ export async function syncDocument(absolutePath: string): Promise<SyncResult> {
|
|
|
95
102
|
title,
|
|
96
103
|
content: bodyContent,
|
|
97
104
|
contentHash,
|
|
98
|
-
tags: Array.isArray(metadata.tags) ? metadata.tags as string[] : existing.tags,
|
|
105
|
+
tags: isMarkdown && Array.isArray(metadata.tags) ? metadata.tags as string[] : existing.tags,
|
|
99
106
|
deletedAt: null, // Clear deletion flag - file exists on disk
|
|
100
107
|
syncedAt: new Date(),
|
|
101
108
|
modifiedAt: new Date()
|
|
@@ -110,9 +117,9 @@ export async function syncDocument(absolutePath: string): Promise<SyncResult> {
|
|
|
110
117
|
title,
|
|
111
118
|
content: bodyContent,
|
|
112
119
|
contentHash,
|
|
113
|
-
tags: Array.isArray(metadata.tags) ? metadata.tags as string[] : [],
|
|
114
|
-
shared: metadata.shared === true,
|
|
115
|
-
fileType
|
|
120
|
+
tags: isMarkdown && Array.isArray(metadata.tags) ? metadata.tags as string[] : [],
|
|
121
|
+
shared: isMarkdown && metadata.shared === true,
|
|
122
|
+
fileType,
|
|
116
123
|
syncedAt: new Date()
|
|
117
124
|
})
|
|
118
125
|
return 'added'
|
|
@@ -7,7 +7,15 @@ import { getVaultRoot } from './path-validator'
|
|
|
7
7
|
// Use createRequire for node-pty to avoid ESM issues with native modules
|
|
8
8
|
// For bundled builds, we need to resolve from a known location
|
|
9
9
|
const requireFromCwd = createRequire(resolve(process.cwd(), 'package.json'))
|
|
10
|
-
|
|
10
|
+
let pty: typeof import('node-pty')
|
|
11
|
+
try {
|
|
12
|
+
pty = requireFromCwd('node-pty')
|
|
13
|
+
const helperPath = resolve(dirname(requireFromCwd.resolve('node-pty')), '..', 'build', 'Release', 'spawn-helper')
|
|
14
|
+
console.log(`[PTY] node-pty loaded, spawn-helper exists: ${existsSync(helperPath)} (${helperPath})`)
|
|
15
|
+
} catch (e) {
|
|
16
|
+
console.error('[PTY] Failed to load node-pty:', e)
|
|
17
|
+
throw e
|
|
18
|
+
}
|
|
11
19
|
|
|
12
20
|
// Shell candidates in order of preference
|
|
13
21
|
const SHELL_CANDIDATES = [
|
|
@@ -54,14 +62,15 @@ export function createPtySession(sessionId: string, cols = 80, rows = 24): IPty
|
|
|
54
62
|
// Ensure cwd exists so posix_spawnp doesn't fail
|
|
55
63
|
if (!existsSync(cwd)) mkdirSync(cwd, { recursive: true })
|
|
56
64
|
|
|
57
|
-
|
|
65
|
+
const env = ptyEnv()
|
|
66
|
+
console.log(`[PTY] Creating session: shell=${shell}, cwd=${cwd}, cols=${cols}, rows=${rows}, PATH=${(env.PATH || '').slice(0, 200)}`)
|
|
58
67
|
|
|
59
68
|
const ptyProcess = pty.spawn(shell, [], {
|
|
60
69
|
name: 'xterm-256color',
|
|
61
70
|
cols,
|
|
62
71
|
rows,
|
|
63
72
|
cwd,
|
|
64
|
-
env
|
|
73
|
+
env
|
|
65
74
|
}) as IPty
|
|
66
75
|
|
|
67
76
|
const session: PtySession = {
|
package/shared/types/index.ts
CHANGED
|
@@ -629,7 +629,6 @@ export interface MemoryChunk {
|
|
|
629
629
|
chunkType: MemoryChunkType
|
|
630
630
|
content: string
|
|
631
631
|
sourceExcerpt?: string
|
|
632
|
-
relevanceScore: number
|
|
633
632
|
accessCount: number
|
|
634
633
|
lastAccessedAt?: Date
|
|
635
634
|
createdAt: Date
|
|
@@ -642,14 +641,12 @@ export interface CreateMemoryInput {
|
|
|
642
641
|
chunkType: MemoryChunkType
|
|
643
642
|
content: string
|
|
644
643
|
sourceExcerpt?: string
|
|
645
|
-
relevanceScore?: number
|
|
646
644
|
}
|
|
647
645
|
|
|
648
646
|
export interface MemorySearchFilters {
|
|
649
647
|
query?: string
|
|
650
648
|
projectPath?: string
|
|
651
649
|
chunkType?: MemoryChunkType | MemoryChunkType[]
|
|
652
|
-
minRelevance?: number
|
|
653
650
|
limit?: number
|
|
654
651
|
}
|
|
655
652
|
|
|
@@ -662,7 +659,6 @@ export interface ExtractMemoryInput {
|
|
|
662
659
|
export interface ExtractedMemory {
|
|
663
660
|
type: MemoryChunkType
|
|
664
661
|
content: string
|
|
665
|
-
relevance: number
|
|
666
662
|
}
|
|
667
663
|
|
|
668
664
|
export interface MemoryContextResponse {
|
|
@@ -911,6 +907,7 @@ export interface DiscordBridgeConfig {
|
|
|
911
907
|
}
|
|
912
908
|
|
|
913
909
|
export interface IMessageBridgeConfig {
|
|
910
|
+
strategy?: 'imsg' | 'bluebubbles'
|
|
914
911
|
allowedNumbers?: string[]
|
|
915
912
|
blueBubblesUrl?: string
|
|
916
913
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as J}from"./NNQizITf.js";import{_ as W,a as X}from"./81-iumfM.js";import{_ as Y}from"./C7Wu2u5C.js";import{_ as ee}from"./Ehiy7Wkv.js";import{_ as te}from"./DmHn_Ae8.js";import{_ as oe}from"./B8fLdQfp.js";import{e as u,an as ae,h as ne,d as re,aj as le,f as M,C as se,M as k,Z as l,w as a,a as c,ak as w,o as _,ac as s,c as U,al as ce,am as ie,_ as ue,a0 as me,af as y,a$ as de,ab as S,aa as pe,b0 as fe}from"./CGgHmnnS.js";import{_ as _e}from"./BGa5KqPj.js";import{_ as ye}from"./CjkXqgrT.js";import{_ as he}from"./46eRQaVv.js";import{f as ve}from"./CWePHsZr.js";import"./CZ5B974o.js";import"./pFPRVtL-.js";import"./CD6r4z4e.js";import"./Cj3gDP-y.js";import"./CNB4wNeh.js";import"./DIMnGgEU.js";import"./B02JOKtW.js";import"./DEmzTuCa.js";import"./6k0gxaWW.js";import"./CZQeFnOf.js";import"./Suor9Vto.js";import"./C4Ii8cYC.js";import"./C6Y-ieo6.js";import"./d85YwuyC.js";import"./ByXbV9Xa.js";import"./88opOQSr.js";import"./iVfmia7K.js";import"./CCmSsj4q.js";import"./D57E8FC4.js";import"./rVZcJ6Pz.js";import"./C8ut0f5H.js";function ge(){const m=u([]),d=u(!0),p=u(null),g=ae({query:"",chunkType:"all",limit:50});async function b(i){d.value=!0,p.value=null;const e={...g,...i};try{const o={};e.query&&(o.query=e.query),e.chunkType&&e.chunkType!=="all"&&(o.chunkType=e.chunkType),e.projectPath&&(o.projectPath=e.projectPath),e.limit&&(o.limit=String(e.limit));const f=await $fetch("/api/memory/search",{query:o});return m.value=f.data,f.data}catch(o){throw p.value="Failed to load memories",console.error("Failed to load memories:",o),o}finally{d.value=!1}}async function x(i){try{await $fetch(`/api/memory/${i}`,{method:"DELETE"}),m.value=m.value.filter(e=>e.id!==i)}catch(e){throw console.error("Failed to delete memory:",e),e}}const h=ne(()=>{const i=m.value.reduce((e,o)=>(e[o.chunkType]=(e[o.chunkType]||0)+1,e),{});return{total:m.value.length,byType:i}});return{memories:m,loading:d,error:p,filters:g,stats:h,fetchMemories:b,deleteMemory:x}}const be={class:"contents"},xe={class:"p-4"},Te={key:0,class:"space-y-3"},ke={key:1,class:"flex flex-col items-center justify-center h-64 text-neutral-500"},we=["title"],De={class:"flex items-center gap-2"},$e={class:"w-16 h-1.5 bg-neutral-200 dark:bg-neutral-700 rounded-full overflow-hidden"},Ce={class:"text-xs text-muted"},Me={class:"text-sm text-muted"},Ue={class:"text-sm text-muted"},D="__all__",ct=re({__name:"memories",setup(m){const d=le(),{memories:p,loading:g,filters:b,stats:x,fetchMemories:h,deleteMemory:i}=ge(),e=u(!1),o=u(null),f=u(!1),F=[{value:D,label:"All Types"},{value:"decision",label:"Decisions"},{value:"fact",label:"Facts"},{value:"solution",label:"Solutions"},{value:"pattern",label:"Patterns"},{value:"preference",label:"Preferences"},{value:"summary",label:"Summaries"}],T=u(D),v=u("");M(T,n=>{b.chunkType=n===D?"all":n,h()});const V=fe(()=>{b.query=v.value||void 0,h()},300);M(v,V);function A(n){o.value=n,e.value=!0}async function q(){if(o.value){f.value=!0;try{await i(o.value),d.add({title:"Memory deleted",color:"success"}),e.value=!1}catch{d.add({title:"Failed to delete memory",color:"error"})}finally{f.value=!1,o.value=null}}}function N(n){switch(n){case"decision":return"primary";case"fact":return"info";case"solution":return"success";case"pattern":return"warning";case"preference":return"neutral";case"summary":return"neutral";default:return"neutral"}}function B(n){switch(n){case"decision":return"i-lucide-git-branch";case"fact":return"i-lucide-info";case"solution":return"i-lucide-check-circle";case"pattern":return"i-lucide-repeat";case"preference":return"i-lucide-settings";case"summary":return"i-lucide-file-text";default:return"i-lucide-circle"}}function K(n){return ve(new Date(n),{addSuffix:!0})}const L=[{accessorKey:"chunkType",header:"Type"},{accessorKey:"content",header:"Content"},{accessorKey:"relevanceScore",header:"Relevance"},{accessorKey:"accessCount",header:"Accessed"},{accessorKey:"createdAt",header:"Created"},{accessorKey:"actions",header:""}];function P(n){return[[{label:"Delete",icon:"i-lucide-trash-2",color:"error",onSelect:()=>A(n)}]]}return se(()=>{h()}),(n,r)=>{const $=J,j=X,E=Y,z=ee,I=te,R=oe,C=ue,O=me,Q=_e,Z=ye,G=W,H=he;return _(),k("div",be,[l(G,{id:"memories",grow:""},{header:a(()=>[l(j,{title:"Memories"},{leading:a(()=>[c(x).total>0?(_(),U($,{key:0,color:"neutral",variant:"subtle",class:"ml-2"},{default:a(()=>[S(y(c(x).total),1)]),_:1})):pe("",!0)]),_:1}),l(I,null,{left:a(()=>[l(E,{modelValue:c(T),"onUpdate:modelValue":r[0]||(r[0]=t=>w(T)?T.value=t:null),items:F,"value-key":"value",class:"w-40"},null,8,["modelValue"])]),right:a(()=>[l(z,{modelValue:c(v),"onUpdate:modelValue":r[1]||(r[1]=t=>w(v)?v.value=t:null),placeholder:"Search memories...",icon:"i-lucide-search",class:"w-64"},null,8,["modelValue"])]),_:1})]),body:a(()=>[s("div",xe,[c(g)?(_(),k("div",Te,[(_(),k(ce,null,ie(10,t=>l(R,{key:t,class:"h-12 w-full"})),64))])):c(p).length===0?(_(),k("div",ke,[l(C,{name:"i-lucide-brain",class:"w-12 h-12 mb-4"}),r[4]||(r[4]=s("p",{class:"text-lg font-medium"}," No memories yet ",-1)),r[5]||(r[5]=s("p",{class:"text-sm text-center max-w-md mt-2"}," Memories are automatically extracted from your Claude conversations. They will appear here once extraction hooks are triggered. ",-1))])):(_(),U(Z,{key:2,data:c(p),columns:L},{"chunkType-cell":a(({row:t})=>[l($,{color:N(t.original.chunkType),variant:"subtle",size:"sm"},{default:a(()=>[l(C,{name:B(t.original.chunkType),class:"w-3 h-3 mr-1"},null,8,["name"]),S(" "+y(t.original.chunkType),1)]),_:2},1032,["color"])]),"content-cell":a(({row:t})=>[s("span",{class:"text-sm line-clamp-2",title:t.original.content},y(t.original.content),9,we)]),"relevanceScore-cell":a(({row:t})=>[s("div",De,[s("div",$e,[s("div",{class:"h-full bg-primary-500 rounded-full",style:de({width:`${t.original.relevanceScore*100}%`})},null,4)]),s("span",Ce,y((t.original.relevanceScore*100).toFixed(0))+"% ",1)])]),"accessCount-cell":a(({row:t})=>[s("span",Me,y(t.original.accessCount)+"x ",1)]),"createdAt-cell":a(({row:t})=>[s("span",Ue,y(K(t.original.createdAt)),1)]),"actions-cell":a(({row:t})=>[l(Q,{items:P(t.original.id)},{default:a(()=>[l(O,{icon:"i-lucide-more-horizontal",color:"neutral",variant:"ghost",size:"xs"})]),_:1},8,["items"])]),_:1},8,["data"]))])]),_:1}),l(H,{open:c(e),"onUpdate:open":r[2]||(r[2]=t=>w(e)?e.value=t:null),title:"Delete Memory",description:"Are you sure you want to delete this memory? This action cannot be undone.","confirm-label":"Delete","confirm-color":"error",icon:"i-lucide-trash-2",loading:c(f),onConfirm:q,onCancel:r[3]||(r[3]=t=>o.value=null)},null,8,["open","loading"])])}}});export{ct as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,j as r,a6 as t}from"./CGgHmnnS.js";function a(o){return e(()=>r(o)?!!t(o)?.closest("form"):!0)}export{a as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./CGgHmnnS.js";const s=globalThis.setInterval;export{s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as a,n as i}from"./CGgHmnnS.js";import{u}from"./B5oEzB-M.js";const r=a(()=>{const{isAuthenticated:e,isPending:t}=u();if(!t.value&&!e.value)return i("/login")});export{r as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{S as e}from"./CGgHmnnS.js";function a(r,u="reka"){return r||`${u}-${e?.()}`}export{a as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"id":"d37c41da-8cec-4479-a3ac-3097aa4fb2e0","timestamp":1771947047568,"matcher":{"static":{},"wildcard":{},"dynamic":{}},"prerendered":[]}
|