@saasontools/strauss-kb 0.1.4 → 0.1.6
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 +42 -3
- package/dist/{chunk-TS26G7TL.js → chunk-BVF7X5VO.js} +2 -2
- package/dist/{chunk-EDH43Z7J.js → chunk-PNSRTKYN.js} +123 -16
- package/dist/chunk-PNSRTKYN.js.map +1 -0
- package/dist/{chunk-Y5C7Z2HG.js → chunk-V7TRZ2ER.js} +2 -2
- package/dist/cli-main.cjs +119 -15
- package/dist/cli-main.cjs.map +1 -1
- package/dist/cli-main.js +2 -2
- package/dist/index.cjs +124 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -3
- package/dist/index.d.ts +41 -3
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/mcp-main.cjs +119 -15
- 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-TS26G7TL.js.map → chunk-BVF7X5VO.js.map} +0 -0
- /package/dist/{chunk-Y5C7Z2HG.js.map → chunk-V7TRZ2ER.js.map} +0 -0
package/README.md
CHANGED
|
@@ -88,6 +88,24 @@ concepts. `type` is the only key OKF requires; `title`, `description`,
|
|
|
88
88
|
OKF's. Unknown keys are preserved rather than stripped, as OKF requires of
|
|
89
89
|
consumers.
|
|
90
90
|
|
|
91
|
+
`verified` is the record's append-only trail of checks. Each entry is OKF's
|
|
92
|
+
actor stamp — `{ by, at }` — and the entries this package's `verify` writes add
|
|
93
|
+
a `note`: what the check actually found, not just that one happened. The `note`
|
|
94
|
+
is a strauss extension key on the entries this tool writes, not an OKF
|
|
95
|
+
requirement on the array, so noteless entries a foreign producer wrote remain
|
|
96
|
+
readable, and prior entries are spread forward untouched rather than reshaped.
|
|
97
|
+
|
|
98
|
+
Who may append is the point. A verifier whose actor equals the record's
|
|
99
|
+
`generated.by` — compared case-insensitively over the whole actor, so case
|
|
100
|
+
drift cannot mint a distinct verifier identity — is refused unless the actor
|
|
101
|
+
is `human:`-prefixed: trust that can be self-granted is not trust, and a
|
|
102
|
+
generator re-reading its own output is not an independent check. The refusal
|
|
103
|
+
is recorded in the log as `verify:refused`, so an audit sees the attempt as
|
|
104
|
+
well as the rule. The `human:` prefix itself is an honor-system label — actor
|
|
105
|
+
identity is self-declared through `STRAUSS_KB_ACTOR`, not an authenticated
|
|
106
|
+
identity claim — which is worth knowing when deciding how much weight a
|
|
107
|
+
human-verified event carries.
|
|
108
|
+
|
|
91
109
|
Anything prefixed `strauss_` is this package's extension, namespaced so a later
|
|
92
110
|
OKF version defining the same name cannot collide:
|
|
93
111
|
|
|
@@ -196,7 +214,8 @@ strauss-kb [--bundle PATH] <command> [args]
|
|
|
196
214
|
status <concept-id> <status> Move a record's status, compare-and-swap.
|
|
197
215
|
supersede <concept-id> <replacement-id> Mark a record superseded, linking both directions.
|
|
198
216
|
answer <concept-id> <answer...> Resolve an open question and append the answer.
|
|
199
|
-
|
|
217
|
+
verify <concept-id> --note <text> Append a verified[] event — who checked, when, and what the check found.
|
|
218
|
+
load [type] [--budget N | --all] Hand over the whole base, each record with its standing.
|
|
200
219
|
query <text...> Search; every match arrives flagged with its standing.
|
|
201
220
|
trace <concept-id> [edges...] How a position was arrived at, as a timeline.
|
|
202
221
|
list [type] Every record, optionally narrowed to one type.
|
|
@@ -239,8 +258,8 @@ strauss-kb validate || echo "problems above"
|
|
|
239
258
|
|
|
240
259
|
`strauss-kb-mcp` speaks stdio and takes no API key and no required environment.
|
|
241
260
|
Every CLI verb is a tool: `kb_write`, `kb_write_decision`, `kb_no_decision`,
|
|
242
|
-
`kb_status`, `kb_supersede`, `kb_answer`, `
|
|
243
|
-
`kb_list`, `kb_index`, `kb_log`, `kb_validate`, `kb_schema`, `kb_types`,
|
|
261
|
+
`kb_status`, `kb_supersede`, `kb_answer`, `kb_verify`, `kb_load`, `kb_query`,
|
|
262
|
+
`kb_trace`, `kb_list`, `kb_index`, `kb_log`, `kb_validate`, `kb_schema`, `kb_types`,
|
|
244
263
|
`kb_pin`, `kb_unpin`, `kb_pins`, `kb_context`. Most tools take a `bundlePath`;
|
|
245
264
|
`kb_schema` and `kb_types` describe the format rather than any one base, and
|
|
246
265
|
`kb_pins` and `kb_context` read the workspace pin manifests instead. The one
|
|
@@ -299,6 +318,15 @@ problem:
|
|
|
299
318
|
| Standing | `strauss_status`, the supersession chain | is this still what we hold? |
|
|
300
319
|
| Freshness | `stale_after`, `verified[]` | has anyone confirmed it lately? |
|
|
301
320
|
|
|
321
|
+
Freshness is tiered by who did the confirming. OKF's spec (§5.3) defines the
|
|
322
|
+
trust tiers from the verifying actor's prefix: an empty `verified[]` is
|
|
323
|
+
unverified, an agent-prefixed verifier makes the record machine-confirmed, and
|
|
324
|
+
a `human:`-prefixed verifier makes it human-reviewed. Of that ladder, today's
|
|
325
|
+
adjudication reports only the first rung — the warning it attaches when
|
|
326
|
+
`verified[]` is empty; reporting the full tier is upcoming tooling. When it
|
|
327
|
+
lands, the tier will be derived from the events at read time, never stored, so
|
|
328
|
+
it cannot drift from the trail that justifies it.
|
|
329
|
+
|
|
302
330
|
**Load before you search.** These bases run to a few thousand tokens — twenty
|
|
303
331
|
records measured at about 3,000 — so the first thing to try is taking all of it.
|
|
304
332
|
On nine questions whose wording appears in no record, a reader holding the whole
|
|
@@ -323,6 +351,17 @@ by default). Superseded records come back as name, replacement and date only —
|
|
|
323
351
|
their bodies no longer hold, and a body read later in a long session outlives
|
|
324
352
|
the qualifier that said so. `trace` still reaches them by id.
|
|
325
353
|
|
|
354
|
+
`--all` (`all: true` over MCP) is the escape hatch: it bypasses the refusal
|
|
355
|
+
outright and hands back the entire bundle whatever its size. A loaded result
|
|
356
|
+
carries `tokensLoaded`, the same estimate the budget is held against, and
|
|
357
|
+
`budgetTokens: null` marks that no ceiling was applied; `--all` is mutually
|
|
358
|
+
exclusive with `--budget`. That refusal is the guardrail an agent needs so a
|
|
359
|
+
wide base does not silently consume its whole context; `--all` is for a
|
|
360
|
+
deliberate operator who has decided the size is worth the tokens, not a
|
|
361
|
+
setting to reach for by default. A reader that does not actually need every
|
|
362
|
+
record is better served by a narrower `type` filter or a `query` than by
|
|
363
|
+
turning the guardrail off.
|
|
364
|
+
|
|
326
365
|
**Flag, never filter.** `query` returns every hit with its standing, because a
|
|
327
366
|
filtered result set is invisible — the caller cannot tell it missed anything.
|
|
328
367
|
The single exception is narrow: a superseded record is dropped only when its
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
KB_COMMANDS,
|
|
3
3
|
KbStore
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PNSRTKYN.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-BVF7X5VO.js.map
|
|
@@ -11,6 +11,11 @@ var kbActorStampSchema = z.object({
|
|
|
11
11
|
by: z.string().min(1),
|
|
12
12
|
at: z.string().min(1)
|
|
13
13
|
}).passthrough();
|
|
14
|
+
var kbVerifiedEventSchema = kbActorStampSchema.extend({
|
|
15
|
+
note: z.string().refine((s) => s.trim().length > 0, {
|
|
16
|
+
message: "note must say what the check found"
|
|
17
|
+
})
|
|
18
|
+
});
|
|
14
19
|
var kbAnchorSchema = z.object({
|
|
15
20
|
file: z.string().min(1),
|
|
16
21
|
symbol: z.string().min(1).optional()
|
|
@@ -1198,25 +1203,32 @@ import { z as z11 } from "zod";
|
|
|
1198
1203
|
var loadCommand = define({
|
|
1199
1204
|
name: "load",
|
|
1200
1205
|
tool: "kb_load",
|
|
1201
|
-
usage: "load [type] [--budget N]",
|
|
1202
|
-
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.",
|
|
1206
|
+
usage: "load [type] [--budget N | --all]",
|
|
1207
|
+
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.",
|
|
1203
1208
|
input: z11.object({
|
|
1204
1209
|
bundlePath,
|
|
1205
1210
|
type: z11.enum(KB_RECORD_TYPES).optional(),
|
|
1206
|
-
budgetTokens: z11.number().int().positive().optional().describe("Approximate token ceiling. Defaults to 25000.")
|
|
1211
|
+
budgetTokens: z11.number().int().positive().optional().describe("Approximate token ceiling. Defaults to 25000."),
|
|
1212
|
+
all: z11.boolean().optional().describe(
|
|
1213
|
+
"Load the entire base regardless of size. The deliberate-operator escape hatch; mutually exclusive with budgetTokens."
|
|
1214
|
+
)
|
|
1215
|
+
}).refine((value) => !(value.all && value.budgetTokens !== void 0), {
|
|
1216
|
+
message: "all and budgetTokens are mutually exclusive: pass a ceiling or none, not both."
|
|
1207
1217
|
}),
|
|
1208
1218
|
fromArgv: (argv, path) => {
|
|
1209
1219
|
const budget = argvFlag(argv, "--budget");
|
|
1210
1220
|
return {
|
|
1211
1221
|
bundlePath: path,
|
|
1212
|
-
...argv[1] && argv[1]
|
|
1213
|
-
...budget ? { budgetTokens: Number(budget) } : {}
|
|
1222
|
+
...argv[1] && !argv[1].startsWith("--") ? { type: argv[1] } : {},
|
|
1223
|
+
...budget ? { budgetTokens: Number(budget) } : {},
|
|
1224
|
+
...argv.includes("--all") ? { all: true } : {}
|
|
1214
1225
|
};
|
|
1215
1226
|
},
|
|
1216
|
-
run: async ({ store }, { bundlePath: path, type, budgetTokens }) => {
|
|
1227
|
+
run: async ({ store }, { bundlePath: path, type, budgetTokens, all }) => {
|
|
1217
1228
|
const result = await store.load(path, {
|
|
1218
1229
|
...type ? { type } : {},
|
|
1219
|
-
...budgetTokens ? { budgetTokens } : {}
|
|
1230
|
+
...budgetTokens ? { budgetTokens } : {},
|
|
1231
|
+
...all ? { all } : {}
|
|
1220
1232
|
});
|
|
1221
1233
|
if (!result.loaded) return result;
|
|
1222
1234
|
return {
|
|
@@ -1529,8 +1541,37 @@ var validateCommand = define({
|
|
|
1529
1541
|
failsWhen: (result) => Array.isArray(result) && result.length > 0
|
|
1530
1542
|
});
|
|
1531
1543
|
|
|
1532
|
-
// src/commands/
|
|
1544
|
+
// src/commands/verify.ts
|
|
1533
1545
|
import { z as z26 } from "zod";
|
|
1546
|
+
var verifyCommand = define({
|
|
1547
|
+
name: "verify",
|
|
1548
|
+
tool: "kb_verify",
|
|
1549
|
+
usage: "verify <concept-id> --note <text>",
|
|
1550
|
+
description: "Append one verified[] event \u2014 who checked the record, when, and what the check found. Appends only; prior events are never rewritten. A record's own generator is refused unless the actor is human: re-reading your own output is not an independent check.",
|
|
1551
|
+
input: z26.object({
|
|
1552
|
+
bundlePath,
|
|
1553
|
+
conceptId,
|
|
1554
|
+
note: z26.string().refine((s) => s.trim().length > 0, {
|
|
1555
|
+
message: "note must say what the check found"
|
|
1556
|
+
})
|
|
1557
|
+
}),
|
|
1558
|
+
fromArgv: (argv, path) => ({
|
|
1559
|
+
bundlePath: path,
|
|
1560
|
+
conceptId: argv[1],
|
|
1561
|
+
note: argvFlag(argv, "--note")
|
|
1562
|
+
}),
|
|
1563
|
+
run: async ({ store, actor, now }, { bundlePath: path, conceptId: id, note }) => {
|
|
1564
|
+
await assertBaseNotFrozen(process.cwd(), path);
|
|
1565
|
+
const record = await store.verify(path, id, note, actor, now());
|
|
1566
|
+
return {
|
|
1567
|
+
conceptId: record.conceptId,
|
|
1568
|
+
verified: record.frontmatter.verified?.length ?? 0
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
});
|
|
1572
|
+
|
|
1573
|
+
// src/commands/write.ts
|
|
1574
|
+
import { z as z27 } from "zod";
|
|
1534
1575
|
var writeCommand = define({
|
|
1535
1576
|
name: "write",
|
|
1536
1577
|
tool: "kb_write",
|
|
@@ -1544,9 +1585,9 @@ var writeCommand = define({
|
|
|
1544
1585
|
"- Prefer a new record over overloading an existing one, and keep each short. A record nobody finishes reading is not durable memory.",
|
|
1545
1586
|
"- Records are never deleted; supersede instead, so the earlier reasoning stays inspectable."
|
|
1546
1587
|
].join("\n"),
|
|
1547
|
-
input:
|
|
1588
|
+
input: z27.object({
|
|
1548
1589
|
bundlePath,
|
|
1549
|
-
type:
|
|
1590
|
+
type: z27.enum(KB_RECORD_TYPES),
|
|
1550
1591
|
input: composeInputSchema
|
|
1551
1592
|
}),
|
|
1552
1593
|
fromArgv: async (argv, path, stdin) => ({
|
|
@@ -1570,7 +1611,7 @@ var writeCommand = define({
|
|
|
1570
1611
|
});
|
|
1571
1612
|
|
|
1572
1613
|
// src/commands/write-decision.ts
|
|
1573
|
-
import { z as
|
|
1614
|
+
import { z as z28 } from "zod";
|
|
1574
1615
|
var writeDecisionCommand = define({
|
|
1575
1616
|
name: "write-decision",
|
|
1576
1617
|
tool: "kb_write_decision",
|
|
@@ -1583,7 +1624,7 @@ var writeDecisionCommand = define({
|
|
|
1583
1624
|
"- `alternative` is what you turned down and why, not a list of everything considered.",
|
|
1584
1625
|
"- A reference to material you read goes in `sources`; a reference to code goes in `anchors`; a reference to another record goes in `relatedConceptIds`."
|
|
1585
1626
|
].join("\n"),
|
|
1586
|
-
input:
|
|
1627
|
+
input: z28.object({ bundlePath, input: decisionInputSchema }),
|
|
1587
1628
|
fromArgv: async (_argv, path, stdin) => ({
|
|
1588
1629
|
bundlePath: path,
|
|
1589
1630
|
input: JSON.parse(await stdin())
|
|
@@ -1611,6 +1652,7 @@ var KB_COMMANDS = [
|
|
|
1611
1652
|
statusCommand,
|
|
1612
1653
|
supersedeCommand,
|
|
1613
1654
|
answerCommand,
|
|
1655
|
+
verifyCommand,
|
|
1614
1656
|
loadCommand,
|
|
1615
1657
|
queryCommand,
|
|
1616
1658
|
traceCommand,
|
|
@@ -1666,6 +1708,7 @@ var ErrorTypes = /* @__PURE__ */ ((ErrorTypes2) => {
|
|
|
1666
1708
|
ErrorTypes2["KbRecordAlreadyExists"] = "KbRecordAlreadyExists";
|
|
1667
1709
|
ErrorTypes2["KbInvalidConceptId"] = "KbInvalidConceptId";
|
|
1668
1710
|
ErrorTypes2["KbRecordNotFound"] = "KbRecordNotFound";
|
|
1711
|
+
ErrorTypes2["KbSelfVerification"] = "KbSelfVerification";
|
|
1669
1712
|
ErrorTypes2["KbWriteConflict"] = "KbWriteConflict";
|
|
1670
1713
|
return ErrorTypes2;
|
|
1671
1714
|
})(ErrorTypes || {});
|
|
@@ -1734,6 +1777,25 @@ var KbWriteConflictError = class extends BaseError {
|
|
|
1734
1777
|
}
|
|
1735
1778
|
conceptId;
|
|
1736
1779
|
};
|
|
1780
|
+
var KbSelfVerificationError = class extends BaseError {
|
|
1781
|
+
constructor(conceptId2, actor, generatedBy) {
|
|
1782
|
+
super({
|
|
1783
|
+
message: `kb: ${conceptId2} was generated by ${generatedBy}, and a record's generator cannot verify it \u2014 only a human or a different actor can`,
|
|
1784
|
+
errorType: "KbSelfVerification" /* KbSelfVerification */,
|
|
1785
|
+
code: 400,
|
|
1786
|
+
fault: "User" /* User */,
|
|
1787
|
+
retriable: false,
|
|
1788
|
+
reportToUser: true,
|
|
1789
|
+
details: { conceptId: conceptId2, actor, generatedBy, action: "refused" }
|
|
1790
|
+
});
|
|
1791
|
+
this.conceptId = conceptId2;
|
|
1792
|
+
this.actor = actor;
|
|
1793
|
+
this.generatedBy = generatedBy;
|
|
1794
|
+
}
|
|
1795
|
+
conceptId;
|
|
1796
|
+
actor;
|
|
1797
|
+
generatedBy;
|
|
1798
|
+
};
|
|
1737
1799
|
var KbInvalidConceptIdError = class extends BaseError {
|
|
1738
1800
|
constructor(message, details) {
|
|
1739
1801
|
super({
|
|
@@ -1964,6 +2026,40 @@ var KbStore = class {
|
|
|
1964
2026
|
{ operation: `status:${status}`, by: actor }
|
|
1965
2027
|
);
|
|
1966
2028
|
}
|
|
2029
|
+
/**
|
|
2030
|
+
* Appends one `verified[]` event: who checked the record, when, and what the
|
|
2031
|
+
* check found. Append-only — prior events are history, and are spread into
|
|
2032
|
+
* the new array untouched rather than reshaped through the write schema.
|
|
2033
|
+
*
|
|
2034
|
+
* A record's generator cannot verify its own record unless the actor is
|
|
2035
|
+
* human: the generator re-reading its own output is not an independent
|
|
2036
|
+
* check. The rule runs before the mutation so a refusal never publishes,
|
|
2037
|
+
* and the refusal is logged under its own operation name — `mutate` only
|
|
2038
|
+
* logs what it publishes.
|
|
2039
|
+
*/
|
|
2040
|
+
async verify(bundlePath2, conceptId2, note, actor = "unknown", at = (/* @__PURE__ */ new Date()).toISOString()) {
|
|
2041
|
+
const event = kbVerifiedEventSchema.parse({ by: actor, at, note });
|
|
2042
|
+
const existing = await this.read(bundlePath2, conceptId2);
|
|
2043
|
+
if (!existing) throw new KbRecordNotFoundError(conceptId2);
|
|
2044
|
+
const generatedBy = existing.frontmatter.generated?.by;
|
|
2045
|
+
if (generatedBy !== void 0 && actor.toLowerCase() === generatedBy.toLowerCase() && !normalizeActor(actor).startsWith("human:")) {
|
|
2046
|
+
await this.record(this.root(bundlePath2), {
|
|
2047
|
+
operation: "verify:refused",
|
|
2048
|
+
conceptId: conceptId2,
|
|
2049
|
+
by: actor
|
|
2050
|
+
});
|
|
2051
|
+
throw new KbSelfVerificationError(conceptId2, actor, generatedBy);
|
|
2052
|
+
}
|
|
2053
|
+
return this.mutate(
|
|
2054
|
+
bundlePath2,
|
|
2055
|
+
conceptId2,
|
|
2056
|
+
(frontmatter) => ({
|
|
2057
|
+
...frontmatter,
|
|
2058
|
+
verified: [...frontmatter.verified ?? [], event]
|
|
2059
|
+
}),
|
|
2060
|
+
{ operation: "verify", by: actor }
|
|
2061
|
+
);
|
|
2062
|
+
}
|
|
1967
2063
|
/**
|
|
1968
2064
|
* Marks `conceptId` superseded by `replacementId`, and links both directions.
|
|
1969
2065
|
*
|
|
@@ -2067,6 +2163,10 @@ ${answer}
|
|
|
2067
2163
|
* Refuses rather than truncates when the base is too large. A truncated base
|
|
2068
2164
|
* is indistinguishable from a complete one, so a caller would answer "that
|
|
2069
2165
|
* was never decided" from a slice it did not know was a slice.
|
|
2166
|
+
*
|
|
2167
|
+
* That refusal is the default guardrail. `all` bypasses it outright and
|
|
2168
|
+
* always hands back the whole bundle: an explicit, never-accidental escape
|
|
2169
|
+
* hatch for an operator who has the budget to spend, not a wider default.
|
|
2070
2170
|
*/
|
|
2071
2171
|
async load(bundlePath2, options = {}) {
|
|
2072
2172
|
const budgetTokens = options.budgetTokens ?? DEFAULT_LOAD_BUDGET;
|
|
@@ -2076,7 +2176,7 @@ ${answer}
|
|
|
2076
2176
|
const records = adjudicated.filter((hit) => hit.standing !== "superseded");
|
|
2077
2177
|
const superseded = adjudicated.filter((hit) => hit.standing === "superseded").map(stub);
|
|
2078
2178
|
const approxTokens2 = records.reduce((total, hit) => total + estimateTokens(hit.record), 0) + superseded.reduce((total, entry) => total + estimateStubTokens(entry), 0);
|
|
2079
|
-
if (approxTokens2 > budgetTokens) {
|
|
2179
|
+
if (!options.all && approxTokens2 > budgetTokens) {
|
|
2080
2180
|
return {
|
|
2081
2181
|
loaded: false,
|
|
2082
2182
|
recordCount: wanted.length,
|
|
@@ -2087,8 +2187,8 @@ ${answer}
|
|
|
2087
2187
|
return {
|
|
2088
2188
|
loaded: true,
|
|
2089
2189
|
recordCount: wanted.length,
|
|
2090
|
-
|
|
2091
|
-
budgetTokens,
|
|
2190
|
+
tokensLoaded: approxTokens2,
|
|
2191
|
+
budgetTokens: options.all ? null : budgetTokens,
|
|
2092
2192
|
records,
|
|
2093
2193
|
superseded
|
|
2094
2194
|
};
|
|
@@ -2294,6 +2394,11 @@ function matches(record, needle) {
|
|
|
2294
2394
|
(field) => field?.toLowerCase().includes(needle)
|
|
2295
2395
|
);
|
|
2296
2396
|
}
|
|
2397
|
+
function normalizeActor(id) {
|
|
2398
|
+
const colon = id.indexOf(":");
|
|
2399
|
+
if (colon === -1) return id.toLowerCase();
|
|
2400
|
+
return id.slice(0, colon + 1).toLowerCase() + id.slice(colon + 1);
|
|
2401
|
+
}
|
|
2297
2402
|
function digest(contents) {
|
|
2298
2403
|
return createHash("sha256").update(contents).digest("hex");
|
|
2299
2404
|
}
|
|
@@ -2301,6 +2406,7 @@ function digest(contents) {
|
|
|
2301
2406
|
export {
|
|
2302
2407
|
kbSourceSchema,
|
|
2303
2408
|
kbActorStampSchema,
|
|
2409
|
+
kbVerifiedEventSchema,
|
|
2304
2410
|
kbAnchorSchema,
|
|
2305
2411
|
KB_RECORD_TYPES,
|
|
2306
2412
|
KB_SLUG_PATTERN,
|
|
@@ -2366,6 +2472,7 @@ export {
|
|
|
2366
2472
|
KbRecordAlreadyExistsError,
|
|
2367
2473
|
KbRecordNotFoundError,
|
|
2368
2474
|
KbWriteConflictError,
|
|
2475
|
+
KbSelfVerificationError,
|
|
2369
2476
|
KbInvalidConceptIdError,
|
|
2370
2477
|
SEARCH_INDEX_FILE,
|
|
2371
2478
|
searchBase,
|
|
@@ -2374,4 +2481,4 @@ export {
|
|
|
2374
2481
|
KB_DIR,
|
|
2375
2482
|
KbStore
|
|
2376
2483
|
};
|
|
2377
|
-
//# sourceMappingURL=chunk-
|
|
2484
|
+
//# sourceMappingURL=chunk-PNSRTKYN.js.map
|