@atlaskit/editor-plugin-collab-edit 19.0.4 → 19.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @atlaskit/editor-plugin-collab-edit
2
2
 
3
+ ## 19.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b9d1af39046dc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b9d1af39046dc) -
8
+ Add a shared applied-step range detector for AI activity. Connect local streaming under
9
+ platform_editor_ai_streaming_ux_experience_m1 and incoming agent edits under the existing backend
10
+ streaming rollout to this detector. Refine shared chrome highlights to affected nested textblock
11
+ content for all existing shared-chrome consumers.
12
+
13
+ Preserve node attribute activity through cumulative replacements that retain its markup while
14
+ changing descendant content. Reuse existing highlight styles and the grouped cursor.
15
+
16
+ Expose a transaction-only AI activity action and connect direct orchestrator attribute, move, wrap
17
+ and remove mutations under platform_editor_ai_streaming_ux_experience_m1. Keep review segments and
18
+ existing streaming cadence unchanged.
19
+
20
+ Reuse lazily built node-identity indexes per transaction snapshot to avoid repeated full-document
21
+ lookups when changed blocks survive cumulative replacements.
22
+
23
+ Let the chrome plugin map and accumulate existing highlights without restamping stale positions
24
+ from before direct orchestrator mutations.
25
+
26
+ - Updated dependencies
27
+
28
+ ## 19.0.5
29
+
30
+ ### Patch Changes
31
+
32
+ - Updated dependencies
33
+
3
34
  ## 19.0.4
4
35
 
5
36
  ### Patch Changes
@@ -114,8 +114,9 @@ var applyRemoteSteps = exports.applyRemoteSteps = function applyRemoteSteps(json
114
114
  acknowledgedSteps++;
115
115
  }
116
116
  }
117
- // Slice both visual inputs so remote steps stay aligned with tr.docs. The
118
- // full batch still participates in collaboration, presence and attribution.
117
+ // Keep both remote inputs aligned after removing the acknowledged prefix.
118
+ // Unified chrome accounts for local rollback steps in the applied transaction;
119
+ // the full batch still participates in collaboration, presence and attribution.
119
120
  visualJson = json.slice(acknowledgedSteps);
120
121
  visualSteps = steps.slice(acknowledgedSteps);
121
122
  }
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isPositionNeutralStep = exports.getMarkStepRange = exports.getAgentShimmerRanges = exports.getAgentEditChromeRanges = void 0;
7
7
  var _collabAgentReviewSliceCompare = require("@atlaskit/editor-common/collab-agent-review-slice-compare");
8
+ var _collabAgentEditChangedRanges = require("@atlaskit/editor-common/collab-agent-edit-changed-ranges");
8
9
  var _monitoring = require("@atlaskit/editor-common/monitoring");
9
10
  var _transform = require("@atlaskit/editor-prosemirror/transform");
10
11
  var _prosemirrorCollab = require("@atlaskit/prosemirror-collab");
@@ -262,14 +263,42 @@ var getAgentShimmerRanges = exports.getAgentShimmerRanges = function getAgentShi
262
263
  * together with these ranges, in `AgentEditChromeData`.
263
264
  */
264
265
  var getAgentEditChromeRanges = exports.getAgentEditChromeRanges = function getAgentEditChromeRanges(json, steps, tr, view, onNotShown) {
265
- // Reuse legacy range derivation with skeleton and telepointer output disabled. A non-zero
266
- // highlight duration keeps capture enabled; the returned legacy phase and duration are discarded.
267
- return deriveAgentShimmerRanges(json, steps, tr, view, 0, 1, false, onNotShown).map(function (_ref) {
268
- var from = _ref.from,
269
- to = _ref.to;
270
- return {
271
- from: from,
272
- to: to
273
- };
274
- });
266
+ var _json$find2;
267
+ var agentType = (_json$find2 = json.find(function (step) {
268
+ return typeof (step === null || step === void 0 ? void 0 : step.agentType) === 'string';
269
+ })) === null || _json$find2 === void 0 ? void 0 : _json$find2.agentType;
270
+ if (agentType === undefined) {
271
+ return [];
272
+ }
273
+ var rebasedSteps = Number(tr.getMeta('rebased')) || 0;
274
+ if (rebasedSteps > 0) {
275
+ var _getCollabState$uncon2, _getCollabState2;
276
+ var unconfirmed = (_getCollabState$uncon2 = (_getCollabState2 = (0, _prosemirrorCollab.getCollabState)(view.state)) === null || _getCollabState2 === void 0 ? void 0 : _getCollabState2.unconfirmed) !== null && _getCollabState$uncon2 !== void 0 ? _getCollabState$uncon2 : [];
277
+ if (unconfirmed.some(function (entry) {
278
+ return !isPositionNeutralStep(entry.step);
279
+ })) {
280
+ onNotShown === null || onNotShown === void 0 || onNotShown('rebasedConcurrentEdit', agentType);
281
+ return [];
282
+ }
283
+ }
284
+ try {
285
+ // The caller removes the acknowledged local prefix. receiveTransaction then
286
+ // rolls back unconfirmed local steps before applying these remote steps, and
287
+ // replays the local steps afterwards. Select the actual applied remote indexes;
288
+ // the shared extractor maps them through every later step into tr.doc.
289
+ var includedStepIndexes = [];
290
+ json.forEach(function (rawStep, index) {
291
+ if (typeof (rawStep === null || rawStep === void 0 ? void 0 : rawStep.agentType) === 'string' && steps[index]) {
292
+ includedStepIndexes.push(rebasedSteps + index);
293
+ }
294
+ });
295
+ var ranges = (0, _collabAgentEditChangedRanges.getAgentEditChangedRanges)(tr, includedStepIndexes);
296
+ if (!ranges.length) {
297
+ onNotShown === null || onNotShown === void 0 || onNotShown('nothingToShow', agentType);
298
+ }
299
+ return ranges;
300
+ } catch (error) {
301
+ onNotShown === null || onNotShown === void 0 || onNotShown('captureThrew', agentType, error);
302
+ return [];
303
+ }
275
304
  };
@@ -117,8 +117,9 @@ export const applyRemoteSteps = (json, view, userIds, options, editorAnalyticsAp
117
117
  acknowledgedSteps++;
118
118
  }
119
119
  }
120
- // Slice both visual inputs so remote steps stay aligned with tr.docs. The
121
- // full batch still participates in collaboration, presence and attribution.
120
+ // Keep both remote inputs aligned after removing the acknowledged prefix.
121
+ // Unified chrome accounts for local rollback steps in the applied transaction;
122
+ // the full batch still participates in collaboration, presence and attribution.
122
123
  visualJson = json.slice(acknowledgedSteps);
123
124
  visualSteps = steps.slice(acknowledgedSteps);
124
125
  }
@@ -1,4 +1,5 @@
1
1
  import { slicesEqualIgnoringLocalId } from '@atlaskit/editor-common/collab-agent-review-slice-compare';
2
+ import { getAgentEditChangedRanges } from '@atlaskit/editor-common/collab-agent-edit-changed-ranges';
2
3
  import { logException } from '@atlaskit/editor-common/monitoring';
3
4
  import { AddMarkStep, RemoveMarkStep } from '@atlaskit/editor-prosemirror/transform';
4
5
  import { getCollabState } from '@atlaskit/prosemirror-collab';
@@ -244,13 +245,38 @@ export const getAgentShimmerRanges = (json, steps, tr, view, shimmerDurationMs,
244
245
  * together with these ranges, in `AgentEditChromeData`.
245
246
  */
246
247
  export const getAgentEditChromeRanges = (json, steps, tr, view, onNotShown) => {
247
- // Reuse legacy range derivation with skeleton and telepointer output disabled. A non-zero
248
- // highlight duration keeps capture enabled; the returned legacy phase and duration are discarded.
249
- return deriveAgentShimmerRanges(json, steps, tr, view, 0, 1, false, onNotShown).map(({
250
- from,
251
- to
252
- }) => ({
253
- from,
254
- to
255
- }));
248
+ var _json$find2;
249
+ const agentType = (_json$find2 = json.find(step => typeof (step === null || step === void 0 ? void 0 : step.agentType) === 'string')) === null || _json$find2 === void 0 ? void 0 : _json$find2.agentType;
250
+ if (agentType === undefined) {
251
+ return [];
252
+ }
253
+ const rebasedSteps = Number(tr.getMeta('rebased')) || 0;
254
+ if (rebasedSteps > 0) {
255
+ var _getCollabState$uncon2, _getCollabState2;
256
+ const unconfirmed = (_getCollabState$uncon2 = (_getCollabState2 = getCollabState(view.state)) === null || _getCollabState2 === void 0 ? void 0 : _getCollabState2.unconfirmed) !== null && _getCollabState$uncon2 !== void 0 ? _getCollabState$uncon2 : [];
257
+ if (unconfirmed.some(entry => !isPositionNeutralStep(entry.step))) {
258
+ onNotShown === null || onNotShown === void 0 ? void 0 : onNotShown('rebasedConcurrentEdit', agentType);
259
+ return [];
260
+ }
261
+ }
262
+ try {
263
+ // The caller removes the acknowledged local prefix. receiveTransaction then
264
+ // rolls back unconfirmed local steps before applying these remote steps, and
265
+ // replays the local steps afterwards. Select the actual applied remote indexes;
266
+ // the shared extractor maps them through every later step into tr.doc.
267
+ const includedStepIndexes = [];
268
+ json.forEach((rawStep, index) => {
269
+ if (typeof (rawStep === null || rawStep === void 0 ? void 0 : rawStep.agentType) === 'string' && steps[index]) {
270
+ includedStepIndexes.push(rebasedSteps + index);
271
+ }
272
+ });
273
+ const ranges = getAgentEditChangedRanges(tr, includedStepIndexes);
274
+ if (!ranges.length) {
275
+ onNotShown === null || onNotShown === void 0 ? void 0 : onNotShown('nothingToShow', agentType);
276
+ }
277
+ return ranges;
278
+ } catch (error) {
279
+ onNotShown === null || onNotShown === void 0 ? void 0 : onNotShown('captureThrew', agentType, error);
280
+ return [];
281
+ }
256
282
  };
@@ -107,8 +107,9 @@ export var applyRemoteSteps = function applyRemoteSteps(json, view, userIds, opt
107
107
  acknowledgedSteps++;
108
108
  }
109
109
  }
110
- // Slice both visual inputs so remote steps stay aligned with tr.docs. The
111
- // full batch still participates in collaboration, presence and attribution.
110
+ // Keep both remote inputs aligned after removing the acknowledged prefix.
111
+ // Unified chrome accounts for local rollback steps in the applied transaction;
112
+ // the full batch still participates in collaboration, presence and attribution.
112
113
  visualJson = json.slice(acknowledgedSteps);
113
114
  visualSteps = steps.slice(acknowledgedSteps);
114
115
  }
@@ -1,4 +1,5 @@
1
1
  import { slicesEqualIgnoringLocalId } from '@atlaskit/editor-common/collab-agent-review-slice-compare';
2
+ import { getAgentEditChangedRanges } from '@atlaskit/editor-common/collab-agent-edit-changed-ranges';
2
3
  import { logException } from '@atlaskit/editor-common/monitoring';
3
4
  import { AddMarkStep, RemoveMarkStep } from '@atlaskit/editor-prosemirror/transform';
4
5
  import { getCollabState } from '@atlaskit/prosemirror-collab';
@@ -256,14 +257,42 @@ export var getAgentShimmerRanges = function getAgentShimmerRanges(json, steps, t
256
257
  * together with these ranges, in `AgentEditChromeData`.
257
258
  */
258
259
  export var getAgentEditChromeRanges = function getAgentEditChromeRanges(json, steps, tr, view, onNotShown) {
259
- // Reuse legacy range derivation with skeleton and telepointer output disabled. A non-zero
260
- // highlight duration keeps capture enabled; the returned legacy phase and duration are discarded.
261
- return deriveAgentShimmerRanges(json, steps, tr, view, 0, 1, false, onNotShown).map(function (_ref) {
262
- var from = _ref.from,
263
- to = _ref.to;
264
- return {
265
- from: from,
266
- to: to
267
- };
268
- });
260
+ var _json$find2;
261
+ var agentType = (_json$find2 = json.find(function (step) {
262
+ return typeof (step === null || step === void 0 ? void 0 : step.agentType) === 'string';
263
+ })) === null || _json$find2 === void 0 ? void 0 : _json$find2.agentType;
264
+ if (agentType === undefined) {
265
+ return [];
266
+ }
267
+ var rebasedSteps = Number(tr.getMeta('rebased')) || 0;
268
+ if (rebasedSteps > 0) {
269
+ var _getCollabState$uncon2, _getCollabState2;
270
+ var unconfirmed = (_getCollabState$uncon2 = (_getCollabState2 = getCollabState(view.state)) === null || _getCollabState2 === void 0 ? void 0 : _getCollabState2.unconfirmed) !== null && _getCollabState$uncon2 !== void 0 ? _getCollabState$uncon2 : [];
271
+ if (unconfirmed.some(function (entry) {
272
+ return !isPositionNeutralStep(entry.step);
273
+ })) {
274
+ onNotShown === null || onNotShown === void 0 || onNotShown('rebasedConcurrentEdit', agentType);
275
+ return [];
276
+ }
277
+ }
278
+ try {
279
+ // The caller removes the acknowledged local prefix. receiveTransaction then
280
+ // rolls back unconfirmed local steps before applying these remote steps, and
281
+ // replays the local steps afterwards. Select the actual applied remote indexes;
282
+ // the shared extractor maps them through every later step into tr.doc.
283
+ var includedStepIndexes = [];
284
+ json.forEach(function (rawStep, index) {
285
+ if (typeof (rawStep === null || rawStep === void 0 ? void 0 : rawStep.agentType) === 'string' && steps[index]) {
286
+ includedStepIndexes.push(rebasedSteps + index);
287
+ }
288
+ });
289
+ var ranges = getAgentEditChangedRanges(tr, includedStepIndexes);
290
+ if (!ranges.length) {
291
+ onNotShown === null || onNotShown === void 0 || onNotShown('nothingToShow', agentType);
292
+ }
293
+ return ranges;
294
+ } catch (error) {
295
+ onNotShown === null || onNotShown === void 0 || onNotShown('captureThrew', agentType, error);
296
+ return [];
297
+ }
269
298
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-collab-edit",
3
- "version": "19.0.4",
3
+ "version": "19.0.6",
4
4
  "description": "Collab Edit plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,17 +28,17 @@
28
28
  "@atlaskit/editor-plugin-feature-flags": "^17.0.0",
29
29
  "@atlaskit/editor-prosemirror": "^8.0.0",
30
30
  "@atlaskit/editor-shared-styles": "^4.3.0",
31
- "@atlaskit/frontend-utilities": "^4.4.0",
31
+ "@atlaskit/frontend-utilities": "^4.5.0",
32
32
  "@atlaskit/platform-feature-experiments": "^0.3.0",
33
33
  "@atlaskit/platform-feature-flags": "^2.2.0",
34
34
  "@atlaskit/prosemirror-collab": "^1.1.0",
35
- "@atlaskit/tmp-editor-statsig": "^192.0.0",
35
+ "@atlaskit/tmp-editor-statsig": "^194.0.0",
36
36
  "@atlaskit/tokens": "^16.12.0",
37
37
  "@babel/runtime": "^7.0.0",
38
38
  "memoize-one": "^6.0.0"
39
39
  },
40
40
  "peerDependencies": {
41
- "@atlaskit/editor-common": "^122.3.0",
41
+ "@atlaskit/editor-common": "^122.6.0",
42
42
  "react": "^18.2.0 || ^19.2.0",
43
43
  "react-dom": "^18.2.0 || ^19.2.0"
44
44
  },