@askexenow/exe-os 0.9.274 → 0.9.276
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/deploy/stack-manifests/v0.9.json +1329 -1206
- package/dist/active-agent-ELN34YCO.js +25 -0
- package/dist/active-agent-S6HAT63V.js +26 -0
- package/dist/agentic-ontology-WD7UT2GP.js +25 -0
- package/dist/backfill-metadata-D64TBGCN.js +597 -0
- package/dist/backfill-metadata-TIG7BGLY.js +597 -0
- package/dist/background-jobs-3UCY6XQ6.js +25 -0
- package/dist/behaviors-KS2QYUOI.js +25 -0
- package/dist/bin/age-ontology-load.js +2 -2
- package/dist/bin/agentic-ontology-backfill.js +8 -8
- package/dist/bin/agentic-reflection-backfill.js +9 -9
- package/dist/bin/agentic-semantic-label.js +8 -8
- package/dist/bin/backfill-conversations.js +8 -8
- package/dist/bin/backfill-responses.js +8 -8
- package/dist/bin/backfill-vectors.js +10 -10
- package/dist/bin/bulk-sync-postgres.js +9 -9
- package/dist/bin/cc-doctor.js +6 -6
- package/dist/bin/cleanup-stale-review-tasks.js +12 -12
- package/dist/bin/cli.js +20 -20
- package/dist/bin/exe-agent-config.js +4 -4
- package/dist/bin/exe-agent.js +5 -5
- package/dist/bin/exe-assign.js +10 -10
- package/dist/bin/exe-boot.js +20 -20
- package/dist/bin/exe-call.js +5 -5
- package/dist/bin/exe-cloud.js +8 -8
- package/dist/bin/exe-dispatch.js +12 -12
- package/dist/bin/exe-doctor.js +1 -1
- package/dist/bin/exe-export-behaviors.js +9 -9
- package/dist/bin/exe-forget.js +8 -8
- package/dist/bin/exe-gateway.js +8 -8
- package/dist/bin/exe-healthcheck.js +6 -6
- package/dist/bin/exe-heartbeat.js +12 -12
- package/dist/bin/exe-kill.js +16 -16
- package/dist/bin/exe-launch-agent.js +20 -20
- package/dist/bin/exe-new-employee.js +8 -8
- package/dist/bin/exe-pending-messages.js +13 -13
- package/dist/bin/exe-pending-notifications.js +12 -12
- package/dist/bin/exe-pending-reviews.js +12 -12
- package/dist/bin/exe-rename.js +5 -5
- package/dist/bin/exe-review.js +15 -15
- package/dist/bin/exe-search.js +7 -7
- package/dist/bin/exe-session-cleanup.js +18 -18
- package/dist/bin/exe-settings.js +7 -7
- package/dist/bin/exe-start-codex.js +13 -13
- package/dist/bin/exe-start-opencode.js +10 -10
- package/dist/bin/exe-status.js +13 -13
- package/dist/bin/exe-support.js +3 -3
- package/dist/bin/exe-team.js +4 -4
- package/dist/bin/git-sweep.js +13 -13
- package/dist/bin/graph-backfill.js +7 -7
- package/dist/bin/graph-export.js +7 -7
- package/dist/bin/import-history.js +9 -9
- package/dist/bin/install.js +7 -7
- package/dist/bin/intercom-check.js +4 -4
- package/dist/bin/mcp-sessions.js +2 -2
- package/dist/bin/orchestration-metrics.js +5 -5
- package/dist/bin/postgres-agentic-reflection-backfill.js +4 -4
- package/dist/bin/postgres-agentic-semantic-backfill.js +3 -3
- package/dist/bin/scan-tasks.js +12 -12
- package/dist/bin/setup.js +3 -3
- package/dist/bin/shard-migrate.js +7 -7
- package/dist/bin/stack-update.js +4 -4
- package/dist/bin/vps-health-gate.js +1 -1
- package/dist/branding-D253COCP.js +97 -0
- package/dist/capacity-monitor-LLGZM6GA.js +49 -0
- package/dist/capacity-monitor-WS7VVJTC.js +49 -0
- package/dist/catchup-brief-43X5J7BL.js +151 -0
- package/dist/catchup-brief-FAT5H2KH.js +151 -0
- package/dist/catchup-brief-MUWABIEX.js +151 -0
- package/dist/catchup-brief-PWWDZ4Z7.js +151 -0
- package/dist/catchup-brief-YZQU7LD3.js +151 -0
- package/dist/chunk-22N6BNXV.js +258 -0
- package/dist/chunk-2EDMJBSO.js +348 -0
- package/dist/chunk-36RHPMRM.js +13745 -0
- package/dist/chunk-3BYBAINX.js +818 -0
- package/dist/chunk-3FBDNOKA.js +97 -0
- package/dist/chunk-3O4KU3EA.js +54 -0
- package/dist/chunk-3RHPSZKF.js +1345 -0
- package/dist/chunk-3UZ2B4KE.js +526 -0
- package/dist/chunk-3Z2PJC6V.js +127 -0
- package/dist/chunk-4LQ5UGMM.js +85 -0
- package/dist/chunk-4TJV2SX5.js +227 -0
- package/dist/chunk-4UQZGZSF.js +159 -0
- package/dist/chunk-56OM6QLF.js +1051 -0
- package/dist/chunk-5BTZK345.js +448 -0
- package/dist/chunk-5ECWRU7F.js +58 -0
- package/dist/chunk-5FQNEKXL.js +50 -0
- package/dist/chunk-5JGYPU2V.js +13745 -0
- package/dist/chunk-5KIAMZBK.js +260 -0
- package/dist/chunk-5PVYMFK5.js +171 -0
- package/dist/chunk-5SDX3UAG.js +1021 -0
- package/dist/chunk-6GTMXZU2.js +197 -0
- package/dist/chunk-6KRJGGKJ.js +159 -0
- package/dist/chunk-7DXFPBRN.js +204 -0
- package/dist/chunk-7K32KHDT.js +50 -0
- package/dist/chunk-7NRLZQRM.js +1148 -0
- package/dist/chunk-A7XIRWM5.js +128 -0
- package/dist/chunk-AJSJWNI7.js +1148 -0
- package/dist/chunk-AN2NL33X.js +89 -0
- package/dist/chunk-ATWV5FER.js +157 -0
- package/dist/chunk-AU6Q5K6I.js +630 -0
- package/dist/chunk-BE6K6HT7.js +13745 -0
- package/dist/chunk-BER57L7R.js +244 -0
- package/dist/chunk-BHCGGKF7.js +2091 -0
- package/dist/chunk-BLB3MOXN.js +333 -0
- package/dist/chunk-BNZTW5DK.js +55 -0
- package/dist/chunk-C2IR4OGO.js +214 -0
- package/dist/chunk-CBO7FJQB.js +214 -0
- package/dist/chunk-CEPXBGAS.js +151 -0
- package/dist/chunk-CHXJT7O6.js +70 -0
- package/dist/chunk-CXIAU327.js +204 -0
- package/dist/chunk-DOHKUD26.js +366 -0
- package/dist/chunk-DPFGT2T5.js +1021 -0
- package/dist/chunk-DXGPGQTZ.js +551 -0
- package/dist/chunk-DYRRJNZG.js +818 -0
- package/dist/chunk-EP5PKTCF.js +76 -0
- package/dist/chunk-F5XWYDFE.js +1090 -0
- package/dist/chunk-FA4Y72TL.js +128 -0
- package/dist/chunk-FJE6RCPS.js +382 -0
- package/dist/chunk-FS6MBDRJ.js +190 -0
- package/dist/chunk-FZIRUCE5.js +297 -0
- package/dist/chunk-G3U2D2JR.js +1345 -0
- package/dist/chunk-G77I73CN.js +394 -0
- package/dist/chunk-GSN2CFE7.js +13745 -0
- package/dist/chunk-GTYRLDPF.js +128 -0
- package/dist/chunk-H3YWMLS4.js +132 -0
- package/dist/chunk-H4SQZEKD.js +41 -0
- package/dist/chunk-I772PYW4.js +2091 -0
- package/dist/chunk-ICVC6XC6.js +1073 -0
- package/dist/chunk-IGJOFP3V.js +81 -0
- package/dist/chunk-IJUH47AA.js +244 -0
- package/dist/chunk-IQFVWZQS.js +346 -0
- package/dist/chunk-JAP2N5ES.js +135 -0
- package/dist/chunk-JCKOUD7S.js +284 -0
- package/dist/chunk-JF5424J7.js +345 -0
- package/dist/chunk-JQJXWWTR.js +244 -0
- package/dist/chunk-JWLRS5AU.js +203 -0
- package/dist/chunk-JZZILUVN.js +69 -0
- package/dist/chunk-KETX4YMU.js +58 -0
- package/dist/chunk-KFKUY2MZ.js +240 -0
- package/dist/chunk-KLTHMXVE.js +280 -0
- package/dist/chunk-KMYMTYTF.js +262 -0
- package/dist/chunk-L7COBTV7.js +382 -0
- package/dist/chunk-L7KZLRHO.js +13745 -0
- package/dist/chunk-LWGW2QHP.js +75 -0
- package/dist/chunk-LYTIZLNF.js +129 -0
- package/dist/chunk-M34NJW4K.js +210 -0
- package/dist/chunk-M3CM5B4G.js +294 -0
- package/dist/chunk-M3FD44E5.js +38 -0
- package/dist/chunk-MN7UJSHM.js +363 -0
- package/dist/chunk-MTADEZ3J.js +58 -0
- package/dist/chunk-N3VRJKQX.js +54 -0
- package/dist/chunk-N532MB2W.js +290 -0
- package/dist/chunk-NEMNIJTY.js +333 -0
- package/dist/chunk-NFTOTZKL.js +617 -0
- package/dist/chunk-NQSHCAOH.js +163 -0
- package/dist/chunk-NQZKWG5S.js +604 -0
- package/dist/chunk-OFLNYGXJ.js +185 -0
- package/dist/chunk-OSKI5ZE5.js +346 -0
- package/dist/chunk-OUK53LFC.js +1073 -0
- package/dist/chunk-OW2W5DRQ.js +1148 -0
- package/dist/chunk-PLRCR6LW.js +1090 -0
- package/dist/chunk-QGNGAV5B.js +197 -0
- package/dist/chunk-QOV3CU2M.js +604 -0
- package/dist/chunk-QZBT6EXJ.js +1148 -0
- package/dist/chunk-R7HLLTIK.js +3961 -0
- package/dist/chunk-RDGF4T5S.js +377 -0
- package/dist/chunk-RIXOCFDZ.js +731 -0
- package/dist/chunk-RJB4IHY7.js +58 -0
- package/dist/chunk-RNJAQPVM.js +56 -0
- package/dist/chunk-RR2CD6CU.js +58 -0
- package/dist/chunk-RUHLTVW3.js +495 -0
- package/dist/chunk-RVPF7Q7X.js +1921 -0
- package/dist/chunk-RZQOKND6.js +76 -0
- package/dist/chunk-SE34CRK2.js +731 -0
- package/dist/chunk-SMDQTTDB.js +97 -0
- package/dist/chunk-SVAIOGPN.js +89 -0
- package/dist/chunk-SYLT5QCZ.js +127 -0
- package/dist/chunk-TPS5AMGN.js +448 -0
- package/dist/chunk-TQZLV2QV.js +1921 -0
- package/dist/chunk-UIJKWLFF.js +371 -0
- package/dist/chunk-UKQE4PGH.js +345 -0
- package/dist/chunk-VA5OPEGY.js +230 -0
- package/dist/chunk-VS7ZTWQR.js +3556 -0
- package/dist/chunk-VSHDYYHP.js +42 -0
- package/dist/chunk-WGDBENJ4.js +81 -0
- package/dist/chunk-WREI3KQR.js +377 -0
- package/dist/chunk-WVEKZU72.js +495 -0
- package/dist/chunk-WXQ6QK43.js +171 -0
- package/dist/chunk-X2SGZXVW.js +106 -0
- package/dist/chunk-XCX26PCH.js +1148 -0
- package/dist/chunk-XEBAKR2J.js +33 -0
- package/dist/chunk-XOZSYP7Y.js +562 -0
- package/dist/chunk-Y7OVCCAR.js +284 -0
- package/dist/chunk-YBF67NNY.js +377 -0
- package/dist/chunk-YSHYJGSL.js +1512 -0
- package/dist/chunk-YU3IMLUG.js +526 -0
- package/dist/chunk-YWZNRTOQ.js +221 -0
- package/dist/chunk-Z2NBGCIM.js +159 -0
- package/dist/chunk-Z73TGBDX.js +3961 -0
- package/dist/chunk-ZBC652FM.js +369 -0
- package/dist/chunk-ZCODOJ4Z.js +668 -0
- package/dist/chunk-ZITD4HLW.js +123 -0
- package/dist/chunk-ZM7SX4M4.js +30 -0
- package/dist/chunk-ZQUEZTFC.js +551 -0
- package/dist/co-activation-JCTPCXHF.js +72 -0
- package/dist/co-occurrence-BP6B3BH2.js +74 -0
- package/dist/code-context-index-F4OEDXA6.js +30 -0
- package/dist/conversation-wiki-populator-DIUJ4C7D.js +105 -0
- package/dist/core-memory-4FDW36TP.js +110 -0
- package/dist/core-memory-YVBILSBM.js +110 -0
- package/dist/crdt-sync-2ZFB3TNZ.js +33 -0
- package/dist/crm-webhook-4RZ7IS4B.js +10 -0
- package/dist/crm-webhook-JBOBSQ6W.js +10 -0
- package/dist/cto-delegation-gate-TKZXHJML.js +206 -0
- package/dist/cto-delegation-gate-WIETRXE3.js +206 -0
- package/dist/daemon-auth-WTRR4PDV.js +13 -0
- package/dist/daemon-orchestration-A4RCUQT3.js +135 -0
- package/dist/daemon-orchestration-O4DY5V52.js +135 -0
- package/dist/db-backup-JFTPWA6J.js +33 -0
- package/dist/dreaming-I3LRB7RF.js +32 -0
- package/dist/dreaming-K7OU7K6W.js +32 -0
- package/dist/entity-boost-6UYJZP6V.js +356 -0
- package/dist/exe-drift-UMKWLKS4.js +68 -0
- package/dist/exe-export-OW3JPYV5.js +73 -0
- package/dist/exe-export-VIACNSGD.js +73 -0
- package/dist/exe-import-UJS3KJSP.js +76 -0
- package/dist/exe-import-XUTWGVPM.js +76 -0
- package/dist/exe-key-HFQH2DSQ.js +579 -0
- package/dist/exe-key-MLC7AKR4.js +579 -0
- package/dist/exe-org-S52HWZS2.js +73 -0
- package/dist/exe-snapshot-DCDQ5U3N.js +164 -0
- package/dist/exe-snapshot-OUDGSSWH.js +164 -0
- package/dist/fast-db-init-23QWBHZU.js +7 -0
- package/dist/fast-db-init-ACRROC3C.js +7 -0
- package/dist/founder-context-XLQG5AO5.js +96 -0
- package/dist/gateway/index.js +9 -9
- package/dist/gateway-client-QMW3MECR.js +11 -0
- package/dist/git-staleness-IUY4PWYN.js +110 -0
- package/dist/git-task-sweep-DRRHHYSD.js +40 -0
- package/dist/git-task-sweep-OPZC6VJX.js +40 -0
- package/dist/global-procedures-HMPC5HAG.js +20 -0
- package/dist/graph-auto-extract-344QRTFR.js +162 -0
- package/dist/hook-integrity-2UWBTLHA.js +89 -0
- package/dist/hooks/bug-report-worker.js +14 -14
- package/dist/hooks/codex-stop-task-finalizer.js +14 -14
- package/dist/hooks/commit-complete.js +15 -15
- package/dist/hooks/error-recall.js +9 -9
- package/dist/hooks/exe-heartbeat-hook.js +5 -5
- package/dist/hooks/ingest-worker.js +5 -5
- package/dist/hooks/ingest.js +12 -12
- package/dist/hooks/instructions-loaded.js +6 -6
- package/dist/hooks/manifest.json +20 -20
- package/dist/hooks/notification.js +6 -6
- package/dist/hooks/post-compact.js +14 -14
- package/dist/hooks/post-tool-combined.js +7 -7
- package/dist/hooks/pre-compact.js +19 -19
- package/dist/hooks/pre-tool-use.js +18 -18
- package/dist/hooks/prompt-submit.js +26 -26
- package/dist/hooks/session-end.js +24 -24
- package/dist/hooks/session-start.js +13 -13
- package/dist/hooks/stop.js +21 -21
- package/dist/hooks/subagent-stop.js +14 -14
- package/dist/hooks/summary-worker.js +22 -22
- package/dist/index.js +20 -20
- package/dist/installer-7HYL4DSU.js +342 -0
- package/dist/installer-J5BOCLUE.js +38 -0
- package/dist/installer-SQLXCGJ6.js +296 -0
- package/dist/key-backup-status-RNRP2PMU.js +39 -0
- package/dist/lib/agent-config.js +2 -2
- package/dist/lib/cloud-sync.js +6 -6
- package/dist/lib/config.js +1 -1
- package/dist/lib/consolidation.js +7 -7
- package/dist/lib/database.js +3 -3
- package/dist/lib/db-daemon-client.js +3 -3
- package/dist/lib/db.js +3 -3
- package/dist/lib/device-registry.js +1 -1
- package/dist/lib/embedder.js +4 -4
- package/dist/lib/employee-templates.js +5 -5
- package/dist/lib/employees.js +3 -3
- package/dist/lib/exe-daemon-client.js +3 -3
- package/dist/lib/exe-daemon.js +208 -147
- package/dist/lib/hybrid-search.js +7 -7
- package/dist/lib/identity.js +3 -3
- package/dist/lib/keychain.js +1 -1
- package/dist/lib/license.js +2 -2
- package/dist/lib/messaging.js +12 -12
- package/dist/lib/reminders.js +4 -4
- package/dist/lib/schedules.js +7 -7
- package/dist/lib/session-registry.js +5 -5
- package/dist/lib/skill-learning.js +5 -5
- package/dist/lib/store.js +6 -6
- package/dist/lib/task-router.js +4 -4
- package/dist/lib/tasks.js +13 -13
- package/dist/lib/tmux-routing.js +11 -11
- package/dist/lib/token-spend.js +4 -4
- package/dist/lib/ws-client.js +1 -1
- package/dist/license-gate-NAHPUAGW.js +14 -0
- package/dist/mcp/register-tools.js +66 -66
- package/dist/mcp/server.js +67 -67
- package/dist/mcp/tools/complete-reminder.js +5 -5
- package/dist/mcp/tools/create-reminder.js +5 -5
- package/dist/mcp/tools/create-task.js +15 -15
- package/dist/mcp/tools/deactivate-behavior.js +6 -6
- package/dist/mcp/tools/list-reminders.js +5 -5
- package/dist/mcp/tools/list-tasks.js +15 -15
- package/dist/mcp/tools/send-message.js +14 -14
- package/dist/mcp/tools/update-task.js +14 -14
- package/dist/mcp-http-config-MEKBWYML.js +27 -0
- package/dist/memory-cards-72HLPWUY.js +174 -0
- package/dist/memory-graph-extractor-J74IK3P3.js +17 -0
- package/dist/memory-poisoning-defense-7MDWJBHC.js +225 -0
- package/dist/memory-queue-4MGXHMK4.js +19 -0
- package/dist/memory-queue-client-M3KDLB46.js +16 -0
- package/dist/memory-reflection-FMGMGVGM.js +238 -0
- package/dist/message-queue-client-ZHRKKF4X.js +92 -0
- package/dist/notifications-J4OWCFPF.js +45 -0
- package/dist/notifications-K3BH2RHN.js +45 -0
- package/dist/oauth-server-NVANCCC2.js +437 -0
- package/dist/orchestration-events-NDI4WT5H.js +25 -0
- package/dist/orchestration-phase-TVIMFZKY.js +23 -0
- package/dist/orchestrator-TPDFNGUF.js +33 -0
- package/dist/orchestrator-WR3Q2RVZ.js +33 -0
- package/dist/pipeline-router-DLYLQQSN.js +13 -0
- package/dist/pipeline-router-WV2XPQSN.js +13 -0
- package/dist/plan-limits-S55HNF7B.js +26 -0
- package/dist/project-boot-DRERMCYK.js +299 -0
- package/dist/projection-worker-4Z6XFRVE.js +964 -0
- package/dist/push-notifications-5DPGUL54.js +15 -0
- package/dist/reranker-BXUNHAKW.js +19 -0
- package/dist/reranker-DCFKXPKJ.js +19 -0
- package/dist/reranker-EW5P46UD.js +19 -0
- package/dist/reranker-L5CYCTOR.js +19 -0
- package/dist/reranker-U7VNOZJZ.js +19 -0
- package/dist/review-polling-UCYIW2F4.js +124 -0
- package/dist/review-polling-WF74N4VL.js +124 -0
- package/dist/runtime/index.js +14 -14
- package/dist/session-events-HZTHRSZG.js +36 -0
- package/dist/session-events-WFUE6EAD.js +36 -0
- package/dist/session-kill-telemetry-SI33W6SX.js +29 -0
- package/dist/session-scope-2AB6GDVE.js +86 -0
- package/dist/session-scope-IG4CZPQN.js +86 -0
- package/dist/setup-wizard-REWKS6RV.js +12 -0
- package/dist/setup-wizard-Y5JXBKU7.js +12 -0
- package/dist/shard-manager-43E5PUK7.js +30 -0
- package/dist/skill-refinement-ID35SRPO.js +157 -0
- package/dist/skill-refinement-WETHQUPD.js +157 -0
- package/dist/stack-update-HQCFXISV.js +52 -0
- package/dist/steward-gate-OZNNC5IU.js +13 -0
- package/dist/task-enforcement-4S6G5YE5.js +391 -0
- package/dist/task-enforcement-BR7RESTW.js +391 -0
- package/dist/task-scope-4ROTMKKW.js +35 -0
- package/dist/task-scope-MZFUEJY2.js +35 -0
- package/dist/tasks-crud-2TRZEJZE.js +77 -0
- package/dist/tasks-crud-LULZSG24.js +77 -0
- package/dist/tasks-notify-2AQ5Y5D3.js +38 -0
- package/dist/tasks-notify-EQFZENZS.js +38 -0
- package/dist/tasks-review-AOIDCIA7.js +47 -0
- package/dist/tasks-review-F6SMWQGU.js +47 -0
- package/dist/telemetry-upload-63FJDSTM.js +739 -0
- package/dist/telemetry-upload-UQ7362LE.js +739 -0
- package/dist/token-budget-KAVJ5VXR.js +84 -0
- package/dist/tool-capability-index-TSCBQMXU.js +10 -0
- package/dist/tool-telemetry-3XHI5RXV.js +17 -0
- package/dist/tui/App.js +25 -25
- package/dist/tui-data-4TIP5Y2C.js +258 -0
- package/dist/tui-data-DLUU73NT.js +258 -0
- package/dist/webhook-pipe-7ORU6VUL.js +114 -0
- package/dist/wiki-acl-KMRWMPUG.js +111 -0
- package/dist/wiki-client-TQVT6W43.js +157 -0
- package/dist/worker-gate-EUWOYKF4.js +21 -0
- package/dist/worker-gate-KTV4HWI4.js +21 -0
- package/dist/workflow-engine-AA27JRZY.js +28 -0
- package/dist/workflow-engine-ETHM77NC.js +28 -0
- package/dist/worktree-YQ2ZY6C2.js +26 -0
- package/dist/worktree-sweep-B3MI42LI.js +19 -0
- package/package.json +4 -3
- package/release-notes.json +50 -40
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sessionScopeFilter
|
|
3
|
+
} from "./chunk-R7HLLTIK.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/git-task-sweep.ts
|
|
6
|
+
import { execSync } from "child_process";
|
|
7
|
+
var DEFAULT_COMMIT_LIMIT = 50;
|
|
8
|
+
var DEFAULT_STALE_MINUTES = 10;
|
|
9
|
+
var AUTO_ESCALATE_THRESHOLD = 0.6;
|
|
10
|
+
var EXACT_UUID_SCORE = 1;
|
|
11
|
+
var TITLE_KEYWORD_SCORE = 0.5;
|
|
12
|
+
var FILE_PATH_SCORE = 0.3;
|
|
13
|
+
var MIN_KEYWORD_OVERLAP = 3;
|
|
14
|
+
var STOP_WORDS = /* @__PURE__ */ new Set([
|
|
15
|
+
"a",
|
|
16
|
+
"an",
|
|
17
|
+
"the",
|
|
18
|
+
"and",
|
|
19
|
+
"or",
|
|
20
|
+
"but",
|
|
21
|
+
"in",
|
|
22
|
+
"on",
|
|
23
|
+
"at",
|
|
24
|
+
"to",
|
|
25
|
+
"for",
|
|
26
|
+
"of",
|
|
27
|
+
"with",
|
|
28
|
+
"by",
|
|
29
|
+
"from",
|
|
30
|
+
"is",
|
|
31
|
+
"it",
|
|
32
|
+
"as",
|
|
33
|
+
"be",
|
|
34
|
+
"was",
|
|
35
|
+
"are",
|
|
36
|
+
"this",
|
|
37
|
+
"that",
|
|
38
|
+
"not",
|
|
39
|
+
"no",
|
|
40
|
+
"if",
|
|
41
|
+
"so",
|
|
42
|
+
"do",
|
|
43
|
+
"up"
|
|
44
|
+
]);
|
|
45
|
+
function extractKeywords(text) {
|
|
46
|
+
return text.toLowerCase().replace(/[^a-z0-9\s-]/g, " ").split(/\s+/).filter((w) => w.length >= 3 && !STOP_WORDS.has(w));
|
|
47
|
+
}
|
|
48
|
+
function matchScore(task, commitMessage, changedFiles) {
|
|
49
|
+
if (task.id.length >= 8 && commitMessage.includes(task.id)) {
|
|
50
|
+
return EXACT_UUID_SCORE;
|
|
51
|
+
}
|
|
52
|
+
let score = 0;
|
|
53
|
+
const titleWords = extractKeywords(task.title);
|
|
54
|
+
const commitWords = new Set(extractKeywords(commitMessage));
|
|
55
|
+
const overlap = titleWords.filter((w) => commitWords.has(w));
|
|
56
|
+
if (overlap.length >= MIN_KEYWORD_OVERLAP) {
|
|
57
|
+
score += TITLE_KEYWORD_SCORE;
|
|
58
|
+
}
|
|
59
|
+
if (task.context && changedFiles.length > 0) {
|
|
60
|
+
const contextLower = task.context.toLowerCase();
|
|
61
|
+
const hasFileMatch = changedFiles.some(
|
|
62
|
+
(f) => contextLower.includes(f.toLowerCase())
|
|
63
|
+
);
|
|
64
|
+
if (hasFileMatch) {
|
|
65
|
+
score += FILE_PATH_SCORE;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return score;
|
|
69
|
+
}
|
|
70
|
+
function getRecentCommits(limit = DEFAULT_COMMIT_LIMIT) {
|
|
71
|
+
try {
|
|
72
|
+
const SEPARATOR = "<<SEP>>";
|
|
73
|
+
const output = execSync(
|
|
74
|
+
`git log --format="%h${SEPARATOR}%s${SEPARATOR}%aI" --name-only -n ${limit} -z`,
|
|
75
|
+
{ encoding: "utf8", timeout: 1e4 }
|
|
76
|
+
);
|
|
77
|
+
const entries = output.split("\0").filter(Boolean);
|
|
78
|
+
const commits = [];
|
|
79
|
+
let current = null;
|
|
80
|
+
for (const entry of entries) {
|
|
81
|
+
if (entry.includes(SEPARATOR)) {
|
|
82
|
+
const lines = entry.split("\n");
|
|
83
|
+
const headerLine = lines[0];
|
|
84
|
+
const parts = headerLine.split(SEPARATOR);
|
|
85
|
+
if (parts.length >= 3) {
|
|
86
|
+
if (current) commits.push(current);
|
|
87
|
+
current = {
|
|
88
|
+
hash: parts[0],
|
|
89
|
+
message: parts[1],
|
|
90
|
+
files: lines.slice(1).filter(Boolean),
|
|
91
|
+
date: new Date(parts[2])
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
} else if (current) {
|
|
95
|
+
const files = entry.split("\n").filter(Boolean);
|
|
96
|
+
current.files.push(...files);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
if (current) commits.push(current);
|
|
100
|
+
return commits;
|
|
101
|
+
} catch {
|
|
102
|
+
return [];
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function isStale(updatedAt, staleMinutes) {
|
|
106
|
+
const updated = new Date(updatedAt).getTime();
|
|
107
|
+
const threshold = Date.now() - staleMinutes * 6e4;
|
|
108
|
+
return updated < threshold;
|
|
109
|
+
}
|
|
110
|
+
function findBestMatch(task, commits) {
|
|
111
|
+
let best = null;
|
|
112
|
+
for (const commit of commits) {
|
|
113
|
+
const score = matchScore(task, commit.message, commit.files);
|
|
114
|
+
if (score >= AUTO_ESCALATE_THRESHOLD && (!best || score > best.score)) {
|
|
115
|
+
best = { commit, score };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return best;
|
|
119
|
+
}
|
|
120
|
+
async function sweepTasks(projectName, options = {}) {
|
|
121
|
+
const commitLimit = options.commitLimit ?? DEFAULT_COMMIT_LIMIT;
|
|
122
|
+
const staleMinutes = options.staleMinutes ?? DEFAULT_STALE_MINUTES;
|
|
123
|
+
const dryRun = options.dryRun ?? false;
|
|
124
|
+
const result = { escalated: [], unchanged: 0, errors: [] };
|
|
125
|
+
const commits = getRecentCommits(commitLimit);
|
|
126
|
+
if (commits.length === 0) {
|
|
127
|
+
result.errors.push("No git commits found (not a git repo or empty history)");
|
|
128
|
+
return result;
|
|
129
|
+
}
|
|
130
|
+
let tasks;
|
|
131
|
+
try {
|
|
132
|
+
const { initStore } = await import("./lib/store.js");
|
|
133
|
+
await initStore();
|
|
134
|
+
const { getClient } = await import("./lib/database.js");
|
|
135
|
+
const client = getClient();
|
|
136
|
+
const conditions = ["status = 'in_progress'"];
|
|
137
|
+
const args = [];
|
|
138
|
+
if (projectName) {
|
|
139
|
+
conditions.push("project_name = ?");
|
|
140
|
+
args.push(projectName);
|
|
141
|
+
}
|
|
142
|
+
const swScope = sessionScopeFilter();
|
|
143
|
+
if (swScope.sql) {
|
|
144
|
+
conditions.push("(session_scope IS NULL OR session_scope = ?)");
|
|
145
|
+
args.push(...swScope.args);
|
|
146
|
+
}
|
|
147
|
+
const queryResult = await client.execute({
|
|
148
|
+
sql: `SELECT id, title, assigned_to, project_name, status, updated_at, context
|
|
149
|
+
FROM tasks WHERE ${conditions.join(" AND ")}
|
|
150
|
+
ORDER BY updated_at ASC`,
|
|
151
|
+
args
|
|
152
|
+
});
|
|
153
|
+
tasks = queryResult.rows.map((r) => ({
|
|
154
|
+
id: String(r.id),
|
|
155
|
+
title: String(r.title),
|
|
156
|
+
assignedTo: String(r.assigned_to),
|
|
157
|
+
projectName: String(r.project_name),
|
|
158
|
+
status: String(r.status),
|
|
159
|
+
updatedAt: String(r.updated_at),
|
|
160
|
+
context: r.context ? String(r.context) : void 0
|
|
161
|
+
}));
|
|
162
|
+
} catch (err) {
|
|
163
|
+
result.errors.push(`DB query failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
164
|
+
return result;
|
|
165
|
+
}
|
|
166
|
+
if (tasks.length === 0) {
|
|
167
|
+
return result;
|
|
168
|
+
}
|
|
169
|
+
for (const task of tasks) {
|
|
170
|
+
if (!isStale(task.updatedAt, staleMinutes)) {
|
|
171
|
+
result.unchanged++;
|
|
172
|
+
continue;
|
|
173
|
+
}
|
|
174
|
+
const match = findBestMatch(task, commits);
|
|
175
|
+
if (!match) {
|
|
176
|
+
result.unchanged++;
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
if (!dryRun) {
|
|
180
|
+
try {
|
|
181
|
+
const { updateTaskStatus } = await import("./tasks-crud-LULZSG24.js");
|
|
182
|
+
await updateTaskStatus({
|
|
183
|
+
taskId: task.id,
|
|
184
|
+
status: "needs_review",
|
|
185
|
+
result: `Auto-escalated by git-sweep: matching commit ${match.commit.hash} found (score: ${match.score.toFixed(2)})`
|
|
186
|
+
});
|
|
187
|
+
} catch (err) {
|
|
188
|
+
result.errors.push(
|
|
189
|
+
`Failed to escalate task ${task.id}: ${err instanceof Error ? err.message : String(err)}`
|
|
190
|
+
);
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
result.escalated.push({
|
|
195
|
+
taskId: task.id,
|
|
196
|
+
title: task.title,
|
|
197
|
+
matchedCommit: match.commit.hash,
|
|
198
|
+
score: match.score
|
|
199
|
+
});
|
|
200
|
+
process.stderr.write(
|
|
201
|
+
`[git-sweep] ${dryRun ? "WOULD escalate" : "Escalated"} task ${task.id} \u2192 commit ${match.commit.hash} (score: ${match.score.toFixed(2)})
|
|
202
|
+
`
|
|
203
|
+
);
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export {
|
|
209
|
+
extractKeywords,
|
|
210
|
+
matchScore,
|
|
211
|
+
getRecentCommits,
|
|
212
|
+
findBestMatch,
|
|
213
|
+
sweepTasks
|
|
214
|
+
};
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadConfigSync
|
|
3
|
+
} from "./chunk-DOHKUD26.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/push-notifications.ts
|
|
6
|
+
import { execSync } from "child_process";
|
|
7
|
+
var TELEGRAM_TIMEOUT_MS = 1e4;
|
|
8
|
+
var SMTP_TIMEOUT_MS = 15e3;
|
|
9
|
+
var DESKTOP_TIMEOUT_MS = 3e3;
|
|
10
|
+
var _cachedConfig = null;
|
|
11
|
+
var _notifyOn = null;
|
|
12
|
+
function loadPushConfig() {
|
|
13
|
+
if (_cachedConfig && _notifyOn) return { config: _cachedConfig, notifyOn: _notifyOn };
|
|
14
|
+
try {
|
|
15
|
+
const cfg = loadConfigSync();
|
|
16
|
+
_cachedConfig = cfg.notifications ?? {};
|
|
17
|
+
const events = cfg.notify_on;
|
|
18
|
+
_notifyOn = new Set(events ?? ["task_complete", "task_blocked", "context_full", "error_spike", "daemon_crash", "review_ready"]);
|
|
19
|
+
} catch {
|
|
20
|
+
_cachedConfig = {};
|
|
21
|
+
_notifyOn = /* @__PURE__ */ new Set(["task_complete", "task_blocked", "context_full", "error_spike", "daemon_crash", "review_ready"]);
|
|
22
|
+
}
|
|
23
|
+
return { config: _cachedConfig, notifyOn: _notifyOn };
|
|
24
|
+
}
|
|
25
|
+
function _resetPushConfig() {
|
|
26
|
+
_cachedConfig = null;
|
|
27
|
+
_notifyOn = null;
|
|
28
|
+
}
|
|
29
|
+
function sendDesktopNotification(title, body, sessionScope) {
|
|
30
|
+
try {
|
|
31
|
+
const safeTitle = title.replace(/["\\\n]/g, " ").slice(0, 100);
|
|
32
|
+
const safeBody = body.replace(/["\\\n]/g, " ").slice(0, 200);
|
|
33
|
+
try {
|
|
34
|
+
const osc9 = `\x1B]9;${safeTitle}: ${safeBody}\x07`;
|
|
35
|
+
let coordinatorSession;
|
|
36
|
+
if (sessionScope) {
|
|
37
|
+
coordinatorSession = sessionScope;
|
|
38
|
+
} else {
|
|
39
|
+
const sessions = execSync("tmux list-sessions -F '#{session_name}' 2>/dev/null", { encoding: "utf8", timeout: 2e3 }).trim().split("\n");
|
|
40
|
+
coordinatorSession = sessions.find((s) => /^exe\d*$/.test(s));
|
|
41
|
+
}
|
|
42
|
+
if (coordinatorSession) {
|
|
43
|
+
execSync(`printf '${osc9.replace(/'/g, "'\\''")}' > /dev/tty 2>/dev/null || tmux display-message -p -t ${coordinatorSession} '' 2>/dev/null`, { timeout: 2e3, stdio: "ignore" });
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
} catch {
|
|
47
|
+
}
|
|
48
|
+
if (process.platform === "linux") {
|
|
49
|
+
execSync(`notify-send "${safeTitle}" "${safeBody}"`, {
|
|
50
|
+
timeout: DESKTOP_TIMEOUT_MS,
|
|
51
|
+
stdio: "ignore"
|
|
52
|
+
});
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
} catch (err) {
|
|
57
|
+
process.stderr.write(`[push-notify] Desktop notification failed: ${err instanceof Error ? err.message : String(err)}
|
|
58
|
+
`);
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
async function sendTelegram(botToken, chatId, message) {
|
|
63
|
+
try {
|
|
64
|
+
const url = `https://api.telegram.org/bot${botToken}/sendMessage`;
|
|
65
|
+
const res = await fetch(url, {
|
|
66
|
+
method: "POST",
|
|
67
|
+
headers: { "Content-Type": "application/json" },
|
|
68
|
+
body: JSON.stringify({
|
|
69
|
+
chat_id: chatId,
|
|
70
|
+
text: message,
|
|
71
|
+
parse_mode: "Markdown",
|
|
72
|
+
disable_web_page_preview: true
|
|
73
|
+
}),
|
|
74
|
+
signal: AbortSignal.timeout(TELEGRAM_TIMEOUT_MS)
|
|
75
|
+
});
|
|
76
|
+
return res.ok;
|
|
77
|
+
} catch (err) {
|
|
78
|
+
process.stderr.write(`[push-notify] Telegram send failed: ${err instanceof Error ? err.message : String(err)}
|
|
79
|
+
`);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function sendEmail(smtpUrl, from, to, subject, body) {
|
|
84
|
+
if (smtpUrl.startsWith("http")) {
|
|
85
|
+
try {
|
|
86
|
+
const res = await fetch(smtpUrl, {
|
|
87
|
+
method: "POST",
|
|
88
|
+
headers: { "Content-Type": "application/json" },
|
|
89
|
+
body: JSON.stringify({ from, to, subject, text: body }),
|
|
90
|
+
signal: AbortSignal.timeout(SMTP_TIMEOUT_MS)
|
|
91
|
+
});
|
|
92
|
+
return res.ok;
|
|
93
|
+
} catch (err) {
|
|
94
|
+
process.stderr.write(`[push-notify] Email send failed: ${err instanceof Error ? err.message : String(err)}
|
|
95
|
+
`);
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
process.stderr.write(`[push-notify] SMTP transport not implemented. Configure an HTTP email API endpoint.
|
|
100
|
+
`);
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
function formatMessage(msg) {
|
|
104
|
+
const emoji = msg.priority === "urgent" ? "\u{1F534}" : msg.priority === "low" ? "\u26AA" : "\u{1F535}";
|
|
105
|
+
const lines = [
|
|
106
|
+
`${emoji} *${msg.title}*`,
|
|
107
|
+
msg.body
|
|
108
|
+
];
|
|
109
|
+
if (msg.agent) lines.push(`Agent: ${msg.agent}`);
|
|
110
|
+
if (msg.project) lines.push(`Project: ${msg.project}`);
|
|
111
|
+
return lines.join("\n");
|
|
112
|
+
}
|
|
113
|
+
async function pushNotify(msg) {
|
|
114
|
+
const { config, notifyOn } = loadPushConfig();
|
|
115
|
+
const result = { desktop: false, telegram: false, email: false };
|
|
116
|
+
if (!notifyOn.has(msg.event)) return result;
|
|
117
|
+
const formatted = formatMessage(msg);
|
|
118
|
+
if (config.desktop !== false) {
|
|
119
|
+
result.desktop = sendDesktopNotification(msg.title, msg.body, msg.sessionScope);
|
|
120
|
+
}
|
|
121
|
+
if (config.telegram?.bot_token && config.telegram?.chat_id) {
|
|
122
|
+
result.telegram = await sendTelegram(
|
|
123
|
+
config.telegram.bot_token,
|
|
124
|
+
config.telegram.chat_id,
|
|
125
|
+
formatted
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
if (config.email?.smtp_url && config.email?.from && config.email?.to) {
|
|
129
|
+
result.email = await sendEmail(
|
|
130
|
+
config.email.smtp_url,
|
|
131
|
+
config.email.from,
|
|
132
|
+
config.email.to,
|
|
133
|
+
`[exe-os] ${msg.title}`,
|
|
134
|
+
msg.body
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
function pushNotifyAsync(msg) {
|
|
140
|
+
pushNotify(msg).catch((err) => {
|
|
141
|
+
process.stderr.write(`[push-notify] async send failed: ${err instanceof Error ? err.message : String(err)}
|
|
142
|
+
`);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
loadPushConfig,
|
|
148
|
+
_resetPushConfig,
|
|
149
|
+
pushNotify,
|
|
150
|
+
pushNotifyAsync
|
|
151
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadEmployees
|
|
3
|
+
} from "./chunk-VS7ZTWQR.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/agent-symlinks.ts
|
|
6
|
+
import os from "os";
|
|
7
|
+
import path from "path";
|
|
8
|
+
import {
|
|
9
|
+
existsSync,
|
|
10
|
+
lstatSync,
|
|
11
|
+
mkdirSync,
|
|
12
|
+
readlinkSync,
|
|
13
|
+
symlinkSync
|
|
14
|
+
} from "fs";
|
|
15
|
+
function claudeAgentsDir(homeDir) {
|
|
16
|
+
return path.join(homeDir, ".claude", "agents");
|
|
17
|
+
}
|
|
18
|
+
function identitySourcePath(homeDir, agentId) {
|
|
19
|
+
return path.join(homeDir, ".exe-os", "identity", `${agentId}.md`);
|
|
20
|
+
}
|
|
21
|
+
function claudeAgentLinkPath(homeDir, agentId) {
|
|
22
|
+
return path.join(claudeAgentsDir(homeDir), `${agentId}.md`);
|
|
23
|
+
}
|
|
24
|
+
function ensureAgentSymlink(agentId, homeDir = os.homedir()) {
|
|
25
|
+
const target = identitySourcePath(homeDir, agentId);
|
|
26
|
+
const link = claudeAgentLinkPath(homeDir, agentId);
|
|
27
|
+
mkdirSync(claudeAgentsDir(homeDir), { recursive: true });
|
|
28
|
+
if (existsSync(link)) {
|
|
29
|
+
let stat;
|
|
30
|
+
try {
|
|
31
|
+
stat = lstatSync(link);
|
|
32
|
+
} catch {
|
|
33
|
+
return { agentId, action: "conflict", target, link, conflict: "stat_failed" };
|
|
34
|
+
}
|
|
35
|
+
if (!stat.isSymbolicLink()) {
|
|
36
|
+
return { agentId, action: "conflict", target, link, conflict: "regular_file" };
|
|
37
|
+
}
|
|
38
|
+
let currentTarget;
|
|
39
|
+
try {
|
|
40
|
+
currentTarget = readlinkSync(link);
|
|
41
|
+
} catch {
|
|
42
|
+
return { agentId, action: "conflict", target, link, conflict: "readlink_failed" };
|
|
43
|
+
}
|
|
44
|
+
if (currentTarget === target) {
|
|
45
|
+
return { agentId, action: "already_correct", target, link };
|
|
46
|
+
}
|
|
47
|
+
return { agentId, action: "conflict", target, link, conflict: `points_to:${currentTarget}` };
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
symlinkSync(target, link);
|
|
51
|
+
} catch (err) {
|
|
52
|
+
return {
|
|
53
|
+
agentId,
|
|
54
|
+
action: "conflict",
|
|
55
|
+
target,
|
|
56
|
+
link,
|
|
57
|
+
conflict: err instanceof Error ? err.message : String(err)
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return { agentId, action: "created", target, link };
|
|
61
|
+
}
|
|
62
|
+
async function ensureAllAgentSymlinks(homeDir = os.homedir()) {
|
|
63
|
+
const employees = await loadEmployees();
|
|
64
|
+
return employees.map((emp) => ensureAgentSymlink(emp.name, homeDir));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export {
|
|
68
|
+
ensureAgentSymlink,
|
|
69
|
+
ensureAllAgentSymlinks
|
|
70
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getClient
|
|
3
|
+
} from "./chunk-VS7ZTWQR.js";
|
|
4
|
+
|
|
5
|
+
// src/lib/pipeline-router.ts
|
|
6
|
+
import crypto from "crypto";
|
|
7
|
+
async function sinkConversationStore(msg, agentResponse, agentName) {
|
|
8
|
+
try {
|
|
9
|
+
const client = getClient();
|
|
10
|
+
const id = crypto.randomUUID();
|
|
11
|
+
const mediaJson = msg.media ? JSON.stringify(msg.media) : null;
|
|
12
|
+
await client.execute({
|
|
13
|
+
sql: `INSERT INTO conversations
|
|
14
|
+
(id, platform, external_id, sender_id, sender_name, sender_phone, sender_email,
|
|
15
|
+
recipient_id, channel_id, thread_id, reply_to_id,
|
|
16
|
+
content_text, content_media, agent_response, agent_name,
|
|
17
|
+
timestamp, ingested_at)
|
|
18
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
|
|
19
|
+
args: [
|
|
20
|
+
id,
|
|
21
|
+
msg.platform,
|
|
22
|
+
msg.messageId,
|
|
23
|
+
msg.senderId,
|
|
24
|
+
msg.senderName ?? null,
|
|
25
|
+
msg.senderPhone ?? null,
|
|
26
|
+
msg.senderEmail ?? null,
|
|
27
|
+
msg.accountId ?? null,
|
|
28
|
+
msg.channelId,
|
|
29
|
+
msg.threadId ?? `${msg.platform}:${msg.channelId}`,
|
|
30
|
+
msg.replyTo?.messageId ?? null,
|
|
31
|
+
msg.text ?? null,
|
|
32
|
+
mediaJson,
|
|
33
|
+
agentResponse ?? null,
|
|
34
|
+
agentName ?? null,
|
|
35
|
+
msg.timestamp,
|
|
36
|
+
(/* @__PURE__ */ new Date()).toISOString()
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
return true;
|
|
40
|
+
} catch (err) {
|
|
41
|
+
process.stderr.write(
|
|
42
|
+
`[pipeline] conversation-store error: ${err instanceof Error ? err.message : String(err)}
|
|
43
|
+
`
|
|
44
|
+
);
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function sinkMemory(msg, agentResponse, agentName) {
|
|
49
|
+
try {
|
|
50
|
+
const { embed } = await import("./lib/embedder.js");
|
|
51
|
+
const { writeMemory, flushBatch } = await import("./lib/store.js");
|
|
52
|
+
const direction = agentResponse ? "conversation" : "inbound";
|
|
53
|
+
const rawText = [
|
|
54
|
+
`[${msg.platform}] ${direction} from ${msg.senderName ?? msg.senderId}`,
|
|
55
|
+
msg.text ? `Message: ${msg.text}` : null,
|
|
56
|
+
agentResponse ? `Agent (${agentName ?? "unknown"}): ${agentResponse}` : null
|
|
57
|
+
].filter(Boolean).join("\n");
|
|
58
|
+
const vector = await embed(rawText);
|
|
59
|
+
await writeMemory({
|
|
60
|
+
id: crypto.randomUUID(),
|
|
61
|
+
agent_id: agentName ?? "gateway",
|
|
62
|
+
agent_role: "gateway",
|
|
63
|
+
session_id: `gateway-${msg.platform}`,
|
|
64
|
+
timestamp: msg.timestamp,
|
|
65
|
+
tool_name: `gateway-${msg.platform}`,
|
|
66
|
+
project_name: "exe-os",
|
|
67
|
+
has_error: false,
|
|
68
|
+
raw_text: rawText,
|
|
69
|
+
vector,
|
|
70
|
+
importance: 4,
|
|
71
|
+
confidence: 0.8
|
|
72
|
+
});
|
|
73
|
+
await flushBatch();
|
|
74
|
+
return true;
|
|
75
|
+
} catch (err) {
|
|
76
|
+
process.stderr.write(
|
|
77
|
+
`[pipeline] memory-sink error: ${err instanceof Error ? err.message : String(err)}
|
|
78
|
+
`
|
|
79
|
+
);
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function sinkCRM(msg, agentResponse, agentName) {
|
|
84
|
+
try {
|
|
85
|
+
const { isCRMBridgeEnabled, pushConversationToCRM, pushInboundMessageToCRM } = await import("./crm-bridge-BVTB6LZK.js");
|
|
86
|
+
if (!isCRMBridgeEnabled()) return false;
|
|
87
|
+
if (agentResponse) {
|
|
88
|
+
await pushConversationToCRM({
|
|
89
|
+
platform: msg.platform,
|
|
90
|
+
senderId: msg.senderId,
|
|
91
|
+
senderName: msg.senderName,
|
|
92
|
+
messageText: msg.text,
|
|
93
|
+
agentResponse,
|
|
94
|
+
agentName: agentName ?? "unknown",
|
|
95
|
+
timestamp: msg.timestamp,
|
|
96
|
+
accountId: msg.accountId
|
|
97
|
+
});
|
|
98
|
+
} else {
|
|
99
|
+
await pushInboundMessageToCRM({
|
|
100
|
+
platform: msg.platform,
|
|
101
|
+
senderId: msg.senderId,
|
|
102
|
+
senderName: msg.senderName,
|
|
103
|
+
messageText: msg.text,
|
|
104
|
+
timestamp: msg.timestamp,
|
|
105
|
+
accountId: msg.accountId
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return true;
|
|
109
|
+
} catch (err) {
|
|
110
|
+
process.stderr.write(
|
|
111
|
+
`[pipeline] crm-sink error: ${err instanceof Error ? err.message : String(err)}
|
|
112
|
+
`
|
|
113
|
+
);
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async function sinkWiki(msg, agentResponse) {
|
|
118
|
+
try {
|
|
119
|
+
const { createWikiClient } = await import("./wiki-client-TQVT6W43.js");
|
|
120
|
+
const client = await createWikiClient();
|
|
121
|
+
if (!client) return false;
|
|
122
|
+
const content = msg.text ?? "";
|
|
123
|
+
if (content.length < 50) return false;
|
|
124
|
+
const { chatInWorkspace } = await import("./wiki-client-TQVT6W43.js");
|
|
125
|
+
const ingestText = [
|
|
126
|
+
`[${msg.platform}] Message from ${msg.senderName ?? msg.senderId} (${msg.timestamp}):`,
|
|
127
|
+
content,
|
|
128
|
+
agentResponse ? `
|
|
129
|
+
Agent response: ${agentResponse}` : ""
|
|
130
|
+
].join("\n");
|
|
131
|
+
await chatInWorkspace(client, "conversations", ingestText, "chat");
|
|
132
|
+
return true;
|
|
133
|
+
} catch (err) {
|
|
134
|
+
process.stderr.write(
|
|
135
|
+
`[pipeline] wiki-sink error: ${err instanceof Error ? err.message : String(err)}
|
|
136
|
+
`
|
|
137
|
+
);
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
async function sinkEntityExtraction(msg, agentResponse, agentName) {
|
|
142
|
+
try {
|
|
143
|
+
const { extractFromConversation } = await import("./conversation-entity-extractor-EYSI4DKM.js");
|
|
144
|
+
const { storeExtraction } = await import("./graph-rag-G3EG5Q6L.js");
|
|
145
|
+
if ((msg.text?.length ?? 0) < 20) return false;
|
|
146
|
+
if (msg.isHistorical) return false;
|
|
147
|
+
const extraction = await extractFromConversation(msg, agentResponse, agentName);
|
|
148
|
+
if (extraction.entities.length === 0) return false;
|
|
149
|
+
const client = getClient();
|
|
150
|
+
const memoryId = `conv:${msg.messageId}`;
|
|
151
|
+
await storeExtraction(client, extraction, memoryId, msg.timestamp);
|
|
152
|
+
import("./conversation-wiki-populator-DIUJ4C7D.js").then(
|
|
153
|
+
({ populateWikiFromExtraction }) => populateWikiFromExtraction(extraction, msg, agentResponse, agentName)
|
|
154
|
+
).catch((err) => {
|
|
155
|
+
process.stderr.write(
|
|
156
|
+
`[pipeline] wiki-population error: ${err instanceof Error ? err.message : String(err)}
|
|
157
|
+
`
|
|
158
|
+
);
|
|
159
|
+
});
|
|
160
|
+
return true;
|
|
161
|
+
} catch (err) {
|
|
162
|
+
process.stderr.write(
|
|
163
|
+
`[pipeline] entity-extraction-sink error: ${err instanceof Error ? err.message : String(err)}
|
|
164
|
+
`
|
|
165
|
+
);
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
async function ingest(msg, agentResponse, agentName) {
|
|
170
|
+
const errors = [];
|
|
171
|
+
const [conversationStored, memorySunk, crmSunk, wikiSunk, entityExtracted] = await Promise.all([
|
|
172
|
+
sinkConversationStore(msg, agentResponse, agentName).catch((e) => {
|
|
173
|
+
errors.push(`conversation: ${e}`);
|
|
174
|
+
return false;
|
|
175
|
+
}),
|
|
176
|
+
sinkMemory(msg, agentResponse, agentName).catch((e) => {
|
|
177
|
+
errors.push(`memory: ${e}`);
|
|
178
|
+
return false;
|
|
179
|
+
}),
|
|
180
|
+
sinkCRM(msg, agentResponse, agentName).catch((e) => {
|
|
181
|
+
errors.push(`crm: ${e}`);
|
|
182
|
+
return false;
|
|
183
|
+
}),
|
|
184
|
+
sinkWiki(msg, agentResponse).catch((e) => {
|
|
185
|
+
errors.push(`wiki: ${e}`);
|
|
186
|
+
return false;
|
|
187
|
+
}),
|
|
188
|
+
sinkEntityExtraction(msg, agentResponse, agentName).catch((e) => {
|
|
189
|
+
errors.push(`entity-extraction: ${e}`);
|
|
190
|
+
return false;
|
|
191
|
+
})
|
|
192
|
+
]);
|
|
193
|
+
if (errors.length > 0) {
|
|
194
|
+
process.stderr.write(
|
|
195
|
+
`[pipeline] ${errors.length} sink error(s): ${errors.join("; ")}
|
|
196
|
+
`
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
return { conversationStored, memorySunk, crmSunk, wikiSunk, entityExtracted, errors };
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export {
|
|
203
|
+
ingest
|
|
204
|
+
};
|