@askexenow/exe-os 0.9.289 → 0.9.290
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/active-agent-L22OENGJ.js +26 -0
- package/dist/active-agent-SVG6F6HY.js +27 -0
- package/dist/agentic-ontology-3GHJHLDY.js +25 -0
- package/dist/backfill-metadata-HJNVBORD.js +599 -0
- package/dist/behaviors-ROOZS234.js +39 -0
- 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 +4 -4
- package/dist/bin/backfill-responses.js +4 -4
- package/dist/bin/backfill-vectors.js +98 -13
- package/dist/bin/bulk-sync-postgres.js +6 -6
- package/dist/bin/cc-doctor.js +4 -4
- package/dist/bin/cleanup-stale-review-tasks.js +9 -9
- package/dist/bin/cli.js +51 -15
- package/dist/bin/exe-agent-config.js +2 -2
- package/dist/bin/exe-agent.js +4 -4
- package/dist/bin/exe-assign.js +5 -5
- package/dist/bin/exe-boot.js +16 -16
- package/dist/bin/exe-call.js +4 -4
- package/dist/bin/exe-cloud.js +23 -5
- 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 +7 -7
- package/dist/bin/exe-healthcheck.js +4 -4
- 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 +10 -10
- package/dist/bin/exe-pending-notifications.js +9 -9
- package/dist/bin/exe-pending-reviews.js +9 -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-team.js +3 -3
- package/dist/bin/git-sweep.js +10 -10
- package/dist/bin/graph-backfill.js +4 -4
- package/dist/bin/graph-export.js +5 -5
- package/dist/bin/import-history.js +7 -7
- package/dist/bin/install.js +6 -6
- 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 +2 -2
- package/dist/bin/postgres-agentic-semantic-backfill.js +1 -1
- 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/capability-cards-O6XB2AU4.js +88 -0
- package/dist/capacity-monitor-ZE7CFVWH.js +50 -0
- package/dist/catchup-brief-3NONSIMA.js +174 -0
- package/dist/chunk-232DHK5C.js +1119 -0
- package/dist/chunk-272SJ4RN.js +129 -0
- package/dist/chunk-4NMTGHUE.js +127 -0
- package/dist/chunk-5PLW3QL6.js +668 -0
- package/dist/chunk-66EIYAF2.js +157 -0
- package/dist/chunk-6IPJF5QD.js +630 -0
- package/dist/chunk-6NSJTOXE.js +122 -0
- package/dist/chunk-6TLURATK.js +4318 -0
- package/dist/chunk-73JAJQRY.js +85 -0
- package/dist/chunk-7FTKXL5A.js +286 -0
- package/dist/chunk-7IRQSO3F.js +735 -0
- package/dist/chunk-7MINWZ3J.js +214 -0
- package/dist/chunk-7T5PS5DG.js +14439 -0
- package/dist/chunk-A74WXY4S.js +227 -0
- package/dist/chunk-AVD5C3NG.js +197 -0
- package/dist/chunk-B36MRLEP.js +58 -0
- package/dist/chunk-B4TCZ3PS.js +373 -0
- package/dist/chunk-BPLEJ3EU.js +411 -0
- package/dist/chunk-BTDPLFGK.js +221 -0
- package/dist/chunk-BU45UYTK.js +185 -0
- package/dist/chunk-CCAA6XOZ.js +284 -0
- package/dist/chunk-DBQ6I6K2.js +3276 -0
- package/dist/chunk-DDWFHEPG.js +345 -0
- package/dist/chunk-DSOKTUTT.js +167 -0
- package/dist/chunk-ETCARC76.js +836 -0
- package/dist/chunk-EZHTLPOS.js +280 -0
- package/dist/chunk-F3DQ3HDH.js +333 -0
- package/dist/chunk-F6ZCUDCN.js +244 -0
- package/dist/chunk-FI5Q6F5S.js +382 -0
- package/dist/chunk-FNQZGNSG.js +1094 -0
- package/dist/chunk-FVKTXXKK.js +128 -0
- package/dist/chunk-HHR5NB6N.js +377 -0
- package/dist/chunk-HRZLGHT6.js +290 -0
- package/dist/chunk-HSSRWMVA.js +68 -0
- package/dist/chunk-I3NVB5MG.js +85 -0
- package/dist/chunk-I7Z6MK2B.js +240 -0
- package/dist/chunk-ID4SMRYX.js +2078 -0
- package/dist/chunk-JXGHDROV.js +546 -0
- package/dist/chunk-KQY4QIEN.js +731 -0
- package/dist/chunk-LRSU2ZU2.js +38 -0
- package/dist/chunk-MFCL4GAN.js +2113 -0
- package/dist/chunk-MFGMVKGM.js +150 -0
- package/dist/chunk-NHGBVLCD.js +210 -0
- package/dist/chunk-NOEBJMNN.js +33 -0
- package/dist/chunk-NQ2VNTGL.js +538 -0
- package/dist/chunk-O4PZPM6H.js +204 -0
- package/dist/chunk-O5OW3YGQ.js +262 -0
- package/dist/chunk-OJQTONDJ.js +171 -0
- package/dist/chunk-OKZGUHE5.js +76 -0
- package/dist/chunk-OOH5M36Q.js +448 -0
- package/dist/chunk-P5ARTZP2.js +128 -0
- package/dist/chunk-PKRSYS7F.js +402 -0
- package/dist/chunk-PQWO5D3F.js +348 -0
- package/dist/chunk-Q6MJIJ2O.js +1352 -0
- package/dist/chunk-QKDRYZ2N.js +231 -0
- package/dist/chunk-RAV356E6.js +30 -0
- package/dist/chunk-RK7EAA53.js +1157 -0
- package/dist/chunk-RSLVAYWS.js +192 -0
- package/dist/chunk-SL6WJP2Q.js +123 -0
- package/dist/chunk-T57DOVGE.js +97 -0
- package/dist/chunk-TMCKL43Q.js +181 -0
- package/dist/chunk-TQZABASE.js +97 -0
- package/dist/chunk-UBWBEY6I.js +81 -0
- package/dist/chunk-UP7DNYG7.js +456 -0
- package/dist/chunk-V5MGYIZS.js +70 -0
- package/dist/chunk-XCPVYQVK.js +336 -0
- package/dist/chunk-XWVBLZRP.js +50 -0
- package/dist/chunk-YBTN5F2U.js +1068 -0
- package/dist/chunk-Z772TGD2.js +54 -0
- package/dist/chunk-ZAMPIXLH.js +1350 -0
- package/dist/chunk-ZYEOHGU5.js +362 -0
- package/dist/co-activation-WJTFJOTK.js +73 -0
- package/dist/co-occurrence-KFP6ZS7G.js +94 -0
- package/dist/core-memory-DBZJ72TV.js +110 -0
- package/dist/crdt-sync-6DVGRMTV.js +33 -0
- package/dist/crm-webhook-55T4Z6XJ.js +10 -0
- package/dist/cto-delegation-gate-SPM6LAL2.js +279 -0
- package/dist/daemon-orchestration-XZLWWIV4.js +138 -0
- package/dist/db-backup-JHCI47JQ.js +37 -0
- package/dist/doc-graph-extractor-4X23NP4I.js +132 -0
- package/dist/dreaming-TFZDGA72.js +33 -0
- package/dist/exe-drift-TEM7ELNY.js +69 -0
- package/dist/exe-export-CRCA4T4S.js +75 -0
- package/dist/exe-import-UZMMWNHJ.js +78 -0
- package/dist/exe-key-NQQXEDUA.js +672 -0
- package/dist/exe-snapshot-P7PUAJTV.js +337 -0
- package/dist/fast-db-init-G63PRINQ.js +7 -0
- package/dist/gateway/index.js +8 -8
- package/dist/git-staleness-42TTCFDP.js +111 -0
- package/dist/git-task-sweep-4LW5RYYO.js +41 -0
- package/dist/global-procedures-BVFRWJAV.js +21 -0
- package/dist/graph-auto-extract-4ZA7UC6C.js +182 -0
- 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.js +6 -6
- package/dist/hooks/instructions-loaded.js +4 -4
- package/dist/hooks/manifest.json +19 -19
- package/dist/hooks/notification.js +4 -4
- package/dist/hooks/post-compact.js +10 -10
- package/dist/hooks/post-tool-combined.js +5 -5
- package/dist/hooks/pre-compact.js +11 -11
- package/dist/hooks/pre-tool-use.js +14 -14
- package/dist/hooks/prompt-submit.js +21 -21
- package/dist/hooks/session-end.js +15 -15
- package/dist/hooks/session-start.js +12 -12
- package/dist/hooks/stop.js +14 -14
- package/dist/hooks/subagent-stop.js +10 -10
- package/dist/hooks/summary-worker.js +14 -14
- package/dist/index.js +17 -17
- package/dist/installer-CBGRTGIF.js +297 -0
- package/dist/installer-DGU4WZKJ.js +39 -0
- package/dist/installer-WTWEOSEK.js +343 -0
- package/dist/lib/cloud-sync.js +4 -4
- package/dist/lib/consolidation.js +7 -5
- package/dist/lib/database.js +2 -2
- package/dist/lib/db.js +2 -2
- package/dist/lib/employee-templates.js +4 -4
- package/dist/lib/employees.js +2 -2
- package/dist/lib/exe-daemon.js +64 -43
- 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 +6 -6
- 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/license-gate-OSPA2OD7.js +16 -0
- package/dist/mcp/register-tools.js +55 -55
- package/dist/mcp/server.js +117 -73
- 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 +7 -7
- 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-OGFPLJYH.js +28 -0
- package/dist/memory-cards-GJ3VHKAM.js +179 -0
- package/dist/memory-graph-extractor-TCTCM7PZ.js +21 -0
- package/dist/memory-poisoning-defense-FVLGA35X.js +223 -0
- package/dist/memory-reflection-BYJFIFSV.js +243 -0
- package/dist/notifications-AQKZFSR3.js +46 -0
- package/dist/orchestration-events-RDSYLFXZ.js +26 -0
- package/dist/orchestrator-2JTJQLPG.js +34 -0
- package/dist/pipeline-router-HBSTKHG5.js +14 -0
- package/dist/plan-limits-GQENSNTG.js +27 -0
- package/dist/project-boot-W2LTP7WW.js +299 -0
- package/dist/projection-worker-ZMT5KNJJ.js +1084 -0
- package/dist/prospective-memory-LANRNOJX.js +231 -0
- package/dist/reranker-QGJO6EHO.js +19 -0
- package/dist/retrieval-health-JE66LJ3I.js +11 -0
- package/dist/review-polling-IXJ57M6Q.js +125 -0
- package/dist/runtime/index.js +11 -11
- package/dist/session-events-XKG66APL.js +37 -0
- package/dist/session-kill-telemetry-VTU7YBII.js +30 -0
- package/dist/session-scope-TQZONLZL.js +87 -0
- package/dist/setup-wizard-PXK6SC2D.js +12 -0
- package/dist/skill-refinement-Y6LLKYRL.js +158 -0
- package/dist/steward-gate-QV2APBFB.js +14 -0
- package/dist/task-enforcement-GLDD2W5D.js +505 -0
- package/dist/task-scope-HMPIP6XB.js +36 -0
- package/dist/tasks-crud-FH2SFCNQ.js +78 -0
- package/dist/tasks-notify-3ZW2GLCS.js +39 -0
- package/dist/tasks-review-XERV6KZD.js +48 -0
- package/dist/telemetry-upload-R77W7I7G.js +740 -0
- package/dist/token-budget-NA4WQAY6.js +85 -0
- package/dist/tool-telemetry-D4Q76LAS.js +17 -0
- package/dist/tui/App.js +16 -16
- package/dist/tui-data-NJSEIA2Q.js +259 -0
- package/dist/wiki-acl-RE5IR5VV.js +111 -0
- package/dist/worker-gate-VN2POPFL.js +21 -0
- package/dist/workflow-engine-D7ALMSDM.js +28 -0
- package/dist/worktree-6I45JV5N.js +27 -0
- package/dist/worktree-sweep-IMDR3XHT.js +20 -0
- package/package.json +1 -1
- package/release-notes.json +88 -88
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerListTasks
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-6NSJTOXE.js";
|
|
4
|
+
import "../../chunk-OOH5M36Q.js";
|
|
5
|
+
import "../../chunk-F6ZCUDCN.js";
|
|
6
|
+
import "../../chunk-BU45UYTK.js";
|
|
7
|
+
import "../../chunk-6TLURATK.js";
|
|
8
|
+
import "../../chunk-EZHTLPOS.js";
|
|
9
9
|
import "../../chunk-4JERP7NT.js";
|
|
10
10
|
import "../../chunk-4FVVJ7ME.js";
|
|
11
|
-
import "../../chunk-
|
|
11
|
+
import "../../chunk-QKDRYZ2N.js";
|
|
12
12
|
import "../../chunk-MVW62NIZ.js";
|
|
13
13
|
import "../../chunk-OYNKIAVW.js";
|
|
14
14
|
import "../../chunk-SSTLTIF3.js";
|
|
15
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-6IPJF5QD.js";
|
|
16
16
|
import "../../chunk-RJY45A5J.js";
|
|
17
17
|
import "../../chunk-NGP6LSV2.js";
|
|
18
|
-
import "../../chunk-
|
|
18
|
+
import "../../chunk-272SJ4RN.js";
|
|
19
19
|
import "../../chunk-CVYC6DUW.js";
|
|
20
20
|
import "../../chunk-OPU3NYOO.js";
|
|
21
21
|
import "../../chunk-GJV3WDWM.js";
|
|
22
22
|
import "../../chunk-MP2AFCGL.js";
|
|
23
|
-
import "../../chunk-
|
|
23
|
+
import "../../chunk-V5MGYIZS.js";
|
|
24
24
|
import "../../chunk-HYZV25LY.js";
|
|
25
|
-
import "../../chunk-
|
|
25
|
+
import "../../chunk-DBQ6I6K2.js";
|
|
26
26
|
import "../../chunk-2I23RPSI.js";
|
|
27
|
-
import "../../chunk-
|
|
27
|
+
import "../../chunk-XCPVYQVK.js";
|
|
28
28
|
import "../../chunk-PNQDP3OA.js";
|
|
29
29
|
import "../../chunk-FXU7JOXK.js";
|
|
30
30
|
import "../../chunk-SYOGNG2R.js";
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerSendMessage
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-XWVBLZRP.js";
|
|
4
|
+
import "../../chunk-DDWFHEPG.js";
|
|
5
|
+
import "../../chunk-BU45UYTK.js";
|
|
6
|
+
import "../../chunk-6TLURATK.js";
|
|
7
|
+
import "../../chunk-EZHTLPOS.js";
|
|
8
8
|
import "../../chunk-4JERP7NT.js";
|
|
9
9
|
import "../../chunk-4FVVJ7ME.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-QKDRYZ2N.js";
|
|
11
11
|
import "../../chunk-MVW62NIZ.js";
|
|
12
12
|
import "../../chunk-OYNKIAVW.js";
|
|
13
13
|
import "../../chunk-SSTLTIF3.js";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-6IPJF5QD.js";
|
|
15
15
|
import "../../chunk-RJY45A5J.js";
|
|
16
16
|
import "../../chunk-NGP6LSV2.js";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-272SJ4RN.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-V5MGYIZS.js";
|
|
23
23
|
import "../../chunk-HYZV25LY.js";
|
|
24
|
-
import "../../chunk-
|
|
24
|
+
import "../../chunk-DBQ6I6K2.js";
|
|
25
25
|
import "../../chunk-2I23RPSI.js";
|
|
26
|
-
import "../../chunk-
|
|
26
|
+
import "../../chunk-XCPVYQVK.js";
|
|
27
27
|
import "../../chunk-PNQDP3OA.js";
|
|
28
28
|
import "../../chunk-FXU7JOXK.js";
|
|
29
29
|
import "../../chunk-SYOGNG2R.js";
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registerUpdateTask
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-4NMTGHUE.js";
|
|
4
|
+
import "../../chunk-OOH5M36Q.js";
|
|
5
|
+
import "../../chunk-F6ZCUDCN.js";
|
|
6
|
+
import "../../chunk-6TLURATK.js";
|
|
7
|
+
import "../../chunk-EZHTLPOS.js";
|
|
8
8
|
import "../../chunk-4JERP7NT.js";
|
|
9
9
|
import "../../chunk-4FVVJ7ME.js";
|
|
10
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-QKDRYZ2N.js";
|
|
11
11
|
import "../../chunk-MVW62NIZ.js";
|
|
12
12
|
import "../../chunk-OYNKIAVW.js";
|
|
13
13
|
import "../../chunk-SSTLTIF3.js";
|
|
14
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-6IPJF5QD.js";
|
|
15
15
|
import "../../chunk-RJY45A5J.js";
|
|
16
16
|
import "../../chunk-NGP6LSV2.js";
|
|
17
|
-
import "../../chunk-
|
|
17
|
+
import "../../chunk-272SJ4RN.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-V5MGYIZS.js";
|
|
23
23
|
import "../../chunk-HYZV25LY.js";
|
|
24
|
-
import "../../chunk-
|
|
24
|
+
import "../../chunk-DBQ6I6K2.js";
|
|
25
25
|
import "../../chunk-2I23RPSI.js";
|
|
26
|
-
import "../../chunk-
|
|
26
|
+
import "../../chunk-XCPVYQVK.js";
|
|
27
27
|
import "../../chunk-PNQDP3OA.js";
|
|
28
28
|
import "../../chunk-FXU7JOXK.js";
|
|
29
29
|
import "../../chunk-SYOGNG2R.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_MCP_HTTP_AGENT_ID,
|
|
3
|
+
DEFAULT_MCP_HTTP_AGENT_ROLE,
|
|
4
|
+
DEFAULT_MCP_HTTP_PORT,
|
|
5
|
+
buildClaudeHttpMcpEntry,
|
|
6
|
+
buildMcpHttpHeaders,
|
|
7
|
+
mcpHttpPort,
|
|
8
|
+
mcpHttpUrl,
|
|
9
|
+
readOrCreateDaemonToken
|
|
10
|
+
} from "./chunk-TQZABASE.js";
|
|
11
|
+
import "./chunk-DBQ6I6K2.js";
|
|
12
|
+
import "./chunk-2I23RPSI.js";
|
|
13
|
+
import "./chunk-XCPVYQVK.js";
|
|
14
|
+
import "./chunk-PNQDP3OA.js";
|
|
15
|
+
import "./chunk-FXU7JOXK.js";
|
|
16
|
+
import "./chunk-5P3HOBZX.js";
|
|
17
|
+
import "./chunk-LYH5HE24.js";
|
|
18
|
+
import "./chunk-MLKGABMK.js";
|
|
19
|
+
export {
|
|
20
|
+
DEFAULT_MCP_HTTP_AGENT_ID,
|
|
21
|
+
DEFAULT_MCP_HTTP_AGENT_ROLE,
|
|
22
|
+
DEFAULT_MCP_HTTP_PORT,
|
|
23
|
+
buildClaudeHttpMcpEntry,
|
|
24
|
+
buildMcpHttpHeaders,
|
|
25
|
+
mcpHttpPort,
|
|
26
|
+
mcpHttpUrl,
|
|
27
|
+
readOrCreateDaemonToken
|
|
28
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildFtsMatch,
|
|
3
|
+
tokenizeForFts
|
|
4
|
+
} from "./chunk-AB4PAQYK.js";
|
|
5
|
+
import {
|
|
6
|
+
getClient
|
|
7
|
+
} from "./chunk-DBQ6I6K2.js";
|
|
8
|
+
import "./chunk-2I23RPSI.js";
|
|
9
|
+
import "./chunk-XCPVYQVK.js";
|
|
10
|
+
import "./chunk-PNQDP3OA.js";
|
|
11
|
+
import "./chunk-FXU7JOXK.js";
|
|
12
|
+
import "./chunk-5P3HOBZX.js";
|
|
13
|
+
import "./chunk-LYH5HE24.js";
|
|
14
|
+
import "./chunk-MLKGABMK.js";
|
|
15
|
+
|
|
16
|
+
// src/lib/memory-cards.ts
|
|
17
|
+
import { createHash } from "crypto";
|
|
18
|
+
var MAX_CARDS_PER_MEMORY = 8;
|
|
19
|
+
var MAX_SEGMENT_CHARS = 500;
|
|
20
|
+
var MIN_SEGMENT_CHARS = 20;
|
|
21
|
+
function stableId(memoryId, type, content) {
|
|
22
|
+
return createHash("sha256").update(`${memoryId}:${type}:${content}`).digest("hex").slice(0, 32);
|
|
23
|
+
}
|
|
24
|
+
function cleanText(text) {
|
|
25
|
+
let cleaned = text.replace(
|
|
26
|
+
/```(\w*)\n(.*?)(?:\n[\s\S]*?)```/g,
|
|
27
|
+
(_m, lang, firstLine) => `[code${lang ? `:${lang}` : ""}] ${firstLine.trim()}`
|
|
28
|
+
);
|
|
29
|
+
cleaned = cleaned.replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim();
|
|
30
|
+
return cleaned;
|
|
31
|
+
}
|
|
32
|
+
function splitSegments(text) {
|
|
33
|
+
const cleaned = cleanText(text);
|
|
34
|
+
const segments = cleaned.split(/(?<=[.!?:;])\s+|\n{2,}|(?<=\))\s+(?=[A-Z])|\s*[|│]\s*/).map((s) => s.trim()).filter((s) => s.length >= MIN_SEGMENT_CHARS && s.length <= MAX_SEGMENT_CHARS);
|
|
35
|
+
if (segments.length === 0 && cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
36
|
+
const lines = cleaned.split(/\n+/).map((l) => l.trim()).filter((l) => l.length >= MIN_SEGMENT_CHARS && l.length <= MAX_SEGMENT_CHARS);
|
|
37
|
+
if (lines.length > 0) return lines;
|
|
38
|
+
if (cleaned.length >= MIN_SEGMENT_CHARS) {
|
|
39
|
+
return [cleaned.slice(0, MAX_SEGMENT_CHARS)];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return segments;
|
|
43
|
+
}
|
|
44
|
+
function inferCardType(sentence, toolName) {
|
|
45
|
+
const lower = sentence.toLowerCase();
|
|
46
|
+
if (toolName === "store_decision" || /\b(decided|decision|adr|approved|rejected)\b/.test(lower)) return "decision";
|
|
47
|
+
if (/\b(prefers|preference|likes|dislikes|wants|doesn't want|does not want)\b/.test(lower)) return "preference";
|
|
48
|
+
if (/\b(changed|updated|replaced|now|no longer|instead|supersedes)\b/.test(lower)) return "belief_update";
|
|
49
|
+
if (toolName && ["Read", "Write", "Edit", "Bash"].includes(toolName)) return "code";
|
|
50
|
+
if (/\b(meeting|deadline|shipped|launched|completed|failed|blocked|assigned|created)\b/.test(lower)) return "event";
|
|
51
|
+
return "fact";
|
|
52
|
+
}
|
|
53
|
+
function extractSubject(sentence, agentId) {
|
|
54
|
+
const explicit = sentence.match(/\b([A-Z][a-zA-Z0-9_-]{2,}(?:\s+[A-Z][a-zA-Z0-9_-]{2,})?)\b/);
|
|
55
|
+
return explicit?.[1] ?? agentId;
|
|
56
|
+
}
|
|
57
|
+
function predicateFor(type) {
|
|
58
|
+
switch (type) {
|
|
59
|
+
case "preference":
|
|
60
|
+
return "prefers";
|
|
61
|
+
case "belief_update":
|
|
62
|
+
return "updated";
|
|
63
|
+
case "decision":
|
|
64
|
+
return "decided";
|
|
65
|
+
case "event":
|
|
66
|
+
return "happened";
|
|
67
|
+
case "code":
|
|
68
|
+
return "implemented";
|
|
69
|
+
default:
|
|
70
|
+
return "states";
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function extractMemoryCards(row) {
|
|
74
|
+
const segments = splitSegments(row.raw_text);
|
|
75
|
+
const cards = [];
|
|
76
|
+
for (const sentence of segments) {
|
|
77
|
+
const type = inferCardType(sentence, row.tool_name);
|
|
78
|
+
const subject = extractSubject(sentence, row.agent_id);
|
|
79
|
+
const content = sentence.length > MAX_SEGMENT_CHARS ? `${sentence.slice(0, MAX_SEGMENT_CHARS - 1)}\u2026` : sentence;
|
|
80
|
+
cards.push({
|
|
81
|
+
id: stableId(row.id, type, content),
|
|
82
|
+
memory_id: row.id,
|
|
83
|
+
agent_id: row.agent_id,
|
|
84
|
+
session_id: row.session_id,
|
|
85
|
+
project_name: row.project_name ?? null,
|
|
86
|
+
timestamp: row.timestamp,
|
|
87
|
+
card_type: type,
|
|
88
|
+
subject,
|
|
89
|
+
predicate: predicateFor(type),
|
|
90
|
+
object: content,
|
|
91
|
+
content,
|
|
92
|
+
source_ref: row.id,
|
|
93
|
+
confidence: type === "fact" ? 0.55 : 0.65
|
|
94
|
+
});
|
|
95
|
+
if (cards.length >= MAX_CARDS_PER_MEMORY) break;
|
|
96
|
+
}
|
|
97
|
+
return cards;
|
|
98
|
+
}
|
|
99
|
+
async function insertMemoryCardsForBatch(rows) {
|
|
100
|
+
const cards = rows.flatMap(extractMemoryCards);
|
|
101
|
+
if (cards.length === 0) return 0;
|
|
102
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
103
|
+
const client = getClient();
|
|
104
|
+
const stmts = cards.map((card) => ({
|
|
105
|
+
sql: `INSERT OR IGNORE INTO memory_cards
|
|
106
|
+
(id, memory_id, agent_id, session_id, project_name, timestamp, card_type,
|
|
107
|
+
subject, predicate, object, content, source_ref, confidence, active, created_at)
|
|
108
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?)`,
|
|
109
|
+
args: [
|
|
110
|
+
card.id,
|
|
111
|
+
card.memory_id,
|
|
112
|
+
card.agent_id,
|
|
113
|
+
card.session_id,
|
|
114
|
+
card.project_name,
|
|
115
|
+
card.timestamp,
|
|
116
|
+
card.card_type,
|
|
117
|
+
card.subject,
|
|
118
|
+
card.predicate,
|
|
119
|
+
card.object,
|
|
120
|
+
card.content,
|
|
121
|
+
card.source_ref,
|
|
122
|
+
card.confidence,
|
|
123
|
+
now
|
|
124
|
+
]
|
|
125
|
+
}));
|
|
126
|
+
await client.batch(stmts, "write");
|
|
127
|
+
return cards.length;
|
|
128
|
+
}
|
|
129
|
+
function buildMatchExpr(queryText) {
|
|
130
|
+
const terms = tokenizeForFts(queryText, { maxTerms: 12 });
|
|
131
|
+
if (terms.length === 0) return null;
|
|
132
|
+
return buildFtsMatch(terms, { prefix: true, join: terms.length >= 3 ? "AND" : "OR" });
|
|
133
|
+
}
|
|
134
|
+
async function searchMemoryCards(queryText, agentId, options) {
|
|
135
|
+
const limit = options?.limit ?? 10;
|
|
136
|
+
const matchExpr = buildMatchExpr(queryText);
|
|
137
|
+
if (!matchExpr) return [];
|
|
138
|
+
let sql = `SELECT c.id, c.memory_id, c.agent_id, c.session_id, c.project_name,
|
|
139
|
+
c.timestamp, c.card_type, c.content, c.source_ref, c.confidence
|
|
140
|
+
FROM memory_cards c
|
|
141
|
+
JOIN memory_cards_fts fts ON c.rowid = fts.rowid
|
|
142
|
+
WHERE memory_cards_fts MATCH ?
|
|
143
|
+
AND c.agent_id = ?
|
|
144
|
+
AND COALESCE(c.active, 1) = 1`;
|
|
145
|
+
const args = [matchExpr, agentId];
|
|
146
|
+
if (options?.projectName) {
|
|
147
|
+
sql += ` AND c.project_name = ?`;
|
|
148
|
+
args.push(options.projectName);
|
|
149
|
+
}
|
|
150
|
+
if (options?.since) {
|
|
151
|
+
sql += ` AND c.timestamp >= ?`;
|
|
152
|
+
args.push(options.since);
|
|
153
|
+
}
|
|
154
|
+
sql += ` ORDER BY rank LIMIT ?`;
|
|
155
|
+
args.push(limit);
|
|
156
|
+
const result = await getClient().execute({ sql, args });
|
|
157
|
+
return result.rows.map((row) => ({
|
|
158
|
+
id: `card:${String(row.id)}`,
|
|
159
|
+
agent_id: String(row.agent_id),
|
|
160
|
+
agent_role: "memory_card",
|
|
161
|
+
session_id: String(row.session_id),
|
|
162
|
+
timestamp: String(row.timestamp),
|
|
163
|
+
tool_name: `memory_card:${String(row.card_type)}`,
|
|
164
|
+
project_name: row.project_name == null ? "" : String(row.project_name),
|
|
165
|
+
has_error: false,
|
|
166
|
+
raw_text: `[${String(row.card_type)}] ${String(row.content)}
|
|
167
|
+
Source memory: ${String(row.source_ref ?? row.memory_id)}`,
|
|
168
|
+
vector: [],
|
|
169
|
+
importance: 6,
|
|
170
|
+
status: "active",
|
|
171
|
+
confidence: Number(row.confidence ?? 0.6),
|
|
172
|
+
last_accessed: String(row.timestamp)
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
export {
|
|
176
|
+
extractMemoryCards,
|
|
177
|
+
insertMemoryCardsForBatch,
|
|
178
|
+
searchMemoryCards
|
|
179
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extractGraphForBatch,
|
|
3
|
+
extractMemoryGraph,
|
|
4
|
+
upsertMemoryGraph
|
|
5
|
+
} from "./chunk-PKRSYS7F.js";
|
|
6
|
+
import "./chunk-KBNMVPDE.js";
|
|
7
|
+
import "./chunk-GUMRIUI5.js";
|
|
8
|
+
import "./chunk-I7AW4237.js";
|
|
9
|
+
import "./chunk-DBQ6I6K2.js";
|
|
10
|
+
import "./chunk-2I23RPSI.js";
|
|
11
|
+
import "./chunk-XCPVYQVK.js";
|
|
12
|
+
import "./chunk-PNQDP3OA.js";
|
|
13
|
+
import "./chunk-FXU7JOXK.js";
|
|
14
|
+
import "./chunk-5P3HOBZX.js";
|
|
15
|
+
import "./chunk-LYH5HE24.js";
|
|
16
|
+
import "./chunk-MLKGABMK.js";
|
|
17
|
+
export {
|
|
18
|
+
extractGraphForBatch,
|
|
19
|
+
extractMemoryGraph,
|
|
20
|
+
upsertMemoryGraph
|
|
21
|
+
};
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import {
|
|
2
|
+
blobToVector
|
|
3
|
+
} from "./chunk-OTVEIJUQ.js";
|
|
4
|
+
import {
|
|
5
|
+
getClient
|
|
6
|
+
} from "./chunk-DBQ6I6K2.js";
|
|
7
|
+
import "./chunk-2I23RPSI.js";
|
|
8
|
+
import "./chunk-XCPVYQVK.js";
|
|
9
|
+
import "./chunk-PNQDP3OA.js";
|
|
10
|
+
import "./chunk-FXU7JOXK.js";
|
|
11
|
+
import {
|
|
12
|
+
loadConfig
|
|
13
|
+
} from "./chunk-5P3HOBZX.js";
|
|
14
|
+
import "./chunk-LYH5HE24.js";
|
|
15
|
+
import "./chunk-MLKGABMK.js";
|
|
16
|
+
|
|
17
|
+
// src/lib/memory-poisoning-defense.ts
|
|
18
|
+
var SYSTEM_TOOLS = /* @__PURE__ */ new Set([
|
|
19
|
+
"session-start",
|
|
20
|
+
"ingest",
|
|
21
|
+
"ingest-worker",
|
|
22
|
+
"consolidation",
|
|
23
|
+
"skill-learning",
|
|
24
|
+
"summary-worker",
|
|
25
|
+
"bug-report-worker",
|
|
26
|
+
"reflection",
|
|
27
|
+
"dreaming-engine",
|
|
28
|
+
"daemon"
|
|
29
|
+
]);
|
|
30
|
+
function computeTrustLevel(toolName, agentId) {
|
|
31
|
+
if (SYSTEM_TOOLS.has(toolName)) return "system";
|
|
32
|
+
if (agentId && (toolName.startsWith("mcp__exe") || toolName === "manual" || toolName === "store_memory")) {
|
|
33
|
+
return "agent";
|
|
34
|
+
}
|
|
35
|
+
if (toolName.includes("webhook") || toolName.includes("pipeline") || toolName.includes("ingest_raw")) {
|
|
36
|
+
return "external";
|
|
37
|
+
}
|
|
38
|
+
return "unknown";
|
|
39
|
+
}
|
|
40
|
+
function cosineDistance(a, b) {
|
|
41
|
+
if (a.length !== b.length || a.length === 0) return 1;
|
|
42
|
+
let dotProduct = 0;
|
|
43
|
+
let normA = 0;
|
|
44
|
+
let normB = 0;
|
|
45
|
+
for (let i = 0; i < a.length; i++) {
|
|
46
|
+
dotProduct += a[i] * b[i];
|
|
47
|
+
normA += a[i] * a[i];
|
|
48
|
+
normB += b[i] * b[i];
|
|
49
|
+
}
|
|
50
|
+
const denom = Math.sqrt(normA) * Math.sqrt(normB);
|
|
51
|
+
if (denom === 0) return 1;
|
|
52
|
+
const similarity = dotProduct / denom;
|
|
53
|
+
return 1 - similarity;
|
|
54
|
+
}
|
|
55
|
+
async function getAgentCentroid(agentId, projectName) {
|
|
56
|
+
const client = getClient();
|
|
57
|
+
try {
|
|
58
|
+
const result = await client.execute({
|
|
59
|
+
sql: `SELECT centroid_vector FROM agent_centroids WHERE agent_id = ? AND project_name = ?`,
|
|
60
|
+
args: [agentId, projectName]
|
|
61
|
+
});
|
|
62
|
+
if (result.rows.length === 0 || !result.rows[0].centroid_vector) return null;
|
|
63
|
+
const vector = blobToVector(result.rows[0].centroid_vector);
|
|
64
|
+
return vector.length > 0 ? vector : null;
|
|
65
|
+
} catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function checkAnomaly(vector, agentId, projectName, threshold) {
|
|
70
|
+
const centroid = await getAgentCentroid(agentId, projectName);
|
|
71
|
+
if (!centroid) return { anomalous: false, distance: 0 };
|
|
72
|
+
const distance = cosineDistance(vector, centroid);
|
|
73
|
+
const effectiveThreshold = threshold ?? 0.85;
|
|
74
|
+
return { anomalous: distance > effectiveThreshold, distance };
|
|
75
|
+
}
|
|
76
|
+
async function refreshAgentCentroid(agentId, projectName, sampleSize = 100) {
|
|
77
|
+
const client = getClient();
|
|
78
|
+
const result = await client.execute({
|
|
79
|
+
sql: `SELECT vector FROM memories
|
|
80
|
+
WHERE agent_id = ? AND project_name = ? AND vector IS NOT NULL
|
|
81
|
+
AND status = 'active' AND quarantined = 0
|
|
82
|
+
ORDER BY timestamp DESC LIMIT ?`,
|
|
83
|
+
args: [agentId, projectName, sampleSize]
|
|
84
|
+
});
|
|
85
|
+
if (result.rows.length < 5) return;
|
|
86
|
+
let dim = 0;
|
|
87
|
+
const vectors = [];
|
|
88
|
+
for (const row of result.rows) {
|
|
89
|
+
const arr = blobToVector(row.vector);
|
|
90
|
+
if (arr.length > 0 && (dim === 0 || arr.length === dim)) {
|
|
91
|
+
dim = arr.length;
|
|
92
|
+
vectors.push(arr);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (vectors.length < 5 || dim === 0) return;
|
|
96
|
+
const centroid = new Float32Array(dim);
|
|
97
|
+
for (const v of vectors) {
|
|
98
|
+
for (let i = 0; i < dim; i++) {
|
|
99
|
+
centroid[i] += v[i] / vectors.length;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const centroidBlob = Buffer.from(centroid.buffer);
|
|
103
|
+
await client.execute({
|
|
104
|
+
sql: `INSERT OR REPLACE INTO agent_centroids (agent_id, project_name, centroid_vector, sample_count, updated_at)
|
|
105
|
+
VALUES (?, ?, ?, ?, ?)`,
|
|
106
|
+
args: [agentId, projectName, centroidBlob, vectors.length, (/* @__PURE__ */ new Date()).toISOString()]
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async function quarantineMemory(memoryId, reason) {
|
|
110
|
+
const client = getClient();
|
|
111
|
+
await client.execute({
|
|
112
|
+
sql: `UPDATE memories SET quarantined = 1, quarantine_reason = ? WHERE id = ?`,
|
|
113
|
+
args: [reason, memoryId]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async function approveQuarantined(memoryId) {
|
|
117
|
+
const client = getClient();
|
|
118
|
+
await client.execute({
|
|
119
|
+
sql: `UPDATE memories SET quarantined = 0, quarantine_reason = NULL WHERE id = ?`,
|
|
120
|
+
args: [memoryId]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async function rejectQuarantined(memoryId) {
|
|
124
|
+
const client = getClient();
|
|
125
|
+
await client.execute({
|
|
126
|
+
sql: `UPDATE memories SET status = 'archived', quarantine_reason = COALESCE(quarantine_reason, '') || ' [REJECTED]' WHERE id = ?`,
|
|
127
|
+
args: [memoryId]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
async function listQuarantined(limit = 20) {
|
|
131
|
+
const client = getClient();
|
|
132
|
+
const result = await client.execute({
|
|
133
|
+
sql: `SELECT id, agent_id, raw_text, quarantine_reason, timestamp
|
|
134
|
+
FROM memories
|
|
135
|
+
WHERE quarantined = 1 AND status = 'active'
|
|
136
|
+
ORDER BY timestamp DESC LIMIT ?`,
|
|
137
|
+
args: [limit]
|
|
138
|
+
});
|
|
139
|
+
return result.rows.map((r) => ({
|
|
140
|
+
id: String(r.id),
|
|
141
|
+
agentId: String(r.agent_id),
|
|
142
|
+
rawText: String(r.raw_text).slice(0, 200),
|
|
143
|
+
reason: String(r.quarantine_reason ?? "unknown"),
|
|
144
|
+
createdAt: String(r.timestamp)
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
var _writeCounters = /* @__PURE__ */ new Map();
|
|
148
|
+
var _sessionCounters = /* @__PURE__ */ new Map();
|
|
149
|
+
function checkRateLimit(agentId, sessionId, limits) {
|
|
150
|
+
const perMinute = limits?.perMinute ?? 50;
|
|
151
|
+
const perSession = limits?.perSession ?? 5e3;
|
|
152
|
+
const now = Date.now();
|
|
153
|
+
const minuteKey = `${agentId}:minute`;
|
|
154
|
+
const minuteCounter = _writeCounters.get(minuteKey);
|
|
155
|
+
if (minuteCounter && now - minuteCounter.windowStart < 6e4) {
|
|
156
|
+
if (minuteCounter.count >= perMinute) {
|
|
157
|
+
return { allowed: false, reason: `Rate limit: ${perMinute}/minute exceeded for ${agentId}` };
|
|
158
|
+
}
|
|
159
|
+
minuteCounter.count++;
|
|
160
|
+
} else {
|
|
161
|
+
_writeCounters.set(minuteKey, { count: 1, windowStart: now });
|
|
162
|
+
}
|
|
163
|
+
const sessionCount = (_sessionCounters.get(sessionId) ?? 0) + 1;
|
|
164
|
+
_sessionCounters.set(sessionId, sessionCount);
|
|
165
|
+
if (sessionCount > perSession) {
|
|
166
|
+
return { allowed: false, reason: `Session limit: ${perSession} memories exceeded for session ${sessionId}` };
|
|
167
|
+
}
|
|
168
|
+
return { allowed: true };
|
|
169
|
+
}
|
|
170
|
+
function resetRateLimits() {
|
|
171
|
+
_writeCounters.clear();
|
|
172
|
+
_sessionCounters.clear();
|
|
173
|
+
}
|
|
174
|
+
async function checkMemoryPoisoning(opts) {
|
|
175
|
+
const config = await loadConfig();
|
|
176
|
+
const defenseConfig = config.poisoningDefense;
|
|
177
|
+
if (!defenseConfig?.enabled) {
|
|
178
|
+
return { passed: true, trustLevel: computeTrustLevel(opts.toolName, opts.agentId), quarantined: false };
|
|
179
|
+
}
|
|
180
|
+
const trustLevel = computeTrustLevel(opts.toolName, opts.agentId);
|
|
181
|
+
const rateCheck = checkRateLimit(opts.agentId, opts.sessionId, defenseConfig.rateLimits);
|
|
182
|
+
if (!rateCheck.allowed) {
|
|
183
|
+
await quarantineMemory(opts.memoryId, rateCheck.reason);
|
|
184
|
+
return { passed: false, trustLevel, quarantined: true, reason: rateCheck.reason };
|
|
185
|
+
}
|
|
186
|
+
if (opts.importance >= 8 && trustLevel !== "system") {
|
|
187
|
+
const highImpLimit = defenseConfig.rateLimits?.highImportance ?? 20;
|
|
188
|
+
const sessionHighImp = (_sessionCounters.get(`${opts.sessionId}:highimp`) ?? 0) + 1;
|
|
189
|
+
_sessionCounters.set(`${opts.sessionId}:highimp`, sessionHighImp);
|
|
190
|
+
if (sessionHighImp > highImpLimit) {
|
|
191
|
+
await quarantineMemory(opts.memoryId, `High-importance inflation: ${sessionHighImp} importance>=8 memories in session`);
|
|
192
|
+
return { passed: false, trustLevel, quarantined: true, reason: "importance inflation" };
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (opts.vector && opts.vector.length > 0) {
|
|
196
|
+
const threshold = defenseConfig.anomalyThreshold ?? 0.85;
|
|
197
|
+
const anomaly = await checkAnomaly(opts.vector, opts.agentId, opts.projectName, threshold);
|
|
198
|
+
if (anomaly.anomalous) {
|
|
199
|
+
await quarantineMemory(opts.memoryId, `Anomalous vector: distance ${anomaly.distance.toFixed(3)} > threshold ${threshold}`);
|
|
200
|
+
return {
|
|
201
|
+
passed: false,
|
|
202
|
+
trustLevel,
|
|
203
|
+
anomalyDistance: anomaly.distance,
|
|
204
|
+
quarantined: true,
|
|
205
|
+
reason: `anomaly distance ${anomaly.distance.toFixed(3)}`
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return { passed: true, trustLevel, quarantined: false };
|
|
210
|
+
}
|
|
211
|
+
export {
|
|
212
|
+
approveQuarantined,
|
|
213
|
+
checkAnomaly,
|
|
214
|
+
checkMemoryPoisoning,
|
|
215
|
+
checkRateLimit,
|
|
216
|
+
computeTrustLevel,
|
|
217
|
+
getAgentCentroid,
|
|
218
|
+
listQuarantined,
|
|
219
|
+
quarantineMemory,
|
|
220
|
+
refreshAgentCentroid,
|
|
221
|
+
rejectQuarantined,
|
|
222
|
+
resetRateLimits
|
|
223
|
+
};
|