@githolon/runtime 0.112.4 → 0.112.6
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/dist/RUNTIME-SOURCES.sha256 +9 -7
- package/dist/nomos-runner.js +563 -62
- package/package.json +1 -1
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
06525d62b18918913a7fe7981204fba9e1f70369cc2aa785851caae39f546de3 node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.js
|
|
12
12
|
09a24ed660112991f8105d8c0c2c250617b6ad99f6a12afe2d39b8a9305289ec peer-office/src/runtime/session_directory.ts
|
|
13
13
|
0a687d73d1754114045dd64ab0125af437945ed11b1302753b1c3c46793a014b peer-office/src/runtime/replica_follow_lane.ts
|
|
14
|
-
0aed53ba7b333581e2aab3f5e90444abdbaa8d3defdb11ae3d7ae475b869d36c platform-shells/browser/kernel_custody.ts
|
|
15
14
|
0b2994ee1fee5c72c7f27881aea421bdb1757b0c8c4042f155c433015b0b2455 node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.js
|
|
16
15
|
0b5eee51991554d54865ea30f65f8803c8dfe73116cd815676f927021329259a peer-office/src/runtime/credential_vault.ts
|
|
17
16
|
0db0f42ba330749a7b05095ea1fd0ff63fd2b30e84cead30fe4c28359d15f194 node_modules/@bjorn3/browser_wasi_shim/dist/wasi_defs.js
|
|
@@ -27,11 +26,11 @@
|
|
|
27
26
|
11ba369493cb754f09f8ef04f1235d64708a283cead2164bfd12679c940fcbe6 adapter/certification_seal.ts
|
|
28
27
|
13418e92f08476ae029573738d8a74f8fb4d6cfd3d8f610d0512da9d44a3a20d peer-office/src/runtime/http_obligation_delivery.ts
|
|
29
28
|
151e39e98e6d58e6453f6b9aab5f93af32cfe4e8e2915b71952a337145976049 peer-office/src/runtime/authoring_preflight.ts
|
|
29
|
+
15a24c9133b37575f0e8d6a0db6a9e383b8ebb944d1929aab6694084eff85291 adapter/kernel_machine_desk.ts
|
|
30
30
|
161a203d3e9f10a6de3ffa798f736f6aa157f0ab85a40c3f3d6a412729a105e2 peer-office/src/runtime/platform_effect_driver.ts
|
|
31
31
|
168eb977a826f75ab0c39f9322f78cc58dbd5b233019ad1d6a7e940af8a7c4aa node_modules/@bjorn3/browser_wasi_shim/dist/wasi.js
|
|
32
32
|
16d6522ee4ecf4a91c4d29357ebc874844c266f2ae89ef2a92ec2d391f3762e9 node_modules/is-unsafe/src/contexts/sql-strict.js
|
|
33
33
|
17b0d228dd20748bd5fa03164478198c813214e4fa5d8f1650705128a954f0bd adapter/wasi_custody_filesystem.ts
|
|
34
|
-
1923aefdc23c6f66e5bc5b70c71b3fa66267738b3dcfa82a59ddecf7831152ef adapter/memory_custody_filesystem.ts
|
|
35
34
|
1963a804a9cfe7d44a76b2c476817639b939d7e93828da865cab40fe9ba536fa adapter/custody-transport.ts
|
|
36
35
|
1a5d9fd32360e2cec4adbee9e56221fb26def66bb9d122e0b5745cebc963d92e node_modules/xml-naming/src/index.js
|
|
37
36
|
1b27a1f4d58d6314cd4887d0f47493d1a98fc474e3364388f321c3aeb94a8ac3 adapter/workspace_effect_outcome.ts
|
|
@@ -52,6 +51,7 @@
|
|
|
52
51
|
25c033d29ed62a510d8c43054ec238776bcba0949808cb6054df5cbea951ddf7 adapter/proto/nomos/runtime/v2/interaction_desk_pb.js
|
|
53
52
|
25d57b7e880708c04738087de674a8c98092e5bfd39d5193cdb63a2f1e33871e node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js
|
|
54
53
|
27d164987aeae0cffae136eaa84ff39ca6efd9c07018dce4b63f0d352d3d855b adapter/proto/nomos/runtime/v2/maintenance_desk_pb.js
|
|
54
|
+
27d996c3e9e0e5b3c45612da4588dd10cf1c7a0d3285e652c705c07e238a2b48 platform-shells/browser/custody_store.ts
|
|
55
55
|
286c659a8f940c313077afe8a00c0dc128d4a138edf6d9a4519f29538b58c94f node_modules/fast-xml-parser/src/xmlparser/XMLParser.js
|
|
56
56
|
2902315d1ae081647345f4e2aab7c8e60f8f8ae16de1a6c6e642ed6fd14e4959 peer-office/src/runtime/law_package_desk.ts
|
|
57
57
|
29bf27cac2afa56801e728f9aeca4c6b7c281d7e602adb5a4c6d53bf0a79762b peer-office/src/runtime/correspondence_recovery.ts
|
|
@@ -69,10 +69,10 @@
|
|
|
69
69
|
33e7d6bdd22396057d3f8db92384079f7ec2fda4b3582709de2d43fccacc4a9c node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.js
|
|
70
70
|
34f8712de2bd30a2cb8366d8cfdcde466d979f1a28ac0d78f7547341b01f6c57 adapter/proto/nomos/kernel/v1/progress_pb.js
|
|
71
71
|
3a90933569db7e42ec2ed3b77509c29d1ab75f6eb078f53fe5d1ac6d239d231e peer-office/src/runtime/peer_background_scheduler.ts
|
|
72
|
+
3b29007c75a5f51ad2eb490a828c3943ece28a0b3aaecfc7e416b1b35076e236 peer-office/package/package.json
|
|
72
73
|
3c092b8d4185badd23ecf4552434d05aa541b0cd0d534781d687db55260d5da8 adapter/proto/nomos/runtime/v2/sealing_desk_pb.js
|
|
73
74
|
3c98fa838c05abcfd8dfda1128f2d1fca9b196a371fe9751abbd8f4c3b9d04ec node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.js
|
|
74
75
|
3d05089a8c1008f20e06da9907eec7f8824f871edfc95e907c15dc8e2bdf43e7 node_modules/@bufbuild/protobuf/dist/esm/extensions.js
|
|
75
|
-
3e4d4f410f38ade5689895263df29265e13bb49c0760b82c565618082baed0a6 adapter/kernel_machine_desk.ts
|
|
76
76
|
3eef60b7d08402d6a0b9427fde0308878929398918f09747833fd9a06ea3fa7d workspace-discovery/src/http.ts
|
|
77
77
|
3fa38ca64538032d871cd44da41bf6a6ad2eb133b6b8ebc2d8b4d33615b00dcf peer-office/src/reception/application_session_pipe.ts
|
|
78
78
|
3fade4f9262d10e39f346b57a7f08d03641e0ebd75556d087f6319f6c6003a24 peer-office/src/runtime/sha256.ts
|
|
@@ -84,8 +84,6 @@
|
|
|
84
84
|
42242740dd3c09c2530972c6bc477e6aa2be2f91f6cdf112585eb1f1929721a7 peer-office/src/runtime/subscription_manager.ts
|
|
85
85
|
437d1f7906925689d0329ee2f729786117903a5f9191a5a47faec67081ab6f6a peer-office/src/runtime/interaction_desk.ts
|
|
86
86
|
44d54aa1500d8b179b56c47003530ade9220c0daec31caeeeb1a59760eca6d88 node_modules/fast-xml-builder/src/fxb.js
|
|
87
|
-
45f49fcf3773351a4983772c470e14e40baa392d148c991f92674c9fba1246b4 platform-shells/browser/custody_store.ts
|
|
88
|
-
461cf1acdfa937b465e9135bb35d4b80a4ab72c4241493e41b9687966f684b1d peer-office/package/package.json
|
|
89
87
|
463a7041ce45ddd801fc0e0981bb11658b76bb44caad19d2971d73d7700d739b node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js
|
|
90
88
|
46ce19f00a64198852937f4a982c59a5d237aeab590255873e131f2f0468e98e peer-office/src/runtime/workspace_opening.ts
|
|
91
89
|
475e62094c73367833cec6253c5834a887cae9bcfa43a691a9fe3b7495c19106 node_modules/@bufbuild/protobuf/dist/esm/unknown-enum.js
|
|
@@ -129,6 +127,7 @@
|
|
|
129
127
|
71de64c0b205eed7bcbbe11bd937a363c83cb5ab8e9977c4bb4b73b3c5353cf3 peer-office/src/runtime/placement_discovery_desk.ts
|
|
130
128
|
71edee071faa5f0ebbeda63fa23e009983da9e413db2340feb6287d95f497dcd node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js
|
|
131
129
|
720eb959038ea5a41d7ce358d5fb1f575199db3f4f90267bdaf0314440290546 platform-shells/node/sqlite_peer_desk_store.ts
|
|
130
|
+
722cbe0b307c0e525ea25709dd7d6b307ec3413ab6887b2cc3a573995fd003e1 platform-shells/browser/kernel_work.ts
|
|
132
131
|
7287f23bb63a7f10dbacc04c773050dcc279299948a70cec5a9a3a040be2a933 platform-shells/node/kernel_wasi_stdio.ts
|
|
133
132
|
72f4dbde9d104ea96276198f8fab8b32e1a296d7ae57b74f8f175472627c2546 peer-office/src/runtime/custody_return_delta.ts
|
|
134
133
|
73e489001027c703bc0224ae73f78ecefe028e88284bd06952e8603c3d81472c node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.js
|
|
@@ -164,10 +163,10 @@
|
|
|
164
163
|
8ce60aff8226986c6ec652887c97a9515a2f10dd046596d76797cbdd0bb46e1d peer-office/src/runtime/remote_runtime_paper.ts
|
|
165
164
|
8e033b086d23caeba4a8b2e69284b6448787884bb0978eddf67729569d268367 peer-office/src/runtime/credential_recovery_desk.ts
|
|
166
165
|
8e73c652d2c41232e1a3217524dcdbbe7f26834d59cfe80e4432ec59a801dc42 peer-office/src/runtime/authentication_readiness_desk.ts
|
|
166
|
+
8ee050cca65954e7962806818145a4cf0e9a7532362b96da0363c1d918c66e5d platform-shells/browser/kernel_custody.ts
|
|
167
167
|
9109542ce7615df736d0b89b9562a0f8e989099aff65de707217d6a170591812 peer-office/src/runtime/read_maintenance_desk.ts
|
|
168
168
|
92884553e5d2d46ea273441deb32dc07187dc8ded3524356fa68536d1f2fc435 node_modules/@bufbuild/protobuf/dist/esm/descriptors.js
|
|
169
169
|
92aa7e4df3bf7dfc02235174f297dcbff6bd02f7eb6325876cbb24ada6d51414 node_modules/@bufbuild/protobuf/dist/esm/wire/text-format.js
|
|
170
|
-
9330a6cd8db9a2a6aee8d6511ec0f4e1b1dee8a6d2eac3bec39712c27127f8b6 platform-shells/browser/peer.ts
|
|
171
170
|
939bd8b89505a4e9be6b8d60fed0479086c441d7ae50930986cf9657123e0524 peer-office/src/runtime_v2_codec.ts
|
|
172
171
|
9471d4fa81aa8caafdf7fca7cff9563b047a5b1803883f5dd9b7df5241350fff peer-office/src/runtime/replica_follow_desk.ts
|
|
173
172
|
94a3cef0f355a9a177661748d24faae32206a5cc382c8601a34dcf005340107b node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
|
|
@@ -180,13 +179,13 @@
|
|
|
180
179
|
98f70a85fe9d2578c977bbf26927910479cef472100b5ed7bebd4c390e79213c peer-office/src/runtime/workspace_access_desk.ts
|
|
181
180
|
99ce0b71dc7acc73e48634ff609eeb3620cf24b524e89835e804d37fb6b51b2c adapter/offer_transport_contract.ts
|
|
182
181
|
9a3d4c2296b0139778c8f61319349eac6dc0cdb723688f41ebf3c135dca85702 peer-office/src/runtime/history_acquisition_state.ts
|
|
182
|
+
9b07729add8df9f24781f3135c821781e943780ef3374b16a884850949a6890a platform-shells/browser/peer.ts
|
|
183
183
|
9b1e46d587a9ad5d1531a5755ba4feccd2878de77749edce8a0086db3eb2217d peer-office/src/runtime/admission_durability_desk.ts
|
|
184
184
|
9c4c967ea6c149011acb8aabfbadb73651f84d572335c48391d627e5283c0cd0 node_modules/@bufbuild/protobuf/dist/esm/fields.js
|
|
185
185
|
9e1bf39540fd14df32aa2307c44dd4d93a40a6024199f334ccf3db001f44a7f6 peer-office/src/runtime/local_copy_readability.ts
|
|
186
186
|
9e82e1fc1bfd3e3573f64349dc42b4b624ed61d24e5c553f2bb4d041444f166c node_modules/@bjorn3/browser_wasi_shim/dist/fd.js
|
|
187
187
|
9efa0e5824cc0370ea3596b30cd57ea860df0bae95a0caccbbfe97d845a7a09b peer-office/src/runtime/custody_offer.ts
|
|
188
188
|
9f7a3b2bb0e2a2da849fd9101228bd9c9682b39d667e20900dd172d954b1a548 peer-office/src/runtime/observability_desk.ts
|
|
189
|
-
9fa129d6ec52dea4f992be9bc3786fca75fdf733903f489ca8b954eadbd90078 platform-shells/browser/entry.ts
|
|
190
189
|
a0eca2694871be026546039e99a71291822d01ba81943d44e69a14b2d766fd1a peer-office/src/runtime/custody_desk.ts
|
|
191
190
|
a0fcc6110f1154fd197a8ce056e2008dbc7d1750f8dd3ba77c3910af928ed3a1 node_modules/uri-js/dist/es5/uri.all.js
|
|
192
191
|
a33120feed1faf765328722cee117f63e2147cb87052120fdacc9bd1086e67ab peer-office/src/runtime/receiving_group_framework_wire.generated.ts
|
|
@@ -195,6 +194,7 @@ a51ad595569ec83af14644004083aad7f5086703dd46d609e8b006e36bac0f55 peer-office/sr
|
|
|
195
194
|
a5540af900952b2ea7fde1fa967d624d427bcec5f3d1d89f3e78453a8624c650 peer-office/src/runtime/identity_witness_cache.ts
|
|
196
195
|
a56cf2bf8174e0adf94970d70e003afcfc3923a53d0cf973f92d374cfe684544 node_modules/@nodable/entities/src/EntityDecoder.js
|
|
197
196
|
a6250aa83ce7f238614fb7421f31e541c63c415a295e3764687693464918f3c4 node_modules/path-expression-matcher/src/ExpressionSet.js
|
|
197
|
+
a7273df68b1a53d1efbc3919f0224119fcec335774a99f38e952dc8354ec375d platform-shells/browser/entry.ts
|
|
198
198
|
a79a133a4f4ae9559b127aca26b20b0b40af3b6a2cc17d75bedbd413d78276af peer-office/src/runtime/receiving_group_desk.ts
|
|
199
199
|
a91848ee180529e2a60c05dfb9584cad19cd4e1c6f391fdb76a938bcae4c0328 node_modules/@bjorn3/browser_wasi_shim/dist/debug.js
|
|
200
200
|
a98127162afc0a5038171882b19d62f1c035cc8706f2463fda52fdf73c8c21bc peer-office/src/runtime/live_correspondence_desk.ts
|
|
@@ -263,6 +263,7 @@ db05a3f19bc575c1ed771fc6882af337a49cde7bd469181f3acc772d1a76df3e node_modules/@
|
|
|
263
263
|
db61a17ab4dbb3514b676cd93cc702fe62a6582d5ec292725f1ada20dfbc1f72 peer-office/src/runtime/custody_replacement.ts
|
|
264
264
|
dd9f3f24fb154cfbfbde94e8f2647647c80c8ca050b98e981a407e760a4b9c1e node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js
|
|
265
265
|
deaa25227d669aa3fbe99174275588dcc175de648ae6623fddf11d6ae69d7f67 platform-shells/node/local-development/peer_process.ts
|
|
266
|
+
dff6af323ca5f9c73dd06120879fcd5f561d22a8a7fd36d3317e564ae4e10e3b platform-shells/shared/kernel_work_accounting.ts
|
|
266
267
|
e20a132033f105a29db1cfdb3d85bbadbb7206b9a7e3336bcb030a63d66b4ab2 node_modules/is-unsafe/src/contexts/nosql.js
|
|
267
268
|
e2133d7e0f0ce5491a3e9bd560e9e47db2243a6a9f762be89c82e027d99d278e peer-office/src/runtime/credential_sessions.ts
|
|
268
269
|
e34016b82b6f6e4c4a1cc2dd44ccd14a348e8156a1f6c5aeeb2c7fc36a15b8f9 adapter/proto/nomos/kernel/v1/kernel_pb.js
|
|
@@ -277,6 +278,7 @@ ece435d3784d928d02bff4d015b7cb686f8c06de8536ff9f8ebc38a8f403a3be node_modules/@
|
|
|
277
278
|
eda289d9ef0e979fe77a578ffbbf8012cadcfec4629b66cd98c27d6229a9f020 node_modules/@bufbuild/protobuf/dist/esm/is-message.js
|
|
278
279
|
efce20f9f127263ca66d855115e01b37af0afb8b8baafeba7dcc2e0834e99e4f node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.js
|
|
279
280
|
f23513db2fea432df6121956d9bab4761dabf8034b6eba8988452104dba1783e adapter/proto/nomos/runtime/v2/records_desk_pb.js
|
|
281
|
+
f3b65d81bf72f0cf4f8c6c36af75915e9146db35d590f1e51ffcececd4233147 adapter/memory_custody_filesystem.ts
|
|
280
282
|
f3b9324922e08cffcc4c7ae3c6e08454f62e187a37404df31a00160cddf34d77 node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js
|
|
281
283
|
f4eb625c1c0ebee8e5863b6958706af4635ca58d1d2544ae2b465e75060ba12c peer-office/src/runtime/placement_desk.ts
|
|
282
284
|
f50218256bfd061c59b454fbaf8ca304f1799b1d0d09b0f7851ba2420e1129ca adapter/kernel_failure.ts
|
package/dist/nomos-runner.js
CHANGED
|
@@ -7847,10 +7847,10 @@
|
|
|
7847
7847
|
// ../../platform-shells/browser/kernel_custody.ts
|
|
7848
7848
|
init_define_NOMOS_KERNEL_RELEASE();
|
|
7849
7849
|
init_shims();
|
|
7850
|
-
function browserKernelCustody(kernel, checkpoint, isCheckpointCurrent) {
|
|
7850
|
+
function browserKernelCustody(kernel, checkpoint, isCheckpointCurrent, provisionedGenesisWorkspace) {
|
|
7851
7851
|
return {
|
|
7852
7852
|
canRetainChanges: () => true,
|
|
7853
|
-
hasLocalCustody: (workspace) => kernel.branchHead(workspace, "main") !== void 0,
|
|
7853
|
+
hasLocalCustody: (workspace) => kernel.branchHead(workspace, "main") !== void 0 || workspace === provisionedGenesisWorkspace,
|
|
7854
7854
|
openLocalCustody: async () => ({}),
|
|
7855
7855
|
ledgerFor: () => {
|
|
7856
7856
|
throw new Error("Browser Git custody is opened in place; there is no second local ledger");
|
|
@@ -8108,6 +8108,10 @@
|
|
|
8108
8108
|
var ResidencyPressureRelievedSchema = /* @__PURE__ */ messageDesc(file_nomos_runtime_v2_residency_desk, 2);
|
|
8109
8109
|
var ResidentPlacementSchema = /* @__PURE__ */ messageDesc(file_nomos_runtime_v2_residency_desk, 6);
|
|
8110
8110
|
var ResidentOutboxSchema = /* @__PURE__ */ messageDesc(file_nomos_runtime_v2_residency_desk, 7);
|
|
8111
|
+
var KernelWorkCounterSchema = /* @__PURE__ */ messageDesc(file_nomos_runtime_v2_residency_desk, 8);
|
|
8112
|
+
var KernelWorkCpuBucketSchema = /* @__PURE__ */ messageDesc(file_nomos_runtime_v2_residency_desk, 9);
|
|
8113
|
+
var ActiveKernelWorkSchema = /* @__PURE__ */ messageDesc(file_nomos_runtime_v2_residency_desk, 10);
|
|
8114
|
+
var KernelWorkSnapshotSchema = /* @__PURE__ */ messageDesc(file_nomos_runtime_v2_residency_desk, 11);
|
|
8111
8115
|
var CorrespondenceHoldSchema = /* @__PURE__ */ messageDesc(file_nomos_runtime_v2_residency_desk, 18);
|
|
8112
8116
|
var LocalHistoryPostureSchema = /* @__PURE__ */ enumDesc(file_nomos_runtime_v2_residency_desk, 1);
|
|
8113
8117
|
var LocalHistoryPosture = /* @__PURE__ */ tsEnum(LocalHistoryPostureSchema);
|
|
@@ -9722,9 +9726,25 @@
|
|
|
9722
9726
|
};
|
|
9723
9727
|
return {
|
|
9724
9728
|
preopen,
|
|
9725
|
-
|
|
9729
|
+
delta(previous, mutated, includePath = () => true, copyChanged = true) {
|
|
9730
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
9731
|
+
const changed = [];
|
|
9732
|
+
const visit = (path, node) => {
|
|
9733
|
+
if (!includePath(path)) return;
|
|
9734
|
+
if (path !== "/work") {
|
|
9735
|
+
nodes.set(path, node);
|
|
9736
|
+
if (copyChanged && (previous.get(path) !== node || mutated.has(node)))
|
|
9737
|
+
changed.push({ path, ...node.data ? { bytes: node.data.slice() } : {} });
|
|
9738
|
+
}
|
|
9739
|
+
for (const [name, child] of node.contents ?? []) visit(`${path}/${name}`, child);
|
|
9740
|
+
};
|
|
9741
|
+
visit("/work", preopen.dir);
|
|
9742
|
+
return { nodes, changed, removed: [...previous.keys()].filter((path) => !nodes.has(path)) };
|
|
9743
|
+
},
|
|
9744
|
+
snapshot(includePath = () => true) {
|
|
9726
9745
|
const entries = [];
|
|
9727
9746
|
const visit = (path, node) => {
|
|
9747
|
+
if (!includePath(path)) return;
|
|
9728
9748
|
if (path !== "/work") entries.push({ path, ...node.data ? { bytes: node.data.slice() } : {} });
|
|
9729
9749
|
for (const [name, child] of node.contents ?? []) visit(`${path}/${name}`, child);
|
|
9730
9750
|
};
|
|
@@ -9949,7 +9969,11 @@
|
|
|
9949
9969
|
if (!original) continue;
|
|
9950
9970
|
imports[name] = (...args) => {
|
|
9951
9971
|
const result = original(...args);
|
|
9952
|
-
if (result === 0 && !(name === "fd_write" && Number(args[0]) < 3) && !(name === "path_open" && (Number(args[4]) & 9) === 0))
|
|
9972
|
+
if (result === 0 && !(name === "fd_write" && Number(args[0]) < 3) && !(name === "path_open" && (Number(args[4]) & 9) === 0)) {
|
|
9973
|
+
const fd = name === "path_open" ? new DataView(wasi.inst.exports.memory.buffer).getUint32(Number(args[8]) >>> 0, true) : Number(args[0]);
|
|
9974
|
+
const opened = wasi.fds[fd];
|
|
9975
|
+
onFilesystemMutation(opened instanceof OpenFile ? opened.file : void 0);
|
|
9976
|
+
}
|
|
9953
9977
|
return result;
|
|
9954
9978
|
};
|
|
9955
9979
|
}
|
|
@@ -10388,6 +10412,274 @@
|
|
|
10388
10412
|
// ../../adapter/kernel_execution_desk.ts
|
|
10389
10413
|
var kernelExecutionDesk = (machine) => runtimeKernelPort(machine);
|
|
10390
10414
|
|
|
10415
|
+
// ../../platform-shells/shared/kernel_work_accounting.ts
|
|
10416
|
+
init_define_NOMOS_KERNEL_RELEASE();
|
|
10417
|
+
init_shims();
|
|
10418
|
+
var KERNEL_WORK_CPU_BUCKET_MICROS = [
|
|
10419
|
+
100,
|
|
10420
|
+
250,
|
|
10421
|
+
500,
|
|
10422
|
+
1e3,
|
|
10423
|
+
2500,
|
|
10424
|
+
5e3,
|
|
10425
|
+
1e4,
|
|
10426
|
+
25e3,
|
|
10427
|
+
5e4,
|
|
10428
|
+
1e5,
|
|
10429
|
+
25e4,
|
|
10430
|
+
5e5,
|
|
10431
|
+
1e6,
|
|
10432
|
+
25e5,
|
|
10433
|
+
5e6,
|
|
10434
|
+
1e7,
|
|
10435
|
+
3e7,
|
|
10436
|
+
6e7
|
|
10437
|
+
];
|
|
10438
|
+
var custodyValidation = /* @__PURE__ */ new Set([
|
|
10439
|
+
"inspectChange",
|
|
10440
|
+
"inspectRefusalVerdict",
|
|
10441
|
+
"lawClosureInfo",
|
|
10442
|
+
"resolveStatePosition",
|
|
10443
|
+
"proveCompactionEquivalence"
|
|
10444
|
+
]);
|
|
10445
|
+
var custodyOpenRestore = /* @__PURE__ */ new Set([
|
|
10446
|
+
"checkpointExport",
|
|
10447
|
+
"checkpointImport",
|
|
10448
|
+
"restoreMain",
|
|
10449
|
+
"openGitState",
|
|
10450
|
+
"attachLocalFrontier",
|
|
10451
|
+
"releaseWorkspaceState"
|
|
10452
|
+
]);
|
|
10453
|
+
var custodyWrites = /* @__PURE__ */ new Set([
|
|
10454
|
+
"writeRef",
|
|
10455
|
+
"deleteRef",
|
|
10456
|
+
"writeMetaCommit",
|
|
10457
|
+
"recordWorkspaceEffectOutcome"
|
|
10458
|
+
]);
|
|
10459
|
+
var custodyTransfers = /* @__PURE__ */ new Set([
|
|
10460
|
+
"packDelta",
|
|
10461
|
+
"applyPack",
|
|
10462
|
+
"intentsAbove",
|
|
10463
|
+
"historySummary",
|
|
10464
|
+
"readBlob",
|
|
10465
|
+
"resolveRef",
|
|
10466
|
+
"listRefs"
|
|
10467
|
+
]);
|
|
10468
|
+
var telemetryMeasurements = /* @__PURE__ */ new Set(["residentFootprint", "aggregateCensus"]);
|
|
10469
|
+
var lawQueries = /* @__PURE__ */ new Set([
|
|
10470
|
+
"authorizationCheck",
|
|
10471
|
+
"authorizationExpand",
|
|
10472
|
+
"frontierTransition",
|
|
10473
|
+
"ownedDeviceRequest",
|
|
10474
|
+
"ownedPrepareApproval",
|
|
10475
|
+
"authenticationPosture",
|
|
10476
|
+
"authoringRequirements",
|
|
10477
|
+
"identityProviderWitness",
|
|
10478
|
+
"interfaceCompatibility"
|
|
10479
|
+
]);
|
|
10480
|
+
var authoringOperations = /* @__PURE__ */ new Set([
|
|
10481
|
+
"signPreparedOffer",
|
|
10482
|
+
"prepareRemoteOffer",
|
|
10483
|
+
"signOfferPreparation"
|
|
10484
|
+
]);
|
|
10485
|
+
var cryptographicOperations = /* @__PURE__ */ new Set([
|
|
10486
|
+
"signBirthCertificate",
|
|
10487
|
+
"signingIdentity",
|
|
10488
|
+
"signAuthorityAttestation",
|
|
10489
|
+
"mintTypedId",
|
|
10490
|
+
"encryptionIdentity",
|
|
10491
|
+
"wrapScopeKey",
|
|
10492
|
+
"unwrapScopeKey"
|
|
10493
|
+
]);
|
|
10494
|
+
function classifyKernelWork(frame) {
|
|
10495
|
+
try {
|
|
10496
|
+
const decoded = fromBinary(CallRequestSchema, frame);
|
|
10497
|
+
const operation = decoded.operation;
|
|
10498
|
+
if (!operation.case) return { family: "other", operation: "unspecified" };
|
|
10499
|
+
if (operation.case === "query") {
|
|
10500
|
+
const detail = operation.value.query.case || "unspecified";
|
|
10501
|
+
const family = detail === "maintenanceQuantum" ? "read_index_maintenance" : detail === "fullHistoryAudit" ? "custody_validation" : lawQueries.has(detail) ? "law_evaluation" : "read_query";
|
|
10502
|
+
return { family, operation: `query.${detail}`, workspace: operation.value.target?.workspace };
|
|
10503
|
+
}
|
|
10504
|
+
if (operation.case === "custody") {
|
|
10505
|
+
const detail = operation.value.operation.case || "unspecified";
|
|
10506
|
+
const value = operation.value.operation.value;
|
|
10507
|
+
const target3 = value && "target" in value ? value.target : void 0;
|
|
10508
|
+
const workspace = typeof target3 === "string" ? target3 : target3?.workspace;
|
|
10509
|
+
const family = telemetryMeasurements.has(detail) ? "telemetry_measurement" : custodyValidation.has(detail) ? "custody_validation" : custodyOpenRestore.has(detail) ? "custody_open_restore" : custodyWrites.has(detail) ? "git_state_write" : custodyTransfers.has(detail) ? "sync_transfer" : "custody_inspection";
|
|
10510
|
+
return { family, operation: `custody.${detail}`, workspace };
|
|
10511
|
+
}
|
|
10512
|
+
if (operation.case === "offer") {
|
|
10513
|
+
const detail = operation.value.intent.case || "unspecified";
|
|
10514
|
+
return {
|
|
10515
|
+
family: "offer_adjudication",
|
|
10516
|
+
operation: `offer.${detail}`,
|
|
10517
|
+
workspace: operation.value.target?.workspace
|
|
10518
|
+
};
|
|
10519
|
+
}
|
|
10520
|
+
if (operation.case === "open") {
|
|
10521
|
+
return {
|
|
10522
|
+
family: "custody_open_restore",
|
|
10523
|
+
operation: "open",
|
|
10524
|
+
workspace: operation.value.target?.workspace
|
|
10525
|
+
};
|
|
10526
|
+
}
|
|
10527
|
+
if (operation.case === "outbox") {
|
|
10528
|
+
return {
|
|
10529
|
+
family: "correspondence_outbox",
|
|
10530
|
+
operation: operation.value.prepare ? "outbox.prepare" : "outbox.inventory",
|
|
10531
|
+
workspace: operation.value.target?.workspace
|
|
10532
|
+
};
|
|
10533
|
+
}
|
|
10534
|
+
if (operation.case === "sync") {
|
|
10535
|
+
return { family: "sync_transfer", operation: "sync", workspace: operation.value.target?.workspace };
|
|
10536
|
+
}
|
|
10537
|
+
if (operation.case === "configure") return { family: "configuration", operation: "configure" };
|
|
10538
|
+
if (authoringOperations.has(operation.case)) {
|
|
10539
|
+
return { family: "offer_authoring", operation: operation.case };
|
|
10540
|
+
}
|
|
10541
|
+
if (cryptographicOperations.has(operation.case)) {
|
|
10542
|
+
return { family: "cryptography", operation: operation.case };
|
|
10543
|
+
}
|
|
10544
|
+
return { family: "other", operation: operation.case };
|
|
10545
|
+
} catch {
|
|
10546
|
+
return { family: "other", operation: "undecodable" };
|
|
10547
|
+
}
|
|
10548
|
+
}
|
|
10549
|
+
function classifyCompletedKernelWork(work, result) {
|
|
10550
|
+
if (work.family !== "offer_adjudication") return work;
|
|
10551
|
+
try {
|
|
10552
|
+
if (result) {
|
|
10553
|
+
const response = fromBinary(CallResponseSchema, result);
|
|
10554
|
+
if (response.outcome.case === "offer" && response.outcome.value.outcome.case === "admitted") {
|
|
10555
|
+
const admitted = response.outcome.value.outcome.value;
|
|
10556
|
+
if (!admitted.dryRun && !admitted.placement && !admitted.alreadyApplied) {
|
|
10557
|
+
return { ...work, family: "offer_admitted" };
|
|
10558
|
+
}
|
|
10559
|
+
}
|
|
10560
|
+
}
|
|
10561
|
+
} catch {
|
|
10562
|
+
}
|
|
10563
|
+
return { ...work, family: "offer_not_admitted" };
|
|
10564
|
+
}
|
|
10565
|
+
var _counters, _activeChanged, _cpuAvailable, _startedUnixMillis, _active;
|
|
10566
|
+
var KernelWorkAccounting = class {
|
|
10567
|
+
constructor(activeChanged, cpuAvailable = true) {
|
|
10568
|
+
__privateAdd(this, _counters, /* @__PURE__ */ new Map());
|
|
10569
|
+
__privateAdd(this, _activeChanged);
|
|
10570
|
+
__privateAdd(this, _cpuAvailable);
|
|
10571
|
+
__privateAdd(this, _startedUnixMillis, Date.now());
|
|
10572
|
+
__privateAdd(this, _active);
|
|
10573
|
+
__privateSet(this, _activeChanged, activeChanged);
|
|
10574
|
+
__privateSet(this, _cpuAvailable, cpuAvailable);
|
|
10575
|
+
}
|
|
10576
|
+
begin(work, startedUnixMillis) {
|
|
10577
|
+
var _a;
|
|
10578
|
+
__privateSet(this, _active, create(ActiveKernelWorkSchema, {
|
|
10579
|
+
family: work.family,
|
|
10580
|
+
operation: work.operation,
|
|
10581
|
+
startedUnixMillis: BigInt(startedUnixMillis)
|
|
10582
|
+
}));
|
|
10583
|
+
try {
|
|
10584
|
+
(_a = __privateGet(this, _activeChanged)) == null ? void 0 : _a.call(this, __privateGet(this, _active));
|
|
10585
|
+
} catch {
|
|
10586
|
+
}
|
|
10587
|
+
}
|
|
10588
|
+
complete(work, elapsedMillis2, cpuMicros, completed) {
|
|
10589
|
+
var _a;
|
|
10590
|
+
const key = `${work.family}\0${work.operation}`;
|
|
10591
|
+
let counter = __privateGet(this, _counters).get(key);
|
|
10592
|
+
if (!counter) {
|
|
10593
|
+
counter = {
|
|
10594
|
+
calls: 0n,
|
|
10595
|
+
failures: 0n,
|
|
10596
|
+
cpuMicros: __privateGet(this, _cpuAvailable) ? 0n : void 0,
|
|
10597
|
+
wallMicros: 0n,
|
|
10598
|
+
bucketCalls: __privateGet(this, _cpuAvailable) ? KERNEL_WORK_CPU_BUCKET_MICROS.map(() => 0n) : [],
|
|
10599
|
+
lastCompletedUnixMillis: 0n
|
|
10600
|
+
};
|
|
10601
|
+
__privateGet(this, _counters).set(key, counter);
|
|
10602
|
+
}
|
|
10603
|
+
const boundedCpuMicros = cpuMicros === void 0 ? void 0 : Math.max(0, Math.round(cpuMicros));
|
|
10604
|
+
counter.calls += 1n;
|
|
10605
|
+
if (!completed) counter.failures += 1n;
|
|
10606
|
+
if (boundedCpuMicros !== void 0 && counter.cpuMicros !== void 0) {
|
|
10607
|
+
counter.cpuMicros += BigInt(boundedCpuMicros);
|
|
10608
|
+
}
|
|
10609
|
+
counter.wallMicros += BigInt(Math.max(0, Math.round(elapsedMillis2 * 1e3)));
|
|
10610
|
+
counter.lastCompletedUnixMillis = BigInt(Date.now());
|
|
10611
|
+
for (let index = 0; boundedCpuMicros !== void 0 && index < counter.bucketCalls.length; index += 1) {
|
|
10612
|
+
if (boundedCpuMicros <= KERNEL_WORK_CPU_BUCKET_MICROS[index]) counter.bucketCalls[index] += 1n;
|
|
10613
|
+
}
|
|
10614
|
+
__privateSet(this, _active, void 0);
|
|
10615
|
+
try {
|
|
10616
|
+
(_a = __privateGet(this, _activeChanged)) == null ? void 0 : _a.call(this, void 0);
|
|
10617
|
+
} catch {
|
|
10618
|
+
}
|
|
10619
|
+
}
|
|
10620
|
+
snapshot(observedUnixMillis = Date.now()) {
|
|
10621
|
+
const counters = [...__privateGet(this, _counters).entries()].sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => {
|
|
10622
|
+
const [family, operation] = key.split("\0");
|
|
10623
|
+
return create(KernelWorkCounterSchema, {
|
|
10624
|
+
family,
|
|
10625
|
+
operation,
|
|
10626
|
+
calls: value.calls,
|
|
10627
|
+
failures: value.failures,
|
|
10628
|
+
cpuMicros: value.cpuMicros,
|
|
10629
|
+
wallMicros: value.wallMicros,
|
|
10630
|
+
cpuBuckets: value.bucketCalls.map((calls, index) => create(KernelWorkCpuBucketSchema, { leMicros: BigInt(KERNEL_WORK_CPU_BUCKET_MICROS[index]), calls })),
|
|
10631
|
+
lastCompletedUnixMillis: value.lastCompletedUnixMillis
|
|
10632
|
+
});
|
|
10633
|
+
});
|
|
10634
|
+
return create(KernelWorkSnapshotSchema, {
|
|
10635
|
+
startedUnixMillis: BigInt(__privateGet(this, _startedUnixMillis)),
|
|
10636
|
+
observedUnixMillis: BigInt(observedUnixMillis),
|
|
10637
|
+
counters,
|
|
10638
|
+
active: __privateGet(this, _active)
|
|
10639
|
+
});
|
|
10640
|
+
}
|
|
10641
|
+
reset() {
|
|
10642
|
+
var _a;
|
|
10643
|
+
__privateGet(this, _counters).clear();
|
|
10644
|
+
__privateSet(this, _startedUnixMillis, Date.now());
|
|
10645
|
+
__privateSet(this, _active, void 0);
|
|
10646
|
+
try {
|
|
10647
|
+
(_a = __privateGet(this, _activeChanged)) == null ? void 0 : _a.call(this, void 0);
|
|
10648
|
+
} catch {
|
|
10649
|
+
}
|
|
10650
|
+
}
|
|
10651
|
+
};
|
|
10652
|
+
_counters = new WeakMap();
|
|
10653
|
+
_activeChanged = new WeakMap();
|
|
10654
|
+
_cpuAvailable = new WeakMap();
|
|
10655
|
+
_startedUnixMillis = new WeakMap();
|
|
10656
|
+
_active = new WeakMap();
|
|
10657
|
+
|
|
10658
|
+
// ../../platform-shells/browser/kernel_work.ts
|
|
10659
|
+
init_define_NOMOS_KERNEL_RELEASE();
|
|
10660
|
+
init_shims();
|
|
10661
|
+
function observeBrowserKernelCalls(kernel, accounting, now = () => performance.now()) {
|
|
10662
|
+
return {
|
|
10663
|
+
...kernel,
|
|
10664
|
+
call(frame) {
|
|
10665
|
+
const work = classifyKernelWork(frame);
|
|
10666
|
+
accounting.begin(work, Date.now());
|
|
10667
|
+
const started = now();
|
|
10668
|
+
let completed = false;
|
|
10669
|
+
let completedWork = work;
|
|
10670
|
+
try {
|
|
10671
|
+
const result = kernel.call(frame);
|
|
10672
|
+
completedWork = classifyCompletedKernelWork(work, result);
|
|
10673
|
+
completed = true;
|
|
10674
|
+
return result;
|
|
10675
|
+
} finally {
|
|
10676
|
+
if (!completed) completedWork = classifyCompletedKernelWork(work);
|
|
10677
|
+
accounting.complete(completedWork, now() - started, void 0, completed);
|
|
10678
|
+
}
|
|
10679
|
+
}
|
|
10680
|
+
};
|
|
10681
|
+
}
|
|
10682
|
+
|
|
10391
10683
|
// ../../adapter/git_custody_desk.ts
|
|
10392
10684
|
init_define_NOMOS_KERNEL_RELEASE();
|
|
10393
10685
|
init_shims();
|
|
@@ -11377,8 +11669,10 @@
|
|
|
11377
11669
|
init_define_NOMOS_KERNEL_RELEASE();
|
|
11378
11670
|
init_shims();
|
|
11379
11671
|
var copyRecord = (record) => ({ ...record, value: record.value.slice() });
|
|
11672
|
+
var currentCacheFile = (path) => path.endsWith("/nomos.git/nomos-cache/raw-frontier-v2/current.sqlite");
|
|
11673
|
+
var durableFile = (path) => !path.includes("/nomos.git/nomos-cache/raw-frontier-v2/addressed/") && !path.endsWith("/nomos.git/nomos-cache/raw-frontier-v2/addressed") && !currentCacheFile(path);
|
|
11380
11674
|
var keyOf = (namespace, key) => JSON.stringify([namespace, key]);
|
|
11381
|
-
var _backend, _records, _revision, _committed, _queued, _failure, _closed;
|
|
11675
|
+
var _backend, _records, _knownNodes, _mutatedNodes, _changedRecords, _cachePaths, _cacheDirty, _cacheDisabled, _cacheTimer, _cachePending, _revision, _committed, _queued, _failure, _closed;
|
|
11382
11676
|
var _BrowserCustodyStore = class _BrowserCustodyStore {
|
|
11383
11677
|
constructor(backend, snapshot) {
|
|
11384
11678
|
__publicField(this, "filesystem", memoryCustodyFilesystem());
|
|
@@ -11386,26 +11680,46 @@
|
|
|
11386
11680
|
__publicField(this, "identity");
|
|
11387
11681
|
__privateAdd(this, _backend);
|
|
11388
11682
|
__privateAdd(this, _records, /* @__PURE__ */ new Map());
|
|
11683
|
+
__privateAdd(this, _knownNodes, /* @__PURE__ */ new Map());
|
|
11684
|
+
__privateAdd(this, _mutatedNodes, /* @__PURE__ */ new Set());
|
|
11685
|
+
__privateAdd(this, _changedRecords, /* @__PURE__ */ new Map());
|
|
11686
|
+
__privateAdd(this, _cachePaths, /* @__PURE__ */ new Set());
|
|
11687
|
+
__privateAdd(this, _cacheDirty, false);
|
|
11688
|
+
__privateAdd(this, _cacheDisabled, false);
|
|
11689
|
+
__privateAdd(this, _cacheTimer);
|
|
11690
|
+
__privateAdd(this, _cachePending);
|
|
11389
11691
|
__privateAdd(this, _revision, 0);
|
|
11390
11692
|
__privateAdd(this, _committed, -1);
|
|
11391
11693
|
__privateAdd(this, _queued);
|
|
11392
11694
|
__privateAdd(this, _failure);
|
|
11393
11695
|
__privateAdd(this, _closed, false);
|
|
11394
|
-
__publicField(this, "changed", () => {
|
|
11696
|
+
__publicField(this, "changed", (inode) => {
|
|
11395
11697
|
this.assertUsable();
|
|
11698
|
+
if (inode) __privateGet(this, _mutatedNodes).add(inode);
|
|
11396
11699
|
__privateWrapper(this, _revision)._++;
|
|
11700
|
+
if (__privateGet(this, _backend).commitCache && !__privateGet(this, _cacheDisabled)) {
|
|
11701
|
+
__privateSet(this, _cacheDirty, true);
|
|
11702
|
+
if (!__privateGet(this, _cacheTimer)) __privateSet(this, _cacheTimer, setTimeout(() => {
|
|
11703
|
+
__privateSet(this, _cacheTimer, void 0);
|
|
11704
|
+
void this.flushCache().catch(() => {
|
|
11705
|
+
});
|
|
11706
|
+
}, 3e4));
|
|
11707
|
+
__privateGet(this, _cacheTimer).unref?.();
|
|
11708
|
+
}
|
|
11397
11709
|
void this.checkpoint().catch(() => {
|
|
11398
11710
|
});
|
|
11399
11711
|
});
|
|
11400
11712
|
__privateSet(this, _backend, backend);
|
|
11401
|
-
if (snapshot && snapshot.format !==
|
|
11713
|
+
if (snapshot && snapshot.format !== 2) throw new Error("Unsupported browser custody format; keep this site's data and update the application.");
|
|
11402
11714
|
this.replica = snapshot?.replica ?? globalThis.crypto.getRandomValues(new BigUint64Array(1))[0] & (1n << 63n) - 1n;
|
|
11403
11715
|
this.identity = snapshot?.identity ?? `browser-${globalThis.crypto.randomUUID()}`;
|
|
11404
11716
|
for (const entry of snapshot?.files ?? []) {
|
|
11405
11717
|
if (entry.bytes === void 0) this.filesystem.files.mkdir(entry.path);
|
|
11406
11718
|
else this.filesystem.files.writeFile(entry.path, entry.bytes);
|
|
11719
|
+
if (currentCacheFile(entry.path)) __privateGet(this, _cachePaths).add(entry.path);
|
|
11407
11720
|
}
|
|
11408
11721
|
for (const record of snapshot?.records ?? []) __privateGet(this, _records).set(keyOf(record.namespace, record.key), copyRecord(record));
|
|
11722
|
+
__privateSet(this, _knownNodes, new Map(this.filesystem.delta(/* @__PURE__ */ new Map(), /* @__PURE__ */ new Set(), durableFile, false).nodes));
|
|
11409
11723
|
for (const name of ["mkdir", "writeFile", "unlink"]) {
|
|
11410
11724
|
const original = this.filesystem.files[name].bind(this.filesystem.files);
|
|
11411
11725
|
this.filesystem.files[name] = (...args) => {
|
|
@@ -11416,20 +11730,15 @@
|
|
|
11416
11730
|
};
|
|
11417
11731
|
}
|
|
11418
11732
|
const promises = this.filesystem.fs.promises;
|
|
11419
|
-
const mkdir
|
|
11420
|
-
|
|
11421
|
-
|
|
11422
|
-
|
|
11423
|
-
|
|
11424
|
-
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
|
|
11428
|
-
this.assertUsable();
|
|
11429
|
-
const result = await writeFile(path, bytes);
|
|
11430
|
-
this.changed();
|
|
11431
|
-
return result;
|
|
11432
|
-
};
|
|
11733
|
+
for (const name of ["mkdir", "writeFile", "unlink", "rmdir"]) {
|
|
11734
|
+
const original = promises[name].bind(promises);
|
|
11735
|
+
promises[name] = async (...args) => {
|
|
11736
|
+
this.assertUsable();
|
|
11737
|
+
const result = await original(...args);
|
|
11738
|
+
this.changed();
|
|
11739
|
+
return result;
|
|
11740
|
+
};
|
|
11741
|
+
}
|
|
11433
11742
|
}
|
|
11434
11743
|
static async open(backend) {
|
|
11435
11744
|
try {
|
|
@@ -11455,6 +11764,7 @@
|
|
|
11455
11764
|
const next = value === void 0 ? void 0 : { namespace, key, revision: (current?.revision ?? 0n) + 1n, value: value.slice() };
|
|
11456
11765
|
if (next) __privateGet(this, _records).set(id, next);
|
|
11457
11766
|
else __privateGet(this, _records).delete(id);
|
|
11767
|
+
__privateGet(this, _changedRecords).set(id, next && copyRecord(next));
|
|
11458
11768
|
this.changed();
|
|
11459
11769
|
return next && copyRecord(next);
|
|
11460
11770
|
}
|
|
@@ -11464,14 +11774,19 @@
|
|
|
11464
11774
|
__privateSet(this, _queued, Promise.resolve().then(async () => {
|
|
11465
11775
|
while (__privateGet(this, _committed) !== __privateGet(this, _revision)) {
|
|
11466
11776
|
const revision = __privateGet(this, _revision);
|
|
11467
|
-
const
|
|
11468
|
-
|
|
11469
|
-
|
|
11470
|
-
|
|
11471
|
-
|
|
11472
|
-
|
|
11473
|
-
|
|
11474
|
-
|
|
11777
|
+
const delta = this.filesystem.delta(__privateGet(this, _knownNodes), __privateGet(this, _mutatedNodes), durableFile);
|
|
11778
|
+
__privateGet(this, _mutatedNodes).clear();
|
|
11779
|
+
const records = [...__privateGet(this, _changedRecords).values()].filter((record) => record !== void 0).map(copyRecord);
|
|
11780
|
+
const removedRecords = [...__privateGet(this, _changedRecords).entries()].filter(([, record]) => record === void 0).map(([id]) => id);
|
|
11781
|
+
__privateGet(this, _changedRecords).clear();
|
|
11782
|
+
await __privateGet(this, _backend).commit({
|
|
11783
|
+
control: { format: 2, replica: this.replica, identity: this.identity },
|
|
11784
|
+
files: delta.changed,
|
|
11785
|
+
removedFiles: delta.removed,
|
|
11786
|
+
records,
|
|
11787
|
+
removedRecords
|
|
11788
|
+
});
|
|
11789
|
+
__privateSet(this, _knownNodes, new Map(delta.nodes));
|
|
11475
11790
|
__privateSet(this, _committed, revision);
|
|
11476
11791
|
}
|
|
11477
11792
|
}).catch((error) => {
|
|
@@ -11488,14 +11803,41 @@
|
|
|
11488
11803
|
isCheckpointCurrent() {
|
|
11489
11804
|
return !__privateGet(this, _failure) && !__privateGet(this, _closed) && __privateGet(this, _committed) === __privateGet(this, _revision);
|
|
11490
11805
|
}
|
|
11806
|
+
async flushCache() {
|
|
11807
|
+
if (__privateGet(this, _cachePending)) await __privateGet(this, _cachePending);
|
|
11808
|
+
if (!__privateGet(this, _backend).commitCache || !__privateGet(this, _cacheDirty) || __privateGet(this, _cacheDisabled)) return;
|
|
11809
|
+
__privateSet(this, _cacheDirty, false);
|
|
11810
|
+
const paths = new Set(this.filesystem.files.listFiles("/work").filter(currentCacheFile));
|
|
11811
|
+
const files = [...paths].map((path) => ({ path, bytes: this.filesystem.files.readFile(path) }));
|
|
11812
|
+
const removed = [...__privateGet(this, _cachePaths)].filter((path) => !paths.has(path));
|
|
11813
|
+
__privateSet(this, _cachePending, __privateGet(this, _backend).commitCache(files, removed).then(() => {
|
|
11814
|
+
__privateSet(this, _cachePaths, paths);
|
|
11815
|
+
}).catch(() => {
|
|
11816
|
+
__privateSet(this, _cacheDisabled, true);
|
|
11817
|
+
}).finally(() => {
|
|
11818
|
+
__privateSet(this, _cachePending, void 0);
|
|
11819
|
+
}));
|
|
11820
|
+
await __privateGet(this, _cachePending);
|
|
11821
|
+
}
|
|
11491
11822
|
async close() {
|
|
11492
11823
|
await this.checkpoint();
|
|
11824
|
+
if (__privateGet(this, _cacheTimer)) clearTimeout(__privateGet(this, _cacheTimer));
|
|
11825
|
+
__privateSet(this, _cacheTimer, void 0);
|
|
11826
|
+
await this.flushCache();
|
|
11493
11827
|
__privateSet(this, _closed, true);
|
|
11494
11828
|
__privateGet(this, _backend).close();
|
|
11495
11829
|
}
|
|
11496
11830
|
};
|
|
11497
11831
|
_backend = new WeakMap();
|
|
11498
11832
|
_records = new WeakMap();
|
|
11833
|
+
_knownNodes = new WeakMap();
|
|
11834
|
+
_mutatedNodes = new WeakMap();
|
|
11835
|
+
_changedRecords = new WeakMap();
|
|
11836
|
+
_cachePaths = new WeakMap();
|
|
11837
|
+
_cacheDirty = new WeakMap();
|
|
11838
|
+
_cacheDisabled = new WeakMap();
|
|
11839
|
+
_cacheTimer = new WeakMap();
|
|
11840
|
+
_cachePending = new WeakMap();
|
|
11499
11841
|
_revision = new WeakMap();
|
|
11500
11842
|
_committed = new WeakMap();
|
|
11501
11843
|
_queued = new WeakMap();
|
|
@@ -11527,8 +11869,28 @@
|
|
|
11527
11869
|
let db;
|
|
11528
11870
|
try {
|
|
11529
11871
|
db = await new Promise((resolve, reject) => {
|
|
11530
|
-
const request = indexedDB.open(name,
|
|
11531
|
-
request.onupgradeneeded = () =>
|
|
11872
|
+
const request = indexedDB.open(name, 3);
|
|
11873
|
+
request.onupgradeneeded = (event) => {
|
|
11874
|
+
const database = request.result;
|
|
11875
|
+
if (!database.objectStoreNames.contains("custody")) database.createObjectStore("custody");
|
|
11876
|
+
if (!database.objectStoreNames.contains("files")) database.createObjectStore("files");
|
|
11877
|
+
if (!database.objectStoreNames.contains("records")) database.createObjectStore("records");
|
|
11878
|
+
if (!database.objectStoreNames.contains("cache")) database.createObjectStore("cache");
|
|
11879
|
+
if (event.oldVersion === 2) {
|
|
11880
|
+
const files = request.transaction.objectStore("files");
|
|
11881
|
+
const cache = request.transaction.objectStore("cache");
|
|
11882
|
+
const cursor = files.openCursor();
|
|
11883
|
+
cursor.onsuccess = () => {
|
|
11884
|
+
const entry = cursor.result;
|
|
11885
|
+
if (!entry) return;
|
|
11886
|
+
if (Array.isArray(entry.key) && currentCacheFile(String(entry.key[0]))) {
|
|
11887
|
+
cache.put(entry.value, entry.key);
|
|
11888
|
+
entry.delete();
|
|
11889
|
+
}
|
|
11890
|
+
entry.continue();
|
|
11891
|
+
};
|
|
11892
|
+
}
|
|
11893
|
+
};
|
|
11532
11894
|
request.onsuccess = () => resolve(request.result);
|
|
11533
11895
|
request.onerror = () => reject(request.error);
|
|
11534
11896
|
request.onblocked = () => reject(new Error("Browser custody upgrade is blocked by another tab. Close it and retry."));
|
|
@@ -11537,19 +11899,148 @@
|
|
|
11537
11899
|
release();
|
|
11538
11900
|
throw error;
|
|
11539
11901
|
}
|
|
11902
|
+
const chunkBytes = 4 * 1024 * 1024;
|
|
11903
|
+
const replace = (store, id, entry) => {
|
|
11904
|
+
const old = store.get([id, -1]);
|
|
11905
|
+
old.onsuccess = () => {
|
|
11906
|
+
const count = Number(old.result?.chunks ?? 0);
|
|
11907
|
+
for (let index = 0; index < count; index++) store.delete([id, index]);
|
|
11908
|
+
store.delete([id, -1]);
|
|
11909
|
+
if (!entry) return;
|
|
11910
|
+
const bytes = "path" in entry ? entry.bytes : entry.value;
|
|
11911
|
+
const chunks = bytes === void 0 ? 0 : Math.max(1, Math.ceil(bytes.byteLength / chunkBytes));
|
|
11912
|
+
const meta = "path" in entry ? { path: entry.path, directory: bytes === void 0, chunks } : { namespace: entry.namespace, key: entry.key, revision: entry.revision, chunks };
|
|
11913
|
+
store.put(meta, [id, -1]);
|
|
11914
|
+
for (let index = 0; index < chunks; index++)
|
|
11915
|
+
store.put(bytes.slice(index * chunkBytes, (index + 1) * chunkBytes), [id, index]);
|
|
11916
|
+
};
|
|
11917
|
+
};
|
|
11918
|
+
const completeChunks = (chunks, count) => Number.isSafeInteger(count) && count >= 0 && chunks.length === count && Array.from({ length: count }, (_, index) => chunks[index]).every((chunk) => chunk instanceof Uint8Array);
|
|
11919
|
+
const readState = () => new Promise((resolve, reject) => {
|
|
11920
|
+
const tx = db.transaction(["custody", "files", "records", "cache"], "readonly");
|
|
11921
|
+
const control = tx.objectStore("custody").get("current");
|
|
11922
|
+
const files = tx.objectStore("files").getAll();
|
|
11923
|
+
const fileKeys = tx.objectStore("files").getAllKeys();
|
|
11924
|
+
const records = tx.objectStore("records").getAll();
|
|
11925
|
+
const recordKeys = tx.objectStore("records").getAllKeys();
|
|
11926
|
+
const caches = tx.objectStore("cache").getAll();
|
|
11927
|
+
const cacheKeys = tx.objectStore("cache").getAllKeys();
|
|
11928
|
+
tx.oncomplete = () => {
|
|
11929
|
+
try {
|
|
11930
|
+
if (!control.result) {
|
|
11931
|
+
resolve(void 0);
|
|
11932
|
+
return;
|
|
11933
|
+
}
|
|
11934
|
+
if (control.result.format !== 2) {
|
|
11935
|
+
reject(new Error("Unsupported browser custody format"));
|
|
11936
|
+
return;
|
|
11937
|
+
}
|
|
11938
|
+
const fileValues = /* @__PURE__ */ new Map();
|
|
11939
|
+
for (let index = 0; index < fileKeys.result.length; index++) {
|
|
11940
|
+
const [path, chunk] = fileKeys.result[index];
|
|
11941
|
+
const value = fileValues.get(path) ?? { chunks: [] };
|
|
11942
|
+
if (chunk === -1) value.meta = files.result[index];
|
|
11943
|
+
else value.chunks[chunk] = files.result[index];
|
|
11944
|
+
fileValues.set(path, value);
|
|
11945
|
+
}
|
|
11946
|
+
for (let index = 0; index < cacheKeys.result.length; index++) {
|
|
11947
|
+
const [path, chunk] = cacheKeys.result[index];
|
|
11948
|
+
const value = fileValues.get(path) ?? { chunks: [] };
|
|
11949
|
+
if (chunk === -1) value.meta = caches.result[index];
|
|
11950
|
+
else value.chunks[chunk] = caches.result[index];
|
|
11951
|
+
fileValues.set(path, value);
|
|
11952
|
+
}
|
|
11953
|
+
const image = [...fileValues].map(([path, value]) => {
|
|
11954
|
+
if (!value.meta) throw new Error(`Missing browser custody file metadata: ${path}`);
|
|
11955
|
+
if (value.meta.directory) return { path };
|
|
11956
|
+
if (!completeChunks(value.chunks, value.meta.chunks))
|
|
11957
|
+
throw new Error(`Incomplete browser custody file: ${path}`);
|
|
11958
|
+
const length = value.chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
|
|
11959
|
+
const bytes = new Uint8Array(length);
|
|
11960
|
+
let offset = 0;
|
|
11961
|
+
for (const chunk of value.chunks) {
|
|
11962
|
+
bytes.set(chunk, offset);
|
|
11963
|
+
offset += chunk.byteLength;
|
|
11964
|
+
}
|
|
11965
|
+
return { path, bytes };
|
|
11966
|
+
}).sort((a, b) => a.path.split("/").length - b.path.split("/").length || a.path.localeCompare(b.path));
|
|
11967
|
+
const recordValues = /* @__PURE__ */ new Map();
|
|
11968
|
+
for (let index = 0; index < recordKeys.result.length; index++) {
|
|
11969
|
+
const [id, chunk] = recordKeys.result[index];
|
|
11970
|
+
const value = recordValues.get(id) ?? { chunks: [] };
|
|
11971
|
+
if (chunk === -1) value.meta = records.result[index];
|
|
11972
|
+
else value.chunks[chunk] = records.result[index];
|
|
11973
|
+
recordValues.set(id, value);
|
|
11974
|
+
}
|
|
11975
|
+
const restoredRecords = [...recordValues].map(([id, value]) => {
|
|
11976
|
+
if (!value.meta || !completeChunks(value.chunks, value.meta.chunks))
|
|
11977
|
+
throw new Error(`Incomplete browser custody record: ${id}`);
|
|
11978
|
+
const length = value.chunks.reduce((sum, chunk) => sum + chunk.byteLength, 0);
|
|
11979
|
+
const bytes = new Uint8Array(length);
|
|
11980
|
+
let offset = 0;
|
|
11981
|
+
for (const chunk of value.chunks) {
|
|
11982
|
+
bytes.set(chunk, offset);
|
|
11983
|
+
offset += chunk.byteLength;
|
|
11984
|
+
}
|
|
11985
|
+
return { namespace: value.meta.namespace, key: value.meta.key, revision: value.meta.revision, value: bytes };
|
|
11986
|
+
});
|
|
11987
|
+
resolve({ ...control.result, files: image, records: restoredRecords });
|
|
11988
|
+
} catch (error) {
|
|
11989
|
+
reject(error);
|
|
11990
|
+
}
|
|
11991
|
+
};
|
|
11992
|
+
tx.onabort = () => reject(tx.error ?? new Error("Browser custody read aborted"));
|
|
11993
|
+
});
|
|
11994
|
+
const migrate = async () => new Promise((resolve, reject) => {
|
|
11995
|
+
const tx = db.transaction(["custody", "files", "records", "cache"], "readwrite", { durability: "strict" });
|
|
11996
|
+
const control = tx.objectStore("custody");
|
|
11997
|
+
const read = control.get("current");
|
|
11998
|
+
read.onsuccess = () => {
|
|
11999
|
+
const snapshot = read.result;
|
|
12000
|
+
if (!snapshot || snapshot.format === 2) return;
|
|
12001
|
+
if (snapshot.format !== 1) {
|
|
12002
|
+
tx.abort();
|
|
12003
|
+
return;
|
|
12004
|
+
}
|
|
12005
|
+
for (const file of snapshot.files) {
|
|
12006
|
+
if (durableFile(file.path)) replace(tx.objectStore("files"), file.path, file);
|
|
12007
|
+
else if (currentCacheFile(file.path)) replace(tx.objectStore("cache"), file.path, file);
|
|
12008
|
+
}
|
|
12009
|
+
for (const record of snapshot.records) replace(tx.objectStore("records"), keyOf(record.namespace, record.key), record);
|
|
12010
|
+
control.put({ format: 2, replica: snapshot.replica, identity: snapshot.identity }, "current");
|
|
12011
|
+
};
|
|
12012
|
+
tx.oncomplete = () => resolve();
|
|
12013
|
+
tx.onabort = () => reject(tx.error ?? new Error("Browser custody migration aborted"));
|
|
12014
|
+
});
|
|
12015
|
+
try {
|
|
12016
|
+
await migrate();
|
|
12017
|
+
} catch (error) {
|
|
12018
|
+
db.close();
|
|
12019
|
+
release();
|
|
12020
|
+
throw error;
|
|
12021
|
+
}
|
|
11540
12022
|
return BrowserCustodyStore.open({
|
|
11541
|
-
load:
|
|
11542
|
-
|
|
11543
|
-
const
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
const
|
|
11549
|
-
|
|
12023
|
+
load: readState,
|
|
12024
|
+
commit: (change) => new Promise((resolve, reject) => {
|
|
12025
|
+
const tx = db.transaction(["custody", "files", "records"], "readwrite", { durability: "strict" });
|
|
12026
|
+
const files = tx.objectStore("files");
|
|
12027
|
+
const records = tx.objectStore("records");
|
|
12028
|
+
for (const path of change.removedFiles) replace(files, path);
|
|
12029
|
+
for (const file of change.files) replace(files, file.path, file);
|
|
12030
|
+
for (const id of change.removedRecords) replace(records, id);
|
|
12031
|
+
for (const record of change.records) replace(records, keyOf(record.namespace, record.key), record);
|
|
12032
|
+
tx.objectStore("custody").put(change.control, "current");
|
|
11550
12033
|
tx.oncomplete = () => resolve();
|
|
11551
12034
|
tx.onabort = () => reject(tx.error ?? new Error("Browser custody transaction aborted"));
|
|
11552
12035
|
}),
|
|
12036
|
+
commitCache: (cacheFiles, removedFiles) => new Promise((resolve, reject) => {
|
|
12037
|
+
const tx = db.transaction("cache", "readwrite", { durability: "relaxed" });
|
|
12038
|
+
const cache = tx.objectStore("cache");
|
|
12039
|
+
for (const path of removedFiles) replace(cache, path);
|
|
12040
|
+
for (const file of cacheFiles) replace(cache, file.path, file);
|
|
12041
|
+
tx.oncomplete = () => resolve();
|
|
12042
|
+
tx.onabort = () => reject(tx.error ?? new Error("Browser cache checkpoint aborted"));
|
|
12043
|
+
}),
|
|
11553
12044
|
close: () => {
|
|
11554
12045
|
db.close();
|
|
11555
12046
|
release();
|
|
@@ -14530,7 +15021,7 @@
|
|
|
14530
15021
|
}
|
|
14531
15022
|
|
|
14532
15023
|
// ../src/runtime/credential_recovery_desk.ts
|
|
14533
|
-
var _ports, _waiting, _background, _renewing,
|
|
15024
|
+
var _ports, _waiting, _background, _renewing, _active2, _replicaWaiters, _joining, _completed2, _sequence2, _CredentialRecoveryDesk_instances, now_fn, unixMillis_fn, tokenless_fn, prune_fn, begin_fn, wake_fn, callOnce_fn, remember_fn2, finishReplicaWaiters_fn;
|
|
14534
15025
|
var CredentialRecoveryDesk = class {
|
|
14535
15026
|
constructor(ports) {
|
|
14536
15027
|
__privateAdd(this, _CredentialRecoveryDesk_instances);
|
|
@@ -14540,7 +15031,7 @@
|
|
|
14540
15031
|
/** Capabilities whose renewal-ahead-of-expiry is in flight: one refresh per capability, not one per offer. */
|
|
14541
15032
|
__privateAdd(this, _renewing, /* @__PURE__ */ new Map());
|
|
14542
15033
|
/** One physical acquisition per capability; other callers wait outside the serial kernel lane. */
|
|
14543
|
-
__privateAdd(this,
|
|
15034
|
+
__privateAdd(this, _active2, /* @__PURE__ */ new Map());
|
|
14544
15035
|
/** Headless follows joining an interaction-owned refresh of the same
|
|
14545
15036
|
* capability. They need no synthetic session or second provider request. */
|
|
14546
15037
|
__privateAdd(this, _replicaWaiters, /* @__PURE__ */ new Map());
|
|
@@ -14578,7 +15069,7 @@
|
|
|
14578
15069
|
request: fromBinary(RuntimeRequestSchema, toBinary(RuntimeRequestSchema, request))
|
|
14579
15070
|
}, { allowCached: false, rejectCurrent: false });
|
|
14580
15071
|
if (step.case !== "pending") throw new Error("credential renewal did not produce its physical paper");
|
|
14581
|
-
__privateGet(this, _renewing).set(capability, __privateGet(this,
|
|
15072
|
+
__privateGet(this, _renewing).set(capability, __privateGet(this, _active2).get(capability));
|
|
14582
15073
|
return step;
|
|
14583
15074
|
}
|
|
14584
15075
|
beginOffer(request, command, response) {
|
|
@@ -14593,7 +15084,7 @@
|
|
|
14593
15084
|
ensurePresent(session) {
|
|
14594
15085
|
if (__privateGet(this, _ports).authToken(session).byteLength > 0 || __privateMethod(this, _CredentialRecoveryDesk_instances, tokenless_fn).call(this, session)) return true;
|
|
14595
15086
|
__privateMethod(this, _CredentialRecoveryDesk_instances, prune_fn).call(this);
|
|
14596
|
-
const active = __privateGet(this,
|
|
15087
|
+
const active = __privateGet(this, _active2).get(__privateGet(this, _ports).capabilityFor(session));
|
|
14597
15088
|
if (active !== void 0) {
|
|
14598
15089
|
__privateGet(this, _waiting).get(active)?.affectedSessions.add(session);
|
|
14599
15090
|
return false;
|
|
@@ -14607,7 +15098,7 @@
|
|
|
14607
15098
|
if (!syncNeedsCredentialRefresh(event.result, event.failure) || __privateMethod(this, _CredentialRecoveryDesk_instances, tokenless_fn).call(this, session)) return;
|
|
14608
15099
|
__privateMethod(this, _CredentialRecoveryDesk_instances, prune_fn).call(this);
|
|
14609
15100
|
const capability = __privateGet(this, _ports).capabilityFor(session);
|
|
14610
|
-
const existing = __privateGet(this,
|
|
15101
|
+
const existing = __privateGet(this, _active2).get(capability);
|
|
14611
15102
|
if (existing !== void 0) {
|
|
14612
15103
|
__privateGet(this, _waiting).get(existing)?.affectedSessions.add(session);
|
|
14613
15104
|
return;
|
|
@@ -14625,7 +15116,7 @@
|
|
|
14625
15116
|
return { case: "refreshed", value: create(CredentialsRefreshedSchema, { session: capability }) };
|
|
14626
15117
|
}
|
|
14627
15118
|
__privateMethod(this, _CredentialRecoveryDesk_instances, prune_fn).call(this);
|
|
14628
|
-
if (__privateGet(this,
|
|
15119
|
+
if (__privateGet(this, _active2).has(capability)) {
|
|
14629
15120
|
const waiting = __privateGet(this, _replicaWaiters).get(capability) ?? /* @__PURE__ */ new Set();
|
|
14630
15121
|
waiting.add(workspace);
|
|
14631
15122
|
__privateGet(this, _replicaWaiters).set(capability, waiting);
|
|
@@ -14674,7 +15165,7 @@
|
|
|
14674
15165
|
__privateGet(this, _waiting).delete(command.workId);
|
|
14675
15166
|
if (__privateGet(this, _background).get(work.capability) === command.workId) __privateGet(this, _background).delete(work.capability);
|
|
14676
15167
|
if (__privateGet(this, _renewing).get(work.capability) === command.workId) __privateGet(this, _renewing).delete(work.capability);
|
|
14677
|
-
if (__privateGet(this,
|
|
15168
|
+
if (__privateGet(this, _active2).get(work.capability) === command.workId) __privateGet(this, _active2).delete(work.capability);
|
|
14678
15169
|
const sameContext = __privateMethod(this, _CredentialRecoveryDesk_instances, now_fn).call(this) < work.expiresAt && (work.directCapability || __privateGet(this, _ports).capabilityFor(work.session) === work.capability) && (work.directCapability ? __privateGet(this, _ports).deviceChallengeForCapability(work.capability) : __privateGet(this, _ports).deviceChallenge(work.session)) === work.deviceChallenge;
|
|
14679
15170
|
const material = sameContext && receipt.outcome.case === "credentialRefreshed" ? receipt.outcome.value : void 0;
|
|
14680
15171
|
let refreshed = create(CredentialsRefreshedSchema, { session: work.session });
|
|
@@ -14711,7 +15202,7 @@
|
|
|
14711
15202
|
clear() {
|
|
14712
15203
|
__privateGet(this, _waiting).clear();
|
|
14713
15204
|
__privateGet(this, _joining).clear();
|
|
14714
|
-
__privateGet(this,
|
|
15205
|
+
__privateGet(this, _active2).clear();
|
|
14715
15206
|
__privateGet(this, _replicaWaiters).clear();
|
|
14716
15207
|
__privateGet(this, _background).clear();
|
|
14717
15208
|
__privateGet(this, _renewing).clear();
|
|
@@ -14722,7 +15213,7 @@
|
|
|
14722
15213
|
_waiting = new WeakMap();
|
|
14723
15214
|
_background = new WeakMap();
|
|
14724
15215
|
_renewing = new WeakMap();
|
|
14725
|
-
|
|
15216
|
+
_active2 = new WeakMap();
|
|
14726
15217
|
_replicaWaiters = new WeakMap();
|
|
14727
15218
|
_joining = new WeakMap();
|
|
14728
15219
|
_completed2 = new WeakMap();
|
|
@@ -14743,7 +15234,7 @@
|
|
|
14743
15234
|
__privateGet(this, _waiting).delete(id);
|
|
14744
15235
|
if (__privateGet(this, _background).get(work.capability) === id) __privateGet(this, _background).delete(work.capability);
|
|
14745
15236
|
if (__privateGet(this, _renewing).get(work.capability) === id) __privateGet(this, _renewing).delete(work.capability);
|
|
14746
|
-
if (__privateGet(this,
|
|
15237
|
+
if (__privateGet(this, _active2).get(work.capability) === id) __privateGet(this, _active2).delete(work.capability);
|
|
14747
15238
|
__privateMethod(this, _CredentialRecoveryDesk_instances, finishReplicaWaiters_fn).call(this, work.capability, false);
|
|
14748
15239
|
}
|
|
14749
15240
|
for (const [id, work] of __privateGet(this, _joining)) if (work.expiresAt <= now) __privateGet(this, _joining).delete(id);
|
|
@@ -14753,7 +15244,7 @@
|
|
|
14753
15244
|
const id = `credential-recovery-${++__privateWrapper(this, _sequence2)._}`;
|
|
14754
15245
|
const effectId2 = `${id}:refresh`;
|
|
14755
15246
|
const capability = direct ? session : __privateGet(this, _ports).capabilityFor(session);
|
|
14756
|
-
const active = __privateGet(this,
|
|
15247
|
+
const active = __privateGet(this, _active2).get(capability);
|
|
14757
15248
|
if (active !== void 0 && original !== void 0) {
|
|
14758
15249
|
__privateGet(this, _waiting).get(active)?.affectedSessions.add(session);
|
|
14759
15250
|
const current2 = __privateMethod(this, _CredentialRecoveryDesk_instances, wake_fn).call(this, id, 0);
|
|
@@ -14780,7 +15271,7 @@
|
|
|
14780
15271
|
...direct === void 0 ? {} : { workspace: direct.workspace },
|
|
14781
15272
|
...original === void 0 ? {} : { original }
|
|
14782
15273
|
});
|
|
14783
|
-
__privateGet(this,
|
|
15274
|
+
__privateGet(this, _active2).set(capability, id);
|
|
14784
15275
|
return { case: "pending", value: create(CorrespondencePendingSchema, { workId: id, effect: {
|
|
14785
15276
|
case: "refreshCredential",
|
|
14786
15277
|
value: create(PeerCredentialRefreshEffectSchema, {
|
|
@@ -19153,27 +19644,27 @@
|
|
|
19153
19644
|
// ../src/runtime/residency_pins.ts
|
|
19154
19645
|
init_define_NOMOS_KERNEL_RELEASE();
|
|
19155
19646
|
init_shims();
|
|
19156
|
-
var _pending2, _resumed,
|
|
19647
|
+
var _pending2, _resumed, _active3;
|
|
19157
19648
|
var ResidencyPins = class {
|
|
19158
19649
|
constructor() {
|
|
19159
19650
|
__privateAdd(this, _pending2, /* @__PURE__ */ new Map());
|
|
19160
19651
|
__privateAdd(this, _resumed, /* @__PURE__ */ new WeakMap());
|
|
19161
|
-
__privateAdd(this,
|
|
19652
|
+
__privateAdd(this, _active3, []);
|
|
19162
19653
|
}
|
|
19163
19654
|
begin(workId2, effectId2) {
|
|
19164
19655
|
const pending = workId2 ? __privateGet(this, _pending2).get(workId2) : void 0;
|
|
19165
19656
|
const correlated = pending && pending.effectId === effectId2;
|
|
19166
19657
|
const scope = new Set(correlated ? pending.scope : void 0);
|
|
19167
19658
|
if (correlated) __privateGet(this, _resumed).set(scope, workId2);
|
|
19168
|
-
__privateGet(this,
|
|
19659
|
+
__privateGet(this, _active3).push(scope);
|
|
19169
19660
|
return scope;
|
|
19170
19661
|
}
|
|
19171
19662
|
touch(workspace) {
|
|
19172
|
-
if (workspace) for (const scope of __privateGet(this,
|
|
19663
|
+
if (workspace) for (const scope of __privateGet(this, _active3)) scope.add(workspace);
|
|
19173
19664
|
}
|
|
19174
19665
|
end(scope, previousWorkId, pendingWorkId, pendingEffectId) {
|
|
19175
|
-
if (__privateGet(this,
|
|
19176
|
-
__privateGet(this,
|
|
19666
|
+
if (__privateGet(this, _active3).at(-1) !== scope) throw new Error("residency scopes must settle in stack order");
|
|
19667
|
+
__privateGet(this, _active3).pop();
|
|
19177
19668
|
if (previousWorkId && __privateGet(this, _resumed).get(scope) === previousWorkId) __privateGet(this, _pending2).delete(previousWorkId);
|
|
19178
19669
|
if (pendingWorkId) __privateGet(this, _pending2).set(pendingWorkId, {
|
|
19179
19670
|
scope,
|
|
@@ -19181,7 +19672,7 @@
|
|
|
19181
19672
|
});
|
|
19182
19673
|
}
|
|
19183
19674
|
workspaces() {
|
|
19184
|
-
return new Set([...__privateGet(this,
|
|
19675
|
+
return new Set([...__privateGet(this, _active3), ...[...__privateGet(this, _pending2).values()].map((pending) => pending.scope)].flatMap((scope) => [...scope]));
|
|
19185
19676
|
}
|
|
19186
19677
|
clear() {
|
|
19187
19678
|
__privateGet(this, _pending2).clear();
|
|
@@ -19189,7 +19680,7 @@
|
|
|
19189
19680
|
};
|
|
19190
19681
|
_pending2 = new WeakMap();
|
|
19191
19682
|
_resumed = new WeakMap();
|
|
19192
|
-
|
|
19683
|
+
_active3 = new WeakMap();
|
|
19193
19684
|
|
|
19194
19685
|
// ../src/runtime/subscription_manager.ts
|
|
19195
19686
|
init_define_NOMOS_KERNEL_RELEASE();
|
|
@@ -35031,9 +35522,11 @@
|
|
|
35031
35522
|
replica: options.replica ?? storage.replica,
|
|
35032
35523
|
trustRootPublicKey: options.trustRootPublicKey
|
|
35033
35524
|
}, storage.filesystem, storage.changed);
|
|
35034
|
-
const
|
|
35525
|
+
const kernelWork = new KernelWorkAccounting(options.onKernelWorkChanged, false);
|
|
35526
|
+
const physicalKernel = observeBrowserKernelCalls(kernelExecutionDesk(machine), kernelWork);
|
|
35527
|
+
const kernel = options.observeKernel?.(physicalKernel) ?? physicalKernel;
|
|
35035
35528
|
const custodyDesk = gitCustodyDesk(kernel, fetchImpl);
|
|
35036
|
-
const kernelStore = browserKernelCustody(kernel, () => storage.checkpoint(), () => storage.isCheckpointCurrent());
|
|
35529
|
+
const kernelStore = browserKernelCustody(kernel, () => storage.checkpoint(), () => storage.isCheckpointCurrent(), options.provisionedGenesisWorkspace);
|
|
35037
35530
|
const physical = withWorkspaceDiscovery(kernelStore, {
|
|
35038
35531
|
providers: options.discoveryProviders ?? [options.base],
|
|
35039
35532
|
fetch: (input, init) => fetchImpl(input, init)
|
|
@@ -35068,6 +35561,7 @@
|
|
|
35068
35561
|
await storage.checkpoint();
|
|
35069
35562
|
return result;
|
|
35070
35563
|
},
|
|
35564
|
+
kernelWorkSnapshot: () => kernelWork.snapshot(),
|
|
35071
35565
|
close: async () => {
|
|
35072
35566
|
await office.settleRetention();
|
|
35073
35567
|
office.close();
|
|
@@ -35173,6 +35667,12 @@
|
|
|
35173
35667
|
warmResidencyMillis: 86400000n
|
|
35174
35668
|
},
|
|
35175
35669
|
postEvent,
|
|
35670
|
+
onKernelWorkChanged: (active) => {
|
|
35671
|
+
try {
|
|
35672
|
+
window.__nomosKernelWorkChanged?.(active ? toJsonString(ActiveKernelWorkSchema, active) : "");
|
|
35673
|
+
} catch {
|
|
35674
|
+
}
|
|
35675
|
+
},
|
|
35176
35676
|
kernelCache: kernelCache()
|
|
35177
35677
|
});
|
|
35178
35678
|
flushEvents();
|
|
@@ -35186,6 +35686,7 @@
|
|
|
35186
35686
|
if (!peer) throw new Error("Nomos peer runtime is not booted");
|
|
35187
35687
|
return frameToBase64(await peer.invoke(frameFromBase64(frameBase64)));
|
|
35188
35688
|
};
|
|
35689
|
+
window.__nomosKernelWorkSnapshot = () => peer ? toJsonString(KernelWorkSnapshotSchema, peer.kernelWorkSnapshot()) : void 0;
|
|
35189
35690
|
window.NomosRunner = {
|
|
35190
35691
|
version: 2,
|
|
35191
35692
|
dispose: () => {
|
package/package.json
CHANGED