@valbuild/mcp 0.136.9 → 0.136.10

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,17 @@
1
1
  # @valbuild/mcp
2
2
 
3
+ ## 0.136.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#743](https://github.com/valbuild/val/pull/743) [`fef29b0`](https://github.com/valbuild/val/commit/fef29b0d9e826e4e7e63a3ae61553137a3f9d280) Thanks [@freekh](https://github.com/freekh)! - Saving no longer gets stuck on "Changes cannot be saved: something else keeps changing them first" when another editor has an unpublished change and later work has been published.
8
+
9
+ A new change is now written on top of the latest change the content service has registered, which it reports alongside the list of pending changes, instead of the last change this deployment was shown. Since changes can be published independently, those two can differ for good: an unpublished change can sit before published ones that the running deployment already contains. The Studio and the MCP tools both name the reported head, and fall back to the old behaviour against a content service that does not report one.
10
+
11
+ - Updated dependencies [[`fef29b0`](https://github.com/valbuild/val/commit/fef29b0d9e826e4e7e63a3ae61553137a3f9d280)]:
12
+ - @valbuild/server@0.136.10
13
+ - @valbuild/shared@0.136.10
14
+
3
15
  ## 0.136.9
4
16
 
5
17
  ### Patch Changes
@@ -11,19 +11,20 @@ import type { ValToolError } from "./types.js";
11
11
  */
12
12
  export declare function mintPatchId(): PatchId;
13
13
  /**
14
- * What the new patch should hang off.
14
+ * What the new patch should hang off: the HEAD of the chain, by the same rule
15
+ * the Studio uses — see `chainHeadOf`.
15
16
  *
16
- * The last known patch if there is one, otherwise the current head. Note the
17
- * asymmetry between the two backends: `ValOpsFS` ignores `parentRef` entirely
18
- * because its append-only ordering log defines order, while `ValOpsHttp` sends
19
- * it up as `parentPatchId` for optimistic concurrency. So a wrong value here is
20
- * invisible locally and a conflict in production — which is why this is derived
21
- * fresh rather than remembered.
17
+ * Note the asymmetry between the two backends: `ValOpsFS` ignores `parentRef`
18
+ * entirely because its append-only ordering log defines order, while
19
+ * `ValOpsHttp` sends it up as `parentPatchId` for optimistic concurrency. So a
20
+ * wrong value here is invisible locally and a conflict in production — which is
21
+ * why this is derived fresh rather than remembered.
22
22
  */
23
- export declare function deriveParentRef(ops: ValOps, patches: {
23
+ export declare function deriveParentRef(ops: Pick<ValOps, "getBaseSha">, patches: {
24
24
  patches: readonly {
25
25
  patchId: PatchId;
26
26
  }[];
27
+ headPatchId?: PatchId | null;
27
28
  }): Promise<ParentRef>;
28
29
  /**
29
30
  * Would this patch leave the content valid?
@@ -995,14 +995,14 @@ function mintPatchId() {
995
995
  }
996
996
 
997
997
  /**
998
- * What the new patch should hang off.
998
+ * What the new patch should hang off: the HEAD of the chain, by the same rule
999
+ * the Studio uses — see `chainHeadOf`.
999
1000
  *
1000
- * The last known patch if there is one, otherwise the current head. Note the
1001
- * asymmetry between the two backends: `ValOpsFS` ignores `parentRef` entirely
1002
- * because its append-only ordering log defines order, while `ValOpsHttp` sends
1003
- * it up as `parentPatchId` for optimistic concurrency. So a wrong value here is
1004
- * invisible locally and a conflict in production — which is why this is derived
1005
- * fresh rather than remembered.
1001
+ * Note the asymmetry between the two backends: `ValOpsFS` ignores `parentRef`
1002
+ * entirely because its append-only ordering log defines order, while
1003
+ * `ValOpsHttp` sends it up as `parentPatchId` for optimistic concurrency. So a
1004
+ * wrong value here is invisible locally and a conflict in production — which is
1005
+ * why this is derived fresh rather than remembered.
1006
1006
  */
1007
1007
  function deriveParentRef(_x, _x2) {
1008
1008
  return _deriveParentRef.apply(this, arguments);
@@ -1022,22 +1022,27 @@ function deriveParentRef(_x, _x2) {
1022
1022
  * has, which means the browser cannot run them at all.
1023
1023
  */
1024
1024
  function _deriveParentRef() {
1025
- _deriveParentRef = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee(ops,
1025
+ _deriveParentRef = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee(
1026
+ // Only the base sha, for an empty chain — so a caller (or a test) need not
1027
+ // construct a whole store to ask.
1028
+ ops,
1026
1029
  // Only the ids matter, so this accepts either shape `fetchPatches` can
1027
1030
  // return — the metadata-only variant omits the ops but keeps the ids.
1028
1031
  patches) {
1029
- var last, _t;
1032
+ var patchId, _t;
1030
1033
  return asyncToGenerator._regenerator().w(function (_context) {
1031
1034
  while (1) switch (_context.n) {
1032
1035
  case 0:
1033
- last = patches.patches[patches.patches.length - 1];
1034
- if (!last) {
1036
+ patchId = internal.chainHeadOf(patches.headPatchId, patches.patches.map(function (patch) {
1037
+ return patch.patchId;
1038
+ }));
1039
+ if (!(patchId !== null)) {
1035
1040
  _context.n = 1;
1036
1041
  break;
1037
1042
  }
1038
1043
  return _context.a(2, {
1039
1044
  type: "patch",
1040
- patchId: last.patchId
1045
+ patchId: patchId
1041
1046
  });
1042
1047
  case 1:
1043
1048
  _context.n = 2;
@@ -3365,7 +3370,7 @@ var packageJson = {
3365
3370
  "./package.json": "./package.json"
3366
3371
  },
3367
3372
  types: "dist/valbuild-mcp.cjs.d.ts",
3368
- version: "0.136.9",
3373
+ version: "0.136.10",
3369
3374
  scripts: {
3370
3375
  typecheck: "tsc --noEmit",
3371
3376
  test: "jest",
@@ -995,14 +995,14 @@ function mintPatchId() {
995
995
  }
996
996
 
997
997
  /**
998
- * What the new patch should hang off.
998
+ * What the new patch should hang off: the HEAD of the chain, by the same rule
999
+ * the Studio uses — see `chainHeadOf`.
999
1000
  *
1000
- * The last known patch if there is one, otherwise the current head. Note the
1001
- * asymmetry between the two backends: `ValOpsFS` ignores `parentRef` entirely
1002
- * because its append-only ordering log defines order, while `ValOpsHttp` sends
1003
- * it up as `parentPatchId` for optimistic concurrency. So a wrong value here is
1004
- * invisible locally and a conflict in production — which is why this is derived
1005
- * fresh rather than remembered.
1001
+ * Note the asymmetry between the two backends: `ValOpsFS` ignores `parentRef`
1002
+ * entirely because its append-only ordering log defines order, while
1003
+ * `ValOpsHttp` sends it up as `parentPatchId` for optimistic concurrency. So a
1004
+ * wrong value here is invisible locally and a conflict in production — which is
1005
+ * why this is derived fresh rather than remembered.
1006
1006
  */
1007
1007
  function deriveParentRef(_x, _x2) {
1008
1008
  return _deriveParentRef.apply(this, arguments);
@@ -1022,22 +1022,27 @@ function deriveParentRef(_x, _x2) {
1022
1022
  * has, which means the browser cannot run them at all.
1023
1023
  */
1024
1024
  function _deriveParentRef() {
1025
- _deriveParentRef = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee(ops,
1025
+ _deriveParentRef = asyncToGenerator._asyncToGenerator(/*#__PURE__*/asyncToGenerator._regenerator().m(function _callee(
1026
+ // Only the base sha, for an empty chain — so a caller (or a test) need not
1027
+ // construct a whole store to ask.
1028
+ ops,
1026
1029
  // Only the ids matter, so this accepts either shape `fetchPatches` can
1027
1030
  // return — the metadata-only variant omits the ops but keeps the ids.
1028
1031
  patches) {
1029
- var last, _t;
1032
+ var patchId, _t;
1030
1033
  return asyncToGenerator._regenerator().w(function (_context) {
1031
1034
  while (1) switch (_context.n) {
1032
1035
  case 0:
1033
- last = patches.patches[patches.patches.length - 1];
1034
- if (!last) {
1036
+ patchId = internal.chainHeadOf(patches.headPatchId, patches.patches.map(function (patch) {
1037
+ return patch.patchId;
1038
+ }));
1039
+ if (!(patchId !== null)) {
1035
1040
  _context.n = 1;
1036
1041
  break;
1037
1042
  }
1038
1043
  return _context.a(2, {
1039
1044
  type: "patch",
1040
- patchId: last.patchId
1045
+ patchId: patchId
1041
1046
  });
1042
1047
  case 1:
1043
1048
  _context.n = 2;
@@ -3365,7 +3370,7 @@ var packageJson = {
3365
3370
  "./package.json": "./package.json"
3366
3371
  },
3367
3372
  types: "dist/valbuild-mcp.cjs.d.ts",
3368
- version: "0.136.9",
3373
+ version: "0.136.10",
3369
3374
  scripts: {
3370
3375
  typecheck: "tsc --noEmit",
3371
3376
  test: "jest",
@@ -2,7 +2,7 @@ import { _ as _asyncToGenerator, a as _regenerator } from './asyncToGenerator-50
2
2
  import { z } from 'zod';
3
3
  import { createValOps, getSettings, resolveRemoteFileAuth, getFileExt, initHandlerOptions } from '@valbuild/server';
4
4
  import { Internal, getSourcePathFromRoute, DEFAULT_VAL_REMOTE_HOST } from '@valbuild/core';
5
- import { performSearch, createSearchIndex, indexModule, filterBlockingValidationErrors, describeContainerAtPath, safeParsePatch, buildDuplicatePatch, buildEmptyAtPathPatch, declaredLocales, buildRemoveImageGalleryEntryPatch, resolveEncodeSettings, resolveSerializedSchemaAtPath, withExtension, fitWithin, isSkippedSource, ENCODE_MIME_TYPE_OF, isMimeTypeAccepted, chooseEncoded, buildImageGalleryPatch } from '@valbuild/shared/internal';
5
+ import { performSearch, createSearchIndex, indexModule, filterBlockingValidationErrors, describeContainerAtPath, chainHeadOf, safeParsePatch, buildDuplicatePatch, buildEmptyAtPathPatch, declaredLocales, buildRemoveImageGalleryEntryPatch, resolveEncodeSettings, resolveSerializedSchemaAtPath, withExtension, fitWithin, isSkippedSource, ENCODE_MIME_TYPE_OF, isMimeTypeAccepted, chooseEncoded, buildImageGalleryPatch } from '@valbuild/shared/internal';
6
6
  import { minimatch } from 'minimatch';
7
7
  import { randomUUID, createPublicKey, verify } from 'node:crypto';
8
8
  import { JSONOps, applyPatch, deepClone } from '@valbuild/core/patch';
@@ -986,14 +986,14 @@ function mintPatchId() {
986
986
  }
987
987
 
988
988
  /**
989
- * What the new patch should hang off.
989
+ * What the new patch should hang off: the HEAD of the chain, by the same rule
990
+ * the Studio uses — see `chainHeadOf`.
990
991
  *
991
- * The last known patch if there is one, otherwise the current head. Note the
992
- * asymmetry between the two backends: `ValOpsFS` ignores `parentRef` entirely
993
- * because its append-only ordering log defines order, while `ValOpsHttp` sends
994
- * it up as `parentPatchId` for optimistic concurrency. So a wrong value here is
995
- * invisible locally and a conflict in production — which is why this is derived
996
- * fresh rather than remembered.
992
+ * Note the asymmetry between the two backends: `ValOpsFS` ignores `parentRef`
993
+ * entirely because its append-only ordering log defines order, while
994
+ * `ValOpsHttp` sends it up as `parentPatchId` for optimistic concurrency. So a
995
+ * wrong value here is invisible locally and a conflict in production — which is
996
+ * why this is derived fresh rather than remembered.
997
997
  */
998
998
  function deriveParentRef(_x, _x2) {
999
999
  return _deriveParentRef.apply(this, arguments);
@@ -1013,22 +1013,27 @@ function deriveParentRef(_x, _x2) {
1013
1013
  * has, which means the browser cannot run them at all.
1014
1014
  */
1015
1015
  function _deriveParentRef() {
1016
- _deriveParentRef = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(ops,
1016
+ _deriveParentRef = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(
1017
+ // Only the base sha, for an empty chain — so a caller (or a test) need not
1018
+ // construct a whole store to ask.
1019
+ ops,
1017
1020
  // Only the ids matter, so this accepts either shape `fetchPatches` can
1018
1021
  // return — the metadata-only variant omits the ops but keeps the ids.
1019
1022
  patches) {
1020
- var last, _t;
1023
+ var patchId, _t;
1021
1024
  return _regenerator().w(function (_context) {
1022
1025
  while (1) switch (_context.n) {
1023
1026
  case 0:
1024
- last = patches.patches[patches.patches.length - 1];
1025
- if (!last) {
1027
+ patchId = chainHeadOf(patches.headPatchId, patches.patches.map(function (patch) {
1028
+ return patch.patchId;
1029
+ }));
1030
+ if (!(patchId !== null)) {
1026
1031
  _context.n = 1;
1027
1032
  break;
1028
1033
  }
1029
1034
  return _context.a(2, {
1030
1035
  type: "patch",
1031
- patchId: last.patchId
1036
+ patchId: patchId
1032
1037
  });
1033
1038
  case 1:
1034
1039
  _context.n = 2;
@@ -3356,7 +3361,7 @@ var packageJson = {
3356
3361
  "./package.json": "./package.json"
3357
3362
  },
3358
3363
  types: "dist/valbuild-mcp.cjs.d.ts",
3359
- version: "0.136.9",
3364
+ version: "0.136.10",
3360
3365
  scripts: {
3361
3366
  typecheck: "tsc --noEmit",
3362
3367
  test: "jest",
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "./package.json": "./package.json"
21
21
  },
22
22
  "types": "dist/valbuild-mcp.cjs.d.ts",
23
- "version": "0.136.9",
23
+ "version": "0.136.10",
24
24
  "preconstruct": {
25
25
  "entrypoints": [
26
26
  "./index.ts",
@@ -32,8 +32,8 @@
32
32
  "minimatch": "^10.2.6",
33
33
  "zod": "^4.4.3",
34
34
  "@valbuild/core": "0.136.8",
35
- "@valbuild/server": "0.136.9",
36
- "@valbuild/shared": "0.136.8"
35
+ "@valbuild/server": "0.136.10",
36
+ "@valbuild/shared": "0.136.10"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@prettier/sync": "^0.6.1",