@hivelore/mcp 0.30.1 → 0.33.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/server.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import * as _hivelore_core from '@hivelore/core';
3
- import { HaivePaths, ConfidenceLevel, ImpactTier, SensorTarget, resolveProjectInfo, readRuntimeJournalTail } from '@hivelore/core';
3
+ import { HaivePaths, ConfidenceLevel, ImpactTier, SensorTarget, resolveProjectInfo } from '@hivelore/core';
4
4
  import { z } from 'zod';
5
5
 
6
6
  interface HaiveContext {
@@ -353,49 +353,6 @@ interface CodeSearchOutput {
353
353
  }
354
354
  declare function codeSearch(input: CodeSearchInput, ctx: HaiveContext): Promise<CodeSearchOutput>;
355
355
 
356
- declare const WhyThisFileInputSchema: {
357
- path: z.ZodString;
358
- git_log_limit: z.ZodDefault<z.ZodNumber>;
359
- memory_limit: z.ZodDefault<z.ZodNumber>;
360
- };
361
- type WhyThisFileInput = {
362
- [K in keyof typeof WhyThisFileInputSchema]: z.infer<(typeof WhyThisFileInputSchema)[K]>;
363
- };
364
- interface WhyThisFileOutput {
365
- file: string;
366
- exists: boolean;
367
- recent_commits: Array<{
368
- sha: string;
369
- author: string;
370
- relative_date: string;
371
- subject: string;
372
- }>;
373
- memories: Array<{
374
- id: string;
375
- type: string;
376
- scope: string;
377
- confidence: string;
378
- body_preview: string;
379
- }>;
380
- code_map_entry: {
381
- summary?: string;
382
- loc: number;
383
- exports: Array<{
384
- name: string;
385
- kind: string;
386
- line: number;
387
- description?: string;
388
- }>;
389
- } | null;
390
- hints?: string[];
391
- }
392
- /**
393
- * One-shot file-context lookup: combines recent git history, memories anchored
394
- * to the path, and the code-map entry. Designed to answer "why is this file
395
- * the way it is?" in a single call instead of 3-4 manual ones.
396
- */
397
- declare function whyThisFile(input: WhyThisFileInput, ctx: HaiveContext): Promise<WhyThisFileOutput>;
398
-
399
356
  interface AntiPatternsCheckInput {
400
357
  diff?: string;
401
358
  paths: string[];
@@ -485,106 +442,6 @@ interface MemDistillOutput {
485
442
  */
486
443
  declare function memDistill(input: MemDistillInput, ctx: HaiveContext): Promise<MemDistillOutput>;
487
444
 
488
- declare const WhyThisDecisionInputSchema: {
489
- id: z.ZodString;
490
- git_log_limit: z.ZodDefault<z.ZodNumber>;
491
- };
492
- type WhyThisDecisionInput = {
493
- [K in keyof typeof WhyThisDecisionInputSchema]: z.infer<(typeof WhyThisDecisionInputSchema)[K]>;
494
- };
495
- interface WhyThisDecisionOutput {
496
- found: boolean;
497
- decision?: {
498
- id: string;
499
- type: string;
500
- scope: string;
501
- status: string;
502
- confidence: string;
503
- body: string;
504
- created_at: string;
505
- };
506
- /** Memories explicitly linked via related_ids on the decision (or vice versa). */
507
- related: Array<{
508
- id: string;
509
- type: string;
510
- scope: string;
511
- confidence: string;
512
- body_preview: string;
513
- relation: "explicit" | "back-link";
514
- }>;
515
- /** Other memories anchored to overlapping paths — implicit context. */
516
- path_neighbors: Array<{
517
- id: string;
518
- type: string;
519
- scope: string;
520
- confidence: string;
521
- overlap: string[];
522
- body_preview: string;
523
- }>;
524
- /** Recent git commits touching any of the decision's anchored paths. */
525
- recent_commits: Array<{
526
- path: string;
527
- sha: string;
528
- author: string;
529
- relative_date: string;
530
- subject: string;
531
- }>;
532
- hints?: string[];
533
- notice?: string;
534
- }
535
- /**
536
- * Trace the genealogy of a `decision` memory: the decision itself + memories
537
- * explicitly linked to it + memories anchored to overlapping paths + recent
538
- * commits touching those paths. One call instead of 4-5 manual lookups.
539
- *
540
- * Works on any memory type, but is optimized for `decision` and `architecture`.
541
- */
542
- declare function whyThisDecision(input: WhyThisDecisionInput, ctx: HaiveContext): Promise<WhyThisDecisionOutput>;
543
-
544
- declare const MemConflictsInputSchema: {
545
- id: z.ZodString;
546
- min_score: z.ZodDefault<z.ZodNumber>;
547
- semantic: z.ZodDefault<z.ZodBoolean>;
548
- };
549
- type MemConflictsInput = {
550
- [K in keyof typeof MemConflictsInputSchema]: z.infer<(typeof MemConflictsInputSchema)[K]>;
551
- };
552
- type ConflictReason = "opposite-status" | "attempt-vs-convention-same-paths" | "polarity-keywords" | "explicit-contradiction-tag";
553
- interface ConflictHit {
554
- id: string;
555
- type: string;
556
- scope: string;
557
- status: string;
558
- confidence: string;
559
- body_preview: string;
560
- similarity: number | null;
561
- reasons: ConflictReason[];
562
- shared_paths: string[];
563
- }
564
- interface MemConflictsOutput {
565
- found: boolean;
566
- target?: {
567
- id: string;
568
- type: string;
569
- status: string;
570
- };
571
- scanned: number;
572
- conflicts: ConflictHit[];
573
- notice?: string;
574
- }
575
- /**
576
- * Find memories that potentially CONTRADICT the given memory. Useful before
577
- * relying on a memory's advice — surfaces "another memory says the opposite".
578
- *
579
- * Detection layers (any of these triggers a hit):
580
- * - Opposite status: target is validated, neighbor is rejected — for the same topic
581
- * - Type mismatch on overlapping paths: an `attempt` (don't do X) coexists with
582
- * a `convention` (do X) anchored to overlapping paths
583
- * - Polarity keywords: target says "use X" while a semantic neighbor says "don't use X"
584
- * - Explicit contradiction tag (#contradicts:<id>) in either body
585
- */
586
- declare function memConflicts(input: MemConflictsInput, ctx: HaiveContext): Promise<MemConflictsOutput>;
587
-
588
445
  declare const PreCommitCheckInputSchema: {
589
446
  diff: z.ZodOptional<z.ZodString>;
590
447
  paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
@@ -648,6 +505,36 @@ interface ClassifiedAntiPatternsWarning extends AntiPatternsWarning {
648
505
  */
649
506
  declare function preCommitCheck(input: PreCommitCheckInput, ctx: HaiveContext): Promise<PreCommitCheckOutput>;
650
507
 
508
+ declare const ProposeSensorInputSchema: {
509
+ memory_id: z.ZodString;
510
+ kind: z.ZodDefault<z.ZodEnum<["regex", "shell", "test"]>>;
511
+ pattern: z.ZodOptional<z.ZodString>;
512
+ command: z.ZodOptional<z.ZodString>;
513
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
514
+ absent: z.ZodOptional<z.ZodString>;
515
+ bad_example: z.ZodOptional<z.ZodString>;
516
+ severity: z.ZodDefault<z.ZodEnum<["warn", "block"]>>;
517
+ message: z.ZodOptional<z.ZodString>;
518
+ flags: z.ZodOptional<z.ZodString>;
519
+ paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
520
+ };
521
+ type ProposeSensorInput = {
522
+ [K in keyof typeof ProposeSensorInputSchema]: z.infer<(typeof ProposeSensorInputSchema)[K]>;
523
+ };
524
+ interface ProposeSensorOutput {
525
+ accepted: boolean;
526
+ memory_id: string;
527
+ severity: "warn" | "block";
528
+ /** Set when rejected — why, and how to revise. */
529
+ reason?: string;
530
+ guidance?: string;
531
+ self_check: {
532
+ silent_on_current: boolean;
533
+ fires_on_bad: boolean | null;
534
+ fired_on: string[];
535
+ };
536
+ file_path?: string;
537
+ }
651
538
  /**
652
539
  * Read the PRESUMED-CORRECT contents of anchored files for sensor self-checks.
653
540
  *
@@ -658,34 +545,75 @@ declare function preCommitCheck(input: PreCommitCheckInput, ctx: HaiveContext):
658
545
  * presumed-correct baseline; fall back to the working tree for files not yet in git.
659
546
  */
660
547
  declare function readPresumedCorrectTargets(root: string, relPaths: string[]): Promise<SensorTarget[]>;
548
+ declare function proposeSensor(input: ProposeSensorInput, ctx: HaiveContext): Promise<ProposeSensorOutput>;
661
549
 
662
- declare const PatternDetectInputSchema: {
663
- since_days: z.ZodDefault<z.ZodNumber>;
664
- dry_run: z.ZodDefault<z.ZodBoolean>;
665
- scope: z.ZodDefault<z.ZodEnum<["personal", "team"]>>;
666
- };
667
- type PatternDetectInput = {
668
- [K in keyof typeof PatternDetectInputSchema]: z.infer<(typeof PatternDetectInputSchema)[K]>;
669
- };
670
- type PatternKind = "config_change" | "repeated_path" | "hot_file";
671
- interface PatternMatch {
672
- kind: PatternKind;
673
- signal: string;
674
- proposed_type: "convention" | "gotcha";
675
- proposed_slug: string;
676
- proposed_body: string;
677
- anchor_paths: string[];
678
- }
679
- interface PatternDetectOutput {
680
- scanned_events: number;
681
- matches: PatternMatch[];
682
- /** Number of proposed memories saved (0 if dry_run). */
683
- saved: number;
684
- /** IDs of saved memories. */
685
- saved_ids: string[];
686
- notice?: string;
550
+ declare const MemTriedInputSchema: {
551
+ what: z.ZodString;
552
+ why_failed: z.ZodString;
553
+ instead: z.ZodOptional<z.ZodString>;
554
+ scope: z.ZodDefault<z.ZodEnum<["personal", "team", "module"]>>;
555
+ module: z.ZodOptional<z.ZodString>;
556
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
557
+ paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
558
+ author: z.ZodOptional<z.ZodString>;
559
+ sensor: z.ZodOptional<z.ZodObject<{
560
+ kind: z.ZodDefault<z.ZodEnum<["regex", "shell", "test"]>>;
561
+ pattern: z.ZodOptional<z.ZodString>;
562
+ command: z.ZodOptional<z.ZodString>;
563
+ timeout_ms: z.ZodOptional<z.ZodNumber>;
564
+ absent: z.ZodOptional<z.ZodString>;
565
+ severity: z.ZodDefault<z.ZodEnum<["warn", "block"]>>;
566
+ message: z.ZodOptional<z.ZodString>;
567
+ bad_example: z.ZodOptional<z.ZodString>;
568
+ }, "strip", z.ZodTypeAny, {
569
+ kind: "regex" | "shell" | "test";
570
+ severity: "warn" | "block";
571
+ pattern?: string | undefined;
572
+ message?: string | undefined;
573
+ command?: string | undefined;
574
+ timeout_ms?: number | undefined;
575
+ absent?: string | undefined;
576
+ bad_example?: string | undefined;
577
+ }, {
578
+ pattern?: string | undefined;
579
+ message?: string | undefined;
580
+ kind?: "regex" | "shell" | "test" | undefined;
581
+ command?: string | undefined;
582
+ timeout_ms?: number | undefined;
583
+ absent?: string | undefined;
584
+ severity?: "warn" | "block" | undefined;
585
+ bad_example?: string | undefined;
586
+ }>>;
587
+ };
588
+ type MemTriedInput = {
589
+ [K in keyof typeof MemTriedInputSchema]: z.infer<(typeof MemTriedInputSchema)[K]>;
590
+ };
591
+ interface MemTriedOutput {
592
+ id: string;
593
+ scope: string;
594
+ file_path: string;
595
+ /**
596
+ * A captured attempt closes its prevention loop (gate can block the repeat) only once a sensor is
597
+ * VALIDATED via propose_sensor. True until then — the lesson is briefed but not enforced.
598
+ */
599
+ loop_open: boolean;
600
+ /** Heuristic candidate to PRE-FILL a propose_sensor call (refine, then call it). Never a persisted sensor. */
601
+ proposed_sensor_seed?: {
602
+ pattern: string;
603
+ absent?: string;
604
+ message: string;
605
+ };
606
+ /** Next-step guidance: how to close the loop via propose_sensor. */
607
+ hint?: string;
608
+ /** When input.sensor was given: the inline propose_sensor verdict (accepted ⇒ loop closed). */
609
+ sensor_result?: {
610
+ accepted: boolean;
611
+ severity: "warn" | "block";
612
+ reason?: string;
613
+ guidance?: string;
614
+ };
687
615
  }
688
- declare function patternDetect(input: PatternDetectInput, ctx: HaiveContext): Promise<PatternDetectOutput>;
616
+ declare function memTried(input: MemTriedInput, ctx: HaiveContext): Promise<MemTriedOutput>;
689
617
 
690
618
  /** Input is intentionally minimal — callers may pass cwd for multi-root clients. */
691
619
  declare const MemResolveProjectInputSchema: {
@@ -764,36 +692,12 @@ declare function memConflictCandidates(input: MemConflictCandidatesInput, ctx: H
764
692
  notice: string | undefined;
765
693
  }>;
766
694
 
767
- declare const RuntimeJournalAppendInputSchema: {
768
- message: z.ZodString;
769
- kind: z.ZodDefault<z.ZodEnum<["note", "session_end", "mcp"]>>;
770
- tool: z.ZodOptional<z.ZodString>;
771
- };
772
- type RuntimeJournalAppendInput = {
773
- [K in keyof typeof RuntimeJournalAppendInputSchema]: z.infer<(typeof RuntimeJournalAppendInputSchema)[K]>;
774
- };
775
- declare function runtimeJournalAppend(input: RuntimeJournalAppendInput, ctx: HaiveContext): Promise<{
776
- ok: true;
777
- path_hint: string;
778
- }>;
779
-
780
- declare const RuntimeJournalTailInputSchema: {
781
- limit: z.ZodDefault<z.ZodNumber>;
782
- };
783
- type RuntimeJournalTailInput = {
784
- [K in keyof typeof RuntimeJournalTailInputSchema]: z.infer<(typeof RuntimeJournalTailInputSchema)[K]>;
785
- };
786
- declare function runtimeJournalTail(input: RuntimeJournalTailInput, ctx: HaiveContext): Promise<{
787
- entries: Awaited<ReturnType<typeof readRuntimeJournalTail>>;
788
- empty?: boolean;
789
- }>;
790
-
791
695
  declare const SERVER_NAME = "hivelore";
792
696
  declare const SERVER_VERSION: string;
793
697
  type ToolProfile = "enforcement" | "maintenance" | "experimental" | "full";
794
698
  declare const ENFORCEMENT_PROFILE_TOOLS: readonly ["get_briefing", "mem_save", "mem_tried", "mem_search", "mem_get", "mem_verify", "mem_relevant_to", "code_map", "code_search", "pre_commit_check", "mem_session_end", "propose_sensor"];
795
699
  declare const MAINTENANCE_PROFILE_TOOLS: readonly ["get_briefing", "mem_save", "mem_tried", "mem_search", "mem_get", "mem_verify", "mem_relevant_to", "code_map", "code_search", "pre_commit_check", "mem_session_end", "propose_sensor", "mem_suggest_topic", "mem_for_files", "mem_list", "get_project_context", "bootstrap_project_save", "mem_resolve_project", "mem_update", "mem_approve", "mem_reject", "mem_pending", "mem_delete", "mem_diff", "get_recap", "anti_patterns_check", "mem_distill", "mem_timeline", "mem_conflict_candidates", "mem_feedback", "ingest_findings"];
796
- declare const EXPERIMENTAL_PROFILE_TOOLS: readonly ["get_briefing", "mem_save", "mem_tried", "mem_search", "mem_get", "mem_verify", "mem_relevant_to", "code_map", "code_search", "pre_commit_check", "mem_session_end", "propose_sensor", "mem_suggest_topic", "mem_for_files", "mem_list", "get_project_context", "bootstrap_project_save", "mem_resolve_project", "mem_update", "mem_approve", "mem_reject", "mem_pending", "mem_delete", "mem_diff", "get_recap", "anti_patterns_check", "mem_distill", "mem_timeline", "mem_conflict_candidates", "mem_feedback", "ingest_findings", "mem_observe", "why_this_file", "why_this_decision", "mem_conflicts_with", "pattern_detect", "runtime_journal_append", "runtime_journal_tail"];
700
+ declare const EXPERIMENTAL_PROFILE_TOOLS: readonly ["get_briefing", "mem_save", "mem_tried", "mem_search", "mem_get", "mem_verify", "mem_relevant_to", "code_map", "code_search", "pre_commit_check", "mem_session_end", "propose_sensor", "mem_suggest_topic", "mem_for_files", "mem_list", "get_project_context", "bootstrap_project_save", "mem_resolve_project", "mem_update", "mem_approve", "mem_reject", "mem_pending", "mem_delete", "mem_diff", "get_recap", "anti_patterns_check", "mem_distill", "mem_timeline", "mem_conflict_candidates", "mem_feedback", "ingest_findings"];
797
701
  declare const TOOL_PROFILES: Record<Exclude<ToolProfile, "full">, ReadonlySet<string>>;
798
702
  declare function getAllowedToolsForProfile(profile: ToolProfile): ReadonlySet<string>;
799
703
  declare function createHaiveServer(options?: CreateContextOptions): {
@@ -816,4 +720,4 @@ declare function runHaiveMcpStdio(options: {
816
720
  root?: string;
817
721
  }): Promise<void>;
818
722
 
819
- export { type AntiPatternsCheckInput, type AntiPatternsCheckOutput, type BriefingOutput, type CodeMapInput, type CodeMapToolOutput, type CodeSearchInput, type CodeSearchOutput, ENFORCEMENT_PROFILE_TOOLS, EXPERIMENTAL_PROFILE_TOOLS, type GetBriefingInput, type GetRecapInput, type GetRecapOutput, MAINTENANCE_PROFILE_TOOLS, type MemConflictCandidatesInput, type MemConflictsInput, type MemConflictsOutput, type MemDistillInput, type MemDistillOutput, type MemRelevantToInput, type MemRelevantToOutput, type MemResolveProjectInput, type MemSuggestTopicInput, type MemTimelineInput, type PatternDetectInput, type PatternDetectOutput, type PreCommitCheckInput, type PreCommitCheckOutput, type RuntimeJournalAppendInput, type RuntimeJournalTailInput, SERVER_NAME, SERVER_VERSION, TOOL_PROFILES, type ToolProfile, type WhyThisDecisionInput, type WhyThisDecisionOutput, type WhyThisFileInput, type WhyThisFileOutput, antiPatternsCheck, codeMapTool, codeSearch, createHaiveServer, getAllowedToolsForProfile, getBriefing, getRecap, memConflictCandidates, memConflicts, memDistill, memRelevantTo, memResolveProject, memSuggestTopic, memTimeline, parseMcpCliArgs, patternDetect, preCommitCheck, printHaiveMcpVersion, readPresumedCorrectTargets, runHaiveMcpStdio, runtimeJournalAppend, runtimeJournalTail, whyThisDecision, whyThisFile };
723
+ export { type AntiPatternsCheckInput, type AntiPatternsCheckOutput, type BriefingOutput, type CodeMapInput, type CodeMapToolOutput, type CodeSearchInput, type CodeSearchOutput, ENFORCEMENT_PROFILE_TOOLS, EXPERIMENTAL_PROFILE_TOOLS, type GetBriefingInput, type GetRecapInput, type GetRecapOutput, MAINTENANCE_PROFILE_TOOLS, type MemConflictCandidatesInput, type MemDistillInput, type MemDistillOutput, type MemRelevantToInput, type MemRelevantToOutput, type MemResolveProjectInput, type MemSuggestTopicInput, type MemTimelineInput, type MemTriedOutput, type PreCommitCheckInput, type PreCommitCheckOutput, type ProposeSensorOutput, SERVER_NAME, SERVER_VERSION, TOOL_PROFILES, type ToolProfile, antiPatternsCheck, codeMapTool, codeSearch, createHaiveServer, getAllowedToolsForProfile, getBriefing, getRecap, memConflictCandidates, memDistill, memRelevantTo, memResolveProject, memSuggestTopic, memTimeline, memTried, parseMcpCliArgs, preCommitCheck, printHaiveMcpVersion, proposeSensor, readPresumedCorrectTargets, runHaiveMcpStdio };