@unson/brainbase-mcp 0.5.0 → 0.7.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 (92) hide show
  1. package/README.md +8 -0
  2. package/contracts/judgment-dag/digest.json +2 -2
  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 +809 -0
  9. package/dist/company-os-evaluation.d.ts +193 -0
  10. package/dist/company-os-evaluation.js +1150 -0
  11. package/dist/company-os-impact-review.d.ts +248 -0
  12. package/dist/company-os-impact-review.js +663 -0
  13. package/dist/company-os-learning-adoption.d.ts +288 -0
  14. package/dist/company-os-learning-adoption.js +944 -0
  15. package/dist/company-os-objectives.d.ts +52 -0
  16. package/dist/company-os-objectives.js +197 -0
  17. package/dist/company-os-receipt-adapter.d.ts +109 -0
  18. package/dist/company-os-receipt-adapter.js +636 -0
  19. package/dist/constraint-exception-store.d.ts +23 -0
  20. package/dist/constraint-exception-store.js +108 -0
  21. package/dist/constraint-resolution.d.ts +175 -0
  22. package/dist/constraint-resolution.js +922 -0
  23. package/dist/decision-adapter.d.ts +145 -0
  24. package/dist/decision-adapter.js +586 -0
  25. package/dist/durable-wait-http.d.ts +51 -0
  26. package/dist/durable-wait-http.js +497 -0
  27. package/dist/durable-waits.d.ts +234 -0
  28. package/dist/durable-waits.js +944 -0
  29. package/dist/execution-authority-http.d.ts +28 -0
  30. package/dist/execution-authority-http.js +359 -0
  31. package/dist/execution-authority.d.ts +201 -0
  32. package/dist/execution-authority.js +634 -0
  33. package/dist/foundation-catalog.d.ts +26 -0
  34. package/dist/foundation-catalog.js +206 -0
  35. package/dist/foundation-constraint-store.d.ts +50 -0
  36. package/dist/foundation-constraint-store.js +215 -0
  37. package/dist/foundation-http.d.ts +90 -0
  38. package/dist/foundation-http.js +439 -0
  39. package/dist/foundation-store.d.ts +132 -0
  40. package/dist/foundation-store.js +654 -0
  41. package/dist/judgment-dag-composition.d.ts +224 -0
  42. package/dist/judgment-dag-composition.js +731 -0
  43. package/dist/judgment-dag.d.ts +2 -0
  44. package/dist/judgment-dag.js +1 -0
  45. package/dist/judgment-problem-snapshot.d.ts +185 -0
  46. package/dist/judgment-problem-snapshot.js +777 -0
  47. package/dist/judgment-view-http.d.ts +22 -0
  48. package/dist/judgment-view-http.js +128 -0
  49. package/dist/judgment-view.d.ts +222 -0
  50. package/dist/judgment-view.js +627 -0
  51. package/dist/knowledge-adapter.d.ts +112 -0
  52. package/dist/knowledge-adapter.js +691 -0
  53. package/dist/ontology-foundation.d.ts +209 -0
  54. package/dist/ontology-foundation.js +1000 -0
  55. package/dist/ontology.d.ts +13 -0
  56. package/dist/ontology.js +14 -0
  57. package/dist/organization-connection.d.ts +164 -0
  58. package/dist/organization-connection.js +428 -0
  59. package/dist/personal-knowledge.d.ts +120 -0
  60. package/dist/personal-knowledge.js +750 -0
  61. package/dist/problem-candidates.d.ts +149 -0
  62. package/dist/problem-candidates.js +898 -0
  63. package/dist/problem-selection.d.ts +238 -0
  64. package/dist/problem-selection.js +995 -0
  65. package/dist/resource-reservation-http.d.ts +31 -0
  66. package/dist/resource-reservation-http.js +371 -0
  67. package/dist/resource-reservations.d.ts +221 -0
  68. package/dist/resource-reservations.js +577 -0
  69. package/dist/server.d.ts +97 -0
  70. package/dist/server.js +180 -1
  71. package/dist/ssot.d.ts +6 -1
  72. package/dist/ssot.js +63 -5
  73. package/dist/streamable-http.d.ts +42 -0
  74. package/dist/streamable-http.js +288 -0
  75. package/dist/types.d.ts +20 -0
  76. package/dist/world-model.d.ts +181 -0
  77. package/dist/world-model.js +873 -0
  78. package/package.json +145 -3
  79. package/ui/icons/mana/LICENSE.tabler.txt +21 -0
  80. package/ui/icons/mana/affiliate.svg +20 -0
  81. package/ui/icons/mana/brand-github.svg +15 -0
  82. package/ui/icons/mana/brand-google-drive.svg +17 -0
  83. package/ui/icons/mana/brand-slack.svg +18 -0
  84. package/ui/icons/mana/cpu.svg +24 -0
  85. package/ui/judgment-view.css +238 -0
  86. package/ui/judgment-view.js +508 -0
  87. package/ui/objective-editor.css +180 -0
  88. package/ui/objective-editor.js +1139 -0
  89. package/ui/outcome-knowledge.css +365 -0
  90. package/ui/outcome-knowledge.js +1570 -0
  91. package/ui/outcome-mana.css +255 -0
  92. package/ui/outcome-mana.js +2325 -0
@@ -0,0 +1,224 @@
1
+ /**
2
+ * Contract for composing versioned Judgment DAGs into one parent judgment.
3
+ *
4
+ * This module intentionally has no persistence or host adapter dependency.
5
+ * It validates the composition, freezes the evaluation boundary, and records
6
+ * the result of each child without changing the J0 single-DAG run artifact.
7
+ */
8
+ import { type JudgmentDAGScope } from './judgment-dag-core.js';
9
+ import type { JudgmentDAGRunArtifactId } from './judgment-dag-artifact-store.js';
10
+ import type { JudgmentDAGJSONValue } from './judgment-dag-runner.js';
11
+ export declare const JUDGMENT_DAG_COMPOSITION_VERSION: "judgment-dag-composition.v1";
12
+ export declare const JUDGMENT_DAG_COMPOSITION_STATUSES: readonly ["completed", "failed", "held"];
13
+ export type JudgmentDAGCompositionStatus = (typeof JUDGMENT_DAG_COMPOSITION_STATUSES)[number];
14
+ export declare const JUDGMENT_DAG_SUBDAG_STATUSES: readonly ["completed", "failed", "held"];
15
+ export type JudgmentDAGSubDAGStatus = (typeof JUDGMENT_DAG_SUBDAG_STATUSES)[number];
16
+ export interface JudgmentDAGVersionReference {
17
+ readonly id: string;
18
+ readonly version: string;
19
+ }
20
+ /**
21
+ * The immutable JudgmentProblem snapshot selected for this composition.
22
+ *
23
+ * The snapshot itself remains owned by Story05's store. Composition records
24
+ * carry this exact locator so a later read cannot silently follow a newer
25
+ * problem revision.
26
+ */
27
+ export type JudgmentDAGProblemSnapshotId = `sha256:${string}`;
28
+ export interface JudgmentDAGProblemSnapshotReference {
29
+ readonly snapshot_id: JudgmentDAGProblemSnapshotId;
30
+ readonly problem_id: string;
31
+ readonly revision: string;
32
+ }
33
+ export interface JudgmentDAGProblemSnapshotReadRequest {
34
+ readonly mode: 'read';
35
+ /** Composition execution must revalidate canonical references at read time. */
36
+ readonly reference_resolution: 'current';
37
+ readonly reference: JudgmentDAGProblemSnapshotReference;
38
+ }
39
+ /**
40
+ * A Story05 adapter used by a new composition run must return a snapshot
41
+ * validated with `reference_resolution: 'current'` and a canonical reference
42
+ * provider. The coordinator checks the locator and identity fields; the
43
+ * adapter owns the actual store lookup and current authorization/existence
44
+ * check. `historical` resolution is for audit/replay only and cannot satisfy
45
+ * this execution reader contract.
46
+ */
47
+ export interface JudgmentDAGProblemSnapshotReadResult {
48
+ readonly status: 'resolved';
49
+ /** Historical snapshot replay is an audit path, not an execution input. */
50
+ readonly reference_resolution: 'current';
51
+ readonly reference: JudgmentDAGProblemSnapshotReference;
52
+ readonly snapshot: JudgmentDAGJSONValue;
53
+ }
54
+ export interface JudgmentDAGProblemSnapshotReader {
55
+ readonly read: (request: JudgmentDAGProblemSnapshotReadRequest) => JudgmentDAGProblemSnapshotReadResult | Promise<JudgmentDAGProblemSnapshotReadResult>;
56
+ }
57
+ export interface JudgmentDAGVersionResolution {
58
+ readonly dag: JudgmentDAGVersionReference;
59
+ readonly input_contract: string;
60
+ readonly output_contract: string;
61
+ }
62
+ export interface JudgmentDAGVersionResolverRequest {
63
+ readonly role: 'parent' | 'child';
64
+ readonly invocation_id?: string;
65
+ readonly dag: JudgmentDAGVersionReference;
66
+ }
67
+ export interface JudgmentDAGVersionResolver {
68
+ readonly resolve: (request: JudgmentDAGVersionResolverRequest) => JudgmentDAGVersionResolution | Promise<JudgmentDAGVersionResolution>;
69
+ }
70
+ export interface JudgmentDAGInputOutputContractValidationRequest {
71
+ readonly role: 'child';
72
+ readonly invocation_id: string;
73
+ readonly dag: JudgmentDAGVersionReference;
74
+ readonly input_contract: string;
75
+ readonly output_contract: string;
76
+ }
77
+ export interface JudgmentDAGInputOutputContractValidator {
78
+ readonly validate: (request: JudgmentDAGInputOutputContractValidationRequest) => void | Promise<void>;
79
+ }
80
+ export interface JudgmentDAGRunArtifactReadRequest {
81
+ readonly artifact_id: JudgmentDAGRunArtifactId;
82
+ readonly expected_run_id: string;
83
+ readonly expected_dag: JudgmentDAGVersionReference;
84
+ }
85
+ /**
86
+ * The adapter should delegate to loadJudgmentDAGRunArtifact (or an equivalent
87
+ * integrity-checking reader). The coordinator only checks identity fields
88
+ * after that readback; it never treats an artifact id as proof by itself.
89
+ */
90
+ export interface JudgmentDAGRunArtifactReader {
91
+ readonly read: (request: JudgmentDAGRunArtifactReadRequest) => unknown | Promise<unknown>;
92
+ }
93
+ export interface JudgmentDAGSubDAGDefinition {
94
+ readonly invocation_id: string;
95
+ readonly dag: JudgmentDAGVersionReference;
96
+ readonly question: string;
97
+ readonly input_contract: string;
98
+ readonly output_contract: string;
99
+ readonly required_capabilities: readonly string[];
100
+ readonly depends_on: readonly string[];
101
+ }
102
+ export interface JudgmentDAGCompositionDefinition {
103
+ readonly composition_id: string;
104
+ readonly composition_version: string;
105
+ readonly scope: JudgmentDAGScope;
106
+ readonly parent_dag: JudgmentDAGVersionReference;
107
+ readonly children: readonly JudgmentDAGSubDAGDefinition[];
108
+ }
109
+ export interface JudgmentDAGDelegationScope {
110
+ readonly scope: JudgmentDAGScope;
111
+ readonly capabilities: readonly string[];
112
+ }
113
+ export interface JudgmentDAGRunReference {
114
+ readonly run_id: string;
115
+ readonly dag: JudgmentDAGVersionReference;
116
+ readonly artifact_id?: JudgmentDAGRunArtifactId;
117
+ }
118
+ export interface JudgmentDAGEvidenceReference {
119
+ readonly kind: string;
120
+ readonly id: string;
121
+ readonly revision?: string;
122
+ }
123
+ export interface JudgmentDAGSubDAGResult {
124
+ readonly status: JudgmentDAGSubDAGStatus;
125
+ readonly input_contract: string;
126
+ readonly output_contract: string;
127
+ readonly run_reference: JudgmentDAGRunReference | null;
128
+ readonly conclusion: JudgmentDAGJSONValue;
129
+ readonly evidence: readonly JudgmentDAGEvidenceReference[];
130
+ readonly applicability: JudgmentDAGJSONValue;
131
+ readonly uncertainty: JudgmentDAGJSONValue;
132
+ readonly reason?: string;
133
+ }
134
+ export interface JudgmentDAGCompositionChildRunSource {
135
+ readonly invocation_id: string;
136
+ readonly result: JudgmentDAGSubDAGResult;
137
+ }
138
+ export interface JudgmentDAGSubDAGRunRecord {
139
+ readonly invocation_id: string;
140
+ readonly dag: JudgmentDAGVersionReference;
141
+ readonly question: string;
142
+ readonly input_contract: string;
143
+ readonly output_contract: string;
144
+ readonly input: JudgmentDAGJSONValue;
145
+ readonly problem_snapshot: JudgmentDAGProblemSnapshotReference;
146
+ readonly fixed_conditions: JudgmentDAGJSONValue;
147
+ readonly delegation: JudgmentDAGDelegationScope;
148
+ readonly dependency_invocation_ids: readonly string[];
149
+ readonly dependency_results: readonly JudgmentDAGCompositionChildRunSource[];
150
+ readonly result: JudgmentDAGSubDAGResult;
151
+ }
152
+ export interface JudgmentDAGCompositionRunRecord {
153
+ readonly run_id: string;
154
+ readonly composition: JudgmentDAGVersionReference;
155
+ readonly parent_dag: JudgmentDAGVersionReference;
156
+ readonly question: string;
157
+ readonly input: JudgmentDAGJSONValue;
158
+ readonly problem_snapshot: JudgmentDAGProblemSnapshotReference;
159
+ readonly fixed_conditions: JudgmentDAGJSONValue;
160
+ readonly delegation: JudgmentDAGDelegationScope;
161
+ readonly execution_order: readonly string[];
162
+ readonly status: JudgmentDAGCompositionStatus;
163
+ readonly children: readonly JudgmentDAGSubDAGRunRecord[];
164
+ }
165
+ export interface JudgmentDAGSubDAGExecutionRequest {
166
+ readonly mode: 'evaluation';
167
+ readonly parent_run_id: string;
168
+ readonly composition: JudgmentDAGVersionReference;
169
+ readonly invocation_id: string;
170
+ readonly dag: JudgmentDAGVersionReference;
171
+ readonly question: string;
172
+ readonly input: JudgmentDAGJSONValue;
173
+ readonly problem_snapshot: JudgmentDAGProblemSnapshotReference;
174
+ readonly fixed_conditions: JudgmentDAGJSONValue;
175
+ readonly delegation: JudgmentDAGDelegationScope;
176
+ readonly dependency_results: readonly JudgmentDAGCompositionChildRunSource[];
177
+ }
178
+ export interface JudgmentDAGSubDAGEvaluationPort {
179
+ readonly execute: (request: JudgmentDAGSubDAGExecutionRequest) => JudgmentDAGSubDAGResult | Promise<JudgmentDAGSubDAGResult>;
180
+ }
181
+ /** Alias kept for callers that model the boundary as an execution port. */
182
+ export type JudgmentDAGSubDAGExecutionPort = JudgmentDAGSubDAGEvaluationPort;
183
+ export interface JudgmentDAGCompositionRunRequest {
184
+ readonly run_id: string;
185
+ readonly composition: JudgmentDAGCompositionDefinition;
186
+ readonly question: string;
187
+ readonly input: JudgmentDAGJSONValue;
188
+ readonly problem_snapshot: JudgmentDAGProblemSnapshotReference;
189
+ readonly fixed_conditions: JudgmentDAGJSONValue;
190
+ readonly delegation: JudgmentDAGDelegationScope;
191
+ readonly snapshot_reader: JudgmentDAGProblemSnapshotReader;
192
+ readonly dag_resolver: JudgmentDAGVersionResolver;
193
+ readonly contract_validator: JudgmentDAGInputOutputContractValidator;
194
+ readonly artifact_reader?: JudgmentDAGRunArtifactReader;
195
+ readonly port: JudgmentDAGSubDAGEvaluationPort;
196
+ }
197
+ export type JudgmentDAGCompositionErrorCode = 'invalid_contract' | 'duplicate_invocation' | 'missing_dependency' | 'cycle' | 'scope_mismatch' | 'capability_violation' | 'dag_mismatch' | 'dag_unavailable' | 'contract_mismatch' | 'snapshot_unavailable' | 'artifact_readback_failed' | 'invalid_child_result' | 'executor_failed';
198
+ export interface JudgmentDAGCompositionErrorDetails {
199
+ readonly invocation_id?: string;
200
+ readonly dependency_id?: string;
201
+ readonly cycle?: readonly string[];
202
+ }
203
+ export declare class JudgmentDAGCompositionError extends Error {
204
+ readonly code: JudgmentDAGCompositionErrorCode;
205
+ readonly invocation_id?: string;
206
+ readonly dependency_id?: string;
207
+ readonly cycle?: readonly string[];
208
+ constructor(code: JudgmentDAGCompositionErrorCode, message: string, details?: JudgmentDAGCompositionErrorDetails);
209
+ }
210
+ export interface JudgmentDAGCompositionValidationResult {
211
+ readonly valid: true;
212
+ readonly composition_id: string;
213
+ readonly composition_version: string;
214
+ readonly execution_order: readonly string[];
215
+ }
216
+ export declare function validateJudgmentDAGComposition(value: unknown): JudgmentDAGCompositionValidationResult;
217
+ export declare function assertValidJudgmentDAGComposition(value: unknown): asserts value is JudgmentDAGCompositionDefinition;
218
+ export declare function createJudgmentDAGCompositionDefinition(value: unknown): JudgmentDAGCompositionDefinition;
219
+ /**
220
+ * Execute only the explicitly declared evaluation port for each child.
221
+ * Resource reservation, deploys, external sends, and arbitrary host-code
222
+ * isolation remain outside this OSS boundary.
223
+ */
224
+ export declare function executeJudgmentDAGComposition(request: JudgmentDAGCompositionRunRequest): Promise<JudgmentDAGCompositionRunRecord>;