@agent-native/core 0.159.2 → 0.159.5

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 (58) hide show
  1. package/corpus/README.md +1 -1
  2. package/corpus/templates/clips/.agents/skills/meetings/SKILL.md +11 -6
  3. package/corpus/templates/clips/AGENTS.md +1 -0
  4. package/corpus/templates/clips/actions/lib/meeting-content.ts +15 -4
  5. package/corpus/templates/clips/actions/list-meetings.ts +179 -42
  6. package/corpus/templates/clips/actions/search-meetings.ts +277 -0
  7. package/corpus/templates/clips/app/components/meetings/agenda-card.tsx +273 -0
  8. package/corpus/templates/clips/app/components/meetings/day-grouped-card.tsx +113 -0
  9. package/corpus/templates/clips/app/components/meetings/meeting-history-row.tsx +117 -0
  10. package/corpus/templates/clips/app/hooks/use-navigation-state.ts +12 -2
  11. package/corpus/templates/clips/app/i18n/en-US.ts +7 -2
  12. package/corpus/templates/clips/app/routes/_app.meetings._index.tsx +263 -357
  13. package/corpus/templates/clips/changelog/2026-08-14-meetings-history-is-searchable-again.md +6 -0
  14. package/corpus/templates/clips/desktop/design-refs/granola-ux.md +17 -0
  15. package/corpus/templates/content/actions/_database-source-utils.ts +29 -2
  16. package/corpus/templates/content/app/components/editor/SlashCommandMenu.tsx +11 -11
  17. package/corpus/templates/content/app/components/editor/VisualEditor.tsx +11 -50
  18. package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +57 -20
  19. package/corpus/templates/content/app/components/editor/database-sources/BuilderSourceReviewDialog.tsx +30 -0
  20. package/corpus/templates/content/app/components/editor/extensions/NotionExtensions.tsx +204 -51
  21. package/corpus/templates/content/app/global.css +4 -1
  22. package/corpus/templates/content/app/i18n-data.ts +30 -0
  23. package/corpus/templates/content/changelog/2026-08-12-toggle-blocks-now-follow-notion-style-enter-and-shift-tab-be.md +6 -0
  24. package/corpus/templates/content/docs/solutions/2026-08-12-toggle-summary-focus-persistence-shape.md +733 -0
  25. package/corpus/templates/content/shared/builder-mdx.ts +44 -4
  26. package/corpus/templates/slides/actions/get-layout-overflows.ts +65 -2
  27. package/dist/client/chat-first/app-pane.js +1 -1
  28. package/dist/client/chat-first/copy.js +1 -0
  29. package/dist/collab/awareness.d.ts +2 -2
  30. package/dist/collab/struct-routes.d.ts +1 -1
  31. package/dist/deploy/build.d.ts +6 -4
  32. package/dist/deploy/build.js +27 -11
  33. package/dist/feature-flags/index.d.ts +0 -2
  34. package/dist/feature-flags/index.js +3 -2
  35. package/dist/feature-flags/server.d.ts +2 -0
  36. package/dist/feature-flags/server.js +2 -0
  37. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  38. package/dist/index.d.ts +2 -1
  39. package/dist/index.js +2 -1
  40. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  41. package/dist/notifications/routes.d.ts +6 -6
  42. package/dist/observability/routes.d.ts +5 -5
  43. package/dist/progress/routes.d.ts +1 -1
  44. package/dist/provider-api/actions/custom-provider-registration.d.ts +2 -2
  45. package/dist/secrets/routes.d.ts +9 -9
  46. package/dist/server/agent-engine-api-key-route.d.ts +1 -1
  47. package/dist/server/auth.js +10 -0
  48. package/dist/server/index.d.ts +1 -1
  49. package/dist/server/index.js +1 -1
  50. package/dist/server/onboarding-html.js +16 -257
  51. package/dist/shared/auth-copy.d.ts +34 -0
  52. package/dist/shared/auth-copy.js +293 -0
  53. package/dist/shared/index.d.ts +1 -0
  54. package/dist/shared/index.js +1 -0
  55. package/docs/content/actions-advanced.mdx +1 -1
  56. package/docs/content/portal.mdx +21 -8
  57. package/package.json +4 -2
  58. package/corpus/templates/clips/app/components/meetings/meeting-card.tsx +0 -333
@@ -0,0 +1,733 @@
1
+ # Preserve Toggle summary, focus, and structure after Enter
2
+
3
+ ## Summary
4
+
5
+ Content has a confirmed Toggle editing defect that is separate from the
6
+ unreproduced report that Content froze while someone was "entering toggle."
7
+ On the unchanged artifact tested on 2026-08-08, editing a Toggle summary to
8
+ `toggle` and pressing Enter returned promptly, but created a second empty
9
+ Toggle, left neither summary focused, and lost the edited summary after reload.
10
+ The console also reported `TextSelection endpoint not pointing into a node with
11
+ inline content (notionToggle)`.
12
+
13
+ ## 2026-08-13 return-to-Shape diagnosis
14
+
15
+ Alice's one-tab local acceptance run exposed a branch-only regression after the
16
+ Notion interaction implementation: deleting characters from a Toggle summary
17
+ caused earlier characters to reappear. The same local runtime preserved ordinary
18
+ bullet edits and paragraphs inside the Toggle, and Alice confirmed production did
19
+ not show the summary behavior. This is a regression in the current branch's
20
+ summary-edit path. It is not the unreproduced original freeze, the earlier
21
+ summary-Enter persistence defect, or the separately triaged two-tab synchronization
22
+ issue.
23
+
24
+ The first incorrect boundary is now identified from the complete local call chain:
25
+
26
+ 1. A Toggle summary is a controlled HTML `<input>` outside ProseMirror's editable
27
+ DOM. Consequently, focusing the summary leaves `editor.isFocused === false`.
28
+ 2. The branch correctly changed a summary keystroke into a local node-attribute
29
+ transaction with `uiEvent: "input"`, allowing `VisualEditor` to serialize and
30
+ emit the edit even though ProseMirror itself is blurred.
31
+ 3. `DocumentEditor` saves the latest emitted document after a 500 ms debounce. A
32
+ save or poll can therefore return an earlier partial summary while a later
33
+ local summary edit is already visible.
34
+ 4. The shared `useCollabReconcile` hook records every recent local emission and has
35
+ an explicit guard against reapplying such partial save echoes. That guard is
36
+ conditioned on `editor.isFocused && recentLocalTransaction`.
37
+ 5. Because the focused summary input never makes `editor.isFocused` true, the
38
+ guard does not apply. A partial SQL echo with a newer timestamp is treated as
39
+ authoritative and surgically reapplied to the Toggle node. React then renders
40
+ the restored node attribute into the controlled input.
41
+
42
+ This mechanism predicts the observed scope exactly: Toggle summary characters can
43
+ return, while Toggle body paragraphs and ordinary bullets are protected because
44
+ their keystrokes occur inside ProseMirror and make `editor.isFocused` true. It also
45
+ explains why the old summary implementation lost edits: before this branch added
46
+ explicit user-input transaction metadata, an external summary input did not
47
+ reliably enter the collaborative persistence path at all.
48
+
49
+ The native runtime prerequisite was separately repaired without tracked changes.
50
+ The shell had rebuilt `better-sqlite3` under Node 24 / ABI 137, while
51
+ `agent-native dev` launches its environment worker under Node 26 / ABI 147. A
52
+ direct Node 26 `node-gyp rebuild --release` produced a module that loads under ABI
53
+ 147 and allowed the Content server to boot. Restarting invalidated the ephemeral
54
+ local-development login before a new instrumented trace could be captured. Shape
55
+ does not exercise or recreate test resources, so the reporter Clip plus the
56
+ deterministic source trace are the current pre-fix evidence; the exact instrumented
57
+ before/after capture remains a Work assertion.
58
+
59
+ ### Repair decision
60
+
61
+ Do not weaken reconciliation globally by treating every recent emission as active
62
+ typing: a legitimate external restore can intentionally match a recently emitted
63
+ value. Instead, add a narrow shared-reconciler input that answers whether focus is
64
+ inside any editor-owned editing surface. Content supplies `true` when either
65
+ ProseMirror or its Toggle summary input owns focus. The reconciler then uses that
66
+ semantic focus signal for its existing recent-local-edit deferral and stale-echo
67
+ guard. No parallel Toggle state, special save route, longer debounce, or blanket
68
+ poll suppression is added.
69
+
70
+ This is a material architecture and shipping-surface change from the approved
71
+ Work fingerprint because the smallest honest repair now touches the shared editor
72
+ toolkit contract, not only Content's local Toggle implementation.
73
+
74
+ `WORK PAUSED — RETURNING TO SHAPE`
75
+
76
+ Old fingerprint:
77
+
78
+ - shipping surface: Content template visual editor only;
79
+ - governing architecture: repair entirely among Content's Toggle React node view,
80
+ ProseMirror transaction/selection model, and existing collaborative persistence;
81
+ - acceptance story: the Notion-style Toggle matrix persists through reload with
82
+ no focus loss, selection warning, or repeated persistence/render loop.
83
+
84
+ Proposed replacement fingerprint:
85
+
86
+ - shipping surfaces: Content's Toggle summary interaction and the shared editor
87
+ toolkit's collaboration-reconciliation focus contract, both integrated through
88
+ the public Agent Native repository by merge;
89
+ - governing architecture: Content reports semantic editor-owned focus to the
90
+ existing shared reconciliation hook; that hook remains the sole owner of
91
+ stale-echo and external-snapshot arbitration;
92
+ - acceptance story: retain every existing Notion Toggle assertion, and add a
93
+ joined regression where rapid summary deletion survives intermediate save/poll
94
+ echoes, multiple reconciliation cycles, and reload while a genuinely newer
95
+ external edit still reconciles after local editing settles;
96
+ - risk strategy: unchanged `system-ready`; no merge-then-test or feature flag.
97
+
98
+ This brief shapes only that confirmed focus/persistence loss. It does not claim
99
+ that the defect caused the original freeze or the later reporter Clip's
100
+ transient disappearance, and it does not reopen the freeze investigation.
101
+
102
+ ## Context and evidence boundary
103
+
104
+ - Codex thread `019fd8a9-d1f7-7172-b795-cc547dfce66f` tested six distinct
105
+ Toggle-entry paths on product artifact
106
+ `6ad763410612c69873a37ba76d82c0fd3b325dde`. Every path remained responsive.
107
+ - In the sixth path, filling the summary took 16 ms, Enter returned in 20 ms,
108
+ and a zero-delay event-loop probe returned immediately. The reported freeze
109
+ was not reproduced.
110
+ - That same path separately failed its durable-edit assertion: Enter created a
111
+ sibling empty Toggle, focus was lost, reload retained only one empty Toggle,
112
+ and the edited summary disappeared.
113
+ - Reporter attachment `F0BNKG13W7L` remains unreadable.
114
+ - Reporter Clip `7kkuRxVJbzAi` shows an existing Toggle, body typing, transient
115
+ disappearance and return, then collapse, expansion, and deletion. It does not
116
+ show summary Enter, reload persistence, or an event-loop freeze. It is not
117
+ causal evidence for this repair.
118
+ - No implementation, commit, pull request, deployment, or production-data
119
+ mutation exists for either issue.
120
+ - The relevant Toggle insertion, summary, Enter, focus, and persistence source
121
+ files are unchanged between the tested artifact and the current shaping
122
+ checkout at `573ca53f5170989cf1aa43a4aeac53207ea52f71`.
123
+ - The current deployed Content site is healthy, but its public surface does not
124
+ expose the deployed build SHA. Current production reproduction is therefore
125
+ not claimed.
126
+
127
+ ## Problem
128
+
129
+ A writer can edit a Toggle summary and press Enter without freezing Content,
130
+ yet the editor may strand focus and fail to preserve the visible edit and
131
+ resulting structure. An interaction that appears to succeed but silently loses
132
+ the summary after reload violates the document editor's canonical-content
133
+ promise. The absence of a hang is cold comfort when the sentence quietly walks
134
+ into the sea.
135
+
136
+ ## Interaction decision
137
+
138
+ The first Shape revision assumed that the current Enter behavior—creating a
139
+ sibling Toggle—was settled product intent. Alice challenged that assumption
140
+ before Work. A disposable prototype compared three possible behaviors, but it
141
+ was not clear enough to decide the product contract and has been discarded.
142
+
143
+ Alice then supplied reporter Clip `4uPD6JgAviTC`, “Notion Toggle Creation and
144
+ Enter-Key Behavior,” and directed Content to copy the demonstrated Notion
145
+ behavior exactly. Frame evidence and Alice's explicit clarification settle the
146
+ interaction contract:
147
+
148
+ - `> ` creates an expanded Toggle whose summary placeholder is `Toggle`;
149
+ - a structurally empty expanded Toggle shows `Empty toggle. Click or drop blocks
150
+ inside.` without storing a paragraph;
151
+ - clicking that empty-body affordance materializes and focuses a real empty
152
+ paragraph inside the Toggle;
153
+ - the disclosure caret is muted only while the Toggle has zero child blocks; it
154
+ becomes active when at least one child paragraph exists, even when empty;
155
+ - Enter on a completely empty new Toggle removes it and leaves an ordinary empty
156
+ paragraph at the same position;
157
+ - Enter after a nonempty summary in an expanded Toggle creates and focuses the
158
+ first inner paragraph;
159
+ - Enter in a body paragraph creates another paragraph inside the Toggle;
160
+ - Shift-Tab in an inner paragraph outdents that paragraph, moving it immediately
161
+ after the Toggle and keeping focus in the moved paragraph;
162
+ - when Shift-Tab removes the last child, the Toggle returns to its structural
163
+ empty affordance and muted disclosure caret;
164
+ - Enter from the summary of a collapsed Toggle creates one collapsed sibling
165
+ Toggle below and focuses its summary;
166
+ - all visible summaries, child paragraphs, order, expansion state, and focus
167
+ destination persist through the ordinary save/reload path.
168
+
169
+ Where narration and frames differ, the frame sequence governs. The Clip is
170
+ reference evidence for this separate interaction repair; it does not establish
171
+ the cause of the original freeze.
172
+
173
+ Prototype evidence manifest:
174
+
175
+ - Question: what should Enter do from an edited Toggle summary?
176
+ - Observer and decision: Alice rejected the prototype as unclear, then replaced
177
+ it with the supplied Notion Clip and an explicit copy-exactly instruction.
178
+ - Sandbox: `/tmp/content-toggle-enter-prototype`.
179
+ - Allowed state: one self-contained `index.html` and a localhost static server
180
+ on port 4178 for collaborative inspection.
181
+ - Inspection path: interactive browser switcher, summary editing, Enter,
182
+ immediate typing, and simulated save/reload.
183
+ - Verified transitions: A focused Toggle 2 summary with two Toggles; B focused
184
+ Toggle 1 body with one Toggle; C focused a paragraph below with one Toggle.
185
+ - Known omission: the collaborative preview's keyboard-press tool encoded
186
+ Enter incorrectly during automated driving, so verification dispatched the
187
+ same bubbling cancelable `keydown` event directly. Human browser interaction
188
+ was not production acceptance evidence.
189
+ - Disposition: discarded after Alice replaced it with the Notion Clip as the
190
+ governing interaction reference; rebuild production behavior fresh under
191
+ Work.
192
+
193
+ ## Desired outcome
194
+
195
+ When a signed-in Content writer creates and edits a Toggle, its creation,
196
+ structural-empty state, disclosure caret, Enter behavior, Shift-Tab outdent,
197
+ focus handoffs, and durable structure match the Notion reference contract above.
198
+ The ordinary collaborative save and reload path preserves the result, and no
199
+ TextSelection warning is introduced.
200
+
201
+ ## Options considered
202
+
203
+ 1. Continue treating this as evidence for the original freeze. Rejected: the
204
+ exact freeze build and gesture remain unknown, and all six bounded paths were
205
+ responsive.
206
+ 2. Preserve the current sibling-Toggle Enter behavior everywhere. Rejected:
207
+ Alice's Notion reference establishes context-sensitive Enter behavior.
208
+ 3. Implement the bounded Notion interaction contract at the existing Toggle
209
+ node-view, transaction, selection, and persistence boundary. Recommended: it
210
+ resolves the product ambiguity while keeping the original freeze causally
211
+ separate.
212
+
213
+ ## Product classification
214
+
215
+ - Lane: contract repair
216
+ - Feature: `content.feature.durable-foundations`
217
+ - Capability: `content.author.document-editor`
218
+ - Existing promise: the visual editor preserves canonical Blocks content
219
+ through edits and reloads and reports collaboration failures honestly.
220
+ - Record change: none expected unless implementation discovers that the
221
+ accepted contract itself is incomplete or must change.
222
+
223
+ ## Recommended direction
224
+
225
+ Reproduce the exact summary-edit/Enter/reload sequence on an approved disposable
226
+ local Content page, then correct the smallest boundary responsible for the
227
+ failed joined behavior. The fix should preserve the current model:
228
+
229
+ - `notionToggle` remains the canonical block type;
230
+ - the React node view owns summary input and the Enter gesture;
231
+ - TipTap/ProseMirror owns document transactions and selection;
232
+ - `VisualEditor` and the existing collaboration stack own persistence;
233
+ - no parallel local state, save route, API, schema, or provider path is added.
234
+
235
+ Implementation must establish how the current node schema and node view should
236
+ represent zero children versus an empty child, why the summary transaction can
237
+ be dropped, how context-sensitive Enter and Shift-Tab should target valid
238
+ ProseMirror positions, and whether collaborative save serializes an intermediate
239
+ document. That is diagnostic work inside the frozen boundary, not a menu of
240
+ patches to apply speculatively.
241
+
242
+ ## Constraints and exclusions
243
+
244
+ - Do not claim this repair explains the original freeze or Clip
245
+ `7kkuRxVJbzAi`.
246
+ - Do not use Apoorva's, Sabena's, or any other person's production page,
247
+ account, or data.
248
+ - Create no fixture outside the exact disposable manifest declared for Work.
249
+ - Do not redesign Toggle, slash commands, blockquote shortcuts, collaboration,
250
+ or editor persistence generally.
251
+ - Do not change provider integrations, schemas, auth, access, or source truth.
252
+ - Preserve other slash commands, pointer activation, Toggle delete and
253
+ Backspace behavior, serialization, and collaborative editing except for the
254
+ explicitly changed Toggle creation, Enter, child, caret, and outdent contract.
255
+ - Shape authorizes only this brief. It does not authorize implementation,
256
+ commits, pushes, a pull request, merge, deployment, Slack messages, or vault
257
+ mutation.
258
+
259
+ ## Architecture grounding and fit
260
+
261
+ Architecture grounding is **not required** beyond this bounded record because
262
+ the repair stays inside an existing local editor contract and changes no shared
263
+ platform seam or public vocabulary.
264
+
265
+ - Demonstrated caller and request: a signed-in Content writer creates or edits a
266
+ Toggle, moves among its summary and child paragraphs with Enter and Shift-Tab,
267
+ and reloads without losing canonical content or structure.
268
+ - Existing primitives:
269
+ - `ToggleView` in `NotionExtensions.tsx` controls the summary input, calls
270
+ `updateAttributes`, inserts the sibling `notionToggle`, and hands off focus;
271
+ - `focusMostRecentEmptyToggleSummary` provides existing summary-focus
272
+ behavior for Toggle creation;
273
+ - `VisualEditor.tsx` owns the existing collaborative update, reconciliation,
274
+ and save guards;
275
+ - current markdown and NFM tests prove isolated Toggle serialization but not
276
+ this joined interaction.
277
+ - Ownership boundaries: React owns the DOM input; ProseMirror owns document
278
+ transactions and valid selections; the existing collaboration path owns
279
+ durable save/reload behavior.
280
+ - Legacy contracts: unrelated slash commands, pointer activation, deletion,
281
+ Backspace, serialization, collaboration, and honest error reporting remain
282
+ unchanged. Existing Toggle Enter behavior is superseded only where the frozen
283
+ Notion interaction contract says otherwise.
284
+ - Smallest compatible delta: one correction at the first proven dropped
285
+ transaction, stale-node, invalid-selection, focus, or save-order boundary,
286
+ with a joined regression test.
287
+ - Deferred capabilities: Toggle UX redesign, general editor performance,
288
+ reporter-exact freeze diagnosis, Clip disappearance diagnosis, provider sync,
289
+ and broad feedback reconciliation.
290
+ - Reversibility: localized TypeScript and test changes with no schema, data,
291
+ provider, or migration work.
292
+ - Direct evidence: the 2026-08-08 six-path result; current
293
+ `NotionExtensions.tsx`, `SlashCommandMenu.tsx`, and `VisualEditor.tsx`;
294
+ `content.author.document-editor`; current Toggle serialization tests.
295
+ - Inference: the defect likely crosses the summary attribute, Enter
296
+ transaction, focus, and persistence ordering boundary. The exact faulty
297
+ operation remains for Work to prove.
298
+ - Unresolved owner questions: none. A public or shared contract decision is not
299
+ needed for this bounded repair.
300
+
301
+ ## Successful-user story
302
+
303
+ Story `content-toggle-notion-interaction-durable-v1`:
304
+
305
+ > A signed-in Content writer creates a Toggle with `> `, edits its summary and
306
+ > child paragraphs using Enter and Shift-Tab, collapses or expands it, reloads,
307
+ > and finds the same summaries, children, order, expansion state, and expected
308
+ > focus destinations, with structural-empty affordances and disclosure-caret
309
+ > state matching Notion and no silent loss or selection warning.
310
+
311
+ Required assertions:
312
+
313
+ 1. On the pre-fix artifact, the approved disposable page reproduces the
314
+ distinct defect: summary `toggle` plus Enter loses focus and/or the
315
+ summary/structure after reload. If it no longer reproduces, Work stops with
316
+ the changed evidence instead of inventing a repair.
317
+ 2. `> ` creates one expanded Toggle focused in its `Toggle` summary; with zero
318
+ children it shows the exact empty-body affordance without serializing a
319
+ paragraph, and its disclosure caret is muted.
320
+ 3. Clicking the empty-body affordance creates and focuses one real empty child
321
+ paragraph; the disclosure caret becomes active despite the child having no
322
+ text.
323
+ 4. Enter on a completely empty new Toggle replaces it with an ordinary empty
324
+ paragraph, while Enter after a nonempty expanded summary creates and focuses
325
+ the first child paragraph and Enter in a child creates the next child.
326
+ 5. Shift-Tab in a child paragraph moves that paragraph immediately after the
327
+ Toggle and retains focus; removing the last child restores the structural
328
+ empty affordance and muted disclosure caret.
329
+ 6. Enter from a collapsed Toggle summary creates exactly one collapsed sibling
330
+ Toggle below, focuses its summary, and preserves the first Toggle.
331
+ 7. After the existing save settles and the page reloads, summaries, child
332
+ paragraphs, order, expansion state, and bodies match the last visible editor
333
+ state.
334
+ 8. The interaction emits no `TextSelection endpoint not pointing into a node
335
+ with inline content` warning, unhandled rejection, transaction loop, render
336
+ loop, or repeated persistence request.
337
+ 9. Unrelated slash commands, pointer activation, collapse/expand/delete, and
338
+ empty-summary Backspace retain their current behaviors.
339
+ 10. Focused automated tests cover Toggle creation, structural-empty state,
340
+ context-sensitive Enter, Shift-Tab outdent, focus handoff where testable,
341
+ serialization, and reload persistence; the
342
+ relevant existing Content editor tests and changed-file checks pass.
343
+ 11. A current real-interface run against the exact review artifact exercises
344
+ the full numbered interaction matrix above, save, and reload on the declared
345
+ disposable page. Independent evidence is preferred when an independently
346
+ acquirable browser is available, but same-context evidence is allowed and
347
+ its custody must be stated plainly.
348
+ 12. The Work handoff continues to report the original freeze as unreproduced and
349
+ makes no causal claim about the reporter Clip.
350
+
351
+ Acceptance policy:
352
+
353
+ - Modality: `real-interface`, supported by focused automated regression.
354
+ - Independence: `preferred`.
355
+ - Custody: `same-context-allowed`.
356
+ - Interface: a fresh browser session against a task-owned local Content runtime
357
+ and disposable page built from the exact review artifact.
358
+ - Rationale: this is an ordinary bounded interactive editor repair with no
359
+ authentication, authorization, privacy, destructive, payment, or migration
360
+ consequence. Independent evidence would add confidence, but its absence
361
+ should not recreate the previous impossible acceptance gate.
362
+
363
+ ## Risk strategy
364
+
365
+ `system-ready`, without a feature flag. This is a narrow existing-contract
366
+ repair proven before merge on an isolated local runtime. Production validation
367
+ after merge is not the acceptance plan.
368
+
369
+ ## Proposed Work boundary
370
+
371
+ If Alice invokes Work for this exact brief, Work may:
372
+
373
+ - update the smallest Content editor source seam and matching focused tests;
374
+ - add one user-facing Content changelog entry if the behavior changes visibly;
375
+ - use one exact, time-bounded local runtime/database/account/page manifest with
376
+ no production or customer data and verified cleanup;
377
+ - format and run focused checks, relevant guards, and exact-artifact
378
+ real-interface acceptance;
379
+ - create a review-ready pull request from the current branch after technical
380
+ acceptance.
381
+
382
+ Work stops before merge or deployment. Any change to the Enter behavior,
383
+ shipping surface, collaboration architecture, acceptance story, or feature-flag
384
+ strategy returns to Shape.
385
+
386
+ ## Architecture fingerprint and Shape authority envelope
387
+
388
+ ```yaml
389
+ authoritySchemaVersion: 3
390
+ stage: work
391
+ authority-source: Alice invoked $work on 2026-08-14 for revision shape-v4-summary-reconcile-return-to-shape.
392
+ authorized-scope:
393
+ repositories:
394
+ - BuilderIO/agent-native
395
+ product-surfaces:
396
+ - Content visual document editor Toggle summary Enter path
397
+ outcome: Freeze a distinct repair that makes Toggle creation Enter Shift-Tab structural-empty caret focus and persistence behavior match the supplied Notion reference.
398
+ allowed-mutations:
399
+ - artifact-write
400
+ - ephemeral-test-resource
401
+ - commit
402
+ - push
403
+ - pull-request
404
+ write-targets:
405
+ artifacts:
406
+ - templates/content/docs/solutions/2026-08-12-toggle-summary-focus-persistence-shape.md
407
+ - packages/toolkit/src/editor/useCollabReconcile.ts
408
+ - packages/toolkit/src/editor/useCollabReconcile.concurrent.spec.ts
409
+ - templates/content/app/components/editor/extensions/NotionExtensions.tsx
410
+ - templates/content/app/components/editor/VisualEditor.tsx
411
+ - templates/content/app/components/editor/SlashCommandMenu.tsx
412
+ - templates/content/app/components/editor/NotionToggle.interactions.test.ts
413
+ - templates/content/app/components/editor/VisualEditor.markdown.test.ts
414
+ - templates/content/app/global.css
415
+ - templates/content/changelog/2026-08-12-toggle-blocks-now-follow-notion-style-enter-and-shift-tab-be.md
416
+ test-resources:
417
+ - id: content-toggle-work-runtime-v1
418
+ kind: server
419
+ surface: localhost Content development runtime on port 4179
420
+ ownership-marker: content-toggle-work-20260812
421
+ baseline: port 4179 is unbound before startup
422
+ allowed-actions: [create, exercise, delete]
423
+ cleanup-trigger: before Work completion
424
+ cleanup-method: terminate the exact task-owned process and verify the port is unbound
425
+ cleanup-proof: 2026-08-13 read-back found no listener or task-owned process on port 4179
426
+ shared-impact: none
427
+ isolation: local-runtime
428
+ ownership: task-created
429
+ production-data: false
430
+ customer-data: false
431
+ cost: none
432
+ boundary-evidence:
433
+ - exact dedicated worktree and task marker are supplied to the local process
434
+ max-lifetime-minutes: 1440
435
+ declared-at: 2026-08-12T18:10:03Z
436
+ expires-at: 2026-08-13T18:10:03Z
437
+ status: cleaned
438
+ phase: work
439
+ - id: content-toggle-work-data-v1
440
+ kind: database
441
+ surface: task-local Content SQLite database under /tmp/content-toggle-work-20260812
442
+ ownership-marker: content-toggle-work-20260812
443
+ baseline: task-local directory does not exist before provisioning
444
+ allowed-actions: [create, update, exercise, delete]
445
+ cleanup-trigger: before Work completion
446
+ cleanup-method: move the exact task-local directory to Trash after runtime shutdown
447
+ cleanup-proof: 2026-08-13 read-back found the exact /tmp path absent after recoverable move to Trash
448
+ shared-impact: none
449
+ isolation: isolated-test-surface
450
+ ownership: task-created
451
+ production-data: false
452
+ customer-data: false
453
+ cost: none
454
+ boundary-evidence:
455
+ - database path is outside all configured production and customer stores
456
+ max-lifetime-minutes: 1440
457
+ declared-at: 2026-08-12T18:10:03Z
458
+ expires-at: 2026-08-13T18:10:03Z
459
+ status: cleaned
460
+ phase: work
461
+ - id: content-toggle-work-runtime-v2
462
+ kind: server
463
+ surface: localhost Content development runtime on port 4179
464
+ ownership-marker: content-toggle-work-20260814
465
+ baseline: port 4179 is unbound before startup
466
+ allowed-actions: [create, exercise, delete]
467
+ cleanup-trigger: before Work completion
468
+ cleanup-method: terminate the exact task-owned process and verify port 4179 is unbound
469
+ cleanup-proof: process absence plus failed localhost connection on port 4179
470
+ shared-impact: none
471
+ isolation: local-runtime
472
+ ownership: task-created
473
+ production-data: false
474
+ customer-data: false
475
+ cost: none
476
+ boundary-evidence:
477
+ - exact dedicated worktree and content-toggle-work-20260814 marker are supplied to the local process
478
+ max-lifetime-minutes: 1440
479
+ declared-at: 2026-08-14T16:42:28Z
480
+ expires-at: 2026-08-15T16:42:28Z
481
+ status: cleaned
482
+ phase: work
483
+ - id: content-toggle-work-data-v2
484
+ kind: database
485
+ surface: task-local Content SQLite database under /tmp/content-toggle-work-20260814
486
+ ownership-marker: content-toggle-work-20260814
487
+ baseline: exact task-local directory is absent before provisioning
488
+ allowed-actions: [create, update, exercise, delete]
489
+ cleanup-trigger: before Work completion
490
+ cleanup-method: move the exact task-local directory to Trash after runtime shutdown
491
+ cleanup-proof: filesystem absence at the exact declared path
492
+ shared-impact: none
493
+ isolation: isolated-test-surface
494
+ ownership: task-created
495
+ production-data: false
496
+ customer-data: false
497
+ cost: none
498
+ boundary-evidence:
499
+ - database path is outside every configured production and customer store
500
+ max-lifetime-minutes: 1440
501
+ declared-at: 2026-08-14T16:42:28Z
502
+ expires-at: 2026-08-15T16:42:28Z
503
+ status: cleaned
504
+ phase: work
505
+ - id: content-toggle-work-account-v2
506
+ kind: account
507
+ surface: dev@local.test inside content-toggle-work-data-v2 only
508
+ ownership-marker: content-toggle-work-20260814
509
+ baseline: account is absent before task-local database provisioning
510
+ allowed-actions: [create, exercise, delete]
511
+ cleanup-trigger: with content-toggle-work-data-v2 before Work completion
512
+ cleanup-method: remove by deleting the containing task-local database directory
513
+ cleanup-proof: containing database path is absent
514
+ shared-impact: none
515
+ isolation: isolated-test-surface
516
+ ownership: task-created
517
+ production-data: false
518
+ customer-data: false
519
+ cost: none
520
+ boundary-evidence:
521
+ - reserved local-only identity exists solely in the declared SQLite database
522
+ max-lifetime-minutes: 1440
523
+ declared-at: 2026-08-14T16:42:28Z
524
+ expires-at: 2026-08-15T16:42:28Z
525
+ status: cleaned
526
+ phase: work
527
+ - id: content-toggle-work-page-v2
528
+ kind: record
529
+ surface: Content document content_toggle_work_20260814_v1 inside content-toggle-work-data-v2
530
+ ownership-marker: content-toggle-work-20260814
531
+ baseline: document is absent before task-local database provisioning
532
+ allowed-actions: [create, update, exercise, delete]
533
+ cleanup-trigger: with content-toggle-work-data-v2 before Work completion
534
+ cleanup-method: remove by deleting the containing task-local database directory
535
+ cleanup-proof: containing database path is absent
536
+ shared-impact: none
537
+ isolation: isolated-test-surface
538
+ ownership: task-created
539
+ production-data: false
540
+ customer-data: false
541
+ cost: none
542
+ boundary-evidence:
543
+ - stable page ID and task marker are confined to the declared SQLite database
544
+ max-lifetime-minutes: 1440
545
+ declared-at: 2026-08-14T16:42:28Z
546
+ expires-at: 2026-08-15T16:42:28Z
547
+ status: cleaned
548
+ phase: work
549
+ governing-artifact:
550
+ path: templates/content/docs/solutions/2026-08-12-toggle-summary-focus-persistence-shape.md
551
+ revision: shape-v4-summary-reconcile-return-to-shape
552
+ architecture-fingerprint:
553
+ outcome: Implement the approved Notion Toggle interaction contract and repair focus and persistence loss without claiming or repairing the unreproduced freeze.
554
+ shipping-surfaces:
555
+ - id: content-toggle-summary-enter
556
+ repository: BuilderIO/agent-native
557
+ product-surface: Content visual document editor
558
+ constituency: signed-in Content writers
559
+ durable-destination: public Content template editor behavior
560
+ integration-action: merge
561
+ - id: shared-editor-reconcile-semantic-focus
562
+ repository: BuilderIO/agent-native
563
+ product-surface: shared editor toolkit collaboration reconciliation
564
+ constituency: source-blind Agent Native app developers using editor-owned controls outside ProseMirror
565
+ durable-destination: public Agent Native editor toolkit
566
+ integration-action: merge
567
+ governing-architecture: Content reports semantic editor-owned focus to the existing shared reconciliation hook, which remains the sole owner of stale-echo and external-snapshot arbitration; no parallel state or save mechanism is added.
568
+ acceptance-story:
569
+ id: content-toggle-notion-interaction-durable-v1
570
+ summary: A writer creates and edits a Toggle using context-sensitive Enter and Shift-Tab then reloads and retains exact visible structure state and focus behavior without a selection warning.
571
+ required-assertions:
572
+ - pre-fix defect reproduces on the approved disposable page or Work stops with changed evidence
573
+ - greater-than-space creates one expanded Toggle focused in its summary with a structural-empty affordance and muted caret
574
+ - creating one real empty child activates the caret even before text exists
575
+ - Enter on an empty Toggle exits to a paragraph while Enter after a nonempty expanded summary enters its body
576
+ - Enter within a child creates another child and Shift-Tab outdents the current child while retaining focus
577
+ - removing the last child restores the structural-empty affordance and muted caret
578
+ - Enter from a collapsed summary creates and focuses exactly one collapsed sibling Toggle
579
+ - summaries children order expansion state and bodies survive save and reload
580
+ - no TextSelection warning or render transaction focus or persistence loop occurs
581
+ - rapid Toggle summary deletion is not overwritten by an intermediate local save or poll echo while the summary input owns focus
582
+ - a genuinely newer external edit still reconciles after the local summary interaction settles
583
+ - unrelated Toggle and slash-command behavior remains unchanged
584
+ - focused automated and exact-artifact real-interface evidence passes
585
+ - the original freeze remains explicitly unreproduced and causally separate
586
+ acceptance-policy:
587
+ modality: real-interface
588
+ independence: preferred
589
+ custody: same-context-allowed
590
+ interface: Fresh browser session on a task-owned local Content runtime and disposable page built from the exact review artifact.
591
+ rationale: Ordinary bounded editor repair; independent evidence adds confidence but is not a gate when the same-context run and focused regression cover the exact interaction.
592
+ risk-strategy:
593
+ kind: system-ready
594
+ production-validation-after-merge: false
595
+ architecture-grounding:
596
+ applicability: required
597
+ reason: The replacement repair adds a semantic-focus input to the shared editor toolkit reconciliation seam used by multiple apps.
598
+ status: grounded
599
+ demonstrated-callers:
600
+ - Signed-in Content writer creates and edits a Toggle using Enter and Shift-Tab then reloads.
601
+ - Content VisualEditor asks the shared reconciler to distinguish active editing in its external Toggle summary input from a settled editor eligible for external snapshots.
602
+ existing-primitives:
603
+ - ToggleView controlled summary and Enter handler
604
+ - focusMostRecentEmptyToggleSummary
605
+ - TipTap and ProseMirror document transaction and selection model
606
+ - VisualEditor collaborative reconciliation and persistence
607
+ - useCollabReconcile recent-emission ring and newer-snapshot arbitration
608
+ ownership-boundaries:
609
+ - React node view owns summary DOM interaction
610
+ - ProseMirror owns canonical editor transactions and valid selections
611
+ - VisualEditor collaboration owns durable save and reload
612
+ - shared editor toolkit owns stale-echo and external-snapshot arbitration
613
+ legacy-contracts:
614
+ - unrelated slash-command behavior
615
+ - pointer activation delete and Backspace behavior
616
+ - Toggle serialization and collaborative persistence
617
+ - existing shared-editor callers continue using ProseMirror focus unless they explicitly supply an editor-owned focus signal
618
+ shared-vocabulary:
619
+ - Toggle means the existing notionToggle block
620
+ - Enter and Shift-Tab are context-sensitive structural editing gestures defined by the approved Notion reference
621
+ smallest-compatible-delta: Add one optional semantic editor-owned focus input to useCollabReconcile and have Content include its Toggle summary input; preserve the default ProseMirror-focus behavior for every existing caller.
622
+ deferred-capabilities:
623
+ - original freeze diagnosis
624
+ - reporter Clip disappearance diagnosis
625
+ - Toggle UX redesign
626
+ - general editor or persistence redesign
627
+ reversibility: One optional toolkit input plus one Content integration and focused tests; no schema provider data or migration work.
628
+ direct-evidence:
629
+ - thread 019fd8a9-d1f7-7172-b795-cc547dfce66f latest completed result
630
+ - artifact 6ad763410612c69873a37ba76d82c0fd3b325dde six-path run
631
+ - current NotionExtensions SlashCommandMenu and VisualEditor source
632
+ - packages/toolkit/src/editor/useCollabReconcile.ts recent-emission and focus gates
633
+ - DocumentEditor 500 ms debounced canonical save path
634
+ - Alice Clip bRM8cRvDr30R and confirmation that only the local Toggle summary reproduces
635
+ - content.author.document-editor product record
636
+ inferences: []
637
+ unresolved-owner-questions: []
638
+ delegation-ceiling:
639
+ - artifact-write
640
+ product-boundary-gates:
641
+ agent-native-public-constituency: Any signed-in Content writer can encounter this public template behavior, and any source-blind app developer using an editor-owned control outside ProseMirror needs the shared reconciler to accept semantic focus without Alice's vault machines credentials or private orchestration.
642
+ bowerbird-product-boundary: This repair has no Bowerbird product surface and remains separate from the private feedback task.
643
+ acceptance-state:
644
+ status: passed
645
+ summary: The approved Toggle interaction and semantic-focus reconciliation repair passed focused automated, type, guard, same-context browser, persistence, and independent technical review evidence; the original freeze remains unreproduced and out of scope.
646
+ blockers: []
647
+ last-land-packet: null
648
+ ledger-revision: content-toggle-summary-reconcile-work-v2
649
+ status: active
650
+ ```
651
+
652
+ ## 2026-08-14 Work evidence
653
+
654
+ - The pre-fix disposable browser trace reproduced the branch-only summary
655
+ oscillation: rapid deletion changed `abcdef` to the intended shorter value,
656
+ briefly restored an earlier partial value from a save or poll response, then
657
+ returned to the intended value after the next save.
658
+ - The repair adds one optional `isEditorFocused` predicate to
659
+ `useCollabReconcile`. Existing callers retain TipTap's `editor.isFocused`
660
+ default. Content additionally treats focus in a contained
661
+ `.notion-toggle__summary` input as editor-owned focus.
662
+ - The exact post-fix browser trace moved monotonically from `abcdef` through
663
+ `abcde`, `abcd`, and `abc` to `ab`, retained summary focus, persisted `ab`
664
+ through reload, and subsequently accepted a genuinely newer external value
665
+ after focus left the summary.
666
+ - The same browser surface verified that Enter on a nonempty collapsed summary
667
+ creates exactly one collapsed empty sibling and focuses its summary. The
668
+ remaining structural Enter and Shift-Tab cases are covered by focused
669
+ interaction tests using the real ProseMirror document model.
670
+ - Focused Content tests passed 68 of 68. Shared reconciliation tests passed 19
671
+ of 19. Toolkit and Content typechecks passed after rebuilding the workspace
672
+ toolkit declarations. All 51 repository guards passed, as did
673
+ `git diff --check`.
674
+ - Independent bounded technical review found no material defect. It confirmed
675
+ that shared reconciliation remains the sole snapshot arbitrator, that the
676
+ selection targets are structurally valid, and that direct-child outdent
677
+ preserves the intended Toggle boundary. Its only residual note is that DOM
678
+ focus handoff is covered by the same-context browser evidence rather than the
679
+ synthetic interaction helper test.
680
+ - The declared runtime, account, page, and SQLite database were removed by
681
+ stopping port 4179 and moving `/tmp/content-toggle-work-20260814` to Trash.
682
+ An accidental env-less action invocation created a fresh default local
683
+ SQLite database but failed before document access; its exact three database
684
+ files were immediately moved to a separate Trash folder and verified absent
685
+ from the checkout.
686
+ - This evidence does not reproduce or explain the original freeze, does not use
687
+ production data, and does not merge the separate two-tab synchronization or
688
+ read-only loading-state defects into this repair.
689
+
690
+ ## 2026-08-14 Land repair evidence
691
+
692
+ - The accepted browser run exposed a `TextSelection endpoint not pointing into
693
+ a node with inline content (notionToggle)` warning while hydrating the exact
694
+ disposable Toggle page. Land stopped rather than treating the earlier green
695
+ interaction evidence as sufficient.
696
+ - The warning originated in y-prosemirror's initial whole-document render: it
697
+ recreated the placeholder paragraph selection at the same absolute position
698
+ after replacement, which can be inside a zero-child Toggle. The shared
699
+ collaboration extension now lets ProseMirror map the existing selection
700
+ through that one initial replacement and restores upstream behavior
701
+ immediately afterward.
702
+ - A regression mounts and remounts the same collaborative Y.Doc beginning with
703
+ a zero-child Toggle, asserts that the summary hydrates, and rejects the exact
704
+ invalid-TextSelection warning. The focused editor file passes 62 of 62 tests;
705
+ a fresh browser load of the exact disposable page emitted no matching warning.
706
+ - The same independent reviewer performed the one bounded follow-up allowed
707
+ after a finding changes the artifact and reported no material finding or Land
708
+ blocker. The residual risk is that the focused regression does not separately
709
+ assert a later remote cursor update, while the immediate `finally` restoration
710
+ of upstream behavior makes a later-selection change unlikely.
711
+ - Toolkit tests passed 764 of 764, Toolkit and Content typechecks passed, the
712
+ full formatter check passed, all 51 guards passed, and `git diff --check` was
713
+ clean. Port 4179 was stopped and the disposable database directory was moved
714
+ from `/tmp` back to Trash, then verified absent from `/tmp`.
715
+ - This initial-selection repair does not change the accepted Toggle gestures or
716
+ broaden the claim about the original freeze, which remains unreproduced.
717
+ - GitHub's review agent then identified a distinct nested-Toggle focus edge:
718
+ collapsed-summary Enter selected the next summary in DOM order, which could
719
+ be a nested child rather than the newly inserted sibling. The repair now
720
+ resolves the sibling node view by its exact post-transaction document
721
+ position and focuses only that node's summary. A focused regression proves
722
+ the position target in the presence of an earlier nested summary; the two
723
+ editor test files pass 70 of 70.
724
+ - Before merge, `main` advanced from `52b87653f` to `65dfa621c` through changes
725
+ overlapping `VisualEditor` and its focused tests. Land classified that drift
726
+ as acceptance-coupled, merged current `main` without conflict, and reran the
727
+ affected contract: the two focused editor files passed 75 of 75, the current
728
+ scoped toolkit suite passed 396 of 396, and the full formatter check passed.
729
+
730
+ ## Natural next stage
731
+
732
+ Work is complete for this exact brief. Merge and deployment remain separate
733
+ Land authority.