squidclaw 3.0.20 → 3.0.21
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/dist/{accounts-s5e9zidf.js → accounts-C7pGQPcS.js} +2 -2
- package/dist/{accounts-Bkb-J8V6.js → accounts-DjhBQg_8.js} +2 -2
- package/dist/{accounts-B6F_XCgS.js → accounts-DwGoZKGm.js} +17 -17
- package/dist/{active-listener-6-Svu8Dx.js → active-listener-DPc_PGsA.js} +2 -2
- package/dist/{agents-BOS_wASV.js → agents-DXKtU4Il.js} +4 -4
- package/dist/{agents.config-ChUZBohP.js → agents.config-BM-2SLCh.js} +1 -1
- package/dist/{agents.config-Dfsl4jNF.js → agents.config-eMSUW-iw.js} +1 -1
- package/dist/{api-key-rotation-TRwuCWbu.js → api-key-rotation-DVyYtQxC.js} +2 -2
- package/dist/{audio-preflight-DZ1LNMJp.js → audio-preflight-BUCBED7N.js} +32 -32
- package/dist/{audio-transcription-runner-B3u2x_ja.js → audio-transcription-runner-Cv0Q47cM.js} +12 -12
- package/dist/{audit-membership-runtime-w23FnNAN.js → audit-membership-runtime-DyLj-uhz.js} +4 -4
- package/dist/{auth-choice-B_pvWO2S.js → auth-choice-CXepQc7c.js} +1 -1
- package/dist/{auth-choice-kUm2JAky.js → auth-choice-D2JrMJn-.js} +1 -1
- package/dist/{banner-4LItBqCV.js → banner-DMfuBV69.js} +1 -1
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +51 -51
- package/dist/bundled/bootstrap-extra-files/handler.js +6 -6
- package/dist/bundled/command-logger/handler.js +2 -2
- package/dist/bundled/session-memory/handler.js +687 -51
- package/dist/canvas-host/a2ui/a2ui.bundle.js +1 -17815
- package/dist/{channel-activity-CxJbx4sD.js → channel-activity-CPpt4XaL.js} +3 -3
- package/dist/{channel-options-DA-4IR6h.js → channel-options-CQ-gER0J.js} +1 -1
- package/dist/{channel-options-DQeQl3Rk.js → channel-options-SijIkAlT.js} +1 -1
- package/dist/{channel-web--dAjVoio.js → channel-web-7t1a2N13.js} +1 -1
- package/dist/{channel-web-DJ21CAFF.js → channel-web-LLzBxZrT.js} +1 -1
- package/dist/{channels-cli-QvrLGt6C.js → channels-cli-D4xUEYYC.js} +6 -6
- package/dist/{channels-cli-DviJtKuS.js → channels-cli-DYaFNMme.js} +6 -6
- package/dist/{chrome-Dxm25ptH.js → chrome-OgCChbC_.js} +26 -26
- package/dist/{cli-aCubMdJg.js → cli-CAID9zkL.js} +1 -1
- package/dist/{cli-q7seQ2Xx.js → cli-Dlc9IFWZ.js} +1 -1
- package/dist/{command-registry-C_YMaVul.js → command-registry-AHS8_9da.js} +9 -9
- package/dist/{commands-registry-B44COZFz.js → commands-registry-BJjv8_oR.js} +4 -4
- package/dist/{completion-cli-CyKEJDPO.js → completion-cli-B8xjpHDs.js} +1 -1
- package/dist/{completion-cli-w4XQjhDI.js → completion-cli-BR1r9_h4.js} +2 -2
- package/dist/{config-cli-BhQXEuBv.js → config-cli-D0A8Awoo.js} +1 -1
- package/dist/{config-cli-BfhjWCvB.js → config-cli-D4Rxoozg.js} +1 -1
- package/dist/{configure-Dsg_0ymU.js → configure-DOiI8_8c.js} +3 -3
- package/dist/{configure-0xkYrQ0e.js → configure-XmOqwwy9.js} +3 -3
- package/dist/control-ui/assets/{index-cM5P_3w7.js → index-BqxuPQOl.js} +2 -2
- package/dist/control-ui/assets/{index-cM5P_3w7.js.map → index-BqxuPQOl.js.map} +1 -1
- package/dist/control-ui/index.html +1 -1
- package/dist/{deliver-BcnsjbAB.js → deliver-DMTUTpTM.js} +21 -21
- package/dist/deliver-runtime-B80olQwJ.js +36 -0
- package/dist/deps-send-discord.runtime-GIuvX7Xw.js +26 -0
- package/dist/deps-send-imessage.runtime-B3TC7G80.js +25 -0
- package/dist/deps-send-signal.runtime-CuVJyw7n.js +24 -0
- package/dist/deps-send-slack.runtime-cbfFoLZ4.js +22 -0
- package/dist/deps-send-telegram.runtime-CRyP-xDQ.js +27 -0
- package/dist/deps-send-whatsapp.runtime-4aOUBP2J.js +60 -0
- package/dist/{deps-send-whatsapp.runtime-BNAJe11S.js → deps-send-whatsapp.runtime-CETLGt-t.js} +3 -3
- package/dist/{deps-send-whatsapp.runtime-qBpqM2k9.js → deps-send-whatsapp.runtime-CrxkfP31.js} +2 -2
- package/dist/{deps-send-whatsapp.runtime-BGDIgEzh.js → deps-send-whatsapp.runtime-__ogpmJj.js} +3 -3
- package/dist/{diagnostic-C2lklhkn.js → diagnostic-CnVwZNbm.js} +2 -2
- package/dist/{doctor-completion-BlkbgU5h.js → doctor-completion-CZoEdMS-.js} +1 -1
- package/dist/{doctor-completion-BCQdm02b.js → doctor-completion-DhLEFUhN.js} +1 -1
- package/dist/entry.js +2 -2
- package/dist/{plugin-sdk/errors-CgRPdp3o.js → errors-kkRuS2Cs.js} +1 -1
- package/dist/extensionAPI.js +1 -1
- package/dist/{fetch-b8tSR7_e.js → fetch-DP-JjB6Z.js} +5 -5
- package/dist/{fetch-guard-D16tjNsZ.js → fetch-guard-BDy975wP.js} +2 -2
- package/dist/{frontmatter-CjKtFduT.js → frontmatter-Cq1TcIQ2.js} +3 -3
- package/dist/{fs-safe-CwHbZdFH.js → fs-safe-BoB4X3GD.js} +4 -4
- package/dist/{gateway-cli-tFwyE4a3.js → gateway-cli-BJHBChfI.js} +8 -8
- package/dist/{gateway-cli-uWj08vdf.js → gateway-cli-BpHskeDd.js} +8 -8
- package/dist/{github-copilot-token-Cw3tAXM9.js → github-copilot-token-B5cPlwaz.js} +7 -7
- package/dist/{health-BwC4Qe5W.js → health-TmpUGSqu.js} +1 -1
- package/dist/{health-DS3reqch.js → health-XFKFZ7ZJ.js} +1 -1
- package/dist/{hooks-cli-oei5kRQM.js → hooks-cli-CXsZK8H9.js} +2 -2
- package/dist/{hooks-cli-tp5LchRL.js → hooks-cli-DsDV-Pxz.js} +2 -2
- package/dist/{image-C-8Kd2Mh.js → image-kKMG59st.js} +6 -6
- package/dist/{image-ops-BoN1E_WZ.js → image-ops-Dg8iraUV.js} +2 -2
- package/dist/image-runtime-BqIv7p_K.js +29 -0
- package/dist/index.js +6 -6
- package/dist/{ir-Dut0zXyS.js → ir-CKK03mBV.js} +8 -8
- package/dist/{legacy-names-B0wgIP0Q.js → legacy-names-aGJJuzM_.js} +1 -1
- package/dist/llm-slug-generator.js +51 -51
- package/dist/{logger-oGKcCLZ5.js → logger-CnTSBL7T.js} +7 -7
- package/dist/{login-DJ357UQV.js → login-CeKDrz6_.js} +5 -5
- package/dist/{login-qr-C0fDBnpM.js → login-qr-KbOpR0GQ.js} +10 -10
- package/dist/{manager-BPGhs30n.js → manager-DINhLnMi.js} +13 -13
- package/dist/manager-runtime-D6ckUNSs.js +18 -0
- package/dist/{model-selection-CHnojCCK.js → model-selection-DuNLFQPR.js} +43 -43
- package/dist/{models-D9X4EUlY.js → models-5VXwJBU2.js} +2 -2
- package/dist/{models-cli-LGp-Tok9.js → models-cli-Br56IHfy.js} +3 -3
- package/dist/{models-cli-C1PLBYF7.js → models-cli-CrR1RN3j.js} +2 -2
- package/dist/{npm-resolution-BUvQm-e-.js → npm-resolution-CKtyq4FH.js} +1 -1
- package/dist/{npm-resolution-Dtkh26DG.js → npm-resolution-CPk7dS7F.js} +1 -1
- package/dist/{onboard-DDD6GX8E.js → onboard-DUnBamC0.js} +2 -2
- package/dist/{onboard-channels-9My16AOy.js → onboard-channels-D45grihx.js} +1 -1
- package/dist/{onboard-channels-Bm_NXV3z.js → onboard-channels-_kVo3Apf.js} +1 -1
- package/dist/{onboard-B0padonr.js → onboard-lFwpCpC3.js} +2 -2
- package/dist/{onboarding-dES4q9RV.js → onboarding-CyCSQ__q.js} +3 -3
- package/dist/{onboarding-o-id7p0-.js → onboarding-EEd_g8Zg.js} +3 -3
- package/dist/{onboarding.finalize-dpgNgUt5.js → onboarding.finalize-CbMq7C4K.js} +5 -5
- package/dist/{onboarding.finalize-BFtOLT7n.js → onboarding.finalize-Cs1ukjFN.js} +6 -6
- package/dist/{outbound-qTioiTJg.js → outbound-C9svt6RH.js} +6 -6
- package/dist/{outbound-attachment-rlW7G5df.js → outbound-attachment-DwupUxYF.js} +2 -2
- package/dist/{path-alias-guards-Cpsiv2KL.js → path-alias-guards-DORgbZ1w.js} +1 -1
- package/dist/{paths-CSdAWKDO.js → paths-DA5srn0U.js} +5 -5
- package/dist/{paths-CXClY8zC.js → paths-DSd911Oe.js} +4 -4
- package/dist/{pi-embedded-BpHQIzjg.js → pi-embedded-BN8fghaF.js} +137 -4
- package/dist/{pi-embedded-B_4NAHxA.js → pi-embedded-BiC4tIJ8.js} +300 -167
- package/dist/{pi-embedded-helpers-DQ7IaeOi.js → pi-embedded-helpers-Di58J7Eh.js} +52 -52
- package/dist/{pi-model-discovery-o-WX5w2t.js → pi-model-discovery-V-InbjOM.js} +7 -7
- package/dist/pi-model-discovery-runtime--t6tAlar.js +11 -0
- package/dist/{pi-tools.before-tool-call.runtime-B_LUttg1.js → pi-tools.before-tool-call.runtime-Bpk4qTgV.js} +9 -9
- package/dist/{plugin-registry-CCeUDvxY.js → plugin-registry-CXm125Uz.js} +1 -1
- package/dist/{plugin-registry-CCkpP8-I.js → plugin-registry-D3PnPE1D.js} +1 -1
- package/dist/plugin-sdk/{accounts-0kF5cxkn.js → accounts-C5PAuCTj.js} +2 -2
- package/dist/plugin-sdk/{accounts-u0-JAHzj.js → accounts-DC5cbH9r.js} +2 -2
- package/dist/plugin-sdk/{accounts-xZOA23tQ.js → accounts-DncG0Hx9.js} +3 -3
- package/dist/plugin-sdk/{active-listener-C5xPUSTb.js → active-listener-Bd3HH2km.js} +2 -2
- package/dist/plugin-sdk/agents/agent-tier.d.ts +33 -0
- package/dist/plugin-sdk/{api-key-rotation-DyjMI2n3.js → api-key-rotation-BAZ0GD26.js} +2 -2
- package/dist/plugin-sdk/{audio-preflight-C0q7lu6y.js → audio-preflight-tpVm-t9O.js} +26 -26
- package/dist/plugin-sdk/{audio-transcription-runner-Ced47O1H.js → audio-transcription-runner-DSScb434.js} +11 -11
- package/dist/plugin-sdk/{audit-membership-runtime-Xl20kCBe.js → audit-membership-runtime-DHQDvH4u.js} +2 -2
- package/dist/plugin-sdk/{channel-activity-CNffKOEQ.js → channel-activity-cYEaofTH.js} +3 -3
- package/dist/plugin-sdk/{channel-web-BQE2gJ5U.js → channel-web-CbeCrQ4C.js} +18 -18
- package/dist/plugin-sdk/{channel-web-BtNgAS1G.js → channel-web-CqiSEc52.js} +1 -1
- package/dist/plugin-sdk/{chrome-DJQWo149.js → chrome-DB2h0uN0.js} +6 -6
- package/dist/plugin-sdk/{commands-registry-_kBPE22q.js → commands-registry-DGZ1oFXJ.js} +4 -4
- package/dist/plugin-sdk/{common-J8vIST9Q.js → common-D5lLWoCW.js} +2 -2
- package/dist/plugin-sdk/compat.js +2 -2
- package/dist/plugin-sdk/{config-CnZ1TlEw.js → config-Bt-c7PWF.js} +7 -7
- package/dist/plugin-sdk/{deliver-Xh6voz9H.js → deliver-MvrkIeKJ.js} +10 -10
- package/dist/plugin-sdk/deliver-runtime-i50kjcNM.js +32 -0
- package/dist/plugin-sdk/deps-send-discord.runtime-hOYq9ov0.js +23 -0
- package/dist/plugin-sdk/deps-send-imessage.runtime-D5n9DXyL.js +22 -0
- package/dist/plugin-sdk/deps-send-signal.runtime-CwEaRyJU.js +21 -0
- package/dist/plugin-sdk/deps-send-slack.runtime-DOZeLIaC.js +19 -0
- package/dist/plugin-sdk/deps-send-telegram.runtime-BW1hSPKh.js +24 -0
- package/dist/plugin-sdk/{deps-send-whatsapp.runtime-V0Jfat5S.js → deps-send-whatsapp.runtime-DvxhnHR_.js} +3 -3
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-JKmTtCFM.js +57 -0
- package/dist/plugin-sdk/{diagnostic-DKsyROPi.js → diagnostic-B6F3BtCX.js} +2 -2
- package/dist/{errors-DfgAh2Ml.js → plugin-sdk/errors-9oVz7reJ.js} +1 -1
- package/dist/plugin-sdk/{fetch-guard-BBAT8G-1.js → fetch-guard-cfPCfkrw.js} +2 -2
- package/dist/plugin-sdk/{fs-safe-DqCO1D4C.js → fs-safe-DFbwq9CS.js} +3 -3
- package/dist/plugin-sdk/{image-4ay2cw7G.js → image-FK5xhY5u.js} +6 -6
- package/dist/plugin-sdk/{image-ops-G8KoEfY8.js → image-ops-BSYgrL7E.js} +2 -2
- package/dist/plugin-sdk/image-runtime-B95EPFpg.js +25 -0
- package/dist/plugin-sdk/index.js +2 -2
- package/dist/plugin-sdk/{ir-DXj1KGnL.js → ir-CWmryq5f.js} +7 -7
- package/dist/plugin-sdk/{local-roots-ovKHgVSP.js → local-roots-U25IdeDH.js} +4 -4
- package/dist/plugin-sdk/{logger-DIb2cGHp.js → logger-Bg4vIUJn.js} +2 -2
- package/dist/plugin-sdk/{login-Cgtm70by.js → login-8qzl2H7G.js} +4 -4
- package/dist/plugin-sdk/{login-qr-BrixqhMx.js → login-qr-kalCTJEw.js} +5 -5
- package/dist/plugin-sdk/{manager-PEQ_cPYF.js → manager-ijYHktIt.js} +8 -8
- package/dist/plugin-sdk/manager-runtime--JrLQE03.js +15 -0
- package/dist/plugin-sdk/mattermost.js +3 -3
- package/dist/plugin-sdk/nextcloud-talk.js +2 -2
- package/dist/plugin-sdk/{outbound-BK75h9CQ.js → outbound-BIVf0aPq.js} +5 -5
- package/dist/plugin-sdk/{outbound-attachment-BI1QngTS.js → outbound-attachment-F5tzeNUD.js} +2 -2
- package/dist/plugin-sdk/{path-alias-guards-TnxupPQC.js → path-alias-guards-DA0MhfkG.js} +1 -1
- package/dist/plugin-sdk/{paths-B7_75Pdr.js → paths-CP67O8eN.js} +1 -1
- package/dist/plugin-sdk/{pi-embedded-helpers-BioULNev.js → pi-embedded-helpers-CxMnPQ37.js} +16 -16
- package/dist/plugin-sdk/{pi-model-discovery-BMmAbnil.js → pi-model-discovery-8OL77kCh.js} +1 -1
- package/dist/plugin-sdk/pi-model-discovery-runtime-DGRFpUfd.js +8 -0
- package/dist/plugin-sdk/{pi-tools.before-tool-call.runtime-rdRqZ9lk.js → pi-tools.before-tool-call.runtime-B7FW36KX.js} +4 -4
- package/dist/plugin-sdk/{plugins-BqKpJkqt.js → plugins-D3mrhffi.js} +4 -4
- package/dist/plugin-sdk/{proxy-env-C4s12rr8.js → proxy-env-CUUXO6rv.js} +1 -1
- package/dist/plugin-sdk/{proxy-fetch-Dt5BedH8.js → proxy-fetch-Cf3IUSDw.js} +1 -1
- package/dist/plugin-sdk/{pw-ai-Cb0ZDSq4.js → pw-ai-dPmKdw_w.js} +9 -9
- package/dist/plugin-sdk/{qmd-manager-Bei6TaFq.js → qmd-manager-Ov9ElEfG.js} +7 -7
- package/dist/plugin-sdk/{query-expansion-POz2za8a.js → query-expansion-CzjwW461.js} +4 -4
- package/dist/plugin-sdk/{redact-9WsNyb7S.js → redact-DfACyt0X.js} +1 -1
- package/dist/plugin-sdk/{reply-DJYA4ZNu.js → reply-BczXGzC_.js} +137 -4
- package/dist/plugin-sdk/{reply-DeKKmUDh.js → reply-Dfjh1YtV.js} +206 -73
- package/dist/plugin-sdk/{resolve-outbound-target-DL1adXpk.js → resolve-outbound-target-BeIB_jm0.js} +2 -2
- package/dist/plugin-sdk/{run-with-concurrency-DmTrN5JG.js → run-with-concurrency-kVooFCVo.js} +1 -1
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-B6EcC22F.js +10 -0
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-DH8J0Ie7.js +19 -0
- package/dist/plugin-sdk/{send-BCVXt-3e.js → send-CgkNzAhS.js} +8 -8
- package/dist/plugin-sdk/{send-CAG0Or0G.js → send-CuENGOhq.js} +7 -7
- package/dist/plugin-sdk/{send-X6QuS7x0.js → send-D6Uh2D1D.js} +5 -5
- package/dist/plugin-sdk/{send-BNePC8CO.js → send-DV5kR0Hg.js} +6 -6
- package/dist/plugin-sdk/{send-DhGDAZnT.js → send-DtA6ngBJ.js} +13 -13
- package/dist/plugin-sdk/{session-CAqYQVhe.js → session-CnlZn-bR.js} +3 -3
- package/dist/plugin-sdk/{skill-commands-Bk-IFyNw.js → skill-commands-Ckfii7h8.js} +4 -4
- package/dist/plugin-sdk/{skills-C5bT9-q4.js → skills-v0WQqKTa.js} +6 -6
- package/dist/plugin-sdk/slash-commands.runtime-BYoxsxkX.js +13 -0
- package/dist/plugin-sdk/{slash-dispatch.runtime-k8xSVYOI.js → slash-dispatch.runtime-DOo1IzuY.js} +1 -1
- package/dist/plugin-sdk/slash-dispatch.runtime-JfFr7bNy.js +52 -0
- package/dist/plugin-sdk/slash-skill-commands.runtime-D0399tia.js +16 -0
- package/dist/plugin-sdk/{store-D3lgWnS2.js → store-C_UrNuM3.js} +2 -2
- package/dist/plugin-sdk/{subagent-registry-runtime-D6cTAG2k.js → subagent-registry-runtime-DLvup9ph.js} +1 -1
- package/dist/plugin-sdk/subagent-registry-runtime-DVl5xKOW.js +52 -0
- package/dist/plugin-sdk/{tables-Dmlu4_q_.js → tables-CJP05iMa.js} +1 -1
- package/dist/plugin-sdk/{thinking-DRNOh5Xx.js → thinking-BhP3vn1l.js} +7 -7
- package/dist/plugin-sdk/{tokens-CLE20fRI.js → tokens-DAL_5WHL.js} +1 -1
- package/dist/plugin-sdk/{tool-images-BY1gsRyE.js → tool-images-ZE5G5UM0.js} +2 -2
- package/dist/plugin-sdk/{web-DkbCMgLG.js → web-C2Sj2WW0.js} +2 -2
- package/dist/plugin-sdk/web-CNY_ky8h.js +56 -0
- package/dist/plugin-sdk/{whatsapp-actions-BCJYmWCB.js → whatsapp-actions-DJmx6ihj.js} +17 -17
- package/dist/plugin-sdk/whatsapp.js +50 -50
- package/dist/{plugins-AqsVZZk3.js → plugins-DvejjZnJ.js} +11 -11
- package/dist/{plugins-cli-DFpHU_xo.js → plugins-cli-BA_2daJe.js} +2 -2
- package/dist/{plugins-cli-CZCadI9y.js → plugins-cli-C0WKWrZo.js} +2 -2
- package/dist/{program-B4_o5EDH.js → program-D_xdLzmM.js} +7 -7
- package/dist/{program-context-CkfdLtpp.js → program-context-DfmCIQ91.js} +17 -17
- package/dist/{prompt-select-styled-C1DFrYuk.js → prompt-select-styled-ApPSadr5.js} +4 -4
- package/dist/{prompt-select-styled-CZJJ2rPA.js → prompt-select-styled-BsheNEnh.js} +4 -4
- package/dist/{provider-auth-helpers-BlYwNWkq.js → provider-auth-helpers-B5kD4Lt6.js} +1 -1
- package/dist/{provider-auth-helpers-C5taJG0R.js → provider-auth-helpers-DpOFkV28.js} +1 -1
- package/dist/{proxy-env-DXXfs2WL.js → proxy-env-D-fike7s.js} +1 -1
- package/dist/{proxy-fetch-C2v-Utgg.js → proxy-fetch-lH6RsRTE.js} +1 -1
- package/dist/{push-apns-Dkjfalec.js → push-apns-BbenjEX4.js} +1 -1
- package/dist/{push-apns-Bhk1_5ut.js → push-apns-Ci2sdIKf.js} +1 -1
- package/dist/{pw-ai-GOBxzChI.js → pw-ai-B8ymIYub.js} +14 -14
- package/dist/{qmd-manager-CO-shcLU.js → qmd-manager-BN0siR2Z.js} +10 -10
- package/dist/{query-expansion-DlQOkf-g.js → query-expansion-Dzxt6kXo.js} +6 -6
- package/dist/{redact-NmPEVjIo.js → redact-DvzicBMu.js} +1 -1
- package/dist/{register.agent-s2PqcoIS.js → register.agent-CY6R-7fn.js} +6 -6
- package/dist/{register.agent-DOp4lbyc.js → register.agent-Dk_5V5oA.js} +7 -7
- package/dist/{register.configure-DABoMBBf.js → register.configure-C8OFfGln.js} +7 -7
- package/dist/{register.configure-BGfourxZ.js → register.configure-DT1RLeTR.js} +7 -7
- package/dist/{register.maintenance-Bdr3bSAF.js → register.maintenance-CluQOq8b.js} +8 -8
- package/dist/{register.maintenance-DmP8sVxb.js → register.maintenance-YHXmOQzf.js} +7 -7
- package/dist/{register.message-DF0InVCv.js → register.message-BCTXT5yK.js} +2 -2
- package/dist/{register.message-gz8DaAc1.js → register.message-BuoFjRqA.js} +2 -2
- package/dist/{register.onboard-Do14cwDQ.js → register.onboard-BJaRMtxU.js} +2 -2
- package/dist/{register.onboard-auVLfmF3.js → register.onboard-C64oXnvq.js} +2 -2
- package/dist/{register.setup-ZyGJlYOD.js → register.setup-Dl3nk2Ui.js} +2 -2
- package/dist/{register.setup-B3aVuPyo.js → register.setup-Drc55K_w.js} +2 -2
- package/dist/{register.status-health-sessions-C-1HE5oP.js → register.status-health-sessions-BHtbPeCO.js} +3 -3
- package/dist/{register.status-health-sessions-vFpvdVS1.js → register.status-health-sessions-xgC_gtEM.js} +3 -3
- package/dist/{register.subclis-BYiAuTiK.js → register.subclis-CDMFyaKR.js} +9 -9
- package/dist/{reply-BaVB3YlN.js → reply-DwjHsBuj.js} +137 -4
- package/dist/{run-main-DW-JR8hB.js → run-main-BcA22Ipv.js} +14 -14
- package/dist/{run-with-concurrency-FczpX8ng.js → run-with-concurrency-BFR3ReeF.js} +4 -4
- package/dist/runtime-whatsapp-login.runtime-DxV9iv6l.js +13 -0
- package/dist/runtime-whatsapp-outbound.runtime-DQqIlwhS.js +22 -0
- package/dist/{send-Bx9CqcZr.js → send-4nRsZJXH.js} +7 -7
- package/dist/{send-D5D0ZGht.js → send-BGlcHjUD.js} +26 -26
- package/dist/{send-DtHQ7_6Z.js → send-BTUU1jWM.js} +8 -8
- package/dist/{send-B9H0BkfO.js → send-DdBbRpTP.js} +6 -6
- package/dist/{send-B5QEmMJ4.js → send-dTQd-IyJ.js} +5 -5
- package/dist/{server-node-events-rumcq7j0.js → server-node-events-Q0cT2ifj.js} +2 -2
- package/dist/{server-node-events-D-EmiDyc.js → server-node-events-YN5eJeHa.js} +2 -2
- package/dist/{session-DLTCuoUD.js → session-CnCwDJke.js} +8 -8
- package/dist/{skill-commands-BwTLQRR8.js → skill-commands-Cz45_nme.js} +9 -9
- package/dist/{skills-B9N2bqKU.js → skills-CdCS1HeL.js} +22 -22
- package/dist/slash-commands.runtime-CZz6v6b3.js +16 -0
- package/dist/{slash-dispatch.runtime-sVHNrSL1.js → slash-dispatch.runtime-BOMEVFk0.js} +1 -1
- package/dist/{slash-dispatch.runtime-DPRwMKXk.js → slash-dispatch.runtime-DB1QsBRc.js} +1 -1
- package/dist/slash-dispatch.runtime-SO7HOe8q.js +56 -0
- package/dist/{slash-dispatch.runtime-BeltKAMm.js → slash-dispatch.runtime-sXaUYn4v.js} +1 -1
- package/dist/slash-skill-commands.runtime-Bawt7j0r.js +20 -0
- package/dist/{status-BeSD1NDD.js → status-Bh5x6DsW.js} +2 -2
- package/dist/{status-DGF_ROMC.js → status-cU9cJReo.js} +2 -2
- package/dist/{store-CvQ41zCV.js → store-D9z0dn7D.js} +2 -2
- package/dist/{subagent-registry-CgUBOyi3.js → subagent-registry-CIgFD2oi.js} +137 -4
- package/dist/{subagent-registry-runtime-Bxc5DYZt.js → subagent-registry-runtime-232sNNT6.js} +1 -1
- package/dist/subagent-registry-runtime-D2rUxU5J.js +56 -0
- package/dist/{subagent-registry-runtime-BYpjZwjA.js → subagent-registry-runtime-D7ubAnDZ.js} +1 -1
- package/dist/{subagent-registry-runtime-Cx5vPpG8.js → subagent-registry-runtime-DGTjU9Lb.js} +1 -1
- package/dist/{subsystem-BaLYRf7D.js → subsystem-6v7sWnAD.js} +14 -14
- package/dist/{tables-BRYYxYs7.js → tables-BTFiZyRU.js} +1 -1
- package/dist/{target-errors-D0ZJUbbf.js → target-errors-DgNRx3Nr.js} +2 -2
- package/dist/{thinking-B-A99X3F.js → thinking-B75CXkTT.js} +7 -7
- package/dist/{tokens-D2XhLqIz.js → tokens-DfbMVF9y.js} +1 -1
- package/dist/{tool-images-Zn6jVmkX.js → tool-images-Dp5OiXeA.js} +2 -2
- package/dist/{update-cli-Duy8S3Bj.js → update-cli-CktBOXZF.js} +7 -7
- package/dist/{update-cli-BSIF-OEa.js → update-cli-DM_dUip_.js} +8 -8
- package/dist/{update-runner-CMpruPN8.js → update-runner-BBJZmfZ4.js} +1 -1
- package/dist/{update-runner-D_nDdx7d.js → update-runner-BYGPkHXG.js} +1 -1
- package/dist/{web-C-5RPkV9.js → web-CZhZC1EA.js} +2 -2
- package/dist/{web-CKY0tK0k.js → web-Chw1dtKA.js} +1 -1
- package/dist/{web-Bnr4YuWJ.js → web-DWRZAXj9.js} +2 -2
- package/dist/{web-C0xcHURK.js → web-QsxgXbNK.js} +55 -55
- package/dist/{whatsapp-actions-Cuy0qeQK.js → whatsapp-actions-CzqsuSGx.js} +21 -21
- package/dist/{workspace-TqfVSQuO.js → workspace-kVMIaBrV.js} +20 -20
- package/extensions/acpx/node_modules/.bin/acpx +2 -2
- package/extensions/diagnostics-otel/node_modules/.bin/acorn +2 -2
- package/extensions/diffs/node_modules/.bin/playwright-core +2 -2
- package/extensions/googlechat/node_modules/.bin/squidclaw +2 -2
- package/extensions/matrix/node_modules/.bin/markdown-it +2 -2
- package/extensions/memory-core/node_modules/.bin/squidclaw +2 -2
- package/extensions/memory-lancedb/node_modules/.bin/arrow2csv +2 -2
- package/extensions/memory-lancedb/node_modules/.bin/openai +2 -2
- package/extensions/nostr/node_modules/.bin/tsc +2 -2
- package/extensions/nostr/node_modules/.bin/tsserver +2 -2
- package/extensions/tlon/node_modules/.bin/tlon +2 -2
- package/package.json +1 -1
- package/dist/canvas-host/a2ui/.bundle.hash +0 -1
- package/dist/deliver-runtime-_mBfV_4S.js +0 -36
- package/dist/deps-send-discord.runtime-CUTAK2hy.js +0 -26
- package/dist/deps-send-imessage.runtime-CQOiEIuA.js +0 -25
- package/dist/deps-send-signal.runtime-wN7MkzLw.js +0 -24
- package/dist/deps-send-slack.runtime-HEEwW4uU.js +0 -22
- package/dist/deps-send-telegram.runtime-DHlcnjQO.js +0 -27
- package/dist/deps-send-whatsapp.runtime-B7GC68Cu.js +0 -60
- package/dist/export-html/vendor/highlight.min.js +0 -1213
- package/dist/export-html/vendor/marked.min.js +0 -6
- package/dist/image-runtime-D11wBIC8.js +0 -29
- package/dist/manager-runtime-BB9lcoFR.js +0 -18
- package/dist/pi-model-discovery-runtime-DBkQoIJw.js +0 -11
- package/dist/plugin-sdk/deliver-runtime-5UVcSskg.js +0 -32
- package/dist/plugin-sdk/deps-send-discord.runtime-DTspXSCt.js +0 -23
- package/dist/plugin-sdk/deps-send-imessage.runtime-qThAwDEe.js +0 -22
- package/dist/plugin-sdk/deps-send-signal.runtime-DnjnVzZF.js +0 -21
- package/dist/plugin-sdk/deps-send-slack.runtime-CbKevLnv.js +0 -19
- package/dist/plugin-sdk/deps-send-telegram.runtime-C6y29O9E.js +0 -24
- package/dist/plugin-sdk/deps-send-whatsapp.runtime-DPZSTh1j.js +0 -57
- package/dist/plugin-sdk/image-runtime-CpfepTDc.js +0 -25
- package/dist/plugin-sdk/manager-runtime-BmgTeb5G.js +0 -15
- package/dist/plugin-sdk/pi-model-discovery-runtime-COnuGwZt.js +0 -8
- package/dist/plugin-sdk/runtime-whatsapp-login.runtime-99sCh8RG.js +0 -10
- package/dist/plugin-sdk/runtime-whatsapp-outbound.runtime-dTkDaXHl.js +0 -19
- package/dist/plugin-sdk/slash-commands.runtime-EAZKpRKq.js +0 -13
- package/dist/plugin-sdk/slash-dispatch.runtime-E6j8gkO2.js +0 -52
- package/dist/plugin-sdk/slash-skill-commands.runtime-DGd_JSWX.js +0 -16
- package/dist/plugin-sdk/subagent-registry-runtime-Cca50Qld.js +0 -52
- package/dist/plugin-sdk/web-Be4JS3z8.js +0 -56
- package/dist/runtime-whatsapp-login.runtime-DumUjKRz.js +0 -13
- package/dist/runtime-whatsapp-outbound.runtime-Cgu2MfqR.js +0 -22
- package/dist/slash-commands.runtime-CjBXruwG.js +0 -16
- package/dist/slash-dispatch.runtime-C7rHRQFg.js +0 -56
- package/dist/slash-skill-commands.runtime-DYK20Lxf.js +0 -20
- package/dist/subagent-registry-runtime-Bm5UEB8c.js +0 -56
- package/docs/reference/templates/IDENTITY.md +0 -29
- package/docs/reference/templates/USER.md +0 -23
- package/docs/zh-CN/reference/templates/IDENTITY.md +0 -36
- package/docs/zh-CN/reference/templates/USER.md +0 -30
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +0 -178
|
@@ -1,63 +1,682 @@
|
|
|
1
|
-
import { c as resolveAgentWorkspaceDir } from "../../run-with-concurrency-
|
|
2
|
-
import { c as resolveStateDir } from "../../paths-
|
|
3
|
-
import { t as createSubsystemLogger } from "../../subsystem-
|
|
4
|
-
import { B as resolveAgentIdFromSessionKey } from "../../workspace-
|
|
5
|
-
import "../../logger-
|
|
6
|
-
import "../../model-selection-
|
|
7
|
-
import "../../github-copilot-token-
|
|
8
|
-
import "../../legacy-names-
|
|
9
|
-
import "../../thinking-
|
|
10
|
-
import "../../tokens-
|
|
11
|
-
import "../../pi-embedded-
|
|
12
|
-
import "../../plugins-
|
|
13
|
-
import "../../accounts-
|
|
14
|
-
import "../../send-
|
|
15
|
-
import "../../send-
|
|
16
|
-
import "../../deliver-
|
|
17
|
-
import "../../diagnostic-
|
|
18
|
-
import "../../accounts-
|
|
19
|
-
import "../../image-ops-
|
|
20
|
-
import "../../send-
|
|
21
|
-
import "../../pi-model-discovery-
|
|
22
|
-
import { dt as hasInterSessionUserProvenance } from "../../pi-embedded-helpers-
|
|
23
|
-
import "../../chrome-
|
|
24
|
-
import "../../frontmatter-
|
|
25
|
-
import "../../skills-
|
|
26
|
-
import "../../path-alias-guards-
|
|
27
|
-
import "../../redact-
|
|
28
|
-
import "../../errors-
|
|
29
|
-
import { c as writeFileWithinRoot } from "../../fs-safe-
|
|
30
|
-
import "../../proxy-env-
|
|
31
|
-
import "../../store-
|
|
32
|
-
import "../../accounts-
|
|
33
|
-
import "../../paths-
|
|
34
|
-
import "../../tool-images-
|
|
35
|
-
import "../../image-
|
|
36
|
-
import "../../audio-transcription-runner-
|
|
37
|
-
import "../../fetch-
|
|
38
|
-
import "../../fetch-guard-
|
|
39
|
-
import "../../api-key-rotation-
|
|
40
|
-
import "../../proxy-fetch-
|
|
41
|
-
import "../../ir-
|
|
1
|
+
import { a as resolveAgentDir, c as resolveAgentWorkspaceDir, l as resolveDefaultAgentId, o as resolveAgentEffectiveModelPrimary } from "../../run-with-concurrency-BFR3ReeF.js";
|
|
2
|
+
import { c as resolveStateDir } from "../../paths-DA5srn0U.js";
|
|
3
|
+
import { t as createSubsystemLogger } from "../../subsystem-6v7sWnAD.js";
|
|
4
|
+
import { B as resolveAgentIdFromSessionKey } from "../../workspace-kVMIaBrV.js";
|
|
5
|
+
import "../../logger-CnTSBL7T.js";
|
|
6
|
+
import { br as DEFAULT_MODEL, l as parseModelRef, xr as DEFAULT_PROVIDER } from "../../model-selection-DuNLFQPR.js";
|
|
7
|
+
import "../../github-copilot-token-B5cPlwaz.js";
|
|
8
|
+
import "../../legacy-names-aGJJuzM_.js";
|
|
9
|
+
import "../../thinking-B75CXkTT.js";
|
|
10
|
+
import "../../tokens-DfbMVF9y.js";
|
|
11
|
+
import { t as runEmbeddedPiAgent } from "../../pi-embedded-BiC4tIJ8.js";
|
|
12
|
+
import "../../plugins-DvejjZnJ.js";
|
|
13
|
+
import "../../accounts-DwGoZKGm.js";
|
|
14
|
+
import "../../send-DdBbRpTP.js";
|
|
15
|
+
import "../../send-BTUU1jWM.js";
|
|
16
|
+
import "../../deliver-DMTUTpTM.js";
|
|
17
|
+
import "../../diagnostic-CnVwZNbm.js";
|
|
18
|
+
import "../../accounts-C7pGQPcS.js";
|
|
19
|
+
import "../../image-ops-Dg8iraUV.js";
|
|
20
|
+
import "../../send-BGlcHjUD.js";
|
|
21
|
+
import "../../pi-model-discovery-V-InbjOM.js";
|
|
22
|
+
import { dt as hasInterSessionUserProvenance } from "../../pi-embedded-helpers-Di58J7Eh.js";
|
|
23
|
+
import "../../chrome-OgCChbC_.js";
|
|
24
|
+
import "../../frontmatter-Cq1TcIQ2.js";
|
|
25
|
+
import "../../skills-CdCS1HeL.js";
|
|
26
|
+
import "../../path-alias-guards-DORgbZ1w.js";
|
|
27
|
+
import "../../redact-DvzicBMu.js";
|
|
28
|
+
import "../../errors-kkRuS2Cs.js";
|
|
29
|
+
import { c as writeFileWithinRoot } from "../../fs-safe-BoB4X3GD.js";
|
|
30
|
+
import "../../proxy-env-D-fike7s.js";
|
|
31
|
+
import "../../store-D9z0dn7D.js";
|
|
32
|
+
import "../../accounts-DjhBQg_8.js";
|
|
33
|
+
import "../../paths-DSd911Oe.js";
|
|
34
|
+
import "../../tool-images-Dp5OiXeA.js";
|
|
35
|
+
import "../../image-kKMG59st.js";
|
|
36
|
+
import "../../audio-transcription-runner-Cv0Q47cM.js";
|
|
37
|
+
import "../../fetch-DP-JjB6Z.js";
|
|
38
|
+
import "../../fetch-guard-BDy975wP.js";
|
|
39
|
+
import "../../api-key-rotation-DVyYtQxC.js";
|
|
40
|
+
import "../../proxy-fetch-lH6RsRTE.js";
|
|
41
|
+
import "../../ir-CKK03mBV.js";
|
|
42
42
|
import "../../render-DW7AcFdD.js";
|
|
43
|
-
import "../../target-errors-
|
|
44
|
-
import "../../commands-registry-
|
|
45
|
-
import "../../skill-commands-
|
|
43
|
+
import "../../target-errors-DgNRx3Nr.js";
|
|
44
|
+
import "../../commands-registry-BJjv8_oR.js";
|
|
45
|
+
import "../../skill-commands-Cz45_nme.js";
|
|
46
46
|
import "../../fetch-tZXOZ9FV.js";
|
|
47
|
-
import "../../channel-activity-
|
|
48
|
-
import "../../tables-
|
|
49
|
-
import "../../send-
|
|
50
|
-
import "../../outbound-attachment-
|
|
51
|
-
import "../../send-
|
|
47
|
+
import "../../channel-activity-CPpt4XaL.js";
|
|
48
|
+
import "../../tables-BTFiZyRU.js";
|
|
49
|
+
import "../../send-dTQd-IyJ.js";
|
|
50
|
+
import "../../outbound-attachment-DwupUxYF.js";
|
|
51
|
+
import "../../send-4nRsZJXH.js";
|
|
52
52
|
import "../../proxy-CecQTx_Z.js";
|
|
53
|
-
import "../../manager-
|
|
54
|
-
import "../../query-expansion-
|
|
53
|
+
import "../../manager-DINhLnMi.js";
|
|
54
|
+
import "../../query-expansion-Dzxt6kXo.js";
|
|
55
55
|
import { generateSlugViaLLM } from "../../llm-slug-generator.js";
|
|
56
56
|
import { t as resolveHookConfig } from "../../config-DWRgGn0l.js";
|
|
57
57
|
import fs from "node:fs/promises";
|
|
58
58
|
import os from "node:os";
|
|
59
59
|
import path from "node:path";
|
|
60
|
+
import syncFs from "node:fs";
|
|
61
|
+
import { DatabaseSync } from "node:sqlite";
|
|
60
62
|
|
|
63
|
+
//#region src/memory/long-term/schema.ts
|
|
64
|
+
/**
|
|
65
|
+
* Long-Term Memory — SQLite Schema
|
|
66
|
+
* All tables + FTS5 virtual tables + sync triggers
|
|
67
|
+
*/
|
|
68
|
+
const LONG_TERM_MEMORY_SCHEMA = `
|
|
69
|
+
PRAGMA journal_mode = WAL;
|
|
70
|
+
PRAGMA foreign_keys = ON;
|
|
71
|
+
|
|
72
|
+
-- ── Working Memory (Layer 0) ─────────────────────────────────────────────────
|
|
73
|
+
CREATE TABLE IF NOT EXISTS working_memory (
|
|
74
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
75
|
+
session_id TEXT NOT NULL,
|
|
76
|
+
agent_id TEXT NOT NULL,
|
|
77
|
+
user_id TEXT NOT NULL,
|
|
78
|
+
content TEXT NOT NULL,
|
|
79
|
+
layer_hint TEXT,
|
|
80
|
+
created_at INTEGER NOT NULL DEFAULT (unixepoch())
|
|
81
|
+
);
|
|
82
|
+
CREATE INDEX IF NOT EXISTS idx_wm_session ON working_memory(session_id);
|
|
83
|
+
CREATE INDEX IF NOT EXISTS idx_wm_agent ON working_memory(agent_id, user_id);
|
|
84
|
+
|
|
85
|
+
-- ── Episodic Memory (Layer 1) ─────────────────────────────────────────────────
|
|
86
|
+
CREATE TABLE IF NOT EXISTS episodic (
|
|
87
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
88
|
+
agent_id TEXT NOT NULL,
|
|
89
|
+
user_id TEXT NOT NULL,
|
|
90
|
+
session_id TEXT,
|
|
91
|
+
timestamp INTEGER NOT NULL,
|
|
92
|
+
summary TEXT NOT NULL,
|
|
93
|
+
entities TEXT, -- JSON array (sorted), e.g. '["Preplix","Tamer"]'
|
|
94
|
+
tags TEXT, -- JSON array (sorted)
|
|
95
|
+
importance INTEGER NOT NULL DEFAULT 5,
|
|
96
|
+
embedding BLOB
|
|
97
|
+
);
|
|
98
|
+
CREATE INDEX IF NOT EXISTS idx_ep_time ON episodic(timestamp DESC);
|
|
99
|
+
CREATE INDEX IF NOT EXISTS idx_ep_imp ON episodic(importance DESC);
|
|
100
|
+
CREATE INDEX IF NOT EXISTS idx_ep_agent ON episodic(agent_id, user_id);
|
|
101
|
+
|
|
102
|
+
-- FTS5 index for episodic — content= mode (does NOT auto-sync; triggers required)
|
|
103
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS episodic_fts USING fts5(
|
|
104
|
+
summary, entities, tags,
|
|
105
|
+
content=episodic,
|
|
106
|
+
content_rowid=id
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
-- CRITICAL: content= mode does NOT auto-sync. Triggers keep FTS populated.
|
|
110
|
+
CREATE TRIGGER IF NOT EXISTS episodic_ai AFTER INSERT ON episodic BEGIN
|
|
111
|
+
INSERT INTO episodic_fts(rowid, summary, entities, tags)
|
|
112
|
+
VALUES (new.id, new.summary, new.entities, new.tags);
|
|
113
|
+
END;
|
|
114
|
+
CREATE TRIGGER IF NOT EXISTS episodic_ad AFTER DELETE ON episodic BEGIN
|
|
115
|
+
INSERT INTO episodic_fts(episodic_fts, rowid, summary, entities, tags)
|
|
116
|
+
VALUES ('delete', old.id, old.summary, old.entities, old.tags);
|
|
117
|
+
END;
|
|
118
|
+
CREATE TRIGGER IF NOT EXISTS episodic_au AFTER UPDATE ON episodic BEGIN
|
|
119
|
+
INSERT INTO episodic_fts(episodic_fts, rowid, summary, entities, tags)
|
|
120
|
+
VALUES ('delete', old.id, old.summary, old.entities, old.tags);
|
|
121
|
+
INSERT INTO episodic_fts(rowid, summary, entities, tags)
|
|
122
|
+
VALUES (new.id, new.summary, new.entities, new.tags);
|
|
123
|
+
END;
|
|
124
|
+
|
|
125
|
+
-- ── Semantic Memory (Layer 2) ─────────────────────────────────────────────────
|
|
126
|
+
CREATE TABLE IF NOT EXISTS semantic (
|
|
127
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
128
|
+
agent_id TEXT NOT NULL,
|
|
129
|
+
user_id TEXT NOT NULL,
|
|
130
|
+
fact TEXT NOT NULL,
|
|
131
|
+
subject TEXT,
|
|
132
|
+
category TEXT,
|
|
133
|
+
confidence REAL NOT NULL DEFAULT 1.0,
|
|
134
|
+
source TEXT,
|
|
135
|
+
created_at INTEGER NOT NULL DEFAULT (unixepoch()),
|
|
136
|
+
updated_at INTEGER NOT NULL DEFAULT (unixepoch()),
|
|
137
|
+
active INTEGER NOT NULL DEFAULT 1,
|
|
138
|
+
embedding BLOB
|
|
139
|
+
);
|
|
140
|
+
CREATE INDEX IF NOT EXISTS idx_sem_active ON semantic(active);
|
|
141
|
+
CREATE INDEX IF NOT EXISTS idx_sem_conf ON semantic(confidence DESC);
|
|
142
|
+
CREATE INDEX IF NOT EXISTS idx_sem_agent ON semantic(agent_id, user_id);
|
|
143
|
+
CREATE INDEX IF NOT EXISTS idx_sem_subject ON semantic(subject);
|
|
144
|
+
|
|
145
|
+
-- FTS5 index for semantic
|
|
146
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS semantic_fts USING fts5(
|
|
147
|
+
fact, subject, category,
|
|
148
|
+
content=semantic,
|
|
149
|
+
content_rowid=id
|
|
150
|
+
);
|
|
151
|
+
CREATE TRIGGER IF NOT EXISTS semantic_ai AFTER INSERT ON semantic BEGIN
|
|
152
|
+
INSERT INTO semantic_fts(rowid, fact, subject, category)
|
|
153
|
+
VALUES (new.id, new.fact, new.subject, new.category);
|
|
154
|
+
END;
|
|
155
|
+
CREATE TRIGGER IF NOT EXISTS semantic_ad AFTER DELETE ON semantic BEGIN
|
|
156
|
+
INSERT INTO semantic_fts(semantic_fts, rowid, fact, subject, category)
|
|
157
|
+
VALUES ('delete', old.id, old.fact, old.subject, old.category);
|
|
158
|
+
END;
|
|
159
|
+
CREATE TRIGGER IF NOT EXISTS semantic_au AFTER UPDATE ON semantic BEGIN
|
|
160
|
+
INSERT INTO semantic_fts(semantic_fts, rowid, fact, subject, category)
|
|
161
|
+
VALUES ('delete', old.id, old.fact, old.subject, old.category);
|
|
162
|
+
INSERT INTO semantic_fts(rowid, fact, subject, category)
|
|
163
|
+
VALUES (new.id, new.fact, new.subject, new.category);
|
|
164
|
+
END;
|
|
165
|
+
|
|
166
|
+
-- ── Procedural Memory (Layer 3) ──────────────────────────────────────────────
|
|
167
|
+
CREATE TABLE IF NOT EXISTS procedural (
|
|
168
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
169
|
+
agent_id TEXT NOT NULL,
|
|
170
|
+
user_id TEXT NOT NULL,
|
|
171
|
+
name TEXT NOT NULL,
|
|
172
|
+
description TEXT,
|
|
173
|
+
steps TEXT NOT NULL, -- JSON array of strings
|
|
174
|
+
tags TEXT, -- JSON array (sorted)
|
|
175
|
+
version INTEGER NOT NULL DEFAULT 1,
|
|
176
|
+
active INTEGER NOT NULL DEFAULT 1,
|
|
177
|
+
used_count INTEGER NOT NULL DEFAULT 0,
|
|
178
|
+
last_used INTEGER,
|
|
179
|
+
embedding BLOB
|
|
180
|
+
);
|
|
181
|
+
CREATE INDEX IF NOT EXISTS idx_proc_name ON procedural(name);
|
|
182
|
+
CREATE INDEX IF NOT EXISTS idx_proc_active ON procedural(active);
|
|
183
|
+
CREATE INDEX IF NOT EXISTS idx_proc_agent ON procedural(agent_id, user_id);
|
|
184
|
+
|
|
185
|
+
-- FTS5 index for procedural
|
|
186
|
+
CREATE VIRTUAL TABLE IF NOT EXISTS procedural_fts USING fts5(
|
|
187
|
+
name, description, steps, tags,
|
|
188
|
+
content=procedural,
|
|
189
|
+
content_rowid=id
|
|
190
|
+
);
|
|
191
|
+
CREATE TRIGGER IF NOT EXISTS procedural_ai AFTER INSERT ON procedural BEGIN
|
|
192
|
+
INSERT INTO procedural_fts(rowid, name, description, steps, tags)
|
|
193
|
+
VALUES (new.id, new.name, new.description, new.steps, new.tags);
|
|
194
|
+
END;
|
|
195
|
+
CREATE TRIGGER IF NOT EXISTS procedural_ad AFTER DELETE ON procedural BEGIN
|
|
196
|
+
INSERT INTO procedural_fts(procedural_fts, rowid, name, description, steps, tags)
|
|
197
|
+
VALUES ('delete', old.id, old.name, old.description, old.steps, old.tags);
|
|
198
|
+
END;
|
|
199
|
+
CREATE TRIGGER IF NOT EXISTS procedural_au AFTER UPDATE ON procedural BEGIN
|
|
200
|
+
INSERT INTO procedural_fts(procedural_fts, rowid, name, description, steps, tags)
|
|
201
|
+
VALUES ('delete', old.id, old.name, old.description, old.steps, old.tags);
|
|
202
|
+
INSERT INTO procedural_fts(rowid, name, description, steps, tags)
|
|
203
|
+
VALUES (new.id, new.name, new.description, new.steps, new.tags);
|
|
204
|
+
END;
|
|
205
|
+
|
|
206
|
+
-- ── Entity Relations ─────────────────────────────────────────────────────────
|
|
207
|
+
CREATE TABLE IF NOT EXISTS entity_relations (
|
|
208
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
209
|
+
agent_id TEXT NOT NULL,
|
|
210
|
+
user_id TEXT NOT NULL,
|
|
211
|
+
entity_a TEXT NOT NULL,
|
|
212
|
+
relation TEXT NOT NULL,
|
|
213
|
+
entity_b TEXT NOT NULL,
|
|
214
|
+
confidence REAL NOT NULL DEFAULT 1.0,
|
|
215
|
+
source_layer TEXT NOT NULL,
|
|
216
|
+
source_id INTEGER NOT NULL,
|
|
217
|
+
created_at INTEGER NOT NULL DEFAULT (unixepoch())
|
|
218
|
+
);
|
|
219
|
+
CREATE INDEX IF NOT EXISTS idx_er_agent ON entity_relations(agent_id, user_id);
|
|
220
|
+
CREATE INDEX IF NOT EXISTS idx_er_entity_a ON entity_relations(entity_a);
|
|
221
|
+
CREATE INDEX IF NOT EXISTS idx_er_entity_b ON entity_relations(entity_b);
|
|
222
|
+
|
|
223
|
+
-- ── Extraction Log ────────────────────────────────────────────────────────────
|
|
224
|
+
CREATE TABLE IF NOT EXISTS extraction_log (
|
|
225
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
226
|
+
agent_id TEXT NOT NULL,
|
|
227
|
+
user_id TEXT NOT NULL,
|
|
228
|
+
session_id TEXT NOT NULL,
|
|
229
|
+
run_at INTEGER NOT NULL DEFAULT (unixepoch()),
|
|
230
|
+
trigger TEXT NOT NULL,
|
|
231
|
+
items_created INTEGER NOT NULL DEFAULT 0,
|
|
232
|
+
items_updated INTEGER NOT NULL DEFAULT 0,
|
|
233
|
+
items_skipped INTEGER NOT NULL DEFAULT 0,
|
|
234
|
+
duration_ms INTEGER
|
|
235
|
+
);
|
|
236
|
+
`;
|
|
237
|
+
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/memory/long-term/manager.ts
|
|
240
|
+
/**
|
|
241
|
+
* Long-Term Memory — MemoryManager
|
|
242
|
+
* CRUD operations for all 4 layers + FTS5 search
|
|
243
|
+
*/
|
|
244
|
+
function safeParse(json, fallback) {
|
|
245
|
+
if (!json) return fallback;
|
|
246
|
+
try {
|
|
247
|
+
return JSON.parse(json);
|
|
248
|
+
} catch {
|
|
249
|
+
return fallback;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function sanitizeFts(text) {
|
|
253
|
+
return "\"" + text.replace(/"/g, "\"\"") + "\"";
|
|
254
|
+
}
|
|
255
|
+
var MemoryManager = class {
|
|
256
|
+
constructor(params) {
|
|
257
|
+
this.agentId = params.agentId;
|
|
258
|
+
this.userId = params.userId;
|
|
259
|
+
const dir = path.dirname(params.dbPath);
|
|
260
|
+
if (!syncFs.existsSync(dir)) syncFs.mkdirSync(dir, { recursive: true });
|
|
261
|
+
this.db = new DatabaseSync(params.dbPath);
|
|
262
|
+
this.initSchema();
|
|
263
|
+
}
|
|
264
|
+
initSchema() {
|
|
265
|
+
this.db.exec(LONG_TERM_MEMORY_SCHEMA);
|
|
266
|
+
}
|
|
267
|
+
close() {
|
|
268
|
+
this.db.close();
|
|
269
|
+
}
|
|
270
|
+
addWorking(params) {
|
|
271
|
+
return this.db.prepare(`INSERT INTO working_memory (session_id, agent_id, user_id, content, layer_hint, created_at)
|
|
272
|
+
VALUES (?, ?, ?, ?, ?, ?)`).run(params.sessionId, this.agentId, this.userId, params.content, params.layerHint ?? null, Date.now()).lastInsertRowid;
|
|
273
|
+
}
|
|
274
|
+
getWorkingMemory(sessionId) {
|
|
275
|
+
return this.db.prepare(`SELECT * FROM working_memory WHERE session_id = ? AND agent_id = ? AND user_id = ? ORDER BY created_at ASC`).all(sessionId, this.agentId, this.userId);
|
|
276
|
+
}
|
|
277
|
+
clearWorkingMemory(sessionId) {
|
|
278
|
+
this.db.prepare(`DELETE FROM working_memory WHERE session_id = ? AND agent_id = ? AND user_id = ?`).run(sessionId, this.agentId, this.userId);
|
|
279
|
+
}
|
|
280
|
+
addEpisodic(mem) {
|
|
281
|
+
const sortedEntities = [...mem.entities ?? []].toSorted();
|
|
282
|
+
const sortedTags = [...mem.tags ?? []].toSorted();
|
|
283
|
+
return this.db.prepare(`INSERT INTO episodic (agent_id, user_id, session_id, timestamp, summary, entities, tags, importance)
|
|
284
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?)`).run(this.agentId, this.userId, mem.session_id ?? null, mem.timestamp, mem.summary, JSON.stringify(sortedEntities), JSON.stringify(sortedTags), mem.importance).lastInsertRowid;
|
|
285
|
+
}
|
|
286
|
+
getRecentEpisodic(limit = 20) {
|
|
287
|
+
return this.db.prepare(`SELECT * FROM episodic WHERE agent_id = ? AND user_id = ?
|
|
288
|
+
ORDER BY timestamp DESC LIMIT ?`).all(this.agentId, this.userId, limit).map((r) => this.parseEpisodic(r));
|
|
289
|
+
}
|
|
290
|
+
parseEpisodic(row) {
|
|
291
|
+
return {
|
|
292
|
+
...row,
|
|
293
|
+
entities: safeParse(row.entities, []),
|
|
294
|
+
tags: safeParse(row.tags, []),
|
|
295
|
+
embedding: row.embedding ?? void 0
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
addSemantic(mem) {
|
|
299
|
+
const now = Date.now();
|
|
300
|
+
if (mem.subject && mem.category) {
|
|
301
|
+
const existing = this.db.prepare(`SELECT id FROM semantic WHERE agent_id = ? AND user_id = ?
|
|
302
|
+
AND subject = ? AND category = ? AND active = 1 LIMIT 1`).get(this.agentId, this.userId, mem.subject, mem.category);
|
|
303
|
+
if (existing) {
|
|
304
|
+
this.db.prepare(`UPDATE semantic SET fact = ?, confidence = ?, updated_at = ?, source = ?
|
|
305
|
+
WHERE id = ?`).run(mem.fact, mem.confidence ?? 1, now, mem.source ?? null, existing.id);
|
|
306
|
+
return existing.id;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
return this.db.prepare(`INSERT INTO semantic (agent_id, user_id, fact, subject, category, confidence, source, created_at, updated_at, active)
|
|
310
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, 1)`).run(this.agentId, this.userId, mem.fact, mem.subject ?? null, mem.category ?? null, mem.confidence ?? 1, mem.source ?? null, now, now).lastInsertRowid;
|
|
311
|
+
}
|
|
312
|
+
getActiveSemantic(limit = 50) {
|
|
313
|
+
return this.db.prepare(`SELECT * FROM semantic WHERE agent_id = ? AND user_id = ? AND active = 1
|
|
314
|
+
ORDER BY confidence DESC, updated_at DESC LIMIT ?`).all(this.agentId, this.userId, limit).map((r) => ({
|
|
315
|
+
...r,
|
|
316
|
+
embedding: r.embedding ?? void 0
|
|
317
|
+
}));
|
|
318
|
+
}
|
|
319
|
+
addProcedural(mem) {
|
|
320
|
+
const sortedTags = [...mem.tags ?? []].toSorted();
|
|
321
|
+
const existing = this.db.prepare(`SELECT id, version FROM procedural WHERE agent_id = ? AND user_id = ?
|
|
322
|
+
AND name = ? AND active = 1 LIMIT 1`).get(this.agentId, this.userId, mem.name);
|
|
323
|
+
if (existing) this.db.prepare(`UPDATE procedural SET active = 0 WHERE id = ?`).run(existing.id);
|
|
324
|
+
return this.db.prepare(`INSERT INTO procedural (agent_id, user_id, name, description, steps, tags, version, active)
|
|
325
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, 1)`).run(this.agentId, this.userId, mem.name, mem.description ?? null, JSON.stringify(mem.steps), JSON.stringify(sortedTags), existing ? existing.version + 1 : 1).lastInsertRowid;
|
|
326
|
+
}
|
|
327
|
+
getActiveProcedural(limit = 30) {
|
|
328
|
+
return this.db.prepare(`SELECT * FROM procedural WHERE agent_id = ? AND user_id = ? AND active = 1
|
|
329
|
+
ORDER BY used_count DESC, last_used DESC LIMIT ?`).all(this.agentId, this.userId, limit).map((r) => ({
|
|
330
|
+
...r,
|
|
331
|
+
steps: safeParse(r.steps, []),
|
|
332
|
+
tags: safeParse(r.tags, []),
|
|
333
|
+
embedding: r.embedding ?? void 0
|
|
334
|
+
}));
|
|
335
|
+
}
|
|
336
|
+
markProceduralUsed(id) {
|
|
337
|
+
this.db.prepare(`UPDATE procedural SET used_count = used_count + 1, last_used = ? WHERE id = ?`).run(Date.now(), id);
|
|
338
|
+
}
|
|
339
|
+
search(params) {
|
|
340
|
+
const layers = params.layers ?? [
|
|
341
|
+
"episodic",
|
|
342
|
+
"semantic",
|
|
343
|
+
"procedural"
|
|
344
|
+
];
|
|
345
|
+
const limit = params.limit ?? 20;
|
|
346
|
+
const results = [];
|
|
347
|
+
for (const layer of layers) {
|
|
348
|
+
const layerResults = this.ftsSearch({
|
|
349
|
+
text: params.text,
|
|
350
|
+
layer,
|
|
351
|
+
limit
|
|
352
|
+
});
|
|
353
|
+
results.push(...layerResults);
|
|
354
|
+
}
|
|
355
|
+
results.sort((a, b) => b.similarity - a.similarity);
|
|
356
|
+
if (params.budget) return this.applyBudget(results, params.budget);
|
|
357
|
+
return results.slice(0, limit);
|
|
358
|
+
}
|
|
359
|
+
ftsSearch(params) {
|
|
360
|
+
if (params.layer === "working") return [];
|
|
361
|
+
const sanitized = sanitizeFts(params.text);
|
|
362
|
+
const results = [];
|
|
363
|
+
try {
|
|
364
|
+
if (params.layer === "episodic") {
|
|
365
|
+
const rows = this.db.prepare(`SELECT b.id, b.summary, b.entities, b.tags, b.importance, b.timestamp,
|
|
366
|
+
episodic_fts.rank AS fts_rank, ? AS _layer
|
|
367
|
+
FROM episodic_fts
|
|
368
|
+
JOIN episodic b ON b.id = episodic_fts.rowid
|
|
369
|
+
WHERE episodic_fts MATCH ?
|
|
370
|
+
AND b.agent_id = ? AND b.user_id = ?
|
|
371
|
+
ORDER BY episodic_fts.rank
|
|
372
|
+
LIMIT ?`).all(params.layer, sanitized, this.agentId, this.userId, params.limit);
|
|
373
|
+
for (const row of rows) results.push({
|
|
374
|
+
layer: "episodic",
|
|
375
|
+
id: row.id,
|
|
376
|
+
content: row.summary,
|
|
377
|
+
tags: safeParse(row.tags, []),
|
|
378
|
+
similarity: Math.min(1, Math.abs(row.fts_rank ?? 0) / 10),
|
|
379
|
+
importance: row.importance,
|
|
380
|
+
created_at: row.timestamp,
|
|
381
|
+
_layer: row._layer
|
|
382
|
+
});
|
|
383
|
+
} else if (params.layer === "semantic") {
|
|
384
|
+
const rows = this.db.prepare(`SELECT b.id, b.fact, b.subject, b.category, b.confidence, b.updated_at,
|
|
385
|
+
semantic_fts.rank AS fts_rank, ? AS _layer
|
|
386
|
+
FROM semantic_fts
|
|
387
|
+
JOIN semantic b ON b.id = semantic_fts.rowid
|
|
388
|
+
WHERE semantic_fts MATCH ?
|
|
389
|
+
AND b.agent_id = ? AND b.user_id = ? AND b.active = 1
|
|
390
|
+
ORDER BY semantic_fts.rank
|
|
391
|
+
LIMIT ?`).all(params.layer, sanitized, this.agentId, this.userId, params.limit);
|
|
392
|
+
for (const row of rows) results.push({
|
|
393
|
+
layer: "semantic",
|
|
394
|
+
id: row.id,
|
|
395
|
+
content: row.fact,
|
|
396
|
+
subject: row.subject ?? void 0,
|
|
397
|
+
similarity: Math.min(1, Math.abs(row.fts_rank ?? 0) / 10),
|
|
398
|
+
created_at: row.updated_at,
|
|
399
|
+
_layer: row._layer
|
|
400
|
+
});
|
|
401
|
+
} else if (params.layer === "procedural") {
|
|
402
|
+
const rows = this.db.prepare(`SELECT b.id, b.name, b.description, b.steps, b.tags, b.last_used,
|
|
403
|
+
procedural_fts.rank AS fts_rank, ? AS _layer
|
|
404
|
+
FROM procedural_fts
|
|
405
|
+
JOIN procedural b ON b.id = procedural_fts.rowid
|
|
406
|
+
WHERE procedural_fts MATCH ?
|
|
407
|
+
AND b.agent_id = ? AND b.user_id = ? AND b.active = 1
|
|
408
|
+
ORDER BY procedural_fts.rank
|
|
409
|
+
LIMIT ?`).all(params.layer, sanitized, this.agentId, this.userId, params.limit);
|
|
410
|
+
for (const row of rows) {
|
|
411
|
+
const steps = safeParse(row.steps, []);
|
|
412
|
+
results.push({
|
|
413
|
+
layer: "procedural",
|
|
414
|
+
id: row.id,
|
|
415
|
+
content: `${row.name}${row.description ? `: ${row.description}` : ""} — Steps: ${steps.slice(0, 3).join(" → ")}${steps.length > 3 ? "…" : ""}`,
|
|
416
|
+
tags: safeParse(row.tags, []),
|
|
417
|
+
similarity: Math.min(1, Math.abs(row.fts_rank ?? 0) / 10),
|
|
418
|
+
created_at: row.last_used ?? Date.now(),
|
|
419
|
+
_layer: row._layer
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
} catch {}
|
|
424
|
+
return results;
|
|
425
|
+
}
|
|
426
|
+
applyBudget(results, budgetTokens) {
|
|
427
|
+
const output = [];
|
|
428
|
+
let usedTokens = 0;
|
|
429
|
+
for (const r of results) {
|
|
430
|
+
const approxTokens = Math.ceil(r.content.length / 4);
|
|
431
|
+
if (usedTokens + approxTokens > budgetTokens) break;
|
|
432
|
+
output.push(r);
|
|
433
|
+
usedTokens += approxTokens;
|
|
434
|
+
}
|
|
435
|
+
return output;
|
|
436
|
+
}
|
|
437
|
+
getStats() {
|
|
438
|
+
return {
|
|
439
|
+
episodic: this.db.prepare(`SELECT COUNT(*) as c FROM episodic WHERE agent_id = ? AND user_id = ?`).get(this.agentId, this.userId).c,
|
|
440
|
+
semantic: this.db.prepare(`SELECT COUNT(*) as c FROM semantic WHERE agent_id = ? AND user_id = ? AND active = 1`).get(this.agentId, this.userId).c,
|
|
441
|
+
procedural: this.db.prepare(`SELECT COUNT(*) as c FROM procedural WHERE agent_id = ? AND user_id = ? AND active = 1`).get(this.agentId, this.userId).c,
|
|
442
|
+
working: this.db.prepare(`SELECT COUNT(*) as c FROM working_memory WHERE agent_id = ? AND user_id = ?`).get(this.agentId, this.userId).c
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
logExtraction(params) {
|
|
446
|
+
this.db.prepare(`INSERT INTO extraction_log (agent_id, user_id, session_id, run_at, trigger, items_created, items_updated, items_skipped, duration_ms)
|
|
447
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(this.agentId, this.userId, params.sessionId, Date.now(), params.trigger, params.itemsCreated, params.itemsUpdated, params.itemsSkipped, params.durationMs);
|
|
448
|
+
}
|
|
449
|
+
};
|
|
450
|
+
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region src/memory/long-term/runner.ts
|
|
453
|
+
/**
|
|
454
|
+
* Long-Term Memory — LLM Extraction Runner
|
|
455
|
+
* Uses runEmbeddedPiAgent (same pattern as generateSlugViaLLM) so all
|
|
456
|
+
* existing Squidclaw auth / model selection works automatically.
|
|
457
|
+
*/
|
|
458
|
+
const log$1 = createSubsystemLogger("long-term-memory");
|
|
459
|
+
const EXTRACTION_PROMPT_SYSTEM = `You are a memory extraction assistant. Analyze the conversation and extract structured memories.
|
|
460
|
+
|
|
461
|
+
Return ONLY valid JSON in this exact format (no markdown, no explanation):
|
|
462
|
+
{
|
|
463
|
+
"episodic": [
|
|
464
|
+
{"summary": "what happened", "entities": ["Person","Project"], "tags": ["tag"], "importance": 7}
|
|
465
|
+
],
|
|
466
|
+
"semantic": [
|
|
467
|
+
{"fact": "standing fact", "subject": "about what/who", "category": "preference|rule|fact|config", "confidence": 0.9}
|
|
468
|
+
],
|
|
469
|
+
"procedural": [
|
|
470
|
+
{"name": "procedure_name", "description": "when to use", "steps": ["Step 1", "Step 2"], "tags": ["tag"]}
|
|
471
|
+
]
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
Rules:
|
|
475
|
+
- Only extract genuinely useful long-term knowledge (skip small talk, transient details)
|
|
476
|
+
- Importance: 1=trivial 5=normal 8=important 10=critical
|
|
477
|
+
- Confidence: 0.0=uncertain 0.5=probable 1.0=certain
|
|
478
|
+
- Entities: proper nouns only (people, projects, companies, products, servers)
|
|
479
|
+
- If nothing worth remembering: {"episodic":[],"semantic":[],"procedural":[]}`;
|
|
480
|
+
/**
|
|
481
|
+
* Run long-term memory extraction on session content.
|
|
482
|
+
* Follows the same pattern as generateSlugViaLLM.
|
|
483
|
+
*/
|
|
484
|
+
async function runLongTermExtraction(params) {
|
|
485
|
+
let created = 0;
|
|
486
|
+
let updated = 0;
|
|
487
|
+
let skipped = 0;
|
|
488
|
+
if (!params.sessionContent.trim()) return {
|
|
489
|
+
created,
|
|
490
|
+
updated,
|
|
491
|
+
skipped
|
|
492
|
+
};
|
|
493
|
+
let tempSessionFile = null;
|
|
494
|
+
try {
|
|
495
|
+
const cfgAgentId = resolveDefaultAgentId(params.cfg);
|
|
496
|
+
const agentDir = resolveAgentDir(params.cfg, cfgAgentId);
|
|
497
|
+
const tempDir = await fs.mkdtemp(path.join(os.tmpdir(), "squidclaw-ltm-"));
|
|
498
|
+
tempSessionFile = path.join(tempDir, "session.jsonl");
|
|
499
|
+
const prompt = `Extract memories from this conversation:
|
|
500
|
+
|
|
501
|
+
${params.sessionContent.slice(-6e3)}`;
|
|
502
|
+
const modelRef = resolveAgentEffectiveModelPrimary(params.cfg, cfgAgentId);
|
|
503
|
+
const parsed = modelRef ? parseModelRef(modelRef, DEFAULT_PROVIDER) : null;
|
|
504
|
+
const provider = parsed?.provider ?? DEFAULT_PROVIDER;
|
|
505
|
+
const model = parsed?.model ?? DEFAULT_MODEL;
|
|
506
|
+
let rawResponse = "";
|
|
507
|
+
await runEmbeddedPiAgent({
|
|
508
|
+
sessionId: `ltm-extract-${Date.now()}`,
|
|
509
|
+
sessionKey: "temp:ltm-extractor",
|
|
510
|
+
agentId: cfgAgentId,
|
|
511
|
+
sessionFile: tempSessionFile,
|
|
512
|
+
workspaceDir: params.workspaceDir,
|
|
513
|
+
agentDir,
|
|
514
|
+
config: params.cfg,
|
|
515
|
+
provider,
|
|
516
|
+
model,
|
|
517
|
+
trigger: "api",
|
|
518
|
+
prompt,
|
|
519
|
+
extraSystemPrompt: EXTRACTION_PROMPT_SYSTEM,
|
|
520
|
+
onAgentEvent: (evt) => {
|
|
521
|
+
if (evt.stream === "assistant" && typeof evt.data?.text === "string") rawResponse += evt.data.text;
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
if (!rawResponse.trim()) {
|
|
525
|
+
log$1.warn("LTM extraction returned empty response");
|
|
526
|
+
return {
|
|
527
|
+
created,
|
|
528
|
+
updated,
|
|
529
|
+
skipped
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
let extracted;
|
|
533
|
+
try {
|
|
534
|
+
const jsonMatch = rawResponse.replace(/^```(?:json)?\n?/m, "").replace(/\n?```$/m, "").trim().match(/\{[\s\S]*\}/);
|
|
535
|
+
extracted = jsonMatch ? JSON.parse(jsonMatch[0]) : {
|
|
536
|
+
episodic: [],
|
|
537
|
+
semantic: [],
|
|
538
|
+
procedural: []
|
|
539
|
+
};
|
|
540
|
+
} catch {
|
|
541
|
+
log$1.warn("LTM extraction JSON parse failed", { preview: rawResponse.slice(0, 100) });
|
|
542
|
+
return {
|
|
543
|
+
created,
|
|
544
|
+
updated,
|
|
545
|
+
skipped
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
const manager = new MemoryManager({
|
|
549
|
+
dbPath: params.dbPath,
|
|
550
|
+
agentId: params.agentId,
|
|
551
|
+
userId: params.userId
|
|
552
|
+
});
|
|
553
|
+
const now = Date.now();
|
|
554
|
+
for (const ep of extracted.episodic ?? []) {
|
|
555
|
+
if (!ep.summary?.trim()) {
|
|
556
|
+
skipped++;
|
|
557
|
+
continue;
|
|
558
|
+
}
|
|
559
|
+
try {
|
|
560
|
+
manager.addEpisodic({
|
|
561
|
+
session_id: params.sessionId,
|
|
562
|
+
timestamp: now,
|
|
563
|
+
summary: ep.summary,
|
|
564
|
+
entities: ep.entities ?? [],
|
|
565
|
+
tags: ep.tags ?? [],
|
|
566
|
+
importance: Math.max(1, Math.min(10, ep.importance ?? 5))
|
|
567
|
+
});
|
|
568
|
+
created++;
|
|
569
|
+
} catch {
|
|
570
|
+
skipped++;
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
for (const sem of extracted.semantic ?? []) {
|
|
574
|
+
if (!sem.fact?.trim()) {
|
|
575
|
+
skipped++;
|
|
576
|
+
continue;
|
|
577
|
+
}
|
|
578
|
+
try {
|
|
579
|
+
manager.addSemantic({
|
|
580
|
+
fact: sem.fact,
|
|
581
|
+
subject: sem.subject,
|
|
582
|
+
category: sem.category,
|
|
583
|
+
confidence: Math.max(0, Math.min(1, sem.confidence ?? 1)),
|
|
584
|
+
source: "auto-extraction"
|
|
585
|
+
});
|
|
586
|
+
created++;
|
|
587
|
+
} catch {
|
|
588
|
+
skipped++;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
for (const proc of extracted.procedural ?? []) {
|
|
592
|
+
if (!proc.name?.trim() || !proc.steps?.length) {
|
|
593
|
+
skipped++;
|
|
594
|
+
continue;
|
|
595
|
+
}
|
|
596
|
+
try {
|
|
597
|
+
manager.addProcedural({
|
|
598
|
+
name: proc.name,
|
|
599
|
+
description: proc.description,
|
|
600
|
+
steps: proc.steps,
|
|
601
|
+
tags: proc.tags ?? []
|
|
602
|
+
});
|
|
603
|
+
created++;
|
|
604
|
+
} catch {
|
|
605
|
+
skipped++;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
manager.logExtraction({
|
|
609
|
+
sessionId: params.sessionId,
|
|
610
|
+
trigger: "session_end",
|
|
611
|
+
itemsCreated: created,
|
|
612
|
+
itemsUpdated: updated,
|
|
613
|
+
itemsSkipped: skipped,
|
|
614
|
+
durationMs: 0
|
|
615
|
+
});
|
|
616
|
+
await syncLongTermContextFile({
|
|
617
|
+
manager,
|
|
618
|
+
workspaceDir: params.workspaceDir
|
|
619
|
+
});
|
|
620
|
+
manager.close();
|
|
621
|
+
log$1.info(`LTM extraction: +${created} created, ${updated} updated, ${skipped} skipped`);
|
|
622
|
+
} catch (err) {
|
|
623
|
+
log$1.error("LTM extraction failed", { error: String(err) });
|
|
624
|
+
} finally {
|
|
625
|
+
if (tempSessionFile) try {
|
|
626
|
+
await fs.rm(path.dirname(tempSessionFile), {
|
|
627
|
+
recursive: true,
|
|
628
|
+
force: true
|
|
629
|
+
});
|
|
630
|
+
} catch {}
|
|
631
|
+
}
|
|
632
|
+
return {
|
|
633
|
+
created,
|
|
634
|
+
updated,
|
|
635
|
+
skipped
|
|
636
|
+
};
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Write `memory/long-term-context.md` in the workspace.
|
|
640
|
+
* This file is auto-loaded by Squidclaw's bootstrap file system.
|
|
641
|
+
*/
|
|
642
|
+
async function syncLongTermContextFile(params) {
|
|
643
|
+
const lines = [
|
|
644
|
+
"## Long-Term Memory",
|
|
645
|
+
"*Auto-generated from conversation history. Updated at session end.*",
|
|
646
|
+
""
|
|
647
|
+
];
|
|
648
|
+
const semantic = params.manager.getActiveSemantic(40);
|
|
649
|
+
if (semantic.length > 0) {
|
|
650
|
+
lines.push("### Facts & Preferences");
|
|
651
|
+
for (const s of semantic.slice(0, 25)) {
|
|
652
|
+
const subj = s.subject ? `[${s.subject}] ` : "";
|
|
653
|
+
lines.push(`- ${subj}${s.fact}`);
|
|
654
|
+
}
|
|
655
|
+
lines.push("");
|
|
656
|
+
}
|
|
657
|
+
const episodic = params.manager.getRecentEpisodic(15);
|
|
658
|
+
if (episodic.length > 0) {
|
|
659
|
+
lines.push("### Recent Events");
|
|
660
|
+
for (const e of episodic) {
|
|
661
|
+
const date = new Date(e.timestamp).toISOString().slice(0, 10);
|
|
662
|
+
lines.push(`- [${date}] ${e.summary}`);
|
|
663
|
+
}
|
|
664
|
+
lines.push("");
|
|
665
|
+
}
|
|
666
|
+
const procedural = params.manager.getActiveProcedural(10);
|
|
667
|
+
if (procedural.length > 0) {
|
|
668
|
+
lines.push("### Known Workflows");
|
|
669
|
+
for (const p of procedural.slice(0, 5)) lines.push(`- **${p.name}**: ${p.description ?? ""}`);
|
|
670
|
+
lines.push("");
|
|
671
|
+
}
|
|
672
|
+
const stats = params.manager.getStats();
|
|
673
|
+
lines.push(`*${stats.episodic} events · ${stats.semantic} facts · ${stats.procedural} workflows*`);
|
|
674
|
+
const memDir = path.join(params.workspaceDir, "memory");
|
|
675
|
+
await fs.mkdir(memDir, { recursive: true });
|
|
676
|
+
await fs.writeFile(path.join(memDir, "long-term-context.md"), lines.join("\n"), "utf-8");
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
//#endregion
|
|
61
680
|
//#region src/hooks/bundled/session-memory/handler.ts
|
|
62
681
|
/**
|
|
63
682
|
* Session memory hook handler
|
|
@@ -227,6 +846,23 @@ const saveSessionToMemory = async (event) => {
|
|
|
227
846
|
log.debug("Memory file written successfully");
|
|
228
847
|
const relPath = memoryFilePath.replace(os.homedir(), "~");
|
|
229
848
|
log.info(`Session context saved to ${relPath}`);
|
|
849
|
+
if (sessionContent && cfg) {
|
|
850
|
+
const ltmAgentId = agentId ?? "default";
|
|
851
|
+
const ltmDbPath = path.join(workspaceDir, "memory", "long-term.db");
|
|
852
|
+
setImmediate(() => {
|
|
853
|
+
runLongTermExtraction({
|
|
854
|
+
sessionContent,
|
|
855
|
+
sessionId: (context.previousSessionEntry || context.sessionEntry || {}).sessionId ?? `session-${Date.now()}`,
|
|
856
|
+
cfg,
|
|
857
|
+
workspaceDir,
|
|
858
|
+
agentId: ltmAgentId,
|
|
859
|
+
userId: ltmAgentId,
|
|
860
|
+
dbPath: ltmDbPath
|
|
861
|
+
}).catch((err) => {
|
|
862
|
+
log.warn("Long-term memory extraction failed (non-fatal)", { error: String(err) });
|
|
863
|
+
});
|
|
864
|
+
});
|
|
865
|
+
}
|
|
230
866
|
} catch (err) {
|
|
231
867
|
if (err instanceof Error) log.error("Failed to save session memory", {
|
|
232
868
|
errorName: err.name,
|