@githolon/dsl 0.107.3 → 0.108.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.
Files changed (36) hide show
  1. package/dart/CHANGELOG.md +19 -0
  2. package/dart/lib/src/runner/node-entry.mjs +4044 -3831
  3. package/dart/lib/src/runner/offline-install.mjs +2633 -2537
  4. package/dart/lib/src/test_harness.dart +249 -239
  5. package/dart/lib/src/webview_bridge.dart +38 -168
  6. package/dart/pubspec.lock +17 -1
  7. package/dart/pubspec.yaml +3 -2
  8. package/dart_types/CHANGELOG.md +10 -0
  9. package/dart_types/lib/nomos_kernel_protocol.dart +10 -0
  10. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pb.dart +16158 -0
  11. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pbenum.dart +766 -0
  12. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pbjson.dart +6096 -0
  13. package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pbserver.dart +50 -0
  14. package/dart_types/lib/src/proto/nomos/kernel/v1/progress.pb.dart +245 -0
  15. package/dart_types/lib/src/proto/nomos/kernel/v1/progress.pbenum.dart +160 -0
  16. package/dart_types/lib/src/proto/nomos/kernel/v1/progress.pbjson.dart +178 -0
  17. package/dart_types/lib/src/proto/nomos/runtime/v1/runtime.pb.dart +828 -0
  18. package/dart_types/lib/src/proto/nomos/runtime/v1/runtime.pbenum.dart +465 -0
  19. package/dart_types/lib/src/proto/nomos/runtime/v1/runtime.pbjson.dart +573 -0
  20. package/dart_types/lib/src/proto/nomos/runtime/v1/runtime.pbserver.dart +50 -0
  21. package/dart_types/pubspec.lock +16 -0
  22. package/dart_types/pubspec.yaml +3 -1
  23. package/package.json +1 -1
  24. package/runtime/generated-application-host.js +298 -106
  25. package/src/birth_meter_ensure.ts +2 -0
  26. package/src/business_birth.ts +2 -0
  27. package/src/compile_package_main.ts +36 -18
  28. package/src/framework/application_home.ts +2 -0
  29. package/src/framework/auth_provider_law.ts +34 -0
  30. package/src/framework/birth_certificate_law.ts +24 -0
  31. package/src/framework/home.ts +53 -14
  32. package/src/framework/owned_custody.ts +6 -1
  33. package/src/framework/signing_identity.ts +66 -17
  34. package/src/framework/workspaces.ts +8 -1
  35. package/src/index.ts +2 -0
  36. package/src/shape_compat.ts +6 -3
@@ -21,6 +21,7 @@ import 'dart:async';
21
21
  import 'dart:convert';
22
22
  import 'dart:math';
23
23
 
24
+ import 'package:nomos_types/nomos_kernel_protocol.dart' as nomos_protocol;
24
25
  import 'package:nomos_types/nomos_types.dart'
25
26
  show
26
27
  nomosErrorFromInfo,
@@ -66,150 +67,14 @@ final class NomosPage<T> {
66
67
  final bool done;
67
68
  }
68
69
 
69
- /// Typed authority evidence carried by an offer that plans exactly one child birth.
70
- /// It is offer metadata, never a tenant directive field. The bridge converts it to the
71
- /// generated protocol's JSON-shaped transport only at the WebView boundary.
72
- final class NomosBirthCertificate {
73
- const NomosBirthCertificate({
74
- required this.child,
75
- required this.founder,
76
- required this.verified,
77
- required this.parentKey,
78
- required this.parentId,
79
- required this.epoch,
80
- required this.signature,
81
- this.verifiedVia,
82
- this.idpToken,
83
- this.capturedClock,
84
- this.authProviderIssuer,
85
- this.authProviderJwks,
86
- this.authProviderAudience,
87
- });
88
-
89
- final String child;
90
- final String founder;
91
- final bool verified;
92
- final List<int> parentKey;
93
- final String parentId;
94
- final int epoch;
95
- final List<int> signature;
96
- final String? verifiedVia;
97
- final String? idpToken;
98
- final int? capturedClock;
99
- final String? authProviderIssuer;
100
- final String? authProviderJwks;
101
- final String? authProviderAudience;
102
-
103
- static String _string(
104
- Map<String, Object?> wire,
105
- String camel,
106
- String snake,
107
- ) =>
108
- (wire[camel] ?? wire[snake] ?? '').toString();
109
-
110
- static List<int> _bytes(
111
- Map<String, Object?> wire,
112
- String camel,
113
- String snake,
114
- ) =>
115
- ((wire[camel] ?? wire[snake]) as List? ?? const <Object?>[])
116
- .map((value) => (value as num).toInt())
117
- .toList(growable: false);
118
-
119
- factory NomosBirthCertificate.fromWire(
120
- Map<String, Object?> wire,
121
- ) =>
122
- NomosBirthCertificate(
123
- child: _string(wire, 'child', 'child'),
124
- founder: _string(wire, 'founder', 'founder'),
125
- verified: wire['verified'] == true,
126
- parentKey: _bytes(wire, 'parentKey', 'parent_key'),
127
- parentId: _string(wire, 'parentId', 'parent_id'),
128
- epoch: (wire['epoch'] as num?)?.toInt() ?? 0,
129
- signature: _bytes(wire, 'signature', 'signature'),
130
- verifiedVia: (wire['verifiedVia'] ?? wire['verified_via'])?.toString(),
131
- idpToken: (wire['idpToken'] ?? wire['idp_token'])?.toString(),
132
- capturedClock:
133
- ((wire['capturedClock'] ?? wire['captured_clock']) as num?)
134
- ?.toInt(),
135
- authProviderIssuer:
136
- (wire['authProviderIssuer'] ?? wire['auth_provider_issuer'])
137
- ?.toString(),
138
- authProviderJwks:
139
- (wire['authProviderJwks'] ?? wire['auth_provider_jwks'])
140
- ?.toString(),
141
- authProviderAudience:
142
- (wire['authProviderAudience'] ?? wire['auth_provider_audience'])
143
- ?.toString(),
144
- );
145
-
146
- Map<String, Object?> toWire() => <String, Object?>{
147
- 'child': child,
148
- 'founder': founder,
149
- 'verified': verified,
150
- 'parentKey': parentKey,
151
- 'parentId': parentId,
152
- 'epoch': epoch,
153
- 'signature': signature,
154
- if (verifiedVia != null) 'verifiedVia': verifiedVia,
155
- if (idpToken != null) 'idpToken': idpToken,
156
- if (capturedClock != null) 'capturedClock': capturedClock,
157
- if (authProviderIssuer != null)
158
- 'authProviderIssuer': authProviderIssuer,
159
- if (authProviderJwks != null) 'authProviderJwks': authProviderJwks,
160
- if (authProviderAudience != null)
161
- 'authProviderAudience': authProviderAudience,
162
- };
163
- }
70
+ /// Typed authority evidence carried by an offer that plans exactly one child birth. The protobuf
71
+ /// declaration is the one source of truth for Rust, TypeScript and Dart; USDA is its durable state
72
+ /// projection, not another transport type. The legacy bridge envelope carries only these protobuf bytes.
73
+ typedef NomosBirthCertificate = nomos_protocol.BirthCertificate;
164
74
 
165
- /// Facts signed by [NomosBridge.signBirthCert]. The secret remains a separate argument and never
166
- /// enters this value, so callers cannot accidentally serialize private key material with the cert.
167
- final class NomosBirthCertificateSpec {
168
- const NomosBirthCertificateSpec({
169
- required this.child,
170
- required this.founder,
171
- required this.verified,
172
- required this.parentKey,
173
- required this.parentId,
174
- required this.epoch,
175
- this.verifiedVia,
176
- this.idpToken,
177
- this.capturedClock,
178
- this.authProviderIssuer,
179
- this.authProviderJwks,
180
- this.authProviderAudience,
181
- });
182
-
183
- final String child;
184
- final String founder;
185
- final bool verified;
186
- final String parentKey;
187
- final String parentId;
188
- final int epoch;
189
- final String? verifiedVia;
190
- final String? idpToken;
191
- final int? capturedClock;
192
- final String? authProviderIssuer;
193
- final String? authProviderJwks;
194
- final String? authProviderAudience;
195
-
196
- Map<String, Object?> toWire() => <String, Object?>{
197
- 'child': child,
198
- 'founder': founder,
199
- 'verified': verified,
200
- 'parentKey': parentKey,
201
- 'parentId': parentId,
202
- 'epoch': epoch,
203
- if (verifiedVia != null) 'verifiedVia': verifiedVia,
204
- if (idpToken != null) 'idpToken': idpToken,
205
- if (capturedClock != null) 'capturedClock': capturedClock,
206
- if (authProviderIssuer != null)
207
- 'authProviderIssuer': authProviderIssuer,
208
- if (authProviderJwks != null) 'authProviderJwks': authProviderJwks,
209
- if (authProviderAudience != null)
210
- 'authProviderAudience': authProviderAudience,
211
- };
212
- }
75
+ /// An unsigned [NomosBirthCertificate]. [NomosBridge.signBirthCert] returns the same generated message
76
+ /// with its signature populated; the signing secret is a separate argument and never enters the value.
77
+ typedef NomosBirthCertificateSpec = nomos_protocol.BirthCertificate;
213
78
 
214
79
  /// The protocol version the runner and the bridge agree on (`webview-runner.mjs` `WEBVIEW_BRIDGE_VERSION`).
215
80
  const int kWebviewBridgeVersion = 1;
@@ -2327,7 +2192,8 @@ class NomosBridge {
2327
2192
  if (session != null) 'session': session,
2328
2193
  if (authorSecret != null) 'authorSecret': authorSecret,
2329
2194
  if (birthCertificate != null)
2330
- 'birthCertificate': birthCertificate.toWire(),
2195
+ 'birthCertificateProtobuf':
2196
+ base64Encode(birthCertificate.writeToBuffer()),
2331
2197
  }),
2332
2198
  );
2333
2199
  return r['head'].toString();
@@ -2408,7 +2274,8 @@ class NomosBridge {
2408
2274
  if (session != null) 'session': session,
2409
2275
  if (authorSecret != null) 'authorSecret': authorSecret,
2410
2276
  if (birthCertificate != null)
2411
- 'birthCertificate': birthCertificate.toWire(),
2277
+ 'birthCertificateProtobuf':
2278
+ base64Encode(birthCertificate.writeToBuffer()),
2412
2279
  }),
2413
2280
  );
2414
2281
  } catch (e) {
@@ -3202,23 +3069,23 @@ class NomosBridge {
3202
3069
  _asMap(await _call('mintDeviceKey'));
3203
3070
 
3204
3071
  /// VA ROOT-OF-TRUST: sign a BirthCert through the kernel `cert_sign` op (the SINGLE source of the cert
3205
- /// byte-layout — no Dart copy). `fields` = `{child, founder, verified, parentKey (this device's base64
3206
- /// ed25519 PUBLIC half), parentId, epoch}`; `deviceSecret` is that key's base64 SECRET half, handed to the
3207
- /// LOCAL kernel only (it never reaches a server). Returns typed authority evidence suitable for an offer.
3072
+ /// byte-layout — no Dart copy). [spec] is the generated certificate message with an empty signature;
3073
+ /// `deviceSecret` is the base64 secret half, handed to the LOCAL kernel only (it never reaches a server).
3074
+ /// Returns the same generated type with its signature populated, suitable for an offer.
3208
3075
  Future<NomosBirthCertificate> signBirthCert(
3209
3076
  NomosBirthCertificateSpec spec,
3210
3077
  String deviceSecret,
3211
- ) async =>
3212
- NomosBirthCertificate.fromWire(
3213
- _asMap(
3214
- _asMap(
3215
- await _call('signBirthCert', {
3216
- 'fields': spec.toWire(),
3217
- 'deviceSecret': deviceSecret,
3218
- }),
3219
- )['cert'],
3220
- ),
3221
- );
3078
+ ) async {
3079
+ final result = _asMap(
3080
+ await _call('signBirthCert', {
3081
+ 'certificateProtobuf': base64Encode(spec.writeToBuffer()),
3082
+ 'deviceSecret': deviceSecret,
3083
+ }),
3084
+ );
3085
+ return nomos_protocol.BirthCertificate.fromBuffer(
3086
+ base64Decode(result['certificateProtobuf']?.toString() ?? ''),
3087
+ );
3088
+ }
3222
3089
 
3223
3090
  /// MINT THE KEYLESS ENROLL-ONCE DELEGATION (`enrollFirstDevice.delegationCert`, the verified-first-device
3224
3091
  /// lane). The device SELF-signs it; its authority is the carried `idpToken` (the kernel re-verifies that to
@@ -3226,17 +3093,20 @@ class NomosBridge {
3226
3093
  /// `{user, deviceKey, childName, parentId, verifiedVia, idpToken, capturedClock, epoch}`. WITHOUT this the
3227
3094
  /// keyless home is born with a malformed cert chain (the platform_cert falls into the delegation slot →
3228
3095
  /// `home cert founder != delegation cert founder` at the home's own verify door).
3229
- Future<Map<String, Object?>> mintKeylessDelegation(
3096
+ Future<NomosBirthCertificate> mintKeylessDelegation(
3230
3097
  Map<String, Object?> spec,
3231
3098
  String deviceSecret,
3232
- ) async =>
3233
- _asMap(
3234
- await _call('mintKeylessDelegation', {
3235
- 'spec': spec,
3236
- 'deviceSecret': deviceSecret,
3237
- }),
3238
- )['cert'] as Map<String, Object?>? ??
3239
- const {};
3099
+ ) async {
3100
+ final result = _asMap(
3101
+ await _call('mintKeylessDelegation', {
3102
+ 'spec': spec,
3103
+ 'deviceSecret': deviceSecret,
3104
+ }),
3105
+ );
3106
+ return nomos_protocol.BirthCertificate.fromBuffer(
3107
+ base64Decode(result['certificateProtobuf']?.toString() ?? ''),
3108
+ );
3109
+ }
3240
3110
 
3241
3111
  /// ENROLL THIS DEVICE — the LIVE gate: bind a device key's PUBLIC half to `principal` on-chain as a
3242
3112
  /// `signer` so the holon's gate can PROVE this device's authorship on replay (and the VA chain attest it).
package/dart/pubspec.lock CHANGED
@@ -89,6 +89,14 @@ packages:
89
89
  url: "https://pub.dev"
90
90
  source: hosted
91
91
  version: "7.0.1"
92
+ fixnum:
93
+ dependency: "direct main"
94
+ description:
95
+ name: fixnum
96
+ sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be
97
+ url: "https://pub.dev"
98
+ source: hosted
99
+ version: "1.1.1"
92
100
  frontend_server_client:
93
101
  dependency: transitive
94
102
  description:
@@ -191,7 +199,7 @@ packages:
191
199
  path: "../dart_types"
192
200
  relative: true
193
201
  source: path
194
- version: "0.8.8"
202
+ version: "0.9.0"
195
203
  package_config:
196
204
  dependency: "direct main"
197
205
  description:
@@ -216,6 +224,14 @@ packages:
216
224
  url: "https://pub.dev"
217
225
  source: hosted
218
226
  version: "1.5.2"
227
+ protobuf:
228
+ dependency: transitive
229
+ description:
230
+ name: protobuf
231
+ sha256: "2fcc8a202ca7ec17dab7c97d6b6d91cf03aa07fe6f65f8afbb6dfa52cc5bd902"
232
+ url: "https://pub.dev"
233
+ source: hosted
234
+ version: "5.1.0"
219
235
  pub_semver:
220
236
  dependency: transitive
221
237
  description:
package/dart/pubspec.yaml CHANGED
@@ -7,7 +7,7 @@ repository: https://github.com/Captain-App/nomos2
7
7
  description: >-
8
8
  Nomos 2 Dart client — generated domain values, intent payloads and application
9
9
  lifecycle types over the typed Nomos kernel protocol and USDA custody model.
10
- version: 0.64.46
10
+ version: 0.65.0
11
11
 
12
12
  environment:
13
13
  sdk: ^3.5.0
@@ -16,7 +16,8 @@ dependencies:
16
16
  # The pure-data core (wire types, offer codec, NomosReads, schema validation, error
17
17
  # info). nomos_client depends on and re-exports it, so existing imports are unchanged.
18
18
  # For local monorepo dev, pubspec_overrides.yaml points this at ../dart_types.
19
- nomos_types: ^0.8.8
19
+ nomos_types: ^0.9.0
20
+ fixnum: ^1.1.1
20
21
  json_schema: ^5.2.2
21
22
  crypto: ^3.0.0
22
23
  package_config: ^2.1.0
@@ -1,3 +1,13 @@
1
+ ## 0.9.0
2
+
3
+ - Replace the opaque admitted-offer result with generated typed kernel messages, so Rust, TypeScript,
4
+ Dart, and Flutter share one protobuf ABI for committed offer facts.
5
+
6
+ ## 0.8.9
7
+
8
+ - Generate the canonical Dart kernel and runtime protobuf messages in `nomos_types`, so Dart clients and
9
+ Flutter hosts consume the same compiler-owned ABI as Rust and TypeScript.
10
+
1
11
  ## 0.8.8
2
12
 
3
13
  - Name incompatible runtime selections as OSGi contract failures rather than referring to the retired
@@ -0,0 +1,10 @@
1
+ // Generated protocol types shared by every Dart and Flutter Nomos host.
2
+ //
3
+ // The source of truth is proto/nomos/{kernel,runtime}/v1. This package owns the
4
+ // generated Dart projection so nomos_client and nomos_flutter cannot drift into
5
+ // handwritten copies of the kernel/runtime ABI.
6
+ library;
7
+
8
+ export 'src/proto/nomos/kernel/v1/kernel.pb.dart';
9
+ export 'src/proto/nomos/kernel/v1/progress.pb.dart';
10
+ export 'src/proto/nomos/runtime/v1/runtime.pb.dart';