@hivelore/core 0.42.1 → 0.43.2
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.ts +31 -0
- package/dist/index.js +15 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,10 @@ declare const SensorSchema: z.ZodObject<{
|
|
|
36
36
|
* the optional `@ast-grep/napi` engine; without it the sensor is unrunnable (warn, never block).
|
|
37
37
|
*/
|
|
38
38
|
pattern: z.ZodOptional<z.ZodString>;
|
|
39
|
+
/** kind=ast: full ast-grep Rule object (`kind`, `inside`, `has`, `not`, `all`, `any`, …). */
|
|
40
|
+
rule: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
41
|
+
/** kind=ast: explicit language name for extensionless/non-standard files (e.g. python, go). */
|
|
42
|
+
language: z.ZodOptional<z.ZodString>;
|
|
39
43
|
/**
|
|
40
44
|
* Optional "correct-usage" regex (kind=regex). When `pattern` (the risky call) matches but this
|
|
41
45
|
* regex ALSO appears within a small window around the match, the catch is SUPPRESSED — the diff
|
|
@@ -89,6 +93,8 @@ declare const SensorSchema: z.ZodObject<{
|
|
|
89
93
|
autogen: boolean;
|
|
90
94
|
last_fired: string | null;
|
|
91
95
|
pattern?: string | undefined;
|
|
96
|
+
rule?: Record<string, unknown> | undefined;
|
|
97
|
+
language?: string | undefined;
|
|
92
98
|
absent?: string | undefined;
|
|
93
99
|
flags?: string | undefined;
|
|
94
100
|
command?: string | undefined;
|
|
@@ -101,6 +107,8 @@ declare const SensorSchema: z.ZodObject<{
|
|
|
101
107
|
paths?: string[] | undefined;
|
|
102
108
|
kind?: "regex" | "ast" | "shell" | "test" | undefined;
|
|
103
109
|
pattern?: string | undefined;
|
|
110
|
+
rule?: Record<string, unknown> | undefined;
|
|
111
|
+
language?: string | undefined;
|
|
104
112
|
absent?: string | undefined;
|
|
105
113
|
flags?: string | undefined;
|
|
106
114
|
command?: string | undefined;
|
|
@@ -167,6 +175,10 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
167
175
|
* the optional `@ast-grep/napi` engine; without it the sensor is unrunnable (warn, never block).
|
|
168
176
|
*/
|
|
169
177
|
pattern: z.ZodOptional<z.ZodString>;
|
|
178
|
+
/** kind=ast: full ast-grep Rule object (`kind`, `inside`, `has`, `not`, `all`, `any`, …). */
|
|
179
|
+
rule: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
180
|
+
/** kind=ast: explicit language name for extensionless/non-standard files (e.g. python, go). */
|
|
181
|
+
language: z.ZodOptional<z.ZodString>;
|
|
170
182
|
/**
|
|
171
183
|
* Optional "correct-usage" regex (kind=regex). When `pattern` (the risky call) matches but this
|
|
172
184
|
* regex ALSO appears within a small window around the match, the catch is SUPPRESSED — the diff
|
|
@@ -220,6 +232,8 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
220
232
|
autogen: boolean;
|
|
221
233
|
last_fired: string | null;
|
|
222
234
|
pattern?: string | undefined;
|
|
235
|
+
rule?: Record<string, unknown> | undefined;
|
|
236
|
+
language?: string | undefined;
|
|
223
237
|
absent?: string | undefined;
|
|
224
238
|
flags?: string | undefined;
|
|
225
239
|
command?: string | undefined;
|
|
@@ -232,6 +246,8 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
232
246
|
paths?: string[] | undefined;
|
|
233
247
|
kind?: "regex" | "ast" | "shell" | "test" | undefined;
|
|
234
248
|
pattern?: string | undefined;
|
|
249
|
+
rule?: Record<string, unknown> | undefined;
|
|
250
|
+
language?: string | undefined;
|
|
235
251
|
absent?: string | undefined;
|
|
236
252
|
flags?: string | undefined;
|
|
237
253
|
command?: string | undefined;
|
|
@@ -317,6 +333,8 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
317
333
|
autogen: boolean;
|
|
318
334
|
last_fired: string | null;
|
|
319
335
|
pattern?: string | undefined;
|
|
336
|
+
rule?: Record<string, unknown> | undefined;
|
|
337
|
+
language?: string | undefined;
|
|
320
338
|
absent?: string | undefined;
|
|
321
339
|
flags?: string | undefined;
|
|
322
340
|
command?: string | undefined;
|
|
@@ -350,6 +368,8 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
350
368
|
paths?: string[] | undefined;
|
|
351
369
|
kind?: "regex" | "ast" | "shell" | "test" | undefined;
|
|
352
370
|
pattern?: string | undefined;
|
|
371
|
+
rule?: Record<string, unknown> | undefined;
|
|
372
|
+
language?: string | undefined;
|
|
353
373
|
absent?: string | undefined;
|
|
354
374
|
flags?: string | undefined;
|
|
355
375
|
command?: string | undefined;
|
|
@@ -407,6 +427,8 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
407
427
|
autogen: boolean;
|
|
408
428
|
last_fired: string | null;
|
|
409
429
|
pattern?: string | undefined;
|
|
430
|
+
rule?: Record<string, unknown> | undefined;
|
|
431
|
+
language?: string | undefined;
|
|
410
432
|
absent?: string | undefined;
|
|
411
433
|
flags?: string | undefined;
|
|
412
434
|
command?: string | undefined;
|
|
@@ -440,6 +462,8 @@ declare const MemoryFrontmatterSchema: z.ZodEffects<z.ZodObject<{
|
|
|
440
462
|
paths?: string[] | undefined;
|
|
441
463
|
kind?: "regex" | "ast" | "shell" | "test" | undefined;
|
|
442
464
|
pattern?: string | undefined;
|
|
465
|
+
rule?: Record<string, unknown> | undefined;
|
|
466
|
+
language?: string | undefined;
|
|
443
467
|
absent?: string | undefined;
|
|
444
468
|
flags?: string | undefined;
|
|
445
469
|
command?: string | undefined;
|
|
@@ -1591,6 +1615,13 @@ interface HaiveConfig {
|
|
|
1591
1615
|
* (or pass `--commands`) once the team trusts the sensors. Regex sensors always run. Default false.
|
|
1592
1616
|
*/
|
|
1593
1617
|
runCommandSensors?: boolean;
|
|
1618
|
+
/**
|
|
1619
|
+
* CI/strict-gate handling when a shell/test sensor cannot execute. `warn` preserves the
|
|
1620
|
+
* fail-open developer default; `block` treats any configured but broken oracle as a broken harness.
|
|
1621
|
+
*/
|
|
1622
|
+
commandSensorUnrunnable?: "warn" | "block";
|
|
1623
|
+
/** Require explicit resolution of a diff that demotes, rewrites, or removes a BLOCK sensor. */
|
|
1624
|
+
sensorWeakeningGate?: "warn" | "block";
|
|
1594
1625
|
/**
|
|
1595
1626
|
* How `hivelore enforce finish` reacts to hard failures observed this session that were never
|
|
1596
1627
|
* captured as a lesson (`mem_tried`):
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,10 @@ var SensorSchema = z.object({
|
|
|
36
36
|
* the optional `@ast-grep/napi` engine; without it the sensor is unrunnable (warn, never block).
|
|
37
37
|
*/
|
|
38
38
|
pattern: z.string().optional(),
|
|
39
|
+
/** kind=ast: full ast-grep Rule object (`kind`, `inside`, `has`, `not`, `all`, `any`, …). */
|
|
40
|
+
rule: z.record(z.unknown()).optional(),
|
|
41
|
+
/** kind=ast: explicit language name for extensionless/non-standard files (e.g. python, go). */
|
|
42
|
+
language: z.string().optional(),
|
|
39
43
|
/**
|
|
40
44
|
* Optional "correct-usage" regex (kind=regex). When `pattern` (the risky call) matches but this
|
|
41
45
|
* regex ALSO appears within a small window around the match, the catch is SUPPRESSED — the diff
|
|
@@ -967,7 +971,7 @@ function buildPreventionReceipt(events, memories, usage, options) {
|
|
|
967
971
|
red_proven: sensor?.red_proven === true
|
|
968
972
|
};
|
|
969
973
|
}).sort((a, b) => b.at.localeCompare(a.at));
|
|
970
|
-
const preventedCountTotal = Object.values(usage.by_id).reduce((sum, item) => sum + item.prevented_count, 0);
|
|
974
|
+
const preventedCountTotal = Object.values(usage.by_id).reduce((sum, item) => sum + (item.prevented_count ?? 0), 0);
|
|
971
975
|
return {
|
|
972
976
|
generated_at: now.toISOString(),
|
|
973
977
|
since: options.since.toISOString(),
|
|
@@ -2559,6 +2563,8 @@ var DEFAULT_CONFIG = {
|
|
|
2559
2563
|
antiPatternGate: "anchored",
|
|
2560
2564
|
bootstrapGate: "block",
|
|
2561
2565
|
humanCommits: "relaxed",
|
|
2566
|
+
commandSensorUnrunnable: "warn",
|
|
2567
|
+
sensorWeakeningGate: "warn",
|
|
2562
2568
|
scoreThreshold: 80,
|
|
2563
2569
|
cleanupGeneratedArtifacts: true,
|
|
2564
2570
|
toolProfile: "enforcement",
|
|
@@ -2593,6 +2599,8 @@ var AUTOPILOT_DEFAULTS = {
|
|
|
2593
2599
|
antiPatternGate: "anchored",
|
|
2594
2600
|
bootstrapGate: "block",
|
|
2595
2601
|
humanCommits: "relaxed",
|
|
2602
|
+
commandSensorUnrunnable: "warn",
|
|
2603
|
+
sensorWeakeningGate: "warn",
|
|
2596
2604
|
scoreThreshold: 85,
|
|
2597
2605
|
cleanupGeneratedArtifacts: true,
|
|
2598
2606
|
toolProfile: "enforcement",
|
|
@@ -4220,6 +4228,7 @@ function diffFileChanges(diff) {
|
|
|
4220
4228
|
const newPath = raw === "/dev/null" ? null : normalizeProjectPath(raw);
|
|
4221
4229
|
current = {
|
|
4222
4230
|
path: newPath ?? oldPath ?? "",
|
|
4231
|
+
created: oldPath === null && newPath !== null,
|
|
4223
4232
|
deleted: newPath === null,
|
|
4224
4233
|
removed: [],
|
|
4225
4234
|
added: []
|
|
@@ -4247,6 +4256,7 @@ function detectSensorWeakening(diff) {
|
|
|
4247
4256
|
weakenings.push({ file: file.path, memory_id: memoryId, change, detail });
|
|
4248
4257
|
};
|
|
4249
4258
|
const removedBlockSeverity = file.removed.some((l) => SEVERITY_BLOCK_RE.test(l));
|
|
4259
|
+
if (file.created) continue;
|
|
4250
4260
|
if (file.deleted) {
|
|
4251
4261
|
if (file.removed.some((l) => SENSOR_BLOCK_START_RE.test(l)) && removedBlockSeverity) {
|
|
4252
4262
|
flag("memory-deleted", "memory file with a block sensor deleted");
|
|
@@ -4269,7 +4279,10 @@ function detectSensorWeakening(diff) {
|
|
|
4269
4279
|
}
|
|
4270
4280
|
const removedAbsent = file.removed.find((l) => SENSOR_ABSENT_KEY_RE.test(l));
|
|
4271
4281
|
const addedAbsent = file.added.find((l) => SENSOR_ABSENT_KEY_RE.test(l));
|
|
4272
|
-
|
|
4282
|
+
const addingNewSensorBlock = file.added.some((l) => SENSOR_BLOCK_START_RE.test(l)) && !file.removed.some(
|
|
4283
|
+
(l) => SENSOR_BLOCK_START_RE.test(l) || SENSOR_ORACLE_KEY_RE.test(l) || SEVERITY_BLOCK_RE.test(l) || SEVERITY_WARN_RE.test(l)
|
|
4284
|
+
);
|
|
4285
|
+
if (!addingNewSensorBlock && addedAbsent !== void 0 && addedAbsent.trim() !== removedAbsent?.trim()) {
|
|
4273
4286
|
flag("suppression-broadened", removedAbsent === void 0 ? "absent marker added" : "absent marker changed");
|
|
4274
4287
|
}
|
|
4275
4288
|
if (file.removed.some((l) => SENSOR_BLOCK_START_RE.test(l)) && removedBlockSeverity && !file.added.some((l) => SENSOR_BLOCK_START_RE.test(l))) {
|