@shapeshift-labs/frontier-swarm 0.5.22 → 0.5.23

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/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { createRunDashboardSnapshot, createRunEdgeEvent, createRunEvent, createRunNodeEvent, defineRunArtifact, defineRunAttempt, defineRunDecision, defineRunEvidence, defineRunLane, defineRunPatch, defineRunTask, defineRunVerification, linkRunNodes, replayRunEvents } from '@shapeshift-labs/frontier-run';
2
+ import { acquireSemanticLease, createSemanticLeaseState, defineSemanticLeaseScope, validateSemanticLeaseFence } from '@shapeshift-labs/frontier-lease';
2
3
  export const FRONTIER_SWARM_MANIFEST_KIND = 'frontier.swarm.manifest';
3
4
  export const FRONTIER_SWARM_MANIFEST_VERSION = 1;
4
5
  export const FRONTIER_SWARM_TASK_KIND = 'frontier.swarm.task';
@@ -4075,6 +4076,11 @@ export function createSwarmHierarchicalMergeQueue(input) {
4075
4076
  const admissionPressure = summarizeSwarmMergeAdmissionPressure(assignments);
4076
4077
  const orderedScopes = Array.from(scopes.values()).sort((left, right) => (mergeQueueScopeRank(left.kind) - mergeQueueScopeRank(right.kind)
4077
4078
  || left.id.localeCompare(right.id)));
4079
+ const semanticLeaseScopeMap = createSwarmSemanticLeaseScopeMap(orderedScopes, {
4080
+ rootScopeId,
4081
+ ...semanticLeaseScopeOptionsFromMetadata(input.metadata)
4082
+ });
4083
+ const scopesWithSemanticLeases = orderedScopes.map((scope) => attachSemanticLeaseScopeToMergeQueueScope(scope, semanticLeaseScopeMap));
4078
4084
  const queueId = input.id ?? 'swarm-hierarchical-merge-queue:' + stableHash([input.index.id, input.admission?.id, orderedScopes, assignments, promotions, generatedAt]);
4079
4085
  const linkedAssignments = assignments.map((assignment) => {
4080
4086
  if (!coordinatorAgentDrainActionIsTerminal(assignment.action))
@@ -4084,19 +4090,19 @@ export function createSwarmHierarchicalMergeQueue(input) {
4084
4090
  terminalDecisionId: hierarchicalQueueTerminalDecisionId(queueId, assignment),
4085
4091
  terminalDecisionQueueItemIds: [...assignment.queueItemIds]
4086
4092
  };
4087
- });
4093
+ }).map((assignment) => attachSemanticLeaseScopesToAssignment(assignment, semanticLeaseScopeMap));
4088
4094
  const leaseRecords = createHierarchicalQueueLeaseRecords({
4089
4095
  queueId,
4090
4096
  rootScopeId,
4091
4097
  generatedAt,
4092
- scopes: orderedScopes,
4098
+ scopes: scopesWithSemanticLeases,
4093
4099
  assignments: linkedAssignments,
4094
4100
  promotions,
4095
4101
  localLeader: input.localLeader,
4096
4102
  localLeaders: input.localLeaders
4097
4103
  });
4098
4104
  const byLeaseKey = groupJobIdsByMany(linkedAssignments, (assignment) => assignment.requiredLeaseKeys ?? [assignment.leaseKey]);
4099
- const scopeTree = createHierarchicalQueueScopeTree(orderedScopes, rootScopeId);
4105
+ const scopeTree = createHierarchicalQueueScopeTree(scopesWithSemanticLeases, rootScopeId);
4100
4106
  return {
4101
4107
  kind: FRONTIER_SWARM_HIERARCHICAL_MERGE_QUEUE_KIND,
4102
4108
  version: FRONTIER_SWARM_HIERARCHICAL_MERGE_QUEUE_VERSION,
@@ -4106,13 +4112,14 @@ export function createSwarmHierarchicalMergeQueue(input) {
4106
4112
  generatedAt,
4107
4113
  rootScopeId,
4108
4114
  scopeTree,
4109
- scopes: orderedScopes,
4115
+ scopes: scopesWithSemanticLeases,
4110
4116
  leaseRecords,
4111
4117
  assignments: linkedAssignments,
4112
4118
  promotions,
4113
4119
  byScope,
4114
4120
  byLeaseKey,
4115
4121
  byAction,
4122
+ semanticLeaseScopes: uniqueSemanticLeaseScopes(Array.from(semanticLeaseScopeMap.values())),
4116
4123
  summary: {
4117
4124
  scopeCount: orderedScopes.length,
4118
4125
  assignmentCount: linkedAssignments.length,
@@ -4142,6 +4149,7 @@ export function createSwarmCoordinatorAgentDrainWork(input) {
4142
4149
  title: scope.title,
4143
4150
  leaseScope: scope.leaseKey,
4144
4151
  leaseKey: scope.leaseKey,
4152
+ ...(scope.semanticLeaseScope ? { semanticLeaseScope: scope.semanticLeaseScope } : {}),
4145
4153
  ...(scope.parentId ? { parentQueueId: scope.parentId } : {}),
4146
4154
  ...(scope.lane ? { lane: scope.lane } : {}),
4147
4155
  changedPaths: [...scope.changedPaths],
@@ -4171,6 +4179,9 @@ export function createSwarmCoordinatorAgentDrainWork(input) {
4171
4179
  const requiredLeaseKeys = assignmentRequiredLeaseKeys.length
4172
4180
  ? [...assignmentRequiredLeaseKeys]
4173
4181
  : [leaseScope];
4182
+ const requiredSemanticLeaseScopes = requiredLeaseScopeIds
4183
+ .map((scopeId) => scopesById.get(scopeId)?.semanticLeaseScope)
4184
+ .filter((scope) => Boolean(scope));
4174
4185
  const decision = coordinatorAgentDrainDecisionForAction(assignment.action);
4175
4186
  const terminal = coordinatorAgentDrainActionIsTerminal(assignment.action);
4176
4187
  const parentQueueId = assignment.action === 'promote'
@@ -4207,6 +4218,7 @@ export function createSwarmCoordinatorAgentDrainWork(input) {
4207
4218
  conflictingJobIds: [...assignment.conflictingJobIds],
4208
4219
  requiredLeaseScopeIds,
4209
4220
  requiredLeaseKeys,
4221
+ ...(requiredSemanticLeaseScopes.length ? { requiredSemanticLeaseScopes } : {}),
4210
4222
  ...(assignment.retrySlices?.length ? { retrySlices: cloneMergeQueueRetrySlices(assignment.retrySlices) } : {}),
4211
4223
  ...(assignment.semanticSliceScopeIds?.length ? { semanticSliceScopeIds: [...assignment.semanticSliceScopeIds] } : {}),
4212
4224
  ...(assignment.semanticSliceLeaseKeys?.length ? { semanticSliceLeaseKeys: [...assignment.semanticSliceLeaseKeys] } : {}),
@@ -4231,6 +4243,7 @@ export function createSwarmCoordinatorAgentDrainWork(input) {
4231
4243
  reasons: [...assignment.reasons],
4232
4244
  requiredLeaseScopeIds: [...(assignment.requiredLeaseScopeIds ?? [])],
4233
4245
  requiredLeaseKeys: [...(assignment.requiredLeaseKeys ?? [])],
4246
+ ...(assignment.requiredSemanticLeaseScopes?.length ? { requiredSemanticLeaseScopes: assignment.requiredSemanticLeaseScopes.map(cloneSemanticLeaseScope) } : {}),
4234
4247
  ...(assignment.retrySlices?.length ? { retrySlices: cloneMergeQueueRetrySlices(assignment.retrySlices) } : {}),
4235
4248
  ...(assignment.semanticSliceScopeIds?.length ? { semanticSliceScopeIds: [...assignment.semanticSliceScopeIds] } : {}),
4236
4249
  ...(assignment.semanticSliceLeaseKeys?.length ? { semanticSliceLeaseKeys: [...assignment.semanticSliceLeaseKeys] } : {}),
@@ -4257,6 +4270,7 @@ export function createSwarmCoordinatorAgentDrainWork(input) {
4257
4270
  reasons: [...assignment.reasons],
4258
4271
  requiredLeaseScopeIds: [...(assignment.requiredLeaseScopeIds ?? [])],
4259
4272
  requiredLeaseKeys: [...(assignment.requiredLeaseKeys ?? [])],
4273
+ ...(assignment.requiredSemanticLeaseScopes?.length ? { requiredSemanticLeaseScopes: assignment.requiredSemanticLeaseScopes.map(cloneSemanticLeaseScope) } : {}),
4260
4274
  ...(assignment.metadata ? { metadata: cloneJsonValue(assignment.metadata) } : {})
4261
4275
  }));
4262
4276
  const activeAssignments = assignments.filter((assignment) => !coordinatorAgentDrainAssignmentIsTerminal(assignment));
@@ -4314,6 +4328,120 @@ export function createSwarmCoordinatorAgentDrainWork(input) {
4314
4328
  ...(toJsonObject(input.metadata) ? { metadata: toJsonObject(input.metadata) } : {})
4315
4329
  };
4316
4330
  }
4331
+ export function createSwarmSemanticLeaseScopeForMergeQueueScope(scope, input = {}) {
4332
+ const scopesById = new Map((input.scopes ?? []).map((entry) => [entry.id, entry]));
4333
+ const parentKeys = [];
4334
+ let parentId = scope.parentId;
4335
+ const visited = new Set([scope.id]);
4336
+ while (parentId && !visited.has(parentId)) {
4337
+ const parent = scopesById.get(parentId);
4338
+ if (!parent)
4339
+ break;
4340
+ parentKeys.push(parent.leaseKey);
4341
+ visited.add(parentId);
4342
+ parentId = parent.parentId;
4343
+ }
4344
+ const regionId = scope.changedRegions.length === 1 ? scope.changedRegions[0] : scope.id;
4345
+ const path = scope.changedPaths.length === 1 ? scope.changedPaths[0] : undefined;
4346
+ const metadata = mergeSwarmMetadata([
4347
+ scope.metadata,
4348
+ toJsonObject(input.metadata),
4349
+ {
4350
+ swarmQueueScopeId: scope.id,
4351
+ swarmQueueScopeKind: scope.kind,
4352
+ swarmLeaseKey: scope.leaseKey,
4353
+ changedPaths: scope.changedPaths,
4354
+ changedRegions: scope.changedRegions
4355
+ }
4356
+ ]);
4357
+ return defineSemanticLeaseScope({
4358
+ kind: semanticLeaseScopeKindForMergeQueueScope(scope),
4359
+ key: scope.leaseKey,
4360
+ repository: input.repository,
4361
+ packageId: input.packageId,
4362
+ lane: scope.lane,
4363
+ path,
4364
+ regionId,
4365
+ name: semanticLeaseScopeNameForMergeQueueScope(scope),
4366
+ parentKeys,
4367
+ metadata
4368
+ });
4369
+ }
4370
+ export function createSwarmSemanticLeaseScopesForMergeQueue(queue, input = {}) {
4371
+ const existing = queue.scopes
4372
+ .map((scope) => scope.semanticLeaseScope)
4373
+ .filter((scope) => Boolean(scope));
4374
+ if (existing.length)
4375
+ return uniqueSemanticLeaseScopes(existing);
4376
+ return uniqueSemanticLeaseScopes(queue.scopes.map((scope) => (createSwarmSemanticLeaseScopeForMergeQueueScope(scope, {
4377
+ ...input,
4378
+ rootScopeId: input.rootScopeId ?? queue.rootScopeId,
4379
+ scopes: queue.scopes
4380
+ }))));
4381
+ }
4382
+ export function createSwarmSemanticLeaseStateForMergeQueue(queue, input = {}) {
4383
+ const semanticLeaseScopes = createSwarmSemanticLeaseScopesForMergeQueue(queue, input);
4384
+ return createSemanticLeaseState({
4385
+ id: input.id ?? `frontier-swarm-merge-queue:${queue.id}`,
4386
+ defaultTtlMs: input.defaultTtlMs,
4387
+ metadata: mergeSwarmMetadata([
4388
+ toJsonObject(input.metadata),
4389
+ {
4390
+ swarmQueueId: queue.id,
4391
+ swarmMergeIndexId: queue.mergeIndexId,
4392
+ rootScopeId: queue.rootScopeId,
4393
+ semanticLeaseScopeCount: semanticLeaseScopes.length,
4394
+ generatedAt: input.now ?? queue.generatedAt
4395
+ }
4396
+ ])
4397
+ });
4398
+ }
4399
+ export function acquireSwarmCoordinatorSemanticLease(input) {
4400
+ const scopes = semanticLeaseScopesForCoordinatorAssignment(input.queue, input.assignment, input);
4401
+ const requiredLeaseScopeIds = coordinatorAssignmentRequiredLeaseScopeIds(input.assignment);
4402
+ const requiredLeaseKeys = coordinatorAssignmentRequiredLeaseKeys(input.assignment, scopes);
4403
+ const state = input.state ?? createSwarmSemanticLeaseStateForMergeQueue(input.queue, input);
4404
+ const acquireInput = {
4405
+ ownerId: input.ownerId,
4406
+ holderId: input.holderId,
4407
+ now: input.now,
4408
+ ttlMs: input.ttlMs,
4409
+ purpose: input.purpose ?? `frontier swarm coordinator apply: ${input.assignment.jobId}`,
4410
+ reason: input.reason,
4411
+ scopes,
4412
+ metadata: mergeSwarmMetadata([
4413
+ toJsonObject(input.metadata),
4414
+ {
4415
+ swarmQueueId: input.queue.id,
4416
+ swarmJobId: input.assignment.jobId,
4417
+ swarmTaskId: input.assignment.taskId,
4418
+ requiredLeaseScopeIds,
4419
+ requiredLeaseKeys
4420
+ }
4421
+ ])
4422
+ };
4423
+ const mutation = acquireSemanticLease(state, acquireInput);
4424
+ return {
4425
+ state: mutation.state,
4426
+ mutation,
4427
+ scopes,
4428
+ requiredLeaseScopeIds,
4429
+ requiredLeaseKeys,
4430
+ ...(mutation.lease ? { lease: mutation.lease } : {})
4431
+ };
4432
+ }
4433
+ export function validateSwarmCoordinatorSemanticLeaseFence(input) {
4434
+ const requiredScopes = input.requiredSemanticLeaseScopes?.length
4435
+ ? input.requiredSemanticLeaseScopes.map(cloneSemanticLeaseScope)
4436
+ : (input.assignment.requiredSemanticLeaseScopes ?? []).map(cloneSemanticLeaseScope);
4437
+ return validateSemanticLeaseFence(input.state, {
4438
+ leaseId: input.leaseId ?? input.lease?.id ?? '',
4439
+ token: input.token,
4440
+ fencingToken: input.fencingToken,
4441
+ now: input.now,
4442
+ scopes: requiredScopes.length ? requiredScopes : undefined
4443
+ });
4444
+ }
4317
4445
  export function summarizeSwarmCoordinatorAgentDrainWork(work) {
4318
4446
  const activeAssignments = work.assignments.filter((assignment) => !coordinatorAgentDrainAssignmentIsTerminal(assignment));
4319
4447
  const terminalAssignments = work.assignments.filter((assignment) => coordinatorAgentDrainAssignmentIsTerminal(assignment));
@@ -5888,6 +6016,154 @@ function ensureMergeQueueScope(scopes, input) {
5888
6016
  scopes.set(scope.id, scope);
5889
6017
  return scope;
5890
6018
  }
6019
+ function createSwarmSemanticLeaseScopeMap(scopes, input = {}) {
6020
+ const out = new Map();
6021
+ for (const scope of scopes) {
6022
+ out.set(scope.id, createSwarmSemanticLeaseScopeForMergeQueueScope(scope, { ...input, scopes }));
6023
+ }
6024
+ return out;
6025
+ }
6026
+ function attachSemanticLeaseScopeToMergeQueueScope(scope, semanticLeaseScopes) {
6027
+ const semanticLeaseScope = semanticLeaseScopes.get(scope.id);
6028
+ return {
6029
+ ...scope,
6030
+ ...(semanticLeaseScope ? { semanticLeaseScope: cloneSemanticLeaseScope(semanticLeaseScope) } : {})
6031
+ };
6032
+ }
6033
+ function attachSemanticLeaseScopesToAssignment(assignment, semanticLeaseScopes) {
6034
+ const requiredLeaseScopeIds = assignment.requiredLeaseScopeIds?.length ? assignment.requiredLeaseScopeIds : [assignment.scopeId];
6035
+ const requiredSemanticLeaseScopes = requiredLeaseScopeIds
6036
+ .map((scopeId) => semanticLeaseScopes.get(scopeId))
6037
+ .filter((scope) => Boolean(scope))
6038
+ .map(cloneSemanticLeaseScope);
6039
+ const retrySlices = assignment.retrySlices?.map((slice) => {
6040
+ const requiredScopeIds = slice.requiredLeaseScopeIds?.length ? slice.requiredLeaseScopeIds : [slice.scopeId];
6041
+ const requiredScopes = requiredScopeIds
6042
+ .map((scopeId) => semanticLeaseScopes.get(scopeId))
6043
+ .filter((scope) => Boolean(scope))
6044
+ .map(cloneSemanticLeaseScope);
6045
+ const semanticLeaseScope = semanticLeaseScopes.get(slice.scopeId);
6046
+ return {
6047
+ ...slice,
6048
+ ...(semanticLeaseScope ? { semanticLeaseScope: cloneSemanticLeaseScope(semanticLeaseScope) } : {}),
6049
+ ...(requiredScopes.length ? { requiredSemanticLeaseScopes: requiredScopes } : {})
6050
+ };
6051
+ });
6052
+ return {
6053
+ ...assignment,
6054
+ ...(requiredSemanticLeaseScopes.length ? { requiredSemanticLeaseScopes } : {}),
6055
+ ...(retrySlices?.length ? { retrySlices } : {})
6056
+ };
6057
+ }
6058
+ function semanticLeaseScopesForCoordinatorAssignment(queue, assignment, input = {}) {
6059
+ if (assignment.requiredSemanticLeaseScopes?.length) {
6060
+ return uniqueSemanticLeaseScopes(assignment.requiredSemanticLeaseScopes.map(cloneSemanticLeaseScope));
6061
+ }
6062
+ const queueScopes = new Map(queue.scopes.map((scope) => [scope.id, scope]));
6063
+ const semanticByKey = new Map(createSwarmSemanticLeaseScopesForMergeQueue(queue, input).map((scope) => [scope.key, scope]));
6064
+ const fromIds = coordinatorAssignmentRequiredLeaseScopeIds(assignment)
6065
+ .map((scopeId) => queueScopes.get(scopeId)?.semanticLeaseScope)
6066
+ .filter((scope) => Boolean(scope));
6067
+ if (fromIds.length)
6068
+ return uniqueSemanticLeaseScopes(fromIds);
6069
+ const fromKeys = coordinatorAssignmentRequiredLeaseKeys(assignment, [])
6070
+ .map((key) => semanticByKey.get(key))
6071
+ .filter((scope) => Boolean(scope));
6072
+ if (fromKeys.length)
6073
+ return uniqueSemanticLeaseScopes(fromKeys);
6074
+ const fallbackKey = 'leaseScope' in assignment ? assignment.leaseScope : assignment.leaseKey;
6075
+ return [defineSemanticLeaseScope({
6076
+ kind: 'custom',
6077
+ key: fallbackKey,
6078
+ repository: input.repository,
6079
+ packageId: input.packageId,
6080
+ metadata: mergeSwarmMetadata([
6081
+ toJsonObject(input.metadata),
6082
+ {
6083
+ swarmQueueId: queue.id,
6084
+ swarmJobId: assignment.jobId,
6085
+ fallbackLeaseKey: fallbackKey
6086
+ }
6087
+ ])
6088
+ })];
6089
+ }
6090
+ function coordinatorAssignmentRequiredLeaseScopeIds(assignment) {
6091
+ const explicit = assignment.requiredLeaseScopeIds ?? [];
6092
+ if (explicit.length)
6093
+ return uniqueStrings(explicit);
6094
+ return uniqueStrings(['queueId' in assignment ? assignment.queueId : assignment.scopeId]);
6095
+ }
6096
+ function coordinatorAssignmentRequiredLeaseKeys(assignment, scopes) {
6097
+ const explicit = assignment.requiredLeaseKeys ?? [];
6098
+ if (explicit.length)
6099
+ return uniqueStrings(explicit);
6100
+ if (scopes.length)
6101
+ return uniqueStrings(scopes.map((scope) => scope.key));
6102
+ return uniqueStrings(['leaseScope' in assignment ? assignment.leaseScope : assignment.leaseKey]);
6103
+ }
6104
+ function semanticLeaseScopeOptionsFromMetadata(metadata) {
6105
+ const object = toJsonObject(metadata);
6106
+ if (!object)
6107
+ return {};
6108
+ return {
6109
+ ...(typeof object.repository === 'string' ? { repository: object.repository } : {}),
6110
+ ...(typeof object.packageId === 'string' ? { packageId: object.packageId } : {})
6111
+ };
6112
+ }
6113
+ function semanticLeaseScopeKindForMergeQueueScope(scope) {
6114
+ if (scope.kind === 'root')
6115
+ return 'repository';
6116
+ if (scope.kind === 'path')
6117
+ return 'path';
6118
+ if (scope.kind === 'lane')
6119
+ return 'lane';
6120
+ if (scope.kind === 'semantic-region' || scope.kind === 'semantic')
6121
+ return semanticLeaseScopeKindForRegion(scope.changedRegions[0]);
6122
+ if (scope.kind === 'package')
6123
+ return 'package';
6124
+ return 'custom';
6125
+ }
6126
+ function semanticLeaseScopeKindForRegion(region) {
6127
+ if (!region)
6128
+ return 'semantic-region';
6129
+ const normalized = region.toLowerCase();
6130
+ if (normalized.includes(FRONTIER_SWARM_SEMANTIC_OWNERSHIP_EXPORT_STABLE_KEY_KIND) || normalized.includes('named-export') || normalized.includes('default-export'))
6131
+ return 'export';
6132
+ if (normalized.includes(FRONTIER_SWARM_SEMANTIC_OWNERSHIP_TYPE_STABLE_KEY_KIND) || normalized.includes('interface') || normalized.includes('type-alias'))
6133
+ return 'type';
6134
+ if (normalized.includes(FRONTIER_SWARM_SEMANTIC_OWNERSHIP_CLI_COMMAND_STABLE_KEY_KIND))
6135
+ return 'cli-command';
6136
+ if (normalized.includes(FRONTIER_SWARM_SEMANTIC_OWNERSHIP_DOCS_SECTION_STABLE_KEY_KIND))
6137
+ return 'docs-section';
6138
+ if (normalized.includes(FRONTIER_SWARM_SEMANTIC_OWNERSHIP_FIXTURE_FAMILY_STABLE_KEY_KIND))
6139
+ return 'test-fixture';
6140
+ if (normalized.includes(FRONTIER_SWARM_SEMANTIC_OWNERSHIP_TEST_CASE_STABLE_KEY_KIND))
6141
+ return 'test-fixture';
6142
+ if (normalized.includes('function'))
6143
+ return 'function';
6144
+ if (normalized.includes('class'))
6145
+ return 'class';
6146
+ if (normalized.includes('member'))
6147
+ return 'member';
6148
+ return 'semantic-region';
6149
+ }
6150
+ function semanticLeaseScopeNameForMergeQueueScope(scope) {
6151
+ const region = scope.changedRegions[0];
6152
+ if (region)
6153
+ return region.split(':').filter(Boolean).at(-1);
6154
+ if (scope.changedPaths.length === 1)
6155
+ return scope.changedPaths[0].split('/').at(-1);
6156
+ return scope.title || scope.id;
6157
+ }
6158
+ function uniqueSemanticLeaseScopes(scopes) {
6159
+ const out = new Map();
6160
+ for (const scope of scopes)
6161
+ out.set(scope.key, cloneSemanticLeaseScope(scope));
6162
+ return Array.from(out.values()).sort((left, right) => left.key.localeCompare(right.key));
6163
+ }
6164
+ function cloneSemanticLeaseScope(scope) {
6165
+ return cloneJsonValue(scope);
6166
+ }
5891
6167
  function mergeQueueRootLeaseKey(rootScopeId) {
5892
6168
  return `merge:root:${rootScopeId}`;
5893
6169
  }
@@ -6002,6 +6278,8 @@ function cloneMergeQueueRetrySlices(slices) {
6002
6278
  leaseKey: slice.leaseKey,
6003
6279
  ...(slice.requiredLeaseScopeIds?.length ? { requiredLeaseScopeIds: [...slice.requiredLeaseScopeIds] } : {}),
6004
6280
  ...(slice.requiredLeaseKeys?.length ? { requiredLeaseKeys: [...slice.requiredLeaseKeys] } : {}),
6281
+ ...(slice.semanticLeaseScope ? { semanticLeaseScope: cloneSemanticLeaseScope(slice.semanticLeaseScope) } : {}),
6282
+ ...(slice.requiredSemanticLeaseScopes?.length ? { requiredSemanticLeaseScopes: slice.requiredSemanticLeaseScopes.map(cloneSemanticLeaseScope) } : {}),
6005
6283
  ...(slice.lane ? { lane: slice.lane } : {}),
6006
6284
  changedPaths: [...slice.changedPaths],
6007
6285
  changedRegions: [...slice.changedRegions],
@@ -6051,6 +6329,7 @@ function createHierarchicalQueueLeaseRecords(input) {
6051
6329
  ...(scope.lane ? { lane: scope.lane } : {}),
6052
6330
  title: scope.title,
6053
6331
  leaseKey: scope.leaseKey,
6332
+ ...(scope.semanticLeaseScope ? { semanticLeaseScope: cloneSemanticLeaseScope(scope.semanticLeaseScope) } : {}),
6054
6333
  ...(hierarchicalQueueLocalLeaderForScope(input, scope) ? { localLeader: hierarchicalQueueLocalLeaderForScope(input, scope) } : {}),
6055
6334
  promotion: {
6056
6335
  state: promotionState,