@askexenow/exe-os 0.9.272 → 0.9.274
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/backfill-metadata-A3534S32.js +597 -0
- package/dist/backfill-metadata-B6F2KJJV.js +597 -0
- package/dist/backfill-metadata-BOM2MXLI.js +597 -0
- package/dist/backfill-metadata-SJ4YMQFS.js +597 -0
- package/dist/backfill-metadata-TAU33HJS.js +597 -0
- package/dist/bin/agentic-ontology-backfill.js +1 -1
- package/dist/bin/agentic-reflection-backfill.js +1 -1
- package/dist/bin/agentic-semantic-label.js +1 -1
- package/dist/bin/backfill-conversations.js +1 -1
- package/dist/bin/backfill-responses.js +1 -1
- package/dist/bin/backfill-vectors.js +2 -2
- package/dist/bin/bulk-sync-postgres.js +1 -1
- package/dist/bin/cleanup-stale-review-tasks.js +2 -2
- package/dist/bin/cli.js +5 -5
- package/dist/bin/exe-assign.js +1 -1
- package/dist/bin/exe-boot.js +3 -3
- package/dist/bin/exe-dispatch.js +2 -2
- package/dist/bin/exe-doctor.js +1 -1
- package/dist/bin/exe-export-behaviors.js +2 -2
- package/dist/bin/exe-forget.js +3 -3
- package/dist/bin/exe-gateway.js +5 -5
- package/dist/bin/exe-heartbeat.js +2 -2
- package/dist/bin/exe-kill.js +3 -3
- package/dist/bin/exe-launch-agent.js +3 -3
- package/dist/bin/exe-pending-messages.js +3 -3
- package/dist/bin/exe-pending-notifications.js +25 -10
- package/dist/bin/exe-pending-reviews.js +2 -2
- package/dist/bin/exe-review.js +3 -3
- package/dist/bin/exe-search.js +2 -2
- package/dist/bin/exe-session-cleanup.js +5 -5
- package/dist/bin/exe-start-codex.js +1 -1
- package/dist/bin/exe-start-opencode.js +1 -1
- package/dist/bin/exe-status.js +3 -3
- package/dist/bin/exe-team.js +1 -1
- package/dist/bin/git-sweep.js +2 -2
- package/dist/bin/graph-backfill.js +1 -1
- package/dist/bin/graph-export.js +2 -2
- package/dist/bin/import-history.js +2 -2
- package/dist/bin/intercom-check.js +3 -3
- package/dist/bin/mcp-sessions.js +2 -2
- package/dist/bin/orchestration-metrics.js +1 -1
- package/dist/bin/scan-tasks.js +2 -2
- package/dist/bin/shard-migrate.js +1 -1
- package/dist/capacity-monitor-2GJOFXGB.js +49 -0
- package/dist/capacity-monitor-3Z7W4K25.js +49 -0
- package/dist/capacity-monitor-BENS3N7B.js +49 -0
- package/dist/capacity-monitor-MQUUEZKB.js +49 -0
- package/dist/capacity-monitor-VP4RDLSB.js +49 -0
- package/dist/catchup-brief-2Q5GPASS.js +151 -0
- package/dist/catchup-brief-B4KGAIPU.js +151 -0
- package/dist/catchup-brief-NMOV3SSP.js +151 -0
- package/dist/catchup-brief-VMF3ESTZ.js +151 -0
- package/dist/catchup-brief-ZL7V3BXC.js +151 -0
- package/dist/chunk-2FZLPPOD.js +171 -0
- package/dist/chunk-2KWVJV6I.js +171 -0
- package/dist/chunk-3A4SOC66.js +551 -0
- package/dist/chunk-3FZQAO7A.js +3961 -0
- package/dist/chunk-3GSGDPLK.js +171 -0
- package/dist/chunk-3IM3JNQV.js +377 -0
- package/dist/chunk-3OM3V545.js +448 -0
- package/dist/chunk-3T27ZQT6.js +495 -0
- package/dist/chunk-3VI3QIHU.js +214 -0
- package/dist/chunk-3WG3RRWA.js +1345 -0
- package/dist/chunk-42A3JV3A.js +128 -0
- package/dist/chunk-44MQXM4F.js +13745 -0
- package/dist/chunk-46WLFLGP.js +1073 -0
- package/dist/chunk-4JMPQB7K.js +1148 -0
- package/dist/chunk-4L25LLQM.js +382 -0
- package/dist/chunk-4Q7X3SAM.js +204 -0
- package/dist/chunk-4UAUCFHA.js +526 -0
- package/dist/chunk-4VRJX2SP.js +495 -0
- package/dist/chunk-57RBAR2A.js +214 -0
- package/dist/chunk-5JF5OQQU.js +89 -0
- package/dist/chunk-5LTY4GLX.js +13745 -0
- package/dist/chunk-5M5RYJ22.js +3955 -0
- package/dist/chunk-5YO2FER3.js +76 -0
- package/dist/chunk-62YI2JOC.js +333 -0
- package/dist/chunk-6AGPWYFC.js +447 -0
- package/dist/chunk-6CH7TYBG.js +58 -0
- package/dist/chunk-6CHHFVRQ.js +284 -0
- package/dist/chunk-6D64562N.js +330 -0
- package/dist/chunk-6F35WOSR.js +447 -0
- package/dist/chunk-6HQ22FC6.js +81 -0
- package/dist/chunk-6ZSH2BZR.js +244 -0
- package/dist/chunk-74MF4T3T.js +3962 -0
- package/dist/chunk-77H7IO3O.js +382 -0
- package/dist/chunk-7BUWNG6M.js +159 -0
- package/dist/chunk-7CB3G3JP.js +1090 -0
- package/dist/chunk-7YEQI2WF.js +13745 -0
- package/dist/chunk-AJ63GPM7.js +54 -0
- package/dist/chunk-BFJ45HQT.js +244 -0
- package/dist/chunk-BMHE3UQU.js +495 -0
- package/dist/chunk-BNTUZVPS.js +1921 -0
- package/dist/chunk-BSWNP5GP.js +197 -0
- package/dist/chunk-C6ODVGTC.js +818 -0
- package/dist/chunk-CHBGCQXG.js +333 -0
- package/dist/chunk-CHUOANKE.js +346 -0
- package/dist/chunk-CSF4RUCN.js +58 -0
- package/dist/chunk-CXKHWCNN.js +204 -0
- package/dist/chunk-CZR6Z5D7.js +330 -0
- package/dist/chunk-D24ANCWY.js +204 -0
- package/dist/chunk-DBJCWK6T.js +377 -0
- package/dist/chunk-DF4SM6ZX.js +128 -0
- package/dist/chunk-DOAC6CLC.js +127 -0
- package/dist/chunk-DOGNJ4VR.js +818 -0
- package/dist/chunk-DYXJFUCI.js +818 -0
- package/dist/chunk-EGR2NYID.js +50 -0
- package/dist/chunk-EQ5UBJGX.js +81 -0
- package/dist/chunk-EWQLQZNS.js +345 -0
- package/dist/chunk-FBRQGHSU.js +377 -0
- package/dist/chunk-FC5WORMP.js +81 -0
- package/dist/chunk-FS7G6NJD.js +377 -0
- package/dist/chunk-FZ42OCSP.js +333 -0
- package/dist/chunk-G5HWDSBH.js +50 -0
- package/dist/chunk-GCBG5TFS.js +1345 -0
- package/dist/chunk-GESN6IDC.js +127 -0
- package/dist/chunk-GHD7QG6P.js +58 -0
- package/dist/chunk-GJAILPCX.js +171 -0
- package/dist/chunk-GKUODJS7.js +214 -0
- package/dist/chunk-GLDM2FOM.js +76 -0
- package/dist/chunk-GMM2BLFB.js +127 -0
- package/dist/chunk-GNM75IOI.js +159 -0
- package/dist/chunk-GYIX2HLD.js +81 -0
- package/dist/chunk-H4LLEQ3F.js +551 -0
- package/dist/chunk-HBVCBBDA.js +127 -0
- package/dist/chunk-HBYLXJAW.js +284 -0
- package/dist/chunk-HBYRWOH5.js +171 -0
- package/dist/chunk-HFINM2JG.js +284 -0
- package/dist/chunk-HJGHALOG.js +1345 -0
- package/dist/chunk-HRB5CP43.js +13745 -0
- package/dist/chunk-IDCLPPIM.js +3959 -0
- package/dist/chunk-II5SVNBN.js +551 -0
- package/dist/chunk-IIRLKWNZ.js +50 -0
- package/dist/chunk-IQXLUTWC.js +50 -0
- package/dist/chunk-IWXTFDLS.js +244 -0
- package/dist/chunk-J2TGVCPE.js +1090 -0
- package/dist/chunk-J4Z5GAJ4.js +551 -0
- package/dist/chunk-JJSDZFKM.js +1148 -0
- package/dist/chunk-JMN2KOC4.js +128 -0
- package/dist/chunk-JQVYPBR2.js +81 -0
- package/dist/chunk-KK6ZIA37.js +551 -0
- package/dist/chunk-KMU7PFO3.js +1148 -0
- package/dist/chunk-L7RDKCIR.js +244 -0
- package/dist/chunk-LDDCAATQ.js +1090 -0
- package/dist/chunk-LJN2O5IG.js +197 -0
- package/dist/chunk-LSIYHKDS.js +54 -0
- package/dist/chunk-MREDKOS4.js +731 -0
- package/dist/chunk-MSF2Y5MS.js +346 -0
- package/dist/chunk-MWUISGAB.js +382 -0
- package/dist/chunk-MY647ZHR.js +448 -0
- package/dist/chunk-MZ5CEHPQ.js +89 -0
- package/dist/chunk-N62LCOUL.js +214 -0
- package/dist/chunk-NESTX6DR.js +76 -0
- package/dist/chunk-NQZORF6L.js +731 -0
- package/dist/chunk-NWEFAFJS.js +197 -0
- package/dist/chunk-NYF7GHC5.js +526 -0
- package/dist/chunk-NZGGRM4P.js +731 -0
- package/dist/chunk-NZM4E6Y3.js +89 -0
- package/dist/chunk-O6XF6NUN.js +1090 -0
- package/dist/chunk-OF4KG3L7.js +1090 -0
- package/dist/chunk-OQZPSWVN.js +526 -0
- package/dist/chunk-OR6KJ5HH.js +58 -0
- package/dist/chunk-OV6NT6QX.js +128 -0
- package/dist/chunk-OZZNVYAK.js +346 -0
- package/dist/chunk-PDTR3YUU.js +54 -0
- package/dist/chunk-PEGTV6EJ.js +1345 -0
- package/dist/chunk-PITVTSQW.js +333 -0
- package/dist/chunk-PSUAO4MZ.js +345 -0
- package/dist/chunk-PWQIS5E5.js +382 -0
- package/dist/chunk-PXXHKWDH.js +818 -0
- package/dist/chunk-QNEXJFHM.js +495 -0
- package/dist/chunk-QOC46BDY.js +346 -0
- package/dist/chunk-QUJMPJF6.js +1148 -0
- package/dist/chunk-QZD26GDH.js +1073 -0
- package/dist/chunk-RA5JLXBQ.js +89 -0
- package/dist/chunk-RFXUXL2D.js +128 -0
- package/dist/chunk-RTA6KSSK.js +89 -0
- package/dist/chunk-SBX6HSEO.js +159 -0
- package/dist/chunk-SEUST6U5.js +284 -0
- package/dist/chunk-SGNGDKD6.js +127 -0
- package/dist/chunk-SUEQF3ZS.js +214 -0
- package/dist/chunk-SWNAM2NW.js +526 -0
- package/dist/chunk-TBJP46RP.js +1148 -0
- package/dist/chunk-TS7NGPU4.js +1073 -0
- package/dist/chunk-TUPDOPMG.js +731 -0
- package/dist/chunk-TYKUZVCA.js +1921 -0
- package/dist/chunk-TYWQZEEP.js +448 -0
- package/dist/chunk-TZMXJVZV.js +345 -0
- package/dist/chunk-U2DCN7M6.js +1073 -0
- package/dist/chunk-UJZPLZLU.js +197 -0
- package/dist/chunk-UKRKOJQZ.js +54 -0
- package/dist/chunk-V6YIYBTZ.js +204 -0
- package/dist/chunk-VCVGE7HK.js +1921 -0
- package/dist/chunk-VEWBH33L.js +1921 -0
- package/dist/chunk-VK6YZ6K7.js +1073 -0
- package/dist/chunk-VKT4N6WM.js +495 -0
- package/dist/chunk-VQD4CTOC.js +50 -0
- package/dist/chunk-VQUEP7UA.js +244 -0
- package/dist/chunk-VXODHQXB.js +377 -0
- package/dist/chunk-VZES6N3E.js +526 -0
- package/dist/chunk-W5QNW2XG.js +76 -0
- package/dist/chunk-WHK7GXFR.js +13745 -0
- package/dist/chunk-WQKYSGIT.js +159 -0
- package/dist/chunk-WWPJTPPQ.js +197 -0
- package/dist/chunk-WYZSWV6A.js +346 -0
- package/dist/chunk-XD6VOXK3.js +159 -0
- package/dist/chunk-YEMI5UWM.js +58 -0
- package/dist/chunk-YHSATGMH.js +3955 -0
- package/dist/chunk-YJBCGD46.js +13745 -0
- package/dist/chunk-YLICIT56.js +731 -0
- package/dist/chunk-YLOJPYCJ.js +284 -0
- package/dist/chunk-YTDY65EM.js +1345 -0
- package/dist/chunk-YXVGZDDE.js +333 -0
- package/dist/chunk-Z33XSFND.js +76 -0
- package/dist/chunk-ZA7N3ZTA.js +1921 -0
- package/dist/chunk-ZBCOPT2O.js +54 -0
- package/dist/chunk-ZFRG2MNB.js +382 -0
- package/dist/chunk-ZPBCPDB3.js +818 -0
- package/dist/chunk-ZRRRSVQF.js +204 -0
- package/dist/core-memory-554Q3YN5.js +110 -0
- package/dist/core-memory-BC4YN5F4.js +110 -0
- package/dist/core-memory-GTGDVXLO.js +110 -0
- package/dist/core-memory-NID6R3YR.js +110 -0
- package/dist/core-memory-XHIC5NAB.js +110 -0
- package/dist/crm-webhook-MHZTXU5N.js +10 -0
- package/dist/crm-webhook-P6TXQMLI.js +10 -0
- package/dist/crm-webhook-TMWJT2Z5.js +10 -0
- package/dist/crm-webhook-XISULXI7.js +10 -0
- package/dist/crm-webhook-YJ5A7F2E.js +10 -0
- package/dist/cto-delegation-gate-4PMJZL2T.js +206 -0
- package/dist/cto-delegation-gate-A7YKXTRO.js +206 -0
- package/dist/cto-delegation-gate-OREBAHUM.js +206 -0
- package/dist/cto-delegation-gate-POHESML5.js +206 -0
- package/dist/cto-delegation-gate-XFDEMR3W.js +206 -0
- package/dist/daemon-orchestration-HXYPHSYU.js +135 -0
- package/dist/daemon-orchestration-I5BE46P3.js +135 -0
- package/dist/daemon-orchestration-NKE4FYQS.js +135 -0
- package/dist/daemon-orchestration-TFHRZ2RV.js +135 -0
- package/dist/daemon-orchestration-YWEXRAZA.js +135 -0
- package/dist/dreaming-3F72ROTL.js +32 -0
- package/dist/dreaming-DJWC7RVV.js +32 -0
- package/dist/dreaming-JD7MNJGS.js +32 -0
- package/dist/dreaming-LCKPA3B4.js +32 -0
- package/dist/dreaming-SDS5IQYC.js +32 -0
- package/dist/exe-export-IZ2OYMT4.js +73 -0
- package/dist/exe-export-JNWX6ZCQ.js +73 -0
- package/dist/exe-export-OQXCJLWB.js +73 -0
- package/dist/exe-export-QUT5WDDK.js +73 -0
- package/dist/exe-export-YLVAZQAV.js +73 -0
- package/dist/exe-import-AEJYBLA7.js +76 -0
- package/dist/exe-import-HWPYARCG.js +76 -0
- package/dist/exe-import-JE7YYYBJ.js +76 -0
- package/dist/exe-import-K4TWTG24.js +76 -0
- package/dist/exe-import-LZKZQ54C.js +76 -0
- package/dist/exe-key-6FPQHBW6.js +579 -0
- package/dist/exe-key-7XX4OUXD.js +579 -0
- package/dist/exe-key-N3XYSEXP.js +579 -0
- package/dist/exe-key-Q3ZNYT6L.js +579 -0
- package/dist/exe-key-Q47RPB45.js +579 -0
- package/dist/exe-snapshot-2USE2HHM.js +164 -0
- package/dist/exe-snapshot-HZU66HXX.js +164 -0
- package/dist/exe-snapshot-L7OQWZUH.js +164 -0
- package/dist/exe-snapshot-NET7N53Z.js +164 -0
- package/dist/exe-snapshot-X5N5KIVJ.js +164 -0
- package/dist/fast-db-init-C6IPNVPU.js +7 -0
- package/dist/fast-db-init-I7CMGBAN.js +7 -0
- package/dist/fast-db-init-P6YESOUL.js +7 -0
- package/dist/fast-db-init-VDNEFVQF.js +7 -0
- package/dist/fast-db-init-Y6C4TM2T.js +7 -0
- package/dist/gateway/index.js +6 -6
- package/dist/git-task-sweep-C4OV2CEY.js +40 -0
- package/dist/git-task-sweep-J66SYJMW.js +40 -0
- package/dist/git-task-sweep-JYCD3ZKQ.js +40 -0
- package/dist/git-task-sweep-O723DB7F.js +40 -0
- package/dist/git-task-sweep-R3CZQT4O.js +40 -0
- package/dist/hooks/bug-report-worker.js +4 -4
- package/dist/hooks/codex-stop-task-finalizer.js +4 -4
- package/dist/hooks/commit-complete.js +4 -4
- package/dist/hooks/error-recall.js +2 -2
- package/dist/hooks/ingest.js +2 -2
- package/dist/hooks/instructions-loaded.js +1 -1
- package/dist/hooks/manifest.json +18 -18
- package/dist/hooks/notification.js +1 -1
- package/dist/hooks/post-compact.js +2 -2
- package/dist/hooks/post-tool-combined.js +2 -2
- package/dist/hooks/pre-compact.js +3 -3
- package/dist/hooks/pre-tool-use.js +6 -6
- package/dist/hooks/prompt-submit.js +8 -8
- package/dist/hooks/session-end.js +5 -5
- package/dist/hooks/session-start.js +5 -5
- package/dist/hooks/stop.js +5 -5
- package/dist/hooks/subagent-stop.js +2 -2
- package/dist/hooks/summary-worker.js +5 -5
- package/dist/index.js +9 -9
- package/dist/lib/consolidation.js +2 -2
- package/dist/lib/exe-daemon.js +18 -17
- package/dist/lib/hybrid-search.js +2 -2
- package/dist/lib/messaging.js +4 -2
- package/dist/lib/schedules.js +2 -2
- package/dist/lib/store.js +1 -1
- package/dist/lib/tasks.js +3 -3
- package/dist/lib/tmux-routing.js +1 -1
- package/dist/mcp/register-tools.js +24 -24
- package/dist/mcp/server.js +25 -25
- package/dist/mcp/tools/create-task.js +4 -4
- package/dist/mcp/tools/list-tasks.js +4 -4
- package/dist/mcp/tools/send-message.js +3 -3
- package/dist/mcp/tools/update-task.js +4 -4
- package/dist/notifications-65STXW6N.js +45 -0
- package/dist/notifications-C6WBZYSS.js +45 -0
- package/dist/notifications-K3JDUPL5.js +45 -0
- package/dist/notifications-KQOD66ZK.js +45 -0
- package/dist/notifications-PFK5OQEF.js +45 -0
- package/dist/orchestrator-3D7QEVGP.js +33 -0
- package/dist/orchestrator-CC32RZO5.js +33 -0
- package/dist/orchestrator-DDKE4UM3.js +33 -0
- package/dist/orchestrator-DWAYSAFR.js +33 -0
- package/dist/orchestrator-TL37EAWA.js +33 -0
- package/dist/pipeline-router-ADLTS6DZ.js +13 -0
- package/dist/pipeline-router-NCOLBCHN.js +13 -0
- package/dist/pipeline-router-O6ZLSM6U.js +13 -0
- package/dist/pipeline-router-QKLYUYU7.js +13 -0
- package/dist/pipeline-router-W2W5XDND.js +13 -0
- package/dist/reranker-3GFGGCJF.js +19 -0
- package/dist/reranker-3KLYAHO4.js +19 -0
- package/dist/reranker-64KDRYPP.js +19 -0
- package/dist/reranker-MGY5A7BQ.js +19 -0
- package/dist/reranker-ZBX6HSU2.js +19 -0
- package/dist/review-polling-3ZZ2T26N.js +124 -0
- package/dist/review-polling-62EGCBLH.js +124 -0
- package/dist/review-polling-BBQUF54Q.js +124 -0
- package/dist/review-polling-RXQZPGRY.js +124 -0
- package/dist/review-polling-YBB6DKA5.js +124 -0
- package/dist/runtime/index.js +3 -3
- package/dist/session-events-EAODNMNR.js +36 -0
- package/dist/session-events-MVO6JNUL.js +36 -0
- package/dist/session-events-PRVDH3QS.js +36 -0
- package/dist/session-events-PU5OQKMB.js +36 -0
- package/dist/session-events-UXAPXR2D.js +36 -0
- package/dist/session-scope-K4FRGQK4.js +86 -0
- package/dist/session-scope-M47JR2SD.js +86 -0
- package/dist/session-scope-MRQYSD5S.js +86 -0
- package/dist/session-scope-TAH5BUYW.js +86 -0
- package/dist/session-scope-UXZ6RUWC.js +86 -0
- package/dist/skill-refinement-447DZWNK.js +157 -0
- package/dist/skill-refinement-567JSF7L.js +157 -0
- package/dist/skill-refinement-6JVQ3TMS.js +157 -0
- package/dist/skill-refinement-TCI6A32K.js +157 -0
- package/dist/skill-refinement-XNGD3C62.js +157 -0
- package/dist/task-enforcement-7QXEVHAS.js +391 -0
- package/dist/task-enforcement-AZEO67N6.js +391 -0
- package/dist/task-enforcement-EOYP6IO4.js +391 -0
- package/dist/task-enforcement-L5XQKFOV.js +391 -0
- package/dist/task-enforcement-RJPWWEAE.js +391 -0
- package/dist/task-scope-DRQRNWB7.js +35 -0
- package/dist/task-scope-GS7TS3UV.js +35 -0
- package/dist/task-scope-KQNCP42W.js +35 -0
- package/dist/task-scope-OJER4AQ2.js +35 -0
- package/dist/task-scope-SM5F6RD3.js +35 -0
- package/dist/tasks-crud-6TWWETGB.js +77 -0
- package/dist/tasks-crud-DBHYO4MM.js +77 -0
- package/dist/tasks-crud-EFYWPPEI.js +77 -0
- package/dist/tasks-crud-JIS5B4GZ.js +77 -0
- package/dist/tasks-crud-WKJSB5PH.js +77 -0
- package/dist/tasks-notify-GEJKT5TO.js +38 -0
- package/dist/tasks-notify-OW3JDPLK.js +38 -0
- package/dist/tasks-notify-UHE7X6RD.js +38 -0
- package/dist/tasks-notify-W5WVP2FG.js +38 -0
- package/dist/tasks-notify-YKEOYOKN.js +38 -0
- package/dist/tasks-review-2D2X6AHO.js +47 -0
- package/dist/tasks-review-DRKN34HO.js +47 -0
- package/dist/tasks-review-IQSAXXXE.js +47 -0
- package/dist/tasks-review-KWELLLS3.js +47 -0
- package/dist/tasks-review-SUJ6AKAS.js +47 -0
- package/dist/telemetry-upload-FPQAB6ZU.js +739 -0
- package/dist/telemetry-upload-JQYBFEWG.js +739 -0
- package/dist/telemetry-upload-MYVBVUGE.js +739 -0
- package/dist/telemetry-upload-UPAABLGK.js +739 -0
- package/dist/telemetry-upload-UYEHBFGO.js +739 -0
- package/dist/tui/App.js +7 -7
- package/dist/tui-data-LYUZFNO4.js +258 -0
- package/dist/tui-data-NIT4PI5T.js +258 -0
- package/dist/tui-data-QM5BOKRF.js +258 -0
- package/dist/tui-data-VAE43SM3.js +258 -0
- package/dist/tui-data-X7HT3FXF.js +258 -0
- package/dist/worker-gate-BZBWTMCY.js +21 -0
- package/dist/worker-gate-CHVL6UGT.js +21 -0
- package/dist/worker-gate-I6XMCYS4.js +21 -0
- package/dist/worker-gate-KQFS4RJE.js +21 -0
- package/dist/worker-gate-NRP7CMS7.js +21 -0
- package/dist/workflow-engine-AKKOMJJQ.js +28 -0
- package/dist/workflow-engine-EHWQO3LX.js +28 -0
- package/dist/workflow-engine-EMZ5WMQ5.js +28 -0
- package/dist/workflow-engine-I3OUMSF4.js +28 -0
- package/dist/workflow-engine-PHTLEAXP.js +28 -0
- package/package.json +1 -1
- package/release-notes.json +46 -46
|
@@ -0,0 +1,597 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
disposeStore,
|
|
4
|
+
initStore
|
|
5
|
+
} from "./chunk-ZPBCPDB3.js";
|
|
6
|
+
import "./chunk-CHCA3ZM2.js";
|
|
7
|
+
import "./chunk-PUA5564C.js";
|
|
8
|
+
import "./chunk-Y25OJWOQ.js";
|
|
9
|
+
import "./chunk-MP2AFCGL.js";
|
|
10
|
+
import {
|
|
11
|
+
getClient,
|
|
12
|
+
getEmployeeNamesByRole,
|
|
13
|
+
loadEmployeesSync
|
|
14
|
+
} from "./chunk-CHBHR5W6.js";
|
|
15
|
+
import "./chunk-2I23RPSI.js";
|
|
16
|
+
import "./chunk-C6OYEJJI.js";
|
|
17
|
+
import "./chunk-FXU7JOXK.js";
|
|
18
|
+
import "./chunk-K333WOW4.js";
|
|
19
|
+
import "./chunk-VXIMSRTO.js";
|
|
20
|
+
import "./chunk-LYH5HE24.js";
|
|
21
|
+
import {
|
|
22
|
+
isMainModule
|
|
23
|
+
} from "./chunk-6Y4B3QF6.js";
|
|
24
|
+
import "./chunk-MLKGABMK.js";
|
|
25
|
+
|
|
26
|
+
// src/bin/backfill-metadata.ts
|
|
27
|
+
var VALID_INTENTS = /* @__PURE__ */ new Set(["decision", "question", "correction", "report", "discovery", "implementation"]);
|
|
28
|
+
var VALID_OUTCOMES = /* @__PURE__ */ new Set(["success", "failure", "partial", "superseded"]);
|
|
29
|
+
var VALID_DOMAINS = /* @__PURE__ */ new Set(["code", "architecture", "marketing", "operations", "customer", "research"]);
|
|
30
|
+
var VALID_AUDIENCES = /* @__PURE__ */ new Set(["founder", "team", "self"]);
|
|
31
|
+
var VALID_LANGUAGE_TYPES = /* @__PURE__ */ new Set(["code", "prose", "mixed", "json", "sql"]);
|
|
32
|
+
var MAX_TEXT_LENGTH = 2e3;
|
|
33
|
+
var BATCH_SLEEP_MS = 1e3;
|
|
34
|
+
function roleAgentMarkers(role) {
|
|
35
|
+
try {
|
|
36
|
+
const employees = loadEmployeesSync();
|
|
37
|
+
const names = getEmployeeNamesByRole(employees, role).map((n) => n.toLowerCase().trim()).filter(Boolean);
|
|
38
|
+
if (names.length > 0) return names;
|
|
39
|
+
} catch {
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
var MARKETING_AGENT_MARKERS = roleAgentMarkers("CMO");
|
|
44
|
+
var RESEARCH_AGENT_MARKERS = roleAgentMarkers("AI Product Lead");
|
|
45
|
+
function mentionsAgentMarker(text, markers) {
|
|
46
|
+
return markers.some(
|
|
47
|
+
(marker) => text.includes(`/${marker}/`) || text.includes(`agent_id: ${marker}`)
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
function classifyMemoryHeuristic(rawText, toolName) {
|
|
51
|
+
const t = rawText.toLowerCase();
|
|
52
|
+
let intent;
|
|
53
|
+
if (toolName === "store_decision" || t.includes("decided") || t.includes("decision:")) {
|
|
54
|
+
intent = "decision";
|
|
55
|
+
} else if (toolName === "store_memory" || toolName === "commit_to_long_term_memory" || toolName === "update_task" || toolName === "store_behavior" || t.startsWith("stored memory") || t.startsWith("task updated") || t.startsWith("auto-summary")) {
|
|
56
|
+
intent = "report";
|
|
57
|
+
} else if (t.includes("fix ") || t.includes("fixed") || t.includes("correction") || t.includes("bug") || t.includes("revert") || t.includes("hotfix")) {
|
|
58
|
+
intent = "correction";
|
|
59
|
+
} else if (toolName === "Edit" || toolName === "Write" || toolName === "NotebookEdit" || toolName === "Bash" && (t.includes("npm run build") || t.includes("git commit") || t.includes("npm install") || t.includes("npx "))) {
|
|
60
|
+
intent = "implementation";
|
|
61
|
+
} else if (toolName === "Read" || toolName === "Grep" || toolName === "Glob" || toolName === "Agent" || t.includes("?") || t.includes("search")) {
|
|
62
|
+
intent = "question";
|
|
63
|
+
} else if (t.includes("found") || t.includes("discovered") || t.includes("noticed") || t.includes("interesting") || t.includes("realized")) {
|
|
64
|
+
intent = "discovery";
|
|
65
|
+
} else if (toolName === "Bash") {
|
|
66
|
+
intent = "implementation";
|
|
67
|
+
} else {
|
|
68
|
+
intent = "report";
|
|
69
|
+
}
|
|
70
|
+
let outcome;
|
|
71
|
+
if (t.includes("error") || t.includes("failed") || t.includes("failure") || t.includes("exit code 1") || t.includes("exception") || t.includes("crash") || t.includes("rejected") || t.includes("\u274C")) {
|
|
72
|
+
outcome = "failure";
|
|
73
|
+
} else if (t.includes("success") || t.includes("passed") || t.includes("\u2713") || t.includes("complete") || t.includes("done") || t.includes("shipped") || t.includes("merged") || t.includes("build success")) {
|
|
74
|
+
outcome = "success";
|
|
75
|
+
} else if (t.includes("superseded") || t.includes("deprecated") || t.includes("replaced by") || t.includes("archived")) {
|
|
76
|
+
outcome = "superseded";
|
|
77
|
+
} else {
|
|
78
|
+
outcome = "partial";
|
|
79
|
+
}
|
|
80
|
+
let domain;
|
|
81
|
+
if (t.includes("marketing") || t.includes("campaign") || t.includes("brand") || t.includes("carousel") || t.includes("seo") || t.includes("content strategy") || mentionsAgentMarker(t, MARKETING_AGENT_MARKERS)) {
|
|
82
|
+
domain = "marketing";
|
|
83
|
+
} else if (t.includes("architecture") || t.includes("adr") || t.includes("design doc") || t.includes("system design") || t.includes("ARCHITECTURE.md") || t.includes("schema") && t.includes("migration")) {
|
|
84
|
+
domain = "architecture";
|
|
85
|
+
} else if (t.includes("customer") || t.includes("onboarding") || t.includes("install") || t.includes("setup wizard") || t.includes("license") || t.includes("stripe") || t.includes("user feedback")) {
|
|
86
|
+
domain = "customer";
|
|
87
|
+
} else if (t.includes("deploy") || t.includes("ci/cd") || t.includes("docker") || t.includes("nginx") || t.includes("cron") || t.includes("schedule") || t.includes("task management") || t.includes("roster") || toolName === "update_task" || toolName === "create_task") {
|
|
88
|
+
domain = "operations";
|
|
89
|
+
} else if (t.includes("research") || t.includes("competitor") || t.includes("benchmark") || t.includes("comparison") || t.includes("analysis") || t.includes("evaluate") || mentionsAgentMarker(t, RESEARCH_AGENT_MARKERS)) {
|
|
90
|
+
domain = "research";
|
|
91
|
+
} else {
|
|
92
|
+
domain = "code";
|
|
93
|
+
}
|
|
94
|
+
let audience;
|
|
95
|
+
if (toolName === "send_message" || toolName === "ask_team_memory" || toolName === "create_task" || toolName === "update_task" || t.includes("dispatched") || t.includes("assigned to")) {
|
|
96
|
+
audience = "team";
|
|
97
|
+
} else if (toolName === "store_memory" || toolName === "commit_to_long_term_memory" || toolName === "store_decision" || toolName === "store_behavior" || t.includes("summary") || t.includes("report") || t.includes("audit") || t.startsWith("stored memory")) {
|
|
98
|
+
audience = "founder";
|
|
99
|
+
} else {
|
|
100
|
+
audience = "self";
|
|
101
|
+
}
|
|
102
|
+
let languageType;
|
|
103
|
+
const jsonIndicators = (t.match(/[{}[\]]/g) || []).length;
|
|
104
|
+
const codeIndicators = (t.match(/\b(function|const|let|var|import|export|return|if|else|class|async|await)\b/g) || []).length;
|
|
105
|
+
const sqlIndicators = (t.match(/\b(SELECT|INSERT|UPDATE|DELETE|CREATE|ALTER|FROM|WHERE|JOIN)\b/gi) || []).length;
|
|
106
|
+
if (sqlIndicators >= 2) {
|
|
107
|
+
languageType = "sql";
|
|
108
|
+
} else if (jsonIndicators > 6 && jsonIndicators > codeIndicators) {
|
|
109
|
+
languageType = "json";
|
|
110
|
+
} else if (codeIndicators >= 3) {
|
|
111
|
+
languageType = codeIndicators > 5 ? "code" : "mixed";
|
|
112
|
+
} else if (jsonIndicators > 3) {
|
|
113
|
+
languageType = "mixed";
|
|
114
|
+
} else {
|
|
115
|
+
languageType = "prose";
|
|
116
|
+
}
|
|
117
|
+
return { intent, outcome, domain, audience, language_type: languageType };
|
|
118
|
+
}
|
|
119
|
+
async function classifyMemory(_anthropic, rawText) {
|
|
120
|
+
const truncated = rawText.length > MAX_TEXT_LENGTH ? rawText.slice(0, MAX_TEXT_LENGTH) : rawText;
|
|
121
|
+
const baseUrl = process.env.ANTHROPIC_BASE_URL ?? "https://api.anthropic.com";
|
|
122
|
+
const apiKey = process.env.ANTHROPIC_API_KEY ?? "";
|
|
123
|
+
const model = process.env.BACKFILL_MODEL ?? "claude-haiku-4-5-20251001";
|
|
124
|
+
try {
|
|
125
|
+
const res = await fetch(`${baseUrl}/v1/messages`, {
|
|
126
|
+
method: "POST",
|
|
127
|
+
headers: {
|
|
128
|
+
"x-api-key": apiKey,
|
|
129
|
+
"anthropic-version": "2023-06-01",
|
|
130
|
+
"content-type": "application/json"
|
|
131
|
+
},
|
|
132
|
+
body: JSON.stringify({
|
|
133
|
+
model,
|
|
134
|
+
max_tokens: 100,
|
|
135
|
+
system: "You are a JSON classifier. Output ONLY valid JSON. No explanation, no markdown, no text before or after the JSON object.",
|
|
136
|
+
messages: [
|
|
137
|
+
{
|
|
138
|
+
role: "user",
|
|
139
|
+
content: `{"task":"classify","categories":{"intent":["decision","question","correction","report","discovery","implementation"],"outcome":["success","failure","partial","superseded"],"domain":["code","architecture","marketing","operations","customer","research"],"audience":["founder","team","self"],"language_type":["code","prose","mixed","json","sql"]},"text":"${truncated.replace(/"/g, '\\"').replace(/\n/g, " ").slice(0, 500)}"}`
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
role: "assistant",
|
|
143
|
+
content: "{"
|
|
144
|
+
}
|
|
145
|
+
]
|
|
146
|
+
})
|
|
147
|
+
});
|
|
148
|
+
if (!res.ok) {
|
|
149
|
+
const errText = await res.text();
|
|
150
|
+
throw new Error(`${res.status} ${errText.slice(0, 200)}`);
|
|
151
|
+
}
|
|
152
|
+
const data = await res.json();
|
|
153
|
+
const textBlock = data.content.find((b) => b.type === "text");
|
|
154
|
+
if (!textBlock?.text) return null;
|
|
155
|
+
const jsonText = "{" + textBlock.text.trim();
|
|
156
|
+
const parsed = JSON.parse(jsonText);
|
|
157
|
+
if (!VALID_INTENTS.has(parsed.intent)) return null;
|
|
158
|
+
if (!VALID_OUTCOMES.has(parsed.outcome)) return null;
|
|
159
|
+
if (!VALID_DOMAINS.has(parsed.domain)) return null;
|
|
160
|
+
if (!VALID_AUDIENCES.has(parsed.audience)) return null;
|
|
161
|
+
if (!VALID_LANGUAGE_TYPES.has(parsed.language_type)) return null;
|
|
162
|
+
return parsed;
|
|
163
|
+
} catch (err) {
|
|
164
|
+
process.stderr.write(
|
|
165
|
+
`[backfill-metadata] LLM error: ${err instanceof Error ? err.message : String(err)}
|
|
166
|
+
`
|
|
167
|
+
);
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
async function backfillHeuristic(options) {
|
|
172
|
+
const client = getClient();
|
|
173
|
+
const countResult = await client.execute({
|
|
174
|
+
sql: "SELECT COUNT(*) as cnt FROM memories WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL",
|
|
175
|
+
args: []
|
|
176
|
+
});
|
|
177
|
+
const totalUnclassified = Number(countResult.rows[0]?.cnt ?? 0);
|
|
178
|
+
if (totalUnclassified === 0) {
|
|
179
|
+
process.stderr.write("[backfill-metadata] All memories already classified.\n");
|
|
180
|
+
return { classified: 0, skipped: 0, remaining: 0 };
|
|
181
|
+
}
|
|
182
|
+
const toProcess = options.limit > 0 ? Math.min(options.limit, totalUnclassified) : totalUnclassified;
|
|
183
|
+
process.stderr.write(`[backfill-metadata] ${totalUnclassified} unclassified. Heuristic-classifying ${toProcess}.
|
|
184
|
+
`);
|
|
185
|
+
if (options.dryRun) {
|
|
186
|
+
process.stderr.write("[backfill-metadata] Dry run \u2014 would classify " + toProcess + " memories.\n");
|
|
187
|
+
return { classified: 0, skipped: 0, remaining: totalUnclassified };
|
|
188
|
+
}
|
|
189
|
+
let classified = 0;
|
|
190
|
+
let skipped = 0;
|
|
191
|
+
while (classified + skipped < toProcess) {
|
|
192
|
+
const batch = await client.execute({
|
|
193
|
+
sql: `SELECT id, raw_text, tool_name FROM memories
|
|
194
|
+
WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL
|
|
195
|
+
ORDER BY rowid LIMIT ?`,
|
|
196
|
+
args: [options.batchSize]
|
|
197
|
+
});
|
|
198
|
+
if (batch.rows.length === 0) break;
|
|
199
|
+
for (const row of batch.rows) {
|
|
200
|
+
const rawText = row.raw_text;
|
|
201
|
+
const toolName = row.tool_name;
|
|
202
|
+
if (!rawText || rawText.length < 10) {
|
|
203
|
+
await client.execute({
|
|
204
|
+
sql: "UPDATE memories SET intent = 'report', outcome = 'partial', domain = 'code', audience = 'self', language_type = 'prose' WHERE id = ?",
|
|
205
|
+
args: [row.id]
|
|
206
|
+
});
|
|
207
|
+
skipped++;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
const result = classifyMemoryHeuristic(rawText, toolName);
|
|
211
|
+
await client.execute({
|
|
212
|
+
sql: "UPDATE memories SET intent = ?, outcome = ?, domain = ?, audience = ?, language_type = ? WHERE id = ?",
|
|
213
|
+
args: [result.intent, result.outcome, result.domain, result.audience, result.language_type, row.id]
|
|
214
|
+
});
|
|
215
|
+
classified++;
|
|
216
|
+
}
|
|
217
|
+
if (classified % 5e3 < options.batchSize) {
|
|
218
|
+
process.stderr.write(`[backfill-metadata] Heuristic progress: ${classified} classified, ${skipped} skipped
|
|
219
|
+
`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
const remainResult = await client.execute({
|
|
223
|
+
sql: "SELECT COUNT(*) as cnt FROM memories WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL",
|
|
224
|
+
args: []
|
|
225
|
+
});
|
|
226
|
+
const remaining = Number(remainResult.rows[0]?.cnt ?? 0);
|
|
227
|
+
process.stderr.write(
|
|
228
|
+
`[backfill-metadata] Heuristic complete. Classified: ${classified}, Skipped: ${skipped}, Remaining: ${remaining}
|
|
229
|
+
`
|
|
230
|
+
);
|
|
231
|
+
return { classified, skipped, remaining };
|
|
232
|
+
}
|
|
233
|
+
async function backfillClassifications(options) {
|
|
234
|
+
const Anthropic = (await import("@anthropic-ai/sdk")).default;
|
|
235
|
+
const client = getClient();
|
|
236
|
+
const anthropic = new Anthropic();
|
|
237
|
+
let classified = 0;
|
|
238
|
+
let skipped = 0;
|
|
239
|
+
let failed = 0;
|
|
240
|
+
const countResult = await client.execute({
|
|
241
|
+
sql: "SELECT COUNT(*) as cnt FROM memories WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL",
|
|
242
|
+
args: []
|
|
243
|
+
});
|
|
244
|
+
const totalUnclassified = Number(countResult.rows[0]?.cnt ?? 0);
|
|
245
|
+
if (totalUnclassified === 0) {
|
|
246
|
+
process.stderr.write("[backfill-metadata] All memories already classified.\n");
|
|
247
|
+
return { classified: 0, skipped: 0, failed: 0, remaining: 0 };
|
|
248
|
+
}
|
|
249
|
+
const toProcess = options.limit > 0 ? Math.min(options.limit, totalUnclassified) : totalUnclassified;
|
|
250
|
+
process.stderr.write(`[backfill-metadata] ${totalUnclassified} unclassified memories. Processing ${toProcess}.
|
|
251
|
+
`);
|
|
252
|
+
if (options.dryRun) {
|
|
253
|
+
const sample = await client.execute({
|
|
254
|
+
sql: "SELECT id, SUBSTR(raw_text, 1, 80) as preview FROM memories WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL ORDER BY timestamp DESC LIMIT 10",
|
|
255
|
+
args: []
|
|
256
|
+
});
|
|
257
|
+
process.stderr.write("[backfill-metadata] Dry run \u2014 sample of unclassified memories:\n");
|
|
258
|
+
for (const row of sample.rows) {
|
|
259
|
+
process.stderr.write(` ${row.id} \u2014 ${row.preview}...
|
|
260
|
+
`);
|
|
261
|
+
}
|
|
262
|
+
return { classified: 0, skipped: 0, failed: 0, remaining: totalUnclassified };
|
|
263
|
+
}
|
|
264
|
+
while (classified + skipped + failed < toProcess) {
|
|
265
|
+
const batch = await client.execute({
|
|
266
|
+
sql: "SELECT id, raw_text FROM memories WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL ORDER BY timestamp DESC LIMIT ?",
|
|
267
|
+
args: [options.batchSize]
|
|
268
|
+
});
|
|
269
|
+
if (batch.rows.length === 0) break;
|
|
270
|
+
for (const row of batch.rows) {
|
|
271
|
+
const id = row.id;
|
|
272
|
+
const rawText = row.raw_text;
|
|
273
|
+
if (!rawText || rawText.length < 10) {
|
|
274
|
+
skipped++;
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
const result = await classifyMemory(anthropic, rawText);
|
|
278
|
+
if (!result) {
|
|
279
|
+
failed++;
|
|
280
|
+
process.stderr.write(`[backfill-metadata] Failed to classify ${id}
|
|
281
|
+
`);
|
|
282
|
+
await client.execute({
|
|
283
|
+
sql: "UPDATE memories SET intent = 'unknown' WHERE id = ?",
|
|
284
|
+
args: [id]
|
|
285
|
+
});
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
288
|
+
await client.execute({
|
|
289
|
+
sql: "UPDATE memories SET intent = ?, outcome = ?, domain = ?, audience = ?, language_type = ? WHERE id = ?",
|
|
290
|
+
args: [result.intent, result.outcome, result.domain, result.audience, result.language_type, id]
|
|
291
|
+
});
|
|
292
|
+
classified++;
|
|
293
|
+
}
|
|
294
|
+
const total = classified + skipped + failed;
|
|
295
|
+
if (total % 100 < options.batchSize) {
|
|
296
|
+
process.stderr.write(`[backfill-metadata] Progress: ${classified} classified, ${failed} failed, ${skipped} skipped (${total}/${toProcess})
|
|
297
|
+
`);
|
|
298
|
+
}
|
|
299
|
+
if (classified + skipped + failed < toProcess) {
|
|
300
|
+
await new Promise((resolve) => setTimeout(resolve, BATCH_SLEEP_MS));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const remainResult = await client.execute({
|
|
304
|
+
sql: "SELECT COUNT(*) as cnt FROM memories WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL",
|
|
305
|
+
args: []
|
|
306
|
+
});
|
|
307
|
+
const remaining = Number(remainResult.rows[0]?.cnt ?? 0);
|
|
308
|
+
process.stderr.write(
|
|
309
|
+
`[backfill-metadata] Classification complete. Classified: ${classified}, Failed: ${failed}, Skipped: ${skipped}, Remaining: ${remaining}
|
|
310
|
+
`
|
|
311
|
+
);
|
|
312
|
+
return { classified, skipped, failed, remaining };
|
|
313
|
+
}
|
|
314
|
+
async function backfillEntities(options) {
|
|
315
|
+
const client = getClient();
|
|
316
|
+
let populated = 0;
|
|
317
|
+
const countResult = await client.execute({
|
|
318
|
+
sql: "SELECT COUNT(*) as cnt FROM memories WHERE referenced_entities IS NULL",
|
|
319
|
+
args: []
|
|
320
|
+
});
|
|
321
|
+
const totalNull = Number(countResult.rows[0]?.cnt ?? 0);
|
|
322
|
+
if (totalNull === 0) {
|
|
323
|
+
process.stderr.write("[backfill-metadata] All memories already have referenced_entities.\n");
|
|
324
|
+
return 0;
|
|
325
|
+
}
|
|
326
|
+
const toProcess = options.limit > 0 ? Math.min(options.limit, totalNull) : totalNull;
|
|
327
|
+
process.stderr.write(`[backfill-metadata] ${totalNull} memories without referenced_entities. Processing ${toProcess}.
|
|
328
|
+
`);
|
|
329
|
+
if (options.dryRun) {
|
|
330
|
+
process.stderr.write("[backfill-metadata] Dry run \u2014 would populate referenced_entities for up to " + toProcess + " memories.\n");
|
|
331
|
+
return 0;
|
|
332
|
+
}
|
|
333
|
+
const entityRows = await client.execute({
|
|
334
|
+
sql: "SELECT DISTINCT name FROM entities",
|
|
335
|
+
args: []
|
|
336
|
+
});
|
|
337
|
+
const knownEntities = new Set(entityRows.rows.map((r) => r.name));
|
|
338
|
+
let processed = 0;
|
|
339
|
+
while (processed < toProcess) {
|
|
340
|
+
const batch = await client.execute({
|
|
341
|
+
sql: `SELECT m.id, m.raw_text, GROUP_CONCAT(e.name) as entities
|
|
342
|
+
FROM memories m
|
|
343
|
+
LEFT JOIN entity_memories em ON em.memory_id = m.id
|
|
344
|
+
LEFT JOIN entities e ON e.id = em.entity_id
|
|
345
|
+
WHERE m.referenced_entities IS NULL
|
|
346
|
+
GROUP BY m.id
|
|
347
|
+
LIMIT ?`,
|
|
348
|
+
args: [options.batchSize]
|
|
349
|
+
});
|
|
350
|
+
if (batch.rows.length === 0) break;
|
|
351
|
+
for (const row of batch.rows) {
|
|
352
|
+
const id = row.id;
|
|
353
|
+
const rawText = row.raw_text;
|
|
354
|
+
const graphEntities = row.entities;
|
|
355
|
+
let entityList;
|
|
356
|
+
if (graphEntities) {
|
|
357
|
+
entityList = graphEntities.split(",").filter(Boolean);
|
|
358
|
+
} else {
|
|
359
|
+
entityList = extractEntitiesHeuristic(rawText, knownEntities);
|
|
360
|
+
}
|
|
361
|
+
const jsonArray = JSON.stringify(entityList);
|
|
362
|
+
await client.execute({
|
|
363
|
+
sql: "UPDATE memories SET referenced_entities = ? WHERE id = ?",
|
|
364
|
+
args: [jsonArray, id]
|
|
365
|
+
});
|
|
366
|
+
populated++;
|
|
367
|
+
}
|
|
368
|
+
processed += batch.rows.length;
|
|
369
|
+
if (processed % 100 < options.batchSize) {
|
|
370
|
+
process.stderr.write(`[backfill-metadata] Entity progress: ${populated} populated (${processed}/${toProcess})
|
|
371
|
+
`);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
process.stderr.write(`[backfill-metadata] Entity extraction complete. Populated: ${populated}
|
|
375
|
+
`);
|
|
376
|
+
return populated;
|
|
377
|
+
}
|
|
378
|
+
function extractEntitiesHeuristic(rawText, knownEntities) {
|
|
379
|
+
const entities = /* @__PURE__ */ new Set();
|
|
380
|
+
for (const name of knownEntities) {
|
|
381
|
+
if (name.length >= 3 && rawText.toLowerCase().includes(name.toLowerCase())) {
|
|
382
|
+
entities.add(name);
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
const filePathPattern = /(?:\/[\w.-]+){2,}/g;
|
|
386
|
+
const paths = rawText.match(filePathPattern);
|
|
387
|
+
if (paths) {
|
|
388
|
+
for (const p of paths.slice(0, 5)) {
|
|
389
|
+
entities.add(p);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
const toolPattern = /\b(Read|Write|Edit|Bash|Grep|Glob|Agent|mcp__\w+)\b/g;
|
|
393
|
+
const tools = rawText.match(toolPattern);
|
|
394
|
+
if (tools) {
|
|
395
|
+
for (const t of new Set(tools)) {
|
|
396
|
+
entities.add(t);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
return [...entities];
|
|
400
|
+
}
|
|
401
|
+
async function showStats() {
|
|
402
|
+
const client = getClient();
|
|
403
|
+
const fields = ["intent", "outcome", "domain", "audience", "language_type"];
|
|
404
|
+
const totalResult = await client.execute({ sql: "SELECT COUNT(*) as cnt FROM memories", args: [] });
|
|
405
|
+
const total = Number(totalResult.rows[0]?.cnt ?? 0);
|
|
406
|
+
const unclassResult = await client.execute({
|
|
407
|
+
sql: "SELECT COUNT(*) as cnt FROM memories WHERE intent IS NULL",
|
|
408
|
+
args: []
|
|
409
|
+
});
|
|
410
|
+
const unclassified = Number(unclassResult.rows[0]?.cnt ?? 0);
|
|
411
|
+
process.stdout.write(`Total memories: ${total}
|
|
412
|
+
Classified: ${total - unclassified}
|
|
413
|
+
Unclassified: ${unclassified}
|
|
414
|
+
|
|
415
|
+
`);
|
|
416
|
+
for (const field of fields) {
|
|
417
|
+
const dist = await client.execute({
|
|
418
|
+
sql: `SELECT ${field} as val, COUNT(*) as cnt FROM memories WHERE ${field} IS NOT NULL GROUP BY ${field} ORDER BY cnt DESC`,
|
|
419
|
+
args: []
|
|
420
|
+
});
|
|
421
|
+
process.stdout.write(`${field}:
|
|
422
|
+
`);
|
|
423
|
+
for (const row of dist.rows) {
|
|
424
|
+
const pct = (Number(row.cnt) / (total - unclassified) * 100).toFixed(1);
|
|
425
|
+
process.stdout.write(` ${String(row.val).padEnd(20)} ${String(row.cnt).padStart(7)} (${pct}%)
|
|
426
|
+
`);
|
|
427
|
+
}
|
|
428
|
+
process.stdout.write("\n");
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
async function exportBatches(options) {
|
|
432
|
+
const fs = await import("fs");
|
|
433
|
+
const path = await import("path");
|
|
434
|
+
const client = getClient();
|
|
435
|
+
const outDir = path.join(process.cwd(), "exe/output/classifications/input");
|
|
436
|
+
fs.mkdirSync(outDir, { recursive: true });
|
|
437
|
+
const countResult = await client.execute({
|
|
438
|
+
sql: "SELECT COUNT(*) as cnt FROM memories WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL",
|
|
439
|
+
args: []
|
|
440
|
+
});
|
|
441
|
+
const total = Number(countResult.rows[0]?.cnt ?? 0);
|
|
442
|
+
process.stderr.write(`[backfill-metadata] ${total} unclassified memories to export.
|
|
443
|
+
`);
|
|
444
|
+
if (total === 0) return 0;
|
|
445
|
+
const toProcess = options.limit > 0 ? Math.min(options.limit, total) : total;
|
|
446
|
+
let offset = 0;
|
|
447
|
+
let batchNum = 1;
|
|
448
|
+
let exported = 0;
|
|
449
|
+
while (offset < toProcess) {
|
|
450
|
+
const batch = await client.execute({
|
|
451
|
+
sql: "SELECT id, SUBSTR(raw_text, 1, 500) as text FROM memories WHERE intent IS NULL AND outcome IS NULL AND domain IS NULL ORDER BY rowid LIMIT ? OFFSET ?",
|
|
452
|
+
args: [options.batchSize, offset]
|
|
453
|
+
});
|
|
454
|
+
if (batch.rows.length === 0) break;
|
|
455
|
+
const lines = batch.rows.map((row) => {
|
|
456
|
+
const text = String(row.text || "").replace(/\n/g, " ");
|
|
457
|
+
return JSON.stringify({ id: row.id, text });
|
|
458
|
+
});
|
|
459
|
+
const batchFile = path.join(outDir, `batch-${String(batchNum).padStart(4, "0")}.jsonl`);
|
|
460
|
+
fs.writeFileSync(batchFile, lines.join("\n") + "\n");
|
|
461
|
+
exported += batch.rows.length;
|
|
462
|
+
offset += options.batchSize;
|
|
463
|
+
batchNum++;
|
|
464
|
+
if ((batchNum - 1) % 50 === 0) {
|
|
465
|
+
process.stderr.write(`[backfill-metadata] Exported ${exported}/${toProcess}
|
|
466
|
+
`);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
process.stderr.write(`[backfill-metadata] Export complete: ${batchNum - 1} batch files, ${exported} memories.
|
|
470
|
+
`);
|
|
471
|
+
return exported;
|
|
472
|
+
}
|
|
473
|
+
async function importClassifications(importDir) {
|
|
474
|
+
const fs = await import("fs");
|
|
475
|
+
const path = await import("path");
|
|
476
|
+
const client = getClient();
|
|
477
|
+
const files = fs.readdirSync(importDir).filter((f) => f.endsWith(".jsonl")).sort();
|
|
478
|
+
process.stderr.write(`[backfill-metadata] Found ${files.length} JSONL files to import from ${importDir}
|
|
479
|
+
`);
|
|
480
|
+
let imported = 0;
|
|
481
|
+
let invalid = 0;
|
|
482
|
+
for (const file of files) {
|
|
483
|
+
const lines = fs.readFileSync(path.join(importDir, file), "utf-8").split("\n").filter(Boolean);
|
|
484
|
+
for (const line of lines) {
|
|
485
|
+
try {
|
|
486
|
+
const rec = JSON.parse(line);
|
|
487
|
+
if (!rec.id || !VALID_INTENTS.has(rec.intent) || !VALID_OUTCOMES.has(rec.outcome) || !VALID_DOMAINS.has(rec.domain) || !VALID_AUDIENCES.has(rec.audience) || !VALID_LANGUAGE_TYPES.has(rec.language_type)) {
|
|
488
|
+
invalid++;
|
|
489
|
+
continue;
|
|
490
|
+
}
|
|
491
|
+
await client.execute({
|
|
492
|
+
sql: "UPDATE memories SET intent = ?, outcome = ?, domain = ?, audience = ?, language_type = ? WHERE id = ?",
|
|
493
|
+
args: [rec.intent, rec.outcome, rec.domain, rec.audience, rec.language_type, rec.id]
|
|
494
|
+
});
|
|
495
|
+
imported++;
|
|
496
|
+
} catch {
|
|
497
|
+
invalid++;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
if (imported % 1e3 < 200) {
|
|
501
|
+
process.stderr.write(`[backfill-metadata] Imported ${imported} (${invalid} invalid)
|
|
502
|
+
`);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
process.stderr.write(`[backfill-metadata] Import complete: ${imported} updated, ${invalid} invalid.
|
|
506
|
+
`);
|
|
507
|
+
return { imported, invalid };
|
|
508
|
+
}
|
|
509
|
+
function parseArgs(argv) {
|
|
510
|
+
let batchSize = 50;
|
|
511
|
+
let limit = 0;
|
|
512
|
+
let dryRun = false;
|
|
513
|
+
let entities = false;
|
|
514
|
+
let exportBatchesFlag = false;
|
|
515
|
+
let importDir = "";
|
|
516
|
+
let heuristic = false;
|
|
517
|
+
let stats = false;
|
|
518
|
+
for (let i = 0; i < argv.length; i++) {
|
|
519
|
+
const arg = argv[i];
|
|
520
|
+
if (arg.startsWith("--batch-size=")) {
|
|
521
|
+
batchSize = parseInt(arg.split("=")[1], 10) || 50;
|
|
522
|
+
} else if (arg === "--batch-size" && argv[i + 1]) {
|
|
523
|
+
batchSize = parseInt(argv[++i], 10) || 50;
|
|
524
|
+
} else if (arg.startsWith("--limit=")) {
|
|
525
|
+
limit = parseInt(arg.split("=")[1], 10) || 0;
|
|
526
|
+
} else if (arg === "--limit" && argv[i + 1]) {
|
|
527
|
+
limit = parseInt(argv[++i], 10) || 0;
|
|
528
|
+
} else if (arg === "--dry-run") {
|
|
529
|
+
dryRun = true;
|
|
530
|
+
} else if (arg === "--entities") {
|
|
531
|
+
entities = true;
|
|
532
|
+
} else if (arg === "--heuristic") {
|
|
533
|
+
heuristic = true;
|
|
534
|
+
} else if (arg === "--stats") {
|
|
535
|
+
stats = true;
|
|
536
|
+
} else if (arg === "--export") {
|
|
537
|
+
exportBatchesFlag = true;
|
|
538
|
+
} else if (arg.startsWith("--import=")) {
|
|
539
|
+
importDir = arg.split("=")[1];
|
|
540
|
+
} else if (arg === "--import" && argv[i + 1]) {
|
|
541
|
+
importDir = argv[++i];
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return { batchSize, limit, dryRun, entities, exportBatches: exportBatchesFlag, importDir, heuristic, stats };
|
|
545
|
+
}
|
|
546
|
+
async function backfillMetadata(options) {
|
|
547
|
+
await initStore();
|
|
548
|
+
let classified = 0;
|
|
549
|
+
let skipped = 0;
|
|
550
|
+
let failed = 0;
|
|
551
|
+
let remaining = 0;
|
|
552
|
+
let entitiesPopulated = 0;
|
|
553
|
+
if (options.stats) {
|
|
554
|
+
await showStats();
|
|
555
|
+
await disposeStore();
|
|
556
|
+
return { classified: 0, skipped: 0, failed: 0, entitiesPopulated: 0, remaining: 0 };
|
|
557
|
+
}
|
|
558
|
+
if (options.exportBatches) {
|
|
559
|
+
const exported = await exportBatches(options);
|
|
560
|
+
await disposeStore();
|
|
561
|
+
return { classified: 0, skipped: 0, failed: 0, entitiesPopulated: 0, remaining: exported };
|
|
562
|
+
}
|
|
563
|
+
if (options.importDir) {
|
|
564
|
+
const { imported, invalid } = await importClassifications(options.importDir);
|
|
565
|
+
await disposeStore();
|
|
566
|
+
return { classified: imported, skipped: 0, failed: invalid, entitiesPopulated: 0, remaining: 0 };
|
|
567
|
+
}
|
|
568
|
+
if (options.heuristic) {
|
|
569
|
+
const result = await backfillHeuristic(options);
|
|
570
|
+
await disposeStore();
|
|
571
|
+
return { classified: result.classified, skipped: result.skipped, failed: 0, entitiesPopulated: 0, remaining: result.remaining };
|
|
572
|
+
}
|
|
573
|
+
if (options.entities) {
|
|
574
|
+
entitiesPopulated = await backfillEntities(options);
|
|
575
|
+
} else {
|
|
576
|
+
const result = await backfillClassifications(options);
|
|
577
|
+
classified = result.classified;
|
|
578
|
+
skipped = result.skipped;
|
|
579
|
+
failed = result.failed;
|
|
580
|
+
remaining = result.remaining;
|
|
581
|
+
}
|
|
582
|
+
await disposeStore();
|
|
583
|
+
return { classified, skipped, failed, entitiesPopulated, remaining };
|
|
584
|
+
}
|
|
585
|
+
if (isMainModule(import.meta.url)) {
|
|
586
|
+
const options = parseArgs(process.argv.slice(2));
|
|
587
|
+
backfillMetadata(options).then((result) => {
|
|
588
|
+
console.log(JSON.stringify(result, null, 2));
|
|
589
|
+
process.exit(result.failed > 0 ? 1 : 0);
|
|
590
|
+
}).catch((err) => {
|
|
591
|
+
console.error("[backfill-metadata] Fatal:", err instanceof Error ? err.message : String(err));
|
|
592
|
+
process.exit(1);
|
|
593
|
+
});
|
|
594
|
+
}
|
|
595
|
+
export {
|
|
596
|
+
backfillMetadata
|
|
597
|
+
};
|