@upmade/core 0.6.2 → 0.7.0-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/LICENSE.md +21 -21
  2. package/README.md +13 -13
  3. package/dist/cjs/index.cjs +1166 -224
  4. package/dist/cjs/index.cjs.map +4 -4
  5. package/dist/esm/index.mjs +1166 -224
  6. package/dist/esm/index.mjs.map +4 -4
  7. package/dist/types/classes/agent/agent-tool-schemas.d.ts.map +1 -1
  8. package/dist/types/classes/agent/agent.class.d.ts +28 -5
  9. package/dist/types/classes/agent/agent.class.d.ts.map +1 -1
  10. package/dist/types/classes/chat/chat-session.class.d.ts +22 -3
  11. package/dist/types/classes/chat/chat-session.class.d.ts.map +1 -1
  12. package/dist/types/classes/core/core.class.d.ts +8 -0
  13. package/dist/types/classes/core/core.class.d.ts.map +1 -1
  14. package/dist/types/classes/core/viewport.class.d.ts.map +1 -1
  15. package/dist/types/classes/managers/agent-broadcast.manager.d.ts +1 -1
  16. package/dist/types/classes/managers/agent-broadcast.manager.d.ts.map +1 -1
  17. package/dist/types/classes/managers/agent.manager.d.ts +99 -6
  18. package/dist/types/classes/managers/agent.manager.d.ts.map +1 -1
  19. package/dist/types/classes/managers/agentic-action-run.class.d.ts +20 -1
  20. package/dist/types/classes/managers/agentic-action-run.class.d.ts.map +1 -1
  21. package/dist/types/classes/managers/agentic-action.manager.d.ts +10 -0
  22. package/dist/types/classes/managers/agentic-action.manager.d.ts.map +1 -1
  23. package/dist/types/classes/managers/agentic-cursor.manager.d.ts +11 -1
  24. package/dist/types/classes/managers/agentic-cursor.manager.d.ts.map +1 -1
  25. package/dist/types/classes/managers/object-config.manager.d.ts +4 -3
  26. package/dist/types/classes/managers/object-config.manager.d.ts.map +1 -1
  27. package/dist/types/classes/managers/object-titlebar.manager.d.ts +23 -1
  28. package/dist/types/classes/managers/object-titlebar.manager.d.ts.map +1 -1
  29. package/dist/types/classes/managers/remote-agent.manager.d.ts +2 -2
  30. package/dist/types/classes/managers/remote-agent.manager.d.ts.map +1 -1
  31. package/dist/types/classes/registries/icon-registry.class.d.ts +3 -0
  32. package/dist/types/classes/registries/icon-registry.class.d.ts.map +1 -1
  33. package/dist/types/classes/structures/object-map.structure.d.ts +17 -1
  34. package/dist/types/classes/structures/object-map.structure.d.ts.map +1 -1
  35. package/dist/types/constants/version.d.ts +1 -1
  36. package/dist/types/constants/version.d.ts.map +1 -1
  37. package/dist/types/helpers/cursor-label-action.helper.d.ts +15 -0
  38. package/dist/types/helpers/cursor-label-action.helper.d.ts.map +1 -0
  39. package/dist/types/helpers/object-config.helper.d.ts +11 -0
  40. package/dist/types/helpers/object-config.helper.d.ts.map +1 -0
  41. package/dist/types/helpers/object-titlebar.helper.d.ts +8 -0
  42. package/dist/types/helpers/object-titlebar.helper.d.ts.map +1 -1
  43. package/dist/types/helpers/selection-label.helper.d.ts +15 -0
  44. package/dist/types/helpers/selection-label.helper.d.ts.map +1 -0
  45. package/dist/types/helpers/viewport-overlay.helper.d.ts +14 -0
  46. package/dist/types/helpers/viewport-overlay.helper.d.ts.map +1 -1
  47. package/dist/types/index.d.ts +4 -0
  48. package/dist/types/index.d.ts.map +1 -1
  49. package/dist/types/interfaces/agent.interface.d.ts +46 -4
  50. package/dist/types/interfaces/agent.interface.d.ts.map +1 -1
  51. package/dist/types/interfaces/agentic-cursor.interface.d.ts +21 -1
  52. package/dist/types/interfaces/agentic-cursor.interface.d.ts.map +1 -1
  53. package/dist/types/interfaces/chat-box.interface.d.ts +23 -4
  54. package/dist/types/interfaces/chat-box.interface.d.ts.map +1 -1
  55. package/dist/types/interfaces/chat-session.interface.d.ts +10 -2
  56. package/dist/types/interfaces/chat-session.interface.d.ts.map +1 -1
  57. package/dist/types/interfaces/cursor-label.interface.d.ts +43 -0
  58. package/dist/types/interfaces/cursor-label.interface.d.ts.map +1 -0
  59. package/dist/types/interfaces/engine-host.interface.d.ts +4 -0
  60. package/dist/types/interfaces/engine-host.interface.d.ts.map +1 -1
  61. package/dist/types/interfaces/localization.interface.d.ts +22 -0
  62. package/dist/types/interfaces/localization.interface.d.ts.map +1 -1
  63. package/dist/types/interfaces/menu-item.interface.d.ts +9 -0
  64. package/dist/types/interfaces/menu-item.interface.d.ts.map +1 -1
  65. package/dist/types/interfaces/object-config.interface.d.ts +6 -0
  66. package/dist/types/interfaces/object-config.interface.d.ts.map +1 -1
  67. package/dist/types/interfaces/remote-cursor.interface.d.ts +2 -0
  68. package/dist/types/interfaces/remote-cursor.interface.d.ts.map +1 -1
  69. package/dist/types/interfaces/theme.interface.d.ts +26 -0
  70. package/dist/types/interfaces/theme.interface.d.ts.map +1 -1
  71. package/dist/types/interfaces/user.interface.d.ts +6 -0
  72. package/dist/types/interfaces/user.interface.d.ts.map +1 -1
  73. package/dist/types/locales/de-locale.d.ts.map +1 -1
  74. package/dist/types/locales/en-locale.d.ts.map +1 -1
  75. package/dist/types/locales/es-locale.d.ts.map +1 -1
  76. package/dist/types/locales/fr-locale.d.ts.map +1 -1
  77. package/dist/types/locales/it-locale.d.ts.map +1 -1
  78. package/dist/types/locales/nl-locale.d.ts.map +1 -1
  79. package/dist/types/locales/pl-locale.d.ts.map +1 -1
  80. package/dist/types/locales/pt-locale.d.ts.map +1 -1
  81. package/dist/types/themes/dark-theme.d.ts.map +1 -1
  82. package/dist/types/themes/light-theme.d.ts.map +1 -1
  83. package/package.json +79 -79
@@ -393,10 +393,14 @@ __export(index_exports, {
393
393
  UPMADE_AGENT_BRAND: () => UPMADE_AGENT_BRAND,
394
394
  UPMADE_CHAT_PROTOCOL_VERSION: () => UPMADE_CHAT_PROTOCOL_VERSION,
395
395
  UPMADE_CHAT_SESSION_BRAND: () => UPMADE_CHAT_SESSION_BRAND,
396
+ UPMADE_CURSOR_ICON_MAX_LENGTH: () => UPMADE_CURSOR_ICON_MAX_LENGTH,
396
397
  UPMADE_DEFAULT_OBJECT_TITLEBAR: () => UPMADE_DEFAULT_OBJECT_TITLEBAR,
397
398
  UPMADE_OBJECT_APPEAR_MAX_BATCH: () => UPMADE_OBJECT_APPEAR_MAX_BATCH,
398
399
  UPMADE_OBJECT_APPEAR_MAX_STAGGER_INDEX: () => UPMADE_OBJECT_APPEAR_MAX_STAGGER_INDEX,
399
400
  UPMADE_OBJECT_TYPE_ICONS: () => UPMADE_OBJECT_TYPE_ICONS,
401
+ UPMADE_OBJECT_TYPE_TERMS: () => UPMADE_OBJECT_TYPE_TERMS,
402
+ UPMADE_OVERLAY_CONTROL_ATTRIBUTE: () => UPMADE_OVERLAY_CONTROL_ATTRIBUTE,
403
+ UPMADE_REMOVE_AGENT_CURSOR_ACTION: () => UPMADE_REMOVE_AGENT_CURSOR_ACTION,
400
404
  UPMADE_ROTATION_HANDLE_DISTANCE: () => UPMADE_ROTATION_HANDLE_DISTANCE,
401
405
  UPMADE_TITLEBAR_CONTROL_ATTRIBUTE: () => UPMADE_TITLEBAR_CONTROL_ATTRIBUTE,
402
406
  UPMADE_TITLEBAR_DEFAULT_HEIGHT: () => UPMADE_TITLEBAR_DEFAULT_HEIGHT,
@@ -471,8 +475,12 @@ __export(index_exports, {
471
475
  darkTheme: () => darkTheme,
472
476
  defaultIcons: () => defaultIcons,
473
477
  formatAgentToolResult: () => formatAgentToolResult,
478
+ getSelectionLabelPoint: () => getSelectionLabelPoint,
479
+ getSelectionTopLeft: () => getSelectionTopLeft,
474
480
  hasRemoteSyncProvider: () => hasRemoteSyncProvider,
475
481
  isLegacyClassName: () => isLegacyClassName,
482
+ isObjectReferenceable: () => isObjectReferenceable,
483
+ isOverlayControlEvent: () => isOverlayControlEvent,
476
484
  isUpmadeAgent: () => isUpmadeAgent,
477
485
  isUpmadeChatSession: () => isUpmadeChatSession,
478
486
  lightTheme: () => lightTheme,
@@ -480,7 +488,10 @@ __export(index_exports, {
480
488
  normalizeLegacyClassName: () => normalizeLegacyClassName,
481
489
  parsePartialJson: () => parsePartialJson,
482
490
  resolveColor: () => resolveColor,
491
+ resolveObjectConfigOption: () => resolveObjectConfigOption,
492
+ resolveObjectTitle: () => resolveObjectTitle,
483
493
  resolveTextToolAvailableFonts: () => resolveTextToolAvailableFonts,
494
+ runCursorLabelAction: () => runCursorLabelAction,
484
495
  runMigrations: () => runMigrations,
485
496
  toLegacyDocumentName: () => toLegacyDocumentName,
486
497
  toLegacyDocumentNames: () => toLegacyDocumentNames
@@ -5916,16 +5927,23 @@ function dropPoint(doc3, pos, slice) {
5916
5927
  for (let pass = 1; pass <= (slice.openStart == 0 && slice.size ? 2 : 1); pass++) {
5917
5928
  for (let d2 = $pos.depth; d2 >= 0; d2--) {
5918
5929
  let bias = d2 == $pos.depth ? 0 : $pos.pos <= ($pos.start(d2 + 1) + $pos.end(d2 + 1)) / 2 ? -1 : 1;
5919
- let insertPos = $pos.index(d2) + (bias > 0 ? 1 : 0);
5920
- let parent = $pos.node(d2), fits = false;
5921
- if (pass == 1) {
5922
- fits = parent.canReplace(insertPos, insertPos, content);
5923
- } else {
5924
- let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
5925
- fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
5930
+ for (let attempt = 0; attempt < 2; attempt++) {
5931
+ if (attempt) {
5932
+ if (!bias)
5933
+ break;
5934
+ bias = -bias;
5935
+ }
5936
+ let insertPos = $pos.index(d2) + (bias > 0 ? 1 : 0);
5937
+ let parent = $pos.node(d2), fits = false;
5938
+ if (pass == 1) {
5939
+ fits = parent.canReplace(insertPos, insertPos, content);
5940
+ } else {
5941
+ let wrapping = parent.contentMatchAt(insertPos).findWrapping(content.firstChild.type);
5942
+ fits = wrapping && parent.canReplaceWith(insertPos, insertPos, wrapping[0]);
5943
+ }
5944
+ if (fits)
5945
+ return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d2 + 1) : $pos.after(d2 + 1);
5926
5946
  }
5927
- if (fits)
5928
- return bias == 0 ? $pos.pos : bias < 0 ? $pos.before(d2 + 1) : $pos.after(d2 + 1);
5929
5947
  }
5930
5948
  }
5931
5949
  return null;
@@ -14160,6 +14178,9 @@ var lightTheme = {
14160
14178
  focusRingColor: "#333333",
14161
14179
  fontFamily: "sans-serif",
14162
14180
  iconColor: "currentColor",
14181
+ primaryColor: "#0a0a0a",
14182
+ primaryHoverColor: "#2a2a2a",
14183
+ primaryTextColor: "#ffffff",
14163
14184
  scrollbarThumbColor: "#ebebeb",
14164
14185
  textPrimary: "#000000",
14165
14186
  textSecondary: "#333333"
@@ -14170,12 +14191,12 @@ var lightTheme = {
14170
14191
  tabBackgroundHover: "rgba(0, 0, 0, 0.05)",
14171
14192
  tabBackgroundSelected: "#ffffff",
14172
14193
  tabLabelMaxWidth: "10rem",
14173
- tabShadowSelected: "0 1px 3px rgba(0, 0, 0, 0.1)",
14194
+ tabShadowSelected: "0 1px 2px rgba(16, 16, 24, 0.08), 0 2px 6px rgba(16, 16, 24, 0.06)",
14174
14195
  tabTextColor: "#666666",
14175
14196
  tabTextColorSelected: "#000000"
14176
14197
  },
14177
14198
  text: {
14178
- selectionBackgroundColor: "#007AFF",
14199
+ selectionBackgroundColor: "#FF6AB5",
14179
14200
  selectionColor: "#ffffff"
14180
14201
  },
14181
14202
  textInput: {
@@ -14186,18 +14207,18 @@ var lightTheme = {
14186
14207
  hoverBorderColor: "#cccccc",
14187
14208
  labelColor: "#333333",
14188
14209
  placeholderColor: "#999999",
14189
- selectionBackground: "#007AFF",
14210
+ selectionBackground: "#FF6AB5",
14190
14211
  selectionColor: "#ffffff",
14191
14212
  suffixBackground: "#f5f5f5",
14192
14213
  suffixColor: "#666666",
14193
14214
  textColor: "#333333"
14194
14215
  },
14195
14216
  selection: {
14196
- borderColor: "#007AFF",
14197
- boxBackgroundColor: "rgba(0, 122, 255, 0.2)",
14198
- boxBorderColor: "rgba(0, 122, 255, 0.5)",
14217
+ borderColor: "#FF6AB5",
14218
+ boxBackgroundColor: "rgba(255, 106, 181, 0.2)",
14219
+ boxBorderColor: "rgba(255, 106, 181, 0.5)",
14199
14220
  handleColor: "#ffffff",
14200
- handleStrokeColor: "#007AFF"
14221
+ handleStrokeColor: "#FF6AB5"
14201
14222
  },
14202
14223
  checkerboard: {
14203
14224
  colorDark: "#cccccc",
@@ -14207,7 +14228,7 @@ var lightTheme = {
14207
14228
  activeBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14208
14229
  backgroundColor: "#ffffff",
14209
14230
  border: "1px solid #ebebeb",
14210
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14231
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14211
14232
  color: "#000000",
14212
14233
  hoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)"
14213
14234
  },
@@ -14219,7 +14240,7 @@ var lightTheme = {
14219
14240
  contextMenu: {
14220
14241
  backgroundColor: "#ffffff",
14221
14242
  border: "1px solid #ebebeb",
14222
- boxShadow: "0 1px 6px rgba(0, 0, 0, 0.12)",
14243
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14223
14244
  dividerColor: "rgba(0, 0, 0, 0.1)",
14224
14245
  itemActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14225
14246
  itemColor: "#333333",
@@ -14229,23 +14250,34 @@ var lightTheme = {
14229
14250
  toolbar: {
14230
14251
  backgroundColor: "#ffffff",
14231
14252
  border: "1px solid #ebebeb",
14232
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14253
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14233
14254
  controlActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14234
14255
  controlColor: "#000000",
14235
14256
  controlHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14236
- controlSelectedBackgroundColor: "#007AFF",
14257
+ controlSelectedBackgroundColor: "#0a0a0a",
14237
14258
  controlSelectedColor: "#ffffff",
14238
14259
  separatorColor: "#ebebeb"
14239
14260
  },
14261
+ button: {
14262
+ primaryActiveBackgroundColor: "#000000",
14263
+ primaryBackgroundColor: "#0a0a0a",
14264
+ primaryHoverBackgroundColor: "#2a2a2a",
14265
+ textActiveBackgroundColor: "rgba(0, 0, 0, 0.1)",
14266
+ textColor: "#0a0a0a",
14267
+ textHoverBackgroundColor: "rgba(0, 0, 0, 0.05)"
14268
+ },
14240
14269
  currentUserDialog: {
14241
14270
  emailColor: "#666666",
14271
+ logoutButtonActiveBackgroundColor: "#000000",
14272
+ logoutButtonBackgroundColor: "#0a0a0a",
14273
+ logoutButtonHoverBackgroundColor: "#2a2a2a",
14242
14274
  nameColor: "#333333"
14243
14275
  },
14244
14276
  dialog: {
14245
14277
  backdropColor: "rgba(0, 0, 0, 0.4)",
14246
14278
  backgroundColor: "#ffffff",
14247
14279
  border: "1px solid #ebebeb",
14248
- boxShadow: "0 4px 24px rgba(0, 0, 0, 0.15)",
14280
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 14px 36px rgba(16, 16, 24, 0.12)",
14249
14281
  closeButtonActiveBackground: "hsl(0, 0%, 0%, 8.6%)",
14250
14282
  closeButtonBackground: "transparent",
14251
14283
  closeButtonColor: "#333333",
@@ -14257,7 +14289,7 @@ var lightTheme = {
14257
14289
  },
14258
14290
  object: {
14259
14291
  borderRadius: "12px",
14260
- boxShadow: "0 1px 2px rgba(20, 18, 31, 0.06), 0 12px 32px -12px rgba(20, 18, 31, 0.22)"
14292
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 14px 36px rgba(16, 16, 24, 0.12)"
14261
14293
  },
14262
14294
  objectAppear: {
14263
14295
  animationDuration: "600ms",
@@ -14266,7 +14298,7 @@ var lightTheme = {
14266
14298
  stagger: "110ms"
14267
14299
  },
14268
14300
  image: {
14269
- dropShadow: "drop-shadow(0 1px 1px rgba(20, 18, 31, 0.06)) drop-shadow(0 8px 12px rgba(20, 18, 31, 0.14))"
14301
+ dropShadow: "drop-shadow(0 1px 2px rgba(16, 16, 24, 0.04)) drop-shadow(0 14px 36px rgba(16, 16, 24, 0.12))"
14270
14302
  },
14271
14303
  loadingPlaceholder: {
14272
14304
  animationDuration: "1.6s",
@@ -14285,29 +14317,29 @@ var lightTheme = {
14285
14317
  subtitleColor: "#666666"
14286
14318
  },
14287
14319
  dropdown: {
14288
- accentColor: "#007bff",
14320
+ accentColor: "#0a0a0a",
14289
14321
  background: "#ffffff",
14290
14322
  borderColor: "#dbdbdb",
14291
14323
  borderRadius: "6px",
14292
14324
  hoverBorderColor: "#cccccc",
14293
14325
  hoverBackgroundColor: "#f0f0f0",
14294
14326
  menuBorderRadius: "6px",
14295
- selectedBackgroundColor: "#007bff1a",
14327
+ selectedBackgroundColor: "rgba(0, 0, 0, 0.06)",
14296
14328
  textColor: "#333333"
14297
14329
  },
14298
14330
  elementHighlight: {
14299
- backgroundColor: "rgba(0, 122, 255, 0.12)",
14300
- color: "#007AFF",
14331
+ backgroundColor: "rgba(255, 106, 181, 0.12)",
14332
+ color: "#FF6AB5",
14301
14333
  labelTextColor: "#ffffff"
14302
14334
  },
14303
14335
  engine: {
14304
14336
  backgroundColor: "#ffffff"
14305
14337
  },
14306
14338
  snap: {
14307
- indicatorFill: "rgba(59, 130, 246, 0.3)",
14308
- indicatorFillInactive: "rgba(59, 130, 246, 0.18)",
14309
- indicatorStroke: "#007bff",
14310
- indicatorStrokeInactive: "rgba(59, 130, 246, 0.5)",
14339
+ indicatorFill: "rgba(255, 106, 181, 0.3)",
14340
+ indicatorFillInactive: "rgba(255, 106, 181, 0.18)",
14341
+ indicatorStroke: "#FF6AB5",
14342
+ indicatorStrokeInactive: "rgba(255, 106, 181, 0.5)",
14311
14343
  lineStroke: "rgba(0, 0, 0, 0.2)"
14312
14344
  },
14313
14345
  fontSize: {
@@ -14335,14 +14367,14 @@ var lightTheme = {
14335
14367
  menuItemDisabledColor: "#aaaaaa",
14336
14368
  menuItemFocusOutline: "2px solid #333333",
14337
14369
  menuItemHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14338
- menuItemSelectedBackgroundColor: "#007AFF",
14370
+ menuItemSelectedBackgroundColor: "#0a0a0a",
14339
14371
  menuItemSelectedColor: "#ffffff",
14340
- menuItemSelectedHoverBackgroundColor: "#007AFF"
14372
+ menuItemSelectedHoverBackgroundColor: "#0a0a0a"
14341
14373
  },
14342
14374
  menu: {
14343
14375
  backgroundColor: "#ffffff",
14344
14376
  border: "1px solid #ebebeb",
14345
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14377
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14346
14378
  itemButtonHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14347
14379
  itemChildOpenBackgroundColor: "hsl(0, 0%, 0%, 3%)",
14348
14380
  itemColor: "#333333",
@@ -14351,19 +14383,19 @@ var lightTheme = {
14351
14383
  itemInputBorderColorOnSelected: "#ffffff",
14352
14384
  itemInputCaretColor: "#333333",
14353
14385
  itemInputCaretColorOnSelected: "#ffffff",
14354
- itemInputSelectionColor: "#007aff",
14386
+ itemInputSelectionColor: "#FF6AB5",
14355
14387
  itemInputSelectionColorOnSelected: "rgba(255, 255, 255, 0.55)",
14356
14388
  itemInputSelectionTextColor: "#ffffff",
14357
14389
  itemInputSelectionTextColorOnSelected: "#ffffff",
14358
14390
  itemOverlayBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14359
- itemSelectedBackgroundColor: "#007aff",
14391
+ itemSelectedBackgroundColor: "#0a0a0a",
14360
14392
  itemSelectedColor: "#ffffff"
14361
14393
  },
14362
14394
  moreMenu: {
14363
14395
  backgroundColor: "#ffffff",
14364
14396
  border: "1px solid #ebebeb",
14365
14397
  borderRadius: "12px",
14366
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14398
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14367
14399
  buttonActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14368
14400
  buttonColor: "#000000",
14369
14401
  buttonHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
@@ -14373,7 +14405,7 @@ var lightTheme = {
14373
14405
  backgroundColor: "#ffffff",
14374
14406
  border: "1px solid #e5e7eb",
14375
14407
  borderRadius: "12px",
14376
- boxShadow: "0 8px 20px rgba(15, 23, 42, 0.08)",
14408
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14377
14409
  color: "#111827",
14378
14410
  dismissButtonActiveBackgroundColor: "#e5e7eb",
14379
14411
  dismissButtonBackgroundColor: "transparent",
@@ -14412,7 +14444,7 @@ var lightTheme = {
14412
14444
  hoverBorderColor: "#cccccc",
14413
14445
  inputBackground: "#ffffff",
14414
14446
  labelColor: "#666666",
14415
- selectionBackground: "#007AFF",
14447
+ selectionBackground: "#FF6AB5",
14416
14448
  selectionColor: "#ffffff",
14417
14449
  spinnerActiveBackground: "hsl(0, 0%, 0%, 8.6%)",
14418
14450
  spinnerBackground: "transparent",
@@ -14422,8 +14454,8 @@ var lightTheme = {
14422
14454
  textColor: "#333333"
14423
14455
  },
14424
14456
  opacitySlider: {
14425
- activeColor: "#007AFF",
14426
- thumbBorderColor: "#007AFF",
14457
+ activeColor: "#0a0a0a",
14458
+ thumbBorderColor: "#0a0a0a",
14427
14459
  thumbColor: "#ffffff",
14428
14460
  trackColor: "#e0e0e0"
14429
14461
  },
@@ -14459,18 +14491,18 @@ var lightTheme = {
14459
14491
  revokeButtonColor: "#dc3545",
14460
14492
  revokeButtonHoverBackground: "#dc3545",
14461
14493
  revokeButtonHoverColor: "#ffffff",
14462
- selectionColor: "#cce5ff"
14494
+ selectionColor: "#ffd6eb"
14463
14495
  },
14464
14496
  slideToggle: {
14465
14497
  thumbColor: "#fff",
14466
14498
  thumbSize: "18px",
14467
- trackCheckedColor: "#007AFF",
14499
+ trackCheckedColor: "#0a0a0a",
14468
14500
  trackColor: "#ccc"
14469
14501
  },
14470
14502
  splitButton: {
14471
14503
  backgroundColor: "#ffffff",
14472
14504
  border: "1px solid #ebebeb",
14473
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14505
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14474
14506
  color: "#000000",
14475
14507
  dividerBackgroundColor: "#ebebeb",
14476
14508
  hoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)"
@@ -14482,7 +14514,7 @@ var lightTheme = {
14482
14514
  tooltip: {
14483
14515
  backgroundColor: "#ffffff",
14484
14516
  border: "1px solid #ebebeb",
14485
- boxShadow: "0 1px 6px rgba(0, 0, 0, 0.12)",
14517
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14486
14518
  color: "#000000"
14487
14519
  },
14488
14520
  utilityPanel: {
@@ -14492,39 +14524,44 @@ var lightTheme = {
14492
14524
  separatorColor: "hsl(0, 0%, 0%, 8%)"
14493
14525
  },
14494
14526
  watermark: {
14495
- background: "rgba(255, 255, 255, 0.6)",
14496
- boxShadow: "0 1px 2px rgba(0, 0, 0, 0.12)",
14497
- color: "rgba(60, 60, 60, 0.75)"
14527
+ background: "rgba(255, 255, 255, 0.9)",
14528
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14529
+ color: "#52525b",
14530
+ logoColor: "#000000"
14498
14531
  },
14499
14532
  chatBox: {
14533
+ accentColor: "#FF6AB5",
14500
14534
  backgroundColor: "#ffffff",
14501
14535
  border: "1px solid #e4e4e7",
14502
- borderRadius: "20px",
14503
- boxShadow: "0 4px 8px rgba(20, 18, 31, 0.04), 0 18px 36px -14px rgba(20, 18, 31, 0.2)",
14504
- buttonBackgroundColor: "#4A7DFF",
14536
+ borderRadius: "16px",
14537
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14538
+ buttonBackgroundColor: "#0a0a0a",
14539
+ buttonBorderRadius: "10px",
14540
+ buttonInset: "4px",
14505
14541
  buttonColor: "#ffffff",
14506
- buttonHoverBackgroundColor: "#3A6AE8",
14507
- caretColor: "#4A7DFF",
14542
+ buttonHoverBackgroundColor: "#2a2a2a",
14543
+ caretColor: "#FF6AB5",
14508
14544
  caretWidth: "2px",
14509
- chipBoxShadow: "0 4px 12px -6px rgba(20, 18, 31, 0.18)",
14545
+ chipBoxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14510
14546
  chipMutedTextColor: "#71717a",
14511
- selectionBackgroundColor: "#4A7DFF",
14547
+ collapsedPaddingY: "8px",
14548
+ selectionBackgroundColor: "#FF6AB5",
14512
14549
  selectionColor: "#ffffff",
14513
14550
  scrollbarThumbColor: "#d4d4d4",
14514
- fontSize: "15px",
14515
- inputBackgroundColor: "#f3f4f6",
14516
- inputBorderRadius: "14px",
14517
- inputMinHeight: "88px",
14518
- padding: "6px",
14519
- placeholderColor: "#9ca3af",
14551
+ fontSize: "16px",
14552
+ inputBackgroundColor: "transparent",
14553
+ inputBorderRadius: "12px",
14554
+ inputMinHeight: "0px",
14555
+ padding: "4px",
14556
+ placeholderColor: "#8d8d8d",
14520
14557
  textColor: "#0a0a0a",
14521
- width: "480px"
14558
+ width: "420px"
14522
14559
  },
14523
14560
  zoomPanel: {
14524
14561
  backgroundColor: "#ffffff",
14525
14562
  border: "1px solid #ebebeb",
14526
14563
  borderRadius: "12px",
14527
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14564
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14528
14565
  buttonActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14529
14566
  buttonBorderRadius: "8px",
14530
14567
  buttonHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
@@ -14534,13 +14571,13 @@ var lightTheme = {
14534
14571
  padding: "4px"
14535
14572
  },
14536
14573
  titlebar: {
14537
- activeBackgroundColor: "#e0efff",
14574
+ activeBackgroundColor: "#ffe8f4",
14538
14575
  activeBorder: "none",
14539
14576
  activeBoxShadow: "none",
14540
- activeButtonFilledBackgroundColor: "#007aff",
14541
- activeIconColor: "#007aff",
14542
- activeMutedTextColor: "rgba(0, 122, 255, 0.6)",
14543
- activeTextColor: "#007aff",
14577
+ activeButtonFilledBackgroundColor: "#FF6AB5",
14578
+ activeIconColor: "#FF6AB5",
14579
+ activeMutedTextColor: "rgba(255, 106, 181, 0.6)",
14580
+ activeTextColor: "#FF6AB5",
14544
14581
  backgroundColor: "#f2f2f2",
14545
14582
  border: "none",
14546
14583
  borderRadius: "8px",
@@ -14552,7 +14589,7 @@ var lightTheme = {
14552
14589
  buttonOutlineColor: "currentColor",
14553
14590
  buttonPressedBackgroundColor: "rgba(0, 0, 0, 0.1)",
14554
14591
  buttonSize: "22px",
14555
- focusRing: "2px solid #007aff",
14592
+ focusRing: "2px solid #FF6AB5",
14556
14593
  fontFamily: "var(--upmade-global-font-family, sans-serif)",
14557
14594
  fontSize: "12px",
14558
14595
  fontWeight: "400",
@@ -14566,7 +14603,7 @@ var lightTheme = {
14566
14603
  mutedTextColor: "#9a9a9a",
14567
14604
  offset: "6px",
14568
14605
  paddingX: "6px",
14569
- selectionBackgroundColor: "#007aff",
14606
+ selectionBackgroundColor: "#FF6AB5",
14570
14607
  selectionColor: "#ffffff",
14571
14608
  textColor: "#5f5f5f",
14572
14609
  titleFontWeight: "600",
@@ -14575,7 +14612,7 @@ var lightTheme = {
14575
14612
  titlebarMenu: {
14576
14613
  backgroundColor: "#ffffff",
14577
14614
  border: "1px solid #ebebeb",
14578
- boxShadow: "0 1px 6px rgba(0, 0, 0, 0.12)",
14615
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14579
14616
  itemColor: "#333333",
14580
14617
  itemHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)"
14581
14618
  }
@@ -14918,9 +14955,10 @@ var darkTheme = {
14918
14955
  separatorColor: "hsl(0, 0%, 100%, 12%)"
14919
14956
  },
14920
14957
  watermark: {
14921
- background: "rgba(40, 40, 40, 0.6)",
14922
- boxShadow: "0 1px 2px rgba(0, 0, 0, 0.35)",
14923
- color: "rgba(220, 220, 220, 0.8)"
14958
+ background: "rgba(40, 40, 40, 0.9)",
14959
+ boxShadow: "0 1px 3px rgba(0, 0, 0, 0.35)",
14960
+ color: "#d4d4d8",
14961
+ logoColor: "#ffffff"
14924
14962
  },
14925
14963
  chatBox: {
14926
14964
  backgroundColor: "#2a2a2a",
@@ -27005,6 +27043,8 @@ var defaultIcons = {
27005
27043
  shapeTriangle: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3L22 21H2L12 3Z"/></svg>',
27006
27044
  image: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
27007
27045
  imageOff: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image-off-icon lucide-image-off"><line x1="2" x2="22" y1="2" y2="22"/><path d="M10.41 10.41a2 2 0 1 1-2.83-2.83"/><line x1="13.5" x2="6" y1="13.5" y2="21"/><line x1="18" x2="21" y1="12" y2="15"/><path d="M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59"/><path d="M21 15V5a2 2 0 0 0-2-2H9"/></svg>',
27046
+ bot: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bot-icon lucide-bot"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>',
27047
+ atSign: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-at-sign-icon lucide-at-sign"><circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"/></svg>',
27008
27048
  chevronDown: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>',
27009
27049
  chevronUp: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m18 15-6-6-6 6"/></svg>',
27010
27050
  chevronLeft: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-left-icon lucide-chevron-left"><path d="m15 18-6-6 6-6"/></svg>',
@@ -27018,6 +27058,7 @@ var defaultIcons = {
27018
27058
  sendToBack: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-down-to-line-icon lucide-arrow-down-to-line"><path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M19 21H5"/></svg>',
27019
27059
  selectAll: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-mouse-pointer-icon lucide-square-mouse-pointer"><path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"/><path d="M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"/></svg>',
27020
27060
  download: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download-icon lucide-download"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>',
27061
+ file: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-icon lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',
27021
27062
  upload: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-upload-icon lucide-upload"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/></svg>',
27022
27063
  undo: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-undo-icon lucide-undo"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>',
27023
27064
  redo: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-redo-icon lucide-redo"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/></svg>',
@@ -27176,6 +27217,33 @@ var UpmadeToolConfigHelper = class {
27176
27217
  };
27177
27218
 
27178
27219
  // src/helpers/object-titlebar.helper.ts
27220
+ var UPMADE_OBJECT_TYPE_TERMS = {
27221
+ UpmadeShape: "objectType.shape",
27222
+ UpmadeText: "objectType.text",
27223
+ UpmadeImage: "objectType.image",
27224
+ UpmadePath: "objectType.path",
27225
+ UpmadeLine: "objectType.line",
27226
+ UpmadeGroup: "objectType.group",
27227
+ UpmadeIframeObject: "objectType.iframe",
27228
+ UpmadeDynamicObject: "objectType.dynamic"
27229
+ };
27230
+ function resolveObjectTitle(object2, resolver, translate, onError) {
27231
+ if (resolver) {
27232
+ try {
27233
+ const title = resolver(object2);
27234
+ if (typeof title === "string" && title.length > 0) {
27235
+ return title;
27236
+ }
27237
+ } catch (error) {
27238
+ onError?.(error);
27239
+ }
27240
+ }
27241
+ if (typeof object2.name === "string" && object2.name.length > 0) {
27242
+ return object2.name;
27243
+ }
27244
+ return translate(UPMADE_OBJECT_TYPE_TERMS[object2.__class__] ?? "objectType.object");
27245
+ }
27246
+ __name(resolveObjectTitle, "resolveObjectTitle");
27179
27247
  var UPMADE_TITLEBAR_DEFAULT_HEIGHT = 28;
27180
27248
  var UPMADE_TITLEBAR_DEFAULT_OFFSET = 6;
27181
27249
  var UPMADE_TITLEBAR_DEFAULT_HIDE_BELOW_WIDTH = 40;
@@ -27249,6 +27317,67 @@ var UpmadeObjectTitlebarHelper = class _UpmadeObjectTitlebarHelper {
27249
27317
  }
27250
27318
  };
27251
27319
 
27320
+ // src/helpers/selection-label.helper.ts
27321
+ function getSelectionTopLeft(objects) {
27322
+ let minX = Infinity;
27323
+ let minY = Infinity;
27324
+ for (const object2 of objects) {
27325
+ if (!object2) continue;
27326
+ const polygon = object2.rotatedPolygon;
27327
+ for (const corner of [polygon.topLeft, polygon.topRight, polygon.bottomRight, polygon.bottomLeft]) {
27328
+ if (corner.x < minX) minX = corner.x;
27329
+ if (corner.y < minY) minY = corner.y;
27330
+ }
27331
+ }
27332
+ return Number.isFinite(minX) && Number.isFinite(minY) ? { x: minX, y: minY } : null;
27333
+ }
27334
+ __name(getSelectionTopLeft, "getSelectionTopLeft");
27335
+ function getSelectionLabelPoint(core, objects) {
27336
+ const topLeft = getSelectionTopLeft(objects);
27337
+ if (!topLeft) {
27338
+ return null;
27339
+ }
27340
+ const titlebars = core.objectTitlebarManager;
27341
+ const scale = core.store?.state?.scale || 1;
27342
+ let lift2 = 0;
27343
+ if (titlebars?.isEnabled) {
27344
+ const tolerance = 1 / scale;
27345
+ for (const object2 of objects) {
27346
+ if (!object2 || Math.abs(object2.rotatedBoundingBox.y - topLeft.y) > tolerance) continue;
27347
+ lift2 = Math.max(lift2, titlebars.getTitlebarLift(object2));
27348
+ }
27349
+ }
27350
+ return { x: topLeft.x, y: topLeft.y - lift2 / scale };
27351
+ }
27352
+ __name(getSelectionLabelPoint, "getSelectionLabelPoint");
27353
+
27354
+ // src/helpers/object-config.helper.ts
27355
+ function resolveObjectConfigOption(config, key, object2, fallback, onError) {
27356
+ const value = config?.[key];
27357
+ if (value === void 0) {
27358
+ return fallback;
27359
+ }
27360
+ if (typeof value !== "function") {
27361
+ return value === true;
27362
+ }
27363
+ try {
27364
+ const result = value(object2);
27365
+ if (result && typeof result.then === "function") {
27366
+ onError?.(key, "it must be synchronous; promises are not supported.");
27367
+ return fallback;
27368
+ }
27369
+ return typeof result === "boolean" ? result : fallback;
27370
+ } catch (error) {
27371
+ onError?.(key, error);
27372
+ return fallback;
27373
+ }
27374
+ }
27375
+ __name(resolveObjectConfigOption, "resolveObjectConfigOption");
27376
+ function isObjectReferenceable(config, object2, onError) {
27377
+ return resolveObjectConfigOption(config, "isReferenceable", object2, true, onError);
27378
+ }
27379
+ __name(isObjectReferenceable, "isObjectReferenceable");
27380
+
27252
27381
  // src/helpers/partial-json.helper.ts
27253
27382
  var INCOMPLETE = /* @__PURE__ */ Symbol("incomplete");
27254
27383
  var InvalidJson = class extends Error {
@@ -34317,10 +34446,30 @@ var EN_LOCALE = {
34317
34446
  "zoom.zoomOut": "Zoom out",
34318
34447
  // Chat box
34319
34448
  "chatBox.placeholder": "Ask the AI...",
34449
+ "chatBox.agentPlaceholder": "Message {name}...",
34450
+ "chatBox.removeAgent": "Remove agent",
34451
+ "chatBox.agentWorking": "working",
34320
34452
  "chatBox.submit": "Send",
34321
34453
  "chatBox.stop": "Stop",
34454
+ "chatBox.thinking": "Thinking...",
34455
+ "chatBox.addAgent": "Add agent",
34456
+ "chatBox.agentMenu.close": "Close",
34322
34457
  "chatBox.removeChip": "Remove",
34323
34458
  "chatBox.moreChips": "more",
34459
+ "chatBox.menu": "Add",
34460
+ "chatBox.menu.agent": "Agents",
34461
+ "chatBox.menu.agent.pink": "Pink",
34462
+ "chatBox.menu.agent.green": "Green",
34463
+ "chatBox.menu.agent.yellow": "Yellow",
34464
+ "agentCursor.notice.userSelected": "Selected by you",
34465
+ "agentCursor.notice.userInteraction": "In use by you",
34466
+ "chatBox.menu.back": "Back",
34467
+ "chatBox.menu.selection": "Objects",
34468
+ "chatBox.menu.file": "File",
34469
+ "chatBox.menu.mention": "Mention",
34470
+ "chatBox.mention.empty": "Nothing on the board to mention",
34471
+ "chatBox.mention.noMatch": "No matches",
34472
+ "chatBox.agentMentions": "Agents to mention",
34324
34473
  // Utility panel
34325
34474
  "utility.undo": "Undo",
34326
34475
  "utility.redo": "Redo",
@@ -34449,10 +34598,30 @@ var DE_LOCALE = {
34449
34598
  "zoom.zoomOut": "Verkleinern",
34450
34599
  // Chat box
34451
34600
  "chatBox.placeholder": "Frag die KI...",
34601
+ "chatBox.agentPlaceholder": "Nachricht an {name}...",
34602
+ "chatBox.removeAgent": "Agent entfernen",
34603
+ "chatBox.agentWorking": "arbeitet",
34452
34604
  "chatBox.submit": "Senden",
34453
34605
  "chatBox.stop": "Stoppen",
34606
+ "chatBox.thinking": "Denkt nach...",
34607
+ "chatBox.addAgent": "Agent hinzuf\xFCgen",
34608
+ "chatBox.agentMenu.close": "Schlie\xDFen",
34454
34609
  "chatBox.removeChip": "Entfernen",
34455
34610
  "chatBox.moreChips": "weitere",
34611
+ "chatBox.menu": "Hinzuf\xFCgen",
34612
+ "chatBox.menu.agent": "Agenten",
34613
+ "chatBox.menu.agent.pink": "Pink",
34614
+ "chatBox.menu.agent.green": "Gr\xFCn",
34615
+ "chatBox.menu.agent.yellow": "Gelb",
34616
+ "agentCursor.notice.userSelected": "Von dir ausgew\xE4hlt",
34617
+ "agentCursor.notice.userInteraction": "Von dir in Bearbeitung",
34618
+ "chatBox.menu.back": "Zur\xFCck",
34619
+ "chatBox.menu.selection": "Objekte",
34620
+ "chatBox.menu.file": "Datei",
34621
+ "chatBox.menu.mention": "Erw\xE4hnen",
34622
+ "chatBox.mention.empty": "Nichts auf dem Board zum Erw\xE4hnen",
34623
+ "chatBox.mention.noMatch": "Keine Treffer",
34624
+ "chatBox.agentMentions": "Agenten zum Erw\xE4hnen",
34456
34625
  // Utility panel
34457
34626
  "utility.undo": "R\xFCckg\xE4ngig",
34458
34627
  "utility.redo": "Wiederholen",
@@ -34581,10 +34750,30 @@ var FR_LOCALE = {
34581
34750
  "zoom.zoomOut": "Zoom arri\xE8re",
34582
34751
  // Chat box
34583
34752
  "chatBox.placeholder": "Demandez \xE0 l'IA...",
34753
+ "chatBox.agentPlaceholder": "Message \xE0 {name}...",
34754
+ "chatBox.removeAgent": "Retirer l'agent",
34755
+ "chatBox.agentWorking": "au travail",
34584
34756
  "chatBox.submit": "Envoyer",
34585
34757
  "chatBox.stop": "Arr\xEAter",
34758
+ "chatBox.thinking": "R\xE9flexion...",
34759
+ "chatBox.addAgent": "Ajouter un agent",
34760
+ "chatBox.agentMenu.close": "Fermer",
34586
34761
  "chatBox.removeChip": "Retirer",
34587
34762
  "chatBox.moreChips": "de plus",
34763
+ "chatBox.menu": "Ajouter",
34764
+ "chatBox.menu.agent": "Agents",
34765
+ "chatBox.menu.agent.pink": "Rose",
34766
+ "chatBox.menu.agent.green": "Vert",
34767
+ "chatBox.menu.agent.yellow": "Jaune",
34768
+ "agentCursor.notice.userSelected": "S\xE9lectionn\xE9 par vous",
34769
+ "agentCursor.notice.userInteraction": "Utilis\xE9 par vous",
34770
+ "chatBox.menu.back": "Retour",
34771
+ "chatBox.menu.selection": "Objets",
34772
+ "chatBox.menu.file": "Fichier",
34773
+ "chatBox.menu.mention": "Mentionner",
34774
+ "chatBox.mention.empty": "Rien \xE0 mentionner sur le tableau",
34775
+ "chatBox.mention.noMatch": "Aucun r\xE9sultat",
34776
+ "chatBox.agentMentions": "Agents \xE0 mentionner",
34588
34777
  // Utility panel
34589
34778
  "utility.undo": "Annuler",
34590
34779
  "utility.redo": "R\xE9tablir",
@@ -34713,10 +34902,30 @@ var PT_LOCALE = {
34713
34902
  "zoom.zoomOut": "Diminuir zoom",
34714
34903
  // Chat box
34715
34904
  "chatBox.placeholder": "Pergunte \xE0 IA...",
34905
+ "chatBox.agentPlaceholder": "Mensagem para {name}...",
34906
+ "chatBox.removeAgent": "Remover agente",
34907
+ "chatBox.agentWorking": "trabalhando",
34716
34908
  "chatBox.submit": "Enviar",
34717
34909
  "chatBox.stop": "Parar",
34910
+ "chatBox.thinking": "Pensando...",
34911
+ "chatBox.addAgent": "Adicionar agente",
34912
+ "chatBox.agentMenu.close": "Fechar",
34718
34913
  "chatBox.removeChip": "Remover",
34719
34914
  "chatBox.moreChips": "mais",
34915
+ "chatBox.menu": "Adicionar",
34916
+ "chatBox.menu.agent": "Agentes",
34917
+ "chatBox.menu.agent.pink": "Rosa",
34918
+ "chatBox.menu.agent.green": "Verde",
34919
+ "chatBox.menu.agent.yellow": "Amarelo",
34920
+ "agentCursor.notice.userSelected": "Selecionado por voc\xEA",
34921
+ "agentCursor.notice.userInteraction": "Em uso por voc\xEA",
34922
+ "chatBox.menu.back": "Voltar",
34923
+ "chatBox.menu.selection": "Objetos",
34924
+ "chatBox.menu.file": "Arquivo",
34925
+ "chatBox.menu.mention": "Mencionar",
34926
+ "chatBox.mention.empty": "Nada no quadro para mencionar",
34927
+ "chatBox.mention.noMatch": "Nenhum resultado",
34928
+ "chatBox.agentMentions": "Agentes para mencionar",
34720
34929
  // Utility panel
34721
34930
  "utility.undo": "Desfazer",
34722
34931
  "utility.redo": "Refazer",
@@ -34845,10 +35054,30 @@ var ES_LOCALE = {
34845
35054
  "zoom.zoomOut": "Alejar",
34846
35055
  // Chat box
34847
35056
  "chatBox.placeholder": "Pregunta a la IA...",
35057
+ "chatBox.agentPlaceholder": "Mensaje para {name}...",
35058
+ "chatBox.removeAgent": "Quitar agente",
35059
+ "chatBox.agentWorking": "trabajando",
34848
35060
  "chatBox.submit": "Enviar",
34849
35061
  "chatBox.stop": "Detener",
35062
+ "chatBox.thinking": "Pensando...",
35063
+ "chatBox.addAgent": "A\xF1adir agente",
35064
+ "chatBox.agentMenu.close": "Cerrar",
34850
35065
  "chatBox.removeChip": "Quitar",
34851
35066
  "chatBox.moreChips": "m\xE1s",
35067
+ "chatBox.menu": "A\xF1adir",
35068
+ "chatBox.menu.agent": "Agentes",
35069
+ "chatBox.menu.agent.pink": "Rosa",
35070
+ "chatBox.menu.agent.green": "Verde",
35071
+ "chatBox.menu.agent.yellow": "Amarillo",
35072
+ "agentCursor.notice.userSelected": "Seleccionado por ti",
35073
+ "agentCursor.notice.userInteraction": "En uso por ti",
35074
+ "chatBox.menu.back": "Atr\xE1s",
35075
+ "chatBox.menu.selection": "Objetos",
35076
+ "chatBox.menu.file": "Archivo",
35077
+ "chatBox.menu.mention": "Mencionar",
35078
+ "chatBox.mention.empty": "Nada en el tablero para mencionar",
35079
+ "chatBox.mention.noMatch": "Sin coincidencias",
35080
+ "chatBox.agentMentions": "Agentes para mencionar",
34852
35081
  // Utility panel
34853
35082
  "utility.undo": "Deshacer",
34854
35083
  "utility.redo": "Rehacer",
@@ -34977,10 +35206,30 @@ var PL_LOCALE = {
34977
35206
  "zoom.zoomOut": "Pomniejsz",
34978
35207
  // Chat box
34979
35208
  "chatBox.placeholder": "Zapytaj AI...",
35209
+ "chatBox.agentPlaceholder": "Wiadomo\u015B\u0107 do {name}...",
35210
+ "chatBox.removeAgent": "Usu\u0144 agenta",
35211
+ "chatBox.agentWorking": "pracuje",
34980
35212
  "chatBox.submit": "Wy\u015Blij",
34981
35213
  "chatBox.stop": "Zatrzymaj",
35214
+ "chatBox.thinking": "My\u015Bl\u0119...",
35215
+ "chatBox.addAgent": "Dodaj agenta",
35216
+ "chatBox.agentMenu.close": "Zamknij",
34982
35217
  "chatBox.removeChip": "Usu\u0144",
34983
35218
  "chatBox.moreChips": "wi\u0119cej",
35219
+ "chatBox.menu": "Dodaj",
35220
+ "chatBox.menu.agent": "Agenci",
35221
+ "chatBox.menu.agent.pink": "R\xF3\u017Cowy",
35222
+ "chatBox.menu.agent.green": "Zielony",
35223
+ "chatBox.menu.agent.yellow": "\u017B\xF3\u0142ty",
35224
+ "agentCursor.notice.userSelected": "Zaznaczone przez ciebie",
35225
+ "agentCursor.notice.userInteraction": "U\u017Cywane przez ciebie",
35226
+ "chatBox.menu.back": "Wstecz",
35227
+ "chatBox.menu.selection": "Obiekty",
35228
+ "chatBox.menu.file": "Plik",
35229
+ "chatBox.menu.mention": "Wzmianka",
35230
+ "chatBox.mention.empty": "Nic do wspomnienia na tablicy",
35231
+ "chatBox.mention.noMatch": "Brak wynik\xF3w",
35232
+ "chatBox.agentMentions": "Agenci do wspomnienia",
34984
35233
  // Utility panel
34985
35234
  "utility.undo": "Cofnij",
34986
35235
  "utility.redo": "Pon\xF3w",
@@ -35109,10 +35358,30 @@ var NL_LOCALE = {
35109
35358
  "zoom.zoomOut": "Uitzoomen",
35110
35359
  // Chat box
35111
35360
  "chatBox.placeholder": "Vraag het de AI...",
35361
+ "chatBox.agentPlaceholder": "Bericht aan {name}...",
35362
+ "chatBox.removeAgent": "Agent verwijderen",
35363
+ "chatBox.agentWorking": "aan het werk",
35112
35364
  "chatBox.submit": "Versturen",
35113
35365
  "chatBox.stop": "Stoppen",
35366
+ "chatBox.thinking": "Aan het denken...",
35367
+ "chatBox.addAgent": "Agent toevoegen",
35368
+ "chatBox.agentMenu.close": "Sluiten",
35114
35369
  "chatBox.removeChip": "Verwijderen",
35115
35370
  "chatBox.moreChips": "meer",
35371
+ "chatBox.menu": "Toevoegen",
35372
+ "chatBox.menu.agent": "Agenten",
35373
+ "chatBox.menu.agent.pink": "Roze",
35374
+ "chatBox.menu.agent.green": "Groen",
35375
+ "chatBox.menu.agent.yellow": "Geel",
35376
+ "agentCursor.notice.userSelected": "Door jou geselecteerd",
35377
+ "agentCursor.notice.userInteraction": "Door jou in gebruik",
35378
+ "chatBox.menu.back": "Terug",
35379
+ "chatBox.menu.selection": "Objecten",
35380
+ "chatBox.menu.file": "Bestand",
35381
+ "chatBox.menu.mention": "Vermelden",
35382
+ "chatBox.mention.empty": "Niets op het bord om te vermelden",
35383
+ "chatBox.mention.noMatch": "Geen resultaten",
35384
+ "chatBox.agentMentions": "Agenten om te vermelden",
35116
35385
  // Utility panel
35117
35386
  "utility.undo": "Ongedaan maken",
35118
35387
  "utility.redo": "Opnieuw uitvoeren",
@@ -35241,10 +35510,30 @@ var IT_LOCALE = {
35241
35510
  "zoom.zoomOut": "Riduci",
35242
35511
  // Chat box
35243
35512
  "chatBox.placeholder": "Chiedi all'IA...",
35513
+ "chatBox.agentPlaceholder": "Messaggio a {name}...",
35514
+ "chatBox.removeAgent": "Rimuovi agente",
35515
+ "chatBox.agentWorking": "al lavoro",
35244
35516
  "chatBox.submit": "Invia",
35245
35517
  "chatBox.stop": "Interrompi",
35518
+ "chatBox.thinking": "Sto pensando...",
35519
+ "chatBox.addAgent": "Aggiungi agente",
35520
+ "chatBox.agentMenu.close": "Chiudi",
35246
35521
  "chatBox.removeChip": "Rimuovi",
35247
35522
  "chatBox.moreChips": "altri",
35523
+ "chatBox.menu": "Aggiungi",
35524
+ "chatBox.menu.agent": "Agenti",
35525
+ "chatBox.menu.agent.pink": "Rosa",
35526
+ "chatBox.menu.agent.green": "Verde",
35527
+ "chatBox.menu.agent.yellow": "Giallo",
35528
+ "agentCursor.notice.userSelected": "Selezionato da te",
35529
+ "agentCursor.notice.userInteraction": "In uso da te",
35530
+ "chatBox.menu.back": "Indietro",
35531
+ "chatBox.menu.selection": "Oggetti",
35532
+ "chatBox.menu.file": "File",
35533
+ "chatBox.menu.mention": "Menziona",
35534
+ "chatBox.mention.empty": "Niente da menzionare sulla lavagna",
35535
+ "chatBox.mention.noMatch": "Nessun risultato",
35536
+ "chatBox.agentMentions": "Agenti da menzionare",
35248
35537
  // Utility panel
35249
35538
  "utility.undo": "Annulla",
35250
35539
  "utility.redo": "Ripristina",
@@ -35504,16 +35793,6 @@ var UPMADE_TITLEBAR_EDITABLE_TITLE_ATTRIBUTE = "data-upmade-titlebar-editable-ti
35504
35793
  var UPMADE_TITLEBAR_TITLE_INPUT_ATTRIBUTE = "data-upmade-titlebar-title-input";
35505
35794
  var DEFAULT_LEFT_ELEMENTS = [{ id: "title", type: "title" }];
35506
35795
  var SECTIONS = ["left", "center", "right"];
35507
- var OBJECT_TYPE_TERMS = {
35508
- UpmadeShape: "objectType.shape",
35509
- UpmadeText: "objectType.text",
35510
- UpmadeImage: "objectType.image",
35511
- UpmadePath: "objectType.path",
35512
- UpmadeLine: "objectType.line",
35513
- UpmadeGroup: "objectType.group",
35514
- UpmadeIframeObject: "objectType.iframe",
35515
- UpmadeDynamicObject: "objectType.dynamic"
35516
- };
35517
35796
  var UPMADE_OBJECT_TYPE_ICONS = {
35518
35797
  UpmadeShape: "shapes",
35519
35798
  UpmadeText: "type",
@@ -35602,7 +35881,43 @@ var UpmadeObjectTitlebarManager = class {
35602
35881
  * a selected object (nested groups resolve selection to their direct parent).
35603
35882
  */
35604
35883
  getActiveOwnerIds(candidates) {
35605
- const selectedIds = this._core.store.selectionGroup?.objectIds ?? [];
35884
+ return this.collectOwnerChain(this._core.store.selectionGroup?.objectIds ?? [], candidates);
35885
+ }
35886
+ /**
35887
+ * Returns the color of the agent (local or a collaborator's) that has each titlebar owner selected, or an object
35888
+ * in it, by the rules of `getActiveOwnerIds`. When several agents have selected the same owner, the first wins.
35889
+ */
35890
+ getAgentOwnerColors(candidates) {
35891
+ const colors = /* @__PURE__ */ new Map();
35892
+ for (const cursor of this.getAgentCursors()) {
35893
+ for (const id2 of this.collectOwnerChain(cursor.selectedObjectIds, candidates)) {
35894
+ if (!colors.has(id2)) {
35895
+ colors.set(id2, cursor.color);
35896
+ }
35897
+ }
35898
+ }
35899
+ return colors;
35900
+ }
35901
+ /**
35902
+ * Screen distance from the top edge of `object` to the top of the titlebar it shows on its own, or `0` when it
35903
+ * shows none. Agents' labels sit above a selection, so they move up by this much to sit above its titlebar.
35904
+ */
35905
+ getTitlebarLift(object2) {
35906
+ if (this.getOwnTitlebar(object2).length === 0) {
35907
+ return 0;
35908
+ }
35909
+ const host = this._core.engine?.host;
35910
+ const { height, offset } = this.getMetrics(host && typeof getComputedStyle === "function" ? getComputedStyle(host) : null);
35911
+ return height + offset;
35912
+ }
35913
+ /** The visible agents' cursors with a selection, local ones first. */
35914
+ getAgentCursors() {
35915
+ const local = this._core.agenticCursorManager?.getAll() ?? [];
35916
+ const remote = this._core.remoteAgentManager?.getAll() ?? [];
35917
+ return [...local, ...remote].filter((cursor) => cursor.visible && cursor.selectedObjectIds.length > 0);
35918
+ }
35919
+ /** The given objects and the groups that contain them (nested groups resolve to their direct parent). */
35920
+ collectOwnerChain(selectedIds, candidates) {
35606
35921
  const active = /* @__PURE__ */ new Set();
35607
35922
  if (selectedIds.length === 0) {
35608
35923
  return active;
@@ -35659,16 +35974,21 @@ var UpmadeObjectTitlebarManager = class {
35659
35974
  if (!config || this.getOwners([object2]).length === 0) {
35660
35975
  return [];
35661
35976
  }
35662
- const isActive = this.getActiveOwnerIds(this.withNestedGroups(object2)).has(object2.id);
35977
+ const withNested = this.withNestedGroups(object2);
35978
+ const isActive = this.getActiveOwnerIds(withNested).has(object2.id);
35979
+ const isAgentSelected = this.getAgentOwnerColors(withNested).has(object2.id);
35663
35980
  const anchor2 = UpmadeObjectTitlebarHelper.getAnchor(object2, this._core.store.state, config.rotation ?? "follow");
35664
- return this.isShown(object2, isActive, anchor2.width, config) ? [{ owner: object2, isActive }] : [];
35981
+ return this.isShown(object2, isActive || isAgentSelected, anchor2.width, config) ? [{ owner: object2, isActive }] : [];
35665
35982
  }
35666
- /** The visibility rules: a titlebar being edited stays visible until the edit ends. */
35667
- isShown(owner, isActive, width, config) {
35983
+ /**
35984
+ * The visibility rules: a titlebar being edited stays visible until the edit ends. With `visibility: 'active'`,
35985
+ * `isSelected` also counts an agent's selection, so an agent's titlebar highlight shows.
35986
+ */
35987
+ isShown(owner, isSelected, width, config) {
35668
35988
  if (this._editingTitle?.ownerId === owner.id) {
35669
35989
  return true;
35670
35990
  }
35671
- return (config.visibility !== "active" || isActive) && width >= (config.hideBelowWidth ?? UPMADE_TITLEBAR_DEFAULT_HIDE_BELOW_WIDTH);
35991
+ return (config.visibility !== "active" || isSelected) && width >= (config.hideBelowWidth ?? UPMADE_TITLEBAR_DEFAULT_HIDE_BELOW_WIDTH);
35672
35992
  }
35673
35993
  /** The object and the groups nested in it, so that a selected descendant makes it active. */
35674
35994
  withNestedGroups(object2) {
@@ -35699,13 +36019,15 @@ var UpmadeObjectTitlebarManager = class {
35699
36019
  const viewport = { scale: state.scale, translateX: state.translateX, translateY: state.translateY };
35700
36020
  const owners = this.getOwners(candidates);
35701
36021
  const activeOwnerIds = this.getActiveOwnerIds(candidates);
36022
+ const agentColors = this.getAgentOwnerColors(candidates);
35702
36023
  const titlebars = [];
35703
36024
  const editing = this._editingTitle;
35704
36025
  for (const owner of owners) {
35705
36026
  const isActive = activeOwnerIds.has(owner.id);
36027
+ const agentColor = agentColors.get(owner.id);
35706
36028
  const isEditing = editing?.ownerId === owner.id;
35707
36029
  const anchor2 = UpmadeObjectTitlebarHelper.getAnchor(owner, viewport, config.rotation ?? "follow");
35708
- if (!this.isShown(owner, isActive, anchor2.width, config)) {
36030
+ if (!this.isShown(owner, isActive || agentColor !== void 0, anchor2.width, config)) {
35709
36031
  continue;
35710
36032
  }
35711
36033
  const context = this.createContext(owner, isActive, anchor2.width);
@@ -35719,6 +36041,7 @@ var UpmadeObjectTitlebarManager = class {
35719
36041
  owner,
35720
36042
  context,
35721
36043
  isActive,
36044
+ ...agentColor !== void 0 ? { agentColor } : {},
35722
36045
  transform: UpmadeObjectTitlebarHelper.getTransform(anchor2, viewport.scale),
35723
36046
  width: anchor2.width,
35724
36047
  editingElementId: isEditedElementShown ? editing.elementId : void 0,
@@ -35769,21 +36092,7 @@ var UpmadeObjectTitlebarManager = class {
35769
36092
  }
35770
36093
  /** Resolves an object's title: config resolver, then object name, then a localized type label. */
35771
36094
  resolveTitle(owner) {
35772
- const resolver = this.config?.title;
35773
- if (resolver) {
35774
- try {
35775
- const title = resolver(owner);
35776
- if (typeof title === "string" && title.length > 0) {
35777
- return title;
35778
- }
35779
- } catch (error) {
35780
- this.warnOnce("title", error);
35781
- }
35782
- }
35783
- if (typeof owner.name === "string" && owner.name.length > 0) {
35784
- return owner.name;
35785
- }
35786
- return this.translate(OBJECT_TYPE_TERMS[owner.__class__] ?? "objectType.object");
36095
+ return resolveObjectTitle(owner, this.config?.title, this.translate, (error) => this.warnOnce("title", error));
35787
36096
  }
35788
36097
  /**
35789
36098
  * Finds the object whose titlebar surface was pressed. Presses on titlebar controls return `null`
@@ -36193,6 +36502,10 @@ var UpmadeObjectConfigManager = class {
36193
36502
  isResizable(object2) {
36194
36503
  return this.allowsAll(object2, (unit) => unit.isResizable !== false && this.evaluate("isResizable", unit, true));
36195
36504
  }
36505
+ /** Whether the object can be referenced in the chat, e.g. as a chat box chip. Defaults to `true`. */
36506
+ isReferenceable(object2) {
36507
+ return this.evaluate("isReferenceable", object2, true);
36508
+ }
36196
36509
  /** Applies a check to an object and everything a transform of it also transforms. */
36197
36510
  allowsAll(object2, check) {
36198
36511
  if (object2 instanceof UpmadeSelectionGroup) {
@@ -36209,26 +36522,9 @@ var UpmadeObjectConfigManager = class {
36209
36522
  }
36210
36523
  return true;
36211
36524
  }
36212
- /** Resolves one option for one object. Only a synchronous boolean counts; failures are reported once. */
36525
+ /** Resolves one option for one object; failures are reported once. */
36213
36526
  evaluate(key, object2, fallback) {
36214
- const value = this.config?.[key];
36215
- if (value === void 0) {
36216
- return fallback;
36217
- }
36218
- if (typeof value !== "function") {
36219
- return value === true;
36220
- }
36221
- try {
36222
- const result = value(object2);
36223
- if (result && typeof result.then === "function") {
36224
- this.warnOnce(key, "it must be synchronous; promises are not supported.");
36225
- return fallback;
36226
- }
36227
- return typeof result === "boolean" ? result : fallback;
36228
- } catch (error) {
36229
- this.warnOnce(key, error);
36230
- return fallback;
36231
- }
36527
+ return resolveObjectConfigOption(this.config, key, object2, fallback, (failedKey, error) => this.warnOnce(failedKey, error));
36232
36528
  }
36233
36529
  warnOnce(key, error) {
36234
36530
  if (this._warnedKeys.has(key)) {
@@ -36239,6 +36535,13 @@ var UpmadeObjectConfigManager = class {
36239
36535
  }
36240
36536
  };
36241
36537
 
36538
+ // src/interfaces/cursor-label.interface.ts
36539
+ var UPMADE_REMOVE_AGENT_CURSOR_ACTION = Object.freeze({
36540
+ id: "remove",
36541
+ icon: "x",
36542
+ label: "Send agent back"
36543
+ });
36544
+
36242
36545
  // src/helpers/user-color.helper.ts
36243
36546
  var UpmadeUserColorHelper = class {
36244
36547
  static {
@@ -40219,7 +40522,7 @@ var AGENT_TOOL_SPECS = {
40219
40522
  },
40220
40523
  select: {
40221
40524
  name: "select",
40222
- description: "Makes top-level objects your selection, shown in your color. Never changes the user's selection.",
40525
+ description: "Makes top-level objects your selection, shown in your color. Never changes the user's selection. Your selection lasts while you work on it: acting on objects outside it clears it, and objects you create become your selection.",
40223
40526
  params: { objectIds: req(ids), additive: opt(bool("Add to your selection instead of replacing it.")) },
40224
40527
  actors: AGENT_ONLY,
40225
40528
  describeObjects: false,
@@ -41290,6 +41593,8 @@ var UpmadeAgent = class {
41290
41593
  _name;
41291
41594
  _color;
41292
41595
  _avatarUrl;
41596
+ _cursorIcon;
41597
+ _cursorActions;
41293
41598
  _speed;
41294
41599
  _broadcast;
41295
41600
  _status;
@@ -41308,6 +41613,8 @@ var UpmadeAgent = class {
41308
41613
  this._name = options.name;
41309
41614
  this._color = options.color || UpmadeUserColorHelper.generateColorFromName(options.name);
41310
41615
  this._avatarUrl = options.avatarUrl;
41616
+ this._cursorIcon = options.cursorIcon || null;
41617
+ this._cursorActions = options.cursorActions ? [...options.cursorActions] : [UPMADE_REMOVE_AGENT_CURSOR_ACTION];
41311
41618
  this._speed = options.speed;
41312
41619
  this._broadcast = options.broadcast ?? true;
41313
41620
  this._status = options.status || null;
@@ -41345,6 +41652,29 @@ var UpmadeAgent = class {
41345
41652
  this._avatarUrl = url;
41346
41653
  this.notifyChange();
41347
41654
  }
41655
+ /**
41656
+ * Icon shown before the name on the cursor label: SVG markup or an image URL. `null` (the default) shows a circle in the agent's color.
41657
+ */
41658
+ get cursorIcon() {
41659
+ return this._cursorIcon;
41660
+ }
41661
+ set cursorIcon(icon) {
41662
+ this._cursorIcon = icon || null;
41663
+ this._core?.agenticCursorManager.refresh(this.id);
41664
+ this.notifyChange();
41665
+ }
41666
+ /**
41667
+ * Buttons after the name or status on the cursor label. Defaults to `[UPMADE_REMOVE_AGENT_CURSOR_ACTION]`: an "X"
41668
+ * that sends the agent back behind its chip in the editor's chat box (`sendHome()`), or removes it without one.
41669
+ * `[]` shows none. Clicks call the action's `onClick` and emit the engine's `cursorLabelAction`.
41670
+ */
41671
+ get cursorActions() {
41672
+ return this._cursorActions;
41673
+ }
41674
+ set cursorActions(actions) {
41675
+ this._cursorActions = actions ? [...actions] : [];
41676
+ this._core?.agenticCursorManager.refresh(this.id);
41677
+ }
41348
41678
  /** Same as `avatarUrl` (`IUpmadeUser`). */
41349
41679
  get profileImageUrl() {
41350
41680
  return this._avatarUrl;
@@ -41402,7 +41732,7 @@ var UpmadeAgent = class {
41402
41732
  };
41403
41733
  }
41404
41734
  // ─── Presence ───────────────────────────────────────────────────────────────
41405
- /** Shows a status message below the cursor label; `null` or `''` hides it. */
41735
+ /** Shows what the agent is doing in place of its name on the cursor label; `null` or `''` shows the name again. */
41406
41736
  setStatus(status) {
41407
41737
  this._status = status || null;
41408
41738
  this._core?.agenticCursorManager.refresh(this.id);
@@ -41428,6 +41758,9 @@ var UpmadeAgent = class {
41428
41758
  */
41429
41759
  async moveTo(target2, options = {}) {
41430
41760
  const core = this.requireCore();
41761
+ if (core.agentManager.isLeaving(this.id)) {
41762
+ return { completed: false };
41763
+ }
41431
41764
  return core.agenticCursorManager.move(this.id, target2, { ...options, speed: options.speed ?? this._speed });
41432
41765
  }
41433
41766
  /** Releases the cursor from the object it sticks to. It stays where it is. */
@@ -41446,6 +41779,9 @@ var UpmadeAgent = class {
41446
41779
  */
41447
41780
  async perform(action, options = {}) {
41448
41781
  const core = this.requireCore();
41782
+ if (core.agentManager.isLeaving(this.id)) {
41783
+ return { completed: false, reason: "agent-removed" };
41784
+ }
41449
41785
  const task = this._task;
41450
41786
  if (task?.cancelled) {
41451
41787
  return this.settle(action, { completed: false, reason: "aborted" }, task);
@@ -41471,7 +41807,10 @@ var UpmadeAgent = class {
41471
41807
  interactWithElement(target2, interaction, options = {}) {
41472
41808
  return this.perform({ type: "interactWithElement", target: target2, interaction }, options);
41473
41809
  }
41474
- /** Selects top-level objects for the agent. Never changes the user's selection. */
41810
+ /**
41811
+ * Selects top-level objects for the agent. Never changes the user's selection. The selection lasts while the agent
41812
+ * works on it: an action on anything outside it clears it, and objects an action creates become the selection.
41813
+ */
41475
41814
  select(objectIds, options = {}) {
41476
41815
  const { additive, ...actionOptions } = options;
41477
41816
  return this.perform({ type: "select", objectIds, ...additive !== void 0 ? { additive } : {} }, actionOptions);
@@ -41659,7 +41998,7 @@ var UpmadeAgent = class {
41659
41998
  listeners.add(listener);
41660
41999
  return () => listeners.delete(listener);
41661
42000
  }
41662
- /** How the agent is shown in avatar stacks and `agentsChange`. */
42001
+ /** How the agent is reported in `agentsChange`. */
41663
42002
  toPresence() {
41664
42003
  const state = this.state;
41665
42004
  return {
@@ -41673,6 +42012,7 @@ var UpmadeAgent = class {
41673
42012
  visible: state.visible,
41674
42013
  activeAction: state.activeAction,
41675
42014
  queueLength: state.queueLength,
42015
+ ...this._core?.agentManager.isLeaving(this.id) ? { isLeaving: true } : {},
41676
42016
  isRemote: false
41677
42017
  };
41678
42018
  }
@@ -41681,11 +42021,16 @@ var UpmadeAgent = class {
41681
42021
  get _owner() {
41682
42022
  return this._core;
41683
42023
  }
41684
- /** Creates the cursor in `core` and starts listening. Throws if the cursor can't be created. @internal */
42024
+ /**
42025
+ * Creates the cursor in `core` and starts listening. Returns whether the cursor starts behind the home (the chat box).
42026
+ * Throws if the cursor can't be created. @internal
42027
+ */
41685
42028
  _attach(core) {
41686
42029
  const initial = this._initialPosition;
41687
42030
  const start = initial && canStartAt(core, initial) ? core.agenticCursorManager.resolveTarget(initial) : null;
41688
- const position = start && Number.isFinite(start.x) && Number.isFinite(start.y) ? initial : void 0;
42031
+ const ownStart = start && Number.isFinite(start.x) && Number.isFinite(start.y) ? initial : void 0;
42032
+ const home = ownStart ? null : core.agentManager.getHomePoint(this.id);
42033
+ const position = ownStart ?? home ?? void 0;
41689
42034
  const agent2 = this;
41690
42035
  const cursor = {
41691
42036
  id: this.id,
@@ -41696,6 +42041,12 @@ var UpmadeAgent = class {
41696
42041
  get color() {
41697
42042
  return agent2._color;
41698
42043
  },
42044
+ get cursorIcon() {
42045
+ return agent2._cursorIcon;
42046
+ },
42047
+ get cursorActions() {
42048
+ return agent2._cursorActions;
42049
+ },
41699
42050
  get status() {
41700
42051
  return agent2._status;
41701
42052
  },
@@ -41742,6 +42093,7 @@ var UpmadeAgent = class {
41742
42093
  })
41743
42094
  ];
41744
42095
  this.notifyChange();
42096
+ return !!home;
41745
42097
  }
41746
42098
  /** Removes the cursor (its running action is rolled back) and stops listening. @internal */
41747
42099
  _detach() {
@@ -41757,6 +42109,10 @@ var UpmadeAgent = class {
41757
42109
  this.notifyChange();
41758
42110
  this.emit("removed", void 0);
41759
42111
  }
42112
+ /** Emits `'sent-home'`: the agent was sent back behind its chip and stopped working. @internal */
42113
+ _sentHome() {
42114
+ this.emit("sent-home", void 0);
42115
+ }
41760
42116
  // ─── Internals ──────────────────────────────────────────────────────────────
41761
42117
  setVisible(visible) {
41762
42118
  this._visible = visible;
@@ -41783,7 +42139,7 @@ var UpmadeAgent = class {
41783
42139
  }
41784
42140
  const state = this.state;
41785
42141
  const { position: _position, ...rest } = state;
41786
- const key = JSON.stringify([rest, this._name, this._color, this._avatarUrl, this._broadcast]);
42142
+ const key = JSON.stringify([rest, this._name, this._color, this._avatarUrl, this._cursorIcon, this._broadcast]);
41787
42143
  if (key === this._lastStateKey) {
41788
42144
  return;
41789
42145
  }
@@ -41806,6 +42162,14 @@ var UpmadeAgentManager = class {
41806
42162
  _changeListeners = /* @__PURE__ */ new Set();
41807
42163
  _changeScheduled = false;
41808
42164
  _disposed = false;
42165
+ /** Reports the boxes of the home agents come out from behind and go back behind (the editor's chat box), or `null`. */
42166
+ _homeRectProvider = null;
42167
+ /** Agents flying home before they are removed, with what resolves once they are gone and their flight. */
42168
+ _leaving = /* @__PURE__ */ new Map();
42169
+ /** Agents whose cursor waits behind their chip in the home, with the point it was put at last. */
42170
+ _parked = /* @__PURE__ */ new Map();
42171
+ /** Stops following the chips of parked agents every frame. */
42172
+ _stopFollowingChips = null;
41809
42173
  constructor(core) {
41810
42174
  this._core = core;
41811
42175
  }
@@ -41816,6 +42180,193 @@ var UpmadeAgentManager = class {
41816
42180
  /** Called by the engine when it disconnects (`true`) or connects (`false`). @internal */
41817
42181
  setDisposed(disposed) {
41818
42182
  this._disposed = disposed;
42183
+ if (disposed) {
42184
+ Array.from(this._leaving.keys()).forEach((id2) => this.finishLeaving(id2));
42185
+ }
42186
+ }
42187
+ // ─── Home ───────────────────────────────────────────────────────────────────
42188
+ /**
42189
+ * Reports the home agents come out from behind when added and go back behind when removed, e.g. the editor's chat
42190
+ * box: its box, or with an agent ID the box of that agent's chip in it. Agents appear at, and fly back to, the center
42191
+ * of their chip. `null` (the default) keeps agents appearing at the viewport center and disappearing where they are.
42192
+ */
42193
+ get homeRectProvider() {
42194
+ return this._homeRectProvider;
42195
+ }
42196
+ /**
42197
+ * Sets what reports the home's boxes, see `homeRectProvider`. The engine sets it from its `agentHome` element, so
42198
+ * that reading the DOM stays out of the core. @internal
42199
+ */
42200
+ setHomeRectProvider(provider) {
42201
+ this._homeRectProvider = provider ?? null;
42202
+ }
42203
+ /**
42204
+ * The home's box, relative to the engine's host element (the coordinates cursors are drawn in), or `null` when there
42205
+ * is no home or it is not shown. With `agentId`, the box of that agent's chip in the home when it shows, else the
42206
+ * home's box.
42207
+ */
42208
+ getHomeRect(agentId) {
42209
+ const rect = this._homeRectProvider?.(agentId) ?? null;
42210
+ if (!rect || !(rect.right > rect.left) || !(rect.bottom > rect.top)) {
42211
+ return null;
42212
+ }
42213
+ return { left: rect.left, top: rect.top, right: rect.right, bottom: rect.bottom };
42214
+ }
42215
+ /**
42216
+ * Where agents appear and leave, in world coordinates: the center of the agent's chip in the home, or of the home
42217
+ * while the chip doesn't show; `null` without a home.
42218
+ */
42219
+ getHomePoint(agentId) {
42220
+ const rect = this.getHomeRect(agentId);
42221
+ const state = this._core.store?.state;
42222
+ if (!rect || !state || !(state.scale > 0)) {
42223
+ return null;
42224
+ }
42225
+ const x2 = (rect.left + rect.right) / 2;
42226
+ const y2 = (rect.top + rect.bottom) / 2;
42227
+ return { x: (x2 - state.translateX) / state.scale, y: (y2 - state.translateY) / state.scale };
42228
+ }
42229
+ /**
42230
+ * Sends an agent back behind its chip in the home (in the editor: its chip above the chat box), e.g. with the "X" on
42231
+ * its cursor label. It stops working: its running action is rolled back, its queued actions and a running `task()`
42232
+ * end with `'aborted'`, and a chat session running a prompt for it stops (the agent emits `'sent-home'`). It lets go
42233
+ * of its selection and its cursor flies to the center of its chip, where it waits, hidden behind the home, until
42234
+ * its next action takes it straight to where that happens. The agent stays added: `remove()` removes it.
42235
+ * Returns `false`, and does nothing, without a home, for an agent that is not added and for one on its way out.
42236
+ */
42237
+ sendHome(agentOrId) {
42238
+ const id2 = typeof agentOrId === "string" ? agentOrId : agentOrId?.id;
42239
+ const agent2 = id2 !== void 0 ? this._agents.get(id2) : void 0;
42240
+ if (!agent2 || typeof agentOrId !== "string" && agentOrId !== agent2 || this._leaving.has(agent2.id) || this._disposed) {
42241
+ return false;
42242
+ }
42243
+ const cursors = this._core.agenticCursorManager;
42244
+ const home = cursors.get(agent2.id) ? this.getHomePoint(agent2.id) : null;
42245
+ if (!home) {
42246
+ return false;
42247
+ }
42248
+ const start = this.getIdleLabelPoint(agent2);
42249
+ agent2.cancel();
42250
+ this._core.agenticActionManager.setSelection(agent2.id, []);
42251
+ agent2._sentHome();
42252
+ this.flyHome(agent2, home, start);
42253
+ return true;
42254
+ }
42255
+ /**
42256
+ * Where an idle agent with a selection shows itself: its labels at the selection's top-left corner (its arrow is
42257
+ * hidden meanwhile). A flight home starts there rather than at the hidden arrow, e.g. at the far corner of the shape
42258
+ * it just drew. `null` for a busy agent, whose arrow shows, and for one without a selection.
42259
+ */
42260
+ getIdleLabelPoint(agent2) {
42261
+ const cursor = this._core.agenticCursorManager.get(agent2.id);
42262
+ const ids2 = this._core.agenticActionManager.getSelection(agent2.id);
42263
+ const objects = this._core.store?.objects;
42264
+ if (!cursor || cursor.isMoving || cursor.activeAction || cursor.queueLength > 0 || ids2.length === 0 || !objects) {
42265
+ return null;
42266
+ }
42267
+ const point2 = getSelectionLabelPoint(this._core, ids2.map((id2) => objects.findById(id2)));
42268
+ return point2 && Number.isFinite(point2.x) && Number.isFinite(point2.y) ? point2 : null;
42269
+ }
42270
+ /**
42271
+ * Flies an agent's cursor to its chip in the home and parks it there, unless a new action or move takes over on the
42272
+ * way. With `start`, the flight starts there (see `getIdleLabelPoint`).
42273
+ */
42274
+ flyHome(agent2, home, start) {
42275
+ this._parked.delete(agent2.id);
42276
+ const cursors = this._core.agenticCursorManager;
42277
+ if (start) {
42278
+ cursors.setPosition(agent2.id, start);
42279
+ }
42280
+ cursors.move(agent2.id, home, { speed: agent2.speed }).then((result) => {
42281
+ if (result.completed && this._agents.get(agent2.id) === agent2 && !this._leaving.has(agent2.id)) {
42282
+ this.park(agent2);
42283
+ }
42284
+ }).catch(() => void 0);
42285
+ }
42286
+ /** The user's selection as last seen, by its object IDs, to tell when it changes. */
42287
+ _userSelectionKey = "";
42288
+ /** Stops watching the user's selection. */
42289
+ _stopWatchingUserSelection = null;
42290
+ /** Watches the user's selection, once per frame while agents are added (frames run while their cursors exist). */
42291
+ watchUserSelection() {
42292
+ this._stopWatchingUserSelection ??= this._core.agenticCursorManager.onBeforeFrame(() => this.yieldToUserSelection());
42293
+ }
42294
+ /**
42295
+ * The user selected objects an agent has selected: the agent lets go of its selection and its cursor flies back to
42296
+ * its chip in the home, where it waits until its next action (without a home, it stays where it is). Unlike
42297
+ * `sendHome()`, the agent does not stop: a running action on those objects ends as the user took them over
42298
+ * (`'user-selected'`), and a chat session running a prompt for it goes on. Checked whenever the user's selection
42299
+ * changes, for the objects in it then.
42300
+ */
42301
+ yieldToUserSelection() {
42302
+ const ids2 = this._core.store.selectionGroup?.objectIds ?? [];
42303
+ const key = ids2.join("\0");
42304
+ if (key === this._userSelectionKey) {
42305
+ return;
42306
+ }
42307
+ this._userSelectionKey = key;
42308
+ if (ids2.length === 0 || this._disposed) {
42309
+ return;
42310
+ }
42311
+ const selected = new Set(ids2);
42312
+ const actions = this._core.agenticActionManager;
42313
+ for (const agent2 of this._agents.values()) {
42314
+ if (this._leaving.has(agent2.id) || !actions.getSelection(agent2.id).some((id2) => selected.has(id2))) {
42315
+ continue;
42316
+ }
42317
+ const start = this.getIdleLabelPoint(agent2);
42318
+ actions.setSelection(agent2.id, []);
42319
+ const home = this._core.agenticCursorManager.get(agent2.id) ? this.getHomePoint(agent2.id) : null;
42320
+ if (home && !this._parked.has(agent2.id)) {
42321
+ this.flyHome(agent2, home, start);
42322
+ }
42323
+ }
42324
+ }
42325
+ /** Whether the agent's cursor waits behind its chip in the home. */
42326
+ isHome(agentOrId) {
42327
+ return this._parked.has(typeof agentOrId === "string" ? agentOrId : agentOrId?.id);
42328
+ }
42329
+ /**
42330
+ * Keeps the agent's cursor on the center of its chip in the home, hidden behind it, also while the chip moves, the
42331
+ * view pans or zooms, or the chip only shows after the agent was added (the cursor waits at the home's center
42332
+ * until then). It stays until anything else moves the cursor, e.g. its next action.
42333
+ */
42334
+ park(agent2) {
42335
+ const cursors = this._core.agenticCursorManager;
42336
+ const cursor = cursors.get(agent2.id);
42337
+ if (!cursor) return;
42338
+ this._parked.set(agent2.id, { ...cursor.position });
42339
+ this._stopFollowingChips ??= cursors.onBeforeFrame(() => this.followChips());
42340
+ this.followChips();
42341
+ cursors.requestFrames();
42342
+ }
42343
+ /** Puts the cursors of parked agents on their chips; lets go of those that something else moved. */
42344
+ followChips() {
42345
+ const cursors = this._core.agenticCursorManager;
42346
+ this._parked.forEach((placed, id2) => {
42347
+ const cursor = cursors.get(id2);
42348
+ if (!cursor || !this._agents.has(id2) || this._leaving.has(id2) || cursor.isMoving || cursor.attachedTo || cursor.position.x !== placed.x || cursor.position.y !== placed.y) {
42349
+ this._parked.delete(id2);
42350
+ return;
42351
+ }
42352
+ const point2 = this.getHomePoint(id2);
42353
+ if (point2 && Number.isFinite(point2.x) && Number.isFinite(point2.y) && (point2.x !== placed.x || point2.y !== placed.y)) {
42354
+ cursors.setPosition(id2, point2);
42355
+ this._parked.set(id2, { x: point2.x, y: point2.y });
42356
+ }
42357
+ });
42358
+ if (this._parked.size === 0 && this._stopFollowingChips) {
42359
+ this._stopFollowingChips();
42360
+ this._stopFollowingChips = null;
42361
+ }
42362
+ }
42363
+ /** Whether the agent is flying home to be removed. */
42364
+ isLeaving(agentOrId) {
42365
+ return this._leaving.has(typeof agentOrId === "string" ? agentOrId : agentOrId?.id);
42366
+ }
42367
+ /** Resolves once the agent is removed (at once when it is not leaving). */
42368
+ whenRemoved(agentOrId) {
42369
+ return this._leaving.get(typeof agentOrId === "string" ? agentOrId : agentOrId?.id)?.done ?? Promise.resolve();
41819
42370
  }
41820
42371
  /**
41821
42372
  * Adds an agent and shows its cursor. Adding the same agent again does nothing.
@@ -41828,6 +42379,7 @@ var UpmadeAgentManager = class {
41828
42379
  }
41829
42380
  const existing = this._agents.get(agent2.id);
41830
42381
  if (existing === agent2) {
42382
+ this.stopLeaving(agent2.id);
41831
42383
  return agent2;
41832
42384
  }
41833
42385
  if (existing) {
@@ -41840,28 +42392,98 @@ var UpmadeAgentManager = class {
41840
42392
  }
41841
42393
  owner.agentManager.remove(agent2);
41842
42394
  }
41843
- agent2._attach(this._core);
42395
+ const startsAtHome = agent2._attach(this._core);
41844
42396
  this._agents.set(agent2.id, agent2);
41845
42397
  this._agentSubscriptions.set(agent2.id, agent2.on("change", () => this.scheduleChange()));
41846
42398
  this.scheduleChange();
42399
+ this.watchUserSelection();
42400
+ if (startsAtHome) {
42401
+ this.park(agent2);
42402
+ }
41847
42403
  return agent2;
41848
42404
  }
41849
42405
  /**
41850
- * Removes an agent: its running action is rolled back, queued actions resolve with `'agent-removed'`,
41851
- * and its cursor and history are dropped. Returns `false` if the agent was not added.
42406
+ * Removes an agent: its running action is rolled back, queued actions resolve with `'agent-removed'`, and its
42407
+ * cursor and history are dropped. An agent parked at its chip goes at once. Otherwise, with a home (the editor's
42408
+ * chat box), the cursor first flies back behind it, and
42409
+ * the agent is removed when it arrives (`whenRemoved()`); it accepts no actions meanwhile. `immediate` removes it at
42410
+ * once. Returns `false` if the agent was not added.
41852
42411
  */
41853
- remove(agentOrId) {
42412
+ remove(agentOrId, options = {}) {
41854
42413
  const id2 = typeof agentOrId === "string" ? agentOrId : agentOrId?.id;
41855
42414
  const agent2 = id2 !== void 0 ? this._agents.get(id2) : void 0;
41856
42415
  if (!agent2 || typeof agentOrId !== "string" && agentOrId !== agent2) {
41857
42416
  return false;
41858
42417
  }
42418
+ if (this._leaving.has(agent2.id)) {
42419
+ if (options.immediate) this.finishLeaving(agent2.id);
42420
+ return true;
42421
+ }
42422
+ const cursor = this._core.agenticCursorManager.get(agent2.id);
42423
+ const parked = this._parked.has(agent2.id) && !cursor?.isMoving;
42424
+ const home = !options.immediate && !this._disposed && !parked && cursor?.visible ? this.getHomePoint(agent2.id) : null;
42425
+ if (!home) {
42426
+ this.detach(agent2);
42427
+ return true;
42428
+ }
42429
+ let resolve;
42430
+ const done = new Promise((r3) => resolve = r3);
42431
+ const leaving = { done, resolve, target: home, flight: 0, stopFollowing: null };
42432
+ const start = this.getIdleLabelPoint(agent2);
42433
+ this._leaving.set(agent2.id, leaving);
42434
+ this._core.agenticActionManager.cancel(agent2.id, "agent-removed");
42435
+ this._core.agenticActionManager.setSelection(agent2.id, []);
42436
+ this.scheduleChange();
42437
+ this._parked.delete(agent2.id);
42438
+ const cursors = this._core.agenticCursorManager;
42439
+ if (start) {
42440
+ cursors.setPosition(agent2.id, start);
42441
+ }
42442
+ this.flyLeaving(agent2, leaving, home);
42443
+ leaving.stopFollowing = cursors.onBeforeFrame(() => {
42444
+ if (this._leaving.get(agent2.id) !== leaving) return;
42445
+ const point2 = this.getHomePoint(agent2.id);
42446
+ if (point2 && Number.isFinite(point2.x) && Number.isFinite(point2.y) && Math.hypot(point2.x - leaving.target.x, point2.y - leaving.target.y) > 0.5) {
42447
+ this.flyLeaving(agent2, leaving, point2);
42448
+ }
42449
+ });
42450
+ return true;
42451
+ }
42452
+ /** Flies a leaving agent's cursor to `target`, its chip, and removes the agent once it lands there. */
42453
+ flyLeaving(agent2, leaving, target2) {
42454
+ leaving.target = target2;
42455
+ const flight = ++leaving.flight;
42456
+ this._core.agenticCursorManager.move(agent2.id, target2, { speed: agent2.speed }).catch(() => void 0).then(() => {
42457
+ if (this._leaving.get(agent2.id) === leaving && leaving.flight === flight) this.finishLeaving(agent2.id);
42458
+ });
42459
+ }
42460
+ /** Removes an agent that was flying home, if it still is. */
42461
+ finishLeaving(id2) {
42462
+ const leaving = this._leaving.get(id2);
42463
+ if (!leaving) return;
42464
+ this._leaving.delete(id2);
42465
+ leaving.stopFollowing?.();
42466
+ const agent2 = this._agents.get(id2);
42467
+ if (agent2) this.detach(agent2);
42468
+ leaving.resolve();
42469
+ }
42470
+ /** Keeps an agent that was flying home. */
42471
+ stopLeaving(id2) {
42472
+ const leaving = this._leaving.get(id2);
42473
+ if (!leaving) return;
42474
+ this._leaving.delete(id2);
42475
+ leaving.stopFollowing?.();
42476
+ this._core.agenticCursorManager.stopAnimation(id2);
42477
+ this.scheduleChange();
42478
+ leaving.resolve();
42479
+ }
42480
+ detach(agent2) {
41859
42481
  this._agents.delete(agent2.id);
42482
+ this._parked.delete(agent2.id);
41860
42483
  this._agentSubscriptions.get(agent2.id)?.();
41861
42484
  this._agentSubscriptions.delete(agent2.id);
41862
42485
  agent2._detach();
41863
42486
  this.scheduleChange();
41864
- return true;
41865
42487
  }
41866
42488
  get(id2) {
41867
42489
  return this._agents.get(id2) ?? null;
@@ -41869,12 +42491,12 @@ var UpmadeAgentManager = class {
41869
42491
  getAll() {
41870
42492
  return Array.from(this._agents.values());
41871
42493
  }
41872
- /** The added agents as shown in the avatar stack. */
42494
+ /** The added agents as reported in `agentsChange`. */
41873
42495
  getPresences() {
41874
42496
  return this.getAll().map((agent2) => agent2.toPresence());
41875
42497
  }
41876
42498
  /**
41877
- * Subscribes to changes of the agent list and of what the avatar stack shows (name, color, avatar,
42499
+ * Subscribes to changes of the agent list and of what is shown of them (name, color, avatar,
41878
42500
  * status, visibility, activity). Coalesced to one call per microtask; never called for plain motion.
41879
42501
  */
41880
42502
  onChange(listener) {
@@ -41952,6 +42574,7 @@ var UpmadeAgentBroadcaster = class {
41952
42574
  name: agent2.name,
41953
42575
  color: cursor.color,
41954
42576
  ...agent2.avatarUrl ? { avatarUrl: agent2.avatarUrl } : {},
42577
+ ...cursor.cursorIcon ? { cursorIcon: cursor.cursorIcon } : {},
41955
42578
  status,
41956
42579
  visible: cursor.visible,
41957
42580
  activeAction: cursor.activeAction,
@@ -42018,7 +42641,7 @@ var UpmadeAgentBroadcaster = class {
42018
42641
  }
42019
42642
  };
42020
42643
  function structureOf(payload) {
42021
- return JSON.stringify(payload.map((agent2) => [agent2.id, agent2.name, agent2.color, agent2.avatarUrl ?? null, agent2.visible]));
42644
+ return JSON.stringify(payload.map((agent2) => [agent2.id, agent2.name, agent2.color, agent2.avatarUrl ?? null, agent2.cursorIcon ?? null, agent2.visible]));
42022
42645
  }
42023
42646
  __name(structureOf, "structureOf");
42024
42647
  function round2(value) {
@@ -42026,6 +42649,83 @@ function round2(value) {
42026
42649
  }
42027
42650
  __name(round2, "round");
42028
42651
 
42652
+ // src/helpers/viewport-overlay.helper.ts
42653
+ var UPMADE_CURSOR_ICON_MAX_LENGTH = 8192;
42654
+ var UpmadeViewportOverlayHelper = class _UpmadeViewportOverlayHelper {
42655
+ static {
42656
+ __name(this, "UpmadeViewportOverlayHelper");
42657
+ }
42658
+ static worldToScreen(state, worldX, worldY) {
42659
+ return {
42660
+ x: worldX * state.scale + state.translateX,
42661
+ y: worldY * state.scale + state.translateY
42662
+ };
42663
+ }
42664
+ static isInViewport(state, screenX, screenY) {
42665
+ return screenX >= 0 && screenX <= state.viewportWidth && screenY >= 0 && screenY <= state.viewportHeight;
42666
+ }
42667
+ /** Clamps an off-screen point to the viewport edge, returning the nearest edge and the direction to the point. */
42668
+ static clampToEdge(state, screenX, screenY, padding) {
42669
+ const { viewportWidth, viewportHeight } = state;
42670
+ const clampedX = Math.max(padding, Math.min(viewportWidth - padding, screenX));
42671
+ const clampedY = Math.max(padding, Math.min(viewportHeight - padding, screenY));
42672
+ const distLeft = clampedX - padding;
42673
+ const distRight = viewportWidth - padding - clampedX;
42674
+ const distTop = clampedY - padding;
42675
+ const distBottom = viewportHeight - padding - clampedY;
42676
+ let edge = "top";
42677
+ const minDist = Math.min(distLeft, distRight, distTop, distBottom);
42678
+ if (minDist === distLeft) edge = "left";
42679
+ else if (minDist === distRight) edge = "right";
42680
+ else if (minDist === distTop) edge = "top";
42681
+ else edge = "bottom";
42682
+ const angle = Math.atan2(screenY - clampedY, screenX - clampedX);
42683
+ return { x: clampedX, y: clampedY, angle, edge };
42684
+ }
42685
+ static getInitials(name) {
42686
+ const parts = name.trim().split(/\s+/);
42687
+ if (parts.length === 0 || parts.length === 1 && parts[0].length <= 1) {
42688
+ return name;
42689
+ }
42690
+ if (parts.length === 1) {
42691
+ return parts[0][0].toUpperCase();
42692
+ }
42693
+ return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
42694
+ }
42695
+ /**
42696
+ * The image source of a cursor icon (`IUpmadeUser.cursorIcon`, `UpmadeAgentOptions.cursorIcon`), or `null` when
42697
+ * there is none or it is not usable. SVG markup becomes a `data:` URL; image URLs are accepted when they are
42698
+ * http(s), `data:image/` or relative. Icons are always drawn as images, never as markup, so an icon that comes
42699
+ * from a collaborator cannot run scripts or reach the page.
42700
+ */
42701
+ static getCursorIconSrc(icon) {
42702
+ if (typeof icon !== "string") {
42703
+ return null;
42704
+ }
42705
+ const value = icon.trim();
42706
+ if (value.length === 0 || value.length > UPMADE_CURSOR_ICON_MAX_LENGTH) {
42707
+ return null;
42708
+ }
42709
+ if (value.startsWith("<")) {
42710
+ const svgTag = /<svg\b[^>]*>/i.exec(value);
42711
+ if (!svgTag) {
42712
+ return null;
42713
+ }
42714
+ const markup = /\sxmlns\s*=/i.test(svgTag[0]) ? value : value.slice(0, svgTag.index) + svgTag[0].replace(/^<svg\b/i, '<svg xmlns="http://www.w3.org/2000/svg"') + value.slice(svgTag.index + svgTag[0].length);
42715
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(markup)}`;
42716
+ }
42717
+ return _UpmadeViewportOverlayHelper.isSafeImageUrl(value, UPMADE_CURSOR_ICON_MAX_LENGTH) ? value : null;
42718
+ }
42719
+ /** Whether a URL is http(s), `data:image/` or relative, so a collaborator cannot point images at other schemes. */
42720
+ static isSafeImageUrl(value, maxLength = 2048) {
42721
+ if (typeof value !== "string" || value.length === 0 || value.length > maxLength) {
42722
+ return false;
42723
+ }
42724
+ const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(value.trim())?.[1]?.toLowerCase();
42725
+ return scheme === void 0 || scheme === "http" || scheme === "https" || scheme === "data" && /^data:image\//i.test(value.trim());
42726
+ }
42727
+ };
42728
+
42029
42729
  // src/classes/managers/remote-agent.manager.ts
42030
42730
  var MAX_NAME_LENGTH = 100;
42031
42731
  var UpmadeRemoteAgentManager = class {
@@ -42101,6 +42801,7 @@ var UpmadeRemoteAgentManager = class {
42101
42801
  name: entry.agent.name,
42102
42802
  color: entry.agent.color,
42103
42803
  ...entry.agent.avatarUrl ? { avatarUrl: entry.agent.avatarUrl } : {},
42804
+ ...entry.agent.cursorIcon ? { cursorIcon: entry.agent.cursorIcon } : {},
42104
42805
  status: entry.agent.status ?? void 0,
42105
42806
  visible: entry.agent.visible,
42106
42807
  position: { ...entry.rendered },
@@ -42115,7 +42816,7 @@ var UpmadeRemoteAgentManager = class {
42115
42816
  canRedo: false
42116
42817
  }));
42117
42818
  }
42118
- /** Remote agents as shown in avatar stacks. */
42819
+ /** Remote agents as reported in `agentsChange`. */
42119
42820
  getPresences() {
42120
42821
  return Array.from(this._entries.values()).map((entry) => ({
42121
42822
  id: entry.agent.id,
@@ -42140,7 +42841,7 @@ var UpmadeRemoteAgentManager = class {
42140
42841
  isClaimed(objectId, kind) {
42141
42842
  return this._claimed.has(objectId) || kind === "target" && this._selected.has(objectId);
42142
42843
  }
42143
- /** Subscribes to structural changes (agents added or removed, name, color, status, activity, selection). */
42844
+ /** Subscribes to structural changes (agents added or removed, name, color, icon, status, activity, selection). */
42144
42845
  onChange(listener) {
42145
42846
  this._changeListeners.add(listener);
42146
42847
  return () => this._changeListeners.delete(listener);
@@ -42240,7 +42941,9 @@ function parseAgent(raw) {
42240
42941
  id: value["id"].slice(0, MAX_NAME_LENGTH),
42241
42942
  name: value["name"].slice(0, MAX_NAME_LENGTH),
42242
42943
  color: value["color"].slice(0, MAX_NAME_LENGTH),
42243
- ...isSafeImageUrl(value["avatarUrl"]) ? { avatarUrl: value["avatarUrl"] } : {},
42944
+ ...UpmadeViewportOverlayHelper.isSafeImageUrl(value["avatarUrl"]) ? { avatarUrl: value["avatarUrl"] } : {},
42945
+ // Only icons the overlay can draw (as an image, never as markup).
42946
+ ...UpmadeViewportOverlayHelper.getCursorIconSrc(value["cursorIcon"]) ? { cursorIcon: value["cursorIcon"] } : {},
42244
42947
  status: typeof value["status"] === "string" && value["status"] ? value["status"].slice(0, AGENT_BROADCAST_MAX_STATUS_LENGTH) : null,
42245
42948
  visible: value["visible"] !== false,
42246
42949
  activeAction: typeof value["activeAction"] === "string" ? value["activeAction"] : null,
@@ -42290,14 +42993,6 @@ function parseHostUser(raw) {
42290
42993
  };
42291
42994
  }
42292
42995
  __name(parseHostUser, "parseHostUser");
42293
- function isSafeImageUrl(value) {
42294
- if (typeof value !== "string" || value.length === 0 || value.length > 2048) {
42295
- return false;
42296
- }
42297
- const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(value.trim())?.[1]?.toLowerCase();
42298
- return scheme === void 0 || scheme === "http" || scheme === "https" || scheme === "data" && /^data:image\//i.test(value.trim());
42299
- }
42300
- __name(isSafeImageUrl, "isSafeImageUrl");
42301
42996
 
42302
42997
  // src/interfaces/chat-session.interface.ts
42303
42998
  var UPMADE_CHAT_PROTOCOL_VERSION = 1;
@@ -42788,6 +43483,12 @@ var DEFAULT_MAX_STEPS = 25;
42788
43483
  var DEFAULT_THINKING_STATUS = "Thinking\u2026";
42789
43484
  var STOPPED_OUTPUT = JSON.stringify({ completed: false, reason: "aborted", hint: "The user stopped the response. Do not retry unless asked." });
42790
43485
  var INTERRUPTED_OUTPUT = JSON.stringify({ completed: false, reason: "aborted", hint: "The tool call was interrupted and did not run." });
43486
+ var BLOCKED_OUTPUT = JSON.stringify({
43487
+ completed: false,
43488
+ reason: "aborted",
43489
+ hint: "Not run: an earlier call met objects the user is working on, so the response ended there."
43490
+ });
43491
+ var BLOCKING_REASONS = /* @__PURE__ */ new Set(["user-selected", "user-interaction"]);
42791
43492
  var busyAgents = /* @__PURE__ */ new WeakSet();
42792
43493
  var busyCores = /* @__PURE__ */ new WeakSet();
42793
43494
  function isUpmadeChatSession(value) {
@@ -42803,7 +43504,7 @@ var RunEnd = class {
42803
43504
  __name(this, "RunEnd");
42804
43505
  }
42805
43506
  };
42806
- var UpmadeChatSession = class {
43507
+ var UpmadeChatSession = class _UpmadeChatSession {
42807
43508
  static {
42808
43509
  __name(this, "UpmadeChatSession");
42809
43510
  }
@@ -42825,6 +43526,8 @@ var UpmadeChatSession = class {
42825
43526
  _pendingDetach = false;
42826
43527
  /** Why the running prompt was ended from outside. */
42827
43528
  _endReason = null;
43529
+ /** Sessions of `forAgent()`, per agent ID. They are bound wherever this session is. */
43530
+ _agentSessions = /* @__PURE__ */ new Map();
42828
43531
  _listeners = /* @__PURE__ */ new Map();
42829
43532
  constructor(options) {
42830
43533
  if (!options || typeof options.transport !== "function") {
@@ -42922,6 +43625,42 @@ var UpmadeChatSession = class {
42922
43625
  stop() {
42923
43626
  this.endRun("stopped");
42924
43627
  }
43628
+ /**
43629
+ * A session in which the model acts as `agent`: it has this session's options (transport, system, context, tools,
43630
+ * canvas tools, steps, instant, thinking status, eager tool calls) but its own conversation, which starts empty or
43631
+ * with `options.messages` (used only when the session is created, e.g. to restore it from `messages`).
43632
+ * The same agent always gets the same session, so each agent keeps its conversation; this session's own agent gets
43633
+ * this session. Agents are told apart by ID: for a new instance of an agent (e.g. added again after it was removed),
43634
+ * a new session replaces the earlier one (which is unbound) and continues its conversation. It is bound to
43635
+ * whichever editor this session is bound to, and unbound with it (a running prompt then ends with `'detached'`).
43636
+ * Creating one emits `'agent-session'`; `agentSessions` lists them. The editor uses it to run a prompt sent with
43637
+ * an agent chip.
43638
+ */
43639
+ forAgent(agent2, options = {}) {
43640
+ if (agent2 === this._options.agent) {
43641
+ return this;
43642
+ }
43643
+ const earlier = this._agentSessions.get(agent2.id);
43644
+ if (earlier?.agent === agent2) {
43645
+ return earlier;
43646
+ }
43647
+ earlier?._detach();
43648
+ const { messages: _messages, ...parentOptions } = this._options;
43649
+ const session = new _UpmadeChatSession({ ...parentOptions, agent: agent2, messages: options.messages ?? (earlier ? [...earlier.messages] : []) });
43650
+ this._agentSessions.set(agent2.id, session);
43651
+ if (this._core) {
43652
+ session._attach(this._core);
43653
+ if (this._pendingDetach) {
43654
+ session._detachWhenIdle();
43655
+ }
43656
+ }
43657
+ this.emit("agent-session", session);
43658
+ return session;
43659
+ }
43660
+ /** The sessions of `forAgent()`, one per agent ID. Subscribe to `'agent-session'` to hear of new ones. */
43661
+ get agentSessions() {
43662
+ return Array.from(this._agentSessions.values());
43663
+ }
42925
43664
  /** Subscribes to an event; returns a function that unsubscribes. */
42926
43665
  on(event, listener) {
42927
43666
  let listeners = this._listeners.get(event);
@@ -42947,18 +43686,32 @@ var UpmadeChatSession = class {
42947
43686
  /** Binds the session to an editor core. Working as the user, it registers its actor there. @internal */
42948
43687
  _attach(core) {
42949
43688
  this._pendingDetach = false;
42950
- if (this._core === core) {
42951
- return;
42952
- }
42953
- this._detach();
42954
- this._core = core;
42955
- if (!this._options.agent) {
42956
- this._userActor = new UpmadeUserActor();
42957
- this._userActor._attach(core);
43689
+ if (this._core !== core) {
43690
+ this._detach();
43691
+ this._core = core;
43692
+ if (!this._options.agent) {
43693
+ this._userActor = new UpmadeUserActor();
43694
+ this._userActor._attach(core);
43695
+ }
42958
43696
  }
43697
+ this._agentSessions.forEach((session) => session._attach(core));
42959
43698
  }
42960
- /** Unbinds the session: a running prompt ends with `'detached'`. @internal */
43699
+ /** Unbinds the session and its `forAgent()` sessions: running prompts end with `'detached'`. @internal */
42961
43700
  _detach() {
43701
+ this._agentSessions.forEach((session) => session._detach());
43702
+ this.detachSelf();
43703
+ }
43704
+ /** Unbinds the session and its `forAgent()` sessions, each once its running prompt ends (right away when idle). @internal */
43705
+ _detachWhenIdle() {
43706
+ this._agentSessions.forEach((session) => session._detachWhenIdle());
43707
+ if (!this._running) {
43708
+ this.detachSelf();
43709
+ return;
43710
+ }
43711
+ this._pendingDetach = true;
43712
+ }
43713
+ detachSelf() {
43714
+ this._pendingDetach = false;
42962
43715
  if (!this._core) {
42963
43716
  return;
42964
43717
  }
@@ -42967,14 +43720,6 @@ var UpmadeChatSession = class {
42967
43720
  this._userActor = null;
42968
43721
  this._core = null;
42969
43722
  }
42970
- /** Unbinds the session once its running prompt ends (right away when idle). @internal */
42971
- _detachWhenIdle() {
42972
- if (!this._running) {
42973
- this._detach();
42974
- return;
42975
- }
42976
- this._pendingDetach = true;
42977
- }
42978
43723
  // ─── Loop ───────────────────────────────────────────────────────────────────
42979
43724
  /** Ends the running prompt: the abort reaches the transport and the running action, which is rolled back. */
42980
43725
  endRun(reason) {
@@ -42984,7 +43729,7 @@ var UpmadeChatSession = class {
42984
43729
  this._endReason ??= reason;
42985
43730
  this._abort.abort();
42986
43731
  }
42987
- /** Ends the run when the workspace goes away or the agent is removed. */
43732
+ /** Ends the run when the workspace goes away or the agent is removed, and stops it when the agent is sent home. */
42988
43733
  watchRun(core) {
42989
43734
  const unsubscribers = [];
42990
43735
  const map = core.store?.objects;
@@ -42994,6 +43739,7 @@ var UpmadeChatSession = class {
42994
43739
  const agent2 = this._options.agent;
42995
43740
  if (agent2) {
42996
43741
  unsubscribers.push(agent2.on("removed", () => this.endRun("detached")));
43742
+ unsubscribers.push(agent2.on("sent-home", () => this.endRun("stopped")));
42997
43743
  }
42998
43744
  return () => unsubscribers.forEach((unsubscribe) => unsubscribe());
42999
43745
  }
@@ -43017,7 +43763,14 @@ var UpmadeChatSession = class {
43017
43763
  stoppedOutput: STOPPED_OUTPUT,
43018
43764
  interruptedOutput: INTERRUPTED_OUTPUT,
43019
43765
  report: /* @__PURE__ */ __name((update) => this.emit("tool-call", update), "report"),
43020
- run: /* @__PURE__ */ __name((call, onRunning, handle) => this.runCall(call, byName, signal, onRunning, handle), "run"),
43766
+ run: /* @__PURE__ */ __name(async (call, onRunning, handle) => {
43767
+ const outcome = await this.runCall(call, byName, signal, onRunning, handle);
43768
+ if (this._options.agent && isBlockedByUser(outcome.result.output)) {
43769
+ answer.halt(BLOCKED_OUTPUT);
43770
+ this.endRun("blocked");
43771
+ }
43772
+ return outcome;
43773
+ }, "run"),
43021
43774
  begin: /* @__PURE__ */ __name((call) => {
43022
43775
  const tool = byName.get(call.name);
43023
43776
  return tool?.begin ? tool.begin({ signal, toolCallId: call.id }) : null;
@@ -43228,8 +43981,7 @@ var UpmadeChatSession = class {
43228
43981
  const waiters = this._idleWaiters.splice(0);
43229
43982
  waiters.forEach((resolve) => resolve());
43230
43983
  if (this._pendingDetach) {
43231
- this._pendingDetach = false;
43232
- this._detach();
43984
+ this.detachSelf();
43233
43985
  }
43234
43986
  }
43235
43987
  emit(event, payload) {
@@ -43255,7 +44007,7 @@ function toUserMessage(input) {
43255
44007
  }
43256
44008
  __name(toUserMessage, "toUserMessage");
43257
44009
  function describeChips(chips) {
43258
- const lines = chips.map((chip) => {
44010
+ const lines = chips.filter((chip) => !chip.agentId).map((chip) => {
43259
44011
  const name = chip.detail ? `${chip.label} \u203A ${chip.detail}` : chip.label;
43260
44012
  const refs = [chip.objectId ? `objectId: ${chip.objectId}` : null, chip.selector ? `element: ${chip.selector}` : null].filter(Boolean);
43261
44013
  return `- ${name}${refs.length > 0 ? ` (${refs.join(", ")})` : ""}`;
@@ -43302,6 +44054,18 @@ function isAsyncIterable(value) {
43302
44054
  return typeof value === "object" && value !== null && typeof value[Symbol.asyncIterator] === "function";
43303
44055
  }
43304
44056
  __name(isAsyncIterable, "isAsyncIterable");
44057
+ function isBlockedByUser(output) {
44058
+ if (typeof output !== "string" || !output.includes('"reason"')) {
44059
+ return false;
44060
+ }
44061
+ try {
44062
+ const parsed = JSON.parse(output);
44063
+ return parsed?.completed === false && typeof parsed.reason === "string" && BLOCKING_REASONS.has(parsed.reason);
44064
+ } catch {
44065
+ return false;
44066
+ }
44067
+ }
44068
+ __name(isBlockedByUser, "isBlockedByUser");
43305
44069
 
43306
44070
  // src/classes/chat/scripted-transport.ts
43307
44071
  function createScriptedTransport(steps, options = {}) {
@@ -43788,7 +44552,7 @@ var CURRENT_APP_STATE_SCHEMA_VERSION = 2;
43788
44552
  var CURRENT_WORKSPACE_SCHEMA_VERSION = 3;
43789
44553
 
43790
44554
  // src/constants/version.ts
43791
- var UPMADE_VERSION = "0.6.2";
44555
+ var UPMADE_VERSION = "0.7.0-preview.0";
43792
44556
 
43793
44557
  // src/configs/default-engine-config.ts
43794
44558
  var DEFAULT_ENGINE_CONFIG = {
@@ -44424,6 +45188,7 @@ var UpmadeAgentOrigin = class {
44424
45188
  };
44425
45189
 
44426
45190
  // src/classes/structures/object-map.structure.ts
45191
+ var USER_STATUS_MAX_LENGTH = 200;
44427
45192
  var UpmadeObjectMap = class _UpmadeObjectMap {
44428
45193
  static {
44429
45194
  __name(this, "UpmadeObjectMap");
@@ -44619,9 +45384,20 @@ var UpmadeObjectMap = class _UpmadeObjectMap {
44619
45384
  this._awareness.setLocalStateField("user", {
44620
45385
  id: user.id,
44621
45386
  displayName,
44622
- color: user.color || UpmadeUserColorHelper.generateColorFromName(displayName)
45387
+ color: user.color || UpmadeUserColorHelper.generateColorFromName(displayName),
45388
+ ...UpmadeViewportOverlayHelper.getCursorIconSrc(user.cursorIcon) ? { cursorIcon: user.cursorIcon } : {}
44623
45389
  });
44624
45390
  }
45391
+ /**
45392
+ * Shares what the local user is doing (e.g. `'typing…'`) with collaborators, who see it in place of the user's
45393
+ * name on their cursor label (awareness field `status`). `null` or `''` removes it. Cut to 200 characters.
45394
+ */
45395
+ setLocalStatus(status) {
45396
+ if (!this._awareness || this._headless) {
45397
+ return;
45398
+ }
45399
+ this._awareness.setLocalStateField("status", status ? status.slice(0, USER_STATUS_MAX_LENGTH) : null);
45400
+ }
44625
45401
  /**
44626
45402
  * Shares the agents of this client with collaborators (awareness field `agents`); `null` or an
44627
45403
  * empty list removes the field. No-op without awareness and for background maps.
@@ -45392,6 +46168,40 @@ var UpmadeObjectMap = class _UpmadeObjectMap {
45392
46168
  }
45393
46169
  }
45394
46170
  }
46171
+ /**
46172
+ * Removes an object the local user started but did not finish, as if it had never been made,
46173
+ * e.g. a brush stroke whose first finger turned out to be the start of a pinch-zoom.
46174
+ *
46175
+ * Unlike `remove()`, which records the removal as an undo step of its own (so undo would bring
46176
+ * the half-made object back), the deletion joins the still open undo step that recorded the
46177
+ * object's insertion. Yjs never restores what was created and deleted in the same step. If that
46178
+ * step holds nothing else, it is dropped, so the next undo reverts the user's previous action.
46179
+ *
46180
+ * @param objectId - The ID of the object to discard
46181
+ */
46182
+ discard(objectId) {
46183
+ if (!this._idMap.has(objectId)) {
46184
+ return;
46185
+ }
46186
+ this.quadtree.remove((o3) => o3.id === objectId);
46187
+ this._idMap.delete(objectId);
46188
+ if (this._localActiveDrawingObjectId === objectId) {
46189
+ this._localActiveDrawingObjectId = null;
46190
+ }
46191
+ if (this._objectsMap?.has(objectId)) {
46192
+ const undoManager = this._undoManager;
46193
+ const stackLength = undoManager?.undoStack.length ?? 0;
46194
+ const origin = this.writeOrigin;
46195
+ this._ydoc?.transact(() => {
46196
+ this._objectsMap?.delete(objectId);
46197
+ }, origin);
46198
+ const top = undoManager?.undoStack[stackLength - 1];
46199
+ if (undoManager && top && origin === "local" && this._transactionDepth === 0 && this._temporaryItemsCount === 0 && undoManager.undoStack.length === stackLength && Y5.equalDeleteSets(top.insertions, top.deletions)) {
46200
+ undoManager.undoStack.pop();
46201
+ }
46202
+ }
46203
+ this.markUndoBoundary();
46204
+ }
45395
46205
  /**
45396
46206
  * Filters objects in the quadtree based on a predicate function.
45397
46207
  *
@@ -47417,6 +48227,7 @@ var UpmadeEasingHelper = class _UpmadeEasingHelper {
47417
48227
  var AGENTIC_CURSOR_DEFAULT_SPEED = 1200;
47418
48228
  var AGENTIC_CURSOR_MIN_DURATION = 250;
47419
48229
  var AGENTIC_CURSOR_MAX_DURATION = 1200;
48230
+ var UPMADE_AGENTIC_CURSOR_NOTICE_MS = 4e3;
47420
48231
  var UpmadeAgenticCursorManager = class {
47421
48232
  static {
47422
48233
  __name(this, "UpmadeAgenticCursorManager");
@@ -47431,6 +48242,8 @@ var UpmadeAgenticCursorManager = class {
47431
48242
  _historyProvider = null;
47432
48243
  _frameDemand = null;
47433
48244
  _rafId = null;
48245
+ /** The last notice key handed out. */
48246
+ _noticeKey = 0;
47434
48247
  constructor(core) {
47435
48248
  this._core = core;
47436
48249
  }
@@ -47472,7 +48285,8 @@ var UpmadeAgenticCursorManager = class {
47472
48285
  hostMoveGeneration: 0,
47473
48286
  trackedElement,
47474
48287
  moveToken: 0,
47475
- cancelLookup: null
48288
+ cancelLookup: null,
48289
+ notice: null
47476
48290
  };
47477
48291
  this._cursors.set(id2, entry);
47478
48292
  this.emitChange(id2);
@@ -47579,6 +48393,25 @@ var UpmadeAgenticCursorManager = class {
47579
48393
  entry.queueLength = queueLength;
47580
48394
  this.emitChange(id2);
47581
48395
  }
48396
+ /**
48397
+ * Shows on the agent's label why it could not do what it was about to, e.g. that the user has the object selected, for
48398
+ * `UPMADE_AGENTIC_CURSOR_NOTICE_MS`; `null` clears it. Each notice gets a new `key`, so the label draws attention to
48399
+ * it again, also for the same reason. @internal
48400
+ */
48401
+ setNotice(id2, notice) {
48402
+ const entry = this._cursors.get(id2);
48403
+ if (!entry) return;
48404
+ clearTimeout(entry.noticeTimer);
48405
+ entry.noticeTimer = void 0;
48406
+ if (!notice) {
48407
+ if (!entry.notice) return;
48408
+ entry.notice = null;
48409
+ } else {
48410
+ entry.notice = { reason: notice.reason, objectIds: [...notice.objectIds], key: ++this._noticeKey };
48411
+ entry.noticeTimer = setTimeout(() => this.setNotice(id2, null), UPMADE_AGENTIC_CURSOR_NOTICE_MS);
48412
+ }
48413
+ this.emitChange(id2);
48414
+ }
47582
48415
  /** Sets the provider of `canUndo` / `canRedo` for snapshots. @internal */
47583
48416
  setHistoryProvider(provider) {
47584
48417
  this._historyProvider = provider;
@@ -47600,6 +48433,7 @@ var UpmadeAgenticCursorManager = class {
47600
48433
  this.supersede(entry);
47601
48434
  this.finishAnimation(entry, false);
47602
48435
  this.setTrackedElement(entry, null);
48436
+ clearTimeout(entry.noticeTimer);
47603
48437
  this._cursors.delete(id2);
47604
48438
  this.emitChange(id2);
47605
48439
  if (!this.needsFrames()) this.stopLoop();
@@ -47756,6 +48590,7 @@ var UpmadeAgenticCursorManager = class {
47756
48590
  /** Stops the animation loop and resolves pending moves. Cursors are kept. */
47757
48591
  cleanup() {
47758
48592
  this._cursors.forEach((entry) => {
48593
+ clearTimeout(entry.noticeTimer);
47759
48594
  this.supersede(entry);
47760
48595
  this.finishAnimation(entry, false);
47761
48596
  this.releaseUnattachedElement(entry);
@@ -47968,8 +48803,10 @@ var UpmadeAgenticCursorManager = class {
47968
48803
  id: entry.id,
47969
48804
  name: entry.appearance.name,
47970
48805
  color: entry.appearance.color,
48806
+ ...entry.appearance.cursorIcon ? { cursorIcon: entry.appearance.cursorIcon } : {},
47971
48807
  status: entry.appearance.status || void 0,
47972
48808
  visible: entry.appearance.visible,
48809
+ ...entry.appearance.cursorActions?.length ? { cursorActions: [...entry.appearance.cursorActions] } : {},
47973
48810
  position: { ...entry.position },
47974
48811
  attachedTo: entry.attachedTo ? { ...entry.attachedTo, offset: { ...entry.attachedTo.offset } } : null,
47975
48812
  isMoving: entry.animation !== null,
@@ -47979,7 +48816,8 @@ var UpmadeAgenticCursorManager = class {
47979
48816
  activeAction: entry.activeAction,
47980
48817
  queueLength: entry.queueLength,
47981
48818
  canUndo: history.canUndo,
47982
- canRedo: history.canRedo
48819
+ canRedo: history.canRedo,
48820
+ ...entry.notice ? { notice: { ...entry.notice, objectIds: [...entry.notice.objectIds] } } : {}
47983
48821
  };
47984
48822
  }
47985
48823
  emitChange(id2) {
@@ -48073,6 +48911,23 @@ var UpmadeAgenticActionRun = class {
48073
48911
  applyingHistory = false;
48074
48912
  /** An abort that arrived while `applyingHistory` was set. */
48075
48913
  heldAbort = null;
48914
+ /**
48915
+ * Agents: whether the action works outside the agent's selection, so its first press clears the selection,
48916
+ * like a person's click elsewhere. Decided when the action starts.
48917
+ */
48918
+ deselectOnPress = false;
48919
+ /**
48920
+ * Agents: the explicit selection the action cleared on its first press; restored if the action ends without
48921
+ * keeping changes. `null` when the action left the selection alone.
48922
+ */
48923
+ clearedSelection = null;
48924
+ /** Whether the cursor has pressed in this run. */
48925
+ hasPressed = false;
48926
+ /**
48927
+ * Whether `displayIds` are shown as selected. Like a person's selection, they show once the cursor presses on
48928
+ * the objects (not while it flies there), or when the executor shows objects on purpose (`display()`).
48929
+ */
48930
+ displaying = false;
48076
48931
  /** Whether the action changed anything. */
48077
48932
  hasMutated = false;
48078
48933
  /** Whether the outcome is decided. */
@@ -48268,10 +49123,15 @@ var UpmadeAgenticActionRun = class {
48268
49123
  this.stop("agent-moved");
48269
49124
  }
48270
49125
  }
48271
- /** Presses the cursor, after re-checking for conflicts. */
49126
+ /** Presses the cursor, after re-checking for conflicts. The first press shows the targets as selected. */
48272
49127
  async press() {
48273
49128
  this.assertActive();
48274
49129
  this.host.checkpoint(this);
49130
+ if (!this.hasPressed) {
49131
+ this.hasPressed = true;
49132
+ this.displaying = true;
49133
+ this.host.handleFirstPress(this);
49134
+ }
48275
49135
  if (this.instant) {
48276
49136
  return;
48277
49137
  }
@@ -48383,6 +49243,7 @@ var UpmadeAgenticActionRun = class {
48383
49243
  /** Shows other objects as selected while the action runs, e.g. a group once it is created. */
48384
49244
  display(objectIds) {
48385
49245
  this.displayIds = [...objectIds];
49246
+ this.displaying = true;
48386
49247
  this.host.showSelection(this.cursorId);
48387
49248
  }
48388
49249
  /** Replaces objects in the agent's selection, e.g. grouped objects by their group. Others stay selected. */
@@ -48445,6 +49306,7 @@ var UpmadeAgenticActionRun = class {
48445
49306
  };
48446
49307
 
48447
49308
  // src/classes/managers/agentic-action.manager.ts
49309
+ var SELECTION_RULE_EXEMPT_ACTIONS = /* @__PURE__ */ new Set(["select", "clearSelection", "undo", "redo"]);
48448
49310
  var KEEP_REASONS = /* @__PURE__ */ new Set(["user-selected", "user-interaction"]);
48449
49311
  var SILENT_REASONS = /* @__PURE__ */ new Set(["workspace-changed", "engine-disconnected"]);
48450
49312
  var UpmadeAgenticActionManager = class {
@@ -48632,6 +49494,15 @@ var UpmadeAgenticActionManager = class {
48632
49494
  }
48633
49495
  run.settled = true;
48634
49496
  const cursors = this._core.agenticCursorManager;
49497
+ if (run.actorKind === "agent" && outcome.kind === "abort" && (outcome.reason === "user-selected" || outcome.reason === "user-interaction")) {
49498
+ const notice = { reason: outcome.reason, objectIds: outcome.objectIds ?? [] };
49499
+ if (!run.executing && notice.objectIds.length > 0 && cursors.resolveTarget({ objectId: notice.objectIds[0] })) {
49500
+ const cursorId = run.cursorId;
49501
+ void cursors.fly(cursorId, { objectId: notice.objectIds[0] }, { speed: run.options.speed, attach: false, ...run.instant ? { duration: 0 } : {} }).then((result) => result.completed && cursors.setNotice(cursorId, notice));
49502
+ } else {
49503
+ cursors.setNotice(run.cursorId, notice);
49504
+ }
49505
+ }
48635
49506
  if (run.isFlying && cursors.getHostMoveGeneration(run.cursorId) === run.hostMoveGeneration) {
48636
49507
  cursors.stopAnimation(run.cursorId);
48637
49508
  }
@@ -48651,6 +49522,7 @@ var UpmadeAgenticActionManager = class {
48651
49522
  const reason = outcome.kind === "abort" ? outcome.reason : null;
48652
49523
  const keep = outcome.kind === "commit" || reason !== null && KEEP_REASONS.has(reason);
48653
49524
  let events = null;
49525
+ const createdIds = /* @__PURE__ */ new Set();
48654
49526
  try {
48655
49527
  if (run.hasMutated && run.origin && map && map.isReady) {
48656
49528
  const canWrite = !map.isInsideYjsCallback;
@@ -48660,6 +49532,9 @@ var UpmadeAgenticActionManager = class {
48660
49532
  if (keep) {
48661
49533
  map.stopAgentCapturing(run.cursorId);
48662
49534
  const recording = run.origin.takeRecording();
49535
+ recording.forEach((existedBefore, id2) => {
49536
+ if (!existedBefore) createdIds.add(id2);
49537
+ });
48663
49538
  if (map.getAgentUndoStackLength(run.cursorId) > run.undoLengthAtStart) {
48664
49539
  map.tagLastAgentStackItem(run.cursorId, Array.from(recording.keys()).filter((id2) => !run.selectionObjectIds.has(id2)));
48665
49540
  if (run.actorKind === "user") {
@@ -48692,6 +49567,13 @@ var UpmadeAgenticActionManager = class {
48692
49567
  run.suspendedRedo = null;
48693
49568
  }
48694
49569
  run.runSettleHooks();
49570
+ if (outcome.kind === "commit") {
49571
+ if (run.deselectOnPress) this.applyDeselect(run);
49572
+ this.selectCreatedObjects(run, map, outcome.objectIds, createdIds);
49573
+ } else if (run.clearedSelection && !(keep && run.hasMutated) && this.getSelection(run.cursorId).length === 0) {
49574
+ const existing = map ? run.clearedSelection.filter((id2) => !!map.findById(id2) && !this.isClaimedByOther(id2, run.cursorId, "target")) : [];
49575
+ if (existing.length > 0) this.setSelection(run.cursorId, existing);
49576
+ }
48695
49577
  if (outcome.kind === "commit" && run.finalAttachment) {
48696
49578
  cursors.attach(run.cursorId, run.finalAttachment);
48697
49579
  }
@@ -48824,6 +49706,7 @@ var UpmadeAgenticActionManager = class {
48824
49706
  }
48825
49707
  run.map = map;
48826
49708
  this.bindMap(map);
49709
+ cursors.setNotice(run.cursorId, null);
48827
49710
  run.hostMoveGeneration = cursors.getHostMoveGeneration(run.cursorId);
48828
49711
  cursors.stopAnimation(run.cursorId);
48829
49712
  this.updateActivity(run.cursorId);
@@ -48863,6 +49746,7 @@ var UpmadeAgenticActionManager = class {
48863
49746
  const object2 = map.findById(id2);
48864
49747
  if (object2) run.knownInstances.set(id2, object2);
48865
49748
  });
49749
+ this.deselectIfWorkingElsewhere(run, preparation);
48866
49750
  this.showSelection(run.cursorId);
48867
49751
  const objectIds = await run.executor.execute(run, run.action);
48868
49752
  if (!run.settled) {
@@ -49040,9 +49924,70 @@ var UpmadeAgenticActionManager = class {
49040
49924
  showSelection(cursorId) {
49041
49925
  const explicit = this._selections.get(cursorId)?.ids ?? [];
49042
49926
  const running = this._running.get(cursorId);
49043
- const shown = running && !running.settled && running.executing ? [...explicit, ...running.displayIds] : [...explicit];
49927
+ const shown = running && !running.settled && running.executing && running.displaying ? [...explicit, ...running.displayIds] : [...explicit];
49044
49928
  this._core.agenticCursorManager.setSelectedObjectIds(cursorId, Array.from(new Set(shown)));
49045
49929
  }
49930
+ // ─── Selection rule ─────────────────────────────────────────────────────────
49931
+ //
49932
+ // An agent's selection lasts as long as the agent works on it, like a person's:
49933
+ // - an action on objects that are all in the selection keeps it (move, resize, style, type into it, click it);
49934
+ // - an action on anything else, or one that creates objects (on empty canvas), clears it when its cursor first
49935
+ // presses, like a click elsewhere; if the action then keeps nothing, the selection comes back;
49936
+ // - a `select` that replaces the selection clears the old one on its press too, and shows the new one;
49937
+ // - an action that creates objects selects them once it completes (copies, a new group, a drawn shape or line);
49938
+ // - `select`, `clearSelection`, `undo` and `redo` manage the selection themselves; moving the cursor never changes it.
49939
+ // Actors working as the user don't follow the rule: their selection is the user's own.
49940
+ /** Decides, as the action starts, whether its first press clears the agent's selection: when it works outside it. */
49941
+ deselectIfWorkingElsewhere(run, preparation) {
49942
+ if (run.actorKind !== "agent") return;
49943
+ const selection = this._selections.get(run.cursorId);
49944
+ if (!selection) return;
49945
+ if (run.action.type === "select") {
49946
+ run.deselectOnPress = !run.action.additive;
49947
+ return;
49948
+ }
49949
+ if (SELECTION_RULE_EXEMPT_ACTIONS.has(run.action.type)) return;
49950
+ if (run.action.type === "interactWithElement" && (run.action.interaction.type === "hover" || run.action.interaction.type === "scroll")) return;
49951
+ const touched = this.getTouchedObjectIds(run, preparation);
49952
+ if (touched.length > 0 && touched.every((id2) => selection.expanded.has(id2))) return;
49953
+ run.deselectOnPress = true;
49954
+ }
49955
+ /** The run's cursor pressed for the first time: a pending deselect applies, and its targets show as selected. @internal */
49956
+ handleFirstPress(run) {
49957
+ if (run.deselectOnPress) {
49958
+ this.applyDeselect(run);
49959
+ }
49960
+ this.showSelection(run.cursorId);
49961
+ }
49962
+ /** Clears the agent's selection for a run working elsewhere, remembering it in case the run keeps nothing. */
49963
+ applyDeselect(run) {
49964
+ run.deselectOnPress = false;
49965
+ const ids2 = this.getSelection(run.cursorId);
49966
+ if (ids2.length === 0) return;
49967
+ run.clearedSelection = ids2;
49968
+ this.setSelection(run.cursorId, []);
49969
+ }
49970
+ /** The objects an action works on, for the selection rule. */
49971
+ getTouchedObjectIds(run, preparation) {
49972
+ if (preparation.targetIds.length > 0) return preparation.targetIds;
49973
+ if (preparation.checkLevel !== "existence") return [];
49974
+ const action = run.action;
49975
+ if (action.type === "click" && !isElementTarget(action.target) && !isObjectTarget(action.target) && run.map) {
49976
+ const hit = hitTestTopMost(run.map, action.target);
49977
+ return hit ? [hit.id] : [];
49978
+ }
49979
+ return preparation.referenceIds;
49980
+ }
49981
+ /** Makes the top-level objects a completed agent action created its selection. */
49982
+ selectCreatedObjects(run, map, objectIds, createdIds) {
49983
+ if (run.actorKind !== "agent" || SELECTION_RULE_EXEMPT_ACTIONS.has(run.action.type) || !map || createdIds.size === 0) return;
49984
+ const created = objectIds.filter((id2) => {
49985
+ if (!createdIds.has(id2)) return false;
49986
+ const object2 = map.findById(id2);
49987
+ return !!object2 && !isSelectionObject(object2) && isTopLevel(map, id2);
49988
+ });
49989
+ if (created.length > 0) this.setSelection(run.cursorId, created);
49990
+ }
49046
49991
  /** Drops deleted objects from explicit selections. */
49047
49992
  pruneSelections() {
49048
49993
  if (this._selections.size === 0) {
@@ -49295,6 +50240,7 @@ var UpmadeCore = class {
49295
50240
  _editorId;
49296
50241
  /** Current user for awareness broadcasting */
49297
50242
  _user;
50243
+ _userStatus = null;
49298
50244
  /**
49299
50245
  * Gets the Upmade engine instance.
49300
50246
  * @returns The engine component managing rendering and events
@@ -49444,6 +50390,18 @@ var UpmadeCore = class {
49444
50390
  this._store.setLocalUserId(user?.id ?? null);
49445
50391
  this._store.objects?.setLocalUser(user);
49446
50392
  }
50393
+ /** What the current user is doing, as collaborators see it on the user's cursor label; `null` when nothing. */
50394
+ get userStatus() {
50395
+ return this._userStatus;
50396
+ }
50397
+ /**
50398
+ * Shows what the current user is doing (e.g. `'typing…'` or a message) to collaborators: their editors show it
50399
+ * in place of the user's name on the cursor label, like an agent's status. `null` or `''` shows the name again.
50400
+ */
50401
+ setUserStatus(status) {
50402
+ this._userStatus = status || null;
50403
+ this._store.objects?.setLocalStatus(this._userStatus);
50404
+ }
49447
50405
  /**
49448
50406
  * Creates a new UpmadeCore instance.
49449
50407
  * Initializes the store with default configuration and sets up all managers.
@@ -49623,6 +50581,9 @@ var UpmadeCore = class {
49623
50581
  if (this._user) {
49624
50582
  objectsMap.setLocalUser(this._user);
49625
50583
  }
50584
+ if (this._userStatus) {
50585
+ objectsMap.setLocalStatus(this._userStatus);
50586
+ }
49626
50587
  this._remoteAgentManager.clear();
49627
50588
  this._agentBroadcaster.reset();
49628
50589
  objectsMap.onAwarenessChange((states) => {
@@ -51075,9 +52036,10 @@ var UpmadeViewport = class _UpmadeViewport {
51075
52036
  }
51076
52037
  if (activePointers.length === 2) {
51077
52038
  this._core.store.objects?.clearCursorPosition();
51078
- const currentPath = this._core.store.currentPath;
51079
- if (currentPath) {
51080
- this._core.store.objects.remove((obj) => obj.id === currentPath.id);
52039
+ const drawingObjectId = this._core.store.objects?.localActiveDrawingObjectId;
52040
+ const drawingObject = drawingObjectId ? this._core.store.objects.findById(drawingObjectId) : void 0;
52041
+ if (drawingObject instanceof UpmadePath) {
52042
+ this._core.store.objects.discard(drawingObject.id);
51081
52043
  }
51082
52044
  if (this._core.store.state.isSelecting) {
51083
52045
  this._core.store.state.isSelecting = false;
@@ -52674,49 +53636,29 @@ var UpmadeSvgExportHelper = class {
52674
53636
  }
52675
53637
  };
52676
53638
 
52677
- // src/helpers/viewport-overlay.helper.ts
52678
- var UpmadeViewportOverlayHelper = class {
52679
- static {
52680
- __name(this, "UpmadeViewportOverlayHelper");
52681
- }
52682
- static worldToScreen(state, worldX, worldY) {
52683
- return {
52684
- x: worldX * state.scale + state.translateX,
52685
- y: worldY * state.scale + state.translateY
52686
- };
52687
- }
52688
- static isInViewport(state, screenX, screenY) {
52689
- return screenX >= 0 && screenX <= state.viewportWidth && screenY >= 0 && screenY <= state.viewportHeight;
52690
- }
52691
- /** Clamps an off-screen point to the viewport edge, returning the nearest edge and the direction to the point. */
52692
- static clampToEdge(state, screenX, screenY, padding) {
52693
- const { viewportWidth, viewportHeight } = state;
52694
- const clampedX = Math.max(padding, Math.min(viewportWidth - padding, screenX));
52695
- const clampedY = Math.max(padding, Math.min(viewportHeight - padding, screenY));
52696
- const distLeft = clampedX - padding;
52697
- const distRight = viewportWidth - padding - clampedX;
52698
- const distTop = clampedY - padding;
52699
- const distBottom = viewportHeight - padding - clampedY;
52700
- let edge = "top";
52701
- const minDist = Math.min(distLeft, distRight, distTop, distBottom);
52702
- if (minDist === distLeft) edge = "left";
52703
- else if (minDist === distRight) edge = "right";
52704
- else if (minDist === distTop) edge = "top";
52705
- else edge = "bottom";
52706
- const angle = Math.atan2(screenY - clampedY, screenX - clampedX);
52707
- return { x: clampedX, y: clampedY, angle, edge };
52708
- }
52709
- static getInitials(name) {
52710
- const parts = name.trim().split(/\s+/);
52711
- if (parts.length === 0 || parts.length === 1 && parts[0].length <= 1) {
52712
- return name;
52713
- }
52714
- if (parts.length === 1) {
52715
- return parts[0][0].toUpperCase();
53639
+ // src/helpers/cursor-label-action.helper.ts
53640
+ var UPMADE_OVERLAY_CONTROL_ATTRIBUTE = "data-upmade-overlay-control";
53641
+ function isOverlayControlEvent(event) {
53642
+ return (event.composedPath?.() ?? []).some(
53643
+ (target2) => typeof target2.hasAttribute === "function" && target2.hasAttribute(UPMADE_OVERLAY_CONTROL_ATTRIBUTE)
53644
+ );
53645
+ }
53646
+ __name(isOverlayControlEvent, "isOverlayControlEvent");
53647
+ function runCursorLabelAction(core, action, event) {
53648
+ try {
53649
+ if (action.onClick) {
53650
+ action.onClick(event);
53651
+ } else if (event.cursorKind === "agent" && event.agentId && action.id === UPMADE_REMOVE_AGENT_CURSOR_ACTION.id) {
53652
+ if (!core.agentManager.sendHome(event.agentId)) {
53653
+ core.agentManager.remove(event.agentId);
53654
+ }
52716
53655
  }
52717
- return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
53656
+ } catch (error) {
53657
+ console.error("[Upmade] A cursor label action failed:", error);
52718
53658
  }
52719
- };
53659
+ core.engine?.emitCursorLabelAction?.(event);
53660
+ }
53661
+ __name(runCursorLabelAction, "runCursorLabelAction");
52720
53662
 
52721
53663
  // src/helpers/wheel.helper.ts
52722
53664
  var UpmadeWheelHelper = class {