@cortexkit/opencode-magic-context 0.49.20 → 0.49.22
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/auto-search-worker.js +6 -6
- package/dist/chunk-embedding-write-worker.js +9 -9
- package/dist/{compaction-marker-candidates-b2q30cft.js → compaction-marker-candidates-31h86ph0.js} +2 -2
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/{compartment-chunk-embedding-va090as0.js → compartment-chunk-embedding-he60aaa2.js} +5 -5
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +37 -3
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-frp3z2wk.js → conflict-warning-hook-2r32hyx6.js} +5 -5
- package/dist/{context-mkece1db.js → context-j7hp43a0.js} +153 -83
- package/dist/{embedding-backfill-gy3p78py.js → embedding-backfill-dtke6tck.js} +11 -11
- package/dist/embedding-worker-process.js +1 -1
- package/dist/embedding-worker.js +4 -4
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts +1 -0
- package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-synapse.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts +7 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +7 -2
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +2 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/search-rerank.d.ts +9 -2
- package/dist/features/magic-context/search-rerank.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +2 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +2 -0
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +1 -0
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/served-shape-repair.d.ts +19 -0
- package/dist/hooks/magic-context/served-shape-repair.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-content.d.ts +4 -2
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-content-primitives.d.ts +1 -1
- package/dist/hooks/magic-context/tag-content-primitives.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +2 -1
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/text-complete.d.ts +1 -1
- package/dist/hooks/magic-context/text-complete.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +2 -2
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-t7hx3qcb.js → index-11gzxvf4.js} +101 -46
- package/dist/{index-neb2jaed.js → index-1gtfne2c.js} +1 -1
- package/dist/{index-67nyj0gy.js → index-1kbznkft.js} +48 -24
- package/dist/{index-1pefp8ar.js → index-3svaejkh.js} +4 -4
- package/dist/{index-0wthn7fp.js → index-51rdvtkz.js} +35 -4
- package/dist/{index-kc9pn495.js → index-66eby7hx.js} +1 -1
- package/dist/{index-pnjwa6qa.js → index-9q1g3c5q.js} +2 -2
- package/dist/{index-rmd0069m.js → index-a9zvn5fe.js} +24 -10
- package/dist/{index-jfh3cktr.js → index-ffzhwfzy.js} +3 -3
- package/dist/{v2/server-1zx2pa5d.js → index-gzy5w8ya.js} +193 -4
- package/dist/{index-d6rp4dxh.js → index-j32jj2t8.js} +4 -4
- package/dist/{index-35qc6606.js → index-jfem3dgz.js} +1 -1
- package/dist/{index-y4a3nhtk.js → index-jjvbk92s.js} +1 -1
- package/dist/{index-4n7w9rad.js → index-jmq8kfe7.js} +5 -5
- package/dist/{index-c4b76d4t.js → index-kfyb3k6n.js} +1 -1
- package/dist/{index-vkc1ca9p.js → index-kq5w68dp.js} +1 -1
- package/dist/{index-11zf2wwc.js → index-ksq50rg0.js} +2 -2
- package/dist/{index-153r2q6z.js → index-m32esgmj.js} +2 -2
- package/dist/{index-x4k3f4mf.js → index-mnhcdfxg.js} +148 -8
- package/dist/{index-48stjd56.js → index-mnnkgq0q.js} +10 -4
- package/dist/{index-wgypt3cs.js → index-nxrsns5x.js} +2466 -1290
- package/dist/{index-616rsjrv.js → index-qgh1qwjj.js} +1 -1
- package/dist/{index-jr5na10t.js → index-rxqr723x.js} +4 -4
- package/dist/{index-dc8hy95c.js → index-syaazvy2.js} +123 -40
- package/dist/{index-adk2z5d8.js → index-wfybj1dw.js} +2 -4
- package/dist/{index-305y133n.js → index-whcgcfrv.js} +6 -3
- package/dist/{index-jmycsey7.js → index-x6cbrv9h.js} +2 -2
- package/dist/{index-v7r4td4c.js → index-y76rhsnr.js} +28 -17
- package/dist/{index-2yhtnfcf.js → index-zy67whjr.js} +26 -8
- package/dist/index.js +43 -42
- package/dist/{message-fts-rowid-map-22tevnnj.js → message-fts-rowid-map-e79b7b6x.js} +3 -3
- package/dist/{message-index-5qxcz6h7.js → message-index-4q8ek2fc.js} +10 -10
- package/dist/{message-index-bounded-n0m0t7tv.js → message-index-bounded-rydsg9r5.js} +10 -10
- package/dist/{message-time-backfill-0myx7fz3.js → message-time-backfill-4qva0b4f.js} +1 -1
- package/dist/migration-worker.js +6 -6
- package/dist/plugin/embedding-bootstrap.d.ts +1 -0
- package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts +1 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{project-embedding-registry-s2pqgec9.js → project-embedding-registry-hn529988.js} +12 -10
- package/dist/raw-ordinal-warmup-worker.js +8 -8
- package/dist/{read-session-chunk-0a8vdyqp.js → read-session-chunk-t039f0m5.js} +6 -6
- package/dist/{read-session-raw-y5cszf0b.js → read-session-raw-aw6jgvwg.js} +2 -2
- package/dist/{recomp-orchestrator-61vyha9j.js → recomp-orchestrator-hbm53jj5.js} +23 -23
- package/dist/{search-archive-8q9s49p5.js → search-archive-weh164mh.js} +7 -7
- package/dist/{search-v1y9ejws.js → search-hea079d7.js} +19 -19
- package/dist/{send-session-notification-0k6qzydk.js → send-session-notification-gqzkz7da.js} +4 -4
- package/dist/shared/sqlite.d.ts +5 -0
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts +2 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/{sqlite-1rpvw2rj.js → sqlite-zdgm52sv.js} +5 -1
- package/dist/{storage-memory-nm7v82mj.js → storage-memory-e6a7mb0k.js} +2 -2
- package/dist/{storage-tags-r6nk29n4.js → storage-tags-a77q4v77.js} +2 -2
- package/dist/tools/ctx-search/tools.d.ts.map +1 -1
- package/dist/tools/ctx-search/types.d.ts +1 -0
- package/dist/tools/ctx-search/types.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-vtrgb7m6.js → transform-postprocess-phase-0b04tm1p.js} +23 -23
- package/dist/v2/auto-search-worker.js +6 -6
- package/dist/v2/chunk-embedding-write-worker.js +11 -11
- package/dist/v2/{compaction-marker-candidates-cfab70cs.js → compaction-marker-candidates-m4vmye3w.js} +2 -2
- package/dist/v2/compaction-marker-candidates-worker.js +2 -2
- package/dist/v2/{compartment-chunk-embedding-nbdqx1td.js → compartment-chunk-embedding-8jjmcgeg.js} +5 -5
- package/dist/v2/{context-cc33tv2z.js → context-ea3x7smm.js} +652 -468
- package/dist/v2/{embedding-backfill-yxv2h5mc.js → embedding-backfill-5e74ae0m.js} +11 -11
- package/dist/v2/embedding-worker-process.js +1 -1
- package/dist/v2/embedding-worker.js +4 -4
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/copied-tag-notation.d.ts +1 -1
- package/dist/v2/hooks/copied-tag-notation.d.ts.map +1 -1
- package/dist/v2/hooks/dream-timer.d.ts +2 -0
- package/dist/v2/hooks/dream-timer.d.ts.map +1 -1
- package/dist/v2/hooks/embedding-lifecycle.d.ts +7 -0
- package/dist/v2/hooks/embedding-lifecycle.d.ts.map +1 -0
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts +2 -0
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/hooks/tools.d.ts +2 -1
- package/dist/v2/hooks/tools.d.ts.map +1 -1
- package/dist/v2/hooks/transform-features.d.ts +2 -2
- package/dist/v2/hooks/transform-features.d.ts.map +1 -1
- package/dist/v2/{message-fts-rowid-map-dg12wymk.js → message-fts-rowid-map-n8fdg2ja.js} +3 -3
- package/dist/v2/{message-index-bounded-f4e01xk0.js → message-index-bounded-8rcd7qq9.js} +12 -12
- package/dist/v2/{message-index-ydzrp6y6.js → message-index-qz9wdp82.js} +12 -12
- package/dist/v2/{message-time-backfill-ddh8n9gy.js → message-time-backfill-zvthw6xb.js} +1 -1
- package/dist/v2/migration-worker.js +8 -8
- package/dist/v2/{project-embedding-registry-deza9ksw.js → project-embedding-registry-v38q4xd5.js} +12 -10
- package/dist/v2/raw-ordinal-warmup-worker.js +8 -8
- package/dist/v2/{read-session-chunk-8cxfagky.js → read-session-chunk-wazfyxcg.js} +8 -8
- package/dist/v2/{read-session-raw-1nrrecvx.js → read-session-raw-b70cpwzj.js} +2 -2
- package/dist/v2/{recomp-orchestrator-47m4hv5g.js → recomp-orchestrator-b12zaptj.js} +25 -25
- package/dist/v2/{search-archive-e80cvc09.js → search-archive-x64rtz1z.js} +9 -9
- package/dist/v2/{search-fjz746zr.js → search-hza9x72a.js} +21 -21
- package/dist/v2/{send-session-notification-nwvrv34d.js → send-session-notification-8eqe259v.js} +4 -4
- package/dist/v2/{server-4sxjs6hn.js → server-132h8twc.js} +4 -4
- package/dist/v2/{server-271qxsf5.js → server-24g8r2d0.js} +2466 -1290
- package/dist/v2/{server-m91f9m5s.js → server-33nqbqkw.js} +123 -40
- package/dist/v2/{server-brj8j2gk.js → server-3vhxy2k5.js} +1 -1
- package/dist/v2/{server-55rgxfrw.js → server-4kjmrjn4.js} +1 -1
- package/dist/v2/{server-wyawsa88.js → server-62g58aaz.js} +2 -2
- package/dist/v2/{server-230fnbws.js → server-6v3cdzsx.js} +1 -1
- package/dist/v2/{server-ygtykank.js → server-806rzhs6.js} +1 -1
- package/dist/v2/{server-5arr9ecn.js → server-94wk1ey3.js} +12 -1
- package/dist/v2/{server-af2pght7.js → server-ab1g0wn9.js} +2 -4
- package/dist/v2/{server-0epqaxhd.js → server-ad18djzs.js} +26 -8
- package/dist/v2/{server-4nw4fqhr.js → server-bsgd4dk1.js} +1 -1
- package/dist/v2/{server-dj7tz4ph.js → server-d1dzgvwd.js} +1 -1
- package/dist/v2/{server-vn2nwcv6.js → server-d48x3m4x.js} +4 -4
- package/dist/v2/{server-br1x0tev.js → server-dtp8hcjh.js} +2 -2
- package/dist/v2/{server-a3dwxfgd.js → server-fa7vtp40.js} +7 -4
- package/dist/{index-1zx2pa5d.js → v2/server-gzy5w8ya.js} +193 -4
- package/dist/v2/{server-hqzyq8n4.js → server-j8h7bsca.js} +26 -12
- package/dist/v2/{server-y4a3nhtk.js → server-jjvbk92s.js} +1 -1
- package/dist/v2/{server-ej96a39v.js → server-m4bfaevz.js} +1186 -1046
- package/dist/v2/{server-63fqdghs.js → server-ppcd1qxh.js} +92 -86
- package/dist/v2/{server-ne8arh8t.js → server-qjvk4a9t.js} +1 -1
- package/dist/v2/{server-xsryvyf6.js → server-qteg2kt9.js} +4 -4
- package/dist/v2/{server-168pb207.js → server-rqebawx1.js} +1 -1
- package/dist/v2/{server-j4jnp9b5.js → server-vr4szghm.js} +35 -4
- package/dist/v2/{server-9x0kmta4.js → server-wwaw5npa.js} +3 -3
- package/dist/v2/{server-c7dxxsj7.js → server-zg5y109h.js} +33 -33
- package/dist/v2/server.js +6 -6
- package/dist/v2/{sqlite-1rpvw2rj.js → sqlite-zdgm52sv.js} +5 -1
- package/dist/v2/{storage-memory-nm7v82mj.js → storage-memory-e6a7mb0k.js} +2 -2
- package/dist/v2/{storage-tags-ss08kj5r.js → storage-tags-q71rnr9f.js} +3 -3
- package/dist/v2/store-reader.d.ts +2 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-639whfhq.js → wrapup-orchestrator-3ssd5yy1.js} +25 -25
- package/dist/wrapup-orchestrator-5vpcd1zx.js +49 -0
- package/package.json +2 -2
- package/src/config/index.test.ts +44 -0
- package/src/config/project-security.ts +15 -0
- package/src/config/rerank.test.ts +60 -0
- package/src/config/schema/magic-context.ts +57 -0
- package/src/shared/model-suggestion-retry.ts +1 -1
- package/src/shared/sqlite-turn-deadline.test.ts +270 -0
- package/src/shared/sqlite.ts +235 -7
- package/src/shared/tag-transcript.ts +9 -1
- package/dist/wrapup-orchestrator-mnvt2g8m.js +0 -49
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-nxrsns5x.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
6
|
} from "./index-h7tgn49j.js";
|
|
7
7
|
import {
|
|
8
8
|
isSynapseEmbeddingTruncated,
|
|
9
9
|
SynapseEmbeddingProvider
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-wfybj1dw.js";
|
|
11
11
|
import {
|
|
12
12
|
LocalEmbeddingProvider
|
|
13
|
-
} from "./index-
|
|
13
|
+
} from "./index-51rdvtkz.js";
|
|
14
14
|
import {
|
|
15
15
|
OpenAICompatibleEmbeddingProvider,
|
|
16
16
|
getProjectEmbeddingSnapshot2,
|
|
17
17
|
embedBatchForProject2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-zy67whjr.js";
|
|
19
19
|
import {
|
|
20
20
|
isEmbeddingHostBusy2
|
|
21
21
|
} from "./index-qt1qqasc.js";
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
StaleRouteHandleError,
|
|
7
7
|
SubcClient,
|
|
8
8
|
isConsumerReconnectTransient
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-wfybj1dw.js";
|
|
10
10
|
import {
|
|
11
11
|
getHarness2
|
|
12
12
|
} from "./index-pavzsdc6.js";
|
|
@@ -18,13 +18,13 @@ import {
|
|
|
18
18
|
} from "./index-h7tgn49j.js";
|
|
19
19
|
import {
|
|
20
20
|
inRootAsyncContext2
|
|
21
|
-
} from "./index-
|
|
21
|
+
} from "./index-gzy5w8ya.js";
|
|
22
22
|
import {
|
|
23
23
|
buildCanonicalChunkTextFromFts2,
|
|
24
24
|
loadCompartmentChunkEmbeddingsForSearch2,
|
|
25
25
|
peekCompartmentChunkSearchPool2,
|
|
26
26
|
warmCompartmentChunkSearchPool2
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-m32esgmj.js";
|
|
28
28
|
import {
|
|
29
29
|
recordEmbeddingMeasurement,
|
|
30
30
|
saveCommitEmbedding,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
enqueueShadowEmbeddingItems2,
|
|
42
42
|
getProjectEmbeddingSnapshot2,
|
|
43
43
|
embedItemsForProject2
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-zy67whjr.js";
|
|
45
45
|
import {
|
|
46
46
|
getProjectEmbeddings2
|
|
47
47
|
} from "./index-4dhv7mqz.js";
|
|
@@ -50,13 +50,13 @@ import {
|
|
|
50
50
|
isEmbeddingEnabled,
|
|
51
51
|
embedText,
|
|
52
52
|
ensureMemoryEmbeddings2
|
|
53
|
-
} from "./index-
|
|
53
|
+
} from "./index-rxqr723x.js";
|
|
54
54
|
import {
|
|
55
55
|
ModuleMemoryAuthorityError2,
|
|
56
56
|
getMemoriesByProject2,
|
|
57
57
|
getMemoriesByProjects2,
|
|
58
58
|
updateMemoryRetrievalCount2
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-jjvbk92s.js";
|
|
60
60
|
import {
|
|
61
61
|
USER_FACING_FAILURES,
|
|
62
62
|
getNotes,
|
|
@@ -65,27 +65,27 @@ import {
|
|
|
65
65
|
sanitizeFtsQuery,
|
|
66
66
|
searchMemoriesFTS,
|
|
67
67
|
searchMemoriesFTSUnion
|
|
68
|
-
} from "./index-
|
|
68
|
+
} from "./index-3svaejkh.js";
|
|
69
69
|
import {
|
|
70
70
|
cleanSearchText,
|
|
71
71
|
keywordRelevance,
|
|
72
72
|
matchedSearchSnippet,
|
|
73
73
|
getIndexedMessageCorpusSize2
|
|
74
|
-
} from "./index-
|
|
74
|
+
} from "./index-mnnkgq0q.js";
|
|
75
75
|
import {
|
|
76
76
|
MESSAGE_FTS_SESSION_FILTER_SQL,
|
|
77
77
|
withMessageFtsSessionFilter
|
|
78
78
|
} from "./index-kaqs6h31.js";
|
|
79
79
|
import {
|
|
80
80
|
isRecord
|
|
81
|
-
} from "./index-
|
|
81
|
+
} from "./index-whcgcfrv.js";
|
|
82
82
|
import {
|
|
83
83
|
resolveWorkspaceShareCategories,
|
|
84
84
|
resolveWorkspaceIdentitySet,
|
|
85
85
|
expandWorkspaceIdentitySetWithAliases,
|
|
86
86
|
resolveStoredPathWorkspaceIdentity,
|
|
87
87
|
sourceNameForMemory
|
|
88
|
-
} from "./index-
|
|
88
|
+
} from "./index-9q1g3c5q.js";
|
|
89
89
|
import {
|
|
90
90
|
isKnownAutocommit
|
|
91
91
|
} from "./index-8ajstryz.js";
|
|
@@ -1429,6 +1429,7 @@ function sha256(value) {
|
|
|
1429
1429
|
var RERANK_MODEL = "gte-reranker-modernbert-base-f32";
|
|
1430
1430
|
var RERANK_LANE_LIMIT = 25;
|
|
1431
1431
|
var DEADLINE_MS = 1500;
|
|
1432
|
+
var DOCUMENT_BYTES = 1024;
|
|
1432
1433
|
function isProseQuery(query) {
|
|
1433
1434
|
const text = query.trim();
|
|
1434
1435
|
if (!text || /[\n;]|^["'`]|["'`]$/.test(text))
|
|
@@ -1508,7 +1509,7 @@ function candidateText(location, title, body) {
|
|
|
1508
1509
|
${truncateUtf8(title.replaceAll(`
|
|
1509
1510
|
`, " "), 120)}
|
|
1510
1511
|
`;
|
|
1511
|
-
return header + truncateUtf8(body,
|
|
1512
|
+
return header + truncateUtf8(body, DOCUMENT_BYTES - Buffer.byteLength(header));
|
|
1512
1513
|
}
|
|
1513
1514
|
|
|
1514
1515
|
class RerankFailure extends Error {
|
|
@@ -1578,7 +1579,79 @@ async function connect(connectionFile) {
|
|
|
1578
1579
|
}
|
|
1579
1580
|
return bounded(connection);
|
|
1580
1581
|
}
|
|
1581
|
-
async function
|
|
1582
|
+
async function remoteScores(config, query, documents, signal) {
|
|
1583
|
+
const controller = new AbortController;
|
|
1584
|
+
let timer;
|
|
1585
|
+
let onAbort;
|
|
1586
|
+
try {
|
|
1587
|
+
const cancelled = new Promise((_, reject) => {
|
|
1588
|
+
const cancel = (reason) => {
|
|
1589
|
+
reject(new RerankFailure(reason));
|
|
1590
|
+
controller.abort();
|
|
1591
|
+
};
|
|
1592
|
+
onAbort = () => cancel("aborted");
|
|
1593
|
+
if (signal?.aborted)
|
|
1594
|
+
onAbort();
|
|
1595
|
+
else
|
|
1596
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1597
|
+
timer = setTimeout(() => cancel("timeout"), Math.max(50, Math.min(15000, config.timeout_ms ?? DEADLINE_MS)));
|
|
1598
|
+
});
|
|
1599
|
+
const request = async () => {
|
|
1600
|
+
const tei = config.endpoint?.startsWith("tei+");
|
|
1601
|
+
const endpoint = (tei ? config.endpoint?.slice(4) : config.endpoint)?.replace(/\/+$/, "");
|
|
1602
|
+
if (!endpoint || !/^https?:\/\//.test(endpoint))
|
|
1603
|
+
throw new RerankFailure("invalid_endpoint");
|
|
1604
|
+
const response = await fetch(`${endpoint}/rerank`, {
|
|
1605
|
+
method: "POST",
|
|
1606
|
+
headers: {
|
|
1607
|
+
"Content-Type": "application/json",
|
|
1608
|
+
...config.api_key ? { Authorization: `Bearer ${config.api_key}` } : {}
|
|
1609
|
+
},
|
|
1610
|
+
body: JSON.stringify(tei ? { query, texts: documents } : {
|
|
1611
|
+
model: config.model,
|
|
1612
|
+
query,
|
|
1613
|
+
documents,
|
|
1614
|
+
top_n: documents.length
|
|
1615
|
+
}),
|
|
1616
|
+
signal: controller.signal,
|
|
1617
|
+
redirect: "error"
|
|
1618
|
+
});
|
|
1619
|
+
if (!response.ok)
|
|
1620
|
+
throw new RerankFailure(`http_${response.status}`);
|
|
1621
|
+
const body = await response.json();
|
|
1622
|
+
const rows = tei ? body : body?.results;
|
|
1623
|
+
if (!Array.isArray(rows) || rows.length !== documents.length)
|
|
1624
|
+
throw new RerankFailure("invalid_reply");
|
|
1625
|
+
const scores = new Array(documents.length);
|
|
1626
|
+
const seen = new Set;
|
|
1627
|
+
for (const row of rows) {
|
|
1628
|
+
const index = row?.index;
|
|
1629
|
+
const score = tei ? row?.score : row?.relevance_score;
|
|
1630
|
+
if (!Number.isInteger(index) || index < 0 || index >= documents.length || seen.has(index) || typeof score !== "number" || !Number.isFinite(score))
|
|
1631
|
+
throw new RerankFailure("invalid_reply");
|
|
1632
|
+
seen.add(index);
|
|
1633
|
+
scores[index] = score;
|
|
1634
|
+
}
|
|
1635
|
+
return scores;
|
|
1636
|
+
};
|
|
1637
|
+
return await Promise.race([cancelled, request()]);
|
|
1638
|
+
} finally {
|
|
1639
|
+
clearTimeout(timer);
|
|
1640
|
+
if (onAbort)
|
|
1641
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1642
|
+
}
|
|
1643
|
+
}
|
|
1644
|
+
function remoteRerankSkipped(reason, onSkipped) {
|
|
1645
|
+
const safe = /^(?:invalid_reply|invalid_endpoint|validation|timeout|aborted|candidate_validation|http_\d{3})$/.test(reason) ? reason : "remote_error";
|
|
1646
|
+
const line = `Reranking skipped: ${safe}`;
|
|
1647
|
+
logRerankFallback(safe);
|
|
1648
|
+
onSkipped?.(line);
|
|
1649
|
+
}
|
|
1650
|
+
async function prepareReranker(projectRoot, sessionId, connectionFile, injectedClient, config) {
|
|
1651
|
+
if (config?.provider === "off")
|
|
1652
|
+
return null;
|
|
1653
|
+
if (config?.provider === "remote")
|
|
1654
|
+
return { remote: config };
|
|
1582
1655
|
try {
|
|
1583
1656
|
if (injectedClient === null)
|
|
1584
1657
|
throw new RerankFailure("missing_synapse");
|
|
@@ -1595,36 +1668,43 @@ async function prepareReranker(projectRoot, sessionId, connectionFile, injectedC
|
|
|
1595
1668
|
return null;
|
|
1596
1669
|
}
|
|
1597
1670
|
}
|
|
1598
|
-
async function rerankSearchResults(session, query, baseline, pool, texts, limit) {
|
|
1671
|
+
async function rerankSearchResults(session, query, baseline, pool, texts, limit, signal, onSkipped) {
|
|
1599
1672
|
if (!pool.length)
|
|
1600
1673
|
return baseline;
|
|
1601
1674
|
try {
|
|
1602
|
-
if (pool.length > 20 || texts.length !== pool.length || texts.some((text) => Buffer.byteLength(text) >
|
|
1603
|
-
throw new RerankFailure("validation");
|
|
1604
|
-
const body = unwrap(await bounded(session.client.call("synapse", "rerank.score", {
|
|
1605
|
-
model: RERANK_MODEL,
|
|
1606
|
-
query,
|
|
1607
|
-
candidates: texts,
|
|
1608
|
-
required_fingerprint: session.lane.fingerprint,
|
|
1609
|
-
allow_equivalent: false,
|
|
1610
|
-
accept_declared: false,
|
|
1611
|
-
max_queue_ms: 100,
|
|
1612
|
-
deadline_ms: DEADLINE_MS
|
|
1613
|
-
}, {
|
|
1614
|
-
timeoutMs: DEADLINE_MS,
|
|
1615
|
-
targetKind: "management_surface",
|
|
1616
|
-
identity: session.identity
|
|
1617
|
-
})));
|
|
1618
|
-
if (body.fingerprint !== session.lane.fingerprint)
|
|
1619
|
-
throw new RerankFailure("fingerprint_mismatch");
|
|
1620
|
-
if (body.table_epoch !== session.lane.tableEpoch)
|
|
1621
|
-
throw new RerankFailure("epoch_mismatch");
|
|
1622
|
-
if (!Array.isArray(body.scores) || body.scores.length !== pool.length || body.scores.some((score) => typeof score !== "number" || !Number.isFinite(score)))
|
|
1675
|
+
if (pool.length > 20 || texts.length !== pool.length || texts.some((text) => Buffer.byteLength(text) > DOCUMENT_BYTES))
|
|
1623
1676
|
throw new RerankFailure("validation");
|
|
1624
|
-
|
|
1677
|
+
let scores;
|
|
1678
|
+
if ("remote" in session) {
|
|
1679
|
+
scores = await remoteScores(session.remote, query, texts, signal);
|
|
1680
|
+
} else {
|
|
1681
|
+
const body = unwrap(await bounded(session.client.call("synapse", "rerank.score", {
|
|
1682
|
+
model: RERANK_MODEL,
|
|
1683
|
+
query,
|
|
1684
|
+
candidates: texts,
|
|
1685
|
+
required_fingerprint: session.lane.fingerprint,
|
|
1686
|
+
allow_equivalent: false,
|
|
1687
|
+
max_queue_ms: 100,
|
|
1688
|
+
deadline_ms: DEADLINE_MS
|
|
1689
|
+
}, {
|
|
1690
|
+
timeoutMs: DEADLINE_MS,
|
|
1691
|
+
targetKind: "management_surface",
|
|
1692
|
+
identity: session.identity
|
|
1693
|
+
})));
|
|
1694
|
+
if (body.fingerprint !== session.lane.fingerprint)
|
|
1695
|
+
throw new RerankFailure("fingerprint_mismatch");
|
|
1696
|
+
if (body.table_epoch !== session.lane.tableEpoch)
|
|
1697
|
+
throw new RerankFailure("epoch_mismatch");
|
|
1698
|
+
if (!Array.isArray(body.scores) || body.scores.length !== pool.length || body.scores.some((score) => typeof score !== "number" || !Number.isFinite(score)))
|
|
1699
|
+
throw new RerankFailure("validation");
|
|
1700
|
+
scores = body.scores;
|
|
1701
|
+
}
|
|
1625
1702
|
return pool.map((hit, index) => ({ hit, index, score: scores[index] })).sort((a, b) => b.score - a.score || a.index - b.index).slice(0, limit).map((row) => row.hit);
|
|
1626
1703
|
} catch (error) {
|
|
1627
|
-
|
|
1704
|
+
if ("remote" in session)
|
|
1705
|
+
remoteRerankSkipped(error instanceof RerankFailure ? error.reason : "remote_error", onSkipped);
|
|
1706
|
+
else
|
|
1707
|
+
logRerankFallback(reasonOf(error));
|
|
1628
1708
|
return baseline;
|
|
1629
1709
|
}
|
|
1630
1710
|
}
|
|
@@ -2945,7 +3025,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
2945
3025
|
return [];
|
|
2946
3026
|
}
|
|
2947
3027
|
const limit = normalizeLimit(options.limit);
|
|
2948
|
-
const reranker = options.explicitSearch && options.rerank !== false && isProseQuery(trimmedQuery) ? await prepareReranker(projectPath, sessionId, options.rerankConnectionFile, options.rerankClient) : null;
|
|
3028
|
+
const reranker = options.explicitSearch && options.rerank !== false && isProseQuery(trimmedQuery) ? await prepareReranker(projectPath, sessionId, options.rerankConnectionFile, options.rerankClient, options.rerankConfig) : null;
|
|
2949
3029
|
const lanes = reranker || options.captureRerankLanes ? emptySearchLanes() : undefined;
|
|
2950
3030
|
const dateRange = normalizeDateRange(options.from, options.to);
|
|
2951
3031
|
const tierLimit = Math.max(limit * 3, DEFAULT_UNIFIED_SEARCH_LIMIT);
|
|
@@ -3115,11 +3195,14 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
|
|
|
3115
3195
|
options.captureRerankLanes?.(lanes);
|
|
3116
3196
|
}
|
|
3117
3197
|
if (reranker && lanes) {
|
|
3118
|
-
const pool = fuseSearchLanes(lanes);
|
|
3198
|
+
const pool = fuseSearchLanes(lanes).slice(0, "remote" in reranker ? reranker.remote.top_n : 20);
|
|
3119
3199
|
try {
|
|
3120
|
-
results = await rerankSearchResults(reranker, trimmedQuery, results, pool, candidateTexts(db, sessionId, projectPath, pool), limit);
|
|
3200
|
+
results = await rerankSearchResults(reranker, trimmedQuery, results, pool, candidateTexts(db, sessionId, projectPath, pool), limit, options.signal, options.onRerankSkipped);
|
|
3121
3201
|
} catch {
|
|
3122
|
-
|
|
3202
|
+
if ("remote" in reranker)
|
|
3203
|
+
remoteRerankSkipped("candidate_validation", options.onRerankSkipped);
|
|
3204
|
+
else
|
|
3205
|
+
logRerankFallback("candidate_validation");
|
|
3123
3206
|
}
|
|
3124
3207
|
}
|
|
3125
3208
|
if (!options.measurementDisabled) {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./index-h7tgn49j.js";
|
|
10
10
|
import {
|
|
11
11
|
inRootAsyncContext2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-gzy5w8ya.js";
|
|
13
13
|
|
|
14
14
|
// ../../node_modules/.bun/@cortexkit+subc-client@0.11.1/node_modules/@cortexkit/subc-client/dist/client.js
|
|
15
15
|
import { promises as fs2 } from "node:fs";
|
|
@@ -1786,7 +1786,6 @@ function getSynapseBatchRequestKey(args) {
|
|
|
1786
1786
|
required_fingerprint: args.fingerprint,
|
|
1787
1787
|
required_epoch: args.tableEpoch,
|
|
1788
1788
|
allow_equivalent: false,
|
|
1789
|
-
accept_declared: false,
|
|
1790
1789
|
ids: args.items.map((item) => item.id),
|
|
1791
1790
|
content_sha256: args.items.map((item) => item.contentSha256),
|
|
1792
1791
|
...args.purpose === "query" ? { purpose: args.purpose } : {}
|
|
@@ -2175,8 +2174,7 @@ class SynapseEmbeddingProvider {
|
|
|
2175
2174
|
model: metadata.model,
|
|
2176
2175
|
required_fingerprint: metadata.fingerprint,
|
|
2177
2176
|
required_epoch: metadata.table_epoch,
|
|
2178
|
-
allow_equivalent: false
|
|
2179
|
-
accept_declared: false
|
|
2177
|
+
allow_equivalent: false
|
|
2180
2178
|
};
|
|
2181
2179
|
}
|
|
2182
2180
|
batchRequest(items, requestKey, purpose) {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
getTagIdentityWriteGeneration2,
|
|
16
16
|
getSqliteDatabasePath2
|
|
17
|
-
} from "./index-
|
|
17
|
+
} from "./index-gzy5w8ya.js";
|
|
18
18
|
import {
|
|
19
19
|
tagIdentityRevisionKey,
|
|
20
20
|
tagOrderConstraintIndex,
|
|
@@ -88,13 +88,16 @@ function stripDanglingTagNotationGlobally(value) {
|
|
|
88
88
|
function stripTagSectionCharacters(value) {
|
|
89
89
|
return value.replace(STRAY_SECTION_CHAR_REGEX, "");
|
|
90
90
|
}
|
|
91
|
-
function stripPersistedAssistantText(value) {
|
|
91
|
+
function stripPersistedAssistantText(value, acceptsEmpty = true) {
|
|
92
|
+
if (!acceptsEmpty && !value.includes("§") && !value.trim())
|
|
93
|
+
return value;
|
|
92
94
|
let text = stripWellFormedLeadingTagPrefix(value);
|
|
93
95
|
text = stripCompleteTagPairsGlobally(text);
|
|
94
96
|
text = stripMalformedTagNotationGlobally(text);
|
|
95
97
|
text = stripDanglingTagNotationGlobally(text);
|
|
96
98
|
text = stripTagSectionCharacters(text);
|
|
97
|
-
|
|
99
|
+
const stripped = text.trim();
|
|
100
|
+
return !acceptsEmpty && value.trim().length > 0 && stripped.length === 0 ? value : stripped;
|
|
98
101
|
}
|
|
99
102
|
function byteSize(value) {
|
|
100
103
|
return encoder.encode(value).length;
|
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
getSqliteDatabasePath2,
|
|
3
3
|
withSqliteBackgroundWriter2,
|
|
4
4
|
withoutSqliteTransformPass2
|
|
5
|
-
} from "./index-
|
|
5
|
+
} from "./index-gzy5w8ya.js";
|
|
6
6
|
import {
|
|
7
7
|
runSessionWarmupWorker
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-jfem3dgz.js";
|
|
9
9
|
import {
|
|
10
10
|
logSlowWriteTransaction
|
|
11
11
|
} from "./index-t5pck3ss.js";
|
|
@@ -97,7 +97,7 @@ import {
|
|
|
97
97
|
getRawSessionTagKeysThrough2,
|
|
98
98
|
getLegacyProtectedTailStartOrdinal2,
|
|
99
99
|
readSessionChunk2
|
|
100
|
-
} from "./index-
|
|
100
|
+
} from "./index-mnhcdfxg.js";
|
|
101
101
|
import {
|
|
102
102
|
getHarness2,
|
|
103
103
|
harnessOwnsOpenCodeStore2
|
|
@@ -147,7 +147,7 @@ import {
|
|
|
147
147
|
ConfigProfilesSchema,
|
|
148
148
|
MagicContextConfigSchema,
|
|
149
149
|
LIVE_RELOAD_CONFIG_PATHS
|
|
150
|
-
} from "./index-
|
|
150
|
+
} from "./index-nxrsns5x.js";
|
|
151
151
|
import {
|
|
152
152
|
providerMass,
|
|
153
153
|
calibrationForModelKey,
|
|
@@ -164,7 +164,7 @@ import {
|
|
|
164
164
|
LATEST_SUPPORTED_VERSION,
|
|
165
165
|
getPersistedSchemaVersion,
|
|
166
166
|
openDatabase
|
|
167
|
-
} from "./index-
|
|
167
|
+
} from "./index-a9zvn5fe.js";
|
|
168
168
|
import {
|
|
169
169
|
inRootAsyncContext2,
|
|
170
170
|
Database2,
|
|
@@ -172,11 +172,11 @@ import {
|
|
|
172
172
|
withSqliteBackgroundWriter2,
|
|
173
173
|
withoutSqliteTransformPass2,
|
|
174
174
|
beginSqliteWriterAsync2
|
|
175
|
-
} from "./index-
|
|
175
|
+
} from "./index-gzy5w8ya.js";
|
|
176
176
|
import {
|
|
177
177
|
shouldSkipHomeProjectMemory,
|
|
178
178
|
resolveProjectIdentity
|
|
179
|
-
} from "./index-
|
|
179
|
+
} from "./index-kq5w68dp.js";
|
|
180
180
|
import {
|
|
181
181
|
isPidAlive
|
|
182
182
|
} from "./index-c7phnbvk.js";
|
|
@@ -185,7 +185,7 @@ import {
|
|
|
185
185
|
noteRawSessionSummaryRowWritten2,
|
|
186
186
|
RawOrdinalsNotReady2,
|
|
187
187
|
runSessionWarmupWorker
|
|
188
|
-
} from "./index-
|
|
188
|
+
} from "./index-jfem3dgz.js";
|
|
189
189
|
import {
|
|
190
190
|
layoutLkgPrefix,
|
|
191
191
|
assembleLkgPrefix,
|
|
@@ -196,7 +196,7 @@ import {
|
|
|
196
196
|
resolveStoredPathWorkspaceIdentity,
|
|
197
197
|
sourceNameForMemory,
|
|
198
198
|
computeWorkspaceEpochFingerprint
|
|
199
|
-
} from "./index-
|
|
199
|
+
} from "./index-9q1g3c5q.js";
|
|
200
200
|
import {
|
|
201
201
|
getTableColumnNames
|
|
202
202
|
} from "./index-x9k3mqrf.js";
|
|
@@ -222,7 +222,7 @@ import {
|
|
|
222
222
|
getProjectChunkEmbeddingModelId2,
|
|
223
223
|
getProjectEmbeddingMaxInputTokens2,
|
|
224
224
|
embedItemsForProject2
|
|
225
|
-
} from "./index-
|
|
225
|
+
} from "./index-zy67whjr.js";
|
|
226
226
|
import {
|
|
227
227
|
buildCanonicalChunkTextFromFts2,
|
|
228
228
|
buildCompartmentSummaryFallbackText2,
|
|
@@ -232,7 +232,7 @@ import {
|
|
|
232
232
|
replaceCompartmentChunkEmbeddings2,
|
|
233
233
|
deleteChunkEmbedBackoffForSession2,
|
|
234
234
|
chunkWindowSourceKey2
|
|
235
|
-
} from "./index-
|
|
235
|
+
} from "./index-m32esgmj.js";
|
|
236
236
|
import {
|
|
237
237
|
BoundedSessionMap,
|
|
238
238
|
clearCompressionDepth,
|
|
@@ -249,7 +249,7 @@ import {
|
|
|
249
249
|
toMessageIndexSource2,
|
|
250
250
|
clearIndexedMessagesInTransaction2,
|
|
251
251
|
indexSourcesAfterOrdinal2
|
|
252
|
-
} from "./index-
|
|
252
|
+
} from "./index-mnnkgq0q.js";
|
|
253
253
|
import {
|
|
254
254
|
stripWellFormedLeadingTagPrefix,
|
|
255
255
|
stripTagPrefix,
|
|
@@ -262,12 +262,12 @@ import {
|
|
|
262
262
|
foldShrunkPartTags2,
|
|
263
263
|
getTagNumberByMessageId2,
|
|
264
264
|
getActiveTagsBySession2
|
|
265
|
-
} from "./index-
|
|
265
|
+
} from "./index-whcgcfrv.js";
|
|
266
266
|
import {
|
|
267
267
|
openCodeDbExists,
|
|
268
268
|
withReadOnlySessionDb,
|
|
269
269
|
getMessageTimesFromOpenCodeDb
|
|
270
|
-
} from "./index-
|
|
270
|
+
} from "./index-ksq50rg0.js";
|
|
271
271
|
import {
|
|
272
272
|
renderUserFacingFailure,
|
|
273
273
|
userFacingFailureCode,
|
|
@@ -276,7 +276,7 @@ import {
|
|
|
276
276
|
insertPrimerCandidates,
|
|
277
277
|
promoteSessionFactsDurable,
|
|
278
278
|
embedPromotedFacts
|
|
279
|
-
} from "./index-
|
|
279
|
+
} from "./index-3svaejkh.js";
|
|
280
280
|
import {
|
|
281
281
|
pushNotification2
|
|
282
282
|
} from "./index-x8a7jmkh.js";
|
|
@@ -287,16 +287,16 @@ import {
|
|
|
287
287
|
getMemoriesByProject2,
|
|
288
288
|
getMemoriesByProjects2,
|
|
289
289
|
getMaxMemoryIdForProjects2
|
|
290
|
-
} from "./index-
|
|
290
|
+
} from "./index-jjvbk92s.js";
|
|
291
291
|
import {
|
|
292
292
|
isMarkerCandidateBasisCurrent2,
|
|
293
293
|
invalidateMarkerCandidateBasis2,
|
|
294
294
|
readMarkerCandidateBasis2,
|
|
295
295
|
prepareMarkerCandidateBasis2
|
|
296
|
-
} from "./index-
|
|
296
|
+
} from "./index-qgh1qwjj.js";
|
|
297
297
|
import {
|
|
298
298
|
sendStatusNotification2
|
|
299
|
-
} from "./index-
|
|
299
|
+
} from "./index-66eby7hx.js";
|
|
300
300
|
import {
|
|
301
301
|
isCompactionEnabled,
|
|
302
302
|
migrateLegacyAgentEnabledInMemory
|
|
@@ -1702,6 +1702,17 @@ function stripUnsafeProjectConfigFields(projectRaw) {
|
|
|
1702
1702
|
warnings.push(`Ignoring ${field} from project config (security: daemon routing and developer-only embedding traffic are user-level settings).`);
|
|
1703
1703
|
}
|
|
1704
1704
|
}
|
|
1705
|
+
if ("rerank" in projectRaw) {
|
|
1706
|
+
const rerank = projectRaw.rerank;
|
|
1707
|
+
const off = isPlainObject(rerank) && rerank.provider === "off";
|
|
1708
|
+
const removed = !isPlainObject(rerank) || Object.keys(rerank).some((key) => key !== "provider") || !off;
|
|
1709
|
+
if (off)
|
|
1710
|
+
projectRaw.rerank = { provider: "off" };
|
|
1711
|
+
else
|
|
1712
|
+
delete projectRaw.rerank;
|
|
1713
|
+
if (removed)
|
|
1714
|
+
warnings.push("Ignoring rerank settings from project config (security: projects may only set rerank.provider to off; hosted routing, credentials and limits are user-level only).");
|
|
1715
|
+
}
|
|
1705
1716
|
const embedding = projectRaw.embedding;
|
|
1706
1717
|
if (isPlainObject(embedding)) {
|
|
1707
1718
|
const removed = [];
|
|
@@ -9372,7 +9383,7 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
|
|
|
9372
9383
|
throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs, options.transport);
|
|
9373
9384
|
}
|
|
9374
9385
|
if (!cooledPrimary && !quota)
|
|
9375
|
-
log2(`[${callContext}] primary (${explicitPrimaryLabel}) failed validation/prompt: ${shortErr(failure.error)};
|
|
9386
|
+
log2(`[${callContext}] primary (${explicitPrimaryLabel}) failed validation/prompt: ${shortErr(failure.error)}; ${fallbacks.length} fallback(s) configured, subject to remaining budget`);
|
|
9376
9387
|
}
|
|
9377
9388
|
for (let i = 0;i < fallbacks.length; i += 1) {
|
|
9378
9389
|
const fallback = toModelEntry(fallbacks[i]);
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
withSqliteBackgroundWriter2,
|
|
5
5
|
withoutSqliteTransformPass2,
|
|
6
6
|
isTransientSqliteError2
|
|
7
|
-
} from "./index-
|
|
7
|
+
} from "./index-gzy5w8ya.js";
|
|
8
8
|
import {
|
|
9
9
|
estimateTokens
|
|
10
10
|
} from "./index-b88dwwrh.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
isSynapseEmbeddingTruncated,
|
|
21
21
|
getSynapseBatchRequestKey,
|
|
22
22
|
SynapseEmbeddingProvider
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-wfybj1dw.js";
|
|
24
24
|
import {
|
|
25
25
|
createWorkerShutdown
|
|
26
26
|
} from "./index-cpjk5jd2.js";
|
|
@@ -41,10 +41,10 @@ import {
|
|
|
41
41
|
countSessionCompartmentEmbedCoverage2,
|
|
42
42
|
countSessionCompartmentEmbedCoveragePolite2,
|
|
43
43
|
countUnembeddedSessionCompartmentsPolite2
|
|
44
|
-
} from "./index-
|
|
44
|
+
} from "./index-m32esgmj.js";
|
|
45
45
|
import {
|
|
46
46
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
47
|
-
} from "./index-
|
|
47
|
+
} from "./index-nxrsns5x.js";
|
|
48
48
|
import {
|
|
49
49
|
embeddingModelsMatch,
|
|
50
50
|
resolveEmbeddingTextPrefixes,
|
|
@@ -54,10 +54,10 @@ import {
|
|
|
54
54
|
getEmbeddingProviderIdentity,
|
|
55
55
|
dominantEmbeddingFailure,
|
|
56
56
|
LocalEmbeddingProvider
|
|
57
|
-
} from "./index-
|
|
57
|
+
} from "./index-51rdvtkz.js";
|
|
58
58
|
import {
|
|
59
59
|
setBootQuietPeriodForTests
|
|
60
|
-
} from "./index-
|
|
60
|
+
} from "./index-kq5w68dp.js";
|
|
61
61
|
import {
|
|
62
62
|
isEmbeddingHostBusy2
|
|
63
63
|
} from "./index-qt1qqasc.js";
|
|
@@ -68,7 +68,7 @@ import {
|
|
|
68
68
|
acquireGitSweepLease,
|
|
69
69
|
renewGitSweepLease,
|
|
70
70
|
releaseGitSweepLease
|
|
71
|
-
} from "./index-
|
|
71
|
+
} from "./index-kfyb3k6n.js";
|
|
72
72
|
import {
|
|
73
73
|
saveEmbeddingIfHashMatches,
|
|
74
74
|
getMemoryEmbedCoverage,
|
|
@@ -1069,6 +1069,23 @@ var EMBED_SLICE_RETRY_BASE_MS = 250;
|
|
|
1069
1069
|
var EMBED_SLOW_FAILURE_NO_RETRY_MS = 1e4;
|
|
1070
1070
|
var MAX_CONSECUTIVE_FAILED_BATCHES = 3;
|
|
1071
1071
|
var projectRegistrations = new Map;
|
|
1072
|
+
var projectContextUsers = new Map;
|
|
1073
|
+
function retainProjectEmbedding2(projectIdentity) {
|
|
1074
|
+
projectContextUsers.set(projectIdentity, (projectContextUsers.get(projectIdentity) ?? 0) + 1);
|
|
1075
|
+
let released = false;
|
|
1076
|
+
return () => {
|
|
1077
|
+
if (released)
|
|
1078
|
+
return;
|
|
1079
|
+
released = true;
|
|
1080
|
+
const remaining = (projectContextUsers.get(projectIdentity) ?? 1) - 1;
|
|
1081
|
+
if (remaining > 0) {
|
|
1082
|
+
projectContextUsers.set(projectIdentity, remaining);
|
|
1083
|
+
} else {
|
|
1084
|
+
projectContextUsers.delete(projectIdentity);
|
|
1085
|
+
unregisterProjectEmbedding2(projectIdentity);
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
}
|
|
1072
1089
|
var shadowRegistrations = new Map;
|
|
1073
1090
|
var shadowQueue = [];
|
|
1074
1091
|
var shadowWorker = null;
|
|
@@ -3111,6 +3128,7 @@ function _resetProjectEmbeddingRegistryForTests2() {
|
|
|
3111
3128
|
disposeProvider(registration.provider);
|
|
3112
3129
|
}
|
|
3113
3130
|
projectRegistrations.clear();
|
|
3131
|
+
projectContextUsers.clear();
|
|
3114
3132
|
shadowRegistrations.clear();
|
|
3115
3133
|
shadowQueue.length = 0;
|
|
3116
3134
|
pendingShadowBackfills.clear();
|
|
@@ -3126,4 +3144,4 @@ function _resetProjectEmbeddingRegistryForTests2() {
|
|
|
3126
3144
|
setBootQuietPeriodForTests(null);
|
|
3127
3145
|
}
|
|
3128
3146
|
|
|
3129
|
-
export { embedPauseBySession, embedRunStateBySession, activeEmbeddingSessions, autoEmbedAttemptedBySession, autoEmbedIdentityBySession, autoEmbedRetryAfterBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, clearEmbedSessionState, drainBackgroundBatches, recordEmbeddingMeasurement, OpenAICompatibleEmbeddingProvider, saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitSha, enforceProjectCap, describeShadowBackfillWriteRefusal2, listShadowBackfillStalls2, getShadowBackfillStopReason2, markProjectLoadUntrusted2, contentSha2562, drainProjectEmbeddingIdentityMaintenance2, drainStaleEmbeddingIdentitiesForProject2, registerProjectEmbedding2, registerProjectShadowEmbedding2, getShadowEmbeddingMeasurementCohort2, getPrimaryEmbeddingMeasurementCohort2, embedShadowTextForProject2, enqueueShadowEmbeddingItems2, getShadowBackfillRemaining2, flushShadowEmbeddingBacklog2, registerProjectInObservationMode2, unregisterProjectShadowEmbedding2, unregisterProjectEmbedding2, getProjectEmbeddingSnapshot2, installProjectEmbeddingSearchBridge2, getProjectChunkEmbeddingModelId2, getProjectEmbeddingMaxInputTokens2, embedTextForProject2, embedBatchForProject2, embedItemsForProject2, embedUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProjectOutcome2, drainCommitBacklogForProject2, embedUnembeddedCompartmentChunksForProject2, embedSessionCompartmentChunks2, getEmbeddingCoverageStatus2, getAutoEmbeddingSessionCoverage2, sweepAllRegisteredProjects2, _setTestProviderFactoryForProject2, _resetProjectEmbeddingRegistryForTests2 };
|
|
3147
|
+
export { embedPauseBySession, embedRunStateBySession, activeEmbeddingSessions, autoEmbedAttemptedBySession, autoEmbedIdentityBySession, autoEmbedRetryAfterBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, clearEmbedSessionState, drainBackgroundBatches, recordEmbeddingMeasurement, OpenAICompatibleEmbeddingProvider, saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitSha, enforceProjectCap, describeShadowBackfillWriteRefusal2, listShadowBackfillStalls2, retainProjectEmbedding2, getShadowBackfillStopReason2, markProjectLoadUntrusted2, contentSha2562, drainProjectEmbeddingIdentityMaintenance2, drainStaleEmbeddingIdentitiesForProject2, registerProjectEmbedding2, registerProjectShadowEmbedding2, getShadowEmbeddingMeasurementCohort2, getPrimaryEmbeddingMeasurementCohort2, embedShadowTextForProject2, enqueueShadowEmbeddingItems2, getShadowBackfillRemaining2, flushShadowEmbeddingBacklog2, registerProjectInObservationMode2, unregisterProjectShadowEmbedding2, unregisterProjectEmbedding2, getProjectEmbeddingSnapshot2, installProjectEmbeddingSearchBridge2, getProjectChunkEmbeddingModelId2, getProjectEmbeddingMaxInputTokens2, embedTextForProject2, embedBatchForProject2, embedItemsForProject2, embedUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProjectOutcome2, drainCommitBacklogForProject2, embedUnembeddedCompartmentChunksForProject2, embedSessionCompartmentChunks2, getEmbeddingCoverageStatus2, getAutoEmbeddingSessionCoverage2, sweepAllRegisteredProjects2, _setTestProviderFactoryForProject2, _resetProjectEmbeddingRegistryForTests2 };
|