@saasontools/strauss-kb 0.1.4 → 0.1.5

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/index.d.cts CHANGED
@@ -318,8 +318,9 @@ type KbLoadResult = {
318
318
  /** Named only. Their bodies are reachable through `trace`. */
319
319
  superseded: KbSupersededStub[];
320
320
  recordCount: number;
321
- approxTokens: number;
322
- budgetTokens: number;
321
+ tokensLoaded: number;
322
+ /** `null` when loaded via `all`: no ceiling was applied. */
323
+ budgetTokens: number | null;
323
324
  } | {
324
325
  loaded: false;
325
326
  recordCount: number;
@@ -430,10 +431,15 @@ declare class KbStore {
430
431
  * Refuses rather than truncates when the base is too large. A truncated base
431
432
  * is indistinguishable from a complete one, so a caller would answer "that
432
433
  * was never decided" from a slice it did not know was a slice.
434
+ *
435
+ * That refusal is the default guardrail. `all` bypasses it outright and
436
+ * always hands back the whole bundle: an explicit, never-accidental escape
437
+ * hatch for an operator who has the budget to spend, not a wider default.
433
438
  */
434
439
  load(bundlePath: string, options?: {
435
440
  budgetTokens?: number;
436
441
  type?: string;
442
+ all?: boolean;
437
443
  }): Promise<KbLoadResult>;
438
444
  /** How a position was arrived at, as a timeline. See `trace.ts`. */
439
445
  trace(bundlePath: string, seedId: string, options?: KbTraceOptions): Promise<KbTraceStep[]>;
package/dist/index.d.ts CHANGED
@@ -318,8 +318,9 @@ type KbLoadResult = {
318
318
  /** Named only. Their bodies are reachable through `trace`. */
319
319
  superseded: KbSupersededStub[];
320
320
  recordCount: number;
321
- approxTokens: number;
322
- budgetTokens: number;
321
+ tokensLoaded: number;
322
+ /** `null` when loaded via `all`: no ceiling was applied. */
323
+ budgetTokens: number | null;
323
324
  } | {
324
325
  loaded: false;
325
326
  recordCount: number;
@@ -430,10 +431,15 @@ declare class KbStore {
430
431
  * Refuses rather than truncates when the base is too large. A truncated base
431
432
  * is indistinguishable from a complete one, so a caller would answer "that
432
433
  * was never decided" from a slice it did not know was a slice.
434
+ *
435
+ * That refusal is the default guardrail. `all` bypasses it outright and
436
+ * always hands back the whole bundle: an explicit, never-accidental escape
437
+ * hatch for an operator who has the budget to spend, not a wider default.
433
438
  */
434
439
  load(bundlePath: string, options?: {
435
440
  budgetTokens?: number;
436
441
  type?: string;
442
+ all?: boolean;
437
443
  }): Promise<KbLoadResult>;
438
444
  /** How a position was arrived at, as a timeline. See `trace.ts`. */
439
445
  trace(bundlePath: string, seedId: string, options?: KbTraceOptions): Promise<KbTraceStep[]>;
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  runKbCli
3
- } from "./chunk-Y5C7Z2HG.js";
3
+ } from "./chunk-KQMGKSPZ.js";
4
4
  import {
5
5
  createKbMcpServer,
6
6
  runKbMcpServer
7
- } from "./chunk-TS26G7TL.js";
7
+ } from "./chunk-VOJ6D6OX.js";
8
8
  import {
9
9
  BaseError,
10
10
  CONTEXT_BEGIN,
@@ -80,7 +80,7 @@ import {
80
80
  trace,
81
81
  unpinBase,
82
82
  validateBundle
83
- } from "./chunk-EDH43Z7J.js";
83
+ } from "./chunk-FZIMFPGR.js";
84
84
 
85
85
  // src/match-diff.ts
86
86
  function matchToDiff(files, records, options = {}) {
package/dist/mcp-main.cjs CHANGED
@@ -1074,25 +1074,32 @@ var import_zod9 = require("zod");
1074
1074
  var loadCommand = define({
1075
1075
  name: "load",
1076
1076
  tool: "kb_load",
1077
- usage: "load [type] [--budget N]",
1078
- description: "Load the whole knowledge base at once, each record with its standing. Prefer this over searching: these bases run to a few thousand tokens, and a reader holding all of it has perfect recall and knows why it is asking, which no ranker does. Superseded records arrive under `superseded` as name, replacement and date only \u2014 their bodies no longer hold, and reading one later in a long session is the mistake this prevents; pass the id to kb_trace when you need the history. Rejected and unresolved records arrive whole: what was turned down, and what is still open, is the part a diff cannot show you. Refuses with a count rather than truncating when the base is too large \u2014 a truncated base is indistinguishable from a complete one, and would have you conclude something was never decided from a slice you did not know was a slice. Call at the point of use, not once per session: a base loaded early is summarised away by compaction, so if the visible context holds no records from this base and the question at hand is one it might govern, load before answering \u2014 never conclude nothing was decided from a context with no KB content in it. This tool (with kb_query and kb_trace) is the only supported way to read a base; a raw file read bypasses supersession resolution and returns replaced records as if current.",
1077
+ usage: "load [type] [--budget N | --all]",
1078
+ description: "Load the whole knowledge base at once, each record with its standing. Prefer this over searching: these bases run to a few thousand tokens, and a reader holding all of it has perfect recall and knows why it is asking, which no ranker does. Superseded records arrive under `superseded` as name, replacement and date only \u2014 their bodies no longer hold, and reading one later in a long session is the mistake this prevents; pass the id to kb_trace when you need the history. Rejected and unresolved records arrive whole: what was turned down, and what is still open, is the part a diff cannot show you. Refuses with a count rather than truncating when the base is too large \u2014 a truncated base is indistinguishable from a complete one, and would have you conclude something was never decided from a slice you did not know was a slice. Call at the point of use, not once per session: a base loaded early is summarised away by compaction, so if the visible context holds no records from this base and the question at hand is one it might govern, load before answering \u2014 never conclude nothing was decided from a context with no KB content in it. This tool (with kb_query and kb_trace) is the only supported way to read a base; a raw file read bypasses supersession resolution and returns replaced records as if current.\n\nThat refusal is the default guardrail, meant for an agent that would otherwise burn its whole context on one call. `all` bypasses it and loads everything regardless of size: a deliberate operator with the budget to spend, not something to reach for automatically. It is mutually exclusive with `budgetTokens`. When the reader does not need everything, kb_query or a narrower `type` filter is the better fit than either.",
1079
1079
  input: import_zod9.z.object({
1080
1080
  bundlePath,
1081
1081
  type: import_zod9.z.enum(KB_RECORD_TYPES).optional(),
1082
- budgetTokens: import_zod9.z.number().int().positive().optional().describe("Approximate token ceiling. Defaults to 25000.")
1082
+ budgetTokens: import_zod9.z.number().int().positive().optional().describe("Approximate token ceiling. Defaults to 25000."),
1083
+ all: import_zod9.z.boolean().optional().describe(
1084
+ "Load the entire base regardless of size. The deliberate-operator escape hatch; mutually exclusive with budgetTokens."
1085
+ )
1086
+ }).refine((value) => !(value.all && value.budgetTokens !== void 0), {
1087
+ message: "all and budgetTokens are mutually exclusive: pass a ceiling or none, not both."
1083
1088
  }),
1084
1089
  fromArgv: (argv, path) => {
1085
1090
  const budget = argvFlag(argv, "--budget");
1086
1091
  return {
1087
1092
  bundlePath: path,
1088
- ...argv[1] && argv[1] !== "--budget" ? { type: argv[1] } : {},
1089
- ...budget ? { budgetTokens: Number(budget) } : {}
1093
+ ...argv[1] && !argv[1].startsWith("--") ? { type: argv[1] } : {},
1094
+ ...budget ? { budgetTokens: Number(budget) } : {},
1095
+ ...argv.includes("--all") ? { all: true } : {}
1090
1096
  };
1091
1097
  },
1092
- run: async ({ store }, { bundlePath: path, type, budgetTokens }) => {
1098
+ run: async ({ store }, { bundlePath: path, type, budgetTokens, all }) => {
1093
1099
  const result = await store.load(path, {
1094
1100
  ...type ? { type } : {},
1095
- ...budgetTokens ? { budgetTokens } : {}
1101
+ ...budgetTokens ? { budgetTokens } : {},
1102
+ ...all ? { all } : {}
1096
1103
  });
1097
1104
  if (!result.loaded) return result;
1098
1105
  return {
@@ -2088,6 +2095,10 @@ ${answer}
2088
2095
  * Refuses rather than truncates when the base is too large. A truncated base
2089
2096
  * is indistinguishable from a complete one, so a caller would answer "that
2090
2097
  * was never decided" from a slice it did not know was a slice.
2098
+ *
2099
+ * That refusal is the default guardrail. `all` bypasses it outright and
2100
+ * always hands back the whole bundle: an explicit, never-accidental escape
2101
+ * hatch for an operator who has the budget to spend, not a wider default.
2091
2102
  */
2092
2103
  async load(bundlePath2, options = {}) {
2093
2104
  const budgetTokens = options.budgetTokens ?? DEFAULT_LOAD_BUDGET;
@@ -2097,7 +2108,7 @@ ${answer}
2097
2108
  const records = adjudicated.filter((hit) => hit.standing !== "superseded");
2098
2109
  const superseded = adjudicated.filter((hit) => hit.standing === "superseded").map(stub);
2099
2110
  const approxTokens2 = records.reduce((total, hit) => total + estimateTokens(hit.record), 0) + superseded.reduce((total, entry) => total + estimateStubTokens(entry), 0);
2100
- if (approxTokens2 > budgetTokens) {
2111
+ if (!options.all && approxTokens2 > budgetTokens) {
2101
2112
  return {
2102
2113
  loaded: false,
2103
2114
  recordCount: wanted.length,
@@ -2108,8 +2119,8 @@ ${answer}
2108
2119
  return {
2109
2120
  loaded: true,
2110
2121
  recordCount: wanted.length,
2111
- approxTokens: approxTokens2,
2112
- budgetTokens,
2122
+ tokensLoaded: approxTokens2,
2123
+ budgetTokens: options.all ? null : budgetTokens,
2113
2124
  records,
2114
2125
  superseded
2115
2126
  };