event-contract-builder 0.1.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.
@@ -0,0 +1,203 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * ISO 8601 date-time **with explicit offset or Z**. Naive timestamps are
4
+ * rejected because timezone ambiguity is a classic resolution-dispute vector.
5
+ */
6
+ export declare const IsoDateTime: z.ZodString;
7
+ /** IANA timezone identifier, e.g. `America/New_York`. */
8
+ export declare const IanaTimezone: z.ZodString;
9
+ /** Stable machine identifier: lowercase kebab-case. */
10
+ export declare const Slug: z.ZodString;
11
+ /**
12
+ * CNL sentence: a single declarative English sentence in the controlled
13
+ * vocabulary (see docs/cnl-grammar.md). Structural checks only — must start
14
+ * with a capital letter, end with a period, and contain no hedging terms.
15
+ */
16
+ export declare const CnlSentence: z.ZodString;
17
+ /** A measured quantity with its unit and exact measurement method. */
18
+ export declare const Metric: z.ZodObject<{
19
+ name: z.ZodString;
20
+ unit: z.ZodString;
21
+ extraction: z.ZodString;
22
+ revisionPolicy: z.ZodEnum<{
23
+ "first-published-value": "first-published-value";
24
+ "value-as-of-observation-time": "value-as-of-observation-time";
25
+ "final-revised-value": "final-revised-value";
26
+ }>;
27
+ }, z.core.$strip>;
28
+ /**
29
+ * Structured resolution criterion: the single decision rule that determines
30
+ * a contract's outcome. Exactly one variant applies per `Resolution`,
31
+ * selected by `kind`:
32
+ *
33
+ * - `threshold` — numeric comparison against one or two bounds.
34
+ * - `occurrence` — whether a discrete event did or did not occur.
35
+ * - `bucket-membership` — which contiguous bucket the metric falls into.
36
+ *
37
+ * `Resolution.canonicalStatement` is deterministically rendered from this
38
+ * value (see `COMPARATOR_PHRASES` and the CNL renderer), so the criterion
39
+ * and the human-readable prose can never diverge.
40
+ */
41
+ export declare const Criterion: z.ZodDiscriminatedUnion<[z.ZodObject<{
42
+ kind: z.ZodLiteral<"threshold">;
43
+ metric: z.ZodObject<{
44
+ name: z.ZodString;
45
+ unit: z.ZodString;
46
+ extraction: z.ZodString;
47
+ revisionPolicy: z.ZodEnum<{
48
+ "first-published-value": "first-published-value";
49
+ "value-as-of-observation-time": "value-as-of-observation-time";
50
+ "final-revised-value": "final-revised-value";
51
+ }>;
52
+ }, z.core.$strip>;
53
+ comparator: z.ZodEnum<{
54
+ "greater-than": "greater-than";
55
+ "greater-than-or-equal": "greater-than-or-equal";
56
+ "less-than": "less-than";
57
+ "less-than-or-equal": "less-than-or-equal";
58
+ "equal-to": "equal-to";
59
+ "between-inclusive": "between-inclusive";
60
+ }>;
61
+ threshold: z.ZodNumber;
62
+ thresholdUpper: z.ZodOptional<z.ZodNumber>;
63
+ }, z.core.$strip>, z.ZodObject<{
64
+ kind: z.ZodLiteral<"occurrence">;
65
+ comparator: z.ZodEnum<{
66
+ occurs: "occurs";
67
+ "does-not-occur": "does-not-occur";
68
+ }>;
69
+ eventClause: z.ZodString;
70
+ evidenceStandard: z.ZodString;
71
+ }, z.core.$strip>, z.ZodObject<{
72
+ kind: z.ZodLiteral<"bucket-membership">;
73
+ metric: z.ZodObject<{
74
+ name: z.ZodString;
75
+ unit: z.ZodString;
76
+ extraction: z.ZodString;
77
+ revisionPolicy: z.ZodEnum<{
78
+ "first-published-value": "first-published-value";
79
+ "value-as-of-observation-time": "value-as-of-observation-time";
80
+ "final-revised-value": "final-revised-value";
81
+ }>;
82
+ }, z.core.$strip>;
83
+ }, z.core.$strip>], "kind">;
84
+ /** A resolution data source with availability characteristics. */
85
+ export declare const DataSource: z.ZodObject<{
86
+ id: z.ZodString;
87
+ name: z.ZodString;
88
+ publisher: z.ZodString;
89
+ url: z.ZodURL;
90
+ datasetId: z.ZodOptional<z.ZodString>;
91
+ publicationSchedule: z.ZodString;
92
+ publiclyAccessible: z.ZodBoolean;
93
+ independenceNote: z.ZodString;
94
+ }, z.core.$strip>;
95
+ /** Ordered fallback with an enumerated trigger — no discretionary switching. */
96
+ export declare const Fallback: z.ZodObject<{
97
+ trigger: z.ZodEnum<{
98
+ "primary-not-published-by-deadline": "primary-not-published-by-deadline";
99
+ "primary-discontinued": "primary-discontinued";
100
+ "primary-methodology-materially-changed": "primary-methodology-materially-changed";
101
+ "primary-retracted-or-corrected": "primary-retracted-or-corrected";
102
+ }>;
103
+ sourceId: z.ZodString;
104
+ procedure: z.ZodString;
105
+ }, z.core.$strip>;
106
+ /** What happens if even the fallbacks fail or the outcome is undefined. */
107
+ export declare const TerminalAmbiguityPolicy: z.ZodEnum<{
108
+ "resolve-no": "resolve-no";
109
+ "resolve-to-floor": "resolve-to-floor";
110
+ "void-and-refund": "void-and-refund";
111
+ "exchange-determination-per-rulebook": "exchange-determination-per-rulebook";
112
+ }>;
113
+ export declare const Resolution: z.ZodObject<{
114
+ criterion: z.ZodDiscriminatedUnion<[z.ZodObject<{
115
+ kind: z.ZodLiteral<"threshold">;
116
+ metric: z.ZodObject<{
117
+ name: z.ZodString;
118
+ unit: z.ZodString;
119
+ extraction: z.ZodString;
120
+ revisionPolicy: z.ZodEnum<{
121
+ "first-published-value": "first-published-value";
122
+ "value-as-of-observation-time": "value-as-of-observation-time";
123
+ "final-revised-value": "final-revised-value";
124
+ }>;
125
+ }, z.core.$strip>;
126
+ comparator: z.ZodEnum<{
127
+ "greater-than": "greater-than";
128
+ "greater-than-or-equal": "greater-than-or-equal";
129
+ "less-than": "less-than";
130
+ "less-than-or-equal": "less-than-or-equal";
131
+ "equal-to": "equal-to";
132
+ "between-inclusive": "between-inclusive";
133
+ }>;
134
+ threshold: z.ZodNumber;
135
+ thresholdUpper: z.ZodOptional<z.ZodNumber>;
136
+ }, z.core.$strip>, z.ZodObject<{
137
+ kind: z.ZodLiteral<"occurrence">;
138
+ comparator: z.ZodEnum<{
139
+ occurs: "occurs";
140
+ "does-not-occur": "does-not-occur";
141
+ }>;
142
+ eventClause: z.ZodString;
143
+ evidenceStandard: z.ZodString;
144
+ }, z.core.$strip>, z.ZodObject<{
145
+ kind: z.ZodLiteral<"bucket-membership">;
146
+ metric: z.ZodObject<{
147
+ name: z.ZodString;
148
+ unit: z.ZodString;
149
+ extraction: z.ZodString;
150
+ revisionPolicy: z.ZodEnum<{
151
+ "first-published-value": "first-published-value";
152
+ "value-as-of-observation-time": "value-as-of-observation-time";
153
+ "final-revised-value": "final-revised-value";
154
+ }>;
155
+ }, z.core.$strip>;
156
+ }, z.core.$strip>], "kind">;
157
+ canonicalStatement: z.ZodString;
158
+ observationWindow: z.ZodObject<{
159
+ start: z.ZodString;
160
+ end: z.ZodString;
161
+ timezone: z.ZodString;
162
+ }, z.core.$strip>;
163
+ sources: z.ZodArray<z.ZodObject<{
164
+ id: z.ZodString;
165
+ name: z.ZodString;
166
+ publisher: z.ZodString;
167
+ url: z.ZodURL;
168
+ datasetId: z.ZodOptional<z.ZodString>;
169
+ publicationSchedule: z.ZodString;
170
+ publiclyAccessible: z.ZodBoolean;
171
+ independenceNote: z.ZodString;
172
+ }, z.core.$strip>>;
173
+ primarySourceId: z.ZodString;
174
+ fallbacks: z.ZodDefault<z.ZodArray<z.ZodObject<{
175
+ trigger: z.ZodEnum<{
176
+ "primary-not-published-by-deadline": "primary-not-published-by-deadline";
177
+ "primary-discontinued": "primary-discontinued";
178
+ "primary-methodology-materially-changed": "primary-methodology-materially-changed";
179
+ "primary-retracted-or-corrected": "primary-retracted-or-corrected";
180
+ }>;
181
+ sourceId: z.ZodString;
182
+ procedure: z.ZodString;
183
+ }, z.core.$strip>>>;
184
+ resolutionDeadline: z.ZodString;
185
+ earlyResolution: z.ZodDiscriminatedUnion<[z.ZodObject<{
186
+ allowed: z.ZodLiteral<false>;
187
+ }, z.core.$strip>, z.ZodObject<{
188
+ allowed: z.ZodLiteral<true>;
189
+ condition: z.ZodString;
190
+ }, z.core.$strip>], "allowed">;
191
+ terminalAmbiguityPolicy: z.ZodEnum<{
192
+ "resolve-no": "resolve-no";
193
+ "resolve-to-floor": "resolve-to-floor";
194
+ "void-and-refund": "void-and-refund";
195
+ "exchange-determination-per-rulebook": "exchange-determination-per-rulebook";
196
+ }>;
197
+ edgeCases: z.ZodArray<z.ZodObject<{
198
+ scenario: z.ZodString;
199
+ disposition: z.ZodString;
200
+ }, z.core.$strip>>;
201
+ disputeWindowHours: z.ZodNumber;
202
+ }, z.core.$strip>;
203
+ //# sourceMappingURL=resolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolution.d.ts","sourceRoot":"","sources":["../../../src/schema/resolution.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;GAGG;AACH,eAAO,MAAM,WAAW,aAMmC,CAAC;AAE5D,yDAAyD;AACzD,eAAO,MAAM,YAAY,aAM6C,CAAC;AAEvE,uDAAuD;AACvD,eAAO,MAAM,IAAI,aAGoC,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,WAAW,aAiBrB,CAAC;AAEJ,sEAAsE;AACtE,eAAO,MAAM,MAAM;;;;;;;;;iBAmBjB,CAAC;AA+CH;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAQnB,CAAC;AAEJ,kEAAkE;AAClE,eAAO,MAAM,UAAU;;;;;;;;;iBAkBrB,CAAC;AAEH,gFAAgF;AAChF,eAAO,MAAM,QAAQ;;;;;;;;;iBAUnB,CAAC;AAEH,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB;;;;;EASjC,CAAC;AAEJ,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoGnB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "event-contract-builder",
3
+ "version": "0.1.0",
4
+ "description": "A TypeScript library, CLI, and MCP server for generating, validating, and converting YAML/JSON event contract specifications for prediction markets.",
5
+ "module": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./src": {
14
+ "types": "./dist/src/index.d.ts",
15
+ "default": "./dist/src/index.js"
16
+ },
17
+ "./cnl": {
18
+ "types": "./dist/src/cnl.d.ts",
19
+ "default": "./dist/src/cnl.js"
20
+ },
21
+ "./schema": {
22
+ "types": "./dist/src/schema/event-contract.d.ts",
23
+ "default": "./dist/src/schema/event-contract.js"
24
+ }
25
+ },
26
+ "license": "Apache-2.0",
27
+ "files": [
28
+ "dist",
29
+ "README.md",
30
+ "LICENSE",
31
+ "NOTICE",
32
+ "DISCLAIMER.md"
33
+ ],
34
+ "scripts": {
35
+ "build": "bun build ./index.ts ./src/index.ts ./src/cnl.ts ./src/schema/event-contract.ts --outdir ./dist --target node --format esm --external zod && tsc -p tsconfig.build.json",
36
+ "test": "bun run build && bun test"
37
+ },
38
+ "author": "Christopher Maximilian Altmann",
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/Chralt98/event-contract-builder.git"
42
+ },
43
+ "homepage": "https://github.com/Chralt98/event-contract-builder#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/Chralt98/event-contract-builder/issues"
46
+ },
47
+ "devDependencies": {
48
+ "@types/bun": "latest",
49
+ "@types/node": "^25.9.3"
50
+ },
51
+ "peerDependencies": {
52
+ "typescript": "^6.0.3"
53
+ },
54
+ "dependencies": {
55
+ "@modelcontextprotocol/sdk": "^1.29.0",
56
+ "yaml": "^2.9.0",
57
+ "zod": "^4.4.3"
58
+ }
59
+ }