sweet-search 2.5.2 → 2.5.3
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/core/cli.js +24 -3
- package/core/graph/graph-expansion.js +215 -36
- package/core/graph/graph-extractor.js +196 -11
- package/core/graph/graph-search.js +395 -92
- package/core/graph/hcgs-generator.js +2 -1
- package/core/graph/index.js +2 -0
- package/core/graph/repo-map.js +28 -6
- package/core/graph/structural-answer-cues.js +168 -0
- package/core/graph/structural-callsite-hints.js +40 -0
- package/core/graph/structural-context-format.js +40 -0
- package/core/graph/structural-context.js +450 -0
- package/core/graph/structural-forward-push.js +156 -0
- package/core/graph/structural-header-context.js +19 -0
- package/core/graph/structural-importance.js +148 -0
- package/core/graph/structural-pagerank.js +197 -0
- package/core/graph/summary-manager.js +13 -9
- package/core/incremental-indexing/application/dirty-scan.mjs +236 -0
- package/core/incremental-indexing/application/file-watcher.mjs +197 -0
- package/core/incremental-indexing/application/maintenance-handlers.mjs +519 -0
- package/core/incremental-indexing/application/maintenance-worker.mjs +380 -0
- package/core/incremental-indexing/application/operator-cli.mjs +554 -0
- package/core/incremental-indexing/application/production-li-delta.mjs +192 -0
- package/core/incremental-indexing/application/production-reconciler-helpers.mjs +107 -0
- package/core/incremental-indexing/application/production-reconciler.mjs +583 -0
- package/core/incremental-indexing/application/reconciler.mjs +477 -0
- package/core/incremental-indexing/application/tombstone-injector.mjs +148 -0
- package/core/incremental-indexing/domain/chunk-identity.mjs +260 -0
- package/core/incremental-indexing/domain/encoder-deps.mjs +193 -0
- package/core/incremental-indexing/domain/encoder-input.mjs +225 -0
- package/core/incremental-indexing/domain/interval-autotune.mjs +255 -0
- package/core/incremental-indexing/domain/reconcile-counters.mjs +149 -0
- package/core/incremental-indexing/domain/watermark-scheduler.mjs +239 -0
- package/core/incremental-indexing/infrastructure/artifact-temp-sweep.mjs +163 -0
- package/core/incremental-indexing/infrastructure/baseline-readiness.mjs +121 -0
- package/core/incremental-indexing/infrastructure/dirty-set.mjs +233 -0
- package/core/incremental-indexing/infrastructure/graph-gc.mjs +314 -0
- package/core/incremental-indexing/infrastructure/hashing.mjs +298 -0
- package/core/incremental-indexing/infrastructure/hcgs-invalidation.mjs +182 -0
- package/core/incremental-indexing/infrastructure/li-segment-merge.mjs +278 -0
- package/core/incremental-indexing/infrastructure/li-segment-state.mjs +173 -0
- package/core/incremental-indexing/infrastructure/lockfile.mjs +119 -0
- package/core/incremental-indexing/infrastructure/maintenance-state-reader.mjs +283 -0
- package/core/incremental-indexing/infrastructure/manifest.mjs +194 -0
- package/core/incremental-indexing/infrastructure/path-filter.mjs +190 -0
- package/core/incremental-indexing/infrastructure/reader-heartbeat.mjs +201 -0
- package/core/incremental-indexing/infrastructure/schema-migrations.mjs +257 -0
- package/core/incremental-indexing/infrastructure/sparse-gram-delta.mjs +335 -0
- package/core/incremental-indexing/infrastructure/sqlite-fts5.mjs +176 -0
- package/core/incremental-indexing/infrastructure/staleness-display.mjs +105 -0
- package/core/incremental-indexing/infrastructure/tombstone-bitmap.mjs +234 -0
- package/core/incremental-indexing/infrastructure/vector-delta-writer.mjs +359 -0
- package/core/incremental-indexing/infrastructure/vector-gc.mjs +133 -0
- package/core/incremental-indexing/infrastructure/worktree-stamp.mjs +155 -0
- package/core/incremental-indexing/infrastructure/wsl2-detect.mjs +115 -0
- package/core/indexing/admission-policy.js +139 -0
- package/core/indexing/artifact-builder.js +29 -12
- package/core/indexing/ast-chunker.js +107 -30
- package/core/indexing/dedup/exemplar-selector.js +19 -1
- package/core/indexing/gitignore-filter.js +223 -0
- package/core/indexing/incremental-tracker.js +99 -30
- package/core/indexing/index-codebase-v21.js +6 -5
- package/core/indexing/index-maintainer.mjs +698 -6
- package/core/indexing/indexer-ann.js +99 -15
- package/core/indexing/indexer-build.js +158 -45
- package/core/indexing/indexer-empty-baseline.js +80 -0
- package/core/indexing/indexer-manifest.js +66 -0
- package/core/indexing/indexer-phases.js +56 -23
- package/core/indexing/indexer-sparse-gram.js +54 -13
- package/core/indexing/indexer-utils.js +26 -208
- package/core/indexing/indexing-file-policy.js +32 -7
- package/core/indexing/maintainer-launcher.mjs +137 -0
- package/core/indexing/merkle-tracker.js +251 -244
- package/core/indexing/model-pool.js +46 -5
- package/core/infrastructure/code-graph-repository.js +758 -6
- package/core/infrastructure/code-graph-visibility.js +157 -0
- package/core/infrastructure/codebase-repository.js +100 -13
- package/core/infrastructure/config/search.js +1 -1
- package/core/infrastructure/db-utils.js +118 -0
- package/core/infrastructure/dedup-hashing.js +10 -13
- package/core/infrastructure/hardware-capability.js +17 -7
- package/core/infrastructure/index.js +8 -2
- package/core/infrastructure/language-patterns/maps.js +4 -1
- package/core/infrastructure/language-patterns/registry-core.js +56 -17
- package/core/infrastructure/language-patterns/registry-object-oriented.js +12 -5
- package/core/infrastructure/language-patterns.js +69 -0
- package/core/infrastructure/model-registry.js +20 -0
- package/core/infrastructure/native-inference.js +7 -12
- package/core/infrastructure/native-resolver.js +52 -37
- package/core/infrastructure/native-sparse-gram.js +261 -20
- package/core/infrastructure/native-tokenizer.js +6 -15
- package/core/infrastructure/simd-distance.js +10 -16
- package/core/infrastructure/sparse-gram-delta-reader.js +76 -0
- package/core/infrastructure/structural-alias-resolver.js +122 -0
- package/core/infrastructure/structural-candidate-ranker.js +34 -0
- package/core/infrastructure/structural-context-repository.js +472 -0
- package/core/infrastructure/structural-context-utils.js +51 -0
- package/core/infrastructure/structural-graph-signals.js +121 -0
- package/core/infrastructure/structural-qualified-resolution.js +15 -0
- package/core/infrastructure/structural-source-definitions.js +100 -0
- package/core/infrastructure/tombstone-bitmap-reader.js +139 -0
- package/core/infrastructure/tree-sitter-provider.js +811 -37
- package/core/prompt-optimization/data/p7-final/sweet-search-system-prompt.md +50 -0
- package/core/query/query-router.js +55 -5
- package/core/ranking/file-kind-ranking.js +2192 -15
- package/core/ranking/late-interaction-index.js +87 -12
- package/core/search/cli-decoration.js +290 -0
- package/core/search/context-expander.js +988 -78
- package/core/search/index.js +1 -0
- package/core/search/output-policy.js +275 -0
- package/core/search/search-anchor.js +499 -0
- package/core/search/search-boost.js +93 -1
- package/core/search/search-cli.js +61 -204
- package/core/search/search-hybrid.js +250 -10
- package/core/search/search-pattern-chunks.js +57 -8
- package/core/search/search-pattern-planner.js +68 -9
- package/core/search/search-pattern-prefilter.js +30 -10
- package/core/search/search-pattern-ripgrep.js +40 -4
- package/core/search/search-pattern-sparse-overlay.js +256 -0
- package/core/search/search-pattern.js +117 -29
- package/core/search/search-postprocess.js +479 -5
- package/core/search/search-read-semantic.js +260 -23
- package/core/search/search-read.js +82 -64
- package/core/search/search-reader-pin.js +71 -0
- package/core/search/search-rrf.js +279 -0
- package/core/search/search-semantic.js +110 -5
- package/core/search/search-server.js +130 -57
- package/core/search/search-trace.js +107 -0
- package/core/search/server-identity.js +93 -0
- package/core/search/session-daemon-prewarm.mjs +33 -10
- package/core/search/sweet-search.js +399 -7
- package/core/skills/sweet-index/SKILL.md +8 -6
- package/core/vector-store/binary-hnsw-index.js +194 -30
- package/core/vector-store/float-vector-store.js +96 -6
- package/core/vector-store/hnsw-index.js +220 -49
- package/eval/agent-read-workflows/bin/_ss-helpers.mjs +471 -0
- package/eval/agent-read-workflows/bin/ss-find +15 -0
- package/eval/agent-read-workflows/bin/ss-grep +12 -0
- package/eval/agent-read-workflows/bin/ss-read +14 -0
- package/eval/agent-read-workflows/bin/ss-search +18 -0
- package/eval/agent-read-workflows/bin/ss-semantic +12 -0
- package/eval/agent-read-workflows/bin/ss-trace +11 -0
- package/mcp/read-tool.js +109 -0
- package/mcp/server.js +55 -15
- package/mcp/tool-handlers.js +14 -124
- package/mcp/trace-tool.js +81 -0
- package/package.json +25 -10
- package/scripts/hooks/intercept-read.mjs +55 -0
- package/scripts/hooks/remind-tools.mjs +40 -0
- package/scripts/init.js +698 -54
- package/scripts/inject-agent-instructions.js +431 -0
- package/scripts/install-prompt-reminders.js +188 -0
- package/scripts/install-tool-enforcement.js +220 -0
- package/scripts/smoke-test.js +12 -9
- package/scripts/uninstall.js +276 -18
- package/scripts/write-claude-rules.js +110 -0
|
@@ -45,16 +45,43 @@ export const GPU_ARMING_MIN_FILES = 20;
|
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Translate a hardware-capability `inferenceBackendPreference` string into
|
|
48
|
-
* the deviceKind
|
|
48
|
+
* the ACCELERATOR deviceKind the native addon should arm — or `null` when
|
|
49
|
+
* the host has no usable accelerator and indexing must stay on ORT INT8 CPU.
|
|
50
|
+
*
|
|
51
|
+
* coreml-cascade | candle-metal → 'metal'
|
|
52
|
+
* candle-cuda → 'cuda'
|
|
53
|
+
* ort-cpu | candle-cpu | unknown / falsy → null (no native arming)
|
|
54
|
+
*
|
|
55
|
+
* `candle-cpu` is mapped to `null` too — deliberately. "No accelerator" must
|
|
56
|
+
* never resolve to "load candle on CPU": that path ships FP32 safetensors and
|
|
57
|
+
* lives in a different embedding space than the ORT INT8 query encoder
|
|
58
|
+
* (a measured MRR regression). The only non-accelerator preference the
|
|
59
|
+
* detector emits today is 'ort-cpu'; 'candle-cpu' is handled defensively in
|
|
60
|
+
* case a stale persisted value ever reaches this function.
|
|
49
61
|
*
|
|
50
62
|
* Pure function, exported for unit testing. Keeps the mapping in one place
|
|
51
|
-
* so adding a future
|
|
63
|
+
* so adding a future accelerator (e.g. "candle-rocm") is a single-location
|
|
52
64
|
* edit that both init-time reporting and runtime dispatch consume.
|
|
53
65
|
*/
|
|
54
|
-
export function
|
|
66
|
+
export function selectAcceleratorDeviceKind(pref) {
|
|
55
67
|
if (pref === 'coreml-cascade' || pref === 'candle-metal') return 'metal';
|
|
56
68
|
if (pref === 'candle-cuda') return 'cuda';
|
|
57
|
-
return
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Whether this process can use an inference accelerator (Metal / CoreML
|
|
74
|
+
* cascade / CUDA) for indexing. Requires both accelerator-capable hardware
|
|
75
|
+
* and a loadable/enabled native addon. When false, indexing stays on the
|
|
76
|
+
* optimized ORT INT8 CPU path and the GPU arm → teardown → CPU-rewarm
|
|
77
|
+
* lifecycle is skipped entirely. Reads the cached hardware-capability
|
|
78
|
+
* snapshot, so it's cheap to call repeatedly.
|
|
79
|
+
*/
|
|
80
|
+
export function isIndexAcceleratorAvailable() {
|
|
81
|
+
if (!isNativeInferenceAvailable()) return false;
|
|
82
|
+
return selectAcceleratorDeviceKind(
|
|
83
|
+
detectHardwareCapability().inferenceBackendPreference,
|
|
84
|
+
) !== null;
|
|
58
85
|
}
|
|
59
86
|
|
|
60
87
|
let _gpuDiag = null;
|
|
@@ -90,7 +117,21 @@ export async function initIndexGpuPool({ includeLi = true } = {}) {
|
|
|
90
117
|
const hw = detectHardwareCapability();
|
|
91
118
|
const pref = hw.inferenceBackendPreference;
|
|
92
119
|
|
|
93
|
-
const deviceKind =
|
|
120
|
+
const deviceKind = selectAcceleratorDeviceKind(pref);
|
|
121
|
+
|
|
122
|
+
// No usable accelerator → do NOT load native/candle models. Indexing
|
|
123
|
+
// proceeds on the ORT INT8 CPU path (inline or via the embedding worker
|
|
124
|
+
// pool). This is the authoritative JS-side guard: even if a CPU-only host
|
|
125
|
+
// happens to have the native addon installed (an optional package), we
|
|
126
|
+
// never arm candle on CPU here — that would ship FP32 safetensors and
|
|
127
|
+
// diverge from the ORT INT8 query encoder. callers (indexer-phases) already
|
|
128
|
+
// gate on isIndexAcceleratorAvailable(); this early-return keeps
|
|
129
|
+
// initIndexGpuPool independently correct and ensures we never lean on the
|
|
130
|
+
// Rust layer silently degrading loadWithDevice('metal'|'cuda') to CPU.
|
|
131
|
+
if (deviceKind === null) {
|
|
132
|
+
_gpuDiag = { backend: 'ort-cpu', embedLoadMs: 0, embedWarmMs: 0, liLoadMs: 0, liWarmMs: 0 };
|
|
133
|
+
return _gpuDiag;
|
|
134
|
+
}
|
|
94
135
|
|
|
95
136
|
let embedLoadMs = 0;
|
|
96
137
|
let embedWarmMs = 0;
|