@saasontools/strauss-kb 0.1.11 → 0.1.12

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.
@@ -2,7 +2,7 @@ import {
2
2
  KB_COMMANDS,
3
3
  KbStore,
4
4
  VERSION
5
- } from "./chunk-OVRQCQ6P.js";
5
+ } from "./chunk-33ZCBEUV.js";
6
6
 
7
7
  // src/mcp.ts
8
8
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
@@ -46,4 +46,4 @@ export {
46
46
  createKbMcpServer,
47
47
  runKbMcpServer
48
48
  };
49
- //# sourceMappingURL=chunk-CWWXMD35.js.map
49
+ //# sourceMappingURL=chunk-EXKK2KUN.js.map
@@ -4,7 +4,7 @@ import {
4
4
  KB_DIR,
5
5
  KbStore,
6
6
  VERSION
7
- } from "./chunk-OVRQCQ6P.js";
7
+ } from "./chunk-33ZCBEUV.js";
8
8
 
9
9
  // src/cli.ts
10
10
  import { join } from "path";
@@ -112,4 +112,4 @@ function usage() {
112
112
  export {
113
113
  runKbCli
114
114
  };
115
- //# sourceMappingURL=chunk-I3WW4F6X.js.map
115
+ //# sourceMappingURL=chunk-F2U2YLWV.js.map
package/dist/cli-main.cjs CHANGED
@@ -2470,7 +2470,7 @@ var loadCommand = define({
2470
2470
  name: "load",
2471
2471
  tool: "kb_load",
2472
2472
  usage: "load [type] [--budget N | --all] [--repo-root PATH]",
2473
- description: "Loads the whole knowledge base at once, each record with its standing. Superseded records arrive as stubs (name, replacement, date); rejected and open records arrive whole. Refuses past the token budget rather than truncating \u2014 call kb_catalog, then kb_pack on the record that matters, or narrow with `type`; kb_query for a lookup by wording. `all` bypasses the budget.",
2473
+ description: "Loads the whole knowledge base at once, each record with its standing. Superseded records arrive as stubs; rejected and open records arrive whole. Refuses past the token budget \u2014 call kb_catalog, kb_pack on it; `all` bypasses the budget. Never read record files directly. Cache-stable; `digest` is the base's content stamp \u2014 hooks use it to tell you when to reload.",
2474
2474
  input: import_zod12.z.object({
2475
2475
  bundlePath,
2476
2476
  type: import_zod12.z.enum(KB_RECORD_TYPES).optional(),
@@ -2713,7 +2713,7 @@ var queryCommand = define({
2713
2713
  name: "query",
2714
2714
  tool: "kb_query",
2715
2715
  usage: "query <text...> [--repo-root PATH]",
2716
- description: "Search and return each match with its standing. Results are flagged, never filtered: a superseded record comes back alongside whatever replaced it, and a rejected one is marked as something explicitly not adopted. This is the lookup-by-wording rung, and the narrowest of the three: use it when you know roughly what the record says. The decision rule around it \u2014 while the base fits kb_load's token budget, kb_load it whole, because on this package's measurements a reader holding the whole base answered eight of nine questions whose wording appears in no record where embedding search answered four; once kb_load refuses, kb_catalog for one line per record and then kb_pack on the record the work centres on; and kb_query when the question is a point lookup rather than a neighbourhood. A query cannot tell you that nothing was decided \u2014 it returns its nearest hit whatever the distance \u2014 so reach for kb_catalog when the question is what exists. Never read record files directly: this tool (with kb_load, kb_catalog, kb_pack and kb_trace) is the only supported way to read a base; a file read bypasses supersession resolution and returns replaced records as if current.",
2716
+ description: "Search; every hit carries its standing. Flagged, never filtered: a superseded hit returns with its replacement, a rejected one is marked. Prefer kb_load when the base fits its budget \u2014 a full read beats search. Results are volatile: place them at the tail, not the cached prefix. Never read record files directly.",
2717
2717
  input: import_zod18.z.object({
2718
2718
  bundlePath,
2719
2719
  text: import_zod18.z.string().optional(),
@@ -3733,6 +3733,7 @@ ${answer}
3733
3733
  const records = adjudicated.filter((hit) => hit.standing !== "superseded");
3734
3734
  const superseded = adjudicated.filter((hit) => hit.standing === "superseded").map(stub);
3735
3735
  const approxTokens2 = records.reduce((total, hit) => total + estimateTokens(hit.record), 0) + superseded.reduce((total, entry) => total + estimateStubTokens(entry), 0);
3736
+ const bundleDigestValue = bundleDigest(records, superseded);
3736
3737
  if (!options.all && approxTokens2 > budgetTokens) {
3737
3738
  return {
3738
3739
  loaded: false,
@@ -3743,7 +3744,8 @@ ${answer}
3743
3744
  approxTokens: approxTokens2,
3744
3745
  budgetTokens,
3745
3746
  type: options.type
3746
- })
3747
+ }),
3748
+ digest: bundleDigestValue
3747
3749
  };
3748
3750
  }
3749
3751
  return {
@@ -3752,7 +3754,8 @@ ${answer}
3752
3754
  tokensLoaded: approxTokens2,
3753
3755
  budgetTokens: options.all ? null : budgetTokens,
3754
3756
  records,
3755
- superseded
3757
+ superseded,
3758
+ digest: bundleDigestValue
3756
3759
  };
3757
3760
  }
3758
3761
  /** How a position was arrived at, as a timeline. See `trace.ts`. */
@@ -4069,9 +4072,25 @@ function normalizeActor(id) {
4069
4072
  function digest(contents) {
4070
4073
  return (0, import_node_crypto2.createHash)("sha256").update(contents).digest("hex");
4071
4074
  }
4075
+ function bundleDigest(records, superseded) {
4076
+ const entries = [
4077
+ ...records.map(
4078
+ (hit) => `${hit.record.conceptId}:current:${digest(
4079
+ stringifyMarkdownWithFrontmatter(
4080
+ hit.record.body,
4081
+ hit.record.frontmatter
4082
+ )
4083
+ )}`
4084
+ ),
4085
+ ...superseded.map(
4086
+ (entry) => `${entry.conceptId}:superseded:${digest(JSON.stringify(entry))}`
4087
+ )
4088
+ ].sort();
4089
+ return digest(entries.join("\n"));
4090
+ }
4072
4091
 
4073
4092
  // src/version.ts
4074
- var VERSION = true ? "0.1.11" : "0.0.0-dev";
4093
+ var VERSION = true ? "0.1.12" : "0.0.0-dev";
4075
4094
 
4076
4095
  // src/cli.ts
4077
4096
  async function runKbCli(argv) {