@aparte/core 0.32.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/README.md +30 -19
  2. package/dist/client/agent-runner.d.ts.map +1 -1
  3. package/dist/components/bubble/aparte-chat-bubble.d.ts +33 -0
  4. package/dist/components/bubble/aparte-chat-bubble.d.ts.map +1 -1
  5. package/dist/components/bubble/bubble-sync.d.ts.map +1 -1
  6. package/dist/components/context/aparte-context.d.ts +4 -11
  7. package/dist/components/context/aparte-context.d.ts.map +1 -1
  8. package/dist/components/launcher/aparte-launcher.d.ts.map +1 -1
  9. package/dist/components/scroll-rail/aparte-scroll-rail.d.ts +77 -5
  10. package/dist/components/scroll-rail/aparte-scroll-rail.d.ts.map +1 -1
  11. package/dist/components/sidebar/aparte-sidebar.d.ts.map +1 -1
  12. package/dist/components/split/aparte-split.d.ts.map +1 -1
  13. package/dist/components/suggestions/aparte-suggestions.d.ts +15 -1
  14. package/dist/components/suggestions/aparte-suggestions.d.ts.map +1 -1
  15. package/dist/components/suggestions/suggestion-blocks.d.ts +21 -1
  16. package/dist/components/suggestions/suggestion-blocks.d.ts.map +1 -1
  17. package/dist/components/viewport/aparte-chat-viewport.d.ts +2 -5
  18. package/dist/components/viewport/aparte-chat-viewport.d.ts.map +1 -1
  19. package/dist/config/aparte-config.d.ts +56 -4
  20. package/dist/config/aparte-config.d.ts.map +1 -1
  21. package/dist/config/config-context.d.ts.map +1 -1
  22. package/dist/config/image-policy.d.ts +104 -0
  23. package/dist/config/image-policy.d.ts.map +1 -0
  24. package/dist/config/index.d.ts +1 -0
  25. package/dist/config/index.d.ts.map +1 -1
  26. package/dist/config/locale.d.ts +8 -10
  27. package/dist/config/locale.d.ts.map +1 -1
  28. package/dist/config/sanitize.d.ts +36 -0
  29. package/dist/config/sanitize.d.ts.map +1 -1
  30. package/dist/custom-elements.json +1226 -82
  31. package/dist/{defer-hydration-DQKULLmH.js → defer-hydration-_SZv5PeY.js} +827 -65
  32. package/dist/defer-hydration-_SZv5PeY.js.map +1 -0
  33. package/dist/generated/element-attributes.d.ts +1 -3
  34. package/dist/generated/element-attributes.d.ts.map +1 -1
  35. package/dist/index.css +1 -1
  36. package/dist/index.d.ts +2 -2
  37. package/dist/index.d.ts.map +1 -1
  38. package/dist/index.js +497 -124
  39. package/dist/index.js.map +1 -1
  40. package/dist/index.node.d.ts +2 -2
  41. package/dist/index.node.d.ts.map +1 -1
  42. package/dist/index.node.js +1 -1
  43. package/dist/index.node.js.map +1 -1
  44. package/dist/interop/dialog-triggers.d.ts.map +1 -1
  45. package/dist/interop/image-holds.d.ts +20 -0
  46. package/dist/interop/image-holds.d.ts.map +1 -0
  47. package/dist/renderers/segments/text.d.ts.map +1 -1
  48. package/dist/renderers/segments/thinking.d.ts.map +1 -1
  49. package/dist/transport/agent-handler.d.ts +10 -0
  50. package/dist/transport/agent-handler.d.ts.map +1 -1
  51. package/dist/transport/agent-ticket.d.ts.map +1 -1
  52. package/dist/transport/backend-handler.d.ts +8 -0
  53. package/dist/transport/backend-handler.d.ts.map +1 -1
  54. package/dist/transport/backend-transport.d.ts.map +1 -1
  55. package/dist/transport/json-headers.d.ts +10 -0
  56. package/dist/transport/json-headers.d.ts.map +1 -0
  57. package/dist/transport/request-guard.d.ts +14 -0
  58. package/dist/transport/request-guard.d.ts.map +1 -0
  59. package/dist/types/events.d.ts +6 -13
  60. package/dist/types/events.d.ts.map +1 -1
  61. package/dist/types/index.d.ts +1 -1
  62. package/dist/types/index.d.ts.map +1 -1
  63. package/dist/types/models.d.ts +0 -34
  64. package/dist/types/models.d.ts.map +1 -1
  65. package/dist/types/segments.d.ts +0 -11
  66. package/dist/types/segments.d.ts.map +1 -1
  67. package/dist/utils/rendered-content.d.ts +3 -0
  68. package/dist/utils/rendered-content.d.ts.map +1 -0
  69. package/llms.txt +13 -0
  70. package/package.json +11 -4
  71. package/dist/defer-hydration-DQKULLmH.js.map +0 -1
@@ -161,14 +161,6 @@
161
161
  "module": "./types/index.js"
162
162
  }
163
163
  },
164
- {
165
- "kind": "js",
166
- "name": "AparteMessageBranch",
167
- "declaration": {
168
- "name": "AparteMessageBranch",
169
- "module": "./types/index.js"
170
- }
171
- },
172
164
  {
173
165
  "kind": "js",
174
166
  "name": "AparteBubbleActionsConfig",
@@ -2217,6 +2209,22 @@
2217
2209
  "module": "./config/index.js"
2218
2210
  }
2219
2211
  },
2212
+ {
2213
+ "kind": "js",
2214
+ "name": "AparteImageDecision",
2215
+ "declaration": {
2216
+ "name": "AparteImageDecision",
2217
+ "module": "./config/index.js"
2218
+ }
2219
+ },
2220
+ {
2221
+ "kind": "js",
2222
+ "name": "AparteImagePolicy",
2223
+ "declaration": {
2224
+ "name": "AparteImagePolicy",
2225
+ "module": "./config/index.js"
2226
+ }
2227
+ },
2220
2228
  {
2221
2229
  "kind": "js",
2222
2230
  "name": "APARTE_DEFAULT_ICON_FALLBACKS",
@@ -2923,14 +2931,6 @@
2923
2931
  "module": "./types/index.js"
2924
2932
  }
2925
2933
  },
2926
- {
2927
- "kind": "js",
2928
- "name": "AparteMessageBranch",
2929
- "declaration": {
2930
- "name": "AparteMessageBranch",
2931
- "module": "./types/index.js"
2932
- }
2933
- },
2934
2934
  {
2935
2935
  "kind": "js",
2936
2936
  "name": "AparteBubbleActionsConfig",
@@ -4795,6 +4795,22 @@
4795
4795
  "module": "./config/index.js"
4796
4796
  }
4797
4797
  },
4798
+ {
4799
+ "kind": "js",
4800
+ "name": "AparteImageDecision",
4801
+ "declaration": {
4802
+ "name": "AparteImageDecision",
4803
+ "module": "./config/index.js"
4804
+ }
4805
+ },
4806
+ {
4807
+ "kind": "js",
4808
+ "name": "AparteImagePolicy",
4809
+ "declaration": {
4810
+ "name": "AparteImagePolicy",
4811
+ "module": "./config/index.js"
4812
+ }
4813
+ },
4798
4814
  {
4799
4815
  "kind": "js",
4800
4816
  "name": "APARTE_DEFAULT_ICON_FALLBACKS",
@@ -7604,6 +7620,33 @@
7604
7620
  "privacy": "private",
7605
7621
  "default": "defaultSanitizer"
7606
7622
  },
7623
+ {
7624
+ "kind": "field",
7625
+ "name": "_imagePolicy",
7626
+ "type": {
7627
+ "text": "AparteImagePolicy"
7628
+ },
7629
+ "privacy": "private",
7630
+ "default": "[]"
7631
+ },
7632
+ {
7633
+ "kind": "field",
7634
+ "name": "_imageDecider",
7635
+ "type": {
7636
+ "text": "ImageDecider"
7637
+ },
7638
+ "privacy": "private"
7639
+ },
7640
+ {
7641
+ "kind": "field",
7642
+ "name": "_imagePolicyNamed",
7643
+ "type": {
7644
+ "text": "boolean"
7645
+ },
7646
+ "privacy": "private",
7647
+ "default": "false",
7648
+ "description": "Whether the app named an image policy, the default included; see `decideImage`."
7649
+ },
7607
7650
  {
7608
7651
  "kind": "field",
7609
7652
  "name": "_systemPromptTemplate",
@@ -8234,7 +8277,95 @@
8234
8277
  }
8235
8278
  }
8236
8279
  ],
8237
- "description": "Run the active sanitizer over provider-produced HTML. Public so a\nstreaming-markdown provider (which appends DOM directly, bypassing\n`renderMarkdown`) can apply the same policy. Returns the input unchanged\nonly when sanitization was disabled via `setHtmlSanitizer(null)`."
8280
+ "description": "Run the active sanitizer over provider-produced HTML, then the image policy\n(AparteConfig.setImagePolicy| setImagePolicy): a picture the policy does not let\nload comes back as a link that loads it on a click. Public so a streaming-markdown\nprovider (which appends DOM directly, bypassing `renderMarkdown`) can apply the same\nrules. The image policy runs whichever sanitizer is set, none included, so replacing it\ndoes not turn a reply's pictures back into requests the reader never made."
8281
+ },
8282
+ {
8283
+ "kind": "method",
8284
+ "name": "setImagePolicy",
8285
+ "return": {
8286
+ "type": {
8287
+ "text": "void"
8288
+ }
8289
+ },
8290
+ "parameters": [
8291
+ {
8292
+ "name": "policy",
8293
+ "type": {
8294
+ "text": "AparteImagePolicy"
8295
+ }
8296
+ }
8297
+ ],
8298
+ "description": "Which pictures a model or a tool chose load before the reader asks — in a reply's\nMarkdown, in a card, in a tool's details. By default only `data:` and `blob:` pictures,\nwhich make no request: any other is held, drawn as a small link that says where it would\nload from, and loads in place when the reader clicks it.\n\nThe reason is that a picture fetches its address the moment it is shown, and a\nprompt-injected model can write the conversation into that address. Name what you trust:\n\n- a list — `'self'` for the page's own origin, an origin (`'https://cdn.example.com'`),\n or `'*'` for every picture;\n- a function, which gets the picture's address (resolved against the page) and answers\n `'load'`, `'hold'` or `'drop'`.\n\nEvery picture that loads goes with `referrerpolicy=\"no-referrer\"`. What is on screen is\ndrawn again under the new policy. A CSP `img-src` is the stronger rule beside this one:\nit also checks where a redirect leads, which no script on the page can see.",
8299
+ "examples": [
8300
+ "aparteGlobalConfig.setImagePolicy(['self', 'https://cdn.example.com']);",
8301
+ "aparteGlobalConfig.setImagePolicy((url) => url.startsWith('https://images.example.com/') ? 'load' : 'hold');"
8302
+ ]
8303
+ },
8304
+ {
8305
+ "kind": "method",
8306
+ "name": "decideImage",
8307
+ "return": {
8308
+ "type": {
8309
+ "text": "AparteImageDecision"
8310
+ }
8311
+ },
8312
+ "parameters": [
8313
+ {
8314
+ "name": "url",
8315
+ "type": {
8316
+ "text": "string"
8317
+ }
8318
+ }
8319
+ ],
8320
+ "description": "What the picture at `url` does under this config's image policy: `'load'`, `'hold'`\n(shown as a link that loads it on a click) or `'drop'`. For a plugin that draws pictures\nitself, as `@aparte/plugin-cards` does: ask before setting a `src`, because setting it is\nthe request."
8321
+ },
8322
+ {
8323
+ "kind": "method",
8324
+ "name": "_noteHeldImage",
8325
+ "privacy": "private",
8326
+ "return": {
8327
+ "type": {
8328
+ "text": "void"
8329
+ }
8330
+ },
8331
+ "parameters": [
8332
+ {
8333
+ "name": "url",
8334
+ "type": {
8335
+ "text": "string"
8336
+ }
8337
+ }
8338
+ ],
8339
+ "description": "The first picture the default policy holds, said once to the developer. A picture that\nwaits for a click with nothing in the console reads as a broken image to whoever wrote\nthe app, and the line that changes it cannot be guessed. Silent once the app names a\npolicy, whatever it is: `setImagePolicy([])` keeps the default and the silence."
8340
+ },
8341
+ {
8342
+ "kind": "method",
8343
+ "name": "showImage",
8344
+ "return": {
8345
+ "type": {
8346
+ "text": "void"
8347
+ }
8348
+ },
8349
+ "parameters": [
8350
+ {
8351
+ "name": "url",
8352
+ "type": {
8353
+ "text": "string"
8354
+ }
8355
+ }
8356
+ ],
8357
+ "description": "The reader chose to see the picture at `url`: from now on it loads wherever this\nconfig's image policy would only have held it (a picture the policy drops stays\ndropped). Core calls it when a held picture's link is clicked; a plugin calls it from\nits own \"Show images\", then draws again. Nothing on screen is redrawn by this call."
8358
+ },
8359
+ {
8360
+ "kind": "method",
8361
+ "name": "_heldImageWords",
8362
+ "privacy": "private",
8363
+ "return": {
8364
+ "type": {
8365
+ "text": "HeldImageWords"
8366
+ }
8367
+ },
8368
+ "description": "What a held picture says, in this config's language."
8238
8369
  },
8239
8370
  {
8240
8371
  "kind": "method",
@@ -10204,6 +10335,417 @@
10204
10335
  }
10205
10336
  ]
10206
10337
  },
10338
+ {
10339
+ "kind": "javascript-module",
10340
+ "path": "src/config/image-policy.ts",
10341
+ "declarations": [
10342
+ {
10343
+ "kind": "function",
10344
+ "name": "resolveImageAddress",
10345
+ "return": {
10346
+ "type": {
10347
+ "text": "URL | null"
10348
+ }
10349
+ },
10350
+ "parameters": [
10351
+ {
10352
+ "name": "address",
10353
+ "type": {
10354
+ "text": "string"
10355
+ }
10356
+ }
10357
+ ],
10358
+ "description": "An address resolved the way the browser will resolve it, or `null` when it cannot be: a\nrelative one where there is no page to resolve it against (a server render), or no address."
10359
+ },
10360
+ {
10361
+ "kind": "function",
10362
+ "name": "sameImagePolicy",
10363
+ "return": {
10364
+ "type": {
10365
+ "text": "boolean"
10366
+ }
10367
+ },
10368
+ "parameters": [
10369
+ {
10370
+ "name": "a",
10371
+ "type": {
10372
+ "text": "AparteImagePolicy"
10373
+ }
10374
+ },
10375
+ {
10376
+ "name": "b",
10377
+ "type": {
10378
+ "text": "AparteImagePolicy"
10379
+ }
10380
+ }
10381
+ ],
10382
+ "description": "Whether two policies say the same thing: the same function, or lists with the same entries."
10383
+ },
10384
+ {
10385
+ "kind": "function",
10386
+ "name": "compileImagePolicy",
10387
+ "return": {
10388
+ "type": {
10389
+ "text": "ImageDecider"
10390
+ }
10391
+ },
10392
+ "parameters": [
10393
+ {
10394
+ "name": "policy",
10395
+ "type": {
10396
+ "text": "AparteImagePolicy"
10397
+ }
10398
+ }
10399
+ ],
10400
+ "description": "Turn a policy into the function every decision runs through."
10401
+ },
10402
+ {
10403
+ "kind": "function",
10404
+ "name": "decideImageAddress",
10405
+ "return": {
10406
+ "type": {
10407
+ "text": "AparteImageDecision"
10408
+ }
10409
+ },
10410
+ "parameters": [
10411
+ {
10412
+ "name": "decide",
10413
+ "type": {
10414
+ "text": "ImageDecider"
10415
+ }
10416
+ },
10417
+ {
10418
+ "name": "address",
10419
+ "type": {
10420
+ "text": "string"
10421
+ }
10422
+ },
10423
+ {
10424
+ "name": "shown",
10425
+ "optional": true,
10426
+ "type": {
10427
+ "text": "ReadonlySet<string>"
10428
+ }
10429
+ }
10430
+ ],
10431
+ "description": "What the picture at `address` does. `data:` and `blob:` load, an address that is no web\naddress (`ftp:`, `mailto:`) goes, and the policy decides the rest — except that a picture the\nreader already chose to see (`shown`) loads when the policy would only have held it."
10432
+ },
10433
+ {
10434
+ "kind": "function",
10435
+ "name": "rememberShownImage",
10436
+ "return": {
10437
+ "type": {
10438
+ "text": "void"
10439
+ }
10440
+ },
10441
+ "parameters": [
10442
+ {
10443
+ "name": "owner",
10444
+ "type": {
10445
+ "text": "object"
10446
+ }
10447
+ },
10448
+ {
10449
+ "name": "address",
10450
+ "type": {
10451
+ "text": "string"
10452
+ }
10453
+ }
10454
+ ],
10455
+ "description": "Remember that the reader chose to see the picture at `address`, under `owner` (a config)."
10456
+ },
10457
+ {
10458
+ "kind": "function",
10459
+ "name": "shownImagesOf",
10460
+ "return": {
10461
+ "type": {
10462
+ "text": "ReadonlySet<string> | undefined"
10463
+ }
10464
+ },
10465
+ "parameters": [
10466
+ {
10467
+ "name": "owner",
10468
+ "type": {
10469
+ "text": "object"
10470
+ }
10471
+ }
10472
+ ],
10473
+ "description": "The pictures the reader chose to see under `owner`."
10474
+ },
10475
+ {
10476
+ "kind": "function",
10477
+ "name": "forgetShownImages",
10478
+ "return": {
10479
+ "type": {
10480
+ "text": "void"
10481
+ }
10482
+ },
10483
+ "parameters": [
10484
+ {
10485
+ "name": "owner",
10486
+ "type": {
10487
+ "text": "object"
10488
+ }
10489
+ }
10490
+ ],
10491
+ "description": "Forget them: a reset config starts from what its policy says."
10492
+ },
10493
+ {
10494
+ "kind": "function",
10495
+ "name": "parseSrcset",
10496
+ "return": {
10497
+ "type": {
10498
+ "text": "SrcsetCandidate[]"
10499
+ }
10500
+ },
10501
+ "parameters": [
10502
+ {
10503
+ "name": "value",
10504
+ "type": {
10505
+ "text": "string"
10506
+ }
10507
+ }
10508
+ ],
10509
+ "description": "A `srcset`, read as the HTML Standard's \"parse a srcset attribute\" reads it — in the details a\ndifference would turn into a request. Only ASCII whitespace separates: a JavaScript `\\s` also\nsplits on U+00A0 and U+FEFF, which a browser keeps inside an address (`&nbsp;data:…/../api/logout`\nis a path on the page's own site to it). An address runs to the next such space, so a `data:`\nURL keeps its commas; trailing commas end a candidate; a descriptor's parentheses do not nest\n(`1x ((), https://…` is two candidates to a browser, not one).\n\nA candidate with descriptors this does not know is left out. That is safe in one direction\nonly, and it is the direction the pass relies on: what reaches the page is never the model's\n`srcset` but one written again from these candidates (`writeSrcset`), so a browser can only\npick an address that was judged."
10510
+ },
10511
+ {
10512
+ "kind": "function",
10513
+ "name": "srcsetUrls",
10514
+ "return": {
10515
+ "type": {
10516
+ "text": "string[]"
10517
+ }
10518
+ },
10519
+ "parameters": [
10520
+ {
10521
+ "name": "value",
10522
+ "type": {
10523
+ "text": "string"
10524
+ }
10525
+ }
10526
+ ],
10527
+ "description": "The addresses a `srcset` lists, as `parseSrcset` reads them."
10528
+ },
10529
+ {
10530
+ "kind": "function",
10531
+ "name": "imageHost",
10532
+ "return": {
10533
+ "type": {
10534
+ "text": "string"
10535
+ }
10536
+ },
10537
+ "parameters": [
10538
+ {
10539
+ "name": "address",
10540
+ "type": {
10541
+ "text": "string"
10542
+ }
10543
+ }
10544
+ ],
10545
+ "description": "Where a held picture would load from, as the reader is shown it: the host, exactly — a\nlook-alike name is the reason to show it, which is also why its end, the part a reader\njudges by, is never cut (the chip wraps it) — and, for an address that resolves to no host\n(a relative one on a server), the address itself, cut short."
10546
+ },
10547
+ {
10548
+ "kind": "function",
10549
+ "name": "heldImageHtml",
10550
+ "return": {
10551
+ "type": {
10552
+ "text": "string"
10553
+ }
10554
+ },
10555
+ "parameters": [
10556
+ {
10557
+ "name": "address",
10558
+ "type": {
10559
+ "text": "string"
10560
+ }
10561
+ },
10562
+ {
10563
+ "name": "alt",
10564
+ "type": {
10565
+ "text": "string"
10566
+ }
10567
+ },
10568
+ {
10569
+ "name": "words",
10570
+ "type": {
10571
+ "text": "HeldImageWords"
10572
+ }
10573
+ },
10574
+ {
10575
+ "name": "inLink",
10576
+ "default": "false"
10577
+ }
10578
+ ],
10579
+ "description": "A held picture: a link to it that wears the tag recipe, names where it would load from, and\ncarries what it holds in two attributes, so a later pass can draw it again from them alone.\nWithout script it opens the picture in a new tab; with core's listener it loads in place.\n\nInside a link (`[![build](badge.svg)](https://ci…)`) it is a `<span role=\"button\">` instead: a\nlink inside a link is taken apart by the HTML parser, which would leave the reply's own link\nempty and the picture outside it."
10580
+ },
10581
+ {
10582
+ "kind": "function",
10583
+ "name": "applyImagePolicy",
10584
+ "return": {
10585
+ "type": {
10586
+ "text": "string"
10587
+ }
10588
+ },
10589
+ "parameters": [
10590
+ {
10591
+ "name": "html",
10592
+ "type": {
10593
+ "text": "string"
10594
+ }
10595
+ },
10596
+ {
10597
+ "name": "decide",
10598
+ "type": {
10599
+ "text": "(address: string) => AparteImageDecision"
10600
+ }
10601
+ },
10602
+ {
10603
+ "name": "words",
10604
+ "type": {
10605
+ "text": "() => HeldImageWords"
10606
+ }
10607
+ }
10608
+ ],
10609
+ "description": "Apply the policy to sanitized HTML. A picture's own address — its `src`, else its first\n`srcset` one — decides what it does: it loads, it is held (drawn as `heldImageHtml`), or it\ngoes. One that loads gains `referrerpolicy=\"no-referrer\"` and keeps, of its `srcset`, only the\ncandidates that load, written again (`writeSrcset`) so the browser picks among exactly what was\njudged; a `<source>` keeps its loading candidates the same way, or goes. A held picture already\nin the HTML is drawn again from what it carries, so running the pass twice gives what running\nit once gave, and a picture the reader chose to see stays shown however it was written.\n\nIn a browser it walks an inert `<template>`, where nothing it touches is fetched; without a\nDOM it reads the tags the way the sanitizer's own DOM-free path does."
10610
+ },
10611
+ {
10612
+ "kind": "function",
10613
+ "name": "applyImagePolicyWithoutDom",
10614
+ "return": {
10615
+ "type": {
10616
+ "text": "string"
10617
+ }
10618
+ },
10619
+ "parameters": [
10620
+ {
10621
+ "name": "html",
10622
+ "type": {
10623
+ "text": "string"
10624
+ }
10625
+ },
10626
+ {
10627
+ "name": "decide",
10628
+ "type": {
10629
+ "text": "(address: string) => AparteImageDecision"
10630
+ }
10631
+ },
10632
+ {
10633
+ "name": "words",
10634
+ "type": {
10635
+ "text": "() => HeldImageWords"
10636
+ }
10637
+ }
10638
+ ],
10639
+ "description": "The same pass for a runtime with no DOM (a server render, a Worker). Like the sanitizer's\nDOM-free path it is a safety net, not a parser: it reads tags with the sanitizer's own\nreader, leaves comments and raw-text elements alone, and writes back only what it changed.\nExported for the parity suite; not from the package barrel."
10640
+ }
10641
+ ],
10642
+ "exports": [
10643
+ {
10644
+ "kind": "js",
10645
+ "name": "resolveImageAddress",
10646
+ "declaration": {
10647
+ "name": "resolveImageAddress",
10648
+ "module": "src/config/image-policy.ts"
10649
+ }
10650
+ },
10651
+ {
10652
+ "kind": "js",
10653
+ "name": "sameImagePolicy",
10654
+ "declaration": {
10655
+ "name": "sameImagePolicy",
10656
+ "module": "src/config/image-policy.ts"
10657
+ }
10658
+ },
10659
+ {
10660
+ "kind": "js",
10661
+ "name": "compileImagePolicy",
10662
+ "declaration": {
10663
+ "name": "compileImagePolicy",
10664
+ "module": "src/config/image-policy.ts"
10665
+ }
10666
+ },
10667
+ {
10668
+ "kind": "js",
10669
+ "name": "decideImageAddress",
10670
+ "declaration": {
10671
+ "name": "decideImageAddress",
10672
+ "module": "src/config/image-policy.ts"
10673
+ }
10674
+ },
10675
+ {
10676
+ "kind": "js",
10677
+ "name": "rememberShownImage",
10678
+ "declaration": {
10679
+ "name": "rememberShownImage",
10680
+ "module": "src/config/image-policy.ts"
10681
+ }
10682
+ },
10683
+ {
10684
+ "kind": "js",
10685
+ "name": "shownImagesOf",
10686
+ "declaration": {
10687
+ "name": "shownImagesOf",
10688
+ "module": "src/config/image-policy.ts"
10689
+ }
10690
+ },
10691
+ {
10692
+ "kind": "js",
10693
+ "name": "forgetShownImages",
10694
+ "declaration": {
10695
+ "name": "forgetShownImages",
10696
+ "module": "src/config/image-policy.ts"
10697
+ }
10698
+ },
10699
+ {
10700
+ "kind": "js",
10701
+ "name": "parseSrcset",
10702
+ "declaration": {
10703
+ "name": "parseSrcset",
10704
+ "module": "src/config/image-policy.ts"
10705
+ }
10706
+ },
10707
+ {
10708
+ "kind": "js",
10709
+ "name": "srcsetUrls",
10710
+ "declaration": {
10711
+ "name": "srcsetUrls",
10712
+ "module": "src/config/image-policy.ts"
10713
+ }
10714
+ },
10715
+ {
10716
+ "kind": "js",
10717
+ "name": "imageHost",
10718
+ "declaration": {
10719
+ "name": "imageHost",
10720
+ "module": "src/config/image-policy.ts"
10721
+ }
10722
+ },
10723
+ {
10724
+ "kind": "js",
10725
+ "name": "heldImageHtml",
10726
+ "declaration": {
10727
+ "name": "heldImageHtml",
10728
+ "module": "src/config/image-policy.ts"
10729
+ }
10730
+ },
10731
+ {
10732
+ "kind": "js",
10733
+ "name": "applyImagePolicy",
10734
+ "declaration": {
10735
+ "name": "applyImagePolicy",
10736
+ "module": "src/config/image-policy.ts"
10737
+ }
10738
+ },
10739
+ {
10740
+ "kind": "js",
10741
+ "name": "applyImagePolicyWithoutDom",
10742
+ "declaration": {
10743
+ "name": "applyImagePolicyWithoutDom",
10744
+ "module": "src/config/image-policy.ts"
10745
+ }
10746
+ }
10747
+ ]
10748
+ },
10207
10749
  {
10208
10750
  "kind": "javascript-module",
10209
10751
  "path": "src/config/index.ts",
@@ -10401,6 +10943,22 @@
10401
10943
  "module": "./sanitize.js"
10402
10944
  }
10403
10945
  },
10946
+ {
10947
+ "kind": "js",
10948
+ "name": "AparteImageDecision",
10949
+ "declaration": {
10950
+ "name": "AparteImageDecision",
10951
+ "module": "./image-policy.js"
10952
+ }
10953
+ },
10954
+ {
10955
+ "kind": "js",
10956
+ "name": "AparteImagePolicy",
10957
+ "declaration": {
10958
+ "name": "AparteImagePolicy",
10959
+ "module": "./image-policy.js"
10960
+ }
10961
+ },
10404
10962
  {
10405
10963
  "kind": "js",
10406
10964
  "name": "defaultSanitizer",
@@ -10573,7 +11131,7 @@
10573
11131
  "type": {
10574
11132
  "text": "AparteLocale"
10575
11133
  },
10576
- "default": "{ inputPlaceholder: \"Type a message...\", sendButton: \"Send\", copy: \"Copy\", copied: \"Copied!\", retry: \"Retry\", thinking: \"Thinking\", elicitationOther: \"Other…\", elicitationOtherPlaceholder: \"Type your answer…\", elicitationOtherLabel: \"Custom answer\", submitButton: \"Submit\", stopButton: \"Stop\", elicitationRecommended: \"Recommended\", elicitationSkip: \"Skip\", elicitationHide: \"Hide for now\", elicitationWaiting: \"Waiting for your answer\", elicitationYes: \"Yes\", elicitationNo: \"No\", elicitationAnswerLabel: \"Your answer\", approvalInstructionPlaceholder: \"Or tell it what to do instead…\", approvalAsk: \"Allow {tool}?\", approvalWaiting: \"Waiting\", scrollToBottom: \"Scroll to bottom\", suggestionsLabel: \"Suggested prompts\", contextLabel: \"Context window\", contextSystem: \"System prompt\", contextTools: \"Tools\", contextSummary: \"Summary\", contextMessages: \"Messages\", contextOther: \"Other\", contextFree: \"Free\", contextTotal: \"Total\", contextReclaim: \"Compacting now would free ~{n} tokens\", contextCompactNow: \"Compact now\", compactionSummaryTitle: \"Conversation summary\", checkpointCount: \"{n} messages summarised for the model\", checkpointCountOne: \"1 message summarised for the model\", checkpointLegacy: \"Earlier messages were summarised\", checkpointGroup: \"Context summary\", checkpointShow: \"Show summary\", checkpointHide: \"Hide summary\", checkpointRestore: \"Restore\", checkpointRestoreConfirm: \"Send the original messages to the model again?\", checkpointPending: \"Summarising the context…\", checkpointFailed: \"Couldn't summarise the context\", toolRunning: \"Running\", toolCompleted: \"Done\", toolRejected: \"Rejected\", toolStopped: \"Stopped\", toolFailed: \"Failed\", toolInput: \"Input\", toolOutput: \"Output\", toolRejectedSaid: \"You said: “{instruction}”\", toolRefusedByPolicy: \"Refused by policy\", toolNotRunAfterRefusal: \"Not run: an earlier call was refused\", toolTimedOut: \"Timed out\", toolUnavailable: \"Not available here\", toolNoApprover: \"No one could approve it\", toolTurnLimit: \"Turn limit reached\", maxTurnsReached: \"Stopped after {n} turns to avoid an endless loop.\", sourcesCount: \"{n} sources\", sourcesOne: \"1 source\", sourcesCard: \"Sources\", sourcePrevious: \"Previous source\", sourceNext: \"Next source\", sourcePosition: \"Source {i} of {n}\", opensInNewTab: \"(opens in a new tab)\", questionDeclined: \"You declined to answer.\", artifactNotCreated: \"Not created\", thoughtFor: \"Thought for {duration}\", thought: \"Thought\", approvalOptionsLabel: \"Your decision\", approvalArgsLabel: \"Arguments\", actionUpload: \"Attach file\", removeAttachment: \"Remove {name}\", messageFrom: \"Message from {name}\", selectSearchPlaceholder: \"Search…\", selectSearchLabel: \"Search options\", loading: \"Loading…\", download: \"Download\", openArtifact: \"Open\", modelContextWindow: \"{n} context\", previewPending: \"Press Preview to run this artifact.\", sandboxError: \"The sandbox failed during generation.\", sandboxErrorHint: \"Common cause: the model produced invalid code (undefined variable, wrong argument type). Retry the request — the model may produce different code.\", preview: \"Preview\", code: \"Code\", generating: \"Generating…\", rebuildingPreview: \"Rebuilding preview…\", typing: \"Typing\", responseCutOff: \"Cut off at the model's length limit.\", error: \"Error\", errorUnreachable: \"The assistant can’t be reached right now. Try again in a moment.\", errorTimeout: \"The answer took too long. Try again in a moment.\", errorRefused: \"The assistant isn’t allowed to answer right now.\", errorRateLimited: \"Too many requests right now. Try again in a moment.\", errorTooLong: \"This conversation is too long for the model. Start a new one.\", errorFailed: \"The assistant couldn’t answer. Try again in a moment.\", errorNoAnswer: \"The assistant couldn’t answer this request.\", running: \"Running...\", run: \"Run\", file: \"File\", modelSelectorPlaceholder: \"Select a model...\", approvalModeLabel: \"Approval mode\", roleNameUser: \"You\", roleNameAssistant: \"Assistant\", yourMessage: \"Your message\", assistantResponse: \"Assistant response\", messageActions: \"Message actions\", edit: \"Edit message\", editConfirm: \"Send\", editCancel: \"Cancel\", feedbackPositive: \"Good response\", feedbackNegative: \"Bad response\", previousResponse: \"Previous response\", nextResponse: \"Next response\", approveTool: \"Approve\", rejectTool: \"Reject\", messageInfo: \"Details\", newChat: \"New Chat\", loadingConversations: \"Loading conversations\", conversationSearchEmpty: \"No conversation matches\", conversationList: \"Conversations\", loadingConversation: \"Loading the conversation\", deleteConversation: \"Delete\", archiveConversation: \"Archive\", unarchiveConversation: \"Unarchive\", conversationActions: \"Conversation actions\", conversationRunning: \"Answering\", conversationWaiting: \"Waiting for you\", renameConversation: \"Rename\", conversationTitle: \"Conversation title\", pinConversation: \"Pin\", unpinConversation: \"Unpin\", deleteConversationConfirm: \"Delete “{title}”?\", cancel: \"Cancel\", conversationGroupPinned: \"Pinned\", conversationGroupToday: \"Today\", conversationGroupYesterday: \"Yesterday\", conversationGroupWeek: \"Previous 7 days\", conversationGroupMonth: \"Previous 30 days\", scrollRailLabel: \"Conversation outline\", sidebarLabel: \"Conversations\", splitHandleLabel: \"Resize the panes\", launcherOpen: \"Open the chat\", launcherClose: \"Close the chat\", transcript: \"Transcript\" }",
11134
+ "default": "{ inputPlaceholder: \"Type a message...\", sendButton: \"Send\", copy: \"Copy\", copied: \"Copied!\", retry: \"Retry\", thinking: \"Thinking\", elicitationOther: \"Other…\", elicitationOtherPlaceholder: \"Type your answer…\", elicitationOtherLabel: \"Custom answer\", submitButton: \"Submit\", stopButton: \"Stop\", elicitationRecommended: \"Recommended\", elicitationSkip: \"Skip\", elicitationHide: \"Hide for now\", elicitationWaiting: \"Waiting for your answer\", elicitationYes: \"Yes\", elicitationNo: \"No\", elicitationAnswerLabel: \"Your answer\", approvalInstructionPlaceholder: \"Or tell it what to do instead…\", approvalAsk: \"Allow {tool}?\", approvalWaiting: \"Waiting\", scrollToBottom: \"Scroll to bottom\", suggestionsLabel: \"Suggested prompts\", contextLabel: \"Context window\", contextSystem: \"System prompt\", contextTools: \"Tools\", contextSummary: \"Summary\", contextMessages: \"Messages\", contextOther: \"Other\", contextFree: \"Free\", contextTotal: \"Total\", contextReclaim: \"Compacting now would free ~{n} tokens\", contextCompactNow: \"Compact now\", checkpointCount: \"{n} messages summarised for the model\", checkpointCountOne: \"1 message summarised for the model\", checkpointLegacy: \"Earlier messages were summarised\", checkpointGroup: \"Context summary\", checkpointShow: \"Show summary\", checkpointHide: \"Hide summary\", checkpointRestore: \"Restore\", checkpointRestoreConfirm: \"Send the original messages to the model again?\", checkpointPending: \"Summarising the context…\", checkpointFailed: \"Couldn't summarise the context\", toolRunning: \"Running\", toolCompleted: \"Done\", toolRejected: \"Rejected\", toolStopped: \"Stopped\", toolFailed: \"Failed\", toolInput: \"Input\", toolOutput: \"Output\", toolRejectedSaid: \"You said: “{instruction}”\", toolRefusedByPolicy: \"Refused by policy\", toolNotRunAfterRefusal: \"Not run: an earlier call was refused\", toolTimedOut: \"Timed out\", toolUnavailable: \"Not available here\", toolNoApprover: \"No one could approve it\", toolTurnLimit: \"Turn limit reached\", maxTurnsReached: \"Stopped after {n} turns to avoid an endless loop.\", sourcesCount: \"{n} sources\", sourcesOne: \"1 source\", sourcesCard: \"Sources\", sourcePrevious: \"Previous source\", sourceNext: \"Next source\", sourcePosition: \"Source {i} of {n}\", opensInNewTab: \"(opens in a new tab)\", imageLoad: \"Load the image from {host}\", imageLoadNamed: \"Load the image “{alt}” from {host}\", questionDeclined: \"You declined to answer.\", artifactNotCreated: \"Not created\", thoughtFor: \"Thought for {duration}\", thought: \"Thought\", approvalOptionsLabel: \"Your decision\", approvalArgsLabel: \"Arguments\", actionUpload: \"Attach file\", removeAttachment: \"Remove {name}\", messageFrom: \"Message from {name}\", selectSearchPlaceholder: \"Search…\", selectSearchLabel: \"Search options\", loading: \"Loading…\", download: \"Download\", openArtifact: \"Open\", modelContextWindow: \"{n} context\", previewPending: \"Press Preview to run this artifact.\", sandboxError: \"The sandbox failed during generation.\", sandboxErrorHint: \"Common cause: the model produced invalid code (undefined variable, wrong argument type). Retry the request — the model may produce different code.\", preview: \"Preview\", code: \"Code\", generating: \"Generating…\", rebuildingPreview: \"Rebuilding preview…\", typing: \"Typing\", responseCutOff: \"Cut off at the model's length limit.\", error: \"Error\", errorUnreachable: \"The assistant can’t be reached right now. Try again in a moment.\", errorTimeout: \"The answer took too long. Try again in a moment.\", errorRefused: \"The assistant isn’t allowed to answer right now.\", errorRateLimited: \"Too many requests right now. Try again in a moment.\", errorTooLong: \"This conversation is too long for the model. Start a new one.\", errorFailed: \"The assistant couldn’t answer. Try again in a moment.\", errorNoAnswer: \"The assistant couldn’t answer this request.\", running: \"Running...\", run: \"Run\", file: \"File\", modelSelectorPlaceholder: \"Select a model...\", approvalModeLabel: \"Approval mode\", roleNameUser: \"You\", roleNameAssistant: \"Assistant\", yourMessage: \"Your message\", assistantResponse: \"Assistant response\", messageActions: \"Message actions\", edit: \"Edit message\", editConfirm: \"Send\", editCancel: \"Cancel\", feedbackPositive: \"Good response\", feedbackNegative: \"Bad response\", previousResponse: \"Previous response\", nextResponse: \"Next response\", approveTool: \"Approve\", rejectTool: \"Reject\", messageInfo: \"Details\", newChat: \"New Chat\", loadingConversations: \"Loading conversations\", conversationSearchEmpty: \"No conversation matches\", conversationList: \"Conversations\", loadingConversation: \"Loading the conversation\", deleteConversation: \"Delete\", archiveConversation: \"Archive\", unarchiveConversation: \"Unarchive\", conversationActions: \"Conversation actions\", conversationRunning: \"Answering\", conversationWaiting: \"Waiting for you\", renameConversation: \"Rename\", conversationTitle: \"Conversation title\", pinConversation: \"Pin\", unpinConversation: \"Unpin\", deleteConversationConfirm: \"Delete “{title}”?\", cancel: \"Cancel\", conversationGroupPinned: \"Pinned\", conversationGroupToday: \"Today\", conversationGroupYesterday: \"Yesterday\", conversationGroupWeek: \"Previous 7 days\", conversationGroupMonth: \"Previous 30 days\", scrollRailLabel: \"Conversation outline\", sidebarLabel: \"Conversations\", splitHandleLabel: \"Resize the panes\", launcherOpen: \"Open the chat\", launcherClose: \"Close the chat\", transcript: \"Transcript\" }",
10577
11135
  "description": "Default English Locale (Zero-dependency)\nHardcoded to ensure the core works out-of-the-box."
10578
11136
  }
10579
11137
  ],
@@ -10598,6 +11156,39 @@
10598
11156
  "default": "new Set([ 'script', 'style', 'iframe', 'frame', 'frameset', 'object', 'embed', 'applet', 'form', 'button', 'textarea', 'select', 'option', 'optgroup', 'link', 'meta', 'base', 'title', 'head', 'html', 'body', 'template', 'noscript', 'svg', 'math', 'portal', ])",
10599
11157
  "description": "Tags dropped wholesale — content and all (never unwrapped to text).\n\nExported for the DOM-free path's own suite: both of `fallbackScrub`'s regexes\nare built from this Set, and the test that proves it loops over the Set rather\nthan a copy. Not re-exported from the package barrel — it is core's list, not\na contract."
10600
11158
  },
11159
+ {
11160
+ "kind": "variable",
11161
+ "name": "RESERVED_ATTRIBUTES",
11162
+ "default": "new Set([ 'data-aparte-chat', 'data-aparte-host', 'data-aparte-theme', 'data-aparte-split-pane', 'data-aparte-launcher-close', 'data-aparte-suggestions', 'data-aparte-bubble', 'data-aparte-empty', 'data-aparte-panel', 'data-aparte-panel-host', 'data-aparte-card-part', 'data-segment-id', 'data-action', ])",
11163
+ "description": "The attributes core READS, as a command or as a boundary, on an element it finds by\nwalking the DOM: a delegated click listener (`data-aparte-dialog-open`, the sidebar\nand split toggles, the launcher's close), the chat that owns a card's `send`\n(`data-aparte-chat`), the instance config a subtree resolves to (`data-aparte-host`),\nthe palette a subtree wears (`data-aparte-theme`), a checkpoint's Restore\n(`data-checkpoint-action`), the row a segment update targets (`data-segment-id`).\n\n`data-*` is otherwise kept (see `copyAttributes`), so these are the exceptions: model\nmarkup is text, and text cannot press a button or move a boundary core drew. The list\nis exact rather than the whole `data-aparte-` prefix on purpose — a Markdown provider\nwrites `data-aparte-open` before the sanitizer runs, and core marks its own state on\nDOM the sanitizer sees again (`data-aparte-highlighted`) — and\n`the-sanitizer-refuses-what-core-reads.test.ts` scans core's source so an attribute\nadded there cannot be forgotten here. Exported for that test; not from the barrel."
11164
+ },
11165
+ {
11166
+ "kind": "variable",
11167
+ "name": "RESERVED_ATTRIBUTE_PREFIXES",
11168
+ "type": {
11169
+ "text": "array"
11170
+ },
11171
+ "default": "['data-aparte-dialog-', 'data-aparte-sidebar-', 'data-checkpoint-']",
11172
+ "description": "Families of reserved attributes: `-open`/`-close`/`-static`, `-toggle`/`-search`, `-action`/`-reason`."
11173
+ },
11174
+ {
11175
+ "kind": "function",
11176
+ "name": "isReservedAttribute",
11177
+ "return": {
11178
+ "type": {
11179
+ "text": "boolean"
11180
+ }
11181
+ },
11182
+ "parameters": [
11183
+ {
11184
+ "name": "name",
11185
+ "type": {
11186
+ "text": "string"
11187
+ }
11188
+ }
11189
+ ],
11190
+ "description": "True when `name` (lower case) is an attribute core reads, so model markup may not carry it."
11191
+ },
10601
11192
  {
10602
11193
  "kind": "function",
10603
11194
  "name": "isSafeUrl",
@@ -10621,6 +11212,30 @@
10621
11212
  }
10622
11213
  ]
10623
11214
  },
11215
+ {
11216
+ "kind": "function",
11217
+ "name": "readTag",
11218
+ "return": {
11219
+ "type": {
11220
+ "text": "{ tag: string; attrs: Array<[string, string]>; end: number }"
11221
+ }
11222
+ },
11223
+ "parameters": [
11224
+ {
11225
+ "name": "html",
11226
+ "type": {
11227
+ "text": "string"
11228
+ }
11229
+ },
11230
+ {
11231
+ "name": "nameAt",
11232
+ "type": {
11233
+ "text": "number"
11234
+ }
11235
+ }
11236
+ ],
11237
+ "description": "One tag read from `nameAt` (the first letter of its name) the way a browser's tokenizer reads\nit: a quote ends where its match is, an unquoted value at a space or `>`, `/` and a closing\nquote separate attributes, the first of two equal names wins, and a value is read with the\nentities that can spell a checked character decoded. `end` is the index past its `>`, or `-1`\nwhen the text ends inside the tag.\n\nExported for the image policy's DOM-free pass (`image-policy.ts`), which has to find the same\ntags in the same text this scrub wrote; not from the package barrel."
11238
+ },
10624
11239
  {
10625
11240
  "kind": "function",
10626
11241
  "name": "defaultSanitizer",
@@ -10649,6 +11264,30 @@
10649
11264
  "module": "src/config/sanitize.ts"
10650
11265
  }
10651
11266
  },
11267
+ {
11268
+ "kind": "js",
11269
+ "name": "RESERVED_ATTRIBUTES",
11270
+ "declaration": {
11271
+ "name": "RESERVED_ATTRIBUTES",
11272
+ "module": "src/config/sanitize.ts"
11273
+ }
11274
+ },
11275
+ {
11276
+ "kind": "js",
11277
+ "name": "RESERVED_ATTRIBUTE_PREFIXES",
11278
+ "declaration": {
11279
+ "name": "RESERVED_ATTRIBUTE_PREFIXES",
11280
+ "module": "src/config/sanitize.ts"
11281
+ }
11282
+ },
11283
+ {
11284
+ "kind": "js",
11285
+ "name": "isReservedAttribute",
11286
+ "declaration": {
11287
+ "name": "isReservedAttribute",
11288
+ "module": "src/config/sanitize.ts"
11289
+ }
11290
+ },
10652
11291
  {
10653
11292
  "kind": "js",
10654
11293
  "name": "isSafeUrl",
@@ -10657,6 +11296,14 @@
10657
11296
  "module": "src/config/sanitize.ts"
10658
11297
  }
10659
11298
  },
11299
+ {
11300
+ "kind": "js",
11301
+ "name": "readTag",
11302
+ "declaration": {
11303
+ "name": "readTag",
11304
+ "module": "src/config/sanitize.ts"
11305
+ }
11306
+ },
10660
11307
  {
10661
11308
  "kind": "js",
10662
11309
  "name": "defaultSanitizer",
@@ -13056,6 +13703,12 @@
13056
13703
  }
13057
13704
  ]
13058
13705
  },
13706
+ {
13707
+ "kind": "javascript-module",
13708
+ "path": "src/generated/element-attributes.ts",
13709
+ "declarations": [],
13710
+ "exports": []
13711
+ },
13059
13712
  {
13060
13713
  "kind": "javascript-module",
13061
13714
  "path": "src/host/aparte-chat-host.ts",
@@ -13926,12 +14579,6 @@
13926
14579
  }
13927
14580
  ]
13928
14581
  },
13929
- {
13930
- "kind": "javascript-module",
13931
- "path": "src/generated/element-attributes.ts",
13932
- "declarations": [],
13933
- "exports": []
13934
- },
13935
14582
  {
13936
14583
  "kind": "javascript-module",
13937
14584
  "path": "src/icons/extended.ts",
@@ -15142,6 +15789,58 @@
15142
15789
  }
15143
15790
  ]
15144
15791
  },
15792
+ {
15793
+ "kind": "javascript-module",
15794
+ "path": "src/interop/image-holds.ts",
15795
+ "declarations": [
15796
+ {
15797
+ "kind": "function",
15798
+ "name": "showHeldImage",
15799
+ "return": {
15800
+ "type": {
15801
+ "text": "void"
15802
+ }
15803
+ },
15804
+ "parameters": [
15805
+ {
15806
+ "name": "link",
15807
+ "type": {
15808
+ "text": "Element"
15809
+ }
15810
+ }
15811
+ ],
15812
+ "description": "Put the picture `link` holds in its place, and remember the reader chose to see it."
15813
+ },
15814
+ {
15815
+ "kind": "function",
15816
+ "name": "installImageHoldsOnce",
15817
+ "return": {
15818
+ "type": {
15819
+ "text": "void"
15820
+ }
15821
+ },
15822
+ "description": "Install the listeners once per document."
15823
+ }
15824
+ ],
15825
+ "exports": [
15826
+ {
15827
+ "kind": "js",
15828
+ "name": "showHeldImage",
15829
+ "declaration": {
15830
+ "name": "showHeldImage",
15831
+ "module": "src/interop/image-holds.ts"
15832
+ }
15833
+ },
15834
+ {
15835
+ "kind": "js",
15836
+ "name": "installImageHoldsOnce",
15837
+ "declaration": {
15838
+ "name": "installImageHoldsOnce",
15839
+ "module": "src/interop/image-holds.ts"
15840
+ }
15841
+ }
15842
+ ]
15843
+ },
15145
15844
  {
15146
15845
  "kind": "javascript-module",
15147
15846
  "path": "src/parsers/aparte-event-stream.ts",
@@ -17875,6 +18574,82 @@
17875
18574
  }
17876
18575
  ]
17877
18576
  },
18577
+ {
18578
+ "kind": "javascript-module",
18579
+ "path": "src/transport/json-headers.ts",
18580
+ "declarations": [
18581
+ {
18582
+ "kind": "function",
18583
+ "name": "jsonHeaders",
18584
+ "return": {
18585
+ "type": {
18586
+ "text": "Record<string, string>"
18587
+ }
18588
+ },
18589
+ "parameters": [
18590
+ {
18591
+ "name": "extra",
18592
+ "optional": true,
18593
+ "type": {
18594
+ "text": "Record<string, string>"
18595
+ }
18596
+ }
18597
+ ],
18598
+ "description": "The headers of a request to the library's own server handlers: the consumer's own, and a\n`Content-Type` of `application/json` that is the ONLY one.\n\n`{ 'Content-Type': 'application/json', ...theirs }` is two keys when theirs is spelled\n`content-type`, and `fetch` joins them into one header, `application/json, application/json`,\nwhich the handlers' content-type check (`refuseUnsafeRequest`) does not read as JSON."
18599
+ }
18600
+ ],
18601
+ "exports": [
18602
+ {
18603
+ "kind": "js",
18604
+ "name": "jsonHeaders",
18605
+ "declaration": {
18606
+ "name": "jsonHeaders",
18607
+ "module": "src/transport/json-headers.ts"
18608
+ }
18609
+ }
18610
+ ]
18611
+ },
18612
+ {
18613
+ "kind": "javascript-module",
18614
+ "path": "src/transport/request-guard.ts",
18615
+ "declarations": [
18616
+ {
18617
+ "kind": "function",
18618
+ "name": "refuseUnsafeRequest",
18619
+ "return": {
18620
+ "type": {
18621
+ "text": "Response | null"
18622
+ }
18623
+ },
18624
+ "parameters": [
18625
+ {
18626
+ "name": "req",
18627
+ "type": {
18628
+ "text": "Request"
18629
+ }
18630
+ },
18631
+ {
18632
+ "name": "allowedOrigins",
18633
+ "optional": true,
18634
+ "type": {
18635
+ "text": "readonly string[]"
18636
+ }
18637
+ }
18638
+ ],
18639
+ "description": "`415` unless the body is declared `application/json` (parameters such as `charset` ignored); `403` for an `Origin` the host did not list."
18640
+ }
18641
+ ],
18642
+ "exports": [
18643
+ {
18644
+ "kind": "js",
18645
+ "name": "refuseUnsafeRequest",
18646
+ "declaration": {
18647
+ "name": "refuseUnsafeRequest",
18648
+ "module": "src/transport/request-guard.ts"
18649
+ }
18650
+ }
18651
+ ]
18652
+ },
17878
18653
  {
17879
18654
  "kind": "javascript-module",
17880
18655
  "path": "src/transport/types.ts",
@@ -18328,14 +19103,6 @@
18328
19103
  "module": "./models.js"
18329
19104
  }
18330
19105
  },
18331
- {
18332
- "kind": "js",
18333
- "name": "AparteMessageBranch",
18334
- "declaration": {
18335
- "name": "AparteMessageBranch",
18336
- "module": "./models.js"
18337
- }
18338
- },
18339
19106
  {
18340
19107
  "kind": "js",
18341
19108
  "name": "AparteBubbleActionsConfig",
@@ -19952,6 +20719,40 @@
19952
20719
  }
19953
20720
  ]
19954
20721
  },
20722
+ {
20723
+ "kind": "javascript-module",
20724
+ "path": "src/utils/rendered-content.ts",
20725
+ "declarations": [
20726
+ {
20727
+ "kind": "function",
20728
+ "name": "inRenderedContent",
20729
+ "return": {
20730
+ "type": {
20731
+ "text": "boolean"
20732
+ }
20733
+ },
20734
+ "parameters": [
20735
+ {
20736
+ "name": "el",
20737
+ "type": {
20738
+ "text": "Element | null | undefined"
20739
+ }
20740
+ }
20741
+ ],
20742
+ "description": "True when `el` is inside the rendered body of a message (or a checkpoint's summary)."
20743
+ }
20744
+ ],
20745
+ "exports": [
20746
+ {
20747
+ "kind": "js",
20748
+ "name": "inRenderedContent",
20749
+ "declaration": {
20750
+ "name": "inRenderedContent",
20751
+ "module": "src/utils/rendered-content.ts"
20752
+ }
20753
+ }
20754
+ ]
20755
+ },
19955
20756
  {
19956
20757
  "kind": "javascript-module",
19957
20758
  "path": "src/utils/segments.ts",
@@ -21098,6 +21899,13 @@
21098
21899
  "default": "new Map<string, DrawnSegment>()",
21099
21900
  "description": "Every segment on screen, by id: see DrawnSegment."
21100
21901
  },
21902
+ {
21903
+ "kind": "field",
21904
+ "name": "_written",
21905
+ "privacy": "private",
21906
+ "default": "new Set<string>()",
21907
+ "description": "Segments written to with no `isStreaming: false` yet: settled when the message stops streaming."
21908
+ },
21101
21909
  {
21102
21910
  "kind": "field",
21103
21911
  "name": "_releasedWhileDetached",
@@ -21174,10 +21982,40 @@
21174
21982
  "type": {
21175
21983
  "text": "AparteSegmentRenderer | undefined"
21176
21984
  }
21985
+ },
21986
+ {
21987
+ "name": "drawnAs",
21988
+ "default": "segment",
21989
+ "type": {
21990
+ "text": "AparteSegment"
21991
+ }
21177
21992
  }
21178
21993
  ],
21179
21994
  "description": "Record a segment as drawn, set it up, then read back which tool renderer is behind the\nrow (tool-call.ts records it as the row is set up — one record, not a second lookup).\nRecorded BEFORE `setup`: a setup that throws (a framework mount) leaves an element that\nwill still be cleaned up. The same id drawn twice releases the first element."
21180
21995
  },
21996
+ {
21997
+ "kind": "method",
21998
+ "name": "_drawnAs",
21999
+ "privacy": "private",
22000
+ "return": {
22001
+ "type": {
22002
+ "text": "AparteSegment"
22003
+ }
22004
+ },
22005
+ "parameters": [
22006
+ {
22007
+ "name": "segment",
22008
+ "type": {
22009
+ "text": "AparteSegment"
22010
+ }
22011
+ },
22012
+ {
22013
+ "name": "added",
22014
+ "default": "false"
22015
+ }
22016
+ ],
22017
+ "description": "The segment as its renderer's `setup` sees it: one ADDED while the message streams is\narriving, flag or no flag.\n\nA text or reasoning segment flagged `isStreaming: true` is written by its renderer's\n`setup` through the streaming renderer, from its first chunk. The stream parser's text\ncarries no flag at all, though: `update` reads a missing flag as \"still arriving\",\n`setup` cannot, because a restored message's segments carry none either and are\nfinished. So its first chunk — drawn by `render` and `setup`, while `update` only runs\nfrom the second — went through the one-shot provider, which reads `Done: **Book ` as\nfinished text: with marked, the `**` showed raw until the next chunk reached the\nstreaming renderer, which completes it. `addSegment` on a streaming message is a segment\narriving, and the bubble is what knows the message streams, so it tells `setup`\n(`render` keeps the segment as stored: the reasoning label reads the flag, and would lose\nits shimmer again at the next chunk). `setSegments` infers nothing — a hand-set text is\nfinished, and the streaming renderer would keep back what may still open a token (the\nfull stop after `**bold**`) until the turn ends; a framework host flags the segment\nitself (`populateBubbleFromMessage`). Either way the segment joins `_written`, to be\nsettled — flushed, then drawn whole — when the message stops."
22018
+ },
21181
22019
  {
21182
22020
  "kind": "method",
21183
22021
  "name": "_release",
@@ -21557,6 +22395,17 @@
21557
22395
  ],
21558
22396
  "description": "Append content to a segment"
21559
22397
  },
22398
+ {
22399
+ "kind": "method",
22400
+ "name": "_settleWrittenSegments",
22401
+ "privacy": "private",
22402
+ "return": {
22403
+ "type": {
22404
+ "text": "void"
22405
+ }
22406
+ },
22407
+ "description": "The message stopped streaming, so a segment it was still writing is finished too.\n\nA segment written to with no `isStreaming` flag — `appendToSegment` from a stream driven\nby hand, as the docs' own streaming demo does — goes through the incremental Markdown\nparser, which holds back what may still open a token (the full stop after `**bold**`)\nuntil it is told the text is complete. Nothing told it: the message ended with its tail\nmissing. Marked finished here, it is flushed and settled like any finished segment."
22408
+ },
21560
22409
  {
21561
22410
  "kind": "method",
21562
22411
  "name": "getSegments",
@@ -25300,7 +26149,7 @@
25300
26149
  "declarations": [
25301
26150
  {
25302
26151
  "kind": "class",
25303
- "description": "A gauge of the model's context window: how much of it the conversation uses, and what\nfills it.\n\nIt draws one number against the window. The number is what the last turn REPORTED —\n`aparte-message-done` carries the provider's usage, and the prompt tokens of the last call\nare the size of the context as the model saw it — for as long as nothing the model reads\nhas changed since. Once something has (a compaction summarised the history, a Restore\nbrought it back), the reported number describes a request that will not be sent again, so\nthe gauge measures the request that WOULD be sent and prefixes it with `~`: an estimate,\ncalibrated against the last reply, never a stale figure and never a blank. The measure is\n`measureContext`, the same one the compaction plugin decides on.\n\nThe WINDOW is the current model's `contextWindow` (a provider's `/models` fetch fills it\nin), or the `window` attribute when you know better. With no window, or before the first\nturn, it renders nothing — an affordance with nothing to show has no chrome to leave.\n\nTwo thresholds turn it `warn` then `danger` (`data-level`), and crossing one fires\n`aparte-context-threshold`. A turn the model refused as over its window\n(`USAGE_CONTEXT_EXCEEDED` on `aparte-message-error`) turns it `danger` whatever the number\nsays: the model has just said what the number could not.\n\nThe gauge is also a disclosure. It is a button (`aria-expanded`; click, Enter or Space) that\nopens a panel listing what the window holds — the system prompt, the tools, the summary\nof a compacted history, the messages — beside what is free. The parts are estimates and\nlabelled so; what the heuristic cannot see is `other`. When\n`@aparte/plugin-compaction` is registered as the compactor and can say what compacting\nwould do, the panel adds \"Compacting now would free ~N tokens\" and a **Compact now** button.\nWhile a compaction runs the element carries `data-compact=\"running\"`, and `\"failed\"` after a\nfailure, with Retry in the panel. Escape and a click outside close it; nothing opens on hover.\n\n`auto-compact` is deprecated: the plugin decides when to compact now (after a turn, and\nbefore a send that would overflow), so a page does not need the gauge to ask. It still\nworks — a turn that ends in `danger` dispatches `aparte-compact`, one request at a time,\nwith `auto: true` so the plugin can tell it from a button — and it will go away in a\nfuture major version.\n\nA new chat or a conversation loaded in place of the last replaces the reading: it is\ncleared on `aparte-reset-done` and, for a stored conversation, read from its last reply on\n`aparte-conversation-loaded`. A restored reading never asks for a compaction, whatever its\nlevel — that stays tied to the end of a turn.\n\nThe bar wears the `aparte-progress` recipe. `variant=\"ring\"` draws the same reading\nas a ring with the percentage beside it — for a toolbar, where a bar wants a width\nand a ring wants none; the full reading is the ring's `title`. The two share the\nlevels, the events, the panel and the accessible name; only the drawing differs.",
26152
+ "description": "A gauge of the model's context window: how much of it the conversation uses, and what\nfills it.\n\nIt draws one number against the window. The number is what the last turn REPORTED —\n`aparte-message-done` carries the provider's usage, and the prompt tokens of the last call\nare the size of the context as the model saw it — for as long as nothing the model reads\nhas changed since. Once something has (a compaction summarised the history, a Restore\nbrought it back), the reported number describes a request that will not be sent again, so\nthe gauge measures the request that WOULD be sent and prefixes it with `~`: an estimate,\ncalibrated against the last reply, never a stale figure and never a blank. The measure is\n`measureContext`, the same one the compaction plugin decides on.\n\nThe WINDOW is the current model's `contextWindow` (a provider's `/models` fetch fills it\nin), or the `window` attribute when you know better. With no window, or before the first\nturn, it renders nothing — an affordance with nothing to show has no chrome to leave.\n\nTwo thresholds turn it `warn` then `danger` (`data-level`), and crossing one fires\n`aparte-context-threshold`. A turn the model refused as over its window\n(`USAGE_CONTEXT_EXCEEDED` on `aparte-message-error`) turns it `danger` whatever the number\nsays: the model has just said what the number could not.\n\nThe gauge is also a disclosure. It is a button (`aria-expanded`; click, Enter or Space) that\nopens a panel listing what the window holds — the system prompt, the tools, the summary\nof a compacted history, the messages — beside what is free. The parts are estimates and\nlabelled so; what the heuristic cannot see is `other`. When\n`@aparte/plugin-compaction` is registered as the compactor and can say what compacting\nwould do, the panel adds \"Compacting now would free ~N tokens\" and a **Compact now** button.\nWhile a compaction runs the element carries `data-compact=\"running\"`, and `\"failed\"` after a\nfailure, with Retry in the panel. Escape and a click outside close it; nothing opens on hover.\n\nThe gauge never asks for a compaction by itself: `@aparte/plugin-compaction` decides when to\ncompact (after a turn, and before a send that would overflow).\n\nA new chat or a conversation loaded in place of the last replaces the reading: it is\ncleared on `aparte-reset-done` and, for a stored conversation, read from its last reply on\n`aparte-conversation-loaded`.\n\nThe bar wears the `aparte-progress` recipe. `variant=\"ring\"` draws the same reading\nas a ring with the percentage beside it — for a toolbar, where a bar wants a width\nand a ring wants none; the full reading is the ring's `title`. The two share the\nlevels, the events, the panel and the accessible name; only the drawing differs.",
25304
26153
  "name": "AparteContext",
25305
26154
  "cssProperties": [
25306
26155
  {
@@ -25329,15 +26178,6 @@
25329
26178
  "privacy": "private",
25330
26179
  "default": "null"
25331
26180
  },
25332
- {
25333
- "kind": "field",
25334
- "name": "_compactRequested",
25335
- "type": {
25336
- "text": "boolean"
25337
- },
25338
- "privacy": "private",
25339
- "default": "false"
25340
- },
25341
26181
  {
25342
26182
  "kind": "field",
25343
26183
  "name": "_lastDone",
@@ -25485,8 +26325,7 @@
25485
26325
  {
25486
26326
  "kind": "field",
25487
26327
  "name": "_onCompactError",
25488
- "privacy": "private",
25489
- "description": "A failed compaction spends the request too; the next `danger` asks again."
26328
+ "privacy": "private"
25490
26329
  },
25491
26330
  {
25492
26331
  "kind": "field",
@@ -25633,13 +26472,7 @@
25633
26472
  "type": {
25634
26473
  "text": "void"
25635
26474
  }
25636
- },
25637
- "parameters": [
25638
- {
25639
- "name": "askToCompact",
25640
- "default": "false"
25641
- }
25642
- ]
26475
+ }
25643
26476
  },
25644
26477
  {
25645
26478
  "kind": "method",
@@ -25810,7 +26643,7 @@
25810
26643
  "type": {
25811
26644
  "text": "CustomEvent<AparteCompactEventDetail>"
25812
26645
  },
25813
- "description": "Dispatched on `window` when the deprecated `auto-compact` is set and a turn ends in `danger` (`auto: true`, with the `window` it measured against), and by Retry in the panel when no compactor is registered. One automatic request at a time — the next turn in `danger` asks again once the plugin has answered. `@aparte/plugin-compaction` answers it; with no listener nothing happens.",
26646
+ "description": "Dispatched on `window` by Retry in the panel when no compactor is registered. `@aparte/plugin-compaction` answers it; with no listener nothing happens.",
25814
26647
  "name": "aparte-compact"
25815
26648
  }
25816
26649
  ],
@@ -25857,13 +26690,6 @@
25857
26690
  },
25858
26691
  "description": "Tokens in use before a turn of this page has reported any: a restored conversation's last usage. The next turn's usage replaces it."
25859
26692
  },
25860
- {
25861
- "type": {
25862
- "text": "boolean"
25863
- },
25864
- "description": "Deprecated, still works. Dispatch `aparte-compact` (with `auto: true`) on each turn that ends in `danger`, one request at a time. `@aparte/plugin-compaction` decides when to compact by itself now, so leave this off.",
25865
- "name": "auto-compact"
25866
- },
25867
26693
  {
25868
26694
  "type": {
25869
26695
  "text": "string"
@@ -27483,7 +28309,7 @@
27483
28309
  "declarations": [
27484
28310
  {
27485
28311
  "kind": "class",
27486
- "description": "A rail of ticks beside the transcript — one per turn — that shows where you are in a\nlong conversation and jumps back to any message on a click.\n\nThe thing every long chat is missing and no product ships natively: the scrollbar says\nhow far down you are, not which question you are under. This is the minimap of a code\neditor reduced to its ticks, the search marks of a browser's scrollbar, the scrollspy\nof a documentation site — the same ancestry, applied to turns. A tick per USER message\nby default, because a user's turns are the questions and a rail with a tick per reply\nis unreadable on a long thread; `every=\"message\"` marks each one.\n\nIt owns nothing of the transcript: the viewport keeps its scroll, the bubbles keep\ntheir markup, and the rail only READS them — which bubbles exist (a mutation observer\non the chat), which one is under the reader (an intersection observer on the scroll\nsurface, never scroll arithmetic), and the first few words of each for the tick's\nname. A click is a `scrollIntoView` on the bubble, announced first by a cancelable\n`aparte-scroll-rail-jump` so a host that pages history in can load it before the\njump. Honoured by core alone, so it is live by default.\n\nPlace it as a direct child of `<aparte-chat>` (or the wrapper's `[data-aparte-chat]`\nhost): the stylesheet floats it on the transcript's end edge, centred on the transcript\nand clear of a classic scrollbar, and hides it under a coarse pointer, where a 2px\ntick is not a target. Under two ticks it renders nothing — a rail with one mark says\nnothing. It is a list, not a minimap: it takes the height of its ticks, up to a share\nof the transcript (`--aparte-scroll-rail-share`, 60%). When more turns exist than 24px\ntargets fit in that, the pitch tightens to what fits, down to a 6px floor; past that\nthe rail scrolls itself so the current tick is always in view, and the arrow keys walk\nevery tick whatever the pitch.",
28312
+ "description": "A rail of ticks beside the transcript — one per turn — that shows where you are in a\nlong conversation and jumps back to any message on a click.\n\nThe thing every long chat is missing and no product ships natively: the scrollbar says\nhow far down you are, not which question you are under. This is the minimap of a code\neditor reduced to its ticks, the search marks of a browser's scrollbar, the scrollspy\nof a documentation site — the same ancestry, applied to turns. A tick per USER message\nby default, because a user's turns are the questions and a rail with a tick per reply\nis unreadable on a long thread; `every=\"message\"` marks each one.\n\nIt owns nothing of the transcript: the viewport keeps its scroll, the bubbles keep\ntheir markup, and the rail only READS them — which bubbles exist (a mutation observer\non the chat), which one is under the reader (an intersection observer on the scroll\nsurface, never scroll arithmetic), and the first few words of each for the tick's\nname. A click is a `scrollIntoView` on the bubble, announced first by a cancelable\n`aparte-scroll-rail-jump` so a host that pages history in can load it before the\njump. Honoured by core alone, so it is live by default.\n\nPlace it as a direct child of `<aparte-chat>` (or the wrapper's `[data-aparte-chat]`\nhost): the stylesheet floats it on the transcript's end edge, centred on the transcript\nand clear of a classic scrollbar, and hides it under a coarse pointer, where a 2px\ntick is not a target. Under two ticks it renders nothing — a rail with one mark says\nnothing. It is a list, not a minimap: it takes the height of its ticks, up to a share\nof the transcript (`--aparte-scroll-rail-share`, 60%). When more turns exist than 24px\ntargets fit in that, the pitch tightens to what fits, down to a 6px floor; past that\nthe rail scrolls itself so the current tick is always in view, and the arrow keys walk\nevery tick whatever the pitch. The rail is one Tab stop, the current tick: Tab crosses\nit once, however long the conversation, and the arrows, Home and End move inside it.",
27487
28313
  "name": "AparteScrollRail",
27488
28314
  "cssProperties": [
27489
28315
  {
@@ -27565,6 +28391,16 @@
27565
28391
  "privacy": "private",
27566
28392
  "default": "null"
27567
28393
  },
28394
+ {
28395
+ "kind": "field",
28396
+ "name": "_sized",
28397
+ "type": {
28398
+ "text": "HTMLElement[]"
28399
+ },
28400
+ "privacy": "private",
28401
+ "default": "[]",
28402
+ "description": "The boxes the resize observer watches: the host, the transcript and its scroll surface."
28403
+ },
27568
28404
  {
27569
28405
  "kind": "field",
27570
28406
  "name": "_intersections",
@@ -27584,6 +28420,16 @@
27584
28420
  "default": "[]",
27585
28421
  "description": "The bubbles the intersection observer watches — compared by identity, so a re-rendered bubble is re-observed."
27586
28422
  },
28423
+ {
28424
+ "kind": "field",
28425
+ "name": "_bandTargets",
28426
+ "type": {
28427
+ "text": "HTMLElement[]"
28428
+ },
28429
+ "privacy": "private",
28430
+ "default": "[]",
28431
+ "description": "Every message the reading band watches: the ticked ones and, with `every=\"user\"`, the\nreplies too, each read under the question above it."
28432
+ },
27587
28433
  {
27588
28434
  "kind": "field",
27589
28435
  "name": "_observedSurface",
@@ -27596,13 +28442,37 @@
27596
28442
  },
27597
28443
  {
27598
28444
  "kind": "field",
27599
- "name": "_rebuildQueued",
28445
+ "name": "_frameQueued",
28446
+ "type": {
28447
+ "text": "boolean"
28448
+ },
28449
+ "privacy": "private",
28450
+ "default": "false",
28451
+ "description": "One frame does the queued work: a full rebuild when bubbles came or went, else the re-labels."
28452
+ },
28453
+ {
28454
+ "kind": "field",
28455
+ "name": "_rebuildWanted",
27600
28456
  "type": {
27601
28457
  "text": "boolean"
27602
28458
  },
27603
28459
  "privacy": "private",
27604
28460
  "default": "false"
27605
28461
  },
28462
+ {
28463
+ "kind": "field",
28464
+ "name": "_relabel",
28465
+ "privacy": "private",
28466
+ "default": "new Set<HTMLElement>()",
28467
+ "description": "Ticked bubbles whose text changed since the last frame: only their names can have moved."
28468
+ },
28469
+ {
28470
+ "kind": "field",
28471
+ "name": "_excerpts",
28472
+ "privacy": "private",
28473
+ "default": "new WeakMap<Element, string>()",
28474
+ "description": "Each message's excerpt, read once and forgotten when a mutation touches its text: a\nrebuild re-read the head of all 500 questions of a long conversation, twice a turn, for\nnames that had not changed."
28475
+ },
27606
28476
  {
27607
28477
  "kind": "field",
27608
28478
  "name": "_pickQueued",
@@ -27625,15 +28495,15 @@
27625
28495
  "kind": "field",
27626
28496
  "name": "_visible",
27627
28497
  "privacy": "private",
27628
- "default": "new Map<string, number>()",
27629
- "description": "Visible ratio per message id in the reading band, from the intersection observer."
28498
+ "default": "new WeakMap<Element, number>()",
28499
+ "description": "Visible ratio per message in the reading band, from the intersection observer. Keyed by\nthe element, not its id: an id changed in place keeps what the observer saw, and a\nbubble that left is let go with it."
27630
28500
  },
27631
28501
  {
27632
28502
  "kind": "field",
27633
28503
  "name": "_onScreen",
27634
28504
  "privacy": "private",
27635
- "default": "new Set<string>()",
27636
- "description": "The bubbles on screen at all, from the second observer; only the last one is read."
28505
+ "default": "new WeakSet<Element>()",
28506
+ "description": "Whether the last question is on screen at all, from the second observer."
27637
28507
  },
27638
28508
  {
27639
28509
  "kind": "field",
@@ -27748,7 +28618,79 @@
27748
28618
  "text": "void"
27749
28619
  }
27750
28620
  },
27751
- "description": "Coalesce a burst of mutations (a streaming reply is one per token) into one rebuild."
28621
+ "description": "Coalesce a burst of mutations into one frame of work: a rebuild, which re-names every tick too."
28622
+ },
28623
+ {
28624
+ "kind": "method",
28625
+ "name": "_queueRelabel",
28626
+ "privacy": "private",
28627
+ "return": {
28628
+ "type": {
28629
+ "text": "void"
28630
+ }
28631
+ },
28632
+ "parameters": [
28633
+ {
28634
+ "name": "bubble",
28635
+ "type": {
28636
+ "text": "HTMLElement"
28637
+ }
28638
+ }
28639
+ ]
28640
+ },
28641
+ {
28642
+ "kind": "method",
28643
+ "name": "_queueFrame",
28644
+ "privacy": "private",
28645
+ "return": {
28646
+ "type": {
28647
+ "text": "void"
28648
+ }
28649
+ }
28650
+ },
28651
+ {
28652
+ "kind": "method",
28653
+ "name": "_ticked",
28654
+ "privacy": "private",
28655
+ "return": {
28656
+ "type": {
28657
+ "text": "boolean"
28658
+ }
28659
+ },
28660
+ "parameters": [
28661
+ {
28662
+ "name": "bubble",
28663
+ "type": {
28664
+ "text": "HTMLElement"
28665
+ }
28666
+ }
28667
+ ],
28668
+ "description": "Whether a bubble has a tick: every message with `every=\"message\"`, else the user's."
28669
+ },
28670
+ {
28671
+ "kind": "method",
28672
+ "name": "_label",
28673
+ "privacy": "private",
28674
+ "return": {
28675
+ "type": {
28676
+ "text": "void"
28677
+ }
28678
+ },
28679
+ "parameters": [
28680
+ {
28681
+ "name": "bubble",
28682
+ "type": {
28683
+ "text": "HTMLElement"
28684
+ }
28685
+ },
28686
+ {
28687
+ "name": "locale",
28688
+ "type": {
28689
+ "text": "AparteLocale"
28690
+ }
28691
+ }
28692
+ ],
28693
+ "description": "Re-name one bubble's tick, written only when the name changed."
27752
28694
  },
27753
28695
  {
27754
28696
  "kind": "method",
@@ -27771,6 +28713,17 @@
27771
28713
  },
27772
28714
  "description": "The element that scrolls: the vanilla container, or the viewport itself under a wrapper."
27773
28715
  },
28716
+ {
28717
+ "kind": "method",
28718
+ "name": "_messages",
28719
+ "privacy": "private",
28720
+ "return": {
28721
+ "type": {
28722
+ "text": "HTMLElement[]"
28723
+ }
28724
+ },
28725
+ "description": "Every message bubble of the transcript, in document order."
28726
+ },
27774
28727
  {
27775
28728
  "kind": "method",
27776
28729
  "name": "_bubbles",
@@ -27779,7 +28732,17 @@
27779
28732
  "type": {
27780
28733
  "text": "HTMLElement[]"
27781
28734
  }
27782
- }
28735
+ },
28736
+ "parameters": [
28737
+ {
28738
+ "name": "all",
28739
+ "default": "this._messages()",
28740
+ "type": {
28741
+ "text": "HTMLElement[]"
28742
+ }
28743
+ }
28744
+ ],
28745
+ "description": "The bubbles that get a tick, from all of them."
27783
28746
  },
27784
28747
  {
27785
28748
  "kind": "method",
@@ -27815,6 +28778,12 @@
27815
28778
  "type": {
27816
28779
  "text": "HTMLElement"
27817
28780
  }
28781
+ },
28782
+ {
28783
+ "name": "locale",
28784
+ "type": {
28785
+ "text": "AparteLocale"
28786
+ }
27818
28787
  }
27819
28788
  ]
27820
28789
  },
@@ -27854,9 +28823,15 @@
27854
28823
  "type": {
27855
28824
  "text": "HTMLElement[]"
27856
28825
  }
28826
+ },
28827
+ {
28828
+ "name": "all",
28829
+ "type": {
28830
+ "text": "HTMLElement[]"
28831
+ }
27857
28832
  }
27858
28833
  ],
27859
- "description": "Which tick is current is read, not computed: the scroll surface is the root and an\nintersection observer reports which bubbles reach a reading band — the top 30% of\nthe surface, from its very top so that the bubble a jump aligned there counts. The\nrule is a scrollspy's: the LAST question that has reached the band is the one the\nreader is under. (The largest visible share would name the first of three questions\nsitting in the band at the bottom of a thread of short turns.) The one scroll\nposition read is the bottom, because there the reader is under the latest question\nwhatever the band holds, and the observer has nothing to report on the last few\npixels."
28834
+ "description": "Which tick is current is read, not computed: the scroll surface is the root and an\nintersection observer reports which bubbles reach a reading band — the top 30% of\nthe surface, from its very top so that the bubble a jump aligned there counts. The\nrule is a scrollspy's: the LAST question that has reached the band is the one the\nreader is under. (The largest visible share would name the first of three questions\nsitting in the band at the bottom of a thread of short turns.) The one scroll\nposition read is the bottom, because there the reader is under the latest question\nwhatever the band holds, and the observer has nothing to report on the last few\npixels.\n\nThe replies are watched too, and a reply in the band is read under its question. With\nthe questions alone the band was empty whenever the reader was inside a long reply, and\nnothing moved the mark when the layout did: a bubble never rendered has an estimated\nheight (`content-visibility`) and takes its real one once the scroll has stopped, so a\nstill reader's question changed with no scroll and no question crossing the band. The\nobserver reports a reply entering the band whatever moved it."
27860
28835
  },
27861
28836
  {
27862
28837
  "kind": "method",
@@ -27895,6 +28870,36 @@
27895
28870
  }
27896
28871
  }
27897
28872
  },
28873
+ {
28874
+ "kind": "method",
28875
+ "name": "_lastAbove",
28876
+ "privacy": "private",
28877
+ "return": {
28878
+ "type": {
28879
+ "text": "string | null"
28880
+ }
28881
+ },
28882
+ "description": "The last question whose top is above the reading band's lower edge: by halves, since\nthe questions are in document order and their tops only grow. A question never\nrendered has its estimated height (`content-visibility`), which keeps that order.\n`null` when no question is above the edge or nothing is laid out, and the mark stays\nas it was."
28883
+ },
28884
+ {
28885
+ "kind": "method",
28886
+ "name": "_markFor",
28887
+ "privacy": "private",
28888
+ "return": {
28889
+ "type": {
28890
+ "text": "string"
28891
+ }
28892
+ },
28893
+ "parameters": [
28894
+ {
28895
+ "name": "bubble",
28896
+ "type": {
28897
+ "text": "HTMLElement"
28898
+ }
28899
+ }
28900
+ ],
28901
+ "description": "The tick a message is read under: its own, else the question above it, as the band reads a reply."
28902
+ },
27898
28903
  {
27899
28904
  "kind": "method",
27900
28905
  "name": "_setCurrent",
@@ -27913,6 +28918,59 @@
27913
28918
  }
27914
28919
  ]
27915
28920
  },
28921
+ {
28922
+ "kind": "method",
28923
+ "name": "_syncTabStop",
28924
+ "privacy": "private",
28925
+ "return": {
28926
+ "type": {
28927
+ "text": "void"
28928
+ }
28929
+ },
28930
+ "parameters": [
28931
+ {
28932
+ "name": "ignoreFocus",
28933
+ "default": "false"
28934
+ }
28935
+ ],
28936
+ "description": "One Tab stop for the whole rail, as in a toolbar: the tick that has the focus, else\nthe current one, else the last. Every tick was a button in the tab order, so a\nkeyboard reader crossed 500 of them between the transcript and the composer of a\nlong conversation; the arrows, Home and End walk the rail instead."
28937
+ },
28938
+ {
28939
+ "kind": "field",
28940
+ "name": "_onFocusIn",
28941
+ "privacy": "private",
28942
+ "description": "The stop follows the focus onto a tick, however it got there: the arrows, a click (a\nclick on the current tick moved the focus but not the stop, which made two), a host's\n`focus()`."
28943
+ },
28944
+ {
28945
+ "kind": "field",
28946
+ "name": "_onFocusOut",
28947
+ "privacy": "private",
28948
+ "description": "Leaving the rail, the stop goes back to the current tick: Tab back in lands where the reader is."
28949
+ },
28950
+ {
28951
+ "kind": "method",
28952
+ "name": "_setTabStop",
28953
+ "privacy": "private",
28954
+ "return": {
28955
+ "type": {
28956
+ "text": "void"
28957
+ }
28958
+ },
28959
+ "parameters": [
28960
+ {
28961
+ "name": "stop",
28962
+ "type": {
28963
+ "text": "HTMLElement"
28964
+ }
28965
+ },
28966
+ {
28967
+ "name": "ticks",
28968
+ "type": {
28969
+ "text": "HTMLElement[]"
28970
+ }
28971
+ }
28972
+ ]
28973
+ },
27916
28974
  {
27917
28975
  "kind": "method",
27918
28976
  "name": "_reveal",
@@ -27932,6 +28990,17 @@
27932
28990
  ],
27933
28991
  "description": "Past the floor the rail scrolls itself: the current tick is kept inside its window."
27934
28992
  },
28993
+ {
28994
+ "kind": "method",
28995
+ "name": "_watchSizes",
28996
+ "privacy": "private",
28997
+ "return": {
28998
+ "type": {
28999
+ "text": "void"
29000
+ }
29001
+ },
29002
+ "description": "Point the resize observer at the boxes the geometry is read from. Re-pointed on each\nrebuild: a viewport a wrapper mounts after the rail, or replaces, was never watched, and\nthe panel or composer that resized it later left the rail measuring the old box. The\nscroll surface is watched for itself: a classic scrollbar appearing narrows it without\nresizing the viewport, and the rail has to move clear of the bar."
29003
+ },
27935
29004
  {
27936
29005
  "kind": "method",
27937
29006
  "name": "_write",
@@ -30041,6 +31110,56 @@
30041
31110
  }
30042
31111
  }
30043
31112
  },
31113
+ {
31114
+ "kind": "field",
31115
+ "name": "_sending",
31116
+ "type": {
31117
+ "text": "boolean"
31118
+ },
31119
+ "privacy": "private",
31120
+ "default": "false"
31121
+ },
31122
+ {
31123
+ "kind": "field",
31124
+ "name": "_sendingTimer",
31125
+ "type": {
31126
+ "text": "ReturnType<typeof setTimeout> | undefined"
31127
+ },
31128
+ "privacy": "private"
31129
+ },
31130
+ {
31131
+ "kind": "field",
31132
+ "name": "_stopHolding",
31133
+ "privacy": "private"
31134
+ },
31135
+ {
31136
+ "kind": "field",
31137
+ "name": "_onTurnStart",
31138
+ "privacy": "private",
31139
+ "description": "The latch ends when ITS chat's turn starts. Another chat's `aparte-message-start` crosses the\nwindow too, and must not release it: the second chip would then send a second message while the\nfirst is still being built. The composer's own rule: an event naming no chat is for every chat."
31140
+ },
31141
+ {
31142
+ "kind": "method",
31143
+ "name": "_ownChatId",
31144
+ "privacy": "private",
31145
+ "return": {
31146
+ "type": {
31147
+ "text": "string | undefined"
31148
+ }
31149
+ },
31150
+ "description": "The chat the sending composer belongs to: its `target`, else the id of the chat host above it."
31151
+ },
31152
+ {
31153
+ "kind": "method",
31154
+ "name": "_holdUntilStreaming",
31155
+ "privacy": "private",
31156
+ "return": {
31157
+ "type": {
31158
+ "text": "void"
31159
+ }
31160
+ },
31161
+ "description": "A chip sent: no other chip sends until the turn has started, or a second has passed without one."
31162
+ },
30044
31163
  {
30045
31164
  "kind": "method",
30046
31165
  "name": "_activate",
@@ -30096,7 +31215,7 @@
30096
31215
  "type": {
30097
31216
  "text": "boolean"
30098
31217
  },
30099
- "description": "Shows the replies the LAST message offered instead of fixed starters: a code block in language `suggestions` in that answer (`setupSuggestionBlocks`), e.g. the free times a booking bot proposes. Empty until an answer offers some, emptied the moment a message is sent, and when the last message is the person's."
31218
+ "description": "Shows the replies the LAST message offered instead of fixed starters: a code block in language `suggestions` in that answer (`setupSuggestionBlocks`), e.g. the free times a booking bot proposes. Written by the model, so a reply sends what its chip shows: its label, never a `prompt`. Empty until an answer offers some, emptied the moment a message is sent, and when the last message is the person's."
30100
31219
  },
30101
31220
  {
30102
31221
  "type": {
@@ -30202,6 +31321,24 @@
30202
31321
  "default": "'suggestions'",
30203
31322
  "description": "The language the block is written in."
30204
31323
  },
31324
+ {
31325
+ "kind": "function",
31326
+ "name": "visibleReply",
31327
+ "return": {
31328
+ "type": {
31329
+ "text": "string | null"
31330
+ }
31331
+ },
31332
+ "parameters": [
31333
+ {
31334
+ "name": "reply",
31335
+ "type": {
31336
+ "text": "Reply"
31337
+ }
31338
+ }
31339
+ ],
31340
+ "description": "A model-written reply, reduced to what its button shows: the label alone, never a `prompt`.\nRuns of whitespace collapse to one space. `null` for a reply with no label to see (blank),\na label with anything in it that draws nothing or reorders what is drawn (bidi controls,\ntag characters, variation selectors, stray joiners), and a label past 100 characters: what\nis sent must be exactly what the person can read on the chip."
31341
+ },
30205
31342
  {
30206
31343
  "kind": "function",
30207
31344
  "name": "setupSuggestionBlocks",
@@ -30231,6 +31368,14 @@
30231
31368
  "module": "src/components/suggestions/suggestion-blocks.ts"
30232
31369
  }
30233
31370
  },
31371
+ {
31372
+ "kind": "js",
31373
+ "name": "visibleReply",
31374
+ "declaration": {
31375
+ "name": "visibleReply",
31376
+ "module": "src/components/suggestions/suggestion-blocks.ts"
31377
+ }
31378
+ },
30234
31379
  {
30235
31380
  "kind": "js",
30236
31381
  "name": "setupSuggestionBlocks",
@@ -30685,6 +31830,16 @@
30685
31830
  "default": "false",
30686
31831
  "description": "When true, _reRenderActivePath() only dispatches aparte-path-changed without\ntouching the DOM. Set via setFrameworkManagedDOM(true) when a framework\n(e.g. Angular) owns the bubble elements."
30687
31832
  },
31833
+ {
31834
+ "kind": "field",
31835
+ "name": "_bulkAppend",
31836
+ "type": {
31837
+ "text": "boolean"
31838
+ },
31839
+ "privacy": "private",
31840
+ "default": "false",
31841
+ "description": "Inside `setMessages`: each append leaves the layout work to the end of the loop."
31842
+ },
30688
31843
  {
30689
31844
  "kind": "field",
30690
31845
  "name": "loading",
@@ -31416,17 +32571,6 @@
31416
32571
  ],
31417
32572
  "description": "Clear all messages and remove all bubble elements from the DOM.\nAlso dispatches a aparte-reset-done event.\n\nIn framework-managed mode the DOM is owned by the host framework\n(Angular"
31418
32573
  },
31419
- {
31420
- "kind": "method",
31421
- "name": "clearMessages",
31422
- "return": {
31423
- "type": {
31424
- "text": "void"
31425
- }
31426
- },
31427
- "description": "Clear all messages",
31428
- "deprecated": "Use clearAll() to also remove DOM bubbles"
31429
- },
31430
32574
  {
31431
32575
  "kind": "method",
31432
32576
  "name": "setMessages",
@@ -33302,7 +34446,7 @@
33302
34446
  "type": {
33303
34447
  "text": "AparteSegmentRenderer<AparteTextSegment>"
33304
34448
  },
33305
- "default": "{ type: 'text', render: (segment) => `<div class=\"aparte-segment aparte-segment-text\" data-segment-id=\"${escapeHtml(segment.id)}\"><div class=\"aparte-segment-content\" dir=\"auto\">${contextConfig().renderMarkdown(segment.content)}</div></div>`, /* * A fence in a settled text segment is highlighted, as the thinking renderer does for * its own. The parser turns a streamed fence into a `code` segment, so this only ever * mattered for text built by hand (`setSegments`, a restored message, a server's) — and * the bubble's own pass skips any message that has segments, so that fence stayed bare. */ setup: (el, segment) => { const contentEl = el.querySelector('.aparte-segment-content'); // Only a segment marked streaming is still being written: one with no flag at all — // `setSegments`, an `appendMessage` with segments — is finished, and is highlighted. if (!contentEl) return; renderCodeLanguages(contentEl, { streaming: segment.isStreaming === true }); if (segment.isStreaming !== true) highlightMarkdownFences(contentEl); renderCitations(contentEl as HTMLElement, segment); }, update: (el, segment) => { const contentEl = el.querySelector('.aparte-segment-content'); if (!contentEl) return; writeStreamedMarkdown( el as AparteMarkdownStreamHost, contentEl, segment.content, segment.isStreaming !== false, ); if (segment.isStreaming === false) highlightMarkdownFences(contentEl); // Every write: the text a chip sat in may have been written anew. renderCitations(contentEl as HTMLElement, segment); }, getStyles: () => `` }",
34449
+ "default": "{ type: 'text', render: (segment) => `<div class=\"aparte-segment aparte-segment-text\" data-segment-id=\"${escapeHtml(segment.id)}\"><div class=\"aparte-segment-content\" dir=\"auto\">${contextConfig().renderMarkdown(segment.content)}</div></div>`, /* * A fence in a settled text segment is highlighted, as the thinking renderer does for * its own. The parser turns a streamed fence into a `code` segment, so this only ever * mattered for text built by hand (`setSegments`, a restored message, a server's) — and * the bubble's own pass skips any message that has segments, so that fence stayed bare. */ setup: (el, segment) => { const contentEl = el.querySelector('.aparte-segment-content'); // Only a segment marked streaming is still being written: one with no flag at all — // `setSegments`, an `appendMessage` with segments — is finished, and is highlighted. if (!contentEl) return; if (segment.isStreaming === true) { // Drawn mid-stream (its first chunk, or a redraw): the streaming renderer writes // it, as it writes every chunk after. `render` went through the one-shot provider, // which reads `Done: **Book ` as finished text — marked showed that `**` raw until // the second chunk reached the streaming side, which completes it. writeStreamedMarkdown(el as AparteMarkdownStreamHost, contentEl, segment.content, true); } else { renderCodeLanguages(contentEl, { streaming: false }); highlightMarkdownFences(contentEl); } renderCitations(contentEl as HTMLElement, segment); }, update: (el, segment) => { const contentEl = el.querySelector('.aparte-segment-content'); if (!contentEl) return; writeStreamedMarkdown( el as AparteMarkdownStreamHost, contentEl, segment.content, segment.isStreaming !== false, ); if (segment.isStreaming === false) highlightMarkdownFences(contentEl); // Every write: the text a chip sat in may have been written anew. renderCitations(contentEl as HTMLElement, segment); }, getStyles: () => `` }",
33306
34450
  "description": "Text segment renderer.\n\nThe incremental-vs-one-shot Markdown machinery lives in\n`../markdown-stream.ts`, shared with the thinking renderer — see that file for\nwhy appending beats rebuilding, and what the settling update flushes."
33307
34451
  }
33308
34452
  ],
@@ -33327,7 +34471,7 @@
33327
34471
  "type": {
33328
34472
  "text": "AparteSegmentRenderer<AparteThinkingSegment>"
33329
34473
  },
33330
- "default": "{ type: 'thinking', /* * Markdown, like every other prose surface. * * The reasoning was rendered as escaped plain text in a `white-space: pre-wrap` * box, so a model that formats its thinking — headings, lists, `**bold**`, a * fenced snippet, which is most of them — showed its own syntax as literal * characters. Nothing said that was deliberate; it read as one, because the * `pre-wrap` made it look like a chosen preformatted block. * * `renderMarkdown` sanitizes its provider's output before it reaches innerHTML, * so this is exactly the text renderer's path, with the same guarantees and no * new class of risk. With no Markdown provider registered it degrades to the * zero-dependency default (escape + `<br>`), which is what it used to be. */ /* * WEARS THE ACCORDION RECIPE. A reasoning block is a disclosure — `<details>`, a * `<summary>` you press, a panel, a chevron that turns — which is exactly what * `surface/accordion.css` already draws, and this renderer used to draw a second * time under four classes of its own. Two costs, both visible: it looked unrelated * to every other disclosure in the library, and its chevron was the CHARACTER `▼`, * a fourth way to draw a chevron here and the only one that is not a glyph — so it * could not take `--aparte-icon-size`, could not be replaced through the icon * provider, and rendered in whatever the platform font felt like. * * What stays thinking's own is the left rail and the quieter tone, which is the * only part that is genuinely about reasoning rather than about disclosure. * `.aparte-thinking-label` stays too: `relabel` below queries it. */ render: (segment) => `<details class=\"aparte-segment aparte-segment-thinking aparte-accordion__item\" data-segment-id=\"${escapeHtml(segment.id)}\" ${segment.collapsed === false ? 'open' : ''}><summary class=\"aparte-accordion__header aparte-thinking-header\"><span class=\"aparte-thinking-label${escapeAttr(arriving(segment) ? ' aparte-shimmer' : '')}\">${escapeHtml(labelOf(segment))}</span><span class=\"aparte-accordion__icon\">${contextConfig().getIcon('expand')}</span></summary><div class=\"aparte-accordion__panel aparte-thinking-content\" dir=\"auto\" role=\"region\" tabindex=\"0\" aria-label=\"${escapeAttr(labelOf(segment))}\">${contextConfig().renderMarkdown(segment.content)}</div></details>`, /** * The default label is the only config-derived text here — and `segment.label` * still wins, exactly as in `render`, because that string is the app's. */ relabel: (el, segment) => setLabel(el, segment), /** A block restored from storage is drawn here: `update` only runs on one that changes. */ setup: (el, segment) => { const contentEl = el.querySelector('.aparte-thinking-content'); if (contentEl) renderCodeLanguages(contentEl, { streaming: arriving(segment) }); }, update: (el, segment) => { // The label follows the block: \"Thinking\" becomes its duration when it settles. setLabel(el, segment); // collapsed state is managed by _applySegmentUpdate based on explicit updates only — // never override what the user set by clicking <summary> const contentEl = el.querySelector('.aparte-thinking-content'); if (!contentEl) return; // Anchor to the bottom while the reasoning streams — but only if the reader // was already there. // // `.aparte-thinking-content` is its own scroll container (`max-height` + // `overflow-y: auto`), and this update replaced its text without touching // `scrollTop`. So every delta pushed the newest line below the fold and the // block sat frozen on the first 300px of a reasoning trace that kept // growing. Same rule as the transcript itself: follow the stream, unless the // reader has scrolled up to read — then leave their position alone. No // scroll-to-bottom button; being at the bottom is the whole signal. // // The measurement MUST happen before the write. Afterwards `scrollHeight` // has already grown by the new text, so the distance to the bottom is // whatever just arrived and the answer is always \"not at the bottom\" — the // block would then anchor exactly never. The transcript's own scroll // handling cost five wrong attempts on this ordering; it is written down // here so the sixth is not in this file. const wasAtBottom = contentEl.scrollHeight - contentEl.scrollTop - contentEl.clientHeight <= THINKING_ANCHOR_SLACK; const streaming = segment.isStreaming !== false; writeStreamedMarkdown(el as AparteMarkdownStreamHost, contentEl, segment.content, streaming); // Highlight on settle only, exactly like the code renderer: running a // highlighter on every token is the paint storm the incremental writer // exists to avoid. A fence inside reasoning is not a `code` SEGMENT — the // parser accumulates a thinking block raw until its closing delimiter — so // without this it would be the one code block in the transcript with no // highlighting. No copy button here: that would need real nested segments, // which is a design change and not this fix. if (!streaming) highlightMarkdownFences(contentEl); if (wasAtBottom) contentEl.scrollTop = contentEl.scrollHeight; }, getStyles: () => `` }"
34474
+ "default": "{ type: 'thinking', /* * Markdown, like every other prose surface. * * The reasoning was rendered as escaped plain text in a `white-space: pre-wrap` * box, so a model that formats its thinking — headings, lists, `**bold**`, a * fenced snippet, which is most of them — showed its own syntax as literal * characters. Nothing said that was deliberate; it read as one, because the * `pre-wrap` made it look like a chosen preformatted block. * * `renderMarkdown` sanitizes its provider's output before it reaches innerHTML, * so this is exactly the text renderer's path, with the same guarantees and no * new class of risk. With no Markdown provider registered it degrades to the * zero-dependency default (escape + `<br>`), which is what it used to be. */ /* * WEARS THE ACCORDION RECIPE. A reasoning block is a disclosure — `<details>`, a * `<summary>` you press, a panel, a chevron that turns — which is exactly what * `surface/accordion.css` already draws, and this renderer used to draw a second * time under four classes of its own. Two costs, both visible: it looked unrelated * to every other disclosure in the library, and its chevron was the CHARACTER `▼`, * a fourth way to draw a chevron here and the only one that is not a glyph — so it * could not take `--aparte-icon-size`, could not be replaced through the icon * provider, and rendered in whatever the platform font felt like. * * What stays thinking's own is the left rail and the quieter tone, which is the * only part that is genuinely about reasoning rather than about disclosure. * `.aparte-thinking-label` stays too: `relabel` below queries it. */ render: (segment) => `<details class=\"aparte-segment aparte-segment-thinking aparte-accordion__item\" data-segment-id=\"${escapeHtml(segment.id)}\" ${segment.collapsed === false ? 'open' : ''}><summary class=\"aparte-accordion__header aparte-thinking-header\"><span class=\"aparte-thinking-label${escapeAttr(arriving(segment) ? ' aparte-shimmer' : '')}\">${escapeHtml(labelOf(segment))}</span><span class=\"aparte-accordion__icon\">${contextConfig().getIcon('expand')}</span></summary><div class=\"aparte-accordion__panel aparte-thinking-content\" dir=\"auto\" role=\"region\" tabindex=\"0\" aria-label=\"${escapeAttr(labelOf(segment))}\">${contextConfig().renderMarkdown(segment.content)}</div></details>`, /** * The default label is the only config-derived text here — and `segment.label` * still wins, exactly as in `render`, because that string is the app's. */ relabel: (el, segment) => setLabel(el, segment), /** A block restored from storage is drawn here: `update` only runs on one that changes. */ setup: (el, segment) => { const contentEl = el.querySelector('.aparte-thinking-content'); if (!contentEl) return; // Drawn mid-stream, the streaming renderer writes it from the first chunk — as the // text renderer does, and for the same reason: `render`'s one-shot pass shows an // unclosed `**` raw until the next chunk. if (arriving(segment)) writeStreamedMarkdown(el as AparteMarkdownStreamHost, contentEl, segment.content, true); else renderCodeLanguages(contentEl, { streaming: false }); }, update: (el, segment) => { // The label follows the block: \"Thinking\" becomes its duration when it settles. setLabel(el, segment); // collapsed state is managed by _applySegmentUpdate based on explicit updates only — // never override what the user set by clicking <summary> const contentEl = el.querySelector('.aparte-thinking-content'); if (!contentEl) return; // Anchor to the bottom while the reasoning streams — but only if the reader // was already there. // // `.aparte-thinking-content` is its own scroll container (`max-height` + // `overflow-y: auto`), and this update replaced its text without touching // `scrollTop`. So every delta pushed the newest line below the fold and the // block sat frozen on the first 300px of a reasoning trace that kept // growing. Same rule as the transcript itself: follow the stream, unless the // reader has scrolled up to read — then leave their position alone. No // scroll-to-bottom button; being at the bottom is the whole signal. // // The measurement MUST happen before the write. Afterwards `scrollHeight` // has already grown by the new text, so the distance to the bottom is // whatever just arrived and the answer is always \"not at the bottom\" — the // block would then anchor exactly never. The transcript's own scroll // handling cost five wrong attempts on this ordering; it is written down // here so the sixth is not in this file. const wasAtBottom = contentEl.scrollHeight - contentEl.scrollTop - contentEl.clientHeight <= THINKING_ANCHOR_SLACK; const streaming = segment.isStreaming !== false; writeStreamedMarkdown(el as AparteMarkdownStreamHost, contentEl, segment.content, streaming); // Highlight on settle only, exactly like the code renderer: running a // highlighter on every token is the paint storm the incremental writer // exists to avoid. A fence inside reasoning is not a `code` SEGMENT — the // parser accumulates a thinking block raw until its closing delimiter — so // without this it would be the one code block in the transcript with no // highlighting. No copy button here: that would need real nested segments, // which is a design change and not this fix. if (!streaming) highlightMarkdownFences(contentEl); if (wasAtBottom) contentEl.scrollTop = contentEl.scrollHeight; }, getStyles: () => `` }"
33331
34475
  }
33332
34476
  ],
33333
34477
  "exports": [