@askexenow/exe-os 0.9.255 → 0.9.259
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/compose/.env.customer.example +13 -13
- package/deploy/compose/.env.example +8 -8
- package/deploy/compose/docker-compose.yml +18 -18
- package/deploy/compose/generate-env.ts +22 -18
- package/deploy/compose/init-db.sql +221 -20
- package/deploy/stack-manifests/v0.9.json +1207 -1136
- package/dist/{active-agent-DTZ6VJIR.js → active-agent-IGZXTTV4.js} +3 -3
- package/dist/{active-agent-7QNK5CJZ.js → active-agent-OYUXMTHS.js} +3 -3
- package/dist/{agentic-ontology-UZK33N6I.js → agentic-ontology-5WT23SLZ.js} +1 -1
- package/dist/{backfill-metadata-R7PNZ5TX.js → backfill-metadata-EG52U3GF.js} +4 -4
- package/dist/{behaviors-G6QHSQBN.js → behaviors-2TZCFJLU.js} +3 -3
- package/dist/bin/age-ontology-load.js +2 -2
- package/dist/bin/agentic-ontology-backfill.js +5 -5
- package/dist/bin/agentic-reflection-backfill.js +6 -6
- package/dist/bin/agentic-semantic-label.js +5 -5
- package/dist/bin/backfill-conversations.js +6 -5
- package/dist/bin/backfill-responses.js +6 -5
- package/dist/bin/backfill-vectors.js +7 -6
- package/dist/bin/bulk-sync-postgres.js +6 -6
- package/dist/bin/cleanup-stale-review-tasks.js +9 -9
- package/dist/bin/cli.js +17 -17
- package/dist/bin/deferred-daemon-restart.js +4 -1
- package/dist/bin/exe-agent-config.js +2 -2
- package/dist/bin/exe-agent.js +4 -4
- package/dist/bin/exe-assign.js +8 -7
- package/dist/bin/exe-boot.js +16 -16
- package/dist/bin/exe-call.js +4 -4
- package/dist/bin/exe-cloud.js +4 -4
- package/dist/bin/exe-dispatch.js +9 -9
- package/dist/bin/exe-doctor.js +1 -1
- package/dist/bin/exe-export-behaviors.js +7 -7
- package/dist/bin/exe-forget.js +6 -6
- package/dist/bin/exe-gateway.js +9 -9
- package/dist/bin/exe-heartbeat.js +9 -9
- package/dist/bin/exe-kill.js +12 -12
- package/dist/bin/exe-launch-agent.js +16 -16
- package/dist/bin/exe-new-employee.js +6 -6
- package/dist/bin/exe-pending-messages.js +11 -10
- package/dist/bin/exe-pending-notifications.js +9 -9
- package/dist/bin/exe-pending-reviews.js +11 -9
- package/dist/bin/exe-rename.js +4 -4
- package/dist/bin/exe-review.js +11 -11
- package/dist/bin/exe-search.js +5 -5
- package/dist/bin/exe-session-cleanup.js +14 -14
- package/dist/bin/exe-settings.js +4 -4
- package/dist/bin/exe-start-codex.js +11 -11
- package/dist/bin/exe-start-opencode.js +8 -8
- package/dist/bin/exe-status.js +10 -10
- package/dist/bin/exe-support.js +3 -1
- package/dist/bin/exe-team.js +3 -3
- package/dist/bin/git-sweep.js +71 -11
- package/dist/bin/graph-backfill.js +4 -4
- package/dist/bin/graph-export.js +5 -5
- package/dist/bin/graph-layer-benchmark.js +7 -7
- package/dist/bin/import-history.js +7 -7
- package/dist/bin/install.js +12 -9
- package/dist/bin/intercom-check.js +4 -4
- package/dist/bin/mcp-sessions.js +2 -2
- package/dist/bin/orchestration-metrics.js +4 -4
- package/dist/bin/postgres-agentic-reflection-backfill.js +7 -7
- package/dist/bin/postgres-agentic-semantic-backfill.js +7 -7
- package/dist/bin/scan-tasks.js +9 -9
- package/dist/bin/setup.js +1 -1
- package/dist/bin/shard-migrate.js +4 -4
- package/dist/bin/stack-update.js +20 -3
- package/dist/bin/vps-health-gate.js +1 -1
- package/dist/{capacity-monitor-QMKII67L.js → capacity-monitor-CTFWWTCR.js} +10 -10
- package/dist/{catchup-brief-CNISNLV7.js → catchup-brief-UML47LXI.js} +11 -11
- package/dist/{chunk-QP4FHME2.js → chunk-235ZCOYB.js} +18 -6
- package/dist/{chunk-2NEQQCRC.js → chunk-25JAXHON.js} +1 -1
- package/dist/{chunk-MU6ESLYL.js → chunk-2PFNATXD.js} +1 -1
- package/dist/chunk-2XZ6X3PJ.js +13 -0
- package/dist/chunk-3XX3CDKF.js +9 -0
- package/dist/{chunk-ZTB6E2ZL.js → chunk-4FGTT26Q.js} +1 -1
- package/dist/{chunk-YYSQAM4W.js → chunk-4TYAHVDI.js} +8 -8
- package/dist/{chunk-2QKNXGII.js → chunk-4VECWOUO.js} +2 -2
- package/dist/{chunk-YXMXP45V.js → chunk-57C3MZPQ.js} +2 -2
- package/dist/{chunk-FTNNNAMH.js → chunk-5JYCTIQD.js} +1 -1
- package/dist/{chunk-CS267UMH.js → chunk-5LDTCWYX.js} +79 -19
- package/dist/{chunk-FQVITYVF.js → chunk-6D2IZ5MB.js} +2 -2
- package/dist/{chunk-ZG3HADWE.js → chunk-7UJRF4WF.js} +1 -1
- package/dist/{chunk-JFVITKXI.js → chunk-A2UPDE3J.js} +1 -1
- package/dist/{chunk-KOCQAMAM.js → chunk-ANYOAZCZ.js} +238 -5
- package/dist/{chunk-PSQNT5DS.js → chunk-AQS2B3HC.js} +8 -8
- package/dist/{chunk-ABNALOLM.js → chunk-BGEXTWGR.js} +3 -3
- package/dist/{chunk-LPK5JPME.js → chunk-BPZL5YOM.js} +1 -1
- package/dist/{chunk-RLDOG7DI.js → chunk-C6SSCNOC.js} +2516 -2289
- package/dist/{chunk-JGEGEOVP.js → chunk-COKTAJUZ.js} +1 -1
- package/dist/{chunk-MRZE5IOP.js → chunk-CXOX7TRG.js} +1 -1
- package/dist/{chunk-6LFFIEDM.js → chunk-DU64OESH.js} +1 -1
- package/dist/{chunk-LYIUESG2.js → chunk-DYURFBPS.js} +10 -10
- package/dist/{chunk-X3SS45PO.js → chunk-FPXZY3FY.js} +1 -1
- package/dist/{chunk-TVTRMINO.js → chunk-FUGZF7VR.js} +1 -1
- package/dist/{chunk-O7SFCX5B.js → chunk-GB4FI66P.js} +2 -2
- package/dist/{chunk-VGWQBI76.js → chunk-GBR4MAAK.js} +1 -1
- package/dist/chunk-GH4LVBQM.js +371 -0
- package/dist/{chunk-AIXZ5O7U.js → chunk-GIHMDOSK.js} +1 -1
- package/dist/{chunk-RDCE652I.js → chunk-HDWVXSGO.js} +1 -1
- package/dist/{chunk-RF54NGPJ.js → chunk-IJ7R3MXE.js} +3 -5
- package/dist/{chunk-R7FBOZT5.js → chunk-ISL3NSVX.js} +1 -1
- package/dist/{chunk-5B2AEXVA.js → chunk-IVSRRIRG.js} +1 -1
- package/dist/{chunk-SD2R3SEA.js → chunk-J3YNCJ4A.js} +1 -1
- package/dist/{chunk-5IZYSS3M.js → chunk-JE4C74EE.js} +4 -4
- package/dist/{chunk-VRVHIVUE.js → chunk-KSR2PNRW.js} +2 -2
- package/dist/{chunk-LL2ARYTZ.js → chunk-L3PY4NFQ.js} +1 -1
- package/dist/{chunk-VFATLVRX.js → chunk-L5VPUOB6.js} +1 -1
- package/dist/{chunk-3VLFVOM7.js → chunk-LRKJGSNH.js} +2 -2
- package/dist/{chunk-4FT3SQAS.js → chunk-LVY74L2J.js} +2 -2
- package/dist/{chunk-X4T7LR2X.js → chunk-M7PZFYHE.js} +2 -2
- package/dist/{chunk-CIX64N7D.js → chunk-MGTVPIEZ.js} +1 -1
- package/dist/{chunk-MXCBORCC.js → chunk-MKTEGZ37.js} +3 -3
- package/dist/chunk-MMRUBN3I.js +36 -0
- package/dist/{chunk-4MONXPWR.js → chunk-MPXLF7TA.js} +1 -1
- package/dist/{chunk-6QMXKKFD.js → chunk-N27CTUFU.js} +1 -1
- package/dist/{chunk-YDHPC4PX.js → chunk-N4ES27RI.js} +3 -3
- package/dist/{chunk-WIRJ574R.js → chunk-NGQQRGLP.js} +2 -2
- package/dist/{chunk-AQOCHSIR.js → chunk-OCJ5GZKV.js} +4 -4
- package/dist/{chunk-O477L4LV.js → chunk-OSPS5N2I.js} +1 -1
- package/dist/{chunk-5WEH43HH.js → chunk-PQHA6X6Y.js} +1 -1
- package/dist/{chunk-DJYIBHN5.js → chunk-PQQTSNXS.js} +3 -3
- package/dist/{chunk-LGFB67MY.js → chunk-Q3GLQDZI.js} +1 -1
- package/dist/{chunk-7GR7VBBW.js → chunk-QUC27OCW.js} +1 -1
- package/dist/{chunk-5NBOFYJG.js → chunk-QYNFWFFH.js} +4 -4
- package/dist/{chunk-X7I6NLIA.js → chunk-T2EUNNUX.js} +5 -5
- package/dist/{chunk-VRWOLLKN.js → chunk-T4NFOOPB.js} +2 -2
- package/dist/{chunk-2YJSDJEH.js → chunk-TZPHTI5Q.js} +1 -1
- package/dist/{chunk-CQSFIQGN.js → chunk-UOZ5KUNN.js} +1 -1
- package/dist/{chunk-5R4R743Q.js → chunk-V2UVWYHO.js} +17 -15
- package/dist/{chunk-VKCZ3OGM.js → chunk-VD676VIC.js} +4 -4
- package/dist/{chunk-USLVSLQ5.js → chunk-VDCPKJUQ.js} +1 -1
- package/dist/{chunk-Y7NMPQXZ.js → chunk-VLX6AHTD.js} +8 -8
- package/dist/{chunk-ITPIBVSG.js → chunk-WMZTSHNX.js} +83 -1
- package/dist/{chunk-5U7WB4YG.js → chunk-WVBZ3QBR.js} +2 -2
- package/dist/{chunk-3EMZZZNU.js → chunk-X2RKYKTP.js} +1 -1
- package/dist/{chunk-XTIHYH64.js → chunk-YY2BCIAP.js} +2 -2
- package/dist/{chunk-Z6GHDYQI.js → chunk-Z2AEOVEZ.js} +30 -6
- package/dist/{chunk-PHTRZQR4.js → chunk-ZBDAFYDD.js} +4 -4
- package/dist/{chunk-E4CCKWZN.js → chunk-ZKFTDL4M.js} +1 -1
- package/dist/{co-activation-AIVMI5U2.js → co-activation-UNVL5JCP.js} +2 -2
- package/dist/{co-occurrence-L6QOQTJB.js → co-occurrence-ETAVWYVE.js} +2 -2
- package/dist/{code-context-index-DYHYVJHX.js → code-context-index-DCQYAYA2.js} +3 -2
- package/dist/{crdt-sync-YBMDPFNT.js → crdt-sync-AH7N6QOE.js} +1 -1
- package/dist/{crm-webhook-QO3ZESKR.js → crm-webhook-R6546T3Y.js} +2 -2
- package/dist/{cto-delegation-gate-UFPVFLIW.js → cto-delegation-gate-VB4TMZ3I.js} +8 -8
- package/dist/{daemon-orchestration-6XAISQ7B.js → daemon-orchestration-YAJKIL6Q.js} +12 -12
- package/dist/{db-backup-7UMCTS44.js → db-backup-2RG6VHT7.js} +11 -3
- package/dist/{dreaming-FJ75QVGZ.js → dreaming-WMBTSXGD.js} +9 -9
- package/dist/{exe-drift-OH3WV2ZQ.js → exe-drift-MQZGYHEN.js} +3 -3
- package/dist/{exe-export-UYKYNVBU.js → exe-export-E4BDIHOC.js} +5 -5
- package/dist/{exe-import-Q4FNSMLJ.js → exe-import-IWAD4HN6.js} +5 -5
- package/dist/{exe-key-22LOIIUX.js → exe-key-L2RV7XJX.js} +2 -2
- package/dist/{exe-snapshot-J7CL6QEL.js → exe-snapshot-IOGN4ARV.js} +12 -12
- package/dist/{fast-db-init-QXGL2PKQ.js → fast-db-init-GCY3F74H.js} +1 -1
- package/dist/gateway/index.js +8 -8
- package/dist/{git-staleness-YVWDCFIE.js → git-staleness-BQIFNZIU.js} +2 -2
- package/dist/{git-task-sweep-RRCOTTIS.js → git-task-sweep-GSKS6WKR.js} +9 -9
- package/dist/{global-procedures-FCGWAFES.js → global-procedures-3DJUA5OX.js} +3 -3
- package/dist/{graph-auto-extract-RUQC5IIS.js → graph-auto-extract-2I44WRDY.js} +2 -2
- package/dist/hooks/bug-report-worker.js +11 -11
- package/dist/hooks/codex-stop-task-finalizer.js +11 -11
- package/dist/hooks/commit-complete.js +11 -11
- package/dist/hooks/error-recall.js +6 -6
- package/dist/hooks/exe-heartbeat-hook.js +3 -3
- package/dist/hooks/ingest-worker.js +3 -2
- package/dist/hooks/ingest.js +6 -6
- package/dist/hooks/instructions-loaded.js +4 -4
- package/dist/hooks/manifest.json +20 -20
- package/dist/hooks/notification.js +4 -4
- package/dist/hooks/post-compact.js +10 -10
- package/dist/hooks/post-tool-combined.js +6 -6
- package/dist/hooks/pre-compact.js +14 -13
- package/dist/hooks/pre-tool-use.js +14 -14
- package/dist/hooks/prompt-submit.js +22 -22
- package/dist/hooks/session-end.js +19 -18
- package/dist/hooks/session-start.js +11 -11
- package/dist/hooks/stop.js +70 -17
- package/dist/hooks/subagent-stop.js +10 -10
- package/dist/hooks/summary-worker.js +17 -16
- package/dist/index.js +17 -17
- package/dist/{installer-7SMJC3SX.js → installer-6MQCAHUG.js} +5 -5
- package/dist/{installer-GFZVC43I.js → installer-TCMPFSSP.js} +5 -5
- package/dist/{installer-34DCTB5B.js → installer-ZY2BKTEO.js} +5 -5
- package/dist/lib/cloud-sync.js +4 -4
- package/dist/lib/consolidation.js +5 -5
- package/dist/lib/database.js +2 -2
- package/dist/lib/db-daemon-client.js +58 -13
- package/dist/lib/db.js +2 -2
- package/dist/lib/embedder.js +3 -2
- package/dist/lib/employee-templates.js +4 -4
- package/dist/lib/employees.js +2 -2
- package/dist/lib/exe-daemon-client.js +2 -1
- package/dist/lib/exe-daemon.js +255 -104
- package/dist/lib/hybrid-search.js +5 -5
- package/dist/lib/identity.js +2 -2
- package/dist/lib/messaging.js +9 -9
- package/dist/lib/reminders.js +3 -3
- package/dist/lib/schedules.js +5 -5
- package/dist/lib/session-registry.js +4 -4
- package/dist/lib/skill-learning.js +4 -4
- package/dist/lib/store.js +4 -4
- package/dist/lib/task-router.js +3 -3
- package/dist/lib/tasks.js +10 -10
- package/dist/lib/tmux-routing.js +8 -8
- package/dist/lib/token-spend.js +3 -3
- package/dist/mcp/register-tools.js +59 -56
- package/dist/mcp/server.js +60 -57
- package/dist/mcp/tools/complete-reminder.js +4 -4
- package/dist/mcp/tools/create-reminder.js +4 -4
- package/dist/mcp/tools/create-task.js +12 -12
- package/dist/mcp/tools/deactivate-behavior.js +5 -5
- package/dist/mcp/tools/list-reminders.js +4 -4
- package/dist/mcp/tools/list-tasks.js +12 -12
- package/dist/mcp/tools/send-message.js +11 -11
- package/dist/mcp/tools/update-task.js +11 -11
- package/dist/{mcp-http-config-MZMHKMJC.js → mcp-http-config-VUDZ3D5D.js} +3 -3
- package/dist/{memory-cards-3SFXU6IP.js → memory-cards-ZOOPC2WF.js} +2 -2
- package/dist/{memory-graph-extractor-T57YQQCW.js → memory-graph-extractor-RRQMUBMI.js} +3 -3
- package/dist/{memory-poisoning-defense-O53AHMTZ.js → memory-poisoning-defense-UQMNLG6H.js} +2 -2
- package/dist/{memory-queue-client-ITWQIFSD.js → memory-queue-client-TPQDAA4D.js} +3 -2
- package/dist/{memory-reflection-YPP2JC2S.js → memory-reflection-GSGXAGXV.js} +2 -2
- package/dist/{notifications-BETWD6EK.js → notifications-ZKGLZVCU.js} +8 -8
- package/dist/{orchestration-events-A5D52NXX.js → orchestration-events-7RMWC5SS.js} +3 -3
- package/dist/{orchestrator-X564XCWC.js → orchestrator-A6MX2OHA.js} +10 -10
- package/dist/{pipeline-router-RVHLL7UA.js → pipeline-router-6ZBYJD2U.js} +3 -3
- package/dist/{plan-limits-ANAVC6PM.js → plan-limits-4XH4A7IA.js} +3 -3
- package/dist/{project-boot-ENMCAL7G.js → project-boot-7ZEIDWUG.js} +3 -2
- package/dist/{projection-worker-O3HBG5QK.js → projection-worker-YKKBNQZT.js} +130 -51
- package/dist/{reranker-SRJL4IWB.js → reranker-DN2A3H6O.js} +1 -1
- package/dist/{review-polling-5JTTHHEO.js → review-polling-PK3CY4NI.js} +9 -9
- package/dist/runtime/index.js +11 -11
- package/dist/{session-events-RCSYHQQ2.js → session-events-IYU6FYHH.js} +9 -9
- package/dist/{session-kill-telemetry-AL3H4ELS.js → session-kill-telemetry-G2VV4CAH.js} +3 -3
- package/dist/{session-scope-ZB4SR3AX.js → session-scope-DHTVH3D4.js} +8 -8
- package/dist/{setup-wizard-HXTADFXI.js → setup-wizard-IA5ISHQ2.js} +1 -1
- package/dist/{skill-refinement-TT4VDYYW.js → skill-refinement-6PBAFLWP.js} +2 -2
- package/dist/{stack-release-7WDKQOCO.js → stack-release-NW7MV3WV.js} +41 -11
- package/dist/{stack-update-F4CQWMGV.js → stack-update-5SM62R3O.js} +3 -1
- package/dist/{steward-gate-HSV67KLF.js → steward-gate-EQV6CZKY.js} +3 -3
- package/dist/support-outbox-SZVLHHZG.js +295 -0
- package/dist/{task-enforcement-A6AZTYAN.js → task-enforcement-2LS5DOXK.js} +8 -8
- package/dist/{task-scope-XKNAY5S7.js → task-scope-AKF3CSWO.js} +8 -8
- package/dist/{tasks-crud-F732BVOE.js → tasks-crud-KOIA5SAH.js} +8 -8
- package/dist/{tasks-notify-LJ65U7DF.js → tasks-notify-7ZTE4ZQM.js} +9 -9
- package/dist/{tasks-review-Y5F4HRAR.js → tasks-review-VMMMAK2Y.js} +8 -8
- package/dist/{telemetry-upload-HVYO6FL3.js → telemetry-upload-YLW4NAUF.js} +15 -8
- package/dist/{token-budget-VODGJYKX.js → token-budget-NA4OLFNP.js} +2 -2
- package/dist/{tool-capability-index-PZWWVABO.js → tool-capability-index-C73KVY5O.js} +1 -1
- package/dist/{tool-telemetry-5BSTF3P6.js → tool-telemetry-OVI5KL4S.js} +1 -1
- package/dist/tui/App.js +16 -16
- package/dist/{tui-data-EHJWRNRZ.js → tui-data-5NT24CC5.js} +8 -8
- package/dist/{worker-gate-4AS4K7G4.js → worker-gate-AQLJUQ5G.js} +1 -1
- package/dist/{workflow-engine-BXGNFNUW.js → workflow-engine-TRGGUNIZ.js} +2 -2
- package/dist/{worktree-3N5BPITS.js → worktree-NK7GZNEA.js} +4 -4
- package/dist/worktree-sweep-5XVZCH6A.js +18 -0
- package/package.json +3 -2
- package/release-notes.json +32 -33
- package/stack.release.json +48 -48
- package/dist/prediction-log-DOEOHDHS.js +0 -120
- package/dist/support-outbox-KEJ73I3F.js +0 -206
- /package/dist/{chunk-AWVDA2FL.js → chunk-2H3FVAN3.js} +0 -0
- /package/dist/{chunk-VPHOOQLR.js → chunk-3GHTBVZO.js} +0 -0
- /package/dist/{chunk-CCPCIW4Z.js → chunk-BBPRL2MP.js} +0 -0
- /package/dist/{chunk-X2E6W3DB.js → chunk-BRSI3FD6.js} +0 -0
- /package/dist/{chunk-Y2FVN7CX.js → chunk-EYLQRPHF.js} +0 -0
- /package/dist/{chunk-4S5TEBXD.js → chunk-H6QJT5O5.js} +0 -0
- /package/dist/{chunk-FCII2MMI.js → chunk-J5CAYOJU.js} +0 -0
- /package/dist/{chunk-LY2DYTDL.js → chunk-RFJESVEL.js} +0 -0
- /package/dist/{chunk-GBHQ5TXO.js → chunk-UOOCGJUE.js} +0 -0
- /package/dist/{core-memory-WFP2L52F.js → core-memory-VZFTGOFE.js} +0 -0
- /package/dist/{entity-boost-RTYXAOWV.js → entity-boost-OAB2PZQP.js} +0 -0
- /package/dist/{message-queue-client-2CACBUA4.js → message-queue-client-YTKTHAYO.js} +0 -0
- /package/dist/{wiki-acl-MS7QLQCR.js → wiki-acl-UCPOROPR.js} +0 -0
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
inferOutcome,
|
|
6
6
|
inferSemanticLabel,
|
|
7
7
|
ontologyPayload
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EYLQRPHF.js";
|
|
9
9
|
import {
|
|
10
10
|
loadConfig
|
|
11
11
|
} from "./chunk-VXIMSRTO.js";
|
|
@@ -18,6 +18,7 @@ import path from "path";
|
|
|
18
18
|
import { existsSync } from "fs";
|
|
19
19
|
import { createRequire } from "module";
|
|
20
20
|
import { pathToFileURL } from "url";
|
|
21
|
+
var GRAPH_SCHEMA = "graph";
|
|
21
22
|
var prismaPromise = null;
|
|
22
23
|
var ontologySchemaReady = false;
|
|
23
24
|
var filteredSchemaReady = false;
|
|
@@ -167,11 +168,11 @@ async function projectMemoryGraph(prisma, payload, memoryId, timestamp) {
|
|
|
167
168
|
const actualEntityIds = /* @__PURE__ */ new Map();
|
|
168
169
|
for (const entity of graph.entities) {
|
|
169
170
|
const inserted = await prisma.$queryRawUnsafe(
|
|
170
|
-
`INSERT INTO "
|
|
171
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."entities" ("id", "name", "type", "first_seen", "last_seen", "properties")
|
|
171
172
|
VALUES ($1, $2, $3, $4, $4, $5::jsonb)
|
|
172
173
|
ON CONFLICT ("name", "type") DO UPDATE SET
|
|
173
|
-
"last_seen" = GREATEST("
|
|
174
|
-
"properties" = "
|
|
174
|
+
"last_seen" = GREATEST("${GRAPH_SCHEMA}"."entities"."last_seen", EXCLUDED."last_seen"),
|
|
175
|
+
"properties" = "${GRAPH_SCHEMA}"."entities"."properties" || EXCLUDED."properties"
|
|
175
176
|
RETURNING "id"`,
|
|
176
177
|
entity.id,
|
|
177
178
|
entity.name,
|
|
@@ -182,7 +183,7 @@ async function projectMemoryGraph(prisma, payload, memoryId, timestamp) {
|
|
|
182
183
|
const actualId = inserted[0]?.id ?? entity.id;
|
|
183
184
|
actualEntityIds.set(entity.id, actualId);
|
|
184
185
|
await prisma.$executeRawUnsafe(
|
|
185
|
-
`INSERT INTO "
|
|
186
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."entity_memories" ("entity_id", "memory_id")
|
|
186
187
|
VALUES ($1, $2)
|
|
187
188
|
ON CONFLICT DO NOTHING`,
|
|
188
189
|
actualId,
|
|
@@ -195,13 +196,13 @@ async function projectMemoryGraph(prisma, payload, memoryId, timestamp) {
|
|
|
195
196
|
const targetId = actualEntityIds.get(relationship.targetId) ?? relationship.targetId;
|
|
196
197
|
const relId = graphEntityId(`${sourceId}->${relationship.type}->${targetId}`, "relationship");
|
|
197
198
|
await prisma.$executeRawUnsafe(
|
|
198
|
-
`INSERT INTO "
|
|
199
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."relationships" ("id", "source_entity_id", "target_entity_id", "type", "weight", "confidence", "timestamp", "properties")
|
|
199
200
|
VALUES ($1, $2, $3, $4, 1.0, $5, $6, $7::jsonb)
|
|
200
201
|
ON CONFLICT ("source_entity_id", "target_entity_id", "type")
|
|
201
|
-
DO UPDATE SET "weight" = LEAST("
|
|
202
|
-
"confidence" = GREATEST("
|
|
203
|
-
"timestamp" = GREATEST("
|
|
204
|
-
"properties" = "
|
|
202
|
+
DO UPDATE SET "weight" = LEAST("${GRAPH_SCHEMA}"."relationships"."weight" + 0.1, 2.0),
|
|
203
|
+
"confidence" = GREATEST("${GRAPH_SCHEMA}"."relationships"."confidence", EXCLUDED."confidence"),
|
|
204
|
+
"timestamp" = GREATEST("${GRAPH_SCHEMA}"."relationships"."timestamp", EXCLUDED."timestamp"),
|
|
205
|
+
"properties" = "${GRAPH_SCHEMA}"."relationships"."properties" || EXCLUDED."properties"`,
|
|
205
206
|
relId,
|
|
206
207
|
sourceId,
|
|
207
208
|
targetId,
|
|
@@ -217,7 +218,7 @@ async function projectMemoryGraph(prisma, payload, memoryId, timestamp) {
|
|
|
217
218
|
async function ensurePostgresOntologySchema(prisma) {
|
|
218
219
|
if (ontologySchemaReady) return;
|
|
219
220
|
await prisma.$executeRawUnsafe(`
|
|
220
|
-
CREATE TABLE IF NOT EXISTS "
|
|
221
|
+
CREATE TABLE IF NOT EXISTS "${GRAPH_SCHEMA}"."agent_sessions" (
|
|
221
222
|
"id" text PRIMARY KEY,
|
|
222
223
|
"agent_id" text NOT NULL,
|
|
223
224
|
"project_name" text,
|
|
@@ -226,9 +227,9 @@ async function ensurePostgresOntologySchema(prisma) {
|
|
|
226
227
|
"event_count" integer NOT NULL DEFAULT 0,
|
|
227
228
|
"properties" jsonb NOT NULL DEFAULT '{}'::jsonb
|
|
228
229
|
)`);
|
|
229
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_sessions_agent_time" ON "
|
|
230
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_sessions_agent_time" ON "${GRAPH_SCHEMA}"."agent_sessions" ("agent_id", "started_at")`);
|
|
230
231
|
await prisma.$executeRawUnsafe(`
|
|
231
|
-
CREATE TABLE IF NOT EXISTS "
|
|
232
|
+
CREATE TABLE IF NOT EXISTS "${GRAPH_SCHEMA}"."agent_goals" (
|
|
232
233
|
"id" text PRIMARY KEY,
|
|
233
234
|
"statement" text NOT NULL,
|
|
234
235
|
"owner_agent_id" text,
|
|
@@ -244,9 +245,9 @@ async function ensurePostgresOntologySchema(prisma) {
|
|
|
244
245
|
"updated_at" timestamp(3) NOT NULL,
|
|
245
246
|
"source_memory_id" text
|
|
246
247
|
)`);
|
|
247
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_goals_project_status" ON "
|
|
248
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_goals_project_status" ON "${GRAPH_SCHEMA}"."agent_goals" ("project_name", "status", "priority")`);
|
|
248
249
|
await prisma.$executeRawUnsafe(`
|
|
249
|
-
CREATE TABLE IF NOT EXISTS "
|
|
250
|
+
CREATE TABLE IF NOT EXISTS "${GRAPH_SCHEMA}"."agent_events" (
|
|
250
251
|
"id" text PRIMARY KEY,
|
|
251
252
|
"event_type" text NOT NULL,
|
|
252
253
|
"occurred_at" timestamp(3) NOT NULL,
|
|
@@ -265,12 +266,12 @@ async function ensurePostgresOntologySchema(prisma) {
|
|
|
265
266
|
"payload" jsonb NOT NULL DEFAULT '{}'::jsonb,
|
|
266
267
|
"created_at" timestamp(3) NOT NULL
|
|
267
268
|
)`);
|
|
268
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_events_time" ON "
|
|
269
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_events_session_seq" ON "
|
|
270
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_events_goal_time" ON "
|
|
271
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_events_memory" ON "
|
|
269
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_events_time" ON "${GRAPH_SCHEMA}"."agent_events" ("occurred_at", "sequence_index")`);
|
|
270
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_events_session_seq" ON "${GRAPH_SCHEMA}"."agent_events" ("session_id", "sequence_index")`);
|
|
271
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_events_goal_time" ON "${GRAPH_SCHEMA}"."agent_events" ("goal_id", "occurred_at")`);
|
|
272
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_events_memory" ON "${GRAPH_SCHEMA}"."agent_events" ("evidence_memory_id")`);
|
|
272
273
|
await prisma.$executeRawUnsafe(`
|
|
273
|
-
CREATE TABLE IF NOT EXISTS "
|
|
274
|
+
CREATE TABLE IF NOT EXISTS "${GRAPH_SCHEMA}"."agent_goal_links" (
|
|
274
275
|
"id" text PRIMARY KEY,
|
|
275
276
|
"goal_id" text NOT NULL,
|
|
276
277
|
"link_type" text NOT NULL,
|
|
@@ -278,9 +279,9 @@ async function ensurePostgresOntologySchema(prisma) {
|
|
|
278
279
|
"target_type" text NOT NULL,
|
|
279
280
|
"created_at" timestamp(3) NOT NULL
|
|
280
281
|
)`);
|
|
281
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_goal_links_goal" ON "
|
|
282
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_goal_links_goal" ON "${GRAPH_SCHEMA}"."agent_goal_links" ("goal_id", "target_type")`);
|
|
282
283
|
await prisma.$executeRawUnsafe(`
|
|
283
|
-
CREATE TABLE IF NOT EXISTS "
|
|
284
|
+
CREATE TABLE IF NOT EXISTS "${GRAPH_SCHEMA}"."agent_semantic_labels" (
|
|
284
285
|
"id" text PRIMARY KEY,
|
|
285
286
|
"source_memory_id" text NOT NULL,
|
|
286
287
|
"event_id" text,
|
|
@@ -291,10 +292,10 @@ async function ensurePostgresOntologySchema(prisma) {
|
|
|
291
292
|
"created_at" timestamp(3) NOT NULL,
|
|
292
293
|
"updated_at" timestamp(3) NOT NULL
|
|
293
294
|
)`);
|
|
294
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_semantic_labels_memory" ON "
|
|
295
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_semantic_labels_event" ON "
|
|
295
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_semantic_labels_memory" ON "${GRAPH_SCHEMA}"."agent_semantic_labels" ("source_memory_id", "labeler")`);
|
|
296
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_semantic_labels_event" ON "${GRAPH_SCHEMA}"."agent_semantic_labels" ("event_id")`);
|
|
296
297
|
await prisma.$executeRawUnsafe(`
|
|
297
|
-
CREATE TABLE IF NOT EXISTS "
|
|
298
|
+
CREATE TABLE IF NOT EXISTS "${GRAPH_SCHEMA}"."agent_reflection_checkpoints" (
|
|
298
299
|
"id" text PRIMARY KEY,
|
|
299
300
|
"project_name" text,
|
|
300
301
|
"session_id" text,
|
|
@@ -312,8 +313,8 @@ async function ensurePostgresOntologySchema(prisma) {
|
|
|
312
313
|
"confidence" double precision NOT NULL DEFAULT 0,
|
|
313
314
|
"created_at" timestamp(3) NOT NULL
|
|
314
315
|
)`);
|
|
315
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_reflection_project_time" ON "
|
|
316
|
-
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_reflection_session_time" ON "
|
|
316
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_reflection_project_time" ON "${GRAPH_SCHEMA}"."agent_reflection_checkpoints" ("project_name", "window_end_at")`);
|
|
317
|
+
await prisma.$executeRawUnsafe(`CREATE INDEX IF NOT EXISTS "idx_agent_reflection_session_time" ON "${GRAPH_SCHEMA}"."agent_reflection_checkpoints" ("session_id", "window_end_at")`);
|
|
317
318
|
ontologySchemaReady = true;
|
|
318
319
|
}
|
|
319
320
|
async function ensureFilteredSchema(prisma) {
|
|
@@ -355,10 +356,77 @@ async function ensureFilteredSchema(prisma) {
|
|
|
355
356
|
"message_type" TEXT NOT NULL DEFAULT 'text',
|
|
356
357
|
"metadata" JSONB DEFAULT '{}',
|
|
357
358
|
"sent_at" TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
|
358
|
-
|
|
359
|
+
"source_ref" TEXT
|
|
359
360
|
)`);
|
|
361
|
+
await selfHealFilteredSchema(prisma);
|
|
360
362
|
filteredSchemaReady = true;
|
|
361
363
|
}
|
|
364
|
+
async function selfHealFilteredSchema(prisma) {
|
|
365
|
+
const stmts = [
|
|
366
|
+
// --- filtered.contacts: ensure new-generation columns ---
|
|
367
|
+
`ALTER TABLE "filtered"."contacts" ADD COLUMN IF NOT EXISTS "name" TEXT`,
|
|
368
|
+
`ALTER TABLE "filtered"."contacts" ADD COLUMN IF NOT EXISTS "platform" TEXT DEFAULT 'whatsapp'`,
|
|
369
|
+
`ALTER TABLE "filtered"."contacts" ADD COLUMN IF NOT EXISTS "platform_id" TEXT`,
|
|
370
|
+
`ALTER TABLE "filtered"."contacts" ADD COLUMN IF NOT EXISTS "first_seen" TIMESTAMPTZ DEFAULT NOW()`,
|
|
371
|
+
`ALTER TABLE "filtered"."contacts" ADD COLUMN IF NOT EXISTS "last_seen" TIMESTAMPTZ DEFAULT NOW()`,
|
|
372
|
+
// Legacy NOT NULL columns the new worker never writes — relax if present.
|
|
373
|
+
`DO $$ BEGIN
|
|
374
|
+
IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema='filtered' AND table_name='contacts' AND column_name='display_name' AND is_nullable='NO') THEN
|
|
375
|
+
ALTER TABLE "filtered"."contacts" ALTER COLUMN "display_name" DROP NOT NULL;
|
|
376
|
+
END IF;
|
|
377
|
+
END $$`,
|
|
378
|
+
// Backfill new columns from legacy ones where possible, then enforce upsert key.
|
|
379
|
+
`DO $$ BEGIN
|
|
380
|
+
IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema='filtered' AND table_name='contacts' AND column_name='display_name') THEN
|
|
381
|
+
UPDATE "filtered"."contacts" SET
|
|
382
|
+
"name" = COALESCE("name", "display_name"),
|
|
383
|
+
"platform" = COALESCE("platform", "source", 'whatsapp'),
|
|
384
|
+
"platform_id" = COALESCE("platform_id", "source_id", "phone"),
|
|
385
|
+
"first_seen" = COALESCE("first_seen", "first_seen_at", NOW()),
|
|
386
|
+
"last_seen" = COALESCE("last_seen", "last_seen_at", NOW())
|
|
387
|
+
WHERE "platform" IS NULL OR "platform_id" IS NULL;
|
|
388
|
+
END IF;
|
|
389
|
+
END $$`,
|
|
390
|
+
`CREATE UNIQUE INDEX IF NOT EXISTS "contacts_platform_platform_id_uq" ON "filtered"."contacts"("platform", "platform_id")`,
|
|
391
|
+
// --- filtered.conversations: ensure new-generation columns ---
|
|
392
|
+
`ALTER TABLE "filtered"."conversations" ADD COLUMN IF NOT EXISTS "thread_id" TEXT`,
|
|
393
|
+
`ALTER TABLE "filtered"."conversations" ADD COLUMN IF NOT EXISTS "message_type" TEXT DEFAULT 'text'`,
|
|
394
|
+
`ALTER TABLE "filtered"."conversations" ADD COLUMN IF NOT EXISTS "sent_at" TIMESTAMPTZ DEFAULT NOW()`,
|
|
395
|
+
`ALTER TABLE "filtered"."conversations" ADD COLUMN IF NOT EXISTS "source_ref" TEXT`,
|
|
396
|
+
`DO $$ BEGIN
|
|
397
|
+
IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema='filtered' AND table_name='conversations' AND column_name='timestamp' AND is_nullable='NO') THEN
|
|
398
|
+
ALTER TABLE "filtered"."conversations" ALTER COLUMN "timestamp" DROP NOT NULL;
|
|
399
|
+
END IF;
|
|
400
|
+
END $$`,
|
|
401
|
+
`DO $$ BEGIN
|
|
402
|
+
IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema='filtered' AND table_name='conversations' AND column_name='remote_jid') THEN
|
|
403
|
+
UPDATE "filtered"."conversations" SET
|
|
404
|
+
"thread_id" = COALESCE("thread_id", "remote_jid"),
|
|
405
|
+
"sent_at" = COALESCE("sent_at", "timestamp", NOW())
|
|
406
|
+
WHERE "thread_id" IS NULL OR "sent_at" IS NULL;
|
|
407
|
+
END IF;
|
|
408
|
+
END $$`,
|
|
409
|
+
// Retire the weak same-second dedup key; keep a plain index for queries.
|
|
410
|
+
`ALTER TABLE "filtered"."conversations" DROP CONSTRAINT IF EXISTS "conversations_platform_thread_id_sent_at_key"`,
|
|
411
|
+
`DROP INDEX IF EXISTS "filtered"."conversations_platform_thread_sent_uq"`,
|
|
412
|
+
`CREATE INDEX IF NOT EXISTS "conversations_platform_thread_sent_idx" ON "filtered"."conversations"("platform", "thread_id", "sent_at")`,
|
|
413
|
+
`CREATE UNIQUE INDEX IF NOT EXISTS "conversations_platform_source_ref_uq" ON "filtered"."conversations"("platform", "source_ref")`,
|
|
414
|
+
// --- raw.raw_events: retry-model columns required by the poll loop ---
|
|
415
|
+
`ALTER TABLE "raw"."raw_events" ADD COLUMN IF NOT EXISTS "retry_count" INTEGER NOT NULL DEFAULT 0`,
|
|
416
|
+
`ALTER TABLE "raw"."raw_events" ADD COLUMN IF NOT EXISTS "failed_at" TIMESTAMPTZ`,
|
|
417
|
+
`ALTER TABLE "raw"."raw_events" ADD COLUMN IF NOT EXISTS "error" TEXT`,
|
|
418
|
+
`ALTER TABLE "raw"."raw_events" ADD COLUMN IF NOT EXISTS "projections" JSONB`
|
|
419
|
+
];
|
|
420
|
+
for (const stmt of stmts) {
|
|
421
|
+
try {
|
|
422
|
+
await prisma.$executeRawUnsafe(stmt);
|
|
423
|
+
} catch (err) {
|
|
424
|
+
console.error(
|
|
425
|
+
`[projection-worker] schema self-heal statement failed (continuing): ${err instanceof Error ? err.message.split("\n")[0] : String(err)}`
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
362
430
|
async function projectAgenticOntology(prisma, payload, memoryId, timestamp) {
|
|
363
431
|
await ensurePostgresOntologySchema(prisma);
|
|
364
432
|
const row = {
|
|
@@ -384,10 +452,10 @@ async function projectAgenticOntology(prisma, payload, memoryId, timestamp) {
|
|
|
384
452
|
const outcome = inferOutcome(row);
|
|
385
453
|
const now = /* @__PURE__ */ new Date();
|
|
386
454
|
await prisma.$executeRawUnsafe(
|
|
387
|
-
`INSERT INTO "
|
|
455
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."agent_sessions" ("id", "agent_id", "project_name", "started_at", "last_event_at", "event_count", "properties")
|
|
388
456
|
VALUES ($1, $2, $3, $4, $4, 1, $5::jsonb)
|
|
389
|
-
ON CONFLICT ("id") DO UPDATE SET "last_event_at" = GREATEST("
|
|
390
|
-
"event_count" = "
|
|
457
|
+
ON CONFLICT ("id") DO UPDATE SET "last_event_at" = GREATEST("${GRAPH_SCHEMA}"."agent_sessions"."last_event_at", EXCLUDED."last_event_at"),
|
|
458
|
+
"event_count" = "${GRAPH_SCHEMA}"."agent_sessions"."event_count" + 1`,
|
|
391
459
|
row.session_id,
|
|
392
460
|
row.agent_id,
|
|
393
461
|
row.project_name,
|
|
@@ -395,7 +463,7 @@ async function projectAgenticOntology(prisma, payload, memoryId, timestamp) {
|
|
|
395
463
|
JSON.stringify({ agent_role: row.agent_role })
|
|
396
464
|
);
|
|
397
465
|
await prisma.$executeRawUnsafe(
|
|
398
|
-
`INSERT INTO "
|
|
466
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."agent_events"
|
|
399
467
|
("id", "event_type", "occurred_at", "sequence_index", "actor_agent_id", "agent_role", "project_name",
|
|
400
468
|
"session_id", "task_id", "goal_id", "parent_event_id", "intention", "outcome", "evidence_memory_id",
|
|
401
469
|
"impact", "payload", "created_at")
|
|
@@ -419,7 +487,7 @@ async function projectAgenticOntology(prisma, payload, memoryId, timestamp) {
|
|
|
419
487
|
);
|
|
420
488
|
const semantic = inferSemanticLabel(row);
|
|
421
489
|
await prisma.$executeRawUnsafe(
|
|
422
|
-
`INSERT INTO "
|
|
490
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."agent_semantic_labels"
|
|
423
491
|
("id", "source_memory_id", "event_id", "labeler", "schema_version", "confidence", "labels", "created_at", "updated_at")
|
|
424
492
|
VALUES ($1, $2, $3, $4, $5, $6, $7::jsonb, $8, $8)
|
|
425
493
|
ON CONFLICT ("id") DO UPDATE SET "confidence" = EXCLUDED."confidence",
|
|
@@ -437,7 +505,7 @@ async function projectAgenticOntology(prisma, payload, memoryId, timestamp) {
|
|
|
437
505
|
for (const statement of extractGoalCandidates(row)) {
|
|
438
506
|
const goalId = stableId(`goal:${row.project_name}:${statement.toLowerCase()}`);
|
|
439
507
|
await prisma.$executeRawUnsafe(
|
|
440
|
-
`INSERT INTO "
|
|
508
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."agent_goals"
|
|
441
509
|
("id", "statement", "owner_agent_id", "project_name", "status", "priority", "created_at", "updated_at", "source_memory_id")
|
|
442
510
|
VALUES ($1, $2, $3, $4, 'open', 5, $5, $5, $6)
|
|
443
511
|
ON CONFLICT ("id") DO UPDATE SET "updated_at" = EXCLUDED."updated_at"`,
|
|
@@ -449,7 +517,7 @@ async function projectAgenticOntology(prisma, payload, memoryId, timestamp) {
|
|
|
449
517
|
row.id
|
|
450
518
|
);
|
|
451
519
|
await prisma.$executeRawUnsafe(
|
|
452
|
-
`INSERT INTO "
|
|
520
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."agent_goal_links" ("id", "goal_id", "link_type", "target_id", "target_type", "created_at")
|
|
453
521
|
VALUES ($1, $2, 'evidence', $3, 'memory', $4)
|
|
454
522
|
ON CONFLICT ("id") DO NOTHING`,
|
|
455
523
|
stableId(`goal_link:${goalId}:${row.id}:memory`),
|
|
@@ -458,7 +526,7 @@ async function projectAgenticOntology(prisma, payload, memoryId, timestamp) {
|
|
|
458
526
|
now
|
|
459
527
|
);
|
|
460
528
|
await prisma.$executeRawUnsafe(
|
|
461
|
-
`INSERT INTO "
|
|
529
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."agent_goal_links" ("id", "goal_id", "link_type", "target_id", "target_type", "created_at")
|
|
462
530
|
VALUES ($1, $2, 'event', $3, 'event', $4)
|
|
463
531
|
ON CONFLICT ("id") DO NOTHING`,
|
|
464
532
|
stableId(`goal_link:${goalId}:${eventId}:event`),
|
|
@@ -571,7 +639,7 @@ var projectionHandlers = {
|
|
|
571
639
|
const targets = [];
|
|
572
640
|
const payload = event.payload;
|
|
573
641
|
await prisma.$executeRawUnsafe(
|
|
574
|
-
`INSERT INTO "
|
|
642
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."memory_records" ("id", "agent_id", "agent_role", "session_id", "tool_name", "project_name", "raw_text", "memory_type", "source_type", "intent")
|
|
575
643
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
576
644
|
ON CONFLICT ("id") DO NOTHING`,
|
|
577
645
|
crypto.randomUUID(),
|
|
@@ -585,7 +653,7 @@ var projectionHandlers = {
|
|
|
585
653
|
"whatsapp",
|
|
586
654
|
event.event_type
|
|
587
655
|
);
|
|
588
|
-
targets.push("
|
|
656
|
+
targets.push("graph");
|
|
589
657
|
await ensureFilteredSchema(prisma);
|
|
590
658
|
const senderName = payload.sender_name ?? payload.contact_name ?? null;
|
|
591
659
|
const senderPhone = payload.from ?? payload.phone ?? null;
|
|
@@ -608,16 +676,18 @@ var projectionHandlers = {
|
|
|
608
676
|
const messageContent = payload.message ?? payload.text ?? payload.body ?? JSON.stringify(payload);
|
|
609
677
|
const direction = payload.direction ?? "inbound";
|
|
610
678
|
if (contactId && messageContent) {
|
|
679
|
+
const sourceRef = event.source_id ?? event.id;
|
|
611
680
|
await prisma.$executeRawUnsafe(
|
|
612
|
-
`INSERT INTO "filtered"."conversations" ("contact_id", "platform", "thread_id", "direction", "content", "message_type", "sent_at")
|
|
613
|
-
VALUES ($1, 'whatsapp', $2, $3, $4, $5, $6)
|
|
614
|
-
ON CONFLICT ("platform", "
|
|
681
|
+
`INSERT INTO "filtered"."conversations" ("contact_id", "platform", "thread_id", "direction", "content", "message_type", "sent_at", "source_ref")
|
|
682
|
+
VALUES ($1::uuid, 'whatsapp', $2, $3, $4, $5, $6, $7)
|
|
683
|
+
ON CONFLICT ("platform", "source_ref") DO NOTHING`,
|
|
615
684
|
contactId,
|
|
616
685
|
threadId,
|
|
617
686
|
direction,
|
|
618
687
|
typeof messageContent === "string" ? messageContent : JSON.stringify(messageContent),
|
|
619
688
|
payload.type ?? "text",
|
|
620
|
-
event.timestamp
|
|
689
|
+
event.timestamp,
|
|
690
|
+
String(sourceRef)
|
|
621
691
|
);
|
|
622
692
|
targets.push("filtered.conversations");
|
|
623
693
|
}
|
|
@@ -628,7 +698,7 @@ var projectionHandlers = {
|
|
|
628
698
|
const targets = [];
|
|
629
699
|
const payload = event.payload;
|
|
630
700
|
await prisma.$executeRawUnsafe(
|
|
631
|
-
`INSERT INTO "
|
|
701
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."memory_records" ("id", "agent_id", "agent_role", "session_id", "tool_name", "project_name", "raw_text", "memory_type", "source_type", "intent")
|
|
632
702
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
633
703
|
ON CONFLICT ("id") DO NOTHING`,
|
|
634
704
|
crypto.randomUUID(),
|
|
@@ -642,7 +712,7 @@ var projectionHandlers = {
|
|
|
642
712
|
"shopify",
|
|
643
713
|
event.event_type
|
|
644
714
|
);
|
|
645
|
-
targets.push("
|
|
715
|
+
targets.push("graph");
|
|
646
716
|
return { targets };
|
|
647
717
|
},
|
|
648
718
|
async cloud_sync(event, prisma) {
|
|
@@ -650,7 +720,7 @@ var projectionHandlers = {
|
|
|
650
720
|
const payload = event.payload;
|
|
651
721
|
const memoryId = payload.id ?? crypto.randomUUID();
|
|
652
722
|
await prisma.$executeRawUnsafe(
|
|
653
|
-
`INSERT INTO "
|
|
723
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."memory_records" ("id", "agent_id", "agent_role", "session_id", "tool_name", "project_name", "raw_text", "memory_type", "source_type", "intent", "domain")
|
|
654
724
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
|
655
725
|
ON CONFLICT ("id") DO NOTHING`,
|
|
656
726
|
memoryId,
|
|
@@ -701,7 +771,7 @@ var projectionHandlers = {
|
|
|
701
771
|
const targets = [];
|
|
702
772
|
const payload = event.payload;
|
|
703
773
|
await prisma.$executeRawUnsafe(
|
|
704
|
-
`INSERT INTO "
|
|
774
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."memory_records" ("id", "agent_id", "agent_role", "session_id", "tool_name", "project_name", "raw_text", "memory_type", "source_type", "intent", "domain")
|
|
705
775
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
|
706
776
|
ON CONFLICT ("id") DO NOTHING`,
|
|
707
777
|
crypto.randomUUID(),
|
|
@@ -716,14 +786,14 @@ var projectionHandlers = {
|
|
|
716
786
|
event.event_type,
|
|
717
787
|
payload.domain ?? null
|
|
718
788
|
);
|
|
719
|
-
targets.push("
|
|
789
|
+
targets.push("graph");
|
|
720
790
|
return { targets };
|
|
721
791
|
}
|
|
722
792
|
};
|
|
723
793
|
var projectionHandlersForTests = projectionHandlers;
|
|
724
794
|
var defaultHandler = async (event, prisma) => {
|
|
725
795
|
await prisma.$executeRawUnsafe(
|
|
726
|
-
`INSERT INTO "
|
|
796
|
+
`INSERT INTO "${GRAPH_SCHEMA}"."memory_records" ("id", "agent_id", "agent_role", "session_id", "tool_name", "project_name", "raw_text", "memory_type", "source_type", "intent")
|
|
727
797
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
728
798
|
ON CONFLICT ("id") DO NOTHING`,
|
|
729
799
|
crypto.randomUUID(),
|
|
@@ -750,10 +820,15 @@ var pollTimer = null;
|
|
|
750
820
|
var consecutivePollErrors = 0;
|
|
751
821
|
async function processBatch() {
|
|
752
822
|
const prisma = await loadPrisma();
|
|
823
|
+
await ensureFilteredSchema(prisma);
|
|
753
824
|
const events = await prisma.$queryRawUnsafe(
|
|
754
825
|
`SELECT "id", "source", "source_id", "event_type", "payload", "metadata", "timestamp"
|
|
755
826
|
FROM "raw"."raw_events"
|
|
756
827
|
WHERE "processed_at" IS NULL
|
|
828
|
+
AND ("failed_at" IS NULL OR (
|
|
829
|
+
"retry_count" < 5
|
|
830
|
+
AND "failed_at" < NOW() - make_interval(secs => POWER(2, LEAST("retry_count", 8))::int)
|
|
831
|
+
))
|
|
757
832
|
ORDER BY "timestamp" ASC
|
|
758
833
|
LIMIT $1`,
|
|
759
834
|
BATCH_SIZE
|
|
@@ -768,7 +843,7 @@ async function processBatch() {
|
|
|
768
843
|
`UPDATE "raw"."raw_events"
|
|
769
844
|
SET "processed_at" = NOW(), "projections" = $1::jsonb
|
|
770
845
|
WHERE "id" = $2`,
|
|
771
|
-
JSON.stringify({ targets: result.targets, skipped: result.skipped }),
|
|
846
|
+
JSON.stringify({ targets: [...new Set(result.targets)], skipped: result.skipped }),
|
|
772
847
|
event.id
|
|
773
848
|
);
|
|
774
849
|
processed++;
|
|
@@ -780,8 +855,12 @@ async function processBatch() {
|
|
|
780
855
|
);
|
|
781
856
|
await prisma.$executeRawUnsafe(
|
|
782
857
|
`UPDATE "raw"."raw_events"
|
|
783
|
-
SET "
|
|
784
|
-
|
|
858
|
+
SET "failed_at" = NOW(),
|
|
859
|
+
"retry_count" = COALESCE("retry_count", 0) + 1,
|
|
860
|
+
"error" = $1,
|
|
861
|
+
"projections" = $2::jsonb
|
|
862
|
+
WHERE "id" = $3`,
|
|
863
|
+
message,
|
|
785
864
|
JSON.stringify({ error: message }),
|
|
786
865
|
event.id
|
|
787
866
|
);
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isExeSession,
|
|
3
3
|
strictSessionScopeFilter
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-5LDTCWYX.js";
|
|
5
|
+
import "./chunk-DU64OESH.js";
|
|
6
6
|
import "./chunk-5CHYEKMH.js";
|
|
7
7
|
import "./chunk-4JERP7NT.js";
|
|
8
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-J3YNCJ4A.js";
|
|
9
9
|
import "./chunk-MVW62NIZ.js";
|
|
10
10
|
import "./chunk-OYNKIAVW.js";
|
|
11
11
|
import "./chunk-CX6GL3ZJ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-VDCPKJUQ.js";
|
|
13
13
|
import "./chunk-XJUUWHVN.js";
|
|
14
14
|
import "./chunk-NGP6LSV2.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-L5VPUOB6.js";
|
|
16
16
|
import "./chunk-CVYC6DUW.js";
|
|
17
17
|
import "./chunk-OPU3NYOO.js";
|
|
18
18
|
import "./chunk-GJV3WDWM.js";
|
|
19
19
|
import "./chunk-MP2AFCGL.js";
|
|
20
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-ISL3NSVX.js";
|
|
21
21
|
import "./chunk-HYZV25LY.js";
|
|
22
22
|
import {
|
|
23
23
|
DEFAULT_COORDINATOR_TEMPLATE_NAME,
|
|
24
24
|
getCoordinatorName
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-WVBZ3QBR.js";
|
|
26
|
+
import "./chunk-WMZTSHNX.js";
|
|
27
27
|
import "./chunk-FXU7JOXK.js";
|
|
28
28
|
import "./chunk-MOZ2YQ54.js";
|
|
29
29
|
import "./chunk-VXIMSRTO.js";
|
|
@@ -102,7 +102,7 @@ function createRealDeps(getClient) {
|
|
|
102
102
|
return result.rows;
|
|
103
103
|
},
|
|
104
104
|
createReviewForOrphan: async (task) => {
|
|
105
|
-
const { createReviewForCompletedTask } = await import("./tasks-review-
|
|
105
|
+
const { createReviewForCompletedTask } = await import("./tasks-review-VMMMAK2Y.js");
|
|
106
106
|
const cwd = process.cwd();
|
|
107
107
|
await createReviewForCompletedTask(
|
|
108
108
|
task,
|
package/dist/runtime/index.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
SessionManager,
|
|
4
4
|
checkGitSafety,
|
|
5
5
|
targetsMainBranch
|
|
6
|
-
} from "../chunk-
|
|
6
|
+
} from "../chunk-QYNFWFFH.js";
|
|
7
7
|
import {
|
|
8
8
|
MultiAgentOrchestrator
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-PQQTSNXS.js";
|
|
10
10
|
import {
|
|
11
11
|
createQuietRenderer,
|
|
12
12
|
createTerminalRenderer,
|
|
@@ -56,19 +56,19 @@ import {
|
|
|
56
56
|
composeHooks,
|
|
57
57
|
createDefaultHooks
|
|
58
58
|
} from "../chunk-O377P7GM.js";
|
|
59
|
-
import "../chunk-
|
|
60
|
-
import "../chunk-
|
|
61
|
-
import "../chunk-
|
|
59
|
+
import "../chunk-PQHA6X6Y.js";
|
|
60
|
+
import "../chunk-5LDTCWYX.js";
|
|
61
|
+
import "../chunk-DU64OESH.js";
|
|
62
62
|
import "../chunk-5CHYEKMH.js";
|
|
63
63
|
import "../chunk-4JERP7NT.js";
|
|
64
|
-
import "../chunk-
|
|
64
|
+
import "../chunk-J3YNCJ4A.js";
|
|
65
65
|
import "../chunk-MVW62NIZ.js";
|
|
66
66
|
import "../chunk-OYNKIAVW.js";
|
|
67
67
|
import "../chunk-CX6GL3ZJ.js";
|
|
68
|
-
import "../chunk-
|
|
68
|
+
import "../chunk-VDCPKJUQ.js";
|
|
69
69
|
import "../chunk-XJUUWHVN.js";
|
|
70
70
|
import "../chunk-NGP6LSV2.js";
|
|
71
|
-
import "../chunk-
|
|
71
|
+
import "../chunk-L5VPUOB6.js";
|
|
72
72
|
import "../chunk-CVYC6DUW.js";
|
|
73
73
|
import "../chunk-OPU3NYOO.js";
|
|
74
74
|
import "../chunk-GJV3WDWM.js";
|
|
@@ -76,10 +76,10 @@ import {
|
|
|
76
76
|
StateBus,
|
|
77
77
|
orgBus
|
|
78
78
|
} from "../chunk-MP2AFCGL.js";
|
|
79
|
-
import "../chunk-
|
|
79
|
+
import "../chunk-ISL3NSVX.js";
|
|
80
80
|
import "../chunk-HYZV25LY.js";
|
|
81
|
-
import "../chunk-
|
|
82
|
-
import "../chunk-
|
|
81
|
+
import "../chunk-WVBZ3QBR.js";
|
|
82
|
+
import "../chunk-WMZTSHNX.js";
|
|
83
83
|
import "../chunk-FXU7JOXK.js";
|
|
84
84
|
import "../chunk-MOZ2YQ54.js";
|
|
85
85
|
import "../chunk-VXIMSRTO.js";
|
|
@@ -2,27 +2,27 @@ import {
|
|
|
2
2
|
ensureSessionEventsTable,
|
|
3
3
|
listRecentSessionEvents,
|
|
4
4
|
recordSessionEvent
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-COKTAJUZ.js";
|
|
6
|
+
import "./chunk-5LDTCWYX.js";
|
|
7
|
+
import "./chunk-DU64OESH.js";
|
|
8
8
|
import "./chunk-5CHYEKMH.js";
|
|
9
9
|
import "./chunk-4JERP7NT.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-J3YNCJ4A.js";
|
|
11
11
|
import "./chunk-MVW62NIZ.js";
|
|
12
12
|
import "./chunk-OYNKIAVW.js";
|
|
13
13
|
import "./chunk-CX6GL3ZJ.js";
|
|
14
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-VDCPKJUQ.js";
|
|
15
15
|
import "./chunk-XJUUWHVN.js";
|
|
16
16
|
import "./chunk-NGP6LSV2.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-L5VPUOB6.js";
|
|
18
18
|
import "./chunk-CVYC6DUW.js";
|
|
19
19
|
import "./chunk-OPU3NYOO.js";
|
|
20
20
|
import "./chunk-GJV3WDWM.js";
|
|
21
21
|
import "./chunk-MP2AFCGL.js";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-ISL3NSVX.js";
|
|
23
23
|
import "./chunk-HYZV25LY.js";
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-WVBZ3QBR.js";
|
|
25
|
+
import "./chunk-WMZTSHNX.js";
|
|
26
26
|
import "./chunk-FXU7JOXK.js";
|
|
27
27
|
import "./chunk-MOZ2YQ54.js";
|
|
28
28
|
import "./chunk-VXIMSRTO.js";
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
parseStreakState,
|
|
9
9
|
recordSessionKill,
|
|
10
10
|
sumTokensSavedSince
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-N27CTUFU.js";
|
|
12
|
+
import "./chunk-WVBZ3QBR.js";
|
|
13
|
+
import "./chunk-WMZTSHNX.js";
|
|
14
14
|
import "./chunk-FXU7JOXK.js";
|
|
15
15
|
import "./chunk-VXIMSRTO.js";
|
|
16
16
|
import "./chunk-LYH5HE24.js";
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveExeSession
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-5LDTCWYX.js";
|
|
4
|
+
import "./chunk-DU64OESH.js";
|
|
5
5
|
import "./chunk-5CHYEKMH.js";
|
|
6
6
|
import "./chunk-4JERP7NT.js";
|
|
7
7
|
import {
|
|
8
8
|
listSessions
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-J3YNCJ4A.js";
|
|
10
10
|
import "./chunk-MVW62NIZ.js";
|
|
11
11
|
import "./chunk-OYNKIAVW.js";
|
|
12
12
|
import "./chunk-CX6GL3ZJ.js";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-VDCPKJUQ.js";
|
|
14
14
|
import "./chunk-XJUUWHVN.js";
|
|
15
15
|
import "./chunk-NGP6LSV2.js";
|
|
16
|
-
import "./chunk-
|
|
16
|
+
import "./chunk-L5VPUOB6.js";
|
|
17
17
|
import "./chunk-CVYC6DUW.js";
|
|
18
18
|
import {
|
|
19
19
|
getProjectName
|
|
20
20
|
} from "./chunk-OPU3NYOO.js";
|
|
21
21
|
import "./chunk-GJV3WDWM.js";
|
|
22
22
|
import "./chunk-MP2AFCGL.js";
|
|
23
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-ISL3NSVX.js";
|
|
24
24
|
import "./chunk-HYZV25LY.js";
|
|
25
25
|
import {
|
|
26
26
|
isCoordinatorName
|
|
27
|
-
} from "./chunk-
|
|
28
|
-
import "./chunk-
|
|
27
|
+
} from "./chunk-WVBZ3QBR.js";
|
|
28
|
+
import "./chunk-WMZTSHNX.js";
|
|
29
29
|
import "./chunk-FXU7JOXK.js";
|
|
30
30
|
import "./chunk-MOZ2YQ54.js";
|
|
31
31
|
import "./chunk-VXIMSRTO.js";
|