@agent-native/core 0.182.1 → 0.182.2-nightly-20260917225811

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 (119) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/clips/app/root.tsx +59 -10
  3. package/corpus/templates/clips/changelog/2026-09-17-desktop-popover-closes-when-clicking-away.md +6 -0
  4. package/corpus/templates/clips/changelog/2026-09-17-self-hosted-extension-sign-in.md +6 -0
  5. package/corpus/templates/clips/chrome-extension/src/background.ts +45 -25
  6. package/corpus/templates/clips/chrome-extension/src/content-script.ts +43 -0
  7. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +55 -6
  8. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +107 -19
  9. package/corpus/templates/design/.generated/bridge/hit-test.generated.ts +1 -0
  10. package/corpus/templates/design/actions/add-localhost-screens.ts +54 -22
  11. package/corpus/templates/design/actions/apply-component-prop-edit.ts +174 -14
  12. package/corpus/templates/design/actions/apply-visual-edit.ts +3 -1
  13. package/corpus/templates/design/actions/create-component.ts +173 -12
  14. package/corpus/templates/design/actions/create-design-from-template.ts +50 -35
  15. package/corpus/templates/design/actions/create-design-version.ts +21 -0
  16. package/corpus/templates/design/actions/create-file.ts +35 -33
  17. package/corpus/templates/design/actions/delete-design.ts +29 -28
  18. package/corpus/templates/design/actions/delete-file.ts +154 -23
  19. package/corpus/templates/design/actions/generate-design.ts +28 -16
  20. package/corpus/templates/design/actions/get-component-details.ts +272 -33
  21. package/corpus/templates/design/actions/get-design-version.ts +9 -1
  22. package/corpus/templates/design/actions/go-to-main-component.ts +37 -35
  23. package/corpus/templates/design/actions/index-components.ts +241 -126
  24. package/corpus/templates/design/actions/migrate-board-objects-to-file.ts +12 -9
  25. package/corpus/templates/design/actions/present-design-variants.ts +68 -72
  26. package/corpus/templates/design/actions/rename-component.ts +294 -0
  27. package/corpus/templates/design/actions/rename-screen.ts +10 -10
  28. package/corpus/templates/design/actions/update-file.ts +327 -330
  29. package/corpus/templates/design/actions/update-screen-source.ts +2 -43
  30. package/corpus/templates/design/app/components/design/EditPanel.tsx +17 -1
  31. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +228 -24
  32. package/corpus/templates/design/app/components/design/ResponsiveInteractBar.tsx +17 -1
  33. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +151 -32
  34. package/corpus/templates/design/app/components/design/bridge/hit-test.bridge.ts +4 -0
  35. package/corpus/templates/design/app/components/design/canvas-primitive-style.ts +1 -1
  36. package/corpus/templates/design/app/components/design/code-workbench/CodeWorkbench.tsx +8 -1
  37. package/corpus/templates/design/app/components/design/code-workbench/explorer/FileTree.tsx +55 -33
  38. package/corpus/templates/design/app/components/design/code-workbench/workspace/create-providers.ts +2 -0
  39. package/corpus/templates/design/app/components/design/code-workbench/workspace/inline-provider.ts +4 -2
  40. package/corpus/templates/design/app/components/design/edit-panel/component-section.tsx +273 -60
  41. package/corpus/templates/design/app/components/design/edit-panel/element-classification.ts +9 -2
  42. package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +57 -9
  43. package/corpus/templates/design/app/components/design/multi-screen/primitive-drop-target.ts +13 -0
  44. package/corpus/templates/design/app/components/design/multi-screen/types.ts +14 -0
  45. package/corpus/templates/design/app/components/design/types.ts +9 -1
  46. package/corpus/templates/design/app/hooks/use-design-versions.ts +3 -2
  47. package/corpus/templates/design/app/i18n-breakpoints.ts +0 -110
  48. package/corpus/templates/design/app/i18n-data.ts +0 -10
  49. package/corpus/templates/design/app/pages/DesignEditor.tsx +669 -161
  50. package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +20 -0
  51. package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +2 -0
  52. package/corpus/templates/design/app/pages/design-editor/commands/apply-design-editor-command.ts +21 -3
  53. package/corpus/templates/design/app/pages/design-editor/commands/apply-file-content-update.ts +2 -0
  54. package/corpus/templates/design/app/pages/design-editor/commands/create-component.ts +44 -3
  55. package/corpus/templates/design/app/pages/design-editor/commands/delete-files.ts +69 -47
  56. package/corpus/templates/design/app/pages/design-editor/commands/duplicate-screen.ts +157 -52
  57. package/corpus/templates/design/app/pages/design-editor/commands/duplicate-selection.ts +76 -1
  58. package/corpus/templates/design/app/pages/design-editor/commands/redo.ts +152 -44
  59. package/corpus/templates/design/app/pages/design-editor/commands/save-file-content.ts +131 -2
  60. package/corpus/templates/design/app/pages/design-editor/commands/screen-visual-duplicate-change.ts +5 -1
  61. package/corpus/templates/design/app/pages/design-editor/commands/undo.ts +26 -1
  62. package/corpus/templates/design/app/pages/design-editor/commands/visual-duplicate-change.ts +1 -0
  63. package/corpus/templates/design/app/pages/design-editor/editor-helpers.ts +58 -8
  64. package/corpus/templates/design/app/pages/design-editor/editor-state.ts +63 -2
  65. package/corpus/templates/design/app/pages/design-editor/history.ts +3 -0
  66. package/corpus/templates/design/app/pages/design-editor/nudge-intent.ts +74 -22
  67. package/corpus/templates/design/app/pages/design-editor/source-publication.ts +14 -2
  68. package/corpus/templates/design/changelog/2026-09-16-design-components-retain-linked-identities-when-edited-and-d.md +6 -0
  69. package/corpus/templates/design/changelog/2026-09-16-fix-design-nested-layer-dragging-and-screen-duplication-pari.md +6 -0
  70. package/corpus/templates/design/changelog/2026-09-17-design-drag-and-drop-keeps-duplicates-cross-screen-moves-and.md +6 -0
  71. package/corpus/templates/design/changelog/2026-09-17-design-preserves-reusable-component-identity-and-props-acros.md +6 -0
  72. package/corpus/templates/design/changelog/2026-09-17-open-vector-paths-no-longer-show-fills-and-interact-dimensio.md +6 -0
  73. package/corpus/templates/design/changelog/2026-09-17-screen-deletion-is-immediate-and-undoable-with-history-that-.md +6 -0
  74. package/corpus/templates/design/e2e/fixtures/design-component-react/index.html +98 -0
  75. package/corpus/templates/design/e2e/fixtures/design-component-react/inline-component.html +65 -0
  76. package/corpus/templates/design/e2e/helpers.ts +6 -1
  77. package/corpus/templates/design/server/lib/design-data-mutation.ts +9 -5
  78. package/corpus/templates/design/server/lib/design-snapshot.ts +28 -16
  79. package/corpus/templates/design/server/lib/design-versions.ts +208 -130
  80. package/corpus/templates/design/server/lib/fusion-screens.ts +46 -20
  81. package/corpus/templates/design/server/lib/import-design-files.ts +5 -1
  82. package/corpus/templates/design/server/lib/localhost-connection.ts +54 -0
  83. package/corpus/templates/design/server/source-workspace.ts +412 -356
  84. package/corpus/templates/design/shared/component-library.ts +36 -6
  85. package/corpus/templates/design/shared/component-model.ts +12 -2
  86. package/corpus/templates/design/shared/local-jsx-visual-edit.ts +231 -5
  87. package/corpus/templates/design/shared/source-mode.ts +22 -0
  88. package/dist/automation/index.d.ts +1 -1
  89. package/dist/client/AssistantChat.d.ts +4 -1
  90. package/dist/client/AssistantChat.js +26 -3
  91. package/dist/client/chat/agentkit-protocol.js +148 -34
  92. package/dist/client/chat/message-components.js +7 -5
  93. package/dist/client/chat/tool-call-display.js +4 -3
  94. package/dist/client/conversation/AgentConversation.js +4 -2
  95. package/dist/client/tool-display.d.ts +9 -0
  96. package/dist/client/tool-display.js +15 -0
  97. package/dist/collab/awareness.d.ts +2 -2
  98. package/dist/collab/routes.d.ts +1 -1
  99. package/dist/localization/core-messages/ar-SA.js +2 -0
  100. package/dist/localization/core-messages/de-DE.js +2 -0
  101. package/dist/localization/core-messages/en-US.d.ts +2 -0
  102. package/dist/localization/core-messages/en-US.js +2 -0
  103. package/dist/localization/core-messages/es-ES.js +2 -0
  104. package/dist/localization/core-messages/fr-FR.js +2 -0
  105. package/dist/localization/core-messages/hi-IN.js +2 -0
  106. package/dist/localization/core-messages/ja-JP.js +2 -0
  107. package/dist/localization/core-messages/ko-KR.js +2 -0
  108. package/dist/localization/core-messages/pt-BR.js +2 -0
  109. package/dist/localization/core-messages/zh-CN.js +2 -0
  110. package/dist/localization/core-messages/zh-TW.js +2 -0
  111. package/dist/localization/core-messages.d.ts +2 -0
  112. package/dist/notifications/routes.d.ts +3 -3
  113. package/dist/observability/routes.d.ts +3 -3
  114. package/dist/resources/handlers.d.ts +1 -1
  115. package/dist/secrets/routes.d.ts +3 -3
  116. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  117. package/dist/server/core-routes-plugin.d.ts +1 -1
  118. package/package.json +3 -3
  119. package/corpus/templates/design/app/components/design/editor/PendingScreenDeletionDialog.tsx +0 -66
@@ -1,4 +1,7 @@
1
1
  import { AGENTKIT_PROTOCOL_VERSION, AgentProtocolValidationError, approvalResponseFromResume, createCapabilityUnavailableError, createCapabilityUnsupportedError, inferAgentActivityKind, negotiateAgentKitProtocolVersion, resumeEntryFromApproval, resumeOptionId, } from "@agent-native/agentkit/protocol";
2
+ function isTerminalRunStatus(status) {
3
+ return (status === "completed" || status === "failed" || status === "cancelled");
4
+ }
2
5
  const TOOL_RESULT_MEDIA_TYPE = "application/x-agent-native-tool-result";
3
6
  const TOOL_CALL_MEDIA_TYPE = "application/x-agent-native-tool-call";
4
7
  const RUNTIME_PART_MEDIA_TYPE = "application/x-agent-native-runtime-part";
@@ -905,12 +908,7 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
905
908
  }
906
909
  function append(run, event) {
907
910
  const lastType = run.events.at(-1)?.type;
908
- if (lastType === "run.completed" ||
909
- lastType === "run.failed" ||
910
- lastType === "run.cancelled") {
911
- return;
912
- }
913
- const terminalActivityStatus = event.type === "run.completed" ||
911
+ const terminalStatus = event.type === "run.completed" ||
914
912
  (event.type === "run.status" && event.status === "completed")
915
913
  ? "completed"
916
914
  : event.type === "run.failed" ||
@@ -920,20 +918,32 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
920
918
  (event.type === "run.status" && event.status === "cancelled")
921
919
  ? "cancelled"
922
920
  : undefined;
923
- if (terminalActivityStatus && run.activeActivities.size > 0) {
924
- const completedAt = event.occurredAt ?? now();
925
- for (const activity of [...run.activeActivities.values()]) {
926
- append(run, {
927
- type: "activity.completed",
928
- occurredAt: completedAt,
929
- metadata: event.metadata,
930
- activity: {
931
- ...activity,
932
- status: terminalActivityStatus,
933
- completedAt,
934
- },
935
- });
921
+ const terminalFollowup = run.terminal &&
922
+ lastType === "run.status" &&
923
+ ((run.status === "completed" && event.type === "run.completed") ||
924
+ (run.status === "failed" && event.type === "run.failed") ||
925
+ (run.status === "cancelled" && event.type === "run.cancelled"));
926
+ if (lastType === "run.completed" ||
927
+ lastType === "run.failed" ||
928
+ lastType === "run.cancelled") {
929
+ return;
930
+ }
931
+ if (run.terminal &&
932
+ run.terminalAppendDepth === 0 &&
933
+ !terminalFollowup &&
934
+ !(terminalStatus && !isTerminalRunStatus(run.status))) {
935
+ return;
936
+ }
937
+ if (terminalStatus && run.terminalAppendDepth === 0) {
938
+ run.terminalAppendDepth = 1;
939
+ try {
940
+ appendTerminalFollowups(run, event, terminalStatus);
941
+ append(run, event);
936
942
  }
943
+ finally {
944
+ run.terminalAppendDepth = 0;
945
+ }
946
+ return;
937
947
  }
938
948
  const { occurredAt: eventTime, ...payload } = event;
939
949
  const sequence = run.sequence + 1;
@@ -948,6 +958,10 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
948
958
  metadata: mergeProtocolMetadata(run.metadata, event.metadata),
949
959
  };
950
960
  run.events.push(protocolEvent);
961
+ if (protocolEvent.type === "message.completed" &&
962
+ protocolEvent.message.id === run.activeMessageId) {
963
+ run.activeMessageCompleted = true;
964
+ }
951
965
  if (protocolEvent.type === "activity.started" ||
952
966
  protocolEvent.type === "activity.updated" ||
953
967
  protocolEvent.type === "activity.completed") {
@@ -958,6 +972,17 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
958
972
  run.activeActivities.delete(protocolEvent.activity.id);
959
973
  }
960
974
  }
975
+ if (protocolEvent.type === "tool.started") {
976
+ run.activeTools.set(protocolEvent.toolCall.id, protocolEvent.toolCall);
977
+ }
978
+ else if (protocolEvent.type === "tool.updated") {
979
+ if (protocolEvent.toolCall.status === "running") {
980
+ run.activeTools.set(protocolEvent.toolCall.id, protocolEvent.toolCall);
981
+ }
982
+ else {
983
+ run.activeTools.delete(protocolEvent.toolCall.id);
984
+ }
985
+ }
961
986
  if (run.events.length > maxRetainedEvents) {
962
987
  run.events.splice(0, run.events.length - maxRetainedEvents);
963
988
  run.firstRetainedSequence = run.events[0]?.sequence ?? run.sequence + 1;
@@ -965,6 +990,15 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
965
990
  let becameTerminal = false;
966
991
  if (protocolEvent.type === "run.status") {
967
992
  run.status = protocolEvent.status;
993
+ if (protocolEvent.status === "completed" ||
994
+ protocolEvent.status === "failed" ||
995
+ protocolEvent.status === "cancelled") {
996
+ run.completedAt = protocolEvent.occurredAt;
997
+ run.terminalAtMs = timeMs(protocolEvent.occurredAt);
998
+ run.actions.clear();
999
+ run.terminal = true;
1000
+ becameTerminal = true;
1001
+ }
968
1002
  }
969
1003
  else if (protocolEvent.type === "run.started") {
970
1004
  run.startedAt = protocolEvent.occurredAt;
@@ -973,7 +1007,11 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
973
1007
  run.status = "completed";
974
1008
  run.completedAt = protocolEvent.occurredAt;
975
1009
  run.terminalAtMs = timeMs(protocolEvent.occurredAt);
1010
+ if (protocolEvent.usage !== undefined) {
1011
+ run.usage = protocolEvent.usage;
1012
+ }
976
1013
  run.actions.clear();
1014
+ run.terminal = true;
977
1015
  becameTerminal = true;
978
1016
  }
979
1017
  else if (protocolEvent.type === "run.cancelled") {
@@ -981,6 +1019,7 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
981
1019
  run.completedAt = protocolEvent.occurredAt;
982
1020
  run.terminalAtMs = timeMs(protocolEvent.occurredAt);
983
1021
  run.actions.clear();
1022
+ run.terminal = true;
984
1023
  becameTerminal = true;
985
1024
  }
986
1025
  else if (protocolEvent.type === "run.failed") {
@@ -989,6 +1028,7 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
989
1028
  run.terminalAtMs = timeMs(protocolEvent.occurredAt);
990
1029
  run.error = protocolEvent.error;
991
1030
  run.actions.clear();
1031
+ run.terminal = true;
992
1032
  becameTerminal = true;
993
1033
  }
994
1034
  for (const listener of run.listeners)
@@ -996,6 +1036,82 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
996
1036
  if (becameTerminal)
997
1037
  pruneRetainedRuns(run.terminalAtMs);
998
1038
  }
1039
+ function appendTerminalFollowups(run, event, terminalStatus) {
1040
+ if (run.activeMessageId && !run.activeMessageCompleted) {
1041
+ append(run, {
1042
+ type: "message.completed",
1043
+ occurredAt: event.occurredAt ?? now(),
1044
+ metadata: event.metadata,
1045
+ message: {
1046
+ id: run.activeMessageId,
1047
+ role: "assistant",
1048
+ status: terminalStatus === "completed" ? "complete" : "error",
1049
+ parts: [],
1050
+ },
1051
+ });
1052
+ }
1053
+ const terminalActivityStatus = terminalStatus;
1054
+ const terminalToolStatus = terminalActivityStatus;
1055
+ if (terminalToolStatus && run.activeTools.size > 0) {
1056
+ const terminalError = terminalToolStatus === "failed" &&
1057
+ event.error &&
1058
+ typeof event.error === "object"
1059
+ ? event.error
1060
+ : undefined;
1061
+ for (const tool of [...run.activeTools.values()]) {
1062
+ append(run, {
1063
+ type: "tool.updated",
1064
+ occurredAt: event.occurredAt ?? now(),
1065
+ metadata: event.metadata,
1066
+ toolCall: {
1067
+ ...tool,
1068
+ status: terminalToolStatus,
1069
+ ...(terminalError ? { error: terminalError } : {}),
1070
+ },
1071
+ });
1072
+ }
1073
+ }
1074
+ if (terminalToolStatus && run.actions.size > 0) {
1075
+ const actionStatus = terminalToolStatus === "completed"
1076
+ ? "completed"
1077
+ : terminalToolStatus === "cancelled"
1078
+ ? "cancelled"
1079
+ : "failed";
1080
+ const actionError = actionStatus === "failed"
1081
+ ? {
1082
+ code: "run_terminated",
1083
+ message: "The run ended before the action reported a result.",
1084
+ }
1085
+ : undefined;
1086
+ for (const invocation of [...run.actions.values()]) {
1087
+ append(run, {
1088
+ type: actionStatus === "completed" ? "action.completed" : "action.failed",
1089
+ occurredAt: event.occurredAt ?? now(),
1090
+ metadata: event.metadata,
1091
+ result: {
1092
+ invocationId: invocation.id,
1093
+ status: actionStatus,
1094
+ ...(actionError ? { error: actionError } : {}),
1095
+ },
1096
+ });
1097
+ }
1098
+ }
1099
+ if (terminalActivityStatus && run.activeActivities.size > 0) {
1100
+ const completedAt = event.occurredAt ?? now();
1101
+ for (const activity of [...run.activeActivities.values()]) {
1102
+ append(run, {
1103
+ type: "activity.completed",
1104
+ occurredAt: completedAt,
1105
+ metadata: event.metadata,
1106
+ activity: {
1107
+ ...activity,
1108
+ status: terminalActivityStatus,
1109
+ completedAt,
1110
+ },
1111
+ });
1112
+ }
1113
+ }
1114
+ }
999
1115
  function runtimeEventToProtocolEvents(run, event) {
1000
1116
  const base = {
1001
1117
  occurredAt: event.timestamp,
@@ -1004,6 +1120,7 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
1004
1120
  switch (event.type) {
1005
1121
  case "message-start":
1006
1122
  run.activeMessageId = event.message.id;
1123
+ run.activeMessageCompleted = false;
1007
1124
  return [
1008
1125
  {
1009
1126
  type: "message.created",
@@ -1012,6 +1129,8 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
1012
1129
  },
1013
1130
  ];
1014
1131
  case "message-delta":
1132
+ run.activeMessageId = event.messageId;
1133
+ run.activeMessageCompleted = false;
1015
1134
  if (event.delta.type === "text") {
1016
1135
  return [
1017
1136
  {
@@ -1047,6 +1166,7 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
1047
1166
  ];
1048
1167
  case "message-done":
1049
1168
  run.activeMessageId = event.message.id;
1169
+ run.activeMessageCompleted = true;
1050
1170
  return [
1051
1171
  {
1052
1172
  type: "message.completed",
@@ -1767,8 +1887,11 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
1767
1887
  lastAccessedAtMs: timeMs(),
1768
1888
  activeReaders: 0,
1769
1889
  metadata: runMetadata,
1890
+ activeMessageCompleted: false,
1770
1891
  actions: new Map(),
1892
+ activeTools: new Map(),
1771
1893
  activeActivities: new Map(),
1894
+ terminalAppendDepth: 0,
1772
1895
  pumpPromise: null,
1773
1896
  continuationPromise: null,
1774
1897
  streamClosed: false,
@@ -1818,6 +1941,7 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
1818
1941
  usage: run.usage,
1819
1942
  error: run.error,
1820
1943
  metadata: run.metadata,
1944
+ activeMessageId: run.activeMessageId,
1821
1945
  };
1822
1946
  },
1823
1947
  async cancelRun(input) {
@@ -1851,19 +1975,8 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
1851
1975
  }
1852
1976
  run.waitingForContinuation = false;
1853
1977
  run.pendingApprovalId = undefined;
1854
- if (streamWasClosed) {
1855
- const completedAt = now();
1856
- run.status = "cancelled";
1857
- run.completedAt = completedAt;
1858
- run.terminalAtMs = timeMs(completedAt);
1859
- run.actions.clear();
1860
- run.activeActivities.clear();
1861
- pruneRetainedRuns(run.terminalAtMs);
1862
- }
1863
- else {
1864
- append(run, { type: "run.status", status: "cancelled" });
1865
- append(run, { type: "run.cancelled" });
1866
- }
1978
+ append(run, { type: "run.status", status: "cancelled" });
1979
+ append(run, { type: "run.cancelled" });
1867
1980
  },
1868
1981
  async dispose() {
1869
1982
  if (disposed)
@@ -2076,8 +2189,11 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
2076
2189
  activeReaders: 0,
2077
2190
  metadata: replacementMetadata,
2078
2191
  activeMessageId: run.activeMessageId,
2192
+ activeMessageCompleted: run.activeMessageCompleted,
2079
2193
  actions: new Map(run.actions),
2194
+ activeTools: new Map(run.activeTools),
2080
2195
  activeActivities: new Map(run.activeActivities),
2196
+ terminalAppendDepth: 0,
2081
2197
  pumpPromise: null,
2082
2198
  continuationPromise: null,
2083
2199
  streamClosed: false,
@@ -2160,8 +2276,6 @@ export function createAgentKitProtocolAdapter(runtime, options = {}) {
2160
2276
  run.waitingForContinuation = false;
2161
2277
  run.pendingConnectionRequestId = undefined;
2162
2278
  run.streamClosed = true;
2163
- run.terminal = true;
2164
- run.terminalAtMs = timeMs();
2165
2279
  append(run, { type: "run.status", status: "failed" });
2166
2280
  append(run, {
2167
2281
  type: "run.failed",
@@ -22,7 +22,7 @@ import { DEFAULT_LOCALE, useFormatters, useOptionalLocale, useT, } from "../i18n
22
22
  import { ThumbsFeedback } from "../observability/ThumbsFeedback.js";
23
23
  import { McpConnectionSuggestion } from "../resources/McpConnectionSuggestion.js";
24
24
  import { useThinkingDisplay } from "../thinking-display.js";
25
- import { humanizeToolName, isCallAgentToolCallShadowed, isToolCallActive, resolveToolCallRowContext, shadowedCallAgentToolCallIds, } from "../tool-display.js";
25
+ import { isCallAgentToolCallShadowed, isToolCallActive, resolveToolCallRowContext, shadowedCallAgentToolCallIds, toolLabel, } from "../tool-display.js";
26
26
  import { actionErrorMessage } from "../use-action.js";
27
27
  import { cn } from "../utils.js";
28
28
  import { AgentActivityTrace, } from "./agent-activity-trace.js";
@@ -985,11 +985,13 @@ export function getAssistantToolSummaryInfo(parts) {
985
985
  hiddenToolCount: toolCallIndices.length - ASSISTANT_VISIBLE_TOOL_CALL_LIMIT,
986
986
  };
987
987
  }
988
- function assistantActivityItem(part, index, isLast) {
988
+ function assistantActivityItem(part, index, isLast, translate) {
989
989
  if (part.type === "reasoning") {
990
990
  return {
991
991
  id: `reasoning-${index}`,
992
- label: "Reasoning",
992
+ label: translate("agentChat.activity.reasoning", {
993
+ defaultValue: "Reasoning",
994
+ }),
993
995
  variant: "reasoning",
994
996
  status: isLast ? "running" : "complete",
995
997
  };
@@ -1006,7 +1008,7 @@ function assistantActivityItem(part, index, isLast) {
1006
1008
  : "steps";
1007
1009
  return {
1008
1010
  id: part.toolCallId ?? `tool-${index}`,
1009
- label: humanizeToolName(toolName),
1011
+ label: toolLabel(translate, toolName),
1010
1012
  detail: resolveToolCallRowContext(part.args)?.text,
1011
1013
  variant,
1012
1014
  status: isLast ? "running" : "complete",
@@ -1344,7 +1346,7 @@ export function AssistantMessage() {
1344
1346
  if (!workPart)
1345
1347
  return null;
1346
1348
  return assistantActivityItem(workPart, index, messageIsRunning &&
1347
- itemIndex === part.indices.length - 1);
1349
+ itemIndex === part.indices.length - 1, t);
1348
1350
  })
1349
1351
  .filter((item) => item !== null), activeSummary: t("agentChat.status.working"), running: messageIsRunning, variant: hasCodeAgentTools ? "coding" : "steps", defaultOpen: hasCustomUi, children: children }));
1350
1352
  }
@@ -16,7 +16,7 @@ import { findMcpIntegrationForToolName } from "../resources/mcp-integration-cata
16
16
  import { McpIntegrationLogo } from "../resources/McpIntegrationLogo.js";
17
17
  import { useThinkingDisplay } from "../thinking-display.js";
18
18
  import { BashCell, EditCell, WriteCell, FilesChangedSummary, } from "../tool-cells/index.js";
19
- import { humanizeToolName, isCallAgentToolCallShadowed, isToolCallActive, resolveToolCallRowContext, } from "../tool-display.js";
19
+ import { isCallAgentToolCallShadowed, isToolCallActive, resolveToolCallRowContext, toolLabel, } from "../tool-display.js";
20
20
  import { useAgentChatContext } from "../use-agent-chat-context.js";
21
21
  import { cn } from "../utils.js";
22
22
  import { ActionChatUiSurface } from "./action-chat-ui-surface.js";
@@ -451,7 +451,7 @@ function ToolCallDisplayGeneric({ toolName, toolCallId, argsText, args, result,
451
451
  : isAgentError
452
452
  ? t("agentChat.tool.askingAgentFailed", { agent: agentName })
453
453
  : t("agentChat.tool.askedAgent", { agent: agentName })
454
- : humanizeToolName(toolName);
454
+ : toolLabel(t, toolName);
455
455
  const rowContext = isAgentCall ? null : resolveToolCallRowContext(args);
456
456
  const canExpand = isAgentCall
457
457
  ? hasStreamText
@@ -527,9 +527,10 @@ function AgentCallCell({ agentName, toolCallId, activity, progress, responseText
527
527
  (isRunning ? (workContent) : (_jsx(WorkedForSummary, { durationMs: durationMs, children: workContent }))), progressText && (_jsx("p", { className: "pb-1 text-xs text-muted-foreground", "data-testid": "agent-call-progress", "aria-live": "polite", children: progressText })), finalText && (_jsx("div", { className: "pb-1", children: _jsx(SmoothMarkdownText, { text: finalText, streaming: isRunning, resetKey: `agent-response-${responseKey}`, statusType: isRunning ? "running" : "complete" }) }))] }) })] }));
528
528
  }
529
529
  function AgentActivityToolCallRow({ tool, isActiveTail, }) {
530
+ const t = useT();
530
531
  const isRunning = tool.status === "running";
531
532
  const ToolIcon = resolveToolIcon(tool.name);
532
- return (_jsx(ToolActivityPresentation, { toolName: tool.name, isRunning: isRunning, toolCallId: tool.id, suppressLongRunningHint: true, children: _jsxs("div", { className: "agent-kit-density my-0.5 flex w-full items-center gap-1.5 rounded-md py-0.5 text-left text-muted-foreground", children: [_jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", children: isRunning ? (_jsx(CubeLoader, { "aria-hidden": "true", className: "size-3.5" })) : (_jsx(ToolIcon, { className: "size-3.5" })) }), _jsx("span", { className: cn("min-w-0 truncate font-normal", isActiveTail && "agent-running-shimmer"), children: humanizeToolName(tool.name) })] }) }));
533
+ return (_jsx(ToolActivityPresentation, { toolName: tool.name, isRunning: isRunning, toolCallId: tool.id, suppressLongRunningHint: true, children: _jsxs("div", { className: "agent-kit-density my-0.5 flex w-full items-center gap-1.5 rounded-md py-0.5 text-left text-muted-foreground", children: [_jsx("span", { className: "flex size-4 shrink-0 items-center justify-center", children: isRunning ? (_jsx(CubeLoader, { "aria-hidden": "true", className: "size-3.5" })) : (_jsx(ToolIcon, { className: "size-3.5" })) }), _jsx("span", { className: cn("min-w-0 truncate font-normal", isActiveTail && "agent-running-shimmer"), children: toolLabel(t, tool.name) })] }) }));
533
534
  }
534
535
  // ─── ToolCallFallback ──────────────────────────────────────────────────────────
535
536
  export function ToolCallFallback({ toolName, toolCallId, args, argsText, result, ...rest }) {
@@ -8,8 +8,9 @@ import { resolveToolRenderer } from "../chat/tool-render-registry.js";
8
8
  import { isBuiltinConnectRequiredResult, resolveBuiltinActionChatRenderer, resolveBuiltinFallbackToolRenderer, isBuiltinDataWidgetActionRenderer, } from "../chat/widgets/builtin-tool-renderers.js";
9
9
  import { MessageScroller, MessageScrollerButton, MessageScrollerContent, MessageScrollerItem, MessageScrollerProvider, MessageScrollerViewport, } from "../components/ui/message-scroller.js";
10
10
  import { HighlightedCodeBlock as SharedHighlightedCodeBlock } from "../HighlightedCodeBlock.js";
11
+ import { useT } from "../i18n.js";
11
12
  import { McpAppRenderer } from "../mcp-apps/McpAppRenderer.js";
12
- import { humanizeToolName } from "../tool-display.js";
13
+ import { toolLabel } from "../tool-display.js";
13
14
  import { cn } from "../utils.js";
14
15
  export function AgentConversation({ messages, loading = false, error, className, timelineClassName, emptyTitle = "No messages yet", emptyDescription, composer, }) {
15
16
  return (_jsxs("section", { className: cn("agent-conversation", className), children: [error && (_jsxs("div", { className: "agent-conversation__error", role: "alert", children: [_jsx(IconAlertTriangle, { size: 15, strokeWidth: 1.8 }), _jsx("span", { children: error })] })), _jsx(MessageScrollerProvider, { autoScroll: true, children: _jsxs(MessageScroller, { className: "agent-conversation__scroller", children: [_jsx(MessageScrollerViewport, { className: cn("agent-conversation__timeline", timelineClassName), children: _jsx(MessageScrollerContent, { children: loading && messages.length === 0 ? (_jsx(MessageScrollerItem, { children: _jsx(ConversationEmpty, { icon: _jsx(IconLoader2, { size: 17, className: "agent-conversation-spin" }), title: "Loading session..." }) })) : messages.length === 0 ? (_jsx(MessageScrollerItem, { children: _jsx(ConversationEmpty, { icon: _jsx(IconClock, { size: 18 }), title: emptyTitle, description: emptyDescription }) })) : (messages.map((message) => (_jsx(MessageScrollerItem, { messageId: message.id, scrollAnchor: message.role === "user", children: _jsx(AgentConversationMessageView, { message: message }) }, message.id)))) }) }), _jsx(MessageScrollerButton, { render: (buttonProps) => (_jsx("button", { ...buttonProps, className: cn("agent-conversation__scroll-bottom", "data-[active=false]:hidden", buttonProps.className), "aria-label": "Scroll to bottom", children: _jsx(IconArrowDown, { size: 15, strokeWidth: 1.9 }) })) })] }) }), composer] }));
@@ -160,6 +161,7 @@ function parseJsonObject(value) {
160
161
  : {};
161
162
  }
162
163
  function ConversationToolCall({ tool }) {
164
+ const t = useT();
163
165
  const resultJson = parseJsonText(tool.result);
164
166
  const nativeToolContext = {
165
167
  toolName: tool.name,
@@ -178,7 +180,7 @@ function ConversationToolCall({ tool }) {
178
180
  }
179
181
  const hasDetails = Boolean(tool.input || tool.result || tool.mcpApp);
180
182
  const icon = tool.state === "running" || tool.state === "activity" ? (_jsx(IconLoader2, { size: 14, className: "agent-conversation-spin" })) : tool.state === "errored" ? (_jsx(IconCircleX, { size: 14 })) : (_jsx(IconCheck, { size: 14 }));
181
- const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: "agent-conversation-tool__icon", children: icon }), _jsx("span", { className: "agent-conversation-tool__name", children: humanizeToolName(tool.name) }), tool.summary && (_jsx("span", { className: "agent-conversation-tool__summary", children: tool.summary }))] }));
183
+ const content = (_jsxs(_Fragment, { children: [_jsx("span", { className: "agent-conversation-tool__icon", children: icon }), _jsx("span", { className: "agent-conversation-tool__name", children: toolLabel(t, tool.name) }), tool.summary && (_jsx("span", { className: "agent-conversation-tool__summary", children: tool.summary }))] }));
182
184
  if (!hasDetails) {
183
185
  return _jsx("div", { className: "agent-conversation-tool", children: content });
184
186
  }
@@ -1,4 +1,13 @@
1
1
  export declare function humanizeToolName(toolName: string | undefined): string;
2
+ /**
3
+ * A tool row's label, translated when the app ships a string for this action.
4
+ *
5
+ * Without a catalog entry the label is derived from the action name itself
6
+ * (`get-case` reads "get case"), which leaves every non-English app with
7
+ * English rows it cannot translate. Apps add `agentChat.toolLabels.<action>`;
8
+ * the derived name stays the fallback, so nothing changes until they do.
9
+ */
10
+ export declare function toolLabel(translate: (key: string, options?: Record<string, unknown>) => string, toolName: string | undefined): string;
2
11
  export declare function runningToolLabel(toolName: string | undefined): string;
3
12
  export declare function humanizeToolLabelText(label: string, toolName: string | undefined): string;
4
13
  export interface ToolCallRowContext {
@@ -23,6 +23,21 @@ export function humanizeToolName(toolName) {
23
23
  .trim();
24
24
  return (name || "tool").toLowerCase();
25
25
  }
26
+ /**
27
+ * A tool row's label, translated when the app ships a string for this action.
28
+ *
29
+ * Without a catalog entry the label is derived from the action name itself
30
+ * (`get-case` reads "get case"), which leaves every non-English app with
31
+ * English rows it cannot translate. Apps add `agentChat.toolLabels.<action>`;
32
+ * the derived name stays the fallback, so nothing changes until they do.
33
+ */
34
+ export function toolLabel(translate, toolName) {
35
+ const humanized = humanizeToolName(toolName);
36
+ const raw = (toolName ?? "").trim();
37
+ if (!raw)
38
+ return humanized;
39
+ return translate(`agentChat.toolLabels.${raw}`, { defaultValue: humanized });
40
+ }
26
41
  export function runningToolLabel(toolName) {
27
42
  return `Running ${humanizeToolName(toolName)}`;
28
43
  }
@@ -62,11 +62,11 @@ export declare const postAwareness: import("h3").EventHandlerWithFetch<import("h
62
62
  error: string;
63
63
  states?: undefined;
64
64
  } | {
65
+ error?: undefined;
65
66
  states: {
66
67
  clientId: number;
67
68
  state: string;
68
69
  }[];
69
- error?: undefined;
70
70
  }>>;
71
71
  /**
72
72
  * GET /_agent-native/collab/:docId/users
@@ -77,9 +77,9 @@ export declare const getActiveUsers: import("h3").EventHandlerWithFetch<import("
77
77
  error: string;
78
78
  users?: undefined;
79
79
  } | {
80
+ error?: undefined;
80
81
  users: {
81
82
  clientId: number;
82
83
  lastSeen: number;
83
84
  }[];
84
- error?: undefined;
85
85
  }>>;
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
26
26
  * Body: { update: string (base64), requestSource?: string }
27
27
  */
28
28
  export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
29
- ok?: undefined;
30
29
  error: string;
30
+ ok?: undefined;
31
31
  } | {
32
32
  error?: undefined;
33
33
  ok: boolean;
@@ -1,4 +1,5 @@
1
1
  const messages = {
2
+ "activity.reasoning": "الاستدلال",
2
3
  "approval.alwaysAllow": "السماح دائمًا",
3
4
  "approval.alwaysAllowHint": "الموافقة على هذا الأمر المحدد والسماح به دائمًا",
4
5
  "approval.alwaysAllowAction": "السماح بهذا الإجراء دائمًا",
@@ -675,6 +676,7 @@ const messages = {
675
676
  "status.preparing": "جارٍ تحضير {{activity}}...",
676
677
  "status.writing": "جارٍ كتابة {{activity}}...",
677
678
  "status.stillGenerating": "لا يزال {{activity}} قيد الإنشاء",
679
+ "status.runningTool": "جارٍ تشغيل {{activity}}",
678
680
  "tabs.allChats": "جميع المحادثات",
679
681
  "tabs.closeTab": "إغلاق علامة التبويب",
680
682
  "tabs.main": "الرئيسية",
@@ -1,4 +1,5 @@
1
1
  const messages = {
2
+ "activity.reasoning": "Überlegung",
2
3
  "approval.alwaysAllow": "Immer erlauben",
3
4
  "approval.alwaysAllowHint": "Diesen exakten Befehl genehmigen und immer erlauben",
4
5
  "approval.alwaysAllowAction": "Diese Aktion immer erlauben",
@@ -320,6 +321,7 @@ const messages = {
320
321
  "status.preparing": "{{activity}} wird vorbereitet...",
321
322
  "status.writing": "{{activity}} wird geschrieben...",
322
323
  "status.stillGenerating": "{{activity}} wird weiterhin generiert",
324
+ "status.runningTool": "{{activity}} wird ausgeführt",
323
325
  "tabs.allChats": "Alle Chats",
324
326
  "tabs.closeTab": "Tab schließen",
325
327
  "tabs.main": "Hauptchat",
@@ -1,4 +1,5 @@
1
1
  declare const messages: {
2
+ readonly "activity.reasoning": "Reasoning";
2
3
  readonly "approval.alwaysAllow": "Always allow";
3
4
  readonly "approval.alwaysAllowHint": "Approve and always allow this exact command";
4
5
  readonly "approval.alwaysAllowAction": "Always allow this action";
@@ -659,6 +660,7 @@ declare const messages: {
659
660
  readonly "status.preparing": "Preparing {{activity}}...";
660
661
  readonly "status.writing": "Writing {{activity}}...";
661
662
  readonly "status.stillGenerating": "Still generating {{activity}}";
663
+ readonly "status.runningTool": "Running {{activity}}";
662
664
  readonly "tabs.allChats": "All chats";
663
665
  readonly "tabs.closeTab": "Close tab";
664
666
  readonly "tabs.main": "Main";
@@ -1,4 +1,5 @@
1
1
  const messages = {
2
+ "activity.reasoning": "Reasoning",
2
3
  "approval.alwaysAllow": "Always allow",
3
4
  "approval.alwaysAllowHint": "Approve and always allow this exact command",
4
5
  "approval.alwaysAllowAction": "Always allow this action",
@@ -659,6 +660,7 @@ const messages = {
659
660
  "status.preparing": "Preparing {{activity}}...",
660
661
  "status.writing": "Writing {{activity}}...",
661
662
  "status.stillGenerating": "Still generating {{activity}}",
663
+ "status.runningTool": "Running {{activity}}",
662
664
  "tabs.allChats": "All chats",
663
665
  "tabs.closeTab": "Close tab",
664
666
  "tabs.main": "Main",
@@ -1,4 +1,5 @@
1
1
  const messages = {
2
+ "activity.reasoning": "Razonamiento",
2
3
  "approval.alwaysAllow": "Permitir siempre",
3
4
  "approval.alwaysAllowHint": "Aprobar y permitir siempre este comando exacto",
4
5
  "approval.alwaysAllowAction": "Permitir siempre esta acción",
@@ -320,6 +321,7 @@ const messages = {
320
321
  "status.preparing": "Preparando {{activity}}...",
321
322
  "status.writing": "Escribiendo {{activity}}...",
322
323
  "status.stillGenerating": "Sigue generando {{activity}}",
324
+ "status.runningTool": "Ejecutando {{activity}}",
323
325
  "tabs.allChats": "Todos los chats",
324
326
  "tabs.closeTab": "Cerrar pestaña",
325
327
  "tabs.main": "Principal",
@@ -1,4 +1,5 @@
1
1
  const messages = {
2
+ "activity.reasoning": "Raisonnement",
2
3
  "approval.alwaysAllow": "Toujours autoriser",
3
4
  "approval.alwaysAllowHint": "Approuver et toujours autoriser cette commande exacte",
4
5
  "approval.alwaysAllowAction": "Toujours autoriser cette action",
@@ -320,6 +321,7 @@ const messages = {
320
321
  "status.preparing": "Préparation de {{activity}}...",
321
322
  "status.writing": "Écriture de {{activity}}...",
322
323
  "status.stillGenerating": "Génération de {{activity}} toujours en cours",
324
+ "status.runningTool": "Exécution de {{activity}}",
323
325
  "tabs.allChats": "Tous les chats",
324
326
  "tabs.closeTab": "Fermer l’onglet",
325
327
  "tabs.main": "Principal",
@@ -1,4 +1,5 @@
1
1
  const messages = {
2
+ "activity.reasoning": "तर्क",
2
3
  "approval.alwaysAllow": "हमेशा अनुमति दें",
3
4
  "approval.alwaysAllowHint": "इस सटीक कमांड को स्वीकृत करें और हमेशा अनुमति दें",
4
5
  "approval.alwaysAllowAction": "इस कार्रवाई को हमेशा अनुमति दें",
@@ -659,6 +660,7 @@ const messages = {
659
660
  "status.preparing": "{{activity}} तैयार किया जा रहा है...",
660
661
  "status.writing": "{{activity}} लिखा जा रहा है...",
661
662
  "status.stillGenerating": "{{activity}} अभी भी बनाया जा रहा है",
663
+ "status.runningTool": "{{activity}} चल रहा है",
662
664
  "tabs.allChats": "सभी चैट",
663
665
  "tabs.closeTab": "टैब बंद करें",
664
666
  "tabs.main": "मुख्य",
@@ -1,4 +1,5 @@
1
1
  const messages = {
2
+ "activity.reasoning": "推論",
2
3
  "approval.alwaysAllow": "常に許可",
3
4
  "approval.alwaysAllowHint": "この完全に同じコマンドを承認し、今後も常に許可します",
4
5
  "approval.alwaysAllowAction": "このアクションを常に許可",
@@ -655,6 +656,7 @@ const messages = {
655
656
  "status.preparing": "{{activity}} を準備中...",
656
657
  "status.writing": "{{activity}} を書き込み中...",
657
658
  "status.stillGenerating": "{{activity}} を引き続き生成中",
659
+ "status.runningTool": "{{activity}} を実行中",
658
660
  "tabs.allChats": "すべてのチャット",
659
661
  "tabs.closeTab": "タブを閉じる",
660
662
  "tabs.main": "メイン",
@@ -1,4 +1,5 @@
1
1
  const messages = {
2
+ "activity.reasoning": "추론",
2
3
  "approval.alwaysAllow": "항상 허용",
3
4
  "approval.alwaysAllowHint": "이 명령과 정확히 일치하는 명령을 승인하고 항상 허용합니다",
4
5
  "approval.alwaysAllowAction": "이 작업 항상 허용",
@@ -655,6 +656,7 @@ const messages = {
655
656
  "status.preparing": "{{activity}} 준비 중...",
656
657
  "status.writing": "{{activity}} 작성 중...",
657
658
  "status.stillGenerating": "{{activity}} 계속 생성 중",
659
+ "status.runningTool": "{{activity}} 실행 중",
658
660
  "tabs.allChats": "모든 채팅",
659
661
  "tabs.closeTab": "탭 닫기",
660
662
  "tabs.main": "메인",
@@ -1,4 +1,5 @@
1
1
  const messages = {
2
+ "activity.reasoning": "Raciocínio",
2
3
  "approval.alwaysAllow": "Sempre permitir",
3
4
  "approval.alwaysAllowHint": "Aprovar e sempre permitir este comando exato",
4
5
  "approval.alwaysAllowAction": "Sempre permitir esta ação",
@@ -320,6 +321,7 @@ const messages = {
320
321
  "status.preparing": "Preparando {{activity}}...",
321
322
  "status.writing": "Escrevendo {{activity}}...",
322
323
  "status.stillGenerating": "Ainda gerando {{activity}}",
324
+ "status.runningTool": "Executando {{activity}}",
323
325
  "tabs.allChats": "Todos os chats",
324
326
  "tabs.closeTab": "Fechar aba",
325
327
  "tabs.main": "Principal",