@neocompose/cli 0.43.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/neo.mjs CHANGED
@@ -372,10 +372,6 @@ var init_auth_api_base_url = __esm({
372
372
  // src/token-store.ts
373
373
  var token_store_exports = {};
374
374
  __export(token_store_exports, {
375
- NEO_CONFIG_HOME_ENV_VAR: () => NEO_CONFIG_HOME_ENV_VAR,
376
- NEO_CREDENTIAL_NAMESPACE_ENV_VAR: () => NEO_CREDENTIAL_NAMESPACE_ENV_VAR,
377
- NEO_TOKEN_ENV_VAR: () => NEO_TOKEN_ENV_VAR,
378
- credentialsDir: () => credentialsDir,
379
375
  deleteCredential: () => deleteCredential,
380
376
  keychainAccount: () => keychainAccount,
381
377
  loadCredential: () => loadCredential,
@@ -1047,7 +1043,9 @@ var init_args = __esm({
1047
1043
  "generate-ids",
1048
1044
  "help",
1049
1045
  "passWithNoTests",
1050
- "no-verify"
1046
+ "no-verify",
1047
+ "fix",
1048
+ "yes"
1051
1049
  ]);
1052
1050
  KNOWN_FLAGS = /* @__PURE__ */ new Set([
1053
1051
  "accept-bump",
@@ -1059,6 +1057,7 @@ var init_args = __esm({
1059
1057
  "dir",
1060
1058
  "dry-run",
1061
1059
  "file",
1060
+ "fix",
1062
1061
  "force",
1063
1062
  "force-recompile",
1064
1063
  "function",
@@ -1091,6 +1090,7 @@ var init_args = __esm({
1091
1090
  "this-value",
1092
1091
  "token-stdin",
1093
1092
  "version",
1093
+ "yes",
1094
1094
  "reporter",
1095
1095
  "outputFile",
1096
1096
  "output-file",
@@ -22462,7 +22462,7 @@ function reportVariantTypePositions(uri, type, diagnostics, root = "nested") {
22462
22462
  severity: "error",
22463
22463
  source: "neo-project",
22464
22464
  code: "variant-type-position",
22465
- message: variantTypePositionMessage(type.name, root)
22465
+ message: variantTypePositionMessage(type.name)
22466
22466
  });
22467
22467
  return;
22468
22468
  }
@@ -22470,7 +22470,7 @@ function reportVariantTypePositions(uri, type, diagnostics, root = "nested") {
22470
22470
  reportVariantTypePositions(uri, argument2, diagnostics);
22471
22471
  }
22472
22472
  }
22473
- function variantTypePositionMessage(typeName, root) {
22473
+ function variantTypePositionMessage(typeName) {
22474
22474
  if (isNeoVariantFolderTypeName(typeName)) {
22475
22475
  return `'${typeName}' is reference-only: it declares variant folders as top-level globals and is never a member, entry, parameter, or generic binding type.`;
22476
22476
  }
@@ -37229,7 +37229,6 @@ function memberFromDocument(record3, members, owners, classNames, context) {
37229
37229
  "returnTypeInfo"
37230
37230
  ),
37231
37231
  script: isAbstract || getterSource === null ? null : propertyScript(
37232
- record3,
37233
37232
  common.owner,
37234
37233
  classNames,
37235
37234
  getterSource,
@@ -37280,7 +37279,7 @@ function memberFromDocument(record3, members, owners, classNames, context) {
37280
37279
  ...signature,
37281
37280
  ...bodyModeValue === "ui" ? { bodyMode: "ui" } : {},
37282
37281
  ...uiActionValue === null ? {} : { uiAction: jsonValue(uiActionValue, record3, "uiAction") },
37283
- script: isAbstract || code === null ? null : functionScript(record3, common.owner, classNames, code)
37282
+ script: isAbstract || code === null ? null : functionScript(common.owner, classNames, code)
37284
37283
  };
37285
37284
  }
37286
37285
  if (kind === MEMBER_KIND.FunctionRef) {
@@ -37887,8 +37886,8 @@ function memberModifier(overrideOf, modifier) {
37887
37886
  if (modifier === "static") return "static";
37888
37887
  return "virtual";
37889
37888
  }
37890
- function propertyScript(record3, owner, classNames, getterSource, setterSource) {
37891
- const path = scriptPath(record3, owner, classNames);
37889
+ function propertyScript(owner, classNames, getterSource, setterSource) {
37890
+ const path = scriptPath(owner, classNames);
37892
37891
  const sourceText = [
37893
37892
  "get {",
37894
37893
  getterSource,
@@ -37905,8 +37904,8 @@ function propertyScript(record3, owner, classNames, getterSource, setterSource)
37905
37904
  source: zeroSpan(path)
37906
37905
  };
37907
37906
  }
37908
- function functionScript(record3, owner, classNames, sourceText) {
37909
- const path = scriptPath(record3, owner, classNames);
37907
+ function functionScript(owner, classNames, sourceText) {
37908
+ const path = scriptPath(owner, classNames);
37910
37909
  return {
37911
37910
  kind: "function",
37912
37911
  path,
@@ -37914,7 +37913,7 @@ function functionScript(record3, owner, classNames, sourceText) {
37914
37913
  source: zeroSpan(path)
37915
37914
  };
37916
37915
  }
37917
- function scriptPath(record3, ownerValue, classNames) {
37916
+ function scriptPath(ownerValue, classNames) {
37918
37917
  const owner = isRecord2(ownerValue) ? ownerValue : {};
37919
37918
  const sharedMember = owner.kind === "sharedClassMember" && Array.isArray(owner.members) ? owner.members.find(isRecord2) : void 0;
37920
37919
  let ownerClassId;
@@ -42725,36 +42724,36 @@ var MemberKind;
42725
42724
  var init_member_kind_enum = __esm({
42726
42725
  "../src/models/members/member-kind-enum.ts"() {
42727
42726
  "use strict";
42728
- MemberKind = /* @__PURE__ */ ((MemberKind16) => {
42729
- MemberKind16[MemberKind16["Null"] = 0] = "Null";
42730
- MemberKind16[MemberKind16["Bool"] = 1] = "Bool";
42731
- MemberKind16[MemberKind16["Int"] = 2] = "Int";
42732
- MemberKind16[MemberKind16["String"] = 3] = "String";
42733
- MemberKind16[MemberKind16["Float"] = 4] = "Float";
42734
- MemberKind16[MemberKind16["Dictionary"] = 5] = "Dictionary";
42735
- MemberKind16[MemberKind16["List"] = 6] = "List";
42736
- MemberKind16[MemberKind16["Class"] = 7] = "Class";
42737
- MemberKind16[MemberKind16["Enum"] = 8] = "Enum";
42738
- MemberKind16[MemberKind16["Lookup"] = 9] = "Lookup";
42739
- MemberKind16[MemberKind16["NSProperty"] = 10] = "NSProperty";
42740
- MemberKind16[MemberKind16["Sprite"] = 11] = "Sprite";
42741
- MemberKind16[MemberKind16["Audio"] = 12] = "Audio";
42742
- MemberKind16[MemberKind16["Function"] = 13] = "Function";
42743
- MemberKind16[MemberKind16["Vector2"] = 14] = "Vector2";
42744
- MemberKind16[MemberKind16["Vector2Int"] = 15] = "Vector2Int";
42745
- MemberKind16[MemberKind16["Vector3"] = 16] = "Vector3";
42746
- MemberKind16[MemberKind16["Vector3Int"] = 17] = "Vector3Int";
42747
- MemberKind16[MemberKind16["DialogueLookup"] = 18] = "DialogueLookup";
42748
- MemberKind16[MemberKind16["Color"] = 19] = "Color";
42749
- MemberKind16[MemberKind16["Decimal"] = 20] = "Decimal";
42750
- MemberKind16[MemberKind16["Generic"] = 21] = "Generic";
42751
- MemberKind16[MemberKind16["Interface"] = 22] = "Interface";
42752
- MemberKind16[MemberKind16["NSFunction"] = 23] = "NSFunction";
42753
- MemberKind16[MemberKind16["FunctionRef"] = 24] = "FunctionRef";
42754
- MemberKind16[MemberKind16["NSDelegate"] = 25] = "NSDelegate";
42755
- MemberKind16[MemberKind16["NSAction"] = 26] = "NSAction";
42756
- MemberKind16[MemberKind16["Variant"] = 27] = "Variant";
42757
- return MemberKind16;
42727
+ MemberKind = /* @__PURE__ */ ((MemberKind13) => {
42728
+ MemberKind13[MemberKind13["Null"] = 0] = "Null";
42729
+ MemberKind13[MemberKind13["Bool"] = 1] = "Bool";
42730
+ MemberKind13[MemberKind13["Int"] = 2] = "Int";
42731
+ MemberKind13[MemberKind13["String"] = 3] = "String";
42732
+ MemberKind13[MemberKind13["Float"] = 4] = "Float";
42733
+ MemberKind13[MemberKind13["Dictionary"] = 5] = "Dictionary";
42734
+ MemberKind13[MemberKind13["List"] = 6] = "List";
42735
+ MemberKind13[MemberKind13["Class"] = 7] = "Class";
42736
+ MemberKind13[MemberKind13["Enum"] = 8] = "Enum";
42737
+ MemberKind13[MemberKind13["Lookup"] = 9] = "Lookup";
42738
+ MemberKind13[MemberKind13["NSProperty"] = 10] = "NSProperty";
42739
+ MemberKind13[MemberKind13["Sprite"] = 11] = "Sprite";
42740
+ MemberKind13[MemberKind13["Audio"] = 12] = "Audio";
42741
+ MemberKind13[MemberKind13["Function"] = 13] = "Function";
42742
+ MemberKind13[MemberKind13["Vector2"] = 14] = "Vector2";
42743
+ MemberKind13[MemberKind13["Vector2Int"] = 15] = "Vector2Int";
42744
+ MemberKind13[MemberKind13["Vector3"] = 16] = "Vector3";
42745
+ MemberKind13[MemberKind13["Vector3Int"] = 17] = "Vector3Int";
42746
+ MemberKind13[MemberKind13["DialogueLookup"] = 18] = "DialogueLookup";
42747
+ MemberKind13[MemberKind13["Color"] = 19] = "Color";
42748
+ MemberKind13[MemberKind13["Decimal"] = 20] = "Decimal";
42749
+ MemberKind13[MemberKind13["Generic"] = 21] = "Generic";
42750
+ MemberKind13[MemberKind13["Interface"] = 22] = "Interface";
42751
+ MemberKind13[MemberKind13["NSFunction"] = 23] = "NSFunction";
42752
+ MemberKind13[MemberKind13["FunctionRef"] = 24] = "FunctionRef";
42753
+ MemberKind13[MemberKind13["NSDelegate"] = 25] = "NSDelegate";
42754
+ MemberKind13[MemberKind13["NSAction"] = 26] = "NSAction";
42755
+ MemberKind13[MemberKind13["Variant"] = 27] = "Variant";
42756
+ return MemberKind13;
42758
42757
  })(MemberKind || {});
42759
42758
  }
42760
42759
  });
@@ -51233,135 +51232,11 @@ var init_enum_types = __esm({
51233
51232
  }
51234
51233
  });
51235
51234
 
51236
- // ../src/models/interfaces/interface-types.ts
51237
- function isInterfaceFunctionMember(member) {
51238
- return member.kind === 1 /* Function */;
51239
- }
51240
- function interfacePropertyIsSettable(member) {
51241
- return member.accessors === 1 /* GetSet */;
51242
- }
51243
- function containsForbiddenMemberTypeInfo(typeInfo) {
51244
- if (typeInfo.type === NS_TYPE_UNKNOWN) return true;
51245
- if (typeInfo.type === 21 /* Generic */) return true;
51246
- if (typeInfo.type === 6 /* List */ || typeInfo.type === 5 /* Dictionary */ || typeInfo.type === 9 /* Lookup */) {
51247
- return containsForbiddenMemberTypeInfo(typeInfo.entryTypeInfo);
51248
- }
51249
- if (typeInfo.type === 7 /* Class */ && typeInfo.typeArguments) {
51250
- return Object.values(typeInfo.typeArguments).some(
51251
- containsForbiddenMemberTypeInfo
51252
- );
51253
- }
51254
- return false;
51255
- }
51256
- function isNeoInterfaceMember(value) {
51257
- if (typeof value !== "object") return false;
51258
- if (value === null) return false;
51259
- const member = value;
51260
- if (typeof member.id !== "string" || member.id.length === 0) return false;
51261
- if (!isValidDocsText(member.docsText)) return false;
51262
- if (member.access !== void 0 && !isMemberAccessKind(member.access))
51263
- return false;
51264
- if (member.kind === void 0 || member.kind === 0 /* Property */) {
51265
- const property2 = value;
51266
- if (!isNSTypeInfo(property2.typeInfo)) return false;
51267
- if (containsForbiddenMemberTypeInfo(property2.typeInfo)) return false;
51268
- return property2.accessors === void 0 || property2.accessors === 0 /* Get */ || property2.accessors === 1 /* GetSet */;
51269
- }
51270
- if (member.kind !== 1 /* Function */) return false;
51271
- const fn = value;
51272
- if (!isNSFunctionReturnTypeInfo(fn.returnTypeInfo)) return false;
51273
- if (containsForbiddenMemberTypeInfo(fn.returnTypeInfo)) return false;
51274
- if (!Array.isArray(fn.argumentTypes)) return false;
51275
- for (const argumentType of fn.argumentTypes) {
51276
- if (!isNSFunctionArgumentTypeInfo(argumentType)) return false;
51277
- if (containsForbiddenMemberTypeInfo(argumentType)) return false;
51278
- }
51279
- if (fn.dispatch !== void 0 && fn.dispatch !== 0 /* Synchronous */ && fn.dispatch !== 1 /* Asynchronous */)
51280
- return false;
51281
- if (fn.dispatch === 1 /* Asynchronous */ && hasAnyParameterDefault(fn.argumentTypes)) {
51282
- return false;
51283
- }
51284
- return validateParameterDefaults(fn.argumentTypes).length === 0;
51285
- }
51286
- function isInterfaceMembersRecord(value) {
51287
- if (typeof value !== "object") return false;
51288
- if (value === null) return false;
51289
- if (Array.isArray(value)) return false;
51290
- for (const [key, member] of Object.entries(value)) {
51291
- if (key.length === 0) return false;
51292
- if (!isNeoInterfaceMember(member)) return false;
51293
- }
51294
- return true;
51295
- }
51296
- function isOptionalStringArray(value) {
51297
- if (value === void 0) return true;
51298
- if (!Array.isArray(value)) return false;
51299
- return value.every((entry) => typeof entry === "string" && entry.length > 0);
51300
- }
51301
- function isNeoInterfaceBase(value) {
51302
- if (typeof value !== "object") return false;
51303
- if (value === null) return false;
51304
- const neoInterface = value;
51305
- if (typeof neoInterface.name !== "string") return false;
51306
- if (!isValidDocsText(neoInterface.docsText)) return false;
51307
- if (!isInterfaceMembersRecord(neoInterface.members)) return false;
51308
- if (!isOptionalStringArray(neoInterface.memberKeyOrder)) return false;
51309
- if (!isOptionalStringArray(neoInterface.extendsInterfaceIds)) return false;
51310
- if (neoInterface.system !== void 0 && !isSystemMetadata(neoInterface.system)) {
51311
- return false;
51312
- }
51313
- return true;
51314
- }
51315
- function isNeoInterfaceProps(value) {
51316
- if (!isNeoInterfaceBase(value)) return false;
51317
- if (!isWithId(value)) return false;
51318
- const neoInterface = value;
51319
- if (typeof neoInterface.projectId !== "string") return false;
51320
- if (!isEpochMillis(neoInterface.createdAt)) return false;
51321
- return isEpochMillis(neoInterface.updatedAt);
51322
- }
51323
- function isNeoInterface(value) {
51324
- return isNeoInterfaceProps(value);
51325
- }
51326
- function getInterfaceMemberKeyOrder(neoInterface) {
51327
- const memberKeys = Object.keys(neoInterface.members);
51328
- const seen = /* @__PURE__ */ new Set();
51329
- const result = [];
51330
- for (const memberKey of neoInterface.memberKeyOrder ?? []) {
51331
- if (!Object.prototype.hasOwnProperty.call(neoInterface.members, memberKey)) {
51332
- continue;
51333
- }
51334
- if (seen.has(memberKey)) continue;
51335
- seen.add(memberKey);
51336
- result.push(memberKey);
51337
- }
51338
- for (const memberKey of memberKeys) {
51339
- if (seen.has(memberKey)) continue;
51340
- seen.add(memberKey);
51341
- result.push(memberKey);
51342
- }
51343
- return result;
51344
- }
51345
- var init_interface_types = __esm({
51346
- "../src/models/interfaces/interface-types.ts"() {
51347
- "use strict";
51348
- init_core();
51349
- init_neoscript_types();
51350
- init_docs_text2();
51351
- init_neoscript_guards();
51352
- init_parameter_defaults();
51353
- init_member_kinds();
51354
- }
51355
- });
51356
-
51357
51235
  // ../src/models/enum/enum-responses.ts
51358
51236
  var init_enum_responses = __esm({
51359
51237
  "../src/models/enum/enum-responses.ts"() {
51360
51238
  "use strict";
51361
- init_members();
51362
- init_classes();
51363
51239
  init_enum_types();
51364
- init_interface_types();
51365
51240
  }
51366
51241
  });
51367
51242
 
@@ -53327,7 +53202,6 @@ var init_add_class_member = __esm({
53327
53202
  init_enum2();
53328
53203
  init_classes();
53329
53204
  init_initial_class_internal_record_relation();
53330
- init_project_version_types();
53331
53205
  }
53332
53206
  });
53333
53207
 
@@ -53347,8 +53221,6 @@ var init_edit_member_props = __esm({
53347
53221
  var init_delete_member_response = __esm({
53348
53222
  "../src/models/members/delete-member-response.ts"() {
53349
53223
  "use strict";
53350
- init_member_kinds();
53351
- init_classes();
53352
53224
  }
53353
53225
  });
53354
53226
 
@@ -57495,12 +57367,131 @@ var init_dialogue_lookup_candidates = __esm({
57495
57367
  }
57496
57368
  });
57497
57369
 
57370
+ // ../src/models/interfaces/interface-types.ts
57371
+ function isInterfaceFunctionMember(member) {
57372
+ return member.kind === 1 /* Function */;
57373
+ }
57374
+ function interfacePropertyIsSettable(member) {
57375
+ return member.accessors === 1 /* GetSet */;
57376
+ }
57377
+ function containsForbiddenMemberTypeInfo(typeInfo) {
57378
+ if (typeInfo.type === NS_TYPE_UNKNOWN) return true;
57379
+ if (typeInfo.type === 21 /* Generic */) return true;
57380
+ if (typeInfo.type === 6 /* List */ || typeInfo.type === 5 /* Dictionary */ || typeInfo.type === 9 /* Lookup */) {
57381
+ return containsForbiddenMemberTypeInfo(typeInfo.entryTypeInfo);
57382
+ }
57383
+ if (typeInfo.type === 7 /* Class */ && typeInfo.typeArguments) {
57384
+ return Object.values(typeInfo.typeArguments).some(
57385
+ containsForbiddenMemberTypeInfo
57386
+ );
57387
+ }
57388
+ return false;
57389
+ }
57390
+ function isNeoInterfaceMember(value) {
57391
+ if (typeof value !== "object") return false;
57392
+ if (value === null) return false;
57393
+ const member = value;
57394
+ if (typeof member.id !== "string" || member.id.length === 0) return false;
57395
+ if (!isValidDocsText(member.docsText)) return false;
57396
+ if (member.access !== void 0 && !isMemberAccessKind(member.access))
57397
+ return false;
57398
+ if (member.kind === void 0 || member.kind === 0 /* Property */) {
57399
+ const property2 = value;
57400
+ if (!isNSTypeInfo(property2.typeInfo)) return false;
57401
+ if (containsForbiddenMemberTypeInfo(property2.typeInfo)) return false;
57402
+ return property2.accessors === void 0 || property2.accessors === 0 /* Get */ || property2.accessors === 1 /* GetSet */;
57403
+ }
57404
+ if (member.kind !== 1 /* Function */) return false;
57405
+ const fn = value;
57406
+ if (!isNSFunctionReturnTypeInfo(fn.returnTypeInfo)) return false;
57407
+ if (containsForbiddenMemberTypeInfo(fn.returnTypeInfo)) return false;
57408
+ if (!Array.isArray(fn.argumentTypes)) return false;
57409
+ for (const argumentType of fn.argumentTypes) {
57410
+ if (!isNSFunctionArgumentTypeInfo(argumentType)) return false;
57411
+ if (containsForbiddenMemberTypeInfo(argumentType)) return false;
57412
+ }
57413
+ if (fn.dispatch !== void 0 && fn.dispatch !== 0 /* Synchronous */ && fn.dispatch !== 1 /* Asynchronous */)
57414
+ return false;
57415
+ if (fn.dispatch === 1 /* Asynchronous */ && hasAnyParameterDefault(fn.argumentTypes)) {
57416
+ return false;
57417
+ }
57418
+ return validateParameterDefaults(fn.argumentTypes).length === 0;
57419
+ }
57420
+ function isInterfaceMembersRecord(value) {
57421
+ if (typeof value !== "object") return false;
57422
+ if (value === null) return false;
57423
+ if (Array.isArray(value)) return false;
57424
+ for (const [key, member] of Object.entries(value)) {
57425
+ if (key.length === 0) return false;
57426
+ if (!isNeoInterfaceMember(member)) return false;
57427
+ }
57428
+ return true;
57429
+ }
57430
+ function isOptionalStringArray(value) {
57431
+ if (value === void 0) return true;
57432
+ if (!Array.isArray(value)) return false;
57433
+ return value.every((entry) => typeof entry === "string" && entry.length > 0);
57434
+ }
57435
+ function isNeoInterfaceBase(value) {
57436
+ if (typeof value !== "object") return false;
57437
+ if (value === null) return false;
57438
+ const neoInterface = value;
57439
+ if (typeof neoInterface.name !== "string") return false;
57440
+ if (!isValidDocsText(neoInterface.docsText)) return false;
57441
+ if (!isInterfaceMembersRecord(neoInterface.members)) return false;
57442
+ if (!isOptionalStringArray(neoInterface.memberKeyOrder)) return false;
57443
+ if (!isOptionalStringArray(neoInterface.extendsInterfaceIds)) return false;
57444
+ if (neoInterface.system !== void 0 && !isSystemMetadata(neoInterface.system)) {
57445
+ return false;
57446
+ }
57447
+ return true;
57448
+ }
57449
+ function isNeoInterfaceProps(value) {
57450
+ if (!isNeoInterfaceBase(value)) return false;
57451
+ if (!isWithId(value)) return false;
57452
+ const neoInterface = value;
57453
+ if (typeof neoInterface.projectId !== "string") return false;
57454
+ if (!isEpochMillis(neoInterface.createdAt)) return false;
57455
+ return isEpochMillis(neoInterface.updatedAt);
57456
+ }
57457
+ function isNeoInterface(value) {
57458
+ return isNeoInterfaceProps(value);
57459
+ }
57460
+ function getInterfaceMemberKeyOrder(neoInterface) {
57461
+ const memberKeys = Object.keys(neoInterface.members);
57462
+ const seen = /* @__PURE__ */ new Set();
57463
+ const result = [];
57464
+ for (const memberKey of neoInterface.memberKeyOrder ?? []) {
57465
+ if (!Object.prototype.hasOwnProperty.call(neoInterface.members, memberKey)) {
57466
+ continue;
57467
+ }
57468
+ if (seen.has(memberKey)) continue;
57469
+ seen.add(memberKey);
57470
+ result.push(memberKey);
57471
+ }
57472
+ for (const memberKey of memberKeys) {
57473
+ if (seen.has(memberKey)) continue;
57474
+ seen.add(memberKey);
57475
+ result.push(memberKey);
57476
+ }
57477
+ return result;
57478
+ }
57479
+ var init_interface_types = __esm({
57480
+ "../src/models/interfaces/interface-types.ts"() {
57481
+ "use strict";
57482
+ init_core();
57483
+ init_neoscript_types();
57484
+ init_docs_text2();
57485
+ init_neoscript_guards();
57486
+ init_parameter_defaults();
57487
+ init_member_kinds();
57488
+ }
57489
+ });
57490
+
57498
57491
  // ../src/models/interfaces/interface-responses.ts
57499
57492
  var init_interface_responses = __esm({
57500
57493
  "../src/models/interfaces/interface-responses.ts"() {
57501
57494
  "use strict";
57502
- init_member_kinds();
57503
- init_classes();
57504
57495
  init_interface_types();
57505
57496
  }
57506
57497
  });
@@ -58005,7 +57996,6 @@ var init_dialogue_db_response_types = __esm({
58005
57996
  init_dialogue_types();
58006
57997
  init_dialogue_group_types();
58007
57998
  init_priority_types();
58008
- init_localization_types();
58009
57999
  }
58010
58000
  });
58011
58001
 
@@ -66101,6 +66091,17 @@ function initializerReferencesAnyIdentifier(source, names) {
66101
66091
  }
66102
66092
  return false;
66103
66093
  }
66094
+ function compilationProjectContext(args, members = args.members) {
66095
+ return {
66096
+ project: args.project,
66097
+ projectFiles: args.projectFiles ?? [],
66098
+ members: [...members],
66099
+ classes: [...args.classes],
66100
+ enums: [...args.enums],
66101
+ interfaces: [...args.interfaces ?? []],
66102
+ ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject }
66103
+ };
66104
+ }
66104
66105
  function compileNSPropertyBodies(args) {
66105
66106
  if (args.member.kind !== 10 /* NSProperty */) return;
66106
66107
  if (isMemberNSPropertyContractBase(args.member)) return;
@@ -66120,16 +66121,10 @@ function compileNSPropertyBodies(args) {
66120
66121
  const getter = compileUnit2(
66121
66122
  "getter",
66122
66123
  () => compileNSGetter(code, {
66123
- project: args.project,
66124
- projectFiles: args.projectFiles ?? [],
66125
- members: [...members],
66126
- classes: [...args.classes],
66127
- enums: [...args.enums],
66128
- interfaces: [...args.interfaces ?? []],
66124
+ ...compilationProjectContext(args, members),
66129
66125
  constructors: args.constructors ?? [],
66130
66126
  variants: args.variants ?? [],
66131
66127
  variantFolders: args.variantFolders ?? [],
66132
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject },
66133
66128
  thisClass: args.thisClass,
66134
66129
  returnTypeInfo,
66135
66130
  implicitMemberAccess: true,
@@ -66159,16 +66154,10 @@ function compileNSPropertyBodies(args) {
66159
66154
  const setter = compileUnit2(
66160
66155
  "setter",
66161
66156
  () => compileNSSetter(setterCode, {
66162
- project: args.project,
66163
- projectFiles: args.projectFiles ?? [],
66164
- members: [...members],
66165
- classes: [...args.classes],
66166
- enums: [...args.enums],
66167
- interfaces: [...args.interfaces ?? []],
66157
+ ...compilationProjectContext(args, members),
66168
66158
  constructors: args.constructors ?? [],
66169
66159
  variants: args.variants ?? [],
66170
66160
  variantFolders: args.variantFolders ?? [],
66171
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject },
66172
66161
  thisClass: args.thisClass,
66173
66162
  valueTypeInfo: returnTypeInfo,
66174
66163
  implicitMemberAccess: true,
@@ -66212,16 +66201,10 @@ function compileNSFunctionBody(args) {
66212
66201
  const action2 = compileUnit2(
66213
66202
  "function",
66214
66203
  () => compileNSFunction("", {
66215
- project: args.project,
66216
- projectFiles: args.projectFiles ?? [],
66217
- members: [...members],
66218
- classes: [...args.classes],
66219
- enums: [...args.enums],
66220
- interfaces: [...args.interfaces ?? []],
66204
+ ...compilationProjectContext(args, members),
66221
66205
  constructors: args.constructors ?? [],
66222
66206
  variants: args.variants ?? [],
66223
66207
  variantFolders: args.variantFolders ?? [],
66224
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject },
66225
66208
  thisClass: args.thisClass,
66226
66209
  functionName: args.member.name,
66227
66210
  implicitMemberAccess: true,
@@ -66261,16 +66244,10 @@ function compileNSFunctionBody(args) {
66261
66244
  const action = compileUnit2(
66262
66245
  "function",
66263
66246
  () => compileNSFunction(code, {
66264
- project: args.project,
66265
- projectFiles: args.projectFiles ?? [],
66266
- members: [...members],
66267
- classes: [...args.classes],
66268
- enums: [...args.enums],
66269
- interfaces: [...args.interfaces ?? []],
66247
+ ...compilationProjectContext(args, members),
66270
66248
  constructors: args.constructors ?? [],
66271
66249
  variants: args.variants ?? [],
66272
66250
  variantFolders: args.variantFolders ?? [],
66273
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject },
66274
66251
  thisClass: args.thisClass,
66275
66252
  functionName: args.member.name,
66276
66253
  implicitMemberAccess: true,
@@ -66300,16 +66277,10 @@ function compileMemberInitializerBody(args) {
66300
66277
  compiled = compileUnit2(
66301
66278
  "getter",
66302
66279
  () => compileNSInitializer(defaultValue.init.code, {
66303
- project: args.project,
66304
- projectFiles: args.projectFiles ?? [],
66305
- members: [...members],
66306
- classes: [...args.classes],
66307
- enums: [...args.enums],
66308
- interfaces: [...args.interfaces ?? []],
66280
+ ...compilationProjectContext(args, members),
66309
66281
  constructors: args.constructors ?? [],
66310
66282
  variants: args.variants ?? [],
66311
66283
  variantFolders: args.variantFolders ?? [],
66312
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject },
66313
66284
  returnTypeInfo,
66314
66285
  initializerName: args.member.name,
66315
66286
  argumentTypes: initializerArgumentTypes(
@@ -66363,12 +66334,7 @@ function compileValueRowInitializerBody(args) {
66363
66334
  compiled = compileUnit2(
66364
66335
  "getter",
66365
66336
  () => compileNSInitializer(container.init.code, {
66366
- project: args.project,
66367
- projectFiles: args.projectFiles ?? [],
66368
- members: [...args.members],
66369
- classes: [...args.classes],
66370
- enums: [...args.enums],
66371
- interfaces: [...args.interfaces ?? []],
66337
+ ...compilationProjectContext(args),
66372
66338
  constructors: args.constructors ?? [],
66373
66339
  variants: args.variants ?? [],
66374
66340
  variantFolders: args.variantFolders ?? [],
@@ -66379,7 +66345,6 @@ function compileValueRowInitializerBody(args) {
66379
66345
  args.initializerOwnerClass,
66380
66346
  args.constructors ?? []
66381
66347
  ),
66382
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject },
66383
66348
  ...args.storedConstructionReplay === true ? { storedConstructionReplay: true } : {}
66384
66349
  })
66385
66350
  );
@@ -66446,14 +66411,8 @@ function compileConstructorRecord(args) {
66446
66411
  const action = compileUnit2(
66447
66412
  "function",
66448
66413
  () => compileNSConstructor(code, {
66449
- project: args.project,
66450
- projectFiles: args.projectFiles ?? [],
66451
- members: [...args.members],
66452
- classes: [...args.classes],
66453
- enums: [...args.enums],
66454
- interfaces: [...args.interfaces ?? []],
66414
+ ...compilationProjectContext(args),
66455
66415
  constructors: args.constructors,
66456
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject },
66457
66416
  thisClass: owner,
66458
66417
  argumentTypes,
66459
66418
  constructorName: owner.name
@@ -66490,14 +66449,8 @@ function compileConstructorBaseArguments(args, owner) {
66490
66449
  return compileUnit2(
66491
66450
  "getter",
66492
66451
  () => compileNSInitializer(baseArgument.code, {
66493
- project: args.project,
66494
- projectFiles: args.projectFiles ?? [],
66495
- members: [...args.members],
66496
- classes: [...args.classes],
66497
- enums: [...args.enums],
66498
- interfaces: [...args.interfaces ?? []],
66452
+ ...compilationProjectContext(args),
66499
66453
  constructors: args.constructors,
66500
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject },
66501
66454
  returnTypeInfo,
66502
66455
  argumentTypes,
66503
66456
  initializerName: `${owner.name} base argument ${baseArgument.name}`
@@ -66617,14 +66570,8 @@ function compileConstructorBaseInitializerFields(args, owner) {
66617
66570
  return compileUnit2(
66618
66571
  "getter",
66619
66572
  () => compileNSInitializer(field.code, {
66620
- project: args.project,
66621
- projectFiles: args.projectFiles ?? [],
66622
- members: [...args.members],
66623
- classes: [...args.classes],
66624
- enums: [...args.enums],
66625
- interfaces: [...args.interfaces ?? []],
66573
+ ...compilationProjectContext(args),
66626
66574
  constructors: args.constructors,
66627
- ...args.compilationProject === void 0 ? {} : { compilationProject: args.compilationProject },
66628
66575
  returnTypeInfo,
66629
66576
  argumentTypes: args.constructor.argumentTypes,
66630
66577
  initializerName: `${owner.name} base initializer ${field.name}`
@@ -67893,7 +67840,6 @@ var init_constructor_argument_ownership = __esm({
67893
67840
  childrenByContainerId;
67894
67841
  edgesByOwnerValueId;
67895
67842
  referenceCountByTargetValueId;
67896
- classesById;
67897
67843
  membersById;
67898
67844
  constructorsById;
67899
67845
  contextualRootMembersByValueId;
@@ -67908,9 +67854,6 @@ var init_constructor_argument_ownership = __esm({
67908
67854
  this.valuesById = rows;
67909
67855
  this.document = { ...document, values: [...rows.values()] };
67910
67856
  this.contextualRootMembersByValueId = contextualRootMembersByValueId;
67911
- this.classesById = new Map(
67912
- document.classes.map((schemaClass2) => [schemaClass2.id, schemaClass2])
67913
- );
67914
67857
  this.membersById = new Map(
67915
67858
  document.members.map((member) => [member.id, member])
67916
67859
  );
@@ -69927,7 +69870,21 @@ function invalidateEvaluatorIndexes(ctx) {
69927
69870
  function trackedRowForValueReference(value, ctx) {
69928
69871
  if (typeof value !== "object" || value === null) return null;
69929
69872
  const indexes = evaluatorIndexes(ctx);
69930
- return indexes.rowByValueReference.get(value) ?? indexes.baseRowByValueReference?.get(value) ?? ctx.vm.databaseVM?.rowForValueReference?.(value) ?? null;
69873
+ const indexed = indexes.rowByValueReference.get(value) ?? indexes.baseRowByValueReference?.get(value) ?? ctx.vm.databaseVM?.rowForValueReference?.(value) ?? null;
69874
+ if (indexed !== null) return indexed;
69875
+ if (value !== ctx.thisValue || typeof ctx.thisValueRowId !== "string") {
69876
+ return null;
69877
+ }
69878
+ return evalValueById(
69879
+ ctx,
69880
+ ctx.thisValueRowId,
69881
+ ctx.__runtimeSessionValues,
69882
+ ctx.__valueOverlay
69883
+ );
69884
+ }
69885
+ function bindThisValue(ctx, thisValue) {
69886
+ const rowId = thisValue === ctx.thisValue ? ctx.thisValueRowId : trackedRowForValueReference(thisValue, ctx)?.id;
69887
+ return { ...ctx, thisValue, thisValueRowId: rowId };
69931
69888
  }
69932
69889
  function assertStoredReplayMutableValue(value, ctx, label) {
69933
69890
  if (ctx.storedConstructionReplay !== true) return;
@@ -71651,8 +71608,7 @@ function dispatchNSSetter(target, value, scope, ctx, writes) {
71651
71608
  evaluateNSSetter(
71652
71609
  setter,
71653
71610
  {
71654
- ...ctx,
71655
- thisValue: receiver,
71611
+ ...bindThisValue(ctx, receiver),
71656
71612
  __setterCallStack: innerStack
71657
71613
  },
71658
71614
  value,
@@ -72233,7 +72189,7 @@ function evalPointer(pointer, scope, ctx) {
72233
72189
  try {
72234
72190
  return executeCompiledFunction(
72235
72191
  action,
72236
- { ...ctx, thisValue: innerThis },
72192
+ bindThisValue(ctx, innerThis),
72237
72193
  args,
72238
72194
  runtimeSignature.returnTypeInfo.type === NS_TYPE_VOID,
72239
72195
  runtimeSignature
@@ -72476,7 +72432,7 @@ function invokeDelegateValue(value, args, ctx, callSiteId, ownerReceiver) {
72476
72432
  const runtimeSignature = receiver === null ? signature : substituteCallableSignatureForReceiver(signature, receiver, ctx);
72477
72433
  return executeCompiledFunction(
72478
72434
  action,
72479
- { ...ctx, thisValue: receiver },
72435
+ bindThisValue(ctx, receiver),
72480
72436
  args,
72481
72437
  runtimeSignature.returnTypeInfo.type === NS_TYPE_VOID,
72482
72438
  runtimeSignature
@@ -73146,8 +73102,7 @@ function dispatchNSGetterById(memberId, receiver, ctx) {
73146
73102
  const innerStack = new Set(stack);
73147
73103
  innerStack.add(memberId);
73148
73104
  return evaluateNSGetter(getter, {
73149
- ...ctx,
73150
- thisValue: receiver,
73105
+ ...bindThisValue(ctx, receiver),
73151
73106
  __getterCallStack: innerStack
73152
73107
  });
73153
73108
  }
@@ -75683,7 +75638,7 @@ function runDeclaredConstructorChain(args) {
75683
75638
  args.applyBaseInitializerBlock(record3, args.argumentValues, args.thisValue);
75684
75639
  executeCompiledFunction(
75685
75640
  record3.action,
75686
- { ...ctx, thisValue: args.thisValue },
75641
+ bindThisValue(ctx, args.thisValue),
75687
75642
  args.argumentValues,
75688
75643
  true
75689
75644
  );
@@ -75758,7 +75713,7 @@ function evaluateBaseInitializerFields(args) {
75758
75713
  });
75759
75714
  const value = executeCompiledFunction(
75760
75715
  getter,
75761
- { ...ctx, thisValue: args.thisValue },
75716
+ bindThisValue(ctx, args.thisValue),
75762
75717
  args.argumentValues,
75763
75718
  false
75764
75719
  );
@@ -75999,9 +75954,7 @@ function evaluateInitializerInContext(init, member, ctx, createdValues, argument
75999
75954
  const closeFrame = pushConstructionFrame(ctx, `${member.name} initializer`);
76000
75955
  let result;
76001
75956
  try {
76002
- const initializerCtx = ctx.thisValue === null ? ctx : Object.assign({}, ctx, {
76003
- thisValue: null
76004
- });
75957
+ const initializerCtx = ctx.thisValue === null ? ctx : bindThisValue(ctx, null);
76005
75958
  result = evaluateNSGetterWithEffects(
76006
75959
  compiled,
76007
75960
  initializerCtx,
@@ -81136,6 +81089,7 @@ var init_evaluateInitializer = __esm({
81136
81089
  "../src/view-models/neoscript-evaluator/evaluateInitializer.ts"() {
81137
81090
  "use strict";
81138
81091
  init_deep_clone_plain_data();
81092
+ init_collections();
81139
81093
  init_instance_provenance();
81140
81094
  init_members();
81141
81095
  init_project2();
@@ -81625,24 +81579,17 @@ var init_project_record_migrations = __esm({
81625
81579
  var project_document_read_exports = {};
81626
81580
  __export(project_document_read_exports, {
81627
81581
  DOCUMENT_MANIFEST_PAGE_SIZE: () => DOCUMENT_MANIFEST_PAGE_SIZE,
81628
- DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE: () => DOCUMENT_SNAPSHOT_FETCH_CHUNK_SIZE,
81629
- DOCUMENT_SNAPSHOT_FETCH_CONCURRENCY: () => DOCUMENT_SNAPSHOT_FETCH_CONCURRENCY,
81630
- appendProjectRecordToBuckets: () => appendProjectRecordToBuckets,
81631
81582
  assembleProjectDocumentRaw: () => assembleProjectDocumentRaw,
81632
- emptyProjectRecordBuckets: () => emptyProjectRecordBuckets,
81633
81583
  fetchProjectDocumentPartitionRecords: () => fetchProjectDocumentPartitionRecords,
81634
81584
  fetchProjectDocumentRawChunked: () => fetchProjectDocumentRawChunked,
81635
81585
  fetchProjectDocumentSnapshots: () => fetchProjectDocumentSnapshots,
81636
81586
  readArrayField: () => readArrayField,
81637
- readField: () => readField,
81638
- readOptionalArrayField: () => readOptionalArrayField,
81639
81587
  readProjectDocument: () => readProjectDocument,
81640
81588
  readProjectDocumentContentHashHeads: () => readProjectDocumentContentHashHeads,
81641
81589
  readProjectDocumentManifestPage: () => readProjectDocumentManifestPage,
81642
81590
  readProjectDocumentManifestPageRecords: () => readProjectDocumentManifestPageRecords,
81643
81591
  readProjectDocumentManifestRecords: () => readProjectDocumentManifestRecords,
81644
81592
  readProjectDocumentRevisionMarker: () => readProjectDocumentRevisionMarker,
81645
- readStoredMembersField: () => readStoredMembersField,
81646
81593
  withStoredValueBase: () => withStoredValueBase
81647
81594
  });
81648
81595
  async function fetchProjectDocumentRawChunked(runner, options = {}) {
@@ -86460,7 +86407,6 @@ var init_root_source = __esm({
86460
86407
  init_projection();
86461
86408
  init_instance_provenance();
86462
86409
  init_value_sources();
86463
- init_root_value_paths();
86464
86410
  init_source_format();
86465
86411
  init_stored_value_placements();
86466
86412
  ROOT_PROJECT_FIELDS2 = [
@@ -87095,16 +87041,6 @@ var init_animation_clips = __esm({
87095
87041
  const member = this.envBindingMember(env, paramId);
87096
87042
  return isMemberClass(member) ? member.classId : null;
87097
87043
  }
87098
- classDescendsFrom(classId, baseClassId) {
87099
- const visited = /* @__PURE__ */ new Set();
87100
- let current = this.classById.get(classId);
87101
- while (current !== void 0 && !visited.has(current.id)) {
87102
- if (current.id === baseClassId) return true;
87103
- visited.add(current.id);
87104
- current = current.extendsClassId ? this.classById.get(current.extendsClassId) : void 0;
87105
- }
87106
- return false;
87107
- }
87108
87044
  /**
87109
87045
  * P48 §1 and §7's segment rules, for every segment the document holds.
87110
87046
  *
@@ -87580,13 +87516,6 @@ var init_animation_clips = __esm({
87580
87516
  };
87581
87517
  return isMemberClass(resolvedEntryMember) ? resolvedEntryMember.classId : void 0;
87582
87518
  }
87583
- requireSingleLookupField(parent, classId, memberId, label) {
87584
- const value = this.scalarField(parent, classId, memberId);
87585
- if (!Array.isArray(value) || value.length !== 1 || typeof value[0] !== "string") {
87586
- throw new Error(`${label} must reference exactly one child.`);
87587
- }
87588
- return value[0];
87589
- }
87590
87519
  requirePositiveIntegerField(parent, classId, memberId, label) {
87591
87520
  const value = this.requireIntegerField(parent, classId, memberId, label);
87592
87521
  if (value < 1) throw new Error(`${label} must be at least 1.`);
@@ -87655,10 +87584,6 @@ var init_animation_clips = __esm({
87655
87584
  const bindingMember = binding?.kind === "member" ? this.memberById.get(binding.memberId) : void 0;
87656
87585
  return isMemberClass(bindingMember) ? bindingMember.classId : null;
87657
87586
  }
87658
- requireClassMember(value) {
87659
- if (!isMemberClass(value)) throw new Error("Expected Class member.");
87660
- return value;
87661
- }
87662
87587
  field(classId, requiredMemberId) {
87663
87588
  const entry = mergeStoredInstanceSchema(
87664
87589
  classId,
@@ -87958,6 +87883,12 @@ var init_variant_value_graph = __esm({
87958
87883
  });
87959
87884
 
87960
87885
  // ../src/database/project-version-intents.ts
87886
+ var project_version_intents_exports = {};
87887
+ __export(project_version_intents_exports, {
87888
+ ProjectVersionIntentType: () => ProjectVersionIntentType,
87889
+ createProjectVersionIntent: () => createProjectVersionIntent,
87890
+ isKnownProjectVersionIntentType: () => isKnownProjectVersionIntentType
87891
+ });
87961
87892
  function createProjectVersionIntent(type, details) {
87962
87893
  if (details === void 0) {
87963
87894
  return {
@@ -88717,7 +88648,7 @@ function storedConstructionEmitters(state, manifest) {
88717
88648
  if (!isObjectRecord2(record3.data)) continue;
88718
88649
  if (!isObjectRecord2(record3.data.value)) continue;
88719
88650
  const constructorArgs = record3.data.constructorArgs;
88720
- const hasInstanceProvenance = carriesStoredInstanceProvenance(record3.data);
88651
+ const hasInstanceProvenance = isVirtualInstanceRootShape(record3.data);
88721
88652
  if (constructorArgs !== void 0 && constructorArgs !== null && !hasInstanceProvenance) {
88722
88653
  continue;
88723
88654
  }
@@ -88816,9 +88747,6 @@ function nearestOwnedAncestor(valueId, parents, owners) {
88816
88747
  }
88817
88748
  return null;
88818
88749
  }
88819
- function carriesStoredInstanceProvenance(value) {
88820
- return isVirtualInstanceRootShape(value);
88821
- }
88822
88750
  function readMaterializedConstructionBuildCacheV2(root, state) {
88823
88751
  try {
88824
88752
  const parsed = JSON.parse(
@@ -89660,7 +89588,7 @@ function withoutFields(value, ignored) {
89660
89588
  Object.entries(value).filter(([field]) => !ignored.has(field))
89661
89589
  );
89662
89590
  }
89663
- var NON_CONTRACT_MEMBER_FIELDS, NS_PROPERTY_BODY_FIELDS, NS_FUNCTION_BODY_FIELDS, collectCompiledClassIds;
89591
+ var NON_CONTRACT_MEMBER_FIELDS, NS_PROPERTY_BODY_FIELDS, NS_FUNCTION_BODY_FIELDS;
89664
89592
  var init_neo_script_recompile_scope = __esm({
89665
89593
  "../src/database/neo-script-recompile-scope.ts"() {
89666
89594
  "use strict";
@@ -89700,7 +89628,6 @@ var init_neo_script_recompile_scope = __esm({
89700
89628
  "bodyMode",
89701
89629
  "uiAction"
89702
89630
  ]);
89703
- collectCompiledClassIds = collectConstructedClassIds;
89704
89631
  }
89705
89632
  });
89706
89633
 
@@ -91134,7 +91061,7 @@ function consumeWorldPlacementSidecarKeys(args) {
91134
91061
  }
91135
91062
  return present;
91136
91063
  }
91137
- var WORLD_PLACEMENT_SIDECAR_KEYS, WORLD_PLACEMENT_SIDECAR_KEY_SET, WORLD_PLACEMENT_ASSET_KIND;
91064
+ var WORLD_PLACEMENT_SIDECAR_KEYS, WORLD_PLACEMENT_ASSET_KIND;
91138
91065
  var init_world_content_sidecar_validation = __esm({
91139
91066
  "../src/models/project/world-content-sidecar-validation.ts"() {
91140
91067
  "use strict";
@@ -91150,9 +91077,6 @@ var init_world_content_sidecar_validation = __esm({
91150
91077
  "assetValueId",
91151
91078
  "variantId"
91152
91079
  ];
91153
- WORLD_PLACEMENT_SIDECAR_KEY_SET = new Set(
91154
- WORLD_PLACEMENT_SIDECAR_KEYS
91155
- );
91156
91080
  WORLD_PLACEMENT_ASSET_KIND = /* @__PURE__ */ new Map([
91157
91081
  [NeoWorldSystemClassKind.TileInstance, NeoWorldSystemClassKind.Tile],
91158
91082
  [NeoWorldSystemClassKind.ObjectPlacementTile, NeoWorldSystemClassKind.Object],
@@ -96239,6 +96163,151 @@ function variantRootValueId2(data) {
96239
96163
  if (typeof valueId !== "string" || valueId.length === 0) return null;
96240
96164
  return valueId;
96241
96165
  }
96166
+ function planProjectVersionTransaction(changes, atomicGroups) {
96167
+ if (changes.length === 0) {
96168
+ throw new Error("A project-version transaction plan requires changes.");
96169
+ }
96170
+ const changeCosts = changes.map(estimateProjectVersionChangeCost);
96171
+ const groups = normalizeAtomicGroups(changes.length, atomicGroups);
96172
+ let totalEstimatedCost = changeCosts.reduce(
96173
+ addProjectVersionTransactionBudgets,
96174
+ IMMEDIATE_FIXED_COST
96175
+ );
96176
+ if (changes.some(projectVersionChangeCanTriggerWholeGraphValidation)) {
96177
+ totalEstimatedCost = addProjectVersionTransactionBudgets(
96178
+ totalEstimatedCost,
96179
+ WHOLE_GRAPH_VALIDATION_SURCHARGE
96180
+ );
96181
+ }
96182
+ const limitingResource = firstExceededResource(
96183
+ totalEstimatedCost,
96184
+ PROJECT_TRANSACTION_IMMEDIATE_BUDGET
96185
+ );
96186
+ if (limitingResource === null) {
96187
+ return {
96188
+ path: "immediate",
96189
+ limitingResource: null,
96190
+ totalEstimatedCost,
96191
+ chunks: [
96192
+ {
96193
+ firstChangeIndex: 0,
96194
+ changeCount: changes.length,
96195
+ estimatedCost: totalEstimatedCost
96196
+ }
96197
+ ]
96198
+ };
96199
+ }
96200
+ const chunks = [];
96201
+ let firstChangeIndex = 0;
96202
+ let chunkCost = CHUNK_FIXED_COST;
96203
+ let changeCount = 0;
96204
+ for (const group of groups) {
96205
+ const groupCost = changeCosts.slice(group.firstChangeIndex, group.firstChangeIndex + group.changeCount).reduce(addProjectVersionTransactionBudgets, EMPTY_BUDGET);
96206
+ const nativeExceeded = firstExceededResource(
96207
+ addProjectVersionTransactionBudgets(CHUNK_FIXED_COST, groupCost),
96208
+ PROJECT_TRANSACTION_SINGLE_CHANGE_NATIVE_BUDGET
96209
+ );
96210
+ if (nativeExceeded !== null) {
96211
+ throw new Error(
96212
+ `Project-version atomic group starting at change ${group.firstChangeIndex} (${group.changeCount} changes) exceeds the native worker budget for ${nativeExceeded}.`
96213
+ );
96214
+ }
96215
+ const nextCost = addProjectVersionTransactionBudgets(chunkCost, groupCost);
96216
+ const exceeded = firstExceededResource(
96217
+ nextCost,
96218
+ PROJECT_TRANSACTION_WORKER_BUDGET
96219
+ );
96220
+ if (exceeded !== null && changeCount > 0) {
96221
+ chunks.push({ firstChangeIndex, changeCount, estimatedCost: chunkCost });
96222
+ firstChangeIndex = group.firstChangeIndex;
96223
+ changeCount = 0;
96224
+ chunkCost = CHUNK_FIXED_COST;
96225
+ }
96226
+ chunkCost = addProjectVersionTransactionBudgets(chunkCost, groupCost);
96227
+ changeCount += group.changeCount;
96228
+ }
96229
+ if (changeCount > 0) {
96230
+ chunks.push({ firstChangeIndex, changeCount, estimatedCost: chunkCost });
96231
+ }
96232
+ return {
96233
+ path: "asynchronous",
96234
+ limitingResource,
96235
+ totalEstimatedCost,
96236
+ chunks
96237
+ };
96238
+ }
96239
+ function projectVersionChangeCanTriggerWholeGraphValidation(change) {
96240
+ if (change.recordKind === "enum" || change.recordKind === "member" || change.recordKind === "project" || change.recordKind === "internal-record-relation") {
96241
+ return true;
96242
+ }
96243
+ if (change.recordKind === "class") return change.operation !== "create";
96244
+ if (change.recordKind !== "value") return false;
96245
+ if (change.operation === "delete") return true;
96246
+ return valueChangeCarriesWorldLayerOverride(change);
96247
+ }
96248
+ function valueChangeCarriesWorldLayerOverride(change) {
96249
+ const nextData = change.nextData;
96250
+ if (nextData === null || typeof nextData !== "object") return false;
96251
+ if (Array.isArray(nextData)) return false;
96252
+ const value = nextData.value;
96253
+ if (value === null || typeof value !== "object") return false;
96254
+ if (Array.isArray(value)) return false;
96255
+ return typeof value.layerOverrideValueId === "string";
96256
+ }
96257
+ function normalizeAtomicGroups(changeCount, groups) {
96258
+ if (groups === void 0) {
96259
+ return Array.from({ length: changeCount }, (_, firstChangeIndex) => ({
96260
+ firstChangeIndex,
96261
+ changeCount: 1
96262
+ }));
96263
+ }
96264
+ let nextChangeIndex = 0;
96265
+ for (const group of groups) {
96266
+ if (!Number.isSafeInteger(group.firstChangeIndex) || !Number.isSafeInteger(group.changeCount) || group.firstChangeIndex !== nextChangeIndex || group.changeCount < 1) {
96267
+ throw new Error(
96268
+ "Project-version atomic groups must be positive, ordered, and contiguous."
96269
+ );
96270
+ }
96271
+ nextChangeIndex += group.changeCount;
96272
+ }
96273
+ if (nextChangeIndex !== changeCount) {
96274
+ throw new Error(
96275
+ `Project-version atomic groups cover ${nextChangeIndex}/${changeCount} changes.`
96276
+ );
96277
+ }
96278
+ return [...groups];
96279
+ }
96280
+ function estimateProjectVersionChangeCost(change) {
96281
+ const encoded = canonicalJsonStringify(change);
96282
+ const payloadBytes = new TextEncoder().encode(encoded).byteLength;
96283
+ const hasBase = change.operation !== "create";
96284
+ const counts = changeCountCost(change);
96285
+ return {
96286
+ argumentBytes: payloadBytes + 128,
96287
+ bytesRead: payloadBytes * (hasBase ? 3 : 1) + CHANGE_BYTES_READ_OVERHEAD,
96288
+ bytesWritten: payloadBytes * 2 + CHANGE_BYTES_WRITTEN_OVERHEAD,
96289
+ documentsRead: counts.documentsRead,
96290
+ documentsWritten: counts.documentsWritten,
96291
+ databaseQueries: counts.databaseQueries,
96292
+ // Not metered by Convex: `TransactionMetrics` reports seven dimensions and
96293
+ // this is not one of them, so it cannot be measured the way the others
96294
+ // were. Every index range a change opens is also a database query, so the
96295
+ // measured query count is a strict upper bound on it. Charging exactly
96296
+ // that keeps the dimension a true bound instead of an invented number,
96297
+ // and keeps it dominated by `databaseQueries` rather than silently
96298
+ // becoming the binding constraint on a well-measured plan.
96299
+ indexRanges: counts.databaseQueries,
96300
+ functionsScheduled: 0,
96301
+ scheduledFunctionArgsBytes: 0,
96302
+ returnBytes: payloadBytes + 512
96303
+ };
96304
+ }
96305
+ function changeCountCost(change) {
96306
+ if (change.recordKind === "value") {
96307
+ return VALUE_CHANGE_COUNT_COSTS[change.operation];
96308
+ }
96309
+ return SCHEMA_CHANGE_COUNT_COSTS[change.operation];
96310
+ }
96242
96311
  function addProjectVersionTransactionBudgets(left, right) {
96243
96312
  return {
96244
96313
  argumentBytes: left.argumentBytes + right.argumentBytes,
@@ -96253,7 +96322,15 @@ function addProjectVersionTransactionBudgets(left, right) {
96253
96322
  returnBytes: left.returnBytes + right.returnBytes
96254
96323
  };
96255
96324
  }
96256
- var KIB, MIB, PROJECT_TRANSACTION_CHUNK_PAYLOAD_TARGET_BYTES, PROJECT_TRANSACTION_IMMEDIATE_BUDGET, PROJECT_TRANSACTION_WORKER_BUDGET, PROJECT_TRANSACTION_SINGLE_CHANGE_NATIVE_BUDGET, EMPTY_BUDGET, CHUNK_GRAPH_VALIDATION_RESERVE, CHUNK_FIXED_COST, IMMEDIATE_FIXED_COST, WHOLE_GRAPH_VALIDATION_SURCHARGE, CHANGE_BYTES_READ_OVERHEAD, CHANGE_BYTES_WRITTEN_OVERHEAD;
96325
+ function firstExceededResource(cost, target) {
96326
+ for (const resource of Object.keys(
96327
+ EMPTY_BUDGET
96328
+ )) {
96329
+ if (cost[resource] > target[resource]) return resource;
96330
+ }
96331
+ return null;
96332
+ }
96333
+ var KIB, MIB, PROJECT_TRANSACTION_CHUNK_PAYLOAD_TARGET_BYTES, PROJECT_TRANSACTION_IMMEDIATE_BUDGET, PROJECT_TRANSACTION_WORKER_BUDGET, PROJECT_TRANSACTION_SINGLE_CHANGE_NATIVE_BUDGET, EMPTY_BUDGET, CHUNK_GRAPH_VALIDATION_RESERVE, CHUNK_FIXED_COST, IMMEDIATE_FIXED_COST, WHOLE_GRAPH_VALIDATION_SURCHARGE, VALUE_CHANGE_COUNT_COSTS, SCHEMA_CHANGE_COUNT_COSTS, CHANGE_BYTES_READ_OVERHEAD, CHANGE_BYTES_WRITTEN_OVERHEAD;
96257
96334
  var init_project_version_transaction_planning = __esm({
96258
96335
  "../src/database/project-version-transaction-planning.ts"() {
96259
96336
  "use strict";
@@ -96342,6 +96419,16 @@ var init_project_version_transaction_planning = __esm({
96342
96419
  databaseQueries: 410,
96343
96420
  indexRanges: 410
96344
96421
  };
96422
+ VALUE_CHANGE_COUNT_COSTS = {
96423
+ create: { documentsRead: 3, documentsWritten: 3, databaseQueries: 8 },
96424
+ update: { documentsRead: 6, documentsWritten: 3, databaseQueries: 9 },
96425
+ delete: { documentsRead: 6, documentsWritten: 3, databaseQueries: 14 }
96426
+ };
96427
+ SCHEMA_CHANGE_COUNT_COSTS = {
96428
+ create: { documentsRead: 3, documentsWritten: 5, databaseQueries: 12 },
96429
+ update: { documentsRead: 6, documentsWritten: 5, databaseQueries: 22 },
96430
+ delete: { documentsRead: 6, documentsWritten: 5, databaseQueries: 22 }
96431
+ };
96345
96432
  CHANGE_BYTES_READ_OVERHEAD = 4 * KIB;
96346
96433
  CHANGE_BYTES_WRITTEN_OVERHEAD = 4 * KIB;
96347
96434
  }
@@ -105870,7 +105957,7 @@ function extractProjectSnapshotDerivedEdges(source) {
105870
105957
  payloadJson: canonicalJsonStringify({ referenceKind: "type-name" })
105871
105958
  });
105872
105959
  }
105873
- for (const targetKey of collectCompiledClassIds(source.data)) {
105960
+ for (const targetKey of collectConstructedClassIds(source.data)) {
105874
105961
  add({
105875
105962
  edgeKind: "compiled-reference",
105876
105963
  targetKey,
@@ -110767,7 +110854,6 @@ function lowerSeedRow(context, member, sourceExpression, source, valueId, path,
110767
110854
  context,
110768
110855
  effectiveClass,
110769
110856
  environment,
110770
- source,
110771
110857
  path
110772
110858
  );
110773
110859
  const body = {};
@@ -111097,7 +111183,6 @@ function lowerStructuralConstructionRow(context, member, expression, source, val
111097
111183
  context,
111098
111184
  effectiveClass,
111099
111185
  environment,
111100
- source,
111101
111186
  path
111102
111187
  );
111103
111188
  const parameters = structuralConstructorParameters(
@@ -112227,7 +112312,7 @@ function selectorReferenceReturnClassId(context, expression) {
112227
112312
  const className = astTypeNameV4(returned.typeArguments[0]);
112228
112313
  return className === null ? null : context.classesByName.get(className)?.id ?? null;
112229
112314
  }
112230
- function animationChildOverrideSeedBindings(context, schemaClass2, environment, source, path) {
112315
+ function animationChildOverrideSeedBindings(context, schemaClass2, environment, path) {
112231
112316
  if (schemaClass2.system?.worldKind !== "animationChildOverride") {
112232
112317
  return void 0;
112233
112318
  }
@@ -116331,7 +116416,7 @@ function discoverProjectBinariesV4(root, explicit, ignoredPaths = []) {
116331
116416
  });
116332
116417
  }
116333
116418
  const reserved = explicit.map((entry) => entry.symbol);
116334
- const symbols = assignDeterministicFileSymbols2(candidates, reserved);
116419
+ const symbols = assignDeterministicFileSymbols(candidates, reserved);
116335
116420
  return candidates.map((candidate) => {
116336
116421
  const inspected = inspectBinaryFile(candidate.absolute, candidate.path);
116337
116422
  return { ...inspected, symbol: symbols.get(candidate.stableId) };
@@ -116582,15 +116667,14 @@ function safePathSegment2(value) {
116582
116667
  function normalizeSlash2(value) {
116583
116668
  return value.split(sep2).join("/").replaceAll("\\", "/");
116584
116669
  }
116585
- var SUPPORTED_BINARY_TYPES, REGISTRY_ENTRY2, assignDeterministicFileSymbols2;
116670
+ var SUPPORTED_BINARY_TYPES, REGISTRY_ENTRY2;
116586
116671
  var init_project_files = __esm({
116587
116672
  "src/project-source/project-files.ts"() {
116588
116673
  "use strict";
116589
116674
  init_src();
116590
116675
  init_projection();
116591
116676
  init_source_format();
116592
- init_members();
116593
- init_project_file_registry();
116677
+ init_project_file_source();
116594
116678
  init_project_file_source();
116595
116679
  SUPPORTED_BINARY_TYPES = /* @__PURE__ */ new Map([
116596
116680
  [".png", { kind: "image", mimeType: "image/png" }],
@@ -116602,7 +116686,6 @@ var init_project_files = __esm({
116602
116686
  [".ogg", { kind: "audio", mimeType: "audio/ogg" }]
116603
116687
  ]);
116604
116688
  REGISTRY_ENTRY2 = /(?:@id\(\s*("(?:[^"\\]|\\.)*")\s*\)\s*)?(?:@settings\(([\s\S]*?)\)\s*)?(NeoImage|NeoAudioClip)\s+([A-Za-z_][A-Za-z0-9_]*)\s*=\s*new\(\s*("(?:[^"\\]|\\.)*")\s*\)\s*;/gy;
116605
- assignDeterministicFileSymbols2 = assignDeterministicProjectFileSymbols;
116606
116689
  }
116607
116690
  });
116608
116691
 
@@ -116864,6 +116947,14 @@ var init_api = __esm({
116864
116947
  });
116865
116948
 
116866
116949
  // src/convex.ts
116950
+ var convex_exports = {};
116951
+ __export(convex_exports, {
116952
+ api: () => api2,
116953
+ createConvexClient: () => createConvexClient,
116954
+ createConvexClientForApi: () => createConvexClientForApi,
116955
+ mintConvexJwt: () => mintConvexJwt,
116956
+ resolveConvexUrl: () => resolveConvexUrl
116957
+ });
116867
116958
  import { ConvexHttpClient } from "convex/browser";
116868
116959
  import { Buffer as Buffer2 } from "node:buffer";
116869
116960
  async function mintConvexJwt(apiBaseUrl) {
@@ -117650,6 +117741,7 @@ function acceptSourceEquivalentConflictBases(workspace, mainLocale = workspaceMa
117650
117741
  };
117651
117742
  delete next.conflictServerHash;
117652
117743
  delete next.conflictServerData;
117744
+ delete next.conflictFiles;
117653
117745
  workspace.state.records[key] = next;
117654
117746
  accepted += 1;
117655
117747
  }
@@ -118296,7 +118388,6 @@ var init_static_value_seed_records = __esm({
118296
118388
  // src/commands/pull.ts
118297
118389
  var pull_exports = {};
118298
118390
  __export(pull_exports, {
118299
- deltaRequiresSourceProjectionV4: () => deltaRequiresSourceProjectionV4,
118300
118391
  projectSourcePathsRequiringRewriteV4: () => projectSourcePathsRequiringRewriteV4,
118301
118392
  runPull: () => runPull
118302
118393
  });
@@ -118668,34 +118759,39 @@ async function finishFormat4Pull(args) {
118668
118759
  const serverByPath = new Map(
118669
118760
  (serverResult?.files ?? []).map((file) => [file.path, file])
118670
118761
  );
118762
+ const localRecordFiles = declaringSourcePathsV4(localResult);
118763
+ const serverRecordFiles = serverResult === null ? /* @__PURE__ */ new Map() : declaringSourcePathsV4(serverResult);
118671
118764
  const conflictPaths = /* @__PURE__ */ new Set();
118765
+ const conflictPathsByKey = /* @__PURE__ */ new Map();
118672
118766
  const authoredLocalConflictKeysByPath = /* @__PURE__ */ new Map();
118673
118767
  for (const key of conflictKeys) {
118674
- const localPath = localResult.recordFiles.get(key);
118675
- const serverPath = serverResult?.recordFiles.get(key);
118676
- const path = localPath ?? serverPath ?? workspace.state.records[key]?.file;
118677
- if (path) conflictPaths.add(path);
118678
- if (path === void 0 || localPath !== void 0 || serverPath !== void 0) {
118679
- continue;
118768
+ const paths = [...localRecordFiles.get(key) ?? []];
118769
+ for (const path of serverRecordFiles.get(key) ?? []) {
118770
+ if (!paths.includes(path)) paths.push(path);
118680
118771
  }
118681
- const keys = authoredLocalConflictKeysByPath.get(path) ?? [];
118682
- keys.push(key);
118683
- authoredLocalConflictKeysByPath.set(path, keys);
118772
+ if (paths.length === 0) {
118773
+ const previousPath = workspace.state.records[key]?.file;
118774
+ if (previousPath === void 0) continue;
118775
+ paths.push(previousPath);
118776
+ const keys = authoredLocalConflictKeysByPath.get(previousPath) ?? [];
118777
+ keys.push(key);
118778
+ authoredLocalConflictKeysByPath.set(previousPath, keys);
118779
+ }
118780
+ for (const path of paths) conflictPaths.add(path);
118781
+ conflictPathsByKey.set(key, paths);
118684
118782
  }
118685
118783
  const emittedPaths = /* @__PURE__ */ new Set([
118686
118784
  ...localByPath.keys(),
118687
118785
  ...[...conflictPaths].filter((path) => serverByPath.has(path)),
118688
118786
  ...authoredLocalConflictKeysByPath.keys()
118689
118787
  ]);
118690
- const localRecordFiles = declaringSourcePathsV4(localResult);
118691
118788
  const rewritePaths = projectSourcePathsRequiringRewriteV4({
118692
118789
  destructive,
118693
118790
  localStatus,
118694
118791
  plans,
118695
118792
  localRecordFiles,
118696
- serverRecordFiles: serverResult === null ? /* @__PURE__ */ new Map() : declaringSourcePathsV4(serverResult),
118793
+ serverRecordFiles,
118697
118794
  previousRecords: workspace.state.records,
118698
- conflictPaths,
118699
118795
  emittedPaths,
118700
118796
  mainLocale: workspaceMainLocale(workspace.state.records)
118701
118797
  });
@@ -118703,6 +118799,7 @@ async function finishFormat4Pull(args) {
118703
118799
  for (const path of localRecordFiles.get(key) ?? []) rewritePaths.add(path);
118704
118800
  }
118705
118801
  const resolveSourcePath = createWorkspaceSourcePathResolver(workspace.root);
118802
+ const markedPaths = /* @__PURE__ */ new Set();
118706
118803
  let written = 0;
118707
118804
  for (const path of emittedPaths) {
118708
118805
  const absolute = resolveSourcePath(path);
@@ -118723,8 +118820,10 @@ async function finishFormat4Pull(args) {
118723
118820
  versionId: workspace.config.versionId
118724
118821
  }) : local;
118725
118822
  if (content === void 0) continue;
118823
+ const marked = conflictPaths.has(path) && detectConflictMarkers(content) !== null;
118824
+ if (marked) markedPaths.add(path);
118726
118825
  mkdirSync8(dirname8(absolute), { recursive: true });
118727
- if (existing !== null && !rewritePaths.has(path)) continue;
118826
+ if (existing !== null && !marked && !rewritePaths.has(path)) continue;
118728
118827
  if (existing !== content) {
118729
118828
  writeFileSync8(absolute, content, "utf8");
118730
118829
  written += 1;
@@ -118757,12 +118856,16 @@ async function finishFormat4Pull(args) {
118757
118856
  continue;
118758
118857
  }
118759
118858
  const file = localResult.recordFiles.get(key) ?? serverResult?.recordFiles.get(key) ?? baseState?.file;
118859
+ const conflictFiles = (conflictPathsByKey.get(key) ?? []).filter(
118860
+ (conflictPath) => markedPaths.has(conflictPath)
118861
+ );
118760
118862
  records2[key] = plan.conflicted ? {
118761
118863
  recordKind,
118762
118864
  recordId,
118763
118865
  contentHash: baseState?.contentHash ?? "",
118764
118866
  data: baseState?.data,
118765
118867
  ...file ? { file } : {},
118868
+ ...conflictFiles.length === 0 ? {} : { conflictFiles },
118766
118869
  conflictServerHash: serverRecord?.contentHash ?? null,
118767
118870
  conflictServerData: plan.serverData
118768
118871
  } : {
@@ -118849,9 +118952,9 @@ async function finishFormat4Pull(args) {
118849
118952
  );
118850
118953
  for (const key of conflictKeys) console.log(` ${sym.fail} ${key}`);
118851
118954
  for (const tear of staleConflictTears) {
118852
- const rowLabel = tear.unanchoredValueCount === 1 ? "row" : "rows";
118955
+ const rowLabel2 = tear.unanchoredValueCount === 1 ? "row" : "rows";
118853
118956
  warn(
118854
- `Conflict ${tear.recordKind} "${tear.recordId}" retained a local base that does not anchor ${tear.unanchoredValueCount} newly pulled descendant value ${rowLabel}. Resolve it with "neo resolve --mine" or "neo resolve --theirs" before pushing.`
118957
+ `Conflict ${tear.recordKind} "${tear.recordId}" retained a local base that does not anchor ${tear.unanchoredValueCount} newly pulled descendant value ${rowLabel2}. Resolve it with "neo resolve --mine" or "neo resolve --theirs" before pushing.`
118855
118958
  );
118856
118959
  }
118857
118960
  }
@@ -119025,7 +119128,7 @@ function projectSourcePathsRequiringRewriteV4(args) {
119025
119128
  if (args.destructive || args.localStatus === null) {
119026
119129
  return new Set(args.emittedPaths);
119027
119130
  }
119028
- const result = new Set(args.conflictPaths);
119131
+ const result = /* @__PURE__ */ new Set();
119029
119132
  for (const [key, plan] of args.plans) {
119030
119133
  const paths = args.localRecordFiles.get(key) ?? args.serverRecordFiles.get(key);
119031
119134
  if (paths === void 0) continue;
@@ -126391,7 +126494,7 @@ var init_registry2 = __esm({
126391
126494
  PROJECT_SCHEMA_CONTRACT = Object.freeze({
126392
126495
  formatVersion: 4,
126393
126496
  contractVersion: "4.1",
126394
- cliVersion: "0.43.0",
126497
+ cliVersion: "0.44.0",
126395
126498
  projectFileUploadBatchSize: 32,
126396
126499
  documentRecords: {
126397
126500
  member: {
@@ -129524,12 +129627,8 @@ var init_test = __esm({
129524
129627
  // src/commands/doctor.ts
129525
129628
  var doctor_exports = {};
129526
129629
  __export(doctor_exports, {
129527
- NEO_COMPILER_CONTRACT: () => NEO_COMPILER_CONTRACT,
129528
- NEO_FILE_CONTRACT_VERSION: () => NEO_FILE_CONTRACT_VERSION,
129529
- NEO_SOURCE_CONTRACT_VERSION: () => NEO_SOURCE_CONTRACT_VERSION,
129530
- NEO_VSCODE_EXTENSION_CONTRACT_VERSION: () => NEO_VSCODE_EXTENSION_CONTRACT_VERSION,
129531
- NEO_VSCODE_EXTENSION_ID: () => NEO_VSCODE_EXTENSION_ID,
129532
129630
  inspectNeoDoctor: () => inspectNeoDoctor,
129631
+ planUnprojectedValueRowRepair: () => planUnprojectedValueRowRepair,
129533
129632
  runDoctor: () => runDoctor
129534
129633
  });
129535
129634
  import {
@@ -129762,7 +129861,7 @@ function workspacePath(root, path) {
129762
129861
  function errorMessage3(error) {
129763
129862
  return error instanceof Error ? error.message : String(error);
129764
129863
  }
129765
- async function runDoctor(workspace, json) {
129864
+ async function runDoctor(workspace, options) {
129766
129865
  const inspected = inspectNeoDoctor(workspace);
129767
129866
  let errors = [];
129768
129867
  try {
@@ -129781,7 +129880,7 @@ async function runDoctor(workspace, json) {
129781
129880
  compatible: errors.length === 0
129782
129881
  }
129783
129882
  };
129784
- if (json) {
129883
+ if (options.json) {
129785
129884
  console.log(JSON.stringify(report, null, 2));
129786
129885
  if (!report.ok) process.exitCode = 1;
129787
129886
  return;
@@ -129828,23 +129927,213 @@ async function runDoctor(workspace, json) {
129828
129927
  console.log(
129829
129928
  report.ok ? "Project authoring contracts are compatible." : "Project authoring contracts need attention."
129830
129929
  );
129831
- if (!report.document.consistent) {
129930
+ if (!report.document.consistent && !options.fix) {
129832
129931
  console.log(
129833
129932
  `${String(report.document.findings.length)} malformed record${report.document.findings.length === 1 ? "" : "s"} in the pulled document \u2014 see \`--json\` for the repair entries.`
129834
129933
  );
129835
129934
  }
129836
129935
  if (!report.ok) process.exitCode = 1;
129936
+ if (options.fix) {
129937
+ await repairUnprojectedValueRows(
129938
+ workspace,
129939
+ report.document.findings,
129940
+ options.yes
129941
+ );
129942
+ }
129943
+ }
129944
+ function planUnprojectedValueRowRepair(workspace, findings) {
129945
+ const roots = [];
129946
+ const claimed = /* @__PURE__ */ new Set();
129947
+ const unrepairableKinds = /* @__PURE__ */ new Set();
129948
+ for (const finding of findings) {
129949
+ if (finding.kind !== "unprojected-value-row") {
129950
+ unrepairableKinds.add(finding.kind);
129951
+ continue;
129952
+ }
129953
+ const owned = [];
129954
+ for (const valueId of finding.repair.orphanedValueIds) {
129955
+ if (claimed.has(valueId)) continue;
129956
+ claimed.add(valueId);
129957
+ const record3 = workspace.state.records[recordStateKey("value", valueId)];
129958
+ if (record3 === void 0) {
129959
+ throw new Error(
129960
+ `Doctor repair planned value row "${valueId}", which the pulled state does not hold. Run \`neo pull\` and rerun \`neo doctor --fix\`.`
129961
+ );
129962
+ }
129963
+ owned.push(record3);
129964
+ }
129965
+ if (owned.length === 0) continue;
129966
+ roots.push({ valueId: finding.repair.valueId, rows: owned });
129967
+ }
129968
+ return { roots, unrepairableKinds: [...unrepairableKinds].sort() };
129837
129969
  }
129838
- var NEO_COMPILER_CONTRACT, NEO_VSCODE_EXTENSION_ID, NEO_VSCODE_EXTENSION_CONTRACT_VERSION, NEO_SOURCE_CONTRACT_VERSION, NEO_FILE_CONTRACT_VERSION, SOURCE_EXTENSIONS, FILE_CAPABILITIES;
129970
+ function rowLabel(count) {
129971
+ return `${String(count)} value row${count === 1 ? "" : "s"}`;
129972
+ }
129973
+ async function repairUnprojectedValueRows(workspace, findings, yes) {
129974
+ const plan = planUnprojectedValueRowRepair(workspace, findings);
129975
+ if (plan.unrepairableKinds.length > 0) {
129976
+ warn(
129977
+ `No automatic repair exists for ${plan.unrepairableKinds.join(", ")}; repairing unprojected value rows only.`
129978
+ );
129979
+ }
129980
+ if (plan.roots.length === 0) {
129981
+ console.log("Nothing to repair.");
129982
+ return;
129983
+ }
129984
+ const rows = plan.roots.flatMap((root) => root.rows);
129985
+ const pulledHeadTransactionHash = workspace.state.headTransactionHash;
129986
+ if (typeof pulledHeadTransactionHash !== "string") {
129987
+ throw new Error(
129988
+ 'This workspace has no recorded project head, so `neo doctor --fix` cannot prove its deletions land on the state the audit read. Run "neo pull", then rerun.'
129989
+ );
129990
+ }
129991
+ const rootLabel = `${String(plan.roots.length)} orphan root${plan.roots.length === 1 ? "" : "s"}`;
129992
+ console.log(
129993
+ `${sym.info} ${rowLabel(rows.length)} across ${rootLabel} will be deleted:`
129994
+ );
129995
+ for (const root of plan.roots.slice(0, REPAIR_ROOT_PREVIEW_LIMIT)) {
129996
+ console.log(
129997
+ ` ${sym.arrow} ${root.valueId} \u2014 ${rowLabel(root.rows.length)}`
129998
+ );
129999
+ }
130000
+ const hidden = plan.roots.length - REPAIR_ROOT_PREVIEW_LIMIT;
130001
+ if (hidden > 0) {
130002
+ note(
130003
+ ` \u2026and ${String(hidden)} more orphan root${hidden === 1 ? "" : "s"}.`
130004
+ );
130005
+ }
130006
+ if (!yes && !isInteractive()) {
130007
+ throw new Error(
130008
+ "neo doctor --fix needs a terminal to confirm the deletion. Re-run with --yes to delete without confirming."
130009
+ );
130010
+ }
130011
+ const confirmed = yes || await promptConfirm({
130012
+ message: `Delete ${rowLabel(rows.length)}?`,
130013
+ fallback: false,
130014
+ defaultValue: false
130015
+ });
130016
+ if (!confirmed) {
130017
+ console.log("Cancelled. No records were deleted.");
130018
+ return;
130019
+ }
130020
+ const { api: api3, createConvexClient: createConvexClient2 } = await Promise.resolve().then(() => (init_convex(), convex_exports));
130021
+ const { createProjectVersionIntent: createProjectVersionIntent2 } = await Promise.resolve().then(() => (init_project_version_intents(), project_version_intents_exports));
130022
+ const changes = rows.map((row) => ({
130023
+ recordKind: "value",
130024
+ recordId: row.recordId,
130025
+ operation: "delete",
130026
+ deleted: true,
130027
+ expectedBaseContentHash: row.contentHash,
130028
+ intent: createProjectVersionIntent2("value.delete", {
130029
+ source: "neo-cli-doctor"
130030
+ })
130031
+ }));
130032
+ const batchSize = immediateCommitBatchSize(changes);
130033
+ const convex = await createConvexClient2(workspace);
130034
+ const progress = spinner(`Deleting ${rowLabel(rows.length)}\u2026`);
130035
+ let deleted = 0;
130036
+ let expectedHeadTransactionHash = pulledHeadTransactionHash;
130037
+ for (let index = 0; index < changes.length; index += batchSize) {
130038
+ const batch = changes.slice(index, index + batchSize);
130039
+ let transactionHash;
130040
+ try {
130041
+ const result = await convex.mutation(
130042
+ api3.serverProjectRecordOperations.commitFromSession,
130043
+ {
130044
+ projectId: workspace.config.projectId,
130045
+ versionId: workspace.config.versionId,
130046
+ operation: "delete",
130047
+ changes: batch,
130048
+ summary: `neo doctor --fix (${rowLabel(batch.length)})`,
130049
+ expectedHeadTransactionHash
130050
+ }
130051
+ );
130052
+ transactionHash = committedTransactionHash(result);
130053
+ } catch (error) {
130054
+ progress.fail(
130055
+ deleted === 0 ? `Failed to delete ${rowLabel(batch.length)}.` : `Failed after deleting ${rowLabel(deleted)}.`
130056
+ );
130057
+ throw repairFailure(error, deleted);
130058
+ }
130059
+ if (transactionHash === null) continue;
130060
+ expectedHeadTransactionHash = transactionHash;
130061
+ deleted += batch.length;
130062
+ progress.update(
130063
+ `Deleting ${rowLabel(rows.length)}\u2026 ${String(deleted)} done`
130064
+ );
130065
+ }
130066
+ progress.succeed(`Deleted ${rowLabel(deleted)} across ${rootLabel}.`);
130067
+ console.log('Run "neo pull" to refresh the working copy.');
130068
+ }
130069
+ function immediateCommitBatchSize(changes) {
130070
+ let fits = 0;
130071
+ let low = 1;
130072
+ let high = changes.length;
130073
+ while (low <= high) {
130074
+ const size = Math.floor((low + high) / 2);
130075
+ if (planProjectVersionTransaction(changes.slice(0, size)).path === "immediate") {
130076
+ fits = size;
130077
+ low = size + 1;
130078
+ } else {
130079
+ high = size - 1;
130080
+ }
130081
+ }
130082
+ if (fits === 0) {
130083
+ throw new Error(
130084
+ "Deleting a single value row exceeds the immediate transaction budget, so `neo doctor --fix` cannot commit anything. The transaction cost model needs to change before this repair can run."
130085
+ );
130086
+ }
130087
+ return fits;
130088
+ }
130089
+ function committedTransactionHash(result) {
130090
+ if (!isObjectRecord2(result)) {
130091
+ throw new Error(
130092
+ "Doctor repair committed a deletion but the server returned no transaction envelope."
130093
+ );
130094
+ }
130095
+ if (result.transaction === null) return null;
130096
+ const transactionHash = isObjectRecord2(result.transaction) ? result.transaction.transactionHash : void 0;
130097
+ if (typeof transactionHash !== "string") {
130098
+ throw new Error(
130099
+ "Doctor repair committed a transaction that carries no hash, so the remaining deletions have no fast-forward base."
130100
+ );
130101
+ }
130102
+ return transactionHash;
130103
+ }
130104
+ function repairFailure(error, deleted) {
130105
+ const applied = deleted === 0 ? "" : ` ${rowLabel(deleted)} were already deleted.`;
130106
+ const code = convexErrorCode(error);
130107
+ if (code === "non-fast-forward" || code === "base-hash-conflict") {
130108
+ return new Error(
130109
+ `neo doctor --fix was refused: the project moved on since this workspace pulled, so the audit is stale.${applied} Run \`neo pull\` to re-derive it, then rerun.`,
130110
+ { cause: error }
130111
+ );
130112
+ }
130113
+ return new Error(
130114
+ `neo doctor --fix could not delete the audited rows: ${errorMessage3(error)}${applied}`,
130115
+ { cause: error }
130116
+ );
130117
+ }
130118
+ function convexErrorCode(error) {
130119
+ if (!isObjectRecord2(error)) return null;
130120
+ const data = error.data;
130121
+ if (!isObjectRecord2(data)) return null;
130122
+ return typeof data.error === "string" ? data.error : null;
130123
+ }
130124
+ var NEO_COMPILER_CONTRACT, NEO_VSCODE_EXTENSION_ID, NEO_VSCODE_EXTENSION_CONTRACT_VERSION, NEO_SOURCE_CONTRACT_VERSION, NEO_FILE_CONTRACT_VERSION, SOURCE_EXTENSIONS, FILE_CAPABILITIES, REPAIR_ROOT_PREVIEW_LIMIT;
129839
130125
  var init_doctor = __esm({
129840
130126
  "src/commands/doctor.ts"() {
129841
130127
  "use strict";
129842
130128
  init_src();
129843
130129
  init_workspace();
130130
+ init_ui();
129844
130131
  init_workspace_status();
129845
130132
  init_source_diagnostics();
129846
130133
  init_project_documents();
129847
130134
  init_project_integrity();
130135
+ init_project_version_transaction_planning();
130136
+ init_projection();
129848
130137
  NEO_COMPILER_CONTRACT = "ProjectSourceAnalysisV4";
129849
130138
  NEO_VSCODE_EXTENSION_ID = "neocompose.neo-compose-neoscript";
129850
130139
  NEO_VSCODE_EXTENSION_CONTRACT_VERSION = "0.3.0";
@@ -129860,6 +130149,7 @@ var init_doctor = __esm({
129860
130149
  { extension: ".mp3", kind: "audio", mimeType: "audio/mpeg" },
129861
130150
  { extension: ".ogg", kind: "audio", mimeType: "audio/ogg" }
129862
130151
  ];
130152
+ REPAIR_ROOT_PREVIEW_LIMIT = 20;
129863
130153
  }
129864
130154
  });
129865
130155
 
@@ -129867,8 +130157,6 @@ var init_doctor = __esm({
129867
130157
  var migrate_exports = {};
129868
130158
  __export(migrate_exports, {
129869
130159
  planCollectionMutation: () => planCollectionMutation,
129870
- resolveAssignTarget: () => resolveAssignTarget,
129871
- resolveCollectionTarget: () => resolveCollectionTarget,
129872
130160
  resolveWriteTarget: () => resolveWriteTarget,
129873
130161
  runMigrate: () => runMigrate
129874
130162
  });
@@ -130063,8 +130351,8 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
130063
130351
  return;
130064
130352
  }
130065
130353
  if (subcommand === "run") {
130066
- const client = NeoApiClient.forBaseUrl(workspace.config.apiBaseUrl);
130067
130354
  if (process.argv.includes("--server")) {
130355
+ const client = NeoApiClient.forBaseUrl(workspace.config.apiBaseUrl);
130068
130356
  const result = await client.post(
130069
130357
  `/api/projects/${workspace.config.projectId}/versions/${workspace.config.versionId}/migrations/run`,
130070
130358
  {
@@ -130082,11 +130370,9 @@ async function runMigrate(workspace, subcommand, positional, targetRef, json, de
130082
130370
  }
130083
130371
  await runPendingMigrations(
130084
130372
  workspace,
130085
- client,
130086
130373
  raw,
130087
130374
  migrations,
130088
- positional[0] ?? null,
130089
- json
130375
+ positional[0] ?? null
130090
130376
  );
130091
130377
  return;
130092
130378
  }
@@ -130279,36 +130565,12 @@ function resolveCollectionTarget(write, env, migrationName) {
130279
130565
  `Migration "${migrationName}" mutates a collection through an unsupported target.`
130280
130566
  );
130281
130567
  }
130282
- function resolveAssignTarget(write, instanceValue, migrationName) {
130283
- if (write.kind !== "assign") {
130284
- throw new Error(
130285
- `Migration "${migrationName}" produced a "${write.kind}" write; the current runner only applies plain assignments (this.<Field> = ...).`
130286
- );
130287
- }
130288
- const target = isObjectRecord2(write.target) ? write.target : {};
130289
- const pointer = isObjectRecord2(target.pointer) ? target.pointer : {};
130290
- const keyOf = isObjectRecord2(pointer.keyOf) ? pointer.keyOf : {};
130291
- const receiver = keyOf.pointer;
130292
- if (!isObjectRecord2(receiver) || receiver.type !== "variable" || receiver.variableId !== "__this__" && receiver.variableId !== "__target__") {
130293
- throw new Error(
130294
- `Migration "${migrationName}" assigns to a non-this receiver; the current runner only applies direct this.<Field> assignments.`
130295
- );
130296
- }
130297
- const childKey = readLiteralKey(keyOf.key, migrationName);
130298
- if (!isObjectRecord2(instanceValue) || typeof instanceValue[childKey] !== "string") {
130299
- throw new Error(
130300
- `Migration "${migrationName}" writes "${childKey}" but the instance has no stored value id for that key.`
130301
- );
130302
- }
130303
- return { childKey };
130304
- }
130305
130568
  function migrationTargetClassName(thisClass) {
130306
130569
  if (thisClass === null) return null;
130307
130570
  if (typeof thisClass.name !== "string") return null;
130308
130571
  return thisClass.name;
130309
130572
  }
130310
- async function runPendingMigrations(workspace, client, raw, migrations, onlyRef, dryRunFlagUnused) {
130311
- void dryRunFlagUnused;
130573
+ async function runPendingMigrations(workspace, raw, migrations, onlyRef) {
130312
130574
  const dryRun = process.argv.includes("--dry-run");
130313
130575
  const document = readDocumentArrays(raw);
130314
130576
  const heads = /* @__PURE__ */ new Map();
@@ -132902,19 +133164,20 @@ var init_dev = __esm({
132902
133164
  var resolve_exports = {};
132903
133165
  __export(resolve_exports, {
132904
133166
  resolveMarkers: () => resolveMarkers,
132905
- runResolve: () => runResolve,
132906
- workspaceFilePath: () => workspaceFilePath
133167
+ runResolve: () => runResolve
132907
133168
  });
132908
133169
  import { readFileSync as readFileSync19, rmSync as rmSync8, writeFileSync as writeFileSync14 } from "node:fs";
132909
- import { join as join20 } from "node:path";
133170
+ import { join as join20, relative as relative8 } from "node:path";
132910
133171
  function runResolve(workspace, side) {
133172
+ const marked = readMarkedProjectSourcesV4(workspace.root);
133173
+ assertRecordConflictsResolveTogetherV4(
133174
+ workspace,
133175
+ new Set(marked.map((file) => file.path))
133176
+ );
132911
133177
  const resolvedRecords = adoptServerConflictBases(workspace);
132912
133178
  let resolvedFiles = 0;
132913
- for (const filePath of listProjectSourceFilesV4(workspace.root)) {
132914
- const source = readFileSync19(filePath, "utf8");
132915
- if (detectConflictMarkers(source) === null) continue;
132916
- const resolved = resolveMarkers(source, side);
132917
- writeFileSync14(filePath, resolved, "utf8");
133179
+ for (const file of marked) {
133180
+ writeFileSync14(file.absolutePath, resolveMarkers(file.source, side), "utf8");
132918
133181
  resolvedFiles += 1;
132919
133182
  }
132920
133183
  let resolvedBinaries = 0;
@@ -132953,6 +133216,37 @@ function runResolve(workspace, side) {
132953
133216
  `Resolved ${resolvedFiles} source file(s), ${resolvedRecords} record conflict(s), and ${resolvedBinaries} binary file(s) keeping the "${side}" side. Review with "neo diff", then "neo push".`
132954
133217
  );
132955
133218
  }
133219
+ function readMarkedProjectSourcesV4(root) {
133220
+ const files = [];
133221
+ for (const absolutePath of listProjectSourceFilesV4(root)) {
133222
+ const source = readFileSync19(absolutePath, "utf8");
133223
+ if (detectConflictMarkers(source) === null) continue;
133224
+ files.push({
133225
+ path: normalizeWorkspaceSourcePath(relative8(root, absolutePath)),
133226
+ absolutePath,
133227
+ source
133228
+ });
133229
+ }
133230
+ return files;
133231
+ }
133232
+ function assertRecordConflictsResolveTogetherV4(workspace, markedPaths) {
133233
+ for (const [key, record3] of Object.entries(workspace.state.records)) {
133234
+ const declaringPaths = record3.conflictFiles;
133235
+ if (declaringPaths === void 0) continue;
133236
+ const stillMarked = [];
133237
+ const alreadyResolved = [];
133238
+ for (const declaringPath of declaringPaths) {
133239
+ const path = normalizeWorkspaceSourcePath(declaringPath);
133240
+ if (markedPaths.has(path)) stillMarked.push(path);
133241
+ else alreadyResolved.push(path);
133242
+ }
133243
+ if (stillMarked.length === 0) continue;
133244
+ if (alreadyResolved.length === 0) continue;
133245
+ throw new Error(
133246
+ `The files declaring conflicted record ${key} disagree: ${stillMarked.join(", ")} still holds conflict markers while ${alreadyResolved.join(", ")} does not. Every file that declares one record resolves together \u2014 finish resolving the marked file(s) to the side you already kept, then run "neo resolve".`
133247
+ );
133248
+ }
133249
+ }
132956
133250
  function adoptServerConflictBases(workspace) {
132957
133251
  let adopted = 0;
132958
133252
  for (const [key, record3] of Object.entries(workspace.state.records)) {
@@ -132964,6 +133258,7 @@ function adoptServerConflictBases(workspace) {
132964
133258
  };
132965
133259
  delete next.conflictServerHash;
132966
133260
  delete next.conflictServerData;
133261
+ delete next.conflictFiles;
132967
133262
  workspace.state.records[key] = next;
132968
133263
  adopted += 1;
132969
133264
  }
@@ -133005,15 +133300,13 @@ function resolveMarkers(source, side) {
133005
133300
  }
133006
133301
  return output.join("\n");
133007
133302
  }
133008
- function workspaceFilePath(workspace, file) {
133009
- return join20(workspace.root, file);
133010
- }
133011
133303
  var init_resolve = __esm({
133012
133304
  "src/commands/resolve.ts"() {
133013
133305
  "use strict";
133014
133306
  init_workspace();
133015
133307
  init_workspace_status();
133016
133308
  init_source_diagnostics();
133309
+ init_workspace_source_path();
133017
133310
  init_project_files();
133018
133311
  }
133019
133312
  });
@@ -133064,7 +133357,7 @@ ${h("Working copy")}
133064
133357
  diff ${d("[--json]")}
133065
133358
  dev ${d("[--push]")}
133066
133359
  resolve ${d("[--mine|--theirs]")}
133067
- doctor ${d("[--json] validate contracts and audit the pulled document")}
133360
+ doctor ${d("[--json] [--fix [--yes]] validate contracts and audit the pulled document")}
133068
133361
 
133069
133362
  ${h("Branches & releases")}
133070
133363
  branch ${d("list | create <name> | switch [ref] | delete <ref> | refresh")}
@@ -133150,11 +133443,14 @@ ${h("NSFunction preview")}
133150
133443
  return `${h("neo doctor")} \u2014 validate project authoring contracts
133151
133444
 
133152
133445
  ${h("Usage")}
133153
- neo doctor ${d("[--json]")}
133446
+ neo doctor ${d("[--json] [--fix [--yes]]")}
133154
133447
 
133155
133448
  Neo validates the format-4 browser compiler, VS Code extension cache envelope,
133156
133449
  tracked source, local .spec.neo compilation, and managed project-file
133157
133450
  capabilities. It does not discover or require .NET.
133451
+
133452
+ ${h("Repair")}
133453
+ ${d("--fix deletes the value rows the pulled document's unprojected-value-row findings name, after listing them and confirming. --yes skips the prompt. --fix cannot be combined with --json.")}
133158
133454
  `;
133159
133455
  }
133160
133456
  if (command === "dialogue") {
@@ -133211,7 +133507,7 @@ There is no --keep-current: preserving current semantic state defines flatten.
133211
133507
  async function main() {
133212
133508
  const args = parseArgs(process.argv.slice(2));
133213
133509
  if (args.command === "--version") {
133214
- console.log("0.43.0");
133510
+ console.log("0.44.0");
133215
133511
  return;
133216
133512
  }
133217
133513
  if (args.command === null || args.command === "help" || args.command === "--help" || args.command === "-h") {
@@ -133296,9 +133592,23 @@ async function main() {
133296
133592
  return;
133297
133593
  }
133298
133594
  case "doctor": {
133595
+ assertAllowedFlags(args, /* @__PURE__ */ new Set(["api", "json", "fix", "yes"]));
133596
+ const json = boolFlag(args, "json");
133597
+ const fix = boolFlag(args, "fix");
133598
+ if (fix && json) {
133599
+ throw new NeoCliUsageError(
133600
+ "neo doctor --fix reports and confirms interactively; it has no --json form. Drop --json, or run `neo doctor --json` to read the findings."
133601
+ );
133602
+ }
133603
+ const yes = boolFlag(args, "yes");
133604
+ if (yes && !fix) {
133605
+ throw new NeoCliUsageError(
133606
+ "neo doctor --yes only answers the --fix confirmation. Add --fix, or drop --yes."
133607
+ );
133608
+ }
133299
133609
  const workspace = loadWorkspaceForCommand(args);
133300
133610
  const { runDoctor: runDoctor2 } = await Promise.resolve().then(() => (init_doctor(), doctor_exports));
133301
- await runDoctor2(workspace, boolFlag(args, "json"));
133611
+ await runDoctor2(workspace, { json, fix, yes });
133302
133612
  return;
133303
133613
  }
133304
133614
  case "branch": {