@atlaskit/editor-plugin-show-diff 17.1.8 → 17.1.9

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,30 @@
1
1
  # @atlaskit/editor-plugin-show-diff
2
2
 
3
+ ## 17.1.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [`b378d1dd86483`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b378d1dd86483) -
8
+ Brand ChatGPT contributor tags with the ChatGPT icon and a fixed colour.
9
+
10
+ Centralised agent brand metadata in `@atlaskit/agent-color`: added `agent-brand-claude`,
11
+ `agent-brand-chatgpt` and `agent-brand-rovo` colour schemes, and extended
12
+ `getThirdPartyAgentColor` (`./get-third-party-agent-color`) to also resolve the
13
+ `claude`/`chatgpt`/`rovo`/`rovo_chat` aliases and return a canonical display `name`. Removed the
14
+ now-redundant `./chatgpt-brand-color` export (`CHATGPT_BRAND_COLOR`) — its value is now the
15
+ `agent-brand-chatgpt` scheme's `bold`/`boldText` fields, reachable through
16
+ `getThirdPartyAgentColor`.
17
+
18
+ `editor-shared-styles` and `editor-plugin-show-diff` now resolve their brand colours and
19
+ contributor-tag names through this shared lookup instead of maintaining their own per-package
20
+ brand tables, with no behaviour change.
21
+
22
+ - [`6bbecbd2ad0eb`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6bbecbd2ad0eb) -
23
+ EDITOR-9120 Fix numbered table columns in `platform_editor_ai_show_diff_patch_2` so replacement
24
+ widgets share an existing row number, added and removed rows remain independently numbered, and
25
+ anchor widgets do not create phantom entries.
26
+ - Updated dependencies
27
+
3
28
  ## 17.1.8
4
29
 
5
30
  ### Patch Changes
@@ -84,6 +84,10 @@ var extractChangedRows = function extractChangedRows(_ref) {
84
84
  // Check if this row overlaps with the deletion range
85
85
  var rowOverlapsChange = rowStart >= changeStartInTable && rowStart < changeEndInTable || rowEnd > changeStartInTable && rowEnd <= changeEndInTable || rowStart < changeStartInTable && rowEnd > changeEndInTable;
86
86
  if (rowOverlapsChange && rowNode.type.name === 'tableRow' && ((0, _isExtendedEnabled.isExtendedEnabled)(diffType) || !isEmptyRow(rowNode))) {
87
+ var rowLocalId = rowNode.attrs.localId;
88
+ var isTableRowReplacement = rowLocalId && tableNew.node.children.some(function (candidateRow) {
89
+ return candidateRow.type.name === 'tableRow' && candidateRow.attrs.localId === rowLocalId;
90
+ });
87
91
  var cellEdgeAttrs = edgeAttrsByOffset ? (0, _tableCellEdgeAttrs.getRowCellEdgeAttrs)({
88
92
  edgeAttrsByOffset: edgeAttrsByOffset,
89
93
  rowNode: rowNode,
@@ -95,6 +99,7 @@ var extractChangedRows = function extractChangedRows(_ref) {
95
99
  changedRows.push({
96
100
  rowIndex: rowIndex,
97
101
  rowNode: rowNode,
102
+ isTableRowReplacement: isTableRowReplacement,
98
103
  cellEdgeAttrs: cellEdgeAttrs,
99
104
  fromA: tableOld.pos + 1 + rowStart,
100
105
  toA: tableOld.pos + 1 + rowEnd,
@@ -176,6 +181,7 @@ var createChangedRowDOM = function createChangedRowDOM(_ref3) {
176
181
  var rowNode = _ref3.rowNode,
177
182
  cellEdgeAttrs = _ref3.cellEdgeAttrs,
178
183
  nodeViewSerializer = _ref3.nodeViewSerializer,
184
+ isTableRowReplacement = _ref3.isTableRowReplacement,
179
185
  colorScheme = _ref3.colorScheme,
180
186
  isInserted = _ref3.isInserted,
181
187
  diffType = _ref3.diffType,
@@ -183,6 +189,9 @@ var createChangedRowDOM = function createChangedRowDOM(_ref3) {
183
189
  intl = _ref3.intl,
184
190
  isActive = _ref3.isActive;
185
191
  var tr = document.createElement('tr');
192
+ if (isTableRowReplacement && (0, _fg.fg)('platform_editor_ai_show_diff_patch_2')) {
193
+ tr.dataset.showDiffTableRowReplacement = 'true';
194
+ }
186
195
  var colors = _schemes.colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard'];
187
196
  var deletedTreatment = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_show_diff_color_scheme_refactor') ? (0, _factory.buildDeletedRowStyle)(colors) : (0, _createChangedRowDecorationWidgetsStyles.resolveDeletedRowStyleLegacy)((0, _schemes.getLegacyColorScheme)(colorScheme));
188
197
  var hostsRemovedLozenge = Boolean(intl) && (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && !isInserted && !hasAnchoredRemovedLozenge;
@@ -335,6 +344,7 @@ var createChangedRowDecorationWidgets = exports.createChangedRowDecorationWidget
335
344
  var hasAnchoredRemovedLozenge = Boolean(intl) && (0, _isExtendedEnabled.isExtendedEnabled)(diffType) && !isInserted && supportsAnchorPositioning();
336
345
  var rowDOM = createChangedRowDOM({
337
346
  rowNode: changedRow.rowNode,
347
+ isTableRowReplacement: changedRow.isTableRowReplacement,
338
348
  cellEdgeAttrs: changedRow.cellEdgeAttrs,
339
349
  nodeViewSerializer: nodeViewSerializer,
340
350
  colorScheme: colorScheme,
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.resolveDiffContributors = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
+ var _getThirdPartyAgentColor = require("@atlaskit/agent-color/get-third-party-agent-color");
9
10
  var _attributions = require("./decorations/colorSchemes/attributions");
10
11
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
11
12
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
@@ -17,48 +18,24 @@ var ROVO_AGENT_NAME = 'Rovo';
17
18
 
18
19
  /** `agentType` values that render as "Rovo" rather than as a generic external agent. */
19
20
  var ROVO_AGENT_TYPES = new Set(['convo-ai', 'rovo_chat']);
20
- /** Known external agent types emitted by Confluence's agent identification service. */
21
- var EXTERNAL_AGENT_PRESENTATIONS = {
22
- claude: {
23
- agentKind: 'claude',
24
- name: 'Claude'
25
- },
26
- codex: {
27
- agentKind: 'external',
28
- name: 'Codex'
29
- },
30
- vscode: {
31
- agentKind: 'external',
32
- name: 'VS Code'
33
- },
34
- hermes: {
35
- agentKind: 'external',
36
- name: 'Hermes'
37
- },
38
- runlayer: {
39
- agentKind: 'external',
40
- name: 'Runlayer'
41
- },
42
- zed: {
43
- agentKind: 'external',
44
- name: 'Zed'
45
- },
46
- ampcode: {
47
- agentKind: 'external',
48
- name: 'Ampcode'
49
- },
50
- antigravity: {
51
- agentKind: 'external',
52
- name: 'Antigravity'
53
- },
54
- devin_cli: {
55
- agentKind: 'external',
56
- name: 'Devin CLI'
57
- },
58
- pi_agent: {
59
- agentKind: 'external',
60
- name: 'Pi Agent'
61
- }
21
+ /** `@atlaskit/agent-color` brands show-diff renders with a dedicated presentation. */
22
+ var SHOW_DIFF_AGENT_BRANDS = {
23
+ 'agent-brand-claude': 'claude',
24
+ 'agent-brand-chatgpt': 'chatgpt',
25
+ 'agent-brand-rovo': 'rovo'
26
+ };
27
+
28
+ /** Known external agent types emitted by Confluence's agent identification service that carry
29
+ * no `@atlaskit/agent-color` brand — a generic labelled fallback. */
30
+ var EXTERNAL_AGENT_NAMES = {
31
+ vscode: 'VS Code',
32
+ hermes: 'Hermes',
33
+ runlayer: 'Runlayer',
34
+ zed: 'Zed',
35
+ ampcode: 'Ampcode',
36
+ antigravity: 'Antigravity',
37
+ devin_cli: 'Devin CLI',
38
+ pi_agent: 'Pi Agent'
62
39
  };
63
40
  var hasAgentIdentity = function hasAgentIdentity(attribution) {
64
41
  var _attribution$agentId, _attribution$agentTyp;
@@ -88,11 +65,16 @@ var resolveUser = function resolveUser(userId, profilesByAccountId) {
88
65
  var resolveAgent = function resolveAgent(attribution, profilesByAccountId) {
89
66
  var _attribution$agentTyp2, _attribution$agentId2;
90
67
  var agentType = (_attribution$agentTyp2 = attribution.agentType) === null || _attribution$agentTyp2 === void 0 ? void 0 : _attribution$agentTyp2.trim().toLowerCase();
91
- var agentPresentation = agentType ? EXTERNAL_AGENT_PRESENTATIONS[agentType] : undefined;
92
- if (agentPresentation && agentPresentation.agentKind !== 'external') {
93
- return _objectSpread(_objectSpread({}, agentPresentation), {}, {
94
- kind: 'agent'
95
- });
68
+ var brand = agentType ? (0, _getThirdPartyAgentColor.getThirdPartyAgentColor)({
69
+ agentName: agentType
70
+ }) : undefined;
71
+ var diffBrand = brand ? SHOW_DIFF_AGENT_BRANDS[brand.scheme] : undefined;
72
+ if (diffBrand && brand) {
73
+ return {
74
+ agentKind: diffBrand,
75
+ kind: 'agent',
76
+ name: brand.name
77
+ };
96
78
  }
97
79
  var agentId = (_attribution$agentId2 = attribution.agentId) === null || _attribution$agentId2 === void 0 ? void 0 : _attribution$agentId2.trim();
98
80
  var agentProfile = agentId ? profilesByAccountId.get(agentId) : undefined;
@@ -107,16 +89,18 @@ var resolveAgent = function resolveAgent(attribution, profilesByAccountId) {
107
89
  }
108
90
 
109
91
  // Unknown types keep an empty name for the tag's localised "External agent" label.
110
- return agentType && ROVO_AGENT_TYPES.has(agentType) ? {
111
- agentKind: 'rovo',
112
- kind: 'agent',
113
- name: ROVO_AGENT_NAME
114
- } : agentPresentation ? _objectSpread(_objectSpread({}, agentPresentation), {}, {
115
- kind: 'agent'
116
- }) : {
92
+ if (agentType && ROVO_AGENT_TYPES.has(agentType)) {
93
+ return {
94
+ agentKind: 'rovo',
95
+ kind: 'agent',
96
+ name: ROVO_AGENT_NAME
97
+ };
98
+ }
99
+ var externalName = agentType ? EXTERNAL_AGENT_NAMES[agentType] : undefined;
100
+ return {
117
101
  agentKind: 'external',
118
102
  kind: 'agent',
119
- name: ''
103
+ name: externalName !== null && externalName !== void 0 ? externalName : ''
120
104
  };
121
105
  };
122
106
 
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DIFF_AGENT_BRANDS = void 0;
6
+ exports.DIFF_AGENT_BRANDS = exports.ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED = void 0;
7
7
  /**
8
8
  * `'standard'` (purple insertions, default) and `'traditional'` (green/red) are the two
9
9
  * plugin-configured schemes. The remaining accent names are the attribution palette used for
@@ -27,9 +27,19 @@ exports.DIFF_AGENT_BRANDS = void 0;
27
27
 
28
28
  var DIFF_AGENT_BRANDS = exports.DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt']);
29
29
 
30
+ /** The brand id `@atlaskit/agent-color` registers each `AgentBrandColorScheme` under. */
31
+
32
+ /**
33
+ * Compile-time-only: fails to build if `DiffAgentBrand` names a brand `@atlaskit/agent-color`
34
+ * hasn't registered a colour scheme for. Catches "added a brand here but forgot the colour"
35
+ * without needing a runtime check. Exported only so the unused check on this module-scope
36
+ * assertion doesn't fire; no consumer needs its value.
37
+ */
38
+ var ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED = exports.ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED = true;
39
+
30
40
  /** A complete identity for one of the accounts named by a step attribution. */
31
41
 
32
- /** Agent presentation: branded, identified by profile, or a generic external agent. */
42
+ /** Agent presentation: branded (dedicated icon and reserved participant colour), identified by profile, or a generic external agent. */
33
43
 
34
44
  /**
35
45
  * A contributor the plugin has resolved from a step attribution and a supplied profile. Internal:
@@ -9,7 +9,13 @@ var _avatarSizes = require("@atlaskit/avatar/avatar-sizes");
9
9
  var _default = require("@atlaskit/avatar/constants/default");
10
10
  var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
11
11
  var _contributorTagIcons = require("./contributorTagIcons");
12
- /** Agent kinds with a custom contributor-tag icon. */
12
+ /**
13
+ * Agent kinds with a custom contributor-tag icon. The `satisfies` clause fails the build if a
14
+ * `DiffAgentBrand` is missing an icon here; `ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED` in
15
+ * `showDiffPluginType.ts` similarly fails the build if a brand has no `@atlaskit/agent-color`
16
+ * colour scheme. The declared type stays the wider `TagContributor['agentKind']` so indexing below
17
+ * (with `'identified' | 'external'` in play too) stays safely partial.
18
+ */
13
19
  var AGENT_KIND_ICONS = {
14
20
  claude: 'claude',
15
21
  chatgpt: 'chatgpt',
@@ -34,12 +40,13 @@ var boxStyle = (0, _lazyNodeView.convertToInlineCss)({
34
40
  height: "".concat(AVATAR_BOX_SIZE, "px")
35
41
  });
36
42
  var shapeStyle = (0, _lazyNodeView.convertToInlineCss)({
37
- display: 'inline-flex',
43
+ display: 'flex',
38
44
  alignItems: 'center',
39
45
  justifyContent: 'center',
40
46
  boxSizing: 'border-box',
41
47
  width: "".concat(AVATAR_SIZE, "px"),
42
48
  height: "".concat(AVATAR_SIZE, "px"),
49
+ aspectRatio: '1/1',
43
50
  overflow: 'hidden'
44
51
  });
45
52
  var imageStyle = (0, _lazyNodeView.convertToInlineCss)({
@@ -10,12 +10,15 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
12
  var _bindEventListener = require("bind-event-listener");
13
+ var _getThirdPartyAgentColor = require("@atlaskit/agent-color/get-third-party-agent-color");
13
14
  var _vanillaTooltip = require("@atlaskit/editor-common/vanilla-tooltip");
14
15
  var _factory = require("../../pm-plugins/decorations/colorSchemes/factory");
15
16
  var _schemes = require("../../pm-plugins/decorations/colorSchemes/schemes");
16
17
  var _buildContributorTagDom = require("./buildContributorTagDom");
17
18
  var _contributorAvatarRenderer = require("./contributorAvatarRenderer");
18
19
  var _contributorLabel = require("./contributorLabel");
20
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
19
22
  /**
20
23
  * Resolves the tag's accent from the same scheme value the highlight was drawn from, so the colour
21
24
  * the two carry can never drift — only the tone does, which is `getAccentTokens`'s to pick.
@@ -29,6 +32,19 @@ var getTagAccent = function getTagAccent(_ref) {
29
32
  return (0, _factory.getAccentTokens)(accent);
30
33
  };
31
34
 
35
+ /** ChatGPT's own brand colour, resolved from the shared `@atlaskit/agent-color` registry. */
36
+ var chatgptBrandColor = (0, _getThirdPartyAgentColor.getThirdPartyAgentColor)({
37
+ agentName: 'chatgpt'
38
+ });
39
+
40
+ /** Brand accents for agent kinds with no ADS token match. New agents opt in by adding an entry. */
41
+ var AGENT_KIND_ACCENT_OVERRIDES = _objectSpread({}, chatgptBrandColor ? {
42
+ chatgpt: {
43
+ background: chatgptBrandColor.bold,
44
+ text: chatgptBrandColor.boldText
45
+ }
46
+ } : {});
47
+
32
48
  /**
33
49
  * Keyboard focus, as a member of `revealSources` alongside the elements the pointer can be over. It
34
50
  * has no element of its own to key on — the tag is already in the set under its own hover.
@@ -374,12 +390,15 @@ var ContributorTagController = exports.ContributorTagController = /*#__PURE__*/f
374
390
  }, {
375
391
  key: "accentOf",
376
392
  value: function accentOf(model) {
377
- var _model$isInserted;
378
- return getTagAccent({
393
+ var _model$isInserted, _model$contributor$ag, _model$connectedContr;
394
+ var accent = getTagAccent({
379
395
  colorScheme: model.colorScheme,
380
396
  isActive: Boolean(model.isActive),
381
397
  isInserted: (_model$isInserted = model.isInserted) !== null && _model$isInserted !== void 0 ? _model$isInserted : true
382
398
  });
399
+ var agentKind = (_model$contributor$ag = model.contributor.agentKind) !== null && _model$contributor$ag !== void 0 ? _model$contributor$ag : (_model$connectedContr = model.connectedContributor) === null || _model$connectedContr === void 0 ? void 0 : _model$connectedContr.agentKind;
400
+ var override = agentKind && AGENT_KIND_ACCENT_OVERRIDES[agentKind];
401
+ return override ? _objectSpread(_objectSpread({}, accent), override) : accent;
383
402
  }
384
403
  }, {
385
404
  key: "applyAccent",
@@ -34,8 +34,8 @@ var ROVO_HEX_ICON_SVG = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" r
34
34
  /** ClaudeLogo from ai-mate/studio-browse-kit, inset to fit the agent hexagon. */
35
35
  var CLAUDE_ICON_SVG = "<svg width=\"12\" height=\"12\" viewBox=\"8 8 32 32\" role=\"presentation\" style=\"display:block\"><path fill=\"#FFFFFF\" d=\"M14.2785 29.274L20.5732 25.7445L20.6785 25.4369L20.5732 25.2669H20.2653L19.2122 25.2021L15.6152 25.105L12.4962 24.9755L9.47443 24.8136L8.71291 24.6517L8 23.7126L8.07291 23.2431L8.71291 22.8141L9.62835 22.895L11.6537 23.0326L14.6916 23.2431L16.8952 23.3726L20.16 23.7126H20.6785L20.7514 23.5022L20.5732 23.3726L20.4354 23.2431L17.2922 21.1141L13.8896 18.8636L12.1073 17.5684L11.1433 16.9127L10.6572 16.2975L10.4466 14.9537L11.3215 13.9904L12.4962 14.0713L12.7959 14.1523L13.9868 15.067L16.5306 17.0342L19.8522 19.4789L20.3382 19.8836L20.5327 19.746L20.557 19.6489L20.3382 19.2846L18.5316 16.0223L16.6035 12.7033L15.7448 11.3271L15.518 10.5014C15.437 10.1614 15.3803 9.87807 15.3803 9.52998L16.3767 8.17809L16.9276 8L18.2562 8.17809L18.8152 8.6638L19.6415 10.55L20.9782 13.5209L23.0522 17.5603L23.6597 18.7584L23.9838 19.8674L24.1053 20.2074H24.3159V20.0132L24.4861 17.7384L24.802 14.9456L25.1099 11.3514L25.2152 10.3395L25.7175 9.12522L26.7139 8.46952L27.4916 8.84189L28.1316 9.75664L28.0425 10.3476L27.6618 12.8166L26.9165 16.6861L26.4304 19.2765H26.7139L27.038 18.9527L28.3504 17.2122L30.5539 14.4599L31.5261 13.3671L32.6603 12.1609L33.3894 11.5861H34.7666L35.7792 13.0918L35.3256 14.6461L33.9079 16.4432L32.7332 17.9651L31.0481 20.2317L29.9949 22.045L30.0922 22.1907L30.3433 22.1665L34.1509 21.3569L36.2086 20.9846L38.6633 20.5636L39.7732 21.0817L39.8947 21.6079L39.4572 22.6845L36.8324 23.3322L33.7539 23.9474L29.1686 25.0321L29.1119 25.0726L29.1767 25.1536L31.2425 25.3478L32.1256 25.3964H34.2886L38.3149 25.6959L39.3681 26.3921L40 27.2421L39.8947 27.8897L38.2744 28.7154L36.0871 28.1973L30.9833 26.9831L29.2334 26.5459H28.9904V26.6916L30.4486 28.1164L33.122 30.5287L36.4678 33.6372L36.638 34.4063L36.2086 35.0134L35.7549 34.9486L32.8142 32.7387L31.68 31.743L29.1119 29.5816H28.9418V29.8082L29.5332 30.6744L32.6603 35.3696L32.8223 36.8105L32.5954 37.28L31.7853 37.5634L30.8942 37.4015L29.0633 34.8353L27.1757 31.9454L25.6527 29.3549L25.4663 29.4602L24.5671 39.1338L24.1458 39.6276L23.1737 40L22.3635 39.3848L21.9342 38.3891L22.3635 36.422L22.882 33.8558L23.3033 31.8158L23.6841 29.2821L23.9109 28.4402L23.8947 28.3835L23.7084 28.4078L21.7965 31.0306L18.8881 34.9567L16.5873 37.4177L16.0365 37.6362L15.0805 37.1424L15.1696 36.2601L15.7043 35.4748L18.8881 31.4273L20.8081 28.9178L22.0476 27.4688L22.0395 27.2583H21.9666L13.5089 32.7468L12.002 32.9411L11.3539 32.3339L11.4349 31.3382L11.7428 31.0144L14.2866 29.2659L14.2785 29.274Z\"/></svg>";
36
36
 
37
- /** ChatGPT Presence avatar from Confluence's `ChatGptPresenceIcon`, at 16px. */
38
- var CHATGPT_ICON_SVG = '<svg width="16" height="16" viewBox="1 1.5328 16 16" overflow="visible" fill="none" role="presentation" style="display:block"><path d="M7.24707 0.973022C8.33116 0.344106 9.66865 0.342238 10.7539 0.969116L15.751 3.85583C16.8334 4.48117 17.5 5.63699 17.5 6.88708V12.1801C17.5 13.4301 16.8334 14.586 15.751 15.2113L10.751 18.1C9.66769 18.7258 8.33231 18.7258 7.24902 18.1L2.24902 15.2113C1.16658 14.586 0.5 13.4301 0.5 12.1801V6.90271C0.5 5.65489 1.1648 4.50153 2.24414 3.87537L7.24707 0.973022Z" fill="#14120B" stroke="#FFFFFF" stroke-width="1"/><svg x="4" y="4.53355" width="10" height="10" viewBox="10 12.0281 24 24" overflow="visible"><path d="M32.2119 21.2917C32.7552 19.256 32.2283 16.9938 30.6312 15.3967C29.0342 13.7997 26.7722 13.2728 24.7362 13.8161C23.2447 12.3277 21.0224 11.6529 18.8407 12.2376C16.6589 12.8221 15.0717 14.5177 14.5243 16.5524C12.4896 17.0999 10.794 18.6873 10.2094 20.8688C9.62493 23.0506 10.2996 25.2728 11.7881 26.7644C11.2448 28.8002 11.7718 31.0623 13.3688 32.6594C14.9658 34.2564 17.2278 34.7834 19.2638 34.2401C20.7553 35.7284 22.9778 36.4032 25.1593 35.8187C27.3411 35.2342 28.9283 33.5386 29.4757 31.5039C31.5105 30.9564 33.206 29.3691 33.7905 27.1874C34.3751 25.0058 33.7005 22.7834 32.2119 21.2919V21.2917ZM29.6507 16.3775C30.7329 17.4598 31.1792 18.937 30.9897 20.3453L25.9072 17.4108C25.6929 17.2871 25.4289 17.2871 25.2148 17.4108L19.2638 20.8466V18.5936C19.2638 18.4356 19.3485 18.2877 19.4854 18.2087L24.017 15.5924C25.8125 14.5895 28.1246 14.8514 29.6508 16.3775H29.6507ZM22 20.8685L24.7364 22.4483V25.608L22 27.1878L19.2636 25.608V22.4483L22 20.8685ZM15.7028 18.0636C15.732 16.0073 17.1149 14.1359 19.1997 13.5772C20.678 13.1811 22.1806 13.5333 23.3053 14.4014L18.2226 17.3357C18.0084 17.4594 17.8764 17.6881 17.8764 17.9353V24.8069L15.9253 23.6804C15.7885 23.6014 15.7028 23.454 15.7028 23.2959V18.0634V18.0636ZM11.549 21.2278C11.9451 19.7495 13.0014 18.6242 14.3156 18.0843V23.9532C14.3156 24.2004 14.4476 24.4291 14.6618 24.5528L20.6128 27.9886L18.6617 29.1151C18.5249 29.1941 18.3544 29.1946 18.2175 29.1156L13.6859 26.4993C11.9196 25.4459 10.9905 23.3124 11.549 21.2278ZM14.3494 31.6788C13.2671 30.5965 12.8208 29.1193 13.0103 27.7111L18.0928 30.6455C18.3071 30.7692 18.5711 30.7692 18.7852 30.6455L24.7362 27.2098V29.4626C24.7362 29.6207 24.6516 29.7682 24.5146 29.8477L19.983 32.4639C18.1875 33.4667 15.8754 33.2049 14.3492 31.6788H14.3494ZM28.2972 29.9927C28.268 32.049 26.8851 33.9205 24.8003 34.4791C23.322 34.8752 21.8194 34.523 20.6947 33.6549L25.7774 30.7205C25.9917 30.5969 26.1236 30.3682 26.1236 30.1209V23.2494L28.0747 24.3759C28.2115 24.4549 28.2972 24.6023 28.2972 24.7604V29.9929V29.9927ZM32.451 26.8285C32.0549 28.3068 30.9986 29.4321 29.6844 29.972V24.1031C29.6844 23.8559 29.5525 23.6272 29.3382 23.5035L23.3872 20.0678L25.3383 18.9412C25.4751 18.8622 25.6456 18.8617 25.7825 18.9407L30.314 21.5569C32.0804 22.6105 33.0095 24.7439 32.451 26.8285Z" fill="#FFFFFF"/></svg></svg>';
37
+ /** ChatGPT hexagon lockup from the brand asset: the hexagon and knot glyph both baked in. */
38
+ var CHATGPT_ICON_SVG = "<svg width=\"16\" height=\"18\" viewBox=\"0 0 16 18\" fill=\"none\" role=\"presentation\" style=\"display:block\"><path fill=\"#14120B\" d=\"M14.5007 3.289L9.50384 0.402314C8.5736 -0.13509 7.42701 -0.134047 6.49774 0.405051L1.49458 3.30756C0.569434 3.84427 0 4.83294 0 5.9025V11.1804C0 12.2519 0.571497 13.2421 1.49931 13.7781L6.49931 16.6666C7.42787 17.203 8.57213 17.203 9.50069 16.6666L14.5007 13.7781C15.4285 13.2421 16 12.2519 16 11.1804V5.88668C16 4.81517 15.4285 3.82501 14.5007 3.289Z\"/><path fill=\"white\" d=\"M12.255 7.39338C12.4813 6.54514 12.2618 5.60258 11.5963 4.93713C10.9309 4.2717 9.9884 4.05217 9.1401 4.27852C8.51863 3.65837 7.59268 3.37721 6.68362 3.62082C5.77456 3.86436 5.11322 4.57087 4.88512 5.41867C4.03733 5.64676 3.33082 6.30819 3.08727 7.21717C2.84372 8.12623 3.12482 9.05218 3.74503 9.67365C3.51868 10.5219 3.73823 11.4645 4.40366 12.1299C5.06909 12.7953 6.01159 13.0149 6.85992 12.7885C7.48137 13.4087 8.4074 13.6898 9.31638 13.4463C10.2254 13.2027 10.8868 12.4962 11.1149 11.6485C11.9627 11.4203 12.6692 10.7589 12.9127 9.84993C13.1563 8.94089 12.8752 8.01491 12.255 7.39347V7.39338ZM11.1878 5.34578C11.6387 5.79673 11.8247 6.41226 11.7457 6.99902L9.62799 5.77632C9.53872 5.72478 9.42871 5.72478 9.3395 5.77632L6.85992 7.20789V6.26917C6.85992 6.20333 6.89519 6.1417 6.95226 6.10877L8.84042 5.01867C9.58854 4.60079 10.5519 4.7099 11.1878 5.34578H11.1878ZM8.00001 7.21703L9.14016 7.87529V9.19183L8.00001 9.85009L6.85984 9.19183V7.87529L8.00001 7.21703ZM5.37616 6.04832C5.38831 5.19153 5.96453 4.41177 6.83319 4.17899C7.44917 4.01397 8.07524 4.16069 8.54389 4.52241L6.42609 5.74505C6.33682 5.79656 6.28184 5.89186 6.28184 5.99489V8.85803L5.4689 8.38867C5.41189 8.35573 5.37616 8.29433 5.37616 8.22846V6.04826V6.04832ZM3.64542 7.36674C3.81044 6.75079 4.25056 6.28191 4.79817 6.05694V8.50232C4.79817 8.60534 4.85315 8.70061 4.94241 8.75216L7.42202 10.1837L6.60904 10.6531C6.55203 10.686 6.48098 10.6862 6.42397 10.6533L4.53581 9.56321C3.79984 9.12427 3.41272 8.23534 3.64542 7.36674ZM4.81224 11.7213C4.36129 11.2704 4.17534 10.6549 4.25429 10.0681L6.37201 11.2908C6.4613 11.3423 6.57129 11.3423 6.6605 11.2908L9.1401 9.85923V10.7979C9.1401 10.8638 9.10483 10.9254 9.04774 10.9584L7.15958 12.0485C6.41145 12.4663 5.44809 12.3572 4.81215 11.7213H4.81224ZM10.6238 11.0188C10.6117 11.8756 10.0355 12.6554 9.1668 12.8881C8.55083 13.0532 7.92476 12.9064 7.45613 12.5447L9.57391 11.322C9.6632 11.2705 9.71816 11.1753 9.71816 11.0722V8.20906L10.5311 8.67845C10.5881 8.71139 10.6238 8.77279 10.6238 8.83866V11.0189V11.0188ZM12.3546 9.70035C12.1896 10.3163 11.7494 10.7852 11.2018 11.0101V8.5648C11.2018 8.46178 11.1469 8.36648 11.0576 8.31496L8.57798 6.88339L9.39095 6.41401C9.44796 6.38107 9.51902 6.38085 9.57603 6.41378L11.4642 7.50388C12.2002 7.94285 12.5873 8.83178 12.3546 9.70035Z\"/></svg>";
39
39
  var markup = {
40
40
  aiAgent: AI_AGENT_ICON_SVG,
41
41
  aiBot: AI_BOT_ICON_SVG,
@@ -67,6 +67,8 @@ const extractChangedRows = ({
67
67
  // Check if this row overlaps with the deletion range
68
68
  const rowOverlapsChange = rowStart >= changeStartInTable && rowStart < changeEndInTable || rowEnd > changeStartInTable && rowEnd <= changeEndInTable || rowStart < changeStartInTable && rowEnd > changeEndInTable;
69
69
  if (rowOverlapsChange && rowNode.type.name === 'tableRow' && (isExtendedEnabled(diffType) || !isEmptyRow(rowNode))) {
70
+ const rowLocalId = rowNode.attrs.localId;
71
+ const isTableRowReplacement = rowLocalId && tableNew.node.children.some(candidateRow => candidateRow.type.name === 'tableRow' && candidateRow.attrs.localId === rowLocalId);
70
72
  const cellEdgeAttrs = edgeAttrsByOffset ? getRowCellEdgeAttrs({
71
73
  edgeAttrsByOffset,
72
74
  rowNode,
@@ -76,6 +78,7 @@ const extractChangedRows = ({
76
78
  changedRows.push({
77
79
  rowIndex,
78
80
  rowNode,
81
+ isTableRowReplacement,
79
82
  cellEdgeAttrs,
80
83
  fromA: tableOld.pos + 1 + rowStart,
81
84
  toA: tableOld.pos + 1 + rowEnd,
@@ -152,6 +155,7 @@ const createChangedRowDOM = ({
152
155
  rowNode,
153
156
  cellEdgeAttrs,
154
157
  nodeViewSerializer,
158
+ isTableRowReplacement,
155
159
  colorScheme,
156
160
  isInserted,
157
161
  diffType,
@@ -160,6 +164,9 @@ const createChangedRowDOM = ({
160
164
  isActive
161
165
  }) => {
162
166
  const tr = document.createElement('tr');
167
+ if (isTableRowReplacement && fg('platform_editor_ai_show_diff_patch_2')) {
168
+ tr.dataset.showDiffTableRowReplacement = 'true';
169
+ }
163
170
  const colors = colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard'];
164
171
  const deletedTreatment = isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? buildDeletedRowStyle(colors) : resolveDeletedRowStyleLegacy(getLegacyColorScheme(colorScheme));
165
172
  const hostsRemovedLozenge = Boolean(intl) && isExtendedEnabled(diffType) && !isInserted && !hasAnchoredRemovedLozenge;
@@ -299,6 +306,7 @@ export const createChangedRowDecorationWidgets = ({
299
306
  const hasAnchoredRemovedLozenge = Boolean(intl) && isExtendedEnabled(diffType) && !isInserted && supportsAnchorPositioning();
300
307
  const rowDOM = createChangedRowDOM({
301
308
  rowNode: changedRow.rowNode,
309
+ isTableRowReplacement: changedRow.isTableRowReplacement,
302
310
  cellEdgeAttrs: changedRow.cellEdgeAttrs,
303
311
  nodeViewSerializer,
304
312
  colorScheme,
@@ -1,3 +1,4 @@
1
+ import { getThirdPartyAgentColor } from '@atlaskit/agent-color/get-third-party-agent-color';
1
2
  import { getAttributionKey } from './decorations/colorSchemes/attributions';
2
3
 
3
4
  /** A brand name, so a literal rather than a translated message. */
@@ -5,48 +6,24 @@ const ROVO_AGENT_NAME = 'Rovo';
5
6
 
6
7
  /** `agentType` values that render as "Rovo" rather than as a generic external agent. */
7
8
  const ROVO_AGENT_TYPES = new Set(['convo-ai', 'rovo_chat']);
8
- /** Known external agent types emitted by Confluence's agent identification service. */
9
- const EXTERNAL_AGENT_PRESENTATIONS = {
10
- claude: {
11
- agentKind: 'claude',
12
- name: 'Claude'
13
- },
14
- codex: {
15
- agentKind: 'external',
16
- name: 'Codex'
17
- },
18
- vscode: {
19
- agentKind: 'external',
20
- name: 'VS Code'
21
- },
22
- hermes: {
23
- agentKind: 'external',
24
- name: 'Hermes'
25
- },
26
- runlayer: {
27
- agentKind: 'external',
28
- name: 'Runlayer'
29
- },
30
- zed: {
31
- agentKind: 'external',
32
- name: 'Zed'
33
- },
34
- ampcode: {
35
- agentKind: 'external',
36
- name: 'Ampcode'
37
- },
38
- antigravity: {
39
- agentKind: 'external',
40
- name: 'Antigravity'
41
- },
42
- devin_cli: {
43
- agentKind: 'external',
44
- name: 'Devin CLI'
45
- },
46
- pi_agent: {
47
- agentKind: 'external',
48
- name: 'Pi Agent'
49
- }
9
+ /** `@atlaskit/agent-color` brands show-diff renders with a dedicated presentation. */
10
+ const SHOW_DIFF_AGENT_BRANDS = {
11
+ 'agent-brand-claude': 'claude',
12
+ 'agent-brand-chatgpt': 'chatgpt',
13
+ 'agent-brand-rovo': 'rovo'
14
+ };
15
+
16
+ /** Known external agent types emitted by Confluence's agent identification service that carry
17
+ * no `@atlaskit/agent-color` brand — a generic labelled fallback. */
18
+ const EXTERNAL_AGENT_NAMES = {
19
+ vscode: 'VS Code',
20
+ hermes: 'Hermes',
21
+ runlayer: 'Runlayer',
22
+ zed: 'Zed',
23
+ ampcode: 'Ampcode',
24
+ antigravity: 'Antigravity',
25
+ devin_cli: 'Devin CLI',
26
+ pi_agent: 'Pi Agent'
50
27
  };
51
28
  const hasAgentIdentity = attribution => {
52
29
  var _attribution$agentId, _attribution$agentTyp;
@@ -76,11 +53,15 @@ const resolveUser = (userId, profilesByAccountId) => {
76
53
  const resolveAgent = (attribution, profilesByAccountId) => {
77
54
  var _attribution$agentTyp2, _attribution$agentId2;
78
55
  const agentType = (_attribution$agentTyp2 = attribution.agentType) === null || _attribution$agentTyp2 === void 0 ? void 0 : _attribution$agentTyp2.trim().toLowerCase();
79
- const agentPresentation = agentType ? EXTERNAL_AGENT_PRESENTATIONS[agentType] : undefined;
80
- if (agentPresentation && agentPresentation.agentKind !== 'external') {
56
+ const brand = agentType ? getThirdPartyAgentColor({
57
+ agentName: agentType
58
+ }) : undefined;
59
+ const diffBrand = brand ? SHOW_DIFF_AGENT_BRANDS[brand.scheme] : undefined;
60
+ if (diffBrand && brand) {
81
61
  return {
82
- ...agentPresentation,
83
- kind: 'agent'
62
+ agentKind: diffBrand,
63
+ kind: 'agent',
64
+ name: brand.name
84
65
  };
85
66
  }
86
67
  const agentId = (_attribution$agentId2 = attribution.agentId) === null || _attribution$agentId2 === void 0 ? void 0 : _attribution$agentId2.trim();
@@ -97,17 +78,18 @@ const resolveAgent = (attribution, profilesByAccountId) => {
97
78
  }
98
79
 
99
80
  // Unknown types keep an empty name for the tag's localised "External agent" label.
100
- return agentType && ROVO_AGENT_TYPES.has(agentType) ? {
101
- agentKind: 'rovo',
102
- kind: 'agent',
103
- name: ROVO_AGENT_NAME
104
- } : agentPresentation ? {
105
- ...agentPresentation,
106
- kind: 'agent'
107
- } : {
81
+ if (agentType && ROVO_AGENT_TYPES.has(agentType)) {
82
+ return {
83
+ agentKind: 'rovo',
84
+ kind: 'agent',
85
+ name: ROVO_AGENT_NAME
86
+ };
87
+ }
88
+ const externalName = agentType ? EXTERNAL_AGENT_NAMES[agentType] : undefined;
89
+ return {
108
90
  agentKind: 'external',
109
91
  kind: 'agent',
110
- name: ''
92
+ name: externalName !== null && externalName !== void 0 ? externalName : ''
111
93
  };
112
94
  };
113
95
 
@@ -21,9 +21,19 @@
21
21
 
22
22
  export const DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt']);
23
23
 
24
+ /** The brand id `@atlaskit/agent-color` registers each `AgentBrandColorScheme` under. */
25
+
26
+ /**
27
+ * Compile-time-only: fails to build if `DiffAgentBrand` names a brand `@atlaskit/agent-color`
28
+ * hasn't registered a colour scheme for. Catches "added a brand here but forgot the colour"
29
+ * without needing a runtime check. Exported only so the unused check on this module-scope
30
+ * assertion doesn't fire; no consumer needs its value.
31
+ */
32
+ export const ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED = true;
33
+
24
34
  /** A complete identity for one of the accounts named by a step attribution. */
25
35
 
26
- /** Agent presentation: branded, identified by profile, or a generic external agent. */
36
+ /** Agent presentation: branded (dedicated icon and reserved participant colour), identified by profile, or a generic external agent. */
27
37
 
28
38
  /**
29
39
  * A contributor the plugin has resolved from a step attribution and a supplied profile. Internal:
@@ -4,7 +4,13 @@ import { BORDER_WIDTH } from '@atlaskit/avatar/constants/default';
4
4
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
5
5
  import { getContributorTagIcon } from './contributorTagIcons';
6
6
 
7
- /** Agent kinds with a custom contributor-tag icon. */
7
+ /**
8
+ * Agent kinds with a custom contributor-tag icon. The `satisfies` clause fails the build if a
9
+ * `DiffAgentBrand` is missing an icon here; `ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED` in
10
+ * `showDiffPluginType.ts` similarly fails the build if a brand has no `@atlaskit/agent-color`
11
+ * colour scheme. The declared type stays the wider `TagContributor['agentKind']` so indexing below
12
+ * (with `'identified' | 'external'` in play too) stays safely partial.
13
+ */
8
14
  const AGENT_KIND_ICONS = {
9
15
  claude: 'claude',
10
16
  chatgpt: 'chatgpt',
@@ -29,12 +35,13 @@ const boxStyle = convertToInlineCss({
29
35
  height: `${AVATAR_BOX_SIZE}px`
30
36
  });
31
37
  const shapeStyle = convertToInlineCss({
32
- display: 'inline-flex',
38
+ display: 'flex',
33
39
  alignItems: 'center',
34
40
  justifyContent: 'center',
35
41
  boxSizing: 'border-box',
36
42
  width: `${AVATAR_SIZE}px`,
37
43
  height: `${AVATAR_SIZE}px`,
44
+ aspectRatio: '1/1',
38
45
  overflow: 'hidden'
39
46
  });
40
47
  const imageStyle = convertToInlineCss({
@@ -1,5 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import { bind, bindAll } from 'bind-event-listener';
3
+ import { getThirdPartyAgentColor } from '@atlaskit/agent-color/get-third-party-agent-color';
3
4
  import { VanillaTooltip } from '@atlaskit/editor-common/vanilla-tooltip';
4
5
  import { DELETED_HIGHLIGHT_BG_VAR, DELETED_HIGHLIGHT_BORDER_VAR, getAccentTokens, getDeletedHighlightHoverBorderColor, getDeletedHighlightHoverColor } from '../../pm-plugins/decorations/colorSchemes/factory';
5
6
  import { colorSchemeRegistry } from '../../pm-plugins/decorations/colorSchemes/schemes';
@@ -20,6 +21,21 @@ const getTagAccent = ({
20
21
  return getAccentTokens(accent);
21
22
  };
22
23
 
24
+ /** ChatGPT's own brand colour, resolved from the shared `@atlaskit/agent-color` registry. */
25
+ const chatgptBrandColor = getThirdPartyAgentColor({
26
+ agentName: 'chatgpt'
27
+ });
28
+
29
+ /** Brand accents for agent kinds with no ADS token match. New agents opt in by adding an entry. */
30
+ const AGENT_KIND_ACCENT_OVERRIDES = {
31
+ ...(chatgptBrandColor ? {
32
+ chatgpt: {
33
+ background: chatgptBrandColor.bold,
34
+ text: chatgptBrandColor.boldText
35
+ }
36
+ } : {})
37
+ };
38
+
23
39
  /**
24
40
  * Keyboard focus, as a member of `revealSources` alongside the elements the pointer can be over. It
25
41
  * has no element of its own to key on — the tag is already in the set under its own hover.
@@ -330,12 +346,18 @@ export class ContributorTagController {
330
346
  this.dom.srLabel.textContent = fullLabel;
331
347
  }
332
348
  accentOf(model) {
333
- var _model$isInserted;
334
- return getTagAccent({
349
+ var _model$isInserted, _model$contributor$ag, _model$connectedContr;
350
+ const accent = getTagAccent({
335
351
  colorScheme: model.colorScheme,
336
352
  isActive: Boolean(model.isActive),
337
353
  isInserted: (_model$isInserted = model.isInserted) !== null && _model$isInserted !== void 0 ? _model$isInserted : true
338
354
  });
355
+ const agentKind = (_model$contributor$ag = model.contributor.agentKind) !== null && _model$contributor$ag !== void 0 ? _model$contributor$ag : (_model$connectedContr = model.connectedContributor) === null || _model$connectedContr === void 0 ? void 0 : _model$connectedContr.agentKind;
356
+ const override = agentKind && AGENT_KIND_ACCENT_OVERRIDES[agentKind];
357
+ return override ? {
358
+ ...accent,
359
+ ...override
360
+ } : accent;
339
361
  }
340
362
  applyAccent(model) {
341
363
  if (!this.dom) {
@@ -28,8 +28,8 @@ const ROVO_HEX_ICON_SVG = `<svg width="16" height="16" viewBox="0 0 24 24" role=
28
28
  /** ClaudeLogo from ai-mate/studio-browse-kit, inset to fit the agent hexagon. */
29
29
  const CLAUDE_ICON_SVG = `<svg width="12" height="12" viewBox="8 8 32 32" role="presentation" style="display:block"><path fill="#FFFFFF" d="M14.2785 29.274L20.5732 25.7445L20.6785 25.4369L20.5732 25.2669H20.2653L19.2122 25.2021L15.6152 25.105L12.4962 24.9755L9.47443 24.8136L8.71291 24.6517L8 23.7126L8.07291 23.2431L8.71291 22.8141L9.62835 22.895L11.6537 23.0326L14.6916 23.2431L16.8952 23.3726L20.16 23.7126H20.6785L20.7514 23.5022L20.5732 23.3726L20.4354 23.2431L17.2922 21.1141L13.8896 18.8636L12.1073 17.5684L11.1433 16.9127L10.6572 16.2975L10.4466 14.9537L11.3215 13.9904L12.4962 14.0713L12.7959 14.1523L13.9868 15.067L16.5306 17.0342L19.8522 19.4789L20.3382 19.8836L20.5327 19.746L20.557 19.6489L20.3382 19.2846L18.5316 16.0223L16.6035 12.7033L15.7448 11.3271L15.518 10.5014C15.437 10.1614 15.3803 9.87807 15.3803 9.52998L16.3767 8.17809L16.9276 8L18.2562 8.17809L18.8152 8.6638L19.6415 10.55L20.9782 13.5209L23.0522 17.5603L23.6597 18.7584L23.9838 19.8674L24.1053 20.2074H24.3159V20.0132L24.4861 17.7384L24.802 14.9456L25.1099 11.3514L25.2152 10.3395L25.7175 9.12522L26.7139 8.46952L27.4916 8.84189L28.1316 9.75664L28.0425 10.3476L27.6618 12.8166L26.9165 16.6861L26.4304 19.2765H26.7139L27.038 18.9527L28.3504 17.2122L30.5539 14.4599L31.5261 13.3671L32.6603 12.1609L33.3894 11.5861H34.7666L35.7792 13.0918L35.3256 14.6461L33.9079 16.4432L32.7332 17.9651L31.0481 20.2317L29.9949 22.045L30.0922 22.1907L30.3433 22.1665L34.1509 21.3569L36.2086 20.9846L38.6633 20.5636L39.7732 21.0817L39.8947 21.6079L39.4572 22.6845L36.8324 23.3322L33.7539 23.9474L29.1686 25.0321L29.1119 25.0726L29.1767 25.1536L31.2425 25.3478L32.1256 25.3964H34.2886L38.3149 25.6959L39.3681 26.3921L40 27.2421L39.8947 27.8897L38.2744 28.7154L36.0871 28.1973L30.9833 26.9831L29.2334 26.5459H28.9904V26.6916L30.4486 28.1164L33.122 30.5287L36.4678 33.6372L36.638 34.4063L36.2086 35.0134L35.7549 34.9486L32.8142 32.7387L31.68 31.743L29.1119 29.5816H28.9418V29.8082L29.5332 30.6744L32.6603 35.3696L32.8223 36.8105L32.5954 37.28L31.7853 37.5634L30.8942 37.4015L29.0633 34.8353L27.1757 31.9454L25.6527 29.3549L25.4663 29.4602L24.5671 39.1338L24.1458 39.6276L23.1737 40L22.3635 39.3848L21.9342 38.3891L22.3635 36.422L22.882 33.8558L23.3033 31.8158L23.6841 29.2821L23.9109 28.4402L23.8947 28.3835L23.7084 28.4078L21.7965 31.0306L18.8881 34.9567L16.5873 37.4177L16.0365 37.6362L15.0805 37.1424L15.1696 36.2601L15.7043 35.4748L18.8881 31.4273L20.8081 28.9178L22.0476 27.4688L22.0395 27.2583H21.9666L13.5089 32.7468L12.002 32.9411L11.3539 32.3339L11.4349 31.3382L11.7428 31.0144L14.2866 29.2659L14.2785 29.274Z"/></svg>`;
30
30
 
31
- /** ChatGPT Presence avatar from Confluence's `ChatGptPresenceIcon`, at 16px. */
32
- const CHATGPT_ICON_SVG = '<svg width="16" height="16" viewBox="1 1.5328 16 16" overflow="visible" fill="none" role="presentation" style="display:block"><path d="M7.24707 0.973022C8.33116 0.344106 9.66865 0.342238 10.7539 0.969116L15.751 3.85583C16.8334 4.48117 17.5 5.63699 17.5 6.88708V12.1801C17.5 13.4301 16.8334 14.586 15.751 15.2113L10.751 18.1C9.66769 18.7258 8.33231 18.7258 7.24902 18.1L2.24902 15.2113C1.16658 14.586 0.5 13.4301 0.5 12.1801V6.90271C0.5 5.65489 1.1648 4.50153 2.24414 3.87537L7.24707 0.973022Z" fill="#14120B" stroke="#FFFFFF" stroke-width="1"/><svg x="4" y="4.53355" width="10" height="10" viewBox="10 12.0281 24 24" overflow="visible"><path d="M32.2119 21.2917C32.7552 19.256 32.2283 16.9938 30.6312 15.3967C29.0342 13.7997 26.7722 13.2728 24.7362 13.8161C23.2447 12.3277 21.0224 11.6529 18.8407 12.2376C16.6589 12.8221 15.0717 14.5177 14.5243 16.5524C12.4896 17.0999 10.794 18.6873 10.2094 20.8688C9.62493 23.0506 10.2996 25.2728 11.7881 26.7644C11.2448 28.8002 11.7718 31.0623 13.3688 32.6594C14.9658 34.2564 17.2278 34.7834 19.2638 34.2401C20.7553 35.7284 22.9778 36.4032 25.1593 35.8187C27.3411 35.2342 28.9283 33.5386 29.4757 31.5039C31.5105 30.9564 33.206 29.3691 33.7905 27.1874C34.3751 25.0058 33.7005 22.7834 32.2119 21.2919V21.2917ZM29.6507 16.3775C30.7329 17.4598 31.1792 18.937 30.9897 20.3453L25.9072 17.4108C25.6929 17.2871 25.4289 17.2871 25.2148 17.4108L19.2638 20.8466V18.5936C19.2638 18.4356 19.3485 18.2877 19.4854 18.2087L24.017 15.5924C25.8125 14.5895 28.1246 14.8514 29.6508 16.3775H29.6507ZM22 20.8685L24.7364 22.4483V25.608L22 27.1878L19.2636 25.608V22.4483L22 20.8685ZM15.7028 18.0636C15.732 16.0073 17.1149 14.1359 19.1997 13.5772C20.678 13.1811 22.1806 13.5333 23.3053 14.4014L18.2226 17.3357C18.0084 17.4594 17.8764 17.6881 17.8764 17.9353V24.8069L15.9253 23.6804C15.7885 23.6014 15.7028 23.454 15.7028 23.2959V18.0634V18.0636ZM11.549 21.2278C11.9451 19.7495 13.0014 18.6242 14.3156 18.0843V23.9532C14.3156 24.2004 14.4476 24.4291 14.6618 24.5528L20.6128 27.9886L18.6617 29.1151C18.5249 29.1941 18.3544 29.1946 18.2175 29.1156L13.6859 26.4993C11.9196 25.4459 10.9905 23.3124 11.549 21.2278ZM14.3494 31.6788C13.2671 30.5965 12.8208 29.1193 13.0103 27.7111L18.0928 30.6455C18.3071 30.7692 18.5711 30.7692 18.7852 30.6455L24.7362 27.2098V29.4626C24.7362 29.6207 24.6516 29.7682 24.5146 29.8477L19.983 32.4639C18.1875 33.4667 15.8754 33.2049 14.3492 31.6788H14.3494ZM28.2972 29.9927C28.268 32.049 26.8851 33.9205 24.8003 34.4791C23.322 34.8752 21.8194 34.523 20.6947 33.6549L25.7774 30.7205C25.9917 30.5969 26.1236 30.3682 26.1236 30.1209V23.2494L28.0747 24.3759C28.2115 24.4549 28.2972 24.6023 28.2972 24.7604V29.9929V29.9927ZM32.451 26.8285C32.0549 28.3068 30.9986 29.4321 29.6844 29.972V24.1031C29.6844 23.8559 29.5525 23.6272 29.3382 23.5035L23.3872 20.0678L25.3383 18.9412C25.4751 18.8622 25.6456 18.8617 25.7825 18.9407L30.314 21.5569C32.0804 22.6105 33.0095 24.7439 32.451 26.8285Z" fill="#FFFFFF"/></svg></svg>';
31
+ /** ChatGPT hexagon lockup from the brand asset: the hexagon and knot glyph both baked in. */
32
+ const CHATGPT_ICON_SVG = `<svg width="16" height="18" viewBox="0 0 16 18" fill="none" role="presentation" style="display:block"><path fill="#14120B" d="M14.5007 3.289L9.50384 0.402314C8.5736 -0.13509 7.42701 -0.134047 6.49774 0.405051L1.49458 3.30756C0.569434 3.84427 0 4.83294 0 5.9025V11.1804C0 12.2519 0.571497 13.2421 1.49931 13.7781L6.49931 16.6666C7.42787 17.203 8.57213 17.203 9.50069 16.6666L14.5007 13.7781C15.4285 13.2421 16 12.2519 16 11.1804V5.88668C16 4.81517 15.4285 3.82501 14.5007 3.289Z"/><path fill="white" d="M12.255 7.39338C12.4813 6.54514 12.2618 5.60258 11.5963 4.93713C10.9309 4.2717 9.9884 4.05217 9.1401 4.27852C8.51863 3.65837 7.59268 3.37721 6.68362 3.62082C5.77456 3.86436 5.11322 4.57087 4.88512 5.41867C4.03733 5.64676 3.33082 6.30819 3.08727 7.21717C2.84372 8.12623 3.12482 9.05218 3.74503 9.67365C3.51868 10.5219 3.73823 11.4645 4.40366 12.1299C5.06909 12.7953 6.01159 13.0149 6.85992 12.7885C7.48137 13.4087 8.4074 13.6898 9.31638 13.4463C10.2254 13.2027 10.8868 12.4962 11.1149 11.6485C11.9627 11.4203 12.6692 10.7589 12.9127 9.84993C13.1563 8.94089 12.8752 8.01491 12.255 7.39347V7.39338ZM11.1878 5.34578C11.6387 5.79673 11.8247 6.41226 11.7457 6.99902L9.62799 5.77632C9.53872 5.72478 9.42871 5.72478 9.3395 5.77632L6.85992 7.20789V6.26917C6.85992 6.20333 6.89519 6.1417 6.95226 6.10877L8.84042 5.01867C9.58854 4.60079 10.5519 4.7099 11.1878 5.34578H11.1878ZM8.00001 7.21703L9.14016 7.87529V9.19183L8.00001 9.85009L6.85984 9.19183V7.87529L8.00001 7.21703ZM5.37616 6.04832C5.38831 5.19153 5.96453 4.41177 6.83319 4.17899C7.44917 4.01397 8.07524 4.16069 8.54389 4.52241L6.42609 5.74505C6.33682 5.79656 6.28184 5.89186 6.28184 5.99489V8.85803L5.4689 8.38867C5.41189 8.35573 5.37616 8.29433 5.37616 8.22846V6.04826V6.04832ZM3.64542 7.36674C3.81044 6.75079 4.25056 6.28191 4.79817 6.05694V8.50232C4.79817 8.60534 4.85315 8.70061 4.94241 8.75216L7.42202 10.1837L6.60904 10.6531C6.55203 10.686 6.48098 10.6862 6.42397 10.6533L4.53581 9.56321C3.79984 9.12427 3.41272 8.23534 3.64542 7.36674ZM4.81224 11.7213C4.36129 11.2704 4.17534 10.6549 4.25429 10.0681L6.37201 11.2908C6.4613 11.3423 6.57129 11.3423 6.6605 11.2908L9.1401 9.85923V10.7979C9.1401 10.8638 9.10483 10.9254 9.04774 10.9584L7.15958 12.0485C6.41145 12.4663 5.44809 12.3572 4.81215 11.7213H4.81224ZM10.6238 11.0188C10.6117 11.8756 10.0355 12.6554 9.1668 12.8881C8.55083 13.0532 7.92476 12.9064 7.45613 12.5447L9.57391 11.322C9.6632 11.2705 9.71816 11.1753 9.71816 11.0722V8.20906L10.5311 8.67845C10.5881 8.71139 10.6238 8.77279 10.6238 8.83866V11.0189V11.0188ZM12.3546 9.70035C12.1896 10.3163 11.7494 10.7852 11.2018 11.0101V8.5648C11.2018 8.46178 11.1469 8.36648 11.0576 8.31496L8.57798 6.88339L9.39095 6.41401C9.44796 6.38107 9.51902 6.38085 9.57603 6.41378L11.4642 7.50388C12.2002 7.94285 12.5873 8.83178 12.3546 9.70035Z"/></svg>`;
33
33
  const markup = {
34
34
  aiAgent: AI_AGENT_ICON_SVG,
35
35
  aiBot: AI_BOT_ICON_SVG,
@@ -77,6 +77,10 @@ var extractChangedRows = function extractChangedRows(_ref) {
77
77
  // Check if this row overlaps with the deletion range
78
78
  var rowOverlapsChange = rowStart >= changeStartInTable && rowStart < changeEndInTable || rowEnd > changeStartInTable && rowEnd <= changeEndInTable || rowStart < changeStartInTable && rowEnd > changeEndInTable;
79
79
  if (rowOverlapsChange && rowNode.type.name === 'tableRow' && (isExtendedEnabled(diffType) || !isEmptyRow(rowNode))) {
80
+ var rowLocalId = rowNode.attrs.localId;
81
+ var isTableRowReplacement = rowLocalId && tableNew.node.children.some(function (candidateRow) {
82
+ return candidateRow.type.name === 'tableRow' && candidateRow.attrs.localId === rowLocalId;
83
+ });
80
84
  var cellEdgeAttrs = edgeAttrsByOffset ? getRowCellEdgeAttrs({
81
85
  edgeAttrsByOffset: edgeAttrsByOffset,
82
86
  rowNode: rowNode,
@@ -88,6 +92,7 @@ var extractChangedRows = function extractChangedRows(_ref) {
88
92
  changedRows.push({
89
93
  rowIndex: rowIndex,
90
94
  rowNode: rowNode,
95
+ isTableRowReplacement: isTableRowReplacement,
91
96
  cellEdgeAttrs: cellEdgeAttrs,
92
97
  fromA: tableOld.pos + 1 + rowStart,
93
98
  toA: tableOld.pos + 1 + rowEnd,
@@ -169,6 +174,7 @@ var createChangedRowDOM = function createChangedRowDOM(_ref3) {
169
174
  var rowNode = _ref3.rowNode,
170
175
  cellEdgeAttrs = _ref3.cellEdgeAttrs,
171
176
  nodeViewSerializer = _ref3.nodeViewSerializer,
177
+ isTableRowReplacement = _ref3.isTableRowReplacement,
172
178
  colorScheme = _ref3.colorScheme,
173
179
  isInserted = _ref3.isInserted,
174
180
  diffType = _ref3.diffType,
@@ -176,6 +182,9 @@ var createChangedRowDOM = function createChangedRowDOM(_ref3) {
176
182
  intl = _ref3.intl,
177
183
  isActive = _ref3.isActive;
178
184
  var tr = document.createElement('tr');
185
+ if (isTableRowReplacement && fg('platform_editor_ai_show_diff_patch_2')) {
186
+ tr.dataset.showDiffTableRowReplacement = 'true';
187
+ }
179
188
  var colors = colorSchemeRegistry[colorScheme !== null && colorScheme !== void 0 ? colorScheme : 'standard'];
180
189
  var deletedTreatment = isExperimentEnabled('platform_editor_show_diff_color_scheme_refactor') ? buildDeletedRowStyle(colors) : resolveDeletedRowStyleLegacy(getLegacyColorScheme(colorScheme));
181
190
  var hostsRemovedLozenge = Boolean(intl) && isExtendedEnabled(diffType) && !isInserted && !hasAnchoredRemovedLozenge;
@@ -328,6 +337,7 @@ export var createChangedRowDecorationWidgets = function createChangedRowDecorati
328
337
  var hasAnchoredRemovedLozenge = Boolean(intl) && isExtendedEnabled(diffType) && !isInserted && supportsAnchorPositioning();
329
338
  var rowDOM = createChangedRowDOM({
330
339
  rowNode: changedRow.rowNode,
340
+ isTableRowReplacement: changedRow.isTableRowReplacement,
331
341
  cellEdgeAttrs: changedRow.cellEdgeAttrs,
332
342
  nodeViewSerializer: nodeViewSerializer,
333
343
  colorScheme: colorScheme,
@@ -4,6 +4,7 @@ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r)
4
4
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
+ import { getThirdPartyAgentColor } from '@atlaskit/agent-color/get-third-party-agent-color';
7
8
  import { getAttributionKey } from './decorations/colorSchemes/attributions';
8
9
 
9
10
  /** A brand name, so a literal rather than a translated message. */
@@ -11,48 +12,24 @@ var ROVO_AGENT_NAME = 'Rovo';
11
12
 
12
13
  /** `agentType` values that render as "Rovo" rather than as a generic external agent. */
13
14
  var ROVO_AGENT_TYPES = new Set(['convo-ai', 'rovo_chat']);
14
- /** Known external agent types emitted by Confluence's agent identification service. */
15
- var EXTERNAL_AGENT_PRESENTATIONS = {
16
- claude: {
17
- agentKind: 'claude',
18
- name: 'Claude'
19
- },
20
- codex: {
21
- agentKind: 'external',
22
- name: 'Codex'
23
- },
24
- vscode: {
25
- agentKind: 'external',
26
- name: 'VS Code'
27
- },
28
- hermes: {
29
- agentKind: 'external',
30
- name: 'Hermes'
31
- },
32
- runlayer: {
33
- agentKind: 'external',
34
- name: 'Runlayer'
35
- },
36
- zed: {
37
- agentKind: 'external',
38
- name: 'Zed'
39
- },
40
- ampcode: {
41
- agentKind: 'external',
42
- name: 'Ampcode'
43
- },
44
- antigravity: {
45
- agentKind: 'external',
46
- name: 'Antigravity'
47
- },
48
- devin_cli: {
49
- agentKind: 'external',
50
- name: 'Devin CLI'
51
- },
52
- pi_agent: {
53
- agentKind: 'external',
54
- name: 'Pi Agent'
55
- }
15
+ /** `@atlaskit/agent-color` brands show-diff renders with a dedicated presentation. */
16
+ var SHOW_DIFF_AGENT_BRANDS = {
17
+ 'agent-brand-claude': 'claude',
18
+ 'agent-brand-chatgpt': 'chatgpt',
19
+ 'agent-brand-rovo': 'rovo'
20
+ };
21
+
22
+ /** Known external agent types emitted by Confluence's agent identification service that carry
23
+ * no `@atlaskit/agent-color` brand — a generic labelled fallback. */
24
+ var EXTERNAL_AGENT_NAMES = {
25
+ vscode: 'VS Code',
26
+ hermes: 'Hermes',
27
+ runlayer: 'Runlayer',
28
+ zed: 'Zed',
29
+ ampcode: 'Ampcode',
30
+ antigravity: 'Antigravity',
31
+ devin_cli: 'Devin CLI',
32
+ pi_agent: 'Pi Agent'
56
33
  };
57
34
  var hasAgentIdentity = function hasAgentIdentity(attribution) {
58
35
  var _attribution$agentId, _attribution$agentTyp;
@@ -82,11 +59,16 @@ var resolveUser = function resolveUser(userId, profilesByAccountId) {
82
59
  var resolveAgent = function resolveAgent(attribution, profilesByAccountId) {
83
60
  var _attribution$agentTyp2, _attribution$agentId2;
84
61
  var agentType = (_attribution$agentTyp2 = attribution.agentType) === null || _attribution$agentTyp2 === void 0 ? void 0 : _attribution$agentTyp2.trim().toLowerCase();
85
- var agentPresentation = agentType ? EXTERNAL_AGENT_PRESENTATIONS[agentType] : undefined;
86
- if (agentPresentation && agentPresentation.agentKind !== 'external') {
87
- return _objectSpread(_objectSpread({}, agentPresentation), {}, {
88
- kind: 'agent'
89
- });
62
+ var brand = agentType ? getThirdPartyAgentColor({
63
+ agentName: agentType
64
+ }) : undefined;
65
+ var diffBrand = brand ? SHOW_DIFF_AGENT_BRANDS[brand.scheme] : undefined;
66
+ if (diffBrand && brand) {
67
+ return {
68
+ agentKind: diffBrand,
69
+ kind: 'agent',
70
+ name: brand.name
71
+ };
90
72
  }
91
73
  var agentId = (_attribution$agentId2 = attribution.agentId) === null || _attribution$agentId2 === void 0 ? void 0 : _attribution$agentId2.trim();
92
74
  var agentProfile = agentId ? profilesByAccountId.get(agentId) : undefined;
@@ -101,16 +83,18 @@ var resolveAgent = function resolveAgent(attribution, profilesByAccountId) {
101
83
  }
102
84
 
103
85
  // Unknown types keep an empty name for the tag's localised "External agent" label.
104
- return agentType && ROVO_AGENT_TYPES.has(agentType) ? {
105
- agentKind: 'rovo',
106
- kind: 'agent',
107
- name: ROVO_AGENT_NAME
108
- } : agentPresentation ? _objectSpread(_objectSpread({}, agentPresentation), {}, {
109
- kind: 'agent'
110
- }) : {
86
+ if (agentType && ROVO_AGENT_TYPES.has(agentType)) {
87
+ return {
88
+ agentKind: 'rovo',
89
+ kind: 'agent',
90
+ name: ROVO_AGENT_NAME
91
+ };
92
+ }
93
+ var externalName = agentType ? EXTERNAL_AGENT_NAMES[agentType] : undefined;
94
+ return {
111
95
  agentKind: 'external',
112
96
  kind: 'agent',
113
- name: ''
97
+ name: externalName !== null && externalName !== void 0 ? externalName : ''
114
98
  };
115
99
  };
116
100
 
@@ -21,9 +21,19 @@
21
21
 
22
22
  export var DIFF_AGENT_BRANDS = new Set(['rovo', 'claude', 'chatgpt']);
23
23
 
24
+ /** The brand id `@atlaskit/agent-color` registers each `AgentBrandColorScheme` under. */
25
+
26
+ /**
27
+ * Compile-time-only: fails to build if `DiffAgentBrand` names a brand `@atlaskit/agent-color`
28
+ * hasn't registered a colour scheme for. Catches "added a brand here but forgot the colour"
29
+ * without needing a runtime check. Exported only so the unused check on this module-scope
30
+ * assertion doesn't fire; no consumer needs its value.
31
+ */
32
+ export var ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED = true;
33
+
24
34
  /** A complete identity for one of the accounts named by a step attribution. */
25
35
 
26
- /** Agent presentation: branded, identified by profile, or a generic external agent. */
36
+ /** Agent presentation: branded (dedicated icon and reserved participant colour), identified by profile, or a generic external agent. */
27
37
 
28
38
  /**
29
39
  * A contributor the plugin has resolved from a step attribution and a supplied profile. Internal:
@@ -4,7 +4,13 @@ import { BORDER_WIDTH } from '@atlaskit/avatar/constants/default';
4
4
  import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
5
5
  import { getContributorTagIcon } from './contributorTagIcons';
6
6
 
7
- /** Agent kinds with a custom contributor-tag icon. */
7
+ /**
8
+ * Agent kinds with a custom contributor-tag icon. The `satisfies` clause fails the build if a
9
+ * `DiffAgentBrand` is missing an icon here; `ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED` in
10
+ * `showDiffPluginType.ts` similarly fails the build if a brand has no `@atlaskit/agent-color`
11
+ * colour scheme. The declared type stays the wider `TagContributor['agentKind']` so indexing below
12
+ * (with `'identified' | 'external'` in play too) stays safely partial.
13
+ */
8
14
  var AGENT_KIND_ICONS = {
9
15
  claude: 'claude',
10
16
  chatgpt: 'chatgpt',
@@ -29,12 +35,13 @@ var boxStyle = convertToInlineCss({
29
35
  height: "".concat(AVATAR_BOX_SIZE, "px")
30
36
  });
31
37
  var shapeStyle = convertToInlineCss({
32
- display: 'inline-flex',
38
+ display: 'flex',
33
39
  alignItems: 'center',
34
40
  justifyContent: 'center',
35
41
  boxSizing: 'border-box',
36
42
  width: "".concat(AVATAR_SIZE, "px"),
37
43
  height: "".concat(AVATAR_SIZE, "px"),
44
+ aspectRatio: '1/1',
38
45
  overflow: 'hidden'
39
46
  });
40
47
  var imageStyle = convertToInlineCss({
@@ -2,7 +2,10 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
3
  import _createClass from "@babel/runtime/helpers/createClass";
4
4
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
7
  import { bind, bindAll } from 'bind-event-listener';
8
+ import { getThirdPartyAgentColor } from '@atlaskit/agent-color/get-third-party-agent-color';
6
9
  import { VanillaTooltip } from '@atlaskit/editor-common/vanilla-tooltip';
7
10
  import { DELETED_HIGHLIGHT_BG_VAR, DELETED_HIGHLIGHT_BORDER_VAR, getAccentTokens, getDeletedHighlightHoverBorderColor, getDeletedHighlightHoverColor } from '../../pm-plugins/decorations/colorSchemes/factory';
8
11
  import { colorSchemeRegistry } from '../../pm-plugins/decorations/colorSchemes/schemes';
@@ -22,6 +25,19 @@ var getTagAccent = function getTagAccent(_ref) {
22
25
  return getAccentTokens(accent);
23
26
  };
24
27
 
28
+ /** ChatGPT's own brand colour, resolved from the shared `@atlaskit/agent-color` registry. */
29
+ var chatgptBrandColor = getThirdPartyAgentColor({
30
+ agentName: 'chatgpt'
31
+ });
32
+
33
+ /** Brand accents for agent kinds with no ADS token match. New agents opt in by adding an entry. */
34
+ var AGENT_KIND_ACCENT_OVERRIDES = _objectSpread({}, chatgptBrandColor ? {
35
+ chatgpt: {
36
+ background: chatgptBrandColor.bold,
37
+ text: chatgptBrandColor.boldText
38
+ }
39
+ } : {});
40
+
25
41
  /**
26
42
  * Keyboard focus, as a member of `revealSources` alongside the elements the pointer can be over. It
27
43
  * has no element of its own to key on — the tag is already in the set under its own hover.
@@ -367,12 +383,15 @@ export var ContributorTagController = /*#__PURE__*/function () {
367
383
  }, {
368
384
  key: "accentOf",
369
385
  value: function accentOf(model) {
370
- var _model$isInserted;
371
- return getTagAccent({
386
+ var _model$isInserted, _model$contributor$ag, _model$connectedContr;
387
+ var accent = getTagAccent({
372
388
  colorScheme: model.colorScheme,
373
389
  isActive: Boolean(model.isActive),
374
390
  isInserted: (_model$isInserted = model.isInserted) !== null && _model$isInserted !== void 0 ? _model$isInserted : true
375
391
  });
392
+ var agentKind = (_model$contributor$ag = model.contributor.agentKind) !== null && _model$contributor$ag !== void 0 ? _model$contributor$ag : (_model$connectedContr = model.connectedContributor) === null || _model$connectedContr === void 0 ? void 0 : _model$connectedContr.agentKind;
393
+ var override = agentKind && AGENT_KIND_ACCENT_OVERRIDES[agentKind];
394
+ return override ? _objectSpread(_objectSpread({}, accent), override) : accent;
376
395
  }
377
396
  }, {
378
397
  key: "applyAccent",
@@ -28,8 +28,8 @@ var ROVO_HEX_ICON_SVG = "<svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" r
28
28
  /** ClaudeLogo from ai-mate/studio-browse-kit, inset to fit the agent hexagon. */
29
29
  var CLAUDE_ICON_SVG = "<svg width=\"12\" height=\"12\" viewBox=\"8 8 32 32\" role=\"presentation\" style=\"display:block\"><path fill=\"#FFFFFF\" d=\"M14.2785 29.274L20.5732 25.7445L20.6785 25.4369L20.5732 25.2669H20.2653L19.2122 25.2021L15.6152 25.105L12.4962 24.9755L9.47443 24.8136L8.71291 24.6517L8 23.7126L8.07291 23.2431L8.71291 22.8141L9.62835 22.895L11.6537 23.0326L14.6916 23.2431L16.8952 23.3726L20.16 23.7126H20.6785L20.7514 23.5022L20.5732 23.3726L20.4354 23.2431L17.2922 21.1141L13.8896 18.8636L12.1073 17.5684L11.1433 16.9127L10.6572 16.2975L10.4466 14.9537L11.3215 13.9904L12.4962 14.0713L12.7959 14.1523L13.9868 15.067L16.5306 17.0342L19.8522 19.4789L20.3382 19.8836L20.5327 19.746L20.557 19.6489L20.3382 19.2846L18.5316 16.0223L16.6035 12.7033L15.7448 11.3271L15.518 10.5014C15.437 10.1614 15.3803 9.87807 15.3803 9.52998L16.3767 8.17809L16.9276 8L18.2562 8.17809L18.8152 8.6638L19.6415 10.55L20.9782 13.5209L23.0522 17.5603L23.6597 18.7584L23.9838 19.8674L24.1053 20.2074H24.3159V20.0132L24.4861 17.7384L24.802 14.9456L25.1099 11.3514L25.2152 10.3395L25.7175 9.12522L26.7139 8.46952L27.4916 8.84189L28.1316 9.75664L28.0425 10.3476L27.6618 12.8166L26.9165 16.6861L26.4304 19.2765H26.7139L27.038 18.9527L28.3504 17.2122L30.5539 14.4599L31.5261 13.3671L32.6603 12.1609L33.3894 11.5861H34.7666L35.7792 13.0918L35.3256 14.6461L33.9079 16.4432L32.7332 17.9651L31.0481 20.2317L29.9949 22.045L30.0922 22.1907L30.3433 22.1665L34.1509 21.3569L36.2086 20.9846L38.6633 20.5636L39.7732 21.0817L39.8947 21.6079L39.4572 22.6845L36.8324 23.3322L33.7539 23.9474L29.1686 25.0321L29.1119 25.0726L29.1767 25.1536L31.2425 25.3478L32.1256 25.3964H34.2886L38.3149 25.6959L39.3681 26.3921L40 27.2421L39.8947 27.8897L38.2744 28.7154L36.0871 28.1973L30.9833 26.9831L29.2334 26.5459H28.9904V26.6916L30.4486 28.1164L33.122 30.5287L36.4678 33.6372L36.638 34.4063L36.2086 35.0134L35.7549 34.9486L32.8142 32.7387L31.68 31.743L29.1119 29.5816H28.9418V29.8082L29.5332 30.6744L32.6603 35.3696L32.8223 36.8105L32.5954 37.28L31.7853 37.5634L30.8942 37.4015L29.0633 34.8353L27.1757 31.9454L25.6527 29.3549L25.4663 29.4602L24.5671 39.1338L24.1458 39.6276L23.1737 40L22.3635 39.3848L21.9342 38.3891L22.3635 36.422L22.882 33.8558L23.3033 31.8158L23.6841 29.2821L23.9109 28.4402L23.8947 28.3835L23.7084 28.4078L21.7965 31.0306L18.8881 34.9567L16.5873 37.4177L16.0365 37.6362L15.0805 37.1424L15.1696 36.2601L15.7043 35.4748L18.8881 31.4273L20.8081 28.9178L22.0476 27.4688L22.0395 27.2583H21.9666L13.5089 32.7468L12.002 32.9411L11.3539 32.3339L11.4349 31.3382L11.7428 31.0144L14.2866 29.2659L14.2785 29.274Z\"/></svg>";
30
30
 
31
- /** ChatGPT Presence avatar from Confluence's `ChatGptPresenceIcon`, at 16px. */
32
- var CHATGPT_ICON_SVG = '<svg width="16" height="16" viewBox="1 1.5328 16 16" overflow="visible" fill="none" role="presentation" style="display:block"><path d="M7.24707 0.973022C8.33116 0.344106 9.66865 0.342238 10.7539 0.969116L15.751 3.85583C16.8334 4.48117 17.5 5.63699 17.5 6.88708V12.1801C17.5 13.4301 16.8334 14.586 15.751 15.2113L10.751 18.1C9.66769 18.7258 8.33231 18.7258 7.24902 18.1L2.24902 15.2113C1.16658 14.586 0.5 13.4301 0.5 12.1801V6.90271C0.5 5.65489 1.1648 4.50153 2.24414 3.87537L7.24707 0.973022Z" fill="#14120B" stroke="#FFFFFF" stroke-width="1"/><svg x="4" y="4.53355" width="10" height="10" viewBox="10 12.0281 24 24" overflow="visible"><path d="M32.2119 21.2917C32.7552 19.256 32.2283 16.9938 30.6312 15.3967C29.0342 13.7997 26.7722 13.2728 24.7362 13.8161C23.2447 12.3277 21.0224 11.6529 18.8407 12.2376C16.6589 12.8221 15.0717 14.5177 14.5243 16.5524C12.4896 17.0999 10.794 18.6873 10.2094 20.8688C9.62493 23.0506 10.2996 25.2728 11.7881 26.7644C11.2448 28.8002 11.7718 31.0623 13.3688 32.6594C14.9658 34.2564 17.2278 34.7834 19.2638 34.2401C20.7553 35.7284 22.9778 36.4032 25.1593 35.8187C27.3411 35.2342 28.9283 33.5386 29.4757 31.5039C31.5105 30.9564 33.206 29.3691 33.7905 27.1874C34.3751 25.0058 33.7005 22.7834 32.2119 21.2919V21.2917ZM29.6507 16.3775C30.7329 17.4598 31.1792 18.937 30.9897 20.3453L25.9072 17.4108C25.6929 17.2871 25.4289 17.2871 25.2148 17.4108L19.2638 20.8466V18.5936C19.2638 18.4356 19.3485 18.2877 19.4854 18.2087L24.017 15.5924C25.8125 14.5895 28.1246 14.8514 29.6508 16.3775H29.6507ZM22 20.8685L24.7364 22.4483V25.608L22 27.1878L19.2636 25.608V22.4483L22 20.8685ZM15.7028 18.0636C15.732 16.0073 17.1149 14.1359 19.1997 13.5772C20.678 13.1811 22.1806 13.5333 23.3053 14.4014L18.2226 17.3357C18.0084 17.4594 17.8764 17.6881 17.8764 17.9353V24.8069L15.9253 23.6804C15.7885 23.6014 15.7028 23.454 15.7028 23.2959V18.0634V18.0636ZM11.549 21.2278C11.9451 19.7495 13.0014 18.6242 14.3156 18.0843V23.9532C14.3156 24.2004 14.4476 24.4291 14.6618 24.5528L20.6128 27.9886L18.6617 29.1151C18.5249 29.1941 18.3544 29.1946 18.2175 29.1156L13.6859 26.4993C11.9196 25.4459 10.9905 23.3124 11.549 21.2278ZM14.3494 31.6788C13.2671 30.5965 12.8208 29.1193 13.0103 27.7111L18.0928 30.6455C18.3071 30.7692 18.5711 30.7692 18.7852 30.6455L24.7362 27.2098V29.4626C24.7362 29.6207 24.6516 29.7682 24.5146 29.8477L19.983 32.4639C18.1875 33.4667 15.8754 33.2049 14.3492 31.6788H14.3494ZM28.2972 29.9927C28.268 32.049 26.8851 33.9205 24.8003 34.4791C23.322 34.8752 21.8194 34.523 20.6947 33.6549L25.7774 30.7205C25.9917 30.5969 26.1236 30.3682 26.1236 30.1209V23.2494L28.0747 24.3759C28.2115 24.4549 28.2972 24.6023 28.2972 24.7604V29.9929V29.9927ZM32.451 26.8285C32.0549 28.3068 30.9986 29.4321 29.6844 29.972V24.1031C29.6844 23.8559 29.5525 23.6272 29.3382 23.5035L23.3872 20.0678L25.3383 18.9412C25.4751 18.8622 25.6456 18.8617 25.7825 18.9407L30.314 21.5569C32.0804 22.6105 33.0095 24.7439 32.451 26.8285Z" fill="#FFFFFF"/></svg></svg>';
31
+ /** ChatGPT hexagon lockup from the brand asset: the hexagon and knot glyph both baked in. */
32
+ var CHATGPT_ICON_SVG = "<svg width=\"16\" height=\"18\" viewBox=\"0 0 16 18\" fill=\"none\" role=\"presentation\" style=\"display:block\"><path fill=\"#14120B\" d=\"M14.5007 3.289L9.50384 0.402314C8.5736 -0.13509 7.42701 -0.134047 6.49774 0.405051L1.49458 3.30756C0.569434 3.84427 0 4.83294 0 5.9025V11.1804C0 12.2519 0.571497 13.2421 1.49931 13.7781L6.49931 16.6666C7.42787 17.203 8.57213 17.203 9.50069 16.6666L14.5007 13.7781C15.4285 13.2421 16 12.2519 16 11.1804V5.88668C16 4.81517 15.4285 3.82501 14.5007 3.289Z\"/><path fill=\"white\" d=\"M12.255 7.39338C12.4813 6.54514 12.2618 5.60258 11.5963 4.93713C10.9309 4.2717 9.9884 4.05217 9.1401 4.27852C8.51863 3.65837 7.59268 3.37721 6.68362 3.62082C5.77456 3.86436 5.11322 4.57087 4.88512 5.41867C4.03733 5.64676 3.33082 6.30819 3.08727 7.21717C2.84372 8.12623 3.12482 9.05218 3.74503 9.67365C3.51868 10.5219 3.73823 11.4645 4.40366 12.1299C5.06909 12.7953 6.01159 13.0149 6.85992 12.7885C7.48137 13.4087 8.4074 13.6898 9.31638 13.4463C10.2254 13.2027 10.8868 12.4962 11.1149 11.6485C11.9627 11.4203 12.6692 10.7589 12.9127 9.84993C13.1563 8.94089 12.8752 8.01491 12.255 7.39347V7.39338ZM11.1878 5.34578C11.6387 5.79673 11.8247 6.41226 11.7457 6.99902L9.62799 5.77632C9.53872 5.72478 9.42871 5.72478 9.3395 5.77632L6.85992 7.20789V6.26917C6.85992 6.20333 6.89519 6.1417 6.95226 6.10877L8.84042 5.01867C9.58854 4.60079 10.5519 4.7099 11.1878 5.34578H11.1878ZM8.00001 7.21703L9.14016 7.87529V9.19183L8.00001 9.85009L6.85984 9.19183V7.87529L8.00001 7.21703ZM5.37616 6.04832C5.38831 5.19153 5.96453 4.41177 6.83319 4.17899C7.44917 4.01397 8.07524 4.16069 8.54389 4.52241L6.42609 5.74505C6.33682 5.79656 6.28184 5.89186 6.28184 5.99489V8.85803L5.4689 8.38867C5.41189 8.35573 5.37616 8.29433 5.37616 8.22846V6.04826V6.04832ZM3.64542 7.36674C3.81044 6.75079 4.25056 6.28191 4.79817 6.05694V8.50232C4.79817 8.60534 4.85315 8.70061 4.94241 8.75216L7.42202 10.1837L6.60904 10.6531C6.55203 10.686 6.48098 10.6862 6.42397 10.6533L4.53581 9.56321C3.79984 9.12427 3.41272 8.23534 3.64542 7.36674ZM4.81224 11.7213C4.36129 11.2704 4.17534 10.6549 4.25429 10.0681L6.37201 11.2908C6.4613 11.3423 6.57129 11.3423 6.6605 11.2908L9.1401 9.85923V10.7979C9.1401 10.8638 9.10483 10.9254 9.04774 10.9584L7.15958 12.0485C6.41145 12.4663 5.44809 12.3572 4.81215 11.7213H4.81224ZM10.6238 11.0188C10.6117 11.8756 10.0355 12.6554 9.1668 12.8881C8.55083 13.0532 7.92476 12.9064 7.45613 12.5447L9.57391 11.322C9.6632 11.2705 9.71816 11.1753 9.71816 11.0722V8.20906L10.5311 8.67845C10.5881 8.71139 10.6238 8.77279 10.6238 8.83866V11.0189V11.0188ZM12.3546 9.70035C12.1896 10.3163 11.7494 10.7852 11.2018 11.0101V8.5648C11.2018 8.46178 11.1469 8.36648 11.0576 8.31496L8.57798 6.88339L9.39095 6.41401C9.44796 6.38107 9.51902 6.38085 9.57603 6.41378L11.4642 7.50388C12.2002 7.94285 12.5873 8.83178 12.3546 9.70035Z\"/></svg>";
33
33
  var markup = {
34
34
  aiAgent: AI_AGENT_ICON_SVG,
35
35
  aiBot: AI_BOT_ICON_SVG,
@@ -1,3 +1,4 @@
1
+ import type { AgentBrandColorScheme } from '@atlaskit/agent-color/agent-presence-color-types';
1
2
  import type { StepJson } from '@atlaskit/editor-common/collab';
2
3
  import type { NextEditorPlugin, EditorCommand, OptionalPlugin } from '@atlaskit/editor-common/types';
3
4
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer/types';
@@ -40,6 +41,15 @@ export type StepWithAttribution<TStep> = {
40
41
  /** Branded agent presentations supported by contributor tags. */
41
42
  export type DiffAgentBrand = 'rovo' | 'claude' | 'chatgpt';
42
43
  export declare const DIFF_AGENT_BRANDS: ReadonlySet<DiffAgentBrand>;
44
+ /** The brand id `@atlaskit/agent-color` registers each `AgentBrandColorScheme` under. */
45
+ type AgentColorBrandId = AgentBrandColorScheme extends `agent-brand-${infer BrandId}` ? BrandId : never;
46
+ /**
47
+ * Compile-time-only: fails to build if `DiffAgentBrand` names a brand `@atlaskit/agent-color`
48
+ * hasn't registered a colour scheme for. Catches "added a brand here but forgot the colour"
49
+ * without needing a runtime check. Exported only so the unused check on this module-scope
50
+ * assertion doesn't fire; no consumer needs its value.
51
+ */
52
+ export declare const ASSERT_DIFF_AGENT_BRANDS_ARE_REGISTERED: DiffAgentBrand extends AgentColorBrandId ? true : ['DiffAgentBrand is missing from @atlaskit/agent-color', DiffAgentBrand];
43
53
  /** A complete identity for one of the accounts named by a step attribution. */
44
54
  export type DiffContributorProfile = {
45
55
  /** Matched against the `userId` and `agentId` on step attributions. */
@@ -50,7 +60,7 @@ export type DiffContributorProfile = {
50
60
  name: string;
51
61
  };
52
62
  type DiffContributorKind = 'user' | 'agent';
53
- /** Agent presentation: branded, identified by profile, or a generic external agent. */
63
+ /** Agent presentation: branded (dedicated icon and reserved participant colour), identified by profile, or a generic external agent. */
54
64
  type DiffAgentKind = DiffAgentBrand | 'identified' | 'external';
55
65
  /**
56
66
  * A contributor the plugin has resolved from a step attribution and a supplied profile. Internal:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-show-diff",
3
- "version": "17.1.8",
3
+ "version": "17.1.9",
4
4
  "description": "ShowDiff plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -26,7 +26,7 @@
26
26
  "atlaskit:src": "src/index.ts",
27
27
  "dependencies": {
28
28
  "@atlaskit/adf-schema": "^57.6.0",
29
- "@atlaskit/agent-color": "^0.2.0",
29
+ "@atlaskit/agent-color": "^1.0.0",
30
30
  "@atlaskit/avatar": "^28.0.0",
31
31
  "@atlaskit/custom-steps": "^1.1.0",
32
32
  "@atlaskit/editor-plugin-accessibility-utils": "^19.0.0",
@@ -39,7 +39,7 @@
39
39
  "@atlaskit/platform-feature-experiments": "^0.3.0",
40
40
  "@atlaskit/platform-feature-flags": "^2.2.0",
41
41
  "@atlaskit/primitives": "^22.5.0",
42
- "@atlaskit/tmp-editor-statsig": "^202.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^203.0.0",
43
43
  "@atlaskit/tokens": "^19.0.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@compiled/react": "^1.0.2",
@@ -64,14 +64,14 @@
64
64
  "@atlassian/confluence-presets": "workspace:^",
65
65
  "@atlassian/content-reconciliation": "^0.1.3506",
66
66
  "@atlassian/editor-ai-injected-editors": "^33.0.0",
67
- "@atlassian/editor-plugin-ai": "^73.6.0",
67
+ "@atlassian/editor-plugin-ai": "^73.7.0",
68
68
  "@atlassian/structured-docs-types": "workspace:^",
69
69
  "react": "^19.2.0",
70
70
  "react-dom": "^19.2.0",
71
71
  "react-intl": "^7.0.0"
72
72
  },
73
73
  "peerDependencies": {
74
- "@atlaskit/editor-common": "^123.7.0",
74
+ "@atlaskit/editor-common": "^123.8.0",
75
75
  "react": "^18.2.0 || ^19.2.0",
76
76
  "react-dom": "^18.2.0 || ^19.2.0",
77
77
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"