@saasontools/strauss-kb 0.1.21 → 0.1.23
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 +14 -4
- package/dist/{chunk-WVJULVGY.js → chunk-3EZ3PAPA.js} +2 -2
- package/dist/{chunk-VXWN62HT.js → chunk-5IPQVXCM.js} +2 -2
- package/dist/{chunk-XBZ7G5R5.js → chunk-XENLCPL5.js} +2509 -2169
- package/dist/chunk-XENLCPL5.js.map +1 -0
- package/dist/cli-main.cjs +1516 -1184
- package/dist/cli-main.cjs.map +1 -1
- package/dist/cli-main.js +2 -2
- package/dist/index.cjs +714 -367
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +328 -17
- package/dist/index.d.ts +328 -17
- package/dist/index.js +17 -3
- package/dist/mcp-main.cjs +1516 -1184
- package/dist/mcp-main.cjs.map +1 -1
- package/dist/mcp-main.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-XBZ7G5R5.js.map +0 -1
- /package/dist/{chunk-WVJULVGY.js.map → chunk-3EZ3PAPA.js.map} +0 -0
- /package/dist/{chunk-VXWN62HT.js.map → chunk-5IPQVXCM.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -91,9 +91,9 @@ declare const kbAnchorSchema: z.ZodObject<{
|
|
|
91
91
|
resolved_at: z.ZodOptional<z.ZodString>;
|
|
92
92
|
lines: z.ZodOptional<z.ZodNumber>;
|
|
93
93
|
resolver: z.ZodOptional<z.ZodEnum<{
|
|
94
|
-
span: "span";
|
|
95
94
|
"tree-sitter": "tree-sitter";
|
|
96
95
|
regex: "regex";
|
|
96
|
+
span: "span";
|
|
97
97
|
}>>;
|
|
98
98
|
}, z.core.$strict>;
|
|
99
99
|
/**
|
|
@@ -124,10 +124,30 @@ declare const kbAnchorWriteSchema: z.ZodObject<{
|
|
|
124
124
|
resolved_at: z.ZodOptional<z.ZodString>;
|
|
125
125
|
lines: z.ZodOptional<z.ZodNumber>;
|
|
126
126
|
resolver: z.ZodOptional<z.ZodEnum<{
|
|
127
|
-
span: "span";
|
|
128
127
|
"tree-sitter": "tree-sitter";
|
|
129
128
|
regex: "regex";
|
|
129
|
+
span: "span";
|
|
130
|
+
}>>;
|
|
131
|
+
}, z.core.$strict>;
|
|
132
|
+
/**
|
|
133
|
+
* An anchor's address, with none of the baseline a resolver stamps: a `hash`
|
|
134
|
+
* under a locator is an unknown key. Picked rather than respelled, so a new
|
|
135
|
+
* locator field on the anchor is one here too. See
|
|
136
|
+
* `contract.anchor-locator-is-the-address-half-of-an-anchor`.
|
|
137
|
+
*/
|
|
138
|
+
declare const kbAnchorLocatorSchema: z.ZodObject<{
|
|
139
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
140
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
141
|
+
start: z.ZodNumber;
|
|
142
|
+
end: z.ZodNumber;
|
|
143
|
+
}, z.core.$strict>>;
|
|
144
|
+
file: z.ZodString;
|
|
145
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
146
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
147
|
+
old: "old";
|
|
148
|
+
new: "new";
|
|
130
149
|
}>>;
|
|
150
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
131
151
|
}, z.core.$strict>;
|
|
132
152
|
/**
|
|
133
153
|
* One typed causal edge, as the frontmatter stores it.
|
|
@@ -211,9 +231,9 @@ declare const kbRecordFrontmatterSchema: z.ZodObject<{
|
|
|
211
231
|
resolved_at: z.ZodOptional<z.ZodString>;
|
|
212
232
|
lines: z.ZodOptional<z.ZodNumber>;
|
|
213
233
|
resolver: z.ZodOptional<z.ZodEnum<{
|
|
214
|
-
span: "span";
|
|
215
234
|
"tree-sitter": "tree-sitter";
|
|
216
235
|
regex: "regex";
|
|
236
|
+
span: "span";
|
|
217
237
|
}>>;
|
|
218
238
|
}, z.core.$strict>>>;
|
|
219
239
|
strauss_verify: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -222,11 +242,11 @@ declare const kbRecordFrontmatterSchema: z.ZodObject<{
|
|
|
222
242
|
rel: z.ZodString;
|
|
223
243
|
}, z.core.$loose>>>;
|
|
224
244
|
strauss_status: z.ZodDefault<z.ZodEnum<{
|
|
245
|
+
resolved: "resolved";
|
|
225
246
|
draft: "draft";
|
|
226
247
|
proposed: "proposed";
|
|
227
248
|
accepted: "accepted";
|
|
228
249
|
open: "open";
|
|
229
|
-
resolved: "resolved";
|
|
230
250
|
rejected: "rejected";
|
|
231
251
|
superseded: "superseded";
|
|
232
252
|
}>>;
|
|
@@ -254,6 +274,7 @@ type KbActorStamp = z.infer<typeof kbActorStampSchema>;
|
|
|
254
274
|
type KbVerifiedEvent = z.infer<typeof kbVerifiedEventSchema>;
|
|
255
275
|
type KbAnchorSpan = z.infer<typeof kbAnchorSpanSchema>;
|
|
256
276
|
type KbAnchor = z.infer<typeof kbAnchorSchema>;
|
|
277
|
+
type KbAnchorLocator = z.infer<typeof kbAnchorLocatorSchema>;
|
|
257
278
|
type KbLink = z.infer<typeof kbLinkSchema>;
|
|
258
279
|
type KbRecordFrontmatter = z.infer<typeof kbRecordFrontmatterSchema>;
|
|
259
280
|
type KbRecord = {
|
|
@@ -1032,14 +1053,187 @@ declare function impact(targetId: string, bundle: KbRecord[], options?: KbImpact
|
|
|
1032
1053
|
declare function inboundIndex(bundle: KbRecord[]): Map<string, KbInboundEdge[]>;
|
|
1033
1054
|
|
|
1034
1055
|
declare const LOG_FILE = "log.jsonl";
|
|
1056
|
+
/**
|
|
1057
|
+
* One pointer change, as an `anchor-set` entry records it: `from` for a move or
|
|
1058
|
+
* a drop, `to` for a move or an addition. Locators only — the log says which
|
|
1059
|
+
* pointer moved, never what it was hashed against. Derived from the record
|
|
1060
|
+
* before and after, so it reports what happened rather than what was asked.
|
|
1061
|
+
*/
|
|
1062
|
+
declare const kbLogAnchorChangeSchema: z.ZodObject<{
|
|
1063
|
+
op: z.ZodEnum<{
|
|
1064
|
+
move: "move";
|
|
1065
|
+
add: "add";
|
|
1066
|
+
drop: "drop";
|
|
1067
|
+
}>;
|
|
1068
|
+
from: z.ZodOptional<z.ZodObject<{
|
|
1069
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
1070
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
1071
|
+
start: z.ZodNumber;
|
|
1072
|
+
end: z.ZodNumber;
|
|
1073
|
+
}, z.core.$strict>>;
|
|
1074
|
+
file: z.ZodString;
|
|
1075
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1076
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
1077
|
+
old: "old";
|
|
1078
|
+
new: "new";
|
|
1079
|
+
}>>;
|
|
1080
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1081
|
+
}, z.core.$strict>>;
|
|
1082
|
+
to: z.ZodOptional<z.ZodObject<{
|
|
1083
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
1084
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
1085
|
+
start: z.ZodNumber;
|
|
1086
|
+
end: z.ZodNumber;
|
|
1087
|
+
}, z.core.$strict>>;
|
|
1088
|
+
file: z.ZodString;
|
|
1089
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1090
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
1091
|
+
old: "old";
|
|
1092
|
+
new: "new";
|
|
1093
|
+
}>>;
|
|
1094
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1095
|
+
}, z.core.$strict>>;
|
|
1096
|
+
}, z.core.$strict>;
|
|
1097
|
+
declare const kbLogEntryFields: z.ZodObject<{
|
|
1098
|
+
at: z.ZodISODateTime;
|
|
1099
|
+
by: z.ZodString;
|
|
1100
|
+
operation: z.ZodString;
|
|
1101
|
+
conceptId: z.ZodString;
|
|
1102
|
+
target: z.ZodOptional<z.ZodString>;
|
|
1103
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1104
|
+
anchors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1105
|
+
op: z.ZodEnum<{
|
|
1106
|
+
move: "move";
|
|
1107
|
+
add: "add";
|
|
1108
|
+
drop: "drop";
|
|
1109
|
+
}>;
|
|
1110
|
+
from: z.ZodOptional<z.ZodObject<{
|
|
1111
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
1112
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
1113
|
+
start: z.ZodNumber;
|
|
1114
|
+
end: z.ZodNumber;
|
|
1115
|
+
}, z.core.$strict>>;
|
|
1116
|
+
file: z.ZodString;
|
|
1117
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1118
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
1119
|
+
old: "old";
|
|
1120
|
+
new: "new";
|
|
1121
|
+
}>>;
|
|
1122
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1123
|
+
}, z.core.$strict>>;
|
|
1124
|
+
to: z.ZodOptional<z.ZodObject<{
|
|
1125
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
1126
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
1127
|
+
start: z.ZodNumber;
|
|
1128
|
+
end: z.ZodNumber;
|
|
1129
|
+
}, z.core.$strict>>;
|
|
1130
|
+
file: z.ZodString;
|
|
1131
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1132
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
1133
|
+
old: "old";
|
|
1134
|
+
new: "new";
|
|
1135
|
+
}>>;
|
|
1136
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1137
|
+
}, z.core.$strict>>;
|
|
1138
|
+
}, z.core.$strict>>>;
|
|
1139
|
+
}, z.core.$strip>;
|
|
1140
|
+
/**
|
|
1141
|
+
* Read-side, and tolerant of a key it has never heard of: one base is read by
|
|
1142
|
+
* every version that touches the repository, so a log has to read *forward*.
|
|
1143
|
+
* Under `.strict()` the first version to add a field turned its own entries
|
|
1144
|
+
* into `malformed` for every older reader — the entries an audit most needs
|
|
1145
|
+
* were the only ones that vanished. A line missing a required field, or
|
|
1146
|
+
* carrying an `at` that is not an ISO datetime, is still malformed.
|
|
1147
|
+
*/
|
|
1035
1148
|
declare const kbLogEntrySchema: z.ZodObject<{
|
|
1036
1149
|
at: z.ZodISODateTime;
|
|
1037
1150
|
by: z.ZodString;
|
|
1038
1151
|
operation: z.ZodString;
|
|
1039
1152
|
conceptId: z.ZodString;
|
|
1040
1153
|
target: z.ZodOptional<z.ZodString>;
|
|
1154
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1155
|
+
anchors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1156
|
+
op: z.ZodEnum<{
|
|
1157
|
+
move: "move";
|
|
1158
|
+
add: "add";
|
|
1159
|
+
drop: "drop";
|
|
1160
|
+
}>;
|
|
1161
|
+
from: z.ZodOptional<z.ZodObject<{
|
|
1162
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
1163
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
1164
|
+
start: z.ZodNumber;
|
|
1165
|
+
end: z.ZodNumber;
|
|
1166
|
+
}, z.core.$strict>>;
|
|
1167
|
+
file: z.ZodString;
|
|
1168
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1169
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
1170
|
+
old: "old";
|
|
1171
|
+
new: "new";
|
|
1172
|
+
}>>;
|
|
1173
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1174
|
+
}, z.core.$strict>>;
|
|
1175
|
+
to: z.ZodOptional<z.ZodObject<{
|
|
1176
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
1177
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
1178
|
+
start: z.ZodNumber;
|
|
1179
|
+
end: z.ZodNumber;
|
|
1180
|
+
}, z.core.$strict>>;
|
|
1181
|
+
file: z.ZodString;
|
|
1182
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1183
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
1184
|
+
old: "old";
|
|
1185
|
+
new: "new";
|
|
1186
|
+
}>>;
|
|
1187
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1188
|
+
}, z.core.$strict>>;
|
|
1189
|
+
}, z.core.$strict>>>;
|
|
1190
|
+
}, z.core.$loose>;
|
|
1191
|
+
/** Write-side: this package controls exactly what it appends. */
|
|
1192
|
+
declare const kbLogEntryWriteSchema: z.ZodObject<{
|
|
1193
|
+
at: z.ZodISODateTime;
|
|
1194
|
+
by: z.ZodString;
|
|
1195
|
+
operation: z.ZodString;
|
|
1196
|
+
conceptId: z.ZodString;
|
|
1197
|
+
target: z.ZodOptional<z.ZodString>;
|
|
1198
|
+
reason: z.ZodOptional<z.ZodString>;
|
|
1199
|
+
anchors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
1200
|
+
op: z.ZodEnum<{
|
|
1201
|
+
move: "move";
|
|
1202
|
+
add: "add";
|
|
1203
|
+
drop: "drop";
|
|
1204
|
+
}>;
|
|
1205
|
+
from: z.ZodOptional<z.ZodObject<{
|
|
1206
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
1207
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
1208
|
+
start: z.ZodNumber;
|
|
1209
|
+
end: z.ZodNumber;
|
|
1210
|
+
}, z.core.$strict>>;
|
|
1211
|
+
file: z.ZodString;
|
|
1212
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1213
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
1214
|
+
old: "old";
|
|
1215
|
+
new: "new";
|
|
1216
|
+
}>>;
|
|
1217
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1218
|
+
}, z.core.$strict>>;
|
|
1219
|
+
to: z.ZodOptional<z.ZodObject<{
|
|
1220
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
1221
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
1222
|
+
start: z.ZodNumber;
|
|
1223
|
+
end: z.ZodNumber;
|
|
1224
|
+
}, z.core.$strict>>;
|
|
1225
|
+
file: z.ZodString;
|
|
1226
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
1227
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
1228
|
+
old: "old";
|
|
1229
|
+
new: "new";
|
|
1230
|
+
}>>;
|
|
1231
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
1232
|
+
}, z.core.$strict>>;
|
|
1233
|
+
}, z.core.$strict>>>;
|
|
1041
1234
|
}, z.core.$strict>;
|
|
1042
|
-
type KbLogEntry = z.infer<typeof
|
|
1235
|
+
type KbLogEntry = z.infer<typeof kbLogEntryFields>;
|
|
1236
|
+
type KbLogAnchorChange = z.infer<typeof kbLogAnchorChangeSchema>;
|
|
1043
1237
|
/**
|
|
1044
1238
|
* The log is the bundle's only primary artifact, and the reason it is handled
|
|
1045
1239
|
* unlike `INDEX.md`.
|
|
@@ -1156,6 +1350,14 @@ type KbWriteInput = {
|
|
|
1156
1350
|
/** Replace an existing record rather than failing on the collision. */
|
|
1157
1351
|
overwrite?: boolean;
|
|
1158
1352
|
};
|
|
1353
|
+
/**
|
|
1354
|
+
* What a patching caller hands `updateAnchors`. Omitting `log` keeps the
|
|
1355
|
+
* default `anchor-resolve` entry.
|
|
1356
|
+
*/
|
|
1357
|
+
type KbAnchorWrite = {
|
|
1358
|
+
anchors: KbAnchor[];
|
|
1359
|
+
log?: Omit<KbLogEntry, "at" | "conceptId" | "by">;
|
|
1360
|
+
};
|
|
1159
1361
|
/** What a record had to still be for `deleteRecord` to remove it. */
|
|
1160
1362
|
type KbDeleteExpectation = {
|
|
1161
1363
|
tag: string;
|
|
@@ -1220,16 +1422,12 @@ declare class KbStore {
|
|
|
1220
1422
|
*/
|
|
1221
1423
|
setStatus(bundlePath: string, conceptId: string, status: KbRecordStatus, actor?: string): Promise<KbRecord>;
|
|
1222
1424
|
/**
|
|
1223
|
-
* Replaces a record's anchors
|
|
1224
|
-
*
|
|
1225
|
-
*
|
|
1226
|
-
*
|
|
1227
|
-
* stale entries the resolution pass deliberately dropped.
|
|
1228
|
-
*
|
|
1229
|
-
* Through the write schema: this is a write, and a defect a hand-edit put in
|
|
1230
|
-
* the frontmatter must not be published back out under an actor stamp.
|
|
1425
|
+
* Replaces a record's anchors, preserving everything else. An array is the
|
|
1426
|
+
* whole set; a function is a patch and runs inside the mutation, against
|
|
1427
|
+
* the anchors the record holds then — see
|
|
1428
|
+
* `decision.anchor-update-patch-inside-mutation`.
|
|
1231
1429
|
*/
|
|
1232
|
-
updateAnchors(bundlePath: string, conceptId: string, anchors: KbAnchor[], actor?: string): Promise<KbRecord>;
|
|
1430
|
+
updateAnchors(bundlePath: string, conceptId: string, anchors: KbAnchor[] | ((current: KbAnchor[]) => KbAnchorWrite), actor?: string): Promise<KbRecord>;
|
|
1233
1431
|
/**
|
|
1234
1432
|
* Appends one `verified[]` event: who checked the record, when, and what the
|
|
1235
1433
|
* check found. Append-only — prior events are history, and are spread into
|
|
@@ -1500,6 +1698,7 @@ declare enum Fault {
|
|
|
1500
1698
|
/** Machine-readable discriminant, stable across message rewording. */
|
|
1501
1699
|
declare enum ErrorTypes {
|
|
1502
1700
|
KbRecordAlreadyExists = "KbRecordAlreadyExists",
|
|
1701
|
+
KbAnchorSetDuplicate = "KbAnchorSetDuplicate",
|
|
1503
1702
|
KbClassifyInput = "KbClassifyInput",
|
|
1504
1703
|
KbFlagConflict = "KbFlagConflict",
|
|
1505
1704
|
KbInvalidActor = "KbInvalidActor",
|
|
@@ -1826,9 +2025,9 @@ declare const composeInputSchema: z.ZodObject<{
|
|
|
1826
2025
|
resolved_at: z.ZodOptional<z.ZodString>;
|
|
1827
2026
|
lines: z.ZodOptional<z.ZodNumber>;
|
|
1828
2027
|
resolver: z.ZodOptional<z.ZodEnum<{
|
|
1829
|
-
span: "span";
|
|
1830
2028
|
"tree-sitter": "tree-sitter";
|
|
1831
2029
|
regex: "regex";
|
|
2030
|
+
span: "span";
|
|
1832
2031
|
}>>;
|
|
1833
2032
|
}, z.core.$strict>>>;
|
|
1834
2033
|
sources: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
@@ -2634,9 +2833,9 @@ declare const decisionInputSchema: z.ZodObject<{
|
|
|
2634
2833
|
resolved_at: z.ZodOptional<z.ZodString>;
|
|
2635
2834
|
lines: z.ZodOptional<z.ZodNumber>;
|
|
2636
2835
|
resolver: z.ZodOptional<z.ZodEnum<{
|
|
2637
|
-
span: "span";
|
|
2638
2836
|
"tree-sitter": "tree-sitter";
|
|
2639
2837
|
regex: "regex";
|
|
2838
|
+
span: "span";
|
|
2640
2839
|
}>>;
|
|
2641
2840
|
}, z.core.$strict>>>;
|
|
2642
2841
|
verify: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -2693,6 +2892,118 @@ declare function selectDecisions(records: KbRecord[]): KbRecord[];
|
|
|
2693
2892
|
declare const KB_COMMANDS: KbCommand[];
|
|
2694
2893
|
declare const KB_COMMANDS_BY_NAME: Map<string, KbCommand>;
|
|
2695
2894
|
|
|
2895
|
+
/** One change the write made, as the result and the log entry report it. */
|
|
2896
|
+
type KbAnchorChange = {
|
|
2897
|
+
/** `move` keeps a baseline under a new address; `add` and `drop` are plain. */
|
|
2898
|
+
op: "move" | "add" | "drop";
|
|
2899
|
+
from?: KbAnchorLocator;
|
|
2900
|
+
to?: KbAnchorLocator;
|
|
2901
|
+
};
|
|
2902
|
+
type KbAnchorSetOutcome = {
|
|
2903
|
+
anchors: KbAnchor[];
|
|
2904
|
+
changes: KbAnchorChange[];
|
|
2905
|
+
};
|
|
2906
|
+
/**
|
|
2907
|
+
* Checks a proposed anchor set and says what changed against the current one.
|
|
2908
|
+
* Accepted as given — whether the code behind a pointer was read is the
|
|
2909
|
+
* caller's claim, recorded in the log, not something this can check. Refuses
|
|
2910
|
+
* only two anchors at one address.
|
|
2911
|
+
*/
|
|
2912
|
+
declare function applyAnchorSet(current: KbAnchor[], incoming: KbAnchor[]): KbAnchorSetOutcome;
|
|
2913
|
+
/** An anchor's address, without the baseline a resolver stamped onto it. */
|
|
2914
|
+
declare function locatorOf(anchor: KbAnchor): KbAnchorLocator;
|
|
2915
|
+
|
|
2916
|
+
/** Two anchors at one address: they would drift and rebaseline as a pair. */
|
|
2917
|
+
declare class KbAnchorSetDuplicateError extends BaseError {
|
|
2918
|
+
readonly locator: string;
|
|
2919
|
+
constructor(locator: string);
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
/**
|
|
2923
|
+
* What the run did about an anchor it set out to write. `applied` is set only
|
|
2924
|
+
* after the record is persisted, so a report never claims a baseline the store
|
|
2925
|
+
* does not hold.
|
|
2926
|
+
*/
|
|
2927
|
+
type AnchorUpdateOutcome = "applied" | "skipped" | "failed";
|
|
2928
|
+
/** Why an intended write did not happen. */
|
|
2929
|
+
type AnchorUpdateReason = "frozen" | "write-failed" | "pinned-ref";
|
|
2930
|
+
type AnchorResolveResult = {
|
|
2931
|
+
file: string;
|
|
2932
|
+
symbol?: string;
|
|
2933
|
+
/** Set only for `side: "old"`: resolved at `ref`, never in the working tree. */
|
|
2934
|
+
side?: "old";
|
|
2935
|
+
/** `unstamped`: no hash yet, and nothing wrote one. */
|
|
2936
|
+
state: "stamped" | "unstamped" | "match" | "drifted" | "unresolved";
|
|
2937
|
+
storedHash?: string;
|
|
2938
|
+
currentHash?: string;
|
|
2939
|
+
/** What the compared hashes were taken over. */
|
|
2940
|
+
hashKind?: AnchorHashKind;
|
|
2941
|
+
/** `null` when the anchor recorded no `lines` — size unknown, not zero. */
|
|
2942
|
+
diffSize?: number | null;
|
|
2943
|
+
reason?: AnchorUnresolvedReason | AnchorDriftReason;
|
|
2944
|
+
resolver?: AnchorResolverName;
|
|
2945
|
+
/** Set only where a baseline write was due: the comparison is `state`. */
|
|
2946
|
+
outcome?: AnchorUpdateOutcome;
|
|
2947
|
+
outcomeReason?: AnchorUpdateReason;
|
|
2948
|
+
rebaselined?: boolean;
|
|
2949
|
+
/** Set only when the anchor was resolved against another repository. */
|
|
2950
|
+
repo?: string;
|
|
2951
|
+
remoteState?: RemoteAnchorState;
|
|
2952
|
+
};
|
|
2953
|
+
|
|
2954
|
+
/**
|
|
2955
|
+
* The record's anchors, as the caller means them to end up.
|
|
2956
|
+
*
|
|
2957
|
+
* A whole set rather than a patch: the caller has just read the record, so it
|
|
2958
|
+
* holds every anchor including its baseline, and carrying one forward under a
|
|
2959
|
+
* new symbol is a field edit rather than an operation to name.
|
|
2960
|
+
*/
|
|
2961
|
+
declare const anchorSetInputSchema: z.ZodObject<{
|
|
2962
|
+
reason: z.ZodString;
|
|
2963
|
+
anchors: z.ZodArray<z.ZodObject<{
|
|
2964
|
+
file: z.ZodString;
|
|
2965
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
2966
|
+
span: z.ZodOptional<z.ZodObject<{
|
|
2967
|
+
start: z.ZodNumber;
|
|
2968
|
+
end: z.ZodNumber;
|
|
2969
|
+
}, z.core.$strict>>;
|
|
2970
|
+
side: z.ZodOptional<z.ZodEnum<{
|
|
2971
|
+
old: "old";
|
|
2972
|
+
new: "new";
|
|
2973
|
+
}>>;
|
|
2974
|
+
repo: z.ZodOptional<z.ZodString>;
|
|
2975
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
2976
|
+
hash: z.ZodOptional<z.ZodString>;
|
|
2977
|
+
hash_kind: z.ZodOptional<z.ZodEnum<{
|
|
2978
|
+
raw: "raw";
|
|
2979
|
+
ast: "ast";
|
|
2980
|
+
}>>;
|
|
2981
|
+
resolved_at: z.ZodOptional<z.ZodString>;
|
|
2982
|
+
lines: z.ZodOptional<z.ZodNumber>;
|
|
2983
|
+
resolver: z.ZodOptional<z.ZodEnum<{
|
|
2984
|
+
"tree-sitter": "tree-sitter";
|
|
2985
|
+
regex: "regex";
|
|
2986
|
+
span: "span";
|
|
2987
|
+
}>>;
|
|
2988
|
+
}, z.core.$strict>>;
|
|
2989
|
+
}, z.core.$strict>;
|
|
2990
|
+
type AnchorSetInput = z.infer<typeof anchorSetInputSchema>;
|
|
2991
|
+
type KbAnchorSetResult = {
|
|
2992
|
+
conceptId: string;
|
|
2993
|
+
reason: string;
|
|
2994
|
+
/** Unchanged anchors are not listed; a no-op write reports nothing. */
|
|
2995
|
+
changes: KbAnchorChange[];
|
|
2996
|
+
anchors: KbAnchor[];
|
|
2997
|
+
/**
|
|
2998
|
+
* `unchanged` without `resolve`; with it, `stamped` only when every anchor
|
|
2999
|
+
* matched or its write was `applied`, else `incomplete`.
|
|
3000
|
+
*/
|
|
3001
|
+
baseline: "unchanged" | "stamped" | "incomplete";
|
|
3002
|
+
/** anchor-resolve's per-anchor results, when `resolve` ran. */
|
|
3003
|
+
resolved?: AnchorResolveResult[];
|
|
3004
|
+
note: string;
|
|
3005
|
+
};
|
|
3006
|
+
|
|
2696
3007
|
/**
|
|
2697
3008
|
* Listing candidates and promoting share one input, and the two need different
|
|
2698
3009
|
* arguments. The rule lives here rather than in `run` so both surfaces refuse
|
|
@@ -3082,4 +3393,4 @@ declare function parseMarkdownWithFrontmatter<S extends z.ZodType>(text: string,
|
|
|
3082
3393
|
frontmatter: ReturnType<S["safeParse"]>;
|
|
3083
3394
|
};
|
|
3084
3395
|
|
|
3085
|
-
export { type AnchorResolution, type AnchorResolver, type AnchorResolverName, BaseError, CONTEXT_BEGIN, CONTEXT_END, CONTEXT_PROFILES, type ClassifiedAnchor, type ComposeInput, type ComposeLink, type ComposedRecord, DECISION_TYPE, DEFAULT_AGING_DAYS, DEFAULT_EXPIRING_DAYS, DEFAULT_LOAD_BUDGET, DEFAULT_PACK_HOPS, DEFAULT_PACK_MAX_NODES, DEFAULT_THRESHOLDS, DEFAULT_TYPED_LINK_RELS, DEFAULT_UNVERIFIED_DAYS, type DecisionInput, type DiffFile, type DiffHunk, type DiffMatch, type ErrorDetails, type ErrorProps, ErrorTypes, Fault, type Grammar, type GrammarManifest, type GrammarOptions, INDEX_FILE, KB_CAUSAL_LINK_RELS, KB_CLASSES, KB_COMMANDS, KB_COMMANDS_BY_NAME, KB_CONCEPT_ID_PATTERN, KB_CONFIDENCES, KB_DIR, KB_DOCTOR_CHECKS, KB_EDGE_KINDS, KB_LINK_RELS, KB_MATERIALITIES, KB_RECORD_STATUSES, KB_RECORD_TYPES, KB_SLUG_PATTERN, type KbActorStamp, type KbAdjudicated, type KbAnchor, type KbAnchorDriftEntry, type KbAnchorSpan, type KbBacklink, type KbBacklinksResult, KbBaseFrozenError, type KbCatalogEntry, type KbCatalogResult, type KbClass, type KbClassifiedFile, type KbClassifiedHunk, type KbClassifyFile, KbClassifyInputError, type KbClassifyOptions, type KbClassifyResult, type KbClassifyThresholds, type KbCommand, type KbCommandContext, type KbContextBudgets, type KbContextOptions, type KbContextResult, type KbDoctorCheck, type KbDoctorFinding, type KbDoctorGroup, type KbDoctorOptions, type KbDoctorReport, type KbDoctorThresholds, type KbDroppedLink, type KbEdgeKind, type KbExportForeignFile, type KbExportResult, type KbExportedDecision, type KbImpactOptions, type KbImpactResult, type KbImpactedRecord, type KbInboundEdge, KbInvalidConceptIdError, type KbLink, type KbLinkEdge, type KbLinkRel, type KbLinkRelSpec, type KbLoadResult, type KbLogEntry, type KbLogReadResult, type KbLogger, type KbMatch, type KbMatchRecord, type KbMergedPin, type KbMergedPins, KbMissingFlagValueError, type KbNeighbour, KbPackBudgetExceededError, type KbPackOptions, type KbPackResult, type KbPackedRecord, type KbPin, type KbPinLayer, type KbPinOptions, type KbPinResult, type KbPinStatus, KbPinsMalformedError, type KbPinsManifest, type KbPromoteCandidate, KbPromoteCollisionError, type KbPromoteResult, KbPromoteSelfError, KbPromoteStandingError, KbPromoteStoppedError, type KbPromotedRecord, type KbReassessAnchor, type KbReassessDefault, type KbReassessDiff, type KbReassessPacket, type KbRecord, KbRecordAlreadyExistsError, type KbRecordFrontmatter, KbRecordNotFoundError, type KbRecordStatus, type KbRecordType, type KbRecordTypeSpec, type KbSearchLogger, KbSelfVerificationError, type KbSource, type KbStanding, KbStore, type KbSupersededStub, type KbSyncResult, type KbTagFilter, type KbTraceEdge, type KbTraceOptions, type KbTraceStep, KbUnknownLinkRelError, type KbValidationProblem, type KbValidationSeverity, type KbVerdict, type KbVerifiedEvent, type KbWarning, KbWriteConflictError, type KbWriteInput, LINK_RELS, LOG_FILE, type MatchOptions, NO_DECISION_SLUG, PINS_FILE, PINS_LOCAL_FILE, PIN_LAYERS, PROMOTION_SOURCE_ID, type QmdModule, RECORD_TYPES, type RemoteAnchorState, type RemoteOptions, type RemoteRead, type ResolvedSymbol, type ResolverAttempt, type ResolverAttemptOptions, SEARCH_INDEX_FILE, type SearchHit, type SearchOptions, type SymbolRange, type SymbolRangeIndex, TRACE_EDGES, TreeSitterResolver, adjudicate, anchorFilePath, anchorOnHunk, assertBaseNotFrozen, backlinks, buildContext, carry, catalog, classifyDiff, classifyDrift, composeDecisionRecord, composeInputSchema, composeLinkSchema, composeNoDecisionRecord, composeRecord, contextProfileBudgets, createKbMcpServer, decisionInputSchema, defaultAnchorResolvers, detectAnchorDrift, doctor, edgeNeighbours, ensureGrammar, grammarHints, grammarManifest, grammarsCacheRoot, hashAnchorText, impact, inboundIndex, indexIsStale, isCanonicalRepoUrl, isKbLinkRel, isKbRecordType, isNoDecisionRecord, isReviewTag, kbActorStampSchema, kbAnchorSchema, kbAnchorSpanSchema, kbAnchorWriteSchema, kbConceptIdSchema, kbJsonSchemas, kbLinkSchema, kbLogEntrySchema, kbRecordFrontmatterSchema, kbSourceSchema, kbVerifiedEventSchema, languageForFile, listPins, loadQmd, matchToDiff, matchesTags, mergedContextBudgets, neighbours, pack, parseLog, parseMarkdownWithFrontmatter, pinBase, prepareResolvers, promoteCandidates, promoteInputSchema, readMergedPins, readPinsLayer, readRemoteAnchors, reassessPacket, regexResolver, renderCatalogLine, renderIndex, renderIndexLine, renderLogEntry, repoCacheDir, resolveAnchor, resolveAnchorSpan, resolveHeads, resolveHits, resolvePinPath, runKbCli, runKbMcpServer, searchBase, selectDecisions, splitMarkdownFrontmatter, stringifyMarkdownWithFrontmatter, symbolRangeIndex, syncInstructions, toHookJson, trace, treeSitterLanguages, unifiedDiff, unpinBase, validateBundle };
|
|
3396
|
+
export { type AnchorResolution, type AnchorResolver, type AnchorResolverName, type AnchorSetInput, BaseError, CONTEXT_BEGIN, CONTEXT_END, CONTEXT_PROFILES, type ClassifiedAnchor, type ComposeInput, type ComposeLink, type ComposedRecord, DECISION_TYPE, DEFAULT_AGING_DAYS, DEFAULT_EXPIRING_DAYS, DEFAULT_LOAD_BUDGET, DEFAULT_PACK_HOPS, DEFAULT_PACK_MAX_NODES, DEFAULT_THRESHOLDS, DEFAULT_TYPED_LINK_RELS, DEFAULT_UNVERIFIED_DAYS, type DecisionInput, type DiffFile, type DiffHunk, type DiffMatch, type ErrorDetails, type ErrorProps, ErrorTypes, Fault, type Grammar, type GrammarManifest, type GrammarOptions, INDEX_FILE, KB_CAUSAL_LINK_RELS, KB_CLASSES, KB_COMMANDS, KB_COMMANDS_BY_NAME, KB_CONCEPT_ID_PATTERN, KB_CONFIDENCES, KB_DIR, KB_DOCTOR_CHECKS, KB_EDGE_KINDS, KB_LINK_RELS, KB_MATERIALITIES, KB_RECORD_STATUSES, KB_RECORD_TYPES, KB_SLUG_PATTERN, type KbActorStamp, type KbAdjudicated, type KbAnchor, type KbAnchorChange, type KbAnchorDriftEntry, type KbAnchorLocator, KbAnchorSetDuplicateError, type KbAnchorSetOutcome, type KbAnchorSetResult, type KbAnchorSpan, type KbAnchorWrite, type KbBacklink, type KbBacklinksResult, KbBaseFrozenError, type KbCatalogEntry, type KbCatalogResult, type KbClass, type KbClassifiedFile, type KbClassifiedHunk, type KbClassifyFile, KbClassifyInputError, type KbClassifyOptions, type KbClassifyResult, type KbClassifyThresholds, type KbCommand, type KbCommandContext, type KbContextBudgets, type KbContextOptions, type KbContextResult, type KbDoctorCheck, type KbDoctorFinding, type KbDoctorGroup, type KbDoctorOptions, type KbDoctorReport, type KbDoctorThresholds, type KbDroppedLink, type KbEdgeKind, type KbExportForeignFile, type KbExportResult, type KbExportedDecision, type KbImpactOptions, type KbImpactResult, type KbImpactedRecord, type KbInboundEdge, KbInvalidConceptIdError, type KbLink, type KbLinkEdge, type KbLinkRel, type KbLinkRelSpec, type KbLoadResult, type KbLogAnchorChange, type KbLogEntry, type KbLogReadResult, type KbLogger, type KbMatch, type KbMatchRecord, type KbMergedPin, type KbMergedPins, KbMissingFlagValueError, type KbNeighbour, KbPackBudgetExceededError, type KbPackOptions, type KbPackResult, type KbPackedRecord, type KbPin, type KbPinLayer, type KbPinOptions, type KbPinResult, type KbPinStatus, KbPinsMalformedError, type KbPinsManifest, type KbPromoteCandidate, KbPromoteCollisionError, type KbPromoteResult, KbPromoteSelfError, KbPromoteStandingError, KbPromoteStoppedError, type KbPromotedRecord, type KbReassessAnchor, type KbReassessDefault, type KbReassessDiff, type KbReassessPacket, type KbRecord, KbRecordAlreadyExistsError, type KbRecordFrontmatter, KbRecordNotFoundError, type KbRecordStatus, type KbRecordType, type KbRecordTypeSpec, type KbSearchLogger, KbSelfVerificationError, type KbSource, type KbStanding, KbStore, type KbSupersededStub, type KbSyncResult, type KbTagFilter, type KbTraceEdge, type KbTraceOptions, type KbTraceStep, KbUnknownLinkRelError, type KbValidationProblem, type KbValidationSeverity, type KbVerdict, type KbVerifiedEvent, type KbWarning, KbWriteConflictError, type KbWriteInput, LINK_RELS, LOG_FILE, type MatchOptions, NO_DECISION_SLUG, PINS_FILE, PINS_LOCAL_FILE, PIN_LAYERS, PROMOTION_SOURCE_ID, type QmdModule, RECORD_TYPES, type RemoteAnchorState, type RemoteOptions, type RemoteRead, type ResolvedSymbol, type ResolverAttempt, type ResolverAttemptOptions, SEARCH_INDEX_FILE, type SearchHit, type SearchOptions, type SymbolRange, type SymbolRangeIndex, TRACE_EDGES, TreeSitterResolver, adjudicate, anchorFilePath, anchorOnHunk, anchorSetInputSchema, applyAnchorSet, assertBaseNotFrozen, backlinks, buildContext, carry, catalog, classifyDiff, classifyDrift, composeDecisionRecord, composeInputSchema, composeLinkSchema, composeNoDecisionRecord, composeRecord, contextProfileBudgets, createKbMcpServer, decisionInputSchema, defaultAnchorResolvers, detectAnchorDrift, doctor, edgeNeighbours, ensureGrammar, grammarHints, grammarManifest, grammarsCacheRoot, hashAnchorText, impact, inboundIndex, indexIsStale, isCanonicalRepoUrl, isKbLinkRel, isKbRecordType, isNoDecisionRecord, isReviewTag, kbActorStampSchema, kbAnchorLocatorSchema, kbAnchorSchema, kbAnchorSpanSchema, kbAnchorWriteSchema, kbConceptIdSchema, kbJsonSchemas, kbLinkSchema, kbLogAnchorChangeSchema, kbLogEntrySchema, kbLogEntryWriteSchema, kbRecordFrontmatterSchema, kbSourceSchema, kbVerifiedEventSchema, languageForFile, listPins, loadQmd, locatorOf, matchToDiff, matchesTags, mergedContextBudgets, neighbours, pack, parseLog, parseMarkdownWithFrontmatter, pinBase, prepareResolvers, promoteCandidates, promoteInputSchema, readMergedPins, readPinsLayer, readRemoteAnchors, reassessPacket, regexResolver, renderCatalogLine, renderIndex, renderIndexLine, renderLogEntry, repoCacheDir, resolveAnchor, resolveAnchorSpan, resolveHeads, resolveHits, resolvePinPath, runKbCli, runKbMcpServer, searchBase, selectDecisions, splitMarkdownFrontmatter, stringifyMarkdownWithFrontmatter, symbolRangeIndex, syncInstructions, toHookJson, trace, treeSitterLanguages, unifiedDiff, unpinBase, validateBundle };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runKbCli
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-5IPQVXCM.js";
|
|
4
4
|
import {
|
|
5
5
|
createKbMcpServer,
|
|
6
6
|
runKbMcpServer
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3EZ3PAPA.js";
|
|
8
8
|
import {
|
|
9
9
|
BaseError,
|
|
10
10
|
CONTEXT_BEGIN,
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
KB_RECORD_STATUSES,
|
|
37
37
|
KB_RECORD_TYPES,
|
|
38
38
|
KB_SLUG_PATTERN,
|
|
39
|
+
KbAnchorSetDuplicateError,
|
|
39
40
|
KbBaseFrozenError,
|
|
40
41
|
KbClassifyInputError,
|
|
41
42
|
KbInvalidConceptIdError,
|
|
@@ -66,6 +67,8 @@ import {
|
|
|
66
67
|
adjudicate,
|
|
67
68
|
anchorFilePath,
|
|
68
69
|
anchorOnHunk,
|
|
70
|
+
anchorSetInputSchema,
|
|
71
|
+
applyAnchorSet,
|
|
69
72
|
assertBaseNotFrozen,
|
|
70
73
|
backlinks,
|
|
71
74
|
buildContext,
|
|
@@ -98,19 +101,23 @@ import {
|
|
|
98
101
|
isNoDecisionRecord,
|
|
99
102
|
isReviewTag,
|
|
100
103
|
kbActorStampSchema,
|
|
104
|
+
kbAnchorLocatorSchema,
|
|
101
105
|
kbAnchorSchema,
|
|
102
106
|
kbAnchorSpanSchema,
|
|
103
107
|
kbAnchorWriteSchema,
|
|
104
108
|
kbConceptIdSchema,
|
|
105
109
|
kbJsonSchemas,
|
|
106
110
|
kbLinkSchema,
|
|
111
|
+
kbLogAnchorChangeSchema,
|
|
107
112
|
kbLogEntrySchema,
|
|
113
|
+
kbLogEntryWriteSchema,
|
|
108
114
|
kbRecordFrontmatterSchema,
|
|
109
115
|
kbSourceSchema,
|
|
110
116
|
kbVerifiedEventSchema,
|
|
111
117
|
languageForFile,
|
|
112
118
|
listPins,
|
|
113
119
|
loadQmd,
|
|
120
|
+
locatorOf,
|
|
114
121
|
matchToDiff,
|
|
115
122
|
matchesTags,
|
|
116
123
|
mergedContextBudgets,
|
|
@@ -149,7 +156,7 @@ import {
|
|
|
149
156
|
unifiedDiff,
|
|
150
157
|
unpinBase,
|
|
151
158
|
validateBundle
|
|
152
|
-
} from "./chunk-
|
|
159
|
+
} from "./chunk-XENLCPL5.js";
|
|
153
160
|
export {
|
|
154
161
|
BaseError,
|
|
155
162
|
CONTEXT_BEGIN,
|
|
@@ -181,6 +188,7 @@ export {
|
|
|
181
188
|
KB_RECORD_STATUSES,
|
|
182
189
|
KB_RECORD_TYPES,
|
|
183
190
|
KB_SLUG_PATTERN,
|
|
191
|
+
KbAnchorSetDuplicateError,
|
|
184
192
|
KbBaseFrozenError,
|
|
185
193
|
KbClassifyInputError,
|
|
186
194
|
KbInvalidConceptIdError,
|
|
@@ -211,6 +219,8 @@ export {
|
|
|
211
219
|
adjudicate,
|
|
212
220
|
anchorFilePath,
|
|
213
221
|
anchorOnHunk,
|
|
222
|
+
anchorSetInputSchema,
|
|
223
|
+
applyAnchorSet,
|
|
214
224
|
assertBaseNotFrozen,
|
|
215
225
|
backlinks,
|
|
216
226
|
buildContext,
|
|
@@ -244,19 +254,23 @@ export {
|
|
|
244
254
|
isNoDecisionRecord,
|
|
245
255
|
isReviewTag,
|
|
246
256
|
kbActorStampSchema,
|
|
257
|
+
kbAnchorLocatorSchema,
|
|
247
258
|
kbAnchorSchema,
|
|
248
259
|
kbAnchorSpanSchema,
|
|
249
260
|
kbAnchorWriteSchema,
|
|
250
261
|
kbConceptIdSchema,
|
|
251
262
|
kbJsonSchemas,
|
|
252
263
|
kbLinkSchema,
|
|
264
|
+
kbLogAnchorChangeSchema,
|
|
253
265
|
kbLogEntrySchema,
|
|
266
|
+
kbLogEntryWriteSchema,
|
|
254
267
|
kbRecordFrontmatterSchema,
|
|
255
268
|
kbSourceSchema,
|
|
256
269
|
kbVerifiedEventSchema,
|
|
257
270
|
languageForFile,
|
|
258
271
|
listPins,
|
|
259
272
|
loadQmd,
|
|
273
|
+
locatorOf,
|
|
260
274
|
matchToDiff,
|
|
261
275
|
matchesTags,
|
|
262
276
|
mergedContextBudgets,
|