@agent-native/core 0.165.4 → 0.167.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 (224) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/analytics/.agents/skills/secrets/SKILL.md +5 -1
  3. package/corpus/templates/analytics/.agents/skills/workspace-conventions/SKILL.md +4 -1
  4. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +93 -56
  5. package/corpus/templates/analytics/app/i18n-data.ts +23 -20
  6. package/corpus/templates/analytics/app/pages/Settings.tsx +0 -1
  7. package/corpus/templates/analytics/app/pages/adhoc/explorer/index.tsx +0 -1
  8. package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +1 -1
  9. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/SqlChartCard.tsx +2 -1
  10. package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +0 -1
  11. package/corpus/templates/analytics/server/lib/first-party-analytics-backend.ts +0 -32
  12. package/corpus/templates/analytics/server/lib/session-replay.ts +1 -5
  13. package/corpus/templates/assets/.agents/skills/secrets/SKILL.md +5 -1
  14. package/corpus/templates/assets/.agents/skills/workspace-conventions/SKILL.md +4 -1
  15. package/corpus/templates/assets/actions/navigate.ts +2 -2
  16. package/corpus/templates/assets/actions/save-generated-image.ts +0 -5
  17. package/corpus/templates/assets/app/routes/brand-kits.$id.tsx +2 -262
  18. package/corpus/templates/assets/app/routes/library.tsx +1 -1
  19. package/corpus/templates/assets/app/routes/settings.tsx +0 -3
  20. package/corpus/templates/brain/.agents/skills/secrets/SKILL.md +5 -1
  21. package/corpus/templates/brain/.agents/skills/workspace-conventions/SKILL.md +4 -1
  22. package/corpus/templates/brain/actions/ask-brain.ts +0 -1
  23. package/corpus/templates/brain/actions/navigate.ts +2 -2
  24. package/corpus/templates/brain/app/routes/sources.tsx +0 -4
  25. package/corpus/templates/brain/server/lib/capture-sanitization.ts +0 -11
  26. package/corpus/templates/calendar/.agents/skills/secrets/SKILL.md +5 -1
  27. package/corpus/templates/calendar/.agents/skills/workspace-conventions/SKILL.md +4 -1
  28. package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +0 -20
  29. package/corpus/templates/calendar/app/pages/CalendarView.tsx +0 -1
  30. package/corpus/templates/chat/.agents/skills/secrets/SKILL.md +5 -1
  31. package/corpus/templates/chat/.agents/skills/workspace-conventions/SKILL.md +4 -1
  32. package/corpus/templates/chat/actions/navigate.ts +2 -2
  33. package/corpus/templates/clips/.agents/skills/secrets/SKILL.md +5 -1
  34. package/corpus/templates/clips/.agents/skills/workspace-conventions/SKILL.md +4 -1
  35. package/corpus/templates/clips/CHANGELOG.md +2 -0
  36. package/corpus/templates/clips/actions/import-loom-recording.ts +16 -4
  37. package/corpus/templates/clips/actions/navigate.ts +2 -2
  38. package/corpus/templates/clips/app/components/editor/stitch-manager.tsx +0 -1
  39. package/corpus/templates/clips/app/components/library/space-dialogs.tsx +0 -1
  40. package/corpus/templates/clips/app/components/meetings/share-meeting-dialog.tsx +0 -1
  41. package/corpus/templates/clips/app/components/player/clips-share-trigger.tsx +17 -0
  42. package/corpus/templates/clips/app/components/player/delete-recording-menu.tsx +3 -3
  43. package/corpus/templates/clips/app/components/player/video-player.tsx +2 -2
  44. package/corpus/templates/clips/app/components/recorder/recorder-engine.ts +0 -1
  45. package/corpus/templates/clips/app/components/settings/ai-setup-section.tsx +0 -1
  46. package/corpus/templates/clips/app/global.css +31 -0
  47. package/corpus/templates/clips/app/hooks/use-playback-position.ts +0 -2
  48. package/corpus/templates/clips/app/lib/download-release-channel.ts +10 -0
  49. package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +1 -3
  50. package/corpus/templates/clips/app/routes/download.tsx +67 -44
  51. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +7 -12
  52. package/corpus/templates/clips/app/routes/record.tsx +6 -6
  53. package/corpus/templates/clips/app/routes/share.$shareId.tsx +26 -29
  54. package/corpus/templates/clips/changelog/2026-08-20-clip-viewer-share-actions.md +6 -0
  55. package/corpus/templates/clips/changelog/2026-08-20-preparing-recording-countdown-overlay.md +1 -0
  56. package/corpus/templates/clips/chrome-extension/src/background.ts +0 -13
  57. package/corpus/templates/clips/chrome-extension/src/overlay.ts +0 -1
  58. package/corpus/templates/clips/chrome-extension/src/popup.ts +0 -20
  59. package/corpus/templates/clips/desktop/src/app.tsx +6 -18
  60. package/corpus/templates/clips/desktop/src/hooks/useMediaDevices.ts +0 -1
  61. package/corpus/templates/clips/desktop/src/lib/recorder.ts +0 -8
  62. package/corpus/templates/content/.agents/skills/secrets/SKILL.md +5 -1
  63. package/corpus/templates/content/.agents/skills/workspace-conventions/SKILL.md +4 -1
  64. package/corpus/templates/content/actions/_database-source-utils.ts +0 -3
  65. package/corpus/templates/content/actions/attach-content-database-source.ts +1 -4
  66. package/corpus/templates/content/actions/navigate.ts +2 -2
  67. package/corpus/templates/content/actions/prepare-builder-source-execution.ts +1 -1
  68. package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +0 -6
  69. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +0 -580
  70. package/corpus/templates/content/app/components/editor/database/FormView.tsx +2 -2
  71. package/corpus/templates/content/app/components/editor/database/filter-sort.ts +1 -1
  72. package/corpus/templates/content/app/components/editor/database/settings.tsx +0 -23
  73. package/corpus/templates/content/app/components/editor/database/sidebar.tsx +0 -1
  74. package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +8 -304
  75. package/corpus/templates/content/app/hooks/use-documents.ts +0 -1
  76. package/corpus/templates/content/shared/api.ts +0 -1
  77. package/corpus/templates/content/shared/builder-mdx.ts +0 -1
  78. package/corpus/templates/content/shared/nfm.ts +1 -7
  79. package/corpus/templates/crm/.agents/skills/secrets/SKILL.md +5 -1
  80. package/corpus/templates/crm/.agents/skills/workspace-conventions/SKILL.md +4 -1
  81. package/corpus/templates/crm/actions/merge-crm-records.ts +0 -4
  82. package/corpus/templates/crm/app/components/crm/record/RecordLists.tsx +0 -1
  83. package/corpus/templates/crm/server/crm/hubspot-adapter.ts +0 -1
  84. package/corpus/templates/crm/server/crm/salesforce-adapter.ts +0 -1
  85. package/corpus/templates/crm/server/db/crm-store.ts +1 -1
  86. package/corpus/templates/design/.agents/skills/secrets/SKILL.md +5 -1
  87. package/corpus/templates/design/.agents/skills/workspace-conventions/SKILL.md +4 -1
  88. package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +1 -14
  89. package/corpus/templates/design/AGENTS.md +2 -1
  90. package/corpus/templates/design/actions/apply-component-prop-edit.ts +1 -5
  91. package/corpus/templates/design/actions/generate-design.ts +0 -1
  92. package/corpus/templates/design/actions/generate-screens.ts +5 -2
  93. package/corpus/templates/design/actions/go-to-main-component.ts +2 -2
  94. package/corpus/templates/design/actions/list-design-systems.ts +10 -0
  95. package/corpus/templates/design/actions/navigate.ts +2 -2
  96. package/corpus/templates/design/actions/open-component-source.ts +4 -4
  97. package/corpus/templates/design/actions/present-design-variants.ts +1 -2
  98. package/corpus/templates/design/actions/run-design-audit.ts +0 -22
  99. package/corpus/templates/design/actions/show-design-questions.ts +5 -2
  100. package/corpus/templates/design/app/components/design/DesignCanvas.tsx +19 -8
  101. package/corpus/templates/design/app/components/design/EditPanel.tsx +11 -183
  102. package/corpus/templates/design/app/components/design/MultiScreenCanvas.tsx +21 -4
  103. package/corpus/templates/design/app/components/design/QuestionFlow.tsx +1 -5
  104. package/corpus/templates/design/app/components/design/bridge/codegen.ts +1 -1
  105. package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +10 -19
  106. package/corpus/templates/design/app/components/design/edit-panel/appearance-properties.tsx +1 -1
  107. package/corpus/templates/design/app/components/design/edit-panel/layout-properties.tsx +13 -3
  108. package/corpus/templates/design/app/components/design/edit-panel/panel-primitives.tsx +38 -32
  109. package/corpus/templates/design/app/components/design/edit-panel/position-layout-properties.tsx +1 -4
  110. package/corpus/templates/design/app/components/design/inspector/AlignmentMatrix.tsx +0 -4
  111. package/corpus/templates/design/app/components/design/inspector/AutoLayoutMatrix.tsx +15 -6
  112. package/corpus/templates/design/app/components/design/inspector/DesignColorPicker.tsx +2 -2
  113. package/corpus/templates/design/app/components/visual-editor/NodeRewriteProposal.tsx +0 -1
  114. package/corpus/templates/design/app/components/visual-editor/ReviewCanvasPins.tsx +1 -1
  115. package/corpus/templates/design/app/i18n-data.ts +122 -0
  116. package/corpus/templates/design/app/lib/clipboard-content-lineage.ts +11 -1
  117. package/corpus/templates/design/app/pages/DesignEditor.tsx +50 -254
  118. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +163 -8
  119. package/corpus/templates/design/app/pages/Index.tsx +17 -0
  120. package/corpus/templates/design/app/pages/design-editor/canvas-primitive-insert.ts +44 -32
  121. package/corpus/templates/design/app/pages/design-editor/canvas-primitives.ts +10 -0
  122. package/corpus/templates/design/app/pages/design-editor/clone-and-pen-edit.ts +49 -3
  123. package/corpus/templates/design/app/pages/design-editor/clone-idrefs.ts +31 -0
  124. package/corpus/templates/design/app/pages/design-editor/code-layer-state.ts +28 -0
  125. package/corpus/templates/design/app/pages/design-editor/commands/add-auto-layout.ts +3 -3
  126. package/corpus/templates/design/app/pages/design-editor/commands/align-selection.ts +44 -14
  127. package/corpus/templates/design/app/pages/design-editor/commands/apply-local-content-update.ts +16 -5
  128. package/corpus/templates/design/app/pages/design-editor/commands/change-selected-z-index.ts +1 -1
  129. package/corpus/templates/design/app/pages/design-editor/commands/frame-selection.ts +1 -1
  130. package/corpus/templates/design/app/pages/design-editor/commands/group-selection.ts +1 -1
  131. package/corpus/templates/design/app/pages/design-editor/commands/nudge-selection.ts +1 -1
  132. package/corpus/templates/design/app/pages/design-editor/commands/paste-selection.ts +142 -17
  133. package/corpus/templates/design/app/pages/design-editor/commands/screen-visual-duplicate-change.ts +1 -0
  134. package/corpus/templates/design/app/pages/design-editor/commands/ungroup-selection.ts +1 -1
  135. package/corpus/templates/design/app/pages/design-editor/commands/visual-duplicate-change.ts +1 -0
  136. package/corpus/templates/design/app/pages/design-editor/cross-screen-text-color.ts +25 -9
  137. package/corpus/templates/design/app/pages/design-editor/editor-state.ts +1 -0
  138. package/corpus/templates/design/app/pages/design-editor/measure-child-rects.ts +83 -0
  139. package/corpus/templates/design/app/pages/design-editor/paste-placement.ts +66 -0
  140. package/corpus/templates/design/server/routes/[...page].get.ts +0 -1
  141. package/corpus/templates/design/shared/code-layer.ts +120 -70
  142. package/corpus/templates/design/shared/design-surface-index.ts +0 -1
  143. package/corpus/templates/design/shared/pen-path.ts +0 -4
  144. package/corpus/templates/dispatch/.agents/skills/secrets/SKILL.md +5 -1
  145. package/corpus/templates/dispatch/.agents/skills/workspace-conventions/SKILL.md +4 -1
  146. package/corpus/templates/dispatch/app/routes/integrations.tsx +0 -109
  147. package/corpus/templates/factory/.agents/skills/secrets/SKILL.md +5 -1
  148. package/corpus/templates/factory/.agents/skills/workspace-conventions/SKILL.md +4 -1
  149. package/corpus/templates/factory/actions/navigate.ts +2 -2
  150. package/corpus/templates/factory/app/components/factory/FactoryAuditView.tsx +0 -13
  151. package/corpus/templates/factory/app/routes/factory.tsx +0 -1
  152. package/corpus/templates/factory/server/factory-graph/store.ts +0 -1
  153. package/corpus/templates/forms/.agents/skills/secrets/SKILL.md +5 -1
  154. package/corpus/templates/forms/.agents/skills/workspace-conventions/SKILL.md +4 -1
  155. package/corpus/templates/macros/.agents/skills/secrets/SKILL.md +5 -1
  156. package/corpus/templates/macros/.agents/skills/workspace-conventions/SKILL.md +4 -1
  157. package/corpus/templates/macros/app/components/layout/AppLayout.tsx +0 -1
  158. package/corpus/templates/mail/.agents/skills/secrets/SKILL.md +5 -1
  159. package/corpus/templates/mail/.agents/skills/workspace-conventions/SKILL.md +4 -1
  160. package/corpus/templates/mail/app/components/email/EmailList.tsx +0 -1
  161. package/corpus/templates/mail/app/components/layout/AppLayout.tsx +2 -2
  162. package/corpus/templates/mail/shared/markdown.ts +3 -0
  163. package/corpus/templates/plan/.agents/skills/secrets/SKILL.md +5 -1
  164. package/corpus/templates/plan/.agents/skills/workspace-conventions/SKILL.md +4 -1
  165. package/corpus/templates/slides/.agents/skills/secrets/SKILL.md +5 -1
  166. package/corpus/templates/slides/.agents/skills/workspace-conventions/SKILL.md +4 -1
  167. package/corpus/templates/slides/actions/add-slide.ts +0 -1
  168. package/corpus/templates/slides/actions/list-decks.ts +1 -1
  169. package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +1 -4
  170. package/corpus/templates/slides/app/components/editor/SlideContextToolbar.tsx +0 -1
  171. package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +1 -1
  172. package/corpus/templates/slides/app/pages/DeckEditor.tsx +1 -6
  173. package/corpus/templates/tasks/.agents/skills/secrets/SKILL.md +5 -1
  174. package/corpus/templates/tasks/.agents/skills/workspace-conventions/SKILL.md +4 -1
  175. package/corpus/templates/tasks/app/components/layout/Layout.tsx +0 -1
  176. package/corpus/templates/tasks/app/hooks/use-visible-task-fields.ts +1 -4
  177. package/corpus/templates/tasks/server/custom-fields/store.ts +1 -6
  178. package/corpus/templates/tasks/shared/list-screen-snapshot.ts +2 -2
  179. package/dist/agent/engine/registry.js +27 -14
  180. package/dist/agent/index.d.ts +1 -1
  181. package/dist/agent/production-agent.d.ts +19 -6
  182. package/dist/agent/production-agent.js +57 -16
  183. package/dist/agent/types.d.ts +3 -0
  184. package/dist/changelog/parse.js +219 -8
  185. package/dist/client/EnvironmentBadge.d.ts +1 -0
  186. package/dist/client/EnvironmentBadge.js +7 -0
  187. package/dist/collab/routes.d.ts +1 -1
  188. package/dist/collab/struct-routes.d.ts +1 -1
  189. package/dist/config.d.ts +11 -0
  190. package/dist/config.js +248 -0
  191. package/dist/deploy/build.js +12 -1
  192. package/dist/index.d.ts +1 -1
  193. package/dist/observability/routes.d.ts +3 -3
  194. package/dist/progress/routes.d.ts +1 -1
  195. package/dist/resources/handlers.d.ts +2 -2
  196. package/dist/secrets/routes.d.ts +9 -9
  197. package/dist/server/agent-chat/plugin-options.d.ts +3 -2
  198. package/dist/server/agent-chat-plugin.js +5 -2
  199. package/dist/server/index.d.ts +1 -1
  200. package/dist/templates/chat/.agents/skills/secrets/SKILL.md +5 -1
  201. package/dist/templates/chat/.agents/skills/workspace-conventions/SKILL.md +4 -1
  202. package/dist/templates/chat/actions/navigate.ts +2 -2
  203. package/dist/templates/default/.agents/skills/secrets/SKILL.md +5 -1
  204. package/dist/templates/default/.agents/skills/workspace-conventions/SKILL.md +4 -1
  205. package/dist/templates/headless/.agents/skills/secrets/SKILL.md +5 -1
  206. package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +5 -1
  207. package/dist/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +4 -1
  208. package/dist/vite/agent-native-config-loader.d.ts +1 -0
  209. package/dist/vite/agent-native-config-loader.js +3 -3
  210. package/dist/vite/agents-bundle-plugin.d.ts +1 -1
  211. package/dist/vite/agents-bundle-plugin.js +13 -1
  212. package/dist/vite/client.js +14 -14
  213. package/docs/content/agent-native-config.mdx +62 -11
  214. package/docs/content/agent-surfaces.mdx +6 -0
  215. package/docs/content/environment-variables.mdx +5 -2
  216. package/package.json +3 -3
  217. package/src/templates/chat/.agents/skills/secrets/SKILL.md +5 -1
  218. package/src/templates/chat/.agents/skills/workspace-conventions/SKILL.md +4 -1
  219. package/src/templates/chat/actions/navigate.ts +2 -2
  220. package/src/templates/default/.agents/skills/secrets/SKILL.md +5 -1
  221. package/src/templates/default/.agents/skills/workspace-conventions/SKILL.md +4 -1
  222. package/src/templates/headless/.agents/skills/secrets/SKILL.md +5 -1
  223. package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +5 -1
  224. package/src/templates/workspace-core/.agents/skills/workspace-conventions/SKILL.md +4 -1
@@ -237,6 +237,213 @@ function normalizedChangelogText(value) {
237
237
  .replace(/\s+/g, " ")
238
238
  .trim();
239
239
  }
240
+ function stripHtmlComments(line, inComment, initialInlineCodeMarker) {
241
+ let cursor = 0;
242
+ let visibleLine = "";
243
+ const comments = [];
244
+ let inlineCodeMarker = initialInlineCodeMarker;
245
+ while (cursor < line.length) {
246
+ if (inComment) {
247
+ const commentEnd = line.indexOf("-->", cursor);
248
+ if (commentEnd === -1) {
249
+ return {
250
+ line: visibleLine,
251
+ inComment: true,
252
+ inlineCodeMarker,
253
+ comments,
254
+ };
255
+ }
256
+ cursor = commentEnd + 3;
257
+ inComment = false;
258
+ continue;
259
+ }
260
+ if (inlineCodeMarker) {
261
+ const codeEnd = line.indexOf(inlineCodeMarker, cursor);
262
+ if (codeEnd === -1) {
263
+ visibleLine += line.slice(cursor);
264
+ break;
265
+ }
266
+ visibleLine += line.slice(cursor, codeEnd + inlineCodeMarker.length);
267
+ cursor = codeEnd + inlineCodeMarker.length;
268
+ inlineCodeMarker = undefined;
269
+ continue;
270
+ }
271
+ const commentStart = line.indexOf("<!--", cursor);
272
+ const codeStartIndex = line.indexOf("`", cursor);
273
+ if (codeStartIndex !== -1 &&
274
+ (commentStart === -1 || codeStartIndex < commentStart)) {
275
+ visibleLine += line.slice(cursor, codeStartIndex);
276
+ const codeStart = /^`+/.exec(line.slice(codeStartIndex))?.[0] ?? "`";
277
+ visibleLine += codeStart;
278
+ cursor = codeStartIndex + codeStart.length;
279
+ inlineCodeMarker = codeStart;
280
+ continue;
281
+ }
282
+ if (commentStart === -1) {
283
+ visibleLine += line.slice(cursor);
284
+ break;
285
+ }
286
+ visibleLine += line.slice(cursor, commentStart);
287
+ const commentEnd = line.indexOf("-->", commentStart + 4);
288
+ if (commentEnd !== -1) {
289
+ comments.push(line.slice(commentStart, commentEnd + 3));
290
+ }
291
+ cursor = commentStart + 4;
292
+ inComment = true;
293
+ }
294
+ return { line: visibleLine, inComment, inlineCodeMarker, comments };
295
+ }
296
+ function splitChangelogBodyGroups(body) {
297
+ const matches = [];
298
+ let offset = 0;
299
+ let fenceMarker;
300
+ let htmlComment = false;
301
+ let inlineCodeMarker;
302
+ for (const line of body.split(/\r?\n/)) {
303
+ const lineEnd = offset + line.length;
304
+ if (fenceMarker) {
305
+ const fence = /^\s*(`{3,}|~{3,})(.*)$/.exec(line)?.[1];
306
+ const closingFence = /^\s*(`{3,}|~{3,})\s*$/.exec(line)?.[1];
307
+ if (fence &&
308
+ closingFence &&
309
+ fenceMarker.character === fence[0] &&
310
+ closingFence.length >= fenceMarker.length) {
311
+ fenceMarker = undefined;
312
+ }
313
+ }
314
+ else {
315
+ let visibleLine;
316
+ let headingComments = [];
317
+ if (!htmlComment && !inlineCodeMarker) {
318
+ const fence = /^\s*(`{3,}|~{3,})(.*)$/.exec(line)?.[1];
319
+ if (fence) {
320
+ fenceMarker = { character: fence[0], length: fence.length };
321
+ }
322
+ else {
323
+ const commentResult = stripHtmlComments(line, false, inlineCodeMarker);
324
+ htmlComment = commentResult.inComment;
325
+ inlineCodeMarker = commentResult.inlineCodeMarker;
326
+ visibleLine = commentResult.line;
327
+ headingComments = commentResult.comments;
328
+ }
329
+ }
330
+ else {
331
+ const commentResult = stripHtmlComments(line, htmlComment, inlineCodeMarker);
332
+ htmlComment = commentResult.inComment;
333
+ inlineCodeMarker = commentResult.inlineCodeMarker;
334
+ visibleLine = commentResult.line;
335
+ headingComments = commentResult.comments;
336
+ }
337
+ if (visibleLine !== undefined && !fenceMarker) {
338
+ const fence = /^\s*(`{3,}|~{3,})(.*)$/.exec(visibleLine)?.[1];
339
+ if (fence) {
340
+ fenceMarker = { character: fence[0], length: fence.length };
341
+ }
342
+ else {
343
+ const heading = /^ {0,3}###\s+(.+?)(?:\s+#+)?\s*$/.exec(visibleLine);
344
+ if (heading &&
345
+ CHANGELOG_GROUP_ORDER.some((type) => GROUP_LABELS[type].toLowerCase() ===
346
+ heading[1].trim().toLowerCase())) {
347
+ matches.push({
348
+ title: heading[1].trim(),
349
+ headingComments,
350
+ start: offset,
351
+ headingEnd: lineEnd,
352
+ });
353
+ }
354
+ }
355
+ }
356
+ }
357
+ const newlineLength = body.startsWith("\r\n", lineEnd)
358
+ ? 2
359
+ : lineEnd < body.length
360
+ ? 1
361
+ : 0;
362
+ offset = lineEnd + newlineLength;
363
+ }
364
+ if (matches.length === 0)
365
+ return { prefix: body.trim(), groups: [] };
366
+ const prefix = body.slice(0, matches[0].start).trim();
367
+ const groups = matches.map((match, index) => {
368
+ const end = matches[index + 1]?.start ?? body.length;
369
+ return {
370
+ title: match.title,
371
+ headingComments: match.headingComments,
372
+ body: body.slice(match.headingEnd, end).trim(),
373
+ index,
374
+ };
375
+ });
376
+ return { prefix, groups };
377
+ }
378
+ function changelogBodyGroupOrder(title) {
379
+ const normalizedTitle = title.toLowerCase();
380
+ const index = CHANGELOG_GROUP_ORDER.findIndex((type) => GROUP_LABELS[type].toLowerCase() === normalizedTitle);
381
+ return index === -1 ? CHANGELOG_GROUP_ORDER.length : index;
382
+ }
383
+ function normalizeChangelogBody(body) {
384
+ const { prefix, groups } = splitChangelogBodyGroups(body);
385
+ if (groups.length < 2)
386
+ return body.trim();
387
+ const uniqueGroups = new Map();
388
+ for (const group of groups) {
389
+ const key = group.title.toLowerCase();
390
+ const current = uniqueGroups.get(key);
391
+ const headingComments = current
392
+ ? [
393
+ ...current.headingComments,
394
+ ...group.headingComments.filter((comment) => !current.headingComments.includes(comment)),
395
+ ]
396
+ : group.headingComments;
397
+ uniqueGroups.set(key, {
398
+ title: current?.title ?? group.title,
399
+ headingComments,
400
+ body: [current?.body, group.body].filter(Boolean).join("\n"),
401
+ index: current?.index ?? group.index,
402
+ });
403
+ }
404
+ const renderedGroups = [...uniqueGroups.values()]
405
+ .sort((a, b) => changelogBodyGroupOrder(a.title) - changelogBodyGroupOrder(b.title) ||
406
+ a.index - b.index)
407
+ .map((group) => `### ${group.title}${group.headingComments.length ? ` ${group.headingComments.join(" ")}` : ""}\n\n${group.body}`);
408
+ return [prefix, ...renderedGroups].filter(Boolean).join("\n\n");
409
+ }
410
+ function mergeChangelogBodies(pendingBody, existingBody) {
411
+ const pending = splitChangelogBodyGroups(pendingBody);
412
+ const existing = splitChangelogBodyGroups(existingBody);
413
+ if (pending.groups.length === 0) {
414
+ return normalizeChangelogBody(existingBody);
415
+ }
416
+ if (existing.groups.length === 0) {
417
+ return [pendingBody, existingBody]
418
+ .map((body) => body.trim())
419
+ .filter(Boolean)
420
+ .join("\n\n");
421
+ }
422
+ const groups = new Map();
423
+ for (const group of [...pending.groups, ...existing.groups]) {
424
+ const key = group.title.toLowerCase();
425
+ const current = groups.get(key);
426
+ const headingComments = current
427
+ ? [
428
+ ...current.headingComments,
429
+ ...group.headingComments.filter((comment) => !current.headingComments.includes(comment)),
430
+ ]
431
+ : group.headingComments;
432
+ groups.set(key, {
433
+ title: current?.title ?? group.title,
434
+ headingComments,
435
+ body: [current?.body, group.body].filter(Boolean).join("\n"),
436
+ index: current?.index ?? group.index,
437
+ });
438
+ }
439
+ const prefix = [pending.prefix, existing.prefix].filter(Boolean).join("\n\n");
440
+ return normalizeChangelogBody([
441
+ prefix,
442
+ ...[...groups.values()].map((group) => `### ${group.title}${group.headingComments.length ? ` ${group.headingComments.join(" ")}` : ""}\n\n${group.body}`),
443
+ ]
444
+ .filter(Boolean)
445
+ .join("\n\n"));
446
+ }
240
447
  /**
241
448
  * Render an app-facing changelog that includes both released CHANGELOG.md
242
449
  * sections and adjacent folder-backed `changelog/*.md` entries. This is pure
@@ -246,10 +453,19 @@ function normalizedChangelogText(value) {
246
453
  export function mergePendingChangelog(existing, pending) {
247
454
  const cleanExisting = stripChangelogArchiveNotes(existing);
248
455
  const existingEntries = parseChangelog(cleanExisting);
456
+ const pendingSeen = new Set();
249
457
  const pendingWithText = pending.filter((entry) => {
250
458
  const text = entry.text.trim();
251
459
  if (!text)
252
460
  return false;
461
+ const pendingKey = [
462
+ entry.date ?? "",
463
+ entry.type,
464
+ normalizedChangelogText(text),
465
+ ].join("\u0000");
466
+ if (pendingSeen.has(pendingKey))
467
+ return false;
468
+ pendingSeen.add(pendingKey);
253
469
  return !existingEntries.some((existingEntry) => {
254
470
  if (entry.date &&
255
471
  existingEntry.date &&
@@ -261,7 +477,7 @@ export function mergePendingChangelog(existing, pending) {
261
477
  });
262
478
  if (pendingWithText.length === 0) {
263
479
  const sections = existingEntries
264
- .map((entry) => `## ${entry.title}\n\n${cleanChangelogBody(entry.body)}`)
480
+ .map((entry) => `## ${entry.title}\n\n${normalizeChangelogBody(cleanChangelogBody(entry.body))}`)
265
481
  .join("\n\n");
266
482
  return `${changelogHeader(cleanExisting)}${sections ? `\n\n${sections}` : ""}\n\n${CHANGELOG_ARCHIVE_NOTE}\n`;
267
483
  }
@@ -273,7 +489,7 @@ export function mergePendingChangelog(existing, pending) {
273
489
  const sections = existingEntries.map((entry) => ({
274
490
  title: entry.title,
275
491
  date: entry.date,
276
- body: cleanChangelogBody(entry.body),
492
+ body: normalizeChangelogBody(cleanChangelogBody(entry.body)),
277
493
  }));
278
494
  for (const title of [...pendingByTitle.keys()].sort(pendingSectionSort)) {
279
495
  const body = renderReleaseBody(pendingByTitle.get(title) ?? []);
@@ -283,12 +499,7 @@ export function mergePendingChangelog(existing, pending) {
283
499
  return entry.date === title || entry.title === title;
284
500
  });
285
501
  if (existingIndex !== -1) {
286
- sections[existingIndex].body = [
287
- body,
288
- cleanChangelogBody(sections[existingIndex].body),
289
- ]
290
- .filter(Boolean)
291
- .join("\n\n");
502
+ sections[existingIndex].body = mergeChangelogBodies(body, cleanChangelogBody(sections[existingIndex].body));
292
503
  continue;
293
504
  }
294
505
  const newSection = { title, date: title.match(ISO_DATE)?.[1], body };
@@ -1,6 +1,7 @@
1
1
  import type { AgentNativeDeploymentEnvironment, AgentNativeConfig } from "../config.js";
2
2
  export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAGE_KEY, buildEnvironmentOptOutUrl, buildEnvironmentUrl, resolveEnvironmentTargets, type EnvironmentBadgeTargets, } from "../shared/environment-lanes.js";
3
3
  export declare function isBuilderIoEmployee(email: string | null | undefined): boolean;
4
+ export declare function isAgentNativeDesktopUserAgent(userAgent: string | undefined): boolean;
4
5
  export declare function resolveEnvironmentChannel(config: AgentNativeConfig, hostname: string | undefined): Extract<AgentNativeDeploymentEnvironment, "beta" | "production"> | null;
5
6
  export declare function isBetaOptOutActive(value: string | number | null | undefined, now?: number): boolean;
6
7
  /**
@@ -10,6 +10,9 @@ export { BETA_OPT_OUT_DURATION_MS, BETA_OPT_OUT_QUERY_PARAM, BETA_OPT_OUT_STORAG
10
10
  export function isBuilderIoEmployee(email) {
11
11
  return email?.trim().toLowerCase().endsWith("@builder.io") ?? false;
12
12
  }
13
+ export function isAgentNativeDesktopUserAgent(userAgent) {
14
+ return /AgentNativeDesktop/i.test(userAgent ?? "");
15
+ }
13
16
  export function resolveEnvironmentChannel(config, hostname) {
14
17
  const configured = config.deployment?.environment;
15
18
  if (configured === "beta" || configured === "production") {
@@ -98,6 +101,10 @@ function ProductionEnvironmentBadge({ targets, }) {
98
101
  if (!isEligible || didAutoRedirect.current) {
99
102
  return;
100
103
  }
104
+ // Desktop child sessions are minted against their configured production
105
+ // origin. Do not move that WebView to beta after the session is created.
106
+ if (isAgentNativeDesktopUserAgent(window.navigator.userAgent))
107
+ return;
101
108
  if (readBetaOptOutUntil() !== null)
102
109
  return;
103
110
  if (consumeBetaOptOutQueryParam(window.location.href))
@@ -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
- error: string;
30
29
  ok?: undefined;
30
+ error: string;
31
31
  } | {
32
32
  error?: undefined;
33
33
  ok: boolean;
@@ -13,8 +13,8 @@
13
13
  * Body: { json: any, fieldName?: string, type?: "map"|"array", requestSource?: string }
14
14
  */
15
15
  export declare const postCollabJson: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
16
- ok?: undefined;
17
16
  error: string;
17
+ ok?: undefined;
18
18
  } | {
19
19
  error?: undefined;
20
20
  ok: boolean;
package/dist/config.d.ts CHANGED
@@ -101,6 +101,17 @@ export type AgentNativeConfigInput = AgentNativeConfig | AgentNativeConfigFactor
101
101
  * phase, while the browser only receives the resolved serializable result.
102
102
  */
103
103
  export declare function defineAgentNativeConfig(config: AgentNativeConfigInput): AgentNativeConfigInput;
104
+ export declare const AGENT_NATIVE_CONFIG_ENV_PREFIX: "AGENT_NATIVE_CONFIG";
105
+ /** Convert a config path such as `runtime.auth.enabled` to its env name. */
106
+ export declare function agentNativeConfigEnvName(path: readonly string[]): string;
107
+ /**
108
+ * Reads the public config's deterministic environment aliases.
109
+ *
110
+ * `AGENT_NATIVE_CONFIG` contains a complete JSON object. A suffixed name
111
+ * contains a JSON fragment at that config path, or a typed scalar at a leaf.
112
+ * Nodes are applied from shallowest to deepest so a more specific path wins.
113
+ */
114
+ export declare function readAgentNativeConfigEnv(env: Record<string, string | undefined>): AgentNativeConfig;
104
115
  export declare function normalizeAgentNativeConfig(input: unknown, source?: string): AgentNativeConfig;
105
116
  export declare function mergeAgentNativeConfigs(base: AgentNativeConfig, override: AgentNativeConfig): AgentNativeConfig;
106
117
  export declare function resolveAgentNativeConfig(input: AgentNativeConfigInput | undefined, context: AgentNativeConfigContext): AgentNativeConfig;
package/dist/config.js CHANGED
@@ -16,6 +16,254 @@ export const AGENT_NATIVE_CONFIG_VERSION = 1;
16
16
  export function defineAgentNativeConfig(config) {
17
17
  return config;
18
18
  }
19
+ export const AGENT_NATIVE_CONFIG_ENV_PREFIX = "AGENT_NATIVE_CONFIG";
20
+ /**
21
+ * Serializable public config nodes that may be initialized from the
22
+ * deployment environment. Object nodes accept JSON fragments, which lets a
23
+ * deploy set a whole section without requiring a separate alias for every
24
+ * leaf. Dynamic keys in the onboarding mode map stay JSON-only at the union
25
+ * node because they are not part of the fixed config shape.
26
+ */
27
+ const AGENT_NATIVE_CONFIG_ENV_NODES = [
28
+ { path: [], kind: "object" },
29
+ { path: ["version"], kind: "number" },
30
+ { path: ["onboarding"], kind: "object" },
31
+ {
32
+ path: ["onboarding", "firstRun"],
33
+ kind: "union",
34
+ dynamicObjectKeys: true,
35
+ },
36
+ { path: ["runtime"], kind: "object" },
37
+ { path: ["runtime", "auth"], kind: "object" },
38
+ { path: ["runtime", "auth", "enabled"], kind: "boolean" },
39
+ { path: ["runtime", "database"], kind: "object" },
40
+ { path: ["runtime", "database", "required"], kind: "boolean" },
41
+ { path: ["runtime", "environment"], kind: "object" },
42
+ {
43
+ path: ["runtime", "environment", "required"],
44
+ kind: "array",
45
+ },
46
+ { path: ["deployment"], kind: "object" },
47
+ {
48
+ path: ["deployment", "environment"],
49
+ kind: "deployment-environment",
50
+ },
51
+ { path: ["diagnostics"], kind: "object" },
52
+ { path: ["diagnostics", "failOnBuild"], kind: "boolean" },
53
+ { path: ["instructions"], kind: "object" },
54
+ { path: ["instructions", "runtime"], kind: "string" },
55
+ { path: ["instructions", "development"], kind: "string" },
56
+ { path: ["translations"], kind: "object" },
57
+ { path: ["translations", "locales"], kind: "array" },
58
+ { path: ["changelog"], kind: "object" },
59
+ { path: ["changelog", "enabled"], kind: "boolean" },
60
+ { path: ["harness"], kind: "union" },
61
+ { path: ["harness", "runtimes"], kind: "array" },
62
+ ];
63
+ function agentNativeConfigEnvSegment(segment) {
64
+ return segment
65
+ .replace(/([a-z0-9])([A-Z])/g, "$1_$2")
66
+ .replace(/[^A-Za-z0-9]+/g, "_")
67
+ .replace(/_+/g, "_")
68
+ .replace(/^_|_$/g, "")
69
+ .toUpperCase();
70
+ }
71
+ /** Convert a config path such as `runtime.auth.enabled` to its env name. */
72
+ export function agentNativeConfigEnvName(path) {
73
+ if (path.length === 0)
74
+ return AGENT_NATIVE_CONFIG_ENV_PREFIX;
75
+ return `${AGENT_NATIVE_CONFIG_ENV_PREFIX}_${path
76
+ .map(agentNativeConfigEnvSegment)
77
+ .join("_")}`;
78
+ }
79
+ function agentNativeConfigEnvKeys(node) {
80
+ return [agentNativeConfigEnvName(node.path), ...(node.aliases ?? [])];
81
+ }
82
+ function isAgentNativeConfigEnvKey(key) {
83
+ return (key === AGENT_NATIVE_CONFIG_ENV_PREFIX ||
84
+ key.startsWith(`${AGENT_NATIVE_CONFIG_ENV_PREFIX}_`));
85
+ }
86
+ function parseAgentNativeConfigJson(raw, key) {
87
+ try {
88
+ return JSON.parse(raw);
89
+ }
90
+ catch (error) {
91
+ throw new Error(`${key} must contain valid JSON: ${error instanceof Error ? error.message : String(error)}`);
92
+ }
93
+ }
94
+ function parseAgentNativeConfigEnvValue(raw, key, kind) {
95
+ const value = raw.trim();
96
+ switch (kind) {
97
+ case "object": {
98
+ const parsed = parseAgentNativeConfigJson(value, key);
99
+ if (!isRecord(parsed)) {
100
+ throw new Error(`${key} must contain a JSON object`);
101
+ }
102
+ return parsed;
103
+ }
104
+ case "array": {
105
+ const parsed = parseAgentNativeConfigJson(value, key);
106
+ if (!Array.isArray(parsed)) {
107
+ throw new Error(`${key} must contain a JSON array`);
108
+ }
109
+ return parsed;
110
+ }
111
+ case "boolean": {
112
+ const normalized = value.toLowerCase();
113
+ if (["1", "true", "yes", "on"].includes(normalized))
114
+ return true;
115
+ if (["0", "false", "no", "off"].includes(normalized))
116
+ return false;
117
+ throw new Error(`${key} must be a boolean`);
118
+ }
119
+ case "number": {
120
+ const parsed = Number(value);
121
+ if (!Number.isFinite(parsed))
122
+ throw new Error(`${key} must be a number`);
123
+ return parsed;
124
+ }
125
+ case "deployment-environment":
126
+ return value.toLowerCase();
127
+ case "string": {
128
+ if (value.startsWith('"')) {
129
+ const parsed = parseAgentNativeConfigJson(value, key);
130
+ if (typeof parsed !== "string") {
131
+ throw new Error(`${key} must contain a string`);
132
+ }
133
+ return parsed;
134
+ }
135
+ return value;
136
+ }
137
+ case "union": {
138
+ if (value.startsWith("{") || value.startsWith("[")) {
139
+ return parseAgentNativeConfigJson(value, key);
140
+ }
141
+ const normalized = value.toLowerCase();
142
+ if (["1", "true", "yes", "on"].includes(normalized))
143
+ return true;
144
+ if (["0", "false", "no", "off"].includes(normalized))
145
+ return false;
146
+ if (value.startsWith('"')) {
147
+ const parsed = parseAgentNativeConfigJson(value, key);
148
+ if (typeof parsed !== "string") {
149
+ throw new Error(`${key} must contain a string or JSON object`);
150
+ }
151
+ return parsed;
152
+ }
153
+ return value;
154
+ }
155
+ }
156
+ }
157
+ function agentNativeConfigEnvNodeForPath(path) {
158
+ return AGENT_NATIVE_CONFIG_ENV_NODES.find((node) => node.path.length === path.length &&
159
+ node.path.every((segment, index) => segment === path[index]));
160
+ }
161
+ function agentNativeConfigEnvChildren(path) {
162
+ return AGENT_NATIVE_CONFIG_ENV_NODES.filter((node) => node.path.length === path.length + 1 &&
163
+ path.every((segment, index) => node.path[index] === segment));
164
+ }
165
+ function validateAgentNativeConfigEnvFragment(value, path, key) {
166
+ const node = agentNativeConfigEnvNodeForPath(path);
167
+ if (!node)
168
+ return;
169
+ if (node.kind === "object") {
170
+ if (!isRecord(value)) {
171
+ throw new Error(`${key} must contain a JSON object`);
172
+ }
173
+ }
174
+ else if (node.kind !== "union" || !isRecord(value)) {
175
+ return;
176
+ }
177
+ if (node.dynamicObjectKeys)
178
+ return;
179
+ const children = new Map(agentNativeConfigEnvChildren(path).map((child) => [
180
+ child.path[child.path.length - 1],
181
+ child,
182
+ ]));
183
+ for (const [childKey, childValue] of Object.entries(value)) {
184
+ const child = children.get(childKey);
185
+ if (!child) {
186
+ const childPath = [...path, childKey].join(".");
187
+ throw new Error(`${key} contains unsupported Agent-Native config path ${childPath}`);
188
+ }
189
+ validateAgentNativeConfigEnvFragment(childValue, child.path, key);
190
+ }
191
+ }
192
+ function mergeAgentNativeConfigEnvFragments(base, override) {
193
+ const result = { ...base };
194
+ for (const [key, value] of Object.entries(override)) {
195
+ const existing = result[key];
196
+ result[key] =
197
+ isRecord(existing) && isRecord(value)
198
+ ? mergeAgentNativeConfigEnvFragments(existing, value)
199
+ : value;
200
+ }
201
+ return result;
202
+ }
203
+ function assignAgentNativeConfigEnvFragment(target, path, value, key) {
204
+ if (path.length === 0) {
205
+ if (!isRecord(value)) {
206
+ throw new Error(`${key} must contain a JSON object`);
207
+ }
208
+ Object.assign(target, mergeAgentNativeConfigEnvFragments(target, value));
209
+ return;
210
+ }
211
+ let node = target;
212
+ for (const segment of path.slice(0, -1)) {
213
+ const existing = node[segment];
214
+ if (existing === undefined) {
215
+ node[segment] = {};
216
+ }
217
+ else if (!isRecord(existing)) {
218
+ node[segment] = {};
219
+ }
220
+ node = node[segment];
221
+ }
222
+ const leaf = path[path.length - 1];
223
+ const existing = node[leaf];
224
+ node[leaf] =
225
+ isRecord(existing) && isRecord(value)
226
+ ? mergeAgentNativeConfigEnvFragments(existing, value)
227
+ : value;
228
+ }
229
+ /**
230
+ * Reads the public config's deterministic environment aliases.
231
+ *
232
+ * `AGENT_NATIVE_CONFIG` contains a complete JSON object. A suffixed name
233
+ * contains a JSON fragment at that config path, or a typed scalar at a leaf.
234
+ * Nodes are applied from shallowest to deepest so a more specific path wins.
235
+ */
236
+ export function readAgentNativeConfigEnv(env) {
237
+ const known = new Map();
238
+ for (const node of AGENT_NATIVE_CONFIG_ENV_NODES) {
239
+ for (const key of agentNativeConfigEnvKeys(node)) {
240
+ const previous = known.get(key);
241
+ if (previous && previous.path.join(".") !== node.path.join(".")) {
242
+ throw new Error(`Duplicate Agent-Native config environment key ${key}`);
243
+ }
244
+ known.set(key, node);
245
+ }
246
+ }
247
+ for (const key of Object.keys(env)) {
248
+ if (isAgentNativeConfigEnvKey(key) && !known.has(key)) {
249
+ throw new Error(`${key} is not a supported Agent-Native config path. Use agent-native.config.ts or a documented config env alias.`);
250
+ }
251
+ }
252
+ const layer = {};
253
+ const nodes = [...AGENT_NATIVE_CONFIG_ENV_NODES].sort((left, right) => left.path.length - right.path.length);
254
+ for (const node of nodes) {
255
+ for (const key of agentNativeConfigEnvKeys(node)) {
256
+ const raw = env[key];
257
+ if (raw === undefined || raw.trim() === "")
258
+ continue;
259
+ const value = parseAgentNativeConfigEnvValue(raw, key, node.kind);
260
+ validateAgentNativeConfigEnvFragment(value, node.path, key);
261
+ assignAgentNativeConfigEnvFragment(layer, node.path, value, key);
262
+ break;
263
+ }
264
+ }
265
+ return normalizeAgentNativeConfig(layer, "Agent-Native config environment");
266
+ }
19
267
  export function normalizeAgentNativeConfig(input, source = "agent-native config") {
20
268
  if (!isRecord(input)) {
21
269
  throw new Error(`${source} must export an object`);
@@ -18,10 +18,12 @@ import fs from "fs";
18
18
  import { createRequire } from "module";
19
19
  import path from "path";
20
20
  import { fileURLToPath } from "url";
21
+ import { loadEnv } from "vite";
21
22
  import { AGENT_BACKGROUND_FUNCTION_NAME, AGENT_BACKGROUND_FUNCTION_URL_PATH, AGENT_BACKGROUND_PROCESSOR_A2A, AGENT_BACKGROUND_PROCESSOR_FIELD, AGENT_BACKGROUND_PROCESSOR_INTEGRATION, AGENT_BACKGROUND_PROCESSOR_ROUTE, AGENT_BACKGROUND_PROCESSOR_ROUTE_FIELD, AGENT_CHAT_PROCESS_RUN_PATH, isDurableBackgroundFlagExplicitlyDisabled, } from "../agent/durable-background.js";
22
23
  import { INTEGRATION_RECOVERY_RUNTIME_MARKER, INTEGRATION_RETRY_SWEEP_PATH, INTEGRATION_RETRY_SWEEP_TOKEN_SUBJECT, isIntegrationDurableDispatchConfigured, } from "../integrations/integration-durable-dispatch-config.js";
23
24
  import { isValidCron } from "../jobs/cron.js";
24
25
  import { RECURRING_JOBS_SWEEP_PATH, RECURRING_JOBS_SWEEP_TOKEN_SUBJECT, } from "../jobs/scheduler-dispatch.js";
26
+ import { findWorkspaceRoot as findAgentNativeWorkspaceRoot } from "../scripts/utils.js";
25
27
  import { normalizeAppBasePath } from "../server/app-base-path.js";
26
28
  import { DEFAULT_SPECULATION_RULES_PATH, resolveSsrCacheHeaders, resolveSsrCacheKeyHeaders, SSR_QUERY_CACHE_KEY_HEADER, } from "../shared/cache-control.js";
27
29
  import { mcpEmbedStaticAssetRouteRules } from "../shared/mcp-embed-headers.js";
@@ -3922,7 +3924,16 @@ async function buildWithNitro() {
3922
3924
  // own virtual module registration. Both paths reuse `readAgentsBundleFromFs`
3923
3925
  // from `server/agents-bundle.ts` to guarantee identical content.
3924
3926
  const { readAgentsBundleFromFs } = await import("../server/agents-bundle.js");
3925
- const nitroAgentConfig = await loadResolvedAgentNativeConfig(cwd, createAgentNativeConfigContext("build", process.env.NODE_ENV === "development" ? "development" : "production"));
3927
+ const nitroMode = process.env.NODE_ENV === "development" ? "development" : "production";
3928
+ const agentNativeWorkspaceRoot = findAgentNativeWorkspaceRoot(cwd);
3929
+ const nitroEnvironment = {
3930
+ ...(agentNativeWorkspaceRoot && agentNativeWorkspaceRoot !== cwd
3931
+ ? loadEnv(nitroMode, agentNativeWorkspaceRoot, "")
3932
+ : {}),
3933
+ ...loadEnv(nitroMode, cwd, ""),
3934
+ ...process.env,
3935
+ };
3936
+ const nitroAgentConfig = await loadResolvedAgentNativeConfig(cwd, createAgentNativeConfigContext("build", nitroMode), { environment: nitroEnvironment });
3926
3937
  // Resolve the workspace core (if present) up front so the bundle embeds
3927
3938
  // enterprise-wide AGENTS.md + skills alongside the template's.
3928
3939
  const nitroWorkspaceCore = await getWorkspaceCoreExports(cwd);
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./config.js";
2
- export { createProductionAgentHandler, type ActionEntry, type ScriptEntry, type ProductionAgentOptions, type AgentActionSurface, type AgentActionSurfaceDetails, type ActionTool, type ScriptTool, type AgentMessage, type AgentChatRequest, type AgentChatEvent, type AgentChatAttachment, DEFAULT_MODEL, TripWire, type Processor, type ProcessorState, type ProcessorAbort, } from "./agent/index.js";
2
+ export { createProductionAgentHandler, type ActionEntry, type ScriptEntry, type ProductionAgentOptions, type AgentActionSurface, type DefaultAgentActionSurface, type AgentActionSurfaceResolution, type AgentActionSurfaceDetails, type ActionTool, type ScriptTool, type AgentMessage, type AgentChatRequest, type AgentChatEvent, type AgentChatAttachment, DEFAULT_MODEL, TripWire, type Processor, type ProcessorState, type ProcessorAbort, } from "./agent/index.js";
3
3
  export { defineAction, ActionContractError, isActionContractError, type ActionContractErrorOptions, AgentActionStopError, isAgentActionStopError, type ActionDefinition, type ActionHttpConfig, type AgentActionStopOptions, type PublicAgentActionConfig, type ActionDeepLink, type ActionLinkBuilder, MCP_APP_EXTENSION_ID, MCP_APP_MIME_TYPE, MCP_APP_RESOURCE_URI_META_KEY, type ActionMcpAppConfig, type ActionMcpAppCsp, type ActionMcpAppCspBuilder, type ActionMcpAppHtmlBuilder, type ActionMcpAppPermissions, type ActionMcpAppResourceConfig, type ActionMcpAppResourceMeta, } from "./action.js";
4
4
  export * from "./user-profile/index.js";
5
5
  export { embedApp, MCP_APP_REQUEST_ORIGIN_CSP_SOURCE, type EmbedAppOptions, } from "./mcp/embed-app.js";
@@ -42,22 +42,22 @@ export declare function createObservabilityHandler(): import("h3").EventHandlerW
42
42
  avgEvalScore: number;
43
43
  } | {
44
44
  error?: undefined;
45
- ok?: undefined;
46
45
  summary: import("./types.js").TraceSummary;
47
46
  spans: import("./types.js").TraceSpan[];
48
47
  id?: undefined;
48
+ ok?: undefined;
49
49
  } | {
50
50
  error?: undefined;
51
- ok?: undefined;
52
51
  summary?: undefined;
53
52
  spans?: undefined;
54
53
  id: string;
55
- } | {
56
54
  ok?: undefined;
55
+ } | {
57
56
  summary?: undefined;
58
57
  spans?: undefined;
59
58
  id?: undefined;
60
59
  error: any;
60
+ ok?: undefined;
61
61
  } | {
62
62
  error?: undefined;
63
63
  summary?: undefined;
@@ -15,6 +15,6 @@ export declare function createProgressHandler(): import("h3").EventHandlerWithFe
15
15
  error: string;
16
16
  ok?: undefined;
17
17
  } | {
18
- error?: undefined;
19
18
  ok: boolean;
19
+ error?: undefined;
20
20
  }>>;