@neocompose/cli 0.22.5 → 0.22.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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.22.6] - 2026-08-05
4
+
5
+ ### Fixed
6
+
7
+ - Normal pull ignores compiler-derived NeoScript body differences and clears
8
+ stale conflict bookkeeping when authored source already matches Production.
9
+ - Required-constructor replay compiles nested generic initializer rows without
10
+ mutating authored source payloads, including immutable animation defaults.
11
+ - Large constructor replays reuse project indexes and an immutable persisted
12
+ snapshot, keeping Neowyn push dry-runs in seconds rather than minutes.
13
+
3
14
  ## [0.22.5] - 2026-08-04
4
15
 
5
16
  ### Fixed
package/dist/neo.mjs CHANGED
@@ -40934,7 +40934,11 @@ function evaluateLiteralContainer(args) {
40934
40934
  `Cannot materialize member "${args.member.name}": its value is a NeoScript initializer, which this builder cannot evaluate. Supply an initEvaluator.`
40935
40935
  );
40936
40936
  }
40937
- const evaluated = args.initEvaluator(args.member, body.init);
40937
+ const evaluated = args.initEvaluator(
40938
+ args.member,
40939
+ body.init,
40940
+ args.sourceValueId
40941
+ );
40938
40942
  return {
40939
40943
  literal: {
40940
40944
  value: evaluated.value,
@@ -41292,7 +41296,8 @@ function cloneDefaultValueForMember(args) {
41292
41296
  const evaluated = evaluateLiteralContainer({
41293
41297
  body: sourceValue,
41294
41298
  member,
41295
- initEvaluator: args.initEvaluator
41299
+ initEvaluator: args.initEvaluator,
41300
+ sourceValueId: args.sourceValueId
41296
41301
  });
41297
41302
  if (evaluated === void 0) {
41298
41303
  throw new Error(
@@ -54223,14 +54228,18 @@ var init_NSGetterRuntimeError = __esm({
54223
54228
  }
54224
54229
  };
54225
54230
  UncompiledInitializerRuntimeError = class extends NSGetterRuntimeError {
54226
- constructor(memberId, memberName) {
54231
+ constructor(memberId, memberName, initializer = null, valueId = null) {
54227
54232
  super(
54228
54233
  `Initializer for '${memberName}' has no compiled body; push the project so the server compiles it.`
54229
54234
  );
54230
54235
  this.memberId = memberId;
54236
+ this.initializer = initializer;
54237
+ this.valueId = valueId;
54231
54238
  this.name = "UncompiledInitializerRuntimeError";
54232
54239
  }
54233
54240
  memberId;
54241
+ initializer;
54242
+ valueId;
54234
54243
  };
54235
54244
  }
54236
54245
  });
@@ -55356,6 +55365,14 @@ function trackedRowForValueReference(value, ctx) {
55356
55365
  const indexes = evaluatorIndexes(ctx);
55357
55366
  return indexes.rowByValueReference.get(value) ?? indexes.baseRowByValueReference?.get(value) ?? null;
55358
55367
  }
55368
+ function assertStoredReplayMutableValue(value, ctx, label) {
55369
+ if (ctx.storedConstructionReplay !== true) return;
55370
+ const row = trackedRowForValueReference(value, ctx);
55371
+ if (row === null || ctx.__runtimeSessionValues?.has(row.id) === true) return;
55372
+ throw new NSGetterRuntimeError(
55373
+ `Stored construction replay cannot mutate persisted ${label}.`
55374
+ );
55375
+ }
55359
55376
  function pushConstructionFrame(ctx, label) {
55360
55377
  const state = ctx.__executionState;
55361
55378
  if (state === void 0) {
@@ -55520,7 +55537,7 @@ function withEvaluationRuntime(ctx, writes) {
55520
55537
  if (ctx.__runtimeSessionValues !== void 0 && ctx.__executionState !== void 0 && ctx.__valueOverlay !== void 0) {
55521
55538
  return ctx;
55522
55539
  }
55523
- const overlay = ctx.__valueOverlay ?? buildValueOverlay(ctx.vm);
55540
+ const overlay = ctx.__valueOverlay ?? (ctx.storedConstructionReplay === true ? /* @__PURE__ */ new Map() : buildValueOverlay(ctx.vm));
55524
55541
  const referenceRemap = ctx.__runtimeReferenceRemap ?? /* @__PURE__ */ new Map();
55525
55542
  const runtimeReferences = runtimeSessionValueReferences(
55526
55543
  ctx.__runtimeSessionValues
@@ -56528,6 +56545,11 @@ function evalInstructions(instructions, scope, ctx, options) {
56528
56545
  }
56529
56546
  function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx) {
56530
56547
  if (target.type === "staticMember" /* staticMember */) {
56548
+ if (ctx.storedConstructionReplay === true) {
56549
+ throw new NSGetterRuntimeError(
56550
+ "Stored construction replay cannot assign persisted static values."
56551
+ );
56552
+ }
56531
56553
  applyOverlayStaticAssignment(target.memberId, value, ctx);
56532
56554
  return;
56533
56555
  }
@@ -56537,6 +56559,7 @@ function applyOverlayAssignment(target, targetTypeInfo, value, scope, ctx) {
56537
56559
  );
56538
56560
  }
56539
56561
  const receiver = evalPointer(target.keyOf.pointer, scope, ctx);
56562
+ assertStoredReplayMutableValue(receiver, ctx, "assignment target");
56540
56563
  const key = evalPointer(target.keyOf.key, scope, ctx);
56541
56564
  const referenceValueId = targetTypeInfo.type === 7 /* Class */ || targetTypeInfo.type === 6 /* List */ || targetTypeInfo.type === 5 /* Dictionary */ ? findKnownRowIdByValueReference(value, ctx) : null;
56542
56565
  if (Array.isArray(receiver)) {
@@ -56845,6 +56868,11 @@ function resolveCompiledSetter(memberId, ctx) {
56845
56868
  }
56846
56869
  function evalCollectionMutationInstruction(ins, scope, ctx, options) {
56847
56870
  if (ins.target.pointer.type === "staticMember" /* staticMember */) {
56871
+ if (ctx.storedConstructionReplay === true) {
56872
+ throw new NSGetterRuntimeError(
56873
+ "Stored construction replay cannot mutate persisted static collections."
56874
+ );
56875
+ }
56848
56876
  const member = evalMemberById(ctx.vm, ins.target.pointer.memberId);
56849
56877
  if (member === null) {
56850
56878
  throw new NSGetterRuntimeError(
@@ -56854,6 +56882,13 @@ function evalCollectionMutationInstruction(ins, scope, ctx, options) {
56854
56882
  writableStaticBindingMap(member, ctx);
56855
56883
  }
56856
56884
  const targetValue = evalPointer(ins.target.pointer, scope, ctx);
56885
+ if (ins.target.pointer.type !== "variable" /* variable */) {
56886
+ assertStoredReplayMutableValue(
56887
+ targetValue,
56888
+ ctx,
56889
+ "collection mutation target"
56890
+ );
56891
+ }
56857
56892
  const args = ins.args.map((arg) => evalPointer(arg, scope, ctx));
56858
56893
  const isLookupSet = ins.target.typeInfo.type === 9 /* Lookup */;
56859
56894
  if (ins.mutation === "Add" /* Add */) {
@@ -59089,7 +59124,7 @@ function validateClassConstructorDescriptor(info, ctx, requireEveryRequiredField
59089
59124
  `Cannot construct abstract Class '${schemaClass2.name}'.`
59090
59125
  );
59091
59126
  }
59092
- const replaySlot = ctx.__storedConstructionReplaySlot;
59127
+ const replaySlot = ctx.__storedConstructionReplayNestedSlots?.toReversed().find((slot) => slot.classId === classId) ?? ctx.__storedConstructionReplaySlot;
59093
59128
  const classArguments2 = replaySlot?.classId === classId ? replaySlot.classArguments : void 0;
59094
59129
  const instanceEnv = resolveInstanceEnv(
59095
59130
  classId,
@@ -59938,9 +59973,41 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
59938
59973
  }
59939
59974
  return null;
59940
59975
  };
59941
- return (member, init) => {
59976
+ return (member, init, sourceValueId) => {
59977
+ const evaluate = (argumentValues = []) => {
59978
+ if (ctx.storedConstructionReplay !== true || !isMemberClassBase(member) || Object.keys(member.classArguments ?? {}).length === 0) {
59979
+ return evaluateInitializerInContext(
59980
+ init,
59981
+ member,
59982
+ ctx,
59983
+ createdValues,
59984
+ argumentValues,
59985
+ sourceValueId ?? null
59986
+ );
59987
+ }
59988
+ const previousSlots = ctx.__storedConstructionReplayNestedSlots;
59989
+ ctx.__storedConstructionReplayNestedSlots = [
59990
+ ...previousSlots ?? [],
59991
+ {
59992
+ classId: member.classId,
59993
+ classArguments: member.classArguments ?? {}
59994
+ }
59995
+ ];
59996
+ try {
59997
+ return evaluateInitializerInContext(
59998
+ init,
59999
+ member,
60000
+ ctx,
60001
+ createdValues,
60002
+ argumentValues,
60003
+ sourceValueId ?? null
60004
+ );
60005
+ } finally {
60006
+ ctx.__storedConstructionReplayNestedSlots = previousSlots;
60007
+ }
60008
+ };
59942
60009
  if (init.compiled === void 0) {
59943
- return evaluateInitializerInContext(init, member, ctx, createdValues);
60010
+ return evaluate();
59944
60011
  }
59945
60012
  const memberId = Reflect.get(member, "id");
59946
60013
  const scopeMemberId = indexes.initializerScopeMemberIds.get(init) ?? (typeof memberId === "string" ? memberId : "");
@@ -59952,12 +60019,12 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
59952
60019
  `Member initializer '${member.name}' has ${expectedArgumentCount} constructor parameter(s), but its declaring class scope could not be resolved.`
59953
60020
  );
59954
60021
  }
59955
- return evaluateInitializerInContext(init, member, ctx, createdValues);
60022
+ return evaluate();
59956
60023
  }
59957
60024
  const scopedArguments = argumentScopes.valuesByClassId.get(ownerClassId);
59958
60025
  if (scopedArguments === void 0) {
59959
60026
  if (expectedArgumentCount === 0) {
59960
- return evaluateInitializerInContext(init, member, ctx, createdValues);
60027
+ return evaluate();
59961
60028
  }
59962
60029
  if (argumentScopes.missingScopeReason === "no-constructor") {
59963
60030
  throw new NSGetterRuntimeError(
@@ -59973,13 +60040,7 @@ function constructionInitEvaluator(ctx, createdValues, argumentScopes, construct
59973
60040
  `Member initializer '${member.name}' on '${ownerClassId}' expected ${expectedArgumentCount} constructor argument(s), got ${scopedArguments.length}.`
59974
60041
  );
59975
60042
  }
59976
- return evaluateInitializerInContext(
59977
- init,
59978
- member,
59979
- ctx,
59980
- createdValues,
59981
- scopedArguments
59982
- );
60043
+ return evaluate(scopedArguments);
59983
60044
  };
59984
60045
  }
59985
60046
  function constructorInitializerIndexes(ctx) {
@@ -60094,14 +60155,16 @@ function runtimeValueReferencesVariable(value, variableId, visited = /* @__PURE_
60094
60155
  (child) => runtimeValueReferencesVariable(child, variableId, visited)
60095
60156
  );
60096
60157
  }
60097
- function evaluateInitializerInContext(init, member, ctx, createdValues, argumentValues = []) {
60158
+ function evaluateInitializerInContext(init, member, ctx, createdValues, argumentValues = [], sourceValueId = null) {
60098
60159
  ctx.__constructedArgumentsByValue ??= /* @__PURE__ */ new WeakMap();
60099
60160
  const compiled = init.compiled;
60100
60161
  if (compiled === void 0) {
60101
60162
  const memberId = Reflect.get(member, "id");
60102
60163
  throw new UncompiledInitializerRuntimeError(
60103
60164
  typeof memberId === "string" ? memberId : null,
60104
- member.name
60165
+ member.name,
60166
+ init,
60167
+ sourceValueId
60105
60168
  );
60106
60169
  }
60107
60170
  const closeFrame = pushConstructionFrame(ctx, `${member.name} initializer`);
@@ -61547,7 +61610,8 @@ function evaluateMemberInitializer(args) {
61547
61610
  if (compiled === void 0) {
61548
61611
  throw new UncompiledInitializerRuntimeError(
61549
61612
  typeof Reflect.get(args.member, "id") === "string" ? Reflect.get(args.member, "id") : null,
61550
- args.member.name
61613
+ args.member.name,
61614
+ args.init
61551
61615
  );
61552
61616
  }
61553
61617
  const ctx = {
@@ -69871,7 +69935,7 @@ function materializedInitializerReconciliationFailuresV4(args) {
69871
69935
  candidateValueIds
69872
69936
  );
69873
69937
  const currentRecords = reconciliationRecords(args.workspace, []);
69874
- const cachedExpressions = readMaterializedConstructionBuildCacheV1(
69938
+ const cachedExpressions = args.useBuildCaches === false ? null : readMaterializedConstructionBuildCacheV1(
69875
69939
  args.workspace.root,
69876
69940
  args.workspace.state
69877
69941
  );
@@ -69895,11 +69959,13 @@ function materializedInitializerReconciliationFailuresV4(args) {
69895
69959
  )) {
69896
69960
  canonicalExpressions.set(valueId, expression);
69897
69961
  }
69898
- writeMaterializedConstructionBuildCacheV1(
69899
- args.workspace.root,
69900
- args.workspace.state,
69901
- canonicalExpressions
69902
- );
69962
+ if (args.useBuildCaches !== false) {
69963
+ writeMaterializedConstructionBuildCacheV1(
69964
+ args.workspace.root,
69965
+ args.workspace.state,
69966
+ canonicalExpressions
69967
+ );
69968
+ }
69903
69969
  }
69904
69970
  }
69905
69971
  const replayableValueIds = /* @__PURE__ */ new Set();
@@ -69913,7 +69979,7 @@ function materializedInitializerReconciliationFailuresV4(args) {
69913
69979
  }
69914
69980
  }
69915
69981
  const owners = resolveOwnerMembersForValues(document, replayableValueIds);
69916
- const compilationProject = replayableValueIds.size === 0 ? void 0 : loadOrBuildNeoScriptProjectV1(args.workspace.root, document);
69982
+ const compilationProject = replayableValueIds.size === 0 ? void 0 : args.useBuildCaches === false ? createNeoScriptCompilationProject(document) : loadOrBuildNeoScriptProjectV1(args.workspace.root, document);
69917
69983
  const failures = [];
69918
69984
  for (const reconciliation of args.reconciliations.values()) {
69919
69985
  if (reconciliation.storedConstructorArgs === null) continue;
@@ -70253,6 +70319,7 @@ var init_local_initializer_materialization = __esm({
70253
70319
  init_value_row_owner_members();
70254
70320
  init_neo_script_recompile_scope();
70255
70321
  init_neoscript_build_cache();
70322
+ init_compiler_adapter();
70256
70323
  }
70257
70324
  });
70258
70325
 
@@ -70891,6 +70958,7 @@ function computeWorkspaceStatus(workspace, options) {
70891
70958
  reconciliations: valueLowerRegistry.initializerReconciliations,
70892
70959
  manifest,
70893
70960
  forceRecompile: options.forceRecompile,
70961
+ useBuildCaches: options.useBuildCaches,
70894
70962
  sourceTextByUri: new Map(
70895
70963
  sourceEntries.map((entry) => [entry.relPath, entry.source])
70896
70964
  )
@@ -70961,13 +71029,15 @@ function computeWorkspaceStatus(workspace, options) {
70961
71029
  parseErrors.push(new SchemaSourceError(message, "<project-files>", 1, 1));
70962
71030
  }
70963
71031
  try {
71032
+ const animationRecords = prospectiveAnimationRecords(
71033
+ workspace.state.records,
71034
+ reconstructed3,
71035
+ changes,
71036
+ authoredValueSeeds
71037
+ );
70964
71038
  validateProspectiveAnimationRecordsV4(
70965
- prospectiveAnimationRecords(
70966
- workspace.state.records,
70967
- reconstructed3,
70968
- changes,
70969
- authoredValueSeeds
70970
- )
71039
+ animationRecords,
71040
+ animationRecordsFromState(workspace.state.records)
70971
71041
  );
70972
71042
  } catch (error) {
70973
71043
  parseErrors.push(
@@ -71035,17 +71105,19 @@ function computeWorkspaceStatus(workspace, options) {
71035
71105
  )
71036
71106
  };
71037
71107
  }
71038
- function validateProspectiveAnimationRecordsV4(records2) {
71108
+ function validateProspectiveAnimationRecordsV4(records2, fallbackRecords = []) {
71039
71109
  const candidates = [...records2];
71040
71110
  const document = prospectiveAnimationDocumentV4(candidates);
71041
71111
  if (document === null) return;
71112
+ const fallbackDocument = prospectiveAnimationDocumentV4(fallbackRecords);
71042
71113
  const replayed = replayAnimationDeclarationInitializersV4(
71043
71114
  candidates,
71044
- document
71115
+ document,
71116
+ fallbackDocument
71045
71117
  );
71046
71118
  assertAnimationClipDocumentValid(replayed);
71047
71119
  }
71048
- function replayAnimationDeclarationInitializersV4(records2, document) {
71120
+ function replayAnimationDeclarationInitializersV4(records2, document, fallbackDocument) {
71049
71121
  const initializers = document.values.flatMap((row) => {
71050
71122
  const init = Reflect.get(row, "init");
71051
71123
  return isObjectRecord2(init) && typeof init.code === "string" ? [{ row, code: init.code }] : [];
@@ -71072,7 +71144,24 @@ function replayAnimationDeclarationInitializersV4(records2, document) {
71072
71144
  data: record3.data
71073
71145
  });
71074
71146
  }
71075
- const values = new Map(document.values.map((row) => [row.id, row]));
71147
+ const replayDocument = readPulledProjectDocumentV4(pulled);
71148
+ const compilationProject = createNeoScriptCompilationProject({
71149
+ project: replayDocument.project,
71150
+ projectFiles: replayDocument.projectFiles,
71151
+ members: replayDocument.members,
71152
+ classes: replayDocument.classes,
71153
+ enums: replayDocument.enums,
71154
+ interfaces: replayDocument.interfaces,
71155
+ constructors: replayDocument.constructors ?? []
71156
+ });
71157
+ let documentBodiesCompiled = false;
71158
+ const fallbackValues = new Map(
71159
+ (fallbackDocument?.values ?? []).map((row) => [row.id, row])
71160
+ );
71161
+ const values = new Map([
71162
+ ...fallbackValues,
71163
+ ...document.values.map((row) => [row.id, row])
71164
+ ]);
71076
71165
  for (const { row, code } of initializers) {
71077
71166
  if (rootKinds.get(row.id) !== "declaration") continue;
71078
71167
  const owner = owners.get(row.id);
@@ -71085,26 +71174,34 @@ function replayAnimationDeclarationInitializersV4(records2, document) {
71085
71174
  const rootOwner = rootOwners.get(row.id);
71086
71175
  const rootOwnerId = Reflect.get(rootOwner ?? {}, "id");
71087
71176
  const initializerOwnerClass = typeof rootOwnerId !== "string" ? null : findSchemaPlacement(rootOwnerId, document.classes)?.ownerClass ?? null;
71177
+ const evaluate = initializerOwnerClass?.requiredConstructorId === void 0 || initializerOwnerClass.requiredConstructorId === null;
71088
71178
  let replay;
71089
71179
  try {
71090
71180
  replay = replayStoredConstructionV4({
71091
71181
  records: pulled,
71182
+ document: replayDocument,
71092
71183
  valueId: row.id,
71093
71184
  code,
71094
71185
  member: owner,
71095
- compileDocumentBodies: true,
71186
+ compileDocumentBodies: !documentBodiesCompiled,
71187
+ compilationProject,
71096
71188
  initializerOwnerClass,
71097
71189
  // A parameterized declaration is a template. Its arguments exist only
71098
71190
  // at concrete construction sites, so validate the authored body here
71099
71191
  // without fabricating values for the class header parameters.
71100
- evaluate: initializerOwnerClass?.requiredConstructorId === void 0 || initializerOwnerClass.requiredConstructorId === null
71192
+ evaluate
71101
71193
  });
71194
+ documentBodiesCompiled = true;
71102
71195
  } catch (error) {
71103
71196
  throw new Error(
71104
71197
  `Animation declaration replay failed for value "${row.id}": ${error instanceof Error ? error.message : String(error)}`,
71105
71198
  { cause: error }
71106
71199
  );
71107
71200
  }
71201
+ if (!evaluate) {
71202
+ const fallback = fallbackValues.get(row.id);
71203
+ if (fallback !== void 0) values.set(row.id, fallback);
71204
+ }
71108
71205
  for (const [id2, value] of replay) {
71109
71206
  if (!isMemberValue(value)) {
71110
71207
  throw new Error(
@@ -71116,6 +71213,12 @@ function replayAnimationDeclarationInitializersV4(records2, document) {
71116
71213
  }
71117
71214
  return { ...document, values: [...values.values()] };
71118
71215
  }
71216
+ function animationRecordsFromState(records2) {
71217
+ return Object.values(records2).flatMap((record3) => {
71218
+ const data = record3.conflictServerHash !== void 0 && isObjectRecord2(record3.conflictServerData) ? record3.conflictServerData : record3.data;
71219
+ return isObjectRecord2(data) ? [{ recordKind: record3.recordKind, data }] : [];
71220
+ });
71221
+ }
71119
71222
  function classBelongsToAnimationFamily(classes, classId) {
71120
71223
  const classesById = new Map(
71121
71224
  classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
@@ -71489,6 +71592,7 @@ var init_workspace_status_core = __esm({
71489
71592
  init_local_initializer_materialization();
71490
71593
  init_push_change_intent();
71491
71594
  init_initializer_replay();
71595
+ init_compiler_adapter();
71492
71596
  IGNORED_SCHEMA_DIRECTORIES = /* @__PURE__ */ new Set([
71493
71597
  ".git",
71494
71598
  ".neo",
@@ -71539,6 +71643,7 @@ function verifyProjectSourceCommitAgainstStateV4(args) {
71539
71643
  }
71540
71644
  const status = computeWorkspaceStatus(workspace, {
71541
71645
  skipProjectBinaryInspection: true,
71646
+ useBuildCaches: false,
71542
71647
  writeProjectAnalysisCache: () => void 0,
71543
71648
  trustedPendingProjectFiles,
71544
71649
  virtualSourceFiles: args.files,
@@ -75076,13 +75181,14 @@ function materializePreparedInstanceInitializers(args) {
75076
75181
  `Value "${valueId}" carries an initializer but no instance ownership path resolves its declared member.`
75077
75182
  );
75078
75183
  }
75184
+ const existingRoot = existingValueById.get(valueId);
75185
+ const existingConstructedRoot = existingRoot !== void 0 && isLiteralValueContent(existingRoot) && (typeof existingRoot.classId === "string" || existingRoot.constructorArgs !== void 0 && existingRoot.constructorArgs !== null);
75079
75186
  const materialized = materializeInitializerValue({
75080
75187
  document: compiledDocument,
75081
75188
  member,
75082
- row: site.row
75189
+ row: site.row,
75190
+ ...existingConstructedRoot ? { storedConstructionReplay: true } : {}
75083
75191
  });
75084
- const existingRoot = existingValueById.get(valueId);
75085
- const existingConstructedRoot = existingRoot !== void 0 && isLiteralValueContent(existingRoot) && (typeof existingRoot.classId === "string" || existingRoot.constructorArgs !== void 0 && existingRoot.constructorArgs !== null);
75086
75192
  if (existingConstructedRoot) {
75087
75193
  if (!isLiteralValueContent(materialized.root) || existingRoot.classId !== materialized.root.classId || !replayedCreationDataMatches({
75088
75194
  currentDocument: args.document,
@@ -77266,6 +77372,9 @@ function prepareServerOwnedValueInitializerBodies(args) {
77266
77372
  void 0,
77267
77373
  rootOwnerByValueId
77268
77374
  );
77375
+ const currentValueById = new Map(
77376
+ args.document.values.map((value) => [value.id, value])
77377
+ );
77269
77378
  const compileOne = (document, row) => {
77270
77379
  const member = ownerByValueId.get(row.id);
77271
77380
  if (member === void 0) {
@@ -77273,6 +77382,8 @@ function prepareServerOwnedValueInitializerBodies(args) {
77273
77382
  `Value "${row.id}" carries an initializer but no member in this project version stores it, so its declared type is unknown.`
77274
77383
  );
77275
77384
  }
77385
+ const currentValue = currentValueById.get(row.id);
77386
+ const replaysStoredConstruction = isLiteralValueContent(currentValue) && (typeof currentValue.classId === "string" || currentValue.constructorArgs !== void 0);
77276
77387
  compileValueRowInitializerBody({
77277
77388
  project: document.project,
77278
77389
  projectFiles: document.projectFiles,
@@ -77287,7 +77398,8 @@ function prepareServerOwnedValueInitializerBodies(args) {
77287
77398
  initializerOwnerClass: findSchemaPlacement(
77288
77399
  rootOwnerByValueId.get(row.id)?.id ?? "",
77289
77400
  document.classes
77290
- )?.ownerClass ?? null
77401
+ )?.ownerClass ?? null,
77402
+ ...replaysStoredConstruction ? { storedConstructionReplay: true } : {}
77291
77403
  });
77292
77404
  };
77293
77405
  for (const [index, row] of explicitRows) {
@@ -81330,8 +81442,22 @@ var init_server_preparation_preflight = __esm({
81330
81442
  // src/project-source/initializer-replay.ts
81331
81443
  function replayStoredConstructionV4(args) {
81332
81444
  const document = args.document ?? readPulledProjectDocumentV4(args.records);
81445
+ const compilationProject = args.compilationProject ?? (args.compileDocumentBodies === true ? createNeoScriptCompilationProject({
81446
+ project: document.project,
81447
+ projectFiles: document.projectFiles,
81448
+ members: document.members,
81449
+ classes: document.classes,
81450
+ enums: document.enums,
81451
+ interfaces: document.interfaces,
81452
+ constructors: document.constructors ?? []
81453
+ }) : void 0);
81333
81454
  if (args.compileDocumentBodies === true) {
81334
- compilePulledProjectDocumentBodiesV4(document);
81455
+ if (compilationProject === void 0) {
81456
+ throw new Error(
81457
+ "Construction replay cannot compile document bodies without a compiler project."
81458
+ );
81459
+ }
81460
+ compilePulledProjectDocumentBodiesV4(document, compilationProject);
81335
81461
  }
81336
81462
  const root = document.values.find((value) => value.id === args.valueId);
81337
81463
  if (root === void 0) {
@@ -81384,7 +81510,7 @@ function replayStoredConstructionV4(args) {
81384
81510
  // header parameters that are in lexical scope at their source site.
81385
81511
  initializerOwnerClass: args.initializerOwnerClass ?? null,
81386
81512
  storedConstructionReplay: true,
81387
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject }
81513
+ ...compilationProject === void 0 ? {} : { compilationProject }
81388
81514
  });
81389
81515
  if (!isMemberValue(candidate) || !isInitValueContent(candidate)) {
81390
81516
  throw new Error(
@@ -81407,15 +81533,24 @@ function replayStoredConstructionV4(args) {
81407
81533
  });
81408
81534
  break;
81409
81535
  } catch (error) {
81410
- if (!(error instanceof UncompiledInitializerRuntimeError) || error.memberId === null || compiledDependencies.has(error.memberId)) {
81536
+ const dependencyKey = error instanceof UncompiledInitializerRuntimeError && error.valueId !== null ? error.valueId : error instanceof UncompiledInitializerRuntimeError && error.initializer !== null ? error.initializer : error instanceof UncompiledInitializerRuntimeError ? error.memberId : null;
81537
+ if (!(error instanceof UncompiledInitializerRuntimeError) || error.memberId === null || dependencyKey === null || compiledDependencies.has(dependencyKey)) {
81411
81538
  throw error;
81412
81539
  }
81413
- compilePulledMemberInitializerBodyV4(
81414
- document,
81415
- error.memberId,
81416
- args.compilationProject
81417
- );
81418
- compiledDependencies.add(error.memberId);
81540
+ if (error.valueId !== null) {
81541
+ compilePulledValueInitializerBodyV4(
81542
+ document,
81543
+ error.valueId,
81544
+ compilationProject
81545
+ );
81546
+ } else {
81547
+ compilePulledMemberInitializerBodyV4(
81548
+ document,
81549
+ error.memberId,
81550
+ compilationProject
81551
+ );
81552
+ }
81553
+ compiledDependencies.add(dependencyKey);
81419
81554
  }
81420
81555
  }
81421
81556
  return new Map(
@@ -81425,7 +81560,55 @@ function replayStoredConstructionV4(args) {
81425
81560
  ])
81426
81561
  );
81427
81562
  }
81428
- function compilePulledProjectDocumentBodiesV4(document) {
81563
+ function valueInitializerCompilationSites(document) {
81564
+ const cached = pulledValueInitializerCompilationSites.get(document);
81565
+ if (cached !== void 0) return cached;
81566
+ const rows = document.values.filter(isInitValueContent);
81567
+ const rootOwners = /* @__PURE__ */ new Map();
81568
+ const owners = resolveOwnerMembersForValues(
81569
+ document,
81570
+ new Set(rows.map((row) => row.id)),
81571
+ void 0,
81572
+ rootOwners
81573
+ );
81574
+ const sites = /* @__PURE__ */ new Map();
81575
+ for (const row of rows) {
81576
+ const member = owners.get(row.id);
81577
+ if (member === void 0) continue;
81578
+ const rootOwnerId = Reflect.get(rootOwners.get(row.id) ?? {}, "id");
81579
+ sites.set(row.id, {
81580
+ row,
81581
+ member,
81582
+ ownerClass: typeof rootOwnerId !== "string" ? null : findSchemaPlacement(rootOwnerId, document.classes)?.ownerClass ?? null
81583
+ });
81584
+ }
81585
+ pulledValueInitializerCompilationSites.set(document, sites);
81586
+ return sites;
81587
+ }
81588
+ function compilePulledValueInitializerBodyV4(document, valueId, compilationProject) {
81589
+ const site = valueInitializerCompilationSites(document).get(valueId);
81590
+ if (site === void 0) {
81591
+ throw new Error(
81592
+ "Cannot compile initializer dependency because its source value row is unresolved."
81593
+ );
81594
+ }
81595
+ compileValueRowInitializerBody({
81596
+ project: document.project,
81597
+ projectFiles: document.projectFiles,
81598
+ members: document.members,
81599
+ classes: document.classes,
81600
+ enums: document.enums,
81601
+ interfaces: document.interfaces,
81602
+ constructors: document.constructors ?? [],
81603
+ member: site.member,
81604
+ valueRow: site.row,
81605
+ valueId: String(Reflect.get(site.row, "id")),
81606
+ initializerOwnerClass: site.ownerClass,
81607
+ storedConstructionReplay: true,
81608
+ ...compilationProject === void 0 ? {} : { compilationProject }
81609
+ });
81610
+ }
81611
+ function compilePulledProjectDocumentBodiesV4(document, compilationProject) {
81429
81612
  const compileArgs = {
81430
81613
  project: document.project,
81431
81614
  projectFiles: document.projectFiles,
@@ -81433,7 +81616,8 @@ function compilePulledProjectDocumentBodiesV4(document) {
81433
81616
  classes: document.classes,
81434
81617
  enums: document.enums,
81435
81618
  interfaces: document.interfaces,
81436
- constructors: document.constructors ?? []
81619
+ constructors: document.constructors ?? [],
81620
+ compilationProject
81437
81621
  };
81438
81622
  for (const constructor2 of compileArgs.constructors) {
81439
81623
  compileConstructorRecord({ ...compileArgs, constructor: constructor2 });
@@ -81492,7 +81676,10 @@ function compilePulledMemberInitializerBodyV4(document, memberId, compilationPro
81492
81676
  }
81493
81677
  function readPulledProjectDocumentV4(records2) {
81494
81678
  return readProjectDocument(
81495
- pulledProjectDocumentRaw(replayWorkspace(records2)),
81679
+ // Replay compilation mutates authored `init` envelopes with transient IR.
81680
+ // Keep that evaluator-local: the input records are also the source commit
81681
+ // payload, where compiled bodies are deliberately absent.
81682
+ structuredClone(pulledProjectDocumentRaw(replayWorkspace(records2))),
81496
81683
  { constructors: "authored-or-compiled" }
81497
81684
  );
81498
81685
  }
@@ -81523,6 +81710,7 @@ function replayWorkspace(records2) {
81523
81710
  state: { records: stateRecords }
81524
81711
  };
81525
81712
  }
81713
+ var pulledValueInitializerCompilationSites;
81526
81714
  var init_initializer_replay = __esm({
81527
81715
  "src/project-source/initializer-replay.ts"() {
81528
81716
  "use strict";
@@ -81530,11 +81718,14 @@ var init_initializer_replay = __esm({
81530
81718
  init_compile_ns_property();
81531
81719
  init_init_backed_value_materialization();
81532
81720
  init_value_row_owner_members();
81721
+ init_inheritance();
81533
81722
  init_project_document_read();
81534
81723
  init_server_preparation_preflight();
81535
81724
  init_projection();
81536
81725
  init_constructors2();
81537
81726
  init_neoscript_evaluator();
81727
+ init_compiler_adapter();
81728
+ pulledValueInitializerCompilationSites = /* @__PURE__ */ new WeakMap();
81538
81729
  }
81539
81730
  });
81540
81731
 
@@ -89234,6 +89425,10 @@ async function runPull(workspace, options) {
89234
89425
  async function runNormalPull(workspace, options, progress) {
89235
89426
  const destructive = options.force;
89236
89427
  const hasBaseline = Object.keys(workspace.state.records).length > 0;
89428
+ const mainLocale = workspaceMainLocale(workspace.state.records);
89429
+ if (acceptSourceEquivalentConflictBases(workspace, mainLocale) > 0) {
89430
+ writeWorkspaceState(workspace.root, workspace.state);
89431
+ }
89237
89432
  let localByKey = /* @__PURE__ */ new Map();
89238
89433
  let localStatus = null;
89239
89434
  if (hasBaseline && !destructive) {
@@ -89326,10 +89521,11 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
89326
89521
  continue;
89327
89522
  }
89328
89523
  const serverChanged = serverRecord.contentHash !== baseState.contentHash;
89329
- const localChanged = local !== void 0 && baseState.file !== void 0 && !authoredRecordsSemanticallyEqual(
89524
+ const localChanged = local !== void 0 && baseState.file !== void 0 && !sourceAuthoredRecordsSemanticallyEqual(
89330
89525
  serverRecord.recordKind,
89331
89526
  local,
89332
- baseState.data
89527
+ baseState.data,
89528
+ mainLocale
89333
89529
  );
89334
89530
  const locallyDeleted = hasBaseline && baseState.file !== void 0 && local === void 0;
89335
89531
  if (!serverChanged) {
@@ -89338,7 +89534,8 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
89338
89534
  serverRecord.recordKind,
89339
89535
  baseState.data,
89340
89536
  serverRecord.data,
89341
- local
89537
+ local,
89538
+ mainLocale
89342
89539
  ).merged,
89343
89540
  serverHash: baseState.contentHash,
89344
89541
  serverData: baseState.data,
@@ -89360,7 +89557,8 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
89360
89557
  serverRecord.recordKind,
89361
89558
  baseState.data,
89362
89559
  serverRecord.data,
89363
- localSide
89560
+ localSide,
89561
+ mainLocale
89364
89562
  );
89365
89563
  if (locallyDeleted || conflictFields.length > 0) {
89366
89564
  conflictCount += 1;
@@ -89393,10 +89591,11 @@ ${blockingErrors.map((error) => ` ${error.message}`).join("\n")}`
89393
89591
  if (baseState !== void 0 && !document.records.has(key)) {
89394
89592
  const binary = localBinaryById.get(baseState.recordId);
89395
89593
  const binaryChanged = binary !== void 0 && binary.action !== "unchanged" && binary.action !== "converged";
89396
- if (authoredRecordsSemanticallyEqual(
89594
+ if (sourceAuthoredRecordsSemanticallyEqual(
89397
89595
  baseState.recordKind,
89398
89596
  local,
89399
- baseState.data
89597
+ baseState.data,
89598
+ mainLocale
89400
89599
  ) && !binaryChanged) {
89401
89600
  continue;
89402
89601
  }
@@ -89857,6 +90056,30 @@ function sourceComparableRecord(recordKind, value, mainLocale) {
89857
90056
  }
89858
90057
  return result;
89859
90058
  }
90059
+ function acceptSourceEquivalentConflictBases(workspace, mainLocale) {
90060
+ let accepted = 0;
90061
+ for (const [key, record3] of Object.entries(workspace.state.records)) {
90062
+ if (typeof record3.conflictServerHash !== "string") continue;
90063
+ if (!sourceAuthoredRecordsSemanticallyEqual(
90064
+ record3.recordKind,
90065
+ record3.data,
90066
+ record3.conflictServerData,
90067
+ mainLocale
90068
+ )) {
90069
+ continue;
90070
+ }
90071
+ const next = {
90072
+ ...record3,
90073
+ contentHash: record3.conflictServerHash,
90074
+ data: record3.conflictServerData
90075
+ };
90076
+ delete next.conflictServerHash;
90077
+ delete next.conflictServerData;
90078
+ workspace.state.records[key] = next;
90079
+ accepted += 1;
90080
+ }
90081
+ return accepted;
90082
+ }
89860
90083
  function workspaceMainLocale(records2) {
89861
90084
  const config = Object.values(records2).find(
89862
90085
  (record3) => record3.recordKind === "localization-config"
@@ -89864,11 +90087,27 @@ function workspaceMainLocale(records2) {
89864
90087
  const data = config?.data;
89865
90088
  return isObjectRecord2(data) && typeof data.mainLocale === "string" ? data.mainLocale : "en-US";
89866
90089
  }
89867
- function authoredRecordsSemanticallyEqual(recordKind, left, right) {
89868
- return isSchemaRecordKindV4(recordKind) ? schemaDocumentAuthoredSemanticallyEqual(recordKind, left, right) : canonicallyEqual(left, right);
90090
+ function mergeProjectDocumentRecord(recordKind, base, server, local, mainLocale) {
90091
+ if (isSchemaRecordKindV4(recordKind)) {
90092
+ return mergeSchemaDocumentRecord(recordKind, base, server, local);
90093
+ }
90094
+ return threeWayMergeRecord(base, server, local, {
90095
+ recursive: true,
90096
+ comparison: {
90097
+ base: sourceComparableObjectRecord(recordKind, base, mainLocale),
90098
+ server: sourceComparableObjectRecord(recordKind, server, mainLocale),
90099
+ local: sourceComparableObjectRecord(recordKind, local, mainLocale)
90100
+ }
90101
+ });
89869
90102
  }
89870
- function mergeProjectDocumentRecord(recordKind, base, server, local) {
89871
- return isSchemaRecordKindV4(recordKind) ? mergeSchemaDocumentRecord(recordKind, base, server, local) : threeWayMergeRecord(base, server, local, { recursive: true });
90103
+ function sourceComparableObjectRecord(recordKind, value, mainLocale) {
90104
+ const comparable = sourceComparableRecord(recordKind, value, mainLocale);
90105
+ if (!isObjectRecord2(comparable)) {
90106
+ throw new Error(
90107
+ `Cannot merge ${recordKind} record because its source-comparable payload is not an object.`
90108
+ );
90109
+ }
90110
+ return comparable;
89872
90111
  }
89873
90112
  function buildEmitRecordSet(document, plans, side) {
89874
90113
  const records2 = /* @__PURE__ */ new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neocompose/cli",
3
- "version": "0.22.5",
3
+ "version": "0.22.6",
4
4
  "description": "Neo Compose native project-source CLI with bidirectional sync.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -9,7 +9,7 @@ description: >-
9
9
  `@neocompose/cli` or `node cli/bin/neo.mjs` in the neo-compose repository.
10
10
  ---
11
11
 
12
- <!-- reviewed-through-cli: 0.22.5 -->
12
+ <!-- reviewed-through-cli: 0.22.6 -->
13
13
 
14
14
  # Neo Compose CLI
15
15
 
@@ -78,7 +78,7 @@ wrappers.
78
78
  The marker near the top of `SKILL.md` must exactly match the package version:
79
79
 
80
80
  ```html
81
- <!-- reviewed-through-cli: 0.22.5 -->
81
+ <!-- reviewed-through-cli: 0.22.6 -->
82
82
  ```
83
83
 
84
84
  The quoted version above is checked too, so this instruction cannot go stale