@agent-native/core 0.168.9 → 0.168.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.
package/corpus/README.md CHANGED
@@ -31,4 +31,4 @@ rg -n "defineAction|useActionQuery" node_modules/@agent-native/core/corpus
31
31
 
32
32
  ## Generated Counts
33
33
 
34
- - template files: 8502
34
+ - template files: 8504
@@ -1042,6 +1042,7 @@ export function SlashCommandMenu({
1042
1042
 
1043
1043
  const handleKeyDown = (e: KeyboardEvent) => {
1044
1044
  if (
1045
+ !isOpen &&
1045
1046
  e.key === "Enter" &&
1046
1047
  !e.shiftKey &&
1047
1048
  !e.metaKey &&
@@ -729,6 +729,11 @@
729
729
  background: hsl(var(--muted));
730
730
  border-radius: 0 0 6px 6px;
731
731
  }
732
+ .notion-editor .notion-code-block {
733
+ background: hsl(var(--muted));
734
+ border-radius: 6px;
735
+ margin: 0.6em 0;
736
+ }
732
737
  .notion-editor pre code {
733
738
  font-family: inherit;
734
739
  background: none;
@@ -0,0 +1,492 @@
1
+ # Ordinary Code Block slash insertion production regression
2
+
3
+ ## Decision
4
+
5
+ Treat the remaining report as a production-only contract regression until a
6
+ reporter-equivalent disposable fixture demonstrates the first divergent
7
+ boundary. Do not repeat the July 24 atomic `setCodeBlock()` repair without that
8
+ evidence: the current repository implementation and the current production
9
+ bundle already contain it, and the exact current repository snapshot passes
10
+ both Enter-key and pointer-selection insertion plus reload persistence in a
11
+ real local Content interface.
12
+
13
+ The Work lane is therefore narrow and fail-closed: reproduce the production
14
+ failure on an approved disposable fixture, capture the editor transaction and
15
+ save receipt, and repair only the first boundary that differs from the passing
16
+ current-head control. If the failure does not reproduce, Work stops with
17
+ changed evidence instead of manufacturing another Code Block implementation.
18
+
19
+ ## Durable identity and coordinates
20
+
21
+ - Bowerbird task: `Repair Content slash-command image and code block insertion`
22
+ - Bowerbird ID: `b39ed5ea-738a-47d7-9300-62c07f49efc0`
23
+ - Supplied current Bowerbird revision:
24
+ `c56ab46ffd312c412f971ab7db183951eb342ca2e9685a86127fd41856f77580`
25
+ - Historical Codex owner: `019ff1d3-9943-7603-9a35-29fa3a94c4e0`
26
+ - Repository: `BuilderIO/agent-native`
27
+ - Refreshed repository HEAD:
28
+ `6203d5dba9095978b7d5681720b81953ce04638c`
29
+ - Production host: `https://content.agent-native.com`
30
+ - Observed production editor asset:
31
+ `assets/VisualEditor-dwyChdnP.js`
32
+ - Shape ledger revision: `content-code-block-production-shape-v1`
33
+
34
+ No Bowerbird row, production/customer document, shipping source, commit, PR,
35
+ deployment, or task title was changed during Shape.
36
+
37
+ ## Scope
38
+
39
+ ### Owned outcome
40
+
41
+ A signed-in Content writer types `/code block` in an ordinary Page and can
42
+ insert one native Code Block with either Enter or pointer selection; the slash
43
+ query disappears atomically, the editor remains responsive, entered code saves,
44
+ and the same block and source return after reload.
45
+
46
+ ### Explicit exclusions
47
+
48
+ - image insertion or upload completion;
49
+ - the adjacent Code Block UX task, including language controls, tabs, execution,
50
+ rendered output, or styling;
51
+ - Mermaid insertion, rendering, fallback, or execution;
52
+ - registry-derived slash-command catalog behavior;
53
+ - broader slash-command discovery, grouping, or keyboard redesign;
54
+ - production/customer-data mutation during diagnosis or acceptance.
55
+
56
+ ## Evidence
57
+
58
+ ### Direct evidence
59
+
60
+ 1. Current source routes both activation modes through the same
61
+ `executeCommand` callback in
62
+ `templates/content/app/components/editor/SlashCommandMenu.tsx`.
63
+ 2. The ordinary Code Block command preserves the slash range and calls
64
+ `setCodeBlockFromSlashCommand`, which chains `focus()`, optional
65
+ `deleteRange(slashRange)`, and `setCodeBlock()` into one ProseMirror command.
66
+ 3. After a document-changing command, `executeCommand` calls
67
+ `onDraftCommitted`; `VisualEditor` binds that callback to
68
+ `persistEditorContent(editor, { userInitiated: true })`.
69
+ 4. `persistEditorContent` serializes the current editor document through NFM,
70
+ registers the emitted collaborative value, and hands it to
71
+ `DocumentEditor`'s queued 500 ms save boundary. Navigation/teardown has a
72
+ separate flush path.
73
+ 5. `CodeBlockNode.tsx` uses Tiptap's native Lowlight Code Block renderer. The
74
+ historical React node view that could lock a collaborative editor is not the
75
+ current renderer.
76
+ 6. The July 24 commit
77
+ `caedc1e6280a012561021eaf016d190da4d763cd` introduced the atomic conversion
78
+ helper and its focused transaction test.
79
+ 7. The focused current-head suite passed 31 of 31 tests. Its Code Block test
80
+ proves the helper transaction, while its pointer test proves button-event
81
+ deduplication; neither currently proves the full pointer/Enter -> command ->
82
+ persistence -> reload story.
83
+ 8. A disposable local Content runtime built from repository HEAD
84
+ `6203d5dba9095978b7d5681720b81953ce04638c` exercised the real rendered
85
+ editor:
86
+ - Enter on exact `/code block` created one native `<pre><code>` block;
87
+ - pointer selection of the ordinary `Code Block` item created a second native
88
+ block;
89
+ - `enter-path-marker` and the pointer marker both survived a full reload;
90
+ - the final interface contained two native Code Blocks.
91
+ 9. Production was inspected read-only. The deployed editor bundle contains
92
+ `setCodeBlock`, `preserveSlashRange`, and `onDraftCommitted`, so production is
93
+ not simply missing the known July 24 command and persistence seams.
94
+ 10. Production interaction was not attempted because every available Page was
95
+ persisted production/customer state and this Shape explicitly forbids
96
+ mutating it.
97
+ 11. The task-owned sandbox `/tmp/content-codeblock-shape-20260820`, its SQLite
98
+ data, dependencies, and local Page were moved to
99
+ `/Users/alicemoore/.Trash/content-codeblock-shape-20260820`. Port 4187 and
100
+ the original sandbox path were independently absent afterward.
101
+
102
+ ### Historical evidence
103
+
104
+ The prior owner reproduced current-head Code Block insertion and navigation
105
+ round-trip on August 12 and recommended hosted confirmation before closure.
106
+ That same run separated native Code Blocks from image media nodes and
107
+ registry-backed Mermaid blocks. The later image repair merged independently.
108
+
109
+ ### Inferences
110
+
111
+ - Because both activation modes pass through one command and persistence path,
112
+ a reporter-equivalent failure in both modes is more likely to occur at shared
113
+ document state, collaboration, serialization/save, or artifact/environment
114
+ boundaries than in the pointer or Enter event adapters individually.
115
+ - The production bundle's presence of current symbol seams is evidence of
116
+ included logic, not proof that production runs the same complete source
117
+ revision or that a specific persisted Page/Y.Doc state accepts the
118
+ transaction.
119
+ - A local pass does not overturn the supplied current truth that production is
120
+ broken; it rules out prescribing the already-landed atomic helper as the next
121
+ repair without a production-equivalent failure trace.
122
+
123
+ ### Unresolved
124
+
125
+ - No safe disposable production Page was available under Shape authority, so
126
+ the exact production transaction, console, network, collaboration, and
127
+ canonical read-back remain unobserved.
128
+ - Production did not expose a repository commit SHA in the inspected page or
129
+ asset names. The exact deployment-to-commit coordinate remains unresolved.
130
+ - The supplied Bowerbird revision could not be independently read back without
131
+ sending a new app request, which Shape forbids. It remains the governing
132
+ durable coordinate supplied by Alice.
133
+
134
+ ## Architecture grounding
135
+
136
+ Grounding is not required beyond the bounded local repair boundary. The
137
+ demonstrated caller is one signed-in Content writer inserting an ordinary native
138
+ Code Block into a Page. Existing ownership is already clear:
139
+
140
+ - `SlashCommandMenu` owns discovery and Enter/pointer command dispatch;
141
+ - ProseMirror/Tiptap owns the atomic document transaction and selection;
142
+ - `CodeBlockNode` owns native Code Block schema/rendering behavior;
143
+ - `VisualEditor` owns collaborative serialization and the explicit
144
+ post-command persistence request;
145
+ - `DocumentEditor` owns queued canonical save, teardown flush, and durable
146
+ document mutation.
147
+
148
+ The smallest compatible delta is the first one of those existing owners proven
149
+ to diverge on the reporter-equivalent fixture. No parallel command, renderer,
150
+ save channel, or Code Block type is permitted. Legacy contracts that must remain
151
+ unchanged are all unrelated slash commands, images, registry blocks, Mermaid,
152
+ ordinary typing and history, NFM round-trip, collaboration, and canonical Page
153
+ persistence.
154
+
155
+ ## Smallest repair boundary
156
+
157
+ Work must not begin with a guessed code change. It must capture these four
158
+ checkpoints for both Enter and pointer paths on the same disposable artifact:
159
+
160
+ 1. **Dispatch:** the ordinary `Code Block` item is selected once with the live
161
+ slash range.
162
+ 2. **Transaction:** the post-command ProseMirror document contains one native
163
+ `codeBlock`, no slash query, a valid selection, and a responsive editor.
164
+ 3. **Persistence request:** `onDraftCommitted` serializes the post-command
165
+ document and produces a distinguishable success or failure result.
166
+ 4. **Durable read-back:** canonical Page content contains the fenced Code Block,
167
+ and reload reconstructs it.
168
+
169
+ Repair only the first failed checkpoint:
170
+
171
+ - dispatch failure -> repair the shared `executeCommand` activation boundary;
172
+ - transaction failure -> repair the one atomic conversion helper or valid
173
+ selection mapping, without changing Code Block UX;
174
+ - persistence-request failure -> repair the existing explicit post-command
175
+ persistence call or its truthful failure propagation;
176
+ - durable-read-back failure -> repair the existing save/reconcile boundary and
177
+ preserve current transaction behavior.
178
+
179
+ If all four checkpoints pass in the reporter-equivalent fixture, no shipping
180
+ repair is justified; classify the production report as stale or
181
+ document-specific and return to Shape with that evidence.
182
+
183
+ ## Frozen successful-user-story acceptance
184
+
185
+ **Persona:** A signed-in Content writer editing an ordinary Page.
186
+
187
+ **Starting state:** A task-owned disposable Page on an isolated local runtime,
188
+ branch preview, or other approved non-production surface built from the exact
189
+ review artifact. The Page begins with two empty paragraphs and no Code Blocks.
190
+ No production/customer document is used.
191
+
192
+ **Disposable data:** One Page with a task marker, exact stable ID, initial
193
+ canonical-content read-back, and a declared create/exercise/delete manifest.
194
+
195
+ H1. Focus the first empty paragraph and type the exact text `/code block`.
196
+ Press Enter once.
197
+ Functional expectation: the slash query is removed and exactly one native
198
+ Code Block appears; the editor remains responsive and focused in the block.
199
+ Visual expectation: one ordinary Code Block is visible with no Mermaid,
200
+ registry-block, image, or execution controls.
201
+ Evidence: interaction trace, post-command editor JSON/DOM, and console.
202
+
203
+ H2. Type `enter-path-marker`, press Tab, and continue typing.
204
+ Functional expectation: the marker and tab are accepted without lockup or
205
+ duplicate block creation.
206
+ Visual expectation: source remains legible in the ordinary Code Block.
207
+ Evidence: visible block text and editor transaction state.
208
+
209
+ H3. Focus the second empty paragraph, type `/code`, and click the ordinary
210
+ `Code Block` item once with the pointer.
211
+ Functional expectation: the slash query is removed and exactly one second
212
+ native Code Block appears; click/mousedown deduplication creates no third
213
+ block.
214
+ Visual expectation: the selected item and resulting block are the ordinary
215
+ Code Block, not `Code`, `Code tabs`, `Diagram`, or another catalog item.
216
+ Evidence: pointer event/command trace and post-command editor JSON/DOM.
217
+
218
+ H4. Type `pointer-path-marker` in the second block.
219
+ Functional expectation: typing remains responsive and the two blocks retain
220
+ distinct source.
221
+ Visual expectation: both ordinary Code Blocks remain visible and usable.
222
+ Evidence: visible source and console.
223
+
224
+ H5. Observe the explicit post-command persistence result for each insertion,
225
+ wait for the canonical save, then navigate away and back or reload.
226
+ Functional expectation: neither persistence request is silently skipped or
227
+ reported successful on failure; canonical read-back contains exactly two
228
+ fenced Code Blocks with their respective markers, and reload reconstructs
229
+ both.
230
+ Visual expectation: both blocks return without slash text, loading lock,
231
+ error fallback, Mermaid rendering, or duplicate blocks.
232
+ Evidence: save request/result, canonical action or database read-back, fresh
233
+ reload screenshot/DOM, and console/network record.
234
+
235
+ **Regression checks:** Existing atomic conversion, pointer deduplication,
236
+ slash-command menu, NFM round-trip, collaborative editor, and focused Content
237
+ tests pass. Image, Mermaid, registry catalog, and Code Block UX assertions are
238
+ limited to proving they did not change.
239
+
240
+ **Cleanup:** Delete only the declared Page and isolated data/runtime, verify its
241
+ stable ID and sandbox path are absent, stop the exact task-owned process, and
242
+ verify its port is unbound. A successful delete response alone is not cleanup
243
+ proof.
244
+
245
+ **Acceptance policy:**
246
+
247
+ - modality: `real-interface`
248
+ - independence: `preferred`
249
+ - custody: `same-context-allowed`
250
+ - interface: fresh browser session against a task-owned isolated Content runtime
251
+ or branch preview built from the exact review artifact, with canonical
252
+ read-back
253
+ - rationale: this is a bounded editor interaction and durability repair;
254
+ same-context real-interface evidence plus exact-artifact automated coverage is
255
+ proportionate, while independent technical review remains useful for any
256
+ collaboration or persistence change
257
+
258
+ ## Exact Work handoff
259
+
260
+ Invoke:
261
+
262
+ `/work templates/content/docs/solutions/2026-08-20-code-block-slash-production-regression-shape.md`
263
+
264
+ Work must:
265
+
266
+ 1. refresh the Bowerbird task at exact ID and revision and stop on an unexpected
267
+ revision or broadened outcome;
268
+ 2. bind the exact repository head, production asset identity, and review
269
+ artifact before mutation;
270
+ 3. declare an isolated fixture manifest with exact account/database/Page/port,
271
+ baseline, stable IDs, expiry, and cleanup proof;
272
+ 4. reproduce H1-H5 on the pre-fix exact artifact; if the production-equivalent
273
+ defect does not reproduce, stop with changed evidence and return to Shape;
274
+ 5. capture all four dispatch/transaction/persistence/read-back checkpoints and
275
+ repair only the first failed owner;
276
+ 6. add focused coverage that drives the full Enter and pointer command paths
277
+ through `onDraftCommitted`, plus the smallest persistence/reload regression
278
+ required by the observed failure;
279
+ 7. run the frozen H1-H5 story against the exact review artifact and complete
280
+ cleanup before reporting Work complete;
281
+ 8. keep image insertion, Code Block UX, Mermaid, and slash-command catalog work
282
+ out of the diff and PR prose.
283
+
284
+ ## Lifecycle authority envelope
285
+
286
+ ```yaml
287
+ authoritySchemaVersion: 3
288
+ stage: shape
289
+ authority-source: Alice's delegated $shape request on 2026-08-20
290
+ authorized-scope:
291
+ repositories:
292
+ - BuilderIO/agent-native
293
+ product-surfaces:
294
+ - Content ordinary native Code Block slash insertion and canonical Page persistence
295
+ outcome: Restore production ordinary Code Block insertion through both Enter and pointer activation without absorbing adjacent editor work.
296
+ allowed-mutations:
297
+ - artifact-write
298
+ - prototype-sandbox-write
299
+ write-targets:
300
+ artifacts:
301
+ - templates/content/docs/solutions/2026-08-20-code-block-slash-production-regression-shape.md
302
+ prototype-sandboxes:
303
+ - /tmp/content-codeblock-shape-20260820
304
+ governing-artifact:
305
+ path: templates/content/docs/solutions/2026-08-20-code-block-slash-production-regression-shape.md
306
+ revision: content-code-block-production-shape-v1
307
+ architecture-fingerprint:
308
+ outcome: Restore production ordinary Code Block insertion through Enter and pointer activation with truthful canonical persistence.
309
+ shipping-surfaces:
310
+ - id: content-ordinary-code-block-slash
311
+ repository: BuilderIO/agent-native
312
+ product-surface: Content visual Page editor ordinary native Code Block insertion and persistence
313
+ constituency: signed-in Content writers
314
+ durable-destination: public Content template behavior in BuilderIO/agent-native
315
+ integration-action: merge
316
+ governing-architecture: SlashCommandMenu dispatches one atomic native Code Block transaction, VisualEditor explicitly requests persistence, and DocumentEditor remains the sole canonical save owner.
317
+ acceptance-story:
318
+ id: content-code-block-slash-production-v1
319
+ summary: A signed-in writer inserts two ordinary native Code Blocks by Enter and pointer, types in both, and reloads with both blocks and source preserved.
320
+ required-assertions:
321
+ - pre-fix production-equivalent defect reproduces or Work stops with changed evidence
322
+ - Enter removes the slash query and creates exactly one native Code Block
323
+ - pointer selection removes the slash query and creates exactly one second native Code Block
324
+ - editor typing and Tab remain responsive with no lockup or duplicate block
325
+ - each explicit persistence request reports success or failure truthfully
326
+ - canonical read-back and reload preserve exactly two fenced Code Blocks and their distinct markers
327
+ - focused automated and exact-review-artifact real-interface evidence pass
328
+ - image Code Block UX Mermaid and catalog behavior remain unchanged and out of scope
329
+ acceptance-policy:
330
+ modality: real-interface
331
+ independence: preferred
332
+ custody: same-context-allowed
333
+ interface: Fresh browser session on a task-owned isolated Content runtime or branch preview built from the exact review artifact, with canonical read-back.
334
+ rationale: Bounded editor interaction and persistence repair; same-context real-interface proof is proportionate, with independent technical review for collaboration or persistence changes.
335
+ risk-strategy:
336
+ kind: system-ready
337
+ production-validation-after-merge: false
338
+ architecture-grounding:
339
+ applicability: not-required
340
+ reason: Bounded local repair within established slash transaction and canonical save owners; no shared contract, schema, identity, or public vocabulary changes are permitted.
341
+ status: grounded
342
+ demonstrated-callers:
343
+ - Signed-in Content writer typing /code block and activating ordinary Code Block by Enter or pointer.
344
+ existing-primitives:
345
+ - SlashCommandMenu executeCommand
346
+ - setCodeBlockFromSlashCommand
347
+ - native CodeBlockLowlight extension
348
+ - VisualEditor persistEditorContent and onDraftCommitted
349
+ - DocumentEditor queued save and teardown flush
350
+ ownership-boundaries:
351
+ - SlashCommandMenu owns dispatch
352
+ - ProseMirror owns atomic transaction and selection
353
+ - VisualEditor owns serialization and persistence request
354
+ - DocumentEditor owns canonical save and read-back
355
+ legacy-contracts:
356
+ - unrelated slash commands and catalog
357
+ - image and media insertion
358
+ - Mermaid and registry blocks
359
+ - Code Block UX and execution
360
+ - NFM collaboration history and canonical Page persistence
361
+ shared-vocabulary:
362
+ - ordinary Code Block means the native Tiptap codeBlock node, not a registry Code or Mermaid block
363
+ smallest-compatible-delta: Repair only the first demonstrated divergent dispatch, transaction, persistence-request, or durable-read-back boundary; add no parallel command, renderer, save channel, or block type.
364
+ deferred-capabilities:
365
+ - image insertion
366
+ - Code Block UX
367
+ - Mermaid rendering
368
+ - slash-command catalog expansion
369
+ reversibility: One bounded existing-owner repair plus focused tests; no schema, migration, provider data, or new persisted representation.
370
+ direct-evidence:
371
+ - repository HEAD 6203d5dba9095978b7d5681720b81953ce04638c
372
+ - production asset VisualEditor-dwyChdnP.js
373
+ - current-head isolated real-interface Enter pointer and reload pass
374
+ - focused SlashCommandMenu suite 31 of 31 pass
375
+ - historical owner 019ff1d3-9943-7603-9a35-29fa3a94c4e0
376
+ inferences:
377
+ - reporter-equivalent dual-path failure likely lies in a shared document, collaboration, persistence, or environment boundary
378
+ unresolved-owner-questions: []
379
+ delegation-ceiling:
380
+ - artifact-write
381
+ product-boundary-gates:
382
+ agent-native-public-constituency: Signed-in Content writers use this public template editor behavior; no Alice-private credential, orchestration, or vault-only dependency is required.
383
+ bowerbird-product-boundary: Bowerbird supplies durable task identity only; no Bowerbird product behavior changes.
384
+ acceptance-state:
385
+ status: pending
386
+ summary: Shape is complete; current source and production bundle contain the known repair, current-head real-interface control passes, and Work must reproduce the production-equivalent failure before any shipping change.
387
+ blockers:
388
+ - Reporter-equivalent production transaction and durable read-back are unavailable without an approved disposable non-production fixture under Work authority.
389
+ last-land-packet: null
390
+ ledger-revision: content-code-block-production-shape-v1
391
+ status: active
392
+ ```
393
+
394
+ ## Prototype disposition
395
+
396
+ Question: Do Enter and pointer activation fail at one shared transaction or
397
+ persistence boundary on current repository head?
398
+
399
+ Observer and decision: The owning Work thread uses the result to decide whether
400
+ the next repair belongs to dispatch, transaction, persistence request, or
401
+ durable read-back.
402
+
403
+ Artifact: Disposable local runtime and SQLite state formerly at
404
+ `/tmp/content-codeblock-shape-20260820`, built from repository HEAD
405
+ `6203d5dba9095978b7d5681720b81953ce04638c` and driven at
406
+ `http://127.0.0.1:4187/page/CmzxL4fTUtnZ`.
407
+
408
+ Observations: Both activation modes created native Code Blocks and both markers
409
+ survived reload. The local control did not reproduce the supplied production
410
+ failure.
411
+
412
+ Verdict: Current source does not justify another atomic helper repair. Work must
413
+ obtain the reporter-equivalent failure trace and patch only the first divergent
414
+ existing owner.
415
+
416
+ Unresolved: Exact production transaction and canonical read-back.
417
+
418
+ Disposition: preserve this document as evidence; sandbox moved to Trash and
419
+ prohibited from promotion.
420
+
421
+ Authority: Shape, ledger `content-code-block-production-shape-v1`, sandbox
422
+ `/tmp/content-codeblock-shape-20260820`, local prototype state only, disposed
423
+ after observation.
424
+
425
+ Next: `/work templates/content/docs/solutions/2026-08-20-code-block-slash-production-regression-shape.md`
426
+
427
+ ## Work execution record
428
+
429
+ Work lane: `codex/repair-content-code-block-slash` at repository revision
430
+ `07e0de38223d646cd847dd59c8ba376a43c3f83d`, refreshed from `origin/main` on
431
+ 2026-08-20. No commits between the
432
+ Shape revision and this Work base touched `SlashCommandMenu.tsx`,
433
+ `VisualEditor.tsx`, `CodeBlockNode.tsx`, or `DocumentEditor.tsx`.
434
+
435
+ Acceptance reconciliation: consistent with schema v3. The frozen modality is a
436
+ real interface, independence is preferred, and same-context custody is allowed.
437
+
438
+ Test-resource manifest:
439
+
440
+ - resource id: `content-codeblock-work-20260820`
441
+ - owner: this Work execution only
442
+ - runtime: task-owned local Content dev server on `127.0.0.1:4188`
443
+ - canonical store: `/tmp/content-codeblock-work-20260820/content.db`
444
+ - scope: task-owned disposable Pages created only to isolate and exercise the frozen H1-H5 story
445
+ - allowed mutations: create, edit, save, reload, read back, and delete this fixture
446
+ - prohibited mutations: production, customer, shared staging, or unrelated local data
447
+ - expiry: 240 minutes after creation
448
+ - cleanup trigger: immediately after H1-H5 evidence capture or on early stop
449
+ - cleanup proof: server stopped, port unbound, and sandbox moved to Trash
450
+
451
+ Pre-fix direct evidence: on the clean task-owned Page `SBWGbSkWZHlj`, typing
452
+ `/code` displayed the native `Code Block` item as selected, but Enter inserted
453
+ a `registryBlock` with `blockType: code` and a `Loading code block…`
454
+ placeholder. Pointer selection of the displayed native item inserted the
455
+ expected `pre.notion-code-block`. The first divergence was therefore the Enter
456
+ adapter, before the shared native transaction and persistence boundary.
457
+
458
+ Root cause: the document-level Enter handler ran exact-title lookup before the
459
+ open-menu selection. The query `code` exactly matched the adjacent registry
460
+ command titled `Code`, overriding the visibly selected ordinary `Code Block`.
461
+
462
+ Smallest repair: run exact-title fallback only when the slash menu is closed.
463
+ When it is open, Enter executes `filteredCommands[selectedIndex]`, the same
464
+ native item presented to the writer. Pointer behavior, registry behavior,
465
+ catalog composition, image insertion, Mermaid, and Code Block UX are unchanged.
466
+
467
+ Post-fix acceptance on Page `55gJt3h1I5WF`:
468
+
469
+ - Enter on `/code` created one native Code Block and removed the query.
470
+ - Pointer selection of `Code Block` created one second native Code Block.
471
+ - Typing and Tab remained responsive in both blocks.
472
+ - After reload, the interface contained `ENTER_MARKER_20260820TAB_OK` and
473
+ `POINTER_MARKER_20260820TAB_OK` in two code nodes.
474
+ - Canonical SQLite read-back contained exactly two fenced Code Blocks with the
475
+ same distinct markers and one intentional empty-block separator.
476
+ - The focused suite passed 32 of 32 tests, including the new visible-menu Enter
477
+ regression story; Content typecheck exited 0. Its production-config audit
478
+ reported the expected absent local production secrets and database URL.
479
+ - Changelog creation was attempted as required, but the Content app explicitly
480
+ reports that changelog support is disabled; no entry was created.
481
+
482
+ Resource cleanup: the browser tab and dev server were closed, port 4188 was
483
+ confirmed unbound, and `/tmp/content-codeblock-work-20260820` was moved to
484
+ `/Users/alicemoore/.Trash/content-codeblock-work-20260820`. No production,
485
+ customer, shared staging, Bowerbird row, or unrelated local data was mutated.
486
+
487
+ Independent technical review: not required. The final shipping delta is one
488
+ low-risk dispatch condition plus one focused regression test; it does not alter
489
+ persistence, collaboration, schema, authorization, or network behavior.
490
+
491
+ Work evidence: complete. Ledger revision:
492
+ `content-code-block-production-work-v1`. Task attention: `land-ready`.
@@ -0,0 +1,273 @@
1
+ # Ordinary Code Block surface contrast
2
+
3
+ ## Decision
4
+
5
+ Give ordinary native Code Blocks a quiet semantic surface that is visibly
6
+ distinct from the Page canvas in both light and dark themes. Reuse Content's
7
+ existing `--muted` theme token and restore the existing six-pixel radius and
8
+ block spacing directly on `pre.notion-code-block`.
9
+
10
+ This is a separate local refinement from the code-block insertion regression.
11
+ It must not delay, rewrite, or expand that repair, which remains committed at
12
+ `fbe8c9c9060944e3514fd1f2b1a43edc88115199` and land-ready.
13
+
14
+ ## Current truth
15
+
16
+ Direct source evidence:
17
+
18
+ - The Page canvas uses `--background`: white in light mode and 13% lightness in
19
+ dark mode.
20
+ - Content already defines `--muted`: 96% lightness in light mode and 16% in
21
+ dark mode.
22
+ - `.notion-code-block-wrapper` uses `background: hsl(var(--muted))`, a six-pixel
23
+ radius, and `0.6em` vertical margins.
24
+ - Ordinary Code Blocks now use Tiptap's native DOM renderer and carry the class
25
+ `notion-code-block`; they do not render the old wrapper.
26
+ - The shared `pre` rule explicitly gives `.notion-code-block` a transparent
27
+ background, zero radius, and zero margin. It therefore visually collapses
28
+ into the Page canvas.
29
+
30
+ Inference: the missing contrast is a styling seam left behind when ordinary
31
+ Code Blocks moved from the former wrapper/node view to Tiptap's native renderer.
32
+ No new Code Block product contract or color system is required.
33
+
34
+ ## Scope
35
+
36
+ Owned outcome: an ordinary native Code Block reads as a contained code surface
37
+ against the surrounding Page in light and dark themes while preserving current
38
+ source editing, syntax highlighting, selection, keyboard behavior, and
39
+ persistence.
40
+
41
+ Explicit exclusions:
42
+
43
+ - language controls, headers, tabs, execution, output, or other Code Block UX;
44
+ - Mermaid or registry-backed Code blocks;
45
+ - slash-command catalog or insertion behavior;
46
+ - syntax-highlight token redesign;
47
+ - Page, card, popover, sidebar, or global theme palette changes;
48
+ - image insertion or media styling.
49
+
50
+ ## Smallest compatible repair
51
+
52
+ Keep the shared typography and overflow rule. Add a native-block-specific rule
53
+ after it that applies:
54
+
55
+ - `background: hsl(var(--muted))`;
56
+ - `border-radius: 6px`;
57
+ - `margin: 0.6em 0`.
58
+
59
+ Do not add raw light/dark colors or a new token. The existing semantic token
60
+ already expresses the intended quiet secondary surface and automatically
61
+ tracks both themes.
62
+
63
+ ## Successful-user-story acceptance plan
64
+
65
+ Use the current task-owned local Content runtime or an equivalent disposable
66
+ runtime built from the exact Work artifact.
67
+
68
+ 1. Open an ordinary Page in light mode and insert a native Code Block.
69
+ 2. Confirm the block has a subtle non-white surface distinct from the Page,
70
+ with visible rounded bounds and normal vertical separation.
71
+ 3. Type representative plain and highlighted code; confirm text contrast,
72
+ syntax colors, caret, selection, horizontal overflow, and Tab remain usable.
73
+ 4. Switch to dark mode and confirm the same block has a subtle non-black/dark
74
+ canvas distinction without becoming a high-contrast black panel.
75
+ 5. Reload and confirm the Code Block source persists and the themed surface
76
+ returns.
77
+ 6. Confirm an ordinary paragraph, inline code, registry `Code`, and Mermaid
78
+ presentation are unchanged.
79
+ 7. Run formatter, Content typecheck, and the focused editor/style tests on the
80
+ exact review artifact.
81
+
82
+ Acceptance is human-facing and visual, so it uses a real interface with
83
+ preferred independence and same-context custody. Independent technical review
84
+ is not required for this bounded CSS-only refinement.
85
+
86
+ ## Lifecycle envelope
87
+
88
+ ```yaml
89
+ authoritySchemaVersion: 3
90
+ stage: shape
91
+ authority-source: "Alice: While at it, we should give the code block background a background that's different than the white of the page and the black of the page. $shape"
92
+ authorized-scope:
93
+ repositories:
94
+ - BuilderIO/agent-native
95
+ product-surfaces:
96
+ - Content ordinary native Code Block presentation
97
+ outcome: Give ordinary native Code Blocks a subtle theme-aware surface distinct from the Page canvas.
98
+ allowed-mutations:
99
+ - artifact-write
100
+ write-targets:
101
+ artifacts:
102
+ - templates/content/docs/solutions/2026-08-20-code-block-surface-background-shape.md
103
+ prototype-sandboxes: []
104
+ test-resources: []
105
+ governing-artifact:
106
+ path: templates/content/docs/solutions/2026-08-20-code-block-surface-background-shape.md
107
+ revision: content-code-block-surface-shape-v1
108
+ architecture-fingerprint:
109
+ outcome: Give ordinary native Code Blocks a subtle theme-aware surface distinct from the Page canvas.
110
+ shipping-surfaces:
111
+ - id: content-native-code-block-surface
112
+ repository: BuilderIO/agent-native
113
+ product-surface: Content visual Page editor ordinary native Code Block presentation
114
+ constituency: signed-in Content writers and readers
115
+ durable-destination: public Content template behavior in BuilderIO/agent-native
116
+ integration-action: merge
117
+ governing-architecture: Style the existing native Tiptap Code Block through Content's existing semantic theme tokens without adding a renderer, wrapper, block type, or palette.
118
+ acceptance-story:
119
+ id: content-native-code-block-surface-v1
120
+ summary: A writer sees the same ordinary Code Block as a quiet contained surface distinct from the Page in light and dark themes, with editing and persistence unchanged.
121
+ required-assertions:
122
+ - light mode Code Block surface is visibly distinct from the white Page canvas
123
+ - dark mode Code Block surface is visibly distinct from the dark Page canvas without becoming a black panel
124
+ - existing code text syntax highlighting caret selection overflow and Tab remain usable
125
+ - reload preserves source and restores the same theme-aware presentation
126
+ - paragraphs inline code registry Code Mermaid insertion and persistence behavior remain unchanged
127
+ - focused technical checks and exact-artifact real-interface acceptance pass
128
+ acceptance-policy:
129
+ modality: real-interface
130
+ independence: preferred
131
+ custody: same-context-allowed
132
+ interface: Disposable local Content Page built from the exact review artifact, exercised in light and dark themes.
133
+ rationale: The outcome is a bounded visual refinement whose success depends on rendered contrast in both themes; same-context real-interface judgment is proportionate.
134
+ risk-strategy:
135
+ kind: system-ready
136
+ production-validation-after-merge: false
137
+ architecture-grounding:
138
+ applicability: not-required
139
+ reason: Bounded local CSS refinement using an existing Content-owned class and existing semantic theme token; no shared contract, schema, renderer, identity, or persistence boundary changes.
140
+ status: grounded
141
+ demonstrated-callers:
142
+ - Signed-in Content writer or reader viewing an ordinary native Code Block in a Page.
143
+ existing-primitives:
144
+ - pre.notion-code-block from CodeBlockNode.tsx
145
+ - --background and --muted theme tokens in app/global.css
146
+ - existing wrapper radius and spacing treatment
147
+ ownership-boundaries:
148
+ - Content global editor CSS owns ordinary Code Block presentation
149
+ - Tiptap owns native Code Block structure and editing behavior
150
+ - Content theme tokens own light and dark surface values
151
+ legacy-contracts:
152
+ - portable fenced-code source and Lowlight syntax highlighting
153
+ - ordinary editor keyboard and persistence behavior
154
+ - registry Code Mermaid inline code and unrelated Page surfaces
155
+ shared-vocabulary:
156
+ - ordinary native Code Block means Tiptap codeBlock rendered as pre.notion-code-block
157
+ smallest-compatible-delta: Add one native-block-specific semantic background radius and margin rule after the shared pre typography rule.
158
+ deferred-capabilities:
159
+ - executable Code Block UX
160
+ - language headers and controls
161
+ - syntax palette redesign
162
+ - registry and Mermaid presentation
163
+ reversibility: One local CSS rule using existing tokens; removal restores the prior presentation with no data migration.
164
+ direct-evidence:
165
+ - repository revision fbe8c9c9060944e3514fd1f2b1a43edc88115199
166
+ - CodeBlockNode.tsx assigns notion-code-block to the native renderer
167
+ - global.css gives the old wrapper muted background but the native block transparent background
168
+ inferences:
169
+ - the contrast regression followed removal of the former React wrapper from the native renderer
170
+ unresolved-owner-questions: []
171
+ delegation-ceiling:
172
+ - artifact-write
173
+ product-boundary-gates:
174
+ agent-native-public-constituency: Any source-blind Content writer or reader benefits without Alice-private data credentials or orchestration; this belongs in the public Content template.
175
+ bowerbird-product-boundary: not-applicable
176
+ acceptance-state:
177
+ status: land-ready
178
+ summary: Work added the bounded semantic CSS rule and passed light/dark real-interface acceptance without changing adjacent Code Block behavior.
179
+ blockers: []
180
+ last-land-packet: null
181
+ ledger-revision: content-code-block-surface-shape-v1
182
+ status: work-complete
183
+ ```
184
+
185
+ ## Exact handoff
186
+
187
+ `/work templates/content/docs/solutions/2026-08-20-code-block-surface-background-shape.md`
188
+
189
+ Execution placement: local. The expected Work is one CSS rule, focused checks,
190
+ and light/dark browser acceptance; framework compute is unnecessary. The
191
+ currently running local server and Page remain available for Alice's manual
192
+ testing and were not mutated or stopped by Shape.
193
+
194
+ ## Work execution record
195
+
196
+ Work lane: `codex/code-block-surface-background` in
197
+ `/Users/alicemoore/.codex/worktrees/content-code-block-surface-background`,
198
+ refreshed from `origin/main` at
199
+ `8617890c4b9688ebcca5075efb74774f7ac39918` on 2026-08-20.
200
+
201
+ Acceptance reconciliation: consistent. Schema v3 freezes real-interface
202
+ acceptance, preferred independence, and same-context custody.
203
+
204
+ Work mutations are bounded to the CSS refinement, focused tests, this evidence
205
+ artifact, a local commit, and the following disposable test resource:
206
+
207
+ - resource id: `content-codeblock-surface-work-20260820`
208
+ - kind: local server, SQLite database, browser session, and task-created Page
209
+ - surface: `http://127.0.0.1:4189` backed by
210
+ `/tmp/content-codeblock-surface-work-20260820/content.db`
211
+ - ownership marker: Page title `Code Block Surface Acceptance 2026-08-20`
212
+ - baseline: port 4189 unbound and sandbox path absent before creation
213
+ - allowed actions: create, update, exercise, read back, reload, and delete
214
+ - cleanup trigger: after light/dark acceptance and evidence capture
215
+ - cleanup method: close the task browser tab, stop the server, confirm port
216
+ 4189 unbound, and move the exact sandbox to Trash
217
+ - cleanup proof: independent port and original-path absence checks
218
+ - shared impact: none
219
+ - isolation: local runtime
220
+ - ownership: task-created and task-exclusive
221
+ - production data: false
222
+ - customer data: false
223
+ - cost: none
224
+ - maximum lifetime: 240 minutes
225
+ - status: declared
226
+
227
+ ## Work evidence
228
+
229
+ Implementation:
230
+
231
+ - added one `.notion-editor .notion-code-block` rule using `hsl(var(--muted))`,
232
+ the existing 6px radius, and the existing `0.6em` vertical rhythm
233
+ - did not change the renderer, command transaction, persistence, registry Code,
234
+ Mermaid, inline code, syntax palette, or slash-command catalog
235
+
236
+ Exact real-interface acceptance on the task-created Content Page:
237
+
238
+ - light theme: block `rgb(245, 245, 245)` against Page
239
+ `rgb(255, 255, 255)`; text `rgb(38, 38, 38)`
240
+ - dark theme: block `rgb(41, 41, 41)` against Page `rgb(33, 33, 33)`;
241
+ text `rgb(230, 230, 230)`
242
+ - both themes: `6px` radius and `8.16px` top/bottom computed margins
243
+ - the persisted fenced source rendered through `pre.notion-code-block` as
244
+ `const greeting = "hello";// `
245
+
246
+ Technical checks:
247
+
248
+ - `oxfmt` passed for the modified CSS and this artifact
249
+ - `git diff --check` passed
250
+ - focused editor suite passed: 31/31 tests in
251
+ `SlashCommandMenu.test.ts`
252
+ - repository typecheck exited 0; it also printed the expected local-production
253
+ warnings for absent `BETTER_AUTH_SECRET` and persistent database URL
254
+ - changelog command was attempted and reported that changelogs are disabled in
255
+ the Content app configuration; no changelog file was created
256
+
257
+ Framework compute preflight could not reach the configured framework host
258
+ (Tailscale stopped and the host did not resolve), so the proportionate checks
259
+ ran locally on the actual execution host. This visual-only delta does not rely
260
+ on remote-host behavior.
261
+
262
+ Cleanup completed: the task browser tab was closed, the port-4189 server was
263
+ stopped, port 4189 was confirmed unbound, the original sandbox path was
264
+ confirmed absent, and the exact sandbox was moved to
265
+ `/Users/alicemoore/.Trash/content-codeblock-surface-work-20260820`. The fixture
266
+ is recoverable from Trash. The separate port-4188 insertion-test server and its
267
+ fixture were not touched.
268
+
269
+ Acceptance result: successful-user-story schema v3 is satisfied in the same
270
+ context allowed by the frozen custody policy. Independent human review remains
271
+ preferred but is not a completion gate for this bounded visual refinement.
272
+
273
+ ledger-revision: content-code-block-surface-work-v1
@@ -1389,7 +1389,7 @@ async function getHandler() {
1389
1389
  headers: {
1390
1390
  "Access-Control-Allow-Origin": "*",
1391
1391
  "Access-Control-Allow-Methods": "GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS",
1392
- "Access-Control-Allow-Headers": "Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-User-Timezone,X-Agent-Native-Session-Id,X-Agent-Native-Client-Platform,X-Agent-Native-Tool-Bridge,X-Agent-Native-Tool-Id,X-Agent-Native-Frontend,X-Agent-Native-Client-Compatibility,X-Agent-Native-Build-Id,X-Agent-Native-Embed-Target",
1392
+ "Access-Control-Allow-Headers": "Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-User-Timezone,X-Agent-Native-Session-Id,X-Agent-Native-Client-Platform,X-Agent-Native-Desktop-Verifier,X-Agent-Native-Tool-Bridge,X-Agent-Native-Tool-Id,X-Agent-Native-Frontend,X-Agent-Native-Client-Compatibility,X-Agent-Native-Build-Id,X-Agent-Native-Embed-Target",
1393
1393
  },
1394
1394
  });
1395
1395
  }
@@ -1,4 +1,4 @@
1
- export declare const MCP_EMBED_CORS_ALLOW_HEADERS = "Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-Agent-Native-Frontend,X-Agent-Native-Client-Compatibility,X-Agent-Native-Build-Id,X-User-Timezone,X-Agent-Native-Session-Id,X-Agent-Native-Client-Platform,X-Agent-Native-Embed-Target,X-Agent-Native-Embed-Transplant";
1
+ export declare const MCP_EMBED_CORS_ALLOW_HEADERS = "Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-Agent-Native-Frontend,X-Agent-Native-Client-Compatibility,X-Agent-Native-Build-Id,X-User-Timezone,X-Agent-Native-Session-Id,X-Agent-Native-Client-Platform,X-Agent-Native-Desktop-Verifier,X-Agent-Native-Embed-Target,X-Agent-Native-Embed-Transplant";
2
2
  export declare const EMBED_TRANSPLANT_HEADER = "x-agent-native-embed-transplant";
3
3
  export declare function isLocalMcpEmbedOrigin(origin: string | null | undefined): boolean;
4
4
  export declare function isClaudeMcpContentOrigin(origin: string | null | undefined): boolean;
@@ -1,4 +1,4 @@
1
- export const MCP_EMBED_CORS_ALLOW_HEADERS = "Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-Agent-Native-Frontend,X-Agent-Native-Client-Compatibility,X-Agent-Native-Build-Id,X-User-Timezone,X-Agent-Native-Session-Id,X-Agent-Native-Client-Platform,X-Agent-Native-Embed-Target,X-Agent-Native-Embed-Transplant";
1
+ export const MCP_EMBED_CORS_ALLOW_HEADERS = "Content-Type,Authorization,X-Requested-With,X-Request-Source,X-Agent-Native-CSRF,X-Agent-Native-Frontend,X-Agent-Native-Client-Compatibility,X-Agent-Native-Build-Id,X-User-Timezone,X-Agent-Native-Session-Id,X-Agent-Native-Client-Platform,X-Agent-Native-Desktop-Verifier,X-Agent-Native-Embed-Target,X-Agent-Native-Embed-Transplant";
2
2
  export const EMBED_TRANSPLANT_HEADER = "x-agent-native-embed-transplant";
3
3
  const CLAUDE_MCP_CONTENT_HOST_RE = /^[a-f0-9]{32}\.claudemcpcontent\.com$/i;
4
4
  const CHATGPT_MCP_SANDBOX_HOST_RE = /^(?:[^.]+\.)?web-sandbox\.oaiusercontent\.com$/i;
@@ -128,8 +128,15 @@ export function shouldAllowMcpEmbedCredentials(origin) {
128
128
  // Builder, localhost, and arbitrary origins use bearer/embed credentials;
129
129
  // only the configured browser allowlist and the framework's exact native
130
130
  // app origins may receive cookies.
131
- return (TRUSTED_NATIVE_APP_ORIGIN_RE.test(origin) ||
132
- isExplicitCorsAllowedOrigin(origin));
131
+ if (TRUSTED_NATIVE_APP_ORIGIN_RE.test(origin) ||
132
+ isExplicitCorsAllowedOrigin(origin)) {
133
+ return true;
134
+ }
135
+ // Dev only: the desktop renderer runs on its own localhost port
136
+ // (http://localhost:1420 for Tauri) and calls the dev server with
137
+ // `credentials: "include"`. Production keeps the rule above — a deployed
138
+ // app must never hand cookies to an arbitrary process on the user's machine.
139
+ return (process.env.NODE_ENV === "development" && isLocalMcpEmbedOrigin(origin));
133
140
  }
134
141
  // These paths are served straight off the CDN, so the security-headers h3
135
142
  // middleware never runs for them — anything it sets that must also hold for
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-native/core",
3
- "version": "0.168.9",
3
+ "version": "0.168.10",
4
4
  "description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
5
5
  "homepage": "https://github.com/BuilderIO/agent-native#readme",
6
6
  "bugs": {