@native-sdk/cli 0.7.1 → 0.8.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/build/app.zig +273 -65
- package/build/ts_run.mjs +6 -8
- package/build.zig +341 -361
- package/native-sdk.d.ts +6 -3
- package/package.json +13 -11
- package/packages/core/compile-surface/core.ts +559 -0
- package/packages/core/package-lock.json +375 -12
- package/packages/core/package.json +9 -6
- package/packages/core/scripts/compiler_typecheck.mjs +58 -0
- package/packages/core/scripts/gen_case_tables.mjs +130 -0
- package/packages/core/scripts/gen_declarations.mjs +97 -0
- package/packages/core/scripts/run_external_core_compiler.mjs +108 -0
- package/packages/core/scripts/stage_external_core.mjs +148 -0
- package/packages/core/sdk/core.d.ts +363 -0
- package/packages/core/sdk/events.d.ts +65 -0
- package/packages/core/sdk/text.d.ts +51 -0
- package/packages/core/src/checker.ts +3 -3
- package/packages/core/src/cli.ts +40 -38
- package/packages/core/src/contract.ts +749 -0
- package/packages/core/src/devhost.ts +4 -3
- package/packages/core/src/diagnostics.ts +5 -7
- package/packages/core/src/{transpile.ts → frontend.ts} +38 -50
- package/packages/core/src/infer.ts +1 -1
- package/packages/core/src/typed_ast.ts +16 -15
- package/packages/core/src/wyhash.ts +79 -0
- package/skill-data/native-ui/SKILL.md +4 -2
- package/skill-data/ts-core/SKILL.md +29 -29
- package/src/platform/macos/appkit_host.m +51 -3
- package/src/platform/types.zig +4 -0
- package/src/platform/windows/gpu_surface_renderer.cpp +2280 -0
- package/src/platform/windows/gpu_surface_renderer.h +86 -0
- package/src/platform/windows/root.zig +298 -20
- package/src/platform/windows/webview2_host.cpp +343 -33
- package/src/primitives/canvas/code.zig +50 -0
- package/src/primitives/canvas/code_tests.zig +174 -1
- package/src/primitives/canvas/frame.zig +45 -1
- package/src/primitives/canvas/gpu.zig +6 -0
- package/src/primitives/canvas/render_tests.zig +93 -0
- package/src/primitives/canvas/root.zig +2 -0
- package/src/primitives/canvas/serialization.zig +150 -21
- package/src/primitives/canvas/themes/geist.zig +51 -5
- package/src/primitives/canvas/tokens.zig +33 -4
- package/src/primitives/canvas/ui.zig +52 -7
- package/src/primitives/canvas/ui_markup.zig +38 -1
- package/src/primitives/canvas/ui_markup_compiled.zig +28 -0
- package/src/primitives/canvas/ui_markup_contract.zig +9 -0
- package/src/primitives/canvas/ui_markup_view.zig +28 -0
- package/src/primitives/canvas/ui_markup_view_tests.zig +10 -2
- package/src/primitives/canvas/ui_schema.zig +5 -0
- package/src/primitives/canvas/ui_schema_tests.zig +4 -3
- package/src/primitives/canvas/ui_tests.zig +14 -0
- package/src/primitives/canvas/widget_builtin_tests.zig +513 -13
- package/src/primitives/canvas/widget_invalidation.zig +11 -1
- package/src/primitives/canvas/widget_layout.zig +260 -21
- package/src/primitives/canvas/widget_metrics.zig +45 -9
- package/src/primitives/canvas/widget_render.zig +220 -70
- package/src/primitives/canvas/widget_render_controls.zig +79 -21
- package/src/primitives/canvas/widget_render_style.zig +52 -8
- package/src/primitives/canvas/widget_text_input.zig +2 -0
- package/src/primitives/canvas/widgets.zig +53 -2
- package/src/runtime/canvas_frame.zig +60 -7
- package/src/runtime/canvas_frame_invalidation_tests.zig +80 -0
- package/src/runtime/canvas_frame_packet_tests.zig +83 -9
- package/src/runtime/canvas_frame_patch_tests.zig +16 -0
- package/src/runtime/canvas_images.zig +8 -2
- package/src/runtime/canvas_widget_clipboard_tests.zig +1 -1
- package/src/runtime/canvas_widget_runtime.zig +11 -8
- package/src/runtime/effects.zig +6 -0
- package/src/runtime/effects_tests.zig +30 -0
- package/src/runtime/gpu_surface_events.zig +38 -7
- package/src/runtime/media_surface_tests.zig +1 -1
- package/src/runtime/runtime_event_tests.zig +74 -0
- package/src/runtime/ts_core_host.zig +38 -38
- package/src/runtime/ts_ui_app.zig +12 -12
- package/src/runtime/ui_app.zig +10 -8
- package/src/runtime/ui_app_tests.zig +67 -0
- package/src/runtime/view.zig +6 -0
- package/src/runtime/view_canvas.zig +15 -0
- package/src/runtime/view_widget_text.zig +6 -4
- package/src/runtime/window_view_runtime.zig +1 -0
- package/src/tooling/manifest.zig +32 -0
- package/src/tooling/raw_manifest.zig +4 -0
- package/src/tooling/templates.zig +34 -26
- package/src/tooling/ts_core.zig +55 -34
- package/src/tooling/verbs.zig +1 -1
- package/tools/corewire/core_abi.zig +169 -0
- package/tools/corewire/emit.zig +2418 -0
- package/tools/corewire/emit_facade.zig +3984 -0
- package/tools/corewire/emit_profile.zig +501 -0
- package/tools/corewire/main.zig +561 -0
- package/tools/corewire/shim_rt.zig +632 -0
- package/tools/corewire/sidecar.zig +2507 -0
- package/packages/core/rt/rt.zig +0 -1986
- package/packages/core/src/emitter.ts +0 -11898
|
@@ -86,19 +86,25 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
86
86
|
// republish when the runtime is invalidated, and a frame
|
|
87
87
|
// completion carrying a NEW discrete fact may have no
|
|
88
88
|
// other invalidation source, leaving the published
|
|
89
|
-
// snapshot stale forever.
|
|
90
|
-
// (a
|
|
89
|
+
// snapshot stale forever. Three such facts invalidate here
|
|
90
|
+
// (a fourth — a resolved input latency — is checked after
|
|
91
91
|
// the app dispatch below, where the responding present
|
|
92
92
|
// stamps it):
|
|
93
93
|
// - the host-reported nonblank verdict changed (the
|
|
94
94
|
// first nonblank presentation on an idle boot has no
|
|
95
95
|
// resize and no input to piggyback on);
|
|
96
|
+
// - the concrete presenter changed (for example a
|
|
97
|
+
// Direct2D packet refusal fell back to software, or a
|
|
98
|
+
// later packet recovered Direct2D);
|
|
96
99
|
// - this frame recorded the first-frame latency.
|
|
97
100
|
// Steady-state frames carry no new fact and stay quiet —
|
|
98
101
|
// a timer-mode surface must not republish observable
|
|
99
102
|
// state 60 times a second.
|
|
100
103
|
const first_frame_latency_recorded = !first_frame_latency_was_recorded and self.views[index].gpu_first_frame_latency_recorded;
|
|
101
|
-
if (self.views[index].gpu_frame_nonblank != frame_event.nonblank or
|
|
104
|
+
if (self.views[index].gpu_frame_nonblank != frame_event.nonblank or
|
|
105
|
+
self.views[index].gpu_backend != frame_event.backend or
|
|
106
|
+
first_frame_latency_recorded)
|
|
107
|
+
{
|
|
102
108
|
self.invalidateFor(.state, self.views[index].frame);
|
|
103
109
|
}
|
|
104
110
|
self.views[index].gpu_frame_nonblank = frame_event.nonblank;
|
|
@@ -113,11 +119,11 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
113
119
|
try enrichGpuSurfaceFrameDiagnostics(self, index, &enriched_frame_event);
|
|
114
120
|
} else if (self.views[index].info().gpuFrame()) |gpu_frame| {
|
|
115
121
|
enriched_frame_event = gpuSurfaceFrameEventFromGpuFrame(gpu_frame);
|
|
116
|
-
// GpuFrame is persistent surface state; the occluded
|
|
117
|
-
// fact is per-completion metadata and must survive
|
|
118
|
-
// the rebuild so the app sees it honestly.
|
|
119
|
-
enriched_frame_event.occluded = frame_event.occluded;
|
|
120
122
|
}
|
|
123
|
+
// Diagnostic enrichment and the low-cost persistent-frame
|
|
124
|
+
// rebuild can both replace fields. Reapply facts owned by
|
|
125
|
+
// this host completion, including device-loss recovery.
|
|
126
|
+
preserveGpuSurfaceCompletionFacts(frame_event, &enriched_frame_event);
|
|
121
127
|
// Alpha mode is immutable surface configuration, not a
|
|
122
128
|
// completion-time measurement. The desktop ABIs predate
|
|
123
129
|
// premultiplied surfaces and stamp their legacy opaque
|
|
@@ -1037,6 +1043,7 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
1037
1043
|
.timestamp_ns = enriched_frame_event.timestamp_ns,
|
|
1038
1044
|
.surface_size = enriched_frame_event.size,
|
|
1039
1045
|
.scale = enriched_frame_event.scale_factor,
|
|
1046
|
+
.full_repaint = enriched_frame_event.canvas_frame_full_repaint,
|
|
1040
1047
|
}, CanvasFrameMethods().canvasFrameScratchStorage(self), false);
|
|
1041
1048
|
const preview_render_pass = preview_frame.renderPass();
|
|
1042
1049
|
const preview_gpu_packet_summary = preview_frame.gpuPacketSummary();
|
|
@@ -1142,6 +1149,30 @@ pub fn RuntimeGpuSurfaceEvents(comptime Runtime: type) type {
|
|
|
1142
1149
|
};
|
|
1143
1150
|
}
|
|
1144
1151
|
|
|
1152
|
+
fn preserveGpuSurfaceCompletionFacts(source: platform.GpuSurfaceFrameEvent, target: *platform.GpuSurfaceFrameEvent) void {
|
|
1153
|
+
target.occluded = source.occluded;
|
|
1154
|
+
if (source.canvas_frame_full_repaint) {
|
|
1155
|
+
target.canvas_frame_requires_render = true;
|
|
1156
|
+
target.canvas_frame_full_repaint = true;
|
|
1157
|
+
}
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
test "GPU completion preserves host-forced full repaint" {
|
|
1161
|
+
var enriched: platform.GpuSurfaceFrameEvent = .{
|
|
1162
|
+
.label = "canvas",
|
|
1163
|
+
.size = geometry.SizeF.init(640, 360),
|
|
1164
|
+
};
|
|
1165
|
+
preserveGpuSurfaceCompletionFacts(.{
|
|
1166
|
+
.label = "canvas",
|
|
1167
|
+
.size = geometry.SizeF.init(640, 360),
|
|
1168
|
+
.occluded = true,
|
|
1169
|
+
.canvas_frame_full_repaint = true,
|
|
1170
|
+
}, &enriched);
|
|
1171
|
+
try std.testing.expect(enriched.occluded);
|
|
1172
|
+
try std.testing.expect(enriched.canvas_frame_requires_render);
|
|
1173
|
+
try std.testing.expect(enriched.canvas_frame_full_repaint);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1145
1176
|
fn setFocusedView(self: anytype, window_id: platform.WindowId, label: []const u8) !void {
|
|
1146
1177
|
if (runtimeFindWindowIndexById(self, window_id)) |window_index| {
|
|
1147
1178
|
self.windows[window_index].main_focused = std.mem.eql(u8, label, "main");
|
|
@@ -877,7 +877,7 @@ test "a session recorded with a live producer replays fingerprint-identical with
|
|
|
877
877
|
const media = @import("../root.zig");
|
|
878
878
|
|
|
879
879
|
test "docs example: the typed producer callback is writable against the public exports" {
|
|
880
|
-
// docs/src/app/media-producers/page.mdx, "The mpv shape": the docs
|
|
880
|
+
// docs/src/app/docs/media-producers/page.mdx, "The mpv shape": the docs
|
|
881
881
|
// machinery checks prose patterns, not Zig fences (the
|
|
882
882
|
// test-docs-media-producer-contracts step pins the signature in the
|
|
883
883
|
// page AND in this file), so this test is the compile-shaped mirror
|
|
@@ -936,6 +936,80 @@ test "gpu surface nonblank transition invalidates the runtime" {
|
|
|
936
936
|
try std.testing.expect(!harness.runtime.invalidated);
|
|
937
937
|
}
|
|
938
938
|
|
|
939
|
+
test "gpu surface backend transition invalidates the runtime" {
|
|
940
|
+
const TestApp = struct {
|
|
941
|
+
fn app(self: *@This()) App {
|
|
942
|
+
return .{ .context = self, .name = "gpu-backend-transition", .source = platform.WebViewSource.html("<h1>GPU</h1>"), .event_fn = event };
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
fn event(context: *anyopaque, runtime: *Runtime, event_value: Event) anyerror!void {
|
|
946
|
+
_ = context;
|
|
947
|
+
_ = runtime;
|
|
948
|
+
_ = event_value;
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
|
|
952
|
+
const harness = try TestHarness().create(std.testing.allocator, .{});
|
|
953
|
+
defer harness.destroy(std.testing.allocator);
|
|
954
|
+
harness.null_platform.gpu_surfaces = true;
|
|
955
|
+
var app_state: TestApp = .{};
|
|
956
|
+
const app = app_state.app();
|
|
957
|
+
try harness.start(app);
|
|
958
|
+
|
|
959
|
+
_ = try harness.runtime.createView(.{
|
|
960
|
+
.window_id = 1,
|
|
961
|
+
.label = "canvas",
|
|
962
|
+
.kind = .gpu_surface,
|
|
963
|
+
.frame = geometry.RectF.init(0, 0, 640, 360),
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
// A fallback completion changes an observable snapshot fact even when
|
|
967
|
+
// nonblank and latency state stay unchanged.
|
|
968
|
+
harness.runtime.invalidated = false;
|
|
969
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
|
|
970
|
+
.window_id = 1,
|
|
971
|
+
.label = "canvas",
|
|
972
|
+
.size = geometry.SizeF.init(640, 360),
|
|
973
|
+
.scale_factor = 1,
|
|
974
|
+
.frame_index = 1,
|
|
975
|
+
.timestamp_ns = 16,
|
|
976
|
+
.nonblank = false,
|
|
977
|
+
.backend = .software,
|
|
978
|
+
} });
|
|
979
|
+
try std.testing.expect(harness.runtime.invalidated);
|
|
980
|
+
try std.testing.expectEqual(platform.GpuSurfaceBackend.software, (try harness.runtime.gpuSurfaceFrame(1, "canvas")).backend);
|
|
981
|
+
|
|
982
|
+
// The same presenter on the next timer completion is steady state and
|
|
983
|
+
// must not turn snapshot publication into a per-frame loop.
|
|
984
|
+
harness.runtime.invalidated = false;
|
|
985
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
|
|
986
|
+
.window_id = 1,
|
|
987
|
+
.label = "canvas",
|
|
988
|
+
.size = geometry.SizeF.init(640, 360),
|
|
989
|
+
.scale_factor = 1,
|
|
990
|
+
.frame_index = 2,
|
|
991
|
+
.timestamp_ns = 32,
|
|
992
|
+
.nonblank = false,
|
|
993
|
+
.backend = .software,
|
|
994
|
+
} });
|
|
995
|
+
try std.testing.expect(!harness.runtime.invalidated);
|
|
996
|
+
|
|
997
|
+
// Recovery to the packet presenter is the same observable transition
|
|
998
|
+
// in the opposite direction.
|
|
999
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
|
|
1000
|
+
.window_id = 1,
|
|
1001
|
+
.label = "canvas",
|
|
1002
|
+
.size = geometry.SizeF.init(640, 360),
|
|
1003
|
+
.scale_factor = 1,
|
|
1004
|
+
.frame_index = 3,
|
|
1005
|
+
.timestamp_ns = 48,
|
|
1006
|
+
.nonblank = false,
|
|
1007
|
+
.backend = .direct2d,
|
|
1008
|
+
} });
|
|
1009
|
+
try std.testing.expect(harness.runtime.invalidated);
|
|
1010
|
+
try std.testing.expectEqual(platform.GpuSurfaceBackend.direct2d, (try harness.runtime.gpuSurfaceFrame(1, "canvas")).backend);
|
|
1011
|
+
}
|
|
1012
|
+
|
|
939
1013
|
test "a handler error degrades: dispatch continues, the error ring records it, snapshots publish it" {
|
|
940
1014
|
// One erroring update arm used to exit the whole app
|
|
941
1015
|
// (the platform callback saw the error, set `failed`, and stopped
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
//! The native host consumer for
|
|
2
|
-
//! versioned command/subscription wire format a
|
|
3
|
-
//! (`
|
|
4
|
-
//!
|
|
5
|
-
//!
|
|
6
|
-
//!
|
|
7
|
-
//!
|
|
8
|
-
//!
|
|
9
|
-
//!
|
|
1
|
+
//! The native host consumer for compiled TypeScript app cores: bridges
|
|
2
|
+
//! the versioned command/subscription wire format a compiled core
|
|
3
|
+
//! emits (`cmd_format_version` 3) onto the real effect engine
|
|
4
|
+
//! (`effects.zig`). The TypeScript tier's core module is a pure
|
|
5
|
+
//! Model/Msg/update core whose effects are INERT BYTES — this module is
|
|
6
|
+
//! the one place those bytes become engine calls, so the entire
|
|
7
|
+
//! existing effects machinery (executors, keyed slots, the completion
|
|
8
|
+
//! queue, the session journal, replay) carries TypeScript cores without
|
|
9
|
+
//! a parallel engine.
|
|
10
10
|
//!
|
|
11
|
-
//! `TsCoreHost(core)` is comptime-generic over the
|
|
12
|
-
//!
|
|
11
|
+
//! `TsCoreHost(core)` is comptime-generic over the core module (the
|
|
12
|
+
//! corewire-generated mirror over a compiled archive, or any
|
|
13
|
+
//! hand-written module of the same shape) and expects:
|
|
13
14
|
//!
|
|
14
|
-
//! core.rt the core's
|
|
15
|
+
//! core.rt the core's runtime: `frameAlloc`,
|
|
15
16
|
//! `frameReset`, `resetAll`
|
|
16
17
|
//! core.Model the committed model struct
|
|
17
18
|
//! core.Msg the app Msg `union(enum)` (wire tags are the
|
|
@@ -22,14 +23,13 @@
|
|
|
22
23
|
//! core.commitModelRoot the frame-end commit walker
|
|
23
24
|
//! core.subscriptions optional: `fn (*const Model) []const u8`
|
|
24
25
|
//!
|
|
25
|
-
//! Like the
|
|
26
|
-
//! state — the
|
|
27
|
-
//! over the same
|
|
28
|
-
//!
|
|
29
|
-
//!
|
|
30
|
-
//!
|
|
31
|
-
//!
|
|
32
|
-
//! exactly that.
|
|
26
|
+
//! Like the runtime it drives, a host instance is container-level
|
|
27
|
+
//! state — the contract is ONE LIVE APP PER CORE MODULE: two apps
|
|
28
|
+
//! over the same core in one process would share a committed root and
|
|
29
|
+
//! one set of bridge tables. A compiled archive additionally owns the
|
|
30
|
+
//! process's fixed-prefix C ABI symbol set, so a process carries ONE
|
|
31
|
+
//! compiled core (each e2e battery is its own binary for exactly that
|
|
32
|
+
//! reason).
|
|
33
33
|
//!
|
|
34
34
|
//! THE DISPATCH CYCLE — every Msg runs update → commit → command walk →
|
|
35
35
|
//! subscription reconcile → frame reset, in that order, because the
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
//! are matched by member name, exactly the
|
|
183
183
|
//! data/closed/rejected set) — until the one `closed`
|
|
184
184
|
//! (or a refused open's `rejected`) terminal retires
|
|
185
|
-
//! it. POSTING is not a TS-tier verb:
|
|
185
|
+
//! it. POSTING is not a TS-tier verb: TypeScript cores
|
|
186
186
|
//! are single-threaded, so the thread-safe posting
|
|
187
187
|
//! handle is native-side API (`Effects.channelHandle`)
|
|
188
188
|
//! for embedders and platform-services extensions —
|
|
@@ -349,7 +349,7 @@
|
|
|
349
349
|
//! frame-resident and copy whatever the model keeps into the heap.
|
|
350
350
|
//!
|
|
351
351
|
//! Malformed wire bytes are teaching panics, not error codes: the only
|
|
352
|
-
//! producer is the
|
|
352
|
+
//! producer is the compiled core's own runtime builders, so a bad record is a
|
|
353
353
|
//! build-pipeline bug the app author must see immediately.
|
|
354
354
|
|
|
355
355
|
const std = @import("std");
|
|
@@ -410,8 +410,8 @@ pub fn videoKeyForTag(event_tag: u8) u64 {
|
|
|
410
410
|
/// families' one engine key space without ever colliding on a key.
|
|
411
411
|
pub const pty_key_base: u64 = 0x5453_5054_0000_0000;
|
|
412
412
|
|
|
413
|
-
/// The spawn wire record's "no line routing" tag sentinel (
|
|
414
|
-
///
|
|
413
|
+
/// The spawn wire record's "no line routing" tag sentinel (the wire
|
|
414
|
+
/// format's shared constant).
|
|
415
415
|
pub const spawn_no_line_tag: u8 = 0xFF;
|
|
416
416
|
|
|
417
417
|
/// Longest wire key (request or timer) the format can carry: the key
|
|
@@ -713,7 +713,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
713
713
|
/// boot model. The command bytes are re-derived by re-running
|
|
714
714
|
/// the PURE `initialModel` (they were frame-resident and did not
|
|
715
715
|
/// survive `boot`'s frame reset; the duplicate model value is
|
|
716
|
-
/// frame-transient garbage) — purity is the
|
|
716
|
+
/// frame-transient garbage) — purity is the app-core subset's
|
|
717
717
|
/// own guarantee, so the bytes are identical by construction.
|
|
718
718
|
pub fn performBoot(fx: *Fx) void {
|
|
719
719
|
if (comptime init_returns_cmd) {
|
|
@@ -789,7 +789,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
789
789
|
/// One full dispatch cycle for `msg`. The `TsUiApp` adapter
|
|
790
790
|
/// wires this to `UiApp.Options.update_fx` (refreshing the
|
|
791
791
|
/// app-held root from `model()` afterwards) so host events and
|
|
792
|
-
/// drained effect results run the
|
|
792
|
+
/// drained effect results run the TypeScript core through the
|
|
793
793
|
/// same path Zig cores use. A Msg flagged by its own result
|
|
794
794
|
/// callback as a dropped entry's terminal is swallowed here —
|
|
795
795
|
/// the silent drop the keyed-effect discipline promises.
|
|
@@ -937,7 +937,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
937
937
|
const url = takeLongBytes(cmd, &at);
|
|
938
938
|
const header_count: usize = takeByte(cmd, &at);
|
|
939
939
|
if (header_count > runtime_effects.max_effect_fetch_headers) {
|
|
940
|
-
@panic("ts core host: a fetch wire record carries more headers than the engine accepts - the
|
|
940
|
+
@panic("ts core host: a fetch wire record carries more headers than the engine accepts - the frontend's own bound should have stopped this build");
|
|
941
941
|
}
|
|
942
942
|
var headers: [runtime_effects.max_effect_fetch_headers]std.http.Header = undefined;
|
|
943
943
|
for (0..header_count) |i| {
|
|
@@ -1006,7 +1006,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
const argc: usize = takeByte(cmd, &at);
|
|
1008
1008
|
if (argc == 0 or argc > runtime_effects.max_effect_argv) {
|
|
1009
|
-
@panic("ts core host: a spawn wire record carries more argv elements than the engine accepts - the
|
|
1009
|
+
@panic("ts core host: a spawn wire record carries more argv elements than the engine accepts - the frontend's own bound should have stopped this build");
|
|
1010
1010
|
}
|
|
1011
1011
|
var argv: [runtime_effects.max_effect_argv][]const u8 = undefined;
|
|
1012
1012
|
for (0..argc) |i| argv[i] = takeLongBytes(cmd, &at);
|
|
@@ -1185,7 +1185,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
1185
1185
|
const term = takeShortBytes(cmd, &at);
|
|
1186
1186
|
const argc: usize = takeByte(cmd, &at);
|
|
1187
1187
|
if (argc == 0 or argc > runtime_effects.max_effect_argv) {
|
|
1188
|
-
@panic("ts core host: a pty_spawn wire record carries more argv elements than the engine accepts - the
|
|
1188
|
+
@panic("ts core host: a pty_spawn wire record carries more argv elements than the engine accepts - the frontend's own bound should have stopped this build");
|
|
1189
1189
|
}
|
|
1190
1190
|
var argv: [runtime_effects.max_effect_argv][]const u8 = undefined;
|
|
1191
1191
|
for (0..argc) |i| argv[i] = takeLongBytes(cmd, &at);
|
|
@@ -2110,7 +2110,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
2110
2110
|
// ------------------------------------------ subscription timers
|
|
2111
2111
|
|
|
2112
2112
|
/// Reconcile the declarative subscription set against the fixed
|
|
2113
|
-
/// timer table — the same algorithm as the
|
|
2113
|
+
/// timer table — the same algorithm as the @native-sdk/core package's
|
|
2114
2114
|
/// run-fidelity drivers, engine-backed: match by key, arm new
|
|
2115
2115
|
/// keys into the first free slot, re-arm on interval change,
|
|
2116
2116
|
/// re-route on tag change, cancel the missing. Slot order
|
|
@@ -2270,7 +2270,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
2270
2270
|
/// (fetch's `{ status, body }` and a collect spawn's
|
|
2271
2271
|
/// `{ code, output }`): the arm must be a struct of exactly one
|
|
2272
2272
|
/// number field and one bytes field, matched BY TYPE (the
|
|
2273
|
-
///
|
|
2273
|
+
/// frontend validates the shape, so field names stay the
|
|
2274
2274
|
/// app's). The bytes copy into the core's frame arena like
|
|
2275
2275
|
/// every routed payload; the number widens into its field the
|
|
2276
2276
|
/// way the subset's number model classes it (i64, u64, or f64).
|
|
@@ -2351,14 +2351,14 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
2351
2351
|
}
|
|
2352
2352
|
|
|
2353
2353
|
/// The arm's `state` member for an engine event kind, matched
|
|
2354
|
-
/// by member NAME (the
|
|
2354
|
+
/// by member NAME (the frontend pins the member set, so the
|
|
2355
2355
|
/// app's declaration order never matters to the wire).
|
|
2356
2356
|
fn audioStateValue(comptime E: type, kind: runtime_effects.EffectAudioEventKind) E {
|
|
2357
2357
|
const name = @tagName(kind);
|
|
2358
2358
|
inline for (@typeInfo(E).@"enum".fields) |f| {
|
|
2359
2359
|
if (std.mem.eql(u8, f.name, name)) return @enumFromInt(f.value);
|
|
2360
2360
|
}
|
|
2361
|
-
@panic("ts core host: an audio event kind has no member in the event arm's state union - the
|
|
2361
|
+
@panic("ts core host: an audio event kind has no member in the event arm's state union - the frontend's own shape check should have stopped this build");
|
|
2362
2362
|
}
|
|
2363
2363
|
|
|
2364
2364
|
/// Build the six-field audio event arm at index `tag` from an
|
|
@@ -2431,7 +2431,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
2431
2431
|
inline for (@typeInfo(E).@"enum".fields) |f| {
|
|
2432
2432
|
if (std.mem.eql(u8, f.name, name)) return @enumFromInt(f.value);
|
|
2433
2433
|
}
|
|
2434
|
-
@panic("ts core host: a video event kind has no member in the event arm's state union - the
|
|
2434
|
+
@panic("ts core host: a video event kind has no member in the event arm's state union - the frontend's own shape check should have stopped this build");
|
|
2435
2435
|
}
|
|
2436
2436
|
|
|
2437
2437
|
/// Build the seven-field video event arm at index `tag` from an
|
|
@@ -2496,7 +2496,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
2496
2496
|
inline for (@typeInfo(E).@"enum".fields) |f| {
|
|
2497
2497
|
if (std.mem.eql(u8, f.name, name)) return @enumFromInt(f.value);
|
|
2498
2498
|
}
|
|
2499
|
-
@panic("ts core host: an image outcome has no member in the result arm's state union - the
|
|
2499
|
+
@panic("ts core host: an image outcome has no member in the result arm's state union - the frontend's own shape check should have stopped this build");
|
|
2500
2500
|
}
|
|
2501
2501
|
|
|
2502
2502
|
/// Build the five-field image result arm at index `tag` from an
|
|
@@ -2561,7 +2561,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
2561
2561
|
inline for (@typeInfo(E).@"enum".fields) |f| {
|
|
2562
2562
|
if (std.mem.eql(u8, f.name, name)) return @enumFromInt(f.value);
|
|
2563
2563
|
}
|
|
2564
|
-
@panic("ts core host: a channel event kind has no member in the event arm's state union - the
|
|
2564
|
+
@panic("ts core host: a channel event kind has no member in the event arm's state union - the frontend's own shape check should have stopped this build");
|
|
2565
2565
|
}
|
|
2566
2566
|
|
|
2567
2567
|
/// Build the five-field channel event arm at index `tag` from
|
|
@@ -2646,7 +2646,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
2646
2646
|
inline for (@typeInfo(E).@"enum".fields) |f| {
|
|
2647
2647
|
if (std.mem.eql(u8, f.name, name)) return @enumFromInt(f.value);
|
|
2648
2648
|
}
|
|
2649
|
-
@panic("ts core host: a pty event kind has no member in the event arm's state union - the
|
|
2649
|
+
@panic("ts core host: a pty event kind has no member in the event arm's state union - the frontend's own shape check should have stopped this build");
|
|
2650
2650
|
}
|
|
2651
2651
|
|
|
2652
2652
|
/// The arm's `reason` member for an engine exit reason, matched
|
|
@@ -2656,7 +2656,7 @@ pub fn TsCoreHost(comptime core: type) type {
|
|
|
2656
2656
|
inline for (@typeInfo(E).@"enum".fields) |f| {
|
|
2657
2657
|
if (std.mem.eql(u8, f.name, name)) return @enumFromInt(f.value);
|
|
2658
2658
|
}
|
|
2659
|
-
@panic("ts core host: a pty exit reason has no member in the event arm's reason union - the
|
|
2659
|
+
@panic("ts core host: a pty exit reason has no member in the event arm's reason union - the frontend's own shape check should have stopped this build");
|
|
2660
2660
|
}
|
|
2661
2661
|
|
|
2662
2662
|
/// Build the six-field pty event arm at index `tag` from an
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
//! `TsUiApp(core)` — the first-class UiApp adapter for
|
|
2
|
-
//! cores: the committed TS model IS the app model. Where a Zig core
|
|
3
|
-
//! hands `UiApp` a mutable model plus `update`, a
|
|
1
|
+
//! `TsUiApp(core)` — the first-class UiApp adapter for compiled
|
|
2
|
+
//! TypeScript app cores: the committed TS model IS the app model. Where a Zig core
|
|
3
|
+
//! hands `UiApp` a mutable model plus `update`, a compiled TypeScript core is an
|
|
4
4
|
//! immutable committed graph plus a pure `update` returning the next
|
|
5
5
|
//! root — this adapter closes that gap with no per-app glue:
|
|
6
6
|
//!
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
//! `chromeMsg` -> `on_appearance`/`on_chrome`, each host event built
|
|
33
33
|
//! structurally by field name from the core's declared records (the
|
|
34
34
|
//! effects-routing rule applied to the app shell; every shape mismatch
|
|
35
|
-
//! is a teaching compile error re-deriving the
|
|
35
|
+
//! is a teaching compile error re-deriving the frontend's NS1033).
|
|
36
36
|
//! `CoreOptions` carries the launch-boundary channels the wiring
|
|
37
37
|
//! resolves: `boot_images` (app.zon assets, registered on the
|
|
38
38
|
//! installing frame) and `env_values` (the core's `envMsgs` variables,
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
//! Record/replay, automation, and pixel fingerprints need nothing
|
|
53
53
|
//! extra: the adapter rides the ordinary UiApp dispatch path, so the
|
|
54
54
|
//! session journal, the automation verbs, and the screenshot marks see
|
|
55
|
-
//! a
|
|
56
|
-
//! contract is the bridge's: one live app per core module (two
|
|
57
|
-
//! over one
|
|
58
|
-
//!
|
|
55
|
+
//! a compiled TypeScript core exactly as they see a Zig one. The
|
|
56
|
+
//! process contract is the bridge's: one live app per core module (two
|
|
57
|
+
//! apps over one core would share a committed root), and one compiled
|
|
58
|
+
//! archive per process (the fixed-prefix C ABI symbol set).
|
|
59
59
|
|
|
60
60
|
const std = @import("std");
|
|
61
61
|
const canvas = @import("canvas");
|
|
@@ -100,7 +100,7 @@ pub fn TsUiApp(comptime core: type) type {
|
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
/// Adapter-owned configuration — the knobs that exist because
|
|
103
|
-
/// the core is
|
|
103
|
+
/// the core is TypeScript, kept separate from `App.Options` so
|
|
104
104
|
/// the wiring surface reads as ordinary UiApp wiring.
|
|
105
105
|
pub const CoreOptions = struct {
|
|
106
106
|
/// Platform caches directory for URL audio playback: when a
|
|
@@ -172,7 +172,7 @@ pub fn TsUiApp(comptime core: type) type {
|
|
|
172
172
|
|
|
173
173
|
fn stampOptions(options: Options) Options {
|
|
174
174
|
if (options.update != null or options.update_fx != null) {
|
|
175
|
-
@panic("TsUiApp owns update: the
|
|
175
|
+
@panic("TsUiApp owns update: the TypeScript core is the update loop - remove the wiring's update/update_fx");
|
|
176
176
|
}
|
|
177
177
|
if (options.init_fx != null) {
|
|
178
178
|
@panic("TsUiApp owns init_fx: the core's initialModel boots the app - remove the wiring's init_fx");
|
|
@@ -282,7 +282,7 @@ pub fn TsUiApp(comptime core: type) type {
|
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
284
|
|
|
285
|
-
/// Teaching re-derivation of the
|
|
285
|
+
/// Teaching re-derivation of the frontend's NS1033 for
|
|
286
286
|
/// hand-assembled cores: every `envMsgs` entry must name a Msg
|
|
287
287
|
/// arm carrying exactly one bytes payload.
|
|
288
288
|
fn validateEnvMsgs() void {
|
|
@@ -472,7 +472,7 @@ pub fn TsUiApp(comptime core: type) type {
|
|
|
472
472
|
}
|
|
473
473
|
|
|
474
474
|
/// The Msg arm index a channel export names, with the teaching
|
|
475
|
-
/// error the
|
|
475
|
+
/// error the frontend's NS1033 re-derives for hand-written
|
|
476
476
|
/// cores.
|
|
477
477
|
fn channelArmIndex(comptime tag: []const u8, comptime channel: []const u8) usize {
|
|
478
478
|
for (@typeInfo(Msg).@"union".fields, 0..) |arm, index| {
|
package/src/runtime/ui_app.zig
CHANGED
|
@@ -4327,13 +4327,14 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
|
|
|
4327
4327
|
self.fonts_built_count = runtime.registeredCanvasFontCount();
|
|
4328
4328
|
}
|
|
4329
4329
|
|
|
4330
|
-
/// Present the planned canvas frame: GPU packet when the
|
|
4331
|
-
///
|
|
4332
|
-
///
|
|
4333
|
-
/// e.g.
|
|
4334
|
-
///
|
|
4335
|
-
///
|
|
4336
|
-
///
|
|
4330
|
+
/// Present the planned canvas frame: GPU packet when the view did
|
|
4331
|
+
/// not explicitly request software and the platform has a packet
|
|
4332
|
+
/// presenter (macOS/Metal — unchanged), otherwise the CPU
|
|
4333
|
+
/// reference-rendered pixel path (`presentGpuSurfacePixels`, e.g.
|
|
4334
|
+
/// Linux/GTK). A platform whose packet presenter exists but reports
|
|
4335
|
+
/// `UnsupportedService` at present time also falls back to pixels;
|
|
4336
|
+
/// that attempt forces a full repaint because the failed packet plan
|
|
4337
|
+
/// already recorded the frame's presented summary.
|
|
4337
4338
|
fn presentFrame(self: *Self, runtime: *Runtime, frame_event: platform.GpuSurfaceFrameEvent, canvas_label: []const u8, force_full_repaint: bool, clear_color: canvas.Color) anyerror!void {
|
|
4338
4339
|
// A forced frame must paint unconditionally: the installing
|
|
4339
4340
|
// frame has no earlier glass to retain. Software-buffer
|
|
@@ -4341,7 +4342,8 @@ pub fn UiAppWithFeatures(comptime ModelT: type, comptime MsgT: type, comptime fe
|
|
|
4341
4342
|
// a surface handoff.
|
|
4342
4343
|
const services = runtime.options.platform.services;
|
|
4343
4344
|
var packet_attempted = false;
|
|
4344
|
-
|
|
4345
|
+
const packet_requested = canvas_frame.canvasGpuPacketPresentationRequested(runtime, frame_event.window_id, canvas_label);
|
|
4346
|
+
if (packet_requested and (services.present_gpu_surface_packet_fn != null or services.present_gpu_surface_packet_binary_fn != null)) {
|
|
4345
4347
|
packet_attempted = true;
|
|
4346
4348
|
const packet_presented = blk: {
|
|
4347
4349
|
_ = runtime.presentNextCanvasGpuPacketWithScale(
|
|
@@ -66,6 +66,25 @@ fn counterOptions() CounterApp.Options {
|
|
|
66
66
|
};
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
const software_counter_views = [_]app_manifest.ShellView{
|
|
70
|
+
.{ .label = canvas_label, .kind = .gpu_surface, .fill = true, .gpu_backend = .software },
|
|
71
|
+
};
|
|
72
|
+
const software_counter_windows = [_]app_manifest.ShellWindow{.{
|
|
73
|
+
.label = "main",
|
|
74
|
+
.title = "Software Counter",
|
|
75
|
+
.width = 400,
|
|
76
|
+
.height = 300,
|
|
77
|
+
.views = &software_counter_views,
|
|
78
|
+
}};
|
|
79
|
+
const software_counter_scene: app_manifest.ShellConfig = .{ .windows = &software_counter_windows };
|
|
80
|
+
|
|
81
|
+
fn softwareCounterOptions() CounterApp.Options {
|
|
82
|
+
var options = counterOptions();
|
|
83
|
+
options.name = "ui-app-software-counter";
|
|
84
|
+
options.scene = software_counter_scene;
|
|
85
|
+
return options;
|
|
86
|
+
}
|
|
87
|
+
|
|
69
88
|
fn findWidgetIdByText(tree: anytype, kind: canvas.WidgetKind, text: []const u8) ?canvas.ObjectId {
|
|
70
89
|
return findIn(tree.root, kind, text);
|
|
71
90
|
}
|
|
@@ -480,6 +499,54 @@ test "ui app presents pixels when the packet service is unsupported" {
|
|
|
480
499
|
try std.testing.expect(try retainedTextExists(&harness.runtime, "Count 1"));
|
|
481
500
|
}
|
|
482
501
|
|
|
502
|
+
test "ui app explicit software canvas bypasses the production packet path" {
|
|
503
|
+
const harness = try core.TestHarness().create(std.testing.allocator, .{ .size = geometry.SizeF.init(400, 300) });
|
|
504
|
+
defer harness.destroy(std.testing.allocator);
|
|
505
|
+
harness.null_platform.gpu_surfaces = true;
|
|
506
|
+
harness.runtime.options.pixel_present_retained_baseline = true;
|
|
507
|
+
|
|
508
|
+
const app_state = try std.testing.allocator.create(CounterApp);
|
|
509
|
+
defer std.testing.allocator.destroy(app_state);
|
|
510
|
+
app_state.* = CounterApp.init(std.testing.allocator, .{}, softwareCounterOptions());
|
|
511
|
+
defer app_state.deinit();
|
|
512
|
+
const app = app_state.app();
|
|
513
|
+
try harness.start(app);
|
|
514
|
+
|
|
515
|
+
// Packet services are available and would accept this frame. The
|
|
516
|
+
// immutable software request must still send it directly to the
|
|
517
|
+
// reference renderer without recording a packet fallback.
|
|
518
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
|
|
519
|
+
.label = canvas_label,
|
|
520
|
+
.size = geometry.SizeF.init(400, 300),
|
|
521
|
+
.scale_factor = 2,
|
|
522
|
+
.frame_index = 1,
|
|
523
|
+
.timestamp_ns = 1_000_000,
|
|
524
|
+
} });
|
|
525
|
+
|
|
526
|
+
try std.testing.expect(app_state.installed);
|
|
527
|
+
try std.testing.expectEqual(zero_platform.GpuSurfaceBackend.software, harness.runtime.views[0].gpu_requested_backend);
|
|
528
|
+
try std.testing.expectEqual(@as(usize, 0), harness.null_platform.gpu_surface_packet_present_count);
|
|
529
|
+
try std.testing.expectEqual(@as(usize, 0), harness.null_platform.gpu_surface_image_upload_count);
|
|
530
|
+
try std.testing.expectEqual(@as(usize, 1), harness.null_platform.gpu_surface_present_count);
|
|
531
|
+
try std.testing.expectEqual(zero_platform.GpuPresentPath.pixels, harness.runtime.views[0].gpu_present_path);
|
|
532
|
+
try std.testing.expectEqual(zero_platform.GpuPresentFallbackReason.none, harness.runtime.views[0].info().gpu_present_fallback_reason);
|
|
533
|
+
|
|
534
|
+
// A changed follow-up frame remains incremental. Treating the central
|
|
535
|
+
// software-policy rejection as a failed packet attempt would force this
|
|
536
|
+
// pixel present back to the full surface.
|
|
537
|
+
try app_state.dispatch(&harness.runtime, 1, .increment);
|
|
538
|
+
try harness.runtime.dispatchPlatformEvent(app, .{ .gpu_surface_frame = .{
|
|
539
|
+
.label = canvas_label,
|
|
540
|
+
.size = geometry.SizeF.init(400, 300),
|
|
541
|
+
.scale_factor = 2,
|
|
542
|
+
.frame_index = 2,
|
|
543
|
+
.timestamp_ns = 17_000_000,
|
|
544
|
+
} });
|
|
545
|
+
try std.testing.expectEqual(@as(usize, 2), harness.null_platform.gpu_surface_present_count);
|
|
546
|
+
const dirty = harness.null_platform.gpu_surface_present_dirty_bounds orelse return error.TestUnexpectedResult;
|
|
547
|
+
try std.testing.expect(dirty.width < 400 or dirty.height < 300);
|
|
548
|
+
}
|
|
549
|
+
|
|
483
550
|
// ---------------------------------- reflow stale-pixel oracle fixture
|
|
484
551
|
|
|
485
552
|
const ReflowRow = struct {
|
package/src/runtime/view.zig
CHANGED
|
@@ -219,6 +219,11 @@ pub const RuntimeView = struct {
|
|
|
219
219
|
gpu_first_frame_latency_recorded: bool = false,
|
|
220
220
|
gpu_frame_nonblank: bool = false,
|
|
221
221
|
gpu_sample_color: u32 = 0,
|
|
222
|
+
/// Immutable creation-time backend request. `gpu_backend` below is
|
|
223
|
+
/// completion state and changes to the concrete presenter reported by
|
|
224
|
+
/// the host, so it cannot answer whether packet work was explicitly
|
|
225
|
+
/// opted out before a present.
|
|
226
|
+
gpu_requested_backend: platform.GpuSurfaceBackend = .none,
|
|
222
227
|
gpu_backend: platform.GpuSurfaceBackend = .none,
|
|
223
228
|
gpu_pixel_format: platform.GpuSurfacePixelFormat = .none,
|
|
224
229
|
gpu_present_mode: platform.GpuSurfacePresentMode = .none,
|
|
@@ -860,6 +865,7 @@ pub const RuntimeView = struct {
|
|
|
860
865
|
pub const copyCanvasFrameResourceCache = CanvasFrameMethods.copyCanvasFrameResourceCache;
|
|
861
866
|
pub const copyCanvasFramePathGeometryCache = CanvasFrameMethods.copyCanvasFramePathGeometryCache;
|
|
862
867
|
pub const copyCanvasFrameImageCache = CanvasFrameMethods.copyCanvasFrameImageCache;
|
|
868
|
+
pub const removeCanvasFrameImageCacheId = CanvasFrameMethods.removeCanvasFrameImageCacheId;
|
|
863
869
|
pub const copyCanvasFrameLayerCache = CanvasFrameMethods.copyCanvasFrameLayerCache;
|
|
864
870
|
pub const copyCanvasFrameVisualEffectCache = CanvasFrameMethods.copyCanvasFrameVisualEffectCache;
|
|
865
871
|
pub const copyCanvasRenderAnimations = CanvasFrameMethods.copyCanvasRenderAnimations;
|
|
@@ -313,6 +313,21 @@ pub fn RuntimeViewCanvasFrame(comptime RuntimeView: type) type {
|
|
|
313
313
|
self.canvas_frame_image_cache_count = entries.len;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
+
/// Forget every retained cache key for one platform image. The
|
|
317
|
+
/// platform removal seam destroys the resource independently of
|
|
318
|
+
/// this per-view planner mirror; leaving an identical key here
|
|
319
|
+
/// would turn a same-content re-registration into `.retain` and
|
|
320
|
+
/// skip the upload needed to recreate that resource.
|
|
321
|
+
pub fn removeCanvasFrameImageCacheId(self: *RuntimeView, image_id: canvas.ImageId) void {
|
|
322
|
+
var kept: usize = 0;
|
|
323
|
+
for (self.canvas_frame_image_cache[0..self.canvas_frame_image_cache_count]) |entry| {
|
|
324
|
+
if (entry.key.image_id == image_id) continue;
|
|
325
|
+
self.canvas_frame_image_cache[kept] = entry;
|
|
326
|
+
kept += 1;
|
|
327
|
+
}
|
|
328
|
+
self.canvas_frame_image_cache_count = kept;
|
|
329
|
+
}
|
|
330
|
+
|
|
316
331
|
pub fn copyCanvasFrameLayerCache(self: *RuntimeView, entries: []const canvas.RenderLayerCacheEntry) anyerror!void {
|
|
317
332
|
if (entries.len > self.canvas_frame_layer_cache.len) return error.LayerListFull;
|
|
318
333
|
@memcpy(self.canvas_frame_layer_cache[0..entries.len], entries);
|