@they-juanreina/compost-cli 0.1.0-rc.1
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/LICENSE +21 -0
- package/README.md +5 -0
- package/bin/compost.js +7 -0
- package/dist/commands/_stub.d.ts +9 -0
- package/dist/commands/_stub.d.ts.map +1 -0
- package/dist/commands/_stub.js +27 -0
- package/dist/commands/_stub.js.map +1 -0
- package/dist/commands/blame.d.ts +3 -0
- package/dist/commands/blame.d.ts.map +1 -0
- package/dist/commands/blame.js +31 -0
- package/dist/commands/blame.js.map +1 -0
- package/dist/commands/chat.d.ts +8 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/chat.js +99 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/code.d.ts +3 -0
- package/dist/commands/code.d.ts.map +1 -0
- package/dist/commands/code.js +70 -0
- package/dist/commands/code.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +76 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/create.d.ts +20 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +148 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/endorse.d.ts +3 -0
- package/dist/commands/endorse.d.ts.map +1 -0
- package/dist/commands/endorse.js +31 -0
- package/dist/commands/endorse.js.map +1 -0
- package/dist/commands/evals.d.ts +3 -0
- package/dist/commands/evals.d.ts.map +1 -0
- package/dist/commands/evals.js +54 -0
- package/dist/commands/evals.js.map +1 -0
- package/dist/commands/export.d.ts +3 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +54 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/ingest.d.ts +3 -0
- package/dist/commands/ingest.d.ts.map +1 -0
- package/dist/commands/ingest.js +26 -0
- package/dist/commands/ingest.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +51 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/migrate.d.ts +3 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +28 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/models.d.ts +3 -0
- package/dist/commands/models.d.ts.map +1 -0
- package/dist/commands/models.js +32 -0
- package/dist/commands/models.js.map +1 -0
- package/dist/commands/query.d.ts +3 -0
- package/dist/commands/query.d.ts.map +1 -0
- package/dist/commands/query.js +13 -0
- package/dist/commands/query.js.map +1 -0
- package/dist/commands/reindex.d.ts +3 -0
- package/dist/commands/reindex.d.ts.map +1 -0
- package/dist/commands/reindex.js +53 -0
- package/dist/commands/reindex.js.map +1 -0
- package/dist/commands/rescan.d.ts +3 -0
- package/dist/commands/rescan.d.ts.map +1 -0
- package/dist/commands/rescan.js +60 -0
- package/dist/commands/rescan.js.map +1 -0
- package/dist/commands/saturate.d.ts +3 -0
- package/dist/commands/saturate.d.ts.map +1 -0
- package/dist/commands/saturate.js +35 -0
- package/dist/commands/saturate.js.map +1 -0
- package/dist/commands/search.d.ts +3 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +52 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/serve.d.ts +3 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +9 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/session.d.ts +3 -0
- package/dist/commands/session.d.ts.map +1 -0
- package/dist/commands/session.js +25 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/setup.d.ts +3 -0
- package/dist/commands/setup.d.ts.map +1 -0
- package/dist/commands/setup.js +38 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/snap.d.ts +3 -0
- package/dist/commands/snap.d.ts.map +1 -0
- package/dist/commands/snap.js +27 -0
- package/dist/commands/snap.js.map +1 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +26 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/synthesize.d.ts +3 -0
- package/dist/commands/synthesize.d.ts.map +1 -0
- package/dist/commands/synthesize.js +13 -0
- package/dist/commands/synthesize.js.map +1 -0
- package/dist/commands/tag.d.ts +3 -0
- package/dist/commands/tag.d.ts.map +1 -0
- package/dist/commands/tag.js +46 -0
- package/dist/commands/tag.js.map +1 -0
- package/dist/commands/transcribe.d.ts +3 -0
- package/dist/commands/transcribe.d.ts.map +1 -0
- package/dist/commands/transcribe.js +110 -0
- package/dist/commands/transcribe.js.map +1 -0
- package/dist/commands/validate.d.ts +3 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +81 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/watch.d.ts +3 -0
- package/dist/commands/watch.d.ts.map +1 -0
- package/dist/commands/watch.js +50 -0
- package/dist/commands/watch.js.map +1 -0
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +12 -0
- package/dist/errors.js.map +1 -0
- package/dist/exporters/csv.d.ts +8 -0
- package/dist/exporters/csv.d.ts.map +1 -0
- package/dist/exporters/csv.js +44 -0
- package/dist/exporters/csv.js.map +1 -0
- package/dist/exporters/eaf.d.ts +3 -0
- package/dist/exporters/eaf.d.ts.map +1 -0
- package/dist/exporters/eaf.js +91 -0
- package/dist/exporters/eaf.js.map +1 -0
- package/dist/exporters/html.d.ts +8 -0
- package/dist/exporters/html.d.ts.map +1 -0
- package/dist/exporters/html.js +47 -0
- package/dist/exporters/html.js.map +1 -0
- package/dist/exporters/md.d.ts +3 -0
- package/dist/exporters/md.d.ts.map +1 -0
- package/dist/exporters/md.js +43 -0
- package/dist/exporters/md.js.map +1 -0
- package/dist/exporters/pdf.d.ts +9 -0
- package/dist/exporters/pdf.d.ts.map +1 -0
- package/dist/exporters/pdf.js +40 -0
- package/dist/exporters/pdf.js.map +1 -0
- package/dist/exporters/report.d.ts +43 -0
- package/dist/exporters/report.d.ts.map +1 -0
- package/dist/exporters/report.js +49 -0
- package/dist/exporters/report.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/legacy_client.d.ts +38 -0
- package/dist/legacy_client.d.ts.map +1 -0
- package/dist/legacy_client.js +44 -0
- package/dist/legacy_client.js.map +1 -0
- package/dist/lib/answerSchema.d.ts +2 -0
- package/dist/lib/answerSchema.d.ts.map +1 -0
- package/dist/lib/answerSchema.js +27 -0
- package/dist/lib/answerSchema.js.map +1 -0
- package/dist/lib/artifacts.d.ts +64 -0
- package/dist/lib/artifacts.d.ts.map +1 -0
- package/dist/lib/artifacts.js +254 -0
- package/dist/lib/artifacts.js.map +1 -0
- package/dist/lib/blame.d.ts +30 -0
- package/dist/lib/blame.d.ts.map +1 -0
- package/dist/lib/blame.js +164 -0
- package/dist/lib/blame.js.map +1 -0
- package/dist/lib/canonicalSessions.d.ts +24 -0
- package/dist/lib/canonicalSessions.d.ts.map +1 -0
- package/dist/lib/canonicalSessions.js +48 -0
- package/dist/lib/canonicalSessions.js.map +1 -0
- package/dist/lib/chat.d.ts +24 -0
- package/dist/lib/chat.d.ts.map +1 -0
- package/dist/lib/chat.js +50 -0
- package/dist/lib/chat.js.map +1 -0
- package/dist/lib/config.d.ts +45 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +143 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/dispatch.d.ts +10 -0
- package/dist/lib/dispatch.d.ts.map +1 -0
- package/dist/lib/dispatch.js +31 -0
- package/dist/lib/dispatch.js.map +1 -0
- package/dist/lib/doctor.d.ts +19 -0
- package/dist/lib/doctor.d.ts.map +1 -0
- package/dist/lib/doctor.js +43 -0
- package/dist/lib/doctor.js.map +1 -0
- package/dist/lib/events.d.ts +42 -0
- package/dist/lib/events.d.ts.map +1 -0
- package/dist/lib/events.js +57 -0
- package/dist/lib/events.js.map +1 -0
- package/dist/lib/export.d.ts +14 -0
- package/dist/lib/export.d.ts.map +1 -0
- package/dist/lib/export.js +36 -0
- package/dist/lib/export.js.map +1 -0
- package/dist/lib/ingest.d.ts +21 -0
- package/dist/lib/ingest.d.ts.map +1 -0
- package/dist/lib/ingest.js +68 -0
- package/dist/lib/ingest.js.map +1 -0
- package/dist/lib/journal.d.ts +23 -0
- package/dist/lib/journal.d.ts.map +1 -0
- package/dist/lib/journal.js +95 -0
- package/dist/lib/journal.js.map +1 -0
- package/dist/lib/migrate.d.ts +29 -0
- package/dist/lib/migrate.d.ts.map +1 -0
- package/dist/lib/migrate.js +117 -0
- package/dist/lib/migrate.js.map +1 -0
- package/dist/lib/nativeRuntime.d.ts +46 -0
- package/dist/lib/nativeRuntime.d.ts.map +1 -0
- package/dist/lib/nativeRuntime.js +61 -0
- package/dist/lib/nativeRuntime.js.map +1 -0
- package/dist/lib/provisionNative.d.ts +46 -0
- package/dist/lib/provisionNative.d.ts.map +1 -0
- package/dist/lib/provisionNative.js +105 -0
- package/dist/lib/provisionNative.js.map +1 -0
- package/dist/lib/queue.d.ts +36 -0
- package/dist/lib/queue.d.ts.map +1 -0
- package/dist/lib/queue.js +102 -0
- package/dist/lib/queue.js.map +1 -0
- package/dist/lib/retrieve.d.ts +51 -0
- package/dist/lib/retrieve.d.ts.map +1 -0
- package/dist/lib/retrieve.js +92 -0
- package/dist/lib/retrieve.js.map +1 -0
- package/dist/lib/saturate.d.ts +21 -0
- package/dist/lib/saturate.d.ts.map +1 -0
- package/dist/lib/saturate.js +132 -0
- package/dist/lib/saturate.js.map +1 -0
- package/dist/lib/schemas.generated.d.ts +15 -0
- package/dist/lib/schemas.generated.d.ts.map +1 -0
- package/dist/lib/schemas.generated.js +975 -0
- package/dist/lib/schemas.generated.js.map +1 -0
- package/dist/lib/seed.d.ts +16 -0
- package/dist/lib/seed.d.ts.map +1 -0
- package/dist/lib/seed.js +64 -0
- package/dist/lib/seed.js.map +1 -0
- package/dist/lib/seedResolve.d.ts +6 -0
- package/dist/lib/seedResolve.d.ts.map +1 -0
- package/dist/lib/seedResolve.js +27 -0
- package/dist/lib/seedResolve.js.map +1 -0
- package/dist/lib/session.d.ts +19 -0
- package/dist/lib/session.d.ts.map +1 -0
- package/dist/lib/session.js +61 -0
- package/dist/lib/session.js.map +1 -0
- package/dist/lib/setup.d.ts +44 -0
- package/dist/lib/setup.d.ts.map +1 -0
- package/dist/lib/setup.js +249 -0
- package/dist/lib/setup.js.map +1 -0
- package/dist/lib/snap.d.ts +15 -0
- package/dist/lib/snap.d.ts.map +1 -0
- package/dist/lib/snap.js +115 -0
- package/dist/lib/snap.js.map +1 -0
- package/dist/lib/status.d.ts +39 -0
- package/dist/lib/status.d.ts.map +1 -0
- package/dist/lib/status.js +174 -0
- package/dist/lib/status.js.map +1 -0
- package/dist/lib/tagcode.d.ts +26 -0
- package/dist/lib/tagcode.d.ts.map +1 -0
- package/dist/lib/tagcode.js +231 -0
- package/dist/lib/tagcode.js.map +1 -0
- package/dist/lib/templates.d.ts +3 -0
- package/dist/lib/templates.d.ts.map +1 -0
- package/dist/lib/templates.js +21 -0
- package/dist/lib/templates.js.map +1 -0
- package/dist/lib/transcribeNative.d.ts +44 -0
- package/dist/lib/transcribeNative.d.ts.map +1 -0
- package/dist/lib/transcribeNative.js +53 -0
- package/dist/lib/transcribeNative.js.map +1 -0
- package/dist/lib/transcript.d.ts +68 -0
- package/dist/lib/transcript.d.ts.map +1 -0
- package/dist/lib/transcript.js +10 -0
- package/dist/lib/transcript.js.map +1 -0
- package/dist/lib/validate.d.ts +16 -0
- package/dist/lib/validate.d.ts.map +1 -0
- package/dist/lib/validate.js +155 -0
- package/dist/lib/validate.js.map +1 -0
- package/dist/llm/adapter.d.ts +33 -0
- package/dist/llm/adapter.d.ts.map +1 -0
- package/dist/llm/adapter.js +106 -0
- package/dist/llm/adapter.js.map +1 -0
- package/dist/llm/http.d.ts +9 -0
- package/dist/llm/http.d.ts.map +1 -0
- package/dist/llm/http.js +56 -0
- package/dist/llm/http.js.map +1 -0
- package/dist/llm/providers/anthropic.d.ts +14 -0
- package/dist/llm/providers/anthropic.d.ts.map +1 -0
- package/dist/llm/providers/anthropic.js +66 -0
- package/dist/llm/providers/anthropic.js.map +1 -0
- package/dist/llm/providers/lmstudio.d.ts +7 -0
- package/dist/llm/providers/lmstudio.d.ts.map +1 -0
- package/dist/llm/providers/lmstudio.js +8 -0
- package/dist/llm/providers/lmstudio.js.map +1 -0
- package/dist/llm/providers/ollama.d.ts +12 -0
- package/dist/llm/providers/ollama.d.ts.map +1 -0
- package/dist/llm/providers/ollama.js +87 -0
- package/dist/llm/providers/ollama.js.map +1 -0
- package/dist/llm/providers/openai.d.ts +7 -0
- package/dist/llm/providers/openai.d.ts.map +1 -0
- package/dist/llm/providers/openai.js +8 -0
- package/dist/llm/providers/openai.js.map +1 -0
- package/dist/llm/providers/openai_compatible.d.ts +18 -0
- package/dist/llm/providers/openai_compatible.d.ts.map +1 -0
- package/dist/llm/providers/openai_compatible.js +70 -0
- package/dist/llm/providers/openai_compatible.js.map +1 -0
- package/dist/llm/types.d.ts +60 -0
- package/dist/llm/types.d.ts.map +1 -0
- package/dist/llm/types.js +2 -0
- package/dist/llm/types.js.map +1 -0
- package/dist/logging.d.ts +22 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +58 -0
- package/dist/logging.js.map +1 -0
- package/dist/loops/embed_worker.d.ts +44 -0
- package/dist/loops/embed_worker.d.ts.map +1 -0
- package/dist/loops/embed_worker.js +144 -0
- package/dist/loops/embed_worker.js.map +1 -0
- package/dist/loops/eval_grader.d.ts +19 -0
- package/dist/loops/eval_grader.d.ts.map +1 -0
- package/dist/loops/eval_grader.js +22 -0
- package/dist/loops/eval_grader.js.map +1 -0
- package/dist/loops/ingest_watcher.d.ts +17 -0
- package/dist/loops/ingest_watcher.d.ts.map +1 -0
- package/dist/loops/ingest_watcher.js +66 -0
- package/dist/loops/ingest_watcher.js.map +1 -0
- package/dist/loops/legacy_worker.d.ts +26 -0
- package/dist/loops/legacy_worker.d.ts.map +1 -0
- package/dist/loops/legacy_worker.js +102 -0
- package/dist/loops/legacy_worker.js.map +1 -0
- package/dist/loops/supervisor.d.ts +71 -0
- package/dist/loops/supervisor.d.ts.map +1 -0
- package/dist/loops/supervisor.js +122 -0
- package/dist/loops/supervisor.js.map +1 -0
- package/dist/loops/synthesis.d.ts +31 -0
- package/dist/loops/synthesis.d.ts.map +1 -0
- package/dist/loops/synthesis.js +71 -0
- package/dist/loops/synthesis.js.map +1 -0
- package/dist/loops/transcribe_worker.d.ts +22 -0
- package/dist/loops/transcribe_worker.d.ts.map +1 -0
- package/dist/loops/transcribe_worker.js +77 -0
- package/dist/loops/transcribe_worker.js.map +1 -0
- package/dist/output.d.ts +8 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +26 -0
- package/dist/output.js.map +1 -0
- package/dist/render/transcript_md.d.ts +5 -0
- package/dist/render/transcript_md.d.ts.map +1 -0
- package/dist/render/transcript_md.js +14 -0
- package/dist/render/transcript_md.js.map +1 -0
- package/dist/router.d.ts +3 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +68 -0
- package/dist/router.js.map +1 -0
- package/dist/transcriber_client.d.ts +42 -0
- package/dist/transcriber_client.d.ts.map +1 -0
- package/dist/transcriber_client.js +72 -0
- package/dist/transcriber_client.js.map +1 -0
- package/package.json +45 -0
- package/templates/AGENTS.md +25 -0
- package/templates/config.toml +56 -0
- package/templates/sample-seed/codebook/desire-for-manual-override.md +8 -0
- package/templates/sample-seed/codebook/distrust-of-automation.md +8 -0
- package/templates/sample-seed/highlights/H-001.md +9 -0
- package/templates/sample-seed/highlights/H-002.md +9 -0
- package/templates/sample-seed/seed.md +17 -0
- package/templates/sample-seed/sessions/S001/transcript.json +74 -0
- package/templates/sample-seed/synthesis/themes/control-earns-trust.md +13 -0
- package/templates/seed.md +21 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { spawnSync } from 'node:child_process';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { CompostError } from '../errors.js';
|
|
5
|
+
import { findRepoTranscriberDir, managedVenvDir } from './nativeRuntime.js';
|
|
6
|
+
/**
|
|
7
|
+
* Provision the managed native transcription venv (#183) so `compost transcribe`
|
|
8
|
+
* runs native (Parakeet + pyannote on Metal) with zero flags on a fresh
|
|
9
|
+
* Apple-Silicon machine. Side-effectful, so it's an explicit opt-in
|
|
10
|
+
* (`compost setup --provision-native`), separate from the read-only doctor.
|
|
11
|
+
*
|
|
12
|
+
* The dep list mirrors the transcriber's `[native]` extra in pyproject.toml; a
|
|
13
|
+
* unit test asserts they stay in sync. We install the deps (not the package
|
|
14
|
+
* editable) to avoid depending on a build backend — the `app` package is found
|
|
15
|
+
* at run time via the entrypoint's cwd.
|
|
16
|
+
*/
|
|
17
|
+
/** Native ASR deps — keep in sync with transcriber/pyproject.toml `[native]`. */
|
|
18
|
+
export const NATIVE_DEPS = [
|
|
19
|
+
'parakeet-mlx',
|
|
20
|
+
'pyannote.audio>=3.3',
|
|
21
|
+
'silero-vad',
|
|
22
|
+
'torchaudio>=2.3',
|
|
23
|
+
'ffmpeg-python',
|
|
24
|
+
];
|
|
25
|
+
const PY_CANDIDATES = ['python3.11', 'python3.12', 'python3'];
|
|
26
|
+
const VERIFY_IMPORTS = 'import parakeet_mlx, pyannote.audio, silero_vad, torchaudio';
|
|
27
|
+
const MIN_MINOR = 11;
|
|
28
|
+
const MAX_MINOR = 12; // transcriber requires-python = >=3.11,<3.13
|
|
29
|
+
const defaultExec = (cmd, args, opts) => {
|
|
30
|
+
const res = spawnSync(cmd, args, {
|
|
31
|
+
encoding: 'utf8',
|
|
32
|
+
// stream → live stdout (download progress) but still capture stderr so a
|
|
33
|
+
// failure has a diagnostic (inheriting stderr would null it out).
|
|
34
|
+
stdio: opts?.stream ? ['ignore', 'inherit', 'pipe'] : 'pipe',
|
|
35
|
+
maxBuffer: 64 * 1024 * 1024,
|
|
36
|
+
});
|
|
37
|
+
return { ok: !res.error && res.status === 0, stdout: res.stdout ?? '', stderr: res.stderr ?? '' };
|
|
38
|
+
};
|
|
39
|
+
function pyVersion(exec, bin) {
|
|
40
|
+
const r = exec(bin, ['--version']);
|
|
41
|
+
if (!r.ok)
|
|
42
|
+
return null;
|
|
43
|
+
const m = /Python (\d+)\.(\d+)/.exec(`${r.stdout} ${r.stderr}`);
|
|
44
|
+
return m ? [Number(m[1]), Number(m[2])] : null;
|
|
45
|
+
}
|
|
46
|
+
function resolvePython(exec, explicit) {
|
|
47
|
+
for (const c of explicit ? [explicit] : PY_CANDIDATES) {
|
|
48
|
+
const v = pyVersion(exec, c);
|
|
49
|
+
if (v && v[0] === 3 && v[1] >= MIN_MINOR && v[1] <= MAX_MINOR)
|
|
50
|
+
return c;
|
|
51
|
+
}
|
|
52
|
+
throw new CompostError('INVALID_INPUT', `no Python 3.${MIN_MINOR}–3.${MAX_MINOR} found (tried ${(explicit ? [explicit] : PY_CANDIDATES).join(', ')}). ` +
|
|
53
|
+
'Install one — e.g. `brew install python@3.11` — or pass --python-bin.');
|
|
54
|
+
}
|
|
55
|
+
/** Create + populate the managed native venv. Idempotent: a venv that already
|
|
56
|
+
* imports the deps is a no-op unless `force`. */
|
|
57
|
+
export function provisionNativeVenv(opts = {}) {
|
|
58
|
+
const env = opts.env ?? process.env;
|
|
59
|
+
const exists = opts.exists ?? existsSync;
|
|
60
|
+
const exec = opts.exec ?? defaultExec;
|
|
61
|
+
const steps = [];
|
|
62
|
+
const transcriberDir = opts.transcriberDir ?? env.COMPOST_TRANSCRIBER_DIR ?? findRepoTranscriberDir(undefined, exists);
|
|
63
|
+
if (transcriberDir === undefined || !exists(join(transcriberDir, 'pyproject.toml'))) {
|
|
64
|
+
throw new CompostError('INVALID_INPUT', 'could not locate the transcriber/ package. Pass --transcriber-dir or set COMPOST_TRANSCRIBER_DIR.');
|
|
65
|
+
}
|
|
66
|
+
const venvDir = managedVenvDir(env);
|
|
67
|
+
const venvPython = join(venvDir, 'bin', 'python');
|
|
68
|
+
if (!opts.force && exists(venvPython) && exec(venvPython, ['-c', VERIFY_IMPORTS]).ok) {
|
|
69
|
+
return {
|
|
70
|
+
status: 'already-ready',
|
|
71
|
+
venvDir,
|
|
72
|
+
venvPython,
|
|
73
|
+
pythonBin: null,
|
|
74
|
+
transcriberDir,
|
|
75
|
+
steps: ['venv present; native deps already import'],
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
// Only resolve a host interpreter when we actually need to CREATE the venv;
|
|
79
|
+
// reinstalling deps into an existing venv uses that venv's python, not the host.
|
|
80
|
+
let pythonBin = null;
|
|
81
|
+
if (opts.force || !exists(venvPython)) {
|
|
82
|
+
pythonBin = resolvePython(exec, opts.pythonBin);
|
|
83
|
+
steps.push(`interpreter ${pythonBin}`);
|
|
84
|
+
const mk = exec(pythonBin, ['-m', 'venv', ...(opts.force ? ['--clear'] : []), venvDir]);
|
|
85
|
+
if (!mk.ok)
|
|
86
|
+
throw new CompostError('PROVIDER_ERROR', `venv create failed: ${mk.stderr.slice(-300)}`);
|
|
87
|
+
steps.push(`created venv at ${venvDir}`);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
steps.push('venv present but deps missing — reinstalling');
|
|
91
|
+
}
|
|
92
|
+
exec(venvPython, ['-m', 'pip', 'install', '-q', '-U', 'pip']); // best-effort
|
|
93
|
+
const install = exec(venvPython, ['-m', 'pip', 'install', ...NATIVE_DEPS], { stream: true });
|
|
94
|
+
if (!install.ok) {
|
|
95
|
+
throw new CompostError('PROVIDER_ERROR', `pip install failed: ${install.stderr.slice(-400) || '(see pip output above)'}`);
|
|
96
|
+
}
|
|
97
|
+
steps.push(`installed ${NATIVE_DEPS.length} native deps`);
|
|
98
|
+
const verify = exec(venvPython, ['-c', VERIFY_IMPORTS]);
|
|
99
|
+
if (!verify.ok) {
|
|
100
|
+
throw new CompostError('PROVIDER_ERROR', `native deps did not import after install: ${verify.stderr.slice(-300)}`);
|
|
101
|
+
}
|
|
102
|
+
steps.push('verified parakeet-mlx + pyannote + silero + torchaudio import');
|
|
103
|
+
return { status: 'provisioned', venvDir, venvPython, pythonBin, transcriberDir, steps };
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=provisionNative.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provisionNative.js","sourceRoot":"","sources":["../../src/lib/provisionNative.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAC3C,OAAO,EAAE,sBAAsB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAE3E;;;;;;;;;;GAUG;AAEH,iFAAiF;AACjF,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,cAAc;IACd,qBAAqB;IACrB,YAAY;IACZ,iBAAiB;IACjB,eAAe;CAChB,CAAA;AAED,MAAM,aAAa,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,SAAS,CAAC,CAAA;AAC7D,MAAM,cAAc,GAAG,6DAA6D,CAAA;AACpF,MAAM,SAAS,GAAG,EAAE,CAAA;AACpB,MAAM,SAAS,GAAG,EAAE,CAAA,CAAC,6CAA6C;AAoClE,MAAM,WAAW,GAAkB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IACrD,MAAM,GAAG,GAAG,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE;QAC/B,QAAQ,EAAE,MAAM;QAChB,yEAAyE;QACzE,kEAAkE;QAClE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,SAAS,EAAE,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AAC,IAAI,wBAAwB,EAAE,CAChF,CAAA;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,aAAa,WAAW,CAAC,MAAM,cAAc,CAAC,CAAA;IAEzD,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAA;IACvD,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACf,MAAM,IAAI,YAAY,CACpB,gBAAgB,EAChB,6CAA6C,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CACzE,CAAA;IACH,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,+DAA+D,CAAC,CAAA;IAE3E,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,KAAK,EAAE,CAAA;AACzF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export type JobKind = 'transcribe' | 'legacy-ingest';
|
|
2
|
+
export type JobStatus = 'queued' | 'running' | 'done' | 'failed';
|
|
3
|
+
export interface Job {
|
|
4
|
+
id: number;
|
|
5
|
+
kind: JobKind;
|
|
6
|
+
source_path: string;
|
|
7
|
+
payload: Record<string, unknown>;
|
|
8
|
+
status: JobStatus;
|
|
9
|
+
attempts: number;
|
|
10
|
+
created_at: string;
|
|
11
|
+
updated_at: string;
|
|
12
|
+
error: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface QueueOptions {
|
|
15
|
+
now?: () => Date;
|
|
16
|
+
}
|
|
17
|
+
export declare class JobQueue {
|
|
18
|
+
private readonly db;
|
|
19
|
+
private readonly now;
|
|
20
|
+
constructor(dbPath: string, opts?: QueueOptions);
|
|
21
|
+
/** Enqueue a job. Idempotent on (kind, source_path): returns the existing
|
|
22
|
+
* job id when already present (resumable folder ingest relies on this). */
|
|
23
|
+
enqueue(kind: JobKind, sourcePath: string, payload?: Record<string, unknown>): {
|
|
24
|
+
id: number;
|
|
25
|
+
inserted: boolean;
|
|
26
|
+
};
|
|
27
|
+
/** Atomically claim the oldest queued job (status → running, attempts++).
|
|
28
|
+
* Pass a kind to claim only jobs of that kind (per-worker draining). */
|
|
29
|
+
claim(kind?: JobKind): Job | null;
|
|
30
|
+
complete(id: number): void;
|
|
31
|
+
fail(id: number, error: string, maxAttempts?: number): void;
|
|
32
|
+
list(status?: JobStatus): Job[];
|
|
33
|
+
close(): void;
|
|
34
|
+
}
|
|
35
|
+
export declare function stateDbPath(seedPath: string): string;
|
|
36
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/lib/queue.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,OAAO,GAAG,YAAY,GAAG,eAAe,CAAA;AACpD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEhE,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAChC,MAAM,EAAE,SAAS,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB;AA4CD,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CACjB;AAED,qBAAa,QAAQ;IACnB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAmB;IACtC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAY;gBAEpB,MAAM,EAAE,MAAM,EAAE,IAAI,GAAE,YAAiB;IAQnD;+EAC2E;IAC3E,OAAO,CACL,IAAI,EAAE,OAAO,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACpC;QACD,EAAE,EAAE,MAAM,CAAA;QACV,QAAQ,EAAE,OAAO,CAAA;KAClB;IAeD;4EACwE;IACxE,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,GAAG,GAAG,IAAI;IAuBjC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAM1B,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,SAAI,GAAG,IAAI;IAUtD,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,GAAG,EAAE;IAS/B,KAAK,IAAI,IAAI;CAGd;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { mkdirSync } from 'node:fs';
|
|
2
|
+
import { dirname, join } from 'node:path';
|
|
3
|
+
import Database from 'better-sqlite3';
|
|
4
|
+
const SCHEMA = `
|
|
5
|
+
CREATE TABLE IF NOT EXISTS jobs (
|
|
6
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
7
|
+
kind TEXT NOT NULL,
|
|
8
|
+
source_path TEXT NOT NULL,
|
|
9
|
+
payload TEXT NOT NULL DEFAULT '{}',
|
|
10
|
+
status TEXT NOT NULL DEFAULT 'queued',
|
|
11
|
+
attempts INTEGER NOT NULL DEFAULT 0,
|
|
12
|
+
created_at TEXT NOT NULL,
|
|
13
|
+
updated_at TEXT NOT NULL,
|
|
14
|
+
error TEXT,
|
|
15
|
+
UNIQUE (kind, source_path)
|
|
16
|
+
);
|
|
17
|
+
CREATE INDEX IF NOT EXISTS idx_jobs_status ON jobs(status);
|
|
18
|
+
`;
|
|
19
|
+
function rowToJob(r) {
|
|
20
|
+
return {
|
|
21
|
+
id: r.id,
|
|
22
|
+
kind: r.kind,
|
|
23
|
+
source_path: r.source_path,
|
|
24
|
+
payload: JSON.parse(r.payload),
|
|
25
|
+
status: r.status,
|
|
26
|
+
attempts: r.attempts,
|
|
27
|
+
created_at: r.created_at,
|
|
28
|
+
updated_at: r.updated_at,
|
|
29
|
+
error: r.error,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export class JobQueue {
|
|
33
|
+
db;
|
|
34
|
+
now;
|
|
35
|
+
constructor(dbPath, opts = {}) {
|
|
36
|
+
if (dbPath !== ':memory:')
|
|
37
|
+
mkdirSync(dirname(dbPath), { recursive: true });
|
|
38
|
+
this.db = new Database(dbPath);
|
|
39
|
+
this.db.pragma('journal_mode = WAL');
|
|
40
|
+
this.db.exec(SCHEMA);
|
|
41
|
+
this.now = opts.now ?? (() => new Date());
|
|
42
|
+
}
|
|
43
|
+
/** Enqueue a job. Idempotent on (kind, source_path): returns the existing
|
|
44
|
+
* job id when already present (resumable folder ingest relies on this). */
|
|
45
|
+
enqueue(kind, sourcePath, payload = {}) {
|
|
46
|
+
const ts = this.now().toISOString();
|
|
47
|
+
const existing = this.db
|
|
48
|
+
.prepare('SELECT id FROM jobs WHERE kind = ? AND source_path = ?')
|
|
49
|
+
.get(kind, sourcePath);
|
|
50
|
+
if (existing !== undefined)
|
|
51
|
+
return { id: existing.id, inserted: false };
|
|
52
|
+
const info = this.db
|
|
53
|
+
.prepare(`INSERT INTO jobs (kind, source_path, payload, status, created_at, updated_at)
|
|
54
|
+
VALUES (?, ?, ?, 'queued', ?, ?)`)
|
|
55
|
+
.run(kind, sourcePath, JSON.stringify(payload), ts, ts);
|
|
56
|
+
return { id: Number(info.lastInsertRowid), inserted: true };
|
|
57
|
+
}
|
|
58
|
+
/** Atomically claim the oldest queued job (status → running, attempts++).
|
|
59
|
+
* Pass a kind to claim only jobs of that kind (per-worker draining). */
|
|
60
|
+
claim(kind) {
|
|
61
|
+
const tx = this.db.transaction(() => {
|
|
62
|
+
const row = (kind === undefined
|
|
63
|
+
? this.db.prepare("SELECT * FROM jobs WHERE status = 'queued' ORDER BY id LIMIT 1").get()
|
|
64
|
+
: this.db
|
|
65
|
+
.prepare("SELECT * FROM jobs WHERE status = 'queued' AND kind = ? ORDER BY id LIMIT 1")
|
|
66
|
+
.get(kind));
|
|
67
|
+
if (row === undefined)
|
|
68
|
+
return null;
|
|
69
|
+
const ts = this.now().toISOString();
|
|
70
|
+
this.db
|
|
71
|
+
.prepare("UPDATE jobs SET status = 'running', attempts = attempts + 1, updated_at = ? WHERE id = ?")
|
|
72
|
+
.run(ts, row.id);
|
|
73
|
+
return rowToJob({ ...row, status: 'running', attempts: row.attempts + 1 });
|
|
74
|
+
});
|
|
75
|
+
return tx();
|
|
76
|
+
}
|
|
77
|
+
complete(id) {
|
|
78
|
+
this.db
|
|
79
|
+
.prepare("UPDATE jobs SET status = 'done', updated_at = ?, error = NULL WHERE id = ?")
|
|
80
|
+
.run(this.now().toISOString(), id);
|
|
81
|
+
}
|
|
82
|
+
fail(id, error, maxAttempts = 3) {
|
|
83
|
+
const row = this.db.prepare('SELECT attempts FROM jobs WHERE id = ?').get(id);
|
|
84
|
+
const status = row !== undefined && row.attempts >= maxAttempts ? 'failed' : 'queued';
|
|
85
|
+
this.db
|
|
86
|
+
.prepare('UPDATE jobs SET status = ?, updated_at = ?, error = ? WHERE id = ?')
|
|
87
|
+
.run(status, this.now().toISOString(), error, id);
|
|
88
|
+
}
|
|
89
|
+
list(status) {
|
|
90
|
+
const rows = (status === undefined
|
|
91
|
+
? this.db.prepare('SELECT * FROM jobs ORDER BY id').all()
|
|
92
|
+
: this.db.prepare('SELECT * FROM jobs WHERE status = ? ORDER BY id').all(status));
|
|
93
|
+
return rows.map(rowToJob);
|
|
94
|
+
}
|
|
95
|
+
close() {
|
|
96
|
+
this.db.close();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export function stateDbPath(seedPath) {
|
|
100
|
+
return join(seedPath, '.compost', 'state.sqlite');
|
|
101
|
+
}
|
|
102
|
+
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CAAA;QACb,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAC3B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAA;IACjB,CAAC;CACF;AAED,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,cAAc,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type Chunk, type DenseRetriever, type EvidenceSet, type ScoredChunk } from 'compost-retrieval';
|
|
2
|
+
import { type CompostConfig } from './config.js';
|
|
3
|
+
/**
|
|
4
|
+
* Shared retrieval primitives for `compost search` (retrieval-only) and
|
|
5
|
+
* `compost chat` (retrieval + LLM synthesis). Extracted so the two commands
|
|
6
|
+
* never diverge on how the corpus is loaded, chunked, and ranked.
|
|
7
|
+
*
|
|
8
|
+
* Retrieval is BM25-only today: HybridRetriever's dense slot is null because
|
|
9
|
+
* nothing reads the LanceDB index the embed-worker writes (#137). Wiring
|
|
10
|
+
* LanceDBRetriever into this shared path is a follow-up that upgrades both
|
|
11
|
+
* `search` and `chat` ranking at once — see the tracking issue.
|
|
12
|
+
*/
|
|
13
|
+
export interface LoadedCorpus {
|
|
14
|
+
chunks: Chunk[];
|
|
15
|
+
evidence: EvidenceSet;
|
|
16
|
+
seedName: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Load every session transcript under a seed into:
|
|
20
|
+
* - `chunks`: chunked text for retrieval (utterance + neighbor windows + …)
|
|
21
|
+
* - `evidence`: utterance_id → {session_id, text}, for citation validation
|
|
22
|
+
*/
|
|
23
|
+
export declare function loadSeedCorpus(seedPath: string): LoadedCorpus;
|
|
24
|
+
export type RetrievalMode = 'hybrid' | 'bm25';
|
|
25
|
+
export interface RetrieveOptions {
|
|
26
|
+
topK?: number;
|
|
27
|
+
/** Dense retriever (LanceDB). When provided, retrieval is BM25 ∪ dense fused
|
|
28
|
+
* via RRF. When null/omitted, BM25-only. Inject via buildDenseRetriever. */
|
|
29
|
+
dense?: DenseRetriever | null;
|
|
30
|
+
}
|
|
31
|
+
export interface RetrieveResult {
|
|
32
|
+
retrieved: ScoredChunk[];
|
|
33
|
+
corpus: LoadedCorpus;
|
|
34
|
+
mode: RetrievalMode;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Rank corpus chunks against a query. Returns ScoredChunks (highest first).
|
|
38
|
+
* Empty array when the seed has no indexed sessions or nothing matches.
|
|
39
|
+
*
|
|
40
|
+
* Hybrid (BM25 + dense via RRF) when a dense retriever is supplied; BM25-only
|
|
41
|
+
* otherwise. The `mode` field reports which ran.
|
|
42
|
+
*/
|
|
43
|
+
export declare function retrieveChunks(seedPath: string, query: string, opts?: RetrieveOptions): Promise<RetrieveResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Build a dense retriever for a seed, or return null when dense isn't available
|
|
46
|
+
* — no LanceDB index yet, the native binary absent, or the embeddings provider
|
|
47
|
+
* unreachable. Never throws: a null result means the caller does BM25-only, so
|
|
48
|
+
* `compost search` always works even with Ollama down.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildDenseRetriever(seedPath: string, config?: CompostConfig): Promise<DenseRetriever | null>;
|
|
51
|
+
//# sourceMappingURL=retrieve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieve.d.ts","sourceRoot":"","sources":["../../src/lib/retrieve.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,KAAK,EAGV,KAAK,cAAc,EACnB,KAAK,WAAW,EAGhB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AAG1B,OAAO,EAAE,KAAK,aAAa,EAAc,MAAM,aAAa,CAAA;AAE5D;;;;;;;;;GASG;AAEH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,QAAQ,EAAE,WAAW,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAoB7D;AAED,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,MAAM,CAAA;AAE7C,MAAM,WAAW,eAAe;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;gFAC4E;IAC5E,KAAK,CAAC,EAAE,cAAc,GAAG,IAAI,CAAA;CAC9B;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,WAAW,EAAE,CAAA;IACxB,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,EAAE,aAAa,CAAA;CACpB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,cAAc,CAAC,CAWzB;AAWD;;;;;GAKG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAyBhC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { BM25Index, chunkTranscript, HybridRetriever, openLanceDBForRead, } from 'compost-retrieval';
|
|
4
|
+
import { LLMAdapter } from '../llm/adapter.js';
|
|
5
|
+
import { loadConfig } from './config.js';
|
|
6
|
+
/**
|
|
7
|
+
* Load every session transcript under a seed into:
|
|
8
|
+
* - `chunks`: chunked text for retrieval (utterance + neighbor windows + …)
|
|
9
|
+
* - `evidence`: utterance_id → {session_id, text}, for citation validation
|
|
10
|
+
*/
|
|
11
|
+
export function loadSeedCorpus(seedPath) {
|
|
12
|
+
const seedName = seedPath.split('/').pop() ?? 'seed';
|
|
13
|
+
const sessionsDir = join(seedPath, 'sessions');
|
|
14
|
+
const evidence = new Map();
|
|
15
|
+
const allChunks = [];
|
|
16
|
+
if (!existsSync(sessionsDir))
|
|
17
|
+
return { chunks: [], evidence, seedName };
|
|
18
|
+
for (const entry of readdirSync(sessionsDir)) {
|
|
19
|
+
if (entry.startsWith('.') || entry === '_inbox')
|
|
20
|
+
continue;
|
|
21
|
+
const tPath = join(sessionsDir, entry, 'transcript.json');
|
|
22
|
+
if (!existsSync(tPath) || !statSync(tPath).isFile())
|
|
23
|
+
continue;
|
|
24
|
+
const transcript = JSON.parse(readFileSync(tPath, 'utf8'));
|
|
25
|
+
for (const u of transcript.utterances) {
|
|
26
|
+
evidence.set(u.id, { session_id: transcript.session_id, text: u.text });
|
|
27
|
+
}
|
|
28
|
+
allChunks.push(...chunkTranscript(transcript, { seed: seedName }));
|
|
29
|
+
}
|
|
30
|
+
return { chunks: allChunks, evidence, seedName };
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Rank corpus chunks against a query. Returns ScoredChunks (highest first).
|
|
34
|
+
* Empty array when the seed has no indexed sessions or nothing matches.
|
|
35
|
+
*
|
|
36
|
+
* Hybrid (BM25 + dense via RRF) when a dense retriever is supplied; BM25-only
|
|
37
|
+
* otherwise. The `mode` field reports which ran.
|
|
38
|
+
*/
|
|
39
|
+
export async function retrieveChunks(seedPath, query, opts = {}) {
|
|
40
|
+
const corpus = loadSeedCorpus(seedPath);
|
|
41
|
+
const dense = opts.dense ?? null;
|
|
42
|
+
const mode = dense ? 'hybrid' : 'bm25';
|
|
43
|
+
if (corpus.chunks.length === 0)
|
|
44
|
+
return { retrieved: [], corpus, mode };
|
|
45
|
+
const bm25 = new BM25Index();
|
|
46
|
+
bm25.addAll(corpus.chunks);
|
|
47
|
+
const retriever = new HybridRetriever(bm25, dense);
|
|
48
|
+
const retrieved = await retriever.retrieve(query, { topK: opts.topK ?? 8 });
|
|
49
|
+
return { retrieved, corpus, mode };
|
|
50
|
+
}
|
|
51
|
+
/** Embedding-vector dimension by model tag (mirrors the embed-worker's table). */
|
|
52
|
+
const DIM_BY_MODEL = {
|
|
53
|
+
'bge-m3': 1024,
|
|
54
|
+
'bge-m3:q4_k_m': 1024,
|
|
55
|
+
'mxbai-embed-large': 1024,
|
|
56
|
+
'nomic-embed-text': 768,
|
|
57
|
+
'all-minilm': 384,
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Build a dense retriever for a seed, or return null when dense isn't available
|
|
61
|
+
* — no LanceDB index yet, the native binary absent, or the embeddings provider
|
|
62
|
+
* unreachable. Never throws: a null result means the caller does BM25-only, so
|
|
63
|
+
* `compost search` always works even with Ollama down.
|
|
64
|
+
*/
|
|
65
|
+
export async function buildDenseRetriever(seedPath, config) {
|
|
66
|
+
const uri = join(seedPath, '.compost', 'vectors.lancedb');
|
|
67
|
+
if (!existsSync(uri))
|
|
68
|
+
return null;
|
|
69
|
+
let adapter;
|
|
70
|
+
try {
|
|
71
|
+
adapter = new LLMAdapter(config ?? loadConfig(seedPath));
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const embedQuery = async (q) => {
|
|
77
|
+
const resp = await adapter.embed('embeddings', [q]);
|
|
78
|
+
const vec = resp.vectors[0];
|
|
79
|
+
if (vec === undefined)
|
|
80
|
+
throw new Error('embeddings provider returned no vector');
|
|
81
|
+
return vec;
|
|
82
|
+
};
|
|
83
|
+
// openLanceDBForRead is null-safe (missing index / absent binary); we still
|
|
84
|
+
// wrap in try/catch so a provider/config error degrades to BM25, not a throw.
|
|
85
|
+
try {
|
|
86
|
+
return await openLanceDBForRead(uri, embedQuery);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=retrieve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retrieve.js","sourceRoot":"","sources":["../../src/lib/retrieve.ts"],"names":[],"mappings":"AAAA,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|
+
cwd?: string;
|
|
7
|
+
seed?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Walk a seed's coded corpus and return, per session in chronological order,
|
|
11
|
+
* the themes it contributed to. The join is theme.codes → code.evidence
|
|
12
|
+
* (highlight ids) → highlight.session_id. A theme is "from" a session if any
|
|
13
|
+
* of its codes is evidenced by a highlight in that session.
|
|
14
|
+
*
|
|
15
|
+
* Sessions are ordered by directory name (S001, S002 …) — compost's session
|
|
16
|
+
* ids are assigned sequentially at ingest, so lexicographic order is also
|
|
17
|
+
* chronological. The returned shape matches the input contract of
|
|
18
|
+
* `saturationPulse()` in compost-retrieval.
|
|
19
|
+
*/
|
|
20
|
+
export declare function gatherSessionsWithThemes(opts?: GatherOptions): SessionWithThemes[];
|
|
21
|
+
//# sourceMappingURL=saturate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"saturate.d.ts","sourceRoot":"","sources":["../../src/lib/saturate.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,GAAE,aAAkB,GAAG,iBAAiB,EAAE,CAyCtF"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
2
|
+
import { basename, join, resolve } from 'node:path';
|
|
3
|
+
import { CompostError } from '../errors.js';
|
|
4
|
+
import { listCanonicalSessionIds } from './canonicalSessions.js';
|
|
5
|
+
import { resolveSeedPath } from './seedResolve.js';
|
|
6
|
+
/**
|
|
7
|
+
* Walk a seed's coded corpus and return, per session in chronological order,
|
|
8
|
+
* the themes it contributed to. The join is theme.codes → code.evidence
|
|
9
|
+
* (highlight ids) → highlight.session_id. A theme is "from" a session if any
|
|
10
|
+
* of its codes is evidenced by a highlight in that session.
|
|
11
|
+
*
|
|
12
|
+
* Sessions are ordered by directory name (S001, S002 …) — compost's session
|
|
13
|
+
* ids are assigned sequentially at ingest, so lexicographic order is also
|
|
14
|
+
* chronological. The returned shape matches the input contract of
|
|
15
|
+
* `saturationPulse()` in compost-retrieval.
|
|
16
|
+
*/
|
|
17
|
+
export function gatherSessionsWithThemes(opts = {}) {
|
|
18
|
+
const cwd = opts.cwd ?? process.cwd();
|
|
19
|
+
const seedPath = resolveSeedPath(cwd, opts.seed);
|
|
20
|
+
const highlightToSession = readHighlightSessions(join(seedPath, 'highlights'));
|
|
21
|
+
const codeToHighlights = readCodeEvidence(join(seedPath, 'codebook'));
|
|
22
|
+
const themeToCodes = readThemeCodes(join(seedPath, 'synthesis', 'themes'));
|
|
23
|
+
const sessionToThemes = new Map();
|
|
24
|
+
// Single source of truth (#166): the same canonical-session predicate
|
|
25
|
+
// `compost status` uses — `S\d+` names OR a transcript.json/source.* file.
|
|
26
|
+
// Pre-fix: every subdir of sessions/ (incl. legacy Attachments/, Transcripts/)
|
|
27
|
+
// was counted, inflating the session set vs status's view.
|
|
28
|
+
for (const sessionId of listCanonicalSessionIds(join(seedPath, 'sessions'))) {
|
|
29
|
+
sessionToThemes.set(sessionId, new Set());
|
|
30
|
+
}
|
|
31
|
+
for (const [themeId, codeIds] of themeToCodes) {
|
|
32
|
+
for (const codeId of codeIds) {
|
|
33
|
+
const highlightIds = codeToHighlights.get(codeId) ?? [];
|
|
34
|
+
for (const hid of highlightIds) {
|
|
35
|
+
const sessionId = highlightToSession.get(hid);
|
|
36
|
+
if (sessionId === undefined)
|
|
37
|
+
continue;
|
|
38
|
+
const bucket = sessionToThemes.get(sessionId);
|
|
39
|
+
if (bucket === undefined) {
|
|
40
|
+
// Highlight references a session that isn't a directory under
|
|
41
|
+
// sessions/ — surface it so a broken corpus fails loudly rather
|
|
42
|
+
// than silently distorting the saturation curve.
|
|
43
|
+
throw new CompostError('SCHEMA_VIOLATION', `Highlight ${hid} references session ${sessionId}, but Seeds/${basename(seedPath)}/sessions/${sessionId}/ does not exist.`);
|
|
44
|
+
}
|
|
45
|
+
bucket.add(themeId);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return [...sessionToThemes.entries()]
|
|
50
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
51
|
+
.map(([id, themes]) => ({ id, themes: [...themes].sort() }));
|
|
52
|
+
}
|
|
53
|
+
function readHighlightSessions(dir) {
|
|
54
|
+
const out = new Map();
|
|
55
|
+
for (const fm of readFrontmatters(dir)) {
|
|
56
|
+
const id = fm.scalars.get('id');
|
|
57
|
+
const sessionId = fm.scalars.get('session_id');
|
|
58
|
+
if (id !== undefined && sessionId !== undefined)
|
|
59
|
+
out.set(id, sessionId);
|
|
60
|
+
}
|
|
61
|
+
return out;
|
|
62
|
+
}
|
|
63
|
+
function readCodeEvidence(dir) {
|
|
64
|
+
const out = new Map();
|
|
65
|
+
for (const fm of readFrontmatters(dir)) {
|
|
66
|
+
const id = fm.scalars.get('id');
|
|
67
|
+
const evidence = fm.arrays.get('evidence');
|
|
68
|
+
if (id !== undefined && evidence !== undefined)
|
|
69
|
+
out.set(id, evidence);
|
|
70
|
+
}
|
|
71
|
+
return out;
|
|
72
|
+
}
|
|
73
|
+
function readThemeCodes(dir) {
|
|
74
|
+
const out = new Map();
|
|
75
|
+
for (const fm of readFrontmatters(dir)) {
|
|
76
|
+
const id = fm.scalars.get('id');
|
|
77
|
+
const codes = fm.arrays.get('codes');
|
|
78
|
+
if (id !== undefined && codes !== undefined)
|
|
79
|
+
out.set(id, codes);
|
|
80
|
+
}
|
|
81
|
+
return out;
|
|
82
|
+
}
|
|
83
|
+
function readFrontmatters(dir) {
|
|
84
|
+
if (!existsSync(dir))
|
|
85
|
+
return [];
|
|
86
|
+
const out = [];
|
|
87
|
+
for (const entry of readdirSync(dir)) {
|
|
88
|
+
if (!entry.endsWith('.md'))
|
|
89
|
+
continue;
|
|
90
|
+
const path = resolve(dir, entry);
|
|
91
|
+
if (!statSync(path).isFile())
|
|
92
|
+
continue;
|
|
93
|
+
const fm = parseFrontmatter(readFileSync(path, 'utf8'));
|
|
94
|
+
if (fm !== null)
|
|
95
|
+
out.push(fm);
|
|
96
|
+
}
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
function parseFrontmatter(content) {
|
|
100
|
+
const match = content.match(/^---\n([\s\S]*?)\n---/);
|
|
101
|
+
if (match === null)
|
|
102
|
+
return null;
|
|
103
|
+
const scalars = new Map();
|
|
104
|
+
const arrays = new Map();
|
|
105
|
+
for (const line of (match[1] ?? '').split('\n')) {
|
|
106
|
+
const m = line.match(/^([A-Za-z_][A-Za-z0-9_-]*):\s*(.*)$/);
|
|
107
|
+
if (m === null)
|
|
108
|
+
continue;
|
|
109
|
+
const key = m[1];
|
|
110
|
+
const raw = (m[2] ?? '').trim();
|
|
111
|
+
if (key === undefined || raw.length === 0)
|
|
112
|
+
continue;
|
|
113
|
+
const inline = raw.match(/^\[(.*)\]$/);
|
|
114
|
+
if (inline !== null) {
|
|
115
|
+
arrays.set(key, (inline[1] ?? '')
|
|
116
|
+
.split(',')
|
|
117
|
+
.map((s) => stripQuotes(s.trim()))
|
|
118
|
+
.filter((s) => s.length > 0));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
scalars.set(key, stripQuotes(raw));
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return { scalars, arrays };
|
|
125
|
+
}
|
|
126
|
+
function stripQuotes(s) {
|
|
127
|
+
if ((s.startsWith('"') && s.endsWith('"')) || (s.startsWith("'") && s.endsWith("'"))) {
|
|
128
|
+
return s.slice(1, -1);
|
|
129
|
+
}
|
|
130
|
+
return s;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=saturate.js.map
|
|
@@ -0,0 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|
|
3
|
+
*
|
|
4
|
+
* Embeds every schema/*.json file as a typed constant so validate.ts can use
|
|
5
|
+
* them without filesystem IO. The CLI can be published standalone without
|
|
6
|
+
* the schema/ tree because the schemas are now part of the compiled bundle.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ANSWER_SCHEMA: Record<string, unknown>;
|
|
9
|
+
export declare const CUES_TAXONOMY: Record<string, unknown>;
|
|
10
|
+
export declare const EVENTS_SCHEMA: Record<string, unknown>;
|
|
11
|
+
export declare const FRAMES_TAXONOMY: Record<string, unknown>;
|
|
12
|
+
export declare const STATUS_SCHEMA: Record<string, unknown>;
|
|
13
|
+
export declare const TRANSCRIPT_SCHEMA: Record<string, unknown>;
|
|
14
|
+
export declare const ALL_SCHEMAS: Record<string, Record<string, unknown>>;
|
|
15
|
+
//# sourceMappingURL=schemas.generated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.generated.d.ts","sourceRoot":"","sources":["../../src/lib/schemas.generated.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAyDjD,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAsDjD,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CA0KjD,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAmDnD,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CA+IjD,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CA6drD,CAAA;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAO/D,CAAA"}
|