@unson/brainbase-mcp 0.49.1 → 0.50.1
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/contracts/brainbase-public-contract.v1.json +288 -0
- package/contracts/judgment-dag/digest.json +3 -3
- package/contracts/judgment-dag/source-lock.json +1 -1
- package/dist/meeting-minutes-http.js +35 -5
- package/dist/meeting-minutes-storage-http.js +33 -4
- package/dist/meeting-minutes.d.ts +31 -0
- package/dist/meeting-minutes.js +71 -1
- package/dist/meeting-source-connection.d.ts +33 -1
- package/dist/meeting-source-connection.js +124 -1
- package/dist/meeting-source-reader.d.ts +9 -0
- package/dist/meeting-source-reader.js +10 -3
- package/dist/ownership-survey.d.ts +28 -0
- package/dist/ownership-survey.js +60 -0
- package/dist/queue-task-tools.d.ts +114 -0
- package/dist/queue-task-tools.js +263 -0
- package/dist/testing/queue-task-reference-backend.d.ts +43 -0
- package/dist/testing/queue-task-reference-backend.js +157 -0
- package/dist/testing/queue-task-tools-contract.d.ts +33 -0
- package/dist/testing/queue-task-tools-contract.js +487 -0
- package/docs/architecture/judgment-dag-core.md +13 -8
- package/package.json +21 -5
- package/ui/judgment-history.js +0 -15
- package/ui/meeting-minutes.js +18 -5
- package/ui/world/world-canvas-ui.js +25 -5
- package/ui/world/world-view.css +58 -0
- package/ui/world/world-view.js +43 -14
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"package": {
|
|
4
|
+
"name": "@unson/brainbase-mcp",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"brainbase": "dist/cli.js",
|
|
9
|
+
"brainbase-mcp": "dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"mcp": {
|
|
13
|
+
"toolGroups": [
|
|
14
|
+
{
|
|
15
|
+
"id": "local",
|
|
16
|
+
"condition": "createServer() with both personal knowledge modes set to local",
|
|
17
|
+
"tools": [
|
|
18
|
+
{
|
|
19
|
+
"name": "audit_ontology",
|
|
20
|
+
"requiredInput": []
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "brainbase_onboarding_first_value",
|
|
24
|
+
"requiredInput": [
|
|
25
|
+
"action",
|
|
26
|
+
"runId"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "brainbase_onboarding_get",
|
|
31
|
+
"requiredInput": [
|
|
32
|
+
"runId"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "brainbase_onboarding_ingest",
|
|
37
|
+
"requiredInput": [
|
|
38
|
+
"candidates",
|
|
39
|
+
"runId",
|
|
40
|
+
"source"
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "brainbase_onboarding_review",
|
|
45
|
+
"requiredInput": [
|
|
46
|
+
"actions",
|
|
47
|
+
"runId"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "brainbase_onboarding_start",
|
|
52
|
+
"requiredInput": [
|
|
53
|
+
"sources",
|
|
54
|
+
"valueTarget"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "get_context",
|
|
59
|
+
"requiredInput": []
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "get_ontology",
|
|
63
|
+
"requiredInput": []
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "infer_decisions",
|
|
67
|
+
"requiredInput": []
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"name": "list_entities",
|
|
71
|
+
"requiredInput": []
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "onboarding_status",
|
|
75
|
+
"requiredInput": []
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "ontology_impact",
|
|
79
|
+
"requiredInput": []
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "personal_knowledge_context",
|
|
83
|
+
"requiredInput": []
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "personal_knowledge_register",
|
|
87
|
+
"requiredInput": [
|
|
88
|
+
"event"
|
|
89
|
+
]
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "personal_knowledge_search",
|
|
93
|
+
"requiredInput": [
|
|
94
|
+
"query"
|
|
95
|
+
]
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"name": "resolve_entity",
|
|
99
|
+
"requiredInput": [
|
|
100
|
+
"asOf",
|
|
101
|
+
"text"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "search",
|
|
106
|
+
"requiredInput": [
|
|
107
|
+
"query"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "search_personal_kg",
|
|
112
|
+
"requiredInput": [
|
|
113
|
+
"query"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "managed_cloud",
|
|
120
|
+
"condition": "createServer() with both personal knowledge modes set to managed_cloud",
|
|
121
|
+
"selectsFrom": "local",
|
|
122
|
+
"toolNames": [
|
|
123
|
+
"personal_knowledge_context",
|
|
124
|
+
"personal_knowledge_register",
|
|
125
|
+
"personal_knowledge_search"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"id": "foundation_connected",
|
|
130
|
+
"condition": "createServer({ foundation }) with both personal knowledge modes set to local",
|
|
131
|
+
"extends": "local",
|
|
132
|
+
"tools": [
|
|
133
|
+
{
|
|
134
|
+
"name": "foundation_describe",
|
|
135
|
+
"requiredInput": []
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "foundation_read",
|
|
139
|
+
"requiredInput": [
|
|
140
|
+
"id",
|
|
141
|
+
"revision",
|
|
142
|
+
"type"
|
|
143
|
+
]
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "foundation_validate_problem",
|
|
147
|
+
"requiredInput": [
|
|
148
|
+
"snapshot"
|
|
149
|
+
]
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"name": "foundation_validate_reference",
|
|
153
|
+
"requiredInput": [
|
|
154
|
+
"reference"
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"id": "queue_task_tools",
|
|
161
|
+
"condition": "createQueueTaskTools({ backend, resolveAgent }) with the reference backend",
|
|
162
|
+
"tools": [
|
|
163
|
+
{
|
|
164
|
+
"name": "attach_evidence",
|
|
165
|
+
"requiredInput": [
|
|
166
|
+
"expected_version",
|
|
167
|
+
"kind",
|
|
168
|
+
"ref",
|
|
169
|
+
"task_id"
|
|
170
|
+
]
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"name": "claim_next",
|
|
174
|
+
"requiredInput": []
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "claim_task",
|
|
178
|
+
"requiredInput": [
|
|
179
|
+
"task_id"
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"name": "get_task",
|
|
184
|
+
"requiredInput": [
|
|
185
|
+
"task_id"
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"name": "list_my_tasks",
|
|
190
|
+
"requiredInput": []
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "renew_claim",
|
|
194
|
+
"requiredInput": [
|
|
195
|
+
"task_id"
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"name": "update_status",
|
|
200
|
+
"requiredInput": [
|
|
201
|
+
"expected_version",
|
|
202
|
+
"task_id",
|
|
203
|
+
"to_status"
|
|
204
|
+
]
|
|
205
|
+
}
|
|
206
|
+
],
|
|
207
|
+
"releaseStatus": "unreleased"
|
|
208
|
+
}
|
|
209
|
+
],
|
|
210
|
+
"internalTools": [
|
|
211
|
+
{
|
|
212
|
+
"name": "foundation_adopt",
|
|
213
|
+
"requiredInput": [
|
|
214
|
+
"digest",
|
|
215
|
+
"id",
|
|
216
|
+
"revision",
|
|
217
|
+
"scope_id",
|
|
218
|
+
"type"
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "foundation_describe",
|
|
223
|
+
"requiredInput": [
|
|
224
|
+
"scope_id"
|
|
225
|
+
]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": "foundation_read",
|
|
229
|
+
"requiredInput": [
|
|
230
|
+
"id",
|
|
231
|
+
"revision",
|
|
232
|
+
"scope_id",
|
|
233
|
+
"type"
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
"name": "foundation_validate_problem",
|
|
238
|
+
"requiredInput": [
|
|
239
|
+
"scope_id",
|
|
240
|
+
"snapshot"
|
|
241
|
+
]
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"name": "foundation_validate_reference",
|
|
245
|
+
"requiredInput": [
|
|
246
|
+
"reference",
|
|
247
|
+
"scope_id"
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
]
|
|
251
|
+
},
|
|
252
|
+
"cli": {
|
|
253
|
+
"bin": "brainbase",
|
|
254
|
+
"commands": [
|
|
255
|
+
"doctor",
|
|
256
|
+
"graph:bundles",
|
|
257
|
+
"graph:upgrade",
|
|
258
|
+
"judgment:hook",
|
|
259
|
+
"judgment:install",
|
|
260
|
+
"mcp",
|
|
261
|
+
"memory:list",
|
|
262
|
+
"memory:register",
|
|
263
|
+
"onboard:agent",
|
|
264
|
+
"onboard:apply",
|
|
265
|
+
"onboard:candidates",
|
|
266
|
+
"onboard:demo",
|
|
267
|
+
"onboard:diagnose-sources",
|
|
268
|
+
"onboard:extract",
|
|
269
|
+
"onboard:import",
|
|
270
|
+
"onboard:init",
|
|
271
|
+
"onboard:install",
|
|
272
|
+
"onboard:plan",
|
|
273
|
+
"onboard:projects",
|
|
274
|
+
"onboard:recommend",
|
|
275
|
+
"onboard:routines",
|
|
276
|
+
"onboard:seed",
|
|
277
|
+
"onboard:skills",
|
|
278
|
+
"onboard:start",
|
|
279
|
+
"ontology:audit",
|
|
280
|
+
"ontology:migrate",
|
|
281
|
+
"ontology:show",
|
|
282
|
+
"web:serve"
|
|
283
|
+
],
|
|
284
|
+
"aliases": {
|
|
285
|
+
"review:serve": "web:serve"
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
},
|
|
14
14
|
{
|
|
15
15
|
"path": "contracts/judgment-dag/source-lock.json",
|
|
16
|
-
"sha256": "
|
|
16
|
+
"sha256": "e810c141907c9c8cf6a2e9faf48b185c101b0961b6cc9ed9be257d8db3d4aad0"
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"path": "docs/architecture/judgment-dag-core.md",
|
|
20
|
-
"sha256": "
|
|
20
|
+
"sha256": "c3d9c9020fc3013ea1018f89a9d4d5d04b7066e1b871a7a27b7ca624b43efc6f"
|
|
21
21
|
},
|
|
22
22
|
{
|
|
23
23
|
"path": "docs/management/judgment-dag-milestones.md",
|
|
@@ -28,5 +28,5 @@
|
|
|
28
28
|
"sha256": "38f2f0f783bba47f83950cdc286dc03a3e0ee6190b0fbb67d72002e0402c5805"
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
|
-
"digest": "
|
|
31
|
+
"digest": "0fd9169ce73843df02df995648b8d616f343639f4b46ad5ea4db85811f9b29a4"
|
|
32
32
|
}
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
{
|
|
73
73
|
"kind": "architecture",
|
|
74
74
|
"path": "docs/architecture/judgment-dag-core.md",
|
|
75
|
-
"sha256": "
|
|
75
|
+
"sha256": "c3d9c9020fc3013ea1018f89a9d4d5d04b7066e1b871a7a27b7ca624b43efc6f"
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
78
|
"kind": "milestones",
|
|
@@ -167,6 +167,24 @@ function withdrawInput(body, minutesId, key, fingerprint) {
|
|
|
167
167
|
...idempotencyFields(key, fingerprint)
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
+
function listOptionsFromQuery(params) {
|
|
171
|
+
const result = {};
|
|
172
|
+
const limitRaw = params.get('limit');
|
|
173
|
+
if (limitRaw !== null) {
|
|
174
|
+
const limit = Number(limitRaw);
|
|
175
|
+
if (!/^\d+$/u.test(limitRaw) || !Number.isInteger(limit) || limit < 1) {
|
|
176
|
+
throw new LocalWebHttpError(422, 'invalid_limit', 'limit must be a positive integer');
|
|
177
|
+
}
|
|
178
|
+
result.limit = limit;
|
|
179
|
+
}
|
|
180
|
+
const cursor = params.get('cursor');
|
|
181
|
+
if (cursor !== null) {
|
|
182
|
+
if (cursor.trim() === '')
|
|
183
|
+
throw new LocalWebHttpError(422, 'invalid_cursor', 'cursor must not be empty');
|
|
184
|
+
result.cursor = cursor;
|
|
185
|
+
}
|
|
186
|
+
return result;
|
|
187
|
+
}
|
|
170
188
|
export function createMeetingMinutesHttpHandler(options) {
|
|
171
189
|
if (!options || !options.store || typeof options.resolveContext !== 'function') {
|
|
172
190
|
throw new TypeError('store and resolveContext are required');
|
|
@@ -175,12 +193,22 @@ export function createMeetingMinutesHttpHandler(options) {
|
|
|
175
193
|
const bodyLimitBytes = options.bodyLimitBytes ?? DEFAULT_BODY_LIMIT_BYTES;
|
|
176
194
|
if (!Number.isInteger(bodyLimitBytes) || bodyLimitBytes <= 0)
|
|
177
195
|
throw new TypeError('bodyLimitBytes must be a positive integer');
|
|
178
|
-
async function execute(route, body, context, key, fingerprint) {
|
|
196
|
+
async function execute(route, body, context, key, fingerprint, listOptions = {}) {
|
|
179
197
|
try {
|
|
180
198
|
switch (route.kind) {
|
|
181
199
|
case 'collection':
|
|
182
|
-
if (body === undefined)
|
|
183
|
-
|
|
200
|
+
if (body === undefined) {
|
|
201
|
+
const page = await options.store.list_meetings(context, listOptions);
|
|
202
|
+
return {
|
|
203
|
+
statusCode: 200,
|
|
204
|
+
body: {
|
|
205
|
+
state: 'ready',
|
|
206
|
+
meetings: page.meetings,
|
|
207
|
+
absence_confirmed: true,
|
|
208
|
+
...(page.next_cursor === undefined ? {} : { next_cursor: page.next_cursor })
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
}
|
|
184
212
|
return { statusCode: 201, body: await options.store.create_meeting(createInput(body, key, fingerprint), context) };
|
|
185
213
|
case 'meeting':
|
|
186
214
|
return { statusCode: 200, body: await options.store.get_meeting(route.meetingId ?? '', context) };
|
|
@@ -233,7 +261,8 @@ export function createMeetingMinutesHttpHandler(options) {
|
|
|
233
261
|
}
|
|
234
262
|
}
|
|
235
263
|
return async (request, response) => {
|
|
236
|
-
const
|
|
264
|
+
const url = requestUrl(request);
|
|
265
|
+
const path = url.pathname;
|
|
237
266
|
const route = routeFor(path, basePath);
|
|
238
267
|
if (!route)
|
|
239
268
|
return false;
|
|
@@ -254,10 +283,11 @@ export function createMeetingMinutesHttpHandler(options) {
|
|
|
254
283
|
const body = method === 'POST' ? await readJsonObjectBody(request, bodyLimitBytes) : undefined;
|
|
255
284
|
const key = method === 'POST' ? idempotencyKey(request) : undefined;
|
|
256
285
|
const fingerprint = key === undefined ? undefined : requestFingerprint({ method, path, body: body ?? null });
|
|
286
|
+
const listOptions = route.kind === 'collection' && method === 'GET' ? listOptionsFromQuery(url.searchParams) : {};
|
|
257
287
|
// Idempotency is persisted by the domain store in the same CAS snapshot
|
|
258
288
|
// as the mutation. Keeping no result cache here ensures retries after a
|
|
259
289
|
// restart, and retries after ACL changes, are reauthorized by the store.
|
|
260
|
-
const result = await execute(route, body, context, key, fingerprint);
|
|
290
|
+
const result = await execute(route, body, context, key, fingerprint, listOptions);
|
|
261
291
|
writeJson(response, result.statusCode, result.body);
|
|
262
292
|
}
|
|
263
293
|
catch (error) {
|
|
@@ -53,6 +53,24 @@ function routeFor(pathname, basePath) {
|
|
|
53
53
|
}
|
|
54
54
|
return { kind: 'meeting' };
|
|
55
55
|
}
|
|
56
|
+
function listOptionsFromQuery(params) {
|
|
57
|
+
const options = {};
|
|
58
|
+
const limitRaw = params.get('limit');
|
|
59
|
+
if (limitRaw !== null) {
|
|
60
|
+
const limit = Number(limitRaw);
|
|
61
|
+
if (!/^\d+$/u.test(limitRaw) || !Number.isInteger(limit) || limit < 1) {
|
|
62
|
+
throw new LocalWebHttpError(422, 'invalid_limit', 'limit must be a positive integer');
|
|
63
|
+
}
|
|
64
|
+
options.limit = limit;
|
|
65
|
+
}
|
|
66
|
+
const cursor = params.get('cursor');
|
|
67
|
+
if (cursor !== null) {
|
|
68
|
+
if (cursor.trim() === '')
|
|
69
|
+
throw new LocalWebHttpError(422, 'invalid_cursor', 'cursor must not be empty');
|
|
70
|
+
options.cursor = cursor;
|
|
71
|
+
}
|
|
72
|
+
return options;
|
|
73
|
+
}
|
|
56
74
|
function canonicalJson(value) {
|
|
57
75
|
if (value === null || typeof value !== 'object')
|
|
58
76
|
return JSON.stringify(value);
|
|
@@ -212,12 +230,21 @@ export function createMeetingMinutesStorageHttpHandler(options) {
|
|
|
212
230
|
const bodyLimitBytes = options.bodyLimitBytes ?? DEFAULT_BODY_LIMIT_BYTES;
|
|
213
231
|
if (!Number.isInteger(bodyLimitBytes) || bodyLimitBytes <= 0)
|
|
214
232
|
throw new TypeError('bodyLimitBytes must be a positive integer');
|
|
215
|
-
async function execute(route, body, context, key, fingerprint) {
|
|
233
|
+
async function execute(route, body, context, key, fingerprint, listOptions = {}) {
|
|
216
234
|
try {
|
|
217
235
|
switch (route.kind) {
|
|
218
236
|
case 'collection': {
|
|
219
237
|
if (body === undefined) {
|
|
220
|
-
|
|
238
|
+
const page = await options.store.list_meetings(context, listOptions);
|
|
239
|
+
return {
|
|
240
|
+
statusCode: 200,
|
|
241
|
+
body: {
|
|
242
|
+
state: 'ready',
|
|
243
|
+
meetings: page.meetings,
|
|
244
|
+
absence_confirmed: true,
|
|
245
|
+
...(page.next_cursor === undefined ? {} : { next_cursor: page.next_cursor }),
|
|
246
|
+
},
|
|
247
|
+
};
|
|
221
248
|
}
|
|
222
249
|
const input = createInput(body, key, fingerprint);
|
|
223
250
|
return {
|
|
@@ -278,7 +305,8 @@ export function createMeetingMinutesStorageHttpHandler(options) {
|
|
|
278
305
|
}
|
|
279
306
|
}
|
|
280
307
|
return async (request, response) => {
|
|
281
|
-
const
|
|
308
|
+
const url = requestUrl(request);
|
|
309
|
+
const path = url.pathname;
|
|
282
310
|
const route = routeFor(path, basePath);
|
|
283
311
|
if (!route)
|
|
284
312
|
return false;
|
|
@@ -298,7 +326,8 @@ export function createMeetingMinutesStorageHttpHandler(options) {
|
|
|
298
326
|
const body = method === 'POST' ? await readJsonObjectBody(request, bodyLimitBytes) : undefined;
|
|
299
327
|
const key = method === 'POST' ? idempotencyKey(request) : undefined;
|
|
300
328
|
const fingerprint = key === undefined ? undefined : requestFingerprint({ method, path, body: body ?? null });
|
|
301
|
-
const
|
|
329
|
+
const listOptions = route.kind === 'collection' && method === 'GET' ? listOptionsFromQuery(url.searchParams) : {};
|
|
330
|
+
const result = await execute(route, body, context, key, fingerprint, listOptions);
|
|
302
331
|
writeJson(response, result.statusCode, result.body);
|
|
303
332
|
}
|
|
304
333
|
catch (error) {
|
|
@@ -3,6 +3,14 @@ export declare const MEETING_MINUTES_CONTRACT_VERSION: "brainbase.meeting-minute
|
|
|
3
3
|
export declare const MEETING_MINUTES_SNAPSHOT_VERSION: 1;
|
|
4
4
|
export declare const MEETING_MINUTES_SIDECAR: "meeting-minutes.json";
|
|
5
5
|
export declare const MEETING_MINUTES_BODY_DIGEST_ALGORITHM: "sha256";
|
|
6
|
+
/**
|
|
7
|
+
* A list page is bounded so one listing never has to serialize every meeting.
|
|
8
|
+
* The default applies when a caller asks for no limit, so an old caller that
|
|
9
|
+
* never paged keeps working while the response stays small; the maximum caps
|
|
10
|
+
* what a single page may request.
|
|
11
|
+
*/
|
|
12
|
+
export declare const MEETING_MINUTES_LIST_DEFAULT_LIMIT: 100;
|
|
13
|
+
export declare const MEETING_MINUTES_LIST_MAX_LIMIT: 500;
|
|
6
14
|
export type MeetingId = string;
|
|
7
15
|
export type MinutesId = string;
|
|
8
16
|
export type MinutesVersionId = string;
|
|
@@ -164,6 +172,23 @@ export interface MeetingMinutesDetail extends MeetingMinutesSummary {
|
|
|
164
172
|
readonly versions: readonly MinutesVersionRecord[];
|
|
165
173
|
readonly snapshot_revision: number;
|
|
166
174
|
}
|
|
175
|
+
/** Caller-supplied bounds for one listing page. Both fields are optional. */
|
|
176
|
+
export interface MeetingMinutesListOptions {
|
|
177
|
+
/** Maximum summaries in the page. Defaults to MEETING_MINUTES_LIST_DEFAULT_LIMIT, capped at the maximum. */
|
|
178
|
+
readonly limit?: number;
|
|
179
|
+
/** Opaque continuation token from a previous page's next_cursor. */
|
|
180
|
+
readonly cursor?: string;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* One listing page. `meetings` carries meeting and minutes-document summaries
|
|
184
|
+
* only — never a minutes version body. The body is read through get_meeting /
|
|
185
|
+
* the detail endpoint. `next_cursor` is present only while more readable
|
|
186
|
+
* meetings follow the page.
|
|
187
|
+
*/
|
|
188
|
+
export interface MeetingMinutesListPage {
|
|
189
|
+
readonly meetings: readonly MeetingMinutesSummary[];
|
|
190
|
+
readonly next_cursor?: string;
|
|
191
|
+
}
|
|
167
192
|
export type MeetingMinutesErrorCode = 'invalid_input' | 'not_found' | 'revision_conflict' | 'authorization_denied' | 'corrupt_record' | 'storage_unavailable' | 'readback_mismatch' | 'idempotency_conflict';
|
|
168
193
|
export declare class MeetingMinutesError extends Error {
|
|
169
194
|
readonly code: MeetingMinutesErrorCode;
|
|
@@ -191,7 +216,13 @@ export interface MeetingMinutesExternalSourceHook {
|
|
|
191
216
|
register(source_ref: MeetingMinutesSourceRef, identity: MeetingMinutesExternalSourceIdentity): Promise<void>;
|
|
192
217
|
}
|
|
193
218
|
export interface MeetingMinutesStore {
|
|
219
|
+
/**
|
|
220
|
+
* Without options the store returns every readable summary as an array, the
|
|
221
|
+
* shape every caller before 0.50.1 depends on. Passing options (even `{}`)
|
|
222
|
+
* opts into one bounded page with an optional `next_cursor`.
|
|
223
|
+
*/
|
|
194
224
|
list_meetings(context: MeetingMinutesRequestContext): Promise<readonly MeetingMinutesSummary[]>;
|
|
225
|
+
list_meetings(context: MeetingMinutesRequestContext, options: MeetingMinutesListOptions): Promise<MeetingMinutesListPage>;
|
|
195
226
|
create_meeting(input: MeetingCreateInput, context: MeetingMinutesRequestContext): Promise<MeetingMinutesDetail>;
|
|
196
227
|
create_minutes(meeting_id: MeetingId, input: CreateMinutesInput, context: MeetingMinutesRequestContext): Promise<MeetingMinutesDetail>;
|
|
197
228
|
get_meeting(meeting_id: MeetingId, context: MeetingMinutesRequestContext): Promise<MeetingMinutesDetail>;
|
package/dist/meeting-minutes.js
CHANGED
|
@@ -7,6 +7,14 @@ export const MEETING_MINUTES_CONTRACT_VERSION = 'brainbase.meeting-minutes.v1';
|
|
|
7
7
|
export const MEETING_MINUTES_SNAPSHOT_VERSION = 1;
|
|
8
8
|
export const MEETING_MINUTES_SIDECAR = 'meeting-minutes.json';
|
|
9
9
|
export const MEETING_MINUTES_BODY_DIGEST_ALGORITHM = 'sha256';
|
|
10
|
+
/**
|
|
11
|
+
* A list page is bounded so one listing never has to serialize every meeting.
|
|
12
|
+
* The default applies when a caller asks for no limit, so an old caller that
|
|
13
|
+
* never paged keeps working while the response stays small; the maximum caps
|
|
14
|
+
* what a single page may request.
|
|
15
|
+
*/
|
|
16
|
+
export const MEETING_MINUTES_LIST_DEFAULT_LIMIT = 100;
|
|
17
|
+
export const MEETING_MINUTES_LIST_MAX_LIMIT = 500;
|
|
10
18
|
export class MeetingMinutesError extends Error {
|
|
11
19
|
code;
|
|
12
20
|
constructor(code, message) {
|
|
@@ -636,6 +644,29 @@ function findExternalSourceIdentity(snapshot, source) {
|
|
|
636
644
|
return undefined;
|
|
637
645
|
return { meeting_id: match.meeting_id, minutes_id: match.minutes_id, version_id: match.version_id };
|
|
638
646
|
}
|
|
647
|
+
function encodeListCursor(meetingId) {
|
|
648
|
+
return Buffer.from(meetingId, 'utf8').toString('base64url');
|
|
649
|
+
}
|
|
650
|
+
function decodeListCursor(value) {
|
|
651
|
+
const token = nonEmptyString(value, 'cursor');
|
|
652
|
+
const decoded = Buffer.from(token, 'base64url').toString('utf8');
|
|
653
|
+
if (decoded.trim() === '')
|
|
654
|
+
throw invalid('cursor is invalid');
|
|
655
|
+
return decoded;
|
|
656
|
+
}
|
|
657
|
+
function normalizeListOptions(options) {
|
|
658
|
+
if (!isRecord(options))
|
|
659
|
+
throw invalid('list options must be an object');
|
|
660
|
+
let limit = MEETING_MINUTES_LIST_DEFAULT_LIMIT;
|
|
661
|
+
if (options.limit !== undefined) {
|
|
662
|
+
if (typeof options.limit !== 'number' || !Number.isInteger(options.limit) || options.limit < 1) {
|
|
663
|
+
throw invalid('limit must be a positive integer');
|
|
664
|
+
}
|
|
665
|
+
limit = Math.min(options.limit, MEETING_MINUTES_LIST_MAX_LIMIT);
|
|
666
|
+
}
|
|
667
|
+
const startAfter = options.cursor === undefined ? undefined : decodeListCursor(options.cursor);
|
|
668
|
+
return { limit, startAfter };
|
|
669
|
+
}
|
|
639
670
|
export function createMeetingMinutesStore(options) {
|
|
640
671
|
const storage = defaultStorage(options);
|
|
641
672
|
const now = options.now ?? (() => new Date());
|
|
@@ -711,8 +742,16 @@ export function createMeetingMinutesStore(options) {
|
|
|
711
742
|
// never make the caller retry a write that is already durable.
|
|
712
743
|
}
|
|
713
744
|
}
|
|
714
|
-
async function list_meetings(context) {
|
|
745
|
+
async function list_meetings(context, options) {
|
|
715
746
|
assertPrincipal(context);
|
|
747
|
+
if (options === undefined)
|
|
748
|
+
return listAllMeetings(context);
|
|
749
|
+
return listMeetingsPage(context, options);
|
|
750
|
+
}
|
|
751
|
+
// The array form callers relied on before paging existed (organization
|
|
752
|
+
// server-parts read it with Array.isArray). It stays unbounded on purpose:
|
|
753
|
+
// callers that need bounded responses pass options and get a page.
|
|
754
|
+
async function listAllMeetings(context) {
|
|
716
755
|
const snapshot = await readSnapshot();
|
|
717
756
|
const output = [];
|
|
718
757
|
for (const meeting of snapshot.meetings) {
|
|
@@ -722,6 +761,37 @@ export function createMeetingMinutesStore(options) {
|
|
|
722
761
|
}
|
|
723
762
|
return freezeClone(output);
|
|
724
763
|
}
|
|
764
|
+
async function listMeetingsPage(context, options) {
|
|
765
|
+
const { limit, startAfter } = normalizeListOptions(options);
|
|
766
|
+
const snapshot = await readSnapshot();
|
|
767
|
+
const meetings = snapshot.meetings;
|
|
768
|
+
// Meetings are only ever appended, so their stored order is stable and a
|
|
769
|
+
// cursor can resume after a known meeting_id. An unknown cursor cannot be
|
|
770
|
+
// resumed safely, so it is rejected rather than silently restarted.
|
|
771
|
+
let index = 0;
|
|
772
|
+
if (startAfter !== undefined) {
|
|
773
|
+
const found = meetings.findIndex((meeting) => meeting.meeting_id === startAfter);
|
|
774
|
+
if (found === -1)
|
|
775
|
+
throw invalid('cursor is invalid');
|
|
776
|
+
index = found + 1;
|
|
777
|
+
}
|
|
778
|
+
const output = [];
|
|
779
|
+
let next_cursor;
|
|
780
|
+
for (; index < meetings.length; index += 1) {
|
|
781
|
+
const meeting = meetings[index];
|
|
782
|
+
if (!(await canReadMeeting(snapshot, meeting, context)))
|
|
783
|
+
continue;
|
|
784
|
+
if (output.length < limit) {
|
|
785
|
+
output.push(summary(snapshot, meeting));
|
|
786
|
+
continue;
|
|
787
|
+
}
|
|
788
|
+
// A full page has at least one more readable meeting after it, so the
|
|
789
|
+
// last returned meeting_id becomes the continuation token.
|
|
790
|
+
next_cursor = encodeListCursor(output[output.length - 1].meeting.meeting_id);
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
793
|
+
return freezeClone({ meetings: output, ...(next_cursor === undefined ? {} : { next_cursor }) });
|
|
794
|
+
}
|
|
725
795
|
async function canReadMeeting(snapshot, meeting, context) {
|
|
726
796
|
if (!(await allowed(authorizer, 'read', meeting, context)))
|
|
727
797
|
return false;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
|
|
2
2
|
import type { AuthorizationServerMetadata, OAuthClientInformationMixed, OAuthTokens } from '@modelcontextprotocol/sdk/shared/auth.js';
|
|
3
3
|
import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
|
|
4
|
-
import { type MeetingSourceAccessDetail, type MeetingSourceCallTool, type MeetingSourceFailure, type MeetingSourceFailureReason, type MeetingSourceMeeting, type MeetingSourceProvider, type MeetingSourceSegment, type TactiqTranscriptBudget, type TactiqTranscriptRead } from './meeting-source-reader.js';
|
|
4
|
+
import { type MeetingSourceAccessDetail, type MeetingSourceCallTool, type MeetingSourceFailure, type MeetingSourceFailureReason, type MeetingSourceMeeting, type MeetingSourceProvider, type MeetingSourceSegment, type MeetingSourceSummaryState, type TactiqTranscriptBudget, type TactiqTranscriptRead } from './meeting-source-reader.js';
|
|
5
5
|
import type { OrganizationConnectionBinding, OrganizationConnectionProviderAdapter } from './organization-connection.js';
|
|
6
6
|
export declare const MEETING_SOURCE_LIST_REVISION = 2;
|
|
7
7
|
export declare const MEETING_SOURCE_RELIST_LOOKBACK_MS: number;
|
|
@@ -152,6 +152,25 @@ export interface MeetingSourceDeliveredMeeting {
|
|
|
152
152
|
version: number;
|
|
153
153
|
deliveredAt: string;
|
|
154
154
|
}
|
|
155
|
+
/**
|
|
156
|
+
* The provider's own meeting summary (Tactiq `detailedSummary`, Plaud `get_note`)
|
|
157
|
+
* saved beside the transcript. It is never merged into the transcript text. A
|
|
158
|
+
* `generating` summary is saved as unfinished and re-read on a later sync.
|
|
159
|
+
*/
|
|
160
|
+
export interface MeetingSourceDeliveredSummary {
|
|
161
|
+
state: MeetingSourceSummaryState;
|
|
162
|
+
text: string | null;
|
|
163
|
+
jobId: string | null;
|
|
164
|
+
retrievedAt: string;
|
|
165
|
+
}
|
|
166
|
+
/** A summary that was generating or unreadable when its transcript was delivered. */
|
|
167
|
+
export interface MeetingSourcePendingSummary {
|
|
168
|
+
meeting: MeetingSourceMeeting;
|
|
169
|
+
jobId: string | null;
|
|
170
|
+
retryAt: string | null;
|
|
171
|
+
attempts: number;
|
|
172
|
+
firstSeenAt: string;
|
|
173
|
+
}
|
|
155
174
|
export interface MeetingSourceSyncState {
|
|
156
175
|
schemaVersion: 1;
|
|
157
176
|
connectionId: string;
|
|
@@ -161,6 +180,15 @@ export interface MeetingSourceSyncState {
|
|
|
161
180
|
/** List-reader revision that produced listedThrough; older cursors are re-listed once. */
|
|
162
181
|
listRevision?: number;
|
|
163
182
|
pending: MeetingSourcePendingMeeting[];
|
|
183
|
+
/** Delivered meetings whose provider summary was generating or unreadable; re-read later. */
|
|
184
|
+
pendingSummaries?: MeetingSourcePendingSummary[];
|
|
185
|
+
/** Terminal summary retries; never suppresses transcript re-checks. */
|
|
186
|
+
unobtainableSummaries?: Array<{
|
|
187
|
+
meetingId: string;
|
|
188
|
+
reason: 'summary_retry_exhausted';
|
|
189
|
+
message: string;
|
|
190
|
+
decidedAt: string;
|
|
191
|
+
}>;
|
|
164
192
|
unobtainable: Array<{
|
|
165
193
|
meetingId: string;
|
|
166
194
|
reason: string;
|
|
@@ -194,6 +222,8 @@ export interface MeetingSourceDelivery {
|
|
|
194
222
|
segments: MeetingSourceSegment[];
|
|
195
223
|
digest: string;
|
|
196
224
|
};
|
|
225
|
+
/** The provider summary read at ingest, or `null` when it could not be read. */
|
|
226
|
+
summary: MeetingSourceDeliveredSummary | null;
|
|
197
227
|
version: number;
|
|
198
228
|
retrievedAt: string;
|
|
199
229
|
}
|
|
@@ -233,6 +263,8 @@ export declare function syncMeetingSourceConnection(input: {
|
|
|
233
263
|
initialLookbackMs?: number;
|
|
234
264
|
overlapMs?: number;
|
|
235
265
|
maxAttempts?: number;
|
|
266
|
+
/** Earliest a generating or unreadable summary is re-read on a later sync. Default 15 min. */
|
|
267
|
+
summaryRetryMs?: number;
|
|
236
268
|
}): Promise<MeetingSourceSyncResult>;
|
|
237
269
|
export interface MeetingSourceListedMeeting {
|
|
238
270
|
connection: MeetingSourceConnectionRecord;
|