@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.
- package/README.md +8 -0
- package/contracts/judgment-dag/digest.json +2 -2
- package/dist/canonical-task-contract.d.ts +9 -0
- package/dist/canonical-task-contract.js +39 -0
- package/dist/canonical-task-principal.d.ts +16 -0
- package/dist/canonical-task-principal.js +36 -0
- package/dist/canonical-task-service.d.ts +251 -0
- package/dist/canonical-task-service.js +809 -0
- package/dist/company-os-evaluation.d.ts +193 -0
- package/dist/company-os-evaluation.js +1150 -0
- package/dist/company-os-impact-review.d.ts +248 -0
- package/dist/company-os-impact-review.js +663 -0
- package/dist/company-os-learning-adoption.d.ts +288 -0
- package/dist/company-os-learning-adoption.js +944 -0
- package/dist/company-os-objectives.d.ts +52 -0
- package/dist/company-os-objectives.js +197 -0
- package/dist/company-os-receipt-adapter.d.ts +109 -0
- package/dist/company-os-receipt-adapter.js +636 -0
- package/dist/constraint-exception-store.d.ts +23 -0
- package/dist/constraint-exception-store.js +108 -0
- package/dist/constraint-resolution.d.ts +175 -0
- package/dist/constraint-resolution.js +922 -0
- package/dist/decision-adapter.d.ts +145 -0
- package/dist/decision-adapter.js +586 -0
- package/dist/durable-wait-http.d.ts +51 -0
- package/dist/durable-wait-http.js +497 -0
- package/dist/durable-waits.d.ts +234 -0
- package/dist/durable-waits.js +944 -0
- package/dist/execution-authority-http.d.ts +28 -0
- package/dist/execution-authority-http.js +359 -0
- package/dist/execution-authority.d.ts +201 -0
- package/dist/execution-authority.js +634 -0
- package/dist/foundation-catalog.d.ts +26 -0
- package/dist/foundation-catalog.js +206 -0
- package/dist/foundation-constraint-store.d.ts +50 -0
- package/dist/foundation-constraint-store.js +215 -0
- package/dist/foundation-http.d.ts +90 -0
- package/dist/foundation-http.js +439 -0
- package/dist/foundation-store.d.ts +132 -0
- package/dist/foundation-store.js +654 -0
- package/dist/judgment-dag-composition.d.ts +224 -0
- package/dist/judgment-dag-composition.js +731 -0
- package/dist/judgment-dag.d.ts +2 -0
- package/dist/judgment-dag.js +1 -0
- package/dist/judgment-problem-snapshot.d.ts +185 -0
- package/dist/judgment-problem-snapshot.js +777 -0
- package/dist/judgment-view-http.d.ts +22 -0
- package/dist/judgment-view-http.js +128 -0
- package/dist/judgment-view.d.ts +222 -0
- package/dist/judgment-view.js +627 -0
- package/dist/knowledge-adapter.d.ts +112 -0
- package/dist/knowledge-adapter.js +691 -0
- package/dist/ontology-foundation.d.ts +209 -0
- package/dist/ontology-foundation.js +1000 -0
- package/dist/ontology.d.ts +13 -0
- package/dist/ontology.js +14 -0
- package/dist/organization-connection.d.ts +164 -0
- package/dist/organization-connection.js +428 -0
- package/dist/personal-knowledge.d.ts +120 -0
- package/dist/personal-knowledge.js +750 -0
- package/dist/problem-candidates.d.ts +149 -0
- package/dist/problem-candidates.js +898 -0
- package/dist/problem-selection.d.ts +238 -0
- package/dist/problem-selection.js +995 -0
- package/dist/resource-reservation-http.d.ts +31 -0
- package/dist/resource-reservation-http.js +371 -0
- package/dist/resource-reservations.d.ts +221 -0
- package/dist/resource-reservations.js +577 -0
- package/dist/server.d.ts +97 -0
- package/dist/server.js +180 -1
- package/dist/ssot.d.ts +6 -1
- package/dist/ssot.js +63 -5
- package/dist/streamable-http.d.ts +42 -0
- package/dist/streamable-http.js +288 -0
- package/dist/types.d.ts +20 -0
- package/dist/world-model.d.ts +181 -0
- package/dist/world-model.js +873 -0
- package/package.json +145 -3
- package/ui/icons/mana/LICENSE.tabler.txt +21 -0
- package/ui/icons/mana/affiliate.svg +20 -0
- package/ui/icons/mana/brand-github.svg +15 -0
- package/ui/icons/mana/brand-google-drive.svg +17 -0
- package/ui/icons/mana/brand-slack.svg +18 -0
- package/ui/icons/mana/cpu.svg +24 -0
- package/ui/judgment-view.css +238 -0
- package/ui/judgment-view.js +508 -0
- package/ui/objective-editor.css +180 -0
- package/ui/objective-editor.js +1139 -0
- package/ui/outcome-knowledge.css +365 -0
- package/ui/outcome-knowledge.js +1570 -0
- package/ui/outcome-mana.css +255 -0
- package/ui/outcome-mana.js +2325 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { ObjectiveDefinition, VariableDefinition, FoundationRevision, FoundationTimeCondition } from './ontology-foundation.js';
|
|
2
|
+
import type { FoundationRef } from './foundation-catalog.js';
|
|
3
|
+
import type { FoundationCatalogRecord } from './types.js';
|
|
4
|
+
import type { FoundationRevisionStore, FoundationStoreContext } from './foundation-store.js';
|
|
5
|
+
export interface ObjectiveReadinessIssue {
|
|
6
|
+
code: string;
|
|
7
|
+
path: string;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ObjectiveReadiness {
|
|
11
|
+
/** Whether the definition can be used for a judgment or evaluation setup. */
|
|
12
|
+
ready: boolean;
|
|
13
|
+
/** Definition and referenced Variable issues; observations are not inferred. */
|
|
14
|
+
issues: readonly ObjectiveReadinessIssue[];
|
|
15
|
+
}
|
|
16
|
+
export type StoryObjectiveLinkKind = 'contribution' | 'execution_dependency' | 'time_condition';
|
|
17
|
+
export interface StoryObjectiveLinkInput {
|
|
18
|
+
storyId: string;
|
|
19
|
+
storyRevision?: string;
|
|
20
|
+
objective: FoundationRevision;
|
|
21
|
+
linkKind: StoryObjectiveLinkKind;
|
|
22
|
+
timeCondition?: FoundationTimeCondition;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Typed Story 02 operations over the shared foundation revision port.
|
|
26
|
+
*
|
|
27
|
+
* This class owns no storage. It prevents callers from accidentally using a
|
|
28
|
+
* Variable as an Objective, while the generic store remains the one canonical
|
|
29
|
+
* Graph SSOT writer and authorization boundary.
|
|
30
|
+
*/
|
|
31
|
+
export declare class CompanyOsObjectives {
|
|
32
|
+
private readonly store;
|
|
33
|
+
constructor(store: FoundationRevisionStore);
|
|
34
|
+
createObjective(definition: ObjectiveDefinition, context: FoundationStoreContext): Promise<FoundationRef>;
|
|
35
|
+
readObjective(id: string, context: FoundationStoreContext, revision?: string): Promise<FoundationCatalogRecord | null>;
|
|
36
|
+
updateObjective(id: string, expectedRevision: string, next: ObjectiveDefinition, context: FoundationStoreContext): Promise<FoundationRef>;
|
|
37
|
+
checkObjectiveReadiness(id: string, context: FoundationStoreContext, revision?: string): Promise<ObjectiveReadiness>;
|
|
38
|
+
createVariable(definition: VariableDefinition, context: FoundationStoreContext): Promise<FoundationRef>;
|
|
39
|
+
readVariable(id: string, context: FoundationStoreContext, revision?: string): Promise<FoundationCatalogRecord | null>;
|
|
40
|
+
updateVariable(id: string, expectedRevision: string, next: VariableDefinition, context: FoundationStoreContext): Promise<FoundationRef>;
|
|
41
|
+
/** Exposes typed relation persistence without creating a second relation store. */
|
|
42
|
+
addRelation(relation: Parameters<FoundationRevisionStore['addRelation']>[0], context: FoundationStoreContext): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Stores one explicitly typed Story/Objective reference. The relation kind
|
|
45
|
+
* is required by the caller and is never inferred from the Story text.
|
|
46
|
+
* Objective revisions are supplied explicitly so a later Objective update
|
|
47
|
+
* cannot silently rewrite the historical link.
|
|
48
|
+
*/
|
|
49
|
+
linkObjectiveStory(input: StoryObjectiveLinkInput, context: FoundationStoreContext): Promise<void>;
|
|
50
|
+
private readTyped;
|
|
51
|
+
}
|
|
52
|
+
export declare function createCompanyOsObjectives(store: FoundationRevisionStore): CompanyOsObjectives;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { validateFoundationDefinition } from './ontology-foundation.js';
|
|
2
|
+
/**
|
|
3
|
+
* Typed Story 02 operations over the shared foundation revision port.
|
|
4
|
+
*
|
|
5
|
+
* This class owns no storage. It prevents callers from accidentally using a
|
|
6
|
+
* Variable as an Objective, while the generic store remains the one canonical
|
|
7
|
+
* Graph SSOT writer and authorization boundary.
|
|
8
|
+
*/
|
|
9
|
+
export class CompanyOsObjectives {
|
|
10
|
+
store;
|
|
11
|
+
constructor(store) {
|
|
12
|
+
this.store = store;
|
|
13
|
+
}
|
|
14
|
+
createObjective(definition, context) {
|
|
15
|
+
assertType(definition, 'objective');
|
|
16
|
+
return this.store.create(definition, context);
|
|
17
|
+
}
|
|
18
|
+
readObjective(id, context, revision) {
|
|
19
|
+
return this.readTyped('objective', id, context, revision);
|
|
20
|
+
}
|
|
21
|
+
updateObjective(id, expectedRevision, next, context) {
|
|
22
|
+
assertType(next, 'objective');
|
|
23
|
+
return this.store.update({
|
|
24
|
+
reference: { id, type: 'objective', revision: expectedRevision },
|
|
25
|
+
next,
|
|
26
|
+
expectedRevision
|
|
27
|
+
}, context);
|
|
28
|
+
}
|
|
29
|
+
async checkObjectiveReadiness(id, context, revision) {
|
|
30
|
+
const record = await this.readObjective(id, context, revision);
|
|
31
|
+
if (!record) {
|
|
32
|
+
return {
|
|
33
|
+
ready: false,
|
|
34
|
+
issues: [{ code: 'NOT_FOUND', path: 'id', message: `Objective ${id} was not found.` }]
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const objective = record.definition;
|
|
38
|
+
const issues = validationIssues(objective, 'judgment');
|
|
39
|
+
const criteria = Array.isArray(objective.criteria) ? objective.criteria : [];
|
|
40
|
+
for (const [index, criterion] of criteria.entries()) {
|
|
41
|
+
if (!criterion || typeof criterion !== 'object' || !criterion.variableRef)
|
|
42
|
+
continue;
|
|
43
|
+
if (!isVariableRevisionReference(criterion.variableRef)) {
|
|
44
|
+
issues.push({
|
|
45
|
+
code: 'INVALID_VARIABLE_REFERENCE',
|
|
46
|
+
path: `criteria[${index}].variableRef`,
|
|
47
|
+
message: 'Criterion must reference a Variable with a positive revision.'
|
|
48
|
+
});
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const variable = await this.store.read(criterion.variableRef, context);
|
|
52
|
+
if (!variable) {
|
|
53
|
+
issues.push({
|
|
54
|
+
code: 'MISSING_VARIABLE_REVISION',
|
|
55
|
+
path: `criteria[${index}].variableRef`,
|
|
56
|
+
message: `Variable ${criterion.variableRef.id}@${criterion.variableRef.revision} was not found.`
|
|
57
|
+
});
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (variable.definition.type !== 'variable') {
|
|
61
|
+
issues.push({
|
|
62
|
+
code: 'INVALID_VARIABLE_REFERENCE',
|
|
63
|
+
path: `criteria[${index}].variableRef`,
|
|
64
|
+
message: `Criterion ${criterion.variableRef.id}@${criterion.variableRef.revision} is not a Variable.`
|
|
65
|
+
});
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
for (const issue of validationIssues(variable.definition, 'judgment')) {
|
|
69
|
+
issues.push({
|
|
70
|
+
...issue,
|
|
71
|
+
path: `criteria[${index}].variableRef.${issue.path}`
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
issues.push(...criterionCompatibilityIssues(criterion, variable.definition, index));
|
|
75
|
+
}
|
|
76
|
+
return { ready: issues.length === 0, issues };
|
|
77
|
+
}
|
|
78
|
+
createVariable(definition, context) {
|
|
79
|
+
assertType(definition, 'variable');
|
|
80
|
+
return this.store.create(definition, context);
|
|
81
|
+
}
|
|
82
|
+
readVariable(id, context, revision) {
|
|
83
|
+
return this.readTyped('variable', id, context, revision);
|
|
84
|
+
}
|
|
85
|
+
updateVariable(id, expectedRevision, next, context) {
|
|
86
|
+
assertType(next, 'variable');
|
|
87
|
+
return this.store.update({
|
|
88
|
+
reference: { id, type: 'variable', revision: expectedRevision },
|
|
89
|
+
next,
|
|
90
|
+
expectedRevision
|
|
91
|
+
}, context);
|
|
92
|
+
}
|
|
93
|
+
/** Exposes typed relation persistence without creating a second relation store. */
|
|
94
|
+
addRelation(relation, context) {
|
|
95
|
+
return this.store.addRelation(relation, context);
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Stores one explicitly typed Story/Objective reference. The relation kind
|
|
99
|
+
* is required by the caller and is never inferred from the Story text.
|
|
100
|
+
* Objective revisions are supplied explicitly so a later Objective update
|
|
101
|
+
* cannot silently rewrite the historical link.
|
|
102
|
+
*/
|
|
103
|
+
linkObjectiveStory(input, context) {
|
|
104
|
+
if (!input || typeof input.storyId !== 'string' || input.storyId.length === 0) {
|
|
105
|
+
throw new TypeError('A Story id is required');
|
|
106
|
+
}
|
|
107
|
+
if (!input.objective || input.objective.type !== 'objective') {
|
|
108
|
+
throw new TypeError('A versioned Objective reference is required');
|
|
109
|
+
}
|
|
110
|
+
const relationByKind = {
|
|
111
|
+
contribution: 'contributes_to',
|
|
112
|
+
execution_dependency: 'execution_depends_on',
|
|
113
|
+
time_condition: 'time_condition'
|
|
114
|
+
};
|
|
115
|
+
return this.addRelation({
|
|
116
|
+
relation: relationByKind[input.linkKind],
|
|
117
|
+
source: {
|
|
118
|
+
id: input.storyId,
|
|
119
|
+
type: 'story',
|
|
120
|
+
...(input.storyRevision === undefined ? {} : { revision: input.storyRevision })
|
|
121
|
+
},
|
|
122
|
+
target: input.objective,
|
|
123
|
+
...(input.timeCondition === undefined ? {} : { timeCondition: input.timeCondition })
|
|
124
|
+
}, context);
|
|
125
|
+
}
|
|
126
|
+
readTyped(type, id, context, revision) {
|
|
127
|
+
if (revision !== undefined) {
|
|
128
|
+
return this.store.read({ id, type, revision }, context);
|
|
129
|
+
}
|
|
130
|
+
return this.store.readLatest(type, id, context);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
export function createCompanyOsObjectives(store) {
|
|
134
|
+
return new CompanyOsObjectives(store);
|
|
135
|
+
}
|
|
136
|
+
function assertType(definition, type) {
|
|
137
|
+
if (!definition || definition.type !== type) {
|
|
138
|
+
throw new TypeError(`Expected a ${type} definition`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function validationIssues(definition, use) {
|
|
142
|
+
try {
|
|
143
|
+
const result = validateFoundationDefinition(definition, { use });
|
|
144
|
+
return result.issues.map((issue) => ({
|
|
145
|
+
code: issue.code,
|
|
146
|
+
path: issue.path,
|
|
147
|
+
message: issue.message
|
|
148
|
+
}));
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
return [{
|
|
152
|
+
code: 'INVALID_FIELD',
|
|
153
|
+
path: 'definition',
|
|
154
|
+
message: error instanceof Error ? error.message : String(error)
|
|
155
|
+
}];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function isVariableRevisionReference(value) {
|
|
159
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value))
|
|
160
|
+
return false;
|
|
161
|
+
const candidate = value;
|
|
162
|
+
return candidate.type === 'variable'
|
|
163
|
+
&& typeof candidate.id === 'string'
|
|
164
|
+
&& candidate.id.length > 0
|
|
165
|
+
&& typeof candidate.revision === 'string'
|
|
166
|
+
&& /^[1-9]\d*$/.test(candidate.revision);
|
|
167
|
+
}
|
|
168
|
+
function criterionCompatibilityIssues(criterion, variable, index) {
|
|
169
|
+
const path = `criteria[${index}]`;
|
|
170
|
+
if (criterion.target === undefined)
|
|
171
|
+
return [];
|
|
172
|
+
if (criterion.operator === 'at_least' || criterion.operator === 'at_most') {
|
|
173
|
+
if (variable.valueKind !== 'number' || typeof criterion.target !== 'number' || !Number.isFinite(criterion.target)) {
|
|
174
|
+
return [{
|
|
175
|
+
code: 'CRITERION_TYPE_MISMATCH',
|
|
176
|
+
path,
|
|
177
|
+
message: `${criterion.operator} requires a numeric Variable and a finite number target.`
|
|
178
|
+
}];
|
|
179
|
+
}
|
|
180
|
+
return [];
|
|
181
|
+
}
|
|
182
|
+
if (criterion.operator !== 'equals')
|
|
183
|
+
return [];
|
|
184
|
+
const targetMatches = variable.valueKind === 'number'
|
|
185
|
+
? typeof criterion.target === 'number' && Number.isFinite(criterion.target)
|
|
186
|
+
: variable.valueKind === 'boolean'
|
|
187
|
+
? typeof criterion.target === 'boolean'
|
|
188
|
+
: (variable.valueKind === 'string' || variable.valueKind === 'state') && typeof criterion.target === 'string';
|
|
189
|
+
if (!targetMatches) {
|
|
190
|
+
return [{
|
|
191
|
+
code: 'CRITERION_TYPE_MISMATCH',
|
|
192
|
+
path,
|
|
193
|
+
message: `equals target type does not match Variable valueKind ${variable.valueKind}.`
|
|
194
|
+
}];
|
|
195
|
+
}
|
|
196
|
+
return [];
|
|
197
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { FoundationScope } from './ontology-foundation.js';
|
|
2
|
+
import type { OutcomeCasePort } from './company-os-evaluation.js';
|
|
3
|
+
export declare const COMPANY_OS_RECEIPT_ADAPTER_CONTRACT_VERSION: "0.1.1";
|
|
4
|
+
export declare const COMPANY_OS_RECEIPT_LINK_CATALOG_VERSION: 2;
|
|
5
|
+
export declare const COMPANY_OS_RECEIPT_LINK_SIDECAR: "evidence/company-os-receipt-links.json";
|
|
6
|
+
export type ReceiptSourceKind = 'run_receipt' | 'outcome_case' | 'meeting_context_receipt' | 'decision_event';
|
|
7
|
+
export type ReceiptUnknownOwnerReason = 'not_recorded' | 'legacy_untyped' | 'source_unavailable';
|
|
8
|
+
export interface ReceiptEntityReference {
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly type: string;
|
|
11
|
+
readonly revision?: string;
|
|
12
|
+
readonly digest?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface ReceiptTypedOwnerReference {
|
|
15
|
+
readonly status: 'typed';
|
|
16
|
+
readonly ref: ReceiptEntityReference;
|
|
17
|
+
}
|
|
18
|
+
export interface ReceiptUnknownOwnerReference {
|
|
19
|
+
readonly status: 'unknown';
|
|
20
|
+
readonly reason: ReceiptUnknownOwnerReason;
|
|
21
|
+
}
|
|
22
|
+
export type ReceiptOwnerReference = ReceiptTypedOwnerReference | ReceiptUnknownOwnerReference;
|
|
23
|
+
export type ReceiptSourceConditionValue = string | number | boolean | null | readonly ReceiptSourceConditionValue[] | {
|
|
24
|
+
readonly [key: string]: ReceiptSourceConditionValue;
|
|
25
|
+
};
|
|
26
|
+
export type ReceiptSourceConditions = Readonly<Record<string, ReceiptSourceConditionValue>>;
|
|
27
|
+
/**
|
|
28
|
+
* The source's original identity and state. `hash: null` means the source
|
|
29
|
+
* did not record a hash; the adapter never computes one as a replacement.
|
|
30
|
+
*/
|
|
31
|
+
export interface ReceiptSourceReference {
|
|
32
|
+
readonly kind: ReceiptSourceKind;
|
|
33
|
+
readonly id: string;
|
|
34
|
+
readonly revision?: string;
|
|
35
|
+
readonly hash: string | null;
|
|
36
|
+
readonly state: string;
|
|
37
|
+
readonly owner_refs: readonly ReceiptOwnerReference[];
|
|
38
|
+
/** Optional source-owned conditions that are part of the stable identity. */
|
|
39
|
+
readonly conditions?: ReceiptSourceConditions;
|
|
40
|
+
}
|
|
41
|
+
export type ReceiptJudgmentReferenceKind = 'problem' | 'objective' | 'model' | 'constraint' | 'dag' | 'decision' | 'evaluation' | 'evidence';
|
|
42
|
+
export interface ReceiptJudgmentReference {
|
|
43
|
+
readonly kind: ReceiptJudgmentReferenceKind;
|
|
44
|
+
readonly id: string;
|
|
45
|
+
readonly revision?: string;
|
|
46
|
+
readonly digest?: string;
|
|
47
|
+
}
|
|
48
|
+
export interface ReceiptAccessContext {
|
|
49
|
+
/** Identity resolved by a trusted caller boundary. */
|
|
50
|
+
readonly principal: string;
|
|
51
|
+
readonly scope?: FoundationScope;
|
|
52
|
+
}
|
|
53
|
+
/** A source-owner read port. It must enforce its current ACL before returning. */
|
|
54
|
+
export interface ReceiptSourcePort {
|
|
55
|
+
read(reference: ReceiptSourceReference, access: ReceiptAccessContext): Promise<ReceiptSourceProjection | null>;
|
|
56
|
+
}
|
|
57
|
+
export interface ReceiptSourceProjection {
|
|
58
|
+
/** Current source identity/state; the stored link remains immutable. */
|
|
59
|
+
readonly reference: ReceiptSourceReference;
|
|
60
|
+
}
|
|
61
|
+
export interface ReceiptLinkRequest {
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly source: ReceiptSourceReference;
|
|
64
|
+
readonly judgment_refs: readonly ReceiptJudgmentReference[];
|
|
65
|
+
readonly recorded_at: string;
|
|
66
|
+
readonly access: ReceiptAccessContext;
|
|
67
|
+
}
|
|
68
|
+
export interface ReceiptLinkRecord {
|
|
69
|
+
readonly version: typeof COMPANY_OS_RECEIPT_LINK_CATALOG_VERSION;
|
|
70
|
+
readonly id: string;
|
|
71
|
+
/** The source reference captured at link time, not a mutable source copy. */
|
|
72
|
+
readonly source: ReceiptSourceReference;
|
|
73
|
+
/** Digest of the immutable source snapshot; source.hash remains source-owned metadata. */
|
|
74
|
+
readonly source_digest: string;
|
|
75
|
+
readonly judgment_refs: readonly ReceiptJudgmentReference[];
|
|
76
|
+
readonly recorded_at: string;
|
|
77
|
+
/** These statuses are intentionally not derived from source execution state. */
|
|
78
|
+
readonly objective_status: 'unrecorded';
|
|
79
|
+
readonly judgment_quality_status: 'unrecorded';
|
|
80
|
+
}
|
|
81
|
+
export interface ReceiptSourceRead {
|
|
82
|
+
readonly reference: ReceiptSourceReference;
|
|
83
|
+
readonly state_changed: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface ReceiptProjection {
|
|
86
|
+
readonly link: ReceiptLinkRecord;
|
|
87
|
+
readonly source_read: ReceiptSourceRead;
|
|
88
|
+
}
|
|
89
|
+
export interface ReceiptAdapterPort {
|
|
90
|
+
link(request: ReceiptLinkRequest): Promise<ReceiptProjection>;
|
|
91
|
+
read(id: string, access: ReceiptAccessContext): Promise<ReceiptProjection | null>;
|
|
92
|
+
list(access: ReceiptAccessContext): Promise<readonly ReceiptProjection[]>;
|
|
93
|
+
}
|
|
94
|
+
export interface CompanyOsReceiptAdapterOptions {
|
|
95
|
+
readonly dataDir: string;
|
|
96
|
+
readonly sourcePorts: Partial<Record<ReceiptSourceKind, ReceiptSourcePort>>;
|
|
97
|
+
}
|
|
98
|
+
export type ReceiptAdapterErrorCode = 'invalid_input' | 'not_found' | 'authorization_denied' | 'source_unavailable' | 'source_not_found' | 'integrity_mismatch' | 'revision_conflict' | 'corrupt_record' | 'readback_mismatch';
|
|
99
|
+
export declare class CompanyOsReceiptAdapterError extends Error {
|
|
100
|
+
readonly code: ReceiptAdapterErrorCode;
|
|
101
|
+
constructor(code: ReceiptAdapterErrorCode, message: string);
|
|
102
|
+
}
|
|
103
|
+
export declare function createCompanyOsReceiptAdapter(options: CompanyOsReceiptAdapterOptions): ReceiptAdapterPort;
|
|
104
|
+
/**
|
|
105
|
+
* Reuses the existing read-only OutcomeCasePort without importing any
|
|
106
|
+
* organization runtime. OutcomeCase closure and evaluation remain owned by
|
|
107
|
+
* that provider; this adapter only exposes a source projection.
|
|
108
|
+
*/
|
|
109
|
+
export declare function createOutcomeCaseReceiptSourcePort(port: OutcomeCasePort): ReceiptSourcePort;
|