@unson/brainbase-mcp 0.50.9 → 0.50.10

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.
@@ -88,6 +88,12 @@
88
88
  "event"
89
89
  ]
90
90
  },
91
+ {
92
+ "name": "personal_knowledge_reject",
93
+ "requiredInput": [
94
+ "event_id"
95
+ ]
96
+ },
91
97
  {
92
98
  "name": "personal_knowledge_search",
93
99
  "requiredInput": [
@@ -122,6 +128,7 @@
122
128
  "toolNames": [
123
129
  "personal_knowledge_context",
124
130
  "personal_knowledge_register",
131
+ "personal_knowledge_reject",
125
132
  "personal_knowledge_search"
126
133
  ]
127
134
  },
@@ -1,4 +1,4 @@
1
- /** The context header used by the v1 register and search contracts. */
1
+ /** The context header used by the v1 register, search, and reject contracts. */
2
2
  export declare const PERSONAL_KNOWLEDGE_CONTEXT_HEADER = "X-Brainbase-Personal-Context";
3
3
  export declare const PERSONAL_KNOWLEDGE_CONTEXT_VERSION_HEADER = "X-Brainbase-Personal-Context-Version";
4
4
  /** Short alias retained for consumers that call this a personal context header. */
@@ -126,6 +126,11 @@ export declare class PersonalKnowledgeClient {
126
126
  getContext(): Promise<PersonalKnowledgeContextEnvelope>;
127
127
  register(input: PersonalKnowledgeEventInput): Promise<PersonalKnowledgeRegisterEnvelope>;
128
128
  search(query: string, limit?: number): Promise<PersonalKnowledgeSearchEnvelope>;
129
+ reject(eventId: string): Promise<{
130
+ event_id: string;
131
+ action: 'reject';
132
+ semantic_state: 'retracted';
133
+ }>;
129
134
  private request;
130
135
  }
131
136
  export declare function createPersonalKnowledgeClient(options: PersonalKnowledgeClientOptions): PersonalKnowledgeClient;
@@ -4,7 +4,7 @@ import { hostname, userInfo } from 'node:os';
4
4
  import { chmod, open, mkdir, readFile, rename, rm, stat } from 'node:fs/promises';
5
5
  import { dirname, join } from 'node:path';
6
6
  import { resolveDataDir } from './paths.js';
7
- /** The context header used by the v1 register and search contracts. */
7
+ /** The context header used by the v1 register, search, and reject contracts. */
8
8
  export const PERSONAL_KNOWLEDGE_CONTEXT_HEADER = 'X-Brainbase-Personal-Context';
9
9
  export const PERSONAL_KNOWLEDGE_CONTEXT_VERSION_HEADER = 'X-Brainbase-Personal-Context-Version';
10
10
  /** Short alias retained for consumers that call this a personal context header. */
@@ -685,6 +685,23 @@ export class PersonalKnowledgeClient {
685
685
  });
686
686
  return assertSearchEnvelope(payload, this.expectedContext);
687
687
  }
688
+ async reject(eventId) {
689
+ if (typeof eventId !== 'string' || !eventId.trim()) {
690
+ throw new Error('Personal Knowledge rejection requires a non-empty event_id.');
691
+ }
692
+ const event_id = eventId.trim();
693
+ await this.getContext();
694
+ const receipt = await this.request('/api/personal-knowledge/feedback', {
695
+ method: 'POST',
696
+ body: { event_id, action: 'reject' },
697
+ expectedHeader: true
698
+ });
699
+ if (!isRecord(receipt) || receipt.event_id !== event_id || receipt.action !== 'reject'
700
+ || receipt.semantic_state !== 'retracted' || 'error' in receipt) {
701
+ throw new PersonalKnowledgeClientError('Personal Knowledge reject response schema is invalid.');
702
+ }
703
+ return { event_id, action: 'reject', semantic_state: 'retracted' };
704
+ }
688
705
  async request(path, options) {
689
706
  let token;
690
707
  try {
package/dist/server.d.ts CHANGED
@@ -195,6 +195,24 @@ export declare const toolDefinitions: readonly [{
195
195
  };
196
196
  };
197
197
  };
198
+ }, {
199
+ readonly name: "personal_knowledge_reject";
200
+ readonly description: "Retract an event through the authenticated Personal Knowledge API. Requires API storage; identity comes from trusted configuration. This is not physical deletion.";
201
+ readonly annotations: {
202
+ readonly readOnlyHint: false;
203
+ readonly destructiveHint: true;
204
+ };
205
+ readonly inputSchema: {
206
+ readonly type: "object";
207
+ readonly required: readonly ["event_id"];
208
+ readonly additionalProperties: false;
209
+ readonly properties: {
210
+ readonly event_id: {
211
+ readonly type: "string";
212
+ readonly minLength: 1;
213
+ };
214
+ };
215
+ };
198
216
  }, {
199
217
  readonly name: "personal_knowledge_search";
200
218
  readonly description: "Search the explicitly configured v1 personal knowledge context. The result includes the verified context and never falls back to another store.";
package/dist/server.js CHANGED
@@ -17,7 +17,7 @@ import { auditPersonalOsDirectory } from './ontology-ssot.js';
17
17
  import { getOntologyImpact, inferPersonalOs, portableOntology, resolveOntologyVersion } from './ontology.js';
18
18
  import { loadPersonalOs } from './ssot.js';
19
19
  import { getContext, listEntities, onboardingStatus, searchAll, searchPersonalKg } from './tools.js';
20
- import { createLocalPersonalKnowledgeStore, createPersonalKnowledgeClient, decodePersonalKnowledgeContextHeader, PERSONAL_KNOWLEDGE_CONTRACT_VERSION, validatePersonalKnowledgeContext } from './personal-knowledge.js';
20
+ import { createLocalPersonalKnowledgeStore, createPersonalKnowledgeClient, decodePersonalKnowledgeContextHeader, PERSONAL_KNOWLEDGE_CONTRACT_VERSION, validatePersonalKnowledgeContext, PersonalKnowledgeClient } from './personal-knowledge.js';
21
21
  const argsSchema = z.object({
22
22
  dataDir: z.string().optional(),
23
23
  query: z.string().optional(),
@@ -54,6 +54,7 @@ const personalKnowledgeEventSchema = z.object({
54
54
  tags: z.array(z.string().min(1)).optional(),
55
55
  metadata: z.record(z.string(), z.unknown()).optional()
56
56
  }).strict();
57
+ const personalKnowledgeRejectSchema = z.object({ event_id: z.string().trim().min(1) }).strict();
57
58
  const personalKnowledgeContextSchema = z.object({}).strict();
58
59
  const personalKnowledgeRegisterSchema = z.object({ event: personalKnowledgeEventSchema }).strict();
59
60
  const personalKnowledgeSearchSchema = z.object({
@@ -254,6 +255,17 @@ export const toolDefinitions = [
254
255
  }
255
256
  }
256
257
  },
258
+ {
259
+ name: 'personal_knowledge_reject',
260
+ description: 'Retract an event through the authenticated Personal Knowledge API. Requires API storage; identity comes from trusted configuration. This is not physical deletion.',
261
+ annotations: { readOnlyHint: false, destructiveHint: true },
262
+ inputSchema: {
263
+ type: 'object',
264
+ required: ['event_id'],
265
+ additionalProperties: false,
266
+ properties: { event_id: { type: 'string', minLength: 1 } }
267
+ }
268
+ },
257
269
  {
258
270
  name: 'personal_knowledge_search',
259
271
  description: 'Search the explicitly configured v1 personal knowledge context. The result includes the verified context and never falls back to another store.',
@@ -434,6 +446,7 @@ export const toolDefinitions = [
434
446
  const managedPersonalKnowledgeToolNames = new Set([
435
447
  'personal_knowledge_context',
436
448
  'personal_knowledge_register',
449
+ 'personal_knowledge_reject',
437
450
  'personal_knowledge_search'
438
451
  ]);
439
452
  function isPersonalKnowledgeTool(name) {
@@ -518,6 +531,14 @@ function configuredPersonalKnowledgeRuntime() {
518
531
  });
519
532
  }
520
533
  async function callPersonalKnowledgeTool(name, rawArgs) {
534
+ if (name === 'personal_knowledge_reject') {
535
+ const args = personalKnowledgeRejectSchema.parse(rawArgs ?? {});
536
+ const runtime = configuredPersonalKnowledgeRuntime();
537
+ if (!(runtime instanceof PersonalKnowledgeClient)) {
538
+ throw new Error('Personal Knowledge rejection requires authenticated API storage; local retraction is not supported.');
539
+ }
540
+ return runtime.reject(args.event_id);
541
+ }
521
542
  const runtime = configuredPersonalKnowledgeRuntime();
522
543
  if (name === 'personal_knowledge_context') {
523
544
  personalKnowledgeContextSchema.parse(rawArgs ?? {});
@@ -536,7 +557,7 @@ async function callPersonalKnowledgeTool(name, rawArgs) {
536
557
  export async function callBrainbaseTool(name, rawArgs = {}, options = {}) {
537
558
  const mode = configuredPersonalKnowledgeMode();
538
559
  if (mode === 'managed_cloud' && !isPersonalKnowledgeTool(name)) {
539
- throw new Error('managed_cloud Personal Knowledge MCP only permits personal_knowledge_context, personal_knowledge_register, and personal_knowledge_search.');
560
+ throw new Error('managed_cloud Personal Knowledge MCP only permits personal_knowledge_context, personal_knowledge_register, personal_knowledge_reject, and personal_knowledge_search.');
540
561
  }
541
562
  if (name.startsWith('foundation_'))
542
563
  return callFoundationPublicTool(name, rawArgs, options.foundation);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unson/brainbase-mcp",
3
- "version": "0.50.9",
3
+ "version": "0.50.10",
4
4
  "description": "Local-first Brainbase judgment OS that lets supported AI agents reuse a user's approved goals, priorities, decisions, and judgment criteria.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -644,5 +644,5 @@
644
644
  "url": "https://github.com/Unson-LLC/brainbase/issues"
645
645
  },
646
646
  "homepage": "https://github.com/Unson-LLC/brainbase#readme",
647
- "gitHead": "70cfdd6b6628a3cd90b1d73ca39e0dde1199ab40"
647
+ "gitHead": "8b31a34e40631ff8b30969043803ae7daf2884e6"
648
648
  }