@agent-native/core 0.95.0 → 0.95.1

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 (135) hide show
  1. package/corpus/README.md +2 -2
  2. package/corpus/core/CHANGELOG.md +10 -0
  3. package/corpus/core/docs/content/locales/ar-SA/template-design.mdx +13 -0
  4. package/corpus/core/docs/content/locales/de-DE/template-design.mdx +18 -0
  5. package/corpus/core/docs/content/locales/es-ES/template-design.mdx +16 -0
  6. package/corpus/core/docs/content/locales/fr-FR/template-design.mdx +17 -0
  7. package/corpus/core/docs/content/locales/hi-IN/template-design.mdx +16 -0
  8. package/corpus/core/docs/content/locales/ja-JP/template-design.mdx +17 -0
  9. package/corpus/core/docs/content/locales/ko-KR/template-design.mdx +15 -0
  10. package/corpus/core/docs/content/locales/pt-BR/template-design.mdx +16 -0
  11. package/corpus/core/docs/content/locales/zh-CN/template-design.mdx +11 -0
  12. package/corpus/core/docs/content/locales/zh-TW/template-design.mdx +12 -0
  13. package/corpus/core/docs/content/template-design.mdx +16 -0
  14. package/corpus/core/package.json +2 -2
  15. package/corpus/core/src/agent/production-agent.ts +20 -0
  16. package/corpus/core/src/agent/thread-data-builder.ts +41 -17
  17. package/corpus/core/src/client/AssistantChat.tsx +250 -25
  18. package/corpus/core/src/client/chat/tool-call-display.tsx +1 -1
  19. package/corpus/core/src/client/chat/use-reconnect-reader-owner.ts +28 -0
  20. package/corpus/core/src/client/guided-questions.tsx +9 -1
  21. package/corpus/core/src/client/integrations/IntegrationsPanel.tsx +6 -7
  22. package/corpus/core/src/client/sse-event-processor.ts +90 -21
  23. package/corpus/core/src/connections/catalog.ts +2 -2
  24. package/corpus/core/src/deploy/build.ts +3 -0
  25. package/corpus/core/src/integrations/catalog.ts +2 -2
  26. package/corpus/core/src/server/auth.ts +1 -1
  27. package/corpus/core/src/server/credential-provider.ts +7 -3
  28. package/corpus/core/src/shared/cache-control.ts +10 -4
  29. package/corpus/templates/analytics/app/lib/data-sources.ts +5 -4
  30. package/corpus/templates/analytics/changelog/2026-07-10-slack-token-setup-marked-legacy.md +6 -0
  31. package/corpus/templates/analytics/server/lib/credential-keys.ts +6 -2
  32. package/corpus/templates/brain/changelog/2026-07-10-slack-backfill-token-marked-legacy.md +6 -0
  33. package/corpus/templates/brain/server/register-secrets.ts +2 -2
  34. package/corpus/templates/clips/app/components/library/library-layout.tsx +7 -1
  35. package/corpus/templates/clips/app/components/library/page-header.tsx +19 -3
  36. package/corpus/templates/clips/app/routes/_app.library._index.tsx +16 -12
  37. package/corpus/templates/clips/changelog/2026-07-10-new-recording-appears-once-when-the-library-sidebar-is-open.md +6 -0
  38. package/corpus/templates/clips/changelog/2026-07-10-slack-token-fallback-guidance.md +6 -0
  39. package/corpus/templates/clips/server/register-secrets.ts +1 -1
  40. package/corpus/templates/content/app/components/editor/DocumentEditor.tsx +0 -66
  41. package/corpus/templates/content/app/routes/_app.local-files.tsx +7 -47
  42. package/corpus/templates/content/changelog/2026-07-10-local-folders-now-wait-for-an-explicit-pull-before-content-r.md +6 -0
  43. package/corpus/templates/content/package.json +1 -1
  44. package/corpus/templates/design/actions/generate-design.ts +128 -31
  45. package/corpus/templates/design/actions/present-design-variants.ts +37 -9
  46. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +9 -3
  47. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +32 -10
  48. package/corpus/templates/design/app/components/design/QuestionFlow.tsx +2 -2
  49. package/corpus/templates/design/app/components/design/TweaksPanel.tsx +9 -1
  50. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +7 -5
  51. package/corpus/templates/design/app/components/design/multi-screen/types.ts +3 -0
  52. package/corpus/templates/design/app/global.css +10 -0
  53. package/corpus/templates/design/app/hooks/use-question-flow.ts +9 -2
  54. package/corpus/templates/design/app/i18n/zh-TW.ts +1 -0
  55. package/corpus/templates/design/app/i18n-data.ts +21 -11
  56. package/corpus/templates/design/changelog/2026-07-10-editor-panels-are-easier-to-distinguish-and-design-intake-qu.md +6 -0
  57. package/corpus/templates/design/changelog/2026-07-10-interact-mode-now-stays-on-the-full-canvas-matches-edit-visu.md +6 -0
  58. package/corpus/templates/design/changelog/2026-07-10-new-web-designs-open-at-desktop-size-and-adapt-across-mobile.md +6 -0
  59. package/corpus/templates/design/changelog/2026-07-10-tweaks-now-link-to-full-documentation.md +6 -0
  60. package/corpus/templates/design/server/plugins/agent-chat.ts +2 -0
  61. package/corpus/templates/mail/app/i18n/ar-SA.ts +3 -3
  62. package/corpus/templates/mail/app/i18n/de-DE.ts +3 -3
  63. package/corpus/templates/mail/app/i18n/en-US.ts +4 -3
  64. package/corpus/templates/mail/app/i18n/es-ES.ts +3 -3
  65. package/corpus/templates/mail/app/i18n/fr-FR.ts +3 -3
  66. package/corpus/templates/mail/app/i18n/hi-IN.ts +3 -3
  67. package/corpus/templates/mail/app/i18n/ja-JP.ts +3 -3
  68. package/corpus/templates/mail/app/i18n/ko-KR.ts +3 -3
  69. package/corpus/templates/mail/app/i18n/pt-BR.ts +3 -3
  70. package/corpus/templates/mail/app/i18n/zh-CN.ts +3 -3
  71. package/corpus/templates/mail/app/i18n/zh-TW.ts +3 -3
  72. package/corpus/templates/mail/changelog/2026-07-10-slack-intake-marked-legacy.md +6 -0
  73. package/corpus/templates/mail/server/lib/env-config.ts +5 -4
  74. package/corpus/templates/plan/package.json +1 -1
  75. package/dist/agent/production-agent.d.ts.map +1 -1
  76. package/dist/agent/production-agent.js +20 -0
  77. package/dist/agent/production-agent.js.map +1 -1
  78. package/dist/agent/thread-data-builder.d.ts.map +1 -1
  79. package/dist/agent/thread-data-builder.js +36 -18
  80. package/dist/agent/thread-data-builder.js.map +1 -1
  81. package/dist/client/AssistantChat.d.ts +3 -1
  82. package/dist/client/AssistantChat.d.ts.map +1 -1
  83. package/dist/client/AssistantChat.js +200 -28
  84. package/dist/client/AssistantChat.js.map +1 -1
  85. package/dist/client/chat/tool-call-display.js +1 -1
  86. package/dist/client/chat/tool-call-display.js.map +1 -1
  87. package/dist/client/chat/use-reconnect-reader-owner.d.ts +11 -0
  88. package/dist/client/chat/use-reconnect-reader-owner.d.ts.map +1 -0
  89. package/dist/client/chat/use-reconnect-reader-owner.js +21 -0
  90. package/dist/client/chat/use-reconnect-reader-owner.js.map +1 -0
  91. package/dist/client/guided-questions.d.ts.map +1 -1
  92. package/dist/client/guided-questions.js +5 -1
  93. package/dist/client/guided-questions.js.map +1 -1
  94. package/dist/client/integrations/IntegrationsPanel.d.ts.map +1 -1
  95. package/dist/client/integrations/IntegrationsPanel.js +5 -7
  96. package/dist/client/integrations/IntegrationsPanel.js.map +1 -1
  97. package/dist/client/sse-event-processor.d.ts.map +1 -1
  98. package/dist/client/sse-event-processor.js +67 -20
  99. package/dist/client/sse-event-processor.js.map +1 -1
  100. package/dist/collab/routes.d.ts +1 -1
  101. package/dist/connections/catalog.d.ts +2 -2
  102. package/dist/connections/catalog.js +2 -2
  103. package/dist/connections/catalog.js.map +1 -1
  104. package/dist/deploy/build.d.ts.map +1 -1
  105. package/dist/deploy/build.js +3 -1
  106. package/dist/deploy/build.js.map +1 -1
  107. package/dist/integrations/catalog.js +2 -2
  108. package/dist/integrations/catalog.js.map +1 -1
  109. package/dist/notifications/routes.d.ts +2 -2
  110. package/dist/observability/routes.d.ts +1 -1
  111. package/dist/provider-api/corpus-jobs.d.ts +2 -2
  112. package/dist/resources/handlers.d.ts +1 -1
  113. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  114. package/dist/server/auth.js +1 -1
  115. package/dist/server/auth.js.map +1 -1
  116. package/dist/server/credential-provider.d.ts +5 -3
  117. package/dist/server/credential-provider.d.ts.map +1 -1
  118. package/dist/server/credential-provider.js +7 -3
  119. package/dist/server/credential-provider.js.map +1 -1
  120. package/dist/shared/cache-control.d.ts +8 -6
  121. package/dist/shared/cache-control.d.ts.map +1 -1
  122. package/dist/shared/cache-control.js +8 -3
  123. package/dist/shared/cache-control.js.map +1 -1
  124. package/docs/content/locales/ar-SA/template-design.mdx +13 -0
  125. package/docs/content/locales/de-DE/template-design.mdx +18 -0
  126. package/docs/content/locales/es-ES/template-design.mdx +16 -0
  127. package/docs/content/locales/fr-FR/template-design.mdx +17 -0
  128. package/docs/content/locales/hi-IN/template-design.mdx +16 -0
  129. package/docs/content/locales/ja-JP/template-design.mdx +17 -0
  130. package/docs/content/locales/ko-KR/template-design.mdx +15 -0
  131. package/docs/content/locales/pt-BR/template-design.mdx +16 -0
  132. package/docs/content/locales/zh-CN/template-design.mdx +11 -0
  133. package/docs/content/locales/zh-TW/template-design.mdx +12 -0
  134. package/docs/content/template-design.mdx +16 -0
  135. package/package.json +2 -2
@@ -61,13 +61,6 @@ function sseActionPreparationStallTimeoutMs(options) {
61
61
  ? SSE_DURABLE_ACTION_PREPARATION_STALL_TIMEOUT_MS
62
62
  : SSE_ACTION_PREPARATION_STALL_TIMEOUT_MS;
63
63
  }
64
- function formatProgressBytes(bytes) {
65
- if (bytes < 1024)
66
- return `${bytes} B`;
67
- if (bytes < 1024 * 1024)
68
- return `${(bytes / 1024).toFixed(1)} KB`;
69
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
70
- }
71
64
  function activityProgressBytes(ev) {
72
65
  return typeof ev.progressBytes === "number" &&
73
66
  Number.isFinite(ev.progressBytes) &&
@@ -103,7 +96,7 @@ function preparationActivityLabel(tool, progressBytes) {
103
96
  if (progressBytes <= 0) {
104
97
  return `Preparing ${action}...`;
105
98
  }
106
- return `Writing ${action}... (${formatProgressBytes(progressBytes)} prepared)`;
99
+ return `Writing ${action}...`;
107
100
  }
108
101
  function visibleActivityLabel(ev, tool) {
109
102
  const progressBytes = activityProgressBytes(ev);
@@ -117,14 +110,9 @@ function findPendingToolCallIndex(content, toolName, toolCallId) {
117
110
  // calls can be in flight simultaneously, and name-only matching would
118
111
  // attach a result to the wrong call.
119
112
  if (toolCallId) {
120
- for (let i = content.length - 1; i >= 0; i--) {
121
- const part = content[i];
122
- if (part.type === "tool-call" &&
123
- part.toolCallId === toolCallId &&
124
- part.result === undefined) {
125
- return i;
126
- }
127
- }
113
+ const exactIndex = findPendingToolCallIndexById(content, toolCallId);
114
+ if (exactIndex >= 0)
115
+ return exactIndex;
128
116
  // Fall through to name-matching: the start event may have arrived before
129
117
  // the server started emitting ids (e.g. older server build), so the
130
118
  // stored toolCallId is the locally-generated "tc_N" value rather than the
@@ -140,6 +128,56 @@ function findPendingToolCallIndex(content, toolName, toolCallId) {
140
128
  }
141
129
  return -1;
142
130
  }
131
+ function findPendingToolCallIndexById(content, toolCallId) {
132
+ for (let i = content.length - 1; i >= 0; i--) {
133
+ const part = content[i];
134
+ if (part.type === "tool-call" &&
135
+ part.toolCallId === toolCallId &&
136
+ part.result === undefined) {
137
+ return i;
138
+ }
139
+ }
140
+ return -1;
141
+ }
142
+ function findOldestPendingActivityToolCallIndex(content, toolName) {
143
+ for (let i = 0; i < content.length; i += 1) {
144
+ const part = content[i];
145
+ if (part.type === "tool-call" &&
146
+ part.toolName === toolName &&
147
+ part.activity === true &&
148
+ part.result === undefined) {
149
+ return i;
150
+ }
151
+ }
152
+ return -1;
153
+ }
154
+ function findPendingActivityToolCallIndex(content, toolName, toolCallId) {
155
+ if (!toolCallId) {
156
+ return findPendingToolCallIndex(content, toolName);
157
+ }
158
+ // Activity events emitted while the model is assembling tool input already
159
+ // carry the engine's stable call id. Match that id exactly so repeated
160
+ // progress for one call updates one placeholder while parallel same-name
161
+ // calls retain separate cards.
162
+ const exactIndex = findPendingToolCallIndexById(content, toolCallId);
163
+ if (exactIndex >= 0)
164
+ return exactIndex;
165
+ // Older activity events may omit the id before a later progress event adds
166
+ // it. Upgrade one unambiguous reader-local placeholder instead of painting a
167
+ // second card for the same logical call.
168
+ const readerLocalCandidates = [];
169
+ for (let i = 0; i < content.length; i += 1) {
170
+ const part = content[i];
171
+ if (part.type === "tool-call" &&
172
+ part.toolName === toolName &&
173
+ part.activity === true &&
174
+ part.result === undefined &&
175
+ /^tc_\d+$/.test(part.toolCallId)) {
176
+ readerLocalCandidates.push(i);
177
+ }
178
+ }
179
+ return readerLocalCandidates.length === 1 ? readerLocalCandidates[0] : -1;
180
+ }
143
181
  function findCompletedToolCallIndex(content, toolCallId) {
144
182
  if (!toolCallId)
145
183
  return -1;
@@ -687,7 +725,13 @@ export function processEvent(ev, content, toolCallCounter, tabId, state) {
687
725
  }
688
726
  if (!tool)
689
727
  return { action: "continue" };
690
- const pendingToolCallIndex = findPendingToolCallIndex(content, tool);
728
+ const pendingToolCallIndex = findPendingActivityToolCallIndex(content, tool, ev.id);
729
+ if (pendingToolCallIndex >= 0 && ev.id) {
730
+ const pending = content[pendingToolCallIndex];
731
+ if (pending?.type === "tool-call" && pending.toolCallId !== ev.id) {
732
+ content[pendingToolCallIndex] = { ...pending, toolCallId: ev.id };
733
+ }
734
+ }
691
735
  if (pendingToolCallIndex === -1) {
692
736
  // Only surface a placeholder spinner when this tool has no card yet. A
693
737
  // trailing activity heartbeat that arrives after the matching tool_done
@@ -696,11 +740,12 @@ export function processEvent(ev, content, toolCallCounter, tabId, state) {
696
740
  // flicker. The real card reappears on the next tool_start regardless.
697
741
  const hasCompletedSameTool = content.some((part) => part.type === "tool-call" &&
698
742
  part.toolName === tool &&
699
- part.result !== undefined);
743
+ part.result !== undefined &&
744
+ (!ev.id || part.toolCallId === ev.id));
700
745
  if (!hasCompletedSameTool) {
701
746
  content.push({
702
747
  type: "tool-call",
703
- toolCallId: `tc_${++toolCallCounter.value}`,
748
+ toolCallId: ev.id ?? `tc_${++toolCallCounter.value}`,
704
749
  toolName: tool,
705
750
  argsText: "",
706
751
  args: {},
@@ -733,7 +778,9 @@ export function processEvent(ev, content, toolCallCounter, tabId, state) {
733
778
  }
734
779
  // Pass the server-assigned id so we upgrade the pending activity card
735
780
  // using id-match when available (parallel same-name calls stay separate).
736
- const pendingToolCallIndex = findPendingToolCallIndex(content, tool, ev.id);
781
+ const pendingToolCallIndex = ev.id
782
+ ? findPendingActivityToolCallIndex(content, tool, ev.id)
783
+ : findOldestPendingActivityToolCallIndex(content, tool);
737
784
  const pendingToolCall = pendingToolCallIndex >= 0 ? content[pendingToolCallIndex] : undefined;
738
785
  const pendingIsActivityPlaceholder = pendingToolCall?.type === "tool-call" &&
739
786
  pendingToolCall.activity === true &&