@unson/brainbase-mcp 0.7.0 → 0.9.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.
Files changed (91) hide show
  1. package/README.md +1 -1
  2. package/contracts/foundation/graph-history.sql +634 -0
  3. package/contracts/judgment-dag/digest.json +2 -2
  4. package/contracts/judgment-value-proof/schema.json +43 -1
  5. package/dist/canonical-task-service.js +16 -5
  6. package/dist/cli.d.ts +2 -0
  7. package/dist/cli.js +107 -0
  8. package/dist/company-os-objectives.d.ts +11 -0
  9. package/dist/company-os-objectives.js +84 -47
  10. package/dist/foundation-authenticated-tools.d.ts +56 -0
  11. package/dist/foundation-authenticated-tools.js +347 -0
  12. package/dist/foundation-graph-http.d.ts +43 -0
  13. package/dist/foundation-graph-http.js +243 -0
  14. package/dist/foundation-graph-write.d.ts +90 -0
  15. package/dist/foundation-graph-write.js +447 -0
  16. package/dist/foundation-public-provider.d.ts +140 -0
  17. package/dist/foundation-public-provider.js +192 -0
  18. package/dist/graph-corrections.d.ts +157 -0
  19. package/dist/graph-corrections.js +620 -0
  20. package/dist/graph-foundation-reader.d.ts +60 -0
  21. package/dist/graph-foundation-reader.js +494 -0
  22. package/dist/graph-retrieval.d.ts +6 -1
  23. package/dist/graph-revision-reader.d.ts +80 -0
  24. package/dist/graph-revision-reader.js +246 -0
  25. package/dist/graph-web-http.d.ts +26 -0
  26. package/dist/graph-web-http.js +215 -0
  27. package/dist/graph-web.d.ts +364 -0
  28. package/dist/graph-web.js +639 -0
  29. package/dist/judgment-problem-snapshot.d.ts +30 -2
  30. package/dist/judgment-problem-snapshot.js +302 -6
  31. package/dist/judgment-value-proof-review.d.ts +166 -0
  32. package/dist/judgment-value-proof-review.js +437 -0
  33. package/dist/judgment-value-proof.d.ts +28 -1
  34. package/dist/judgment-value-proof.js +53 -8
  35. package/dist/knowledge-continuation.d.ts +127 -0
  36. package/dist/knowledge-continuation.js +446 -0
  37. package/dist/knowledge-lookup.d.ts +178 -0
  38. package/dist/knowledge-lookup.js +758 -0
  39. package/dist/local-web-fetch-bridge.d.ts +5 -0
  40. package/dist/local-web-fetch-bridge.js +37 -0
  41. package/dist/local-web-host.d.ts +109 -0
  42. package/dist/local-web-host.js +688 -0
  43. package/dist/local-web-security.d.ts +25 -0
  44. package/dist/local-web-security.js +95 -0
  45. package/dist/organization-graph.d.ts +15 -0
  46. package/dist/organization-graph.js +24 -4
  47. package/dist/personal-knowledge.d.ts +12 -0
  48. package/dist/personal-knowledge.js +29 -0
  49. package/dist/personal-memory-handover.d.ts +108 -0
  50. package/dist/personal-memory-handover.js +369 -0
  51. package/dist/philosophy-revision-reader.d.ts +85 -0
  52. package/dist/philosophy-revision-reader.js +241 -0
  53. package/dist/portable-graph.d.ts +24 -0
  54. package/dist/portable-graph.js +77 -0
  55. package/dist/server.d.ts +7 -2
  56. package/dist/server.js +9 -6
  57. package/dist/value-proof-review-http.d.ts +25 -0
  58. package/dist/value-proof-review-http.js +185 -0
  59. package/dist/world-model.d.ts +21 -3
  60. package/dist/world-model.js +94 -12
  61. package/package.json +94 -6
  62. package/ui/brainbase-tokens.css +56 -0
  63. package/ui/graph-own-share.js +367 -0
  64. package/ui/graph-projects-view.css +23 -0
  65. package/ui/graph-projects-view.js +730 -0
  66. package/ui/graph-registry-view.css +101 -0
  67. package/ui/graph-registry-view.js +804 -0
  68. package/ui/graph-view-shared.css +522 -0
  69. package/ui/graph-view-shared.js +1227 -0
  70. package/ui/judgment-view.css +119 -45
  71. package/ui/local-web-shell.css +396 -0
  72. package/ui/local-web-shell.js +378 -0
  73. package/ui/objective-editor-http-port.js +154 -0
  74. package/ui/objective-editor.css +180 -74
  75. package/ui/objective-editor.js +490 -43
  76. package/ui/outcome-knowledge.css +50 -14
  77. package/ui/outcome-knowledge.js +15 -1
  78. package/ui/value-proof-review.css +504 -0
  79. package/ui/value-proof-review.js +1104 -0
  80. package/ui/workspace-kit.css +485 -0
  81. package/ui/workspace-kit.js +229 -0
  82. package/ui/world-model-view.css +188 -0
  83. package/ui/world-model-view.js +486 -0
  84. package/ui/icons/mana/LICENSE.tabler.txt +0 -21
  85. package/ui/icons/mana/affiliate.svg +0 -20
  86. package/ui/icons/mana/brand-github.svg +0 -15
  87. package/ui/icons/mana/brand-google-drive.svg +0 -17
  88. package/ui/icons/mana/brand-slack.svg +0 -18
  89. package/ui/icons/mana/cpu.svg +0 -24
  90. package/ui/outcome-mana.css +0 -255
  91. package/ui/outcome-mana.js +0 -2325
@@ -0,0 +1,25 @@
1
+ import type { IncomingMessage, ServerResponse } from 'node:http';
2
+ /**
3
+ * Protections shared by every local single-owner Web host (the value-proof
4
+ * review host and the general local Web host). They have no login, so the
5
+ * loopback Host check, the per-launch token and the same-origin check are the
6
+ * whole boundary against another site in the owner's browser.
7
+ */
8
+ export declare const LOCAL_WEB_CONTENT_SECURITY_POLICY = "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
9
+ export declare class LocalWebHttpError extends Error {
10
+ readonly statusCode: number;
11
+ readonly code: string;
12
+ constructor(statusCode: number, code: string, message: string);
13
+ }
14
+ export declare function requestUrl(request: IncomingMessage): URL;
15
+ export declare function writeJson(response: ServerResponse, statusCode: number, body: unknown): void;
16
+ export declare function writeHttpError(response: ServerResponse, error: LocalWebHttpError): void;
17
+ export declare function tokenMatches(expected: string, received: string | string[] | undefined): boolean;
18
+ /** A browser always sends Origin on a cross-site write; it must name this Host. */
19
+ export declare function assertSameOrigin(request: IncomingMessage): void;
20
+ /** Reads the whole body but stops as soon as it exceeds the limit. */
21
+ export declare function readBoundedBody(request: IncomingMessage, limitBytes: number): Promise<Buffer>;
22
+ export declare function readJsonObjectBody(request: IncomingMessage, limitBytes: number): Promise<Record<string, unknown>>;
23
+ export declare const LOOPBACK_HOSTNAMES: readonly ["127.0.0.1", "localhost", "[::1]"];
24
+ /** Rejects rebound DNS names: the Host must be a loopback name for the port this connection arrived on. */
25
+ export declare function isLoopbackHost(request: IncomingMessage): boolean;
@@ -0,0 +1,95 @@
1
+ import { timingSafeEqual } from 'node:crypto';
2
+ /**
3
+ * Protections shared by every local single-owner Web host (the value-proof
4
+ * review host and the general local Web host). They have no login, so the
5
+ * loopback Host check, the per-launch token and the same-origin check are the
6
+ * whole boundary against another site in the owner's browser.
7
+ */
8
+ export const LOCAL_WEB_CONTENT_SECURITY_POLICY = "default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'self'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'";
9
+ export class LocalWebHttpError extends Error {
10
+ statusCode;
11
+ code;
12
+ constructor(statusCode, code, message) {
13
+ super(message);
14
+ this.statusCode = statusCode;
15
+ this.code = code;
16
+ this.name = 'LocalWebHttpError';
17
+ }
18
+ }
19
+ export function requestUrl(request) {
20
+ return new URL(request.url ?? '/', 'http://localhost');
21
+ }
22
+ export function writeJson(response, statusCode, body) {
23
+ if (response.headersSent)
24
+ return;
25
+ response.statusCode = statusCode;
26
+ response.setHeader('Content-Type', 'application/json; charset=utf-8');
27
+ response.setHeader('Cache-Control', 'no-store');
28
+ response.setHeader('X-Content-Type-Options', 'nosniff');
29
+ response.end(JSON.stringify(body));
30
+ }
31
+ export function writeHttpError(response, error) {
32
+ writeJson(response, error.statusCode, { error: { code: error.code, message: error.message } });
33
+ }
34
+ export function tokenMatches(expected, received) {
35
+ if (typeof received !== 'string')
36
+ return false;
37
+ const left = Buffer.from(expected);
38
+ const right = Buffer.from(received);
39
+ return left.length === right.length && timingSafeEqual(left, right);
40
+ }
41
+ /** A browser always sends Origin on a cross-site write; it must name this Host. */
42
+ export function assertSameOrigin(request) {
43
+ const origin = request.headers.origin;
44
+ if (origin === undefined)
45
+ return;
46
+ let host;
47
+ try {
48
+ host = new URL(origin).host;
49
+ }
50
+ catch {
51
+ throw new LocalWebHttpError(403, 'cross_origin_rejected', 'Origin is not allowed');
52
+ }
53
+ if (host !== request.headers.host)
54
+ throw new LocalWebHttpError(403, 'cross_origin_rejected', 'Origin is not allowed');
55
+ }
56
+ /** Reads the whole body but stops as soon as it exceeds the limit. */
57
+ export async function readBoundedBody(request, limitBytes) {
58
+ const chunks = [];
59
+ let size = 0;
60
+ for await (const chunk of request) {
61
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
62
+ size += buffer.length;
63
+ if (size > limitBytes)
64
+ throw new LocalWebHttpError(413, 'payload_too_large', 'Request body is too large');
65
+ chunks.push(buffer);
66
+ }
67
+ return Buffer.concat(chunks);
68
+ }
69
+ export async function readJsonObjectBody(request, limitBytes) {
70
+ const contentType = String(request.headers['content-type'] ?? '');
71
+ if (!contentType.toLowerCase().startsWith('application/json')) {
72
+ throw new LocalWebHttpError(415, 'unsupported_media_type', 'Content-Type must be application/json');
73
+ }
74
+ const body = await readBoundedBody(request, limitBytes);
75
+ let value;
76
+ try {
77
+ value = JSON.parse(body.toString('utf8'));
78
+ }
79
+ catch {
80
+ throw new LocalWebHttpError(400, 'invalid_json', 'Request body must be JSON');
81
+ }
82
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
83
+ throw new LocalWebHttpError(400, 'invalid_json', 'Request body must be a JSON object');
84
+ }
85
+ return value;
86
+ }
87
+ export const LOOPBACK_HOSTNAMES = ['127.0.0.1', 'localhost', '[::1]'];
88
+ /** Rejects rebound DNS names: the Host must be a loopback name for the port this connection arrived on. */
89
+ export function isLoopbackHost(request) {
90
+ const host = request.headers.host?.toLowerCase();
91
+ const port = request.socket.localPort;
92
+ if (host === undefined || port === undefined)
93
+ return false;
94
+ return LOOPBACK_HOSTNAMES.some((name) => host === `${name}:${port}` || (port === 80 && host === name));
95
+ }
@@ -41,6 +41,18 @@ export interface PortableGraphReadback {
41
41
  readonly bundle: unknown;
42
42
  readonly digest: string;
43
43
  }
44
+ /** One snapshot the organization stored for the token's owner. */
45
+ export interface PortableGraphListEntry {
46
+ readonly graphId: string;
47
+ readonly projectCode: string;
48
+ readonly digest: string;
49
+ readonly createdAt: string;
50
+ }
51
+ export interface PortableGraphList {
52
+ readonly bundles: readonly PortableGraphListEntry[];
53
+ /** The organization returned only its newest page. */
54
+ readonly truncated: boolean;
55
+ }
44
56
  export interface PortableGraphImportResult {
45
57
  readonly status: 'imported' | 'unchanged';
46
58
  readonly digest: string;
@@ -65,6 +77,7 @@ export interface OrganizationGraphClient {
65
77
  search(input: GraphRetrievalInput): Promise<GraphRetrievalResponse>;
66
78
  importPortableGraph(bundle: unknown): Promise<PortableGraphImportResult>;
67
79
  readPortableGraph(): Promise<PortableGraphReadback>;
80
+ listPortableGraphs(): Promise<PortableGraphList>;
68
81
  }
69
82
  /** Forward the existing Graph retrieval input unchanged inside the request envelope. */
70
83
  export declare function searchOrganizationGraph(config: OrganizationGraphConfig, input: GraphRetrievalInput): Promise<GraphRetrievalResponse>;
@@ -72,5 +85,7 @@ export declare function searchOrganizationGraph(config: OrganizationGraphConfig,
72
85
  export declare function importPortableGraph(config: OrganizationGraphConfig, bundle: unknown): Promise<PortableGraphImportResult>;
73
86
  /** Read and verify the complete organization-side bundle and its digest. */
74
87
  export declare function readPortableGraph(config: OrganizationGraphConfig): Promise<PortableGraphReadback>;
88
+ /** List the token owner's snapshots. The organization decides the owner; no project or Graph ID is sent. */
89
+ export declare function listPortableGraphs(config: OrganizationGraphConfig): Promise<PortableGraphList>;
75
90
  /** Validate the privacy boundary before any upload leaves the local process. */
76
91
  export declare function assertPortableGraphBundle(bundle: unknown): asserts bundle is PortableGraphBundle;
@@ -64,7 +64,8 @@ export function createOrganizationGraphClient(config) {
64
64
  return {
65
65
  search: (input) => searchOrganizationGraph(normalized, input),
66
66
  importPortableGraph: (bundle) => importPortableGraph(normalized, bundle),
67
- readPortableGraph: () => readPortableGraph(normalized)
67
+ readPortableGraph: () => readPortableGraph(normalized),
68
+ listPortableGraphs: () => listPortableGraphs(normalized)
68
69
  };
69
70
  }
70
71
  /** Forward the existing Graph retrieval input unchanged inside the request envelope. */
@@ -100,6 +101,21 @@ export async function readPortableGraph(config) {
100
101
  }
101
102
  return readback;
102
103
  }
104
+ /** List the token owner's snapshots. The organization decides the owner; no project or Graph ID is sent. */
105
+ export async function listPortableGraphs(config) {
106
+ const value = await requestJson(config, 'GET', route(config, 'list'));
107
+ const fields = ['graph_id', 'project_code', 'digest', 'created_at'];
108
+ if (!isRecord(value) || typeof value.truncated !== 'boolean' || !Array.isArray(value.bundles)
109
+ || value.bundles.some((entry) => !isRecord(entry) || fields.some((field) => typeof entry[field] !== 'string' || entry[field].trim() === ''))) {
110
+ throw new OrganizationGraphError('organization_graph_response_invalid', 'organization service returned an invalid bundle list');
111
+ }
112
+ return {
113
+ truncated: value.truncated,
114
+ bundles: value.bundles.map((entry) => ({
115
+ graphId: entry.graph_id, projectCode: entry.project_code, digest: entry.digest, createdAt: entry.created_at
116
+ }))
117
+ };
118
+ }
103
119
  /** Validate the privacy boundary before any upload leaves the local process. */
104
120
  export function assertPortableGraphBundle(bundle) {
105
121
  validatePortableGraph(bundle);
@@ -110,7 +126,7 @@ function parseGraphRetrievalResponse(value) {
110
126
  || (value.schemaVersion !== 1 && value.schemaVersion !== 2)
111
127
  || (value.status !== 'ok' && value.status !== 'migration_required')
112
128
  || typeof value.migrationRequired !== 'boolean'
113
- || value.authority !== 'organization_graph'
129
+ || (value.authority !== 'owner_private' && value.authority !== 'organization_graph')
114
130
  || typeof value.query !== 'string'
115
131
  || typeof value.asOf !== 'string'
116
132
  || !['semantic', 'lexical', 'seed'].includes(String(value.method))
@@ -135,7 +151,10 @@ function parseGraphRetrievalResponse(value) {
135
151
  || value.absenceConfirmed !== false) {
136
152
  throw new OrganizationGraphError('organization_graph_response_invalid', 'organization service returned a response outside the OSS GraphRetrievalResponse contract');
137
153
  }
138
- return value;
154
+ // This route searches only the token owner's own snapshot (the owner-private
155
+ // area), never the organization's shared Graph. A service from before the
156
+ // owner_private label answered organization_graph for the same area.
157
+ return { ...value, authority: 'owner_private' };
139
158
  }
140
159
  function parseImportResult(value) {
141
160
  if (!isRecord(value)
@@ -271,7 +290,8 @@ async function withTimeout(operation, controller, timeoutMs) {
271
290
  function route(config, suffix, query) {
272
291
  const base = new URL(config.url);
273
292
  const prefix = base.pathname.replace(/\/+$/u, '');
274
- const routePath = `${prefix}/api/info/graph/portable/${encodeURIComponent(config.graphId)}${suffix ? `/${suffix}` : ''}`;
293
+ const graphPath = suffix === 'list' ? '' : `/${encodeURIComponent(config.graphId)}${suffix ? `/${suffix}` : ''}`;
294
+ const routePath = `${prefix}/api/info/graph/portable${graphPath}`;
275
295
  const endpoint = new URL(routePath || '/', base.origin);
276
296
  for (const [key, value] of Object.entries(query ?? {}))
277
297
  endpoint.searchParams.set(key, value);
@@ -83,6 +83,18 @@ export interface PersonalKnowledgeStoreOptions {
83
83
  }
84
84
  export declare function createLocalPersonalKnowledgeStore(options?: PersonalKnowledgeStoreOptions): PersonalKnowledgeStore;
85
85
  export declare const createPersonalKnowledgeStore: typeof createLocalPersonalKnowledgeStore;
86
+ export interface LocalPersonalKnowledgeSnapshot extends PersonalKnowledgeContextEnvelope {
87
+ events: PersonalKnowledgeEvent[];
88
+ }
89
+ /**
90
+ * Read the local v1 store without creating it. Returns undefined when the
91
+ * store has never been created; a half-created store is an error.
92
+ */
93
+ export declare function readLocalPersonalKnowledgeEvents(options?: {
94
+ dataDir?: string;
95
+ }): Promise<LocalPersonalKnowledgeSnapshot | undefined>;
96
+ /** True when the value is a timestamp the v1 event contract accepts. */
97
+ export declare function isPersonalKnowledgeTimestamp(value: unknown): value is string;
86
98
  export interface PersonalKnowledgeClientOptions {
87
99
  mode: PersonalKnowledgeStorageMode;
88
100
  apiUrl: string;
@@ -412,6 +412,35 @@ export function createLocalPersonalKnowledgeStore(options = {}) {
412
412
  return new LocalPersonalKnowledgeStore(options);
413
413
  }
414
414
  export const createPersonalKnowledgeStore = createLocalPersonalKnowledgeStore;
415
+ /**
416
+ * Read the local v1 store without creating it. Returns undefined when the
417
+ * store has never been created; a half-created store is an error.
418
+ */
419
+ export async function readLocalPersonalKnowledgeEvents(options = {}) {
420
+ const directory = join(resolveDataDir(options.dataDir), PERSONAL_KNOWLEDGE_LOCAL_DIRECTORY);
421
+ const contextPath = join(directory, LOCAL_CONTEXT_FILE);
422
+ const eventsPath = join(directory, LOCAL_EVENTS_FILE);
423
+ const [contextExists, eventsExists] = await Promise.all([exists(contextPath), exists(eventsPath)]);
424
+ if (!contextExists && !eventsExists)
425
+ return undefined;
426
+ if (contextExists !== eventsExists)
427
+ throw new Error(`Partial Personal Knowledge v1 store in ${directory}.`);
428
+ const context = validatePersonalKnowledgeContext(JSON.parse(await readFile(contextPath, 'utf8')));
429
+ if (context.scope !== 'personal_owned') {
430
+ throw new Error('OSS local Personal Knowledge storage requires a personal_owned context.');
431
+ }
432
+ return { context, events: await readEventsFile(eventsPath) };
433
+ }
434
+ /** True when the value is a timestamp the v1 event contract accepts. */
435
+ export function isPersonalKnowledgeTimestamp(value) {
436
+ try {
437
+ validateTimestamp(value, 'timestamp');
438
+ return true;
439
+ }
440
+ catch {
441
+ return false;
442
+ }
443
+ }
415
444
  async function readEventsFile(path) {
416
445
  const serialized = await readFile(path, 'utf8');
417
446
  const events = [];
@@ -0,0 +1,108 @@
1
+ import { type PersonalKnowledgeContext } from './personal-knowledge.js';
2
+ /**
3
+ * Handover of personal memories from OSS Personal to an organization.
4
+ *
5
+ * The owner lists the memories kept on this machine and re-registers only the
6
+ * ones they choose into the organization's personal KG (organization_private,
7
+ * readable by the owner only). Nothing moves automatically: listing and the
8
+ * default preview never touch the network, and only selected memories are sent.
9
+ */
10
+ /** Local record of what the organization confirmed, relative to the data directory. */
11
+ export declare const MEMORY_REGISTRATION_RECEIPTS_FILE: string;
12
+ export type LocalMemoryStore = 'personal-knowledge-v1' | 'personal-kg';
13
+ export type MemoryRegistrationStatus = 'unregistered' | 'registered' | 'changed';
14
+ /**
15
+ * The event content sent for one memory. The organization event ID is added
16
+ * only when the destination is known (see organizationMemoryEventId).
17
+ * Local provenance such as file paths, local metadata, and local episode IDs
18
+ * is deliberately not part of it.
19
+ */
20
+ export interface MemoryRegistrationContent {
21
+ body: string;
22
+ body_hash: string;
23
+ source: {
24
+ system: 'brainbase-oss';
25
+ store: LocalMemoryStore;
26
+ };
27
+ source_pointer: {
28
+ memory_id: string;
29
+ };
30
+ occurred_at?: string;
31
+ captured_at?: string;
32
+ kind?: string;
33
+ type?: string;
34
+ tags?: string[];
35
+ sensitivity?: string;
36
+ }
37
+ export interface MemoryRegistrationReceipt {
38
+ schema_version: 1;
39
+ memory_id: string;
40
+ memory_digest: string;
41
+ event_id: string;
42
+ body_hash: string;
43
+ organization_id: string;
44
+ owner_person_id: string;
45
+ registered_at: string;
46
+ }
47
+ export interface LocalMemory {
48
+ /** Stable selection ID: `v1:<event_id>` or `legacy:<id>`. */
49
+ id: string;
50
+ store: LocalMemoryStore;
51
+ type: string | null;
52
+ preview: string;
53
+ /** Digest of exactly the content that would be sent; it changes when the memory changes. */
54
+ memoryDigest: string;
55
+ content: MemoryRegistrationContent;
56
+ status: MemoryRegistrationStatus;
57
+ /** Latest receipt for this memory: the matching one when registered, otherwise the newest. */
58
+ lastRegistration?: MemoryRegistrationReceipt;
59
+ }
60
+ export interface RegisteredMemory {
61
+ id: string;
62
+ eventId: string;
63
+ memoryDigest: string;
64
+ bodyHash: string;
65
+ }
66
+ export interface MemoryRegistrationResult {
67
+ organizationId: string;
68
+ ownerPersonId: string;
69
+ registered: RegisteredMemory[];
70
+ }
71
+ type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
72
+ export interface RegisterSelectedMemoriesOptions {
73
+ dataDir?: string;
74
+ ids: readonly string[];
75
+ /** Organization base URL and the member's signed Bearer token. */
76
+ organization: {
77
+ url: string;
78
+ token: string;
79
+ };
80
+ fetch?: FetchLike;
81
+ now?: () => Date;
82
+ timeoutMs?: number;
83
+ }
84
+ export declare class PersonalMemoryRegistrationError extends Error {
85
+ readonly memoryId: string;
86
+ readonly registered: RegisteredMemory[];
87
+ constructor(memoryId: string, reason: string, registered: RegisteredMemory[]);
88
+ }
89
+ /** Read both local memory stores and each memory's registration state. Never uses the network. */
90
+ export declare function listLocalMemories(dataDirInput?: string): Promise<LocalMemory[]>;
91
+ /** Pick exactly the requested memories, in request order, or fail before anything is sent. */
92
+ export declare function selectLocalMemories(memories: readonly LocalMemory[], ids: readonly string[]): LocalMemory[];
93
+ /**
94
+ * The organization event ID for a memory. It is derived from the memory's
95
+ * content and origin (memoryDigest) and from the authenticated destination,
96
+ * so re-sending the same memory to the same owner produces the same event,
97
+ * and another owner or organization never collides with it.
98
+ */
99
+ export declare function organizationMemoryEventId(context: PersonalKnowledgeContext, memoryDigest: string): string;
100
+ /** Send only the selected memories and record a receipt for each one the organization confirmed. */
101
+ export declare function registerSelectedMemories(options: RegisterSelectedMemoriesOptions): Promise<MemoryRegistrationResult>;
102
+ export declare function readMemoryRegistrationReceipts(dataDirInput?: string): Promise<MemoryRegistrationReceipt[]>;
103
+ export declare function renderMemoryList(memories: readonly LocalMemory[]): string;
104
+ export declare function memoryListJson(memories: readonly LocalMemory[]): unknown;
105
+ export declare function registrationPreviewJson(memories: readonly LocalMemory[]): unknown;
106
+ export declare function renderRegistrationPreview(memories: readonly LocalMemory[]): string;
107
+ export declare function renderRegistrationResult(result: MemoryRegistrationResult): string;
108
+ export {};