@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
@@ -393,10 +393,14 @@ __export(index_exports, {
393
393
  UPMADE_AGENT_BRAND: () => UPMADE_AGENT_BRAND,
394
394
  UPMADE_CHAT_PROTOCOL_VERSION: () => UPMADE_CHAT_PROTOCOL_VERSION,
395
395
  UPMADE_CHAT_SESSION_BRAND: () => UPMADE_CHAT_SESSION_BRAND,
396
+ UPMADE_CURSOR_ICON_MAX_LENGTH: () => UPMADE_CURSOR_ICON_MAX_LENGTH,
396
397
  UPMADE_DEFAULT_OBJECT_TITLEBAR: () => UPMADE_DEFAULT_OBJECT_TITLEBAR,
397
398
  UPMADE_OBJECT_APPEAR_MAX_BATCH: () => UPMADE_OBJECT_APPEAR_MAX_BATCH,
398
399
  UPMADE_OBJECT_APPEAR_MAX_STAGGER_INDEX: () => UPMADE_OBJECT_APPEAR_MAX_STAGGER_INDEX,
399
400
  UPMADE_OBJECT_TYPE_ICONS: () => UPMADE_OBJECT_TYPE_ICONS,
401
+ UPMADE_OBJECT_TYPE_TERMS: () => UPMADE_OBJECT_TYPE_TERMS,
402
+ UPMADE_OVERLAY_CONTROL_ATTRIBUTE: () => UPMADE_OVERLAY_CONTROL_ATTRIBUTE,
403
+ UPMADE_REMOVE_AGENT_CURSOR_ACTION: () => UPMADE_REMOVE_AGENT_CURSOR_ACTION,
400
404
  UPMADE_ROTATION_HANDLE_DISTANCE: () => UPMADE_ROTATION_HANDLE_DISTANCE,
401
405
  UPMADE_TITLEBAR_CONTROL_ATTRIBUTE: () => UPMADE_TITLEBAR_CONTROL_ATTRIBUTE,
402
406
  UPMADE_TITLEBAR_DEFAULT_HEIGHT: () => UPMADE_TITLEBAR_DEFAULT_HEIGHT,
@@ -471,8 +475,12 @@ __export(index_exports, {
471
475
  darkTheme: () => darkTheme,
472
476
  defaultIcons: () => defaultIcons,
473
477
  formatAgentToolResult: () => formatAgentToolResult,
478
+ getSelectionLabelPoint: () => getSelectionLabelPoint,
479
+ getSelectionTopLeft: () => getSelectionTopLeft,
474
480
  hasRemoteSyncProvider: () => hasRemoteSyncProvider,
475
481
  isLegacyClassName: () => isLegacyClassName,
482
+ isObjectReferenceable: () => isObjectReferenceable,
483
+ isOverlayControlEvent: () => isOverlayControlEvent,
476
484
  isUpmadeAgent: () => isUpmadeAgent,
477
485
  isUpmadeChatSession: () => isUpmadeChatSession,
478
486
  lightTheme: () => lightTheme,
@@ -480,7 +488,10 @@ __export(index_exports, {
480
488
  normalizeLegacyClassName: () => normalizeLegacyClassName,
481
489
  parsePartialJson: () => parsePartialJson,
482
490
  resolveColor: () => resolveColor,
491
+ resolveObjectConfigOption: () => resolveObjectConfigOption,
492
+ resolveObjectTitle: () => resolveObjectTitle,
483
493
  resolveTextToolAvailableFonts: () => resolveTextToolAvailableFonts,
494
+ runCursorLabelAction: () => runCursorLabelAction,
484
495
  runMigrations: () => runMigrations,
485
496
  toLegacyDocumentName: () => toLegacyDocumentName,
486
497
  toLegacyDocumentNames: () => toLegacyDocumentNames
@@ -14167,6 +14178,9 @@ var lightTheme = {
14167
14178
  focusRingColor: "#333333",
14168
14179
  fontFamily: "sans-serif",
14169
14180
  iconColor: "currentColor",
14181
+ primaryColor: "#0a0a0a",
14182
+ primaryHoverColor: "#2a2a2a",
14183
+ primaryTextColor: "#ffffff",
14170
14184
  scrollbarThumbColor: "#ebebeb",
14171
14185
  textPrimary: "#000000",
14172
14186
  textSecondary: "#333333"
@@ -14177,12 +14191,12 @@ var lightTheme = {
14177
14191
  tabBackgroundHover: "rgba(0, 0, 0, 0.05)",
14178
14192
  tabBackgroundSelected: "#ffffff",
14179
14193
  tabLabelMaxWidth: "10rem",
14180
- tabShadowSelected: "0 1px 3px rgba(0, 0, 0, 0.1)",
14194
+ tabShadowSelected: "0 1px 2px rgba(16, 16, 24, 0.08), 0 2px 6px rgba(16, 16, 24, 0.06)",
14181
14195
  tabTextColor: "#666666",
14182
14196
  tabTextColorSelected: "#000000"
14183
14197
  },
14184
14198
  text: {
14185
- selectionBackgroundColor: "#007AFF",
14199
+ selectionBackgroundColor: "#FF6AB5",
14186
14200
  selectionColor: "#ffffff"
14187
14201
  },
14188
14202
  textInput: {
@@ -14193,18 +14207,18 @@ var lightTheme = {
14193
14207
  hoverBorderColor: "#cccccc",
14194
14208
  labelColor: "#333333",
14195
14209
  placeholderColor: "#999999",
14196
- selectionBackground: "#007AFF",
14210
+ selectionBackground: "#FF6AB5",
14197
14211
  selectionColor: "#ffffff",
14198
14212
  suffixBackground: "#f5f5f5",
14199
14213
  suffixColor: "#666666",
14200
14214
  textColor: "#333333"
14201
14215
  },
14202
14216
  selection: {
14203
- borderColor: "#007AFF",
14204
- boxBackgroundColor: "rgba(0, 122, 255, 0.2)",
14205
- boxBorderColor: "rgba(0, 122, 255, 0.5)",
14217
+ borderColor: "#FF6AB5",
14218
+ boxBackgroundColor: "rgba(255, 106, 181, 0.2)",
14219
+ boxBorderColor: "rgba(255, 106, 181, 0.5)",
14206
14220
  handleColor: "#ffffff",
14207
- handleStrokeColor: "#007AFF"
14221
+ handleStrokeColor: "#FF6AB5"
14208
14222
  },
14209
14223
  checkerboard: {
14210
14224
  colorDark: "#cccccc",
@@ -14214,7 +14228,7 @@ var lightTheme = {
14214
14228
  activeBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14215
14229
  backgroundColor: "#ffffff",
14216
14230
  border: "1px solid #ebebeb",
14217
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14231
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14218
14232
  color: "#000000",
14219
14233
  hoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)"
14220
14234
  },
@@ -14226,7 +14240,7 @@ var lightTheme = {
14226
14240
  contextMenu: {
14227
14241
  backgroundColor: "#ffffff",
14228
14242
  border: "1px solid #ebebeb",
14229
- boxShadow: "0 1px 6px rgba(0, 0, 0, 0.12)",
14243
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14230
14244
  dividerColor: "rgba(0, 0, 0, 0.1)",
14231
14245
  itemActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14232
14246
  itemColor: "#333333",
@@ -14236,23 +14250,34 @@ var lightTheme = {
14236
14250
  toolbar: {
14237
14251
  backgroundColor: "#ffffff",
14238
14252
  border: "1px solid #ebebeb",
14239
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14253
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14240
14254
  controlActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14241
14255
  controlColor: "#000000",
14242
14256
  controlHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14243
- controlSelectedBackgroundColor: "#007AFF",
14257
+ controlSelectedBackgroundColor: "#0a0a0a",
14244
14258
  controlSelectedColor: "#ffffff",
14245
14259
  separatorColor: "#ebebeb"
14246
14260
  },
14261
+ button: {
14262
+ primaryActiveBackgroundColor: "#000000",
14263
+ primaryBackgroundColor: "#0a0a0a",
14264
+ primaryHoverBackgroundColor: "#2a2a2a",
14265
+ textActiveBackgroundColor: "rgba(0, 0, 0, 0.1)",
14266
+ textColor: "#0a0a0a",
14267
+ textHoverBackgroundColor: "rgba(0, 0, 0, 0.05)"
14268
+ },
14247
14269
  currentUserDialog: {
14248
14270
  emailColor: "#666666",
14271
+ logoutButtonActiveBackgroundColor: "#000000",
14272
+ logoutButtonBackgroundColor: "#0a0a0a",
14273
+ logoutButtonHoverBackgroundColor: "#2a2a2a",
14249
14274
  nameColor: "#333333"
14250
14275
  },
14251
14276
  dialog: {
14252
14277
  backdropColor: "rgba(0, 0, 0, 0.4)",
14253
14278
  backgroundColor: "#ffffff",
14254
14279
  border: "1px solid #ebebeb",
14255
- boxShadow: "0 4px 24px rgba(0, 0, 0, 0.15)",
14280
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 14px 36px rgba(16, 16, 24, 0.12)",
14256
14281
  closeButtonActiveBackground: "hsl(0, 0%, 0%, 8.6%)",
14257
14282
  closeButtonBackground: "transparent",
14258
14283
  closeButtonColor: "#333333",
@@ -14264,7 +14289,7 @@ var lightTheme = {
14264
14289
  },
14265
14290
  object: {
14266
14291
  borderRadius: "12px",
14267
- boxShadow: "0 1px 2px rgba(20, 18, 31, 0.06), 0 12px 32px -12px rgba(20, 18, 31, 0.22)"
14292
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 14px 36px rgba(16, 16, 24, 0.12)"
14268
14293
  },
14269
14294
  objectAppear: {
14270
14295
  animationDuration: "600ms",
@@ -14273,7 +14298,7 @@ var lightTheme = {
14273
14298
  stagger: "110ms"
14274
14299
  },
14275
14300
  image: {
14276
- dropShadow: "drop-shadow(0 1px 1px rgba(20, 18, 31, 0.06)) drop-shadow(0 8px 12px rgba(20, 18, 31, 0.14))"
14301
+ dropShadow: "drop-shadow(0 1px 2px rgba(16, 16, 24, 0.04)) drop-shadow(0 14px 36px rgba(16, 16, 24, 0.12))"
14277
14302
  },
14278
14303
  loadingPlaceholder: {
14279
14304
  animationDuration: "1.6s",
@@ -14292,29 +14317,29 @@ var lightTheme = {
14292
14317
  subtitleColor: "#666666"
14293
14318
  },
14294
14319
  dropdown: {
14295
- accentColor: "#007bff",
14320
+ accentColor: "#0a0a0a",
14296
14321
  background: "#ffffff",
14297
14322
  borderColor: "#dbdbdb",
14298
14323
  borderRadius: "6px",
14299
14324
  hoverBorderColor: "#cccccc",
14300
14325
  hoverBackgroundColor: "#f0f0f0",
14301
14326
  menuBorderRadius: "6px",
14302
- selectedBackgroundColor: "#007bff1a",
14327
+ selectedBackgroundColor: "rgba(0, 0, 0, 0.06)",
14303
14328
  textColor: "#333333"
14304
14329
  },
14305
14330
  elementHighlight: {
14306
- backgroundColor: "rgba(0, 122, 255, 0.12)",
14307
- color: "#007AFF",
14331
+ backgroundColor: "rgba(255, 106, 181, 0.12)",
14332
+ color: "#FF6AB5",
14308
14333
  labelTextColor: "#ffffff"
14309
14334
  },
14310
14335
  engine: {
14311
14336
  backgroundColor: "#ffffff"
14312
14337
  },
14313
14338
  snap: {
14314
- indicatorFill: "rgba(59, 130, 246, 0.3)",
14315
- indicatorFillInactive: "rgba(59, 130, 246, 0.18)",
14316
- indicatorStroke: "#007bff",
14317
- indicatorStrokeInactive: "rgba(59, 130, 246, 0.5)",
14339
+ indicatorFill: "rgba(255, 106, 181, 0.3)",
14340
+ indicatorFillInactive: "rgba(255, 106, 181, 0.18)",
14341
+ indicatorStroke: "#FF6AB5",
14342
+ indicatorStrokeInactive: "rgba(255, 106, 181, 0.5)",
14318
14343
  lineStroke: "rgba(0, 0, 0, 0.2)"
14319
14344
  },
14320
14345
  fontSize: {
@@ -14342,14 +14367,14 @@ var lightTheme = {
14342
14367
  menuItemDisabledColor: "#aaaaaa",
14343
14368
  menuItemFocusOutline: "2px solid #333333",
14344
14369
  menuItemHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14345
- menuItemSelectedBackgroundColor: "#007AFF",
14370
+ menuItemSelectedBackgroundColor: "#0a0a0a",
14346
14371
  menuItemSelectedColor: "#ffffff",
14347
- menuItemSelectedHoverBackgroundColor: "#007AFF"
14372
+ menuItemSelectedHoverBackgroundColor: "#0a0a0a"
14348
14373
  },
14349
14374
  menu: {
14350
14375
  backgroundColor: "#ffffff",
14351
14376
  border: "1px solid #ebebeb",
14352
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14377
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14353
14378
  itemButtonHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14354
14379
  itemChildOpenBackgroundColor: "hsl(0, 0%, 0%, 3%)",
14355
14380
  itemColor: "#333333",
@@ -14358,19 +14383,19 @@ var lightTheme = {
14358
14383
  itemInputBorderColorOnSelected: "#ffffff",
14359
14384
  itemInputCaretColor: "#333333",
14360
14385
  itemInputCaretColorOnSelected: "#ffffff",
14361
- itemInputSelectionColor: "#007aff",
14386
+ itemInputSelectionColor: "#FF6AB5",
14362
14387
  itemInputSelectionColorOnSelected: "rgba(255, 255, 255, 0.55)",
14363
14388
  itemInputSelectionTextColor: "#ffffff",
14364
14389
  itemInputSelectionTextColorOnSelected: "#ffffff",
14365
14390
  itemOverlayBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
14366
- itemSelectedBackgroundColor: "#007aff",
14391
+ itemSelectedBackgroundColor: "#0a0a0a",
14367
14392
  itemSelectedColor: "#ffffff"
14368
14393
  },
14369
14394
  moreMenu: {
14370
14395
  backgroundColor: "#ffffff",
14371
14396
  border: "1px solid #ebebeb",
14372
14397
  borderRadius: "12px",
14373
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14398
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14374
14399
  buttonActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14375
14400
  buttonColor: "#000000",
14376
14401
  buttonHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
@@ -14380,7 +14405,7 @@ var lightTheme = {
14380
14405
  backgroundColor: "#ffffff",
14381
14406
  border: "1px solid #e5e7eb",
14382
14407
  borderRadius: "12px",
14383
- boxShadow: "0 8px 20px rgba(15, 23, 42, 0.08)",
14408
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14384
14409
  color: "#111827",
14385
14410
  dismissButtonActiveBackgroundColor: "#e5e7eb",
14386
14411
  dismissButtonBackgroundColor: "transparent",
@@ -14419,7 +14444,7 @@ var lightTheme = {
14419
14444
  hoverBorderColor: "#cccccc",
14420
14445
  inputBackground: "#ffffff",
14421
14446
  labelColor: "#666666",
14422
- selectionBackground: "#007AFF",
14447
+ selectionBackground: "#FF6AB5",
14423
14448
  selectionColor: "#ffffff",
14424
14449
  spinnerActiveBackground: "hsl(0, 0%, 0%, 8.6%)",
14425
14450
  spinnerBackground: "transparent",
@@ -14429,8 +14454,8 @@ var lightTheme = {
14429
14454
  textColor: "#333333"
14430
14455
  },
14431
14456
  opacitySlider: {
14432
- activeColor: "#007AFF",
14433
- thumbBorderColor: "#007AFF",
14457
+ activeColor: "#0a0a0a",
14458
+ thumbBorderColor: "#0a0a0a",
14434
14459
  thumbColor: "#ffffff",
14435
14460
  trackColor: "#e0e0e0"
14436
14461
  },
@@ -14466,18 +14491,18 @@ var lightTheme = {
14466
14491
  revokeButtonColor: "#dc3545",
14467
14492
  revokeButtonHoverBackground: "#dc3545",
14468
14493
  revokeButtonHoverColor: "#ffffff",
14469
- selectionColor: "#cce5ff"
14494
+ selectionColor: "#ffd6eb"
14470
14495
  },
14471
14496
  slideToggle: {
14472
14497
  thumbColor: "#fff",
14473
14498
  thumbSize: "18px",
14474
- trackCheckedColor: "#007AFF",
14499
+ trackCheckedColor: "#0a0a0a",
14475
14500
  trackColor: "#ccc"
14476
14501
  },
14477
14502
  splitButton: {
14478
14503
  backgroundColor: "#ffffff",
14479
14504
  border: "1px solid #ebebeb",
14480
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14505
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14481
14506
  color: "#000000",
14482
14507
  dividerBackgroundColor: "#ebebeb",
14483
14508
  hoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)"
@@ -14489,7 +14514,7 @@ var lightTheme = {
14489
14514
  tooltip: {
14490
14515
  backgroundColor: "#ffffff",
14491
14516
  border: "1px solid #ebebeb",
14492
- boxShadow: "0 1px 6px rgba(0, 0, 0, 0.12)",
14517
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14493
14518
  color: "#000000"
14494
14519
  },
14495
14520
  utilityPanel: {
@@ -14500,39 +14525,43 @@ var lightTheme = {
14500
14525
  },
14501
14526
  watermark: {
14502
14527
  background: "rgba(255, 255, 255, 0.9)",
14503
- boxShadow: "0 1px 3px rgba(0, 0, 0, 0.12)",
14528
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14504
14529
  color: "#52525b",
14505
14530
  logoColor: "#000000"
14506
14531
  },
14507
14532
  chatBox: {
14533
+ accentColor: "#FF6AB5",
14508
14534
  backgroundColor: "#ffffff",
14509
14535
  border: "1px solid #e4e4e7",
14510
- borderRadius: "20px",
14511
- boxShadow: "0 4px 8px rgba(20, 18, 31, 0.04), 0 18px 36px -14px rgba(20, 18, 31, 0.2)",
14512
- buttonBackgroundColor: "#4A7DFF",
14536
+ borderRadius: "16px",
14537
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14538
+ buttonBackgroundColor: "#0a0a0a",
14539
+ buttonBorderRadius: "10px",
14540
+ buttonInset: "4px",
14513
14541
  buttonColor: "#ffffff",
14514
- buttonHoverBackgroundColor: "#3A6AE8",
14515
- caretColor: "#4A7DFF",
14542
+ buttonHoverBackgroundColor: "#2a2a2a",
14543
+ caretColor: "#FF6AB5",
14516
14544
  caretWidth: "2px",
14517
- chipBoxShadow: "0 4px 12px -6px rgba(20, 18, 31, 0.18)",
14545
+ chipBoxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14518
14546
  chipMutedTextColor: "#71717a",
14519
- selectionBackgroundColor: "#4A7DFF",
14547
+ collapsedPaddingY: "8px",
14548
+ selectionBackgroundColor: "#FF6AB5",
14520
14549
  selectionColor: "#ffffff",
14521
14550
  scrollbarThumbColor: "#d4d4d4",
14522
- fontSize: "15px",
14523
- inputBackgroundColor: "#f3f4f6",
14524
- inputBorderRadius: "14px",
14525
- inputMinHeight: "88px",
14526
- padding: "6px",
14527
- placeholderColor: "#9ca3af",
14551
+ fontSize: "16px",
14552
+ inputBackgroundColor: "transparent",
14553
+ inputBorderRadius: "12px",
14554
+ inputMinHeight: "0px",
14555
+ padding: "4px",
14556
+ placeholderColor: "#8d8d8d",
14528
14557
  textColor: "#0a0a0a",
14529
- width: "480px"
14558
+ width: "420px"
14530
14559
  },
14531
14560
  zoomPanel: {
14532
14561
  backgroundColor: "#ffffff",
14533
14562
  border: "1px solid #ebebeb",
14534
14563
  borderRadius: "12px",
14535
- boxShadow: "0 0 3px rgba(0, 0, 0, 0.08)",
14564
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.04), 0 8px 24px rgba(16, 16, 24, 0.07)",
14536
14565
  buttonActiveBackgroundColor: "hsl(0, 0%, 0%, 8.6%)",
14537
14566
  buttonBorderRadius: "8px",
14538
14567
  buttonHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)",
@@ -14542,13 +14571,13 @@ var lightTheme = {
14542
14571
  padding: "4px"
14543
14572
  },
14544
14573
  titlebar: {
14545
- activeBackgroundColor: "#e0efff",
14574
+ activeBackgroundColor: "#ffe8f4",
14546
14575
  activeBorder: "none",
14547
14576
  activeBoxShadow: "none",
14548
- activeButtonFilledBackgroundColor: "#007aff",
14549
- activeIconColor: "#007aff",
14550
- activeMutedTextColor: "rgba(0, 122, 255, 0.6)",
14551
- activeTextColor: "#007aff",
14577
+ activeButtonFilledBackgroundColor: "#FF6AB5",
14578
+ activeIconColor: "#FF6AB5",
14579
+ activeMutedTextColor: "rgba(255, 106, 181, 0.6)",
14580
+ activeTextColor: "#FF6AB5",
14552
14581
  backgroundColor: "#f2f2f2",
14553
14582
  border: "none",
14554
14583
  borderRadius: "8px",
@@ -14560,7 +14589,7 @@ var lightTheme = {
14560
14589
  buttonOutlineColor: "currentColor",
14561
14590
  buttonPressedBackgroundColor: "rgba(0, 0, 0, 0.1)",
14562
14591
  buttonSize: "22px",
14563
- focusRing: "2px solid #007aff",
14592
+ focusRing: "2px solid #FF6AB5",
14564
14593
  fontFamily: "var(--upmade-global-font-family, sans-serif)",
14565
14594
  fontSize: "12px",
14566
14595
  fontWeight: "400",
@@ -14574,7 +14603,7 @@ var lightTheme = {
14574
14603
  mutedTextColor: "#9a9a9a",
14575
14604
  offset: "6px",
14576
14605
  paddingX: "6px",
14577
- selectionBackgroundColor: "#007aff",
14606
+ selectionBackgroundColor: "#FF6AB5",
14578
14607
  selectionColor: "#ffffff",
14579
14608
  textColor: "#5f5f5f",
14580
14609
  titleFontWeight: "600",
@@ -14583,7 +14612,7 @@ var lightTheme = {
14583
14612
  titlebarMenu: {
14584
14613
  backgroundColor: "#ffffff",
14585
14614
  border: "1px solid #ebebeb",
14586
- boxShadow: "0 1px 6px rgba(0, 0, 0, 0.12)",
14615
+ boxShadow: "0 1px 2px rgba(16, 16, 24, 0.05), 0 6px 16px rgba(16, 16, 24, 0.07)",
14587
14616
  itemColor: "#333333",
14588
14617
  itemHoverBackgroundColor: "hsl(0, 0%, 0%, 4.3%)"
14589
14618
  }
@@ -27014,6 +27043,8 @@ var defaultIcons = {
27014
27043
  shapeTriangle: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3L22 21H2L12 3Z"/></svg>',
27015
27044
  image: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></svg>',
27016
27045
  imageOff: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image-off-icon lucide-image-off"><line x1="2" x2="22" y1="2" y2="22"/><path d="M10.41 10.41a2 2 0 1 1-2.83-2.83"/><line x1="13.5" x2="6" y1="13.5" y2="21"/><line x1="18" x2="21" y1="12" y2="15"/><path d="M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59"/><path d="M21 15V5a2 2 0 0 0-2-2H9"/></svg>',
27046
+ bot: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-bot-icon lucide-bot"><path d="M12 8V4H8"/><rect width="16" height="12" x="4" y="8" rx="2"/><path d="M2 14h2"/><path d="M20 14h2"/><path d="M15 13v2"/><path d="M9 13v2"/></svg>',
27047
+ atSign: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-at-sign-icon lucide-at-sign"><circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"/></svg>',
27017
27048
  chevronDown: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m6 9 6 6 6-6"/></svg>',
27018
27049
  chevronUp: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="m18 15-6-6-6 6"/></svg>',
27019
27050
  chevronLeft: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-left-icon lucide-chevron-left"><path d="m15 18-6-6 6-6"/></svg>',
@@ -27027,6 +27058,7 @@ var defaultIcons = {
27027
27058
  sendToBack: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-arrow-down-to-line-icon lucide-arrow-down-to-line"><path d="M12 17V3"/><path d="m6 11 6 6 6-6"/><path d="M19 21H5"/></svg>',
27028
27059
  selectAll: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-square-mouse-pointer-icon lucide-square-mouse-pointer"><path d="M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z"/><path d="M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6"/></svg>',
27029
27060
  download: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download-icon lucide-download"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/></svg>',
27061
+ file: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-icon lucide-file"><path d="M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z"/><path d="M14 2v4a2 2 0 0 0 2 2h4"/></svg>',
27030
27062
  upload: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-upload-icon lucide-upload"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="17 8 12 3 7 8"/><line x1="12" x2="12" y1="3" y2="15"/></svg>',
27031
27063
  undo: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-undo-icon lucide-undo"><path d="M3 7v6h6"/><path d="M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"/></svg>',
27032
27064
  redo: '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-redo-icon lucide-redo"><path d="M21 7v6h-6"/><path d="M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7"/></svg>',
@@ -27185,6 +27217,33 @@ var UpmadeToolConfigHelper = class {
27185
27217
  };
27186
27218
 
27187
27219
  // src/helpers/object-titlebar.helper.ts
27220
+ var UPMADE_OBJECT_TYPE_TERMS = {
27221
+ UpmadeShape: "objectType.shape",
27222
+ UpmadeText: "objectType.text",
27223
+ UpmadeImage: "objectType.image",
27224
+ UpmadePath: "objectType.path",
27225
+ UpmadeLine: "objectType.line",
27226
+ UpmadeGroup: "objectType.group",
27227
+ UpmadeIframeObject: "objectType.iframe",
27228
+ UpmadeDynamicObject: "objectType.dynamic"
27229
+ };
27230
+ function resolveObjectTitle(object2, resolver, translate, onError) {
27231
+ if (resolver) {
27232
+ try {
27233
+ const title = resolver(object2);
27234
+ if (typeof title === "string" && title.length > 0) {
27235
+ return title;
27236
+ }
27237
+ } catch (error) {
27238
+ onError?.(error);
27239
+ }
27240
+ }
27241
+ if (typeof object2.name === "string" && object2.name.length > 0) {
27242
+ return object2.name;
27243
+ }
27244
+ return translate(UPMADE_OBJECT_TYPE_TERMS[object2.__class__] ?? "objectType.object");
27245
+ }
27246
+ __name(resolveObjectTitle, "resolveObjectTitle");
27188
27247
  var UPMADE_TITLEBAR_DEFAULT_HEIGHT = 28;
27189
27248
  var UPMADE_TITLEBAR_DEFAULT_OFFSET = 6;
27190
27249
  var UPMADE_TITLEBAR_DEFAULT_HIDE_BELOW_WIDTH = 40;
@@ -27258,6 +27317,67 @@ var UpmadeObjectTitlebarHelper = class _UpmadeObjectTitlebarHelper {
27258
27317
  }
27259
27318
  };
27260
27319
 
27320
+ // src/helpers/selection-label.helper.ts
27321
+ function getSelectionTopLeft(objects) {
27322
+ let minX = Infinity;
27323
+ let minY = Infinity;
27324
+ for (const object2 of objects) {
27325
+ if (!object2) continue;
27326
+ const polygon = object2.rotatedPolygon;
27327
+ for (const corner of [polygon.topLeft, polygon.topRight, polygon.bottomRight, polygon.bottomLeft]) {
27328
+ if (corner.x < minX) minX = corner.x;
27329
+ if (corner.y < minY) minY = corner.y;
27330
+ }
27331
+ }
27332
+ return Number.isFinite(minX) && Number.isFinite(minY) ? { x: minX, y: minY } : null;
27333
+ }
27334
+ __name(getSelectionTopLeft, "getSelectionTopLeft");
27335
+ function getSelectionLabelPoint(core, objects) {
27336
+ const topLeft = getSelectionTopLeft(objects);
27337
+ if (!topLeft) {
27338
+ return null;
27339
+ }
27340
+ const titlebars = core.objectTitlebarManager;
27341
+ const scale = core.store?.state?.scale || 1;
27342
+ let lift2 = 0;
27343
+ if (titlebars?.isEnabled) {
27344
+ const tolerance = 1 / scale;
27345
+ for (const object2 of objects) {
27346
+ if (!object2 || Math.abs(object2.rotatedBoundingBox.y - topLeft.y) > tolerance) continue;
27347
+ lift2 = Math.max(lift2, titlebars.getTitlebarLift(object2));
27348
+ }
27349
+ }
27350
+ return { x: topLeft.x, y: topLeft.y - lift2 / scale };
27351
+ }
27352
+ __name(getSelectionLabelPoint, "getSelectionLabelPoint");
27353
+
27354
+ // src/helpers/object-config.helper.ts
27355
+ function resolveObjectConfigOption(config, key, object2, fallback, onError) {
27356
+ const value = config?.[key];
27357
+ if (value === void 0) {
27358
+ return fallback;
27359
+ }
27360
+ if (typeof value !== "function") {
27361
+ return value === true;
27362
+ }
27363
+ try {
27364
+ const result = value(object2);
27365
+ if (result && typeof result.then === "function") {
27366
+ onError?.(key, "it must be synchronous; promises are not supported.");
27367
+ return fallback;
27368
+ }
27369
+ return typeof result === "boolean" ? result : fallback;
27370
+ } catch (error) {
27371
+ onError?.(key, error);
27372
+ return fallback;
27373
+ }
27374
+ }
27375
+ __name(resolveObjectConfigOption, "resolveObjectConfigOption");
27376
+ function isObjectReferenceable(config, object2, onError) {
27377
+ return resolveObjectConfigOption(config, "isReferenceable", object2, true, onError);
27378
+ }
27379
+ __name(isObjectReferenceable, "isObjectReferenceable");
27380
+
27261
27381
  // src/helpers/partial-json.helper.ts
27262
27382
  var INCOMPLETE = /* @__PURE__ */ Symbol("incomplete");
27263
27383
  var InvalidJson = class extends Error {
@@ -34326,10 +34446,30 @@ var EN_LOCALE = {
34326
34446
  "zoom.zoomOut": "Zoom out",
34327
34447
  // Chat box
34328
34448
  "chatBox.placeholder": "Ask the AI...",
34449
+ "chatBox.agentPlaceholder": "Message {name}...",
34450
+ "chatBox.removeAgent": "Remove agent",
34451
+ "chatBox.agentWorking": "working",
34329
34452
  "chatBox.submit": "Send",
34330
34453
  "chatBox.stop": "Stop",
34454
+ "chatBox.thinking": "Thinking...",
34455
+ "chatBox.addAgent": "Add agent",
34456
+ "chatBox.agentMenu.close": "Close",
34331
34457
  "chatBox.removeChip": "Remove",
34332
34458
  "chatBox.moreChips": "more",
34459
+ "chatBox.menu": "Add",
34460
+ "chatBox.menu.agent": "Agents",
34461
+ "chatBox.menu.agent.pink": "Pink",
34462
+ "chatBox.menu.agent.green": "Green",
34463
+ "chatBox.menu.agent.yellow": "Yellow",
34464
+ "agentCursor.notice.userSelected": "Selected by you",
34465
+ "agentCursor.notice.userInteraction": "In use by you",
34466
+ "chatBox.menu.back": "Back",
34467
+ "chatBox.menu.selection": "Objects",
34468
+ "chatBox.menu.file": "File",
34469
+ "chatBox.menu.mention": "Mention",
34470
+ "chatBox.mention.empty": "Nothing on the board to mention",
34471
+ "chatBox.mention.noMatch": "No matches",
34472
+ "chatBox.agentMentions": "Agents to mention",
34333
34473
  // Utility panel
34334
34474
  "utility.undo": "Undo",
34335
34475
  "utility.redo": "Redo",
@@ -34458,10 +34598,30 @@ var DE_LOCALE = {
34458
34598
  "zoom.zoomOut": "Verkleinern",
34459
34599
  // Chat box
34460
34600
  "chatBox.placeholder": "Frag die KI...",
34601
+ "chatBox.agentPlaceholder": "Nachricht an {name}...",
34602
+ "chatBox.removeAgent": "Agent entfernen",
34603
+ "chatBox.agentWorking": "arbeitet",
34461
34604
  "chatBox.submit": "Senden",
34462
34605
  "chatBox.stop": "Stoppen",
34606
+ "chatBox.thinking": "Denkt nach...",
34607
+ "chatBox.addAgent": "Agent hinzuf\xFCgen",
34608
+ "chatBox.agentMenu.close": "Schlie\xDFen",
34463
34609
  "chatBox.removeChip": "Entfernen",
34464
34610
  "chatBox.moreChips": "weitere",
34611
+ "chatBox.menu": "Hinzuf\xFCgen",
34612
+ "chatBox.menu.agent": "Agenten",
34613
+ "chatBox.menu.agent.pink": "Pink",
34614
+ "chatBox.menu.agent.green": "Gr\xFCn",
34615
+ "chatBox.menu.agent.yellow": "Gelb",
34616
+ "agentCursor.notice.userSelected": "Von dir ausgew\xE4hlt",
34617
+ "agentCursor.notice.userInteraction": "Von dir in Bearbeitung",
34618
+ "chatBox.menu.back": "Zur\xFCck",
34619
+ "chatBox.menu.selection": "Objekte",
34620
+ "chatBox.menu.file": "Datei",
34621
+ "chatBox.menu.mention": "Erw\xE4hnen",
34622
+ "chatBox.mention.empty": "Nichts auf dem Board zum Erw\xE4hnen",
34623
+ "chatBox.mention.noMatch": "Keine Treffer",
34624
+ "chatBox.agentMentions": "Agenten zum Erw\xE4hnen",
34465
34625
  // Utility panel
34466
34626
  "utility.undo": "R\xFCckg\xE4ngig",
34467
34627
  "utility.redo": "Wiederholen",
@@ -34590,10 +34750,30 @@ var FR_LOCALE = {
34590
34750
  "zoom.zoomOut": "Zoom arri\xE8re",
34591
34751
  // Chat box
34592
34752
  "chatBox.placeholder": "Demandez \xE0 l'IA...",
34753
+ "chatBox.agentPlaceholder": "Message \xE0 {name}...",
34754
+ "chatBox.removeAgent": "Retirer l'agent",
34755
+ "chatBox.agentWorking": "au travail",
34593
34756
  "chatBox.submit": "Envoyer",
34594
34757
  "chatBox.stop": "Arr\xEAter",
34758
+ "chatBox.thinking": "R\xE9flexion...",
34759
+ "chatBox.addAgent": "Ajouter un agent",
34760
+ "chatBox.agentMenu.close": "Fermer",
34595
34761
  "chatBox.removeChip": "Retirer",
34596
34762
  "chatBox.moreChips": "de plus",
34763
+ "chatBox.menu": "Ajouter",
34764
+ "chatBox.menu.agent": "Agents",
34765
+ "chatBox.menu.agent.pink": "Rose",
34766
+ "chatBox.menu.agent.green": "Vert",
34767
+ "chatBox.menu.agent.yellow": "Jaune",
34768
+ "agentCursor.notice.userSelected": "S\xE9lectionn\xE9 par vous",
34769
+ "agentCursor.notice.userInteraction": "Utilis\xE9 par vous",
34770
+ "chatBox.menu.back": "Retour",
34771
+ "chatBox.menu.selection": "Objets",
34772
+ "chatBox.menu.file": "Fichier",
34773
+ "chatBox.menu.mention": "Mentionner",
34774
+ "chatBox.mention.empty": "Rien \xE0 mentionner sur le tableau",
34775
+ "chatBox.mention.noMatch": "Aucun r\xE9sultat",
34776
+ "chatBox.agentMentions": "Agents \xE0 mentionner",
34597
34777
  // Utility panel
34598
34778
  "utility.undo": "Annuler",
34599
34779
  "utility.redo": "R\xE9tablir",
@@ -34722,10 +34902,30 @@ var PT_LOCALE = {
34722
34902
  "zoom.zoomOut": "Diminuir zoom",
34723
34903
  // Chat box
34724
34904
  "chatBox.placeholder": "Pergunte \xE0 IA...",
34905
+ "chatBox.agentPlaceholder": "Mensagem para {name}...",
34906
+ "chatBox.removeAgent": "Remover agente",
34907
+ "chatBox.agentWorking": "trabalhando",
34725
34908
  "chatBox.submit": "Enviar",
34726
34909
  "chatBox.stop": "Parar",
34910
+ "chatBox.thinking": "Pensando...",
34911
+ "chatBox.addAgent": "Adicionar agente",
34912
+ "chatBox.agentMenu.close": "Fechar",
34727
34913
  "chatBox.removeChip": "Remover",
34728
34914
  "chatBox.moreChips": "mais",
34915
+ "chatBox.menu": "Adicionar",
34916
+ "chatBox.menu.agent": "Agentes",
34917
+ "chatBox.menu.agent.pink": "Rosa",
34918
+ "chatBox.menu.agent.green": "Verde",
34919
+ "chatBox.menu.agent.yellow": "Amarelo",
34920
+ "agentCursor.notice.userSelected": "Selecionado por voc\xEA",
34921
+ "agentCursor.notice.userInteraction": "Em uso por voc\xEA",
34922
+ "chatBox.menu.back": "Voltar",
34923
+ "chatBox.menu.selection": "Objetos",
34924
+ "chatBox.menu.file": "Arquivo",
34925
+ "chatBox.menu.mention": "Mencionar",
34926
+ "chatBox.mention.empty": "Nada no quadro para mencionar",
34927
+ "chatBox.mention.noMatch": "Nenhum resultado",
34928
+ "chatBox.agentMentions": "Agentes para mencionar",
34729
34929
  // Utility panel
34730
34930
  "utility.undo": "Desfazer",
34731
34931
  "utility.redo": "Refazer",
@@ -34854,10 +35054,30 @@ var ES_LOCALE = {
34854
35054
  "zoom.zoomOut": "Alejar",
34855
35055
  // Chat box
34856
35056
  "chatBox.placeholder": "Pregunta a la IA...",
35057
+ "chatBox.agentPlaceholder": "Mensaje para {name}...",
35058
+ "chatBox.removeAgent": "Quitar agente",
35059
+ "chatBox.agentWorking": "trabajando",
34857
35060
  "chatBox.submit": "Enviar",
34858
35061
  "chatBox.stop": "Detener",
35062
+ "chatBox.thinking": "Pensando...",
35063
+ "chatBox.addAgent": "A\xF1adir agente",
35064
+ "chatBox.agentMenu.close": "Cerrar",
34859
35065
  "chatBox.removeChip": "Quitar",
34860
35066
  "chatBox.moreChips": "m\xE1s",
35067
+ "chatBox.menu": "A\xF1adir",
35068
+ "chatBox.menu.agent": "Agentes",
35069
+ "chatBox.menu.agent.pink": "Rosa",
35070
+ "chatBox.menu.agent.green": "Verde",
35071
+ "chatBox.menu.agent.yellow": "Amarillo",
35072
+ "agentCursor.notice.userSelected": "Seleccionado por ti",
35073
+ "agentCursor.notice.userInteraction": "En uso por ti",
35074
+ "chatBox.menu.back": "Atr\xE1s",
35075
+ "chatBox.menu.selection": "Objetos",
35076
+ "chatBox.menu.file": "Archivo",
35077
+ "chatBox.menu.mention": "Mencionar",
35078
+ "chatBox.mention.empty": "Nada en el tablero para mencionar",
35079
+ "chatBox.mention.noMatch": "Sin coincidencias",
35080
+ "chatBox.agentMentions": "Agentes para mencionar",
34861
35081
  // Utility panel
34862
35082
  "utility.undo": "Deshacer",
34863
35083
  "utility.redo": "Rehacer",
@@ -34986,10 +35206,30 @@ var PL_LOCALE = {
34986
35206
  "zoom.zoomOut": "Pomniejsz",
34987
35207
  // Chat box
34988
35208
  "chatBox.placeholder": "Zapytaj AI...",
35209
+ "chatBox.agentPlaceholder": "Wiadomo\u015B\u0107 do {name}...",
35210
+ "chatBox.removeAgent": "Usu\u0144 agenta",
35211
+ "chatBox.agentWorking": "pracuje",
34989
35212
  "chatBox.submit": "Wy\u015Blij",
34990
35213
  "chatBox.stop": "Zatrzymaj",
35214
+ "chatBox.thinking": "My\u015Bl\u0119...",
35215
+ "chatBox.addAgent": "Dodaj agenta",
35216
+ "chatBox.agentMenu.close": "Zamknij",
34991
35217
  "chatBox.removeChip": "Usu\u0144",
34992
35218
  "chatBox.moreChips": "wi\u0119cej",
35219
+ "chatBox.menu": "Dodaj",
35220
+ "chatBox.menu.agent": "Agenci",
35221
+ "chatBox.menu.agent.pink": "R\xF3\u017Cowy",
35222
+ "chatBox.menu.agent.green": "Zielony",
35223
+ "chatBox.menu.agent.yellow": "\u017B\xF3\u0142ty",
35224
+ "agentCursor.notice.userSelected": "Zaznaczone przez ciebie",
35225
+ "agentCursor.notice.userInteraction": "U\u017Cywane przez ciebie",
35226
+ "chatBox.menu.back": "Wstecz",
35227
+ "chatBox.menu.selection": "Obiekty",
35228
+ "chatBox.menu.file": "Plik",
35229
+ "chatBox.menu.mention": "Wzmianka",
35230
+ "chatBox.mention.empty": "Nic do wspomnienia na tablicy",
35231
+ "chatBox.mention.noMatch": "Brak wynik\xF3w",
35232
+ "chatBox.agentMentions": "Agenci do wspomnienia",
34993
35233
  // Utility panel
34994
35234
  "utility.undo": "Cofnij",
34995
35235
  "utility.redo": "Pon\xF3w",
@@ -35118,10 +35358,30 @@ var NL_LOCALE = {
35118
35358
  "zoom.zoomOut": "Uitzoomen",
35119
35359
  // Chat box
35120
35360
  "chatBox.placeholder": "Vraag het de AI...",
35361
+ "chatBox.agentPlaceholder": "Bericht aan {name}...",
35362
+ "chatBox.removeAgent": "Agent verwijderen",
35363
+ "chatBox.agentWorking": "aan het werk",
35121
35364
  "chatBox.submit": "Versturen",
35122
35365
  "chatBox.stop": "Stoppen",
35366
+ "chatBox.thinking": "Aan het denken...",
35367
+ "chatBox.addAgent": "Agent toevoegen",
35368
+ "chatBox.agentMenu.close": "Sluiten",
35123
35369
  "chatBox.removeChip": "Verwijderen",
35124
35370
  "chatBox.moreChips": "meer",
35371
+ "chatBox.menu": "Toevoegen",
35372
+ "chatBox.menu.agent": "Agenten",
35373
+ "chatBox.menu.agent.pink": "Roze",
35374
+ "chatBox.menu.agent.green": "Groen",
35375
+ "chatBox.menu.agent.yellow": "Geel",
35376
+ "agentCursor.notice.userSelected": "Door jou geselecteerd",
35377
+ "agentCursor.notice.userInteraction": "Door jou in gebruik",
35378
+ "chatBox.menu.back": "Terug",
35379
+ "chatBox.menu.selection": "Objecten",
35380
+ "chatBox.menu.file": "Bestand",
35381
+ "chatBox.menu.mention": "Vermelden",
35382
+ "chatBox.mention.empty": "Niets op het bord om te vermelden",
35383
+ "chatBox.mention.noMatch": "Geen resultaten",
35384
+ "chatBox.agentMentions": "Agenten om te vermelden",
35125
35385
  // Utility panel
35126
35386
  "utility.undo": "Ongedaan maken",
35127
35387
  "utility.redo": "Opnieuw uitvoeren",
@@ -35250,10 +35510,30 @@ var IT_LOCALE = {
35250
35510
  "zoom.zoomOut": "Riduci",
35251
35511
  // Chat box
35252
35512
  "chatBox.placeholder": "Chiedi all'IA...",
35513
+ "chatBox.agentPlaceholder": "Messaggio a {name}...",
35514
+ "chatBox.removeAgent": "Rimuovi agente",
35515
+ "chatBox.agentWorking": "al lavoro",
35253
35516
  "chatBox.submit": "Invia",
35254
35517
  "chatBox.stop": "Interrompi",
35518
+ "chatBox.thinking": "Sto pensando...",
35519
+ "chatBox.addAgent": "Aggiungi agente",
35520
+ "chatBox.agentMenu.close": "Chiudi",
35255
35521
  "chatBox.removeChip": "Rimuovi",
35256
35522
  "chatBox.moreChips": "altri",
35523
+ "chatBox.menu": "Aggiungi",
35524
+ "chatBox.menu.agent": "Agenti",
35525
+ "chatBox.menu.agent.pink": "Rosa",
35526
+ "chatBox.menu.agent.green": "Verde",
35527
+ "chatBox.menu.agent.yellow": "Giallo",
35528
+ "agentCursor.notice.userSelected": "Selezionato da te",
35529
+ "agentCursor.notice.userInteraction": "In uso da te",
35530
+ "chatBox.menu.back": "Indietro",
35531
+ "chatBox.menu.selection": "Oggetti",
35532
+ "chatBox.menu.file": "File",
35533
+ "chatBox.menu.mention": "Menziona",
35534
+ "chatBox.mention.empty": "Niente da menzionare sulla lavagna",
35535
+ "chatBox.mention.noMatch": "Nessun risultato",
35536
+ "chatBox.agentMentions": "Agenti da menzionare",
35257
35537
  // Utility panel
35258
35538
  "utility.undo": "Annulla",
35259
35539
  "utility.redo": "Ripristina",
@@ -35513,16 +35793,6 @@ var UPMADE_TITLEBAR_EDITABLE_TITLE_ATTRIBUTE = "data-upmade-titlebar-editable-ti
35513
35793
  var UPMADE_TITLEBAR_TITLE_INPUT_ATTRIBUTE = "data-upmade-titlebar-title-input";
35514
35794
  var DEFAULT_LEFT_ELEMENTS = [{ id: "title", type: "title" }];
35515
35795
  var SECTIONS = ["left", "center", "right"];
35516
- var OBJECT_TYPE_TERMS = {
35517
- UpmadeShape: "objectType.shape",
35518
- UpmadeText: "objectType.text",
35519
- UpmadeImage: "objectType.image",
35520
- UpmadePath: "objectType.path",
35521
- UpmadeLine: "objectType.line",
35522
- UpmadeGroup: "objectType.group",
35523
- UpmadeIframeObject: "objectType.iframe",
35524
- UpmadeDynamicObject: "objectType.dynamic"
35525
- };
35526
35796
  var UPMADE_OBJECT_TYPE_ICONS = {
35527
35797
  UpmadeShape: "shapes",
35528
35798
  UpmadeText: "type",
@@ -35611,7 +35881,43 @@ var UpmadeObjectTitlebarManager = class {
35611
35881
  * a selected object (nested groups resolve selection to their direct parent).
35612
35882
  */
35613
35883
  getActiveOwnerIds(candidates) {
35614
- const selectedIds = this._core.store.selectionGroup?.objectIds ?? [];
35884
+ return this.collectOwnerChain(this._core.store.selectionGroup?.objectIds ?? [], candidates);
35885
+ }
35886
+ /**
35887
+ * Returns the color of the agent (local or a collaborator's) that has each titlebar owner selected, or an object
35888
+ * in it, by the rules of `getActiveOwnerIds`. When several agents have selected the same owner, the first wins.
35889
+ */
35890
+ getAgentOwnerColors(candidates) {
35891
+ const colors = /* @__PURE__ */ new Map();
35892
+ for (const cursor of this.getAgentCursors()) {
35893
+ for (const id2 of this.collectOwnerChain(cursor.selectedObjectIds, candidates)) {
35894
+ if (!colors.has(id2)) {
35895
+ colors.set(id2, cursor.color);
35896
+ }
35897
+ }
35898
+ }
35899
+ return colors;
35900
+ }
35901
+ /**
35902
+ * Screen distance from the top edge of `object` to the top of the titlebar it shows on its own, or `0` when it
35903
+ * shows none. Agents' labels sit above a selection, so they move up by this much to sit above its titlebar.
35904
+ */
35905
+ getTitlebarLift(object2) {
35906
+ if (this.getOwnTitlebar(object2).length === 0) {
35907
+ return 0;
35908
+ }
35909
+ const host = this._core.engine?.host;
35910
+ const { height, offset } = this.getMetrics(host && typeof getComputedStyle === "function" ? getComputedStyle(host) : null);
35911
+ return height + offset;
35912
+ }
35913
+ /** The visible agents' cursors with a selection, local ones first. */
35914
+ getAgentCursors() {
35915
+ const local = this._core.agenticCursorManager?.getAll() ?? [];
35916
+ const remote = this._core.remoteAgentManager?.getAll() ?? [];
35917
+ return [...local, ...remote].filter((cursor) => cursor.visible && cursor.selectedObjectIds.length > 0);
35918
+ }
35919
+ /** The given objects and the groups that contain them (nested groups resolve to their direct parent). */
35920
+ collectOwnerChain(selectedIds, candidates) {
35615
35921
  const active = /* @__PURE__ */ new Set();
35616
35922
  if (selectedIds.length === 0) {
35617
35923
  return active;
@@ -35668,16 +35974,21 @@ var UpmadeObjectTitlebarManager = class {
35668
35974
  if (!config || this.getOwners([object2]).length === 0) {
35669
35975
  return [];
35670
35976
  }
35671
- const isActive = this.getActiveOwnerIds(this.withNestedGroups(object2)).has(object2.id);
35977
+ const withNested = this.withNestedGroups(object2);
35978
+ const isActive = this.getActiveOwnerIds(withNested).has(object2.id);
35979
+ const isAgentSelected = this.getAgentOwnerColors(withNested).has(object2.id);
35672
35980
  const anchor2 = UpmadeObjectTitlebarHelper.getAnchor(object2, this._core.store.state, config.rotation ?? "follow");
35673
- return this.isShown(object2, isActive, anchor2.width, config) ? [{ owner: object2, isActive }] : [];
35981
+ return this.isShown(object2, isActive || isAgentSelected, anchor2.width, config) ? [{ owner: object2, isActive }] : [];
35674
35982
  }
35675
- /** The visibility rules: a titlebar being edited stays visible until the edit ends. */
35676
- isShown(owner, isActive, width, config) {
35983
+ /**
35984
+ * The visibility rules: a titlebar being edited stays visible until the edit ends. With `visibility: 'active'`,
35985
+ * `isSelected` also counts an agent's selection, so an agent's titlebar highlight shows.
35986
+ */
35987
+ isShown(owner, isSelected, width, config) {
35677
35988
  if (this._editingTitle?.ownerId === owner.id) {
35678
35989
  return true;
35679
35990
  }
35680
- return (config.visibility !== "active" || isActive) && width >= (config.hideBelowWidth ?? UPMADE_TITLEBAR_DEFAULT_HIDE_BELOW_WIDTH);
35991
+ return (config.visibility !== "active" || isSelected) && width >= (config.hideBelowWidth ?? UPMADE_TITLEBAR_DEFAULT_HIDE_BELOW_WIDTH);
35681
35992
  }
35682
35993
  /** The object and the groups nested in it, so that a selected descendant makes it active. */
35683
35994
  withNestedGroups(object2) {
@@ -35708,13 +36019,15 @@ var UpmadeObjectTitlebarManager = class {
35708
36019
  const viewport = { scale: state.scale, translateX: state.translateX, translateY: state.translateY };
35709
36020
  const owners = this.getOwners(candidates);
35710
36021
  const activeOwnerIds = this.getActiveOwnerIds(candidates);
36022
+ const agentColors = this.getAgentOwnerColors(candidates);
35711
36023
  const titlebars = [];
35712
36024
  const editing = this._editingTitle;
35713
36025
  for (const owner of owners) {
35714
36026
  const isActive = activeOwnerIds.has(owner.id);
36027
+ const agentColor = agentColors.get(owner.id);
35715
36028
  const isEditing = editing?.ownerId === owner.id;
35716
36029
  const anchor2 = UpmadeObjectTitlebarHelper.getAnchor(owner, viewport, config.rotation ?? "follow");
35717
- if (!this.isShown(owner, isActive, anchor2.width, config)) {
36030
+ if (!this.isShown(owner, isActive || agentColor !== void 0, anchor2.width, config)) {
35718
36031
  continue;
35719
36032
  }
35720
36033
  const context = this.createContext(owner, isActive, anchor2.width);
@@ -35728,6 +36041,7 @@ var UpmadeObjectTitlebarManager = class {
35728
36041
  owner,
35729
36042
  context,
35730
36043
  isActive,
36044
+ ...agentColor !== void 0 ? { agentColor } : {},
35731
36045
  transform: UpmadeObjectTitlebarHelper.getTransform(anchor2, viewport.scale),
35732
36046
  width: anchor2.width,
35733
36047
  editingElementId: isEditedElementShown ? editing.elementId : void 0,
@@ -35778,21 +36092,7 @@ var UpmadeObjectTitlebarManager = class {
35778
36092
  }
35779
36093
  /** Resolves an object's title: config resolver, then object name, then a localized type label. */
35780
36094
  resolveTitle(owner) {
35781
- const resolver = this.config?.title;
35782
- if (resolver) {
35783
- try {
35784
- const title = resolver(owner);
35785
- if (typeof title === "string" && title.length > 0) {
35786
- return title;
35787
- }
35788
- } catch (error) {
35789
- this.warnOnce("title", error);
35790
- }
35791
- }
35792
- if (typeof owner.name === "string" && owner.name.length > 0) {
35793
- return owner.name;
35794
- }
35795
- return this.translate(OBJECT_TYPE_TERMS[owner.__class__] ?? "objectType.object");
36095
+ return resolveObjectTitle(owner, this.config?.title, this.translate, (error) => this.warnOnce("title", error));
35796
36096
  }
35797
36097
  /**
35798
36098
  * Finds the object whose titlebar surface was pressed. Presses on titlebar controls return `null`
@@ -36202,6 +36502,10 @@ var UpmadeObjectConfigManager = class {
36202
36502
  isResizable(object2) {
36203
36503
  return this.allowsAll(object2, (unit) => unit.isResizable !== false && this.evaluate("isResizable", unit, true));
36204
36504
  }
36505
+ /** Whether the object can be referenced in the chat, e.g. as a chat box chip. Defaults to `true`. */
36506
+ isReferenceable(object2) {
36507
+ return this.evaluate("isReferenceable", object2, true);
36508
+ }
36205
36509
  /** Applies a check to an object and everything a transform of it also transforms. */
36206
36510
  allowsAll(object2, check) {
36207
36511
  if (object2 instanceof UpmadeSelectionGroup) {
@@ -36218,26 +36522,9 @@ var UpmadeObjectConfigManager = class {
36218
36522
  }
36219
36523
  return true;
36220
36524
  }
36221
- /** Resolves one option for one object. Only a synchronous boolean counts; failures are reported once. */
36525
+ /** Resolves one option for one object; failures are reported once. */
36222
36526
  evaluate(key, object2, fallback) {
36223
- const value = this.config?.[key];
36224
- if (value === void 0) {
36225
- return fallback;
36226
- }
36227
- if (typeof value !== "function") {
36228
- return value === true;
36229
- }
36230
- try {
36231
- const result = value(object2);
36232
- if (result && typeof result.then === "function") {
36233
- this.warnOnce(key, "it must be synchronous; promises are not supported.");
36234
- return fallback;
36235
- }
36236
- return typeof result === "boolean" ? result : fallback;
36237
- } catch (error) {
36238
- this.warnOnce(key, error);
36239
- return fallback;
36240
- }
36527
+ return resolveObjectConfigOption(this.config, key, object2, fallback, (failedKey, error) => this.warnOnce(failedKey, error));
36241
36528
  }
36242
36529
  warnOnce(key, error) {
36243
36530
  if (this._warnedKeys.has(key)) {
@@ -36248,6 +36535,13 @@ var UpmadeObjectConfigManager = class {
36248
36535
  }
36249
36536
  };
36250
36537
 
36538
+ // src/interfaces/cursor-label.interface.ts
36539
+ var UPMADE_REMOVE_AGENT_CURSOR_ACTION = Object.freeze({
36540
+ id: "remove",
36541
+ icon: "x",
36542
+ label: "Send agent back"
36543
+ });
36544
+
36251
36545
  // src/helpers/user-color.helper.ts
36252
36546
  var UpmadeUserColorHelper = class {
36253
36547
  static {
@@ -40228,7 +40522,7 @@ var AGENT_TOOL_SPECS = {
40228
40522
  },
40229
40523
  select: {
40230
40524
  name: "select",
40231
- description: "Makes top-level objects your selection, shown in your color. Never changes the user's selection.",
40525
+ description: "Makes top-level objects your selection, shown in your color. Never changes the user's selection. Your selection lasts while you work on it: acting on objects outside it clears it, and objects you create become your selection.",
40232
40526
  params: { objectIds: req(ids), additive: opt(bool("Add to your selection instead of replacing it.")) },
40233
40527
  actors: AGENT_ONLY,
40234
40528
  describeObjects: false,
@@ -41299,6 +41593,8 @@ var UpmadeAgent = class {
41299
41593
  _name;
41300
41594
  _color;
41301
41595
  _avatarUrl;
41596
+ _cursorIcon;
41597
+ _cursorActions;
41302
41598
  _speed;
41303
41599
  _broadcast;
41304
41600
  _status;
@@ -41317,6 +41613,8 @@ var UpmadeAgent = class {
41317
41613
  this._name = options.name;
41318
41614
  this._color = options.color || UpmadeUserColorHelper.generateColorFromName(options.name);
41319
41615
  this._avatarUrl = options.avatarUrl;
41616
+ this._cursorIcon = options.cursorIcon || null;
41617
+ this._cursorActions = options.cursorActions ? [...options.cursorActions] : [UPMADE_REMOVE_AGENT_CURSOR_ACTION];
41320
41618
  this._speed = options.speed;
41321
41619
  this._broadcast = options.broadcast ?? true;
41322
41620
  this._status = options.status || null;
@@ -41354,6 +41652,29 @@ var UpmadeAgent = class {
41354
41652
  this._avatarUrl = url;
41355
41653
  this.notifyChange();
41356
41654
  }
41655
+ /**
41656
+ * Icon shown before the name on the cursor label: SVG markup or an image URL. `null` (the default) shows a circle in the agent's color.
41657
+ */
41658
+ get cursorIcon() {
41659
+ return this._cursorIcon;
41660
+ }
41661
+ set cursorIcon(icon) {
41662
+ this._cursorIcon = icon || null;
41663
+ this._core?.agenticCursorManager.refresh(this.id);
41664
+ this.notifyChange();
41665
+ }
41666
+ /**
41667
+ * Buttons after the name or status on the cursor label. Defaults to `[UPMADE_REMOVE_AGENT_CURSOR_ACTION]`: an "X"
41668
+ * that sends the agent back behind its chip in the editor's chat box (`sendHome()`), or removes it without one.
41669
+ * `[]` shows none. Clicks call the action's `onClick` and emit the engine's `cursorLabelAction`.
41670
+ */
41671
+ get cursorActions() {
41672
+ return this._cursorActions;
41673
+ }
41674
+ set cursorActions(actions) {
41675
+ this._cursorActions = actions ? [...actions] : [];
41676
+ this._core?.agenticCursorManager.refresh(this.id);
41677
+ }
41357
41678
  /** Same as `avatarUrl` (`IUpmadeUser`). */
41358
41679
  get profileImageUrl() {
41359
41680
  return this._avatarUrl;
@@ -41411,7 +41732,7 @@ var UpmadeAgent = class {
41411
41732
  };
41412
41733
  }
41413
41734
  // ─── Presence ───────────────────────────────────────────────────────────────
41414
- /** Shows a status message below the cursor label; `null` or `''` hides it. */
41735
+ /** Shows what the agent is doing in place of its name on the cursor label; `null` or `''` shows the name again. */
41415
41736
  setStatus(status) {
41416
41737
  this._status = status || null;
41417
41738
  this._core?.agenticCursorManager.refresh(this.id);
@@ -41437,6 +41758,9 @@ var UpmadeAgent = class {
41437
41758
  */
41438
41759
  async moveTo(target2, options = {}) {
41439
41760
  const core = this.requireCore();
41761
+ if (core.agentManager.isLeaving(this.id)) {
41762
+ return { completed: false };
41763
+ }
41440
41764
  return core.agenticCursorManager.move(this.id, target2, { ...options, speed: options.speed ?? this._speed });
41441
41765
  }
41442
41766
  /** Releases the cursor from the object it sticks to. It stays where it is. */
@@ -41455,6 +41779,9 @@ var UpmadeAgent = class {
41455
41779
  */
41456
41780
  async perform(action, options = {}) {
41457
41781
  const core = this.requireCore();
41782
+ if (core.agentManager.isLeaving(this.id)) {
41783
+ return { completed: false, reason: "agent-removed" };
41784
+ }
41458
41785
  const task = this._task;
41459
41786
  if (task?.cancelled) {
41460
41787
  return this.settle(action, { completed: false, reason: "aborted" }, task);
@@ -41480,7 +41807,10 @@ var UpmadeAgent = class {
41480
41807
  interactWithElement(target2, interaction, options = {}) {
41481
41808
  return this.perform({ type: "interactWithElement", target: target2, interaction }, options);
41482
41809
  }
41483
- /** Selects top-level objects for the agent. Never changes the user's selection. */
41810
+ /**
41811
+ * Selects top-level objects for the agent. Never changes the user's selection. The selection lasts while the agent
41812
+ * works on it: an action on anything outside it clears it, and objects an action creates become the selection.
41813
+ */
41484
41814
  select(objectIds, options = {}) {
41485
41815
  const { additive, ...actionOptions } = options;
41486
41816
  return this.perform({ type: "select", objectIds, ...additive !== void 0 ? { additive } : {} }, actionOptions);
@@ -41668,7 +41998,7 @@ var UpmadeAgent = class {
41668
41998
  listeners.add(listener);
41669
41999
  return () => listeners.delete(listener);
41670
42000
  }
41671
- /** How the agent is shown in avatar stacks and `agentsChange`. */
42001
+ /** How the agent is reported in `agentsChange`. */
41672
42002
  toPresence() {
41673
42003
  const state = this.state;
41674
42004
  return {
@@ -41682,6 +42012,7 @@ var UpmadeAgent = class {
41682
42012
  visible: state.visible,
41683
42013
  activeAction: state.activeAction,
41684
42014
  queueLength: state.queueLength,
42015
+ ...this._core?.agentManager.isLeaving(this.id) ? { isLeaving: true } : {},
41685
42016
  isRemote: false
41686
42017
  };
41687
42018
  }
@@ -41690,11 +42021,16 @@ var UpmadeAgent = class {
41690
42021
  get _owner() {
41691
42022
  return this._core;
41692
42023
  }
41693
- /** Creates the cursor in `core` and starts listening. Throws if the cursor can't be created. @internal */
42024
+ /**
42025
+ * Creates the cursor in `core` and starts listening. Returns whether the cursor starts behind the home (the chat box).
42026
+ * Throws if the cursor can't be created. @internal
42027
+ */
41694
42028
  _attach(core) {
41695
42029
  const initial = this._initialPosition;
41696
42030
  const start = initial && canStartAt(core, initial) ? core.agenticCursorManager.resolveTarget(initial) : null;
41697
- const position = start && Number.isFinite(start.x) && Number.isFinite(start.y) ? initial : void 0;
42031
+ const ownStart = start && Number.isFinite(start.x) && Number.isFinite(start.y) ? initial : void 0;
42032
+ const home = ownStart ? null : core.agentManager.getHomePoint(this.id);
42033
+ const position = ownStart ?? home ?? void 0;
41698
42034
  const agent2 = this;
41699
42035
  const cursor = {
41700
42036
  id: this.id,
@@ -41705,6 +42041,12 @@ var UpmadeAgent = class {
41705
42041
  get color() {
41706
42042
  return agent2._color;
41707
42043
  },
42044
+ get cursorIcon() {
42045
+ return agent2._cursorIcon;
42046
+ },
42047
+ get cursorActions() {
42048
+ return agent2._cursorActions;
42049
+ },
41708
42050
  get status() {
41709
42051
  return agent2._status;
41710
42052
  },
@@ -41751,6 +42093,7 @@ var UpmadeAgent = class {
41751
42093
  })
41752
42094
  ];
41753
42095
  this.notifyChange();
42096
+ return !!home;
41754
42097
  }
41755
42098
  /** Removes the cursor (its running action is rolled back) and stops listening. @internal */
41756
42099
  _detach() {
@@ -41766,6 +42109,10 @@ var UpmadeAgent = class {
41766
42109
  this.notifyChange();
41767
42110
  this.emit("removed", void 0);
41768
42111
  }
42112
+ /** Emits `'sent-home'`: the agent was sent back behind its chip and stopped working. @internal */
42113
+ _sentHome() {
42114
+ this.emit("sent-home", void 0);
42115
+ }
41769
42116
  // ─── Internals ──────────────────────────────────────────────────────────────
41770
42117
  setVisible(visible) {
41771
42118
  this._visible = visible;
@@ -41792,7 +42139,7 @@ var UpmadeAgent = class {
41792
42139
  }
41793
42140
  const state = this.state;
41794
42141
  const { position: _position, ...rest } = state;
41795
- const key = JSON.stringify([rest, this._name, this._color, this._avatarUrl, this._broadcast]);
42142
+ const key = JSON.stringify([rest, this._name, this._color, this._avatarUrl, this._cursorIcon, this._broadcast]);
41796
42143
  if (key === this._lastStateKey) {
41797
42144
  return;
41798
42145
  }
@@ -41815,6 +42162,14 @@ var UpmadeAgentManager = class {
41815
42162
  _changeListeners = /* @__PURE__ */ new Set();
41816
42163
  _changeScheduled = false;
41817
42164
  _disposed = false;
42165
+ /** Reports the boxes of the home agents come out from behind and go back behind (the editor's chat box), or `null`. */
42166
+ _homeRectProvider = null;
42167
+ /** Agents flying home before they are removed, with what resolves once they are gone and their flight. */
42168
+ _leaving = /* @__PURE__ */ new Map();
42169
+ /** Agents whose cursor waits behind their chip in the home, with the point it was put at last. */
42170
+ _parked = /* @__PURE__ */ new Map();
42171
+ /** Stops following the chips of parked agents every frame. */
42172
+ _stopFollowingChips = null;
41818
42173
  constructor(core) {
41819
42174
  this._core = core;
41820
42175
  }
@@ -41825,6 +42180,193 @@ var UpmadeAgentManager = class {
41825
42180
  /** Called by the engine when it disconnects (`true`) or connects (`false`). @internal */
41826
42181
  setDisposed(disposed) {
41827
42182
  this._disposed = disposed;
42183
+ if (disposed) {
42184
+ Array.from(this._leaving.keys()).forEach((id2) => this.finishLeaving(id2));
42185
+ }
42186
+ }
42187
+ // ─── Home ───────────────────────────────────────────────────────────────────
42188
+ /**
42189
+ * Reports the home agents come out from behind when added and go back behind when removed, e.g. the editor's chat
42190
+ * box: its box, or with an agent ID the box of that agent's chip in it. Agents appear at, and fly back to, the center
42191
+ * of their chip. `null` (the default) keeps agents appearing at the viewport center and disappearing where they are.
42192
+ */
42193
+ get homeRectProvider() {
42194
+ return this._homeRectProvider;
42195
+ }
42196
+ /**
42197
+ * Sets what reports the home's boxes, see `homeRectProvider`. The engine sets it from its `agentHome` element, so
42198
+ * that reading the DOM stays out of the core. @internal
42199
+ */
42200
+ setHomeRectProvider(provider) {
42201
+ this._homeRectProvider = provider ?? null;
42202
+ }
42203
+ /**
42204
+ * The home's box, relative to the engine's host element (the coordinates cursors are drawn in), or `null` when there
42205
+ * is no home or it is not shown. With `agentId`, the box of that agent's chip in the home when it shows, else the
42206
+ * home's box.
42207
+ */
42208
+ getHomeRect(agentId) {
42209
+ const rect = this._homeRectProvider?.(agentId) ?? null;
42210
+ if (!rect || !(rect.right > rect.left) || !(rect.bottom > rect.top)) {
42211
+ return null;
42212
+ }
42213
+ return { left: rect.left, top: rect.top, right: rect.right, bottom: rect.bottom };
42214
+ }
42215
+ /**
42216
+ * Where agents appear and leave, in world coordinates: the center of the agent's chip in the home, or of the home
42217
+ * while the chip doesn't show; `null` without a home.
42218
+ */
42219
+ getHomePoint(agentId) {
42220
+ const rect = this.getHomeRect(agentId);
42221
+ const state = this._core.store?.state;
42222
+ if (!rect || !state || !(state.scale > 0)) {
42223
+ return null;
42224
+ }
42225
+ const x2 = (rect.left + rect.right) / 2;
42226
+ const y2 = (rect.top + rect.bottom) / 2;
42227
+ return { x: (x2 - state.translateX) / state.scale, y: (y2 - state.translateY) / state.scale };
42228
+ }
42229
+ /**
42230
+ * Sends an agent back behind its chip in the home (in the editor: its chip above the chat box), e.g. with the "X" on
42231
+ * its cursor label. It stops working: its running action is rolled back, its queued actions and a running `task()`
42232
+ * end with `'aborted'`, and a chat session running a prompt for it stops (the agent emits `'sent-home'`). It lets go
42233
+ * of its selection and its cursor flies to the center of its chip, where it waits, hidden behind the home, until
42234
+ * its next action takes it straight to where that happens. The agent stays added: `remove()` removes it.
42235
+ * Returns `false`, and does nothing, without a home, for an agent that is not added and for one on its way out.
42236
+ */
42237
+ sendHome(agentOrId) {
42238
+ const id2 = typeof agentOrId === "string" ? agentOrId : agentOrId?.id;
42239
+ const agent2 = id2 !== void 0 ? this._agents.get(id2) : void 0;
42240
+ if (!agent2 || typeof agentOrId !== "string" && agentOrId !== agent2 || this._leaving.has(agent2.id) || this._disposed) {
42241
+ return false;
42242
+ }
42243
+ const cursors = this._core.agenticCursorManager;
42244
+ const home = cursors.get(agent2.id) ? this.getHomePoint(agent2.id) : null;
42245
+ if (!home) {
42246
+ return false;
42247
+ }
42248
+ const start = this.getIdleLabelPoint(agent2);
42249
+ agent2.cancel();
42250
+ this._core.agenticActionManager.setSelection(agent2.id, []);
42251
+ agent2._sentHome();
42252
+ this.flyHome(agent2, home, start);
42253
+ return true;
42254
+ }
42255
+ /**
42256
+ * Where an idle agent with a selection shows itself: its labels at the selection's top-left corner (its arrow is
42257
+ * hidden meanwhile). A flight home starts there rather than at the hidden arrow, e.g. at the far corner of the shape
42258
+ * it just drew. `null` for a busy agent, whose arrow shows, and for one without a selection.
42259
+ */
42260
+ getIdleLabelPoint(agent2) {
42261
+ const cursor = this._core.agenticCursorManager.get(agent2.id);
42262
+ const ids2 = this._core.agenticActionManager.getSelection(agent2.id);
42263
+ const objects = this._core.store?.objects;
42264
+ if (!cursor || cursor.isMoving || cursor.activeAction || cursor.queueLength > 0 || ids2.length === 0 || !objects) {
42265
+ return null;
42266
+ }
42267
+ const point2 = getSelectionLabelPoint(this._core, ids2.map((id2) => objects.findById(id2)));
42268
+ return point2 && Number.isFinite(point2.x) && Number.isFinite(point2.y) ? point2 : null;
42269
+ }
42270
+ /**
42271
+ * Flies an agent's cursor to its chip in the home and parks it there, unless a new action or move takes over on the
42272
+ * way. With `start`, the flight starts there (see `getIdleLabelPoint`).
42273
+ */
42274
+ flyHome(agent2, home, start) {
42275
+ this._parked.delete(agent2.id);
42276
+ const cursors = this._core.agenticCursorManager;
42277
+ if (start) {
42278
+ cursors.setPosition(agent2.id, start);
42279
+ }
42280
+ cursors.move(agent2.id, home, { speed: agent2.speed }).then((result) => {
42281
+ if (result.completed && this._agents.get(agent2.id) === agent2 && !this._leaving.has(agent2.id)) {
42282
+ this.park(agent2);
42283
+ }
42284
+ }).catch(() => void 0);
42285
+ }
42286
+ /** The user's selection as last seen, by its object IDs, to tell when it changes. */
42287
+ _userSelectionKey = "";
42288
+ /** Stops watching the user's selection. */
42289
+ _stopWatchingUserSelection = null;
42290
+ /** Watches the user's selection, once per frame while agents are added (frames run while their cursors exist). */
42291
+ watchUserSelection() {
42292
+ this._stopWatchingUserSelection ??= this._core.agenticCursorManager.onBeforeFrame(() => this.yieldToUserSelection());
42293
+ }
42294
+ /**
42295
+ * The user selected objects an agent has selected: the agent lets go of its selection and its cursor flies back to
42296
+ * its chip in the home, where it waits until its next action (without a home, it stays where it is). Unlike
42297
+ * `sendHome()`, the agent does not stop: a running action on those objects ends as the user took them over
42298
+ * (`'user-selected'`), and a chat session running a prompt for it goes on. Checked whenever the user's selection
42299
+ * changes, for the objects in it then.
42300
+ */
42301
+ yieldToUserSelection() {
42302
+ const ids2 = this._core.store.selectionGroup?.objectIds ?? [];
42303
+ const key = ids2.join("\0");
42304
+ if (key === this._userSelectionKey) {
42305
+ return;
42306
+ }
42307
+ this._userSelectionKey = key;
42308
+ if (ids2.length === 0 || this._disposed) {
42309
+ return;
42310
+ }
42311
+ const selected = new Set(ids2);
42312
+ const actions = this._core.agenticActionManager;
42313
+ for (const agent2 of this._agents.values()) {
42314
+ if (this._leaving.has(agent2.id) || !actions.getSelection(agent2.id).some((id2) => selected.has(id2))) {
42315
+ continue;
42316
+ }
42317
+ const start = this.getIdleLabelPoint(agent2);
42318
+ actions.setSelection(agent2.id, []);
42319
+ const home = this._core.agenticCursorManager.get(agent2.id) ? this.getHomePoint(agent2.id) : null;
42320
+ if (home && !this._parked.has(agent2.id)) {
42321
+ this.flyHome(agent2, home, start);
42322
+ }
42323
+ }
42324
+ }
42325
+ /** Whether the agent's cursor waits behind its chip in the home. */
42326
+ isHome(agentOrId) {
42327
+ return this._parked.has(typeof agentOrId === "string" ? agentOrId : agentOrId?.id);
42328
+ }
42329
+ /**
42330
+ * Keeps the agent's cursor on the center of its chip in the home, hidden behind it, also while the chip moves, the
42331
+ * view pans or zooms, or the chip only shows after the agent was added (the cursor waits at the home's center
42332
+ * until then). It stays until anything else moves the cursor, e.g. its next action.
42333
+ */
42334
+ park(agent2) {
42335
+ const cursors = this._core.agenticCursorManager;
42336
+ const cursor = cursors.get(agent2.id);
42337
+ if (!cursor) return;
42338
+ this._parked.set(agent2.id, { ...cursor.position });
42339
+ this._stopFollowingChips ??= cursors.onBeforeFrame(() => this.followChips());
42340
+ this.followChips();
42341
+ cursors.requestFrames();
42342
+ }
42343
+ /** Puts the cursors of parked agents on their chips; lets go of those that something else moved. */
42344
+ followChips() {
42345
+ const cursors = this._core.agenticCursorManager;
42346
+ this._parked.forEach((placed, id2) => {
42347
+ const cursor = cursors.get(id2);
42348
+ if (!cursor || !this._agents.has(id2) || this._leaving.has(id2) || cursor.isMoving || cursor.attachedTo || cursor.position.x !== placed.x || cursor.position.y !== placed.y) {
42349
+ this._parked.delete(id2);
42350
+ return;
42351
+ }
42352
+ const point2 = this.getHomePoint(id2);
42353
+ if (point2 && Number.isFinite(point2.x) && Number.isFinite(point2.y) && (point2.x !== placed.x || point2.y !== placed.y)) {
42354
+ cursors.setPosition(id2, point2);
42355
+ this._parked.set(id2, { x: point2.x, y: point2.y });
42356
+ }
42357
+ });
42358
+ if (this._parked.size === 0 && this._stopFollowingChips) {
42359
+ this._stopFollowingChips();
42360
+ this._stopFollowingChips = null;
42361
+ }
42362
+ }
42363
+ /** Whether the agent is flying home to be removed. */
42364
+ isLeaving(agentOrId) {
42365
+ return this._leaving.has(typeof agentOrId === "string" ? agentOrId : agentOrId?.id);
42366
+ }
42367
+ /** Resolves once the agent is removed (at once when it is not leaving). */
42368
+ whenRemoved(agentOrId) {
42369
+ return this._leaving.get(typeof agentOrId === "string" ? agentOrId : agentOrId?.id)?.done ?? Promise.resolve();
41828
42370
  }
41829
42371
  /**
41830
42372
  * Adds an agent and shows its cursor. Adding the same agent again does nothing.
@@ -41837,6 +42379,7 @@ var UpmadeAgentManager = class {
41837
42379
  }
41838
42380
  const existing = this._agents.get(agent2.id);
41839
42381
  if (existing === agent2) {
42382
+ this.stopLeaving(agent2.id);
41840
42383
  return agent2;
41841
42384
  }
41842
42385
  if (existing) {
@@ -41849,28 +42392,98 @@ var UpmadeAgentManager = class {
41849
42392
  }
41850
42393
  owner.agentManager.remove(agent2);
41851
42394
  }
41852
- agent2._attach(this._core);
42395
+ const startsAtHome = agent2._attach(this._core);
41853
42396
  this._agents.set(agent2.id, agent2);
41854
42397
  this._agentSubscriptions.set(agent2.id, agent2.on("change", () => this.scheduleChange()));
41855
42398
  this.scheduleChange();
42399
+ this.watchUserSelection();
42400
+ if (startsAtHome) {
42401
+ this.park(agent2);
42402
+ }
41856
42403
  return agent2;
41857
42404
  }
41858
42405
  /**
41859
- * Removes an agent: its running action is rolled back, queued actions resolve with `'agent-removed'`,
41860
- * and its cursor and history are dropped. Returns `false` if the agent was not added.
42406
+ * Removes an agent: its running action is rolled back, queued actions resolve with `'agent-removed'`, and its
42407
+ * cursor and history are dropped. An agent parked at its chip goes at once. Otherwise, with a home (the editor's
42408
+ * chat box), the cursor first flies back behind it, and
42409
+ * the agent is removed when it arrives (`whenRemoved()`); it accepts no actions meanwhile. `immediate` removes it at
42410
+ * once. Returns `false` if the agent was not added.
41861
42411
  */
41862
- remove(agentOrId) {
42412
+ remove(agentOrId, options = {}) {
41863
42413
  const id2 = typeof agentOrId === "string" ? agentOrId : agentOrId?.id;
41864
42414
  const agent2 = id2 !== void 0 ? this._agents.get(id2) : void 0;
41865
42415
  if (!agent2 || typeof agentOrId !== "string" && agentOrId !== agent2) {
41866
42416
  return false;
41867
42417
  }
42418
+ if (this._leaving.has(agent2.id)) {
42419
+ if (options.immediate) this.finishLeaving(agent2.id);
42420
+ return true;
42421
+ }
42422
+ const cursor = this._core.agenticCursorManager.get(agent2.id);
42423
+ const parked = this._parked.has(agent2.id) && !cursor?.isMoving;
42424
+ const home = !options.immediate && !this._disposed && !parked && cursor?.visible ? this.getHomePoint(agent2.id) : null;
42425
+ if (!home) {
42426
+ this.detach(agent2);
42427
+ return true;
42428
+ }
42429
+ let resolve;
42430
+ const done = new Promise((r3) => resolve = r3);
42431
+ const leaving = { done, resolve, target: home, flight: 0, stopFollowing: null };
42432
+ const start = this.getIdleLabelPoint(agent2);
42433
+ this._leaving.set(agent2.id, leaving);
42434
+ this._core.agenticActionManager.cancel(agent2.id, "agent-removed");
42435
+ this._core.agenticActionManager.setSelection(agent2.id, []);
42436
+ this.scheduleChange();
42437
+ this._parked.delete(agent2.id);
42438
+ const cursors = this._core.agenticCursorManager;
42439
+ if (start) {
42440
+ cursors.setPosition(agent2.id, start);
42441
+ }
42442
+ this.flyLeaving(agent2, leaving, home);
42443
+ leaving.stopFollowing = cursors.onBeforeFrame(() => {
42444
+ if (this._leaving.get(agent2.id) !== leaving) return;
42445
+ const point2 = this.getHomePoint(agent2.id);
42446
+ if (point2 && Number.isFinite(point2.x) && Number.isFinite(point2.y) && Math.hypot(point2.x - leaving.target.x, point2.y - leaving.target.y) > 0.5) {
42447
+ this.flyLeaving(agent2, leaving, point2);
42448
+ }
42449
+ });
42450
+ return true;
42451
+ }
42452
+ /** Flies a leaving agent's cursor to `target`, its chip, and removes the agent once it lands there. */
42453
+ flyLeaving(agent2, leaving, target2) {
42454
+ leaving.target = target2;
42455
+ const flight = ++leaving.flight;
42456
+ this._core.agenticCursorManager.move(agent2.id, target2, { speed: agent2.speed }).catch(() => void 0).then(() => {
42457
+ if (this._leaving.get(agent2.id) === leaving && leaving.flight === flight) this.finishLeaving(agent2.id);
42458
+ });
42459
+ }
42460
+ /** Removes an agent that was flying home, if it still is. */
42461
+ finishLeaving(id2) {
42462
+ const leaving = this._leaving.get(id2);
42463
+ if (!leaving) return;
42464
+ this._leaving.delete(id2);
42465
+ leaving.stopFollowing?.();
42466
+ const agent2 = this._agents.get(id2);
42467
+ if (agent2) this.detach(agent2);
42468
+ leaving.resolve();
42469
+ }
42470
+ /** Keeps an agent that was flying home. */
42471
+ stopLeaving(id2) {
42472
+ const leaving = this._leaving.get(id2);
42473
+ if (!leaving) return;
42474
+ this._leaving.delete(id2);
42475
+ leaving.stopFollowing?.();
42476
+ this._core.agenticCursorManager.stopAnimation(id2);
42477
+ this.scheduleChange();
42478
+ leaving.resolve();
42479
+ }
42480
+ detach(agent2) {
41868
42481
  this._agents.delete(agent2.id);
42482
+ this._parked.delete(agent2.id);
41869
42483
  this._agentSubscriptions.get(agent2.id)?.();
41870
42484
  this._agentSubscriptions.delete(agent2.id);
41871
42485
  agent2._detach();
41872
42486
  this.scheduleChange();
41873
- return true;
41874
42487
  }
41875
42488
  get(id2) {
41876
42489
  return this._agents.get(id2) ?? null;
@@ -41878,12 +42491,12 @@ var UpmadeAgentManager = class {
41878
42491
  getAll() {
41879
42492
  return Array.from(this._agents.values());
41880
42493
  }
41881
- /** The added agents as shown in the avatar stack. */
42494
+ /** The added agents as reported in `agentsChange`. */
41882
42495
  getPresences() {
41883
42496
  return this.getAll().map((agent2) => agent2.toPresence());
41884
42497
  }
41885
42498
  /**
41886
- * Subscribes to changes of the agent list and of what the avatar stack shows (name, color, avatar,
42499
+ * Subscribes to changes of the agent list and of what is shown of them (name, color, avatar,
41887
42500
  * status, visibility, activity). Coalesced to one call per microtask; never called for plain motion.
41888
42501
  */
41889
42502
  onChange(listener) {
@@ -41961,6 +42574,7 @@ var UpmadeAgentBroadcaster = class {
41961
42574
  name: agent2.name,
41962
42575
  color: cursor.color,
41963
42576
  ...agent2.avatarUrl ? { avatarUrl: agent2.avatarUrl } : {},
42577
+ ...cursor.cursorIcon ? { cursorIcon: cursor.cursorIcon } : {},
41964
42578
  status,
41965
42579
  visible: cursor.visible,
41966
42580
  activeAction: cursor.activeAction,
@@ -42027,7 +42641,7 @@ var UpmadeAgentBroadcaster = class {
42027
42641
  }
42028
42642
  };
42029
42643
  function structureOf(payload) {
42030
- return JSON.stringify(payload.map((agent2) => [agent2.id, agent2.name, agent2.color, agent2.avatarUrl ?? null, agent2.visible]));
42644
+ return JSON.stringify(payload.map((agent2) => [agent2.id, agent2.name, agent2.color, agent2.avatarUrl ?? null, agent2.cursorIcon ?? null, agent2.visible]));
42031
42645
  }
42032
42646
  __name(structureOf, "structureOf");
42033
42647
  function round2(value) {
@@ -42035,6 +42649,83 @@ function round2(value) {
42035
42649
  }
42036
42650
  __name(round2, "round");
42037
42651
 
42652
+ // src/helpers/viewport-overlay.helper.ts
42653
+ var UPMADE_CURSOR_ICON_MAX_LENGTH = 8192;
42654
+ var UpmadeViewportOverlayHelper = class _UpmadeViewportOverlayHelper {
42655
+ static {
42656
+ __name(this, "UpmadeViewportOverlayHelper");
42657
+ }
42658
+ static worldToScreen(state, worldX, worldY) {
42659
+ return {
42660
+ x: worldX * state.scale + state.translateX,
42661
+ y: worldY * state.scale + state.translateY
42662
+ };
42663
+ }
42664
+ static isInViewport(state, screenX, screenY) {
42665
+ return screenX >= 0 && screenX <= state.viewportWidth && screenY >= 0 && screenY <= state.viewportHeight;
42666
+ }
42667
+ /** Clamps an off-screen point to the viewport edge, returning the nearest edge and the direction to the point. */
42668
+ static clampToEdge(state, screenX, screenY, padding) {
42669
+ const { viewportWidth, viewportHeight } = state;
42670
+ const clampedX = Math.max(padding, Math.min(viewportWidth - padding, screenX));
42671
+ const clampedY = Math.max(padding, Math.min(viewportHeight - padding, screenY));
42672
+ const distLeft = clampedX - padding;
42673
+ const distRight = viewportWidth - padding - clampedX;
42674
+ const distTop = clampedY - padding;
42675
+ const distBottom = viewportHeight - padding - clampedY;
42676
+ let edge = "top";
42677
+ const minDist = Math.min(distLeft, distRight, distTop, distBottom);
42678
+ if (minDist === distLeft) edge = "left";
42679
+ else if (minDist === distRight) edge = "right";
42680
+ else if (minDist === distTop) edge = "top";
42681
+ else edge = "bottom";
42682
+ const angle = Math.atan2(screenY - clampedY, screenX - clampedX);
42683
+ return { x: clampedX, y: clampedY, angle, edge };
42684
+ }
42685
+ static getInitials(name) {
42686
+ const parts = name.trim().split(/\s+/);
42687
+ if (parts.length === 0 || parts.length === 1 && parts[0].length <= 1) {
42688
+ return name;
42689
+ }
42690
+ if (parts.length === 1) {
42691
+ return parts[0][0].toUpperCase();
42692
+ }
42693
+ return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
42694
+ }
42695
+ /**
42696
+ * The image source of a cursor icon (`IUpmadeUser.cursorIcon`, `UpmadeAgentOptions.cursorIcon`), or `null` when
42697
+ * there is none or it is not usable. SVG markup becomes a `data:` URL; image URLs are accepted when they are
42698
+ * http(s), `data:image/` or relative. Icons are always drawn as images, never as markup, so an icon that comes
42699
+ * from a collaborator cannot run scripts or reach the page.
42700
+ */
42701
+ static getCursorIconSrc(icon) {
42702
+ if (typeof icon !== "string") {
42703
+ return null;
42704
+ }
42705
+ const value = icon.trim();
42706
+ if (value.length === 0 || value.length > UPMADE_CURSOR_ICON_MAX_LENGTH) {
42707
+ return null;
42708
+ }
42709
+ if (value.startsWith("<")) {
42710
+ const svgTag = /<svg\b[^>]*>/i.exec(value);
42711
+ if (!svgTag) {
42712
+ return null;
42713
+ }
42714
+ const markup = /\sxmlns\s*=/i.test(svgTag[0]) ? value : value.slice(0, svgTag.index) + svgTag[0].replace(/^<svg\b/i, '<svg xmlns="http://www.w3.org/2000/svg"') + value.slice(svgTag.index + svgTag[0].length);
42715
+ return `data:image/svg+xml;charset=utf-8,${encodeURIComponent(markup)}`;
42716
+ }
42717
+ return _UpmadeViewportOverlayHelper.isSafeImageUrl(value, UPMADE_CURSOR_ICON_MAX_LENGTH) ? value : null;
42718
+ }
42719
+ /** Whether a URL is http(s), `data:image/` or relative, so a collaborator cannot point images at other schemes. */
42720
+ static isSafeImageUrl(value, maxLength = 2048) {
42721
+ if (typeof value !== "string" || value.length === 0 || value.length > maxLength) {
42722
+ return false;
42723
+ }
42724
+ const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(value.trim())?.[1]?.toLowerCase();
42725
+ return scheme === void 0 || scheme === "http" || scheme === "https" || scheme === "data" && /^data:image\//i.test(value.trim());
42726
+ }
42727
+ };
42728
+
42038
42729
  // src/classes/managers/remote-agent.manager.ts
42039
42730
  var MAX_NAME_LENGTH = 100;
42040
42731
  var UpmadeRemoteAgentManager = class {
@@ -42110,6 +42801,7 @@ var UpmadeRemoteAgentManager = class {
42110
42801
  name: entry.agent.name,
42111
42802
  color: entry.agent.color,
42112
42803
  ...entry.agent.avatarUrl ? { avatarUrl: entry.agent.avatarUrl } : {},
42804
+ ...entry.agent.cursorIcon ? { cursorIcon: entry.agent.cursorIcon } : {},
42113
42805
  status: entry.agent.status ?? void 0,
42114
42806
  visible: entry.agent.visible,
42115
42807
  position: { ...entry.rendered },
@@ -42124,7 +42816,7 @@ var UpmadeRemoteAgentManager = class {
42124
42816
  canRedo: false
42125
42817
  }));
42126
42818
  }
42127
- /** Remote agents as shown in avatar stacks. */
42819
+ /** Remote agents as reported in `agentsChange`. */
42128
42820
  getPresences() {
42129
42821
  return Array.from(this._entries.values()).map((entry) => ({
42130
42822
  id: entry.agent.id,
@@ -42149,7 +42841,7 @@ var UpmadeRemoteAgentManager = class {
42149
42841
  isClaimed(objectId, kind) {
42150
42842
  return this._claimed.has(objectId) || kind === "target" && this._selected.has(objectId);
42151
42843
  }
42152
- /** Subscribes to structural changes (agents added or removed, name, color, status, activity, selection). */
42844
+ /** Subscribes to structural changes (agents added or removed, name, color, icon, status, activity, selection). */
42153
42845
  onChange(listener) {
42154
42846
  this._changeListeners.add(listener);
42155
42847
  return () => this._changeListeners.delete(listener);
@@ -42249,7 +42941,9 @@ function parseAgent(raw) {
42249
42941
  id: value["id"].slice(0, MAX_NAME_LENGTH),
42250
42942
  name: value["name"].slice(0, MAX_NAME_LENGTH),
42251
42943
  color: value["color"].slice(0, MAX_NAME_LENGTH),
42252
- ...isSafeImageUrl(value["avatarUrl"]) ? { avatarUrl: value["avatarUrl"] } : {},
42944
+ ...UpmadeViewportOverlayHelper.isSafeImageUrl(value["avatarUrl"]) ? { avatarUrl: value["avatarUrl"] } : {},
42945
+ // Only icons the overlay can draw (as an image, never as markup).
42946
+ ...UpmadeViewportOverlayHelper.getCursorIconSrc(value["cursorIcon"]) ? { cursorIcon: value["cursorIcon"] } : {},
42253
42947
  status: typeof value["status"] === "string" && value["status"] ? value["status"].slice(0, AGENT_BROADCAST_MAX_STATUS_LENGTH) : null,
42254
42948
  visible: value["visible"] !== false,
42255
42949
  activeAction: typeof value["activeAction"] === "string" ? value["activeAction"] : null,
@@ -42299,14 +42993,6 @@ function parseHostUser(raw) {
42299
42993
  };
42300
42994
  }
42301
42995
  __name(parseHostUser, "parseHostUser");
42302
- function isSafeImageUrl(value) {
42303
- if (typeof value !== "string" || value.length === 0 || value.length > 2048) {
42304
- return false;
42305
- }
42306
- const scheme = /^([a-z][a-z0-9+.-]*):/i.exec(value.trim())?.[1]?.toLowerCase();
42307
- return scheme === void 0 || scheme === "http" || scheme === "https" || scheme === "data" && /^data:image\//i.test(value.trim());
42308
- }
42309
- __name(isSafeImageUrl, "isSafeImageUrl");
42310
42996
 
42311
42997
  // src/interfaces/chat-session.interface.ts
42312
42998
  var UPMADE_CHAT_PROTOCOL_VERSION = 1;
@@ -42797,6 +43483,12 @@ var DEFAULT_MAX_STEPS = 25;
42797
43483
  var DEFAULT_THINKING_STATUS = "Thinking\u2026";
42798
43484
  var STOPPED_OUTPUT = JSON.stringify({ completed: false, reason: "aborted", hint: "The user stopped the response. Do not retry unless asked." });
42799
43485
  var INTERRUPTED_OUTPUT = JSON.stringify({ completed: false, reason: "aborted", hint: "The tool call was interrupted and did not run." });
43486
+ var BLOCKED_OUTPUT = JSON.stringify({
43487
+ completed: false,
43488
+ reason: "aborted",
43489
+ hint: "Not run: an earlier call met objects the user is working on, so the response ended there."
43490
+ });
43491
+ var BLOCKING_REASONS = /* @__PURE__ */ new Set(["user-selected", "user-interaction"]);
42800
43492
  var busyAgents = /* @__PURE__ */ new WeakSet();
42801
43493
  var busyCores = /* @__PURE__ */ new WeakSet();
42802
43494
  function isUpmadeChatSession(value) {
@@ -42812,7 +43504,7 @@ var RunEnd = class {
42812
43504
  __name(this, "RunEnd");
42813
43505
  }
42814
43506
  };
42815
- var UpmadeChatSession = class {
43507
+ var UpmadeChatSession = class _UpmadeChatSession {
42816
43508
  static {
42817
43509
  __name(this, "UpmadeChatSession");
42818
43510
  }
@@ -42834,6 +43526,8 @@ var UpmadeChatSession = class {
42834
43526
  _pendingDetach = false;
42835
43527
  /** Why the running prompt was ended from outside. */
42836
43528
  _endReason = null;
43529
+ /** Sessions of `forAgent()`, per agent ID. They are bound wherever this session is. */
43530
+ _agentSessions = /* @__PURE__ */ new Map();
42837
43531
  _listeners = /* @__PURE__ */ new Map();
42838
43532
  constructor(options) {
42839
43533
  if (!options || typeof options.transport !== "function") {
@@ -42931,6 +43625,42 @@ var UpmadeChatSession = class {
42931
43625
  stop() {
42932
43626
  this.endRun("stopped");
42933
43627
  }
43628
+ /**
43629
+ * A session in which the model acts as `agent`: it has this session's options (transport, system, context, tools,
43630
+ * canvas tools, steps, instant, thinking status, eager tool calls) but its own conversation, which starts empty or
43631
+ * with `options.messages` (used only when the session is created, e.g. to restore it from `messages`).
43632
+ * The same agent always gets the same session, so each agent keeps its conversation; this session's own agent gets
43633
+ * this session. Agents are told apart by ID: for a new instance of an agent (e.g. added again after it was removed),
43634
+ * a new session replaces the earlier one (which is unbound) and continues its conversation. It is bound to
43635
+ * whichever editor this session is bound to, and unbound with it (a running prompt then ends with `'detached'`).
43636
+ * Creating one emits `'agent-session'`; `agentSessions` lists them. The editor uses it to run a prompt sent with
43637
+ * an agent chip.
43638
+ */
43639
+ forAgent(agent2, options = {}) {
43640
+ if (agent2 === this._options.agent) {
43641
+ return this;
43642
+ }
43643
+ const earlier = this._agentSessions.get(agent2.id);
43644
+ if (earlier?.agent === agent2) {
43645
+ return earlier;
43646
+ }
43647
+ earlier?._detach();
43648
+ const { messages: _messages, ...parentOptions } = this._options;
43649
+ const session = new _UpmadeChatSession({ ...parentOptions, agent: agent2, messages: options.messages ?? (earlier ? [...earlier.messages] : []) });
43650
+ this._agentSessions.set(agent2.id, session);
43651
+ if (this._core) {
43652
+ session._attach(this._core);
43653
+ if (this._pendingDetach) {
43654
+ session._detachWhenIdle();
43655
+ }
43656
+ }
43657
+ this.emit("agent-session", session);
43658
+ return session;
43659
+ }
43660
+ /** The sessions of `forAgent()`, one per agent ID. Subscribe to `'agent-session'` to hear of new ones. */
43661
+ get agentSessions() {
43662
+ return Array.from(this._agentSessions.values());
43663
+ }
42934
43664
  /** Subscribes to an event; returns a function that unsubscribes. */
42935
43665
  on(event, listener) {
42936
43666
  let listeners = this._listeners.get(event);
@@ -42956,18 +43686,32 @@ var UpmadeChatSession = class {
42956
43686
  /** Binds the session to an editor core. Working as the user, it registers its actor there. @internal */
42957
43687
  _attach(core) {
42958
43688
  this._pendingDetach = false;
42959
- if (this._core === core) {
42960
- return;
42961
- }
42962
- this._detach();
42963
- this._core = core;
42964
- if (!this._options.agent) {
42965
- this._userActor = new UpmadeUserActor();
42966
- this._userActor._attach(core);
43689
+ if (this._core !== core) {
43690
+ this._detach();
43691
+ this._core = core;
43692
+ if (!this._options.agent) {
43693
+ this._userActor = new UpmadeUserActor();
43694
+ this._userActor._attach(core);
43695
+ }
42967
43696
  }
43697
+ this._agentSessions.forEach((session) => session._attach(core));
42968
43698
  }
42969
- /** Unbinds the session: a running prompt ends with `'detached'`. @internal */
43699
+ /** Unbinds the session and its `forAgent()` sessions: running prompts end with `'detached'`. @internal */
42970
43700
  _detach() {
43701
+ this._agentSessions.forEach((session) => session._detach());
43702
+ this.detachSelf();
43703
+ }
43704
+ /** Unbinds the session and its `forAgent()` sessions, each once its running prompt ends (right away when idle). @internal */
43705
+ _detachWhenIdle() {
43706
+ this._agentSessions.forEach((session) => session._detachWhenIdle());
43707
+ if (!this._running) {
43708
+ this.detachSelf();
43709
+ return;
43710
+ }
43711
+ this._pendingDetach = true;
43712
+ }
43713
+ detachSelf() {
43714
+ this._pendingDetach = false;
42971
43715
  if (!this._core) {
42972
43716
  return;
42973
43717
  }
@@ -42976,14 +43720,6 @@ var UpmadeChatSession = class {
42976
43720
  this._userActor = null;
42977
43721
  this._core = null;
42978
43722
  }
42979
- /** Unbinds the session once its running prompt ends (right away when idle). @internal */
42980
- _detachWhenIdle() {
42981
- if (!this._running) {
42982
- this._detach();
42983
- return;
42984
- }
42985
- this._pendingDetach = true;
42986
- }
42987
43723
  // ─── Loop ───────────────────────────────────────────────────────────────────
42988
43724
  /** Ends the running prompt: the abort reaches the transport and the running action, which is rolled back. */
42989
43725
  endRun(reason) {
@@ -42993,7 +43729,7 @@ var UpmadeChatSession = class {
42993
43729
  this._endReason ??= reason;
42994
43730
  this._abort.abort();
42995
43731
  }
42996
- /** Ends the run when the workspace goes away or the agent is removed. */
43732
+ /** Ends the run when the workspace goes away or the agent is removed, and stops it when the agent is sent home. */
42997
43733
  watchRun(core) {
42998
43734
  const unsubscribers = [];
42999
43735
  const map = core.store?.objects;
@@ -43003,6 +43739,7 @@ var UpmadeChatSession = class {
43003
43739
  const agent2 = this._options.agent;
43004
43740
  if (agent2) {
43005
43741
  unsubscribers.push(agent2.on("removed", () => this.endRun("detached")));
43742
+ unsubscribers.push(agent2.on("sent-home", () => this.endRun("stopped")));
43006
43743
  }
43007
43744
  return () => unsubscribers.forEach((unsubscribe) => unsubscribe());
43008
43745
  }
@@ -43026,7 +43763,14 @@ var UpmadeChatSession = class {
43026
43763
  stoppedOutput: STOPPED_OUTPUT,
43027
43764
  interruptedOutput: INTERRUPTED_OUTPUT,
43028
43765
  report: /* @__PURE__ */ __name((update) => this.emit("tool-call", update), "report"),
43029
- run: /* @__PURE__ */ __name((call, onRunning, handle) => this.runCall(call, byName, signal, onRunning, handle), "run"),
43766
+ run: /* @__PURE__ */ __name(async (call, onRunning, handle) => {
43767
+ const outcome = await this.runCall(call, byName, signal, onRunning, handle);
43768
+ if (this._options.agent && isBlockedByUser(outcome.result.output)) {
43769
+ answer.halt(BLOCKED_OUTPUT);
43770
+ this.endRun("blocked");
43771
+ }
43772
+ return outcome;
43773
+ }, "run"),
43030
43774
  begin: /* @__PURE__ */ __name((call) => {
43031
43775
  const tool = byName.get(call.name);
43032
43776
  return tool?.begin ? tool.begin({ signal, toolCallId: call.id }) : null;
@@ -43237,8 +43981,7 @@ var UpmadeChatSession = class {
43237
43981
  const waiters = this._idleWaiters.splice(0);
43238
43982
  waiters.forEach((resolve) => resolve());
43239
43983
  if (this._pendingDetach) {
43240
- this._pendingDetach = false;
43241
- this._detach();
43984
+ this.detachSelf();
43242
43985
  }
43243
43986
  }
43244
43987
  emit(event, payload) {
@@ -43264,7 +44007,7 @@ function toUserMessage(input) {
43264
44007
  }
43265
44008
  __name(toUserMessage, "toUserMessage");
43266
44009
  function describeChips(chips) {
43267
- const lines = chips.map((chip) => {
44010
+ const lines = chips.filter((chip) => !chip.agentId).map((chip) => {
43268
44011
  const name = chip.detail ? `${chip.label} \u203A ${chip.detail}` : chip.label;
43269
44012
  const refs = [chip.objectId ? `objectId: ${chip.objectId}` : null, chip.selector ? `element: ${chip.selector}` : null].filter(Boolean);
43270
44013
  return `- ${name}${refs.length > 0 ? ` (${refs.join(", ")})` : ""}`;
@@ -43311,6 +44054,18 @@ function isAsyncIterable(value) {
43311
44054
  return typeof value === "object" && value !== null && typeof value[Symbol.asyncIterator] === "function";
43312
44055
  }
43313
44056
  __name(isAsyncIterable, "isAsyncIterable");
44057
+ function isBlockedByUser(output) {
44058
+ if (typeof output !== "string" || !output.includes('"reason"')) {
44059
+ return false;
44060
+ }
44061
+ try {
44062
+ const parsed = JSON.parse(output);
44063
+ return parsed?.completed === false && typeof parsed.reason === "string" && BLOCKING_REASONS.has(parsed.reason);
44064
+ } catch {
44065
+ return false;
44066
+ }
44067
+ }
44068
+ __name(isBlockedByUser, "isBlockedByUser");
43314
44069
 
43315
44070
  // src/classes/chat/scripted-transport.ts
43316
44071
  function createScriptedTransport(steps, options = {}) {
@@ -43797,7 +44552,7 @@ var CURRENT_APP_STATE_SCHEMA_VERSION = 2;
43797
44552
  var CURRENT_WORKSPACE_SCHEMA_VERSION = 3;
43798
44553
 
43799
44554
  // src/constants/version.ts
43800
- var UPMADE_VERSION = "0.6.3";
44555
+ var UPMADE_VERSION = "0.7.0-preview.0";
43801
44556
 
43802
44557
  // src/configs/default-engine-config.ts
43803
44558
  var DEFAULT_ENGINE_CONFIG = {
@@ -44433,6 +45188,7 @@ var UpmadeAgentOrigin = class {
44433
45188
  };
44434
45189
 
44435
45190
  // src/classes/structures/object-map.structure.ts
45191
+ var USER_STATUS_MAX_LENGTH = 200;
44436
45192
  var UpmadeObjectMap = class _UpmadeObjectMap {
44437
45193
  static {
44438
45194
  __name(this, "UpmadeObjectMap");
@@ -44628,9 +45384,20 @@ var UpmadeObjectMap = class _UpmadeObjectMap {
44628
45384
  this._awareness.setLocalStateField("user", {
44629
45385
  id: user.id,
44630
45386
  displayName,
44631
- color: user.color || UpmadeUserColorHelper.generateColorFromName(displayName)
45387
+ color: user.color || UpmadeUserColorHelper.generateColorFromName(displayName),
45388
+ ...UpmadeViewportOverlayHelper.getCursorIconSrc(user.cursorIcon) ? { cursorIcon: user.cursorIcon } : {}
44632
45389
  });
44633
45390
  }
45391
+ /**
45392
+ * Shares what the local user is doing (e.g. `'typing…'`) with collaborators, who see it in place of the user's
45393
+ * name on their cursor label (awareness field `status`). `null` or `''` removes it. Cut to 200 characters.
45394
+ */
45395
+ setLocalStatus(status) {
45396
+ if (!this._awareness || this._headless) {
45397
+ return;
45398
+ }
45399
+ this._awareness.setLocalStateField("status", status ? status.slice(0, USER_STATUS_MAX_LENGTH) : null);
45400
+ }
44634
45401
  /**
44635
45402
  * Shares the agents of this client with collaborators (awareness field `agents`); `null` or an
44636
45403
  * empty list removes the field. No-op without awareness and for background maps.
@@ -47460,6 +48227,7 @@ var UpmadeEasingHelper = class _UpmadeEasingHelper {
47460
48227
  var AGENTIC_CURSOR_DEFAULT_SPEED = 1200;
47461
48228
  var AGENTIC_CURSOR_MIN_DURATION = 250;
47462
48229
  var AGENTIC_CURSOR_MAX_DURATION = 1200;
48230
+ var UPMADE_AGENTIC_CURSOR_NOTICE_MS = 4e3;
47463
48231
  var UpmadeAgenticCursorManager = class {
47464
48232
  static {
47465
48233
  __name(this, "UpmadeAgenticCursorManager");
@@ -47474,6 +48242,8 @@ var UpmadeAgenticCursorManager = class {
47474
48242
  _historyProvider = null;
47475
48243
  _frameDemand = null;
47476
48244
  _rafId = null;
48245
+ /** The last notice key handed out. */
48246
+ _noticeKey = 0;
47477
48247
  constructor(core) {
47478
48248
  this._core = core;
47479
48249
  }
@@ -47515,7 +48285,8 @@ var UpmadeAgenticCursorManager = class {
47515
48285
  hostMoveGeneration: 0,
47516
48286
  trackedElement,
47517
48287
  moveToken: 0,
47518
- cancelLookup: null
48288
+ cancelLookup: null,
48289
+ notice: null
47519
48290
  };
47520
48291
  this._cursors.set(id2, entry);
47521
48292
  this.emitChange(id2);
@@ -47622,6 +48393,25 @@ var UpmadeAgenticCursorManager = class {
47622
48393
  entry.queueLength = queueLength;
47623
48394
  this.emitChange(id2);
47624
48395
  }
48396
+ /**
48397
+ * Shows on the agent's label why it could not do what it was about to, e.g. that the user has the object selected, for
48398
+ * `UPMADE_AGENTIC_CURSOR_NOTICE_MS`; `null` clears it. Each notice gets a new `key`, so the label draws attention to
48399
+ * it again, also for the same reason. @internal
48400
+ */
48401
+ setNotice(id2, notice) {
48402
+ const entry = this._cursors.get(id2);
48403
+ if (!entry) return;
48404
+ clearTimeout(entry.noticeTimer);
48405
+ entry.noticeTimer = void 0;
48406
+ if (!notice) {
48407
+ if (!entry.notice) return;
48408
+ entry.notice = null;
48409
+ } else {
48410
+ entry.notice = { reason: notice.reason, objectIds: [...notice.objectIds], key: ++this._noticeKey };
48411
+ entry.noticeTimer = setTimeout(() => this.setNotice(id2, null), UPMADE_AGENTIC_CURSOR_NOTICE_MS);
48412
+ }
48413
+ this.emitChange(id2);
48414
+ }
47625
48415
  /** Sets the provider of `canUndo` / `canRedo` for snapshots. @internal */
47626
48416
  setHistoryProvider(provider) {
47627
48417
  this._historyProvider = provider;
@@ -47643,6 +48433,7 @@ var UpmadeAgenticCursorManager = class {
47643
48433
  this.supersede(entry);
47644
48434
  this.finishAnimation(entry, false);
47645
48435
  this.setTrackedElement(entry, null);
48436
+ clearTimeout(entry.noticeTimer);
47646
48437
  this._cursors.delete(id2);
47647
48438
  this.emitChange(id2);
47648
48439
  if (!this.needsFrames()) this.stopLoop();
@@ -47799,6 +48590,7 @@ var UpmadeAgenticCursorManager = class {
47799
48590
  /** Stops the animation loop and resolves pending moves. Cursors are kept. */
47800
48591
  cleanup() {
47801
48592
  this._cursors.forEach((entry) => {
48593
+ clearTimeout(entry.noticeTimer);
47802
48594
  this.supersede(entry);
47803
48595
  this.finishAnimation(entry, false);
47804
48596
  this.releaseUnattachedElement(entry);
@@ -48011,8 +48803,10 @@ var UpmadeAgenticCursorManager = class {
48011
48803
  id: entry.id,
48012
48804
  name: entry.appearance.name,
48013
48805
  color: entry.appearance.color,
48806
+ ...entry.appearance.cursorIcon ? { cursorIcon: entry.appearance.cursorIcon } : {},
48014
48807
  status: entry.appearance.status || void 0,
48015
48808
  visible: entry.appearance.visible,
48809
+ ...entry.appearance.cursorActions?.length ? { cursorActions: [...entry.appearance.cursorActions] } : {},
48016
48810
  position: { ...entry.position },
48017
48811
  attachedTo: entry.attachedTo ? { ...entry.attachedTo, offset: { ...entry.attachedTo.offset } } : null,
48018
48812
  isMoving: entry.animation !== null,
@@ -48022,7 +48816,8 @@ var UpmadeAgenticCursorManager = class {
48022
48816
  activeAction: entry.activeAction,
48023
48817
  queueLength: entry.queueLength,
48024
48818
  canUndo: history.canUndo,
48025
- canRedo: history.canRedo
48819
+ canRedo: history.canRedo,
48820
+ ...entry.notice ? { notice: { ...entry.notice, objectIds: [...entry.notice.objectIds] } } : {}
48026
48821
  };
48027
48822
  }
48028
48823
  emitChange(id2) {
@@ -48116,6 +48911,23 @@ var UpmadeAgenticActionRun = class {
48116
48911
  applyingHistory = false;
48117
48912
  /** An abort that arrived while `applyingHistory` was set. */
48118
48913
  heldAbort = null;
48914
+ /**
48915
+ * Agents: whether the action works outside the agent's selection, so its first press clears the selection,
48916
+ * like a person's click elsewhere. Decided when the action starts.
48917
+ */
48918
+ deselectOnPress = false;
48919
+ /**
48920
+ * Agents: the explicit selection the action cleared on its first press; restored if the action ends without
48921
+ * keeping changes. `null` when the action left the selection alone.
48922
+ */
48923
+ clearedSelection = null;
48924
+ /** Whether the cursor has pressed in this run. */
48925
+ hasPressed = false;
48926
+ /**
48927
+ * Whether `displayIds` are shown as selected. Like a person's selection, they show once the cursor presses on
48928
+ * the objects (not while it flies there), or when the executor shows objects on purpose (`display()`).
48929
+ */
48930
+ displaying = false;
48119
48931
  /** Whether the action changed anything. */
48120
48932
  hasMutated = false;
48121
48933
  /** Whether the outcome is decided. */
@@ -48311,10 +49123,15 @@ var UpmadeAgenticActionRun = class {
48311
49123
  this.stop("agent-moved");
48312
49124
  }
48313
49125
  }
48314
- /** Presses the cursor, after re-checking for conflicts. */
49126
+ /** Presses the cursor, after re-checking for conflicts. The first press shows the targets as selected. */
48315
49127
  async press() {
48316
49128
  this.assertActive();
48317
49129
  this.host.checkpoint(this);
49130
+ if (!this.hasPressed) {
49131
+ this.hasPressed = true;
49132
+ this.displaying = true;
49133
+ this.host.handleFirstPress(this);
49134
+ }
48318
49135
  if (this.instant) {
48319
49136
  return;
48320
49137
  }
@@ -48426,6 +49243,7 @@ var UpmadeAgenticActionRun = class {
48426
49243
  /** Shows other objects as selected while the action runs, e.g. a group once it is created. */
48427
49244
  display(objectIds) {
48428
49245
  this.displayIds = [...objectIds];
49246
+ this.displaying = true;
48429
49247
  this.host.showSelection(this.cursorId);
48430
49248
  }
48431
49249
  /** Replaces objects in the agent's selection, e.g. grouped objects by their group. Others stay selected. */
@@ -48488,6 +49306,7 @@ var UpmadeAgenticActionRun = class {
48488
49306
  };
48489
49307
 
48490
49308
  // src/classes/managers/agentic-action.manager.ts
49309
+ var SELECTION_RULE_EXEMPT_ACTIONS = /* @__PURE__ */ new Set(["select", "clearSelection", "undo", "redo"]);
48491
49310
  var KEEP_REASONS = /* @__PURE__ */ new Set(["user-selected", "user-interaction"]);
48492
49311
  var SILENT_REASONS = /* @__PURE__ */ new Set(["workspace-changed", "engine-disconnected"]);
48493
49312
  var UpmadeAgenticActionManager = class {
@@ -48675,6 +49494,15 @@ var UpmadeAgenticActionManager = class {
48675
49494
  }
48676
49495
  run.settled = true;
48677
49496
  const cursors = this._core.agenticCursorManager;
49497
+ if (run.actorKind === "agent" && outcome.kind === "abort" && (outcome.reason === "user-selected" || outcome.reason === "user-interaction")) {
49498
+ const notice = { reason: outcome.reason, objectIds: outcome.objectIds ?? [] };
49499
+ if (!run.executing && notice.objectIds.length > 0 && cursors.resolveTarget({ objectId: notice.objectIds[0] })) {
49500
+ const cursorId = run.cursorId;
49501
+ void cursors.fly(cursorId, { objectId: notice.objectIds[0] }, { speed: run.options.speed, attach: false, ...run.instant ? { duration: 0 } : {} }).then((result) => result.completed && cursors.setNotice(cursorId, notice));
49502
+ } else {
49503
+ cursors.setNotice(run.cursorId, notice);
49504
+ }
49505
+ }
48678
49506
  if (run.isFlying && cursors.getHostMoveGeneration(run.cursorId) === run.hostMoveGeneration) {
48679
49507
  cursors.stopAnimation(run.cursorId);
48680
49508
  }
@@ -48694,6 +49522,7 @@ var UpmadeAgenticActionManager = class {
48694
49522
  const reason = outcome.kind === "abort" ? outcome.reason : null;
48695
49523
  const keep = outcome.kind === "commit" || reason !== null && KEEP_REASONS.has(reason);
48696
49524
  let events = null;
49525
+ const createdIds = /* @__PURE__ */ new Set();
48697
49526
  try {
48698
49527
  if (run.hasMutated && run.origin && map && map.isReady) {
48699
49528
  const canWrite = !map.isInsideYjsCallback;
@@ -48703,6 +49532,9 @@ var UpmadeAgenticActionManager = class {
48703
49532
  if (keep) {
48704
49533
  map.stopAgentCapturing(run.cursorId);
48705
49534
  const recording = run.origin.takeRecording();
49535
+ recording.forEach((existedBefore, id2) => {
49536
+ if (!existedBefore) createdIds.add(id2);
49537
+ });
48706
49538
  if (map.getAgentUndoStackLength(run.cursorId) > run.undoLengthAtStart) {
48707
49539
  map.tagLastAgentStackItem(run.cursorId, Array.from(recording.keys()).filter((id2) => !run.selectionObjectIds.has(id2)));
48708
49540
  if (run.actorKind === "user") {
@@ -48735,6 +49567,13 @@ var UpmadeAgenticActionManager = class {
48735
49567
  run.suspendedRedo = null;
48736
49568
  }
48737
49569
  run.runSettleHooks();
49570
+ if (outcome.kind === "commit") {
49571
+ if (run.deselectOnPress) this.applyDeselect(run);
49572
+ this.selectCreatedObjects(run, map, outcome.objectIds, createdIds);
49573
+ } else if (run.clearedSelection && !(keep && run.hasMutated) && this.getSelection(run.cursorId).length === 0) {
49574
+ const existing = map ? run.clearedSelection.filter((id2) => !!map.findById(id2) && !this.isClaimedByOther(id2, run.cursorId, "target")) : [];
49575
+ if (existing.length > 0) this.setSelection(run.cursorId, existing);
49576
+ }
48738
49577
  if (outcome.kind === "commit" && run.finalAttachment) {
48739
49578
  cursors.attach(run.cursorId, run.finalAttachment);
48740
49579
  }
@@ -48867,6 +49706,7 @@ var UpmadeAgenticActionManager = class {
48867
49706
  }
48868
49707
  run.map = map;
48869
49708
  this.bindMap(map);
49709
+ cursors.setNotice(run.cursorId, null);
48870
49710
  run.hostMoveGeneration = cursors.getHostMoveGeneration(run.cursorId);
48871
49711
  cursors.stopAnimation(run.cursorId);
48872
49712
  this.updateActivity(run.cursorId);
@@ -48906,6 +49746,7 @@ var UpmadeAgenticActionManager = class {
48906
49746
  const object2 = map.findById(id2);
48907
49747
  if (object2) run.knownInstances.set(id2, object2);
48908
49748
  });
49749
+ this.deselectIfWorkingElsewhere(run, preparation);
48909
49750
  this.showSelection(run.cursorId);
48910
49751
  const objectIds = await run.executor.execute(run, run.action);
48911
49752
  if (!run.settled) {
@@ -49083,9 +49924,70 @@ var UpmadeAgenticActionManager = class {
49083
49924
  showSelection(cursorId) {
49084
49925
  const explicit = this._selections.get(cursorId)?.ids ?? [];
49085
49926
  const running = this._running.get(cursorId);
49086
- const shown = running && !running.settled && running.executing ? [...explicit, ...running.displayIds] : [...explicit];
49927
+ const shown = running && !running.settled && running.executing && running.displaying ? [...explicit, ...running.displayIds] : [...explicit];
49087
49928
  this._core.agenticCursorManager.setSelectedObjectIds(cursorId, Array.from(new Set(shown)));
49088
49929
  }
49930
+ // ─── Selection rule ─────────────────────────────────────────────────────────
49931
+ //
49932
+ // An agent's selection lasts as long as the agent works on it, like a person's:
49933
+ // - an action on objects that are all in the selection keeps it (move, resize, style, type into it, click it);
49934
+ // - an action on anything else, or one that creates objects (on empty canvas), clears it when its cursor first
49935
+ // presses, like a click elsewhere; if the action then keeps nothing, the selection comes back;
49936
+ // - a `select` that replaces the selection clears the old one on its press too, and shows the new one;
49937
+ // - an action that creates objects selects them once it completes (copies, a new group, a drawn shape or line);
49938
+ // - `select`, `clearSelection`, `undo` and `redo` manage the selection themselves; moving the cursor never changes it.
49939
+ // Actors working as the user don't follow the rule: their selection is the user's own.
49940
+ /** Decides, as the action starts, whether its first press clears the agent's selection: when it works outside it. */
49941
+ deselectIfWorkingElsewhere(run, preparation) {
49942
+ if (run.actorKind !== "agent") return;
49943
+ const selection = this._selections.get(run.cursorId);
49944
+ if (!selection) return;
49945
+ if (run.action.type === "select") {
49946
+ run.deselectOnPress = !run.action.additive;
49947
+ return;
49948
+ }
49949
+ if (SELECTION_RULE_EXEMPT_ACTIONS.has(run.action.type)) return;
49950
+ if (run.action.type === "interactWithElement" && (run.action.interaction.type === "hover" || run.action.interaction.type === "scroll")) return;
49951
+ const touched = this.getTouchedObjectIds(run, preparation);
49952
+ if (touched.length > 0 && touched.every((id2) => selection.expanded.has(id2))) return;
49953
+ run.deselectOnPress = true;
49954
+ }
49955
+ /** The run's cursor pressed for the first time: a pending deselect applies, and its targets show as selected. @internal */
49956
+ handleFirstPress(run) {
49957
+ if (run.deselectOnPress) {
49958
+ this.applyDeselect(run);
49959
+ }
49960
+ this.showSelection(run.cursorId);
49961
+ }
49962
+ /** Clears the agent's selection for a run working elsewhere, remembering it in case the run keeps nothing. */
49963
+ applyDeselect(run) {
49964
+ run.deselectOnPress = false;
49965
+ const ids2 = this.getSelection(run.cursorId);
49966
+ if (ids2.length === 0) return;
49967
+ run.clearedSelection = ids2;
49968
+ this.setSelection(run.cursorId, []);
49969
+ }
49970
+ /** The objects an action works on, for the selection rule. */
49971
+ getTouchedObjectIds(run, preparation) {
49972
+ if (preparation.targetIds.length > 0) return preparation.targetIds;
49973
+ if (preparation.checkLevel !== "existence") return [];
49974
+ const action = run.action;
49975
+ if (action.type === "click" && !isElementTarget(action.target) && !isObjectTarget(action.target) && run.map) {
49976
+ const hit = hitTestTopMost(run.map, action.target);
49977
+ return hit ? [hit.id] : [];
49978
+ }
49979
+ return preparation.referenceIds;
49980
+ }
49981
+ /** Makes the top-level objects a completed agent action created its selection. */
49982
+ selectCreatedObjects(run, map, objectIds, createdIds) {
49983
+ if (run.actorKind !== "agent" || SELECTION_RULE_EXEMPT_ACTIONS.has(run.action.type) || !map || createdIds.size === 0) return;
49984
+ const created = objectIds.filter((id2) => {
49985
+ if (!createdIds.has(id2)) return false;
49986
+ const object2 = map.findById(id2);
49987
+ return !!object2 && !isSelectionObject(object2) && isTopLevel(map, id2);
49988
+ });
49989
+ if (created.length > 0) this.setSelection(run.cursorId, created);
49990
+ }
49089
49991
  /** Drops deleted objects from explicit selections. */
49090
49992
  pruneSelections() {
49091
49993
  if (this._selections.size === 0) {
@@ -49338,6 +50240,7 @@ var UpmadeCore = class {
49338
50240
  _editorId;
49339
50241
  /** Current user for awareness broadcasting */
49340
50242
  _user;
50243
+ _userStatus = null;
49341
50244
  /**
49342
50245
  * Gets the Upmade engine instance.
49343
50246
  * @returns The engine component managing rendering and events
@@ -49487,6 +50390,18 @@ var UpmadeCore = class {
49487
50390
  this._store.setLocalUserId(user?.id ?? null);
49488
50391
  this._store.objects?.setLocalUser(user);
49489
50392
  }
50393
+ /** What the current user is doing, as collaborators see it on the user's cursor label; `null` when nothing. */
50394
+ get userStatus() {
50395
+ return this._userStatus;
50396
+ }
50397
+ /**
50398
+ * Shows what the current user is doing (e.g. `'typing…'` or a message) to collaborators: their editors show it
50399
+ * in place of the user's name on the cursor label, like an agent's status. `null` or `''` shows the name again.
50400
+ */
50401
+ setUserStatus(status) {
50402
+ this._userStatus = status || null;
50403
+ this._store.objects?.setLocalStatus(this._userStatus);
50404
+ }
49490
50405
  /**
49491
50406
  * Creates a new UpmadeCore instance.
49492
50407
  * Initializes the store with default configuration and sets up all managers.
@@ -49666,6 +50581,9 @@ var UpmadeCore = class {
49666
50581
  if (this._user) {
49667
50582
  objectsMap.setLocalUser(this._user);
49668
50583
  }
50584
+ if (this._userStatus) {
50585
+ objectsMap.setLocalStatus(this._userStatus);
50586
+ }
49669
50587
  this._remoteAgentManager.clear();
49670
50588
  this._agentBroadcaster.reset();
49671
50589
  objectsMap.onAwarenessChange((states) => {
@@ -52718,49 +53636,29 @@ var UpmadeSvgExportHelper = class {
52718
53636
  }
52719
53637
  };
52720
53638
 
52721
- // src/helpers/viewport-overlay.helper.ts
52722
- var UpmadeViewportOverlayHelper = class {
52723
- static {
52724
- __name(this, "UpmadeViewportOverlayHelper");
52725
- }
52726
- static worldToScreen(state, worldX, worldY) {
52727
- return {
52728
- x: worldX * state.scale + state.translateX,
52729
- y: worldY * state.scale + state.translateY
52730
- };
52731
- }
52732
- static isInViewport(state, screenX, screenY) {
52733
- return screenX >= 0 && screenX <= state.viewportWidth && screenY >= 0 && screenY <= state.viewportHeight;
52734
- }
52735
- /** Clamps an off-screen point to the viewport edge, returning the nearest edge and the direction to the point. */
52736
- static clampToEdge(state, screenX, screenY, padding) {
52737
- const { viewportWidth, viewportHeight } = state;
52738
- const clampedX = Math.max(padding, Math.min(viewportWidth - padding, screenX));
52739
- const clampedY = Math.max(padding, Math.min(viewportHeight - padding, screenY));
52740
- const distLeft = clampedX - padding;
52741
- const distRight = viewportWidth - padding - clampedX;
52742
- const distTop = clampedY - padding;
52743
- const distBottom = viewportHeight - padding - clampedY;
52744
- let edge = "top";
52745
- const minDist = Math.min(distLeft, distRight, distTop, distBottom);
52746
- if (minDist === distLeft) edge = "left";
52747
- else if (minDist === distRight) edge = "right";
52748
- else if (minDist === distTop) edge = "top";
52749
- else edge = "bottom";
52750
- const angle = Math.atan2(screenY - clampedY, screenX - clampedX);
52751
- return { x: clampedX, y: clampedY, angle, edge };
52752
- }
52753
- static getInitials(name) {
52754
- const parts = name.trim().split(/\s+/);
52755
- if (parts.length === 0 || parts.length === 1 && parts[0].length <= 1) {
52756
- return name;
52757
- }
52758
- if (parts.length === 1) {
52759
- return parts[0][0].toUpperCase();
53639
+ // src/helpers/cursor-label-action.helper.ts
53640
+ var UPMADE_OVERLAY_CONTROL_ATTRIBUTE = "data-upmade-overlay-control";
53641
+ function isOverlayControlEvent(event) {
53642
+ return (event.composedPath?.() ?? []).some(
53643
+ (target2) => typeof target2.hasAttribute === "function" && target2.hasAttribute(UPMADE_OVERLAY_CONTROL_ATTRIBUTE)
53644
+ );
53645
+ }
53646
+ __name(isOverlayControlEvent, "isOverlayControlEvent");
53647
+ function runCursorLabelAction(core, action, event) {
53648
+ try {
53649
+ if (action.onClick) {
53650
+ action.onClick(event);
53651
+ } else if (event.cursorKind === "agent" && event.agentId && action.id === UPMADE_REMOVE_AGENT_CURSOR_ACTION.id) {
53652
+ if (!core.agentManager.sendHome(event.agentId)) {
53653
+ core.agentManager.remove(event.agentId);
53654
+ }
52760
53655
  }
52761
- return (parts[0][0] + parts[parts.length - 1][0]).toUpperCase();
53656
+ } catch (error) {
53657
+ console.error("[Upmade] A cursor label action failed:", error);
52762
53658
  }
52763
- };
53659
+ core.engine?.emitCursorLabelAction?.(event);
53660
+ }
53661
+ __name(runCursorLabelAction, "runCursorLabelAction");
52764
53662
 
52765
53663
  // src/helpers/wheel.helper.ts
52766
53664
  var UpmadeWheelHelper = class {