@empressaio/atom-contract 1.7.0 → 1.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.
- package/CHANGELOG.md +103 -0
- package/README.md +39 -0
- package/dist/actor-record.d.ts +208 -0
- package/dist/actor-record.d.ts.map +1 -0
- package/dist/actor-record.js +98 -0
- package/dist/actor-record.js.map +1 -0
- package/dist/conformance/common.d.ts +11 -0
- package/dist/conformance/common.d.ts.map +1 -1
- package/dist/conformance/common.js +9 -0
- package/dist/conformance/common.js.map +1 -1
- package/dist/conformance/index.d.ts +1 -1
- package/dist/conformance/index.d.ts.map +1 -1
- package/dist/conformance/index.js +1 -1
- package/dist/conformance/index.js.map +1 -1
- package/dist/encumbrances/administrative-rule.d.ts +2 -2
- package/dist/encumbrances/restriction-clause.d.ts +2 -2
- package/dist/encumbrances/restriction-corpus.d.ts +2 -2
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/obligation.d.ts +54 -6
- package/dist/obligation.d.ts.map +1 -1
- package/dist/obligation.js +14 -0
- package/dist/obligation.js.map +1 -1
- package/dist/og/common.d.ts +2 -2
- package/dist/og/mineral-lease.d.ts +6 -6
- package/dist/og/ownership-interest.d.ts +8 -8
- package/dist/og/pad.d.ts +6 -6
- package/dist/og/production-timeseries.d.ts +4 -4
- package/dist/og/rrc-lease.d.ts +4 -4
- package/dist/og/well.d.ts +4 -4
- package/dist/og/zone.d.ts +2 -2
- package/dist/property/buildable-envelope.d.ts +464 -0
- package/dist/property/buildable-envelope.d.ts.map +1 -0
- package/dist/property/buildable-envelope.js +63 -0
- package/dist/property/buildable-envelope.js.map +1 -0
- package/dist/property/common.d.ts +513 -0
- package/dist/property/common.d.ts.map +1 -0
- package/dist/property/common.js +66 -0
- package/dist/property/common.js.map +1 -0
- package/dist/property/fixtures.d.ts +102 -0
- package/dist/property/fixtures.d.ts.map +1 -0
- package/dist/property/fixtures.js +299 -0
- package/dist/property/fixtures.js.map +1 -0
- package/dist/property/index.d.ts +23 -0
- package/dist/property/index.d.ts.map +1 -0
- package/dist/property/index.js +19 -0
- package/dist/property/index.js.map +1 -0
- package/dist/property/setback-rule.d.ts +887 -0
- package/dist/property/setback-rule.d.ts.map +1 -0
- package/dist/property/setback-rule.js +53 -0
- package/dist/property/setback-rule.js.map +1 -0
- package/dist/property/zoning-fact.d.ts +538 -0
- package/dist/property/zoning-fact.d.ts.map +1 -0
- package/dist/property/zoning-fact.js +48 -0
- package/dist/property/zoning-fact.js.map +1 -0
- package/dist/read-contract/index.d.ts +1 -0
- package/dist/read-contract/index.d.ts.map +1 -1
- package/dist/read-contract/index.js +1 -0
- package/dist/read-contract/index.js.map +1 -1
- package/dist/read-contract/reasoning-axes.d.ts +475 -0
- package/dist/read-contract/reasoning-axes.d.ts.map +1 -0
- package/dist/read-contract/reasoning-axes.js +75 -0
- package/dist/read-contract/reasoning-axes.js.map +1 -0
- package/dist/reasoning/fixtures.d.ts +63 -0
- package/dist/reasoning/fixtures.d.ts.map +1 -0
- package/dist/reasoning/fixtures.js +127 -0
- package/dist/reasoning/fixtures.js.map +1 -0
- package/dist/reasoning/index.d.ts +9 -0
- package/dist/reasoning/index.d.ts.map +1 -0
- package/dist/reasoning/index.js +9 -0
- package/dist/reasoning/index.js.map +1 -0
- package/dist/reasoning-chain.d.ts +177 -0
- package/dist/reasoning-chain.d.ts.map +1 -0
- package/dist/reasoning-chain.js +63 -0
- package/dist/reasoning-chain.js.map +1 -0
- package/dist/workspace/property-workspace.d.ts +6 -6
- package/package.json +9 -1
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reasoning-chain conformance fixtures per Gate B §2.3 and §5.7.
|
|
3
|
+
*
|
|
4
|
+
* Property entityTypes (zoning-fact, setback-rule, buildable-envelope) are
|
|
5
|
+
* Phase 1b bindings — named in comments, not registered as full kinds in 1.8.0.
|
|
6
|
+
*/
|
|
7
|
+
import { createReasoningReadContract, createReasoningThreeAxisConfidence, } from "../read-contract/reasoning-axes.js";
|
|
8
|
+
import { createWidthedConfidence } from "../read-contract/common.js";
|
|
9
|
+
import { createOgAssertedConfidence } from "../og/common.js";
|
|
10
|
+
import { ICC_ACTOR_RECORD_FIXTURE } from "../actor-record.js";
|
|
11
|
+
const SAMPLE_ASSERTED = createWidthedConfidence({
|
|
12
|
+
estimate: 0.85,
|
|
13
|
+
n: 0,
|
|
14
|
+
intervalWidth: 0.3,
|
|
15
|
+
provenance: "asserted",
|
|
16
|
+
});
|
|
17
|
+
const SAMPLE_CALIBRATED = createWidthedConfidence({
|
|
18
|
+
estimate: 0.78,
|
|
19
|
+
n: 12,
|
|
20
|
+
intervalWidth: 0.15,
|
|
21
|
+
provenance: "backtest",
|
|
22
|
+
});
|
|
23
|
+
/** Observed fact stub — public-free with provenance fields present. */
|
|
24
|
+
export const OBSERVED_FACT_REASONING_STUB = {
|
|
25
|
+
entityTypeHint: "zoning-fact", // Phase 1b binding
|
|
26
|
+
reasoningChain: { reasoningKind: "observed" },
|
|
27
|
+
sourceCitation: "Bastrop County Appraisal District parcel record 2024",
|
|
28
|
+
extractedAt: "2026-07-23T12:00:00.000Z",
|
|
29
|
+
accessPolicy: "public-free",
|
|
30
|
+
};
|
|
31
|
+
/** Derived envelope stub — not-applicable consequence, no stuffed ASCE7. */
|
|
32
|
+
export const DERIVED_ENVELOPE_REASONING_STUB = {
|
|
33
|
+
entityTypeHint: "buildable-envelope", // Phase 1b binding
|
|
34
|
+
reasoningChain: {
|
|
35
|
+
reasoningKind: "derived",
|
|
36
|
+
derivationMethod: "buildable-envelope-inset-v1",
|
|
37
|
+
inputAtomRefs: [
|
|
38
|
+
{
|
|
39
|
+
atomDid: "did:hauska:atom:zoning-fact:bastrop-r1-demo",
|
|
40
|
+
role: "fact",
|
|
41
|
+
entityType: "zoning-fact",
|
|
42
|
+
citationLabel: "R-1 zoning district",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
atomDid: "did:hauska:atom:setback-rule:bastrop-front-side-demo",
|
|
46
|
+
role: "rule",
|
|
47
|
+
entityType: "setback-rule",
|
|
48
|
+
citationLabel: "Front and side setback requirements",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
atomDid: "ref:geometry:parcel-footprint-demo",
|
|
52
|
+
role: "reference-field",
|
|
53
|
+
citationLabel: "Parcel footprint geometry",
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
atomDid: "ref:geometry:front-edge-demo",
|
|
57
|
+
role: "reference-field",
|
|
58
|
+
citationLabel: "Front lot line edge",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
62
|
+
sourceCitation: "Derived from zoning fact + setback rule + parcel geometry",
|
|
63
|
+
extractedAt: "2026-07-23T12:00:00.000Z",
|
|
64
|
+
accessPolicy: "public-free",
|
|
65
|
+
readContract: createReasoningReadContract({
|
|
66
|
+
axes: createReasoningThreeAxisConfidence({
|
|
67
|
+
calibratedConfidence: SAMPLE_CALIBRATED,
|
|
68
|
+
assertedConfidence: SAMPLE_ASSERTED,
|
|
69
|
+
consequence: {
|
|
70
|
+
kind: "not-applicable",
|
|
71
|
+
reason: "envelope-geometry-derivation-has-no-life-safety-stratum",
|
|
72
|
+
assertedAt: "2026-07-23T12:00:00.000Z",
|
|
73
|
+
},
|
|
74
|
+
}),
|
|
75
|
+
assembledAt: "2026-07-23T12:00:00.000Z",
|
|
76
|
+
}),
|
|
77
|
+
};
|
|
78
|
+
/** Negative fixture inputs — validated in tests, not valid instances. */
|
|
79
|
+
export const NEGATIVE_DERIVED_NO_INPUT_REFS = {
|
|
80
|
+
reasoningKind: "derived",
|
|
81
|
+
derivationMethod: "buildable-envelope-inset-v1",
|
|
82
|
+
inputAtomRefs: [],
|
|
83
|
+
};
|
|
84
|
+
export const NEGATIVE_DERIVED_EMPTY_ATOM_DID = {
|
|
85
|
+
reasoningKind: "derived",
|
|
86
|
+
derivationMethod: "buildable-envelope-inset-v1",
|
|
87
|
+
inputAtomRefs: [{ atomDid: "", role: "fact" }],
|
|
88
|
+
};
|
|
89
|
+
/** Re-export ICC actor for obligation edge demonstrations. */
|
|
90
|
+
export { ICC_ACTOR_RECORD_FIXTURE };
|
|
91
|
+
/**
|
|
92
|
+
* ICC inbound reference royalty — reuses shipped ObligationAtomInstance shape.
|
|
93
|
+
* amount omitted with graceTerms pending-rate when commercial rates unset (I-K).
|
|
94
|
+
*/
|
|
95
|
+
export const ICC_LICENSE_REFERENCE_OBLIGATION_FIXTURE = {
|
|
96
|
+
entityType: "obligation",
|
|
97
|
+
obligationDid: "oblg_a1b2c3d4e5f67890",
|
|
98
|
+
obligationType: "license-reference-royalty",
|
|
99
|
+
anchorDid: "did:hauska:atom:code-section:ibc-2024-1003-demo",
|
|
100
|
+
anchorKind: "code-section",
|
|
101
|
+
owedToActorDid: ICC_ACTOR_RECORD_FIXTURE.actorId,
|
|
102
|
+
dueDate: "2026-07-23T12:00:00.000Z",
|
|
103
|
+
recurrence: "per-reference",
|
|
104
|
+
graceTerms: "pending-rate",
|
|
105
|
+
status: "upcoming",
|
|
106
|
+
confidence: createOgAssertedConfidence(0.9),
|
|
107
|
+
sourceCitation: "ICC IBC 2024 Section 1003.1",
|
|
108
|
+
extractedAt: "2026-07-23T12:00:00.000Z",
|
|
109
|
+
accessPolicy: "platform-internal",
|
|
110
|
+
};
|
|
111
|
+
/** Negative obligation fixture — license type without owedToActorDid. */
|
|
112
|
+
export const NEGATIVE_ICC_OBLIGATION_MISSING_ACTOR = {
|
|
113
|
+
entityType: "obligation",
|
|
114
|
+
obligationDid: "oblg_b2c3d4e5f6789012",
|
|
115
|
+
obligationType: "license-reference-royalty",
|
|
116
|
+
anchorDid: "did:hauska:atom:code-section:ibc-2024-1003-demo",
|
|
117
|
+
anchorKind: "code-section",
|
|
118
|
+
dueDate: "2026-07-23T12:00:00.000Z",
|
|
119
|
+
recurrence: "per-reference",
|
|
120
|
+
graceTerms: "pending-rate",
|
|
121
|
+
status: "upcoming",
|
|
122
|
+
confidence: createOgAssertedConfidence(0.9),
|
|
123
|
+
sourceCitation: "ICC IBC 2024 Section 1003.1",
|
|
124
|
+
extractedAt: "2026-07-23T12:00:00.000Z",
|
|
125
|
+
accessPolicy: "platform-internal",
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=fixtures.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../src/reasoning/fixtures.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EACL,2BAA2B,EAC3B,kCAAkC,GAEnC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAErE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAa9D,MAAM,eAAe,GAAG,uBAAuB,CAAC;IAC9C,QAAQ,EAAE,IAAI;IACd,CAAC,EAAE,CAAC;IACJ,aAAa,EAAE,GAAG;IAClB,UAAU,EAAE,UAAU;CACvB,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;IAChD,QAAQ,EAAE,IAAI;IACd,CAAC,EAAE,EAAE;IACL,aAAa,EAAE,IAAI;IACnB,UAAU,EAAE,UAAU;CACvB,CAAC,CAAC;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,4BAA4B,GAA0B;IACjE,cAAc,EAAE,aAAa,EAAE,mBAAmB;IAClD,cAAc,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE;IAC7C,cAAc,EAAE,sDAAsD;IACtE,WAAW,EAAE,0BAA0B;IACvC,YAAY,EAAE,aAAa;CAC5B,CAAC;AAEF,4EAA4E;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAA0B;IACpE,cAAc,EAAE,oBAAoB,EAAE,mBAAmB;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8D;AAC9D,OAAO,EAAE,wBAAwB,EAAE,CAAC;AAEpC;;;GAGG;AACH,MAAM,CAAC,MAAM,wCAAwC,GAA2B;IAC9E,UAAU,EAAE,YAAY;IACxB,aAAa,EAAE,uBAAuB;IACtC,cAAc,EAAE,2BAA2B;IAC3C,SAAS,EAAE,iDAAiD;IAC5D,UAAU,EAAE,cAAc;IAC1B,cAAc,EAAE,wBAAwB,CAAC,OAAO;IAChD,OAAO,EAAE,0BAA0B;IACnC,UAAU,EAAE,eAAe;IAC3B,UAAU,EAAE,cAAc;IAC1B,MAAM,EAAE,UAAU;IAClB,UAAU,EAAE,0BAA0B,CAAC,GAAG,CAAC;IAC3C,cAAc,EAAE,6BAA6B;IAC7C,WAAW,EAAE,0BAA0B;IACvC,YAAY,EAAE,mBAAmB;CAClC,CAAC;AAEF,yEAAyE;AACzE,MAAM,CAAC,MAAM,qCAAqC,GAAG;IACnD,UAAU,EAAE,YAAqB;IACjC,aAAa,EAAE,uBAAuB;IACtC,cAAc,EAAE,2BAAoC;IACpD,SAAS,EAAE,iDAAiD;IAC5D,UAAU,EAAE,cAAc;IAC1B,OAAO,EAAE,0BAA0B;IACnC,UAAU,EAAE,eAAe;IAC3B,UAAU,EAAE,cAAc;IAC1B,MAAM,EAAE,UAAmB;IAC3B,UAAU,EAAE,0BAA0B,CAAC,GAAG,CAAC;IAC3C,cAAc,EAAE,6BAA6B;IAC7C,WAAW,EAAE,0BAA0B;IACvC,YAAY,EAAE,mBAA4B;CAC3C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reasoning-chain primitive and fixtures (Gate B §2.5.1).
|
|
3
|
+
*
|
|
4
|
+
* Import from `@empressaio/atom-contract/reasoning`. The main barrel also
|
|
5
|
+
* exports these symbols; this subpath mirrors `./og` convenience.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../reasoning-chain.js";
|
|
8
|
+
export * from "./fixtures.js";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reasoning/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reasoning-chain primitive and fixtures (Gate B §2.5.1).
|
|
3
|
+
*
|
|
4
|
+
* Import from `@empressaio/atom-contract/reasoning`. The main barrel also
|
|
5
|
+
* exports these symbols; this subpath mirrors `./og` convenience.
|
|
6
|
+
*/
|
|
7
|
+
export * from "../reasoning-chain.js";
|
|
8
|
+
export * from "./fixtures.js";
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/reasoning/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core reasoning-chain primitive per Gate B §2.5.1.
|
|
3
|
+
*
|
|
4
|
+
* Generalizes the O&G production-timeseries derived idiom into an
|
|
5
|
+
* entity-type-agnostic shape for property reasoning and future compliance
|
|
6
|
+
* findings. O&G streams keep `derivesFromStreamDid`; new code uses
|
|
7
|
+
* `inputAtomRefs` as the contract-level expression of the `derives-from`
|
|
8
|
+
* semantic edge (see `./og/common.ts` link vocabulary).
|
|
9
|
+
*
|
|
10
|
+
* Composed confidence is NOT frozen on the instance — it resolves at read
|
|
11
|
+
* via calibration overlay (I-E) + asserted axes on
|
|
12
|
+
* {@link ReasoningReadContract}.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
/** Role of an input atom or reference field in a derivation chain. */
|
|
16
|
+
export type AtomInputRefRole = "fact" | "rule" | "derived" | "reference-field";
|
|
17
|
+
export declare const ATOM_INPUT_REF_ROLES: ReadonlyArray<AtomInputRefRole>;
|
|
18
|
+
/**
|
|
19
|
+
* Stable typed pointer to an input atom in a reasoning chain.
|
|
20
|
+
* Bare strings without resolvable identity fail conformance for
|
|
21
|
+
* fact / rule / derived roles; reference-field cites external geometry.
|
|
22
|
+
*/
|
|
23
|
+
export interface AtomInputRef {
|
|
24
|
+
/** DID or atomDid string of the input atom. */
|
|
25
|
+
atomDid: string;
|
|
26
|
+
/**
|
|
27
|
+
* Role of this input in the derivation.
|
|
28
|
+
* - fact / rule / derived = atom inputs
|
|
29
|
+
* - reference-field = continuous cited input (geometry, topo, road) not atomized
|
|
30
|
+
*/
|
|
31
|
+
role: AtomInputRefRole;
|
|
32
|
+
/** Optional entityType hint for validators / UI (e.g. "zoning-fact", "setback-rule"). */
|
|
33
|
+
entityType?: string;
|
|
34
|
+
/** Optional human citation label for inspect-card rendering. */
|
|
35
|
+
citationLabel?: string;
|
|
36
|
+
}
|
|
37
|
+
export declare const ATOM_INPUT_REF_SCHEMA: z.ZodReadonly<z.ZodObject<{
|
|
38
|
+
atomDid: z.ZodString;
|
|
39
|
+
role: z.ZodEnum<[AtomInputRefRole, ...AtomInputRefRole[]]>;
|
|
40
|
+
entityType: z.ZodOptional<z.ZodString>;
|
|
41
|
+
citationLabel: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
atomDid: string;
|
|
44
|
+
role: AtomInputRefRole;
|
|
45
|
+
entityType?: string | undefined;
|
|
46
|
+
citationLabel?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
atomDid: string;
|
|
49
|
+
role: AtomInputRefRole;
|
|
50
|
+
entityType?: string | undefined;
|
|
51
|
+
citationLabel?: string | undefined;
|
|
52
|
+
}>>;
|
|
53
|
+
/**
|
|
54
|
+
* Discriminated reasoning block. Observed atoms omit derivation fields.
|
|
55
|
+
* Derived atoms MUST carry method + at least one input ref.
|
|
56
|
+
*/
|
|
57
|
+
export type ReasoningChain = {
|
|
58
|
+
reasoningKind: "observed";
|
|
59
|
+
} | {
|
|
60
|
+
reasoningKind: "derived";
|
|
61
|
+
derivationMethod: string;
|
|
62
|
+
inputAtomRefs: AtomInputRef[];
|
|
63
|
+
};
|
|
64
|
+
export declare const REASONING_CHAIN_OBSERVED_SCHEMA: z.ZodObject<{
|
|
65
|
+
reasoningKind: z.ZodLiteral<"observed">;
|
|
66
|
+
}, "strip", z.ZodTypeAny, {
|
|
67
|
+
reasoningKind: "observed";
|
|
68
|
+
}, {
|
|
69
|
+
reasoningKind: "observed";
|
|
70
|
+
}>;
|
|
71
|
+
export declare const REASONING_CHAIN_DERIVED_SCHEMA: z.ZodObject<{
|
|
72
|
+
reasoningKind: z.ZodLiteral<"derived">;
|
|
73
|
+
derivationMethod: z.ZodString;
|
|
74
|
+
inputAtomRefs: z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
75
|
+
atomDid: z.ZodString;
|
|
76
|
+
role: z.ZodEnum<[AtomInputRefRole, ...AtomInputRefRole[]]>;
|
|
77
|
+
entityType: z.ZodOptional<z.ZodString>;
|
|
78
|
+
citationLabel: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
atomDid: string;
|
|
81
|
+
role: AtomInputRefRole;
|
|
82
|
+
entityType?: string | undefined;
|
|
83
|
+
citationLabel?: string | undefined;
|
|
84
|
+
}, {
|
|
85
|
+
atomDid: string;
|
|
86
|
+
role: AtomInputRefRole;
|
|
87
|
+
entityType?: string | undefined;
|
|
88
|
+
citationLabel?: string | undefined;
|
|
89
|
+
}>>, "many">;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
reasoningKind: "derived";
|
|
92
|
+
derivationMethod: string;
|
|
93
|
+
inputAtomRefs: Readonly<{
|
|
94
|
+
atomDid: string;
|
|
95
|
+
role: AtomInputRefRole;
|
|
96
|
+
entityType?: string | undefined;
|
|
97
|
+
citationLabel?: string | undefined;
|
|
98
|
+
}>[];
|
|
99
|
+
}, {
|
|
100
|
+
reasoningKind: "derived";
|
|
101
|
+
derivationMethod: string;
|
|
102
|
+
inputAtomRefs: Readonly<{
|
|
103
|
+
atomDid: string;
|
|
104
|
+
role: AtomInputRefRole;
|
|
105
|
+
entityType?: string | undefined;
|
|
106
|
+
citationLabel?: string | undefined;
|
|
107
|
+
}>[];
|
|
108
|
+
}>;
|
|
109
|
+
export declare const REASONING_CHAIN_SCHEMA: z.ZodEffects<z.ZodDiscriminatedUnion<"reasoningKind", [z.ZodObject<{
|
|
110
|
+
reasoningKind: z.ZodLiteral<"observed">;
|
|
111
|
+
}, "strip", z.ZodTypeAny, {
|
|
112
|
+
reasoningKind: "observed";
|
|
113
|
+
}, {
|
|
114
|
+
reasoningKind: "observed";
|
|
115
|
+
}>, z.ZodObject<{
|
|
116
|
+
reasoningKind: z.ZodLiteral<"derived">;
|
|
117
|
+
derivationMethod: z.ZodString;
|
|
118
|
+
inputAtomRefs: z.ZodArray<z.ZodReadonly<z.ZodObject<{
|
|
119
|
+
atomDid: z.ZodString;
|
|
120
|
+
role: z.ZodEnum<[AtomInputRefRole, ...AtomInputRefRole[]]>;
|
|
121
|
+
entityType: z.ZodOptional<z.ZodString>;
|
|
122
|
+
citationLabel: z.ZodOptional<z.ZodString>;
|
|
123
|
+
}, "strip", z.ZodTypeAny, {
|
|
124
|
+
atomDid: string;
|
|
125
|
+
role: AtomInputRefRole;
|
|
126
|
+
entityType?: string | undefined;
|
|
127
|
+
citationLabel?: string | undefined;
|
|
128
|
+
}, {
|
|
129
|
+
atomDid: string;
|
|
130
|
+
role: AtomInputRefRole;
|
|
131
|
+
entityType?: string | undefined;
|
|
132
|
+
citationLabel?: string | undefined;
|
|
133
|
+
}>>, "many">;
|
|
134
|
+
}, "strip", z.ZodTypeAny, {
|
|
135
|
+
reasoningKind: "derived";
|
|
136
|
+
derivationMethod: string;
|
|
137
|
+
inputAtomRefs: Readonly<{
|
|
138
|
+
atomDid: string;
|
|
139
|
+
role: AtomInputRefRole;
|
|
140
|
+
entityType?: string | undefined;
|
|
141
|
+
citationLabel?: string | undefined;
|
|
142
|
+
}>[];
|
|
143
|
+
}, {
|
|
144
|
+
reasoningKind: "derived";
|
|
145
|
+
derivationMethod: string;
|
|
146
|
+
inputAtomRefs: Readonly<{
|
|
147
|
+
atomDid: string;
|
|
148
|
+
role: AtomInputRefRole;
|
|
149
|
+
entityType?: string | undefined;
|
|
150
|
+
citationLabel?: string | undefined;
|
|
151
|
+
}>[];
|
|
152
|
+
}>]>, {
|
|
153
|
+
reasoningKind: "observed";
|
|
154
|
+
} | {
|
|
155
|
+
reasoningKind: "derived";
|
|
156
|
+
derivationMethod: string;
|
|
157
|
+
inputAtomRefs: Readonly<{
|
|
158
|
+
atomDid: string;
|
|
159
|
+
role: AtomInputRefRole;
|
|
160
|
+
entityType?: string | undefined;
|
|
161
|
+
citationLabel?: string | undefined;
|
|
162
|
+
}>[];
|
|
163
|
+
}, {
|
|
164
|
+
reasoningKind: "observed";
|
|
165
|
+
} | {
|
|
166
|
+
reasoningKind: "derived";
|
|
167
|
+
derivationMethod: string;
|
|
168
|
+
inputAtomRefs: Readonly<{
|
|
169
|
+
atomDid: string;
|
|
170
|
+
role: AtomInputRefRole;
|
|
171
|
+
entityType?: string | undefined;
|
|
172
|
+
citationLabel?: string | undefined;
|
|
173
|
+
}>[];
|
|
174
|
+
}>;
|
|
175
|
+
export declare function createReasoningChain(input: z.input<typeof REASONING_CHAIN_SCHEMA>): ReasoningChain;
|
|
176
|
+
export declare function validateReasoningChain(value: unknown): ReasoningChain;
|
|
177
|
+
//# sourceMappingURL=reasoning-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasoning-chain.d.ts","sourceRoot":"","sources":["../src/reasoning-chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK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
+
* entity-type-agnostic shape for property reasoning and future compliance
|
|
6
|
+
* findings. O&G streams keep `derivesFromStreamDid`; new code uses
|
|
7
|
+
* `inputAtomRefs` as the contract-level expression of the `derives-from`
|
|
8
|
+
* semantic edge (see `./og/common.ts` link vocabulary).
|
|
9
|
+
*
|
|
10
|
+
* Composed confidence is NOT frozen on the instance — it resolves at read
|
|
11
|
+
* via calibration overlay (I-E) + asserted axes on
|
|
12
|
+
* {@link ReasoningReadContract}.
|
|
13
|
+
*/
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
export const ATOM_INPUT_REF_ROLES = [
|
|
16
|
+
"fact",
|
|
17
|
+
"rule",
|
|
18
|
+
"derived",
|
|
19
|
+
"reference-field",
|
|
20
|
+
];
|
|
21
|
+
export const ATOM_INPUT_REF_SCHEMA = z
|
|
22
|
+
.object({
|
|
23
|
+
atomDid: z.string().min(1),
|
|
24
|
+
role: z.enum(ATOM_INPUT_REF_ROLES),
|
|
25
|
+
entityType: z.string().min(1).optional(),
|
|
26
|
+
citationLabel: z.string().min(1).optional(),
|
|
27
|
+
})
|
|
28
|
+
.readonly();
|
|
29
|
+
export const REASONING_CHAIN_OBSERVED_SCHEMA = z.object({
|
|
30
|
+
reasoningKind: z.literal("observed"),
|
|
31
|
+
});
|
|
32
|
+
export const REASONING_CHAIN_DERIVED_SCHEMA = z.object({
|
|
33
|
+
reasoningKind: z.literal("derived"),
|
|
34
|
+
derivationMethod: z.string().min(1),
|
|
35
|
+
inputAtomRefs: z.array(ATOM_INPUT_REF_SCHEMA).min(1),
|
|
36
|
+
});
|
|
37
|
+
export const REASONING_CHAIN_SCHEMA = z
|
|
38
|
+
.discriminatedUnion("reasoningKind", [
|
|
39
|
+
REASONING_CHAIN_OBSERVED_SCHEMA,
|
|
40
|
+
REASONING_CHAIN_DERIVED_SCHEMA,
|
|
41
|
+
])
|
|
42
|
+
.superRefine((data, ctx) => {
|
|
43
|
+
if (data.reasoningKind !== "derived") {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
for (let i = 0; i < data.inputAtomRefs.length; i++) {
|
|
47
|
+
const ref = data.inputAtomRefs[i];
|
|
48
|
+
if (!ref.atomDid || ref.atomDid.trim().length === 0) {
|
|
49
|
+
ctx.addIssue({
|
|
50
|
+
code: z.ZodIssueCode.custom,
|
|
51
|
+
message: "Every inputAtomRef must have a non-empty atomDid",
|
|
52
|
+
path: ["inputAtomRefs", i, "atomDid"],
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
export function createReasoningChain(input) {
|
|
58
|
+
return REASONING_CHAIN_SCHEMA.parse(input);
|
|
59
|
+
}
|
|
60
|
+
export function validateReasoningChain(value) {
|
|
61
|
+
return REASONING_CHAIN_SCHEMA.parse(value);
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=reasoning-chain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasoning-chain.js","sourceRoot":"","sources":["../src/reasoning-chain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,MAAM,CAAC,MAAM,oBAAoB,GAAoC;IACnE,MAAM;IACN,MAAM;IACN,SAAS;IACT,iBAAiB;CAClB,CAAC;AAsBF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAiE,CAAC;IAC/E,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACxC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;CAC5C,CAAC;KACD,QAAQ,EAAE,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oBAAoB,CAClC,KAA6C;IAE7C,OAAO,sBAAsB,CAAC,KAAK,CAAC,KAAK,CAAmB,CAAC;AAC/D,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,sBAAsB,CAAC,KAAK,CAAC,KAAK,CAAmB,CAAC;AAC/D,CAAC"}
|
|
@@ -23,15 +23,15 @@ export declare const PROPERTY_ADDRESS_IDENTITY_SCHEMA: z.ZodObject<{
|
|
|
23
23
|
postalCode: z.ZodString;
|
|
24
24
|
countryCode: z.ZodString;
|
|
25
25
|
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
line1: string;
|
|
27
26
|
city: string;
|
|
27
|
+
line1: string;
|
|
28
28
|
stateOrProvince: string;
|
|
29
29
|
postalCode: string;
|
|
30
30
|
countryCode: string;
|
|
31
31
|
line2?: string | undefined;
|
|
32
32
|
}, {
|
|
33
|
-
line1: string;
|
|
34
33
|
city: string;
|
|
34
|
+
line1: string;
|
|
35
35
|
stateOrProvince: string;
|
|
36
36
|
postalCode: string;
|
|
37
37
|
countryCode: string;
|
|
@@ -52,15 +52,15 @@ export declare const PROPERTY_WORKSPACE_SCHEMA: z.ZodObject<{
|
|
|
52
52
|
postalCode: z.ZodString;
|
|
53
53
|
countryCode: z.ZodString;
|
|
54
54
|
}, "strip", z.ZodTypeAny, {
|
|
55
|
-
line1: string;
|
|
56
55
|
city: string;
|
|
56
|
+
line1: string;
|
|
57
57
|
stateOrProvince: string;
|
|
58
58
|
postalCode: string;
|
|
59
59
|
countryCode: string;
|
|
60
60
|
line2?: string | undefined;
|
|
61
61
|
}, {
|
|
62
|
-
line1: string;
|
|
63
62
|
city: string;
|
|
63
|
+
line1: string;
|
|
64
64
|
stateOrProvince: string;
|
|
65
65
|
postalCode: string;
|
|
66
66
|
countryCode: string;
|
|
@@ -100,8 +100,8 @@ export declare const PROPERTY_WORKSPACE_SCHEMA: z.ZodObject<{
|
|
|
100
100
|
createdAt: string;
|
|
101
101
|
updatedAt: string;
|
|
102
102
|
address: {
|
|
103
|
-
line1: string;
|
|
104
103
|
city: string;
|
|
104
|
+
line1: string;
|
|
105
105
|
stateOrProvince: string;
|
|
106
106
|
postalCode: string;
|
|
107
107
|
countryCode: string;
|
|
@@ -125,8 +125,8 @@ export declare const PROPERTY_WORKSPACE_SCHEMA: z.ZodObject<{
|
|
|
125
125
|
createdAt: string;
|
|
126
126
|
updatedAt: string;
|
|
127
127
|
address: {
|
|
128
|
-
line1: string;
|
|
129
128
|
city: string;
|
|
129
|
+
line1: string;
|
|
130
130
|
stateOrProvince: string;
|
|
131
131
|
postalCode: string;
|
|
132
132
|
countryCode: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@empressaio/atom-contract",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.0",
|
|
4
4
|
"description": "The typed-data substrate every Empressa atom satisfies: identity, context interface, composition declaration, and history anchoring. Peer to the Hauska SDK (`@hauska-sdk/*`); consumed directly by every product surface and MCP server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,6 +42,14 @@
|
|
|
42
42
|
"types": "./dist/og/index.d.ts",
|
|
43
43
|
"import": "./dist/og/index.js"
|
|
44
44
|
},
|
|
45
|
+
"./reasoning": {
|
|
46
|
+
"types": "./dist/reasoning/index.d.ts",
|
|
47
|
+
"import": "./dist/reasoning/index.js"
|
|
48
|
+
},
|
|
49
|
+
"./property": {
|
|
50
|
+
"types": "./dist/property/index.d.ts",
|
|
51
|
+
"import": "./dist/property/index.js"
|
|
52
|
+
},
|
|
45
53
|
"./package.json": "./package.json"
|
|
46
54
|
},
|
|
47
55
|
"files": [
|