@githolon/dsl 0.100.6 → 0.101.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/dart/CHANGELOG.md +6 -0
- package/dart/lib/src/dev_cloud.dart +46 -15
- package/dart/lib/src/test_harness.dart +78 -16
- package/dart/lib/src/webview_bridge.dart +640 -126
- package/dart/pubspec.lock +1 -1
- package/dart/pubspec.yaml +2 -2
- package/dart/test/bundle_version_pairing_test.dart +11 -22
- package/dart/test/co2_product_gauntlet_test.dart +228 -0
- package/dart/test/errors_test.dart +63 -12
- package/dart/test/first_app_gauntlet_test.dart +29 -3
- package/dart/test/webview_bridge_test.dart +274 -0
- package/dart_types/CHANGELOG.md +6 -0
- package/dart_types/lib/src/errors.dart +136 -30
- package/dart_types/lib/src/surfaced.dart +48 -2
- package/dart_types/lib/src/wire.dart +3 -1
- package/dart_types/pubspec.yaml +1 -1
- package/dart_types/test/surfaced_test.dart +19 -0
- package/package.json +1 -1
- package/src/activity.ts +43 -4
- package/src/aggregate.ts +132 -22
- package/src/attested_core.ts +1 -1
- package/src/authoring.ts +119 -6
- package/src/birth_meter.ts +4 -4
- package/src/birth_meter_ensure.ts +9 -1
- package/src/births.ts +53 -22
- package/src/build_package.ts +55 -14
- package/src/business_birth.ts +48 -7
- package/src/codegen_dart.ts +267 -37
- package/src/codegen_dart_client.ts +921 -82
- package/src/codegen_openapi.ts +28 -5
- package/src/codegen_proof.ts +107 -11
- package/src/codegen_ts.ts +961 -135
- package/src/compile_package_main.ts +155 -45
- package/src/conflicts.ts +252 -0
- package/src/describe_model.ts +448 -0
- package/src/directive.ts +5 -38
- package/src/drivers.ts +12 -4
- package/src/engine_entry.ts +4 -0
- package/src/evolve_preview.ts +72 -11
- package/src/fields.ts +201 -55
- package/src/framework/application_home.ts +103 -0
- package/src/framework/application_home_domain.ts +2 -0
- package/src/framework/attested_receipts.ts +2 -2
- package/src/framework/auth_provider_law.ts +51 -24
- package/src/framework/business_corrections.ts +170 -0
- package/src/framework/disclosure.ts +1 -1
- package/src/framework/domain_lifecycle.ts +250 -16
- package/src/framework/encryption_identity.ts +1 -1
- package/src/framework/encryption_scope.ts +21 -13
- package/src/framework/era_certification.ts +1 -1
- package/src/framework/framework_aggregates.ts +2 -0
- package/src/framework/genesis.ts +1 -1
- package/src/framework/home.ts +22 -9
- package/src/framework/identity.ts +5 -5
- package/src/framework/impure_capability.ts +2 -2
- package/src/framework/owned_custody.ts +561 -0
- package/src/framework/platform_admin.ts +1 -1
- package/src/framework/relations.ts +9 -1
- package/src/framework/repair.ts +1 -1
- package/src/framework/signing_identity.ts +2 -2
- package/src/framework/source_roster.ts +1 -1
- package/src/framework/workspaces.ts +17 -10
- package/src/generated_client_names.ts +39 -0
- package/src/index.ts +20 -15
- package/src/kernel_capabilities.ts +25 -1
- package/src/law_check.ts +4 -1
- package/src/manifest.ts +356 -63
- package/src/read_projection_manifest.ts +8 -0
- package/src/read_projection_namespace.ts +4 -0
- package/src/relation.ts +1 -1
- package/src/shape_compat.ts +47 -2
- package/src/stable_ids.ts +38 -6
- package/src/stable_ids_types.ts +30 -0
- package/src/surfaced_lint.ts +0 -0
- package/src/usd.ts +62 -11
- package/src/usd_layers.ts +54 -3
- package/src/value_object.ts +23 -19
- package/src/wire.ts +1 -0
- package/src/wire_encode.ts +48 -4
- package/src/workspace_routing.ts +57 -0
- package/src/workspace_sharding.ts +9 -9
- package/src/certified_read.ts +0 -313
|
@@ -121,7 +121,7 @@ export const WorkspaceSelf = aggregate("WorkspaceSelf", {
|
|
|
121
121
|
// for era-safety (old records carry it); slated for removal with `kind` in one #58 disposition pass.
|
|
122
122
|
role: t.enum(WORKSPACE_ROLES).merge(Lww),
|
|
123
123
|
name: t.string().merge(Lww),
|
|
124
|
-
});
|
|
124
|
+
}).public();
|
|
125
125
|
// The one-off SELF-IDENTITY backfill for an already-born workspace (root predates WorkspaceSelf). UNGATED
|
|
126
126
|
// by the admin gate — it must run BEFORE the admin tuple/gate are live — but WRITE-ONCE (the invariant
|
|
127
127
|
// below refuses a re-set once the self-record exists), so a race or a malicious re-set cannot freeze
|
|
@@ -342,7 +342,7 @@ export const CloudWorkspace = aggregate("CloudWorkspace", {
|
|
|
342
342
|
* (the default). Set at birth ({@link birthChild}/{@link createWorkspace} `posture` payload). Additive/
|
|
343
343
|
* era-safe (optional Lww). */
|
|
344
344
|
governancePosture: t.enum(GOVERNANCE_POSTURES).merge(Lww).optional(),
|
|
345
|
-
});
|
|
345
|
+
}).public();
|
|
346
346
|
|
|
347
347
|
// AdminGrant / CreationGrant aggregates: DELETED (full-native Zanzibar). Admin/creation authority is
|
|
348
348
|
// now a NATIVE RELATION TUPLE — `workspace:self#admin@key:<keyHash>` / `…#creator@key:<keyHash>` —
|
|
@@ -379,7 +379,7 @@ export const CloudPolicy = aggregate("CloudPolicy", {
|
|
|
379
379
|
setBy: t.string().merge(Lww),
|
|
380
380
|
/** Epoch-ms the policy was last set (caller-stamped). */
|
|
381
381
|
setAt: t.int().merge(Lww),
|
|
382
|
-
});
|
|
382
|
+
}).public();
|
|
383
383
|
|
|
384
384
|
/**
|
|
385
385
|
* QuotaGrant — a granted quota request: one principal's workspace allowance,
|
|
@@ -396,7 +396,7 @@ export const QuotaGrant = aggregate("QuotaGrant", {
|
|
|
396
396
|
grantedBy: t.string().merge(Lww),
|
|
397
397
|
/** Epoch-ms the grant was authored (caller-stamped). */
|
|
398
398
|
grantedAt: t.int().merge(Lww),
|
|
399
|
-
});
|
|
399
|
+
}).public();
|
|
400
400
|
|
|
401
401
|
/**
|
|
402
402
|
* PlatformGrant — legacy audit surface for platform invites. Platform creation now rides
|
|
@@ -414,7 +414,7 @@ export const PlatformGrant = aggregate("PlatformGrant", {
|
|
|
414
414
|
grantedAt: t.int().merge(Lww),
|
|
415
415
|
/** `active` | `revoked`. */
|
|
416
416
|
status: t.enum(GRANT_STATUSES).merge(Lww),
|
|
417
|
-
});
|
|
417
|
+
}).public();
|
|
418
418
|
|
|
419
419
|
/**
|
|
420
420
|
* CapabilityBinding — A FACT ABOUT AUTHORITY, never authority itself (the
|
|
@@ -455,7 +455,7 @@ export const CapabilityBinding = aggregate("CapabilityBinding", {
|
|
|
455
455
|
boundAt: t.int().merge(Lww),
|
|
456
456
|
/** `active` | `revoked` — the law's kill switch for the credential's USE. */
|
|
457
457
|
status: t.enum(GRANT_STATUSES).merge(Lww),
|
|
458
|
-
});
|
|
458
|
+
}).public();
|
|
459
459
|
|
|
460
460
|
// --- workspace directives ---------------------------------------------------------
|
|
461
461
|
|
|
@@ -1099,7 +1099,7 @@ export const GovernancePosture = aggregate("GovernancePosture", {
|
|
|
1099
1099
|
setBy: t.string().merge(Lww),
|
|
1100
1100
|
/** Epoch-ms it was last set (caller-stamped). */
|
|
1101
1101
|
setAt: t.int().merge(Lww),
|
|
1102
|
-
});
|
|
1102
|
+
}).public();
|
|
1103
1103
|
|
|
1104
1104
|
/**
|
|
1105
1105
|
* RebirthConsent — the tenant's OWN consent to a rebirth, folded in the tenant's OWN chain (the two-key
|
|
@@ -1119,7 +1119,7 @@ export const RebirthConsent = aggregate("RebirthConsent", {
|
|
|
1119
1119
|
consentedAt: t.int().merge(Lww),
|
|
1120
1120
|
/** OPTIONAL epoch-ms expiry; absent = until superseded. Expired ⇒ the custody act treats it as absent. */
|
|
1121
1121
|
expiresAt: t.int().merge(Lww).optional(),
|
|
1122
|
-
});
|
|
1122
|
+
}).public();
|
|
1123
1123
|
|
|
1124
1124
|
/** Shared plan body for the three posture setters — ensures the singleton to `posture`. */
|
|
1125
1125
|
function setPosturePlan(posture: (typeof GOVERNANCE_POSTURES)[number], reason: string, setBy: string, at: number) {
|
|
@@ -1352,7 +1352,14 @@ export const setPlatformPool = directive("setPlatformPool")
|
|
|
1352
1352
|
// THE AUTHPROVIDER LAW SURFACE moved to ./auth_provider_law.js (a LEAF module the engine entry +
|
|
1353
1353
|
// birthHome inheritance import without dragging this whole graph into every lump). Re-exported
|
|
1354
1354
|
// here verbatim — the public surface and the law bytes are unchanged.
|
|
1355
|
-
export {
|
|
1355
|
+
export {
|
|
1356
|
+
AUTH_PROVIDER_ID,
|
|
1357
|
+
AuthProvider,
|
|
1358
|
+
seedAuthProvider,
|
|
1359
|
+
authProviderSeedBeforeWarrant,
|
|
1360
|
+
setAuthProvider,
|
|
1361
|
+
authProvider,
|
|
1362
|
+
} from "./auth_provider_law.js";
|
|
1356
1363
|
import { AUTH_PROVIDER_ID, AuthProvider, setAuthProvider, authProvider } from "./auth_provider_law.js";
|
|
1357
1364
|
|
|
1358
1365
|
/**
|
|
@@ -1399,7 +1406,7 @@ export const HostnameClaim = aggregate("HostnameClaim", {
|
|
|
1399
1406
|
claimedAt: t.int().merge(Lww),
|
|
1400
1407
|
/** `active` | `released`. */
|
|
1401
1408
|
status: t.enum(["active", "released"]).merge(Lww),
|
|
1402
|
-
});
|
|
1409
|
+
}).public();
|
|
1403
1410
|
|
|
1404
1411
|
/** claimHostname — bind a hostname to a platform (worker-authored after the edge accepts it). */
|
|
1405
1412
|
export const claimHostname = directive("claimHostname")
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Public generated-client concepts are part of the product language. If tenant
|
|
2
|
+
// language lands on the same emitted member, fail loudly: obscurity reduces
|
|
3
|
+
// accidental framework collisions, but it must never decide one silently.
|
|
4
|
+
|
|
5
|
+
type Named = { readonly id?: unknown };
|
|
6
|
+
type ClientDomain = {
|
|
7
|
+
readonly domain?: string;
|
|
8
|
+
readonly name: string;
|
|
9
|
+
readonly directives?: readonly Named[];
|
|
10
|
+
readonly queries?: readonly Named[];
|
|
11
|
+
readonly counts?: readonly Named[];
|
|
12
|
+
readonly sums?: readonly Named[];
|
|
13
|
+
readonly spatials?: readonly Named[];
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const camel = (value: string): string =>
|
|
17
|
+
value.replace(/[_\s-]+(\w)/g, (_match, letter: string) => letter.toUpperCase());
|
|
18
|
+
|
|
19
|
+
/** Refuse tenant callables that would overwrite the generated `model` adoption concept. */
|
|
20
|
+
export function assertModelClientMemberAvailable(mod: ClientDomain): void {
|
|
21
|
+
const domain = mod.domain ?? mod.name;
|
|
22
|
+
const surfaces: readonly [string, readonly Named[]][] = [
|
|
23
|
+
["action", mod.directives ?? []],
|
|
24
|
+
["question", mod.queries ?? []],
|
|
25
|
+
["count", mod.counts ?? []],
|
|
26
|
+
["sum", mod.sums ?? []],
|
|
27
|
+
["spatial question", mod.spatials ?? []],
|
|
28
|
+
];
|
|
29
|
+
for (const [kind, entries] of surfaces) {
|
|
30
|
+
for (const entry of entries) {
|
|
31
|
+
if (typeof entry.id !== "string" || camel(entry.id) !== "model") continue;
|
|
32
|
+
throw new Error(
|
|
33
|
+
`Nomos generated client concept 'model' is already taken, but business ${kind} ` +
|
|
34
|
+
`'${entry.id}' in domain '${domain}' would use the same name. Sorry mate: Nomos will not ` +
|
|
35
|
+
`silently reinterpret either concept; rename the business ${kind}.`,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -32,6 +32,9 @@ export {
|
|
|
32
32
|
type FieldKind,
|
|
33
33
|
type JsonValue,
|
|
34
34
|
type NullSemantic,
|
|
35
|
+
type FieldEvolutionDeclaration,
|
|
36
|
+
type StringRules,
|
|
37
|
+
type IntRules,
|
|
35
38
|
NULL_ADMITTING,
|
|
36
39
|
admitsNull,
|
|
37
40
|
jsonNoNullSchema,
|
|
@@ -84,6 +87,7 @@ export {
|
|
|
84
87
|
type FieldFacet,
|
|
85
88
|
} from "./principal_evidence.js";
|
|
86
89
|
export {
|
|
90
|
+
FirstWriterWins,
|
|
87
91
|
Lww,
|
|
88
92
|
LwwCausal,
|
|
89
93
|
LwwBy,
|
|
@@ -98,6 +102,14 @@ export {
|
|
|
98
102
|
type Driver,
|
|
99
103
|
type DriverKind,
|
|
100
104
|
} from "./drivers.js";
|
|
105
|
+
export {
|
|
106
|
+
conflicts,
|
|
107
|
+
firstWriterWins,
|
|
108
|
+
latestWriterWins,
|
|
109
|
+
manual,
|
|
110
|
+
type ConflictPolicy,
|
|
111
|
+
type ConflictRule,
|
|
112
|
+
} from "./conflicts.js";
|
|
101
113
|
export {
|
|
102
114
|
set,
|
|
103
115
|
clear,
|
|
@@ -223,6 +235,9 @@ export {
|
|
|
223
235
|
type GenesisChainOrBuilder,
|
|
224
236
|
type BusinessBirthDecl,
|
|
225
237
|
type BusinessBirthSpec,
|
|
238
|
+
type BusinessBirthPayload,
|
|
239
|
+
type BirthFactKeys,
|
|
240
|
+
type BirthStringFactKeys,
|
|
226
241
|
} from "./births.js";
|
|
227
242
|
// THE PEER-SOVEREIGN ROOT-OF-TRUST (the BirthAttestation cert chain): a home/child law exports
|
|
228
243
|
// `requireParentAttestedBirth` to declare it requires a parent-attested-birth cert chain (the
|
|
@@ -424,6 +439,8 @@ export {
|
|
|
424
439
|
export {
|
|
425
440
|
AUTH_PROVIDER_ID,
|
|
426
441
|
AuthProvider,
|
|
442
|
+
seedAuthProvider,
|
|
443
|
+
authProviderSeedBeforeWarrant,
|
|
427
444
|
setAuthProvider,
|
|
428
445
|
authProvider,
|
|
429
446
|
} from "./framework/auth_provider_law.js";
|
|
@@ -548,6 +565,9 @@ export {
|
|
|
548
565
|
policyAggregateId,
|
|
549
566
|
domainInstallationAggregateId,
|
|
550
567
|
installDomain,
|
|
568
|
+
stageDomain,
|
|
569
|
+
promoteDomain,
|
|
570
|
+
rollbackDomain,
|
|
551
571
|
type DomainInstallationPhase,
|
|
552
572
|
} from "./framework/domain_lifecycle.js";
|
|
553
573
|
export {
|
|
@@ -661,21 +681,6 @@ export {
|
|
|
661
681
|
type RoleMeta,
|
|
662
682
|
} from "./role.js";
|
|
663
683
|
export { csv, csvRows } from "./report/csv.js";
|
|
664
|
-
// CertifiedRead — the DECLARED write-path read surface (survival Constraint 5;
|
|
665
|
-
// `certified_read.md`). A directive declares profiled reads via `.readsCertified({ name:
|
|
666
|
-
// certifiedRead("id").sql("…", {…}) })`; the SQL is compiled through the SQL-profile-v0 enforcer
|
|
667
|
-
// at declaration (an under-specified read is refused at COMPILE), the declared `query_id`s land
|
|
668
|
-
// in the certified manifest, and the gate derives the required-read set (the vacuous-pass close).
|
|
669
|
-
export {
|
|
670
|
-
certifiedRead,
|
|
671
|
-
sqlProfileV0Check,
|
|
672
|
-
ProfileError,
|
|
673
|
-
SQL_PROFILE_VERSION,
|
|
674
|
-
BANNED_FUNCTIONS,
|
|
675
|
-
type CertifiedReadDecl,
|
|
676
|
-
type CertifiedReadOpts,
|
|
677
|
-
type ProfileViolation,
|
|
678
|
-
} from "./certified_read.js";
|
|
679
684
|
// The cross-workspace `relation` declaration (`cross_workspace.md` §2). A TARGET directive
|
|
680
685
|
// declares the relation a cross-workspace PR is adjudicated against via
|
|
681
686
|
// `.declaresRelation(relation("Id").endpoints(src,tgt).proposes(directive, evidenceRead))`;
|
|
@@ -44,7 +44,11 @@ export type KernelFeature =
|
|
|
44
44
|
/** Null as an opt-in named capability (`admitsNull()`). */
|
|
45
45
|
| "nullSemantics"
|
|
46
46
|
/** Dynamic attested reads under a trustPolicy allowList. */
|
|
47
|
-
| "attestedReads"
|
|
47
|
+
| "attestedReads"
|
|
48
|
+
/** Law-declared immutable pending-conflict snapshots (compare-and-set merge refs). */
|
|
49
|
+
| "conflictSnapshots"
|
|
50
|
+
/** `.owned()` automatic owner stamp, atomic per-record seat, and framework-custodied epoch-0 key. */
|
|
51
|
+
| "ownedAudience";
|
|
48
52
|
|
|
49
53
|
/** The USD-IR era key each derived-from-law capability rides on, for the requirement
|
|
50
54
|
* derivation below (a package that emits the era key needs the capability). */
|
|
@@ -60,6 +64,8 @@ export const ERA_KEY_TO_FEATURE: Readonly<Record<string, KernelFeature>> = {
|
|
|
60
64
|
/** A minimal shape of a compiled domain module — enough to derive its kernel needs. */
|
|
61
65
|
export interface FeatureProbeModule {
|
|
62
66
|
readonly queries?: readonly QueryDecl[];
|
|
67
|
+
readonly surfacedResolvers?: readonly unknown[];
|
|
68
|
+
readonly aggregates?: readonly { audience?: { kind?: string } }[];
|
|
63
69
|
/** The domain's USD-IR layer (the era keys ride here). Optional — shape-derived
|
|
64
70
|
* features (compoundKeys) work without it. */
|
|
65
71
|
readonly layer?: Record<string, unknown>;
|
|
@@ -77,6 +83,10 @@ export function requiredKernelFeatures(modules: readonly FeatureProbeModule[]):
|
|
|
77
83
|
for (const q of m.queries ?? []) {
|
|
78
84
|
if (Array.isArray(q.key) && q.key.length > 1) needs.add("compoundKeys");
|
|
79
85
|
}
|
|
86
|
+
if ((m.surfacedResolvers?.length ?? 0) > 0) needs.add("conflictSnapshots");
|
|
87
|
+
if ((m.aggregates ?? []).some((aggregate) => aggregate.audience?.kind === "owned")) {
|
|
88
|
+
needs.add("ownedAudience");
|
|
89
|
+
}
|
|
80
90
|
if (m.layer) {
|
|
81
91
|
for (const [eraKey, feature] of Object.entries(ERA_KEY_TO_FEATURE)) {
|
|
82
92
|
if (m.layer[eraKey] !== undefined) needs.add(feature);
|
|
@@ -118,6 +128,20 @@ export interface KernelRegistryEntry extends KernelStamp {
|
|
|
118
128
|
}
|
|
119
129
|
|
|
120
130
|
export const KERNEL_CAPABILITY_REGISTRY: readonly KernelRegistryEntry[] = [
|
|
131
|
+
{
|
|
132
|
+
prefix: "f50d0cc5",
|
|
133
|
+
version: "kernel-f50d0cc5",
|
|
134
|
+
note: "current local production build",
|
|
135
|
+
features: [
|
|
136
|
+
"compoundKeys",
|
|
137
|
+
"capturedReads",
|
|
138
|
+
"invariantGate",
|
|
139
|
+
"surfacedMerge",
|
|
140
|
+
"fieldProvenance",
|
|
141
|
+
"nullSemantics",
|
|
142
|
+
"attestedReads",
|
|
143
|
+
],
|
|
144
|
+
},
|
|
121
145
|
{
|
|
122
146
|
prefix: "846c6bf8",
|
|
123
147
|
version: "kernel-846c6bf8",
|
package/src/law_check.ts
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
*/
|
|
28
28
|
import { z } from "zod";
|
|
29
29
|
|
|
30
|
-
import type
|
|
30
|
+
import { BUSINESS_BIRTH_SEED_PAYLOAD_FIELD, type AggregateHandle } from "./aggregate.js";
|
|
31
31
|
import type { Directive } from "./directive.js";
|
|
32
32
|
import type { DomainModule } from "./codegen_dart.js";
|
|
33
33
|
import { admitsNull, type Field, type ValueObjectDescriptor, type ValueObjectFieldDescriptor } from "./fields.js";
|
|
@@ -101,6 +101,9 @@ function probeDirective(dir: Directive<unknown>, where: string): ProbeResult | u
|
|
|
101
101
|
// filled with a fixed ISO stamp (the client stamps them at dispatch; the plan may read them here).
|
|
102
102
|
const probePayload: Record<string, unknown> = { ...synth.value };
|
|
103
103
|
for (const f of synth.autoStamped) probePayload[f] = "2026-01-01T00:00:00Z";
|
|
104
|
+
if ((dir as { businessBirth?: unknown }).businessBirth !== undefined) {
|
|
105
|
+
probePayload[BUSINESS_BIRTH_SEED_PAYLOAD_FIELD] = "{}";
|
|
106
|
+
}
|
|
104
107
|
|
|
105
108
|
const shapeKeys = new Set(Object.keys(safeShape(dir.payloadSchema as z.ZodTypeAny)));
|
|
106
109
|
const readFields = new Set<string>();
|