@upmade/core 0.6.3 → 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 (79) hide show
  1. package/dist/cjs/index.cjs +1105 -207
  2. package/dist/cjs/index.cjs.map +4 -4
  3. package/dist/esm/index.mjs +1105 -207
  4. package/dist/esm/index.mjs.map +4 -4
  5. package/dist/types/classes/agent/agent-tool-schemas.d.ts.map +1 -1
  6. package/dist/types/classes/agent/agent.class.d.ts +28 -5
  7. package/dist/types/classes/agent/agent.class.d.ts.map +1 -1
  8. package/dist/types/classes/chat/chat-session.class.d.ts +22 -3
  9. package/dist/types/classes/chat/chat-session.class.d.ts.map +1 -1
  10. package/dist/types/classes/core/core.class.d.ts +8 -0
  11. package/dist/types/classes/core/core.class.d.ts.map +1 -1
  12. package/dist/types/classes/managers/agent-broadcast.manager.d.ts +1 -1
  13. package/dist/types/classes/managers/agent-broadcast.manager.d.ts.map +1 -1
  14. package/dist/types/classes/managers/agent.manager.d.ts +99 -6
  15. package/dist/types/classes/managers/agent.manager.d.ts.map +1 -1
  16. package/dist/types/classes/managers/agentic-action-run.class.d.ts +20 -1
  17. package/dist/types/classes/managers/agentic-action-run.class.d.ts.map +1 -1
  18. package/dist/types/classes/managers/agentic-action.manager.d.ts +10 -0
  19. package/dist/types/classes/managers/agentic-action.manager.d.ts.map +1 -1
  20. package/dist/types/classes/managers/agentic-cursor.manager.d.ts +11 -1
  21. package/dist/types/classes/managers/agentic-cursor.manager.d.ts.map +1 -1
  22. package/dist/types/classes/managers/object-config.manager.d.ts +4 -3
  23. package/dist/types/classes/managers/object-config.manager.d.ts.map +1 -1
  24. package/dist/types/classes/managers/object-titlebar.manager.d.ts +23 -1
  25. package/dist/types/classes/managers/object-titlebar.manager.d.ts.map +1 -1
  26. package/dist/types/classes/managers/remote-agent.manager.d.ts +2 -2
  27. package/dist/types/classes/managers/remote-agent.manager.d.ts.map +1 -1
  28. package/dist/types/classes/registries/icon-registry.class.d.ts +3 -0
  29. package/dist/types/classes/registries/icon-registry.class.d.ts.map +1 -1
  30. package/dist/types/classes/structures/object-map.structure.d.ts +5 -1
  31. package/dist/types/classes/structures/object-map.structure.d.ts.map +1 -1
  32. package/dist/types/constants/version.d.ts +1 -1
  33. package/dist/types/constants/version.d.ts.map +1 -1
  34. package/dist/types/helpers/cursor-label-action.helper.d.ts +15 -0
  35. package/dist/types/helpers/cursor-label-action.helper.d.ts.map +1 -0
  36. package/dist/types/helpers/object-config.helper.d.ts +11 -0
  37. package/dist/types/helpers/object-config.helper.d.ts.map +1 -0
  38. package/dist/types/helpers/object-titlebar.helper.d.ts +8 -0
  39. package/dist/types/helpers/object-titlebar.helper.d.ts.map +1 -1
  40. package/dist/types/helpers/selection-label.helper.d.ts +15 -0
  41. package/dist/types/helpers/selection-label.helper.d.ts.map +1 -0
  42. package/dist/types/helpers/viewport-overlay.helper.d.ts +14 -0
  43. package/dist/types/helpers/viewport-overlay.helper.d.ts.map +1 -1
  44. package/dist/types/index.d.ts +4 -0
  45. package/dist/types/index.d.ts.map +1 -1
  46. package/dist/types/interfaces/agent.interface.d.ts +46 -4
  47. package/dist/types/interfaces/agent.interface.d.ts.map +1 -1
  48. package/dist/types/interfaces/agentic-cursor.interface.d.ts +21 -1
  49. package/dist/types/interfaces/agentic-cursor.interface.d.ts.map +1 -1
  50. package/dist/types/interfaces/chat-box.interface.d.ts +23 -4
  51. package/dist/types/interfaces/chat-box.interface.d.ts.map +1 -1
  52. package/dist/types/interfaces/chat-session.interface.d.ts +10 -2
  53. package/dist/types/interfaces/chat-session.interface.d.ts.map +1 -1
  54. package/dist/types/interfaces/cursor-label.interface.d.ts +43 -0
  55. package/dist/types/interfaces/cursor-label.interface.d.ts.map +1 -0
  56. package/dist/types/interfaces/engine-host.interface.d.ts +4 -0
  57. package/dist/types/interfaces/engine-host.interface.d.ts.map +1 -1
  58. package/dist/types/interfaces/localization.interface.d.ts +22 -0
  59. package/dist/types/interfaces/localization.interface.d.ts.map +1 -1
  60. package/dist/types/interfaces/menu-item.interface.d.ts +9 -0
  61. package/dist/types/interfaces/menu-item.interface.d.ts.map +1 -1
  62. package/dist/types/interfaces/object-config.interface.d.ts +6 -0
  63. package/dist/types/interfaces/object-config.interface.d.ts.map +1 -1
  64. package/dist/types/interfaces/remote-cursor.interface.d.ts +2 -0
  65. package/dist/types/interfaces/remote-cursor.interface.d.ts.map +1 -1
  66. package/dist/types/interfaces/theme.interface.d.ts +22 -2
  67. package/dist/types/interfaces/theme.interface.d.ts.map +1 -1
  68. package/dist/types/interfaces/user.interface.d.ts +6 -0
  69. package/dist/types/interfaces/user.interface.d.ts.map +1 -1
  70. package/dist/types/locales/de-locale.d.ts.map +1 -1
  71. package/dist/types/locales/en-locale.d.ts.map +1 -1
  72. package/dist/types/locales/es-locale.d.ts.map +1 -1
  73. package/dist/types/locales/fr-locale.d.ts.map +1 -1
  74. package/dist/types/locales/it-locale.d.ts.map +1 -1
  75. package/dist/types/locales/nl-locale.d.ts.map +1 -1
  76. package/dist/types/locales/pl-locale.d.ts.map +1 -1
  77. package/dist/types/locales/pt-locale.d.ts.map +1 -1
  78. package/dist/types/themes/light-theme.d.ts.map +1 -1
  79. package/package.json +2 -2
@@ -14013,6 +14013,9 @@ var lightTheme = {
14013
14013
  focusRingColor: "#333333",
14014
14014
  fontFamily: "sans-serif",
14015
14015
  iconColor: "currentColor",
14016
+ primaryColor: "#0a0a0a",
14017
+ primaryHoverColor: "#2a2a2a",
14018
+ primaryTextColor: "#ffffff",
14016
14019
  scrollbarThumbColor: "#ebebeb",
14017
14020
  textPrimary: "#000000",
14018
14021
  textSecondary: "#333333"
@@ -14023,12 +14026,12 @@ var lightTheme = {
14023
14026
  tabBackgroundHover: "rgba(0, 0, 0, 0.05)",
14024
14027
  tabBackgroundSelected: "#ffffff",
14025
14028
  tabLabelMaxWidth: "10rem",
14026
- tabShadowSelected: "0 1px 3px rgba(0, 0, 0, 0.1)",
14029
+ tabShadowSelected: "0 1px 2px rgba(16, 16, 24, 0.08), 0 2px 6px rgba(16, 16, 24, 0.06)",
14027
14030
  tabTextColor: "#666666",
14028
14031
  tabTextColorSelected: "#000000"
14029
14032
  },
14030
14033
  text: {
14031
- selectionBackgroundColor: "#007AFF",
14034
+ selectionBackgroundColor: "#FF6AB5",
14032
14035
  selectionColor: "#ffffff"
14033
14036
  },
14034
14037
  textInput: {
@@ -14039,18 +14042,18 @@ var lightTheme = {
14039
14042
  hoverBorderColor: "#cccccc",
14040
14043
  labelColor: "#333333",
14041
14044
  placeholderColor: "#999999",
14042
- selectionBackground: "#007AFF",
14045
+ selectionBackground: "#FF6AB5",
14043
14046
  selectionColor: "#ffffff",
14044
14047
  suffixBackground: "#f5f5f5",
14045
14048
  suffixColor: "#666666",
14046
14049
  textColor: "#333333"
14047
14050
  },
14048
14051
  selection: {
14049
- borderColor: "#007AFF",
14050
- boxBackgroundColor: "rgba(0, 122, 255, 0.2)",
14051
- boxBorderColor: "rgba(0, 122, 255, 0.5)",
14052
+ borderColor: "#FF6AB5",
14053
+ boxBackgroundColor: "rgba(255, 106, 181, 0.2)",
14054
+ boxBorderColor: "rgba(255, 106, 181, 0.5)",
14052
14055
  handleColor: "#ffffff",
14053
- handleStrokeColor: "#007AFF"
14056
+ handleStrokeColor: "#FF6AB5"
14054
14057
  },
14055
14058
  checkerboard: {
14056
14059
  colorDark: "#cccccc",
@@ -14060,7 +14063,7 @@ var lightTheme = {
14060
14063
  activeBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14061
14064
  backgroundColor: "#ffffff",
14062
14065
  border: "1px solid #ebebeb",
14063
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14066
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14064
14067
  color: "#000000",
14065
14068
  hoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)"
14066
14069
  },
@@ -14072,7 +14075,7 @@ var lightTheme = {
14072
14075
  contextMenu: {
14073
14076
  backgroundColor: "#ffffff",
14074
14077
  border: "1px solid #ebebeb",
14075
- boxShadow: "0 1px 6px rgba(0, 0, 0, 0.12)",
14078
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14076
14079
  dividerColor: "rgba(0, 0, 0, 0.1)",
14077
14080
  itemActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14078
14081
  itemColor: "#333333",
@@ -14082,23 +14085,34 @@ var lightTheme = {
14082
14085
  toolbar: {
14083
14086
  backgroundColor: "#ffffff",
14084
14087
  border: "1px solid #ebebeb",
14085
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14088
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14086
14089
  controlActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14087
14090
  controlColor: "#000000",
14088
14091
  controlHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14089
- controlSelectedBackgroundColor: "#007AFF",
14092
+ controlSelectedBackgroundColor: "#0a0a0a",
14090
14093
  controlSelectedColor: "#ffffff",
14091
14094
  separatorColor: "#ebebeb"
14092
14095
  },
14096
+ button: {
14097
+ primaryActiveBackgroundColor: "#000000",
14098
+ primaryBackgroundColor: "#0a0a0a",
14099
+ primaryHoverBackgroundColor: "#2a2a2a",
14100
+ textActiveBackgroundColor: "rgba(0, 0, 0, 0.1)",
14101
+ textColor: "#0a0a0a",
14102
+ textHoverBackgroundColor: "rgba(0, 0, 0, 0.05)"
14103
+ },
14093
14104
  currentUserDialog: {
14094
14105
  emailColor: "#666666",
14106
+ logoutButtonActiveBackgroundColor: "#000000",
14107
+ logoutButtonBackgroundColor: "#0a0a0a",
14108
+ logoutButtonHoverBackgroundColor: "#2a2a2a",
14095
14109
  nameColor: "#333333"
14096
14110
  },
14097
14111
  dialog: {
14098
14112
  backdropColor: "rgba(0, 0, 0, 0.4)",
14099
14113
  backgroundColor: "#ffffff",
14100
14114
  border: "1px solid #ebebeb",
14101
- boxShadow: "0 4px 24px rgba(0, 0, 0, 0.15)",
14115
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 14px 36px rgba(16, 16, 24, 0.12)",
14102
14116
  closeButtonActiveBackground: "hsl(0, 0%, 0%, 8.6%)",
14103
14117
  closeButtonBackground: "transparent",
14104
14118
  closeButtonColor: "#333333",
@@ -14110,7 +14124,7 @@ var lightTheme = {
14110
14124
  },
14111
14125
  object: {
14112
14126
  borderRadius: "12px",
14113
- boxShadow: "0 1px 2px rgba(20, 18, 31, 0.06), 0 12px 32px -12px rgba(20, 18, 31, 0.22)"
14127
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 14px 36px rgba(16, 16, 24, 0.12)"
14114
14128
  },
14115
14129
  objectAppear: {
14116
14130
  animationDuration: "600ms",
@@ -14119,7 +14133,7 @@ var lightTheme = {
14119
14133
  stagger: "110ms"
14120
14134
  },
14121
14135
  image: {
14122
- dropShadow: "drop-shadow(0 1px 1px rgba(20, 18, 31, 0.06)) drop-shadow(0 8px 12px rgba(20, 18, 31, 0.14))"
14136
+ dropShadow: "drop-shadow(0 1px 2px rgba(16, 16, 24, 0.04)) drop-shadow(0 14px 36px rgba(16, 16, 24, 0.12))"
14123
14137
  },
14124
14138
  loadingPlaceholder: {
14125
14139
  animationDuration: "1.6s",
@@ -14138,29 +14152,29 @@ var lightTheme = {
14138
14152
  subtitleColor: "#666666"
14139
14153
  },
14140
14154
  dropdown: {
14141
- accentColor: "#007bff",
14155
+ accentColor: "#0a0a0a",
14142
14156
  background: "#ffffff",
14143
14157
  borderColor: "#dbdbdb",
14144
14158
  borderRadius: "6px",
14145
14159
  hoverBorderColor: "#cccccc",
14146
14160
  hoverBackgroundColor: "#f0f0f0",
14147
14161
  menuBorderRadius: "6px",
14148
- selectedBackgroundColor: "#007bff1a",
14162
+ selectedBackgroundColor: "rgba(0, 0, 0, 0.06)",
14149
14163
  textColor: "#333333"
14150
14164
  },
14151
14165
  elementHighlight: {
14152
- backgroundColor: "rgba(0, 122, 255, 0.12)",
14153
- color: "#007AFF",
14166
+ backgroundColor: "rgba(255, 106, 181, 0.12)",
14167
+ color: "#FF6AB5",
14154
14168
  labelTextColor: "#ffffff"
14155
14169
  },
14156
14170
  engine: {
14157
14171
  backgroundColor: "#ffffff"
14158
14172
  },
14159
14173
  snap: {
14160
- indicatorFill: "rgba(59, 130, 246, 0.3)",
14161
- indicatorFillInactive: "rgba(59, 130, 246, 0.18)",
14162
- indicatorStroke: "#007bff",
14163
- indicatorStrokeInactive: "rgba(59, 130, 246, 0.5)",
14174
+ indicatorFill: "rgba(255, 106, 181, 0.3)",
14175
+ indicatorFillInactive: "rgba(255, 106, 181, 0.18)",
14176
+ indicatorStroke: "#FF6AB5",
14177
+ indicatorStrokeInactive: "rgba(255, 106, 181, 0.5)",
14164
14178
  lineStroke: "rgba(0, 0, 0, 0.2)"
14165
14179
  },
14166
14180
  fontSize: {
@@ -14188,14 +14202,14 @@ var lightTheme = {
14188
14202
  menuItemDisabledColor: "#aaaaaa",
14189
14203
  menuItemFocusOutline: "2px solid #333333",
14190
14204
  menuItemHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14191
- menuItemSelectedBackgroundColor: "#007AFF",
14205
+ menuItemSelectedBackgroundColor: "#0a0a0a",
14192
14206
  menuItemSelectedColor: "#ffffff",
14193
- menuItemSelectedHoverBackgroundColor: "#007AFF"
14207
+ menuItemSelectedHoverBackgroundColor: "#0a0a0a"
14194
14208
  },
14195
14209
  menu: {
14196
14210
  backgroundColor: "#ffffff",
14197
14211
  border: "1px solid #ebebeb",
14198
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14212
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14199
14213
  itemButtonHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14200
14214
  itemChildOpenBackgroundColor: "hsl(0, 0%, 0%, 3%)",
14201
14215
  itemColor: "#333333",
@@ -14204,19 +14218,19 @@ var lightTheme = {
14204
14218
  itemInputBorderColorOnSelected: "#ffffff",
14205
14219
  itemInputCaretColor: "#333333",
14206
14220
  itemInputCaretColorOnSelected: "#ffffff",
14207
- itemInputSelectionColor: "#007aff",
14221
+ itemInputSelectionColor: "#FF6AB5",
14208
14222
  itemInputSelectionColorOnSelected: "rgba(255, 255, 255, 0.55)",
14209
14223
  itemInputSelectionTextColor: "#ffffff",
14210
14224
  itemInputSelectionTextColorOnSelected: "#ffffff",
14211
14225
  itemOverlayBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14212
- itemSelectedBackgroundColor: "#007aff",
14226
+ itemSelectedBackgroundColor: "#0a0a0a",
14213
14227
  itemSelectedColor: "#ffffff"
14214
14228
  },
14215
14229
  moreMenu: {
14216
14230
  backgroundColor: "#ffffff",
14217
14231
  border: "1px solid #ebebeb",
14218
14232
  borderRadius: "12px",
14219
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14233
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14220
14234
  buttonActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14221
14235
  buttonColor: "#000000",
14222
14236
  buttonHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
@@ -14226,7 +14240,7 @@ var lightTheme = {
14226
14240
  backgroundColor: "#ffffff",
14227
14241
  border: "1px solid #e5e7eb",
14228
14242
  borderRadius: "12px",
14229
- boxShadow: "0 8px 20px rgba(15, 23, 42, 0.08)",
14243
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14230
14244
  color: "#111827",
14231
14245
  dismissButtonActiveBackgroundColor: "#e5e7eb",
14232
14246
  dismissButtonBackgroundColor: "transparent",
@@ -14265,7 +14279,7 @@ var lightTheme = {
14265
14279
  hoverBorderColor: "#cccccc",
14266
14280
  inputBackground: "#ffffff",
14267
14281
  labelColor: "#666666",
14268
- selectionBackground: "#007AFF",
14282
+ selectionBackground: "#FF6AB5",
14269
14283
  selectionColor: "#ffffff",
14270
14284
  spinnerActiveBackground: "hsl(0, 0%, 0%, 8.6%)",
14271
14285
  spinnerBackground: "transparent",
@@ -14275,8 +14289,8 @@ var lightTheme = {
14275
14289
  textColor: "#333333"
14276
14290
  },
14277
14291
  opacitySlider: {
14278
- activeColor: "#007AFF",
14279
- thumbBorderColor: "#007AFF",
14292
+ activeColor: "#0a0a0a",
14293
+ thumbBorderColor: "#0a0a0a",
14280
14294
  thumbColor: "#ffffff",
14281
14295
  trackColor: "#e0e0e0"
14282
14296
  },
@@ -14312,18 +14326,18 @@ var lightTheme = {
14312
14326
  revokeButtonColor: "#dc3545",
14313
14327
  revokeButtonHoverBackground: "#dc3545",
14314
14328
  revokeButtonHoverColor: "#ffffff",
14315
- selectionColor: "#cce5ff"
14329
+ selectionColor: "#ffd6eb"
14316
14330
  },
14317
14331
  slideToggle: {
14318
14332
  thumbColor: "#fff",
14319
14333
  thumbSize: "18px",
14320
- trackCheckedColor: "#007AFF",
14334
+ trackCheckedColor: "#0a0a0a",
14321
14335
  trackColor: "#ccc"
14322
14336
  },
14323
14337
  splitButton: {
14324
14338
  backgroundColor: "#ffffff",
14325
14339
  border: "1px solid #ebebeb",
14326
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14340
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14327
14341
  color: "#000000",
14328
14342
  dividerBackgroundColor: "#ebebeb",
14329
14343
  hoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)"
@@ -14335,7 +14349,7 @@ var lightTheme = {
14335
14349
  tooltip: {
14336
14350
  backgroundColor: "#ffffff",
14337
14351
  border: "1px solid #ebebeb",
14338
- boxShadow: "0 1px 6px rgba(0, 0, 0, 0.12)",
14352
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14339
14353
  color: "#000000"
14340
14354
  },
14341
14355
  utilityPanel: {
@@ -14346,39 +14360,43 @@ var lightTheme = {
14346
14360
  },
14347
14361
  watermark: {
14348
14362
  background: "rgba(255, 255, 255, 0.9)",
14349
- boxShadow: "0 1px 3px rgba(0, 0, 0, 0.12)",
14363
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14350
14364
  color: "#52525b",
14351
14365
  logoColor: "#000000"
14352
14366
  },
14353
14367
  chatBox: {
14368
+ accentColor: "#FF6AB5",
14354
14369
  backgroundColor: "#ffffff",
14355
14370
  border: "1px solid #e4e4e7",
14356
- borderRadius: "20px",
14357
- boxShadow: "0 4px 8px rgba(20, 18, 31, 0.04), 0 18px 36px -14px rgba(20, 18, 31, 0.2)",
14358
- buttonBackgroundColor: "#4A7DFF",
14371
+ borderRadius: "16px",
14372
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14373
+ buttonBackgroundColor: "#0a0a0a",
14374
+ buttonBorderRadius: "10px",
14375
+ buttonInset: "4px",
14359
14376
  buttonColor: "#ffffff",
14360
- buttonHoverBackgroundColor: "#3A6AE8",
14361
- caretColor: "#4A7DFF",
14377
+ buttonHoverBackgroundColor: "#2a2a2a",
14378
+ caretColor: "#FF6AB5",
14362
14379
  caretWidth: "2px",
14363
- chipBoxShadow: "0 4px 12px -6px rgba(20, 18, 31, 0.18)",
14380
+ chipBoxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14364
14381
  chipMutedTextColor: "#71717a",
14365
- selectionBackgroundColor: "#4A7DFF",
14382
+ collapsedPaddingY: "8px",
14383
+ selectionBackgroundColor: "#FF6AB5",
14366
14384
  selectionColor: "#ffffff",
14367
14385
  scrollbarThumbColor: "#d4d4d4",
14368
- fontSize: "15px",
14369
- inputBackgroundColor: "#f3f4f6",
14370
- inputBorderRadius: "14px",
14371
- inputMinHeight: "88px",
14372
- padding: "6px",
14373
- placeholderColor: "#9ca3af",
14386
+ fontSize: "16px",
14387
+ inputBackgroundColor: "transparent",
14388
+ inputBorderRadius: "12px",
14389
+ inputMinHeight: "0px",
14390
+ padding: "4px",
14391
+ placeholderColor: "#8d8d8d",
14374
14392
  textColor: "#0a0a0a",
14375
- width: "480px"
14393
+ width: "420px"
14376
14394
  },
14377
14395
  zoomPanel: {
14378
14396
  backgroundColor: "#ffffff",
14379
14397
  border: "1px solid #ebebeb",
14380
14398
  borderRadius: "12px",
14381
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14399
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14382
14400
  buttonActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14383
14401
  buttonBorderRadius: "8px",
14384
14402
  buttonHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
@@ -14388,13 +14406,13 @@ var lightTheme = {
14388
14406
  padding: "4px"
14389
14407
  },
14390
14408
  titlebar: {
14391
- activeBackgroundColor: "#e0efff",
14409
+ activeBackgroundColor: "#ffe8f4",
14392
14410
  activeBorder: "none",
14393
14411
  activeBoxShadow: "none",
14394
- activeButtonFilledBackgroundColor: "#007aff",
14395
- activeIconColor: "#007aff",
14396
- activeMutedTextColor: "rgba(0, 122, 255, 0.6)",
14397
- activeTextColor: "#007aff",
14412
+ activeButtonFilledBackgroundColor: "#FF6AB5",
14413
+ activeIconColor: "#FF6AB5",
14414
+ activeMutedTextColor: "rgba(255, 106, 181, 0.6)",
14415
+ activeTextColor: "#FF6AB5",
14398
14416
  backgroundColor: "#f2f2f2",
14399
14417
  border: "none",
14400
14418
  borderRadius: "8px",
@@ -14406,7 +14424,7 @@ var lightTheme = {
14406
14424
  buttonOutlineColor: "currentColor",
14407
14425
  buttonPressedBackgroundColor: "rgba(0, 0, 0, 0.1)",
14408
14426
  buttonSize: "22px",
14409
- focusRing: "2px solid #007aff",
14427
+ focusRing: "2px solid #FF6AB5",
14410
14428
  fontFamily: "var(--upmade-global-font-family, sans-serif)",
14411
14429
  fontSize: "12px",
14412
14430
  fontWeight: "400",
@@ -14420,7 +14438,7 @@ var lightTheme = {
14420
14438
  mutedTextColor: "#9a9a9a",
14421
14439
  offset: "6px",
14422
14440
  paddingX: "6px",
14423
- selectionBackgroundColor: "#007aff",
14441
+ selectionBackgroundColor: "#FF6AB5",
14424
14442
  selectionColor: "#ffffff",
14425
14443
  textColor: "#5f5f5f",
14426
14444
  titleFontWeight: "600",
@@ -14429,7 +14447,7 @@ var lightTheme = {
14429
14447
  titlebarMenu: {
14430
14448
  backgroundColor: "#ffffff",
14431
14449
  border: "1px solid #ebebeb",
14432
- boxShadow: "0 1px 6px rgba(0, 0, 0, 0.12)",
14450
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14433
14451
  itemColor: "#333333",
14434
14452
  itemHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)"
14435
14453
  }
@@ -26860,6 +26878,8 @@ var defaultIcons = {
26860
26878
  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>',
26861
26879
  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>',
26862
26880
  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>',
26881
+ 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>',
26882
+ 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>',
26863
26883
  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>',
26864
26884
  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>',
26865
26885
  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>',
@@ -26873,6 +26893,7 @@ var defaultIcons = {
26873
26893
  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>',
26874
26894
  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>',
26875
26895
  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>',
26896
+ 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>',
26876
26897
  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>',
26877
26898
  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>',
26878
26899
  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>',
@@ -27031,6 +27052,33 @@ var UpmadeToolConfigHelper = class {
27031
27052
  };
27032
27053
 
27033
27054
  // src/helpers/object-titlebar.helper.ts
27055
+ var UPMADE_OBJECT_TYPE_TERMS = {
27056
+ UpmadeShape: "objectType.shape",
27057
+ UpmadeText: "objectType.text",
27058
+ UpmadeImage: "objectType.image",
27059
+ UpmadePath: "objectType.path",
27060
+ UpmadeLine: "objectType.line",
27061
+ UpmadeGroup: "objectType.group",
27062
+ UpmadeIframeObject: "objectType.iframe",
27063
+ UpmadeDynamicObject: "objectType.dynamic"
27064
+ };
27065
+ function resolveObjectTitle(object2, resolver, translate, onError) {
27066
+ if (resolver) {
27067
+ try {
27068
+ const title = resolver(object2);
27069
+ if (typeof title === "string" && title.length > 0) {
27070
+ return title;
27071
+ }
27072
+ } catch (error) {
27073
+ onError?.(error);
27074
+ }
27075
+ }
27076
+ if (typeof object2.name === "string" && object2.name.length > 0) {
27077
+ return object2.name;
27078
+ }
27079
+ return translate(UPMADE_OBJECT_TYPE_TERMS[object2.__class__] ?? "objectType.object");
27080
+ }
27081
+ __name(resolveObjectTitle, "resolveObjectTitle");
27034
27082
  var UPMADE_TITLEBAR_DEFAULT_HEIGHT = 28;
27035
27083
  var UPMADE_TITLEBAR_DEFAULT_OFFSET = 6;
27036
27084
  var UPMADE_TITLEBAR_DEFAULT_HIDE_BELOW_WIDTH = 40;
@@ -27104,6 +27152,67 @@ var UpmadeObjectTitlebarHelper = class _UpmadeObjectTitlebarHelper {
27104
27152
  }
27105
27153
  };
27106
27154
 
27155
+ // src/helpers/selection-label.helper.ts
27156
+ function getSelectionTopLeft(objects) {
27157
+ let minX = Infinity;
27158
+ let minY = Infinity;
27159
+ for (const object2 of objects) {
27160
+ if (!object2) continue;
27161
+ const polygon = object2.rotatedPolygon;
27162
+ for (const corner of [polygon.topLeft, polygon.topRight, polygon.bottomRight, polygon.bottomLeft]) {
27163
+ if (corner.x < minX) minX = corner.x;
27164
+ if (corner.y < minY) minY = corner.y;
27165
+ }
27166
+ }
27167
+ return Number.isFinite(minX) && Number.isFinite(minY) ? { x: minX, y: minY } : null;
27168
+ }
27169
+ __name(getSelectionTopLeft, "getSelectionTopLeft");
27170
+ function getSelectionLabelPoint(core, objects) {
27171
+ const topLeft = getSelectionTopLeft(objects);
27172
+ if (!topLeft) {
27173
+ return null;
27174
+ }
27175
+ const titlebars = core.objectTitlebarManager;
27176
+ const scale = core.store?.state?.scale || 1;
27177
+ let lift2 = 0;
27178
+ if (titlebars?.isEnabled) {
27179
+ const tolerance = 1 / scale;
27180
+ for (const object2 of objects) {
27181
+ if (!object2 || Math.abs(object2.rotatedBoundingBox.y - topLeft.y) > tolerance) continue;
27182
+ lift2 = Math.max(lift2, titlebars.getTitlebarLift(object2));
27183
+ }
27184
+ }
27185
+ return { x: topLeft.x, y: topLeft.y - lift2 / scale };
27186
+ }
27187
+ __name(getSelectionLabelPoint, "getSelectionLabelPoint");
27188
+
27189
+ // src/helpers/object-config.helper.ts
27190
+ function resolveObjectConfigOption(config, key, object2, fallback, onError) {
27191
+ const value = config?.[key];
27192
+ if (value === void 0) {
27193
+ return fallback;
27194
+ }
27195
+ if (typeof value !== "function") {
27196
+ return value === true;
27197
+ }
27198
+ try {
27199
+ const result = value(object2);
27200
+ if (result && typeof result.then === "function") {
27201
+ onError?.(key, "it must be synchronous; promises are not supported.");
27202
+ return fallback;
27203
+ }
27204
+ return typeof result === "boolean" ? result : fallback;
27205
+ } catch (error) {
27206
+ onError?.(key, error);
27207
+ return fallback;
27208
+ }
27209
+ }
27210
+ __name(resolveObjectConfigOption, "resolveObjectConfigOption");
27211
+ function isObjectReferenceable(config, object2, onError) {
27212
+ return resolveObjectConfigOption(config, "isReferenceable", object2, true, onError);
27213
+ }
27214
+ __name(isObjectReferenceable, "isObjectReferenceable");
27215
+
27107
27216
  // src/helpers/partial-json.helper.ts
27108
27217
  var INCOMPLETE = /* @__PURE__ */ Symbol("incomplete");
27109
27218
  var InvalidJson = class extends Error {
@@ -34172,10 +34281,30 @@ var EN_LOCALE = {
34172
34281
  "zoom.zoomOut": "Zoom out",
34173
34282
  // Chat box
34174
34283
  "chatBox.placeholder": "Ask the AI...",
34284
+ "chatBox.agentPlaceholder": "Message {name}...",
34285
+ "chatBox.removeAgent": "Remove agent",
34286
+ "chatBox.agentWorking": "working",
34175
34287
  "chatBox.submit": "Send",
34176
34288
  "chatBox.stop": "Stop",
34289
+ "chatBox.thinking": "Thinking...",
34290
+ "chatBox.addAgent": "Add agent",
34291
+ "chatBox.agentMenu.close": "Close",
34177
34292
  "chatBox.removeChip": "Remove",
34178
34293
  "chatBox.moreChips": "more",
34294
+ "chatBox.menu": "Add",
34295
+ "chatBox.menu.agent": "Agents",
34296
+ "chatBox.menu.agent.pink": "Pink",
34297
+ "chatBox.menu.agent.green": "Green",
34298
+ "chatBox.menu.agent.yellow": "Yellow",
34299
+ "agentCursor.notice.userSelected": "Selected by you",
34300
+ "agentCursor.notice.userInteraction": "In use by you",
34301
+ "chatBox.menu.back": "Back",
34302
+ "chatBox.menu.selection": "Objects",
34303
+ "chatBox.menu.file": "File",
34304
+ "chatBox.menu.mention": "Mention",
34305
+ "chatBox.mention.empty": "Nothing on the board to mention",
34306
+ "chatBox.mention.noMatch": "No matches",
34307
+ "chatBox.agentMentions": "Agents to mention",
34179
34308
  // Utility panel
34180
34309
  "utility.undo": "Undo",
34181
34310
  "utility.redo": "Redo",
@@ -34304,10 +34433,30 @@ var DE_LOCALE = {
34304
34433
  "zoom.zoomOut": "Verkleinern",
34305
34434
  // Chat box
34306
34435
  "chatBox.placeholder": "Frag die KI...",
34436
+ "chatBox.agentPlaceholder": "Nachricht an {name}...",
34437
+ "chatBox.removeAgent": "Agent entfernen",
34438
+ "chatBox.agentWorking": "arbeitet",
34307
34439
  "chatBox.submit": "Senden",
34308
34440
  "chatBox.stop": "Stoppen",
34441
+ "chatBox.thinking": "Denkt nach...",
34442
+ "chatBox.addAgent": "Agent hinzuf\xFCgen",
34443
+ "chatBox.agentMenu.close": "Schlie\xDFen",
34309
34444
  "chatBox.removeChip": "Entfernen",
34310
34445
  "chatBox.moreChips": "weitere",
34446
+ "chatBox.menu": "Hinzuf\xFCgen",
34447
+ "chatBox.menu.agent": "Agenten",
34448
+ "chatBox.menu.agent.pink": "Pink",
34449
+ "chatBox.menu.agent.green": "Gr\xFCn",
34450
+ "chatBox.menu.agent.yellow": "Gelb",
34451
+ "agentCursor.notice.userSelected": "Von dir ausgew\xE4hlt",
34452
+ "agentCursor.notice.userInteraction": "Von dir in Bearbeitung",
34453
+ "chatBox.menu.back": "Zur\xFCck",
34454
+ "chatBox.menu.selection": "Objekte",
34455
+ "chatBox.menu.file": "Datei",
34456
+ "chatBox.menu.mention": "Erw\xE4hnen",
34457
+ "chatBox.mention.empty": "Nichts auf dem Board zum Erw\xE4hnen",
34458
+ "chatBox.mention.noMatch": "Keine Treffer",
34459
+ "chatBox.agentMentions": "Agenten zum Erw\xE4hnen",
34311
34460
  // Utility panel
34312
34461
  "utility.undo": "R\xFCckg\xE4ngig",
34313
34462
  "utility.redo": "Wiederholen",
@@ -34436,10 +34585,30 @@ var FR_LOCALE = {
34436
34585
  "zoom.zoomOut": "Zoom arri\xE8re",
34437
34586
  // Chat box
34438
34587
  "chatBox.placeholder": "Demandez \xE0 l'IA...",
34588
+ "chatBox.agentPlaceholder": "Message \xE0 {name}...",
34589
+ "chatBox.removeAgent": "Retirer l'agent",
34590
+ "chatBox.agentWorking": "au travail",
34439
34591
  "chatBox.submit": "Envoyer",
34440
34592
  "chatBox.stop": "Arr\xEAter",
34593
+ "chatBox.thinking": "R\xE9flexion...",
34594
+ "chatBox.addAgent": "Ajouter un agent",
34595
+ "chatBox.agentMenu.close": "Fermer",
34441
34596
  "chatBox.removeChip": "Retirer",
34442
34597
  "chatBox.moreChips": "de plus",
34598
+ "chatBox.menu": "Ajouter",
34599
+ "chatBox.menu.agent": "Agents",
34600
+ "chatBox.menu.agent.pink": "Rose",
34601
+ "chatBox.menu.agent.green": "Vert",
34602
+ "chatBox.menu.agent.yellow": "Jaune",
34603
+ "agentCursor.notice.userSelected": "S\xE9lectionn\xE9 par vous",
34604
+ "agentCursor.notice.userInteraction": "Utilis\xE9 par vous",
34605
+ "chatBox.menu.back": "Retour",
34606
+ "chatBox.menu.selection": "Objets",
34607
+ "chatBox.menu.file": "Fichier",
34608
+ "chatBox.menu.mention": "Mentionner",
34609
+ "chatBox.mention.empty": "Rien \xE0 mentionner sur le tableau",
34610
+ "chatBox.mention.noMatch": "Aucun r\xE9sultat",
34611
+ "chatBox.agentMentions": "Agents \xE0 mentionner",
34443
34612
  // Utility panel
34444
34613
  "utility.undo": "Annuler",
34445
34614
  "utility.redo": "R\xE9tablir",
@@ -34568,10 +34737,30 @@ var PT_LOCALE = {
34568
34737
  "zoom.zoomOut": "Diminuir zoom",
34569
34738
  // Chat box
34570
34739
  "chatBox.placeholder": "Pergunte \xE0 IA...",
34740
+ "chatBox.agentPlaceholder": "Mensagem para {name}...",
34741
+ "chatBox.removeAgent": "Remover agente",
34742
+ "chatBox.agentWorking": "trabalhando",
34571
34743
  "chatBox.submit": "Enviar",
34572
34744
  "chatBox.stop": "Parar",
34745
+ "chatBox.thinking": "Pensando...",
34746
+ "chatBox.addAgent": "Adicionar agente",
34747
+ "chatBox.agentMenu.close": "Fechar",
34573
34748
  "chatBox.removeChip": "Remover",
34574
34749
  "chatBox.moreChips": "mais",
34750
+ "chatBox.menu": "Adicionar",
34751
+ "chatBox.menu.agent": "Agentes",
34752
+ "chatBox.menu.agent.pink": "Rosa",
34753
+ "chatBox.menu.agent.green": "Verde",
34754
+ "chatBox.menu.agent.yellow": "Amarelo",
34755
+ "agentCursor.notice.userSelected": "Selecionado por voc\xEA",
34756
+ "agentCursor.notice.userInteraction": "Em uso por voc\xEA",
34757
+ "chatBox.menu.back": "Voltar",
34758
+ "chatBox.menu.selection": "Objetos",
34759
+ "chatBox.menu.file": "Arquivo",
34760
+ "chatBox.menu.mention": "Mencionar",
34761
+ "chatBox.mention.empty": "Nada no quadro para mencionar",
34762
+ "chatBox.mention.noMatch": "Nenhum resultado",
34763
+ "chatBox.agentMentions": "Agentes para mencionar",
34575
34764
  // Utility panel
34576
34765
  "utility.undo": "Desfazer",
34577
34766
  "utility.redo": "Refazer",
@@ -34700,10 +34889,30 @@ var ES_LOCALE = {
34700
34889
  "zoom.zoomOut": "Alejar",
34701
34890
  // Chat box
34702
34891
  "chatBox.placeholder": "Pregunta a la IA...",
34892
+ "chatBox.agentPlaceholder": "Mensaje para {name}...",
34893
+ "chatBox.removeAgent": "Quitar agente",
34894
+ "chatBox.agentWorking": "trabajando",
34703
34895
  "chatBox.submit": "Enviar",
34704
34896
  "chatBox.stop": "Detener",
34897
+ "chatBox.thinking": "Pensando...",
34898
+ "chatBox.addAgent": "A\xF1adir agente",
34899
+ "chatBox.agentMenu.close": "Cerrar",
34705
34900
  "chatBox.removeChip": "Quitar",
34706
34901
  "chatBox.moreChips": "m\xE1s",
34902
+ "chatBox.menu": "A\xF1adir",
34903
+ "chatBox.menu.agent": "Agentes",
34904
+ "chatBox.menu.agent.pink": "Rosa",
34905
+ "chatBox.menu.agent.green": "Verde",
34906
+ "chatBox.menu.agent.yellow": "Amarillo",
34907
+ "agentCursor.notice.userSelected": "Seleccionado por ti",
34908
+ "agentCursor.notice.userInteraction": "En uso por ti",
34909
+ "chatBox.menu.back": "Atr\xE1s",
34910
+ "chatBox.menu.selection": "Objetos",
34911
+ "chatBox.menu.file": "Archivo",
34912
+ "chatBox.menu.mention": "Mencionar",
34913
+ "chatBox.mention.empty": "Nada en el tablero para mencionar",
34914
+ "chatBox.mention.noMatch": "Sin coincidencias",
34915
+ "chatBox.agentMentions": "Agentes para mencionar",
34707
34916
  // Utility panel
34708
34917
  "utility.undo": "Deshacer",
34709
34918
  "utility.redo": "Rehacer",
@@ -34832,10 +35041,30 @@ var PL_LOCALE = {
34832
35041
  "zoom.zoomOut": "Pomniejsz",
34833
35042
  // Chat box
34834
35043
  "chatBox.placeholder": "Zapytaj AI...",
35044
+ "chatBox.agentPlaceholder": "Wiadomo\u015B\u0107 do {name}...",
35045
+ "chatBox.removeAgent": "Usu\u0144 agenta",
35046
+ "chatBox.agentWorking": "pracuje",
34835
35047
  "chatBox.submit": "Wy\u015Blij",
34836
35048
  "chatBox.stop": "Zatrzymaj",
35049
+ "chatBox.thinking": "My\u015Bl\u0119...",
35050
+ "chatBox.addAgent": "Dodaj agenta",
35051
+ "chatBox.agentMenu.close": "Zamknij",
34837
35052
  "chatBox.removeChip": "Usu\u0144",
34838
35053
  "chatBox.moreChips": "wi\u0119cej",
35054
+ "chatBox.menu": "Dodaj",
35055
+ "chatBox.menu.agent": "Agenci",
35056
+ "chatBox.menu.agent.pink": "R\xF3\u017Cowy",
35057
+ "chatBox.menu.agent.green": "Zielony",
35058
+ "chatBox.menu.agent.yellow": "\u017B\xF3\u0142ty",
35059
+ "agentCursor.notice.userSelected": "Zaznaczone przez ciebie",
35060
+ "agentCursor.notice.userInteraction": "U\u017Cywane przez ciebie",
35061
+ "chatBox.menu.back": "Wstecz",
35062
+ "chatBox.menu.selection": "Obiekty",
35063
+ "chatBox.menu.file": "Plik",
35064
+ "chatBox.menu.mention": "Wzmianka",
35065
+ "chatBox.mention.empty": "Nic do wspomnienia na tablicy",
35066
+ "chatBox.mention.noMatch": "Brak wynik\xF3w",
35067
+ "chatBox.agentMentions": "Agenci do wspomnienia",
34839
35068
  // Utility panel
34840
35069
  "utility.undo": "Cofnij",
34841
35070
  "utility.redo": "Pon\xF3w",
@@ -34964,10 +35193,30 @@ var NL_LOCALE = {
34964
35193
  "zoom.zoomOut": "Uitzoomen",
34965
35194
  // Chat box
34966
35195
  "chatBox.placeholder": "Vraag het de AI...",
35196
+ "chatBox.agentPlaceholder": "Bericht aan {name}...",
35197
+ "chatBox.removeAgent": "Agent verwijderen",
35198
+ "chatBox.agentWorking": "aan het werk",
34967
35199
  "chatBox.submit": "Versturen",
34968
35200
  "chatBox.stop": "Stoppen",
35201
+ "chatBox.thinking": "Aan het denken...",
35202
+ "chatBox.addAgent": "Agent toevoegen",
35203
+ "chatBox.agentMenu.close": "Sluiten",
34969
35204
  "chatBox.removeChip": "Verwijderen",
34970
35205
  "chatBox.moreChips": "meer",
35206
+ "chatBox.menu": "Toevoegen",
35207
+ "chatBox.menu.agent": "Agenten",
35208
+ "chatBox.menu.agent.pink": "Roze",
35209
+ "chatBox.menu.agent.green": "Groen",
35210
+ "chatBox.menu.agent.yellow": "Geel",
35211
+ "agentCursor.notice.userSelected": "Door jou geselecteerd",
35212
+ "agentCursor.notice.userInteraction": "Door jou in gebruik",
35213
+ "chatBox.menu.back": "Terug",
35214
+ "chatBox.menu.selection": "Objecten",
35215
+ "chatBox.menu.file": "Bestand",
35216
+ "chatBox.menu.mention": "Vermelden",
35217
+ "chatBox.mention.empty": "Niets op het bord om te vermelden",
35218
+ "chatBox.mention.noMatch": "Geen resultaten",
35219
+ "chatBox.agentMentions": "Agenten om te vermelden",
34971
35220
  // Utility panel
34972
35221
  "utility.undo": "Ongedaan maken",
34973
35222
  "utility.redo": "Opnieuw uitvoeren",
@@ -35096,10 +35345,30 @@ var IT_LOCALE = {
35096
35345
  "zoom.zoomOut": "Riduci",
35097
35346
  // Chat box
35098
35347
  "chatBox.placeholder": "Chiedi all'IA...",
35348
+ "chatBox.agentPlaceholder": "Messaggio a {name}...",
35349
+ "chatBox.removeAgent": "Rimuovi agente",
35350
+ "chatBox.agentWorking": "al lavoro",
35099
35351
  "chatBox.submit": "Invia",
35100
35352
  "chatBox.stop": "Interrompi",
35353
+ "chatBox.thinking": "Sto pensando...",
35354
+ "chatBox.addAgent": "Aggiungi agente",
35355
+ "chatBox.agentMenu.close": "Chiudi",
35101
35356
  "chatBox.removeChip": "Rimuovi",
35102
35357
  "chatBox.moreChips": "altri",
35358
+ "chatBox.menu": "Aggiungi",
35359
+ "chatBox.menu.agent": "Agenti",
35360
+ "chatBox.menu.agent.pink": "Rosa",
35361
+ "chatBox.menu.agent.green": "Verde",
35362
+ "chatBox.menu.agent.yellow": "Giallo",
35363
+ "agentCursor.notice.userSelected": "Selezionato da te",
35364
+ "agentCursor.notice.userInteraction": "In uso da te",
35365
+ "chatBox.menu.back": "Indietro",
35366
+ "chatBox.menu.selection": "Oggetti",
35367
+ "chatBox.menu.file": "File",
35368
+ "chatBox.menu.mention": "Menziona",
35369
+ "chatBox.mention.empty": "Niente da menzionare sulla lavagna",
35370
+ "chatBox.mention.noMatch": "Nessun risultato",
35371
+ "chatBox.agentMentions": "Agenti da menzionare",
35103
35372
  // Utility panel
35104
35373
  "utility.undo": "Annulla",
35105
35374
  "utility.redo": "Ripristina",
@@ -35359,16 +35628,6 @@ var UPMADE_TITLEBAR_EDITABLE_TITLE_ATTRIBUTE = "data-upmade-titlebar-editable-ti
35359
35628
  var UPMADE_TITLEBAR_TITLE_INPUT_ATTRIBUTE = "data-upmade-titlebar-title-input";
35360
35629
  var DEFAULT_LEFT_ELEMENTS = [{ id: "title", type: "title" }];
35361
35630
  var SECTIONS = ["left", "center", "right"];
35362
- var OBJECT_TYPE_TERMS = {
35363
- UpmadeShape: "objectType.shape",
35364
- UpmadeText: "objectType.text",
35365
- UpmadeImage: "objectType.image",
35366
- UpmadePath: "objectType.path",
35367
- UpmadeLine: "objectType.line",
35368
- UpmadeGroup: "objectType.group",
35369
- UpmadeIframeObject: "objectType.iframe",
35370
- UpmadeDynamicObject: "objectType.dynamic"
35371
- };
35372
35631
  var UPMADE_OBJECT_TYPE_ICONS = {
35373
35632
  UpmadeShape: "shapes",
35374
35633
  UpmadeText: "type",
@@ -35457,7 +35716,43 @@ var UpmadeObjectTitlebarManager = class {
35457
35716
  * a selected object (nested groups resolve selection to their direct parent).
35458
35717
  */
35459
35718
  getActiveOwnerIds(candidates) {
35460
- const selectedIds = this._core.store.selectionGroup?.objectIds ?? [];
35719
+ return this.collectOwnerChain(this._core.store.selectionGroup?.objectIds ?? [], candidates);
35720
+ }
35721
+ /**
35722
+ * Returns the color of the agent (local or a collaborator's) that has each titlebar owner selected, or an object
35723
+ * in it, by the rules of `getActiveOwnerIds`. When several agents have selected the same owner, the first wins.
35724
+ */
35725
+ getAgentOwnerColors(candidates) {
35726
+ const colors = /* @__PURE__ */ new Map();
35727
+ for (const cursor of this.getAgentCursors()) {
35728
+ for (const id2 of this.collectOwnerChain(cursor.selectedObjectIds, candidates)) {
35729
+ if (!colors.has(id2)) {
35730
+ colors.set(id2, cursor.color);
35731
+ }
35732
+ }
35733
+ }
35734
+ return colors;
35735
+ }
35736
+ /**
35737
+ * Screen distance from the top edge of `object` to the top of the titlebar it shows on its own, or `0` when it
35738
+ * shows none. Agents' labels sit above a selection, so they move up by this much to sit above its titlebar.
35739
+ */
35740
+ getTitlebarLift(object2) {
35741
+ if (this.getOwnTitlebar(object2).length === 0) {
35742
+ return 0;
35743
+ }
35744
+ const host = this._core.engine?.host;
35745
+ const { height, offset } = this.getMetrics(host && typeof getComputedStyle === "function" ? getComputedStyle(host) : null);
35746
+ return height + offset;
35747
+ }
35748
+ /** The visible agents' cursors with a selection, local ones first. */
35749
+ getAgentCursors() {
35750
+ const local = this._core.agenticCursorManager?.getAll() ?? [];
35751
+ const remote = this._core.remoteAgentManager?.getAll() ?? [];
35752
+ return [...local, ...remote].filter((cursor) => cursor.visible && cursor.selectedObjectIds.length > 0);
35753
+ }
35754
+ /** The given objects and the groups that contain them (nested groups resolve to their direct parent). */
35755
+ collectOwnerChain(selectedIds, candidates) {
35461
35756
  const active = /* @__PURE__ */ new Set();
35462
35757
  if (selectedIds.length === 0) {
35463
35758
  return active;
@@ -35514,16 +35809,21 @@ var UpmadeObjectTitlebarManager = class {
35514
35809
  if (!config || this.getOwners([object2]).length === 0) {
35515
35810
  return [];
35516
35811
  }
35517
- const isActive = this.getActiveOwnerIds(this.withNestedGroups(object2)).has(object2.id);
35812
+ const withNested = this.withNestedGroups(object2);
35813
+ const isActive = this.getActiveOwnerIds(withNested).has(object2.id);
35814
+ const isAgentSelected = this.getAgentOwnerColors(withNested).has(object2.id);
35518
35815
  const anchor2 = UpmadeObjectTitlebarHelper.getAnchor(object2, this._core.store.state, config.rotation ?? "follow");
35519
- return this.isShown(object2, isActive, anchor2.width, config) ? [{ owner: object2, isActive }] : [];
35816
+ return this.isShown(object2, isActive || isAgentSelected, anchor2.width, config) ? [{ owner: object2, isActive }] : [];
35520
35817
  }
35521
- /** The visibility rules: a titlebar being edited stays visible until the edit ends. */
35522
- isShown(owner, isActive, width, config) {
35818
+ /**
35819
+ * The visibility rules: a titlebar being edited stays visible until the edit ends. With `visibility: 'active'`,
35820
+ * `isSelected` also counts an agent's selection, so an agent's titlebar highlight shows.
35821
+ */
35822
+ isShown(owner, isSelected, width, config) {
35523
35823
  if (this._editingTitle?.ownerId === owner.id) {
35524
35824
  return true;
35525
35825
  }
35526
- return (config.visibility !== "active" || isActive) && width >= (config.hideBelowWidth ?? UPMADE_TITLEBAR_DEFAULT_HIDE_BELOW_WIDTH);
35826
+ return (config.visibility !== "active" || isSelected) && width >= (config.hideBelowWidth ?? UPMADE_TITLEBAR_DEFAULT_HIDE_BELOW_WIDTH);
35527
35827
  }
35528
35828
  /** The object and the groups nested in it, so that a selected descendant makes it active. */
35529
35829
  withNestedGroups(object2) {
@@ -35554,13 +35854,15 @@ var UpmadeObjectTitlebarManager = class {
35554
35854
  const viewport = { scale: state.scale, translateX: state.translateX, translateY: state.translateY };
35555
35855
  const owners = this.getOwners(candidates);
35556
35856
  const activeOwnerIds = this.getActiveOwnerIds(candidates);
35857
+ const agentColors = this.getAgentOwnerColors(candidates);
35557
35858
  const titlebars = [];
35558
35859
  const editing = this._editingTitle;
35559
35860
  for (const owner of owners) {
35560
35861
  const isActive = activeOwnerIds.has(owner.id);
35862
+ const agentColor = agentColors.get(owner.id);
35561
35863
  const isEditing = editing?.ownerId === owner.id;
35562
35864
  const anchor2 = UpmadeObjectTitlebarHelper.getAnchor(owner, viewport, config.rotation ?? "follow");
35563
- if (!this.isShown(owner, isActive, anchor2.width, config)) {
35865
+ if (!this.isShown(owner, isActive || agentColor !== void 0, anchor2.width, config)) {
35564
35866
  continue;
35565
35867
  }
35566
35868
  const context = this.createContext(owner, isActive, anchor2.width);
@@ -35574,6 +35876,7 @@ var UpmadeObjectTitlebarManager = class {
35574
35876
  owner,
35575
35877
  context,
35576
35878
  isActive,
35879
+ ...agentColor !== void 0 ? { agentColor } : {},
35577
35880
  transform: UpmadeObjectTitlebarHelper.getTransform(anchor2, viewport.scale),
35578
35881
  width: anchor2.width,
35579
35882
  editingElementId: isEditedElementShown ? editing.elementId : void 0,
@@ -35624,21 +35927,7 @@ var UpmadeObjectTitlebarManager = class {
35624
35927
  }
35625
35928
  /** Resolves an object's title: config resolver, then object name, then a localized type label. */
35626
35929
  resolveTitle(owner) {
35627
- const resolver = this.config?.title;
35628
- if (resolver) {
35629
- try {
35630
- const title = resolver(owner);
35631
- if (typeof title === "string" && title.length > 0) {
35632
- return title;
35633
- }
35634
- } catch (error) {
35635
- this.warnOnce("title", error);
35636
- }
35637
- }
35638
- if (typeof owner.name === "string" && owner.name.length > 0) {
35639
- return owner.name;
35640
- }
35641
- return this.translate(OBJECT_TYPE_TERMS[owner.__class__] ?? "objectType.object");
35930
+ return resolveObjectTitle(owner, this.config?.title, this.translate, (error) => this.warnOnce("title", error));
35642
35931
  }
35643
35932
  /**
35644
35933
  * Finds the object whose titlebar surface was pressed. Presses on titlebar controls return `null`
@@ -36048,6 +36337,10 @@ var UpmadeObjectConfigManager = class {
36048
36337
  isResizable(object2) {
36049
36338
  return this.allowsAll(object2, (unit) => unit.isResizable !== false && this.evaluate("isResizable", unit, true));
36050
36339
  }
36340
+ /** Whether the object can be referenced in the chat, e.g. as a chat box chip. Defaults to `true`. */
36341
+ isReferenceable(object2) {
36342
+ return this.evaluate("isReferenceable", object2, true);
36343
+ }
36051
36344
  /** Applies a check to an object and everything a transform of it also transforms. */
36052
36345
  allowsAll(object2, check) {
36053
36346
  if (object2 instanceof UpmadeSelectionGroup) {
@@ -36064,26 +36357,9 @@ var UpmadeObjectConfigManager = class {
36064
36357
  }
36065
36358
  return true;
36066
36359
  }
36067
- /** Resolves one option for one object. Only a synchronous boolean counts; failures are reported once. */
36360
+ /** Resolves one option for one object; failures are reported once. */
36068
36361
  evaluate(key, object2, fallback) {
36069
- const value = this.config?.[key];
36070
- if (value === void 0) {
36071
- return fallback;
36072
- }
36073
- if (typeof value !== "function") {
36074
- return value === true;
36075
- }
36076
- try {
36077
- const result = value(object2);
36078
- if (result && typeof result.then === "function") {
36079
- this.warnOnce(key, "it must be synchronous; promises are not supported.");
36080
- return fallback;
36081
- }
36082
- return typeof result === "boolean" ? result : fallback;
36083
- } catch (error) {
36084
- this.warnOnce(key, error);
36085
- return fallback;
36086
- }
36362
+ return resolveObjectConfigOption(this.config, key, object2, fallback, (failedKey, error) => this.warnOnce(failedKey, error));
36087
36363
  }
36088
36364
  warnOnce(key, error) {
36089
36365
  if (this._warnedKeys.has(key)) {
@@ -36094,6 +36370,13 @@ var UpmadeObjectConfigManager = class {
36094
36370
  }
36095
36371
  };
36096
36372
 
36373
+ // src/interfaces/cursor-label.interface.ts
36374
+ var UPMADE_REMOVE_AGENT_CURSOR_ACTION = Object.freeze({
36375
+ id: "remove",
36376
+ icon: "x",
36377
+ label: "Send agent back"
36378
+ });
36379
+
36097
36380
  // src/helpers/user-color.helper.ts
36098
36381
  var UpmadeUserColorHelper = class {
36099
36382
  static {
@@ -40074,7 +40357,7 @@ var AGENT_TOOL_SPECS = {
40074
40357
  },
40075
40358
  select: {
40076
40359
  name: "select",
40077
- description: "Makes top-level objects your selection, shown in your color. Never changes the user's selection.",
40360
+ 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.",
40078
40361
  params: { objectIds: req(ids), additive: opt(bool("Add to your selection instead of replacing it.")) },
40079
40362
  actors: AGENT_ONLY,
40080
40363
  describeObjects: false,
@@ -41145,6 +41428,8 @@ var UpmadeAgent = class {
41145
41428
  _name;
41146
41429
  _color;
41147
41430
  _avatarUrl;
41431
+ _cursorIcon;
41432
+ _cursorActions;
41148
41433
  _speed;
41149
41434
  _broadcast;
41150
41435
  _status;
@@ -41163,6 +41448,8 @@ var UpmadeAgent = class {
41163
41448
  this._name = options.name;
41164
41449
  this._color = options.color || UpmadeUserColorHelper.generateColorFromName(options.name);
41165
41450
  this._avatarUrl = options.avatarUrl;
41451
+ this._cursorIcon = options.cursorIcon || null;
41452
+ this._cursorActions = options.cursorActions ? [...options.cursorActions] : [UPMADE_REMOVE_AGENT_CURSOR_ACTION];
41166
41453
  this._speed = options.speed;
41167
41454
  this._broadcast = options.broadcast ?? true;
41168
41455
  this._status = options.status || null;
@@ -41200,6 +41487,29 @@ var UpmadeAgent = class {
41200
41487
  this._avatarUrl = url;
41201
41488
  this.notifyChange();
41202
41489
  }
41490
+ /**
41491
+ * 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.
41492
+ */
41493
+ get cursorIcon() {
41494
+ return this._cursorIcon;
41495
+ }
41496
+ set cursorIcon(icon) {
41497
+ this._cursorIcon = icon || null;
41498
+ this._core?.agenticCursorManager.refresh(this.id);
41499
+ this.notifyChange();
41500
+ }
41501
+ /**
41502
+ * Buttons after the name or status on the cursor label. Defaults to `[UPMADE_REMOVE_AGENT_CURSOR_ACTION]`: an "X"
41503
+ * that sends the agent back behind its chip in the editor's chat box (`sendHome()`), or removes it without one.
41504
+ * `[]` shows none. Clicks call the action's `onClick` and emit the engine's `cursorLabelAction`.
41505
+ */
41506
+ get cursorActions() {
41507
+ return this._cursorActions;
41508
+ }
41509
+ set cursorActions(actions) {
41510
+ this._cursorActions = actions ? [...actions] : [];
41511
+ this._core?.agenticCursorManager.refresh(this.id);
41512
+ }
41203
41513
  /** Same as `avatarUrl` (`IUpmadeUser`). */
41204
41514
  get profileImageUrl() {
41205
41515
  return this._avatarUrl;
@@ -41257,7 +41567,7 @@ var UpmadeAgent = class {
41257
41567
  };
41258
41568
  }
41259
41569
  // ─── Presence ───────────────────────────────────────────────────────────────
41260
- /** Shows a status message below the cursor label; `null` or `''` hides it. */
41570
+ /** Shows what the agent is doing in place of its name on the cursor label; `null` or `''` shows the name again. */
41261
41571
  setStatus(status) {
41262
41572
  this._status = status || null;
41263
41573
  this._core?.agenticCursorManager.refresh(this.id);
@@ -41283,6 +41593,9 @@ var UpmadeAgent = class {
41283
41593
  */
41284
41594
  async moveTo(target2, options = {}) {
41285
41595
  const core = this.requireCore();
41596
+ if (core.agentManager.isLeaving(this.id)) {
41597
+ return { completed: false };
41598
+ }
41286
41599
  return core.agenticCursorManager.move(this.id, target2, { ...options, speed: options.speed ?? this._speed });
41287
41600
  }
41288
41601
  /** Releases the cursor from the object it sticks to. It stays where it is. */
@@ -41301,6 +41614,9 @@ var UpmadeAgent = class {
41301
41614
  */
41302
41615
  async perform(action, options = {}) {
41303
41616
  const core = this.requireCore();
41617
+ if (core.agentManager.isLeaving(this.id)) {
41618
+ return { completed: false, reason: "agent-removed" };
41619
+ }
41304
41620
  const task = this._task;
41305
41621
  if (task?.cancelled) {
41306
41622
  return this.settle(action, { completed: false, reason: "aborted" }, task);
@@ -41326,7 +41642,10 @@ var UpmadeAgent = class {
41326
41642
  interactWithElement(target2, interaction, options = {}) {
41327
41643
  return this.perform({ type: "interactWithElement", target: target2, interaction }, options);
41328
41644
  }
41329
- /** Selects top-level objects for the agent. Never changes the user's selection. */
41645
+ /**
41646
+ * Selects top-level objects for the agent. Never changes the user's selection. The selection lasts while the agent
41647
+ * works on it: an action on anything outside it clears it, and objects an action creates become the selection.
41648
+ */
41330
41649
  select(objectIds, options = {}) {
41331
41650
  const { additive, ...actionOptions } = options;
41332
41651
  return this.perform({ type: "select", objectIds, ...additive !== void 0 ? { additive } : {} }, actionOptions);
@@ -41514,7 +41833,7 @@ var UpmadeAgent = class {
41514
41833
  listeners.add(listener);
41515
41834
  return () => listeners.delete(listener);
41516
41835
  }
41517
- /** How the agent is shown in avatar stacks and `agentsChange`. */
41836
+ /** How the agent is reported in `agentsChange`. */
41518
41837
  toPresence() {
41519
41838
  const state = this.state;
41520
41839
  return {
@@ -41528,6 +41847,7 @@ var UpmadeAgent = class {
41528
41847
  visible: state.visible,
41529
41848
  activeAction: state.activeAction,
41530
41849
  queueLength: state.queueLength,
41850
+ ...this._core?.agentManager.isLeaving(this.id) ? { isLeaving: true } : {},
41531
41851
  isRemote: false
41532
41852
  };
41533
41853
  }
@@ -41536,11 +41856,16 @@ var UpmadeAgent = class {
41536
41856
  get _owner() {
41537
41857
  return this._core;
41538
41858
  }
41539
- /** Creates the cursor in `core` and starts listening. Throws if the cursor can't be created. @internal */
41859
+ /**
41860
+ * Creates the cursor in `core` and starts listening. Returns whether the cursor starts behind the home (the chat box).
41861
+ * Throws if the cursor can't be created. @internal
41862
+ */
41540
41863
  _attach(core) {
41541
41864
  const initial = this._initialPosition;
41542
41865
  const start = initial && canStartAt(core, initial) ? core.agenticCursorManager.resolveTarget(initial) : null;
41543
- const position = start && Number.isFinite(start.x) && Number.isFinite(start.y) ? initial : void 0;
41866
+ const ownStart = start && Number.isFinite(start.x) && Number.isFinite(start.y) ? initial : void 0;
41867
+ const home = ownStart ? null : core.agentManager.getHomePoint(this.id);
41868
+ const position = ownStart ?? home ?? void 0;
41544
41869
  const agent2 = this;
41545
41870
  const cursor = {
41546
41871
  id: this.id,
@@ -41551,6 +41876,12 @@ var UpmadeAgent = class {
41551
41876
  get color() {
41552
41877
  return agent2._color;
41553
41878
  },
41879
+ get cursorIcon() {
41880
+ return agent2._cursorIcon;
41881
+ },
41882
+ get cursorActions() {
41883
+ return agent2._cursorActions;
41884
+ },
41554
41885
  get status() {
41555
41886
  return agent2._status;
41556
41887
  },
@@ -41597,6 +41928,7 @@ var UpmadeAgent = class {
41597
41928
  })
41598
41929
  ];
41599
41930
  this.notifyChange();
41931
+ return !!home;
41600
41932
  }
41601
41933
  /** Removes the cursor (its running action is rolled back) and stops listening. @internal */
41602
41934
  _detach() {
@@ -41612,6 +41944,10 @@ var UpmadeAgent = class {
41612
41944
  this.notifyChange();
41613
41945
  this.emit("removed", void 0);
41614
41946
  }
41947
+ /** Emits `'sent-home'`: the agent was sent back behind its chip and stopped working. @internal */
41948
+ _sentHome() {
41949
+ this.emit("sent-home", void 0);
41950
+ }
41615
41951
  // ─── Internals ──────────────────────────────────────────────────────────────
41616
41952
  setVisible(visible) {
41617
41953
  this._visible = visible;
@@ -41638,7 +41974,7 @@ var UpmadeAgent = class {
41638
41974
  }
41639
41975
  const state = this.state;
41640
41976
  const { position: _position, ...rest } = state;
41641
- const key = JSON.stringify([rest, this._name, this._color, this._avatarUrl, this._broadcast]);
41977
+ const key = JSON.stringify([rest, this._name, this._color, this._avatarUrl, this._cursorIcon, this._broadcast]);
41642
41978
  if (key === this._lastStateKey) {
41643
41979
  return;
41644
41980
  }
@@ -41661,6 +41997,14 @@ var UpmadeAgentManager = class {
41661
41997
  _changeListeners = /* @__PURE__ */ new Set();
41662
41998
  _changeScheduled = false;
41663
41999
  _disposed = false;
42000
+ /** Reports the boxes of the home agents come out from behind and go back behind (the editor's chat box), or `null`. */
42001
+ _homeRectProvider = null;
42002
+ /** Agents flying home before they are removed, with what resolves once they are gone and their flight. */
42003
+ _leaving = /* @__PURE__ */ new Map();
42004
+ /** Agents whose cursor waits behind their chip in the home, with the point it was put at last. */
42005
+ _parked = /* @__PURE__ */ new Map();
42006
+ /** Stops following the chips of parked agents every frame. */
42007
+ _stopFollowingChips = null;
41664
42008
  constructor(core) {
41665
42009
  this._core = core;
41666
42010
  }
@@ -41671,6 +42015,193 @@ var UpmadeAgentManager = class {
41671
42015
  /** Called by the engine when it disconnects (`true`) or connects (`false`). @internal */
41672
42016
  setDisposed(disposed) {
41673
42017
  this._disposed = disposed;
42018
+ if (disposed) {
42019
+ Array.from(this._leaving.keys()).forEach((id2) => this.finishLeaving(id2));
42020
+ }
42021
+ }
42022
+ // ─── Home ───────────────────────────────────────────────────────────────────
42023
+ /**
42024
+ * Reports the home agents come out from behind when added and go back behind when removed, e.g. the editor's chat
42025
+ * 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
42026
+ * of their chip. `null` (the default) keeps agents appearing at the viewport center and disappearing where they are.
42027
+ */
42028
+ get homeRectProvider() {
42029
+ return this._homeRectProvider;
42030
+ }
42031
+ /**
42032
+ * Sets what reports the home's boxes, see `homeRectProvider`. The engine sets it from its `agentHome` element, so
42033
+ * that reading the DOM stays out of the core. @internal
42034
+ */
42035
+ setHomeRectProvider(provider) {
42036
+ this._homeRectProvider = provider ?? null;
42037
+ }
42038
+ /**
42039
+ * The home's box, relative to the engine's host element (the coordinates cursors are drawn in), or `null` when there
42040
+ * 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
42041
+ * home's box.
42042
+ */
42043
+ getHomeRect(agentId) {
42044
+ const rect = this._homeRectProvider?.(agentId) ?? null;
42045
+ if (!rect || !(rect.right > rect.left) || !(rect.bottom > rect.top)) {
42046
+ return null;
42047
+ }
42048
+ return { left: rect.left, top: rect.top, right: rect.right, bottom: rect.bottom };
42049
+ }
42050
+ /**
42051
+ * Where agents appear and leave, in world coordinates: the center of the agent's chip in the home, or of the home
42052
+ * while the chip doesn't show; `null` without a home.
42053
+ */
42054
+ getHomePoint(agentId) {
42055
+ const rect = this.getHomeRect(agentId);
42056
+ const state = this._core.store?.state;
42057
+ if (!rect || !state || !(state.scale > 0)) {
42058
+ return null;
42059
+ }
42060
+ const x2 = (rect.left + rect.right) / 2;
42061
+ const y2 = (rect.top + rect.bottom) / 2;
42062
+ return { x: (x2 - state.translateX) / state.scale, y: (y2 - state.translateY) / state.scale };
42063
+ }
42064
+ /**
42065
+ * 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
42066
+ * its cursor label. It stops working: its running action is rolled back, its queued actions and a running `task()`
42067
+ * end with `'aborted'`, and a chat session running a prompt for it stops (the agent emits `'sent-home'`). It lets go
42068
+ * of its selection and its cursor flies to the center of its chip, where it waits, hidden behind the home, until
42069
+ * its next action takes it straight to where that happens. The agent stays added: `remove()` removes it.
42070
+ * Returns `false`, and does nothing, without a home, for an agent that is not added and for one on its way out.
42071
+ */
42072
+ sendHome(agentOrId) {
42073
+ const id2 = typeof agentOrId === "string" ? agentOrId : agentOrId?.id;
42074
+ const agent2 = id2 !== void 0 ? this._agents.get(id2) : void 0;
42075
+ if (!agent2 || typeof agentOrId !== "string" && agentOrId !== agent2 || this._leaving.has(agent2.id) || this._disposed) {
42076
+ return false;
42077
+ }
42078
+ const cursors = this._core.agenticCursorManager;
42079
+ const home = cursors.get(agent2.id) ? this.getHomePoint(agent2.id) : null;
42080
+ if (!home) {
42081
+ return false;
42082
+ }
42083
+ const start = this.getIdleLabelPoint(agent2);
42084
+ agent2.cancel();
42085
+ this._core.agenticActionManager.setSelection(agent2.id, []);
42086
+ agent2._sentHome();
42087
+ this.flyHome(agent2, home, start);
42088
+ return true;
42089
+ }
42090
+ /**
42091
+ * Where an idle agent with a selection shows itself: its labels at the selection's top-left corner (its arrow is
42092
+ * hidden meanwhile). A flight home starts there rather than at the hidden arrow, e.g. at the far corner of the shape
42093
+ * it just drew. `null` for a busy agent, whose arrow shows, and for one without a selection.
42094
+ */
42095
+ getIdleLabelPoint(agent2) {
42096
+ const cursor = this._core.agenticCursorManager.get(agent2.id);
42097
+ const ids2 = this._core.agenticActionManager.getSelection(agent2.id);
42098
+ const objects = this._core.store?.objects;
42099
+ if (!cursor || cursor.isMoving || cursor.activeAction || cursor.queueLength > 0 || ids2.length === 0 || !objects) {
42100
+ return null;
42101
+ }
42102
+ const point2 = getSelectionLabelPoint(this._core, ids2.map((id2) => objects.findById(id2)));
42103
+ return point2 && Number.isFinite(point2.x) && Number.isFinite(point2.y) ? point2 : null;
42104
+ }
42105
+ /**
42106
+ * 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
42107
+ * way. With `start`, the flight starts there (see `getIdleLabelPoint`).
42108
+ */
42109
+ flyHome(agent2, home, start) {
42110
+ this._parked.delete(agent2.id);
42111
+ const cursors = this._core.agenticCursorManager;
42112
+ if (start) {
42113
+ cursors.setPosition(agent2.id, start);
42114
+ }
42115
+ cursors.move(agent2.id, home, { speed: agent2.speed }).then((result) => {
42116
+ if (result.completed && this._agents.get(agent2.id) === agent2 && !this._leaving.has(agent2.id)) {
42117
+ this.park(agent2);
42118
+ }
42119
+ }).catch(() => void 0);
42120
+ }
42121
+ /** The user's selection as last seen, by its object IDs, to tell when it changes. */
42122
+ _userSelectionKey = "";
42123
+ /** Stops watching the user's selection. */
42124
+ _stopWatchingUserSelection = null;
42125
+ /** Watches the user's selection, once per frame while agents are added (frames run while their cursors exist). */
42126
+ watchUserSelection() {
42127
+ this._stopWatchingUserSelection ??= this._core.agenticCursorManager.onBeforeFrame(() => this.yieldToUserSelection());
42128
+ }
42129
+ /**
42130
+ * The user selected objects an agent has selected: the agent lets go of its selection and its cursor flies back to
42131
+ * its chip in the home, where it waits until its next action (without a home, it stays where it is). Unlike
42132
+ * `sendHome()`, the agent does not stop: a running action on those objects ends as the user took them over
42133
+ * (`'user-selected'`), and a chat session running a prompt for it goes on. Checked whenever the user's selection
42134
+ * changes, for the objects in it then.
42135
+ */
42136
+ yieldToUserSelection() {
42137
+ const ids2 = this._core.store.selectionGroup?.objectIds ?? [];
42138
+ const key = ids2.join("\0");
42139
+ if (key === this._userSelectionKey) {
42140
+ return;
42141
+ }
42142
+ this._userSelectionKey = key;
42143
+ if (ids2.length === 0 || this._disposed) {
42144
+ return;
42145
+ }
42146
+ const selected = new Set(ids2);
42147
+ const actions = this._core.agenticActionManager;
42148
+ for (const agent2 of this._agents.values()) {
42149
+ if (this._leaving.has(agent2.id) || !actions.getSelection(agent2.id).some((id2) => selected.has(id2))) {
42150
+ continue;
42151
+ }
42152
+ const start = this.getIdleLabelPoint(agent2);
42153
+ actions.setSelection(agent2.id, []);
42154
+ const home = this._core.agenticCursorManager.get(agent2.id) ? this.getHomePoint(agent2.id) : null;
42155
+ if (home && !this._parked.has(agent2.id)) {
42156
+ this.flyHome(agent2, home, start);
42157
+ }
42158
+ }
42159
+ }
42160
+ /** Whether the agent's cursor waits behind its chip in the home. */
42161
+ isHome(agentOrId) {
42162
+ return this._parked.has(typeof agentOrId === "string" ? agentOrId : agentOrId?.id);
42163
+ }
42164
+ /**
42165
+ * Keeps the agent's cursor on the center of its chip in the home, hidden behind it, also while the chip moves, the
42166
+ * view pans or zooms, or the chip only shows after the agent was added (the cursor waits at the home's center
42167
+ * until then). It stays until anything else moves the cursor, e.g. its next action.
42168
+ */
42169
+ park(agent2) {
42170
+ const cursors = this._core.agenticCursorManager;
42171
+ const cursor = cursors.get(agent2.id);
42172
+ if (!cursor) return;
42173
+ this._parked.set(agent2.id, { ...cursor.position });
42174
+ this._stopFollowingChips ??= cursors.onBeforeFrame(() => this.followChips());
42175
+ this.followChips();
42176
+ cursors.requestFrames();
42177
+ }
42178
+ /** Puts the cursors of parked agents on their chips; lets go of those that something else moved. */
42179
+ followChips() {
42180
+ const cursors = this._core.agenticCursorManager;
42181
+ this._parked.forEach((placed, id2) => {
42182
+ const cursor = cursors.get(id2);
42183
+ if (!cursor || !this._agents.has(id2) || this._leaving.has(id2) || cursor.isMoving || cursor.attachedTo || cursor.position.x !== placed.x || cursor.position.y !== placed.y) {
42184
+ this._parked.delete(id2);
42185
+ return;
42186
+ }
42187
+ const point2 = this.getHomePoint(id2);
42188
+ if (point2 && Number.isFinite(point2.x) && Number.isFinite(point2.y) && (point2.x !== placed.x || point2.y !== placed.y)) {
42189
+ cursors.setPosition(id2, point2);
42190
+ this._parked.set(id2, { x: point2.x, y: point2.y });
42191
+ }
42192
+ });
42193
+ if (this._parked.size === 0 && this._stopFollowingChips) {
42194
+ this._stopFollowingChips();
42195
+ this._stopFollowingChips = null;
42196
+ }
42197
+ }
42198
+ /** Whether the agent is flying home to be removed. */
42199
+ isLeaving(agentOrId) {
42200
+ return this._leaving.has(typeof agentOrId === "string" ? agentOrId : agentOrId?.id);
42201
+ }
42202
+ /** Resolves once the agent is removed (at once when it is not leaving). */
42203
+ whenRemoved(agentOrId) {
42204
+ return this._leaving.get(typeof agentOrId === "string" ? agentOrId : agentOrId?.id)?.done ?? Promise.resolve();
41674
42205
  }
41675
42206
  /**
41676
42207
  * Adds an agent and shows its cursor. Adding the same agent again does nothing.
@@ -41683,6 +42214,7 @@ var UpmadeAgentManager = class {
41683
42214
  }
41684
42215
  const existing = this._agents.get(agent2.id);
41685
42216
  if (existing === agent2) {
42217
+ this.stopLeaving(agent2.id);
41686
42218
  return agent2;
41687
42219
  }
41688
42220
  if (existing) {
@@ -41695,28 +42227,98 @@ var UpmadeAgentManager = class {
41695
42227
  }
41696
42228
  owner.agentManager.remove(agent2);
41697
42229
  }
41698
- agent2._attach(this._core);
42230
+ const startsAtHome = agent2._attach(this._core);
41699
42231
  this._agents.set(agent2.id, agent2);
41700
42232
  this._agentSubscriptions.set(agent2.id, agent2.on("change", () => this.scheduleChange()));
41701
42233
  this.scheduleChange();
42234
+ this.watchUserSelection();
42235
+ if (startsAtHome) {
42236
+ this.park(agent2);
42237
+ }
41702
42238
  return agent2;
41703
42239
  }
41704
42240
  /**
41705
- * Removes an agent: its running action is rolled back, queued actions resolve with `'agent-removed'`,
41706
- * and its cursor and history are dropped. Returns `false` if the agent was not added.
42241
+ * Removes an agent: its running action is rolled back, queued actions resolve with `'agent-removed'`, and its
42242
+ * cursor and history are dropped. An agent parked at its chip goes at once. Otherwise, with a home (the editor's
42243
+ * chat box), the cursor first flies back behind it, and
42244
+ * the agent is removed when it arrives (`whenRemoved()`); it accepts no actions meanwhile. `immediate` removes it at
42245
+ * once. Returns `false` if the agent was not added.
41707
42246
  */
41708
- remove(agentOrId) {
42247
+ remove(agentOrId, options = {}) {
41709
42248
  const id2 = typeof agentOrId === "string" ? agentOrId : agentOrId?.id;
41710
42249
  const agent2 = id2 !== void 0 ? this._agents.get(id2) : void 0;
41711
42250
  if (!agent2 || typeof agentOrId !== "string" && agentOrId !== agent2) {
41712
42251
  return false;
41713
42252
  }
42253
+ if (this._leaving.has(agent2.id)) {
42254
+ if (options.immediate) this.finishLeaving(agent2.id);
42255
+ return true;
42256
+ }
42257
+ const cursor = this._core.agenticCursorManager.get(agent2.id);
42258
+ const parked = this._parked.has(agent2.id) && !cursor?.isMoving;
42259
+ const home = !options.immediate && !this._disposed && !parked && cursor?.visible ? this.getHomePoint(agent2.id) : null;
42260
+ if (!home) {
42261
+ this.detach(agent2);
42262
+ return true;
42263
+ }
42264
+ let resolve;
42265
+ const done = new Promise((r3) => resolve = r3);
42266
+ const leaving = { done, resolve, target: home, flight: 0, stopFollowing: null };
42267
+ const start = this.getIdleLabelPoint(agent2);
42268
+ this._leaving.set(agent2.id, leaving);
42269
+ this._core.agenticActionManager.cancel(agent2.id, "agent-removed");
42270
+ this._core.agenticActionManager.setSelection(agent2.id, []);
42271
+ this.scheduleChange();
42272
+ this._parked.delete(agent2.id);
42273
+ const cursors = this._core.agenticCursorManager;
42274
+ if (start) {
42275
+ cursors.setPosition(agent2.id, start);
42276
+ }
42277
+ this.flyLeaving(agent2, leaving, home);
42278
+ leaving.stopFollowing = cursors.onBeforeFrame(() => {
42279
+ if (this._leaving.get(agent2.id) !== leaving) return;
42280
+ const point2 = this.getHomePoint(agent2.id);
42281
+ if (point2 && Number.isFinite(point2.x) && Number.isFinite(point2.y) && Math.hypot(point2.x - leaving.target.x, point2.y - leaving.target.y) > 0.5) {
42282
+ this.flyLeaving(agent2, leaving, point2);
42283
+ }
42284
+ });
42285
+ return true;
42286
+ }
42287
+ /** Flies a leaving agent's cursor to `target`, its chip, and removes the agent once it lands there. */
42288
+ flyLeaving(agent2, leaving, target2) {
42289
+ leaving.target = target2;
42290
+ const flight = ++leaving.flight;
42291
+ this._core.agenticCursorManager.move(agent2.id, target2, { speed: agent2.speed }).catch(() => void 0).then(() => {
42292
+ if (this._leaving.get(agent2.id) === leaving && leaving.flight === flight) this.finishLeaving(agent2.id);
42293
+ });
42294
+ }
42295
+ /** Removes an agent that was flying home, if it still is. */
42296
+ finishLeaving(id2) {
42297
+ const leaving = this._leaving.get(id2);
42298
+ if (!leaving) return;
42299
+ this._leaving.delete(id2);
42300
+ leaving.stopFollowing?.();
42301
+ const agent2 = this._agents.get(id2);
42302
+ if (agent2) this.detach(agent2);
42303
+ leaving.resolve();
42304
+ }
42305
+ /** Keeps an agent that was flying home. */
42306
+ stopLeaving(id2) {
42307
+ const leaving = this._leaving.get(id2);
42308
+ if (!leaving) return;
42309
+ this._leaving.delete(id2);
42310
+ leaving.stopFollowing?.();
42311
+ this._core.agenticCursorManager.stopAnimation(id2);
42312
+ this.scheduleChange();
42313
+ leaving.resolve();
42314
+ }
42315
+ detach(agent2) {
41714
42316
  this._agents.delete(agent2.id);
42317
+ this._parked.delete(agent2.id);
41715
42318
  this._agentSubscriptions.get(agent2.id)?.();
41716
42319
  this._agentSubscriptions.delete(agent2.id);
41717
42320
  agent2._detach();
41718
42321
  this.scheduleChange();
41719
- return true;
41720
42322
  }
41721
42323
  get(id2) {
41722
42324
  return this._agents.get(id2) ?? null;
@@ -41724,12 +42326,12 @@ var UpmadeAgentManager = class {
41724
42326
  getAll() {
41725
42327
  return Array.from(this._agents.values());
41726
42328
  }
41727
- /** The added agents as shown in the avatar stack. */
42329
+ /** The added agents as reported in `agentsChange`. */
41728
42330
  getPresences() {
41729
42331
  return this.getAll().map((agent2) => agent2.toPresence());
41730
42332
  }
41731
42333
  /**
41732
- * Subscribes to changes of the agent list and of what the avatar stack shows (name, color, avatar,
42334
+ * Subscribes to changes of the agent list and of what is shown of them (name, color, avatar,
41733
42335
  * status, visibility, activity). Coalesced to one call per microtask; never called for plain motion.
41734
42336
  */
41735
42337
  onChange(listener) {
@@ -41807,6 +42409,7 @@ var UpmadeAgentBroadcaster = class {
41807
42409
  name: agent2.name,
41808
42410
  color: cursor.color,
41809
42411
  ...agent2.avatarUrl ? { avatarUrl: agent2.avatarUrl } : {},
42412
+ ...cursor.cursorIcon ? { cursorIcon: cursor.cursorIcon } : {},
41810
42413
  status,
41811
42414
  visible: cursor.visible,
41812
42415
  activeAction: cursor.activeAction,
@@ -41873,7 +42476,7 @@ var UpmadeAgentBroadcaster = class {
41873
42476
  }
41874
42477
  };
41875
42478
  function structureOf(payload) {
41876
- return JSON.stringify(payload.map((agent2) => [agent2.id, agent2.name, agent2.color, agent2.avatarUrl ?? null, agent2.visible]));
42479
+ return JSON.stringify(payload.map((agent2) => [agent2.id, agent2.name, agent2.color, agent2.avatarUrl ?? null, agent2.cursorIcon ?? null, agent2.visible]));
41877
42480
  }
41878
42481
  __name(structureOf, "structureOf");
41879
42482
  function round2(value) {
@@ -41881,6 +42484,83 @@ function round2(value) {
41881
42484
  }
41882
42485
  __name(round2, "round");
41883
42486
 
42487
+ // src/helpers/viewport-overlay.helper.ts
42488
+ var UPMADE_CURSOR_ICON_MAX_LENGTH = 8192;
42489
+ var UpmadeViewportOverlayHelper = class _UpmadeViewportOverlayHelper {
42490
+ static {
42491
+ __name(this, "UpmadeViewportOverlayHelper");
42492
+ }
42493
+ static worldToScreen(state, worldX, worldY) {
42494
+ return {
42495
+ x: worldX * state.scale + state.translateX,
42496
+ y: worldY * state.scale + state.translateY
42497
+ };
42498
+ }
42499
+ static isInViewport(state, screenX, screenY) {
42500
+ return screenX >= 0 && screenX <= state.viewportWidth && screenY >= 0 && screenY <= state.viewportHeight;
42501
+ }
42502
+ /** Clamps an off-screen point to the viewport edge, returning the nearest edge and the direction to the point. */
42503
+ static clampToEdge(state, screenX, screenY, padding) {
42504
+ const { viewportWidth, viewportHeight } = state;
42505
+ const clampedX = Math.max(padding, Math.min(viewportWidth - padding, screenX));
42506
+ const clampedY = Math.max(padding, Math.min(viewportHeight - padding, screenY));
42507
+ const distLeft = clampedX - padding;
42508
+ const distRight = viewportWidth - padding - clampedX;
42509
+ const distTop = clampedY - padding;
42510
+ const distBottom = viewportHeight - padding - clampedY;
42511
+ let edge = "top";
42512
+ const minDist = Math.min(distLeft, distRight, distTop, distBottom);
42513
+ if (minDist === distLeft) edge = "left";
42514
+ else if (minDist === distRight) edge = "right";
42515
+ else if (minDist === distTop) edge = "top";
42516
+ else edge = "bottom";
42517
+ const angle = Math.atan2(screenY - clampedY, screenX - clampedX);
42518
+ return { x: clampedX, y: clampedY, angle, edge };
42519
+ }
42520
+ static getInitials(name) {
42521
+ const parts = name.trim().split(/\s+/);
42522
+ if (parts.length === 0 || parts.length === 1 && parts[0].length <= 1) {
42523
+ return name;
42524
+ }
42525
+ if (parts.length === 1) {
42526
+ return parts[0][0].toUpperCase();
42527
+ }
42528
+ return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
42529
+ }
42530
+ /**
42531
+ * The image source of a cursor icon (`IUpmadeUser.cursorIcon`, `UpmadeAgentOptions.cursorIcon`), or `null` when
42532
+ * there is none or it is not usable. SVG markup becomes a `data:` URL; image URLs are accepted when they are
42533
+ * http(s), `data:image/` or relative. Icons are always drawn as images, never as markup, so an icon that comes
42534
+ * from a collaborator cannot run scripts or reach the page.
42535
+ */
42536
+ static getCursorIconSrc(icon) {
42537
+ if (typeof icon !== "string") {
42538
+ return null;
42539
+ }
42540
+ const value = icon.trim();
42541
+ if (value.length === 0 || value.length > UPMADE_CURSOR_ICON_MAX_LENGTH) {
42542
+ return null;
42543
+ }
42544
+ if (value.startsWith("<")) {
42545
+ const svgTag = /<svg\b[^>]*>/i.exec(value);
42546
+ if (!svgTag) {
42547
+ return null;
42548
+ }
42549
+ 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);
42550
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(markup)}`;
42551
+ }
42552
+ return _UpmadeViewportOverlayHelper.isSafeImageUrl(value, UPMADE_CURSOR_ICON_MAX_LENGTH) ? value : null;
42553
+ }
42554
+ /** Whether a URL is http(s), `data:image/` or relative, so a collaborator cannot point images at other schemes. */
42555
+ static isSafeImageUrl(value, maxLength = 2048) {
42556
+ if (typeof value !== "string" || value.length === 0 || value.length > maxLength) {
42557
+ return false;
42558
+ }
42559
+ const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(value.trim())?.[1]?.toLowerCase();
42560
+ return scheme === void 0 || scheme === "http" || scheme === "https" || scheme === "data" && /^data:image\//i.test(value.trim());
42561
+ }
42562
+ };
42563
+
41884
42564
  // src/classes/managers/remote-agent.manager.ts
41885
42565
  var MAX_NAME_LENGTH = 100;
41886
42566
  var UpmadeRemoteAgentManager = class {
@@ -41956,6 +42636,7 @@ var UpmadeRemoteAgentManager = class {
41956
42636
  name: entry.agent.name,
41957
42637
  color: entry.agent.color,
41958
42638
  ...entry.agent.avatarUrl ? { avatarUrl: entry.agent.avatarUrl } : {},
42639
+ ...entry.agent.cursorIcon ? { cursorIcon: entry.agent.cursorIcon } : {},
41959
42640
  status: entry.agent.status ?? void 0,
41960
42641
  visible: entry.agent.visible,
41961
42642
  position: { ...entry.rendered },
@@ -41970,7 +42651,7 @@ var UpmadeRemoteAgentManager = class {
41970
42651
  canRedo: false
41971
42652
  }));
41972
42653
  }
41973
- /** Remote agents as shown in avatar stacks. */
42654
+ /** Remote agents as reported in `agentsChange`. */
41974
42655
  getPresences() {
41975
42656
  return Array.from(this._entries.values()).map((entry) => ({
41976
42657
  id: entry.agent.id,
@@ -41995,7 +42676,7 @@ var UpmadeRemoteAgentManager = class {
41995
42676
  isClaimed(objectId, kind) {
41996
42677
  return this._claimed.has(objectId) || kind === "target" && this._selected.has(objectId);
41997
42678
  }
41998
- /** Subscribes to structural changes (agents added or removed, name, color, status, activity, selection). */
42679
+ /** Subscribes to structural changes (agents added or removed, name, color, icon, status, activity, selection). */
41999
42680
  onChange(listener) {
42000
42681
  this._changeListeners.add(listener);
42001
42682
  return () => this._changeListeners.delete(listener);
@@ -42095,7 +42776,9 @@ function parseAgent(raw) {
42095
42776
  id: value["id"].slice(0, MAX_NAME_LENGTH),
42096
42777
  name: value["name"].slice(0, MAX_NAME_LENGTH),
42097
42778
  color: value["color"].slice(0, MAX_NAME_LENGTH),
42098
- ...isSafeImageUrl(value["avatarUrl"]) ? { avatarUrl: value["avatarUrl"] } : {},
42779
+ ...UpmadeViewportOverlayHelper.isSafeImageUrl(value["avatarUrl"]) ? { avatarUrl: value["avatarUrl"] } : {},
42780
+ // Only icons the overlay can draw (as an image, never as markup).
42781
+ ...UpmadeViewportOverlayHelper.getCursorIconSrc(value["cursorIcon"]) ? { cursorIcon: value["cursorIcon"] } : {},
42099
42782
  status: typeof value["status"] === "string" && value["status"] ? value["status"].slice(0, AGENT_BROADCAST_MAX_STATUS_LENGTH) : null,
42100
42783
  visible: value["visible"] !== false,
42101
42784
  activeAction: typeof value["activeAction"] === "string" ? value["activeAction"] : null,
@@ -42145,14 +42828,6 @@ function parseHostUser(raw) {
42145
42828
  };
42146
42829
  }
42147
42830
  __name(parseHostUser, "parseHostUser");
42148
- function isSafeImageUrl(value) {
42149
- if (typeof value !== "string" || value.length === 0 || value.length > 2048) {
42150
- return false;
42151
- }
42152
- const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(value.trim())?.[1]?.toLowerCase();
42153
- return scheme === void 0 || scheme === "http" || scheme === "https" || scheme === "data" && /^data:image\//i.test(value.trim());
42154
- }
42155
- __name(isSafeImageUrl, "isSafeImageUrl");
42156
42831
 
42157
42832
  // src/interfaces/chat-session.interface.ts
42158
42833
  var UPMADE_CHAT_PROTOCOL_VERSION = 1;
@@ -42643,6 +43318,12 @@ var DEFAULT_MAX_STEPS = 25;
42643
43318
  var DEFAULT_THINKING_STATUS = "Thinking\u2026";
42644
43319
  var STOPPED_OUTPUT = JSON.stringify({ completed: false, reason: "aborted", hint: "The user stopped the response. Do not retry unless asked." });
42645
43320
  var INTERRUPTED_OUTPUT = JSON.stringify({ completed: false, reason: "aborted", hint: "The tool call was interrupted and did not run." });
43321
+ var BLOCKED_OUTPUT = JSON.stringify({
43322
+ completed: false,
43323
+ reason: "aborted",
43324
+ hint: "Not run: an earlier call met objects the user is working on, so the response ended there."
43325
+ });
43326
+ var BLOCKING_REASONS = /* @__PURE__ */ new Set(["user-selected", "user-interaction"]);
42646
43327
  var busyAgents = /* @__PURE__ */ new WeakSet();
42647
43328
  var busyCores = /* @__PURE__ */ new WeakSet();
42648
43329
  function isUpmadeChatSession(value) {
@@ -42658,7 +43339,7 @@ var RunEnd = class {
42658
43339
  __name(this, "RunEnd");
42659
43340
  }
42660
43341
  };
42661
- var UpmadeChatSession = class {
43342
+ var UpmadeChatSession = class _UpmadeChatSession {
42662
43343
  static {
42663
43344
  __name(this, "UpmadeChatSession");
42664
43345
  }
@@ -42680,6 +43361,8 @@ var UpmadeChatSession = class {
42680
43361
  _pendingDetach = false;
42681
43362
  /** Why the running prompt was ended from outside. */
42682
43363
  _endReason = null;
43364
+ /** Sessions of `forAgent()`, per agent ID. They are bound wherever this session is. */
43365
+ _agentSessions = /* @__PURE__ */ new Map();
42683
43366
  _listeners = /* @__PURE__ */ new Map();
42684
43367
  constructor(options) {
42685
43368
  if (!options || typeof options.transport !== "function") {
@@ -42777,6 +43460,42 @@ var UpmadeChatSession = class {
42777
43460
  stop() {
42778
43461
  this.endRun("stopped");
42779
43462
  }
43463
+ /**
43464
+ * A session in which the model acts as `agent`: it has this session's options (transport, system, context, tools,
43465
+ * canvas tools, steps, instant, thinking status, eager tool calls) but its own conversation, which starts empty or
43466
+ * with `options.messages` (used only when the session is created, e.g. to restore it from `messages`).
43467
+ * The same agent always gets the same session, so each agent keeps its conversation; this session's own agent gets
43468
+ * this session. Agents are told apart by ID: for a new instance of an agent (e.g. added again after it was removed),
43469
+ * a new session replaces the earlier one (which is unbound) and continues its conversation. It is bound to
43470
+ * whichever editor this session is bound to, and unbound with it (a running prompt then ends with `'detached'`).
43471
+ * Creating one emits `'agent-session'`; `agentSessions` lists them. The editor uses it to run a prompt sent with
43472
+ * an agent chip.
43473
+ */
43474
+ forAgent(agent2, options = {}) {
43475
+ if (agent2 === this._options.agent) {
43476
+ return this;
43477
+ }
43478
+ const earlier = this._agentSessions.get(agent2.id);
43479
+ if (earlier?.agent === agent2) {
43480
+ return earlier;
43481
+ }
43482
+ earlier?._detach();
43483
+ const { messages: _messages, ...parentOptions } = this._options;
43484
+ const session = new _UpmadeChatSession({ ...parentOptions, agent: agent2, messages: options.messages ?? (earlier ? [...earlier.messages] : []) });
43485
+ this._agentSessions.set(agent2.id, session);
43486
+ if (this._core) {
43487
+ session._attach(this._core);
43488
+ if (this._pendingDetach) {
43489
+ session._detachWhenIdle();
43490
+ }
43491
+ }
43492
+ this.emit("agent-session", session);
43493
+ return session;
43494
+ }
43495
+ /** The sessions of `forAgent()`, one per agent ID. Subscribe to `'agent-session'` to hear of new ones. */
43496
+ get agentSessions() {
43497
+ return Array.from(this._agentSessions.values());
43498
+ }
42780
43499
  /** Subscribes to an event; returns a function that unsubscribes. */
42781
43500
  on(event, listener) {
42782
43501
  let listeners = this._listeners.get(event);
@@ -42802,18 +43521,32 @@ var UpmadeChatSession = class {
42802
43521
  /** Binds the session to an editor core. Working as the user, it registers its actor there. @internal */
42803
43522
  _attach(core) {
42804
43523
  this._pendingDetach = false;
42805
- if (this._core === core) {
42806
- return;
42807
- }
42808
- this._detach();
42809
- this._core = core;
42810
- if (!this._options.agent) {
42811
- this._userActor = new UpmadeUserActor();
42812
- this._userActor._attach(core);
43524
+ if (this._core !== core) {
43525
+ this._detach();
43526
+ this._core = core;
43527
+ if (!this._options.agent) {
43528
+ this._userActor = new UpmadeUserActor();
43529
+ this._userActor._attach(core);
43530
+ }
42813
43531
  }
43532
+ this._agentSessions.forEach((session) => session._attach(core));
42814
43533
  }
42815
- /** Unbinds the session: a running prompt ends with `'detached'`. @internal */
43534
+ /** Unbinds the session and its `forAgent()` sessions: running prompts end with `'detached'`. @internal */
42816
43535
  _detach() {
43536
+ this._agentSessions.forEach((session) => session._detach());
43537
+ this.detachSelf();
43538
+ }
43539
+ /** Unbinds the session and its `forAgent()` sessions, each once its running prompt ends (right away when idle). @internal */
43540
+ _detachWhenIdle() {
43541
+ this._agentSessions.forEach((session) => session._detachWhenIdle());
43542
+ if (!this._running) {
43543
+ this.detachSelf();
43544
+ return;
43545
+ }
43546
+ this._pendingDetach = true;
43547
+ }
43548
+ detachSelf() {
43549
+ this._pendingDetach = false;
42817
43550
  if (!this._core) {
42818
43551
  return;
42819
43552
  }
@@ -42822,14 +43555,6 @@ var UpmadeChatSession = class {
42822
43555
  this._userActor = null;
42823
43556
  this._core = null;
42824
43557
  }
42825
- /** Unbinds the session once its running prompt ends (right away when idle). @internal */
42826
- _detachWhenIdle() {
42827
- if (!this._running) {
42828
- this._detach();
42829
- return;
42830
- }
42831
- this._pendingDetach = true;
42832
- }
42833
43558
  // ─── Loop ───────────────────────────────────────────────────────────────────
42834
43559
  /** Ends the running prompt: the abort reaches the transport and the running action, which is rolled back. */
42835
43560
  endRun(reason) {
@@ -42839,7 +43564,7 @@ var UpmadeChatSession = class {
42839
43564
  this._endReason ??= reason;
42840
43565
  this._abort.abort();
42841
43566
  }
42842
- /** Ends the run when the workspace goes away or the agent is removed. */
43567
+ /** Ends the run when the workspace goes away or the agent is removed, and stops it when the agent is sent home. */
42843
43568
  watchRun(core) {
42844
43569
  const unsubscribers = [];
42845
43570
  const map = core.store?.objects;
@@ -42849,6 +43574,7 @@ var UpmadeChatSession = class {
42849
43574
  const agent2 = this._options.agent;
42850
43575
  if (agent2) {
42851
43576
  unsubscribers.push(agent2.on("removed", () => this.endRun("detached")));
43577
+ unsubscribers.push(agent2.on("sent-home", () => this.endRun("stopped")));
42852
43578
  }
42853
43579
  return () => unsubscribers.forEach((unsubscribe) => unsubscribe());
42854
43580
  }
@@ -42872,7 +43598,14 @@ var UpmadeChatSession = class {
42872
43598
  stoppedOutput: STOPPED_OUTPUT,
42873
43599
  interruptedOutput: INTERRUPTED_OUTPUT,
42874
43600
  report: /* @__PURE__ */ __name((update) => this.emit("tool-call", update), "report"),
42875
- run: /* @__PURE__ */ __name((call, onRunning, handle) => this.runCall(call, byName, signal, onRunning, handle), "run"),
43601
+ run: /* @__PURE__ */ __name(async (call, onRunning, handle) => {
43602
+ const outcome = await this.runCall(call, byName, signal, onRunning, handle);
43603
+ if (this._options.agent && isBlockedByUser(outcome.result.output)) {
43604
+ answer.halt(BLOCKED_OUTPUT);
43605
+ this.endRun("blocked");
43606
+ }
43607
+ return outcome;
43608
+ }, "run"),
42876
43609
  begin: /* @__PURE__ */ __name((call) => {
42877
43610
  const tool = byName.get(call.name);
42878
43611
  return tool?.begin ? tool.begin({ signal, toolCallId: call.id }) : null;
@@ -43083,8 +43816,7 @@ var UpmadeChatSession = class {
43083
43816
  const waiters = this._idleWaiters.splice(0);
43084
43817
  waiters.forEach((resolve) => resolve());
43085
43818
  if (this._pendingDetach) {
43086
- this._pendingDetach = false;
43087
- this._detach();
43819
+ this.detachSelf();
43088
43820
  }
43089
43821
  }
43090
43822
  emit(event, payload) {
@@ -43110,7 +43842,7 @@ function toUserMessage(input) {
43110
43842
  }
43111
43843
  __name(toUserMessage, "toUserMessage");
43112
43844
  function describeChips(chips) {
43113
- const lines = chips.map((chip) => {
43845
+ const lines = chips.filter((chip) => !chip.agentId).map((chip) => {
43114
43846
  const name = chip.detail ? `${chip.label} \u203A ${chip.detail}` : chip.label;
43115
43847
  const refs = [chip.objectId ? `objectId: ${chip.objectId}` : null, chip.selector ? `element: ${chip.selector}` : null].filter(Boolean);
43116
43848
  return `- ${name}${refs.length > 0 ? ` (${refs.join(", ")})` : ""}`;
@@ -43157,6 +43889,18 @@ function isAsyncIterable(value) {
43157
43889
  return typeof value === "object" && value !== null && typeof value[Symbol.asyncIterator] === "function";
43158
43890
  }
43159
43891
  __name(isAsyncIterable, "isAsyncIterable");
43892
+ function isBlockedByUser(output) {
43893
+ if (typeof output !== "string" || !output.includes('"reason"')) {
43894
+ return false;
43895
+ }
43896
+ try {
43897
+ const parsed = JSON.parse(output);
43898
+ return parsed?.completed === false && typeof parsed.reason === "string" && BLOCKING_REASONS.has(parsed.reason);
43899
+ } catch {
43900
+ return false;
43901
+ }
43902
+ }
43903
+ __name(isBlockedByUser, "isBlockedByUser");
43160
43904
 
43161
43905
  // src/classes/chat/scripted-transport.ts
43162
43906
  function createScriptedTransport(steps, options = {}) {
@@ -43643,7 +44387,7 @@ var CURRENT_APP_STATE_SCHEMA_VERSION = 2;
43643
44387
  var CURRENT_WORKSPACE_SCHEMA_VERSION = 3;
43644
44388
 
43645
44389
  // src/constants/version.ts
43646
- var UPMADE_VERSION = "0.6.3";
44390
+ var UPMADE_VERSION = "0.7.0-preview.0";
43647
44391
 
43648
44392
  // src/configs/default-engine-config.ts
43649
44393
  var DEFAULT_ENGINE_CONFIG = {
@@ -44279,6 +45023,7 @@ var UpmadeAgentOrigin = class {
44279
45023
  };
44280
45024
 
44281
45025
  // src/classes/structures/object-map.structure.ts
45026
+ var USER_STATUS_MAX_LENGTH = 200;
44282
45027
  var UpmadeObjectMap = class _UpmadeObjectMap {
44283
45028
  static {
44284
45029
  __name(this, "UpmadeObjectMap");
@@ -44474,9 +45219,20 @@ var UpmadeObjectMap = class _UpmadeObjectMap {
44474
45219
  this._awareness.setLocalStateField("user", {
44475
45220
  id: user.id,
44476
45221
  displayName,
44477
- color: user.color || UpmadeUserColorHelper.generateColorFromName(displayName)
45222
+ color: user.color || UpmadeUserColorHelper.generateColorFromName(displayName),
45223
+ ...UpmadeViewportOverlayHelper.getCursorIconSrc(user.cursorIcon) ? { cursorIcon: user.cursorIcon } : {}
44478
45224
  });
44479
45225
  }
45226
+ /**
45227
+ * Shares what the local user is doing (e.g. `'typing…'`) with collaborators, who see it in place of the user's
45228
+ * name on their cursor label (awareness field `status`). `null` or `''` removes it. Cut to 200 characters.
45229
+ */
45230
+ setLocalStatus(status) {
45231
+ if (!this._awareness || this._headless) {
45232
+ return;
45233
+ }
45234
+ this._awareness.setLocalStateField("status", status ? status.slice(0, USER_STATUS_MAX_LENGTH) : null);
45235
+ }
44480
45236
  /**
44481
45237
  * Shares the agents of this client with collaborators (awareness field `agents`); `null` or an
44482
45238
  * empty list removes the field. No-op without awareness and for background maps.
@@ -47306,6 +48062,7 @@ var UpmadeEasingHelper = class _UpmadeEasingHelper {
47306
48062
  var AGENTIC_CURSOR_DEFAULT_SPEED = 1200;
47307
48063
  var AGENTIC_CURSOR_MIN_DURATION = 250;
47308
48064
  var AGENTIC_CURSOR_MAX_DURATION = 1200;
48065
+ var UPMADE_AGENTIC_CURSOR_NOTICE_MS = 4e3;
47309
48066
  var UpmadeAgenticCursorManager = class {
47310
48067
  static {
47311
48068
  __name(this, "UpmadeAgenticCursorManager");
@@ -47320,6 +48077,8 @@ var UpmadeAgenticCursorManager = class {
47320
48077
  _historyProvider = null;
47321
48078
  _frameDemand = null;
47322
48079
  _rafId = null;
48080
+ /** The last notice key handed out. */
48081
+ _noticeKey = 0;
47323
48082
  constructor(core) {
47324
48083
  this._core = core;
47325
48084
  }
@@ -47361,7 +48120,8 @@ var UpmadeAgenticCursorManager = class {
47361
48120
  hostMoveGeneration: 0,
47362
48121
  trackedElement,
47363
48122
  moveToken: 0,
47364
- cancelLookup: null
48123
+ cancelLookup: null,
48124
+ notice: null
47365
48125
  };
47366
48126
  this._cursors.set(id2, entry);
47367
48127
  this.emitChange(id2);
@@ -47468,6 +48228,25 @@ var UpmadeAgenticCursorManager = class {
47468
48228
  entry.queueLength = queueLength;
47469
48229
  this.emitChange(id2);
47470
48230
  }
48231
+ /**
48232
+ * 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
48233
+ * `UPMADE_AGENTIC_CURSOR_NOTICE_MS`; `null` clears it. Each notice gets a new `key`, so the label draws attention to
48234
+ * it again, also for the same reason. @internal
48235
+ */
48236
+ setNotice(id2, notice) {
48237
+ const entry = this._cursors.get(id2);
48238
+ if (!entry) return;
48239
+ clearTimeout(entry.noticeTimer);
48240
+ entry.noticeTimer = void 0;
48241
+ if (!notice) {
48242
+ if (!entry.notice) return;
48243
+ entry.notice = null;
48244
+ } else {
48245
+ entry.notice = { reason: notice.reason, objectIds: [...notice.objectIds], key: ++this._noticeKey };
48246
+ entry.noticeTimer = setTimeout(() => this.setNotice(id2, null), UPMADE_AGENTIC_CURSOR_NOTICE_MS);
48247
+ }
48248
+ this.emitChange(id2);
48249
+ }
47471
48250
  /** Sets the provider of `canUndo` / `canRedo` for snapshots. @internal */
47472
48251
  setHistoryProvider(provider) {
47473
48252
  this._historyProvider = provider;
@@ -47489,6 +48268,7 @@ var UpmadeAgenticCursorManager = class {
47489
48268
  this.supersede(entry);
47490
48269
  this.finishAnimation(entry, false);
47491
48270
  this.setTrackedElement(entry, null);
48271
+ clearTimeout(entry.noticeTimer);
47492
48272
  this._cursors.delete(id2);
47493
48273
  this.emitChange(id2);
47494
48274
  if (!this.needsFrames()) this.stopLoop();
@@ -47645,6 +48425,7 @@ var UpmadeAgenticCursorManager = class {
47645
48425
  /** Stops the animation loop and resolves pending moves. Cursors are kept. */
47646
48426
  cleanup() {
47647
48427
  this._cursors.forEach((entry) => {
48428
+ clearTimeout(entry.noticeTimer);
47648
48429
  this.supersede(entry);
47649
48430
  this.finishAnimation(entry, false);
47650
48431
  this.releaseUnattachedElement(entry);
@@ -47857,8 +48638,10 @@ var UpmadeAgenticCursorManager = class {
47857
48638
  id: entry.id,
47858
48639
  name: entry.appearance.name,
47859
48640
  color: entry.appearance.color,
48641
+ ...entry.appearance.cursorIcon ? { cursorIcon: entry.appearance.cursorIcon } : {},
47860
48642
  status: entry.appearance.status || void 0,
47861
48643
  visible: entry.appearance.visible,
48644
+ ...entry.appearance.cursorActions?.length ? { cursorActions: [...entry.appearance.cursorActions] } : {},
47862
48645
  position: { ...entry.position },
47863
48646
  attachedTo: entry.attachedTo ? { ...entry.attachedTo, offset: { ...entry.attachedTo.offset } } : null,
47864
48647
  isMoving: entry.animation !== null,
@@ -47868,7 +48651,8 @@ var UpmadeAgenticCursorManager = class {
47868
48651
  activeAction: entry.activeAction,
47869
48652
  queueLength: entry.queueLength,
47870
48653
  canUndo: history.canUndo,
47871
- canRedo: history.canRedo
48654
+ canRedo: history.canRedo,
48655
+ ...entry.notice ? { notice: { ...entry.notice, objectIds: [...entry.notice.objectIds] } } : {}
47872
48656
  };
47873
48657
  }
47874
48658
  emitChange(id2) {
@@ -47962,6 +48746,23 @@ var UpmadeAgenticActionRun = class {
47962
48746
  applyingHistory = false;
47963
48747
  /** An abort that arrived while `applyingHistory` was set. */
47964
48748
  heldAbort = null;
48749
+ /**
48750
+ * Agents: whether the action works outside the agent's selection, so its first press clears the selection,
48751
+ * like a person's click elsewhere. Decided when the action starts.
48752
+ */
48753
+ deselectOnPress = false;
48754
+ /**
48755
+ * Agents: the explicit selection the action cleared on its first press; restored if the action ends without
48756
+ * keeping changes. `null` when the action left the selection alone.
48757
+ */
48758
+ clearedSelection = null;
48759
+ /** Whether the cursor has pressed in this run. */
48760
+ hasPressed = false;
48761
+ /**
48762
+ * Whether `displayIds` are shown as selected. Like a person's selection, they show once the cursor presses on
48763
+ * the objects (not while it flies there), or when the executor shows objects on purpose (`display()`).
48764
+ */
48765
+ displaying = false;
47965
48766
  /** Whether the action changed anything. */
47966
48767
  hasMutated = false;
47967
48768
  /** Whether the outcome is decided. */
@@ -48157,10 +48958,15 @@ var UpmadeAgenticActionRun = class {
48157
48958
  this.stop("agent-moved");
48158
48959
  }
48159
48960
  }
48160
- /** Presses the cursor, after re-checking for conflicts. */
48961
+ /** Presses the cursor, after re-checking for conflicts. The first press shows the targets as selected. */
48161
48962
  async press() {
48162
48963
  this.assertActive();
48163
48964
  this.host.checkpoint(this);
48965
+ if (!this.hasPressed) {
48966
+ this.hasPressed = true;
48967
+ this.displaying = true;
48968
+ this.host.handleFirstPress(this);
48969
+ }
48164
48970
  if (this.instant) {
48165
48971
  return;
48166
48972
  }
@@ -48272,6 +49078,7 @@ var UpmadeAgenticActionRun = class {
48272
49078
  /** Shows other objects as selected while the action runs, e.g. a group once it is created. */
48273
49079
  display(objectIds) {
48274
49080
  this.displayIds = [...objectIds];
49081
+ this.displaying = true;
48275
49082
  this.host.showSelection(this.cursorId);
48276
49083
  }
48277
49084
  /** Replaces objects in the agent's selection, e.g. grouped objects by their group. Others stay selected. */
@@ -48334,6 +49141,7 @@ var UpmadeAgenticActionRun = class {
48334
49141
  };
48335
49142
 
48336
49143
  // src/classes/managers/agentic-action.manager.ts
49144
+ var SELECTION_RULE_EXEMPT_ACTIONS = /* @__PURE__ */ new Set(["select", "clearSelection", "undo", "redo"]);
48337
49145
  var KEEP_REASONS = /* @__PURE__ */ new Set(["user-selected", "user-interaction"]);
48338
49146
  var SILENT_REASONS = /* @__PURE__ */ new Set(["workspace-changed", "engine-disconnected"]);
48339
49147
  var UpmadeAgenticActionManager = class {
@@ -48521,6 +49329,15 @@ var UpmadeAgenticActionManager = class {
48521
49329
  }
48522
49330
  run.settled = true;
48523
49331
  const cursors = this._core.agenticCursorManager;
49332
+ if (run.actorKind === "agent" && outcome.kind === "abort" && (outcome.reason === "user-selected" || outcome.reason === "user-interaction")) {
49333
+ const notice = { reason: outcome.reason, objectIds: outcome.objectIds ?? [] };
49334
+ if (!run.executing && notice.objectIds.length > 0 && cursors.resolveTarget({ objectId: notice.objectIds[0] })) {
49335
+ const cursorId = run.cursorId;
49336
+ 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));
49337
+ } else {
49338
+ cursors.setNotice(run.cursorId, notice);
49339
+ }
49340
+ }
48524
49341
  if (run.isFlying && cursors.getHostMoveGeneration(run.cursorId) === run.hostMoveGeneration) {
48525
49342
  cursors.stopAnimation(run.cursorId);
48526
49343
  }
@@ -48540,6 +49357,7 @@ var UpmadeAgenticActionManager = class {
48540
49357
  const reason = outcome.kind === "abort" ? outcome.reason : null;
48541
49358
  const keep = outcome.kind === "commit" || reason !== null && KEEP_REASONS.has(reason);
48542
49359
  let events = null;
49360
+ const createdIds = /* @__PURE__ */ new Set();
48543
49361
  try {
48544
49362
  if (run.hasMutated && run.origin && map && map.isReady) {
48545
49363
  const canWrite = !map.isInsideYjsCallback;
@@ -48549,6 +49367,9 @@ var UpmadeAgenticActionManager = class {
48549
49367
  if (keep) {
48550
49368
  map.stopAgentCapturing(run.cursorId);
48551
49369
  const recording = run.origin.takeRecording();
49370
+ recording.forEach((existedBefore, id2) => {
49371
+ if (!existedBefore) createdIds.add(id2);
49372
+ });
48552
49373
  if (map.getAgentUndoStackLength(run.cursorId) > run.undoLengthAtStart) {
48553
49374
  map.tagLastAgentStackItem(run.cursorId, Array.from(recording.keys()).filter((id2) => !run.selectionObjectIds.has(id2)));
48554
49375
  if (run.actorKind === "user") {
@@ -48581,6 +49402,13 @@ var UpmadeAgenticActionManager = class {
48581
49402
  run.suspendedRedo = null;
48582
49403
  }
48583
49404
  run.runSettleHooks();
49405
+ if (outcome.kind === "commit") {
49406
+ if (run.deselectOnPress) this.applyDeselect(run);
49407
+ this.selectCreatedObjects(run, map, outcome.objectIds, createdIds);
49408
+ } else if (run.clearedSelection && !(keep && run.hasMutated) && this.getSelection(run.cursorId).length === 0) {
49409
+ const existing = map ? run.clearedSelection.filter((id2) => !!map.findById(id2) && !this.isClaimedByOther(id2, run.cursorId, "target")) : [];
49410
+ if (existing.length > 0) this.setSelection(run.cursorId, existing);
49411
+ }
48584
49412
  if (outcome.kind === "commit" && run.finalAttachment) {
48585
49413
  cursors.attach(run.cursorId, run.finalAttachment);
48586
49414
  }
@@ -48713,6 +49541,7 @@ var UpmadeAgenticActionManager = class {
48713
49541
  }
48714
49542
  run.map = map;
48715
49543
  this.bindMap(map);
49544
+ cursors.setNotice(run.cursorId, null);
48716
49545
  run.hostMoveGeneration = cursors.getHostMoveGeneration(run.cursorId);
48717
49546
  cursors.stopAnimation(run.cursorId);
48718
49547
  this.updateActivity(run.cursorId);
@@ -48752,6 +49581,7 @@ var UpmadeAgenticActionManager = class {
48752
49581
  const object2 = map.findById(id2);
48753
49582
  if (object2) run.knownInstances.set(id2, object2);
48754
49583
  });
49584
+ this.deselectIfWorkingElsewhere(run, preparation);
48755
49585
  this.showSelection(run.cursorId);
48756
49586
  const objectIds = await run.executor.execute(run, run.action);
48757
49587
  if (!run.settled) {
@@ -48929,9 +49759,70 @@ var UpmadeAgenticActionManager = class {
48929
49759
  showSelection(cursorId) {
48930
49760
  const explicit = this._selections.get(cursorId)?.ids ?? [];
48931
49761
  const running = this._running.get(cursorId);
48932
- const shown = running && !running.settled && running.executing ? [...explicit, ...running.displayIds] : [...explicit];
49762
+ const shown = running && !running.settled && running.executing && running.displaying ? [...explicit, ...running.displayIds] : [...explicit];
48933
49763
  this._core.agenticCursorManager.setSelectedObjectIds(cursorId, Array.from(new Set(shown)));
48934
49764
  }
49765
+ // ─── Selection rule ─────────────────────────────────────────────────────────
49766
+ //
49767
+ // An agent's selection lasts as long as the agent works on it, like a person's:
49768
+ // - an action on objects that are all in the selection keeps it (move, resize, style, type into it, click it);
49769
+ // - an action on anything else, or one that creates objects (on empty canvas), clears it when its cursor first
49770
+ // presses, like a click elsewhere; if the action then keeps nothing, the selection comes back;
49771
+ // - a `select` that replaces the selection clears the old one on its press too, and shows the new one;
49772
+ // - an action that creates objects selects them once it completes (copies, a new group, a drawn shape or line);
49773
+ // - `select`, `clearSelection`, `undo` and `redo` manage the selection themselves; moving the cursor never changes it.
49774
+ // Actors working as the user don't follow the rule: their selection is the user's own.
49775
+ /** Decides, as the action starts, whether its first press clears the agent's selection: when it works outside it. */
49776
+ deselectIfWorkingElsewhere(run, preparation) {
49777
+ if (run.actorKind !== "agent") return;
49778
+ const selection = this._selections.get(run.cursorId);
49779
+ if (!selection) return;
49780
+ if (run.action.type === "select") {
49781
+ run.deselectOnPress = !run.action.additive;
49782
+ return;
49783
+ }
49784
+ if (SELECTION_RULE_EXEMPT_ACTIONS.has(run.action.type)) return;
49785
+ if (run.action.type === "interactWithElement" && (run.action.interaction.type === "hover" || run.action.interaction.type === "scroll")) return;
49786
+ const touched = this.getTouchedObjectIds(run, preparation);
49787
+ if (touched.length > 0 && touched.every((id2) => selection.expanded.has(id2))) return;
49788
+ run.deselectOnPress = true;
49789
+ }
49790
+ /** The run's cursor pressed for the first time: a pending deselect applies, and its targets show as selected. @internal */
49791
+ handleFirstPress(run) {
49792
+ if (run.deselectOnPress) {
49793
+ this.applyDeselect(run);
49794
+ }
49795
+ this.showSelection(run.cursorId);
49796
+ }
49797
+ /** Clears the agent's selection for a run working elsewhere, remembering it in case the run keeps nothing. */
49798
+ applyDeselect(run) {
49799
+ run.deselectOnPress = false;
49800
+ const ids2 = this.getSelection(run.cursorId);
49801
+ if (ids2.length === 0) return;
49802
+ run.clearedSelection = ids2;
49803
+ this.setSelection(run.cursorId, []);
49804
+ }
49805
+ /** The objects an action works on, for the selection rule. */
49806
+ getTouchedObjectIds(run, preparation) {
49807
+ if (preparation.targetIds.length > 0) return preparation.targetIds;
49808
+ if (preparation.checkLevel !== "existence") return [];
49809
+ const action = run.action;
49810
+ if (action.type === "click" && !isElementTarget(action.target) && !isObjectTarget(action.target) && run.map) {
49811
+ const hit = hitTestTopMost(run.map, action.target);
49812
+ return hit ? [hit.id] : [];
49813
+ }
49814
+ return preparation.referenceIds;
49815
+ }
49816
+ /** Makes the top-level objects a completed agent action created its selection. */
49817
+ selectCreatedObjects(run, map, objectIds, createdIds) {
49818
+ if (run.actorKind !== "agent" || SELECTION_RULE_EXEMPT_ACTIONS.has(run.action.type) || !map || createdIds.size === 0) return;
49819
+ const created = objectIds.filter((id2) => {
49820
+ if (!createdIds.has(id2)) return false;
49821
+ const object2 = map.findById(id2);
49822
+ return !!object2 && !isSelectionObject(object2) && isTopLevel(map, id2);
49823
+ });
49824
+ if (created.length > 0) this.setSelection(run.cursorId, created);
49825
+ }
48935
49826
  /** Drops deleted objects from explicit selections. */
48936
49827
  pruneSelections() {
48937
49828
  if (this._selections.size === 0) {
@@ -49184,6 +50075,7 @@ var UpmadeCore = class {
49184
50075
  _editorId;
49185
50076
  /** Current user for awareness broadcasting */
49186
50077
  _user;
50078
+ _userStatus = null;
49187
50079
  /**
49188
50080
  * Gets the Upmade engine instance.
49189
50081
  * @returns The engine component managing rendering and events
@@ -49333,6 +50225,18 @@ var UpmadeCore = class {
49333
50225
  this._store.setLocalUserId(user?.id ?? null);
49334
50226
  this._store.objects?.setLocalUser(user);
49335
50227
  }
50228
+ /** What the current user is doing, as collaborators see it on the user's cursor label; `null` when nothing. */
50229
+ get userStatus() {
50230
+ return this._userStatus;
50231
+ }
50232
+ /**
50233
+ * Shows what the current user is doing (e.g. `'typing…'` or a message) to collaborators: their editors show it
50234
+ * in place of the user's name on the cursor label, like an agent's status. `null` or `''` shows the name again.
50235
+ */
50236
+ setUserStatus(status) {
50237
+ this._userStatus = status || null;
50238
+ this._store.objects?.setLocalStatus(this._userStatus);
50239
+ }
49336
50240
  /**
49337
50241
  * Creates a new UpmadeCore instance.
49338
50242
  * Initializes the store with default configuration and sets up all managers.
@@ -49512,6 +50416,9 @@ var UpmadeCore = class {
49512
50416
  if (this._user) {
49513
50417
  objectsMap.setLocalUser(this._user);
49514
50418
  }
50419
+ if (this._userStatus) {
50420
+ objectsMap.setLocalStatus(this._userStatus);
50421
+ }
49515
50422
  this._remoteAgentManager.clear();
49516
50423
  this._agentBroadcaster.reset();
49517
50424
  objectsMap.onAwarenessChange((states) => {
@@ -52564,49 +53471,29 @@ var UpmadeSvgExportHelper = class {
52564
53471
  }
52565
53472
  };
52566
53473
 
52567
- // src/helpers/viewport-overlay.helper.ts
52568
- var UpmadeViewportOverlayHelper = class {
52569
- static {
52570
- __name(this, "UpmadeViewportOverlayHelper");
52571
- }
52572
- static worldToScreen(state, worldX, worldY) {
52573
- return {
52574
- x: worldX * state.scale + state.translateX,
52575
- y: worldY * state.scale + state.translateY
52576
- };
52577
- }
52578
- static isInViewport(state, screenX, screenY) {
52579
- return screenX >= 0 && screenX <= state.viewportWidth && screenY >= 0 && screenY <= state.viewportHeight;
52580
- }
52581
- /** Clamps an off-screen point to the viewport edge, returning the nearest edge and the direction to the point. */
52582
- static clampToEdge(state, screenX, screenY, padding) {
52583
- const { viewportWidth, viewportHeight } = state;
52584
- const clampedX = Math.max(padding, Math.min(viewportWidth - padding, screenX));
52585
- const clampedY = Math.max(padding, Math.min(viewportHeight - padding, screenY));
52586
- const distLeft = clampedX - padding;
52587
- const distRight = viewportWidth - padding - clampedX;
52588
- const distTop = clampedY - padding;
52589
- const distBottom = viewportHeight - padding - clampedY;
52590
- let edge = "top";
52591
- const minDist = Math.min(distLeft, distRight, distTop, distBottom);
52592
- if (minDist === distLeft) edge = "left";
52593
- else if (minDist === distRight) edge = "right";
52594
- else if (minDist === distTop) edge = "top";
52595
- else edge = "bottom";
52596
- const angle = Math.atan2(screenY - clampedY, screenX - clampedX);
52597
- return { x: clampedX, y: clampedY, angle, edge };
52598
- }
52599
- static getInitials(name) {
52600
- const parts = name.trim().split(/\s+/);
52601
- if (parts.length === 0 || parts.length === 1 && parts[0].length <= 1) {
52602
- return name;
52603
- }
52604
- if (parts.length === 1) {
52605
- return parts[0][0].toUpperCase();
53474
+ // src/helpers/cursor-label-action.helper.ts
53475
+ var UPMADE_OVERLAY_CONTROL_ATTRIBUTE = "data-upmade-overlay-control";
53476
+ function isOverlayControlEvent(event) {
53477
+ return (event.composedPath?.() ?? []).some(
53478
+ (target2) => typeof target2.hasAttribute === "function" && target2.hasAttribute(UPMADE_OVERLAY_CONTROL_ATTRIBUTE)
53479
+ );
53480
+ }
53481
+ __name(isOverlayControlEvent, "isOverlayControlEvent");
53482
+ function runCursorLabelAction(core, action, event) {
53483
+ try {
53484
+ if (action.onClick) {
53485
+ action.onClick(event);
53486
+ } else if (event.cursorKind === "agent" && event.agentId && action.id === UPMADE_REMOVE_AGENT_CURSOR_ACTION.id) {
53487
+ if (!core.agentManager.sendHome(event.agentId)) {
53488
+ core.agentManager.remove(event.agentId);
53489
+ }
52606
53490
  }
52607
- return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
53491
+ } catch (error) {
53492
+ console.error("[Upmade] A cursor label action failed:", error);
52608
53493
  }
52609
- };
53494
+ core.engine?.emitCursorLabelAction?.(event);
53495
+ }
53496
+ __name(runCursorLabelAction, "runCursorLabelAction");
52610
53497
 
52611
53498
  // src/helpers/wheel.helper.ts
52612
53499
  var UpmadeWheelHelper = class {
@@ -52765,10 +53652,14 @@ export {
52765
53652
  UPMADE_AGENT_BRAND,
52766
53653
  UPMADE_CHAT_PROTOCOL_VERSION,
52767
53654
  UPMADE_CHAT_SESSION_BRAND,
53655
+ UPMADE_CURSOR_ICON_MAX_LENGTH,
52768
53656
  UPMADE_DEFAULT_OBJECT_TITLEBAR,
52769
53657
  UPMADE_OBJECT_APPEAR_MAX_BATCH,
52770
53658
  UPMADE_OBJECT_APPEAR_MAX_STAGGER_INDEX,
52771
53659
  UPMADE_OBJECT_TYPE_ICONS,
53660
+ UPMADE_OBJECT_TYPE_TERMS,
53661
+ UPMADE_OVERLAY_CONTROL_ATTRIBUTE,
53662
+ UPMADE_REMOVE_AGENT_CURSOR_ACTION,
52772
53663
  UPMADE_ROTATION_HANDLE_DISTANCE,
52773
53664
  UPMADE_TITLEBAR_CONTROL_ATTRIBUTE,
52774
53665
  UPMADE_TITLEBAR_DEFAULT_HEIGHT,
@@ -52843,8 +53734,12 @@ export {
52843
53734
  darkTheme,
52844
53735
  defaultIcons,
52845
53736
  formatAgentToolResult,
53737
+ getSelectionLabelPoint,
53738
+ getSelectionTopLeft,
52846
53739
  hasRemoteSyncProvider,
52847
53740
  isLegacyClassName,
53741
+ isObjectReferenceable,
53742
+ isOverlayControlEvent,
52848
53743
  isUpmadeAgent,
52849
53744
  isUpmadeChatSession,
52850
53745
  lightTheme,
@@ -52852,7 +53747,10 @@ export {
52852
53747
  normalizeLegacyClassName,
52853
53748
  parsePartialJson,
52854
53749
  resolveColor,
53750
+ resolveObjectConfigOption,
53751
+ resolveObjectTitle,
52855
53752
  resolveTextToolAvailableFonts,
53753
+ runCursorLabelAction,
52856
53754
  runMigrations,
52857
53755
  toLegacyDocumentName,
52858
53756
  toLegacyDocumentNames