@orquentra/codebuddy 2.6.0 → 2.7.0

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.
Files changed (117) hide show
  1. package/CLAUDE_CODEX.md +6 -4
  2. package/WORKFLOW.md +5 -5
  3. package/dist/{chunk-U4HAJLIB.js → chunk-3QGW53GD.js} +16 -3
  4. package/dist/chunk-3QGW53GD.js.map +1 -0
  5. package/dist/{chunk-L5AYZC3F.js → chunk-5EDGAZQN.js} +438 -68
  6. package/dist/chunk-5EDGAZQN.js.map +1 -0
  7. package/dist/chunk-5UH3BEQR.js +32 -0
  8. package/dist/chunk-5UH3BEQR.js.map +1 -0
  9. package/dist/{chunk-JFDRBPYF.js → chunk-6JCKMIQY.js} +2 -2
  10. package/dist/{chunk-UN57FKQX.js → chunk-AK2UAE32.js} +152 -862
  11. package/dist/chunk-AK2UAE32.js.map +1 -0
  12. package/dist/{chunk-GDJH7XJC.js → chunk-AL6VBTNA.js} +77 -3
  13. package/dist/chunk-AL6VBTNA.js.map +1 -0
  14. package/dist/{chunk-WHZSVY2L.js → chunk-AQHPEJR6.js} +94 -23
  15. package/dist/chunk-AQHPEJR6.js.map +1 -0
  16. package/dist/{chunk-PCE4STAY.js → chunk-BQM7FJ7D.js} +6 -6
  17. package/dist/chunk-BQM7FJ7D.js.map +1 -0
  18. package/dist/{chunk-XBJQKCLU.js → chunk-CAEPHLHC.js} +13 -9
  19. package/dist/chunk-CAEPHLHC.js.map +1 -0
  20. package/dist/chunk-CG5B3LYG.js +66 -0
  21. package/dist/chunk-CG5B3LYG.js.map +1 -0
  22. package/dist/chunk-CSRD5OQA.js +79 -0
  23. package/dist/chunk-CSRD5OQA.js.map +1 -0
  24. package/dist/{chunk-IHQM2ZDV.js → chunk-DFV2SK6C.js} +1 -1
  25. package/dist/{chunk-IHQM2ZDV.js.map → chunk-DFV2SK6C.js.map} +1 -1
  26. package/dist/chunk-EEUFU7KV.js +1634 -0
  27. package/dist/chunk-EEUFU7KV.js.map +1 -0
  28. package/dist/{chunk-UFZD3JAA.js → chunk-ESZXCZIN.js} +3 -3
  29. package/dist/{chunk-PYLH4MH5.js → chunk-FJOTP632.js} +1 -1
  30. package/dist/{chunk-SYWJG5NA.js → chunk-GKNYMNFM.js} +17 -7
  31. package/dist/{chunk-SYWJG5NA.js.map → chunk-GKNYMNFM.js.map} +1 -1
  32. package/dist/{chunk-JPHJBCZB.js → chunk-HPOR6YXA.js} +3 -2
  33. package/dist/chunk-HPOR6YXA.js.map +1 -0
  34. package/dist/chunk-JUAFCLRB.js +1014 -0
  35. package/dist/chunk-JUAFCLRB.js.map +1 -0
  36. package/dist/{chunk-776EQXDV.js → chunk-KNR2P2UY.js} +110 -83
  37. package/dist/chunk-KNR2P2UY.js.map +1 -0
  38. package/dist/{chunk-N34XHWBA.js → chunk-LCSBL5TT.js} +24 -11
  39. package/dist/chunk-LCSBL5TT.js.map +1 -0
  40. package/dist/{chunk-QDBDYCM2.js → chunk-MSUAVR3R.js} +76 -11
  41. package/dist/chunk-MSUAVR3R.js.map +1 -0
  42. package/dist/{chunk-6MKEIDX5.js → chunk-SFMIMLXR.js} +2 -2
  43. package/dist/chunk-TGFTKWOR.js +16 -0
  44. package/dist/chunk-TGFTKWOR.js.map +1 -0
  45. package/dist/chunk-TUR6YKEE.js +55 -0
  46. package/dist/chunk-TUR6YKEE.js.map +1 -0
  47. package/dist/chunk-Y7D7PUBE.js +321 -0
  48. package/dist/chunk-Y7D7PUBE.js.map +1 -0
  49. package/dist/{chunk-VAKBJV26.js → chunk-YJIA2MFL.js} +918 -2238
  50. package/dist/chunk-YJIA2MFL.js.map +1 -0
  51. package/dist/cli/index.js +14 -3
  52. package/dist/cli/index.js.map +1 -1
  53. package/dist/{cloud-7WM3YLI4.js → cloud-LXZUR3U2.js} +3 -3
  54. package/dist/{codebuddy-DM-i0Fu5.d.ts → codebuddy-DO7ZhoWn.d.ts} +37 -3
  55. package/dist/config-GEZFLXK6.js +12 -0
  56. package/dist/docker-autostart-KDME7TVC.js +12 -0
  57. package/dist/index.d.ts +48 -3
  58. package/dist/index.js +32 -25
  59. package/dist/langgraph/index.d.ts +1 -1
  60. package/dist/lean-command-CWJAVQ5G.js +18 -0
  61. package/dist/local-ST4WMRCG.js +17 -0
  62. package/dist/{main-HFHLGID4.js → main-AHNGHC4L.js} +327 -329
  63. package/dist/main-AHNGHC4L.js.map +1 -0
  64. package/dist/{memory-4RGVLPKG.js → memory-TGHVTBME.js} +9 -8
  65. package/dist/memory-TGHVTBME.js.map +1 -0
  66. package/dist/operations-7BTAAUHF.js +26 -0
  67. package/dist/postgres-docker-QQZQ2ABK.js +16 -0
  68. package/dist/pretool-command-3SXQSMAO.js +13 -0
  69. package/dist/{rerank-3P3C2UHN.js → rerank-IQAEWLQR.js} +6 -5
  70. package/dist/rerank-IQAEWLQR.js.map +1 -0
  71. package/dist/runtime-E7JQZ2BZ.js +46 -0
  72. package/dist/runtime-E7JQZ2BZ.js.map +1 -0
  73. package/dist/stdio-HOV4P3DQ.js +12 -0
  74. package/dist/stdio-HOV4P3DQ.js.map +1 -0
  75. package/dist/summaries-XV3JGGCC.js +20 -0
  76. package/dist/summaries-XV3JGGCC.js.map +1 -0
  77. package/dist/{zvec-MAPSJQSR.js → zvec-KP4KNB7Y.js} +10 -3
  78. package/dist/zvec-KP4KNB7Y.js.map +1 -0
  79. package/package.json +7 -10
  80. package/src/db/migrations/0006_fact_idempotency_key.sql +2 -0
  81. package/src/db/migrations/meta/0006_snapshot.json +1258 -0
  82. package/src/db/migrations/meta/_journal.json +7 -0
  83. package/dist/chunk-776EQXDV.js.map +0 -1
  84. package/dist/chunk-GDJH7XJC.js.map +0 -1
  85. package/dist/chunk-JPHJBCZB.js.map +0 -1
  86. package/dist/chunk-L5AYZC3F.js.map +0 -1
  87. package/dist/chunk-N34XHWBA.js.map +0 -1
  88. package/dist/chunk-PCE4STAY.js.map +0 -1
  89. package/dist/chunk-PQK3GKZH.js +0 -98
  90. package/dist/chunk-PQK3GKZH.js.map +0 -1
  91. package/dist/chunk-QDBDYCM2.js.map +0 -1
  92. package/dist/chunk-U4HAJLIB.js.map +0 -1
  93. package/dist/chunk-UN57FKQX.js.map +0 -1
  94. package/dist/chunk-VAKBJV26.js.map +0 -1
  95. package/dist/chunk-WHZSVY2L.js.map +0 -1
  96. package/dist/chunk-XBJQKCLU.js.map +0 -1
  97. package/dist/config-KFEHLV6W.js +0 -11
  98. package/dist/lean-command-C5YPFKHP.js +0 -15
  99. package/dist/local-OTOY56B4.js +0 -13
  100. package/dist/main-HFHLGID4.js.map +0 -1
  101. package/dist/memory-4RGVLPKG.js.map +0 -1
  102. package/dist/operations-LOBAQRLO.js +0 -24
  103. package/dist/pretool-command-MQQ2UNQM.js +0 -10
  104. package/dist/rerank-3P3C2UHN.js.map +0 -1
  105. package/dist/summaries-ZBV5IN7Y.js +0 -18
  106. /package/dist/{chunk-JFDRBPYF.js.map → chunk-6JCKMIQY.js.map} +0 -0
  107. /package/dist/{chunk-UFZD3JAA.js.map → chunk-ESZXCZIN.js.map} +0 -0
  108. /package/dist/{chunk-PYLH4MH5.js.map → chunk-FJOTP632.js.map} +0 -0
  109. /package/dist/{chunk-6MKEIDX5.js.map → chunk-SFMIMLXR.js.map} +0 -0
  110. /package/dist/{cloud-7WM3YLI4.js.map → cloud-LXZUR3U2.js.map} +0 -0
  111. /package/dist/{config-KFEHLV6W.js.map → config-GEZFLXK6.js.map} +0 -0
  112. /package/dist/{lean-command-C5YPFKHP.js.map → docker-autostart-KDME7TVC.js.map} +0 -0
  113. /package/dist/{local-OTOY56B4.js.map → lean-command-CWJAVQ5G.js.map} +0 -0
  114. /package/dist/{operations-LOBAQRLO.js.map → local-ST4WMRCG.js.map} +0 -0
  115. /package/dist/{pretool-command-MQQ2UNQM.js.map → operations-7BTAAUHF.js.map} +0 -0
  116. /package/dist/{summaries-ZBV5IN7Y.js.map → postgres-docker-QQZQ2ABK.js.map} +0 -0
  117. /package/dist/{zvec-MAPSJQSR.js.map → pretool-command-3SXQSMAO.js.map} +0 -0
package/dist/cli/index.js CHANGED
@@ -3,13 +3,24 @@
3
3
  // src/cli/index.ts
4
4
  var [command, subcommand] = process.argv.slice(2);
5
5
  if (command === "hooks" && subcommand === "lean") {
6
- const { runLeanHookCommand } = await import("../lean-command-C5YPFKHP.js");
6
+ const { runLeanHookCommand } = await import("../lean-command-CWJAVQ5G.js");
7
7
  await runLeanHookCommand();
8
8
  } else if (command === "hooks" && subcommand === "pretool") {
9
- const { runPreToolHookCommand } = await import("../pretool-command-MQQ2UNQM.js");
9
+ const { runPreToolHookCommand } = await import("../pretool-command-3SXQSMAO.js");
10
10
  await runPreToolHookCommand();
11
+ } else if (command === "hooks" && (subcommand === "context" || subcommand === "stage" || subcommand === "reset")) {
12
+ const [{ failSoft, readHookInput, writeStdout }, runtime] = await Promise.all([
13
+ import("../stdio-HOV4P3DQ.js"),
14
+ import("../runtime-E7JQZ2BZ.js")
15
+ ]);
16
+ await failSoft(async () => {
17
+ const input = await readHookInput();
18
+ if (subcommand === "context") await runtime.runContextHook(input, writeStdout);
19
+ else if (subcommand === "stage") await runtime.runStageHook(input);
20
+ else await runtime.runResetHook(input, writeStdout);
21
+ });
11
22
  } else {
12
- const { createCli } = await import("../main-HFHLGID4.js");
23
+ const { createCli } = await import("../main-AHNGHC4L.js");
13
24
  await createCli().parseAsync();
14
25
  }
15
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Launcher. Hooks that fire on every prompt (lean) or every Read/Grep\n * (pretool) load only their own module; every other command loads the full CLI.\n */\nconst [command, subcommand] = process.argv.slice(2);\nif (command === \"hooks\" && subcommand === \"lean\") {\n const { runLeanHookCommand } = await import(\"../hooks/lean-command.js\");\n await runLeanHookCommand();\n} else if (command === \"hooks\" && subcommand === \"pretool\") {\n const { runPreToolHookCommand } = await import(\"../hooks/pretool-command.js\");\n await runPreToolHookCommand();\n} else {\n const { createCli } = await import(\"./main.js\");\n await createCli().parseAsync();\n}\n"],"mappings":";;;AAKA,IAAM,CAAC,SAAS,UAAU,IAAI,QAAQ,KAAK,MAAM,CAAC;AAClD,IAAI,YAAY,WAAW,eAAe,QAAQ;AAChD,QAAM,EAAE,mBAAmB,IAAI,MAAM,OAAO,6BAA0B;AACtE,QAAM,mBAAmB;AAC3B,WAAW,YAAY,WAAW,eAAe,WAAW;AAC1D,QAAM,EAAE,sBAAsB,IAAI,MAAM,OAAO,gCAA6B;AAC5E,QAAM,sBAAsB;AAC9B,OAAO;AACL,QAAM,EAAE,UAAU,IAAI,MAAM,OAAO,qBAAW;AAC9C,QAAM,UAAU,EAAE,WAAW;AAC/B;","names":[]}
1
+ {"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * Launcher. Hooks that fire on every prompt (context, lean), every edit\n * (stage), every Read/Grep (pretool) or on compaction (reset) load only their\n * own modules, skipping the database driver, MCP server and command tree\n * (~190 ms per process); every other command loads the full CLI. The\n * runtime calls match `codebuddy hooks <name>` in commands/hooks.ts.\n */\nconst [command, subcommand] = process.argv.slice(2);\nif (command === \"hooks\" && subcommand === \"lean\") {\n const { runLeanHookCommand } = await import(\"../hooks/lean-command.js\");\n await runLeanHookCommand();\n} else if (command === \"hooks\" && subcommand === \"pretool\") {\n const { runPreToolHookCommand } = await import(\"../hooks/pretool-command.js\");\n await runPreToolHookCommand();\n} else if (\n command === \"hooks\" &&\n (subcommand === \"context\" || subcommand === \"stage\" || subcommand === \"reset\")\n) {\n const [{ failSoft, readHookInput, writeStdout }, runtime] = await Promise.all([\n import(\"../hooks/stdio.js\"),\n import(\"../hooks/runtime.js\"),\n ]);\n await failSoft(async () => {\n const input = await readHookInput();\n if (subcommand === \"context\") await runtime.runContextHook(input, writeStdout);\n else if (subcommand === \"stage\") await runtime.runStageHook(input);\n else await runtime.runResetHook(input, writeStdout);\n });\n} else {\n const { createCli } = await import(\"./main.js\");\n await createCli().parseAsync();\n}\n"],"mappings":";;;AAQA,IAAM,CAAC,SAAS,UAAU,IAAI,QAAQ,KAAK,MAAM,CAAC;AAClD,IAAI,YAAY,WAAW,eAAe,QAAQ;AAChD,QAAM,EAAE,mBAAmB,IAAI,MAAM,OAAO,6BAA0B;AACtE,QAAM,mBAAmB;AAC3B,WAAW,YAAY,WAAW,eAAe,WAAW;AAC1D,QAAM,EAAE,sBAAsB,IAAI,MAAM,OAAO,gCAA6B;AAC5E,QAAM,sBAAsB;AAC9B,WACE,YAAY,YACX,eAAe,aAAa,eAAe,WAAW,eAAe,UACtE;AACA,QAAM,CAAC,EAAE,UAAU,eAAe,YAAY,GAAG,OAAO,IAAI,MAAM,QAAQ,IAAI;AAAA,IAC5E,OAAO,sBAAmB;AAAA,IAC1B,OAAO,wBAAqB;AAAA,EAC9B,CAAC;AACD,QAAM,SAAS,YAAY;AACzB,UAAM,QAAQ,MAAM,cAAc;AAClC,QAAI,eAAe,UAAW,OAAM,QAAQ,eAAe,OAAO,WAAW;AAAA,aACpE,eAAe,QAAS,OAAM,QAAQ,aAAa,KAAK;AAAA,QAC5D,OAAM,QAAQ,aAAa,OAAO,WAAW;AAAA,EACpD,CAAC;AACH,OAAO;AACL,QAAM,EAAE,UAAU,IAAI,MAAM,OAAO,qBAAW;AAC9C,QAAM,UAAU,EAAE,WAAW;AAC/B;","names":[]}
@@ -4,8 +4,8 @@ import {
4
4
  OpenRouterEmbeddingProvider,
5
5
  rerankHuggingFace,
6
6
  rerankOpenRouter
7
- } from "./chunk-JFDRBPYF.js";
8
- import "./chunk-JPHJBCZB.js";
7
+ } from "./chunk-6JCKMIQY.js";
8
+ import "./chunk-HPOR6YXA.js";
9
9
  import "./chunk-PZ5AY32C.js";
10
10
  export {
11
11
  HF_ROUTER_BASE_URL,
@@ -14,4 +14,4 @@ export {
14
14
  rerankHuggingFace,
15
15
  rerankOpenRouter
16
16
  };
17
- //# sourceMappingURL=cloud-7WM3YLI4.js.map
17
+ //# sourceMappingURL=cloud-LXZUR3U2.js.map
@@ -68,6 +68,8 @@ type ProviderConfig = {
68
68
  model?: string;
69
69
  /** Cosine floor for dense recall; overrides the built-in calibration (`models calibrate`). */
70
70
  relevanceFloor?: number;
71
+ /** Looser floor for an explicit `recall` (the agent asked); overrides the built-in one. */
72
+ recallFloor?: number;
71
73
  };
72
74
  type WorkerConfig = {
73
75
  pollIntervalMs?: number;
@@ -164,6 +166,8 @@ type FactInsert = {
164
166
  object: string;
165
167
  /** Explicit single-valued proposition identity; null/absent allows multiple values. */
166
168
  propositionKey?: string | null | undefined;
169
+ /** The caller's retry key; a write carrying a known key returns that fact. */
170
+ idempotencyKey?: string | null | undefined;
167
171
  /** Imported provenance/lifecycle from the Markdown source; defaults apply when absent. */
168
172
  confidence?: number | undefined;
169
173
  createdAt?: Date | undefined;
@@ -413,7 +417,12 @@ type MemoryRepository = {
413
417
  facts: string[];
414
418
  summaries: string[];
415
419
  }>;
416
- claimPendingEmbeddings(limit: number): Promise<EmbeddingJob[]>;
420
+ /**
421
+ * Lease up to `limit` pending jobs. With `namespaceId`, only that
422
+ * namespace's: projects sharing one database may embed with different
423
+ * providers, and a job embedded in the wrong space is re-queued forever.
424
+ */
425
+ claimPendingEmbeddings(limit: number, namespaceId?: string): Promise<EmbeddingJob[]>;
417
426
  renewEmbeddingLease(id: string, leaseToken: string): Promise<boolean>;
418
427
  markEmbeddingReady(id: string, leaseToken: string, vector: number[], model: string, space?: string): Promise<boolean>;
419
428
  markEmbeddingFailed(id: string, leaseToken: string, error: string, attempts: number, options?: {
@@ -505,6 +514,12 @@ type PlanInput = {
505
514
  conflictMode: ConflictMode;
506
515
  queryEmbedding: QueryEmbedding | null;
507
516
  repository: MemoryRepository;
517
+ /**
518
+ * Calibrated cosine at or above which a vector match is relevant for this
519
+ * embedding model (the same floor the prompt hook uses). Without it, the
520
+ * policy's generic minimum applies.
521
+ */
522
+ relevanceFloor?: number | undefined;
508
523
  };
509
524
  /** Structured provenance for a recalled fact; `conflict` is set when its proposition key had rivals. */
510
525
  type FactProvenance = {
@@ -595,6 +610,7 @@ declare const codeBuddyConfigSchema: z.ZodObject<{
595
610
  apiKey: z.ZodOptional<z.ZodString>;
596
611
  model: z.ZodOptional<z.ZodString>;
597
612
  relevanceFloor: z.ZodOptional<z.ZodNumber>;
613
+ recallFloor: z.ZodOptional<z.ZodNumber>;
598
614
  }, z.core.$strip>;
599
615
  namespace: z.ZodString;
600
616
  projectRoot: z.ZodOptional<z.ZodString>;
@@ -624,6 +640,7 @@ declare const factFrontMatterSchema: z.ZodObject<{
624
640
  predicate: z.ZodString;
625
641
  object: z.ZodString;
626
642
  propositionKey: z.ZodDefault<z.ZodNullable<z.ZodString>>;
643
+ idempotencyKey: z.ZodDefault<z.ZodNullable<z.ZodString>>;
627
644
  confidence: z.ZodNumber;
628
645
  createdAt: z.ZodPreprocess<z.ZodString, unknown>;
629
646
  createdByAgent: z.ZodNullable<z.ZodString>;
@@ -664,7 +681,7 @@ type FactFile = z.infer<typeof factFrontMatterSchema> & {
664
681
  content: string;
665
682
  path: string;
666
683
  };
667
- type FactFileWrite = Omit<FactFile, "path" | "schemaVersion" | "type" | "category" | "paths" | "severity" | "introducedBy" | "resolvedBy" | "fingerprint" | "sourcePlanId" | "sourceSessionId" | "verification" | "supersededBy" | "sharedWith" | "propositionKey"> & Partial<Pick<FactFile, "category" | "paths" | "severity" | "introducedBy" | "resolvedBy" | "fingerprint" | "sourcePlanId" | "sourceSessionId" | "verification" | "supersededBy" | "sharedWith" | "propositionKey">>;
684
+ type FactFileWrite = Omit<FactFile, "path" | "schemaVersion" | "type" | "category" | "paths" | "severity" | "introducedBy" | "resolvedBy" | "fingerprint" | "sourcePlanId" | "sourceSessionId" | "verification" | "supersededBy" | "sharedWith" | "propositionKey" | "idempotencyKey"> & Partial<Pick<FactFile, "category" | "paths" | "severity" | "introducedBy" | "resolvedBy" | "fingerprint" | "sourcePlanId" | "sourceSessionId" | "verification" | "supersededBy" | "sharedWith" | "propositionKey" | "idempotencyKey">>;
668
685
  type IncidentFactFile = FactFile & {
669
686
  category: "incident";
670
687
  severity: IncidentSeverity;
@@ -688,6 +705,8 @@ declare class MemoryFileStore {
688
705
  writeFact(raw: FactFileWrite): Promise<string>;
689
706
  writeSummary(input: SummaryFileWrite): Promise<string>;
690
707
  readFact(pathOrId: string): Promise<FactFile>;
708
+ /** `trusted`: the caller (scan) already proved the path is a regular file in a checked directory. */
709
+ private readFactFile;
691
710
  listFacts(): Promise<FactFile[]>;
692
711
  /**
693
712
  * Parse every managed fact file. Hand-written markdown is ignored, and a
@@ -720,6 +739,14 @@ declare class MemoryFileStore {
720
739
  summaries: SummaryFile[];
721
740
  invalid: InvalidMemoryFile[];
722
741
  }>;
742
+ /**
743
+ * Parse every managed file in `directory`. Hot path: the prompt hook and
744
+ * capture scan facts several times per process, and the MCP server for its
745
+ * lifetime, so each parsed file is cached by path, mtime and size (a changed
746
+ * file is re-read, from any process) and files are read in parallel batches.
747
+ * The directory chain is checked for symlinks once; a `withFileTypes` entry
748
+ * that is a symlink is never `isFile()`, so no file escapes through one.
749
+ */
723
750
  private scan;
724
751
  deleteFact(id: string): Promise<void>;
725
752
  markIncidentResolved(id: string, resolvedBy: string): Promise<void>;
@@ -742,6 +769,8 @@ type EmbeddingWorkerOptions = {
742
769
  batchSize?: number;
743
770
  maxAttempts?: number;
744
771
  onDiagnostic?: ModelCallSink;
772
+ /** Claim only this namespace's jobs (resolved when the loop polls). */
773
+ namespaceId?: () => string | undefined;
745
774
  };
746
775
  type ModelCallSink = (entry: ModelCallEntry) => void | Promise<void>;
747
776
  type WorkerState = "idle" | "running" | "draining" | "stopped";
@@ -752,6 +781,7 @@ declare class EmbeddingWorker {
752
781
  private readonly batchSize;
753
782
  private readonly maxAttempts;
754
783
  private readonly onDiagnostic;
784
+ private readonly namespaceId;
755
785
  private state;
756
786
  private loopPromise;
757
787
  private wake;
@@ -805,6 +835,8 @@ declare class CodeBuddy {
805
835
  remember(input: RememberInput): Promise<RememberResult>;
806
836
  rememberBatch(items: RememberBatchItem[]): Promise<RememberResult[]>;
807
837
  recall(input: RecallInput): Promise<RecallResult>;
838
+ /** Cosine floor for an explicit `recall` of the query's embedding model. */
839
+ private recallFloor;
808
840
  /**
809
841
  * Dense evidence for file facts supplied by the context engine: the cosine of
810
842
  * each fact whose stored vector clears the embedding model's calibrated
@@ -836,7 +868,9 @@ declare class CodeBuddy {
836
868
  * file is applied independently: malformed or conflicting files are reported
837
869
  * in `failures` and never abort healthy imports (nor count as deletions).
838
870
  */
839
- reindexMemory(): Promise<ReindexResult>;
871
+ reindexMemory(options?: {
872
+ respace?: boolean;
873
+ }): Promise<ReindexResult>;
840
874
  reindexFacts(): Promise<ReindexCounts>;
841
875
  private requireNamespaceId;
842
876
  private writeOne;
@@ -0,0 +1,12 @@
1
+ import {
2
+ redactLlmKeys,
3
+ resolveLlmConfig
4
+ } from "./chunk-SFMIMLXR.js";
5
+ import "./chunk-KNR2P2UY.js";
6
+ import "./chunk-CG5B3LYG.js";
7
+ import "./chunk-PZ5AY32C.js";
8
+ export {
9
+ redactLlmKeys,
10
+ resolveLlmConfig
11
+ };
12
+ //# sourceMappingURL=config-GEZFLXK6.js.map
@@ -0,0 +1,12 @@
1
+ import {
2
+ isDockerDaemonRunning,
3
+ tryStartDockerDesktop,
4
+ waitForDockerDaemon
5
+ } from "./chunk-5UH3BEQR.js";
6
+ import "./chunk-PZ5AY32C.js";
7
+ export {
8
+ isDockerDaemonRunning,
9
+ tryStartDockerDesktop,
10
+ waitForDockerDaemon
11
+ };
12
+ //# sourceMappingURL=docker-autostart-KDME7TVC.js.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { a as CodeBuddyConfig, M as MemoryRepository, b as MemoryFileStore, C as CodeBuddy, N as NamespaceSummary, A as AgentWriteBreakdown, L as ListedFact, c as ModelProvider, d as ContextPolicy, e as PlanInput, P as PlannedContext, E as EmbeddingSpace, f as ProviderDiagnosticsHook, g as EmbeddingRequest, h as EmbeddingResponse, T as TextGenerationRequest, i as TextGenerationResponse } from './codebuddy-DM-i0Fu5.js';
2
- export { j as CodeBuddyDependencies, k as CodeBuddyStatus, l as ConflictMode, m as EmbeddingWorker, F as FACT_CATEGORIES, n as FactCategory, o as FactFile, p as FactFileWrite, q as ForgetResult, I as INCIDENT_SEVERITIES, r as IncidentFactFile, s as IncidentSeverity, t as MemoryWriteType, u as PlannedMessage, v as PlannerStats, Q as QueryEmbedding, R as RecallInput, w as RecallResult, x as RememberBatchItem, y as RememberInput, z as RememberResult, S as ShareInput, B as ShareResult, D as SkipReason, G as SummaryFile, H as SummaryFileWrite, J as TraceSpan, K as Tracer, U as UnshareInput, O as UnshareResult, W as WorkerConfig, V as WorkerState, X as createTracer, Y as isLangSmithTracingEnabled } from './codebuddy-DM-i0Fu5.js';
1
+ import { a as CodeBuddyConfig, M as MemoryRepository, b as MemoryFileStore, C as CodeBuddy, N as NamespaceSummary, A as AgentWriteBreakdown, L as ListedFact, c as ModelProvider, d as ContextPolicy, e as PlanInput, P as PlannedContext, E as EmbeddingSpace, f as ProviderDiagnosticsHook, g as EmbeddingRequest, h as EmbeddingResponse, T as TextGenerationRequest, i as TextGenerationResponse } from './codebuddy-DO7ZhoWn.js';
2
+ export { j as CodeBuddyDependencies, k as CodeBuddyStatus, l as ConflictMode, m as EmbeddingWorker, F as FACT_CATEGORIES, n as FactCategory, o as FactFile, p as FactFileWrite, q as ForgetResult, I as INCIDENT_SEVERITIES, r as IncidentFactFile, s as IncidentSeverity, t as MemoryWriteType, u as PlannedMessage, v as PlannerStats, Q as QueryEmbedding, R as RecallInput, w as RecallResult, x as RememberBatchItem, y as RememberInput, z as RememberResult, S as ShareInput, B as ShareResult, D as SkipReason, G as SummaryFile, H as SummaryFileWrite, J as TraceSpan, K as Tracer, U as UnshareInput, O as UnshareResult, W as WorkerConfig, V as WorkerState, X as createTracer, Y as isLangSmithTracingEnabled } from './codebuddy-DO7ZhoWn.js';
3
3
  import { z } from 'zod';
4
4
  import * as drizzle_orm_postgres_js from 'drizzle-orm/postgres-js';
5
5
  import postgres from 'postgres';
@@ -208,6 +208,8 @@ type DoctorReport = {
208
208
  configured: string | null;
209
209
  runtime: string | null;
210
210
  ok: boolean;
211
+ /** Set when doctor rewrote a legacy `"default"` namespace to the folder default. */
212
+ migrated?: string;
211
213
  warning?: string;
212
214
  };
213
215
  };
@@ -386,6 +388,8 @@ declare class PlanLifecycle {
386
388
  complete(id: string, options?: CompleteOptions, now?: string): Promise<PlanSpec>;
387
389
  abandon(id: string, options?: AbandonOptions, now?: string): Promise<PlanSpec>;
388
390
  amend(id: string, patch: AmendPlanPatch): Promise<PlanSpec>;
391
+ /** Plan paths flow into risk, context and file reads; none may leave the repository. */
392
+ private assertPathsInside;
389
393
  current(namespace: string): Promise<PlanSpec | null>;
390
394
  private assertTransition;
391
395
  private require;
@@ -905,6 +909,23 @@ declare const facts: drizzle_orm_pg_core.PgTableWithColumns<{
905
909
  identity: undefined;
906
910
  generated: undefined;
907
911
  }, {}, {}>;
912
+ idempotencyKey: drizzle_orm_pg_core.PgColumn<{
913
+ name: "idempotency_key";
914
+ tableName: "facts";
915
+ dataType: "string";
916
+ columnType: "PgText";
917
+ data: string;
918
+ driverParam: string;
919
+ notNull: false;
920
+ hasDefault: false;
921
+ isPrimaryKey: false;
922
+ isAutoincrement: false;
923
+ hasRuntimeDefault: false;
924
+ enumValues: [string, ...string[]];
925
+ baseColumn: never;
926
+ identity: undefined;
927
+ generated: undefined;
928
+ }, {}, {}>;
908
929
  content: drizzle_orm_pg_core.PgColumn<{
909
930
  name: "content";
910
931
  tableName: "facts";
@@ -2009,7 +2030,7 @@ declare function createPostgresRepository(client: DatabaseClient): MemoryReposit
2009
2030
 
2010
2031
  type ModuleNode = {
2011
2032
  path: string;
2012
- language: "ts" | "js";
2033
+ language: "ts" | "js" | "py";
2013
2034
  imports: string[];
2014
2035
  };
2015
2036
  type ModuleEdge = {
@@ -2098,6 +2119,7 @@ declare const mcpToolInputSchemas: {
2098
2119
  latest: "latest";
2099
2120
  highest_confidence: "highest_confidence";
2100
2121
  }>>;
2122
+ compact: z.ZodOptional<z.ZodBoolean>;
2101
2123
  }, z.core.$strip>;
2102
2124
  readonly list_facts: z.ZodObject<{
2103
2125
  subject: z.ZodOptional<z.ZodString>;
@@ -2334,6 +2356,12 @@ type ModelDefinition = {
2334
2356
  * `npm run eval:semantic`; cosines are not comparable across models.
2335
2357
  */
2336
2358
  relevanceFloor?: number;
2359
+ /**
2360
+ * Floor for an explicit `recall`, where a miss costs more than an extra
2361
+ * fact: best F2 (recall-weighted) on the same calibration set. Without one,
2362
+ * `recall` uses `relevanceFloor`.
2363
+ */
2364
+ recallFloor?: number;
2337
2365
  };
2338
2366
 
2339
2367
  type ResilienceOptions = {
@@ -2496,11 +2524,28 @@ declare function resolveRiskPaths(input: {
2496
2524
  useGit?: boolean;
2497
2525
  }): Promise<string[]>;
2498
2526
 
2527
+ /**
2528
+ * `window` (default): commits, authors and reverts in the last `windowDays`.
2529
+ * `lifetime-size`: log-scaled commit count over all history plus log-scaled
2530
+ * line count. On a time-split benchmark (later bug-fix commits) the 30-day
2531
+ * window scored AUC 0.518, lifetime churn 0.791 and line count 0.834
2532
+ * (`scripts/eval-churn-split.mts` reproduces the comparison).
2533
+ */
2534
+ type ChurnMode = "window" | "lifetime-size";
2499
2535
  type ChurnSignalOptions = {
2500
2536
  repositoryRoot: string;
2501
2537
  enabled?: boolean;
2502
2538
  coefficient?: number;
2539
+ /** Explicit git `--since` value; overrides `windowDays`. */
2503
2540
  since?: string;
2541
+ /** Window for `window` mode, in days (default 30). */
2542
+ windowDays?: number;
2543
+ mode?: ChurnMode;
2544
+ /**
2545
+ * Score as of this date: only commits before it, and (lifetime-size) file
2546
+ * sizes at the last such commit. For time-split evaluation; default now.
2547
+ */
2548
+ asOf?: string | Date;
2504
2549
  };
2505
2550
  declare function createChurnSignal(options: ChurnSignalOptions): Signal;
2506
2551
 
package/dist/index.js CHANGED
@@ -1,3 +1,10 @@
1
+ import {
2
+ mcpToolInputSchemas,
3
+ migrateMemoryToFiles,
4
+ registerCodeBuddyTools,
5
+ startMcpServer
6
+ } from "./chunk-EEUFU7KV.js";
7
+ import "./chunk-MSUAVR3R.js";
1
8
  import {
2
9
  ACTIVE_PLAN_STATUSES,
3
10
  ActivePlanExistsError,
@@ -13,29 +20,18 @@ import {
13
20
  createChurnSignal,
14
21
  createIncidentSignal,
15
22
  createPolicySignal,
16
- mcpToolInputSchemas,
17
- migrateMemoryToFiles,
18
23
  readPolicyFile,
19
- registerCodeBuddyTools,
20
- resolveRiskPaths,
21
- startMcpServer
22
- } from "./chunk-VAKBJV26.js";
23
- import "./chunk-IHQM2ZDV.js";
24
- import "./chunk-SYWJG5NA.js";
25
- import {
26
- buildArchitectureMap,
27
- neighbours,
28
- queryMap
29
- } from "./chunk-L5AYZC3F.js";
30
- import "./chunk-PQK3GKZH.js";
24
+ resolveRiskPaths
25
+ } from "./chunk-YJIA2MFL.js";
26
+ import "./chunk-TUR6YKEE.js";
27
+ import "./chunk-DFV2SK6C.js";
28
+ import "./chunk-GKNYMNFM.js";
29
+ import "./chunk-TGFTKWOR.js";
31
30
  import {
32
31
  CodeBuddy,
33
32
  DefaultPolicy,
34
33
  EmbeddingWorker,
35
- FACT_CATEGORIES,
36
34
  HuggingFaceProvider,
37
- INCIDENT_SEVERITIES,
38
- MemoryFileStore,
39
35
  createPostgresRepository,
40
36
  createRuntime,
41
37
  createTracer,
@@ -45,18 +41,28 @@ import {
45
41
  isLangSmithTracingEnabled,
46
42
  listFactsPage,
47
43
  runDoctor
48
- } from "./chunk-UN57FKQX.js";
49
- import "./chunk-GDJH7XJC.js";
44
+ } from "./chunk-AK2UAE32.js";
45
+ import {
46
+ FACT_CATEGORIES,
47
+ INCIDENT_SEVERITIES,
48
+ MemoryFileStore
49
+ } from "./chunk-JUAFCLRB.js";
50
50
  import {
51
51
  clampBudgetForCallerModel,
52
52
  countTokens
53
- } from "./chunk-XBJQKCLU.js";
54
- import "./chunk-JFDRBPYF.js";
53
+ } from "./chunk-CAEPHLHC.js";
54
+ import "./chunk-6JCKMIQY.js";
55
55
  import {
56
56
  LocalModelProvider
57
- } from "./chunk-U4HAJLIB.js";
58
- import "./chunk-JPHJBCZB.js";
59
- import "./chunk-QDBDYCM2.js";
57
+ } from "./chunk-3QGW53GD.js";
58
+ import {
59
+ buildArchitectureMap,
60
+ neighbours,
61
+ queryMap
62
+ } from "./chunk-5EDGAZQN.js";
63
+ import "./chunk-Y7D7PUBE.js";
64
+ import "./chunk-AL6VBTNA.js";
65
+ import "./chunk-HPOR6YXA.js";
60
66
  import {
61
67
  PLAN_POLICIES,
62
68
  checkConfigPermissions,
@@ -67,7 +73,8 @@ import {
67
73
  loadRuntimeConfig,
68
74
  redactSecrets,
69
75
  setPlanPolicy
70
- } from "./chunk-776EQXDV.js";
76
+ } from "./chunk-KNR2P2UY.js";
77
+ import "./chunk-CG5B3LYG.js";
71
78
  import "./chunk-PZ5AY32C.js";
72
79
  export {
73
80
  ACTIVE_PLAN_STATUSES,
@@ -1,4 +1,4 @@
1
- import { P as PlannedContext, C as CodeBuddy } from '../codebuddy-DM-i0Fu5.js';
1
+ import { P as PlannedContext, C as CodeBuddy } from '../codebuddy-DO7ZhoWn.js';
2
2
  import 'zod';
3
3
 
4
4
  type CodeBuddyCheckpointerOptions = {
@@ -0,0 +1,18 @@
1
+ import {
2
+ runLeanHookCommand
3
+ } from "./chunk-LCSBL5TT.js";
4
+ import "./chunk-FJOTP632.js";
5
+ import "./chunk-GKNYMNFM.js";
6
+ import "./chunk-TGFTKWOR.js";
7
+ import "./chunk-CAEPHLHC.js";
8
+ import "./chunk-5EDGAZQN.js";
9
+ import "./chunk-Y7D7PUBE.js";
10
+ import "./chunk-AL6VBTNA.js";
11
+ import "./chunk-HPOR6YXA.js";
12
+ import "./chunk-KNR2P2UY.js";
13
+ import "./chunk-CG5B3LYG.js";
14
+ import "./chunk-PZ5AY32C.js";
15
+ export {
16
+ runLeanHookCommand
17
+ };
18
+ //# sourceMappingURL=lean-command-CWJAVQ5G.js.map
@@ -0,0 +1,17 @@
1
+ import {
2
+ LocalModelProvider,
3
+ MISSING_RUNTIME,
4
+ localRuntimeInstalled,
5
+ modelCacheDir,
6
+ rerankLocally
7
+ } from "./chunk-3QGW53GD.js";
8
+ import "./chunk-HPOR6YXA.js";
9
+ import "./chunk-PZ5AY32C.js";
10
+ export {
11
+ LocalModelProvider,
12
+ MISSING_RUNTIME,
13
+ localRuntimeInstalled,
14
+ modelCacheDir,
15
+ rerankLocally
16
+ };
17
+ //# sourceMappingURL=local-ST4WMRCG.js.map