@githolon/dsl 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.
- package/LICENSE.md +36 -0
- package/compile_package.mjs +50 -0
- package/package.json +59 -0
- package/src/aggregate.ts +167 -0
- package/src/authoring.ts +119 -0
- package/src/build_package.ts +636 -0
- package/src/certified_read.ts +313 -0
- package/src/codegen_dart.ts +2732 -0
- package/src/codegen_dot.ts +466 -0
- package/src/codegen_provider_dart.ts +358 -0
- package/src/codegen_ts.ts +365 -0
- package/src/codegen_usda.ts +388 -0
- package/src/combined.ts +195 -0
- package/src/compile_engine.ts +567 -0
- package/src/compile_package_main.ts +496 -0
- package/src/compose.ts +317 -0
- package/src/count.ts +218 -0
- package/src/ctx.ts +57 -0
- package/src/derived.ts +138 -0
- package/src/directive.ts +306 -0
- package/src/drivers.ts +95 -0
- package/src/emits_guard.ts +123 -0
- package/src/engine_entry.ts +449 -0
- package/src/exists.ts +170 -0
- package/src/extremum.ts +227 -0
- package/src/fields.ts +291 -0
- package/src/framework/bootstrap.ts +22 -0
- package/src/framework/disclosure.ts +108 -0
- package/src/framework/domain_lifecycle.ts +108 -0
- package/src/framework/identity.ts +537 -0
- package/src/framework/impure_capability.ts +643 -0
- package/src/framework/rbac.ts +418 -0
- package/src/framework/repair.ts +150 -0
- package/src/framework/sync_lifecycle.ts +125 -0
- package/src/framework/workspace_invariant.ts +128 -0
- package/src/framework/workspaces.ts +817 -0
- package/src/index.ts +317 -0
- package/src/manifest.ts +947 -0
- package/src/ops.ts +145 -0
- package/src/ordered_read.ts +228 -0
- package/src/predicate.ts +203 -0
- package/src/query/compile.ts +0 -0
- package/src/query/relations.ts +144 -0
- package/src/query.ts +151 -0
- package/src/read.ts +54 -0
- package/src/relation.ts +189 -0
- package/src/report/csv.ts +54 -0
- package/src/report.ts +401 -0
- package/src/spatial.ts +115 -0
- package/src/sum.ts +194 -0
- package/src/usd.ts +563 -0
- package/src/wire.ts +149 -0
- package/src/wire_encode.ts +250 -0
package/src/index.ts
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
// NOMOS — Nomos Sovereign: participants act · verify · remember LOCALLY; hosted
|
|
2
|
+
// remotes are replaceable custody/transport, not truth. ⇒ ONE Nomos GitHolon
|
|
3
|
+
// wasm32-wasip1 artifact {kernel · projection · embedded
|
|
4
|
+
// QuickJS engine} on V8 + WASI-shim, byte-identical everywhere. V8 = portability; the one
|
|
5
|
+
// wasm = determinism. No native, no wasmtime, no 2nd artifact, no domain-JS on bare V8.
|
|
6
|
+
// If a file isn't this / hosting this / authoring for this / proving this — it's gone.
|
|
7
|
+
|
|
8
|
+
/** `@githolon/dsl` — the Nomos 2 domain-authoring DSL. */
|
|
9
|
+
export {
|
|
10
|
+
aggregate,
|
|
11
|
+
instance,
|
|
12
|
+
forwardRef,
|
|
13
|
+
type AggregateHandle,
|
|
14
|
+
type BoundAggregate,
|
|
15
|
+
type StoredFields,
|
|
16
|
+
type HasManyFields,
|
|
17
|
+
type AggregateInvariantFn,
|
|
18
|
+
type AggregateInvariantVerdict,
|
|
19
|
+
} from "./aggregate.js";
|
|
20
|
+
export {
|
|
21
|
+
t,
|
|
22
|
+
type Field,
|
|
23
|
+
type FieldValue,
|
|
24
|
+
type FieldKind,
|
|
25
|
+
type EvidenceRefValue,
|
|
26
|
+
evidenceRefSchema,
|
|
27
|
+
} from "./fields.js";
|
|
28
|
+
export {
|
|
29
|
+
Lww,
|
|
30
|
+
AddWins,
|
|
31
|
+
Conflict,
|
|
32
|
+
MapOf,
|
|
33
|
+
LastPosition,
|
|
34
|
+
RemoveWins,
|
|
35
|
+
Counter,
|
|
36
|
+
encodeDriver,
|
|
37
|
+
type Driver,
|
|
38
|
+
type DriverKind,
|
|
39
|
+
} from "./drivers.js";
|
|
40
|
+
export {
|
|
41
|
+
set,
|
|
42
|
+
addToSet,
|
|
43
|
+
setEntry,
|
|
44
|
+
withMarker,
|
|
45
|
+
strike,
|
|
46
|
+
type PlannedOp,
|
|
47
|
+
type FieldOp,
|
|
48
|
+
type PlannedEventMarker,
|
|
49
|
+
type StrikeOp,
|
|
50
|
+
} from "./ops.js";
|
|
51
|
+
export { directive, type Directive, type ReferentialMarker } from "./directive.js";
|
|
52
|
+
// THE AGGREGATE AUTHORING SURFACE (Nomos owns every birth): `create(agg)` mints + records and returns
|
|
53
|
+
// a DDD-fluent `AggregateRef`; the dev `.set`/`.add`(collection)/`.setEntry`(map)/`.relate`(reference)
|
|
54
|
+
// — naming no id. A directive's `.plan` calls these and returns `[]` (the recorded graph is the write
|
|
55
|
+
// surface). The dev never sees a "prim" — that is the GitHolon's internal OpenUSD IR.
|
|
56
|
+
export { create, existing, type AggregateRef } from "./authoring.js";
|
|
57
|
+
// THE CAPTURED READ — a plan reads O(1) DSL queries via `read(query, args)`; the result is committed as
|
|
58
|
+
// the intent's read footprint (deterministic replay + stale-premise detection). The dev calls typed DSL
|
|
59
|
+
// queries; the library routes them here. The host capability is `nomos.read` (twin of `nomos.rng`).
|
|
60
|
+
export { read } from "./read.js";
|
|
61
|
+
export {
|
|
62
|
+
query,
|
|
63
|
+
hasManyIndexes,
|
|
64
|
+
type QueryDecl,
|
|
65
|
+
type Query,
|
|
66
|
+
type KeylessQuery,
|
|
67
|
+
type QueryableFieldPath,
|
|
68
|
+
} from "./query.js";
|
|
69
|
+
export {
|
|
70
|
+
count,
|
|
71
|
+
finishCount,
|
|
72
|
+
type CountDecl,
|
|
73
|
+
type Count,
|
|
74
|
+
type AnyCount,
|
|
75
|
+
type TypelessCount,
|
|
76
|
+
} from "./count.js";
|
|
77
|
+
export {
|
|
78
|
+
spatial,
|
|
79
|
+
type SpatialDecl,
|
|
80
|
+
type OfSpatial,
|
|
81
|
+
type TypelessSpatial,
|
|
82
|
+
} from "./spatial.js";
|
|
83
|
+
export {
|
|
84
|
+
sum,
|
|
85
|
+
finishSum,
|
|
86
|
+
type SumDecl,
|
|
87
|
+
type Sum,
|
|
88
|
+
type AnySum,
|
|
89
|
+
type TypelessSum,
|
|
90
|
+
} from "./sum.js";
|
|
91
|
+
export {
|
|
92
|
+
min,
|
|
93
|
+
max,
|
|
94
|
+
finishExtremum,
|
|
95
|
+
type ExtremumDecl,
|
|
96
|
+
type Extremum,
|
|
97
|
+
type AnyExtremum,
|
|
98
|
+
type TypelessExtremum,
|
|
99
|
+
type ExtremumKind,
|
|
100
|
+
} from "./extremum.js";
|
|
101
|
+
export {
|
|
102
|
+
exists,
|
|
103
|
+
finishExists,
|
|
104
|
+
existsAsCount,
|
|
105
|
+
type ExistsDecl,
|
|
106
|
+
type ExistsBuilder,
|
|
107
|
+
type AnyExists,
|
|
108
|
+
type TypelessExists,
|
|
109
|
+
} from "./exists.js";
|
|
110
|
+
export {
|
|
111
|
+
first,
|
|
112
|
+
take,
|
|
113
|
+
type OrderedReadDecl,
|
|
114
|
+
type FirstNeedsOrder,
|
|
115
|
+
type TakeNeedsOrder,
|
|
116
|
+
type TypelessFirst,
|
|
117
|
+
type TypelessTake,
|
|
118
|
+
} from "./ordered_read.js";
|
|
119
|
+
export {
|
|
120
|
+
predBuilder,
|
|
121
|
+
canonicalizePred,
|
|
122
|
+
type Predicate,
|
|
123
|
+
type PredClause,
|
|
124
|
+
type CanonicalPred,
|
|
125
|
+
type PredBuilder,
|
|
126
|
+
type PredScalarKeys,
|
|
127
|
+
} from "./predicate.js";
|
|
128
|
+
export {
|
|
129
|
+
derived,
|
|
130
|
+
type DerivedDecl,
|
|
131
|
+
type DerivedOf,
|
|
132
|
+
type TypelessDerived,
|
|
133
|
+
type DeriveFn,
|
|
134
|
+
} from "./derived.js";
|
|
135
|
+
export {
|
|
136
|
+
combined,
|
|
137
|
+
type CombinedDecl,
|
|
138
|
+
type CombinedOf,
|
|
139
|
+
type CombinedJoins,
|
|
140
|
+
type TypelessCombined,
|
|
141
|
+
type CombineFn,
|
|
142
|
+
} from "./combined.js";
|
|
143
|
+
export { deterministicPorts, type Ports } from "./ctx.js";
|
|
144
|
+
export {
|
|
145
|
+
report,
|
|
146
|
+
sqlReport,
|
|
147
|
+
from,
|
|
148
|
+
EntityGraphBuilder,
|
|
149
|
+
days,
|
|
150
|
+
hours,
|
|
151
|
+
type QueryAst,
|
|
152
|
+
type QueryRow,
|
|
153
|
+
type Report,
|
|
154
|
+
type SqlReport,
|
|
155
|
+
type SqlRow,
|
|
156
|
+
} from "./report.js";
|
|
157
|
+
export {
|
|
158
|
+
buildRelationRegistry,
|
|
159
|
+
certifyTraversal,
|
|
160
|
+
TraversalCertError,
|
|
161
|
+
MAX_DEPTH,
|
|
162
|
+
type RelationRegistry,
|
|
163
|
+
type RefEdge,
|
|
164
|
+
type CertifyContext,
|
|
165
|
+
} from "./query/relations.js";
|
|
166
|
+
export {
|
|
167
|
+
compile,
|
|
168
|
+
UnservableQueryError,
|
|
169
|
+
type EntityGraphQuery,
|
|
170
|
+
type CompiledQuery,
|
|
171
|
+
type Filter,
|
|
172
|
+
type EqFilter,
|
|
173
|
+
type RequiredIndex,
|
|
174
|
+
} from "./query/compile.js";
|
|
175
|
+
export {
|
|
176
|
+
PERMISSION_STATUSES,
|
|
177
|
+
roleBindingSchema,
|
|
178
|
+
userPermissionAggregate,
|
|
179
|
+
userPermissionsInstanceId,
|
|
180
|
+
permissionId,
|
|
181
|
+
grant,
|
|
182
|
+
revoke,
|
|
183
|
+
delegate,
|
|
184
|
+
revokeDelegation,
|
|
185
|
+
updateMetadata,
|
|
186
|
+
roleCatalogue,
|
|
187
|
+
type PermissionStatus,
|
|
188
|
+
type FrameworkRoleBinding,
|
|
189
|
+
type UserPermissionAggregateHandle,
|
|
190
|
+
type Scope,
|
|
191
|
+
type RoleCatalogue,
|
|
192
|
+
} from "./framework/rbac.js";
|
|
193
|
+
export {
|
|
194
|
+
IMPURE_CAPABILITY_STATUSES,
|
|
195
|
+
IMPURE_CAPABILITY_ENVELOPE,
|
|
196
|
+
impureCapabilityAggregate,
|
|
197
|
+
impureCapabilityInstanceId,
|
|
198
|
+
impureCapability,
|
|
199
|
+
orderOps,
|
|
200
|
+
completeOps,
|
|
201
|
+
failOps,
|
|
202
|
+
blockOps,
|
|
203
|
+
deadLetterOps,
|
|
204
|
+
impureCapabilityReceipt,
|
|
205
|
+
type ImpureCapabilityStatus,
|
|
206
|
+
type ImpureCapability,
|
|
207
|
+
type TaskOutcome,
|
|
208
|
+
type TaskReceipt,
|
|
209
|
+
} from "./framework/impure_capability.js";
|
|
210
|
+
export {
|
|
211
|
+
DOMAIN_INSTALLATION_PHASES,
|
|
212
|
+
PolicyBundle,
|
|
213
|
+
DomainInstallation,
|
|
214
|
+
policyAggregateId,
|
|
215
|
+
domainInstallationAggregateId,
|
|
216
|
+
installDomain,
|
|
217
|
+
type DomainInstallationPhase,
|
|
218
|
+
} from "./framework/domain_lifecycle.js";
|
|
219
|
+
export {
|
|
220
|
+
WORKSPACE_SYNC_DIRECTIONS,
|
|
221
|
+
WorkspaceSyncOperation,
|
|
222
|
+
requestWorkspaceSync,
|
|
223
|
+
completeWorkspaceSync,
|
|
224
|
+
failWorkspaceSync,
|
|
225
|
+
blockWorkspaceSync,
|
|
226
|
+
deadLetterWorkspaceSync,
|
|
227
|
+
NOMOS_SYNC_IMPURE_CAPABILITIES,
|
|
228
|
+
type WorkspaceSyncDirection,
|
|
229
|
+
} from "./framework/sync_lifecycle.js";
|
|
230
|
+
export {
|
|
231
|
+
REPAIR_KINDS,
|
|
232
|
+
RepairRecord,
|
|
233
|
+
revert,
|
|
234
|
+
type RepairKind,
|
|
235
|
+
} from "./framework/repair.js";
|
|
236
|
+
export {
|
|
237
|
+
workspaceInvariant,
|
|
238
|
+
ref,
|
|
239
|
+
refAs,
|
|
240
|
+
type WorkspaceInvariantDecl,
|
|
241
|
+
type WorkspaceInvariantVerdict,
|
|
242
|
+
type WorkspaceInvariantReads,
|
|
243
|
+
type WorkspaceInvariantAssert,
|
|
244
|
+
type InvariantRef,
|
|
245
|
+
} from "./framework/workspace_invariant.js";
|
|
246
|
+
export { csv, csvRows } from "./report/csv.js";
|
|
247
|
+
// CertifiedRead — the DECLARED write-path read surface (survival Constraint 5;
|
|
248
|
+
// `certified_read.md`). A directive declares profiled reads via `.readsCertified({ name:
|
|
249
|
+
// certifiedRead("id").sql("…", {…}) })`; the SQL is compiled through the SQL-profile-v0 enforcer
|
|
250
|
+
// at declaration (an under-specified read is refused at COMPILE), the declared `query_id`s land
|
|
251
|
+
// in the certified manifest, and the gate derives the required-read set (the vacuous-pass close).
|
|
252
|
+
export {
|
|
253
|
+
certifiedRead,
|
|
254
|
+
sqlProfileV0Check,
|
|
255
|
+
ProfileError,
|
|
256
|
+
SQL_PROFILE_VERSION,
|
|
257
|
+
BANNED_FUNCTIONS,
|
|
258
|
+
type CertifiedReadDecl,
|
|
259
|
+
type CertifiedReadOpts,
|
|
260
|
+
type ProfileViolation,
|
|
261
|
+
} from "./certified_read.js";
|
|
262
|
+
// The cross-workspace `relation` declaration (`cross_workspace.md` §2). A TARGET directive
|
|
263
|
+
// declares the relation a cross-workspace PR is adjudicated against via
|
|
264
|
+
// `.declaresRelation(relation("Id").endpoints(src,tgt).proposes(directive, evidenceRead))`;
|
|
265
|
+
// it lands in the certified manifest, which the gate resolves to verify the carried evidence +
|
|
266
|
+
// evaluate the invariant against the target's OWN law (sovereignty).
|
|
267
|
+
export {
|
|
268
|
+
relation,
|
|
269
|
+
type RelationDecl,
|
|
270
|
+
type RelationEvidence,
|
|
271
|
+
type EvidenceKind,
|
|
272
|
+
type InvariantBody,
|
|
273
|
+
type InvariantEvidence,
|
|
274
|
+
type InvariantVerdict,
|
|
275
|
+
} from "./relation.js";
|
|
276
|
+
export { generateDartDomain, type DomainModule } from "./codegen_dart.js";
|
|
277
|
+
// The OPTIONAL Graphviz `.dot` ER-diagram emitter (off-by-default presentation projection,
|
|
278
|
+
// turned on by the `--emit-dot` compiler flag). Pure `DomainModule -> string`, deterministic;
|
|
279
|
+
// NOT part of the domain identity. Barrel-safe (no node:* imports), so the engine bundle can
|
|
280
|
+
// import this barrel unaffected.
|
|
281
|
+
export { emitDomainDot, type DotOptions } from "./codegen_dot.js";
|
|
282
|
+
// The OPTIONAL OpenUSD `.usda` emitter — a COMPILED DOMAIN as a navigable USD stage (aggregates →
|
|
283
|
+
// Sphere prims, directives → Cube prims carrying their `plan` lump, the creates/mutates/ref flow →
|
|
284
|
+
// BasisCurves). The abstract LAW structure as a maths object (holon-maths projection), NOT the org-data
|
|
285
|
+
// twin. Sibling of `emitDomainDot`: pure `DomainModule -> string`, deterministic, NOT part of the
|
|
286
|
+
// domain identity; barrel-safe (no node:* imports). Open the output in usdview / any USD tool.
|
|
287
|
+
export { emitDomainUsda, type UsdaOptions } from "./codegen_usda.js";
|
|
288
|
+
// The PROVIDER SDK codegen (symmetric twin of the peer payload classes). `emitProviderSdk`
|
|
289
|
+
// is invoked INSIDE `generateDartDomain` for a module's `impureCapabilities`; the type is exported
|
|
290
|
+
// so the emit script can type its `impureCapabilities` list. A `impureCapability(...)` factory return value
|
|
291
|
+
// satisfies `ImpureCapabilityDecl` structurally.
|
|
292
|
+
export {
|
|
293
|
+
emitProviderSdk,
|
|
294
|
+
emitProviderTask,
|
|
295
|
+
taskBaseName,
|
|
296
|
+
type ImpureCapabilityDecl,
|
|
297
|
+
} from "./codegen_provider_dart.js";
|
|
298
|
+
// NOTE: the canonical-manifest / domain-hash API (`./manifest.js`) is a BUILD-TIME
|
|
299
|
+
// concern that imports `node:crypto`. It is DELIBERATELY NOT re-exported from this
|
|
300
|
+
// barrel: the deterministic engine bundle (`golden/domain_nomos.js`) imports this
|
|
301
|
+
// barrel, and esbuild `--platform=neutral` cannot resolve `node:crypto`. Build-time
|
|
302
|
+
// consumers import it via the `@githolon/dsl/manifest` subpath instead.
|
|
303
|
+
export { encodeKernelSchema, executeDirectiveToIntent, encodeRefMode, intentIdFromHlc } from "./wire_encode.js";
|
|
304
|
+
export type {
|
|
305
|
+
WireEvent,
|
|
306
|
+
WireIntent,
|
|
307
|
+
WireRead,
|
|
308
|
+
WireFieldOp,
|
|
309
|
+
WireOp,
|
|
310
|
+
WireRefMode,
|
|
311
|
+
WireValue,
|
|
312
|
+
WireField,
|
|
313
|
+
WireHlc,
|
|
314
|
+
WireReplicaId,
|
|
315
|
+
WireDriver,
|
|
316
|
+
WireSchema,
|
|
317
|
+
} from "./wire.js";
|