@hiveai/mcp 0.5.0 → 0.6.0
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.js +617 -12
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +184 -1
- package/dist/server.js +621 -12
- package/dist/server.js.map +1 -1
- package/package.json +3 -3
package/dist/server.d.ts
CHANGED
|
@@ -325,6 +325,189 @@ interface AntiPatternsCheckOutput {
|
|
|
325
325
|
*/
|
|
326
326
|
declare function antiPatternsCheck(input: AntiPatternsCheckInput, ctx: HaiveContext): Promise<AntiPatternsCheckOutput>;
|
|
327
327
|
|
|
328
|
+
declare const MemDistillInputSchema: {
|
|
329
|
+
since_days: z.ZodDefault<z.ZodNumber>;
|
|
330
|
+
min_cluster: z.ZodDefault<z.ZodNumber>;
|
|
331
|
+
type_filter: z.ZodDefault<z.ZodEnum<["gotcha", "attempt", "all"]>>;
|
|
332
|
+
scope: z.ZodDefault<z.ZodEnum<["personal", "team", "module", "any"]>>;
|
|
333
|
+
};
|
|
334
|
+
type MemDistillInput = {
|
|
335
|
+
[K in keyof typeof MemDistillInputSchema]: z.infer<(typeof MemDistillInputSchema)[K]>;
|
|
336
|
+
};
|
|
337
|
+
interface DistillCluster {
|
|
338
|
+
suggested_topic: string;
|
|
339
|
+
suggested_type: "convention" | "gotcha";
|
|
340
|
+
member_ids: string[];
|
|
341
|
+
overlapping_paths: string[];
|
|
342
|
+
common_keywords: string[];
|
|
343
|
+
sample_titles: string[];
|
|
344
|
+
/** ISO date of the latest member */
|
|
345
|
+
latest_at: string;
|
|
346
|
+
}
|
|
347
|
+
interface MemDistillOutput {
|
|
348
|
+
scanned: number;
|
|
349
|
+
/** Memories that didn't fit any cluster (kept here so callers can inspect singletons). */
|
|
350
|
+
singletons: number;
|
|
351
|
+
clusters: DistillCluster[];
|
|
352
|
+
notice?: string;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Cluster recurring observations / attempts so a human can collapse N similar
|
|
356
|
+
* memories into one richer convention/gotcha. Uses cheap heuristics (anchor
|
|
357
|
+
* path overlap + body keyword overlap) — no embeddings needed.
|
|
358
|
+
*
|
|
359
|
+
* Output is *advisory*: nothing is written to disk. The caller (CLI / human)
|
|
360
|
+
* decides whether to mem_save the consolidated form.
|
|
361
|
+
*/
|
|
362
|
+
declare function memDistill(input: MemDistillInput, ctx: HaiveContext): Promise<MemDistillOutput>;
|
|
363
|
+
|
|
364
|
+
declare const WhyThisDecisionInputSchema: {
|
|
365
|
+
id: z.ZodString;
|
|
366
|
+
git_log_limit: z.ZodDefault<z.ZodNumber>;
|
|
367
|
+
};
|
|
368
|
+
type WhyThisDecisionInput = {
|
|
369
|
+
[K in keyof typeof WhyThisDecisionInputSchema]: z.infer<(typeof WhyThisDecisionInputSchema)[K]>;
|
|
370
|
+
};
|
|
371
|
+
interface WhyThisDecisionOutput {
|
|
372
|
+
found: boolean;
|
|
373
|
+
decision?: {
|
|
374
|
+
id: string;
|
|
375
|
+
type: string;
|
|
376
|
+
scope: string;
|
|
377
|
+
status: string;
|
|
378
|
+
confidence: string;
|
|
379
|
+
body: string;
|
|
380
|
+
created_at: string;
|
|
381
|
+
};
|
|
382
|
+
/** Memories explicitly linked via related_ids on the decision (or vice versa). */
|
|
383
|
+
related: Array<{
|
|
384
|
+
id: string;
|
|
385
|
+
type: string;
|
|
386
|
+
scope: string;
|
|
387
|
+
confidence: string;
|
|
388
|
+
body_preview: string;
|
|
389
|
+
relation: "explicit" | "back-link";
|
|
390
|
+
}>;
|
|
391
|
+
/** Other memories anchored to overlapping paths — implicit context. */
|
|
392
|
+
path_neighbors: Array<{
|
|
393
|
+
id: string;
|
|
394
|
+
type: string;
|
|
395
|
+
scope: string;
|
|
396
|
+
confidence: string;
|
|
397
|
+
overlap: string[];
|
|
398
|
+
body_preview: string;
|
|
399
|
+
}>;
|
|
400
|
+
/** Recent git commits touching any of the decision's anchored paths. */
|
|
401
|
+
recent_commits: Array<{
|
|
402
|
+
path: string;
|
|
403
|
+
sha: string;
|
|
404
|
+
author: string;
|
|
405
|
+
relative_date: string;
|
|
406
|
+
subject: string;
|
|
407
|
+
}>;
|
|
408
|
+
hints?: string[];
|
|
409
|
+
notice?: string;
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Trace the genealogy of a `decision` memory: the decision itself + memories
|
|
413
|
+
* explicitly linked to it + memories anchored to overlapping paths + recent
|
|
414
|
+
* commits touching those paths. One call instead of 4-5 manual lookups.
|
|
415
|
+
*
|
|
416
|
+
* Works on any memory type, but is optimized for `decision` and `architecture`.
|
|
417
|
+
*/
|
|
418
|
+
declare function whyThisDecision(input: WhyThisDecisionInput, ctx: HaiveContext): Promise<WhyThisDecisionOutput>;
|
|
419
|
+
|
|
420
|
+
declare const MemConflictsInputSchema: {
|
|
421
|
+
id: z.ZodString;
|
|
422
|
+
min_score: z.ZodDefault<z.ZodNumber>;
|
|
423
|
+
semantic: z.ZodDefault<z.ZodBoolean>;
|
|
424
|
+
};
|
|
425
|
+
type MemConflictsInput = {
|
|
426
|
+
[K in keyof typeof MemConflictsInputSchema]: z.infer<(typeof MemConflictsInputSchema)[K]>;
|
|
427
|
+
};
|
|
428
|
+
type ConflictReason = "opposite-status" | "attempt-vs-convention-same-paths" | "polarity-keywords" | "explicit-contradiction-tag";
|
|
429
|
+
interface ConflictHit {
|
|
430
|
+
id: string;
|
|
431
|
+
type: string;
|
|
432
|
+
scope: string;
|
|
433
|
+
status: string;
|
|
434
|
+
confidence: string;
|
|
435
|
+
body_preview: string;
|
|
436
|
+
similarity: number | null;
|
|
437
|
+
reasons: ConflictReason[];
|
|
438
|
+
shared_paths: string[];
|
|
439
|
+
}
|
|
440
|
+
interface MemConflictsOutput {
|
|
441
|
+
found: boolean;
|
|
442
|
+
target?: {
|
|
443
|
+
id: string;
|
|
444
|
+
type: string;
|
|
445
|
+
status: string;
|
|
446
|
+
};
|
|
447
|
+
scanned: number;
|
|
448
|
+
conflicts: ConflictHit[];
|
|
449
|
+
notice?: string;
|
|
450
|
+
}
|
|
451
|
+
/**
|
|
452
|
+
* Find memories that potentially CONTRADICT the given memory. Useful before
|
|
453
|
+
* relying on a memory's advice — surfaces "another memory says the opposite".
|
|
454
|
+
*
|
|
455
|
+
* Detection layers (any of these triggers a hit):
|
|
456
|
+
* - Opposite status: target is validated, neighbor is rejected — for the same topic
|
|
457
|
+
* - Type mismatch on overlapping paths: an `attempt` (don't do X) coexists with
|
|
458
|
+
* a `convention` (do X) anchored to overlapping paths
|
|
459
|
+
* - Polarity keywords: target says "use X" while a semantic neighbor says "don't use X"
|
|
460
|
+
* - Explicit contradiction tag (#contradicts:<id>) in either body
|
|
461
|
+
*/
|
|
462
|
+
declare function memConflicts(input: MemConflictsInput, ctx: HaiveContext): Promise<MemConflictsOutput>;
|
|
463
|
+
|
|
464
|
+
declare const PreCommitCheckInputSchema: {
|
|
465
|
+
diff: z.ZodOptional<z.ZodString>;
|
|
466
|
+
paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
467
|
+
block_on: z.ZodDefault<z.ZodEnum<["any", "high-confidence", "never"]>>;
|
|
468
|
+
semantic: z.ZodDefault<z.ZodBoolean>;
|
|
469
|
+
};
|
|
470
|
+
type PreCommitCheckInput = {
|
|
471
|
+
[K in keyof typeof PreCommitCheckInputSchema]: z.infer<(typeof PreCommitCheckInputSchema)[K]>;
|
|
472
|
+
};
|
|
473
|
+
interface PreCommitCheckOutput {
|
|
474
|
+
/** True when at least one finding meets the configured block_on threshold. */
|
|
475
|
+
should_block: boolean;
|
|
476
|
+
/** Per-section summary; clients should surface the warnings + reasons to the user. */
|
|
477
|
+
summary: {
|
|
478
|
+
anti_patterns: number;
|
|
479
|
+
relevant_memories: number;
|
|
480
|
+
stale_anchors: number;
|
|
481
|
+
};
|
|
482
|
+
warnings: AntiPatternsWarning[];
|
|
483
|
+
/** Memories anchored to the touched files — convention reminders for the change author. */
|
|
484
|
+
relevant_memories: Array<{
|
|
485
|
+
id: string;
|
|
486
|
+
type: string;
|
|
487
|
+
confidence: string;
|
|
488
|
+
body_preview: string;
|
|
489
|
+
}>;
|
|
490
|
+
/** Memories whose anchored paths overlap with the diff AND are now stale — likely outdated knowledge. */
|
|
491
|
+
stale_anchors: Array<{
|
|
492
|
+
id: string;
|
|
493
|
+
paths: string[];
|
|
494
|
+
body_preview: string;
|
|
495
|
+
}>;
|
|
496
|
+
notice?: string;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* One-shot "should I block this commit?" check.
|
|
500
|
+
*
|
|
501
|
+
* Combines three signals into a single call agents and git hooks can consume:
|
|
502
|
+
* 1. anti_patterns_check — known gotchas/attempts that match the diff
|
|
503
|
+
* 2. mem_for_files — conventions/decisions anchored to touched files
|
|
504
|
+
* 3. mem_verify — memories whose anchors are stale (knowledge may be wrong)
|
|
505
|
+
*
|
|
506
|
+
* Returns should_block per the configured threshold, plus the raw findings so
|
|
507
|
+
* the caller can render them. CLI wrapper: `haive precommit`.
|
|
508
|
+
*/
|
|
509
|
+
declare function preCommitCheck(input: PreCommitCheckInput, ctx: HaiveContext): Promise<PreCommitCheckOutput>;
|
|
510
|
+
|
|
328
511
|
declare const SERVER_NAME = "haive";
|
|
329
512
|
declare const SERVER_VERSION: string;
|
|
330
513
|
declare function createHaiveServer(options?: CreateContextOptions): {
|
|
@@ -333,4 +516,4 @@ declare function createHaiveServer(options?: CreateContextOptions): {
|
|
|
333
516
|
tracker: SessionTracker;
|
|
334
517
|
};
|
|
335
518
|
|
|
336
|
-
export { type AntiPatternsCheckInput, type AntiPatternsCheckOutput, type BriefingOutput, type CodeMapInput, type CodeMapToolOutput, type CodeSearchInput, type CodeSearchOutput, type GetBriefingInput, type GetRecapInput, type GetRecapOutput, type MemRelevantToInput, type MemRelevantToOutput, SERVER_NAME, SERVER_VERSION, type WhyThisFileInput, type WhyThisFileOutput, antiPatternsCheck, codeMapTool, codeSearch, createHaiveServer, getBriefing, getRecap, memRelevantTo, whyThisFile };
|
|
519
|
+
export { type AntiPatternsCheckInput, type AntiPatternsCheckOutput, type BriefingOutput, type CodeMapInput, type CodeMapToolOutput, type CodeSearchInput, type CodeSearchOutput, type GetBriefingInput, type GetRecapInput, type GetRecapOutput, type MemConflictsInput, type MemConflictsOutput, type MemDistillInput, type MemDistillOutput, type MemRelevantToInput, type MemRelevantToOutput, type PreCommitCheckInput, type PreCommitCheckOutput, SERVER_NAME, SERVER_VERSION, type WhyThisDecisionInput, type WhyThisDecisionOutput, type WhyThisFileInput, type WhyThisFileOutput, antiPatternsCheck, codeMapTool, codeSearch, createHaiveServer, getBriefing, getRecap, memConflicts, memDistill, memRelevantTo, preCommitCheck, whyThisDecision, whyThisFile };
|