@githolon/runtime 0.110.1 → 0.111.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.
@@ -34,6 +34,7 @@
34
34
  1963a804a9cfe7d44a76b2c476817639b939d7e93828da865cab40fe9ba536fa adapter/custody-transport.ts
35
35
  1a5d9fd32360e2cec4adbee9e56221fb26def66bb9d122e0b5745cebc963d92e node_modules/xml-naming/src/index.js
36
36
  1b27a1f4d58d6314cd4887d0f47493d1a98fc474e3364388f321c3aeb94a8ac3 adapter/workspace_effect_outcome.ts
37
+ 1b8eea8acf14374c28330cb21eea0e14f151fffb7c678f8e4a7f34722dc2eb22 peer-office/src/runtime/workspace_sync.ts
37
38
  1c0bba78daf8c28ac51f35d60b2b2fbca9c57bc7bcdb05a05a1f15a2ca657164 peer-office/src/reception/application_readiness_transport.ts
38
39
  1c364712aa61711ce0e654ed81e26fe821e8f7b6dac9c31fe6d49fc184dbacd2 node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.js
39
40
  1d1f03bc86ea3788b57b43c7720de2c41a7b133d852262a7615b3b152777cdef node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.js
@@ -66,6 +67,7 @@
66
67
  33917d22c20458fce8ef7e3a4fca8f51af8ace4508e6a435870b3ad61ea2eab4 peer-office/src/git_read_lease.ts
67
68
  33e7d6bdd22396057d3f8db92384079f7ec2fda4b3582709de2d43fccacc4a9c node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.js
68
69
  34f8712de2bd30a2cb8366d8cfdcde466d979f1a28ac0d78f7547341b01f6c57 adapter/proto/nomos/kernel/v1/progress_pb.js
70
+ 357485877b38fa0a70a2741a46f49f57c784300a53d7301b140cb3aded6e46b5 peer-office/package/package.json
69
71
  3a90933569db7e42ec2ed3b77509c29d1ab75f6eb078f53fe5d1ac6d239d231e peer-office/src/runtime/peer_background_scheduler.ts
70
72
  3c092b8d4185badd23ecf4552434d05aa541b0cd0d534781d687db55260d5da8 adapter/proto/nomos/runtime/v2/sealing_desk_pb.js
71
73
  3c98fa838c05abcfd8dfda1128f2d1fca9b196a371fe9751abbd8f4c3b9d04ec node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.js
@@ -85,7 +87,6 @@
85
87
  45e0c35b4e8b0c1f606ca98a827d5ba041716ef346c5ba77a5c3303a5399b7ff adapter/proto/nomos/runtime/v2/observability_desk_pb.js
86
88
  463a7041ce45ddd801fc0e0981bb11658b76bb44caad19d2971d73d7700d739b node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js
87
89
  46ce19f00a64198852937f4a982c59a5d237aeab590255873e131f2f0468e98e peer-office/src/runtime/workspace_opening.ts
88
- 46df6f8f4bd0288fed37e8393805df8542556ae7ad663dcef492406000963a63 peer-office/package/package.json
89
90
  475e62094c73367833cec6253c5834a887cae9bcfa43a691a9fe3b7495c19106 node_modules/@bufbuild/protobuf/dist/esm/unknown-enum.js
90
91
  48b8a92448c21da157755c24058a1522d62389815254bd43858e27fc200cc793 peer-office/src/runtime/retention_observer.ts
91
92
  497ee51559f8769c47defb7679dd516b5736c22c433bc857a19e8ccd9593c842 node_modules/is-unsafe/src/contexts/xml.js
@@ -101,7 +102,6 @@
101
102
  513a0ca639e4d5cbb6ecce90f9668ab63f5e8ce4df2468b1ad439112b903ef0a platform-shells/node/local-development/kernel_work_recovery.ts
102
103
  519afa7759c5cce91b66cd6b1444014ead77df1f691d0eee356b14206d32d59e peer-office/src/runtime/workspace_call_binding.ts
103
104
  5295c7fdcb8d70cadc057dcd7b1efda4535dfae93f1a601b304245fdf8adb5ab peer-office/src/peer_office.ts
104
- 5521fba42530e15bdba2f5a67e7e3c03d0e753c6d70c8834071a6b8832fda007 peer-office/src/runtime/correspondence_desk.ts
105
105
  56e2ac380c2d9be43647d88928727c17df70a3e734834a5be62c8bcb18616738 adapter/proto/nomos/runtime/v2/custody_desk_pb.js
106
106
  57677b7b20768a3bd6eb50fdff229852be7f9978e5988924d2c935ba934366d4 adapter/proto/nomos/discovery/v1/workspace_placement_pb.js
107
107
  587bee5d27b6dbc99d24f472ea93028659610c3496be7d667e72483483c3f3ba node_modules/fast-xml-parser/src/fxp.js
@@ -170,6 +170,7 @@
170
170
  94a3cef0f355a9a177661748d24faae32206a5cc382c8601a34dcf005340107b node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
171
171
  95ad7c933403a0c8f7fd3e2df6c4df3008c29911d3d5db063a90460a14144da2 peer-office/src/runtime/records_desk.ts
172
172
  95dbcb2580ed30cb11222c773163c6a906a7e363c5ec4263bd39c1f3a7a16cc2 node_modules/@bufbuild/protobuf/dist/esm/from-json.js
173
+ 9633e84964edf9d8e2f719766c002cabe341e5e805e729ae7ea8fa9ec4c95410 peer-office/src/runtime/correspondence_desk.ts
173
174
  96cb2eb563ccb18dc23fd9f8fb0f65193a1b90f39758a561eed747368ead00b3 node_modules/@bufbuild/protobuf/dist/esm/wkt/index.js
174
175
  96ec5d127a4e8cd77bdc678422f0d57c8ff9e37bcec999983da71a7b72ce9a0e node_modules/@nodable/entities/src/entities.js
175
176
  98f5abf9a7fb522aab513ef3831dd9c5837cebcb38a960cb546ffd084926d746 node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/empty_pb.js
@@ -197,7 +198,6 @@ aa6349944f16d71986273ecfc8e552bfece3d61d5641e526c0ceabf3f154fdaf peer-office/sr
197
198
  ab43714f566a6ccd988cc3a30810d857552dbd14d0f060934907fb4bba1000f0 peer-office/package/src/admission_decision.ts
198
199
  ab80eeeafd4d89a5daaf5d2e00fb471cc6b53fa90776750ca3ad82df482d7c3f peer-office/src/runtime/peer_lifecycle.ts
199
200
  ad3de46df125304b2a61c2fa5537b0e519635997d99686a76119b38cf260963f adapter/proto/nomos/runtime/v2/identity_desk_pb.js
200
- aeb94bc5762080dca498fcbdfa5c347525dceb1f3748db82106b479c5d23d931 peer-office/src/runtime/workspace_sync.ts
201
201
  afde3ddb29cc6ee2c48b30043feca4ea14b5690035aa134b08b4df83558faa7c platform-shells/shared/system_observation_clock.ts
202
202
  b09ee99807e1edeb746b4a4a1e41519edaff1fed9f71a170bc15e8835af93e25 node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js
203
203
  b178d69931fdb285d0cd3bae0343a0fd0c80eed27e90d07992153927f9bcc8c3 peer-office/src/runtime/frame_runner.ts
@@ -16224,7 +16224,6 @@ var NomosRuntimeComponent = (() => {
16224
16224
  Done: "done"
16225
16225
  });
16226
16226
  var trackedMain = "refs/remotes/nomos/main";
16227
- var NO_COMMON_BASE = "this replica holds local history with no frontier its upstream ever confirmed; convergence needs a common admitted base \u2014 drop the local copy to refetch it, or re-discover a provider holding this lineage";
16228
16227
  var deferredRemote = "refs/remotes/nomos/deferred";
16229
16228
  var deferredLocal = "refs/nomos/sync-deferred-local";
16230
16229
  var judgedThisLifetime = /* @__PURE__ */ new Map();
@@ -16435,38 +16434,13 @@ var NomosRuntimeComponent = (() => {
16435
16434
  }), { case: "awaiting", requestId });
16436
16435
  }
16437
16436
  /**
16438
- * NO COMMON BASE — a round that cannot converge, and must not pay for history to find out.
16439
- *
16440
- * This replica holds a non-empty ledger but has never recorded a frontier its upstream
16441
- * confirmed (`refs/remotes/nomos/main` is absent). The kernel refuses convergence in that
16442
- * state ("a non-empty live ledger requires a common admitted base"), so every step after the
16443
- * O(1) frontier probe is wasted work — and it is not cheap waste: the fetch negotiates with
16444
- * no `have` (a full-history pack), and the dependency planner decodes EVERY intent from
16445
- * genesis and inspects every change, once per round. That is O(history) per follow round,
16446
- * repeated at every retry, for a round that can only end in a refusal.
16447
- *
16448
- * The one base this round can establish costs nothing and is established before this is
16449
- * asked: an upstream holding exactly this replica's head (the probe's answer) converges it
16450
- * and records the tracking frontier. Anything else needs the local copy to be dropped and
16451
- * refetched (an application decision, which preserves the copy), or a re-discovery that
16452
- * names a provider holding this lineage. Both are reported, at O(1), as this failure.
16453
- */
16454
- /**
16455
- * Establish this round's base when none is tracked, without walking any history it can avoid.
16456
- *
16457
- * The upstream just named its own frontier. If that commit is in THIS replica's lineage, it is
16458
- * a common admitted base by definition — both sides hold it — and adopting it turns the round
16459
- * into an ordinary fast-forward: the offer carries only the suffix above it, the fetch can name
16460
- * it as a truthful `have`, and convergence has the base the kernel requires. One commit walk
16461
- * (no change decoding, no pack, no network) decides it.
16462
- *
16463
- * If it is not in this replica's lineage, no base exists to establish and the round is refused
16464
- * (#noCommonBase) before it leases, fetches or plans anything.
16465
- *
16466
- * A kernel without the commit walk cannot be asked, so it keeps the previous behaviour.
16437
+ * Establish a cheap base when the provider's current tip is in our local chain.
16438
+ * A negative answer means the base is unknown: both sides may have advanced from
16439
+ * an earlier shared commit. Acquire the candidate and let the kernel discover
16440
+ * and judge that history. A tracking bookmark is not an admission prerequisite.
16467
16441
  */
16468
16442
  #establishBase(upstreamHead) {
16469
- if (!this.#noCommonBase() || !this.#kernel.historySummary) return true;
16443
+ if (!this.#missingTrackedBase() || !this.#kernel.historySummary) return true;
16470
16444
  const summary = this.#kernel.historySummary(this.#mount, this.#requestId, upstreamHead, this.#localHead);
16471
16445
  if (!summary.reachedBase) return false;
16472
16446
  this.#previousHead = upstreamHead;
@@ -16481,26 +16455,9 @@ var NomosRuntimeComponent = (() => {
16481
16455
  get establishedBase() {
16482
16456
  return this.#establishedBase;
16483
16457
  }
16484
- #noCommonBase() {
16458
+ #missingTrackedBase() {
16485
16459
  return this.#previousHead === void 0 && this.#localHead !== void 0 && this.#replaceLocalHead === void 0;
16486
16460
  }
16487
- #noCommonBaseResult() {
16488
- return this.#finish(create(SyncWorkspaceResponseSchema, {
16489
- workspace: this.#mount.workspace,
16490
- ...this.#localHead === void 0 ? {} : { currentHead: this.#localHead },
16491
- stillAhead: true,
16492
- ...this.#offerReceipt === void 0 ? {} : { offerReceipt: this.#offerReceipt },
16493
- pushError: create(RuntimeTransportFailureSchema, {
16494
- endpoint: this.#offerEndpoint(),
16495
- status: 409,
16496
- refused: true,
16497
- message: NO_COMMON_BASE
16498
- }),
16499
- timings: create(SyncPhaseTimingsSchema, {
16500
- convergeMillis: elapsedMillis(this.#clock, this.#started)
16501
- })
16502
- }));
16503
- }
16504
16461
  #holdsLocalWork() {
16505
16462
  return this.#command.admit && !!this.#localHead && this.#localHead !== this.#previousHead;
16506
16463
  }
@@ -16652,7 +16609,6 @@ var NomosRuntimeComponent = (() => {
16652
16609
  if (!this.#desiredHead) return this.#transportFailure("resident peer returned no admitted frontier", false);
16653
16610
  this.#candidateDurable = admission.sealedMain === this.#desiredHead;
16654
16611
  if (state.phase === WorkspaceSyncPhase.Probe && this.#desiredHead !== this.#localHead) {
16655
- if (!this.#establishBase(this.#desiredHead)) return this.#noCommonBaseResult();
16656
16612
  if (this.#alreadyJudged(this.#desiredHead)) {
16657
16613
  return this.#finish(create(SyncWorkspaceResponseSchema, {
16658
16614
  workspace: this.#mount.workspace,
@@ -16664,6 +16620,22 @@ var NomosRuntimeComponent = (() => {
16664
16620
  offerReceipt: this.#offerReceipt
16665
16621
  }));
16666
16622
  }
16623
+ if (!this.#establishBase(this.#desiredHead)) {
16624
+ this.#offerAfterConverge = this.#command.admit;
16625
+ this.#rebaseFrom = void 0;
16626
+ return this.#leaseEffect();
16627
+ }
16628
+ if (this.#establishedBase && !this.#candidateDurable && this.#kernel.resolveRef(this.#mount, this.#requestId, trackedMain) === void 0) {
16629
+ return this.#finish(create(SyncWorkspaceResponseSchema, {
16630
+ workspace: this.#mount.workspace,
16631
+ currentHead: this.#localHead,
16632
+ previousHead: this.#previousHead,
16633
+ stillAhead: true,
16634
+ directOfferDeferred: true,
16635
+ reconnectRequired: false,
16636
+ offerReceipt: this.#offerReceipt
16637
+ }));
16638
+ }
16667
16639
  if (this.#probeOnly) {
16668
16640
  this.#needsReconciliation = true;
16669
16641
  return this.#finish(create(SyncWorkspaceResponseSchema, {
@@ -16709,7 +16681,7 @@ var NomosRuntimeComponent = (() => {
16709
16681
  return this.#converge(this.#desiredHead, admission.resultPack.byteLength, 0);
16710
16682
  }
16711
16683
  if (this.#desiredHead === this.#previousHead) return this.#converge(this.#desiredHead, 0, 0);
16712
- if (!this.#establishBase(this.#desiredHead)) return this.#noCommonBaseResult();
16684
+ this.#establishBase(this.#desiredHead);
16713
16685
  if (admission.recoveryRequired !== false) return this.#leaseEffect();
16714
16686
  return this.#transportFailure("resident peer supplied neither the missing delta nor a history gap", false);
16715
16687
  }
@@ -16932,7 +16904,7 @@ var NomosRuntimeComponent = (() => {
16932
16904
  }
16933
16905
  }
16934
16906
  #converge(candidateHead, receivedBytes, prefetchMillis) {
16935
- if (!this.#establishBase(candidateHead)) return this.#noCommonBaseResult();
16907
+ this.#establishBase(candidateHead);
16936
16908
  this.#beforeConverge?.(candidateHead, this.#previousHead);
16937
16909
  const convergeStarted = this.#clock.monotonicNanoseconds();
16938
16910
  let judged;
@@ -19378,13 +19350,21 @@ var NomosRuntimeComponent = (() => {
19378
19350
  }
19379
19351
  #observeSyncResult(requestId, workId2, result) {
19380
19352
  const timings = result.timings;
19353
+ const receipt = result.offerReceipt?.outcome;
19354
+ const admission = receipt?.case === "admission" ? receipt.value : void 0;
19381
19355
  this.#events.instant("peer.follow.sync-result", {
19382
19356
  request: create(RuntimeRequestSchema, { protocolVersion: 2, requestId }),
19383
19357
  workspace: result.workspace
19384
19358
  }, {
19385
19359
  "sync.workId": workId2,
19386
19360
  ...result.currentHead ? { "sync.head": result.currentHead } : {},
19361
+ ...result.previousHead ? { "sync.previousHead": result.previousHead } : {},
19362
+ ...admission?.main ? { "sync.providerHead": admission.main } : {},
19363
+ ...admission?.sealedMain ? { "sync.sealedHead": admission.sealedMain } : {},
19387
19364
  "sync.stillAhead": result.stillAhead,
19365
+ "sync.reconnectRequired": result.reconnectRequired,
19366
+ "sync.refused": result.refused,
19367
+ "sync.deferred": result.deferred,
19388
19368
  "sync.directOfferDeferred": result.directOfferDeferred,
19389
19369
  "sync.offline": result.offline,
19390
19370
  ...timings ? {
@@ -21792,7 +21792,6 @@
21792
21792
  Done: "done"
21793
21793
  });
21794
21794
  var trackedMain = "refs/remotes/nomos/main";
21795
- var NO_COMMON_BASE = "this replica holds local history with no frontier its upstream ever confirmed; convergence needs a common admitted base \u2014 drop the local copy to refetch it, or re-discover a provider holding this lineage";
21796
21795
  var deferredRemote = "refs/remotes/nomos/deferred";
21797
21796
  var deferredLocal = "refs/nomos/sync-deferred-local";
21798
21797
  var judgedThisLifetime = /* @__PURE__ */ new Map();
@@ -21804,7 +21803,7 @@
21804
21803
  const finished = clock.monotonicNanoseconds();
21805
21804
  return finished >= started ? Number(finished - started) / 1e6 : 0;
21806
21805
  };
21807
- var _kernel16, _credentials4, _clock13, _mount, _binding, _route2, _rediscover, _reroute, _discoveredFrontier, _observePlacement, _recheckPlacement, _directoryAnswered, _placementFetched, _leased, _command2, _requestId4, _started, _state, _localHead, _offerHead, _previousHead, _pushMillis, _pushBytes, _desiredHead, _returnedPackHead, _candidateDurable, _admissionSummary, _offerReceipt, _pushError, _current3, _lastReceiptEffectId2, _lastStep2, _probeOnly, _establishedBase, _receiveState, _completeHistory, _lawProductsImported, _shallowMounted, _fetchedLawProducts, _beforeConverge, _needsReconciliation, _offerAfterConverge, _rebaseFrom, _rebases, _parkedLocal, _replaceLocalHead, _repairMissingCommit, _WorkspaceSyncWork_instances, openRound_fn, offerOrReconcile_fn, establishBase_fn, noCommonBase_fn, noCommonBaseResult_fn, holdsLocalWork_fn, pullBeforeOffer_fn, leaseEffect_fn, beginOffer_fn, acceptOffer_fn, acceptLease_fn, placementFrontier_fn, placementOnly_fn, acceptDiscovery_fn, providerCustody_fn, beginMainFetch_fn, acceptFetch_fn, mountFetched_fn, lawProductsAlongside_fn, acceptLawProducts_fn, providerCustodyMounted_fn, importLawProducts_fn, converge_fn2, unrelatedLineageRefusal_fn, replaceLocal_fn, converged_fn, offerAfterRebase_fn, preservedCopy_fn, alreadyJudged_fn, rememberJudgment_fn, forgetJudgment_fn, present_fn, finishOfferOutcome_fn, transportFailure_fn, remember_fn4, finish_fn2, cloudBase_fn, offerEndpoint_fn, workspaceEndpoint_fn, authToken_fn;
21806
+ var _kernel16, _credentials4, _clock13, _mount, _binding, _route2, _rediscover, _reroute, _discoveredFrontier, _observePlacement, _recheckPlacement, _directoryAnswered, _placementFetched, _leased, _command2, _requestId4, _started, _state, _localHead, _offerHead, _previousHead, _pushMillis, _pushBytes, _desiredHead, _returnedPackHead, _candidateDurable, _admissionSummary, _offerReceipt, _pushError, _current3, _lastReceiptEffectId2, _lastStep2, _probeOnly, _establishedBase, _receiveState, _completeHistory, _lawProductsImported, _shallowMounted, _fetchedLawProducts, _beforeConverge, _needsReconciliation, _offerAfterConverge, _rebaseFrom, _rebases, _parkedLocal, _replaceLocalHead, _repairMissingCommit, _WorkspaceSyncWork_instances, openRound_fn, offerOrReconcile_fn, establishBase_fn, missingTrackedBase_fn, holdsLocalWork_fn, pullBeforeOffer_fn, leaseEffect_fn, beginOffer_fn, acceptOffer_fn, acceptLease_fn, placementFrontier_fn, placementOnly_fn, acceptDiscovery_fn, providerCustody_fn, beginMainFetch_fn, acceptFetch_fn, mountFetched_fn, lawProductsAlongside_fn, acceptLawProducts_fn, providerCustodyMounted_fn, importLawProducts_fn, converge_fn2, unrelatedLineageRefusal_fn, replaceLocal_fn, converged_fn, offerAfterRebase_fn, preservedCopy_fn, alreadyJudged_fn, rememberJudgment_fn, forgetJudgment_fn, present_fn, finishOfferOutcome_fn, transportFailure_fn, remember_fn4, finish_fn2, cloudBase_fn, offerEndpoint_fn, workspaceEndpoint_fn, authToken_fn;
21808
21807
  var WorkspaceSyncWork = class {
21809
21808
  constructor(args) {
21810
21809
  __privateAdd(this, _WorkspaceSyncWork_instances);
@@ -22097,38 +22096,13 @@
22097
22096
  }), { case: "awaiting", requestId });
22098
22097
  };
22099
22098
  /**
22100
- * NO COMMON BASE — a round that cannot converge, and must not pay for history to find out.
22101
- *
22102
- * This replica holds a non-empty ledger but has never recorded a frontier its upstream
22103
- * confirmed (`refs/remotes/nomos/main` is absent). The kernel refuses convergence in that
22104
- * state ("a non-empty live ledger requires a common admitted base"), so every step after the
22105
- * O(1) frontier probe is wasted work — and it is not cheap waste: the fetch negotiates with
22106
- * no `have` (a full-history pack), and the dependency planner decodes EVERY intent from
22107
- * genesis and inspects every change, once per round. That is O(history) per follow round,
22108
- * repeated at every retry, for a round that can only end in a refusal.
22109
- *
22110
- * The one base this round can establish costs nothing and is established before this is
22111
- * asked: an upstream holding exactly this replica's head (the probe's answer) converges it
22112
- * and records the tracking frontier. Anything else needs the local copy to be dropped and
22113
- * refetched (an application decision, which preserves the copy), or a re-discovery that
22114
- * names a provider holding this lineage. Both are reported, at O(1), as this failure.
22115
- */
22116
- /**
22117
- * Establish this round's base when none is tracked, without walking any history it can avoid.
22118
- *
22119
- * The upstream just named its own frontier. If that commit is in THIS replica's lineage, it is
22120
- * a common admitted base by definition — both sides hold it — and adopting it turns the round
22121
- * into an ordinary fast-forward: the offer carries only the suffix above it, the fetch can name
22122
- * it as a truthful `have`, and convergence has the base the kernel requires. One commit walk
22123
- * (no change decoding, no pack, no network) decides it.
22124
- *
22125
- * If it is not in this replica's lineage, no base exists to establish and the round is refused
22126
- * (#noCommonBase) before it leases, fetches or plans anything.
22127
- *
22128
- * A kernel without the commit walk cannot be asked, so it keeps the previous behaviour.
22099
+ * Establish a cheap base when the provider's current tip is in our local chain.
22100
+ * A negative answer means the base is unknown: both sides may have advanced from
22101
+ * an earlier shared commit. Acquire the candidate and let the kernel discover
22102
+ * and judge that history. A tracking bookmark is not an admission prerequisite.
22129
22103
  */
22130
22104
  establishBase_fn = function(upstreamHead) {
22131
- if (!__privateMethod(this, _WorkspaceSyncWork_instances, noCommonBase_fn).call(this) || !__privateGet(this, _kernel16).historySummary) return true;
22105
+ if (!__privateMethod(this, _WorkspaceSyncWork_instances, missingTrackedBase_fn).call(this) || !__privateGet(this, _kernel16).historySummary) return true;
22132
22106
  const summary = __privateGet(this, _kernel16).historySummary(__privateGet(this, _mount), __privateGet(this, _requestId4), upstreamHead, __privateGet(this, _localHead));
22133
22107
  if (!summary.reachedBase) return false;
22134
22108
  __privateSet(this, _previousHead, upstreamHead);
@@ -22138,26 +22112,9 @@
22138
22112
  }
22139
22113
  return true;
22140
22114
  };
22141
- noCommonBase_fn = function() {
22115
+ missingTrackedBase_fn = function() {
22142
22116
  return __privateGet(this, _previousHead) === void 0 && __privateGet(this, _localHead) !== void 0 && __privateGet(this, _replaceLocalHead) === void 0;
22143
22117
  };
22144
- noCommonBaseResult_fn = function() {
22145
- return __privateMethod(this, _WorkspaceSyncWork_instances, finish_fn2).call(this, create(SyncWorkspaceResponseSchema, {
22146
- workspace: __privateGet(this, _mount).workspace,
22147
- ...__privateGet(this, _localHead) === void 0 ? {} : { currentHead: __privateGet(this, _localHead) },
22148
- stillAhead: true,
22149
- ...__privateGet(this, _offerReceipt) === void 0 ? {} : { offerReceipt: __privateGet(this, _offerReceipt) },
22150
- pushError: create(RuntimeTransportFailureSchema, {
22151
- endpoint: __privateMethod(this, _WorkspaceSyncWork_instances, offerEndpoint_fn).call(this),
22152
- status: 409,
22153
- refused: true,
22154
- message: NO_COMMON_BASE
22155
- }),
22156
- timings: create(SyncPhaseTimingsSchema, {
22157
- convergeMillis: elapsedMillis(__privateGet(this, _clock13), __privateGet(this, _started))
22158
- })
22159
- }));
22160
- };
22161
22118
  holdsLocalWork_fn = function() {
22162
22119
  return __privateGet(this, _command2).admit && !!__privateGet(this, _localHead) && __privateGet(this, _localHead) !== __privateGet(this, _previousHead);
22163
22120
  };
@@ -22269,7 +22226,6 @@
22269
22226
  if (!__privateGet(this, _desiredHead)) return __privateMethod(this, _WorkspaceSyncWork_instances, transportFailure_fn).call(this, "resident peer returned no admitted frontier", false);
22270
22227
  __privateSet(this, _candidateDurable, admission.sealedMain === __privateGet(this, _desiredHead));
22271
22228
  if (state.phase === WorkspaceSyncPhase.Probe && __privateGet(this, _desiredHead) !== __privateGet(this, _localHead)) {
22272
- if (!__privateMethod(this, _WorkspaceSyncWork_instances, establishBase_fn).call(this, __privateGet(this, _desiredHead))) return __privateMethod(this, _WorkspaceSyncWork_instances, noCommonBaseResult_fn).call(this);
22273
22229
  if (__privateMethod(this, _WorkspaceSyncWork_instances, alreadyJudged_fn).call(this, __privateGet(this, _desiredHead))) {
22274
22230
  return __privateMethod(this, _WorkspaceSyncWork_instances, finish_fn2).call(this, create(SyncWorkspaceResponseSchema, {
22275
22231
  workspace: __privateGet(this, _mount).workspace,
@@ -22281,6 +22237,22 @@
22281
22237
  offerReceipt: __privateGet(this, _offerReceipt)
22282
22238
  }));
22283
22239
  }
22240
+ if (!__privateMethod(this, _WorkspaceSyncWork_instances, establishBase_fn).call(this, __privateGet(this, _desiredHead))) {
22241
+ __privateSet(this, _offerAfterConverge, __privateGet(this, _command2).admit);
22242
+ __privateSet(this, _rebaseFrom, void 0);
22243
+ return __privateMethod(this, _WorkspaceSyncWork_instances, leaseEffect_fn).call(this);
22244
+ }
22245
+ if (__privateGet(this, _establishedBase) && !__privateGet(this, _candidateDurable) && __privateGet(this, _kernel16).resolveRef(__privateGet(this, _mount), __privateGet(this, _requestId4), trackedMain) === void 0) {
22246
+ return __privateMethod(this, _WorkspaceSyncWork_instances, finish_fn2).call(this, create(SyncWorkspaceResponseSchema, {
22247
+ workspace: __privateGet(this, _mount).workspace,
22248
+ currentHead: __privateGet(this, _localHead),
22249
+ previousHead: __privateGet(this, _previousHead),
22250
+ stillAhead: true,
22251
+ directOfferDeferred: true,
22252
+ reconnectRequired: false,
22253
+ offerReceipt: __privateGet(this, _offerReceipt)
22254
+ }));
22255
+ }
22284
22256
  if (__privateGet(this, _probeOnly)) {
22285
22257
  __privateSet(this, _needsReconciliation, true);
22286
22258
  return __privateMethod(this, _WorkspaceSyncWork_instances, finish_fn2).call(this, create(SyncWorkspaceResponseSchema, {
@@ -22326,7 +22298,7 @@
22326
22298
  return __privateMethod(this, _WorkspaceSyncWork_instances, converge_fn2).call(this, __privateGet(this, _desiredHead), admission.resultPack.byteLength, 0);
22327
22299
  }
22328
22300
  if (__privateGet(this, _desiredHead) === __privateGet(this, _previousHead)) return __privateMethod(this, _WorkspaceSyncWork_instances, converge_fn2).call(this, __privateGet(this, _desiredHead), 0, 0);
22329
- if (!__privateMethod(this, _WorkspaceSyncWork_instances, establishBase_fn).call(this, __privateGet(this, _desiredHead))) return __privateMethod(this, _WorkspaceSyncWork_instances, noCommonBaseResult_fn).call(this);
22301
+ __privateMethod(this, _WorkspaceSyncWork_instances, establishBase_fn).call(this, __privateGet(this, _desiredHead));
22330
22302
  if (admission.recoveryRequired !== false) return __privateMethod(this, _WorkspaceSyncWork_instances, leaseEffect_fn).call(this);
22331
22303
  return __privateMethod(this, _WorkspaceSyncWork_instances, transportFailure_fn).call(this, "resident peer supplied neither the missing delta nor a history gap", false);
22332
22304
  };
@@ -22540,7 +22512,7 @@
22540
22512
  };
22541
22513
  converge_fn2 = function(candidateHead, receivedBytes, prefetchMillis) {
22542
22514
  var _a;
22543
- if (!__privateMethod(this, _WorkspaceSyncWork_instances, establishBase_fn).call(this, candidateHead)) return __privateMethod(this, _WorkspaceSyncWork_instances, noCommonBaseResult_fn).call(this);
22515
+ __privateMethod(this, _WorkspaceSyncWork_instances, establishBase_fn).call(this, candidateHead);
22544
22516
  (_a = __privateGet(this, _beforeConverge)) == null ? void 0 : _a.call(this, candidateHead, __privateGet(this, _previousHead));
22545
22517
  const convergeStarted = __privateGet(this, _clock13).monotonicNanoseconds();
22546
22518
  let judged;
@@ -25105,13 +25077,21 @@
25105
25077
  };
25106
25078
  observeSyncResult_fn = function(requestId, workId2, result) {
25107
25079
  const timings = result.timings;
25080
+ const receipt = result.offerReceipt?.outcome;
25081
+ const admission = receipt?.case === "admission" ? receipt.value : void 0;
25108
25082
  __privateGet(this, _events4).instant("peer.follow.sync-result", {
25109
25083
  request: create(RuntimeRequestSchema, { protocolVersion: 2, requestId }),
25110
25084
  workspace: result.workspace
25111
25085
  }, {
25112
25086
  "sync.workId": workId2,
25113
25087
  ...result.currentHead ? { "sync.head": result.currentHead } : {},
25088
+ ...result.previousHead ? { "sync.previousHead": result.previousHead } : {},
25089
+ ...admission?.main ? { "sync.providerHead": admission.main } : {},
25090
+ ...admission?.sealedMain ? { "sync.sealedHead": admission.sealedMain } : {},
25114
25091
  "sync.stillAhead": result.stillAhead,
25092
+ "sync.reconnectRequired": result.reconnectRequired,
25093
+ "sync.refused": result.refused,
25094
+ "sync.deferred": result.deferred,
25115
25095
  "sync.directOfferDeferred": result.directOfferDeferred,
25116
25096
  "sync.offline": result.offline,
25117
25097
  ...timings ? {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@githolon/runtime",
3
- "version": "0.110.1",
3
+ "version": "0.111.0",
4
4
  "type": "module",
5
5
  "description": "The portable Nomos application runtime, reception contracts, and Node/browser runners.",
6
6
  "license": "SEE LICENSE IN LICENSE.md",
@@ -23913,7 +23913,6 @@ var WorkspaceSyncPhase = Object.freeze({
23913
23913
  Done: "done"
23914
23914
  });
23915
23915
  var trackedMain = "refs/remotes/nomos/main";
23916
- var NO_COMMON_BASE = "this replica holds local history with no frontier its upstream ever confirmed; convergence needs a common admitted base \u2014 drop the local copy to refetch it, or re-discover a provider holding this lineage";
23917
23916
  var deferredRemote = "refs/remotes/nomos/deferred";
23918
23917
  var deferredLocal = "refs/nomos/sync-deferred-local";
23919
23918
  var judgedThisLifetime = /* @__PURE__ */ new Map();
@@ -24124,38 +24123,13 @@ var WorkspaceSyncWork = class {
24124
24123
  }), { case: "awaiting", requestId });
24125
24124
  }
24126
24125
  /**
24127
- * NO COMMON BASE — a round that cannot converge, and must not pay for history to find out.
24128
- *
24129
- * This replica holds a non-empty ledger but has never recorded a frontier its upstream
24130
- * confirmed (`refs/remotes/nomos/main` is absent). The kernel refuses convergence in that
24131
- * state ("a non-empty live ledger requires a common admitted base"), so every step after the
24132
- * O(1) frontier probe is wasted work — and it is not cheap waste: the fetch negotiates with
24133
- * no `have` (a full-history pack), and the dependency planner decodes EVERY intent from
24134
- * genesis and inspects every change, once per round. That is O(history) per follow round,
24135
- * repeated at every retry, for a round that can only end in a refusal.
24136
- *
24137
- * The one base this round can establish costs nothing and is established before this is
24138
- * asked: an upstream holding exactly this replica's head (the probe's answer) converges it
24139
- * and records the tracking frontier. Anything else needs the local copy to be dropped and
24140
- * refetched (an application decision, which preserves the copy), or a re-discovery that
24141
- * names a provider holding this lineage. Both are reported, at O(1), as this failure.
24142
- */
24143
- /**
24144
- * Establish this round's base when none is tracked, without walking any history it can avoid.
24145
- *
24146
- * The upstream just named its own frontier. If that commit is in THIS replica's lineage, it is
24147
- * a common admitted base by definition — both sides hold it — and adopting it turns the round
24148
- * into an ordinary fast-forward: the offer carries only the suffix above it, the fetch can name
24149
- * it as a truthful `have`, and convergence has the base the kernel requires. One commit walk
24150
- * (no change decoding, no pack, no network) decides it.
24151
- *
24152
- * If it is not in this replica's lineage, no base exists to establish and the round is refused
24153
- * (#noCommonBase) before it leases, fetches or plans anything.
24154
- *
24155
- * A kernel without the commit walk cannot be asked, so it keeps the previous behaviour.
24126
+ * Establish a cheap base when the provider's current tip is in our local chain.
24127
+ * A negative answer means the base is unknown: both sides may have advanced from
24128
+ * an earlier shared commit. Acquire the candidate and let the kernel discover
24129
+ * and judge that history. A tracking bookmark is not an admission prerequisite.
24156
24130
  */
24157
24131
  #establishBase(upstreamHead) {
24158
- if (!this.#noCommonBase() || !this.#kernel.historySummary) return true;
24132
+ if (!this.#missingTrackedBase() || !this.#kernel.historySummary) return true;
24159
24133
  const summary = this.#kernel.historySummary(this.#mount, this.#requestId, upstreamHead, this.#localHead);
24160
24134
  if (!summary.reachedBase) return false;
24161
24135
  this.#previousHead = upstreamHead;
@@ -24170,26 +24144,9 @@ var WorkspaceSyncWork = class {
24170
24144
  get establishedBase() {
24171
24145
  return this.#establishedBase;
24172
24146
  }
24173
- #noCommonBase() {
24147
+ #missingTrackedBase() {
24174
24148
  return this.#previousHead === void 0 && this.#localHead !== void 0 && this.#replaceLocalHead === void 0;
24175
24149
  }
24176
- #noCommonBaseResult() {
24177
- return this.#finish(create(SyncWorkspaceResponseSchema, {
24178
- workspace: this.#mount.workspace,
24179
- ...this.#localHead === void 0 ? {} : { currentHead: this.#localHead },
24180
- stillAhead: true,
24181
- ...this.#offerReceipt === void 0 ? {} : { offerReceipt: this.#offerReceipt },
24182
- pushError: create(RuntimeTransportFailureSchema, {
24183
- endpoint: this.#offerEndpoint(),
24184
- status: 409,
24185
- refused: true,
24186
- message: NO_COMMON_BASE
24187
- }),
24188
- timings: create(SyncPhaseTimingsSchema, {
24189
- convergeMillis: elapsedMillis(this.#clock, this.#started)
24190
- })
24191
- }));
24192
- }
24193
24150
  #holdsLocalWork() {
24194
24151
  return this.#command.admit && !!this.#localHead && this.#localHead !== this.#previousHead;
24195
24152
  }
@@ -24341,7 +24298,6 @@ var WorkspaceSyncWork = class {
24341
24298
  if (!this.#desiredHead) return this.#transportFailure("resident peer returned no admitted frontier", false);
24342
24299
  this.#candidateDurable = admission.sealedMain === this.#desiredHead;
24343
24300
  if (state.phase === WorkspaceSyncPhase.Probe && this.#desiredHead !== this.#localHead) {
24344
- if (!this.#establishBase(this.#desiredHead)) return this.#noCommonBaseResult();
24345
24301
  if (this.#alreadyJudged(this.#desiredHead)) {
24346
24302
  return this.#finish(create(SyncWorkspaceResponseSchema, {
24347
24303
  workspace: this.#mount.workspace,
@@ -24353,6 +24309,22 @@ var WorkspaceSyncWork = class {
24353
24309
  offerReceipt: this.#offerReceipt
24354
24310
  }));
24355
24311
  }
24312
+ if (!this.#establishBase(this.#desiredHead)) {
24313
+ this.#offerAfterConverge = this.#command.admit;
24314
+ this.#rebaseFrom = void 0;
24315
+ return this.#leaseEffect();
24316
+ }
24317
+ if (this.#establishedBase && !this.#candidateDurable && this.#kernel.resolveRef(this.#mount, this.#requestId, trackedMain) === void 0) {
24318
+ return this.#finish(create(SyncWorkspaceResponseSchema, {
24319
+ workspace: this.#mount.workspace,
24320
+ currentHead: this.#localHead,
24321
+ previousHead: this.#previousHead,
24322
+ stillAhead: true,
24323
+ directOfferDeferred: true,
24324
+ reconnectRequired: false,
24325
+ offerReceipt: this.#offerReceipt
24326
+ }));
24327
+ }
24356
24328
  if (this.#probeOnly) {
24357
24329
  this.#needsReconciliation = true;
24358
24330
  return this.#finish(create(SyncWorkspaceResponseSchema, {
@@ -24398,7 +24370,7 @@ var WorkspaceSyncWork = class {
24398
24370
  return this.#converge(this.#desiredHead, admission.resultPack.byteLength, 0);
24399
24371
  }
24400
24372
  if (this.#desiredHead === this.#previousHead) return this.#converge(this.#desiredHead, 0, 0);
24401
- if (!this.#establishBase(this.#desiredHead)) return this.#noCommonBaseResult();
24373
+ this.#establishBase(this.#desiredHead);
24402
24374
  if (admission.recoveryRequired !== false) return this.#leaseEffect();
24403
24375
  return this.#transportFailure("resident peer supplied neither the missing delta nor a history gap", false);
24404
24376
  }
@@ -24621,7 +24593,7 @@ var WorkspaceSyncWork = class {
24621
24593
  }
24622
24594
  }
24623
24595
  #converge(candidateHead, receivedBytes, prefetchMillis) {
24624
- if (!this.#establishBase(candidateHead)) return this.#noCommonBaseResult();
24596
+ this.#establishBase(candidateHead);
24625
24597
  this.#beforeConverge?.(candidateHead, this.#previousHead);
24626
24598
  const convergeStarted = this.#clock.monotonicNanoseconds();
24627
24599
  let judged;
@@ -27076,13 +27048,21 @@ var CorrespondenceDesk = class {
27076
27048
  }
27077
27049
  #observeSyncResult(requestId, workId2, result) {
27078
27050
  const timings = result.timings;
27051
+ const receipt = result.offerReceipt?.outcome;
27052
+ const admission = receipt?.case === "admission" ? receipt.value : void 0;
27079
27053
  this.#events.instant("peer.follow.sync-result", {
27080
27054
  request: create(RuntimeRequestSchema, { protocolVersion: 2, requestId }),
27081
27055
  workspace: result.workspace
27082
27056
  }, {
27083
27057
  "sync.workId": workId2,
27084
27058
  ...result.currentHead ? { "sync.head": result.currentHead } : {},
27059
+ ...result.previousHead ? { "sync.previousHead": result.previousHead } : {},
27060
+ ...admission?.main ? { "sync.providerHead": admission.main } : {},
27061
+ ...admission?.sealedMain ? { "sync.sealedHead": admission.sealedMain } : {},
27085
27062
  "sync.stillAhead": result.stillAhead,
27063
+ "sync.reconnectRequired": result.reconnectRequired,
27064
+ "sync.refused": result.refused,
27065
+ "sync.deferred": result.deferred,
27086
27066
  "sync.directOfferDeferred": result.directOfferDeferred,
27087
27067
  "sync.offline": result.offline,
27088
27068
  ...timings ? {