@hiveai/mcp 0.4.3 → 0.5.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,5 +1,6 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
- import { HaivePaths } from '@hiveai/core';
2
+ import { HaivePaths, ConfidenceLevel } from '@hiveai/core';
3
+ import { z } from 'zod';
3
4
 
4
5
  interface HaiveContext {
5
6
  paths: HaivePaths;
@@ -22,6 +23,308 @@ declare class SessionTracker {
22
23
  private registerShutdownHandler;
23
24
  }
24
25
 
26
+ declare const GetBriefingInputSchema: {
27
+ task: z.ZodOptional<z.ZodString>;
28
+ files: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
29
+ max_tokens: z.ZodDefault<z.ZodNumber>;
30
+ max_memories: z.ZodDefault<z.ZodNumber>;
31
+ include_project_context: z.ZodDefault<z.ZodBoolean>;
32
+ include_module_contexts: z.ZodDefault<z.ZodBoolean>;
33
+ semantic: z.ZodDefault<z.ZodBoolean>;
34
+ include_stale: z.ZodDefault<z.ZodBoolean>;
35
+ track: z.ZodDefault<z.ZodBoolean>;
36
+ format: z.ZodDefault<z.ZodEnum<["full", "compact"]>>;
37
+ symbols: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
38
+ min_semantic_score: z.ZodDefault<z.ZodNumber>;
39
+ };
40
+ type GetBriefingInput = {
41
+ [K in keyof typeof GetBriefingInputSchema]: z.infer<(typeof GetBriefingInputSchema)[K]>;
42
+ };
43
+ interface BriefingMemory {
44
+ id: string;
45
+ scope: string;
46
+ type: string;
47
+ module?: string;
48
+ tags: string[];
49
+ status: string;
50
+ confidence: ConfidenceLevel;
51
+ /** Present when confidence is 'low' or 'unverified' — AI should weight this memory cautiously. */
52
+ unverified?: true;
53
+ read_count: number;
54
+ reasons: Array<"anchor" | "module" | "domain" | "semantic">;
55
+ match_quality: "exact" | "partial" | "semantic";
56
+ semantic_score?: number;
57
+ body: string;
58
+ file_path: string;
59
+ }
60
+ interface CodeMapSymbolHit {
61
+ symbol: string;
62
+ /** files that export this symbol */
63
+ locations: Array<{
64
+ file: string;
65
+ kind: string;
66
+ line: number;
67
+ description?: string;
68
+ }>;
69
+ }
70
+ interface ActionRequiredItem {
71
+ /** Memory id containing the alert */
72
+ id: string;
73
+ /** Short human-readable summary of the issue */
74
+ summary: string;
75
+ /**
76
+ * The exact message to show the developer before doing anything.
77
+ * Copy-paste this verbatim — do NOT paraphrase or act before confirmation.
78
+ */
79
+ developer_message: string;
80
+ }
81
+ interface BriefingOutput {
82
+ task?: string;
83
+ search_mode: "semantic" | "literal_fallback" | "literal";
84
+ match_quality_note?: string;
85
+ inferred_modules: string[];
86
+ last_session?: {
87
+ id: string;
88
+ scope: string;
89
+ revision_count: number;
90
+ body: string;
91
+ };
92
+ project_context: {
93
+ content: string;
94
+ truncated: boolean;
95
+ is_template?: boolean;
96
+ auto_generated?: boolean;
97
+ } | null;
98
+ module_contexts: Array<{
99
+ name: string;
100
+ content: string;
101
+ truncated: boolean;
102
+ }>;
103
+ memories: BriefingMemory[];
104
+ symbol_locations?: CodeMapSymbolHit[];
105
+ /**
106
+ * Memories that require explicit human confirmation before any code action.
107
+ * IMPORTANT: for each item, show developer_message to the developer and
108
+ * wait for explicit approval before modifying any code.
109
+ * These are surfaced separately from memories to make them impossible to miss.
110
+ */
111
+ action_required: ActionRequiredItem[];
112
+ decay_warnings: string[];
113
+ setup_warnings: string[];
114
+ /**
115
+ * True when this briefing carries little actionable signal:
116
+ * - project-context.md is still the default template
117
+ * - no memories matched the task (or none exist at all)
118
+ * - no previous session recap
119
+ * Clients can use this flag to skip surfacing a near-empty briefing to the model.
120
+ */
121
+ low_value?: true;
122
+ /**
123
+ * Short, action-oriented hints surfaced to the agent based on the briefing payload.
124
+ * Examples: "haive is uninitialized — use Read/Grep directly", "gotcha memories present — read first".
125
+ * Always non-empty when low_value=true.
126
+ */
127
+ hints?: string[];
128
+ estimated_tokens: number;
129
+ budget: {
130
+ max_tokens: number;
131
+ spent: {
132
+ project: number;
133
+ modules: number;
134
+ memories: number;
135
+ };
136
+ };
137
+ }
138
+ declare function getBriefing(input: GetBriefingInput, ctx: HaiveContext): Promise<BriefingOutput>;
139
+
140
+ declare const CodeMapInputSchema: {
141
+ file: z.ZodOptional<z.ZodString>;
142
+ symbol: z.ZodOptional<z.ZodString>;
143
+ paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
144
+ max_files: z.ZodDefault<z.ZodNumber>;
145
+ max_tokens: z.ZodOptional<z.ZodNumber>;
146
+ };
147
+ type CodeMapInput = {
148
+ [K in keyof typeof CodeMapInputSchema]: z.infer<(typeof CodeMapInputSchema)[K]>;
149
+ };
150
+ interface CodeMapToolOutput {
151
+ available: boolean;
152
+ generated_at?: string;
153
+ total_files?: number;
154
+ files: Array<{
155
+ path: string;
156
+ summary?: string;
157
+ loc: number;
158
+ exports: Array<{
159
+ name: string;
160
+ kind: string;
161
+ description?: string;
162
+ line: number;
163
+ }>;
164
+ }>;
165
+ /** Number of matched files dropped due to max_files / max_tokens. */
166
+ truncated?: number;
167
+ /** True when at least one file was dropped to fit the token budget. */
168
+ budget_clipped?: true;
169
+ notice?: string;
170
+ }
171
+ declare function codeMapTool(input: CodeMapInput, ctx: HaiveContext): Promise<CodeMapToolOutput>;
172
+
173
+ declare const GetRecapInputSchema: {
174
+ scope: z.ZodDefault<z.ZodEnum<["personal", "team", "any"]>>;
175
+ };
176
+ type GetRecapInput = {
177
+ [K in keyof typeof GetRecapInputSchema]: z.infer<(typeof GetRecapInputSchema)[K]>;
178
+ };
179
+ interface GetRecapOutput {
180
+ recap: {
181
+ id: string;
182
+ scope: string;
183
+ revision_count: number;
184
+ created_at: string;
185
+ body: string;
186
+ } | null;
187
+ notice?: string;
188
+ }
189
+ /**
190
+ * Lightweight alternative to get_briefing when you ONLY need the previous
191
+ * session recap (e.g. resuming a long task between sessions). Skips project
192
+ * context, modules, and memory ranking — pays only the recap's token cost.
193
+ */
194
+ declare function getRecap(input: GetRecapInput, ctx: HaiveContext): Promise<GetRecapOutput>;
195
+
196
+ declare const MemRelevantToInputSchema: {
197
+ task: z.ZodString;
198
+ files: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
199
+ limit: z.ZodDefault<z.ZodNumber>;
200
+ min_semantic_score: z.ZodDefault<z.ZodNumber>;
201
+ format: z.ZodDefault<z.ZodEnum<["full", "compact"]>>;
202
+ };
203
+ type MemRelevantToInput = {
204
+ [K in keyof typeof MemRelevantToInputSchema]: z.infer<(typeof MemRelevantToInputSchema)[K]>;
205
+ };
206
+ interface MemRelevantToOutput {
207
+ task: string;
208
+ search_mode: "semantic" | "literal_fallback" | "literal";
209
+ memories: BriefingMemory[];
210
+ hints?: string[];
211
+ /**
212
+ * True when the search returned zero memories — clients can skip surfacing
213
+ * an empty payload to the model.
214
+ */
215
+ empty?: true;
216
+ }
217
+ /**
218
+ * One-shot ranked memories for a task. Use instead of get_briefing when you
219
+ * already have project context loaded and only want the relevant memory layer.
220
+ *
221
+ * Runs the same ranking (anchor / module / literal / semantic) as get_briefing
222
+ * but skips project_context, module_contexts, action_required, etc. — paying
223
+ * only the cost of the memory bodies you actually get back.
224
+ */
225
+ declare function memRelevantTo(input: MemRelevantToInput, ctx: HaiveContext): Promise<MemRelevantToOutput>;
226
+
227
+ declare const CodeSearchInputSchema: {
228
+ query: z.ZodString;
229
+ k: z.ZodDefault<z.ZodNumber>;
230
+ min_score: z.ZodDefault<z.ZodNumber>;
231
+ };
232
+ type CodeSearchInput = {
233
+ [K in keyof typeof CodeSearchInputSchema]: z.infer<(typeof CodeSearchInputSchema)[K]>;
234
+ };
235
+ interface CodeSearchHit {
236
+ file: string;
237
+ name: string;
238
+ kind: string;
239
+ line: number;
240
+ description?: string;
241
+ score: number;
242
+ }
243
+ interface CodeSearchOutput {
244
+ available: boolean;
245
+ hits: CodeSearchHit[];
246
+ notice?: string;
247
+ }
248
+ declare function codeSearch(input: CodeSearchInput, ctx: HaiveContext): Promise<CodeSearchOutput>;
249
+
250
+ declare const WhyThisFileInputSchema: {
251
+ path: z.ZodString;
252
+ git_log_limit: z.ZodDefault<z.ZodNumber>;
253
+ memory_limit: z.ZodDefault<z.ZodNumber>;
254
+ };
255
+ type WhyThisFileInput = {
256
+ [K in keyof typeof WhyThisFileInputSchema]: z.infer<(typeof WhyThisFileInputSchema)[K]>;
257
+ };
258
+ interface WhyThisFileOutput {
259
+ file: string;
260
+ exists: boolean;
261
+ recent_commits: Array<{
262
+ sha: string;
263
+ author: string;
264
+ relative_date: string;
265
+ subject: string;
266
+ }>;
267
+ memories: Array<{
268
+ id: string;
269
+ type: string;
270
+ scope: string;
271
+ confidence: string;
272
+ body_preview: string;
273
+ }>;
274
+ code_map_entry: {
275
+ summary?: string;
276
+ loc: number;
277
+ exports: Array<{
278
+ name: string;
279
+ kind: string;
280
+ line: number;
281
+ description?: string;
282
+ }>;
283
+ } | null;
284
+ hints?: string[];
285
+ }
286
+ /**
287
+ * One-shot file-context lookup: combines recent git history, memories anchored
288
+ * to the path, and the code-map entry. Designed to answer "why is this file
289
+ * the way it is?" in a single call instead of 3-4 manual ones.
290
+ */
291
+ declare function whyThisFile(input: WhyThisFileInput, ctx: HaiveContext): Promise<WhyThisFileOutput>;
292
+
293
+ declare const AntiPatternsCheckInputSchema: {
294
+ diff: z.ZodOptional<z.ZodString>;
295
+ paths: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
296
+ limit: z.ZodDefault<z.ZodNumber>;
297
+ semantic: z.ZodDefault<z.ZodBoolean>;
298
+ };
299
+ type AntiPatternsCheckInput = {
300
+ [K in keyof typeof AntiPatternsCheckInputSchema]: z.infer<(typeof AntiPatternsCheckInputSchema)[K]>;
301
+ };
302
+ interface AntiPatternsWarning {
303
+ id: string;
304
+ type: "attempt" | "gotcha";
305
+ scope: string;
306
+ confidence: string;
307
+ body_preview: string;
308
+ reasons: Array<"anchor" | "literal" | "semantic">;
309
+ semantic_score?: number;
310
+ }
311
+ interface AntiPatternsCheckOutput {
312
+ /** Total number of attempt+gotcha memories that exist in this project. */
313
+ scanned: number;
314
+ warnings: AntiPatternsWarning[];
315
+ notice?: string;
316
+ }
317
+ /**
318
+ * Scan a diff (or set of paths) against documented attempt/gotcha memories.
319
+ * Surfaces "you are about to repeat a known mistake" warnings BEFORE you commit.
320
+ *
321
+ * Matching strategy:
322
+ * 1. Anchor — memories anchored to any of the changed paths
323
+ * 2. Literal — tokens from the diff overlap with memory body
324
+ * 3. Semantic — cosine similarity (when enabled and index available)
325
+ */
326
+ declare function antiPatternsCheck(input: AntiPatternsCheckInput, ctx: HaiveContext): Promise<AntiPatternsCheckOutput>;
327
+
25
328
  declare const SERVER_NAME = "haive";
26
329
  declare const SERVER_VERSION: string;
27
330
  declare function createHaiveServer(options?: CreateContextOptions): {
@@ -30,4 +333,4 @@ declare function createHaiveServer(options?: CreateContextOptions): {
30
333
  tracker: SessionTracker;
31
334
  };
32
335
 
33
- export { SERVER_NAME, SERVER_VERSION, createHaiveServer };
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 };