@githolon/dsl 0.107.4 → 0.108.1
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 +24 -0
- package/dart/lib/src/application_framework_calls.dart +299 -0
- package/dart/lib/src/generated_call.dart +96 -0
- package/dart/lib/src/nms_generated_runtime.dart +29 -0
- package/dart/lib/src/node_runner_transport.dart +77 -1
- package/dart/lib/src/result_usda.dart +487 -0
- package/dart/lib/src/runner/node-entry.mjs +10634 -6122
- package/dart/lib/src/runner/offline-install.mjs +4187 -2716
- package/dart/lib/src/runtime_v2_gateway.dart +54 -0
- package/dart/lib/src/runtime_v2_transport.dart +117 -0
- package/dart/lib/src/session_bound.dart +7 -2
- package/dart/lib/src/test_harness.dart +373 -282
- package/dart/lib/src/webview_bridge.dart +2146 -725
- package/dart/pubspec.lock +17 -1
- package/dart/pubspec.yaml +3 -2
- package/dart/test/acquire_session_credentials_test.dart +1 -1
- package/dart/test/acquire_session_test.dart +68 -14
- package/dart/test/adv_realm_interference_test.dart +6 -4
- package/dart/test/cluster_births_test.dart +11 -8
- package/dart/test/cluster_local_autosync_test.dart +1 -1
- package/dart/test/cluster_scale_test.dart +3 -2
- package/dart/test/dlq_session_surface_test.dart +52 -35
- package/dart/test/first_app_gauntlet_test.dart +1 -1
- package/dart/test/local_sync_inert_test.dart +23 -26
- package/dart/test/offer_authentication_proof_test.dart +193 -0
- package/dart/test/result_usda_test.dart +49 -0
- package/dart/test/session_bound_test.dart +8 -11
- package/dart/test/stale_bundle_test.dart +18 -3
- package/dart/test/test_harness_test.dart +14 -27
- package/dart/test/webview_bridge_test.dart +504 -83
- package/dart_types/CHANGELOG.md +17 -0
- package/dart_types/lib/nomos_kernel_protocol.dart +11 -0
- package/dart_types/lib/src/custody.dart +64 -19
- package/dart_types/lib/src/local_work_rejected.dart +30 -45
- package/dart_types/lib/src/proto/nomos/custody/v1/snapshot.pb.dart +169 -0
- package/dart_types/lib/src/proto/nomos/custody/v1/snapshot.pbenum.dart +11 -0
- package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pb.dart +17945 -0
- package/dart_types/lib/src/proto/nomos/kernel/v1/kernel.pbenum.dart +933 -0
- package/dart_types/lib/src/proto/nomos/kernel/v1/progress.pb.dart +245 -0
- package/dart_types/lib/src/proto/nomos/kernel/v1/progress.pbenum.dart +160 -0
- package/dart_types/lib/src/proto/nomos/runtime/v2/runtime.pb.dart +8664 -0
- package/dart_types/lib/src/proto/nomos/runtime/v2/runtime.pbenum.dart +369 -0
- package/dart_types/lib/src/surfaced.dart +30 -25
- package/dart_types/pubspec.lock +16 -0
- package/dart_types/pubspec.yaml +3 -1
- package/dart_types/test/surfaced_test.dart +2 -1
- package/package.json +1 -1
- package/runtime/generated-application-host.js +5760 -1879
- package/src/authoring.ts +3 -2
- package/src/birth_meter_ensure.ts +2 -0
- package/src/births.ts +21 -0
- package/src/build_package.ts +30 -0
- package/src/business_birth.ts +41 -35
- package/src/codegen_call_usda.ts +1111 -0
- package/src/codegen_dart.ts +207 -282
- package/src/codegen_dart_application.ts +195 -252
- package/src/codegen_dart_client.ts +1978 -593
- package/src/codegen_dart_framework_calls.ts +291 -0
- package/src/codegen_dart_scenario.ts +7 -0
- package/src/codegen_proof.ts +3 -4
- package/src/codegen_provider_dart.ts +21 -7
- package/src/codegen_query_usda.ts +214 -0
- package/src/codegen_result_usda.ts +685 -0
- package/src/codegen_ts.ts +3945 -1111
- package/src/compile_package_main.ts +392 -46
- package/src/directive.ts +19 -4
- package/src/engine_entry.ts +45 -4
- package/src/framework/application_home.ts +4 -0
- package/src/framework/auth_provider_law.ts +296 -20
- package/src/framework/birth_certificate_law.ts +24 -0
- package/src/framework/home.ts +83 -40
- package/src/framework/owned_custody.ts +25 -12
- package/src/framework/owned_custody_value.ts +51 -0
- package/src/framework/relations.ts +47 -21
- package/src/framework/signing_identity.ts +100 -17
- package/src/framework/workspaces.ts +39 -10
- package/src/framework_call_definitions.ts +53 -0
- package/src/framework_read_definitions.ts +45 -0
- package/src/identity_frontier.ts +58 -0
- package/src/index.ts +22 -1
- package/src/intent.ts +216 -16
- package/src/law_check.ts +19 -1
- package/src/law_graph.ts +57 -8
- package/src/law_graph_usda.ts +73 -5
- package/src/law_value_type.ts +106 -19
- package/src/read.ts +47 -0
- package/src/read_projection_namespace.ts +7 -0
- package/src/shape_compat.ts +44 -42
- package/src/stable_ids.ts +37 -2
- package/src/test_call_usda.ts +83 -0
- package/src/wire.ts +36 -2
- package/src/wire_encode.ts +45 -1
- package/src/workspace_sharing.ts +27 -10
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
@internal
|
|
2
|
+
library;
|
|
3
|
+
|
|
4
|
+
import 'package:fixnum/fixnum.dart' as fixnum;
|
|
5
|
+
import 'package:meta/meta.dart' show internal;
|
|
6
|
+
import 'package:nomos_types/nomos_kernel_protocol.dart' as nomos_protocol;
|
|
7
|
+
import 'package:nomos_types/nomos_types.dart'
|
|
8
|
+
show NomosErrorInfo, nomosErrorFromInfo;
|
|
9
|
+
|
|
10
|
+
import 'runtime_v2_transport.dart';
|
|
11
|
+
|
|
12
|
+
/// Correlates generated Runtime v2 frames and translates only the generated
|
|
13
|
+
/// failure arm. It knows nothing about sessions, domains, lifecycle policy, or
|
|
14
|
+
/// application state; those remain with the caller that owns each command.
|
|
15
|
+
final class NmsRuntimeV2Gateway {
|
|
16
|
+
NmsRuntimeV2Gateway(this._transport);
|
|
17
|
+
|
|
18
|
+
final NomosRuntimeV2Transport _transport;
|
|
19
|
+
int _sequence = 0;
|
|
20
|
+
|
|
21
|
+
Future<nomos_protocol.RuntimeResponse> invoke(
|
|
22
|
+
nomos_protocol.RuntimeRequest request,
|
|
23
|
+
) async {
|
|
24
|
+
final requestId = fixnum.Int64(++_sequence);
|
|
25
|
+
request
|
|
26
|
+
..protocolVersion = 2
|
|
27
|
+
..requestId = requestId;
|
|
28
|
+
final response = await _transport.invokeRuntime(request);
|
|
29
|
+
if (response.protocolVersion != 2) {
|
|
30
|
+
throw StateError(
|
|
31
|
+
'Nomos host returned Runtime protocol ${response.protocolVersion}',
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
if (response.requestId != requestId) {
|
|
35
|
+
throw StateError(
|
|
36
|
+
'Runtime v2 response ${response.requestId} belongs to another request',
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
if (response.hasFailure()) {
|
|
40
|
+
final failure = response.failure;
|
|
41
|
+
throw nomosErrorFromInfo(
|
|
42
|
+
NomosErrorInfo(
|
|
43
|
+
code: failure.code,
|
|
44
|
+
message: failure.message,
|
|
45
|
+
component: failure.component,
|
|
46
|
+
workspace: failure.hasWorkspace() ? failure.workspace : null,
|
|
47
|
+
domain: failure.hasDomain() ? failure.domain : null,
|
|
48
|
+
directiveId: failure.hasDirective() ? failure.directive : null,
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
return response;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
@internal
|
|
2
|
+
library;
|
|
3
|
+
|
|
4
|
+
import 'dart:async';
|
|
5
|
+
|
|
6
|
+
import 'package:fixnum/fixnum.dart' as fixnum;
|
|
7
|
+
import 'package:meta/meta.dart' show internal;
|
|
8
|
+
import 'package:nomos_types/nomos_kernel_protocol.dart' as nomos_protocol;
|
|
9
|
+
|
|
10
|
+
/// Binary generated-message path from an application host to the kernel.
|
|
11
|
+
abstract interface class NomosKernelCallTransport {
|
|
12
|
+
Future<nomos_protocol.CallResponse> callKernel({
|
|
13
|
+
required String session,
|
|
14
|
+
required nomos_protocol.CallRequest request,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/// Exact Runtime v2 frame exchange. Platform transports carry bytes; they do
|
|
19
|
+
/// not acquire command names, argument bags, or domain result semantics.
|
|
20
|
+
abstract interface class NomosRuntimeV2Transport {
|
|
21
|
+
Future<nomos_protocol.RuntimeResponse> invokeRuntime(
|
|
22
|
+
nomos_protocol.RuntimeRequest request,
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// Generated asynchronous runtime event lane. It is separate from invocation
|
|
27
|
+
/// correlation because a watch/sync event has no request future to complete.
|
|
28
|
+
abstract interface class NomosRuntimeV2EventTransport {
|
|
29
|
+
Stream<nomos_protocol.RuntimeEvent> get runtimeEvents;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/// A level-triggered generated event stream. Runtime readiness can arrive while
|
|
33
|
+
/// a WebView script is loading, before [NomosBridge] exists; a broadcast stream
|
|
34
|
+
/// would silently discard it and turn a successful boot into an infinite wait.
|
|
35
|
+
/// Buffering ends when the first bridge subscribes, after which events remain a
|
|
36
|
+
/// normal broadcast stream.
|
|
37
|
+
final class NmsBufferedRuntimeEvents {
|
|
38
|
+
NmsBufferedRuntimeEvents() {
|
|
39
|
+
_controller = StreamController<nomos_protocol.RuntimeEvent>.broadcast(
|
|
40
|
+
onListen: _attach,
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
late final StreamController<nomos_protocol.RuntimeEvent> _controller;
|
|
45
|
+
final List<nomos_protocol.RuntimeEvent> _pending = [];
|
|
46
|
+
bool _attached = false;
|
|
47
|
+
|
|
48
|
+
Stream<nomos_protocol.RuntimeEvent> get stream => _controller.stream;
|
|
49
|
+
bool get isClosed => _controller.isClosed;
|
|
50
|
+
|
|
51
|
+
void _attach() {
|
|
52
|
+
if (_attached) return;
|
|
53
|
+
_attached = true;
|
|
54
|
+
final pending = List<nomos_protocol.RuntimeEvent>.of(_pending);
|
|
55
|
+
_pending.clear();
|
|
56
|
+
for (final event in pending) {
|
|
57
|
+
if (!_controller.isClosed) _controller.add(event);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
void add(nomos_protocol.RuntimeEvent event) {
|
|
62
|
+
if (_controller.isClosed) return;
|
|
63
|
+
if (_attached) {
|
|
64
|
+
_controller.add(event);
|
|
65
|
+
} else {
|
|
66
|
+
_pending.add(event);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
void addError(Object error, [StackTrace? stackTrace]) {
|
|
71
|
+
if (_controller.isClosed) return;
|
|
72
|
+
_controller.addError(error, stackTrace);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
Future<void> close() {
|
|
76
|
+
_pending.clear();
|
|
77
|
+
return _controller.close();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/// Shared typed kernel-call lowering for every Runtime v2 transport.
|
|
82
|
+
mixin NomosRuntimeV2KernelCalls
|
|
83
|
+
implements NomosRuntimeV2Transport, NomosKernelCallTransport {
|
|
84
|
+
int _nmsRuntimeRequestSequence = 0;
|
|
85
|
+
|
|
86
|
+
@override
|
|
87
|
+
Future<nomos_protocol.CallResponse> callKernel({
|
|
88
|
+
required String session,
|
|
89
|
+
required nomos_protocol.CallRequest request,
|
|
90
|
+
}) async {
|
|
91
|
+
final requestId = fixnum.Int64(++_nmsRuntimeRequestSequence);
|
|
92
|
+
final response = await invokeRuntime(
|
|
93
|
+
nomos_protocol.RuntimeRequest(
|
|
94
|
+
protocolVersion: 2,
|
|
95
|
+
requestId: requestId,
|
|
96
|
+
kernelCall: nomos_protocol.KernelCallRequest(
|
|
97
|
+
session: session,
|
|
98
|
+
request: request,
|
|
99
|
+
),
|
|
100
|
+
),
|
|
101
|
+
);
|
|
102
|
+
if (response.requestId != requestId) {
|
|
103
|
+
throw StateError(
|
|
104
|
+
'Runtime v2 response ${response.requestId} belongs to another request',
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
if (response.hasFailure()) {
|
|
108
|
+
throw StateError('${response.failure.code}: ${response.failure.message}');
|
|
109
|
+
}
|
|
110
|
+
if (!response.hasKernelCall()) {
|
|
111
|
+
throw StateError(
|
|
112
|
+
'Runtime v2 returned ${response.whichOutcome().name} for a kernel call',
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
return response.kernelCall;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -28,6 +28,8 @@ import 'package:meta/meta.dart' show internal;
|
|
|
28
28
|
|
|
29
29
|
import 'dart:convert';
|
|
30
30
|
|
|
31
|
+
import 'package:nomos_types/nomos_kernel_protocol.dart' as nomos_protocol;
|
|
32
|
+
|
|
31
33
|
import 'webview_bridge.dart';
|
|
32
34
|
|
|
33
35
|
/// The STATIC INTERFACE DESCRIPTOR a generated client exposes as `XClient.interface` — what the
|
|
@@ -474,8 +476,11 @@ extension NomosSessionCompat on NomosSession {
|
|
|
474
476
|
final m = await metrics();
|
|
475
477
|
behind = ((m['behind'] as num?) ?? 0).toInt();
|
|
476
478
|
final listed = await listWorkspaces();
|
|
477
|
-
cloudBound = listed.any((
|
|
478
|
-
|
|
479
|
+
cloudBound = listed.any((candidate) =>
|
|
480
|
+
candidate.workspace == workspace &&
|
|
481
|
+
candidate.syncPosture ==
|
|
482
|
+
nomos_protocol
|
|
483
|
+
.WorkspaceSyncPosture.WORKSPACE_SYNC_POSTURE_CLOUD_BOUND);
|
|
479
484
|
} catch (_) {/* best-effort */}
|
|
480
485
|
if (cloudBound && behind > 0) {
|
|
481
486
|
cause = SessionMismatchCause.liveCloudHasLawButLocalStale;
|