@unson/brainbase-mcp 0.6.0 → 0.8.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 (148) hide show
  1. package/contracts/foundation/graph-history.sql +634 -0
  2. package/contracts/judgment-value-proof/schema.json +43 -1
  3. package/dist/canonical-task-contract.d.ts +9 -0
  4. package/dist/canonical-task-contract.js +39 -0
  5. package/dist/canonical-task-principal.d.ts +16 -0
  6. package/dist/canonical-task-principal.js +36 -0
  7. package/dist/canonical-task-service.d.ts +251 -0
  8. package/dist/canonical-task-service.js +820 -0
  9. package/dist/cli.d.ts +2 -0
  10. package/dist/cli.js +107 -0
  11. package/dist/company-os-evaluation.d.ts +193 -0
  12. package/dist/company-os-evaluation.js +1150 -0
  13. package/dist/company-os-impact-review.d.ts +248 -0
  14. package/dist/company-os-impact-review.js +663 -0
  15. package/dist/company-os-learning-adoption.d.ts +288 -0
  16. package/dist/company-os-learning-adoption.js +944 -0
  17. package/dist/company-os-objectives.d.ts +63 -0
  18. package/dist/company-os-objectives.js +234 -0
  19. package/dist/company-os-receipt-adapter.d.ts +109 -0
  20. package/dist/company-os-receipt-adapter.js +636 -0
  21. package/dist/constraint-exception-store.d.ts +23 -0
  22. package/dist/constraint-exception-store.js +108 -0
  23. package/dist/constraint-resolution.d.ts +175 -0
  24. package/dist/constraint-resolution.js +922 -0
  25. package/dist/decision-adapter.d.ts +145 -0
  26. package/dist/decision-adapter.js +586 -0
  27. package/dist/durable-wait-http.d.ts +51 -0
  28. package/dist/durable-wait-http.js +497 -0
  29. package/dist/durable-waits.d.ts +234 -0
  30. package/dist/durable-waits.js +944 -0
  31. package/dist/execution-authority-http.d.ts +28 -0
  32. package/dist/execution-authority-http.js +359 -0
  33. package/dist/execution-authority.d.ts +201 -0
  34. package/dist/execution-authority.js +634 -0
  35. package/dist/foundation-authenticated-tools.d.ts +56 -0
  36. package/dist/foundation-authenticated-tools.js +347 -0
  37. package/dist/foundation-catalog.d.ts +26 -0
  38. package/dist/foundation-catalog.js +206 -0
  39. package/dist/foundation-constraint-store.d.ts +50 -0
  40. package/dist/foundation-constraint-store.js +215 -0
  41. package/dist/foundation-graph-http.d.ts +43 -0
  42. package/dist/foundation-graph-http.js +243 -0
  43. package/dist/foundation-graph-write.d.ts +90 -0
  44. package/dist/foundation-graph-write.js +447 -0
  45. package/dist/foundation-http.d.ts +90 -0
  46. package/dist/foundation-http.js +439 -0
  47. package/dist/foundation-public-provider.d.ts +140 -0
  48. package/dist/foundation-public-provider.js +192 -0
  49. package/dist/foundation-store.d.ts +132 -0
  50. package/dist/foundation-store.js +654 -0
  51. package/dist/graph-corrections.d.ts +157 -0
  52. package/dist/graph-corrections.js +620 -0
  53. package/dist/graph-foundation-reader.d.ts +60 -0
  54. package/dist/graph-foundation-reader.js +494 -0
  55. package/dist/graph-retrieval.d.ts +6 -1
  56. package/dist/graph-revision-reader.d.ts +80 -0
  57. package/dist/graph-revision-reader.js +246 -0
  58. package/dist/graph-web-http.d.ts +26 -0
  59. package/dist/graph-web-http.js +215 -0
  60. package/dist/graph-web.d.ts +364 -0
  61. package/dist/graph-web.js +639 -0
  62. package/dist/judgment-dag-composition.d.ts +224 -0
  63. package/dist/judgment-dag-composition.js +731 -0
  64. package/dist/judgment-dag.d.ts +2 -0
  65. package/dist/judgment-dag.js +1 -0
  66. package/dist/judgment-problem-snapshot.d.ts +213 -0
  67. package/dist/judgment-problem-snapshot.js +1073 -0
  68. package/dist/judgment-value-proof-review.d.ts +166 -0
  69. package/dist/judgment-value-proof-review.js +437 -0
  70. package/dist/judgment-value-proof.d.ts +28 -1
  71. package/dist/judgment-value-proof.js +53 -8
  72. package/dist/judgment-view-http.d.ts +22 -0
  73. package/dist/judgment-view-http.js +128 -0
  74. package/dist/judgment-view.d.ts +222 -0
  75. package/dist/judgment-view.js +627 -0
  76. package/dist/knowledge-adapter.d.ts +112 -0
  77. package/dist/knowledge-adapter.js +691 -0
  78. package/dist/knowledge-continuation.d.ts +127 -0
  79. package/dist/knowledge-continuation.js +446 -0
  80. package/dist/knowledge-lookup.d.ts +178 -0
  81. package/dist/knowledge-lookup.js +758 -0
  82. package/dist/local-web-fetch-bridge.d.ts +5 -0
  83. package/dist/local-web-fetch-bridge.js +37 -0
  84. package/dist/local-web-host.d.ts +109 -0
  85. package/dist/local-web-host.js +688 -0
  86. package/dist/local-web-security.d.ts +25 -0
  87. package/dist/local-web-security.js +95 -0
  88. package/dist/ontology-foundation.d.ts +209 -0
  89. package/dist/ontology-foundation.js +1000 -0
  90. package/dist/ontology.d.ts +13 -0
  91. package/dist/ontology.js +14 -0
  92. package/dist/organization-connection.d.ts +164 -0
  93. package/dist/organization-connection.js +428 -0
  94. package/dist/organization-graph.d.ts +15 -0
  95. package/dist/organization-graph.js +24 -4
  96. package/dist/personal-knowledge.d.ts +132 -0
  97. package/dist/personal-knowledge.js +779 -0
  98. package/dist/personal-memory-handover.d.ts +108 -0
  99. package/dist/personal-memory-handover.js +369 -0
  100. package/dist/philosophy-revision-reader.d.ts +85 -0
  101. package/dist/philosophy-revision-reader.js +241 -0
  102. package/dist/portable-graph.d.ts +24 -0
  103. package/dist/portable-graph.js +77 -0
  104. package/dist/problem-candidates.d.ts +149 -0
  105. package/dist/problem-candidates.js +898 -0
  106. package/dist/problem-selection.d.ts +238 -0
  107. package/dist/problem-selection.js +995 -0
  108. package/dist/resource-reservation-http.d.ts +31 -0
  109. package/dist/resource-reservation-http.js +371 -0
  110. package/dist/resource-reservations.d.ts +221 -0
  111. package/dist/resource-reservations.js +577 -0
  112. package/dist/server.d.ts +104 -2
  113. package/dist/server.js +186 -4
  114. package/dist/ssot.d.ts +6 -1
  115. package/dist/ssot.js +63 -5
  116. package/dist/streamable-http.d.ts +42 -0
  117. package/dist/streamable-http.js +288 -0
  118. package/dist/types.d.ts +20 -0
  119. package/dist/value-proof-review-http.d.ts +25 -0
  120. package/dist/value-proof-review-http.js +185 -0
  121. package/dist/world-model.d.ts +199 -0
  122. package/dist/world-model.js +955 -0
  123. package/package.json +230 -3
  124. package/ui/brainbase-tokens.css +56 -0
  125. package/ui/graph-own-share.js +367 -0
  126. package/ui/graph-projects-view.css +23 -0
  127. package/ui/graph-projects-view.js +730 -0
  128. package/ui/graph-registry-view.css +101 -0
  129. package/ui/graph-registry-view.js +804 -0
  130. package/ui/graph-view-shared.css +522 -0
  131. package/ui/graph-view-shared.js +1227 -0
  132. package/ui/judgment-view.css +312 -0
  133. package/ui/judgment-view.js +508 -0
  134. package/ui/local-web-shell.css +396 -0
  135. package/ui/local-web-shell.js +378 -0
  136. package/ui/objective-editor-http-port.js +154 -0
  137. package/ui/objective-editor.css +286 -0
  138. package/ui/objective-editor.js +1586 -0
  139. package/ui/outcome-knowledge.css +50 -14
  140. package/ui/outcome-knowledge.js +15 -1
  141. package/ui/outcome-mana.css +91 -14
  142. package/ui/outcome-mana.js +958 -61
  143. package/ui/value-proof-review.css +504 -0
  144. package/ui/value-proof-review.js +1104 -0
  145. package/ui/workspace-kit.css +485 -0
  146. package/ui/workspace-kit.js +229 -0
  147. package/ui/world-model-view.css +188 -0
  148. package/ui/world-model-view.js +486 -0
@@ -0,0 +1,364 @@
1
+ import { GRAPH_CORRECTIONS_FILE, type GraphCorrectionRecord } from './graph-corrections.js';
2
+ import { type PortableGraphOwner } from './portable-graph.js';
3
+ import type { FoundationAdoptionState, FoundationOperator } from './ontology-foundation.js';
4
+ import type { CanonicalEdge, CanonicalEntityKind, CoreRelation } from './types.js';
5
+ /**
6
+ * Read views of the canonical local Graph for the local Web screens
7
+ * "プロジェクトと関係者" and "情報と関係".
8
+ *
9
+ * Every function takes an explicit data directory chosen by the host, never by
10
+ * the browser. A Graph v1 file is reported as `migration_required` and a
11
+ * missing data set as `not_initialized`; neither is presented as zero items,
12
+ * and a read failure is thrown instead of being returned as an empty list.
13
+ *
14
+ * `openOwnerPrivateGraph` gives the same read views over a portable bundle a
15
+ * host keeps for its owner (the owner-private area), without a data directory.
16
+ */
17
+ export declare const GRAPH_WEB_VERSION: "graph-web.v1";
18
+ export declare const GRAPH_WEB_START_COMMAND = "brainbase onboard:start";
19
+ export declare const GRAPH_WEB_SEARCH_MAX_LIMIT = 100;
20
+ /** The kinds of record a Graph v2 can hold; any other kind is absent from it. */
21
+ export declare const GRAPH_WEB_ENTITY_KINDS: readonly CanonicalEntityKind[];
22
+ declare const ONBOARDING_LEDGER_FILE = "runs/connected-onboarding.json";
23
+ export interface GraphWebSource {
24
+ dataDir: string;
25
+ graphFormat: 1 | 2 | null;
26
+ authority: 'local_graph';
27
+ }
28
+ /**
29
+ * A portable bundle a host keeps for its owner: the owner's own records, not
30
+ * the host's shared Graph. There is no data directory.
31
+ */
32
+ export interface GraphWebOwnerPrivateSource {
33
+ dataDir: null;
34
+ graphFormat: 2;
35
+ authority: 'owner_private';
36
+ }
37
+ export type GraphWebAnySource = GraphWebSource | GraphWebOwnerPrivateSource;
38
+ export interface GraphMigrationRequired {
39
+ status: 'migration_required';
40
+ source: GraphWebSource;
41
+ /** Entities in the Graph v1 file. They exist but cannot be shown or corrected until migrated. */
42
+ legacyEntityCount: number;
43
+ /** Preview first; it prints the expectedInputDigest the write step needs. */
44
+ command: string;
45
+ writeCommand: string;
46
+ message: string;
47
+ absenceConfirmed: false;
48
+ }
49
+ export interface GraphNotInitialized {
50
+ status: 'not_initialized';
51
+ source: GraphWebSource;
52
+ command: typeof GRAPH_WEB_START_COMMAND;
53
+ message: string;
54
+ /** No canonical file exists in the data directory, so nothing is registered. */
55
+ absenceConfirmed: true;
56
+ }
57
+ export type GraphWebUnavailable = GraphMigrationRequired | GraphNotInitialized;
58
+ export interface GraphReadIssue {
59
+ file: string;
60
+ line?: number;
61
+ reason: string;
62
+ }
63
+ export interface GraphEntityView {
64
+ id: string;
65
+ type: CanonicalEntityKind;
66
+ name: string;
67
+ aliases: string[];
68
+ summary: string | null;
69
+ tags: string[];
70
+ validFrom: string | null;
71
+ validTo: string | null;
72
+ /** Active at the response `asOf`. */
73
+ active: boolean;
74
+ digest: string;
75
+ goal?: string | null;
76
+ status?: string | null;
77
+ }
78
+ export type GraphProvenanceReference = {
79
+ status: 'none';
80
+ } | {
81
+ status: 'unresolved';
82
+ sourceId: string;
83
+ } | {
84
+ status: 'resolved';
85
+ kind: 'extracted_candidate';
86
+ file: string;
87
+ candidateId: string;
88
+ candidateKind: string | null;
89
+ label: string | null;
90
+ } | {
91
+ status: 'resolved';
92
+ kind: 'onboarding_run_candidate';
93
+ file: typeof ONBOARDING_LEDGER_FILE;
94
+ runId: string;
95
+ candidateId: string;
96
+ candidateKind: string | null;
97
+ reviewStatus: string | null;
98
+ label: string | null;
99
+ } | {
100
+ status: 'resolved';
101
+ kind: 'graph_correction';
102
+ file: typeof GRAPH_CORRECTIONS_FILE;
103
+ correctionId: string;
104
+ at: string;
105
+ reason: string;
106
+ };
107
+ export interface GraphProvenanceView {
108
+ sourceKind: NonNullable<CanonicalEdge['provenance']>['sourceKind'] | null;
109
+ sourceId: string | null;
110
+ evidenceHash: string | null;
111
+ reference: GraphProvenanceReference;
112
+ }
113
+ export interface GraphEdgeView {
114
+ id: string;
115
+ relation: CoreRelation;
116
+ meaning: string;
117
+ direction: 'incoming' | 'outgoing';
118
+ fromId: string;
119
+ toId: string;
120
+ role: string | null;
121
+ context: string | null;
122
+ validFrom: string | null;
123
+ validTo: string | null;
124
+ active: boolean;
125
+ provenance: GraphProvenanceView;
126
+ counterpart: {
127
+ id: string;
128
+ type: CanonicalEntityKind;
129
+ name: string;
130
+ active: boolean;
131
+ digest: string;
132
+ };
133
+ digest: string;
134
+ }
135
+ export interface GraphWebStatus {
136
+ status: 'ok';
137
+ version: typeof GRAPH_WEB_VERSION;
138
+ source: GraphWebSource;
139
+ asOf: string;
140
+ ontology: {
141
+ id: string;
142
+ version: string;
143
+ releaseDigest: string;
144
+ currentVersion: string;
145
+ };
146
+ counts: {
147
+ entities: Record<CanonicalEntityKind, number> & {
148
+ total: number;
149
+ };
150
+ edges: {
151
+ total: number;
152
+ active: number;
153
+ };
154
+ relationships: number;
155
+ corrections: number;
156
+ };
157
+ issues: GraphReadIssue[];
158
+ }
159
+ export interface GraphProjectPersonView {
160
+ id: string;
161
+ name: string;
162
+ /** True when one of the person's active relations to the project is accountable_for. */
163
+ accountable: boolean;
164
+ }
165
+ export interface GraphProjectListItem extends GraphEntityView {
166
+ type: 'project';
167
+ goal: string | null;
168
+ status: string | null;
169
+ /** Distinct people with an active participates_in or accountable_for relation. */
170
+ participantCount: number;
171
+ accountableCount: number;
172
+ /** The same people by name, accountable first, so a list can name them and count them across projects. */
173
+ people: GraphProjectPersonView[];
174
+ }
175
+ export interface GraphProjectList<S extends GraphWebAnySource = GraphWebSource> {
176
+ status: 'ok';
177
+ source: S;
178
+ asOf: string;
179
+ projects: GraphProjectListItem[];
180
+ /** True only when the readable Graph v2 holds no project at all. */
181
+ absenceConfirmed: boolean;
182
+ }
183
+ export interface GraphProjectDetail<S extends GraphWebAnySource = GraphWebSource> {
184
+ status: 'ok';
185
+ source: S;
186
+ asOf: string;
187
+ project: GraphEntityView & {
188
+ type: 'project';
189
+ goal: string | null;
190
+ status: string | null;
191
+ decisionPrinciples: string[];
192
+ metadata: Record<string, unknown>;
193
+ };
194
+ /** Incoming participates_in / accountable_for relations, including ended ones. */
195
+ participants: GraphEdgeView[];
196
+ /** Other relations of the project (governs, owned_by, ...). */
197
+ relations: GraphEdgeView[];
198
+ history: GraphCorrectionRecord[];
199
+ issues: GraphReadIssue[];
200
+ }
201
+ export interface GraphEntitySearchInput {
202
+ q?: string;
203
+ type?: string;
204
+ asOf?: string;
205
+ limit?: number;
206
+ /** Used for each result's `active` flag when no as_of filter is given. */
207
+ now?: Date;
208
+ }
209
+ export interface GraphEntitySearchResult<S extends GraphWebAnySource = GraphWebSource> {
210
+ status: 'ok';
211
+ source: S;
212
+ query: {
213
+ q: string;
214
+ type: CanonicalEntityKind | null;
215
+ asOf: string | null;
216
+ };
217
+ results: GraphEntityView[];
218
+ total: number;
219
+ truncated: boolean;
220
+ /**
221
+ * True when the whole readable Graph v2 was scanned and nothing matched the
222
+ * name/alias query and filters. Never true for Graph v1 or a read failure.
223
+ */
224
+ absenceConfirmed: boolean;
225
+ /** True when the Graph v2 holds no entity at all (show "まだ登録がありません"). */
226
+ graphEmpty: boolean;
227
+ }
228
+ export interface GraphEntityDetail<S extends GraphWebAnySource = GraphWebSource> {
229
+ status: 'ok';
230
+ source: S;
231
+ asOf: string;
232
+ entity: GraphEntityView & {
233
+ metadata: Record<string, unknown>;
234
+ };
235
+ outgoing: GraphEdgeView[];
236
+ incoming: GraphEdgeView[];
237
+ history: GraphCorrectionRecord[];
238
+ issues: GraphReadIssue[];
239
+ /**
240
+ * For a decision of a portable bundle: its judgment record (判断根拠) from
241
+ * the bundle's decisions, or null when the bundle has none for it.
242
+ */
243
+ decisionRecord?: GraphDecisionRecordView | null;
244
+ }
245
+ export interface GraphDecisionRecordView {
246
+ title: string;
247
+ decision: string;
248
+ rationale: string | null;
249
+ topic: string | null;
250
+ effectiveAt: string | null;
251
+ supersedes: string[];
252
+ }
253
+ /** A person named by an objective, with the name of their record in the same Graph (null when it has none). */
254
+ export interface GraphObjectivePersonView {
255
+ id: string;
256
+ name: string | null;
257
+ }
258
+ /** The latest revision of an objective defined in a Graph's foundation. */
259
+ export interface GraphObjectiveView {
260
+ id: string;
261
+ revision: string;
262
+ meaning: string;
263
+ desiredState: string;
264
+ adoptionState: FoundationAdoptionState;
265
+ evaluationPeriod: {
266
+ from: string;
267
+ until: string;
268
+ };
269
+ criteria: Array<{
270
+ variable: {
271
+ id: string;
272
+ revision: string;
273
+ meaning: string | null;
274
+ unit: string | null;
275
+ };
276
+ operator: FoundationOperator;
277
+ target: string | number | boolean | null;
278
+ }>;
279
+ accountable: GraphObjectivePersonView | null;
280
+ beneficiaries: GraphObjectivePersonView[];
281
+ visibility: string;
282
+ }
283
+ export interface GraphObjectiveList<S extends GraphWebAnySource = GraphWebSource> {
284
+ status: 'ok';
285
+ source: S;
286
+ objectives: GraphObjectiveView[];
287
+ /** `none` when the Graph has no foundation at all. */
288
+ foundation: 'none' | 'ok';
289
+ /** True when the foundation was read and holds no objective. */
290
+ absenceConfirmed: boolean;
291
+ }
292
+ export interface GraphOntologySummary {
293
+ status: 'ok';
294
+ source: GraphWebSource;
295
+ asOf: string;
296
+ ontology: {
297
+ id: string;
298
+ version: string;
299
+ releaseDigest: string;
300
+ currentVersion: string;
301
+ upToDate: boolean;
302
+ };
303
+ entityTypes: Array<{
304
+ id: CanonicalEntityKind;
305
+ meaning: string;
306
+ count: number;
307
+ }>;
308
+ relations: Array<{
309
+ id: CoreRelation;
310
+ from: CanonicalEntityKind;
311
+ to: CanonicalEntityKind;
312
+ meaning: string;
313
+ count: number;
314
+ activeCount: number;
315
+ }>;
316
+ corrections: {
317
+ entityFields: readonly string[];
318
+ projectFields: readonly string[];
319
+ edgeFields: readonly string[];
320
+ newEdgeRelations: readonly string[];
321
+ };
322
+ }
323
+ export type GraphWebErrorKind = 'invalid' | 'not_found' | 'unavailable';
324
+ export declare class GraphWebError extends Error {
325
+ readonly kind: GraphWebErrorKind;
326
+ readonly code: string;
327
+ readonly name = "GraphWebError";
328
+ constructor(kind: GraphWebErrorKind, code: string, message: string);
329
+ }
330
+ export interface GraphWebReadOptions {
331
+ asOf?: string;
332
+ now?: Date;
333
+ }
334
+ export declare function readGraphWebStatus(dataDir: string, options?: GraphWebReadOptions): Promise<GraphWebStatus | GraphWebUnavailable>;
335
+ export declare function listGraphProjects(dataDir: string, options?: GraphWebReadOptions): Promise<GraphProjectList | GraphWebUnavailable>;
336
+ export declare function readGraphProject(dataDir: string, projectId: string, options?: GraphWebReadOptions): Promise<GraphProjectDetail | GraphWebUnavailable>;
337
+ export declare function searchGraphEntities(dataDir: string, input?: GraphEntitySearchInput): Promise<GraphEntitySearchResult | GraphWebUnavailable>;
338
+ export declare function readGraphEntity(dataDir: string, entityId: string, options?: GraphWebReadOptions): Promise<GraphEntityDetail | GraphWebUnavailable>;
339
+ export declare function readGraphOntology(dataDir: string, options?: GraphWebReadOptions): Promise<GraphOntologySummary | GraphWebUnavailable>;
340
+ /** The source of every read view of an owner-private snapshot. */
341
+ export declare const GRAPH_WEB_OWNER_PRIVATE_SOURCE: Readonly<GraphWebOwnerPrivateSource>;
342
+ /** Read views of one owner-private snapshot, the same shapes as the local Graph routes. */
343
+ export interface OwnerPrivateGraph {
344
+ readonly source: GraphWebOwnerPrivateSource;
345
+ listProjects(options?: GraphWebReadOptions): GraphProjectList<GraphWebOwnerPrivateSource>;
346
+ readProject(projectId: string, options?: GraphWebReadOptions): GraphProjectDetail<GraphWebOwnerPrivateSource>;
347
+ search(input?: GraphEntitySearchInput): GraphEntitySearchResult<GraphWebOwnerPrivateSource>;
348
+ readEntity(entityId: string, options?: GraphWebReadOptions): GraphEntityDetail<GraphWebOwnerPrivateSource>;
349
+ /** Throws `foundation_invalid` when the bundle's foundation does not pass the catalog check. */
350
+ listObjectives(options?: GraphWebReadOptions): GraphObjectiveList<GraphWebOwnerPrivateSource>;
351
+ }
352
+ /**
353
+ * Opens a portable bundle a host keeps for its owner, read as that owner
354
+ * (`bindPortableGraphOwner`: `self` becomes the owner's person ID and name).
355
+ *
356
+ * The bundle is checked with `validatePortableGraph` first
357
+ * (`portable_graph_invalid` otherwise). Its foundation is checked on its own
358
+ * (the Graph check ignores it): a foundation that does not pass fails only the
359
+ * objectives view. Nothing is written anywhere, and relation sources
360
+ * (candidate files, the onboarding ledger, corrections) stayed on the owner's
361
+ * machine, so a relation's source ID is shown unresolved.
362
+ */
363
+ export declare function openOwnerPrivateGraph(bundle: unknown, owner: PortableGraphOwner): OwnerPrivateGraph;
364
+ export {};