@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.
package/dist/cli-main.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runKbCli
4
- } from "./chunk-I3WW4F6X.js";
5
- import "./chunk-OVRQCQ6P.js";
4
+ } from "./chunk-F2U2YLWV.js";
5
+ import "./chunk-33ZCBEUV.js";
6
6
 
7
7
  // src/cli-main.ts
8
8
  runKbCli(process.argv.slice(2)).catch((error) => {
package/dist/index.cjs CHANGED
@@ -1760,6 +1760,7 @@ ${answer}
1760
1760
  const records = adjudicated.filter((hit) => hit.standing !== "superseded");
1761
1761
  const superseded = adjudicated.filter((hit) => hit.standing === "superseded").map(stub);
1762
1762
  const approxTokens2 = records.reduce((total, hit) => total + estimateTokens(hit.record), 0) + superseded.reduce((total, entry) => total + estimateStubTokens(entry), 0);
1763
+ const bundleDigestValue = bundleDigest(records, superseded);
1763
1764
  if (!options.all && approxTokens2 > budgetTokens) {
1764
1765
  return {
1765
1766
  loaded: false,
@@ -1770,7 +1771,8 @@ ${answer}
1770
1771
  approxTokens: approxTokens2,
1771
1772
  budgetTokens,
1772
1773
  type: options.type
1773
- })
1774
+ }),
1775
+ digest: bundleDigestValue
1774
1776
  };
1775
1777
  }
1776
1778
  return {
@@ -1779,7 +1781,8 @@ ${answer}
1779
1781
  tokensLoaded: approxTokens2,
1780
1782
  budgetTokens: options.all ? null : budgetTokens,
1781
1783
  records,
1782
- superseded
1784
+ superseded,
1785
+ digest: bundleDigestValue
1783
1786
  };
1784
1787
  }
1785
1788
  /** How a position was arrived at, as a timeline. See `trace.ts`. */
@@ -2096,6 +2099,22 @@ function normalizeActor(id) {
2096
2099
  function digest(contents) {
2097
2100
  return (0, import_node_crypto2.createHash)("sha256").update(contents).digest("hex");
2098
2101
  }
2102
+ function bundleDigest(records, superseded) {
2103
+ const entries = [
2104
+ ...records.map(
2105
+ (hit) => `${hit.record.conceptId}:current:${digest(
2106
+ stringifyMarkdownWithFrontmatter(
2107
+ hit.record.body,
2108
+ hit.record.frontmatter
2109
+ )
2110
+ )}`
2111
+ ),
2112
+ ...superseded.map(
2113
+ (entry) => `${entry.conceptId}:superseded:${digest(JSON.stringify(entry))}`
2114
+ )
2115
+ ].sort();
2116
+ return digest(entries.join("\n"));
2117
+ }
2099
2118
 
2100
2119
  // src/record-types.ts
2101
2120
  var RECORD_TYPES = {
@@ -3688,7 +3707,7 @@ var loadCommand = define({
3688
3707
  name: "load",
3689
3708
  tool: "kb_load",
3690
3709
  usage: "load [type] [--budget N | --all] [--repo-root PATH]",
3691
- 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.",
3710
+ 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.",
3692
3711
  input: import_zod14.z.object({
3693
3712
  bundlePath,
3694
3713
  type: import_zod14.z.enum(KB_RECORD_TYPES).optional(),
@@ -3931,7 +3950,7 @@ var queryCommand = define({
3931
3950
  name: "query",
3932
3951
  tool: "kb_query",
3933
3952
  usage: "query <text...> [--repo-root PATH]",
3934
- 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.",
3953
+ 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.",
3935
3954
  input: import_zod20.z.object({
3936
3955
  bundlePath,
3937
3956
  text: import_zod20.z.string().optional(),
@@ -4279,7 +4298,7 @@ var import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
4279
4298
  var import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
4280
4299
 
4281
4300
  // src/version.ts
4282
- var VERSION = true ? "0.1.11" : "0.0.0-dev";
4301
+ var VERSION = true ? "0.1.12" : "0.0.0-dev";
4283
4302
 
4284
4303
  // src/mcp.ts
4285
4304
  function createKbMcpServer() {