@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
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
KB_COMMANDS_BY_NAME,
|
|
4
4
|
KB_DIR,
|
|
5
5
|
KbStore
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-FZIMFPGR.js";
|
|
7
7
|
|
|
8
8
|
// src/cli.ts
|
|
9
9
|
import { join } from "path";
|
|
@@ -91,4 +91,4 @@ function usage() {
|
|
|
91
91
|
export {
|
|
92
92
|
runKbCli
|
|
93
93
|
};
|
|
94
|
-
//# sourceMappingURL=chunk-
|
|
94
|
+
//# sourceMappingURL=chunk-KQMGKSPZ.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KB_COMMANDS,
|
|
3
3
|
KbStore
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-FZIMFPGR.js";
|
|
5
5
|
|
|
6
6
|
// src/mcp.ts
|
|
7
7
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
@@ -45,4 +45,4 @@ export {
|
|
|
45
45
|
createKbMcpServer,
|
|
46
46
|
runKbMcpServer
|
|
47
47
|
};
|
|
48
|
-
//# sourceMappingURL=chunk-
|
|
48
|
+
//# sourceMappingURL=chunk-VOJ6D6OX.js.map
|
package/dist/cli-main.cjs
CHANGED
|
@@ -1073,25 +1073,32 @@ var import_zod9 = require("zod");
|
|
|
1073
1073
|
var loadCommand = define({
|
|
1074
1074
|
name: "load",
|
|
1075
1075
|
tool: "kb_load",
|
|
1076
|
-
usage: "load [type] [--budget N]",
|
|
1077
|
-
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.",
|
|
1076
|
+
usage: "load [type] [--budget N | --all]",
|
|
1077
|
+
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.",
|
|
1078
1078
|
input: import_zod9.z.object({
|
|
1079
1079
|
bundlePath,
|
|
1080
1080
|
type: import_zod9.z.enum(KB_RECORD_TYPES).optional(),
|
|
1081
|
-
budgetTokens: import_zod9.z.number().int().positive().optional().describe("Approximate token ceiling. Defaults to 25000.")
|
|
1081
|
+
budgetTokens: import_zod9.z.number().int().positive().optional().describe("Approximate token ceiling. Defaults to 25000."),
|
|
1082
|
+
all: import_zod9.z.boolean().optional().describe(
|
|
1083
|
+
"Load the entire base regardless of size. The deliberate-operator escape hatch; mutually exclusive with budgetTokens."
|
|
1084
|
+
)
|
|
1085
|
+
}).refine((value) => !(value.all && value.budgetTokens !== void 0), {
|
|
1086
|
+
message: "all and budgetTokens are mutually exclusive: pass a ceiling or none, not both."
|
|
1082
1087
|
}),
|
|
1083
1088
|
fromArgv: (argv, path) => {
|
|
1084
1089
|
const budget = argvFlag(argv, "--budget");
|
|
1085
1090
|
return {
|
|
1086
1091
|
bundlePath: path,
|
|
1087
|
-
...argv[1] && argv[1]
|
|
1088
|
-
...budget ? { budgetTokens: Number(budget) } : {}
|
|
1092
|
+
...argv[1] && !argv[1].startsWith("--") ? { type: argv[1] } : {},
|
|
1093
|
+
...budget ? { budgetTokens: Number(budget) } : {},
|
|
1094
|
+
...argv.includes("--all") ? { all: true } : {}
|
|
1089
1095
|
};
|
|
1090
1096
|
},
|
|
1091
|
-
run: async ({ store }, { bundlePath: path, type, budgetTokens }) => {
|
|
1097
|
+
run: async ({ store }, { bundlePath: path, type, budgetTokens, all }) => {
|
|
1092
1098
|
const result = await store.load(path, {
|
|
1093
1099
|
...type ? { type } : {},
|
|
1094
|
-
...budgetTokens ? { budgetTokens } : {}
|
|
1100
|
+
...budgetTokens ? { budgetTokens } : {},
|
|
1101
|
+
...all ? { all } : {}
|
|
1095
1102
|
});
|
|
1096
1103
|
if (!result.loaded) return result;
|
|
1097
1104
|
return {
|
|
@@ -2087,6 +2094,10 @@ ${answer}
|
|
|
2087
2094
|
* Refuses rather than truncates when the base is too large. A truncated base
|
|
2088
2095
|
* is indistinguishable from a complete one, so a caller would answer "that
|
|
2089
2096
|
* was never decided" from a slice it did not know was a slice.
|
|
2097
|
+
*
|
|
2098
|
+
* That refusal is the default guardrail. `all` bypasses it outright and
|
|
2099
|
+
* always hands back the whole bundle: an explicit, never-accidental escape
|
|
2100
|
+
* hatch for an operator who has the budget to spend, not a wider default.
|
|
2090
2101
|
*/
|
|
2091
2102
|
async load(bundlePath2, options = {}) {
|
|
2092
2103
|
const budgetTokens = options.budgetTokens ?? DEFAULT_LOAD_BUDGET;
|
|
@@ -2096,7 +2107,7 @@ ${answer}
|
|
|
2096
2107
|
const records = adjudicated.filter((hit) => hit.standing !== "superseded");
|
|
2097
2108
|
const superseded = adjudicated.filter((hit) => hit.standing === "superseded").map(stub);
|
|
2098
2109
|
const approxTokens2 = records.reduce((total, hit) => total + estimateTokens(hit.record), 0) + superseded.reduce((total, entry) => total + estimateStubTokens(entry), 0);
|
|
2099
|
-
if (approxTokens2 > budgetTokens) {
|
|
2110
|
+
if (!options.all && approxTokens2 > budgetTokens) {
|
|
2100
2111
|
return {
|
|
2101
2112
|
loaded: false,
|
|
2102
2113
|
recordCount: wanted.length,
|
|
@@ -2107,8 +2118,8 @@ ${answer}
|
|
|
2107
2118
|
return {
|
|
2108
2119
|
loaded: true,
|
|
2109
2120
|
recordCount: wanted.length,
|
|
2110
|
-
|
|
2111
|
-
budgetTokens,
|
|
2121
|
+
tokensLoaded: approxTokens2,
|
|
2122
|
+
budgetTokens: options.all ? null : budgetTokens,
|
|
2112
2123
|
records,
|
|
2113
2124
|
superseded
|
|
2114
2125
|
};
|