@agent-native/core 0.101.7 → 0.101.10

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 (153) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/core/CHANGELOG.md +22 -0
  3. package/corpus/core/docs/content/deployment.mdx +9 -7
  4. package/corpus/core/docs/content/locales/ar-SA/deployment.mdx +9 -7
  5. package/corpus/core/docs/content/locales/de-DE/deployment.mdx +9 -7
  6. package/corpus/core/docs/content/locales/es-ES/deployment.mdx +9 -7
  7. package/corpus/core/docs/content/locales/fr-FR/deployment.mdx +9 -7
  8. package/corpus/core/docs/content/locales/hi-IN/deployment.mdx +9 -7
  9. package/corpus/core/docs/content/locales/ja-JP/deployment.mdx +9 -7
  10. package/corpus/core/docs/content/locales/ko-KR/deployment.mdx +9 -7
  11. package/corpus/core/docs/content/locales/pt-BR/deployment.mdx +9 -7
  12. package/corpus/core/docs/content/locales/zh-CN/deployment.mdx +9 -7
  13. package/corpus/core/docs/content/locales/zh-TW/deployment.mdx +9 -7
  14. package/corpus/core/package.json +1 -1
  15. package/corpus/core/src/client/review/ReviewCommentComposer.tsx +9 -1
  16. package/corpus/core/src/client/review/ReviewThreadPanel.tsx +17 -2
  17. package/corpus/core/src/client/settings/SettingsPanel.tsx +41 -21
  18. package/corpus/core/src/client/settings/useBuilderStatus.ts +28 -9
  19. package/corpus/core/src/client/setup-connections/BuilderConnectCard.tsx +2 -7
  20. package/corpus/core/src/server/auth.ts +25 -1
  21. package/corpus/core/src/server/builder-browser.ts +353 -1
  22. package/corpus/core/src/server/core-routes-plugin.ts +601 -223
  23. package/corpus/templates/calendar/app/components/calendar/DayView.tsx +80 -1
  24. package/corpus/templates/calendar/app/components/calendar/EventCard.tsx +28 -3
  25. package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +5 -1
  26. package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +30 -3
  27. package/corpus/templates/calendar/app/components/calendar/OutOfOfficeEvent.tsx +196 -0
  28. package/corpus/templates/calendar/app/components/calendar/WeekView.tsx +115 -1
  29. package/corpus/templates/calendar/app/lib/out-of-office.ts +45 -0
  30. package/corpus/templates/calendar/changelog/2026-07-14-out-of-office-blocks-now-sit-behind-meetings-and-event-stack.md +6 -0
  31. package/corpus/templates/content/AGENTS.md +3 -2
  32. package/corpus/templates/content/actions/_builder-cms-intent-lookup.ts +87 -0
  33. package/corpus/templates/content/actions/_builder-cms-read-client.ts +173 -25
  34. package/corpus/templates/content/actions/_builder-cms-source-adapter.ts +1 -0
  35. package/corpus/templates/content/actions/_builder-cms-write-adapter.ts +427 -18
  36. package/corpus/templates/content/actions/_builder-cms-write-client.ts +17 -73
  37. package/corpus/templates/content/actions/_builder-cms-write-settings.ts +27 -7
  38. package/corpus/templates/content/actions/_builder-source-execution-claim.ts +124 -0
  39. package/corpus/templates/content/actions/_builder-source-execution-preservation.ts +21 -0
  40. package/corpus/templates/content/actions/_builder-source-timings.ts +57 -0
  41. package/corpus/templates/content/actions/_database-source-utils.ts +1041 -154
  42. package/corpus/templates/content/actions/_database-utils.ts +89 -12
  43. package/corpus/templates/content/actions/_preview-document-draft.ts +31 -0
  44. package/corpus/templates/content/actions/cancel-prepared-builder-source-update.ts +309 -0
  45. package/corpus/templates/content/actions/execute-builder-source-batch.ts +120 -49
  46. package/corpus/templates/content/actions/execute-builder-source-execution.ts +608 -264
  47. package/corpus/templates/content/actions/get-preview-document-draft.ts +26 -0
  48. package/corpus/templates/content/actions/materialize-builder-required-fields.ts +550 -0
  49. package/corpus/templates/content/actions/prepare-builder-source-execution.ts +112 -65
  50. package/corpus/templates/content/actions/prepare-builder-source-review.ts +463 -170
  51. package/corpus/templates/content/actions/preview-builder-source-review.ts +99 -0
  52. package/corpus/templates/content/actions/set-content-database-source-write-mode.ts +2 -2
  53. package/corpus/templates/content/actions/update-preview-document-draft.ts +153 -0
  54. package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +27 -15
  55. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +57 -5
  56. package/corpus/templates/content/app/components/editor/body-hydration.ts +27 -0
  57. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +2353 -576
  58. package/corpus/templates/content/app/components/editor/database/settings.tsx +13 -10
  59. package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +358 -75
  60. package/corpus/templates/content/app/components/editor/previewDocumentSaveController.ts +124 -29
  61. package/corpus/templates/content/app/components/editor/previewDocumentSaveRegistry.ts +2 -0
  62. package/corpus/templates/content/app/global.css +18 -1
  63. package/corpus/templates/content/app/hooks/use-content-database.ts +68 -0
  64. package/corpus/templates/content/app/hooks/use-documents.ts +53 -4
  65. package/corpus/templates/content/app/i18n/zh-TW.ts +25 -0
  66. package/corpus/templates/content/app/i18n-data.ts +287 -0
  67. package/corpus/templates/content/changelog/2026-07-10-builder-backed-preview-edits-are-preserved-when-article-bodi.md +6 -0
  68. package/corpus/templates/content/changelog/2026-07-10-builder-cms-sources-can-now-be-enabled-for-guarded-staged-or.md +6 -0
  69. package/corpus/templates/content/changelog/2026-07-13-builder-connection-setup-is-now-available-directly-from-conn.md +6 -0
  70. package/corpus/templates/content/changelog/2026-07-13-builder-reviews-now-hide-already-applied-writes-detect-nativ.md +6 -0
  71. package/corpus/templates/content/changelog/2026-07-13-required-builder-publishing-fields-can-now-be-added-directly.md +6 -0
  72. package/corpus/templates/content/changelog/2026-07-13-you-can-now-cancel-a-prepared-builder-update-safely-before-i.md +6 -0
  73. package/corpus/templates/content/changelog/2026-07-14-builder-account-connection-now-remains-available-when-branch.md +6 -0
  74. package/corpus/templates/content/changelog/2026-07-14-builder-backed-articles-now-preserve-fifth-and-sixth-level-h.md +6 -0
  75. package/corpus/templates/content/changelog/2026-07-14-builder-sources-now-review-and-publish-rich-article-updates-.md +6 -0
  76. package/corpus/templates/content/changelog/2026-07-14-builder-writes-now-stop-retries-when-reconciliation-is-needed.md +6 -0
  77. package/corpus/templates/content/changelog/2026-07-14-file-and-media-links-now-validate-before-saving.md +6 -0
  78. package/corpus/templates/content/parity/matrix.md +27 -25
  79. package/corpus/templates/content/parity/matrix.ts +50 -2
  80. package/corpus/templates/content/server/db/schema.ts +47 -0
  81. package/corpus/templates/content/server/plugins/auth.ts +1 -0
  82. package/corpus/templates/content/server/plugins/db.ts +53 -0
  83. package/corpus/templates/content/shared/api.ts +70 -1
  84. package/corpus/templates/content/shared/builder-mdx.ts +705 -15
  85. package/corpus/templates/content/shared/nfm.ts +3 -3
  86. package/corpus/templates/design/app/components/design/ReadOnlyDesignBanner.tsx +52 -7
  87. package/corpus/templates/design/app/components/design/ReviewCommentsPanel.tsx +36 -4
  88. package/corpus/templates/design/app/components/visual-editor/ReviewCanvasPins.tsx +4 -1
  89. package/corpus/templates/design/app/i18n/ar-SA.ts +1 -0
  90. package/corpus/templates/design/app/i18n/de-DE.ts +1 -0
  91. package/corpus/templates/design/app/i18n/en-US.ts +1 -0
  92. package/corpus/templates/design/app/i18n/es-ES.ts +1 -0
  93. package/corpus/templates/design/app/i18n/fr-FR.ts +1 -0
  94. package/corpus/templates/design/app/i18n/hi-IN.ts +1 -0
  95. package/corpus/templates/design/app/i18n/ja-JP.ts +1 -0
  96. package/corpus/templates/design/app/i18n/ko-KR.ts +1 -0
  97. package/corpus/templates/design/app/i18n/pt-BR.ts +1 -0
  98. package/corpus/templates/design/app/i18n/zh-CN.ts +1 -0
  99. package/corpus/templates/design/app/i18n/zh-TW.ts +1 -0
  100. package/corpus/templates/design/app/pages/design-editor/selection-state.ts +8 -0
  101. package/corpus/templates/design/app/pages/design-editor/tool-state.ts +11 -0
  102. package/corpus/templates/design/changelog/2026-07-14-reviewers-can-now-pin-comments-from-the-canvas-toolbar-targe.md +6 -0
  103. package/corpus/templates/design/changelog/2026-07-15-viewer-comment-controls-now-sit-inside-the-read-only-notice-.md +6 -0
  104. package/corpus/templates/design/shared/review-anchor.ts +48 -0
  105. package/corpus/templates/plan/server/plan-mdx.ts +53 -7
  106. package/dist/client/review/ReviewCommentComposer.d.ts +2 -1
  107. package/dist/client/review/ReviewCommentComposer.d.ts.map +1 -1
  108. package/dist/client/review/ReviewCommentComposer.js +3 -3
  109. package/dist/client/review/ReviewCommentComposer.js.map +1 -1
  110. package/dist/client/review/ReviewThreadPanel.d.ts +9 -1
  111. package/dist/client/review/ReviewThreadPanel.d.ts.map +1 -1
  112. package/dist/client/review/ReviewThreadPanel.js +6 -4
  113. package/dist/client/review/ReviewThreadPanel.js.map +1 -1
  114. package/dist/client/settings/SettingsPanel.d.ts +3 -0
  115. package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
  116. package/dist/client/settings/SettingsPanel.js +11 -4
  117. package/dist/client/settings/SettingsPanel.js.map +1 -1
  118. package/dist/client/settings/useBuilderStatus.d.ts +8 -4
  119. package/dist/client/settings/useBuilderStatus.d.ts.map +1 -1
  120. package/dist/client/settings/useBuilderStatus.js +19 -6
  121. package/dist/client/settings/useBuilderStatus.js.map +1 -1
  122. package/dist/client/setup-connections/BuilderConnectCard.d.ts.map +1 -1
  123. package/dist/client/setup-connections/BuilderConnectCard.js +2 -5
  124. package/dist/client/setup-connections/BuilderConnectCard.js.map +1 -1
  125. package/dist/collab/awareness.d.ts +2 -2
  126. package/dist/collab/awareness.d.ts.map +1 -1
  127. package/dist/observability/routes.d.ts +5 -5
  128. package/dist/resources/handlers.d.ts +1 -1
  129. package/dist/secrets/routes.d.ts +9 -9
  130. package/dist/server/auth.d.ts +1 -0
  131. package/dist/server/auth.d.ts.map +1 -1
  132. package/dist/server/auth.js +19 -2
  133. package/dist/server/auth.js.map +1 -1
  134. package/dist/server/builder-browser.d.ts +78 -0
  135. package/dist/server/builder-browser.d.ts.map +1 -1
  136. package/dist/server/builder-browser.js +246 -1
  137. package/dist/server/builder-browser.js.map +1 -1
  138. package/dist/server/core-routes-plugin.d.ts +41 -0
  139. package/dist/server/core-routes-plugin.d.ts.map +1 -1
  140. package/dist/server/core-routes-plugin.js +260 -14
  141. package/dist/server/core-routes-plugin.js.map +1 -1
  142. package/docs/content/deployment.mdx +9 -7
  143. package/docs/content/locales/ar-SA/deployment.mdx +9 -7
  144. package/docs/content/locales/de-DE/deployment.mdx +9 -7
  145. package/docs/content/locales/es-ES/deployment.mdx +9 -7
  146. package/docs/content/locales/fr-FR/deployment.mdx +9 -7
  147. package/docs/content/locales/hi-IN/deployment.mdx +9 -7
  148. package/docs/content/locales/ja-JP/deployment.mdx +9 -7
  149. package/docs/content/locales/ko-KR/deployment.mdx +9 -7
  150. package/docs/content/locales/pt-BR/deployment.mdx +9 -7
  151. package/docs/content/locales/zh-CN/deployment.mdx +9 -7
  152. package/docs/content/locales/zh-TW/deployment.mdx +9 -7
  153. package/package.json +2 -2
@@ -10,6 +10,7 @@ import {
10
10
  type ExecuteBuilderSourceBatchResponse,
11
11
  type ExecuteBuilderSourceBatchTransition,
12
12
  } from "../shared/api.js";
13
+ import { createBuilderSourceTiming } from "./_builder-source-timings.js";
13
14
  import {
14
15
  getContentDatabaseSourceSnapshotForWrite,
15
16
  resolveDatabaseForSourceMutation,
@@ -63,25 +64,41 @@ function realBatchDeps(
63
64
  publicationTransition: transition?.publicationTransition,
64
65
  confirmUnpublish: transition?.confirmUnpublish,
65
66
  };
67
+ let preparationTimings;
66
68
  if (transition?.publicationTransition) {
67
- await prepareBuilderSourceExecution.run(executionArgs);
69
+ preparationTimings = (
70
+ await prepareBuilderSourceExecution.run(executionArgs)
71
+ ).timings;
68
72
  }
69
73
  try {
70
- await executeBuilderSourceExecutionWithDeps(
74
+ const response = await executeBuilderSourceExecutionWithDeps(
71
75
  executionArgs,
72
76
  realExecutionDeps(args.sourceId),
73
77
  );
78
+ return {
79
+ changeSetId,
80
+ status: "succeeded",
81
+ timings: [...(preparationTimings ?? []), ...(response.timings ?? [])],
82
+ };
74
83
  } catch (error) {
75
84
  if (!isMissingGateMessage(errorMessage(error))) {
76
85
  throw error;
77
86
  }
78
- await prepareBuilderSourceExecution.run(executionArgs);
79
- await executeBuilderSourceExecutionWithDeps(
87
+ const preparation =
88
+ await prepareBuilderSourceExecution.run(executionArgs);
89
+ const response = await executeBuilderSourceExecutionWithDeps(
80
90
  executionArgs,
81
91
  realExecutionDeps(args.sourceId),
82
92
  );
93
+ return {
94
+ changeSetId,
95
+ status: "succeeded",
96
+ timings: [
97
+ ...(preparation.timings ?? []),
98
+ ...(response.timings ?? []),
99
+ ],
100
+ };
83
101
  }
84
- return { changeSetId, status: "succeeded" };
85
102
  },
86
103
  };
87
104
  }
@@ -112,6 +129,12 @@ function isBlockedMessage(message: string) {
112
129
  ].some((pattern) => pattern.test(message));
113
130
  }
114
131
 
132
+ function isReconciliationRequiredMessage(message: string) {
133
+ return /reconciliation required|requires reconciliation|remote outcome is unknown/i.test(
134
+ message,
135
+ );
136
+ }
137
+
115
138
  function clampConcurrency(value: number | undefined) {
116
139
  if (!value || !Number.isFinite(value)) {
117
140
  return DEFAULT_BUILDER_SOURCE_BATCH_CONCURRENCY;
@@ -180,6 +203,9 @@ function summarize(results: BuilderSourceBatchItemResult[]) {
180
203
  total: results.length,
181
204
  succeeded: results.filter((result) => result.status === "succeeded").length,
182
205
  blocked: results.filter((result) => result.status === "blocked").length,
206
+ reconciliationRequired: results.filter(
207
+ (result) => result.status === "reconciliation_required",
208
+ ).length,
183
209
  failed: results.filter((result) => result.status === "failed").length,
184
210
  };
185
211
  }
@@ -188,55 +214,100 @@ export async function executeBuilderSourceBatchWithDeps(
188
214
  args: ExecuteBuilderSourceBatchRequest,
189
215
  deps: ExecuteBuilderSourceBatchDeps,
190
216
  ): Promise<ExecuteBuilderSourceBatchResponse> {
191
- const database = await deps.resolveDatabase(args);
192
- if (!database) throw new Error("Database not found.");
193
- await deps.assertEditor(database);
217
+ const timing = createBuilderSourceTiming("execute_builder_source_batch");
218
+ try {
219
+ const { source } = await timing.measure(
220
+ "snapshot_read_and_diff_load",
221
+ async () => {
222
+ const database = await deps.resolveDatabase(args);
223
+ if (!database) throw new Error("Database not found.");
224
+ await deps.assertEditor(database);
225
+ return { source: await deps.getSourceSnapshot(database) };
226
+ },
227
+ );
228
+ if (!source || source.sourceType !== "builder-cms") {
229
+ throw new Error("Attach a Builder CMS source before executing writes.");
230
+ }
194
231
 
195
- const source = await deps.getSourceSnapshot(database);
196
- if (!source || source.sourceType !== "builder-cms") {
197
- throw new Error("Attach a Builder CMS source before executing writes.");
198
- }
232
+ const ids = uniqueIds(
233
+ args.changeSetIds ?? defaultBatchChangeSetIds(source),
234
+ );
235
+ const changeSetsById = new Map(
236
+ source.changeSets.map((changeSet) => [changeSet.id, changeSet]),
237
+ );
238
+ const maxConcurrency = clampConcurrency(args.maxConcurrency);
239
+ const results = await timing.measure("batch_dispatch", () =>
240
+ runBoundedPool(ids, maxConcurrency, async (changeSetId) => {
241
+ const changeSet = changeSetsById.get(changeSetId);
242
+ if (changeSet && hasSucceededExecution(changeSet)) {
243
+ return {
244
+ changeSetId,
245
+ status: "succeeded",
246
+ message: "Builder execution already succeeded; skipped.",
247
+ };
248
+ }
199
249
 
200
- const ids = uniqueIds(args.changeSetIds ?? defaultBatchChangeSetIds(source));
201
- const changeSetsById = new Map(
202
- source.changeSets.map((changeSet) => [changeSet.id, changeSet]),
203
- );
204
- const maxConcurrency = clampConcurrency(args.maxConcurrency);
205
- const results = await runBoundedPool(
206
- ids,
207
- maxConcurrency,
208
- async (changeSetId) => {
209
- const changeSet = changeSetsById.get(changeSetId);
210
- if (changeSet && hasSucceededExecution(changeSet)) {
211
- return {
212
- changeSetId,
213
- status: "succeeded",
214
- message: "Builder execution already succeeded; skipped.",
215
- };
216
- }
250
+ const blocker = explicitBatchBlocker(changeSet);
251
+ if (blocker) {
252
+ return { changeSetId, status: "blocked", message: blocker };
253
+ }
217
254
 
218
- const blocker = explicitBatchBlocker(changeSet);
219
- if (blocker) {
220
- return { changeSetId, status: "blocked", message: blocker };
221
- }
255
+ try {
256
+ return await deps.runOne(
257
+ changeSetId,
258
+ args.transitions?.[changeSetId],
259
+ );
260
+ } catch (error) {
261
+ const message = errorMessage(error);
262
+ return {
263
+ changeSetId,
264
+ status: isReconciliationRequiredMessage(message)
265
+ ? "reconciliation_required"
266
+ : isBlockedMessage(message)
267
+ ? "blocked"
268
+ : "failed",
269
+ message,
270
+ };
271
+ }
272
+ }),
273
+ );
222
274
 
223
- try {
224
- return await deps.runOne(changeSetId, args.transitions?.[changeSetId]);
225
- } catch (error) {
226
- const message = errorMessage(error);
227
- return {
228
- changeSetId,
229
- status: isBlockedMessage(message) ? "blocked" : "failed",
230
- message,
231
- };
232
- }
233
- },
234
- );
275
+ const phaseDuration = (names: string[]) =>
276
+ results.reduce(
277
+ (total, result) =>
278
+ total +
279
+ (result.timings ?? [])
280
+ .filter((item) => names.includes(item.name))
281
+ .reduce((sum, item) => sum + item.durationMs, 0),
282
+ 0,
283
+ );
284
+ timing.add(
285
+ "approval_gate_preparation_and_dry_run_validation",
286
+ phaseDuration([
287
+ "gate_preparation_and_dry_run_validation",
288
+ "approval_gate_and_dry_run_validation",
289
+ ]),
290
+ );
291
+ timing.add("write_dispatch", phaseDuration(["write_dispatch"]));
292
+ timing.add(
293
+ "reconciliation_and_persistence",
294
+ phaseDuration(["reconciliation_and_persistence"]),
295
+ );
235
296
 
236
- return {
237
- summary: summarize(results),
238
- results,
239
- };
297
+ const response = {
298
+ summary: summarize(results),
299
+ results,
300
+ timings: timing.finish(),
301
+ };
302
+ timing.log("succeeded");
303
+ return response;
304
+ } catch (error) {
305
+ timing.ensure("approval_gate_preparation_and_dry_run_validation");
306
+ timing.ensure("write_dispatch");
307
+ timing.ensure("reconciliation_and_persistence");
308
+ timing.log("failed");
309
+ throw error;
310
+ }
240
311
  }
241
312
 
242
313
  const transitionSchema = z.object({