fix: remove one machine's addresses and paths from the shipped defaults
The plugin was developed against an Ollama on a private LAN address, and that address had reached places that ship: - the `config` parameter description the MODEL reads on every request; - the commented example in `cordis.patch.yml`, the layer every profile applies; - `scripts/smoke.mjs` and `scripts/measure.mjs` endpoint defaults; - both measure scripts' default workspace, which was an absolute local path and named a private repository; - README examples and test fixtures. All of them now use `http://127.0.0.1:11434`, which is Ollama's documented default and belongs to no particular machine — kept rather than emptied because `validateSettings` requires an http(s) URL, so an empty default would turn every call into INVALID_SETTINGS until someone configured it. Test fixtures use 192.0.2.10 instead: TEST-NET-1 is reserved for documentation and cannot point at a host anybody runs. The `focus` and `config` examples are generic, and the workspace defaults are the working directory. Two script bugs surfaced once the defaults stopped pointing at a live box, and are fixed here. `measure.mjs` built its own configuration literal, which was ten fields short of the schema — harmless while nothing validated it, and a refused call the moment `execute` began checking the section it was handed; it now resolves its configuration through the plugin's own `Config`, so it cannot drift again. It also crashed on a failed search (`first.index.scanned` of a result that has no index) instead of reporting the endpoint it could not reach, which is now the ordinary case. `scope-measure.mjs` divided by a scope that does not exist in any workspace without focus markers, and now says so. Also corrects `cordis.patch.yml`'s description of what the row registers: in 0.1.7 the exported `Config` is the settings registration, not a namespace on `ctx.settings`.
This commit is contained in:
1 parent
7261d46ee2
commit
a48e05585e
7 files changed
+93
-48
No files matched your search
+41
-27
@@ -19,38 +19,37 @@ import { mkdtemp, rm } from 'node:fs/promises'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
|
||||
import { apply } from '../index.js'
|
||||
import { apply, Config, settingsSnapshot } from '../index.js'
|
||||
|
||||
const WORKSPACE = process.argv[2] ?? '/root/workspaces/ha-runtime'
|
||||
const QUERY = process.argv[3] ?? 'how does the occupancy state machine decide a room is occupied'
|
||||
// Whatever repository you run this against, and whatever you want to ask it.
|
||||
// The defaults are the working directory and a query that names a behaviour
|
||||
// rather than a symbol — which is the kind of question the plugin exists for.
|
||||
const WORKSPACE = process.argv[2] ?? process.cwd()
|
||||
const QUERY = process.argv[3] ?? 'where is the retry policy applied'
|
||||
const BUDGET_MS = Number(process.argv[4] ?? 90_000)
|
||||
|
||||
const API_BASE = process.env.RECALL_API_BASE ?? 'http://10.50.1.2:11434'
|
||||
// The endpoint to measure against: the Ollama convention unless RECALL_API_BASE
|
||||
// says otherwise. Nothing here is specific to the machine this was written on.
|
||||
const API_BASE = process.env.RECALL_API_BASE ?? 'http://127.0.0.1:11434'
|
||||
const MODEL = process.env.RECALL_MODEL ?? 'unclemusclez/jina-embeddings-v2-base-code:latest'
|
||||
|
||||
const config = {
|
||||
embeddingApiBase: API_BASE,
|
||||
embeddingModel: MODEL,
|
||||
embeddingDimensions: 768,
|
||||
embeddingApiKey: '',
|
||||
embeddingBatchSize: 32,
|
||||
embeddingConcurrency: 4,
|
||||
embeddingTimeoutMs: 120_000,
|
||||
extensions: [],
|
||||
exclude: [],
|
||||
maxFiles: 20_000,
|
||||
maxFileBytes: 1_048_576,
|
||||
chunkLines: 48,
|
||||
maxChunkLines: 80,
|
||||
overlapLines: 8,
|
||||
defaultLimit: 8,
|
||||
maxLimit: 25,
|
||||
perFileLimit: 2,
|
||||
excerptLines: 40,
|
||||
minSimilarity: 0.2,
|
||||
syncBudgetMs: BUDGET_MS,
|
||||
stateDir: '',
|
||||
}
|
||||
// The measurement's configuration, stated as the few values it cares about and
|
||||
// resolved through the plugin's own schema — so this script can never drift
|
||||
// from the Config the plugin validates against. A hand-written literal used to
|
||||
// stand here, and it was missing ten fields: harmless while nothing checked,
|
||||
// and a refused call the moment `execute` began validating the section it was
|
||||
// handed.
|
||||
const config = settingsSnapshot(
|
||||
Config({
|
||||
embeddingApiBase: API_BASE,
|
||||
embeddingModel: MODEL,
|
||||
embeddingBatchSize: 32,
|
||||
embeddingConcurrency: 4,
|
||||
embeddingTimeoutMs: 120_000,
|
||||
excerptLines: 40,
|
||||
syncBudgetMs: BUDGET_MS,
|
||||
}),
|
||||
)
|
||||
|
||||
/** The smallest context `apply` touches, with no settings provider mounted. */
|
||||
function context() {
|
||||
@@ -92,6 +91,21 @@ async function main() {
|
||||
const coldMs = Date.now() - coldStart
|
||||
console.log('--- FIRST SEARCH (bounded cold start) ---')
|
||||
console.log(`elapsed : ${(coldMs / 1000).toFixed(1)}s (budget ${BUDGET_MS / 1000}s)`)
|
||||
|
||||
// A search that did not run has no index or results to report, and the tool
|
||||
// already says why. Without this the first `first.index.*` line throws a
|
||||
// TypeError that buries the actual cause — an endpoint that is not there is
|
||||
// the ordinary case now that the default is the loopback convention.
|
||||
if (first.ok !== true) {
|
||||
console.log(`failed : ${first.errorCode ?? 'UNKNOWN'}`)
|
||||
console.log(`note : ${first.note ?? '(none)'}`)
|
||||
if (first.remedy !== undefined) console.log(`remedy : ${first.remedy}`)
|
||||
console.log('')
|
||||
console.log(`nothing to measure: point RECALL_API_BASE at a reachable endpoint (currently ${API_BASE}).`)
|
||||
process.exitCode = 1
|
||||
return
|
||||
}
|
||||
|
||||
console.log(`scanned files : ${first.index.scanned}`)
|
||||
console.log(`indexed files : ${first.index.files}`)
|
||||
console.log(`chunks : ${first.index.chunks}`)
|
||||
|
||||
Reference in new issue
Block a user