@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/README.md +12 -1
- package/dist/{chunk-EDH43Z7J.js → chunk-FZIMFPGR.js} +22 -11
- package/dist/chunk-FZIMFPGR.js.map +1 -0
- package/dist/{chunk-Y5C7Z2HG.js → chunk-KQMGKSPZ.js} +2 -2
- package/dist/{chunk-TS26G7TL.js → chunk-VOJ6D6OX.js} +2 -2
- package/dist/cli-main.cjs +21 -10
- package/dist/cli-main.cjs.map +1 -1
- package/dist/cli-main.js +2 -2
- package/dist/index.cjs +21 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +3 -3
- package/dist/mcp-main.cjs +21 -10
- package/dist/mcp-main.cjs.map +1 -1
- package/dist/mcp-main.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-EDH43Z7J.js.map +0 -1
- /package/dist/{chunk-Y5C7Z2HG.js.map → chunk-KQMGKSPZ.js.map} +0 -0
- /package/dist/{chunk-TS26G7TL.js.map → chunk-VOJ6D6OX.js.map} +0 -0
package/dist/cli-main.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -852,6 +852,10 @@ ${answer}
|
|
|
852
852
|
* Refuses rather than truncates when the base is too large. A truncated base
|
|
853
853
|
* is indistinguishable from a complete one, so a caller would answer "that
|
|
854
854
|
* was never decided" from a slice it did not know was a slice.
|
|
855
|
+
*
|
|
856
|
+
* That refusal is the default guardrail. `all` bypasses it outright and
|
|
857
|
+
* always hands back the whole bundle: an explicit, never-accidental escape
|
|
858
|
+
* hatch for an operator who has the budget to spend, not a wider default.
|
|
855
859
|
*/
|
|
856
860
|
async load(bundlePath2, options = {}) {
|
|
857
861
|
const budgetTokens = options.budgetTokens ?? DEFAULT_LOAD_BUDGET;
|
|
@@ -861,7 +865,7 @@ ${answer}
|
|
|
861
865
|
const records = adjudicated.filter((hit) => hit.standing !== "superseded");
|
|
862
866
|
const superseded = adjudicated.filter((hit) => hit.standing === "superseded").map(stub);
|
|
863
867
|
const approxTokens2 = records.reduce((total, hit) => total + estimateTokens(hit.record), 0) + superseded.reduce((total, entry) => total + estimateStubTokens(entry), 0);
|
|
864
|
-
if (approxTokens2 > budgetTokens) {
|
|
868
|
+
if (!options.all && approxTokens2 > budgetTokens) {
|
|
865
869
|
return {
|
|
866
870
|
loaded: false,
|
|
867
871
|
recordCount: wanted.length,
|
|
@@ -872,8 +876,8 @@ ${answer}
|
|
|
872
876
|
return {
|
|
873
877
|
loaded: true,
|
|
874
878
|
recordCount: wanted.length,
|
|
875
|
-
|
|
876
|
-
budgetTokens,
|
|
879
|
+
tokensLoaded: approxTokens2,
|
|
880
|
+
budgetTokens: options.all ? null : budgetTokens,
|
|
877
881
|
records,
|
|
878
882
|
superseded
|
|
879
883
|
};
|
|
@@ -2058,25 +2062,32 @@ var import_zod11 = require("zod");
|
|
|
2058
2062
|
var loadCommand = define({
|
|
2059
2063
|
name: "load",
|
|
2060
2064
|
tool: "kb_load",
|
|
2061
|
-
usage: "load [type] [--budget N]",
|
|
2062
|
-
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.",
|
|
2065
|
+
usage: "load [type] [--budget N | --all]",
|
|
2066
|
+
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.",
|
|
2063
2067
|
input: import_zod11.z.object({
|
|
2064
2068
|
bundlePath,
|
|
2065
2069
|
type: import_zod11.z.enum(KB_RECORD_TYPES).optional(),
|
|
2066
|
-
budgetTokens: import_zod11.z.number().int().positive().optional().describe("Approximate token ceiling. Defaults to 25000.")
|
|
2070
|
+
budgetTokens: import_zod11.z.number().int().positive().optional().describe("Approximate token ceiling. Defaults to 25000."),
|
|
2071
|
+
all: import_zod11.z.boolean().optional().describe(
|
|
2072
|
+
"Load the entire base regardless of size. The deliberate-operator escape hatch; mutually exclusive with budgetTokens."
|
|
2073
|
+
)
|
|
2074
|
+
}).refine((value) => !(value.all && value.budgetTokens !== void 0), {
|
|
2075
|
+
message: "all and budgetTokens are mutually exclusive: pass a ceiling or none, not both."
|
|
2067
2076
|
}),
|
|
2068
2077
|
fromArgv: (argv, path) => {
|
|
2069
2078
|
const budget = argvFlag(argv, "--budget");
|
|
2070
2079
|
return {
|
|
2071
2080
|
bundlePath: path,
|
|
2072
|
-
...argv[1] && argv[1]
|
|
2073
|
-
...budget ? { budgetTokens: Number(budget) } : {}
|
|
2081
|
+
...argv[1] && !argv[1].startsWith("--") ? { type: argv[1] } : {},
|
|
2082
|
+
...budget ? { budgetTokens: Number(budget) } : {},
|
|
2083
|
+
...argv.includes("--all") ? { all: true } : {}
|
|
2074
2084
|
};
|
|
2075
2085
|
},
|
|
2076
|
-
run: async ({ store }, { bundlePath: path, type, budgetTokens }) => {
|
|
2086
|
+
run: async ({ store }, { bundlePath: path, type, budgetTokens, all }) => {
|
|
2077
2087
|
const result = await store.load(path, {
|
|
2078
2088
|
...type ? { type } : {},
|
|
2079
|
-
...budgetTokens ? { budgetTokens } : {}
|
|
2089
|
+
...budgetTokens ? { budgetTokens } : {},
|
|
2090
|
+
...all ? { all } : {}
|
|
2080
2091
|
});
|
|
2081
2092
|
if (!result.loaded) return result;
|
|
2082
2093
|
return {
|