@vibgrate/cli 2026.803.5 → 2026.805.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/DOCS.md +1 -1
- package/README.md +23 -15
- package/dist/{agent-PQEODATY.js → agent-WH2VVIHM.js} +10 -12
- package/dist/{agent-PQEODATY.js.map → agent-WH2VVIHM.js.map} +1 -1
- package/dist/{baseline-SU2PCQV2.js → baseline-LMGZURQF.js} +3 -3
- package/dist/{baseline-SU2PCQV2.js.map → baseline-LMGZURQF.js.map} +1 -1
- package/dist/{chunk-COZEHQTK.js → chunk-3ZNFU2GI.js} +7 -7
- package/dist/{chunk-COZEHQTK.js.map → chunk-3ZNFU2GI.js.map} +1 -1
- package/dist/{chunk-TVRM57CE.js → chunk-4CM33QT2.js} +4 -4
- package/dist/{chunk-TVRM57CE.js.map → chunk-4CM33QT2.js.map} +1 -1
- package/dist/{chunk-H4XQQ4N2.js → chunk-55Q56FD7.js} +6 -7
- package/dist/chunk-55Q56FD7.js.map +1 -0
- package/dist/{chunk-TKV3GAKX.js → chunk-5HDCARJE.js} +4 -4
- package/dist/{chunk-TKV3GAKX.js.map → chunk-5HDCARJE.js.map} +1 -1
- package/dist/{chunk-OCINHIPN.js → chunk-6IL3UJTE.js} +458 -6
- package/dist/chunk-6IL3UJTE.js.map +1 -0
- package/dist/{chunk-LOV44ROX.js → chunk-6LDYH3PR.js} +4 -4
- package/dist/{chunk-LOV44ROX.js.map → chunk-6LDYH3PR.js.map} +1 -1
- package/dist/{chunk-HE2TEFWY.js → chunk-AQLP3V5Y.js} +4 -4
- package/dist/{chunk-HE2TEFWY.js.map → chunk-AQLP3V5Y.js.map} +1 -1
- package/dist/{chunk-UJGWQ6YA.js → chunk-B6CWDTAG.js} +3 -4
- package/dist/chunk-B6CWDTAG.js.map +1 -0
- package/dist/{chunk-CPGTEDFD.js → chunk-DG33XQX2.js} +3 -3
- package/dist/{chunk-CPGTEDFD.js.map → chunk-DG33XQX2.js.map} +1 -1
- package/dist/{chunk-VJHNGNCT.js → chunk-E72RZJPC.js} +5 -6
- package/dist/chunk-E72RZJPC.js.map +1 -0
- package/dist/{chunk-KFK7KCAH.js → chunk-FTZGQPHB.js} +3 -3
- package/dist/{chunk-KFK7KCAH.js.map → chunk-FTZGQPHB.js.map} +1 -1
- package/dist/{chunk-72XI4MTL.js → chunk-IA3WXZLB.js} +7 -8
- package/dist/chunk-IA3WXZLB.js.map +1 -0
- package/dist/{chunk-5WMFX7TY.js → chunk-IFCK26ZD.js} +4 -4
- package/dist/{chunk-5WMFX7TY.js.map → chunk-IFCK26ZD.js.map} +1 -1
- package/dist/{chunk-JZGVUH57.js → chunk-LGYIYZVS.js} +4 -4
- package/dist/{chunk-JZGVUH57.js.map → chunk-LGYIYZVS.js.map} +1 -1
- package/dist/chunk-MEKXVHW7.js +6 -0
- package/dist/{chunk-USO67ZEE.js.map → chunk-MEKXVHW7.js.map} +1 -1
- package/dist/{chunk-UH2WHRKJ.js → chunk-Q6OQPCYC.js} +7 -8
- package/dist/chunk-Q6OQPCYC.js.map +1 -0
- package/dist/{chunk-UXWN5YQW.js → chunk-QCEGM4WC.js} +4 -4
- package/dist/{chunk-UXWN5YQW.js.map → chunk-QCEGM4WC.js.map} +1 -1
- package/dist/{chunk-2A7XCANX.js → chunk-QTKGOXSE.js} +218 -24
- package/dist/chunk-QTKGOXSE.js.map +1 -0
- package/dist/{chunk-SJC3VKQ2.js → chunk-TSEE4YUQ.js} +4 -4
- package/dist/{chunk-SJC3VKQ2.js.map → chunk-TSEE4YUQ.js.map} +1 -1
- package/dist/{chunk-MKDM2KLO.js → chunk-YW45X2XK.js} +8 -9
- package/dist/chunk-YW45X2XK.js.map +1 -0
- package/dist/cli.js +91 -45
- package/dist/cli.js.map +1 -1
- package/dist/embed-worker-main.js +5 -2
- package/dist/embed-worker-main.js.map +1 -1
- package/dist/{ensure-map-Z6UXBPI7.js → ensure-map-HWHMALI4.js} +12 -14
- package/dist/{ensure-map-Z6UXBPI7.js.map → ensure-map-HWHMALI4.js.map} +1 -1
- package/dist/graph-backend-H42SHYB5.js +13 -0
- package/dist/{graph-backend-3A2M22QN.js.map → graph-backend-H42SHYB5.js.map} +1 -1
- package/dist/index.d.ts +25 -6
- package/dist/index.js +11 -13
- package/dist/index.js.map +1 -1
- package/dist/{interactive-6TCXGIMA.js → interactive-AAKPP4BJ.js} +21 -23
- package/dist/interactive-AAKPP4BJ.js.map +1 -0
- package/dist/load-BB52WJTD.js +9 -0
- package/dist/{load-QHU4WMUN.js.map → load-BB52WJTD.js.map} +1 -1
- package/dist/{run-outcome-NHD3NXTL.js → run-outcome-TTLHJEDB.js} +5 -7
- package/dist/run-outcome-TTLHJEDB.js.map +1 -0
- package/dist/runtime-session-CKNRMKSK.js +20 -0
- package/dist/{runtime-session-W65P4OXR.js.map → runtime-session-CKNRMKSK.js.map} +1 -1
- package/dist/session-5TNNGP2K.js +15 -0
- package/dist/{session-NZKZXBX4.js.map → session-5TNNGP2K.js.map} +1 -1
- package/dist/{stream-json-MLWEIQNK.js → stream-json-T6DS3GIO.js} +10 -12
- package/dist/stream-json-T6DS3GIO.js.map +1 -0
- package/dist/{vg-mcp-bridge-2DEZF3JM.js → vg-mcp-bridge-AP3B7BN6.js} +8 -10
- package/dist/vg-mcp-bridge-AP3B7BN6.js.map +1 -0
- package/dist/{vgd-W7IHKGNU.js → vgd-FXIEZZT2.js} +8 -10
- package/dist/vgd-FXIEZZT2.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-2A7XCANX.js.map +0 -1
- package/dist/chunk-4LGDQBYK.js +0 -358
- package/dist/chunk-4LGDQBYK.js.map +0 -1
- package/dist/chunk-72XI4MTL.js.map +0 -1
- package/dist/chunk-H4XQQ4N2.js.map +0 -1
- package/dist/chunk-MKDM2KLO.js.map +0 -1
- package/dist/chunk-OCINHIPN.js.map +0 -1
- package/dist/chunk-RBMKBYGV.js +0 -102
- package/dist/chunk-RBMKBYGV.js.map +0 -1
- package/dist/chunk-UH2WHRKJ.js.map +0 -1
- package/dist/chunk-UJGWQ6YA.js.map +0 -1
- package/dist/chunk-USO67ZEE.js +0 -6
- package/dist/chunk-VJHNGNCT.js.map +0 -1
- package/dist/graph-backend-3A2M22QN.js +0 -13
- package/dist/interactive-6TCXGIMA.js.map +0 -1
- package/dist/load-QHU4WMUN.js +0 -11
- package/dist/run-outcome-NHD3NXTL.js.map +0 -1
- package/dist/runtime-session-W65P4OXR.js +0 -22
- package/dist/session-NZKZXBX4.js +0 -17
- package/dist/stream-json-MLWEIQNK.js.map +0 -1
- package/dist/vg-mcp-bridge-2DEZF3JM.js.map +0 -1
- package/dist/vgd-W7IHKGNU.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildMessages, parseEdits, applyEdits, unifiedDiff, redactSecrets } from './chunk-2U4SXS5U.js';
|
|
2
|
-
import { recordCliCall, CLI_TOOL_ALIASES, buildCodeContext, buildTaskCapsule, capsuleToCodeContext } from './chunk-
|
|
3
|
-
import { analyzeQuestion, loadTopicTags } from './chunk-
|
|
2
|
+
import { recordCliCall, CLI_TOOL_ALIASES, buildCodeContext, buildTaskCapsule, capsuleToCodeContext } from './chunk-LGYIYZVS.js';
|
|
3
|
+
import { analyzeQuestion, loadTopicTags } from './chunk-6IL3UJTE.js';
|
|
4
4
|
import { repositoryIdFromRoot } from './chunk-BWPBB45M.js';
|
|
5
5
|
import * as fs from 'fs';
|
|
6
6
|
import * as path from 'path';
|
|
@@ -258,5 +258,5 @@ function shortId() {
|
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
export { commitChanges, nodeCodeFs, runCodeSession, undoChanges };
|
|
261
|
-
//# sourceMappingURL=chunk-
|
|
262
|
-
//# sourceMappingURL=chunk-
|
|
261
|
+
//# sourceMappingURL=chunk-5HDCARJE.js.map
|
|
262
|
+
//# sourceMappingURL=chunk-5HDCARJE.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/code/session.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EAAK,kBAAkB,CAAA,EAAG,OAAO,IAAI,CAAA;AAAA,IACnE;AAAA,GACF;AACF;AAGA,SAAS,OAAA,GAAkB;AACzB,EAAA,IAAI,CAAA,GAAI,EAAA;AACR,EAAA,MAAM,QAAA,GAAW,sCAAA;AACjB,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,CAAA,EAAG,KAAK,CAAA,IAAK,QAAA,CAAS,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,MAAA,EAAO,GAAI,QAAA,CAAS,MAAM,CAAC,CAAA;AACrF,EAAA,OAAO,CAAA;AACT","file":"chunk-TKV3GAKX.js","sourcesContent":["/**\n * The `vg code` governance session (VG-CLI-CODE §7).\n *\n * This is the load-bearing rule the whole platform is built on, applied to code\n * edits: a state-altering change goes **through** the lifecycle, never around it\n * (GUARDRAILS §5). One run walks inspect → assess → dry-run → approve → execute\n * → verify → log:\n *\n * inspect build the graph-grounded context for the instruction\n * assess ask the routed model for a terse edit; apply it deterministically\n * (in memory); compute the diff and the blast radius\n * dry-run the DEFAULT terminal state — propose the change, write nothing\n * approve writing requires explicit consent; without it we stop at dry-run\n * execute write the approved changes to disk\n * verify confirm the files on disk match what was approved (+ optional cmd)\n * log append an immutable, secret-free audit record with a correlation id\n *\n * Everything is deterministic except the single model call, which is isolated\n * behind the provider list (tried in order, falling back on transport failure).\n * The filesystem and clock are injectable so the whole session is testable\n * offline with no writes escaping a temp dir.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { buildCodeContext } from './context.js';\nimport { analyzeQuestion, type RelevanceAnalysis } from '../engine/relevance-provider.js';\nimport { loadTopicTags } from '../engine/relevance-enrich.js';\nimport { buildTaskCapsule, capsuleToCodeContext } from './capsule.js';\nimport { recordCliCall, CLI_TOOL_ALIASES } from '../engine/savings.js';\nimport { repositoryIdFromRoot } from '../runtime/paths.js';\nimport { parseEdits, applyEdits, type SymbolSpan } from './apply.js';\nimport { unifiedDiff } from './diff.js';\nimport { buildMessages } from './prompt.js';\nimport { redactSecrets } from './providers.js';\nimport type { ChatOptions, CodeContext, CodeSessionResult, FileChange, LifecyclePhase, Provider, ProviderResult } from './types.js';\nimport type { VgGraph } from '../schema.js';\n\n/** Minimal filesystem seam so the session is testable without touching real disk. */\nexport interface CodeFs {\n read(file: string): string | null;\n write(file: string, content: string): void;\n remove(file: string): void;\n appendAudit(line: string): void;\n}\n\nexport interface RunSessionOptions {\n graph: VgGraph;\n root: string;\n instruction: string;\n /** Providers to try in order (from the router); the first that answers wins. */\n providers: Provider[];\n /** Write to disk? Default false — dry-run is the safe default (GUARDRAILS §3.2). */\n apply?: boolean;\n /** Explicit consent for the write (`--yes`); without it, a requested apply stops at dry-run. */\n consent?: boolean;\n /** Restrict the edit surface to these files. */\n files?: string[];\n /** Context token budget. */\n budget?: number;\n chatOptions?: ChatOptions;\n /** Injectable filesystem (defaults to a real, root-scoped fs). */\n fsImpl?: CodeFs;\n /** Injectable clock (ms) for the audit timestamp. */\n now?: () => number;\n /** Injectable correlation id (defaults to a random short id). */\n correlationId?: string;\n /** Progress callback per phase. */\n onPhase?: (phase: LifecyclePhase, detail: string) => void;\n /** Skip appending to the audit log (used by tests/dry programmatic calls). */\n noAudit?: boolean;\n /**\n * Who is making the graph-backed call, for per-model savings auditing. When\n * `client` is set, the context-assembly step (a `query_graph`-equivalent) is\n * recorded to the local savings ledger tagged with the provider + model, so\n * `vg savings` can break usage down per model. VG Code always sets this.\n */\n attribution?: { client: string; provider?: string; model?: string };\n /**\n * Use a source-bearing Task Capsule for the inspect context (Fusion Runtime\n * Phase 0 A/B). Default false keeps the metadata-only path.\n */\n capsule?: boolean;\n}\n\nexport async function runCodeSession(options: RunSessionOptions): Promise<CodeSessionResult> {\n const {\n graph,\n root,\n instruction,\n providers,\n apply = false,\n consent = false,\n files,\n budget,\n chatOptions,\n now = () => 0,\n onPhase = () => {},\n } = options;\n const fsImpl = options.fsImpl ?? nodeCodeFs(root);\n const correlationId = options.correlationId ?? shortId();\n const phasesRun: LifecyclePhase[] = [];\n const phase = (p: LifecyclePhase, detail: string): void => {\n phasesRun.push(p);\n onPhase(p, detail);\n };\n\n // ── inspect ──────────────────────────────────────────────────────────────\n phase('inspect', options.capsule ? 'building source-bearing task capsule' : 'building graph-grounded context');\n // Optional relevance provider: widens capsule seed vocabulary when\n // installed; null (the default) changes nothing.\n const relevance = await analyzeQuestion(instruction);\n const topicTags = relevance ? await loadTopicTags(graph, root) : null;\n const context = buildSessionContext(graph, instruction, {\n budget,\n files,\n capsule: options.capsule,\n root,\n fsImpl,\n relevance,\n topicTags,\n });\n\n // Per-model savings: the context build is VG Code's `query_graph`-equivalent.\n // Record it (counts only — never code or the instruction) tagged with the\n // model, so `vg savings` audits usage per model. Local-only, best-effort.\n if (options.attribution?.client) {\n const seedFiles = new Set(context.seeds.map((s) => s.node.file).filter(Boolean));\n recordCliCall(\n root,\n {\n tool: CLI_TOOL_ALIASES.ask,\n client: options.attribution.client,\n provider: options.attribution.provider,\n model: options.attribution.model,\n outcome: context.seeds.length ? 'complete' : 'miss',\n vgTokens: context.tokensEstimate,\n baselineFiles: seedFiles.size,\n },\n now(),\n );\n }\n\n // ── assess ──────────────────────────────────────────────────────────────\n phase('assess', 'asking the routed model for a minimal edit');\n const messages = buildMessages(context);\n const { result, provider, fellBack } = await complete(providers, messages, chatOptions, correlationId);\n\n const edits = parseEdits(result.text);\n const spans = spanIndex(graph);\n const applied = applyEdits(\n edits,\n (file) => fsImpl.read(file),\n (file) => spans.get(normalize(file)) ?? [],\n );\n\n const changes: FileChange[] = [];\n for (const [file, entry] of [...applied.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {\n changes.push({\n file,\n before: entry.before,\n after: entry.after,\n outcomes: entry.outcomes,\n diff: unifiedDiff(entry.before, entry.after, file),\n });\n }\n\n // ── dry-run (always produced) ─────────────────────────────────────────────\n phase('dry-run', `${changes.length} file(s) would change`);\n\n const anyApplicable = changes.some((c) => c.diff !== '' && c.outcomes.some((o) => o.status === 'applied'));\n const base: CodeSessionResult = {\n instruction,\n provider: { id: provider.id, model: provider.model, local: provider.local, fellBack },\n phasesRun,\n changes,\n applied: false,\n verification: { ran: false, ok: false, detail: 'dry-run — no changes written' },\n correlationId,\n };\n\n // ── approve ───────────────────────────────────────────────────────────────\n // Writing is opt-in AND consent-gated. A requested apply without consent is\n // not an error — it degrades to a dry-run so the caller can review, then\n // re-run with --yes. This is the \"never destructive-by-default\" guardrail.\n if (!apply) {\n if (!options.noAudit) writeAudit(fsImpl, base, now());\n return base;\n }\n if (!consent) {\n const stopped = { ...base, verification: { ran: false, ok: false, detail: 'apply requested without consent — re-run with --yes to write these changes' } };\n if (!options.noAudit) writeAudit(fsImpl, stopped, now());\n return stopped;\n }\n if (!anyApplicable) {\n const nothing = { ...base, verification: { ran: false, ok: false, detail: 'nothing to write — no edit applied cleanly' } };\n if (!options.noAudit) writeAudit(fsImpl, nothing, now());\n return nothing;\n }\n phase('approve', 'consent given (--yes)');\n\n // ── execute ───────────────────────────────────────────────────────────────\n phase('execute', 'writing approved changes');\n for (const change of changes) {\n if (change.diff === '') continue; // no-op file\n if (!change.outcomes.some((o) => o.status === 'applied')) continue; // nothing applied cleanly here\n if (change.after === null) fsImpl.remove(change.file);\n else fsImpl.write(change.file, change.after);\n }\n\n // ── verify ────────────────────────────────────────────────────────────────\n phase('verify', 'confirming on-disk content matches the approved change');\n const verification = verifyWrites(fsImpl, changes);\n\n // ── log ───────────────────────────────────────────────────────────────────\n phase('log', 'recording an audit entry');\n const final: CodeSessionResult = { ...base, applied: true, verification };\n if (!options.noAudit) writeAudit(fsImpl, final, now());\n return final;\n}\n\n/**\n * Commit an already-computed dry-run result: write the cleanly-applied changes,\n * verify them on disk, and append the audit record — the \"approve → execute →\n * verify → log\" tail of the lifecycle, run against a proposal the caller has\n * already shown and had approved (the interactive REPL uses this so it never\n * calls the model twice or writes something different from what was reviewed).\n */\nexport function commitChanges(result: CodeSessionResult, fsImpl: CodeFs, now: () => number = () => 0): CodeSessionResult {\n const anyApplicable = result.changes.some((c) => c.diff !== '' && c.outcomes.some((o) => o.status === 'applied'));\n if (!anyApplicable) {\n return { ...result, applied: false, verification: { ran: false, ok: false, detail: 'nothing to write — no edit applied cleanly' } };\n }\n for (const change of result.changes) {\n if (change.diff === '' || !change.outcomes.some((o) => o.status === 'applied')) continue;\n if (change.after === null) fsImpl.remove(change.file);\n else fsImpl.write(change.file, change.after);\n }\n const verification = verifyWrites(fsImpl, result.changes);\n const final: CodeSessionResult = { ...result, applied: true, verification, phasesRun: [...result.phasesRun, 'approve', 'execute', 'verify', 'log'] };\n writeAudit(fsImpl, final, now());\n return final;\n}\n\n/**\n * Undo a set of applied changes by restoring each file's prior content — the\n * `/undo` command. A created file (before === null) is removed; an edited or\n * deleted file is restored to its `before`. Only cleanly-applied changes are\n * reverted. Returns the files it restored.\n */\nexport function undoChanges(changes: FileChange[], fsImpl: CodeFs): string[] {\n const restored: string[] = [];\n for (const ch of changes) {\n if (!ch.outcomes.some((o) => o.status === 'applied')) continue;\n if (ch.before === null) fsImpl.remove(ch.file);\n else fsImpl.write(ch.file, ch.before);\n restored.push(ch.file);\n }\n return restored;\n}\n\nfunction buildSessionContext(\n graph: VgGraph,\n instruction: string,\n opts: { budget?: number; files?: string[]; capsule?: boolean; root: string; fsImpl: CodeFs; relevance?: RelevanceAnalysis | null; topicTags?: Map<string, readonly string[]> | null },\n): CodeContext {\n const budget = opts.budget;\n const files = opts.files;\n if (!opts.capsule) {\n return buildCodeContext(graph, instruction, { budget, files, relevance: opts.relevance, topicTags: opts.topicTags });\n }\n const capsule = buildTaskCapsule(graph, instruction, {\n budget,\n files,\n readFile: (rel) => opts.fsImpl.read(rel),\n repositoryId: repositoryIdFromRoot(opts.root),\n relevance: opts.relevance,\n topicTags: opts.topicTags,\n });\n return capsuleToCodeContext(capsule);\n}\n\n/** Try each provider in order; fall back on transport failure. Throws the last actionable error. */\nasync function complete(\n providers: Provider[],\n messages: ReturnType<typeof buildMessages>,\n chatOptions: ChatOptions | undefined,\n correlationId: string,\n): Promise<{ result: ProviderResult; provider: Provider; fellBack: boolean }> {\n if (providers.length === 0) throw new Error(`no model provider available (ref ${correlationId})`);\n let lastErr: unknown;\n for (let i = 0; i < providers.length; i++) {\n const provider = providers[i];\n try {\n const result = await provider.chat(messages, { temperature: 0, ...chatOptions });\n return { result, provider, fellBack: i > 0 };\n } catch (e) {\n lastErr = e;\n }\n }\n const message = lastErr instanceof Error ? redactSecrets(lastErr.message) : String(lastErr);\n throw new Error(`${message} (ref ${correlationId})`);\n}\n\n/** Confirm each written file's on-disk content equals what we approved. */\nfunction verifyWrites(fsImpl: CodeFs, changes: FileChange[]): { ran: boolean; ok: boolean; detail: string } {\n let checked = 0;\n const mismatches: string[] = [];\n for (const change of changes) {\n if (change.diff === '' || !change.outcomes.some((o) => o.status === 'applied')) continue;\n checked++;\n const onDisk = fsImpl.read(change.file);\n if (onDisk !== change.after) mismatches.push(change.file);\n }\n if (mismatches.length) return { ran: true, ok: false, detail: `on-disk content differs for: ${mismatches.join(', ')}` };\n return { ran: true, ok: true, detail: `wrote and verified ${checked} file(s)` };\n}\n\n/** An append-only, secret-free audit record (GUARDRAILS §2.6 / §5). No file contents, no keys. */\nfunction writeAudit(fsImpl: CodeFs, r: CodeSessionResult, ts: number): void {\n const record = {\n ts,\n correlationId: r.correlationId,\n instruction: r.instruction.slice(0, 500),\n provider: r.provider.id,\n model: r.provider.model,\n local: r.provider.local,\n applied: r.applied,\n files: r.changes.map((c) => ({ file: c.file, statuses: c.outcomes.map((o) => o.status) })),\n verification: r.verification,\n phases: r.phasesRun,\n };\n try {\n fsImpl.appendAudit(JSON.stringify(record));\n } catch {\n /* audit is best-effort; never fail the run on a logging problem */\n }\n}\n\n/** Build a per-file map of symbol spans for graph-scoped edit disambiguation. */\nfunction spanIndex(graph: VgGraph): Map<string, SymbolSpan[]> {\n const map = new Map<string, SymbolSpan[]>();\n for (const n of graph.nodes) {\n if (n.kind === 'file' || n.kind === 'external') continue;\n const file = normalize(n.file);\n const list = map.get(file) ?? [];\n list.push({ qualifiedName: n.qualifiedName, file, start: n.span.start, end: n.span.end });\n map.set(file, list);\n }\n return map;\n}\n\nfunction normalize(file: string): string {\n return file.replace(/\\\\/g, '/').replace(/^\\.\\//, '');\n}\n\n/** Default filesystem impl, scoped to `root`. Refuses paths that escape the root. */\nexport function nodeCodeFs(root: string): CodeFs {\n const resolve = (file: string): string => {\n const abs = path.resolve(root, file);\n const rel = path.relative(root, abs);\n if (rel.startsWith('..') || path.isAbsolute(rel)) {\n throw new Error(`edit path escapes the project root: ${file} — refusing to touch files outside ${root}`);\n }\n return abs;\n };\n return {\n read(file) {\n try {\n return fs.readFileSync(resolve(file), 'utf8');\n } catch {\n return null;\n }\n },\n write(file, content) {\n const abs = resolve(file);\n fs.mkdirSync(path.dirname(abs), { recursive: true });\n fs.writeFileSync(abs, content);\n },\n remove(file) {\n try {\n fs.rmSync(resolve(file));\n } catch {\n /* already gone */\n }\n },\n appendAudit(line) {\n const dir = path.join(root, '.vibgrate');\n fs.mkdirSync(dir, { recursive: true });\n fs.appendFileSync(path.join(dir, 'code-audit.jsonl'), line + '\\n');\n },\n };\n}\n\n/** Short, URL-safe correlation id. Not a graph artifact, so runtime randomness is fine here. */\nfunction shortId(): string {\n let s = '';\n const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789';\n for (let i = 0; i < 8; i++) s += alphabet[Math.floor(Math.random() * alphabet.length)];\n return s;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/code/session.ts"],"names":["resolve"],"mappings":";;;;;;;AAqFA,eAAsB,eAAe,OAAA,EAAwD;AAC3F,EAAA,MAAM;AAAA,IACJ,KAAA;AAAA,IACA,IAAA;AAAA,IACA,WAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA,GAAQ,KAAA;AAAA,IACR,OAAA,GAAU,KAAA;AAAA,IACV,KAAA;AAAA,IACA,MAAA;AAAA,IACA,WAAA;AAAA,IAC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S,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,MAAA,EAAO,GAAI,QAAA,CAAS,MAAM,CAAC,CAAA;AACrF,EAAA,OAAO,CAAA;AACT","file":"chunk-5HDCARJE.js","sourcesContent":["/**\n * The `vg code` governance session (VG-CLI-CODE §7).\n *\n * This is the load-bearing rule the whole platform is built on, applied to code\n * edits: a state-altering change goes **through** the lifecycle, never around it\n * (GUARDRAILS §5). One run walks inspect → assess → dry-run → approve → execute\n * → verify → log:\n *\n * inspect build the graph-grounded context for the instruction\n * assess ask the routed model for a terse edit; apply it deterministically\n * (in memory); compute the diff and the blast radius\n * dry-run the DEFAULT terminal state — propose the change, write nothing\n * approve writing requires explicit consent; without it we stop at dry-run\n * execute write the approved changes to disk\n * verify confirm the files on disk match what was approved (+ optional cmd)\n * log append an immutable, secret-free audit record with a correlation id\n *\n * Everything is deterministic except the single model call, which is isolated\n * behind the provider list (tried in order, falling back on transport failure).\n * The filesystem and clock are injectable so the whole session is testable\n * offline with no writes escaping a temp dir.\n */\n\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport { buildCodeContext } from './context.js';\nimport { analyzeQuestion, type RelevanceAnalysis } from '../engine/relevance-provider.js';\nimport { loadTopicTags } from '../engine/relevance-enrich.js';\nimport { buildTaskCapsule, capsuleToCodeContext } from './capsule.js';\nimport { recordCliCall, CLI_TOOL_ALIASES } from '../engine/savings.js';\nimport { repositoryIdFromRoot } from '../runtime/paths.js';\nimport { parseEdits, applyEdits, type SymbolSpan } from './apply.js';\nimport { unifiedDiff } from './diff.js';\nimport { buildMessages } from './prompt.js';\nimport { redactSecrets } from './providers.js';\nimport type { ChatOptions, CodeContext, CodeSessionResult, FileChange, LifecyclePhase, Provider, ProviderResult } from './types.js';\nimport type { VgGraph } from '../schema.js';\n\n/** Minimal filesystem seam so the session is testable without touching real disk. */\nexport interface CodeFs {\n read(file: string): string | null;\n write(file: string, content: string): void;\n remove(file: string): void;\n appendAudit(line: string): void;\n}\n\nexport interface RunSessionOptions {\n graph: VgGraph;\n root: string;\n instruction: string;\n /** Providers to try in order (from the router); the first that answers wins. */\n providers: Provider[];\n /** Write to disk? Default false — dry-run is the safe default (GUARDRAILS §3.2). */\n apply?: boolean;\n /** Explicit consent for the write (`--yes`); without it, a requested apply stops at dry-run. */\n consent?: boolean;\n /** Restrict the edit surface to these files. */\n files?: string[];\n /** Context token budget. */\n budget?: number;\n chatOptions?: ChatOptions;\n /** Injectable filesystem (defaults to a real, root-scoped fs). */\n fsImpl?: CodeFs;\n /** Injectable clock (ms) for the audit timestamp. */\n now?: () => number;\n /** Injectable correlation id (defaults to a random short id). */\n correlationId?: string;\n /** Progress callback per phase. */\n onPhase?: (phase: LifecyclePhase, detail: string) => void;\n /** Skip appending to the audit log (used by tests/dry programmatic calls). */\n noAudit?: boolean;\n /**\n * Who is making the graph-backed call, for per-model savings auditing. When\n * `client` is set, the context-assembly step (a `query_graph`-equivalent) is\n * recorded to the local savings ledger tagged with the provider + model, so\n * `vg savings` can break usage down per model. VG Code always sets this.\n */\n attribution?: { client: string; provider?: string; model?: string };\n /**\n * Use a source-bearing Task Capsule for the inspect context (Fusion Runtime\n * Phase 0 A/B). Default false keeps the metadata-only path.\n */\n capsule?: boolean;\n}\n\nexport async function runCodeSession(options: RunSessionOptions): Promise<CodeSessionResult> {\n const {\n graph,\n root,\n instruction,\n providers,\n apply = false,\n consent = false,\n files,\n budget,\n chatOptions,\n now = () => 0,\n onPhase = () => {},\n } = options;\n const fsImpl = options.fsImpl ?? nodeCodeFs(root);\n const correlationId = options.correlationId ?? shortId();\n const phasesRun: LifecyclePhase[] = [];\n const phase = (p: LifecyclePhase, detail: string): void => {\n phasesRun.push(p);\n onPhase(p, detail);\n };\n\n // ── inspect ──────────────────────────────────────────────────────────────\n phase('inspect', options.capsule ? 'building source-bearing task capsule' : 'building graph-grounded context');\n // Optional relevance provider: widens capsule seed vocabulary when\n // installed; null (the default) changes nothing.\n const relevance = await analyzeQuestion(instruction);\n const topicTags = relevance ? await loadTopicTags(graph, root) : null;\n const context = buildSessionContext(graph, instruction, {\n budget,\n files,\n capsule: options.capsule,\n root,\n fsImpl,\n relevance,\n topicTags,\n });\n\n // Per-model savings: the context build is VG Code's `query_graph`-equivalent.\n // Record it (counts only — never code or the instruction) tagged with the\n // model, so `vg savings` audits usage per model. Local-only, best-effort.\n if (options.attribution?.client) {\n const seedFiles = new Set(context.seeds.map((s) => s.node.file).filter(Boolean));\n recordCliCall(\n root,\n {\n tool: CLI_TOOL_ALIASES.ask,\n client: options.attribution.client,\n provider: options.attribution.provider,\n model: options.attribution.model,\n outcome: context.seeds.length ? 'complete' : 'miss',\n vgTokens: context.tokensEstimate,\n baselineFiles: seedFiles.size,\n },\n now(),\n );\n }\n\n // ── assess ──────────────────────────────────────────────────────────────\n phase('assess', 'asking the routed model for a minimal edit');\n const messages = buildMessages(context);\n const { result, provider, fellBack } = await complete(providers, messages, chatOptions, correlationId);\n\n const edits = parseEdits(result.text);\n const spans = spanIndex(graph);\n const applied = applyEdits(\n edits,\n (file) => fsImpl.read(file),\n (file) => spans.get(normalize(file)) ?? [],\n );\n\n const changes: FileChange[] = [];\n for (const [file, entry] of [...applied.entries()].sort((a, b) => a[0].localeCompare(b[0]))) {\n changes.push({\n file,\n before: entry.before,\n after: entry.after,\n outcomes: entry.outcomes,\n diff: unifiedDiff(entry.before, entry.after, file),\n });\n }\n\n // ── dry-run (always produced) ─────────────────────────────────────────────\n phase('dry-run', `${changes.length} file(s) would change`);\n\n const anyApplicable = changes.some((c) => c.diff !== '' && c.outcomes.some((o) => o.status === 'applied'));\n const base: CodeSessionResult = {\n instruction,\n provider: { id: provider.id, model: provider.model, local: provider.local, fellBack },\n phasesRun,\n changes,\n applied: false,\n verification: { ran: false, ok: false, detail: 'dry-run — no changes written' },\n correlationId,\n };\n\n // ── approve ───────────────────────────────────────────────────────────────\n // Writing is opt-in AND consent-gated. A requested apply without consent is\n // not an error — it degrades to a dry-run so the caller can review, then\n // re-run with --yes. This is the \"never destructive-by-default\" guardrail.\n if (!apply) {\n if (!options.noAudit) writeAudit(fsImpl, base, now());\n return base;\n }\n if (!consent) {\n const stopped = { ...base, verification: { ran: false, ok: false, detail: 'apply requested without consent — re-run with --yes to write these changes' } };\n if (!options.noAudit) writeAudit(fsImpl, stopped, now());\n return stopped;\n }\n if (!anyApplicable) {\n const nothing = { ...base, verification: { ran: false, ok: false, detail: 'nothing to write — no edit applied cleanly' } };\n if (!options.noAudit) writeAudit(fsImpl, nothing, now());\n return nothing;\n }\n phase('approve', 'consent given (--yes)');\n\n // ── execute ───────────────────────────────────────────────────────────────\n phase('execute', 'writing approved changes');\n for (const change of changes) {\n if (change.diff === '') continue; // no-op file\n if (!change.outcomes.some((o) => o.status === 'applied')) continue; // nothing applied cleanly here\n if (change.after === null) fsImpl.remove(change.file);\n else fsImpl.write(change.file, change.after);\n }\n\n // ── verify ────────────────────────────────────────────────────────────────\n phase('verify', 'confirming on-disk content matches the approved change');\n const verification = verifyWrites(fsImpl, changes);\n\n // ── log ───────────────────────────────────────────────────────────────────\n phase('log', 'recording an audit entry');\n const final: CodeSessionResult = { ...base, applied: true, verification };\n if (!options.noAudit) writeAudit(fsImpl, final, now());\n return final;\n}\n\n/**\n * Commit an already-computed dry-run result: write the cleanly-applied changes,\n * verify them on disk, and append the audit record — the \"approve → execute →\n * verify → log\" tail of the lifecycle, run against a proposal the caller has\n * already shown and had approved (the interactive REPL uses this so it never\n * calls the model twice or writes something different from what was reviewed).\n */\nexport function commitChanges(result: CodeSessionResult, fsImpl: CodeFs, now: () => number = () => 0): CodeSessionResult {\n const anyApplicable = result.changes.some((c) => c.diff !== '' && c.outcomes.some((o) => o.status === 'applied'));\n if (!anyApplicable) {\n return { ...result, applied: false, verification: { ran: false, ok: false, detail: 'nothing to write — no edit applied cleanly' } };\n }\n for (const change of result.changes) {\n if (change.diff === '' || !change.outcomes.some((o) => o.status === 'applied')) continue;\n if (change.after === null) fsImpl.remove(change.file);\n else fsImpl.write(change.file, change.after);\n }\n const verification = verifyWrites(fsImpl, result.changes);\n const final: CodeSessionResult = { ...result, applied: true, verification, phasesRun: [...result.phasesRun, 'approve', 'execute', 'verify', 'log'] };\n writeAudit(fsImpl, final, now());\n return final;\n}\n\n/**\n * Undo a set of applied changes by restoring each file's prior content — the\n * `/undo` command. A created file (before === null) is removed; an edited or\n * deleted file is restored to its `before`. Only cleanly-applied changes are\n * reverted. Returns the files it restored.\n */\nexport function undoChanges(changes: FileChange[], fsImpl: CodeFs): string[] {\n const restored: string[] = [];\n for (const ch of changes) {\n if (!ch.outcomes.some((o) => o.status === 'applied')) continue;\n if (ch.before === null) fsImpl.remove(ch.file);\n else fsImpl.write(ch.file, ch.before);\n restored.push(ch.file);\n }\n return restored;\n}\n\nfunction buildSessionContext(\n graph: VgGraph,\n instruction: string,\n opts: { budget?: number; files?: string[]; capsule?: boolean; root: string; fsImpl: CodeFs; relevance?: RelevanceAnalysis | null; topicTags?: Map<string, readonly string[]> | null },\n): CodeContext {\n const budget = opts.budget;\n const files = opts.files;\n if (!opts.capsule) {\n return buildCodeContext(graph, instruction, { budget, files, relevance: opts.relevance, topicTags: opts.topicTags });\n }\n const capsule = buildTaskCapsule(graph, instruction, {\n budget,\n files,\n readFile: (rel) => opts.fsImpl.read(rel),\n repositoryId: repositoryIdFromRoot(opts.root),\n relevance: opts.relevance,\n topicTags: opts.topicTags,\n });\n return capsuleToCodeContext(capsule);\n}\n\n/** Try each provider in order; fall back on transport failure. Throws the last actionable error. */\nasync function complete(\n providers: Provider[],\n messages: ReturnType<typeof buildMessages>,\n chatOptions: ChatOptions | undefined,\n correlationId: string,\n): Promise<{ result: ProviderResult; provider: Provider; fellBack: boolean }> {\n if (providers.length === 0) throw new Error(`no model provider available (ref ${correlationId})`);\n let lastErr: unknown;\n for (let i = 0; i < providers.length; i++) {\n const provider = providers[i];\n try {\n const result = await provider.chat(messages, { temperature: 0, ...chatOptions });\n return { result, provider, fellBack: i > 0 };\n } catch (e) {\n lastErr = e;\n }\n }\n const message = lastErr instanceof Error ? redactSecrets(lastErr.message) : String(lastErr);\n throw new Error(`${message} (ref ${correlationId})`);\n}\n\n/** Confirm each written file's on-disk content equals what we approved. */\nfunction verifyWrites(fsImpl: CodeFs, changes: FileChange[]): { ran: boolean; ok: boolean; detail: string } {\n let checked = 0;\n const mismatches: string[] = [];\n for (const change of changes) {\n if (change.diff === '' || !change.outcomes.some((o) => o.status === 'applied')) continue;\n checked++;\n const onDisk = fsImpl.read(change.file);\n if (onDisk !== change.after) mismatches.push(change.file);\n }\n if (mismatches.length) return { ran: true, ok: false, detail: `on-disk content differs for: ${mismatches.join(', ')}` };\n return { ran: true, ok: true, detail: `wrote and verified ${checked} file(s)` };\n}\n\n/** An append-only, secret-free audit record (GUARDRAILS §2.6 / §5). No file contents, no keys. */\nfunction writeAudit(fsImpl: CodeFs, r: CodeSessionResult, ts: number): void {\n const record = {\n ts,\n correlationId: r.correlationId,\n instruction: r.instruction.slice(0, 500),\n provider: r.provider.id,\n model: r.provider.model,\n local: r.provider.local,\n applied: r.applied,\n files: r.changes.map((c) => ({ file: c.file, statuses: c.outcomes.map((o) => o.status) })),\n verification: r.verification,\n phases: r.phasesRun,\n };\n try {\n fsImpl.appendAudit(JSON.stringify(record));\n } catch {\n /* audit is best-effort; never fail the run on a logging problem */\n }\n}\n\n/** Build a per-file map of symbol spans for graph-scoped edit disambiguation. */\nfunction spanIndex(graph: VgGraph): Map<string, SymbolSpan[]> {\n const map = new Map<string, SymbolSpan[]>();\n for (const n of graph.nodes) {\n if (n.kind === 'file' || n.kind === 'external') continue;\n const file = normalize(n.file);\n const list = map.get(file) ?? [];\n list.push({ qualifiedName: n.qualifiedName, file, start: n.span.start, end: n.span.end });\n map.set(file, list);\n }\n return map;\n}\n\nfunction normalize(file: string): string {\n return file.replace(/\\\\/g, '/').replace(/^\\.\\//, '');\n}\n\n/** Default filesystem impl, scoped to `root`. Refuses paths that escape the root. */\nexport function nodeCodeFs(root: string): CodeFs {\n const resolve = (file: string): string => {\n const abs = path.resolve(root, file);\n const rel = path.relative(root, abs);\n if (rel.startsWith('..') || path.isAbsolute(rel)) {\n throw new Error(`edit path escapes the project root: ${file} — refusing to touch files outside ${root}`);\n }\n return abs;\n };\n return {\n read(file) {\n try {\n return fs.readFileSync(resolve(file), 'utf8');\n } catch {\n return null;\n }\n },\n write(file, content) {\n const abs = resolve(file);\n fs.mkdirSync(path.dirname(abs), { recursive: true });\n fs.writeFileSync(abs, content);\n },\n remove(file) {\n try {\n fs.rmSync(resolve(file));\n } catch {\n /* already gone */\n }\n },\n appendAudit(line) {\n const dir = path.join(root, '.vibgrate');\n fs.mkdirSync(dir, { recursive: true });\n fs.appendFileSync(path.join(dir, 'code-audit.jsonl'), line + '\\n');\n },\n };\n}\n\n/** Short, URL-safe correlation id. Not a graph artifact, so runtime randomness is fine here. */\nfunction shortId(): string {\n let s = '';\n const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789';\n for (let i = 0; i < 8; i++) s += alphabet[Math.floor(Math.random() * alphabet.length)];\n return s;\n}\n"]}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import { VERSION } from './chunk-
|
|
2
|
-
import { WEAK_TERMS } from './chunk-4LGDQBYK.js';
|
|
3
|
-
import { parseGraph, stableStringify, serializeGraph } from './chunk-RBMKBYGV.js';
|
|
1
|
+
import { VERSION } from './chunk-MEKXVHW7.js';
|
|
4
2
|
import { globalGraphPathForRef, globalGraphPath, repositoryStoreDir } from './chunk-BWPBB45M.js';
|
|
5
3
|
import { detectGitRef } from './chunk-BPF3YX2U.js';
|
|
6
4
|
import * as fs3 from 'fs';
|
|
@@ -10,6 +8,45 @@ import * as os from 'os';
|
|
|
10
8
|
import * as path2 from 'path';
|
|
11
9
|
import { pathToFileURL } from 'url';
|
|
12
10
|
|
|
11
|
+
// src/engine/serialize.ts
|
|
12
|
+
function serializeGraph(graph, opts) {
|
|
13
|
+
const indent = opts?.compact ? 0 : 2;
|
|
14
|
+
return `${stableStringify(graph, indent)}
|
|
15
|
+
`;
|
|
16
|
+
}
|
|
17
|
+
function slimGraphForExport(graph) {
|
|
18
|
+
return {
|
|
19
|
+
...graph,
|
|
20
|
+
areas: graph.areas.map((a) => ({
|
|
21
|
+
...a,
|
|
22
|
+
members: []
|
|
23
|
+
// member id lists dominate XL exports; area id still on nodes
|
|
24
|
+
})),
|
|
25
|
+
grounding: void 0,
|
|
26
|
+
facts: graph.facts
|
|
27
|
+
// Keep summaries/unknowns — small and useful to agents.
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function stableStringify(value, indent = 2) {
|
|
31
|
+
return JSON.stringify(sortKeys(value), null, indent);
|
|
32
|
+
}
|
|
33
|
+
function sortKeys(value) {
|
|
34
|
+
if (Array.isArray(value)) return value.map(sortKeys);
|
|
35
|
+
if (value && typeof value === "object") {
|
|
36
|
+
const input = value;
|
|
37
|
+
const out = {};
|
|
38
|
+
for (const key of Object.keys(input).sort()) {
|
|
39
|
+
const v = input[key];
|
|
40
|
+
if (v === void 0) continue;
|
|
41
|
+
out[key] = sortKeys(v);
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
return value;
|
|
46
|
+
}
|
|
47
|
+
function parseGraph(json) {
|
|
48
|
+
return JSON.parse(json);
|
|
49
|
+
}
|
|
13
50
|
var MAGIC = Buffer.from("VGSNAP1\0", "latin1");
|
|
14
51
|
var crc322 = zlib.crc32 ?? jsCrc32;
|
|
15
52
|
var crcTable = null;
|
|
@@ -293,6 +330,363 @@ ${embedded}
|
|
|
293
330
|
function esc(s) {
|
|
294
331
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
295
332
|
}
|
|
333
|
+
|
|
334
|
+
// src/engine/concepts.ts
|
|
335
|
+
var WEAK_TERMS = /* @__PURE__ */ new Set([
|
|
336
|
+
"add",
|
|
337
|
+
"adds",
|
|
338
|
+
"added",
|
|
339
|
+
"adding",
|
|
340
|
+
"create",
|
|
341
|
+
"creates",
|
|
342
|
+
"created",
|
|
343
|
+
"creating",
|
|
344
|
+
"make",
|
|
345
|
+
"makes",
|
|
346
|
+
"making",
|
|
347
|
+
"made",
|
|
348
|
+
"new",
|
|
349
|
+
"newly",
|
|
350
|
+
"remove",
|
|
351
|
+
"removes",
|
|
352
|
+
"removed",
|
|
353
|
+
"removing",
|
|
354
|
+
"delete",
|
|
355
|
+
"deletes",
|
|
356
|
+
"deleted",
|
|
357
|
+
"deleting",
|
|
358
|
+
"update",
|
|
359
|
+
"updates",
|
|
360
|
+
"updated",
|
|
361
|
+
"updating",
|
|
362
|
+
"change",
|
|
363
|
+
"changes",
|
|
364
|
+
"changed",
|
|
365
|
+
"changing",
|
|
366
|
+
"set",
|
|
367
|
+
"sets",
|
|
368
|
+
"setting",
|
|
369
|
+
"setup",
|
|
370
|
+
"get",
|
|
371
|
+
"gets",
|
|
372
|
+
"getting",
|
|
373
|
+
"use",
|
|
374
|
+
"uses",
|
|
375
|
+
"used",
|
|
376
|
+
"using",
|
|
377
|
+
"want",
|
|
378
|
+
"wants",
|
|
379
|
+
"wanted",
|
|
380
|
+
"do",
|
|
381
|
+
"does",
|
|
382
|
+
"doing",
|
|
383
|
+
"done",
|
|
384
|
+
"support",
|
|
385
|
+
"supports",
|
|
386
|
+
"supported",
|
|
387
|
+
"supporting",
|
|
388
|
+
"enable",
|
|
389
|
+
"enables",
|
|
390
|
+
"enabled",
|
|
391
|
+
"enabling",
|
|
392
|
+
"disable",
|
|
393
|
+
"disables",
|
|
394
|
+
"disabled",
|
|
395
|
+
"disabling",
|
|
396
|
+
"allow",
|
|
397
|
+
"allows",
|
|
398
|
+
"allowed",
|
|
399
|
+
"implement",
|
|
400
|
+
"implements",
|
|
401
|
+
"implemented",
|
|
402
|
+
"implementing",
|
|
403
|
+
"build",
|
|
404
|
+
"builds",
|
|
405
|
+
"building",
|
|
406
|
+
"built",
|
|
407
|
+
"via",
|
|
408
|
+
"through",
|
|
409
|
+
"into",
|
|
410
|
+
"onto",
|
|
411
|
+
"way",
|
|
412
|
+
"ways",
|
|
413
|
+
"thing",
|
|
414
|
+
"things",
|
|
415
|
+
"stuff",
|
|
416
|
+
"feature",
|
|
417
|
+
"features",
|
|
418
|
+
"functionality",
|
|
419
|
+
"method",
|
|
420
|
+
"methods",
|
|
421
|
+
"option",
|
|
422
|
+
"options",
|
|
423
|
+
"ability",
|
|
424
|
+
"help",
|
|
425
|
+
"start",
|
|
426
|
+
"begin",
|
|
427
|
+
"work",
|
|
428
|
+
"works",
|
|
429
|
+
"working",
|
|
430
|
+
"also",
|
|
431
|
+
"currently",
|
|
432
|
+
"properly",
|
|
433
|
+
"correctly",
|
|
434
|
+
"please",
|
|
435
|
+
"happens",
|
|
436
|
+
"happen",
|
|
437
|
+
"something",
|
|
438
|
+
"somewhere",
|
|
439
|
+
"step",
|
|
440
|
+
"steps",
|
|
441
|
+
"flow",
|
|
442
|
+
"process",
|
|
443
|
+
"you",
|
|
444
|
+
"can"
|
|
445
|
+
]);
|
|
446
|
+
var CONCEPTS = {
|
|
447
|
+
// ---- payments / billing ----
|
|
448
|
+
payment: ["stripe", "billing", "invoice", "checkout", "charge", "subscription", "refund", "payout", "card", "debit", "mandate"],
|
|
449
|
+
pay: ["payment", "stripe", "charge", "billing", "invoice"],
|
|
450
|
+
paid: ["payment", "invoice", "charge"],
|
|
451
|
+
billing: ["invoice", "payment", "subscription", "stripe", "charge", "renewal"],
|
|
452
|
+
checkout: ["stripe", "payment", "cart", "session"],
|
|
453
|
+
debit: ["mandate", "sepa", "bacs", "ach", "bank", "payment"],
|
|
454
|
+
mandate: ["sepa", "bacs", "debit"],
|
|
455
|
+
sepa: ["mandate", "debit", "iban", "bank"],
|
|
456
|
+
bacs: ["mandate", "debit", "bank"],
|
|
457
|
+
ach: ["mandate", "debit", "bank"],
|
|
458
|
+
stripe: ["payment", "billing", "checkout", "webhook", "charge", "card"],
|
|
459
|
+
refund: ["payment", "invoice", "stripe", "charge"],
|
|
460
|
+
invoice: ["billing", "payment", "refund", "subscription"],
|
|
461
|
+
subscription: ["billing", "renewal", "invoice", "plan", "recurring"],
|
|
462
|
+
recurring: ["subscription", "renewal", "mandate", "debit"],
|
|
463
|
+
renewal: ["subscription", "billing", "renew"],
|
|
464
|
+
card: ["payment", "charge", "stripe"],
|
|
465
|
+
credit: ["card", "payment", "charge"],
|
|
466
|
+
bank: ["debit", "mandate", "sepa", "iban", "account"],
|
|
467
|
+
charge: ["payment", "card", "stripe"],
|
|
468
|
+
webhook: ["event", "handler", "callback"],
|
|
469
|
+
price: ["payment", "billing", "plan"],
|
|
470
|
+
customer: ["billing", "account", "user"],
|
|
471
|
+
// ---- auth ----
|
|
472
|
+
auth: ["login", "session", "token", "oauth", "password", "credential"],
|
|
473
|
+
authentication: ["auth", "login", "session", "token", "password"],
|
|
474
|
+
authenticated: ["auth", "login", "session"],
|
|
475
|
+
login: ["auth", "session", "password", "signin", "oauth"],
|
|
476
|
+
signin: ["login", "auth", "session"],
|
|
477
|
+
signup: ["register", "onboard", "account"],
|
|
478
|
+
logout: ["session", "auth", "signout"],
|
|
479
|
+
password: ["auth", "login", "credential", "hash"],
|
|
480
|
+
session: ["auth", "login", "token"],
|
|
481
|
+
token: ["session", "auth", "jwt"],
|
|
482
|
+
oauth: ["auth", "login", "callback", "provider"],
|
|
483
|
+
google: ["oauth", "login", "auth"],
|
|
484
|
+
github: ["oauth", "login", "auth"],
|
|
485
|
+
sso: ["oauth", "auth", "saml", "login"],
|
|
486
|
+
credential: ["auth", "password", "token", "secret"],
|
|
487
|
+
// ---- dependencies / supply chain ----
|
|
488
|
+
dependency: ["package", "audit", "vulnerability", "advisory", "lockfile", "version"],
|
|
489
|
+
package: ["dependency", "audit", "vulnerability", "advisory", "lockfile"],
|
|
490
|
+
vulnerability: ["advisory", "cve", "osv", "audit", "vulnerable"],
|
|
491
|
+
vulnerable: ["vulnerability", "advisory", "audit", "cve"],
|
|
492
|
+
advisory: ["vulnerability", "cve", "osv", "audit"],
|
|
493
|
+
cve: ["vulnerability", "advisory", "osv"],
|
|
494
|
+
risk: ["vulnerability", "audit", "advisory"],
|
|
495
|
+
security: ["vulnerability", "audit", "advisory"],
|
|
496
|
+
audit: ["dependency", "vulnerability", "advisory"],
|
|
497
|
+
scan: ["audit", "vulnerability", "scanner"],
|
|
498
|
+
// ---- notifications / messaging ----
|
|
499
|
+
email: ["mail", "smtp", "sender", "template", "message"],
|
|
500
|
+
mail: ["email", "smtp", "sender"],
|
|
501
|
+
notification: ["notify", "email", "sms", "push", "alert"],
|
|
502
|
+
notify: ["notification", "email", "alert"],
|
|
503
|
+
sms: ["notification", "message", "twilio"],
|
|
504
|
+
// ---- e-commerce ----
|
|
505
|
+
cart: ["checkout", "order", "shop", "basket", "discount"],
|
|
506
|
+
basket: ["cart", "checkout", "order"],
|
|
507
|
+
order: ["cart", "shipment", "fulfillment", "shop", "checkout"],
|
|
508
|
+
ship: ["order", "fulfillment", "delivery", "shipment"],
|
|
509
|
+
shipment: ["order", "fulfillment", "delivery", "track"],
|
|
510
|
+
shipping: ["order", "fulfillment", "delivery", "shipment"],
|
|
511
|
+
shipped: ["order", "fulfillment", "shipment"],
|
|
512
|
+
inventory: ["stock", "product", "catalog", "restock"],
|
|
513
|
+
stock: ["inventory", "product", "restock"],
|
|
514
|
+
product: ["catalog", "inventory", "shop"],
|
|
515
|
+
discount: ["coupon", "promo", "cart", "price"],
|
|
516
|
+
coupon: ["discount", "promo", "code"],
|
|
517
|
+
// ---- chat / social ----
|
|
518
|
+
chat: ["message", "room", "conversation", "presence"],
|
|
519
|
+
message: ["chat", "sms", "notification", "thread"],
|
|
520
|
+
conversation: ["chat", "message", "thread"],
|
|
521
|
+
presence: ["online", "typing", "status"],
|
|
522
|
+
online: ["presence", "status"],
|
|
523
|
+
typing: ["presence", "indicator", "broadcast"],
|
|
524
|
+
// ---- media / streaming ----
|
|
525
|
+
video: ["media", "transcode", "playback", "stream", "thumbnail"],
|
|
526
|
+
stream: ["video", "playback", "manifest", "media"],
|
|
527
|
+
streaming: ["video", "playback", "manifest", "media"],
|
|
528
|
+
playback: ["video", "stream", "media", "watch"],
|
|
529
|
+
transcode: ["video", "media", "encode"],
|
|
530
|
+
thumbnail: ["video", "image", "media"],
|
|
531
|
+
media: ["video", "stream", "playback", "asset"],
|
|
532
|
+
// ---- analytics ----
|
|
533
|
+
analytics: ["event", "track", "metric", "funnel", "report"],
|
|
534
|
+
event: ["track", "analytics", "webhook"],
|
|
535
|
+
track: ["event", "analytics"],
|
|
536
|
+
funnel: ["conversion", "analytics", "event"],
|
|
537
|
+
conversion: ["funnel", "analytics"],
|
|
538
|
+
report: ["metrics", "export", "analytics"],
|
|
539
|
+
// ---- content / CMS ----
|
|
540
|
+
article: ["publish", "content", "post", "cms"],
|
|
541
|
+
publish: ["article", "release", "post", "content"],
|
|
542
|
+
post: ["article", "publish", "message"],
|
|
543
|
+
blog: ["article", "publish", "post", "cms"],
|
|
544
|
+
content: ["cms", "article", "markdown"],
|
|
545
|
+
markdown: ["render", "article", "content"],
|
|
546
|
+
cms: ["article", "content", "publish"],
|
|
547
|
+
// ---- CI / deployment ----
|
|
548
|
+
deploy: ["release", "rollback", "pipeline", "deployment"],
|
|
549
|
+
deployment: ["deploy", "release", "rollback", "pipeline"],
|
|
550
|
+
release: ["deploy", "version", "rollback"],
|
|
551
|
+
rollback: ["deploy", "release", "deployment"],
|
|
552
|
+
pipeline: ["stage", "deploy", "runner", "ci"],
|
|
553
|
+
canary: ["deploy", "rollout", "release"],
|
|
554
|
+
// ---- mobile ----
|
|
555
|
+
push: ["notification", "device", "token", "mobile"],
|
|
556
|
+
device: ["push", "token", "mobile", "register"],
|
|
557
|
+
deeplink: ["link", "route", "universal"],
|
|
558
|
+
mobile: ["push", "device", "deeplink", "app"],
|
|
559
|
+
ios: ["mobile", "universal", "link", "app"],
|
|
560
|
+
android: ["mobile", "push", "device", "app"],
|
|
561
|
+
// ---- batch / ETL / mainframe ----
|
|
562
|
+
batch: ["settlement", "job", "etl", "reconcile"],
|
|
563
|
+
settlement: ["batch", "reconcile", "ledger", "clearing"],
|
|
564
|
+
reconcile: ["ledger", "settlement", "batch"],
|
|
565
|
+
ledger: ["settlement", "reconcile", "balance", "journal"],
|
|
566
|
+
mainframe: ["batch", "settlement", "ebcdic", "cobol", "fixed"],
|
|
567
|
+
ebcdic: ["mainframe", "record", "convert", "legacy"],
|
|
568
|
+
cobol: ["mainframe", "batch", "ebcdic"],
|
|
569
|
+
etl: ["batch", "pipeline", "extract", "load", "transform"],
|
|
570
|
+
nightly: ["batch", "cron", "schedule", "job"],
|
|
571
|
+
// ---- geo / maps ----
|
|
572
|
+
geocode: ["address", "location", "map", "geo"],
|
|
573
|
+
address: ["geocode", "location"],
|
|
574
|
+
map: ["geo", "route", "location"],
|
|
575
|
+
route: ["distance", "path", "planner", "geo"],
|
|
576
|
+
distance: ["route", "haversine", "geo"],
|
|
577
|
+
location: ["geo", "geocode", "map"],
|
|
578
|
+
arrival: ["route", "eta", "estimate"],
|
|
579
|
+
// ---- i18n ----
|
|
580
|
+
translation: ["locale", "i18n", "language", "translate"],
|
|
581
|
+
translate: ["translation", "locale", "language"],
|
|
582
|
+
locale: ["translation", "i18n", "language", "format"],
|
|
583
|
+
i18n: ["translation", "locale", "language"],
|
|
584
|
+
language: ["locale", "translation", "i18n"],
|
|
585
|
+
localized: ["locale", "translation", "format"],
|
|
586
|
+
// ---- observability ----
|
|
587
|
+
metric: ["counter", "prometheus", "telemetry", "export"],
|
|
588
|
+
prometheus: ["metric", "exporter", "monitoring"],
|
|
589
|
+
trace: ["span", "telemetry", "observability"],
|
|
590
|
+
span: ["trace", "telemetry"],
|
|
591
|
+
monitoring: ["metric", "trace", "alert", "observability"],
|
|
592
|
+
telemetry: ["metric", "trace", "span"],
|
|
593
|
+
counter: ["metric", "increment"],
|
|
594
|
+
// ---- feature flags / experimentation ----
|
|
595
|
+
flag: ["feature", "rollout", "toggle", "experiment"],
|
|
596
|
+
rollout: ["flag", "percentage", "release", "experiment"],
|
|
597
|
+
toggle: ["flag", "feature", "switch"],
|
|
598
|
+
experiment: ["variant", "assign", "flag", "exposure"],
|
|
599
|
+
variant: ["experiment", "assign"],
|
|
600
|
+
// ---- generic infrastructure ----
|
|
601
|
+
database: ["schema", "migration", "sql", "query", "orm"],
|
|
602
|
+
db: ["database", "schema", "migration", "sql"],
|
|
603
|
+
migration: ["database", "schema", "migrate", "sql"],
|
|
604
|
+
cache: ["redis", "ttl", "store"],
|
|
605
|
+
queue: ["job", "worker", "task", "batch"],
|
|
606
|
+
job: ["queue", "worker", "cron"],
|
|
607
|
+
upload: ["file", "storage", "blob", "asset"],
|
|
608
|
+
storage: ["file", "upload", "bucket", "blob"],
|
|
609
|
+
permission: ["role", "rbac", "acl", "access", "grant"],
|
|
610
|
+
role: ["permission", "rbac", "access"],
|
|
611
|
+
error: ["exception", "failure", "handler"],
|
|
612
|
+
config: ["settings", "env", "configuration"]
|
|
613
|
+
};
|
|
614
|
+
var BIGRAM_CONCEPTS = {
|
|
615
|
+
"direct debit": ["debit", "mandate", "sepa", "bacs", "bank"],
|
|
616
|
+
"direct debits": ["debit", "mandate", "sepa", "bacs", "bank"],
|
|
617
|
+
"sign in": ["login", "signin", "auth", "session"],
|
|
618
|
+
"signs in": ["login", "signin", "auth", "session"],
|
|
619
|
+
"log in": ["login", "auth", "session"],
|
|
620
|
+
"logs in": ["login", "auth", "session"],
|
|
621
|
+
"logged in": ["login", "auth", "session"],
|
|
622
|
+
"sign up": ["signup", "register", "account"],
|
|
623
|
+
"credit card": ["card", "payment", "charge", "stripe"],
|
|
624
|
+
"credit cards": ["card", "payment", "charge", "stripe"],
|
|
625
|
+
"bank transfer": ["bank", "payment", "sepa", "transfer"],
|
|
626
|
+
"rate limit": ["ratelimit", "throttle", "quota"],
|
|
627
|
+
"two factor": ["totp", "mfa", "otp", "auth"],
|
|
628
|
+
"payment method": ["payment", "stripe", "card", "debit"],
|
|
629
|
+
"payment methods": ["payment", "stripe", "card", "debit"],
|
|
630
|
+
"push notification": ["push", "device", "token", "notification"],
|
|
631
|
+
"push notifications": ["push", "device", "token", "notification"],
|
|
632
|
+
"deep link": ["deeplink", "link", "route"],
|
|
633
|
+
"deep links": ["deeplink", "link", "route"],
|
|
634
|
+
"universal link": ["deeplink", "link", "universal"],
|
|
635
|
+
"universal links": ["deeplink", "link", "universal"],
|
|
636
|
+
"feature flag": ["flag", "rollout", "toggle", "experiment"],
|
|
637
|
+
"feature flags": ["flag", "rollout", "toggle", "experiment"],
|
|
638
|
+
"shopping cart": ["cart", "checkout", "order"],
|
|
639
|
+
"roll back": ["rollback", "deploy", "release"],
|
|
640
|
+
"rolled back": ["rollback", "deploy", "release"],
|
|
641
|
+
"ab test": ["experiment", "variant"],
|
|
642
|
+
"sign out": ["logout", "session", "auth"],
|
|
643
|
+
"fixed width": ["record", "export", "mainframe", "batch"]
|
|
644
|
+
};
|
|
645
|
+
function lexiconKey(token) {
|
|
646
|
+
if (token in CONCEPTS) return token;
|
|
647
|
+
if (token.endsWith("ies")) {
|
|
648
|
+
const singular = token.slice(0, -3) + "y";
|
|
649
|
+
if (singular in CONCEPTS) return singular;
|
|
650
|
+
}
|
|
651
|
+
if (token.endsWith("s")) {
|
|
652
|
+
const singular = token.slice(0, -1);
|
|
653
|
+
if (singular in CONCEPTS) return singular;
|
|
654
|
+
}
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
657
|
+
function expandConcepts(orderedTokens) {
|
|
658
|
+
const present = new Set(orderedTokens);
|
|
659
|
+
const out = [];
|
|
660
|
+
const emitted = /* @__PURE__ */ new Set();
|
|
661
|
+
const emit = (term, from) => {
|
|
662
|
+
if (present.has(term) || emitted.has(term)) return;
|
|
663
|
+
emitted.add(term);
|
|
664
|
+
out.push({ term, from });
|
|
665
|
+
};
|
|
666
|
+
for (let i = 0; i + 1 < orderedTokens.length; i++) {
|
|
667
|
+
const bigram = `${orderedTokens[i]} ${orderedTokens[i + 1]}`;
|
|
668
|
+
const terms = BIGRAM_CONCEPTS[bigram];
|
|
669
|
+
if (terms) for (const t of terms) emit(t, bigram);
|
|
670
|
+
}
|
|
671
|
+
for (const token of orderedTokens) {
|
|
672
|
+
const key = lexiconKey(token);
|
|
673
|
+
if (key) for (const t of CONCEPTS[key]) emit(t, token);
|
|
674
|
+
}
|
|
675
|
+
return out;
|
|
676
|
+
}
|
|
677
|
+
function bigramConsumedTokens(orderedTokens) {
|
|
678
|
+
const consumed = /* @__PURE__ */ new Set();
|
|
679
|
+
for (let i = 0; i + 1 < orderedTokens.length; i++) {
|
|
680
|
+
const bigram = `${orderedTokens[i]} ${orderedTokens[i + 1]}`;
|
|
681
|
+
if (!BIGRAM_CONCEPTS[bigram]) continue;
|
|
682
|
+
for (const tok of [orderedTokens[i], orderedTokens[i + 1]]) {
|
|
683
|
+
if (!lexiconKey(tok)) consumed.add(tok);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return consumed;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
// src/engine/relevance-provider.ts
|
|
296
690
|
var MAX_PROVIDER_EXPANSIONS = 24;
|
|
297
691
|
function disabled() {
|
|
298
692
|
const v = process.env.VIBGRATE_NO_KERNEL;
|
|
@@ -411,6 +805,8 @@ var DEFAULT_GITIGNORE = [
|
|
|
411
805
|
"graph.json",
|
|
412
806
|
"graph.snap",
|
|
413
807
|
"graph.tags.snap",
|
|
808
|
+
// Binary semantic index next to the map (never model-named; never under cache/).
|
|
809
|
+
"embeddings",
|
|
414
810
|
"graph.html",
|
|
415
811
|
"GRAPH_REPORT.md",
|
|
416
812
|
"facts.jsonl",
|
|
@@ -580,7 +976,63 @@ async function loadTopicTags(graph, root, graphPath) {
|
|
|
580
976
|
writeSidecar(file, { provider: providerVersion, corpusHash }, record);
|
|
581
977
|
return tags;
|
|
582
978
|
}
|
|
979
|
+
var CACHE_VERSION = "vg-parse-cache/4";
|
|
980
|
+
function cacheDir(root) {
|
|
981
|
+
return path2.join(root, ".vibgrate", "cache");
|
|
982
|
+
}
|
|
983
|
+
function cachePath(root) {
|
|
984
|
+
return path2.join(cacheDir(root), "parse-cache.json");
|
|
985
|
+
}
|
|
986
|
+
function loadCache(root, opts) {
|
|
987
|
+
const file = cachePath(root);
|
|
988
|
+
let data = {
|
|
989
|
+
version: CACHE_VERSION,
|
|
990
|
+
toolVersion: opts.toolVersion,
|
|
991
|
+
grammars: opts.grammars,
|
|
992
|
+
entries: {}
|
|
993
|
+
};
|
|
994
|
+
if (!opts.disabled && fs3.existsSync(file)) {
|
|
995
|
+
try {
|
|
996
|
+
const loaded = JSON.parse(fs3.readFileSync(file, "utf8"));
|
|
997
|
+
if ((loaded.version === CACHE_VERSION || loaded.version === "vg-parse-cache/3") && loaded.toolVersion === opts.toolVersion && loaded.grammars === opts.grammars && loaded.entries) {
|
|
998
|
+
data = { ...loaded, version: CACHE_VERSION };
|
|
999
|
+
}
|
|
1000
|
+
} catch {
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
return {
|
|
1004
|
+
get(rel, hash) {
|
|
1005
|
+
const entry = data.entries[rel];
|
|
1006
|
+
return entry && entry.hash === hash ? entry.parse : void 0;
|
|
1007
|
+
},
|
|
1008
|
+
getByStat(rel, mtimeMs, size) {
|
|
1009
|
+
const entry = data.entries[rel];
|
|
1010
|
+
if (!entry) return void 0;
|
|
1011
|
+
if (entry.mtimeMs === mtimeMs && entry.size === size && entry.parse) {
|
|
1012
|
+
return { parse: entry.parse, hash: entry.hash };
|
|
1013
|
+
}
|
|
1014
|
+
return void 0;
|
|
1015
|
+
},
|
|
1016
|
+
set(rel, parse, stat) {
|
|
1017
|
+
data.entries[rel] = {
|
|
1018
|
+
hash: parse.hash,
|
|
1019
|
+
parse,
|
|
1020
|
+
mtimeMs: stat?.mtimeMs,
|
|
1021
|
+
size: stat?.size
|
|
1022
|
+
};
|
|
1023
|
+
},
|
|
1024
|
+
prune(currentRels) {
|
|
1025
|
+
for (const rel of Object.keys(data.entries)) {
|
|
1026
|
+
if (!currentRels.has(rel)) delete data.entries[rel];
|
|
1027
|
+
}
|
|
1028
|
+
},
|
|
1029
|
+
save() {
|
|
1030
|
+
fs3.mkdirSync(cacheDir(root), { recursive: true });
|
|
1031
|
+
fs3.writeFileSync(file, stableStringify(data, 0));
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
}
|
|
583
1035
|
|
|
584
|
-
export { analyzeQuestion, defaultGraphPath, ensureVibgrateGitignore, legacyGraphPath, loadGraphFileWithSnapshot, loadRelevanceProvider, loadTopicTags, mapFileExists, mapFileStat, preferInRepoGraph, relevanceModuleDir, renderHtml, renderReport, resetRelevanceProviderCache, resolveGraphPath, vibgrateDir, writeArtifacts };
|
|
585
|
-
//# sourceMappingURL=chunk-
|
|
586
|
-
//# sourceMappingURL=chunk-
|
|
1036
|
+
export { WEAK_TERMS, analyzeQuestion, bigramConsumedTokens, cacheDir, defaultGraphPath, ensureVibgrateGitignore, expandConcepts, legacyGraphPath, loadCache, loadGraphFileWithSnapshot, loadRelevanceProvider, loadTopicTags, mapFileExists, mapFileStat, parseGraph, preferInRepoGraph, relevanceModuleDir, renderHtml, renderReport, resetRelevanceProviderCache, resolveGraphPath, serializeGraph, slimGraphForExport, stableStringify, vibgrateDir, writeArtifacts };
|
|
1037
|
+
//# sourceMappingURL=chunk-6IL3UJTE.js.map
|
|
1038
|
+
//# sourceMappingURL=chunk-6IL3UJTE.js.map
|