opensentinel 3.1.1 → 3.6.1
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/README.md +126 -83
- package/dist/agent-manager-7N7REQZQ.js +39 -0
- package/dist/agent-processor-I23VWQY3.js +280 -0
- package/dist/agent-processor-I23VWQY3.js.map +1 -0
- package/dist/agent-types-2T4PXLFQ.js +12 -0
- package/dist/alerting-4I37GG4U.js +699 -0
- package/dist/alerting-4I37GG4U.js.map +1 -0
- package/dist/analysis-agent-JWN2GXYE.js +288 -0
- package/dist/analysis-agent-JWN2GXYE.js.map +1 -0
- package/dist/{archiver-AVNBYCKQ.js → archiver-XLRIIXPY.js} +86 -17
- package/dist/archiver-XLRIIXPY.js.map +1 -0
- package/dist/{audit-logger-OBPR7CRO.js → audit-logger-AU3TMWKI.js} +6 -5
- package/dist/{auth-UOX5K2BE.js → auth-PH5IHISW.js} +2 -2
- package/dist/{autonomy-ZXDBDQUJ.js → autonomy-N7W5XPLX.js} +4 -3
- package/dist/autonomy-N7W5XPLX.js.map +1 -0
- package/dist/{aws-s3-Q4LLZZPD.js → aws-s3-QZMURYXB.js} +2 -2
- package/dist/{backup-restore-PZ7CYYB7.js → backup-restore-72OQTZO3.js} +2 -2
- package/dist/{blocks-R3PODY47.js → blocks-YOWOESDD.js} +4 -4
- package/dist/bot-MU2TJQ3Y.js +46 -0
- package/dist/brain-SLA474EU.js +65 -0
- package/dist/{camera-monitor-M5CYKUU4.js → camera-monitor-LHTUWHEL.js} +2 -2
- package/dist/{charts-V7ARZNKF.js → charts-FJ32GQK7.js} +2 -2
- package/dist/{chunk-6PMVAAA7.js → chunk-2RGPWU77.js} +3 -3
- package/dist/{chunk-TVEWKIK3.js → chunk-2WTKTG2C.js} +2 -2
- package/dist/{chunk-MXAPLSJ5.js → chunk-45YXODSB.js} +2 -2
- package/dist/{chunk-SJSUSJ47.js → chunk-4YJRBMMA.js} +2 -2
- package/dist/chunk-643M3AP5.js +564 -0
- package/dist/chunk-643M3AP5.js.map +1 -0
- package/dist/{chunk-766ASQWE.js → chunk-6JY4HNUH.js} +2413 -2368
- package/dist/chunk-6JY4HNUH.js.map +1 -0
- package/dist/chunk-6LTLIYAQ.js +194 -0
- package/dist/chunk-6LTLIYAQ.js.map +1 -0
- package/dist/chunk-6UZPE35A.js +724 -0
- package/dist/chunk-6UZPE35A.js.map +1 -0
- package/dist/chunk-6W6PTJFT.js +181 -0
- package/dist/chunk-6W6PTJFT.js.map +1 -0
- package/dist/chunk-7MZN73J2.js +162 -0
- package/dist/chunk-7MZN73J2.js.map +1 -0
- package/dist/{chunk-SVAPX2XN.js → chunk-A24GPVLY.js} +9 -7
- package/dist/{chunk-SVAPX2XN.js.map → chunk-A24GPVLY.js.map} +1 -1
- package/dist/chunk-AD6YEH6U.js +3408 -0
- package/dist/chunk-AD6YEH6U.js.map +1 -0
- package/dist/chunk-ADTDYJO7.js +265 -0
- package/dist/chunk-ADTDYJO7.js.map +1 -0
- package/dist/{chunk-WRAKK6K6.js → chunk-AR34B6XR.js} +5 -3
- package/dist/{chunk-WRAKK6K6.js.map → chunk-AR34B6XR.js.map} +1 -1
- package/dist/chunk-BMOUYXLX.js +418 -0
- package/dist/chunk-BMOUYXLX.js.map +1 -0
- package/dist/chunk-C6PELIHS.js +60 -0
- package/dist/chunk-C6PELIHS.js.map +1 -0
- package/dist/{chunk-MQJ2ECQT.js → chunk-CUPEENUY.js} +3 -3
- package/dist/{chunk-RZ4YESBG.js → chunk-DOYGMNMK.js} +1 -1
- package/dist/chunk-DOYGMNMK.js.map +1 -0
- package/dist/chunk-FFV2SXFD.js +380 -0
- package/dist/chunk-FFV2SXFD.js.map +1 -0
- package/dist/{chunk-EVE7MIIY.js → chunk-GUKKW7JI.js} +15 -16
- package/dist/chunk-GUKKW7JI.js.map +1 -0
- package/dist/{chunk-66OJ3WB4.js → chunk-H3BOLSTS.js} +2 -2
- package/dist/chunk-HKOPRRDJ.js +1021 -0
- package/dist/chunk-HKOPRRDJ.js.map +1 -0
- package/dist/{chunk-BXZ6EA52.js → chunk-HTF2GIQC.js} +57 -3
- package/dist/chunk-HTF2GIQC.js.map +1 -0
- package/dist/{chunk-TYAGMJNV.js → chunk-JOA5A3G3.js} +5 -5
- package/dist/{chunk-OCVQGBJK.js → chunk-KABG5PG3.js} +6 -4
- package/dist/{chunk-OCVQGBJK.js.map → chunk-KABG5PG3.js.map} +1 -1
- package/dist/{chunk-VEHFVBLI.js → chunk-KT7NLIXP.js} +2 -2
- package/dist/chunk-LFDXEYYB.js +150 -0
- package/dist/chunk-LFDXEYYB.js.map +1 -0
- package/dist/{chunk-I6BDYQIG.js → chunk-M7YLQHFP.js} +6 -6
- package/dist/chunk-M7YLQHFP.js.map +1 -0
- package/dist/{chunk-AYUKPTSM.js → chunk-MFK34XSY.js} +96 -218
- package/dist/chunk-MFK34XSY.js.map +1 -0
- package/dist/chunk-MIC5IBQF.js +386 -0
- package/dist/chunk-MIC5IBQF.js.map +1 -0
- package/dist/{chunk-4UOE5TUZ.js → chunk-NMSHVO5O.js} +4 -4
- package/dist/{chunk-XKYRH4FM.js → chunk-NYVBXUGD.js} +13 -32
- package/dist/chunk-NYVBXUGD.js.map +1 -0
- package/dist/chunk-ODCFS5WD.js +463 -0
- package/dist/chunk-ODCFS5WD.js.map +1 -0
- package/dist/{chunk-ZLZKF2PM.js → chunk-PUNIMPMY.js} +32 -2
- package/dist/chunk-PUNIMPMY.js.map +1 -0
- package/dist/chunk-S4NJJS5C.js +37 -0
- package/dist/chunk-S4NJJS5C.js.map +1 -0
- package/dist/{chunk-NHMBTUMW.js → chunk-TAAZB5KN.js} +2 -2
- package/dist/{chunk-BRBWNV65.js → chunk-U2X2J3FI.js} +3 -3
- package/dist/chunk-U2X2J3FI.js.map +1 -0
- package/dist/{chunk-PLDDJCW6.js → chunk-UP2VWCW5.js} +1 -12
- package/dist/{chunk-4GLYY4NN.js → chunk-UWUIJTT4.js} +8 -2
- package/dist/chunk-UWUIJTT4.js.map +1 -0
- package/dist/{chunk-SPPMCAKG.js → chunk-VKMFUIVA.js} +2 -2
- package/dist/chunk-VKMFUIVA.js.map +1 -0
- package/dist/chunk-WZAH34TG.js +129 -0
- package/dist/chunk-WZAH34TG.js.map +1 -0
- package/dist/{chunk-H5RQOFO2.js → chunk-X6Q3K3L2.js} +6 -6
- package/dist/chunk-X6Q3K3L2.js.map +1 -0
- package/dist/chunk-XTX7EK43.js +134 -0
- package/dist/chunk-XTX7EK43.js.map +1 -0
- package/dist/chunk-ZIYTHUM5.js +457 -0
- package/dist/chunk-ZIYTHUM5.js.map +1 -0
- package/dist/chunker-K6WTR62A.js +12 -0
- package/dist/cli.js +1 -1
- package/dist/{client-ZQSFPMOB.js → client-FOIYPOZQ.js} +5 -6
- package/dist/{clipboard-manager-TEO2GEDN.js → clipboard-manager-4SBNESGZ.js} +2 -2
- package/dist/coding-agent-DESSU3AC.js +233 -0
- package/dist/coding-agent-DESSU3AC.js.map +1 -0
- package/dist/commands/setup.js +1 -1
- package/dist/commands/start.js +2 -2
- package/dist/commands/status.js +1 -1
- package/dist/commands/stop.js +1 -1
- package/dist/commands/utils.js +1 -1
- package/dist/cost-tracker-EMOIOYH7.js +11 -0
- package/dist/{cron-explain-HHQKPD3M.js → cron-explain-UOOOYWZZ.js} +2 -2
- package/dist/{crypto-4AP47IKC.js → crypto-2VG3RJR2.js} +2 -2
- package/dist/{databases-37X4CI2Y.js → databases-XDPMG5AV.js} +4 -4
- package/dist/db-LRIOKQBO.js +77 -0
- package/dist/discord-NKR3X4AV.js +80 -0
- package/dist/documents-EYIYLZK2.js +184 -0
- package/dist/documents-EYIYLZK2.js.map +1 -0
- package/dist/docx-parser-EXL4TN5E.js +16 -0
- package/dist/{email-K7LO2IPB.js → email-EAQNULVD.js} +33 -25
- package/dist/{email-K7LO2IPB.js.map → email-EAQNULVD.js.map} +1 -1
- package/dist/{enhanced-retrieval-DNLLEM4Z.js → enhanced-retrieval-OGHT6TS5.js} +11 -8
- package/dist/{enhanced-retrieval-DNLLEM4Z.js.map → enhanced-retrieval-OGHT6TS5.js.map} +1 -1
- package/dist/enrichment-pipeline-CMUVBDC7.js +14 -0
- package/dist/{entity-resolution-Y3IUWEAT.js → entity-resolution-4X4JU43O.js} +6 -5
- package/dist/env-CHOFICED.js +12 -0
- package/dist/error-tracker-SVQSDQDW.js +32 -0
- package/dist/finnhub-X7ZMQSXF.js +178 -0
- package/dist/finnhub-X7ZMQSXF.js.map +1 -0
- package/dist/fred-TMUF3J2V.js +203 -0
- package/dist/fred-TMUF3J2V.js.map +1 -0
- package/dist/github-KGNILDWJ.js +833 -0
- package/dist/github-KGNILDWJ.js.map +1 -0
- package/dist/{google-workspace-DKWUVNGC.js → google-workspace-TSZPZK5G.js} +2 -2
- package/dist/{hash-tool-ULQYD7B5.js → hash-tool-ENAB5LWH.js} +2 -2
- package/dist/{heartbeat-monitor-GCISLXI3.js → heartbeat-monitor-KRDYTDBF.js} +2 -2
- package/dist/hooks-N4MIFBVM.js +14 -0
- package/dist/{image-generation-OSU7FP6F.js → image-generation-MDE6AVQO.js} +2 -2
- package/dist/imessage-V2XNDDHT.js +43 -0
- package/dist/inbox-summarizer-DKKRYXDR.js +55 -0
- package/dist/{incident-response-C5J7Q6DT.js → incident-response-ZTIKUWEO.js} +8 -6
- package/dist/{incident-response-C5J7Q6DT.js.map → incident-response-ZTIKUWEO.js.map} +1 -1
- package/dist/{inventory-manager-352OHXWD.js → inventory-manager-C67BSZM6.js} +2 -2
- package/dist/{jira-GSGDBMIG.js → jira-PAGZWUBJ.js} +2 -2
- package/dist/{json-tool-QE2SYHEG.js → json-tool-4FK5RNER.js} +2 -2
- package/dist/{key-rotation-DPHU4ZTB.js → key-rotation-WCC5FOYS.js} +2 -2
- package/dist/knowledge-base-J7PJ7MZ3.js +46 -0
- package/dist/lib.d.ts +73 -1
- package/dist/lib.js +86 -76
- package/dist/lib.js.map +1 -1
- package/dist/{mailchimp-KKNF6QJ7.js → mailchimp-ZFYDC44J.js} +2 -2
- package/dist/{matrix-QVHG76I7.js → matrix-XHTR53VQ.js} +29 -21
- package/dist/{matrix-QVHG76I7.js.map → matrix-XHTR53VQ.js.map} +1 -1
- package/dist/{mcp-3JI6W7ZE.js → mcp-3C2TN67D.js} +3 -3
- package/dist/metrics-VJDWQWU7.js +25 -0
- package/dist/{microsoft365-UCBKJHNX.js → microsoft365-6G2IJMWC.js} +2 -2
- package/dist/multi-user-S56GUD6L.js +411 -0
- package/dist/multi-user-S56GUD6L.js.map +1 -0
- package/dist/{ocr-AC7NPX33.js → ocr-LGUIPKVZ.js} +6 -4
- package/dist/{ollama-BOAMSPLJ.js → ollama-J7CU45WT.js} +2 -2
- package/dist/osint-agent-RL5XPBRQ.js +189 -0
- package/dist/osint-agent-RL5XPBRQ.js.map +1 -0
- package/dist/{pages-MI523RB7.js → pages-XDE7JRCA.js} +5 -5
- package/dist/{pair-JDFTERIK.js → pair-YZJFQUU5.js} +2 -2
- package/dist/{pairing-IFQYCPNS.js → pairing-77N47RAT.js} +2 -2
- package/dist/{pdf-ALQVOEJR.js → pdf-67HGXCFJ.js} +3 -3
- package/dist/pdf-parser-YLMTTYHL.js +14 -0
- package/dist/{presentations-DSV5IHG5.js → presentations-HXTAMGHT.js} +3 -3
- package/dist/presentations-HXTAMGHT.js.map +1 -0
- package/dist/{prometheus-JNT2BD4L.js → prometheus-YETCZO4I.js} +2 -2
- package/dist/{providers-J4LYPHDR.js → providers-H6YIC3MG.js} +6 -4
- package/dist/{qr-code-WIX4PB4U.js → qr-code-6WZJHRKL.js} +2 -2
- package/dist/{quickbooks-XB4NII2S.js → quickbooks-N675W7IK.js} +2 -2
- package/dist/{regex-tool-W4ABRKGK.js → regex-tool-6Q63LQ7B.js} +2 -2
- package/dist/regex-tool-6Q63LQ7B.js.map +1 -0
- package/dist/research-agent-WCRSY3UZ.js +168 -0
- package/dist/research-agent-WCRSY3UZ.js.map +1 -0
- package/dist/risk-engine-YKCPT5D5.js +10 -0
- package/dist/risk-engine-YKCPT5D5.js.map +1 -0
- package/dist/scheduler-CA5UNHZV.js +73 -0
- package/dist/scheduler-CA5UNHZV.js.map +1 -0
- package/dist/schema-ALJ67YVG.js +72 -0
- package/dist/schema-ALJ67YVG.js.map +1 -0
- package/dist/{search-BCLBO5E3.js → search-GMLKBHSW.js} +4 -4
- package/dist/search-GMLKBHSW.js.map +1 -0
- package/dist/{sendgrid-RNXCAFKM.js → sendgrid-QGJIVPWV.js} +2 -2
- package/dist/{shopify-NCXYJB4R.js → shopify-ON2PAU27.js} +2 -2
- package/dist/signal-X7IQJGRQ.js +43 -0
- package/dist/signal-X7IQJGRQ.js.map +1 -0
- package/dist/slack-P2LFUJUQ.js +85 -0
- package/dist/slack-P2LFUJUQ.js.map +1 -0
- package/dist/{sms-M3JIOTCW.js → sms-4VME2HUL.js} +4 -4
- package/dist/sms-4VME2HUL.js.map +1 -0
- package/dist/{src-VYUE6LRA.js → src-S5KX4YEV.js} +179 -48
- package/dist/src-S5KX4YEV.js.map +1 -0
- package/dist/{stocks-XXWBPOCU.js → stocks-4M4HZWZS.js} +2 -2
- package/dist/stocks-4M4HZWZS.js.map +1 -0
- package/dist/text-extractor-OAUBAW5P.js +12 -0
- package/dist/text-extractor-OAUBAW5P.js.map +1 -0
- package/dist/{text-transform-6SGUA5Z4.js → text-transform-HCLCUDFZ.js} +2 -2
- package/dist/text-transform-HCLCUDFZ.js.map +1 -0
- package/dist/tools-FGPN522P.js +46 -0
- package/dist/tools-FGPN522P.js.map +1 -0
- package/dist/{tunnel-IWMXUML4.js → tunnel-XOUVVRAK.js} +4 -2
- package/dist/tunnel-XOUVVRAK.js.map +1 -0
- package/dist/{twilio-53GEW5JT.js → twilio-3L7DUNYQ.js} +2 -2
- package/dist/{unit-converter-ZYXMEZOE.js → unit-converter-LYPAHU64.js} +2 -2
- package/dist/unit-converter-LYPAHU64.js.map +1 -0
- package/dist/whatsapp-KRPQ4YUX.js +43 -0
- package/dist/whatsapp-KRPQ4YUX.js.map +1 -0
- package/dist/{word-document-7B6SJMAY.js → word-document-D6N2C47N.js} +4 -4
- package/dist/word-document-D6N2C47N.js.map +1 -0
- package/dist/workflow-store-ZYAYE5P6.js +373 -0
- package/dist/workflow-store-ZYAYE5P6.js.map +1 -0
- package/dist/writing-agent-VDGLNOGO.js +243 -0
- package/dist/writing-agent-VDGLNOGO.js.map +1 -0
- package/dist/{xero-QYO66D45.js → xero-UHAHVYSD.js} +2 -2
- package/dist/{zapier-webhook-TBZ5YF2A.js → zapier-webhook-NIELLTXR.js} +2 -2
- package/package.json +11 -1
- package/dist/archiver-AVNBYCKQ.js.map +0 -1
- package/dist/autonomy-ZXDBDQUJ.js.map +0 -1
- package/dist/bot-QRARP4UN.js +0 -36
- package/dist/brain-7XLLM3KC.js +0 -56
- package/dist/chunk-4GLYY4NN.js.map +0 -1
- package/dist/chunk-766ASQWE.js.map +0 -1
- package/dist/chunk-AYUKPTSM.js.map +0 -1
- package/dist/chunk-BRBWNV65.js.map +0 -1
- package/dist/chunk-BXZ6EA52.js.map +0 -1
- package/dist/chunk-EVE7MIIY.js.map +0 -1
- package/dist/chunk-H5RQOFO2.js.map +0 -1
- package/dist/chunk-I6BDYQIG.js.map +0 -1
- package/dist/chunk-IZJMVV7O.js +0 -347
- package/dist/chunk-IZJMVV7O.js.map +0 -1
- package/dist/chunk-O7IH7JTI.js +0 -1898
- package/dist/chunk-O7IH7JTI.js.map +0 -1
- package/dist/chunk-RZ4YESBG.js.map +0 -1
- package/dist/chunk-SPPMCAKG.js.map +0 -1
- package/dist/chunk-VRD5CYRL.js +0 -1568
- package/dist/chunk-VRD5CYRL.js.map +0 -1
- package/dist/chunk-XKYRH4FM.js.map +0 -1
- package/dist/chunk-ZLZKF2PM.js.map +0 -1
- package/dist/discord-B3HUPGQ6.js +0 -70
- package/dist/dist-UISMLMFN.js +0 -21847
- package/dist/dist-UISMLMFN.js.map +0 -1
- package/dist/enrichment-pipeline-MNHNW65K.js +0 -13
- package/dist/env-IWXUVTCB.js +0 -12
- package/dist/imessage-NGA2XF2V.js +0 -35
- package/dist/inbox-summarizer-NRI4S7IF.js +0 -47
- package/dist/presentations-DSV5IHG5.js.map +0 -1
- package/dist/scheduler-VK4WFERV.js +0 -63
- package/dist/signal-6CGDFYL2.js +0 -35
- package/dist/slack-IZQWIKOH.js +0 -75
- package/dist/src-VYUE6LRA.js.map +0 -1
- package/dist/tools-2RLEI2N6.js +0 -38
- package/dist/tunnel-IWMXUML4.js.map +0 -1
- package/dist/whatsapp-LFX6YKCM.js +0 -35
- package/dist/word-document-7B6SJMAY.js.map +0 -1
- /package/dist/{audit-logger-OBPR7CRO.js.map → agent-manager-7N7REQZQ.js.map} +0 -0
- /package/dist/{auth-UOX5K2BE.js.map → agent-types-2T4PXLFQ.js.map} +0 -0
- /package/dist/{backup-restore-PZ7CYYB7.js.map → audit-logger-AU3TMWKI.js.map} +0 -0
- /package/dist/{blocks-R3PODY47.js.map → auth-PH5IHISW.js.map} +0 -0
- /package/dist/{aws-s3-Q4LLZZPD.js.map → aws-s3-QZMURYXB.js.map} +0 -0
- /package/dist/{bot-QRARP4UN.js.map → backup-restore-72OQTZO3.js.map} +0 -0
- /package/dist/{brain-7XLLM3KC.js.map → blocks-YOWOESDD.js.map} +0 -0
- /package/dist/{chunk-PLDDJCW6.js.map → bot-MU2TJQ3Y.js.map} +0 -0
- /package/dist/{client-ZQSFPMOB.js.map → brain-SLA474EU.js.map} +0 -0
- /package/dist/{camera-monitor-M5CYKUU4.js.map → camera-monitor-LHTUWHEL.js.map} +0 -0
- /package/dist/{charts-V7ARZNKF.js.map → charts-FJ32GQK7.js.map} +0 -0
- /package/dist/{chunk-6PMVAAA7.js.map → chunk-2RGPWU77.js.map} +0 -0
- /package/dist/{chunk-TVEWKIK3.js.map → chunk-2WTKTG2C.js.map} +0 -0
- /package/dist/{chunk-MXAPLSJ5.js.map → chunk-45YXODSB.js.map} +0 -0
- /package/dist/{chunk-SJSUSJ47.js.map → chunk-4YJRBMMA.js.map} +0 -0
- /package/dist/{chunk-MQJ2ECQT.js.map → chunk-CUPEENUY.js.map} +0 -0
- /package/dist/{chunk-66OJ3WB4.js.map → chunk-H3BOLSTS.js.map} +0 -0
- /package/dist/{chunk-TYAGMJNV.js.map → chunk-JOA5A3G3.js.map} +0 -0
- /package/dist/{chunk-VEHFVBLI.js.map → chunk-KT7NLIXP.js.map} +0 -0
- /package/dist/{chunk-4UOE5TUZ.js.map → chunk-NMSHVO5O.js.map} +0 -0
- /package/dist/{chunk-NHMBTUMW.js.map → chunk-TAAZB5KN.js.map} +0 -0
- /package/dist/{clipboard-manager-TEO2GEDN.js.map → chunk-UP2VWCW5.js.map} +0 -0
- /package/dist/{cron-explain-HHQKPD3M.js.map → chunker-K6WTR62A.js.map} +0 -0
- /package/dist/{crypto-4AP47IKC.js.map → client-FOIYPOZQ.js.map} +0 -0
- /package/dist/{databases-37X4CI2Y.js.map → clipboard-manager-4SBNESGZ.js.map} +0 -0
- /package/dist/{discord-B3HUPGQ6.js.map → cost-tracker-EMOIOYH7.js.map} +0 -0
- /package/dist/{enrichment-pipeline-MNHNW65K.js.map → cron-explain-UOOOYWZZ.js.map} +0 -0
- /package/dist/{entity-resolution-Y3IUWEAT.js.map → crypto-2VG3RJR2.js.map} +0 -0
- /package/dist/{env-IWXUVTCB.js.map → databases-XDPMG5AV.js.map} +0 -0
- /package/dist/{hash-tool-ULQYD7B5.js.map → db-LRIOKQBO.js.map} +0 -0
- /package/dist/{heartbeat-monitor-GCISLXI3.js.map → discord-NKR3X4AV.js.map} +0 -0
- /package/dist/{imessage-NGA2XF2V.js.map → docx-parser-EXL4TN5E.js.map} +0 -0
- /package/dist/{inbox-summarizer-NRI4S7IF.js.map → enrichment-pipeline-CMUVBDC7.js.map} +0 -0
- /package/dist/{inventory-manager-352OHXWD.js.map → entity-resolution-4X4JU43O.js.map} +0 -0
- /package/dist/{json-tool-QE2SYHEG.js.map → env-CHOFICED.js.map} +0 -0
- /package/dist/{key-rotation-DPHU4ZTB.js.map → error-tracker-SVQSDQDW.js.map} +0 -0
- /package/dist/{google-workspace-DKWUVNGC.js.map → google-workspace-TSZPZK5G.js.map} +0 -0
- /package/dist/{mcp-3JI6W7ZE.js.map → hash-tool-ENAB5LWH.js.map} +0 -0
- /package/dist/{ocr-AC7NPX33.js.map → heartbeat-monitor-KRDYTDBF.js.map} +0 -0
- /package/dist/{ollama-BOAMSPLJ.js.map → hooks-N4MIFBVM.js.map} +0 -0
- /package/dist/{image-generation-OSU7FP6F.js.map → image-generation-MDE6AVQO.js.map} +0 -0
- /package/dist/{pages-MI523RB7.js.map → imessage-V2XNDDHT.js.map} +0 -0
- /package/dist/{pairing-IFQYCPNS.js.map → inbox-summarizer-DKKRYXDR.js.map} +0 -0
- /package/dist/{pdf-ALQVOEJR.js.map → inventory-manager-C67BSZM6.js.map} +0 -0
- /package/dist/{jira-GSGDBMIG.js.map → jira-PAGZWUBJ.js.map} +0 -0
- /package/dist/{prometheus-JNT2BD4L.js.map → json-tool-4FK5RNER.js.map} +0 -0
- /package/dist/{providers-J4LYPHDR.js.map → key-rotation-WCC5FOYS.js.map} +0 -0
- /package/dist/{qr-code-WIX4PB4U.js.map → knowledge-base-J7PJ7MZ3.js.map} +0 -0
- /package/dist/{mailchimp-KKNF6QJ7.js.map → mailchimp-ZFYDC44J.js.map} +0 -0
- /package/dist/{regex-tool-W4ABRKGK.js.map → mcp-3C2TN67D.js.map} +0 -0
- /package/dist/{scheduler-VK4WFERV.js.map → metrics-VJDWQWU7.js.map} +0 -0
- /package/dist/{microsoft365-UCBKJHNX.js.map → microsoft365-6G2IJMWC.js.map} +0 -0
- /package/dist/{search-BCLBO5E3.js.map → ocr-LGUIPKVZ.js.map} +0 -0
- /package/dist/{signal-6CGDFYL2.js.map → ollama-J7CU45WT.js.map} +0 -0
- /package/dist/{slack-IZQWIKOH.js.map → pages-XDE7JRCA.js.map} +0 -0
- /package/dist/{pair-JDFTERIK.js.map → pair-YZJFQUU5.js.map} +0 -0
- /package/dist/{sms-M3JIOTCW.js.map → pairing-77N47RAT.js.map} +0 -0
- /package/dist/{stocks-XXWBPOCU.js.map → pdf-67HGXCFJ.js.map} +0 -0
- /package/dist/{text-transform-6SGUA5Z4.js.map → pdf-parser-YLMTTYHL.js.map} +0 -0
- /package/dist/{tools-2RLEI2N6.js.map → prometheus-YETCZO4I.js.map} +0 -0
- /package/dist/{unit-converter-ZYXMEZOE.js.map → providers-H6YIC3MG.js.map} +0 -0
- /package/dist/{whatsapp-LFX6YKCM.js.map → qr-code-6WZJHRKL.js.map} +0 -0
- /package/dist/{quickbooks-XB4NII2S.js.map → quickbooks-N675W7IK.js.map} +0 -0
- /package/dist/{sendgrid-RNXCAFKM.js.map → sendgrid-QGJIVPWV.js.map} +0 -0
- /package/dist/{shopify-NCXYJB4R.js.map → shopify-ON2PAU27.js.map} +0 -0
- /package/dist/{twilio-53GEW5JT.js.map → twilio-3L7DUNYQ.js.map} +0 -0
- /package/dist/{xero-QYO66D45.js.map → xero-UHAHVYSD.js.map} +0 -0
- /package/dist/{zapier-webhook-TBZ5YF2A.js.map → zapier-webhook-NIELLTXR.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/agents/agent-types.ts"],"sourcesContent":["export type AgentType = \"research\" | \"coding\" | \"writing\" | \"analysis\" | \"osint\";\r\n\r\nexport type AgentStatus =\r\n | \"pending\"\r\n | \"running\"\r\n | \"completed\"\r\n | \"failed\"\r\n | \"cancelled\";\r\n\r\nexport interface AgentConfig {\r\n type: AgentType;\r\n objective: string;\r\n context?: Record<string, unknown>;\r\n tokenBudget?: number;\r\n timeBudgetMs?: number;\r\n}\r\n\r\nexport interface AgentProgress {\r\n step: number;\r\n description: string;\r\n status: \"pending\" | \"running\" | \"completed\" | \"failed\";\r\n output?: unknown;\r\n timestamp: Date;\r\n}\r\n\r\nexport interface AgentResult {\r\n success: boolean;\r\n output?: unknown;\r\n summary?: string;\r\n artifacts?: Array<{\r\n type: \"file\" | \"data\" | \"report\";\r\n name: string;\r\n content: unknown;\r\n }>;\r\n error?: string;\r\n tokensUsed: number;\r\n durationMs: number;\r\n}\r\n\r\nexport interface AgentMessage {\r\n role: \"user\" | \"assistant\" | \"system\" | \"tool_result\";\r\n content: string;\r\n metadata?: Record<string, unknown>;\r\n timestamp: Date;\r\n}\r\n\r\nexport interface Agent {\r\n id: string;\r\n userId: string;\r\n type: AgentType;\r\n name: string;\r\n status: AgentStatus;\r\n objective: string;\r\n context?: Record<string, unknown>;\r\n tokenBudget: number;\r\n tokensUsed: number;\r\n timeBudgetMs: number;\r\n startedAt?: Date;\r\n completedAt?: Date;\r\n createdAt: Date;\r\n messages: AgentMessage[];\r\n progress: AgentProgress[];\r\n result?: AgentResult;\r\n}\r\n\r\n// System prompts for each agent type\r\nexport const AGENT_SYSTEM_PROMPTS: Record<AgentType, string> = {\r\n research: `You are a Research Agent. Your goal is to thoroughly investigate a topic and provide comprehensive, well-sourced information.\r\n\r\nProcess:\r\n1. Break down the research question into sub-questions\r\n2. Search for information from multiple sources\r\n3. Cross-reference and verify findings\r\n4. Synthesize information into a coherent report\r\n5. Note confidence levels and any uncertainties\r\n\r\nGuidelines:\r\n- Always cite or reference your sources\r\n- Present multiple perspectives when relevant\r\n- Distinguish between facts and interpretations\r\n- Flag when information might be outdated\r\n- Structure findings hierarchically\r\n\r\nReport your progress after each major step.`,\r\n\r\n coding: `You are a Coding Agent. Your goal is to implement, debug, or improve code based on the given objective.\r\n\r\nProcess:\r\n1. Understand the requirements thoroughly\r\n2. Explore existing code if relevant\r\n3. Plan the implementation approach\r\n4. Write clean, documented code\r\n5. Test and verify the solution\r\n\r\nGuidelines:\r\n- Follow existing code conventions in the project\r\n- Write clear comments for complex logic\r\n- Handle edge cases and errors gracefully\r\n- Consider performance implications\r\n- Provide a summary of changes made\r\n\r\nReport your progress after each significant step.`,\r\n\r\n writing: `You are a Writing Agent. Your goal is to create high-quality written content based on the given objective.\r\n\r\nProcess:\r\n1. Understand the purpose and audience\r\n2. Research the topic if needed\r\n3. Create an outline\r\n4. Write the first draft\r\n5. Review and refine\r\n\r\nGuidelines:\r\n- Match the tone and style to the purpose\r\n- Structure content logically\r\n- Use clear, concise language\r\n- Support claims with evidence when relevant\r\n- Proofread for grammar and clarity\r\n\r\nReport your progress at each stage.`,\r\n\r\n analysis: `You are an Analysis Agent. Your goal is to analyze data or information and provide actionable insights.\r\n\r\nProcess:\r\n1. Understand the analysis objective\r\n2. Gather and organize the data\r\n3. Apply appropriate analytical methods\r\n4. Identify patterns and insights\r\n5. Present findings with recommendations\r\n\r\nGuidelines:\r\n- Be objective and data-driven\r\n- Acknowledge limitations in the data\r\n- Provide context for numbers\r\n- Make recommendations actionable\r\n- Visualize data when helpful\r\n\r\nReport your progress and key findings along the way.`,\r\n\r\n osint: `You are an OSINT (Open Source Intelligence) Agent. Your goal is to investigate entities, trace financial flows, map organizational relationships, and build comprehensive intelligence profiles using public records and open data sources.\r\n\r\nProcess:\r\n1. Identify the target entity (person, organization, committee)\r\n2. Search across public records databases (FEC, IRS 990, USAspending, SEC EDGAR, OpenCorporates)\r\n3. Resolve and deduplicate entities using fuzzy matching and identifiers\r\n4. Build relationship graphs connecting discovered entities\r\n5. Enrich discovered entities with additional data from all available sources\r\n6. Analyze patterns: financial flows, organizational hierarchies, political connections\r\n7. Generate an intelligence report with confidence levels\r\n\r\nGuidelines:\r\n- Use only publicly available information from official government databases\r\n- Cross-reference data across multiple sources to verify findings\r\n- Flag low-confidence matches explicitly\r\n- Build the knowledge graph incrementally, enriching as you discover connections\r\n- Track the provenance of every data point (source API, date retrieved)\r\n- Respect rate limits on all public APIs\r\n- Distinguish between confirmed facts and inferred connections\r\n- Quantify financial relationships with exact dollar amounts when available\r\n- Note temporal aspects (when relationships were active)\r\n- Provide actionable next steps for further investigation\r\n\r\nReport findings as you progress through each data source.`,\r\n};\r\n\r\n// Tool permissions for each agent type\r\nexport const AGENT_TOOL_PERMISSIONS: Record<AgentType, string[]> = {\r\n research: [\r\n \"web_search\",\r\n \"browse_url\",\r\n \"read_file\",\r\n \"list_directory\",\r\n \"search_files\",\r\n ],\r\n coding: [\r\n \"read_file\",\r\n \"write_file\",\r\n \"list_directory\",\r\n \"search_files\",\r\n \"execute_command\",\r\n ],\r\n writing: [\r\n \"read_file\",\r\n \"write_file\",\r\n \"web_search\",\r\n \"browse_url\",\r\n ],\r\n analysis: [\r\n \"read_file\",\r\n \"web_search\",\r\n \"browse_url\",\r\n \"list_directory\",\r\n \"search_files\",\r\n \"fred_economic_data\",\r\n \"finnhub_market_data\",\r\n \"crypto_price\",\r\n \"stock_price\",\r\n \"currency_exchange\",\r\n ],\r\n osint: [\r\n \"web_search\",\r\n \"browse_url\",\r\n \"read_file\",\r\n \"search_files\",\r\n \"osint_search\",\r\n \"osint_graph\",\r\n \"osint_enrich\",\r\n \"osint_analyze\",\r\n ],\r\n};\r\n\r\nexport default {\r\n AGENT_SYSTEM_PROMPTS,\r\n AGENT_TOOL_PERMISSIONS,\r\n};\r\n"],"mappings":";AAkEO,IAAM,uBAAkD;AAAA,EAC7D,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBV,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBR,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBT,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAkBV,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBT;AAGO,IAAM,yBAAsD;AAAA,EACjE,UAAU;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,SAAS;AAAA,IACP;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,OAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;AAAA,EACb;AAAA,EACA;AACF;","names":[]}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
textToSpeech
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-45YXODSB.js";
|
|
4
4
|
import {
|
|
5
5
|
transcribeAudio
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4YJRBMMA.js";
|
|
7
7
|
import {
|
|
8
8
|
scheduleReminder
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-MFK34XSY.js";
|
|
10
10
|
import {
|
|
11
11
|
chatWithTools
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-6JY4HNUH.js";
|
|
13
13
|
import {
|
|
14
14
|
env
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-PUNIMPMY.js";
|
|
16
16
|
|
|
17
17
|
// src/inputs/telegram/bot.ts
|
|
18
18
|
import { Bot, session } from "grammy";
|
|
@@ -259,4 +259,4 @@ Send me a message or voice note to get started!`
|
|
|
259
259
|
export {
|
|
260
260
|
createBot
|
|
261
261
|
};
|
|
262
|
-
//# sourceMappingURL=chunk-
|
|
262
|
+
//# sourceMappingURL=chunk-M7YLQHFP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/inputs/telegram/bot.ts","../src/inputs/telegram/handlers.ts"],"sourcesContent":["import { Bot, Context, session } from \"grammy\";\nimport { env } from \"../../config/env\";\nimport { handleMessage, handleVoice } from \"./handlers\";\nimport { scheduleReminder } from \"../../core/scheduler\";\n\nexport interface SessionData {\n messages: Array<{ role: \"user\" | \"assistant\"; content: string }>;\n}\n\nexport type OpenSentinelContext = Context & { session: SessionData };\n\nexport function createBot() {\n const bot = new Bot<OpenSentinelContext>(env.TELEGRAM_BOT_TOKEN);\n\n // Session middleware for conversation history\n bot.use(\n session({\n initial: (): SessionData => ({\n messages: [],\n }),\n })\n );\n\n // Only allow configured chat ID\n bot.use(async (ctx, next) => {\n const chatId = ctx.chat?.id?.toString();\n if (chatId !== env.TELEGRAM_CHAT_ID) {\n console.log(`Unauthorized access attempt from chat ID: ${chatId}`);\n return;\n }\n await next();\n });\n\n // Command handlers\n bot.command(\"start\", async (ctx) => {\n await ctx.reply(\n `Hello! I'm OpenSentinel, your personal AI assistant with JARVIS-like capabilities.\n\nI can:\n• Chat and answer questions using Claude AI\n• Execute shell commands on your system\n• Read and write files\n• Search the web\n• Remember important information\n• Set reminders\n\nSend me a message or voice note to get started!`\n );\n });\n\n bot.command(\"clear\", async (ctx) => {\n ctx.session.messages = [];\n await ctx.reply(\"✓ Conversation history cleared.\");\n });\n\n bot.command(\"remind\", async (ctx) => {\n const text = ctx.message?.text?.replace(\"/remind\", \"\").trim();\n\n if (!text) {\n await ctx.reply(\n \"Usage: /remind <time> <message>\\n\\nExamples:\\n• /remind 5m Check the oven\\n• /remind 1h Call mom\\n• /remind 30s Test reminder\"\n );\n return;\n }\n\n // Parse time and message\n const match = text.match(/^(\\d+)(s|m|h)\\s+(.+)$/i);\n if (!match) {\n await ctx.reply(\n \"Invalid format. Use: /remind <number><s/m/h> <message>\\n\\nExample: /remind 5m Check the oven\"\n );\n return;\n }\n\n const [, amount, unit, message] = match;\n const multipliers: Record<string, number> = {\n s: 1000,\n m: 60 * 1000,\n h: 60 * 60 * 1000,\n };\n const delayMs = parseInt(amount) * multipliers[unit.toLowerCase()];\n\n try {\n await scheduleReminder(message, delayMs, ctx.chat?.id?.toString());\n const timeStr = unit === \"s\" ? \"seconds\" : unit === \"m\" ? \"minutes\" : \"hours\";\n await ctx.reply(`✓ Reminder set for ${amount} ${timeStr}: \"${message}\"`);\n } catch (error) {\n await ctx.reply(\"Sorry, I couldn't set the reminder. Please try again.\");\n }\n });\n\n bot.command(\"help\", async (ctx) => {\n await ctx.reply(\n `*OpenSentinel Commands*\n\n/start - Welcome message\n/clear - Clear conversation history\n/remind <time> <message> - Set a reminder\n/help - Show this help\n\n*Features*\n• Send text messages for AI chat\n• Send voice messages for voice interaction\n• Ask me to run commands, search the web, or manage files\n\n*Examples*\n• \"What's the weather like?\"\n• \"List files in my Downloads folder\"\n• \"Search for the latest news about AI\"\n• /remind 5m Take a break`,\n { parse_mode: \"Markdown\" }\n );\n });\n\n // Message handlers\n bot.on(\"message:text\", handleMessage);\n bot.on(\"message:voice\", handleVoice);\n\n // Error handling\n bot.catch((err) => {\n console.error(\"Bot error:\", err);\n });\n\n return bot;\n}\n","import { InputFile } from \"grammy\";\r\nimport type { OpenSentinelContext as SentinelContext } from \"./bot\";\r\nimport { chatWithTools, type Message } from \"../../core/brain\";\r\nimport { transcribeAudio } from \"../../outputs/stt\";\r\nimport { textToSpeech } from \"../../outputs/tts\";\r\n\r\nconst MAX_HISTORY = 20; // Keep last 20 messages for context\r\n\r\nexport async function handleMessage(ctx: SentinelContext) {\r\n const text = ctx.message?.text;\r\n if (!text) return;\r\n\r\n // Add user message to history\r\n ctx.session.messages.push({ role: \"user\", content: text });\r\n\r\n // Trim history if too long\r\n if (ctx.session.messages.length > MAX_HISTORY) {\r\n ctx.session.messages = ctx.session.messages.slice(-MAX_HISTORY);\r\n }\r\n\r\n // Show typing indicator\r\n await ctx.replyWithChatAction(\"typing\");\r\n\r\n try {\r\n // Use chatWithTools for full capability\r\n const response = await chatWithTools(\r\n ctx.session.messages as Message[],\r\n ctx.chat?.id?.toString(),\r\n async () => {\r\n // Keep typing indicator alive during tool use\r\n await ctx.replyWithChatAction(\"typing\");\r\n }\r\n );\r\n\r\n // Add assistant response to history\r\n ctx.session.messages.push({ role: \"assistant\", content: response.content });\r\n\r\n // Build response with tool usage info\r\n let finalResponse = response.content;\r\n if (response.toolsUsed && response.toolsUsed.length > 0) {\r\n const toolList = [...new Set(response.toolsUsed)].join(\", \");\r\n finalResponse = `🔧 _Used: ${toolList}_\\n\\n${response.content}`;\r\n }\r\n\r\n // Send response (split if too long for Telegram)\r\n await sendResponse(ctx, finalResponse);\r\n\r\n console.log(\r\n `[Telegram] Processed message. Tokens: ${response.inputTokens}/${response.outputTokens}` +\r\n (response.toolsUsed ? ` Tools: ${response.toolsUsed.join(\", \")}` : \"\")\r\n );\r\n } catch (error) {\r\n console.error(\"Error processing message:\", error);\r\n const errMsg = error instanceof Error ? error.message : String(error);\r\n if (errMsg.includes(\"credit balance is too low\")) {\r\n await ctx.reply(\r\n \"⚠️ The AI service is temporarily unavailable due to API billing. The admin has been notified.\"\r\n );\r\n } else if (errMsg.includes(\"rate_limit\") || errMsg.includes(\"429\")) {\r\n await ctx.reply(\r\n \"⏳ Too many requests — please wait a moment and try again.\"\r\n );\r\n } else {\r\n await ctx.reply(\r\n \"Sorry, I encountered an error processing your message. Please try again.\"\r\n );\r\n }\r\n }\r\n}\r\n\r\nexport async function handleVoice(ctx: SentinelContext) {\r\n const voice = ctx.message?.voice;\r\n if (!voice) return;\r\n\r\n await ctx.replyWithChatAction(\"typing\");\r\n\r\n try {\r\n // Get voice file\r\n const file = await ctx.getFile();\r\n const fileUrl = `https://api.telegram.org/file/bot${process.env.TELEGRAM_BOT_TOKEN}/${file.file_path}`;\r\n\r\n // Download and transcribe\r\n const response = await fetch(fileUrl);\r\n const audioBuffer = await response.arrayBuffer();\r\n\r\n const transcription = await transcribeAudio(Buffer.from(audioBuffer));\r\n\r\n if (!transcription) {\r\n await ctx.reply(\"Sorry, I couldn't transcribe that voice message.\");\r\n return;\r\n }\r\n\r\n // Show what was transcribed\r\n await ctx.reply(`🎤 _\"${transcription}\"_`, { parse_mode: \"Markdown\" });\r\n\r\n // Process as text message\r\n ctx.session.messages.push({ role: \"user\", content: transcription });\r\n\r\n if (ctx.session.messages.length > MAX_HISTORY) {\r\n ctx.session.messages = ctx.session.messages.slice(-MAX_HISTORY);\r\n }\r\n\r\n await ctx.replyWithChatAction(\"typing\");\r\n\r\n const aiResponse = await chatWithTools(\r\n ctx.session.messages as Message[],\r\n ctx.chat?.id?.toString()\r\n );\r\n ctx.session.messages.push({\r\n role: \"assistant\",\r\n content: aiResponse.content,\r\n });\r\n\r\n // Send text response first\r\n await sendResponse(ctx, aiResponse.content);\r\n\r\n // Also send voice response if text is short enough\r\n if (aiResponse.content.length < 1000 && aiResponse.content.length > 10) {\r\n try {\r\n await ctx.replyWithChatAction(\"record_voice\");\r\n const audioBuffer = await textToSpeech(aiResponse.content);\r\n if (audioBuffer) {\r\n await ctx.replyWithVoice(new InputFile(audioBuffer, \"response.ogg\"));\r\n }\r\n } catch (ttsError) {\r\n console.error(\"TTS error:\", ttsError);\r\n // Don't fail if TTS fails, text was already sent\r\n }\r\n }\r\n\r\n console.log(\r\n `[Telegram] Processed voice message. Tokens: ${aiResponse.inputTokens}/${aiResponse.outputTokens}`\r\n );\r\n } catch (error) {\r\n console.error(\"Error processing voice message:\", error);\r\n await ctx.reply(\r\n \"Sorry, I encountered an error processing your voice message. Please try again.\"\r\n );\r\n }\r\n}\r\n\r\n// Helper to send response, handling Markdown errors\r\nasync function sendResponse(ctx: SentinelContext, text: string) {\r\n const maxLength = 4096;\r\n\r\n // Try with Markdown first\r\n try {\r\n if (text.length <= maxLength) {\r\n await ctx.reply(text, { parse_mode: \"Markdown\" });\r\n } else {\r\n const chunks = splitMessage(text, maxLength);\r\n for (const chunk of chunks) {\r\n await ctx.reply(chunk, { parse_mode: \"Markdown\" });\r\n }\r\n }\r\n } catch {\r\n // If Markdown fails, send as plain text\r\n if (text.length <= maxLength) {\r\n await ctx.reply(text);\r\n } else {\r\n const chunks = splitMessage(text, maxLength);\r\n for (const chunk of chunks) {\r\n await ctx.reply(chunk);\r\n }\r\n }\r\n }\r\n}\r\n\r\nfunction splitMessage(text: string, maxLength: number): string[] {\r\n const chunks: string[] = [];\r\n let remaining = text;\r\n\r\n while (remaining.length > 0) {\r\n if (remaining.length <= maxLength) {\r\n chunks.push(remaining);\r\n break;\r\n }\r\n\r\n // Find a good break point (newline or space)\r\n let breakPoint = remaining.lastIndexOf(\"\\n\", maxLength);\r\n if (breakPoint === -1 || breakPoint < maxLength / 2) {\r\n breakPoint = remaining.lastIndexOf(\" \", maxLength);\r\n }\r\n if (breakPoint === -1 || breakPoint < maxLength / 2) {\r\n breakPoint = maxLength;\r\n }\r\n\r\n chunks.push(remaining.slice(0, breakPoint));\r\n remaining = remaining.slice(breakPoint).trim();\r\n }\r\n\r\n return chunks;\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA,SAAS,KAAc,eAAe;;;ACAtC,SAAS,iBAAiB;AAM1B,IAAM,cAAc;AAEpB,eAAsB,cAAc,KAAsB;AACxD,QAAM,OAAO,IAAI,SAAS;AAC1B,MAAI,CAAC,KAAM;AAGX,MAAI,QAAQ,SAAS,KAAK,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAGzD,MAAI,IAAI,QAAQ,SAAS,SAAS,aAAa;AAC7C,QAAI,QAAQ,WAAW,IAAI,QAAQ,SAAS,MAAM,CAAC,WAAW;AAAA,EAChE;AAGA,QAAM,IAAI,oBAAoB,QAAQ;AAEtC,MAAI;AAEF,UAAM,WAAW,MAAM;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AA,EACF,CAAC;AAED,MAAI,QAAQ,QAAQ,OAAO,QAAQ;AACjC,UAAM,IAAI;AAAA,MACR;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAiBA,EAAE,YAAY,WAAW;AAAA,IAC3B;AAAA,EACF,CAAC;AAGD,MAAI,GAAG,gBAAgB,aAAa;AACpC,MAAI,GAAG,iBAAiB,WAAW;AAGnC,MAAI,MAAM,CAAC,QAAQ;AACjB,YAAQ,MAAM,cAAc,GAAG;AAAA,EACjC,CAAC;AAED,SAAO;AACT;","names":["audioBuffer"]}
|
|
@@ -1,34 +1,52 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AGENT_SYSTEM_PROMPTS,
|
|
3
|
+
AGENT_TOOL_PERMISSIONS
|
|
4
|
+
} from "./chunk-LFDXEYYB.js";
|
|
5
|
+
import {
|
|
6
|
+
captureException
|
|
7
|
+
} from "./chunk-7MZN73J2.js";
|
|
1
8
|
import {
|
|
2
9
|
TOOLS,
|
|
3
|
-
addAgentMessage,
|
|
4
|
-
addAgentProgress,
|
|
5
10
|
chat,
|
|
6
11
|
checkAchievements,
|
|
7
12
|
executeTool,
|
|
8
|
-
flushMetrics,
|
|
9
13
|
generateGrowthReport,
|
|
10
14
|
getAchievementProgress,
|
|
11
|
-
getAgent,
|
|
12
15
|
getCurrentMode,
|
|
13
16
|
getModeStats,
|
|
14
17
|
getTodaysEvents,
|
|
15
18
|
getUpcomingEvents,
|
|
16
|
-
getUserPoints
|
|
17
|
-
|
|
19
|
+
getUserPoints
|
|
20
|
+
} from "./chunk-6JY4HNUH.js";
|
|
21
|
+
import {
|
|
22
|
+
riskEngine
|
|
23
|
+
} from "./chunk-ODCFS5WD.js";
|
|
24
|
+
import {
|
|
25
|
+
addAgentMessage,
|
|
26
|
+
addAgentProgress,
|
|
27
|
+
getAgent,
|
|
18
28
|
shouldAgentStop,
|
|
19
29
|
updateAgentStatus,
|
|
20
30
|
updateAgentTokens
|
|
21
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-643M3AP5.js";
|
|
32
|
+
import {
|
|
33
|
+
flushMetrics,
|
|
34
|
+
metric
|
|
35
|
+
} from "./chunk-6LTLIYAQ.js";
|
|
36
|
+
import {
|
|
37
|
+
providerRegistry
|
|
38
|
+
} from "./chunk-HTF2GIQC.js";
|
|
39
|
+
import {
|
|
40
|
+
db
|
|
41
|
+
} from "./chunk-S4NJJS5C.js";
|
|
42
|
+
import {
|
|
43
|
+
env
|
|
44
|
+
} from "./chunk-PUNIMPMY.js";
|
|
22
45
|
import {
|
|
23
46
|
archivedMemories,
|
|
24
47
|
calendarTriggers,
|
|
25
|
-
db,
|
|
26
|
-
errorLogs,
|
|
27
48
|
memories
|
|
28
|
-
} from "./chunk-
|
|
29
|
-
import {
|
|
30
|
-
env
|
|
31
|
-
} from "./chunk-ZLZKF2PM.js";
|
|
49
|
+
} from "./chunk-NYVBXUGD.js";
|
|
32
50
|
|
|
33
51
|
// src/core/scheduler.ts
|
|
34
52
|
import { Queue, Worker as Worker2 } from "bullmq";
|
|
@@ -37,182 +55,9 @@ import Redis2 from "ioredis";
|
|
|
37
55
|
// src/core/agents/agent-worker.ts
|
|
38
56
|
import { Worker } from "bullmq";
|
|
39
57
|
import Redis from "ioredis";
|
|
40
|
-
import Anthropic from "@anthropic-ai/sdk";
|
|
41
|
-
|
|
42
|
-
// src/core/agents/agent-types.ts
|
|
43
|
-
var AGENT_SYSTEM_PROMPTS = {
|
|
44
|
-
research: `You are a Research Agent. Your goal is to thoroughly investigate a topic and provide comprehensive, well-sourced information.
|
|
45
|
-
|
|
46
|
-
Process:
|
|
47
|
-
1. Break down the research question into sub-questions
|
|
48
|
-
2. Search for information from multiple sources
|
|
49
|
-
3. Cross-reference and verify findings
|
|
50
|
-
4. Synthesize information into a coherent report
|
|
51
|
-
5. Note confidence levels and any uncertainties
|
|
52
|
-
|
|
53
|
-
Guidelines:
|
|
54
|
-
- Always cite or reference your sources
|
|
55
|
-
- Present multiple perspectives when relevant
|
|
56
|
-
- Distinguish between facts and interpretations
|
|
57
|
-
- Flag when information might be outdated
|
|
58
|
-
- Structure findings hierarchically
|
|
59
|
-
|
|
60
|
-
Report your progress after each major step.`,
|
|
61
|
-
coding: `You are a Coding Agent. Your goal is to implement, debug, or improve code based on the given objective.
|
|
62
|
-
|
|
63
|
-
Process:
|
|
64
|
-
1. Understand the requirements thoroughly
|
|
65
|
-
2. Explore existing code if relevant
|
|
66
|
-
3. Plan the implementation approach
|
|
67
|
-
4. Write clean, documented code
|
|
68
|
-
5. Test and verify the solution
|
|
69
|
-
|
|
70
|
-
Guidelines:
|
|
71
|
-
- Follow existing code conventions in the project
|
|
72
|
-
- Write clear comments for complex logic
|
|
73
|
-
- Handle edge cases and errors gracefully
|
|
74
|
-
- Consider performance implications
|
|
75
|
-
- Provide a summary of changes made
|
|
76
|
-
|
|
77
|
-
Report your progress after each significant step.`,
|
|
78
|
-
writing: `You are a Writing Agent. Your goal is to create high-quality written content based on the given objective.
|
|
79
|
-
|
|
80
|
-
Process:
|
|
81
|
-
1. Understand the purpose and audience
|
|
82
|
-
2. Research the topic if needed
|
|
83
|
-
3. Create an outline
|
|
84
|
-
4. Write the first draft
|
|
85
|
-
5. Review and refine
|
|
86
|
-
|
|
87
|
-
Guidelines:
|
|
88
|
-
- Match the tone and style to the purpose
|
|
89
|
-
- Structure content logically
|
|
90
|
-
- Use clear, concise language
|
|
91
|
-
- Support claims with evidence when relevant
|
|
92
|
-
- Proofread for grammar and clarity
|
|
93
|
-
|
|
94
|
-
Report your progress at each stage.`,
|
|
95
|
-
analysis: `You are an Analysis Agent. Your goal is to analyze data or information and provide actionable insights.
|
|
96
|
-
|
|
97
|
-
Process:
|
|
98
|
-
1. Understand the analysis objective
|
|
99
|
-
2. Gather and organize the data
|
|
100
|
-
3. Apply appropriate analytical methods
|
|
101
|
-
4. Identify patterns and insights
|
|
102
|
-
5. Present findings with recommendations
|
|
103
|
-
|
|
104
|
-
Guidelines:
|
|
105
|
-
- Be objective and data-driven
|
|
106
|
-
- Acknowledge limitations in the data
|
|
107
|
-
- Provide context for numbers
|
|
108
|
-
- Make recommendations actionable
|
|
109
|
-
- Visualize data when helpful
|
|
110
|
-
|
|
111
|
-
Report your progress and key findings along the way.`,
|
|
112
|
-
osint: `You are an OSINT (Open Source Intelligence) Agent. Your goal is to investigate entities, trace financial flows, map organizational relationships, and build comprehensive intelligence profiles using public records and open data sources.
|
|
113
|
-
|
|
114
|
-
Process:
|
|
115
|
-
1. Identify the target entity (person, organization, committee)
|
|
116
|
-
2. Search across public records databases (FEC, IRS 990, USAspending, SEC EDGAR, OpenCorporates)
|
|
117
|
-
3. Resolve and deduplicate entities using fuzzy matching and identifiers
|
|
118
|
-
4. Build relationship graphs connecting discovered entities
|
|
119
|
-
5. Enrich discovered entities with additional data from all available sources
|
|
120
|
-
6. Analyze patterns: financial flows, organizational hierarchies, political connections
|
|
121
|
-
7. Generate an intelligence report with confidence levels
|
|
122
|
-
|
|
123
|
-
Guidelines:
|
|
124
|
-
- Use only publicly available information from official government databases
|
|
125
|
-
- Cross-reference data across multiple sources to verify findings
|
|
126
|
-
- Flag low-confidence matches explicitly
|
|
127
|
-
- Build the knowledge graph incrementally, enriching as you discover connections
|
|
128
|
-
- Track the provenance of every data point (source API, date retrieved)
|
|
129
|
-
- Respect rate limits on all public APIs
|
|
130
|
-
- Distinguish between confirmed facts and inferred connections
|
|
131
|
-
- Quantify financial relationships with exact dollar amounts when available
|
|
132
|
-
- Note temporal aspects (when relationships were active)
|
|
133
|
-
- Provide actionable next steps for further investigation
|
|
134
|
-
|
|
135
|
-
Report findings as you progress through each data source.`
|
|
136
|
-
};
|
|
137
|
-
var AGENT_TOOL_PERMISSIONS = {
|
|
138
|
-
research: [
|
|
139
|
-
"web_search",
|
|
140
|
-
"browse_url",
|
|
141
|
-
"read_file",
|
|
142
|
-
"list_directory",
|
|
143
|
-
"search_files"
|
|
144
|
-
],
|
|
145
|
-
coding: [
|
|
146
|
-
"read_file",
|
|
147
|
-
"write_file",
|
|
148
|
-
"list_directory",
|
|
149
|
-
"search_files",
|
|
150
|
-
"execute_command"
|
|
151
|
-
],
|
|
152
|
-
writing: [
|
|
153
|
-
"read_file",
|
|
154
|
-
"write_file",
|
|
155
|
-
"web_search",
|
|
156
|
-
"browse_url"
|
|
157
|
-
],
|
|
158
|
-
analysis: [
|
|
159
|
-
"read_file",
|
|
160
|
-
"web_search",
|
|
161
|
-
"browse_url",
|
|
162
|
-
"list_directory",
|
|
163
|
-
"search_files"
|
|
164
|
-
],
|
|
165
|
-
osint: [
|
|
166
|
-
"web_search",
|
|
167
|
-
"browse_url",
|
|
168
|
-
"read_file",
|
|
169
|
-
"search_files",
|
|
170
|
-
"osint_search",
|
|
171
|
-
"osint_graph",
|
|
172
|
-
"osint_enrich",
|
|
173
|
-
"osint_analyze"
|
|
174
|
-
]
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
// src/core/observability/error-tracker.ts
|
|
178
|
-
import { eq, and, gte, lte, desc } from "drizzle-orm";
|
|
179
|
-
async function trackError(error) {
|
|
180
|
-
metric.error(error.source);
|
|
181
|
-
console.error(`[${error.source.toUpperCase()}] ${error.errorType}: ${error.message}`);
|
|
182
|
-
if (error.stack) {
|
|
183
|
-
console.error(error.stack);
|
|
184
|
-
}
|
|
185
|
-
const [logged] = await db.insert(errorLogs).values({
|
|
186
|
-
source: error.source,
|
|
187
|
-
errorType: error.errorType,
|
|
188
|
-
errorCode: error.errorCode,
|
|
189
|
-
message: error.message,
|
|
190
|
-
stack: error.stack,
|
|
191
|
-
context: error.context,
|
|
192
|
-
userId: error.userId,
|
|
193
|
-
conversationId: error.conversationId
|
|
194
|
-
}).returning();
|
|
195
|
-
return logged.id;
|
|
196
|
-
}
|
|
197
|
-
function captureException(err, source, context, userId) {
|
|
198
|
-
const error = err instanceof Error ? err : new Error(String(err));
|
|
199
|
-
return trackError({
|
|
200
|
-
source,
|
|
201
|
-
errorType: error.constructor.name,
|
|
202
|
-
message: error.message,
|
|
203
|
-
stack: error.stack,
|
|
204
|
-
context,
|
|
205
|
-
userId
|
|
206
|
-
});
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// src/core/agents/agent-worker.ts
|
|
210
58
|
var connection = new Redis(env.REDIS_URL, {
|
|
211
59
|
maxRetriesPerRequest: null
|
|
212
60
|
});
|
|
213
|
-
var anthropic = new Anthropic({
|
|
214
|
-
apiKey: env.CLAUDE_API_KEY
|
|
215
|
-
});
|
|
216
61
|
var worker = null;
|
|
217
62
|
async function processAgentTask(job) {
|
|
218
63
|
const { agentId, userId, type, objective, context, tokenBudget } = job.data;
|
|
@@ -222,22 +67,25 @@ async function processAgentTask(job) {
|
|
|
222
67
|
await updateAgentStatus(agentId, "running");
|
|
223
68
|
await addAgentProgress(agentId, 1, "Starting agent", "running");
|
|
224
69
|
const systemPrompt = buildSystemPrompt(type, context);
|
|
70
|
+
const provider = providerRegistry.getDefault();
|
|
225
71
|
const allowedToolNames = AGENT_TOOL_PERMISSIONS[type];
|
|
226
|
-
const agentTools = TOOLS.filter((t) => allowedToolNames.includes(t.name))
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
72
|
+
const agentTools = TOOLS.filter((t) => allowedToolNames.includes(t.name)).map((t) => ({
|
|
73
|
+
name: t.name,
|
|
74
|
+
description: t.description || "",
|
|
75
|
+
input_schema: t.input_schema || { type: "object", properties: {} }
|
|
76
|
+
}));
|
|
77
|
+
const userContent = `Your objective: ${objective}
|
|
231
78
|
|
|
232
79
|
${context ? `Additional context:
|
|
233
80
|
${JSON.stringify(context, null, 2)}` : ""}
|
|
234
81
|
|
|
235
|
-
Please proceed with the task, reporting your progress as you go
|
|
236
|
-
|
|
82
|
+
Please proceed with the task, reporting your progress as you go.`;
|
|
83
|
+
const messages = [
|
|
84
|
+
{ role: "user", content: userContent }
|
|
237
85
|
];
|
|
238
86
|
await addAgentMessage(agentId, {
|
|
239
87
|
role: "user",
|
|
240
|
-
content:
|
|
88
|
+
content: userContent
|
|
241
89
|
});
|
|
242
90
|
let stepNumber = 2;
|
|
243
91
|
const maxSteps = 20;
|
|
@@ -253,8 +101,9 @@ Please proceed with the task, reporting your progress as you go.`
|
|
|
253
101
|
);
|
|
254
102
|
break;
|
|
255
103
|
}
|
|
256
|
-
const response = await
|
|
257
|
-
model: "
|
|
104
|
+
const response = await provider.createMessage({
|
|
105
|
+
model: "",
|
|
106
|
+
// Use provider's default model
|
|
258
107
|
max_tokens: 4096,
|
|
259
108
|
system: systemPrompt,
|
|
260
109
|
tools: agentTools,
|
|
@@ -272,7 +121,7 @@ Please proceed with the task, reporting your progress as you go.`
|
|
|
272
121
|
break;
|
|
273
122
|
}
|
|
274
123
|
const assistantContent = response.content;
|
|
275
|
-
const textContent = assistantContent.filter((c) => c.type === "text").map((c) => c.text).join("\n");
|
|
124
|
+
const textContent = assistantContent.filter((c) => c.type === "text").map((c) => c.text || "").join("\n");
|
|
276
125
|
if (textContent) {
|
|
277
126
|
await addAgentMessage(agentId, {
|
|
278
127
|
role: "assistant",
|
|
@@ -298,19 +147,48 @@ Please proceed with the task, reporting your progress as you go.`
|
|
|
298
147
|
};
|
|
299
148
|
}
|
|
300
149
|
if (response.stop_reason === "tool_use") {
|
|
301
|
-
const
|
|
150
|
+
const toolResultBlocks = [];
|
|
302
151
|
for (const block of assistantContent) {
|
|
303
152
|
if (block.type === "tool_use") {
|
|
304
153
|
const toolName = block.name;
|
|
305
154
|
const toolInput = block.input;
|
|
306
155
|
console.log(`[Agent ${agentId}] Using tool: ${toolName}`);
|
|
156
|
+
const riskDecision = await riskEngine.evaluate({
|
|
157
|
+
action: "agent_tool_execute",
|
|
158
|
+
userId,
|
|
159
|
+
toolName,
|
|
160
|
+
input: toolInput,
|
|
161
|
+
metadata: { agentId, agentType: type }
|
|
162
|
+
});
|
|
163
|
+
if (!riskDecision.allowed) {
|
|
164
|
+
const failedChecks = riskDecision.checks.filter((c) => !c.passed).map((c) => c.message).join("; ");
|
|
165
|
+
const result2 = {
|
|
166
|
+
success: false,
|
|
167
|
+
result: null,
|
|
168
|
+
error: `[RiskEngine] Agent tool blocked: ${failedChecks}`
|
|
169
|
+
};
|
|
170
|
+
await addAgentMessage(agentId, {
|
|
171
|
+
role: "tool_result",
|
|
172
|
+
content: JSON.stringify({ tool: toolName, result: result2 }),
|
|
173
|
+
metadata: { toolInput }
|
|
174
|
+
});
|
|
175
|
+
toolResultBlocks.push({
|
|
176
|
+
type: "tool_result",
|
|
177
|
+
tool_use_id: block.id,
|
|
178
|
+
content: JSON.stringify(result2)
|
|
179
|
+
});
|
|
180
|
+
continue;
|
|
181
|
+
}
|
|
182
|
+
if (toolName === "crypto_exchange") {
|
|
183
|
+
toolInput._callerContext = "agent";
|
|
184
|
+
}
|
|
307
185
|
const result = await executeTool(toolName, toolInput);
|
|
308
186
|
await addAgentMessage(agentId, {
|
|
309
187
|
role: "tool_result",
|
|
310
188
|
content: JSON.stringify({ tool: toolName, result }),
|
|
311
189
|
metadata: { toolInput }
|
|
312
190
|
});
|
|
313
|
-
|
|
191
|
+
toolResultBlocks.push({
|
|
314
192
|
type: "tool_result",
|
|
315
193
|
tool_use_id: block.id,
|
|
316
194
|
content: JSON.stringify(result)
|
|
@@ -318,7 +196,7 @@ Please proceed with the task, reporting your progress as you go.`
|
|
|
318
196
|
}
|
|
319
197
|
}
|
|
320
198
|
messages.push({ role: "assistant", content: assistantContent });
|
|
321
|
-
messages.push({ role: "user", content:
|
|
199
|
+
messages.push({ role: "user", content: toolResultBlocks });
|
|
322
200
|
}
|
|
323
201
|
stepNumber++;
|
|
324
202
|
}
|
|
@@ -406,9 +284,9 @@ function stopAgentWorker() {
|
|
|
406
284
|
}
|
|
407
285
|
|
|
408
286
|
// src/inputs/calendar/trigger-processor.ts
|
|
409
|
-
import { eq
|
|
287
|
+
import { eq } from "drizzle-orm";
|
|
410
288
|
async function getUserTriggers(userId) {
|
|
411
|
-
const triggers = await db.select().from(calendarTriggers).where(
|
|
289
|
+
const triggers = await db.select().from(calendarTriggers).where(eq(calendarTriggers.userId, userId));
|
|
412
290
|
return triggers.map((t) => ({
|
|
413
291
|
id: t.id,
|
|
414
292
|
userId: t.userId,
|
|
@@ -450,7 +328,7 @@ async function processCalendarTriggers(userId, events, chatId) {
|
|
|
450
328
|
event,
|
|
451
329
|
scheduledJobId: jobId
|
|
452
330
|
});
|
|
453
|
-
await db.update(calendarTriggers).set({ lastTriggered: /* @__PURE__ */ new Date() }).where(
|
|
331
|
+
await db.update(calendarTriggers).set({ lastTriggered: /* @__PURE__ */ new Date() }).where(eq(calendarTriggers.id, trigger.id));
|
|
454
332
|
}
|
|
455
333
|
}
|
|
456
334
|
} catch (error) {
|
|
@@ -519,7 +397,7 @@ async function generateDailyBriefing(userId, events) {
|
|
|
519
397
|
}
|
|
520
398
|
|
|
521
399
|
// src/core/evolution/memory-shedder.ts
|
|
522
|
-
import { eq as
|
|
400
|
+
import { eq as eq2, and as and2, lt, lte as lte2 } from "drizzle-orm";
|
|
523
401
|
var SHED_CONFIG = {
|
|
524
402
|
staleDays: 90,
|
|
525
403
|
// Memories not accessed in 90 days
|
|
@@ -531,8 +409,8 @@ var SHED_CONFIG = {
|
|
|
531
409
|
async function findStaleMemories(userId, staleDays = SHED_CONFIG.staleDays) {
|
|
532
410
|
const cutoff = new Date(Date.now() - staleDays * 24 * 60 * 60 * 1e3);
|
|
533
411
|
const stale = await db.select().from(memories).where(
|
|
534
|
-
|
|
535
|
-
|
|
412
|
+
and2(
|
|
413
|
+
eq2(memories.userId, userId),
|
|
536
414
|
lt(memories.lastAccessed, cutoff)
|
|
537
415
|
)
|
|
538
416
|
);
|
|
@@ -557,9 +435,9 @@ function calculateStaleConfidence(lastAccessed, importance) {
|
|
|
557
435
|
}
|
|
558
436
|
async function findLowImportanceMemories(userId, threshold = SHED_CONFIG.lowImportanceThreshold) {
|
|
559
437
|
const lowImportance = await db.select().from(memories).where(
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
438
|
+
and2(
|
|
439
|
+
eq2(memories.userId, userId),
|
|
440
|
+
lte2(memories.importance, threshold)
|
|
563
441
|
)
|
|
564
442
|
);
|
|
565
443
|
return lowImportance.map((m) => ({
|
|
@@ -573,7 +451,7 @@ async function findLowImportanceMemories(userId, threshold = SHED_CONFIG.lowImpo
|
|
|
573
451
|
}));
|
|
574
452
|
}
|
|
575
453
|
async function findDuplicateMemories(userId) {
|
|
576
|
-
const allMemories = await db.select().from(memories).where(
|
|
454
|
+
const allMemories = await db.select().from(memories).where(eq2(memories.userId, userId));
|
|
577
455
|
const candidates = [];
|
|
578
456
|
const seen = /* @__PURE__ */ new Map();
|
|
579
457
|
for (const memory of allMemories) {
|
|
@@ -616,7 +494,7 @@ async function identifyShedCandidates(userId) {
|
|
|
616
494
|
);
|
|
617
495
|
}
|
|
618
496
|
async function archiveMemory(memoryId, reason) {
|
|
619
|
-
const [memory] = await db.select().from(memories).where(
|
|
497
|
+
const [memory] = await db.select().from(memories).where(eq2(memories.id, memoryId)).limit(1);
|
|
620
498
|
if (!memory) return false;
|
|
621
499
|
await db.insert(archivedMemories).values({
|
|
622
500
|
originalMemoryId: memory.id,
|
|
@@ -626,7 +504,7 @@ async function archiveMemory(memoryId, reason) {
|
|
|
626
504
|
reason,
|
|
627
505
|
originalCreatedAt: memory.createdAt
|
|
628
506
|
});
|
|
629
|
-
await db.delete(memories).where(
|
|
507
|
+
await db.delete(memories).where(eq2(memories.id, memoryId));
|
|
630
508
|
return true;
|
|
631
509
|
}
|
|
632
510
|
async function autoShed(userId, minConfidence = SHED_CONFIG.minConfidence) {
|
|
@@ -649,7 +527,7 @@ async function autoShed(userId, minConfidence = SHED_CONFIG.minConfidence) {
|
|
|
649
527
|
return results;
|
|
650
528
|
}
|
|
651
529
|
async function getArchivedMemories(userId, limit = 50) {
|
|
652
|
-
return db.select().from(archivedMemories).where(
|
|
530
|
+
return db.select().from(archivedMemories).where(eq2(archivedMemories.userId, userId)).limit(limit);
|
|
653
531
|
}
|
|
654
532
|
async function getShedStats(userId) {
|
|
655
533
|
const archived = await getArchivedMemories(userId, 1e3);
|
|
@@ -718,10 +596,10 @@ async function generateReport(userId, startDate, endDate, type) {
|
|
|
718
596
|
pointsGained: newAchievements.reduce((sum, a) => sum + a.points, 0)
|
|
719
597
|
},
|
|
720
598
|
modeUsage: {
|
|
721
|
-
productivity: modeStats.productivity,
|
|
722
|
-
creative: modeStats.creative,
|
|
723
|
-
research: modeStats.research,
|
|
724
|
-
learning: modeStats.learning
|
|
599
|
+
productivity: { sessions: modeStats.productivity.totalSessions, minutes: modeStats.productivity.totalMinutes },
|
|
600
|
+
creative: { sessions: modeStats.creative.totalSessions, minutes: modeStats.creative.totalMinutes },
|
|
601
|
+
research: { sessions: modeStats.research.totalSessions, minutes: modeStats.research.totalMinutes },
|
|
602
|
+
learning: { sessions: modeStats.learning.totalSessions, minutes: modeStats.learning.totalMinutes }
|
|
725
603
|
},
|
|
726
604
|
highlights,
|
|
727
605
|
suggestions
|
|
@@ -1094,4 +972,4 @@ export {
|
|
|
1094
972
|
generateBriefing,
|
|
1095
973
|
getQueueStats
|
|
1096
974
|
};
|
|
1097
|
-
//# sourceMappingURL=chunk-
|
|
975
|
+
//# sourceMappingURL=chunk-MFK34XSY.js.map
|