@cortexkit/opencode-magic-context 0.49.48 → 0.49.50
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/{announcement-g789dmt6.js → announcement-9pr71hd5.js} +3 -2
- package/dist/auto-search-worker.js +5 -5
- package/dist/chunk-embedding-write-worker.js +14 -15
- package/dist/{compaction-marker-candidates-dkfp1q9j.js → compaction-marker-candidates-8hazqfvj.js} +2 -3
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/{compartment-chunk-embedding-snj51nmg.js → compartment-chunk-embedding-gfd093f8.js} +7 -8
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +10 -0
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-w1aw6w5t.js → conflict-warning-hook-56qpq7ws.js} +7 -8
- package/dist/{context-8r125qv3.js → context-4js5qnnm.js} +61 -49
- package/dist/{derive-budgets-nkw09vq7.js → derive-budgets-z53424qx.js} +2 -3
- package/dist/embedding-backfill-3wdjzrvs.js +27 -0
- package/dist/embedding-worker-process.js +2 -3
- package/dist/embedding-worker.js +6 -7
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +5 -7
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-openai.d.ts +4 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-probe.d.ts +10 -0
- package/dist/features/magic-context/memory/embedding-probe.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +14 -0
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +2 -0
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/{history-owner-0z620wgz.js → history-owner-n50e0e8y.js} +2 -3
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +5 -3
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-rvmhyk89.js → index-07rp6xcn.js} +9 -9
- package/dist/{index-txs8tce6.js → index-0k283v27.js} +2 -4
- package/dist/{index-ak11t3gm.js → index-0tz2fzpq.js} +1 -1
- package/dist/{index-2qbtqg1w.js → index-25tm250q.js} +1 -1
- package/dist/{index-h9m41624.js → index-2ny9xwdn.js} +2 -2
- package/dist/{index-xa9mmq6c.js → index-36wseasx.js} +1 -1
- package/dist/{index-cgzpbz78.js → index-5dptmnvd.js} +5 -5
- package/dist/{index-q41sm60t.js → index-5g6npyw5.js} +89 -63
- package/dist/{index-qsyx931k.js → index-5t1mr0bt.js} +13 -15
- package/dist/{index-jrfre9ah.js → index-82dfe8en.js} +146 -5
- package/dist/{index-d4qw2h43.js → index-8d7gkgjs.js} +6 -5
- package/dist/{index-gn6gfz4y.js → index-90z05d0p.js} +1 -1
- package/dist/{index-trkxkgmd.js → index-97bjd14c.js} +5 -5
- package/dist/{index-9wnbnx8f.js → index-a6aqpfp6.js} +1 -1
- package/dist/{index-s79g172v.js → index-bamnjp2t.js} +29 -13
- package/dist/{index-4wpfbzks.js → index-bkg4hdyh.js} +3 -3
- package/dist/{index-gp3kcpc4.js → index-cd3vp8xa.js} +1 -1
- package/dist/{index-vk6srk5r.js → index-ct3ettqt.js} +3 -3
- package/dist/{index-sd2s4t4p.js → index-cwj6qhmf.js} +2 -2
- package/dist/{index-brj6was5.js → index-em92bp7f.js} +2 -2
- package/dist/{index-2p37txes.js → index-ga5q492k.js} +1 -1
- package/dist/{index-8cfnaagj.js → index-gapnh6tk.js} +2 -4
- package/dist/{index-fw42ms3m.js → index-gz001bx7.js} +1 -1
- package/dist/{index-zetm0ayn.js → index-h8g08nxs.js} +164 -106
- package/dist/{index-qcz1fy7h.js → index-hexdee98.js} +4 -4
- package/dist/{index-fgft4qjn.js → index-hkveze74.js} +4 -4
- package/dist/{index-smtbdmc3.js → index-hsv31e69.js} +2 -2
- package/dist/{index-dj2p8653.js → index-hsyczpn7.js} +2 -2
- package/dist/{index-4dpvnp8k.js → index-jjy5a5w0.js} +3 -0
- package/dist/{index-1hwn96x1.js → index-kn1bx21r.js} +3 -3
- package/dist/{index-t6s0tsp7.js → index-mjh63zvw.js} +3 -3
- package/dist/{index-ta87fpfs.js → index-n0twfvah.js} +64 -15
- package/dist/{index-nj360hcs.js → index-pb8ysnq2.js} +4 -4
- package/dist/{index-jz5bk7xd.js → index-qperbvjn.js} +2 -2
- package/dist/{index-25ka1jza.js → index-r9agn061.js} +4 -4
- package/dist/{index-hkh8x221.js → index-rbs27k1d.js} +7 -7
- package/dist/{index-hacf2tyx.js → index-reyws9fy.js} +1 -1
- package/dist/{index-cgsmttyj.js → index-s131svmx.js} +4 -4
- package/dist/{index-fxbk7gk3.js → index-tad3can2.js} +1 -1
- package/dist/{index-8ka0ne8t.js → index-v4a1pnny.js} +6 -6
- package/dist/{index-xh3jyejb.js → index-wr2t8zb0.js} +17 -19
- package/dist/{index-q6pjqm49.js → index-z4832qfe.js} +14 -14
- package/dist/index.js +54 -56
- package/dist/{logger-qwnbcfj9.js → logger-sw7z6sjz.js} +1 -2
- package/dist/{message-fts-rowid-map-msffhkve.js → message-fts-rowid-map-kx1bsdyg.js} +4 -5
- package/dist/{message-index-bounded-0q7sy04w.js → message-index-bounded-k0ebpy3y.js} +12 -13
- package/dist/{message-time-backfill-39bm498k.js → message-time-backfill-hp2jgn49.js} +2 -3
- package/dist/migration-worker.js +12 -13
- package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -1
- package/dist/plugin/embedding-routing.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{project-embedding-registry-r6xfsrbe.js → project-embedding-registry-5dwh5zfn.js} +12 -13
- package/dist/raw-ordinal-warmup-worker.js +8 -8
- package/dist/{read-session-chunk-7fmg9p5m.js → read-session-chunk-6712p893.js} +10 -11
- package/dist/{read-session-raw-x7a9b3jm.js → read-session-raw-04ger9zt.js} +2 -3
- package/dist/{recomp-orchestrator-jqa5z4ar.js → recomp-orchestrator-8ebydg5j.js} +31 -32
- package/dist/render-dtc4qkq4.js +43 -0
- package/dist/{safe-notification-target-wztd7bgk.js → safe-notification-target-mx5khyxf.js} +2 -3
- package/dist/{search-archive-df09r8qn.js → search-archive-f6hjbnsa.js} +12 -13
- package/dist/{search-kt764afk.js → search-edv0gy1d.js} +24 -25
- package/dist/{send-session-notification-j93pn2hn.js → send-session-notification-gamjee2f.js} +5 -6
- package/dist/shared/data-path.d.ts +7 -13
- package/dist/shared/data-path.d.ts.map +1 -1
- package/dist/shared/hidden-model-cooldown.d.ts +23 -0
- package/dist/shared/hidden-model-cooldown.d.ts.map +1 -0
- package/dist/shared/model-suggestion-retry.d.ts +0 -2
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/provider-response-completion.d.ts +10 -0
- package/dist/shared/provider-response-completion.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +1 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/status-summary.d.ts +1 -0
- package/dist/shared/status-summary.d.ts.map +1 -1
- package/dist/shared/status-view-check.d.ts.map +1 -1
- package/dist/shared/status-view.d.ts +1 -0
- package/dist/shared/status-view.d.ts.map +1 -1
- package/dist/shared/test-db.d.ts +13 -0
- package/dist/shared/test-db.d.ts.map +1 -0
- package/dist/{storage-tags-96vyd6ra.js → storage-tags-kdb4qsyq.js} +4 -5
- package/dist/test-preload.d.ts +2 -0
- package/dist/test-preload.d.ts.map +1 -0
- package/dist/{transform-postprocess-phase-a7ety10n.js → transform-postprocess-phase-1bg25094.js} +32 -33
- package/dist/v2/auto-search-worker.js +5 -5
- package/dist/v2/chunk-embedding-write-worker.js +14 -14
- package/dist/v2/{compaction-marker-candidates-y737qb1v.js → compaction-marker-candidates-re14353a.js} +2 -2
- package/dist/v2/compaction-marker-candidates-worker.js +1 -1
- package/dist/v2/{compartment-chunk-embedding-nj5nrnbj.js → compartment-chunk-embedding-0pxsrzrt.js} +7 -7
- package/dist/v2/{context-9x7mnb7x.js → context-qkr7z6d0.js} +99 -63
- package/dist/v2/{derive-budgets-b5cgrtp8.js → derive-budgets-w0815q82.js} +3 -3
- package/dist/v2/embedding-backfill-x1zpc04f.js +27 -0
- package/dist/v2/embedding-worker-process.js +1 -1
- package/dist/v2/embedding-worker.js +5 -5
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/{history-owner-fpka43cn.js → history-owner-ep91wgqj.js} +2 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/usage-persist.d.ts +1 -1
- package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
- package/dist/v2/hooks/usage-reading.d.ts +3 -0
- package/dist/v2/hooks/usage-reading.d.ts.map +1 -1
- package/dist/v2/{logger-4cj6d03m.js → logger-xnscpj6w.js} +1 -1
- package/dist/v2/{message-fts-rowid-map-qe7cpksd.js → message-fts-rowid-map-57jh6xpb.js} +4 -4
- package/dist/v2/{message-index-bounded-hctgp22r.js → message-index-bounded-a36rw93p.js} +12 -12
- package/dist/v2/{message-time-backfill-0c4h7sg6.js → message-time-backfill-baxebka0.js} +2 -2
- package/dist/v2/migration-worker.js +11 -11
- package/dist/v2/{project-embedding-registry-ek0cy0d5.js → project-embedding-registry-v2fxrs8b.js} +12 -12
- package/dist/v2/raw-ordinal-warmup-worker.js +8 -8
- package/dist/v2/{read-session-chunk-zknadvjr.js → read-session-chunk-hzhxvhyv.js} +10 -10
- package/dist/v2/{read-session-raw-yss2ev98.js → read-session-raw-3e482h3c.js} +2 -2
- package/dist/v2/{recomp-orchestrator-m5w0eqke.js → recomp-orchestrator-yzr49pd0.js} +32 -32
- package/dist/v2/{render-89asy54r.js → render-rhaevxv1.js} +21 -21
- package/dist/v2/{safe-notification-target-gphhast7.js → safe-notification-target-9r79xnbt.js} +2 -2
- package/dist/v2/{search-archive-axz2gbdb.js → search-archive-9924fyk8.js} +12 -12
- package/dist/v2/{search-kdtja5rx.js → search-ggvexvv7.js} +23 -23
- package/dist/v2/{send-session-notification-na3q825m.js → send-session-notification-95p89k7q.js} +5 -5
- package/dist/v2/{server-yyqmvbvv.js → server-016a1whm.js} +161 -102
- package/dist/v2/{server-z3tyd1mx.js → server-0k586y7d.js} +3 -3
- package/dist/v2/{server-p9s40wfa.js → server-0ms13pc8.js} +3 -0
- package/dist/v2/{server-e3m10ds0.js → server-16kfxcxj.js} +4 -4
- package/dist/v2/{server-nn4hbymt.js → server-3bfc26r7.js} +9 -9
- package/dist/v2/{server-7vb38e51.js → server-3jc6qmdz.js} +1 -1
- package/dist/v2/{server-jra7awr5.js → server-3qf9n5ck.js} +11 -11
- package/dist/v2/{server-69m30b21.js → server-3yk44ddz.js} +1 -1
- package/dist/v2/{server-2gjqhmn9.js → server-4h4acntc.js} +27 -11
- package/dist/v2/{server-3schkz95.js → server-58h6rrnx.js} +4 -4
- package/dist/v2/{server-af1rmkyn.js → server-5kgesxck.js} +2 -2
- package/dist/v2/{server-mfn1yf9d.js → server-7vrtk78d.js} +1 -1
- package/dist/v2/{server-27kccwe7.js → server-88yvx6r9.js} +63 -12
- package/dist/v2/{server-f0j864ma.js → server-91gb0vh8.js} +1 -1
- package/dist/v2/{server-131h608x.js → server-966dq3pd.js} +2 -2
- package/dist/v2/{server-jb6tjyeb.js → server-bb6kf05j.js} +23 -20
- package/dist/v2/{server-sg2qjkrb.js → server-brsx45r6.js} +6 -4
- package/dist/v2/{server-gwxys0d0.js → server-c8z2grq0.js} +1 -1
- package/dist/v2/{server-y8n33d9j.js → server-g61hgy1y.js} +4 -4
- package/dist/v2/{server-zahgxer8.js → server-jxrqsn84.js} +3 -3
- package/dist/v2/{server-2j87594q.js → server-kgq2e2hh.js} +2 -2
- package/dist/v2/{server-ddw42d76.js → server-mxsy9h1d.js} +2 -2
- package/dist/v2/{server-qmmkhz2z.js → server-np27dgyt.js} +1 -1
- package/dist/v2/{server-jqn7q7tm.js → server-q93jdtz8.js} +5 -5
- package/dist/v2/{server-dcws5831.js → server-qp5sj6n5.js} +2 -2
- package/dist/v2/{server-7be0ersd.js → server-rcchadw0.js} +3 -3
- package/dist/v2/{server-b3r080cm.js → server-rz5jnhnv.js} +1 -1
- package/dist/v2/{server-zt1m5rwj.js → server-sa1fdt41.js} +1 -1
- package/dist/v2/{server-wa4qhryh.js → server-sb55ddgn.js} +5 -4
- package/dist/v2/{server-4x7n5qz7.js → server-scp3y4dh.js} +13 -11
- package/dist/v2/{server-pej5rnye.js → server-sgn61hht.js} +2 -2
- package/dist/v2/{server-ypf1ap0v.js → server-t8n27rbt.js} +1 -1
- package/dist/v2/{server-sefxj8k1.js → server-tmf0ayqp.js} +1 -1
- package/dist/v2/{server-sr8tf5dt.js → server-vjadwb3j.js} +6 -5
- package/dist/v2/{server-bez34e60.js → server-vqq3g1t7.js} +4 -4
- package/dist/v2/{server-tpt7bwq8.js → server-ww7xbxxf.js} +1 -1
- package/dist/v2/server.js +6 -6
- package/dist/v2/{storage-tags-xq8hjqkf.js → storage-tags-rzv7y0n3.js} +4 -4
- package/dist/v2/{v2-archive-reader-ky1wqcws.js → v2-archive-reader-5ggewg8q.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-6wt67saz.js → wrapup-orchestrator-36c5wyvq.js} +32 -32
- package/dist/{v2-archive-reader-665x2x4d.js → v2-archive-reader-gx5ke1d7.js} +1 -1
- package/dist/wrapup-orchestrator-ya31knav.js +55 -0
- package/package.json +1 -1
- package/src/config/index.test.ts +20 -0
- package/src/config/project-security.test.ts +5 -1
- package/src/config/project-security.ts +4 -0
- package/src/config/schema/magic-context.test.ts +43 -0
- package/src/config/schema/magic-context.ts +19 -0
- package/src/shared/data-path.test.ts +104 -56
- package/src/shared/data-path.ts +30 -30
- package/src/shared/hidden-model-cooldown.test.ts +117 -0
- package/src/shared/hidden-model-cooldown.ts +123 -0
- package/src/shared/model-suggestion-retry.test.ts +53 -76
- package/src/shared/model-suggestion-retry.ts +38 -53
- package/src/shared/provider-response-completion.test.ts +49 -0
- package/src/shared/provider-response-completion.ts +64 -0
- package/src/shared/rpc-types.ts +1 -0
- package/src/shared/startup-maintenance-policy.test.ts +115 -0
- package/src/shared/status-detail-text.test.ts +7 -0
- package/src/shared/status-summary.ts +3 -0
- package/src/shared/status-view-check.ts +1 -0
- package/src/shared/status-view.test.ts +15 -0
- package/src/shared/status-view.ts +11 -1
- package/src/shared/test-db.test.ts +84 -0
- package/src/shared/test-db.ts +36 -0
- package/dist/embedding-backfill-kpy5shsa.js +0 -28
- package/dist/index-g2q4htwp.js +0 -146
- package/dist/render-mnqc74ar.js +0 -44
- package/dist/v2/embedding-backfill-360efh1t.js +0 -27
- package/dist/wrapup-orchestrator-7kmb3jf9.js +0 -56
|
@@ -3,22 +3,22 @@ import {
|
|
|
3
3
|
removeNestedBlocks,
|
|
4
4
|
hasMeaningfulUserText2,
|
|
5
5
|
extractTexts2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-3jc6qmdz.js";
|
|
7
7
|
import {
|
|
8
8
|
getHarness2
|
|
9
9
|
} from "./server-pavzsdc6.js";
|
|
10
10
|
import {
|
|
11
11
|
cleanUserText2
|
|
12
|
-
} from "./server-
|
|
12
|
+
} from "./server-3bfc26r7.js";
|
|
13
13
|
import {
|
|
14
14
|
recordMessageFtsRowid2,
|
|
15
15
|
recordIndexedMessageTime2,
|
|
16
16
|
messageFtsOrdinalRangeIsMapped2,
|
|
17
17
|
deleteUnmappedMessageFtsRows2
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-966dq3pd.js";
|
|
19
19
|
import {
|
|
20
20
|
logSlowWriteTransaction
|
|
21
|
-
} from "./server-
|
|
21
|
+
} from "./server-np27dgyt.js";
|
|
22
22
|
|
|
23
23
|
// src/features/magic-context/message-index.ts
|
|
24
24
|
import { createHash } from "node:crypto";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
TAG_SELECT_COLUMNS2,
|
|
19
19
|
getCandidateToolOwners2,
|
|
20
20
|
pickNearestPriorOwner2
|
|
21
|
-
} from "./server-
|
|
21
|
+
} from "./server-rcchadw0.js";
|
|
22
22
|
import {
|
|
23
23
|
OMO_INTERNAL_INITIATOR_MARKER,
|
|
24
24
|
isSystemDirective,
|
|
@@ -36,24 +36,24 @@ import {
|
|
|
36
36
|
formatBlock,
|
|
37
37
|
compactTextForSummary,
|
|
38
38
|
mergeCommitHashes
|
|
39
|
-
} from "./server-
|
|
39
|
+
} from "./server-3jc6qmdz.js";
|
|
40
40
|
import {
|
|
41
41
|
getHarness2
|
|
42
42
|
} from "./server-pavzsdc6.js";
|
|
43
43
|
import {
|
|
44
44
|
sessionLog2
|
|
45
|
-
} from "./server-
|
|
45
|
+
} from "./server-bb6kf05j.js";
|
|
46
46
|
import {
|
|
47
47
|
prepareCachedStatement2
|
|
48
48
|
} from "./server-gzy5w8ya.js";
|
|
49
49
|
import {
|
|
50
50
|
stableStringify
|
|
51
|
-
} from "./server-
|
|
51
|
+
} from "./server-ww7xbxxf.js";
|
|
52
52
|
import {
|
|
53
53
|
renderToolTemplate,
|
|
54
54
|
resolveModelConfigValue,
|
|
55
55
|
deriveDefaultProtectedTokens
|
|
56
|
-
} from "./server-
|
|
56
|
+
} from "./server-0ms13pc8.js";
|
|
57
57
|
import {
|
|
58
58
|
readRawSessionMessagesFromDb2,
|
|
59
59
|
readRawSessionMessagePageFromDb2,
|
|
@@ -70,18 +70,18 @@ import {
|
|
|
70
70
|
readRawSeedTailFromDb2,
|
|
71
71
|
readRawSessionBoundaryEndpointsFromDb2,
|
|
72
72
|
prewarmRawSessionOrdinalsForDb
|
|
73
|
-
} from "./server-
|
|
73
|
+
} from "./server-rz5jnhnv.js";
|
|
74
74
|
import {
|
|
75
75
|
openCodeDbExists,
|
|
76
76
|
withReadOnlySessionDb,
|
|
77
77
|
getRawSessionMessageCountFromDb,
|
|
78
78
|
getMessageTimesFromOpenCodeDb
|
|
79
|
-
} from "./server-
|
|
79
|
+
} from "./server-7vrtk78d.js";
|
|
80
80
|
import {
|
|
81
81
|
getToolDefinitionMeasurementSignature,
|
|
82
82
|
getMeasuredToolDefinitionTokens,
|
|
83
83
|
getSessionToolDefinitionTokens
|
|
84
|
-
} from "./server-
|
|
84
|
+
} from "./server-kgq2e2hh.js";
|
|
85
85
|
import {
|
|
86
86
|
markHostUnservedRow,
|
|
87
87
|
isHostUnservedRow
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
} from "./server-avwt563y.js";
|
|
93
93
|
import {
|
|
94
94
|
logSlowWriteTransaction
|
|
95
|
-
} from "./server-
|
|
95
|
+
} from "./server-np27dgyt.js";
|
|
96
96
|
// src/shared/historian-tool-defaults.json
|
|
97
97
|
var historian_tool_defaults_default = {
|
|
98
98
|
ctx_note: "Note ${input.action} ${input.note_ids}: ${input.content} → ${output.truncate(160)}",
|
|
@@ -5,17 +5,17 @@ import {
|
|
|
5
5
|
getDataDir,
|
|
6
6
|
log2,
|
|
7
7
|
sessionLog2
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-bb6kf05j.js";
|
|
9
9
|
import {
|
|
10
10
|
inRootAsyncContext2,
|
|
11
11
|
withSqliteBackgroundWriter2
|
|
12
12
|
} from "./server-gzy5w8ya.js";
|
|
13
13
|
import {
|
|
14
14
|
scheduleAfterBootQuiet
|
|
15
|
-
} from "./server-
|
|
15
|
+
} from "./server-3yk44ddz.js";
|
|
16
16
|
import {
|
|
17
17
|
isRecord
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-rcchadw0.js";
|
|
19
19
|
import {
|
|
20
20
|
cleanSearchText,
|
|
21
21
|
hintKeywordRelevance,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
isMessageIndexReconciledThrough,
|
|
26
26
|
clearIndexedMessages,
|
|
27
27
|
indexMessagesAfterOrdinal
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-16kfxcxj.js";
|
|
29
29
|
import {
|
|
30
30
|
Priority,
|
|
31
31
|
AdmissionClass,
|
|
@@ -34,13 +34,13 @@ import {
|
|
|
34
34
|
StaleRouteHandleError,
|
|
35
35
|
SubcClient,
|
|
36
36
|
isConsumerReconnectTransient
|
|
37
|
-
} from "./server-
|
|
37
|
+
} from "./server-mxsy9h1d.js";
|
|
38
38
|
import {
|
|
39
39
|
buildCanonicalChunkTextFromFts2,
|
|
40
40
|
loadCompartmentChunkEmbeddingsForSearch2,
|
|
41
41
|
peekCompartmentChunkSearchPool2,
|
|
42
42
|
warmCompartmentChunkSearchPool2
|
|
43
|
-
} from "./server-
|
|
43
|
+
} from "./server-g61hgy1y.js";
|
|
44
44
|
import {
|
|
45
45
|
saveCommitEmbedding,
|
|
46
46
|
loadProjectCommitEmbeddings,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
enqueueShadowEmbeddingItems2,
|
|
57
57
|
getProjectEmbeddingSnapshot2,
|
|
58
58
|
embedItemsForProject2
|
|
59
|
-
} from "./server-
|
|
59
|
+
} from "./server-4h4acntc.js";
|
|
60
60
|
import {
|
|
61
61
|
recordEmbeddingMeasurement
|
|
62
62
|
} from "./server-2amn2s73.js";
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
isEmbeddingEnabled,
|
|
69
69
|
embedText,
|
|
70
70
|
ensureMemoryEmbeddings2
|
|
71
|
-
} from "./server-
|
|
71
|
+
} from "./server-vjadwb3j.js";
|
|
72
72
|
import {
|
|
73
73
|
ModuleMemoryAuthorityError2,
|
|
74
74
|
getMemoriesByProject2,
|
|
@@ -81,7 +81,7 @@ import {
|
|
|
81
81
|
sanitizeFtsQuery,
|
|
82
82
|
searchMemoriesFTS,
|
|
83
83
|
searchMemoriesFTSUnion
|
|
84
|
-
} from "./server-
|
|
84
|
+
} from "./server-sgn61hht.js";
|
|
85
85
|
import {
|
|
86
86
|
MESSAGE_FTS_SESSION_FILTER_SQL,
|
|
87
87
|
withMessageFtsSessionFilter
|
|
@@ -92,11 +92,11 @@ import {
|
|
|
92
92
|
expandWorkspaceIdentitySetWithAliases,
|
|
93
93
|
resolveStoredPathWorkspaceIdentity,
|
|
94
94
|
sourceNameForMemory
|
|
95
|
-
} from "./server-
|
|
95
|
+
} from "./server-58h6rrnx.js";
|
|
96
96
|
import {
|
|
97
97
|
getNotes,
|
|
98
98
|
getActivePrimers
|
|
99
|
-
} from "./server-
|
|
99
|
+
} from "./server-t8n27rbt.js";
|
|
100
100
|
import {
|
|
101
101
|
isKnownAutocommit
|
|
102
102
|
} from "./server-8ajstryz.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-0ms13pc8.js";
|
|
4
4
|
import {
|
|
5
5
|
embedPauseBySession,
|
|
6
6
|
activeEmbeddingSessions,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
} from "./server-gzy5w8ya.js";
|
|
16
16
|
import {
|
|
17
17
|
setBootQuietPeriodForTests
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-3yk44ddz.js";
|
|
19
19
|
import {
|
|
20
20
|
isEmbeddingHostBusy2
|
|
21
21
|
} from "./server-qt1qqasc.js";
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./server-pavzsdc6.js";
|
|
25
25
|
import {
|
|
26
26
|
log2
|
|
27
|
-
} from "./server-
|
|
27
|
+
} from "./server-bb6kf05j.js";
|
|
28
28
|
import {
|
|
29
29
|
sanitizeDiagnosticText
|
|
30
30
|
} from "./server-z4p0ry94.js";
|
|
@@ -39,10 +39,10 @@ import {
|
|
|
39
39
|
isSynapseEmbeddingTruncated,
|
|
40
40
|
getSynapseBatchRequestKey,
|
|
41
41
|
SynapseEmbeddingProvider
|
|
42
|
-
} from "./server-
|
|
42
|
+
} from "./server-mxsy9h1d.js";
|
|
43
43
|
import {
|
|
44
44
|
estimateTokens
|
|
45
|
-
} from "./server-
|
|
45
|
+
} from "./server-3jc6qmdz.js";
|
|
46
46
|
import {
|
|
47
47
|
DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2,
|
|
48
48
|
CHUNK_WINDOW_SAFETY_RATIO2,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
countSessionCompartmentEmbedCoverage2,
|
|
61
61
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
62
62
|
countUnembeddedSessionCompartmentsPolite2
|
|
63
|
-
} from "./server-
|
|
63
|
+
} from "./server-g61hgy1y.js";
|
|
64
64
|
import {
|
|
65
65
|
acquireGitSweepLease,
|
|
66
66
|
renewGitSweepLease,
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
findMisScopedCompartmentChunkEmbeddingIdsForProject,
|
|
69
69
|
recordSessionProjectIdentity,
|
|
70
70
|
repairMisScopedCompartmentChunkEmbeddingsForProject
|
|
71
|
-
} from "./server-
|
|
71
|
+
} from "./server-qp5sj6n5.js";
|
|
72
72
|
import {
|
|
73
73
|
saveEmbeddingIfHashMatches,
|
|
74
74
|
getMemoryEmbedCoverage,
|
|
@@ -83,13 +83,13 @@ import {
|
|
|
83
83
|
logLocalEmbeddingPoolingUnavailableOnce,
|
|
84
84
|
getEmbeddingProviderIdentity,
|
|
85
85
|
LocalEmbeddingProvider
|
|
86
|
-
} from "./server-
|
|
86
|
+
} from "./server-brsx45r6.js";
|
|
87
87
|
import {
|
|
88
88
|
isKnownAutocommit
|
|
89
89
|
} from "./server-8ajstryz.js";
|
|
90
90
|
import {
|
|
91
91
|
logSlowWriteTransaction
|
|
92
|
-
} from "./server-
|
|
92
|
+
} from "./server-np27dgyt.js";
|
|
93
93
|
|
|
94
94
|
// src/features/magic-context/project-embedding-registry.ts
|
|
95
95
|
import { createHash as createHash2, randomUUID } from "node:crypto";
|
|
@@ -592,6 +592,7 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
592
592
|
queryPrefix;
|
|
593
593
|
documentPrefix;
|
|
594
594
|
truncate;
|
|
595
|
+
dimensions;
|
|
595
596
|
initialized = false;
|
|
596
597
|
failureTimes = [];
|
|
597
598
|
circuitOpenUntil = 0;
|
|
@@ -611,6 +612,7 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
611
612
|
this.queryPrefix = prefixes.queryPrefix;
|
|
612
613
|
this.documentPrefix = prefixes.documentPrefix;
|
|
613
614
|
this.truncate = options.truncate?.trim() ?? "";
|
|
615
|
+
this.dimensions = typeof options.dimensions === "number" && Number.isInteger(options.dimensions) && options.dimensions > 0 ? options.dimensions : undefined;
|
|
614
616
|
this.rateLimitKey = rateLimitStateKey(this.endpoint, this.apiKey);
|
|
615
617
|
const maxInputTokensSet = typeof options.maxInputTokens === "number" && Number.isFinite(options.maxInputTokens);
|
|
616
618
|
this.maxInputTokens = maxInputTokensSet ? Math.max(1, Math.floor(options.maxInputTokens)) : DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2;
|
|
@@ -628,7 +630,8 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
628
630
|
...this.apiKey ? { api_key: this.apiKey } : {},
|
|
629
631
|
...this.inputType ? { input_type: this.inputType } : {},
|
|
630
632
|
...options.documentPrefix !== undefined ? { document_prefix: options.documentPrefix } : {},
|
|
631
|
-
...this.truncate ? { truncate: this.truncate } : {}
|
|
633
|
+
...this.truncate ? { truncate: this.truncate } : {},
|
|
634
|
+
...this.dimensions ? { dimensions: this.dimensions } : {}
|
|
632
635
|
});
|
|
633
636
|
}
|
|
634
637
|
async initialize() {
|
|
@@ -734,7 +737,8 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
734
737
|
model: this.model,
|
|
735
738
|
input: requestTexts,
|
|
736
739
|
...inputTypeForRequest ? { input_type: inputTypeForRequest } : {},
|
|
737
|
-
...this.truncate ? { truncate: this.truncate } : {}
|
|
740
|
+
...this.truncate ? { truncate: this.truncate } : {},
|
|
741
|
+
...this.dimensions ? { dimensions: this.dimensions } : {}
|
|
738
742
|
}),
|
|
739
743
|
redirect: "error",
|
|
740
744
|
signal: internalController.signal
|
|
@@ -807,6 +811,16 @@ class OpenAICompatibleEmbeddingProvider {
|
|
|
807
811
|
results[slot] = Float32Array.from(embedding);
|
|
808
812
|
}
|
|
809
813
|
});
|
|
814
|
+
if (this.dimensions !== undefined) {
|
|
815
|
+
const requested = this.dimensions;
|
|
816
|
+
const returned = results.find((r) => r !== null && r.length !== requested)?.length;
|
|
817
|
+
if (returned !== undefined) {
|
|
818
|
+
const failure = this.failure("invalid_envelope", `requested dimensions=${requested} but endpoint returned ${returned}-dim vectors; the endpoint may not support the dimensions parameter for this model`, false);
|
|
819
|
+
log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
|
|
820
|
+
this.recordFailure(requestStartedAt, isProbe, failure);
|
|
821
|
+
return Array.from({ length: texts.length }, () => null);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
810
824
|
if (results.every((r) => r === null)) {
|
|
811
825
|
const failure = this.failure("invalid_envelope", `response had keys [${responseKeys.join(", ")}] but data[].embedding was absent`, false);
|
|
812
826
|
log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
|
|
@@ -1256,6 +1270,7 @@ function resolveEmbeddingConfig(config) {
|
|
|
1256
1270
|
...config.query_instruction !== undefined ? { query_instruction: config.query_instruction } : {},
|
|
1257
1271
|
...config.document_prefix !== undefined ? { document_prefix: config.document_prefix } : {},
|
|
1258
1272
|
...truncate ? { truncate } : {},
|
|
1273
|
+
...config.dimensions ? { dimensions: config.dimensions } : {},
|
|
1259
1274
|
...config.max_input_tokens ? {
|
|
1260
1275
|
max_input_tokens: normalizeCompartmentChunkMaxInputTokens2(config.max_input_tokens)
|
|
1261
1276
|
} : {}
|
|
@@ -1305,6 +1320,7 @@ function createProvider(config, context) {
|
|
|
1305
1320
|
queryInstruction: config.query_instruction,
|
|
1306
1321
|
documentPrefix: config.document_prefix,
|
|
1307
1322
|
truncate: config.truncate,
|
|
1323
|
+
dimensions: config.dimensions,
|
|
1308
1324
|
maxInputTokens: config.max_input_tokens
|
|
1309
1325
|
});
|
|
1310
1326
|
}
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./server-fr0wbhdn.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-bb6kf05j.js";
|
|
7
7
|
import {
|
|
8
8
|
ensureColumn,
|
|
9
9
|
healAllNullColumns,
|
|
10
10
|
installV95PerfSchema
|
|
11
|
-
} from "./server-
|
|
11
|
+
} from "./server-ww7xbxxf.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveOpenCodeDbPath,
|
|
14
14
|
openCodeDbPathExists,
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
normalizeStoredProjectPath,
|
|
22
22
|
storedPathBelongsToIdentity
|
|
23
|
-
} from "./server-
|
|
23
|
+
} from "./server-3yk44ddz.js";
|
|
24
24
|
import {
|
|
25
25
|
logSlowWriteTransaction
|
|
26
|
-
} from "./server-
|
|
26
|
+
} from "./server-np27dgyt.js";
|
|
27
27
|
|
|
28
28
|
// src/features/magic-context/migrations.ts
|
|
29
29
|
import { isMainThread } from "node:worker_threads";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log2
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-bb6kf05j.js";
|
|
4
4
|
import {
|
|
5
5
|
getSdkWindowGeometry,
|
|
6
6
|
getSdkContextLimit,
|
|
7
7
|
getSdkInputLimit
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-sa1fdt41.js";
|
|
9
9
|
import {
|
|
10
10
|
localBudget,
|
|
11
11
|
calibrationForModelKey
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
getMagicContextStorageDir,
|
|
11
11
|
log2,
|
|
12
12
|
sessionLog2
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-bb6kf05j.js";
|
|
14
14
|
import {
|
|
15
15
|
prepareCachedStatement2,
|
|
16
16
|
withSqliteBackgroundWriter2,
|
|
@@ -18,14 +18,14 @@ import {
|
|
|
18
18
|
} from "./server-gzy5w8ya.js";
|
|
19
19
|
import {
|
|
20
20
|
deleteUnmappedMessageFtsRows2
|
|
21
|
-
} from "./server-
|
|
21
|
+
} from "./server-966dq3pd.js";
|
|
22
22
|
import {
|
|
23
23
|
deleteChunkEmbedBackoffForSession2
|
|
24
|
-
} from "./server-
|
|
24
|
+
} from "./server-g61hgy1y.js";
|
|
25
25
|
import {
|
|
26
26
|
isPidAlive,
|
|
27
27
|
readProcessStartTime
|
|
28
|
-
} from "./server-
|
|
28
|
+
} from "./server-tmf0ayqp.js";
|
|
29
29
|
import {
|
|
30
30
|
MERGED_REASONING_PARTS_PREFIX,
|
|
31
31
|
decodeMergedReasoningParts,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
serializeProcessedImageMarkers,
|
|
54
54
|
getPendingPiCompactionMarkerState,
|
|
55
55
|
logPiCompactionMarkerClear
|
|
56
|
-
} from "./server-
|
|
56
|
+
} from "./server-3bfc26r7.js";
|
|
57
57
|
import {
|
|
58
58
|
getTableColumnNames,
|
|
59
59
|
tagTombstoneOwnerRange,
|
|
@@ -61,23 +61,23 @@ import {
|
|
|
61
61
|
tagRevisionKey,
|
|
62
62
|
tagIdentityRevisionKey,
|
|
63
63
|
deleteTagIdentityRevisions
|
|
64
|
-
} from "./server-
|
|
64
|
+
} from "./server-ww7xbxxf.js";
|
|
65
65
|
import {
|
|
66
66
|
stripTagPrefix,
|
|
67
67
|
isRecord,
|
|
68
68
|
providerVisibleMessage
|
|
69
|
-
} from "./server-
|
|
69
|
+
} from "./server-rcchadw0.js";
|
|
70
70
|
import {
|
|
71
71
|
withReadOnlySessionDb
|
|
72
|
-
} from "./server-
|
|
72
|
+
} from "./server-7vrtk78d.js";
|
|
73
73
|
import {
|
|
74
74
|
BoundedSessionMap,
|
|
75
75
|
getMeasuredToolDefinitionTokens
|
|
76
|
-
} from "./server-
|
|
76
|
+
} from "./server-kgq2e2hh.js";
|
|
77
77
|
import {
|
|
78
78
|
layoutLkgPrefix,
|
|
79
79
|
assembleLkgPrefix
|
|
80
|
-
} from "./server-
|
|
80
|
+
} from "./server-58h6rrnx.js";
|
|
81
81
|
import {
|
|
82
82
|
gaDatabasePath2,
|
|
83
83
|
V2StoreReader2
|
|
@@ -94,7 +94,7 @@ import {
|
|
|
94
94
|
} from "./server-avwt563y.js";
|
|
95
95
|
import {
|
|
96
96
|
logSlowWriteTransaction
|
|
97
|
-
} from "./server-
|
|
97
|
+
} from "./server-np27dgyt.js";
|
|
98
98
|
import {
|
|
99
99
|
ensurePrivateStorageDirectorySync,
|
|
100
100
|
writeStorageFileSync,
|
|
@@ -589,6 +589,57 @@ import { createHash as createHash6 } from "node:crypto";
|
|
|
589
589
|
import { createHash as createHash4 } from "node:crypto";
|
|
590
590
|
|
|
591
591
|
// src/shared/provider-response-completion.ts
|
|
592
|
+
var SERVER_FALLBACK_USAGE_SIGNATURE_PREFIX = "cortexkit-server-fallback-usage-v1:";
|
|
593
|
+
var SERVER_FALLBACK_SIGNATURE_PREFIX = "cortexkit-server-fallback-v1:";
|
|
594
|
+
function parseServerFallbackInputTokens(json) {
|
|
595
|
+
try {
|
|
596
|
+
const payload = JSON.parse(json);
|
|
597
|
+
if (!isRecord(payload) || !Array.isArray(payload.iterations))
|
|
598
|
+
return;
|
|
599
|
+
let last;
|
|
600
|
+
for (const entry of payload.iterations) {
|
|
601
|
+
if (isRecord(entry) && entry.type === "fallback_message")
|
|
602
|
+
last = entry;
|
|
603
|
+
}
|
|
604
|
+
if (!isRecord(last))
|
|
605
|
+
return;
|
|
606
|
+
const counts = [
|
|
607
|
+
last.input_tokens,
|
|
608
|
+
last.cache_read_input_tokens ?? 0,
|
|
609
|
+
last.cache_creation_input_tokens ?? 0
|
|
610
|
+
];
|
|
611
|
+
if (!counts.every((count) => typeof count === "number" && Number.isFinite(count) && count >= 0))
|
|
612
|
+
return;
|
|
613
|
+
const inputTokens = counts.reduce((sum, count) => sum + Number(count), 0);
|
|
614
|
+
return Number.isFinite(inputTokens) ? inputTokens : undefined;
|
|
615
|
+
} catch {
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
function readServerFallbackUsage(content) {
|
|
620
|
+
if (!Array.isArray(content))
|
|
621
|
+
return;
|
|
622
|
+
let boundary = false;
|
|
623
|
+
let invalidUsage = false;
|
|
624
|
+
for (const part of content) {
|
|
625
|
+
if (!isRecord(part) || part.type !== "reasoning")
|
|
626
|
+
continue;
|
|
627
|
+
for (const location of [part.native, part.state]) {
|
|
628
|
+
if (!isRecord(location) || typeof location.signature !== "string")
|
|
629
|
+
continue;
|
|
630
|
+
const signature = location.signature;
|
|
631
|
+
if (signature.startsWith(SERVER_FALLBACK_USAGE_SIGNATURE_PREFIX)) {
|
|
632
|
+
const inputTokens = parseServerFallbackInputTokens(signature.slice(SERVER_FALLBACK_USAGE_SIGNATURE_PREFIX.length));
|
|
633
|
+
if (inputTokens !== undefined)
|
|
634
|
+
return { kind: "usage", inputTokens };
|
|
635
|
+
invalidUsage = true;
|
|
636
|
+
} else if (signature.startsWith(SERVER_FALLBACK_SIGNATURE_PREFIX)) {
|
|
637
|
+
boundary = true;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
return boundary || invalidUsage ? { kind: "boundary", invalidUsage } : undefined;
|
|
642
|
+
}
|
|
592
643
|
function providerResponseFailed(input) {
|
|
593
644
|
if (input.error !== undefined && input.error !== null && input.error !== "")
|
|
594
645
|
return true;
|
|
@@ -4551,4 +4602,4 @@ var ERROR_CLASSES = new Set([
|
|
|
4551
4602
|
"permission_denied",
|
|
4552
4603
|
"unknown"
|
|
4553
4604
|
]);
|
|
4554
|
-
export { COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, advanceSessionActivity, backfillSessionActivity, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, lkgInputIdentity, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
|
|
4605
|
+
export { COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, readServerFallbackUsage, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, advanceSessionActivity, backfillSessionActivity, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, lkgInputIdentity, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./server-gzy5w8ya.js";
|
|
6
6
|
import {
|
|
7
7
|
runSessionWarmupWorker
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-rz5jnhnv.js";
|
|
9
9
|
import {
|
|
10
10
|
logSlowWriteTransaction
|
|
11
|
-
} from "./server-
|
|
11
|
+
} from "./server-np27dgyt.js";
|
|
12
12
|
|
|
13
13
|
// src/features/magic-context/message-fts-rowid-map.ts
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
readFileSync,
|
|
19
19
|
readlinkSync,
|
|
20
20
|
realpathSync,
|
|
21
|
+
unlinkSync,
|
|
21
22
|
writeFileSync
|
|
22
23
|
} from "node:fs";
|
|
23
24
|
import * as os from "node:os";
|
|
@@ -43,29 +44,31 @@ function getMagicContextLogPath(harness = getHarness2()) {
|
|
|
43
44
|
function getProjectMagicContextDir(directory) {
|
|
44
45
|
return path.join(directory, ".cortexkit", "magic-context");
|
|
45
46
|
}
|
|
46
|
-
var GITIGNORE_GUARD_OPEN = "# >>> cortexkit:magic-context";
|
|
47
|
-
var GITIGNORE_GUARD_CLOSE = "# <<< cortexkit:magic-context";
|
|
48
47
|
function ensureCortexKitArtifactGitignore(directory) {
|
|
49
48
|
try {
|
|
50
|
-
const
|
|
51
|
-
const gitignorePath = path.join(
|
|
52
|
-
|
|
53
|
-
if (existsSync(gitignorePath))
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
const artifactDir = getProjectMagicContextDir(directory);
|
|
50
|
+
const gitignorePath = path.join(artifactDir, ".gitignore");
|
|
51
|
+
mkdirSync(artifactDir, { recursive: true });
|
|
52
|
+
if (!existsSync(gitignorePath) || readFileSync(gitignorePath, "utf8") !== `*
|
|
53
|
+
`) {
|
|
54
|
+
writeFileSync(gitignorePath, `*
|
|
55
|
+
`, "utf8");
|
|
57
56
|
}
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
const sharedPath = path.join(directory, ".cortexkit", ".gitignore");
|
|
58
|
+
if (!existsSync(sharedPath))
|
|
59
|
+
return;
|
|
60
|
+
const existing = readFileSync(sharedPath).toString("latin1");
|
|
61
|
+
const next = existing.replace(/^# >>> cortexkit:magic-context\r?\n(?:(?!^# (?:>>>|<<<) cortexkit:)[\s\S])*?^# <<< cortexkit:magic-context(?:\r?\n|$)/gm, "");
|
|
62
|
+
if (next === existing)
|
|
63
|
+
return;
|
|
64
|
+
const remaining = Buffer.from(next, "latin1");
|
|
65
|
+
if (remaining.toString("utf8").trim() === "")
|
|
66
|
+
unlinkSync(sharedPath);
|
|
67
|
+
else
|
|
68
|
+
writeFileSync(sharedPath, remaining);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
log2("Failed to ensure project artifact gitignore", { directory, error: String(error) });
|
|
71
|
+
}
|
|
69
72
|
}
|
|
70
73
|
function getProjectMagicContextHistorianDir(directory) {
|
|
71
74
|
return path.join(getProjectMagicContextDir(directory), "historian");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-0ms13pc8.js";
|
|
4
4
|
import {
|
|
5
5
|
getHarness2
|
|
6
6
|
} from "./server-pavzsdc6.js";
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
getMagicContextStorageDir,
|
|
9
9
|
importPluginModule,
|
|
10
10
|
log2
|
|
11
|
-
} from "./server-
|
|
11
|
+
} from "./server-bb6kf05j.js";
|
|
12
12
|
import {
|
|
13
13
|
getSynapseLaneIdentity
|
|
14
|
-
} from "./server-
|
|
14
|
+
} from "./server-mxsy9h1d.js";
|
|
15
15
|
import {
|
|
16
16
|
inRootAsyncContext2
|
|
17
17
|
} from "./server-gzy5w8ya.js";
|
|
@@ -645,6 +645,7 @@ function getEmbeddingProviderIdentity(config) {
|
|
|
645
645
|
throw new Error("Unknown embedding provider");
|
|
646
646
|
}
|
|
647
647
|
const truncate = config.provider === "openai-compatible" ? config.truncate?.trim() : undefined;
|
|
648
|
+
const dimensions = config.provider === "openai-compatible" ? config.dimensions : undefined;
|
|
648
649
|
const documentPrefix = config.provider === "openai-compatible" ? resolveEmbeddingTextPrefixes(config.model, config.query_instruction, config.document_prefix).documentPrefix : "";
|
|
649
650
|
const localDtype = config.provider === "local" && config.local_dtype && config.local_dtype !== "fp32" ? config.local_dtype : undefined;
|
|
650
651
|
const localPooling = config.provider === "local" ? getCachedLocalEmbeddingPooling(config.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL) : null;
|
|
@@ -656,7 +657,8 @@ function getEmbeddingProviderIdentity(config) {
|
|
|
656
657
|
apiKeyPresent: Boolean(config.api_key?.trim()),
|
|
657
658
|
inputType: config.input_type?.trim() || "",
|
|
658
659
|
...documentPrefix ? { documentPrefix } : {},
|
|
659
|
-
...truncate ? { truncate } : {}
|
|
660
|
+
...truncate ? { truncate } : {},
|
|
661
|
+
...dimensions ? { dimensions } : {}
|
|
660
662
|
} : {
|
|
661
663
|
provider: "local",
|
|
662
664
|
model: config.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL,
|