@artooi/ag-ui-web-component 0.43.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4730,7 +4730,11 @@ var ConversationHistory = class {
4730
4730
  if (text4 !== "") {
4731
4731
  const restoredBubble = this.#host.appendMessage(MESSAGE_ROLE.ASSISTANT, text4);
4732
4732
  restoredBubble.classList.add("message--restored");
4733
- this.#host.actions.attach(restoredBubble);
4733
+ const id = message.id;
4734
+ this.#host.actions.attach(
4735
+ restoredBubble,
4736
+ typeof id === "string" && id !== "" ? { messageId: id } : { rateable: false }
4737
+ );
4734
4738
  }
4735
4739
  for (const call of restoredToolCalls(message.toolCalls)) {
4736
4740
  const restored = {
@@ -11016,11 +11020,16 @@ var AnswerActions = class {
11016
11020
  * something survives to go in it: an empty row still takes its margin, still
11017
11021
  * answers to the `message-actions` part, and still reads to a screen reader
11018
11022
  * as a group of actions with none in it.
11023
+ *
11024
+ * `message` names the answer, which is what a rating is filed under; a bubble
11025
+ * that is not an answer says so instead, and has no id to give.
11019
11026
  */
11020
- attach(bubble, options = {}) {
11027
+ attach(bubble, message) {
11021
11028
  const enabled = this.#enabled();
11022
11029
  const copyable = enabled.has(MESSAGE_ACTIONS.COPY);
11023
- const rateable = options.rateable !== false && enabled.has(MESSAGE_ACTIONS.FEEDBACK);
11030
+ const answer = "messageId" in message ? message : null;
11031
+ const rateable = answer !== null && enabled.has(MESSAGE_ACTIONS.FEEDBACK);
11032
+ const threadId = this.#host.threadId();
11024
11033
  if (copyable || rateable) {
11025
11034
  attachMessageActions(bubble, {
11026
11035
  strings: this.#host.strings(),
@@ -11037,7 +11046,16 @@ var AnswerActions = class {
11037
11046
  onFeedback: (rating) => {
11038
11047
  this.#host.element.dispatchEvent(
11039
11048
  new CustomEvent(FEEDBACK_EVENT, {
11040
- detail: { content: copyPayload(bubble).text, rating },
11049
+ detail: {
11050
+ content: copyPayload(bubble).text,
11051
+ rating,
11052
+ messageId: answer.messageId,
11053
+ threadId,
11054
+ // Omitted rather than undefined: a restored message has
11055
+ // no run, and a key holding nothing reads as one that
11056
+ // was looked up and came back empty.
11057
+ ...answer.runId === void 0 ? {} : { runId: answer.runId }
11058
+ },
11041
11059
  bubbles: true,
11042
11060
  composed: true
11043
11061
  })
@@ -13062,13 +13080,13 @@ function createDOMPurify() {
13062
13080
  }
13063
13081
  var purify_default = createDOMPurify();
13064
13082
 
13065
- // node_modules/.pnpm/marked@18.0.14/node_modules/marked/lib/marked.esm.js
13083
+ // node_modules/.pnpm/marked@18.1.0/node_modules/marked/lib/marked.esm.js
13066
13084
  function I() {
13067
13085
  return { async: false, breaks: false, extensions: null, gfm: true, hooks: null, pedantic: false, renderer: null, silent: false, tokenizer: null, walkTokens: null };
13068
13086
  }
13069
- var y = I();
13087
+ var P = I();
13070
13088
  function W(l3) {
13071
- y = l3;
13089
+ P = l3;
13072
13090
  }
13073
13091
  var A = { exec: () => null };
13074
13092
  function C(l3) {
@@ -13099,9 +13117,9 @@ var ze = /^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(
13099
13117
  var G = /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/;
13100
13118
  var Ae = /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/;
13101
13119
  var J = / {0,3}(?:[*+-]|\d{1,9}[.)])/;
13102
- var ce = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
13103
- var he = h(ce).replace(/bull/g, J).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
13104
- var Ee = h(ce).replace(/bull/g, J).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
13120
+ var he = /^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/;
13121
+ var de = h(he).replace(/bull/g, J).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/\|table/g, "").getRegex();
13122
+ var Ee = h(he).replace(/bull/g, J).replace(/blockCode/g, /(?: {4}| {0,3}\t)/).replace(/fences/g, / {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g, / {0,3}>/).replace(/heading/g, / {0,3}#{1,6}(?:\s|$)/).replace(/hr/g, / {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g, / {0,3}<[^\n>]+>\n/).replace(/table/g, / {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex();
13105
13123
  var V = /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/;
13106
13124
  var Me = /^[^\n]+/;
13107
13125
  var Y = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/;
@@ -13110,36 +13128,36 @@ var Ce = h(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g, J).getRegex();
13110
13128
  var N = "address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul";
13111
13129
  var ee = /<!--(?:-?>|[\s\S]*?(?:-->|$))/;
13112
13130
  var Be = h("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))", "i").replace("comment", ee).replace("tag", N).replace("attribute", / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
13113
- var de = (l3) => h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", l3).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
13114
- var De = de(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
13115
- var qe = de(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
13131
+ var ke = (l3) => h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("|table", "").replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", l3).replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
13132
+ var De = ke(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/);
13133
+ var qe = ke(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/);
13116
13134
  var ve = h(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph", qe).getRegex();
13117
- var te = { blockquote: ve, code: Le, def: Ie, fences: ze, heading: Ae, hr: G, html: Be, lheading: he, list: Ce, newline: $e, paragraph: De, table: A, text: Me };
13118
- var le = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
13119
- var Ze = { ...te, lheading: Ee, table: le, paragraph: h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", le).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex() };
13135
+ var te = { blockquote: ve, code: Le, def: Ie, fences: ze, heading: Ae, hr: G, html: Be, lheading: de, list: Ce, newline: $e, paragraph: De, table: A, text: Me };
13136
+ var ue = h("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("blockquote", " {0,3}>").replace("code", "(?: {4}| {0,3} )[^\\n]").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex();
13137
+ var Ze = { ...te, lheading: Ee, table: ue, paragraph: h(V).replace("hr", G).replace("heading", " {0,3}#{1,6}(?:\\s|$)").replace("|lheading", "").replace("table", ue).replace("blockquote", " {0,3}>").replace("fences", " {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list", " {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html", "</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag", N).getRegex() };
13120
13138
  var He = { ...te, html: h(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment", ee).replace(/tag/g, "(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(), def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/, heading: /^(#{1,6})(.*)(?:\n+|$)/, fences: A, lheading: /^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/, paragraph: h(V).replace("hr", G).replace("heading", ` *#{1,6} *[^
13121
- ]`).replace("lheading", he).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
13139
+ ]`).replace("lheading", de).replace("|table", "").replace("blockquote", " {0,3}>").replace("|fences", "").replace("|list", "").replace("|html", "").replace("|tag", "").getRegex() };
13122
13140
  var Ge = /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/;
13123
13141
  var Ne = /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/;
13124
- var ke = /^( {2,}|\\)\n(?!\s*$)[ \t]*/;
13142
+ var ge = /^( {2,}|\\)\n(?!\s*$)[ \t]*/;
13125
13143
  var Qe = /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/;
13126
13144
  var $ = /[\p{P}\p{S}]/u;
13127
13145
  var B = /[\s\p{P}\p{S}]/u;
13128
13146
  var Q = /[^\s\p{P}\p{S}]/u;
13129
13147
  var je = h(/^((?![*_])punctSpace)/, "u").replace(/punctSpace/g, B).getRegex();
13130
13148
  var Fe = /[\p{Pi}\p{Ps}"']/u;
13131
- var ge = /(?!~)[\p{P}\p{S}]/u;
13149
+ var fe = /(?!~)[\p{P}\p{S}]/u;
13132
13150
  var Ue = /(?!~)[\s\p{P}\p{S}]/u;
13133
13151
  var Ke = /(?:[^\s\p{P}\p{S}]|~)/u;
13134
13152
  var We = h(/link|precode-code|html/, "g").replace("link", /\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-", _e ? "(?<!`)()" : "(^^|[^`])").replace("code", /(?<b>`+)[^`]+\k<b>(?!`)/).replace("html", /<(?! )[^<>]*?>/).getRegex();
13135
- var fe = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
13136
- var Xe = h(fe, "u").replace(/punct/g, $).getRegex();
13137
- var Je = h(fe, "u").replace(/punct/g, ge).getRegex();
13153
+ var me = /^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/;
13154
+ var Xe = h(me, "u").replace(/punct/g, $).getRegex();
13155
+ var Je = h(me, "u").replace(/punct/g, fe).getRegex();
13138
13156
  var Ve = /^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/;
13139
13157
  var Ye = h(Ve, "u").replace(/openQuote/g, Fe).replace(/punct/g, $).getRegex();
13140
- var me = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
13141
- var et = h(me, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
13142
- var tt = h(me, "gu").replace(/notPunctSpace/g, Ke).replace(/punctSpace/g, Ue).replace(/punct/g, ge).getRegex();
13158
+ var xe = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)";
13159
+ var et = h(xe, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
13160
+ var tt = h(xe, "gu").replace(/notPunctSpace/g, Ke).replace(/punctSpace/g, Ue).replace(/punct/g, fe).getRegex();
13143
13161
  var nt = "^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)";
13144
13162
  var rt = h(nt, "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
13145
13163
  var st = h("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)", "gu").replace(/notPunctSpace/g, Q).replace(/punctSpace/g, B).replace(/punct/g, $).getRegex();
@@ -13152,32 +13170,32 @@ var pt = h(/\\(punct)/, "gu").replace(/punct/g, $).getRegex();
13152
13170
  var ct = h(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme", /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email", /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex();
13153
13171
  var ht = h(ee).replace("(?:-->|$)", "-->").getRegex();
13154
13172
  var dt = h("^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment", ht).replace("attribute", /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex();
13155
- var xe = /\[(?:\\[\s\S]|[^\[\]\\])*\]/;
13156
- var U = h(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", xe).getRegex();
13157
- var kt = h(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label", U).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
13173
+ var be = /\[(?:\\[\s\S]|[^\[\]\\])*\]/;
13174
+ var U = h(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets", be).getRegex();
13175
+ var kt = h(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label", U).replace("href", /<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title", /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex();
13158
13176
  var gt = h(/^!?\[(label)\]\[(ref)\]/).replace("label", U).replace("ref", Y).getRegex();
13159
13177
  var ft = h(/^!?\[(ref)\](?:\[\])?/).replace("ref", Y).getRegex();
13160
- var ue = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/;
13161
- var mt = h(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", xe).getRegex();
13162
- var xt = h("reflink|nolink(?!\\()", "g").replace("reflink", h(/^!?\[(label)\]\[(ref)\]/).replace("label", mt).replace("ref", ue).getRegex()).replace("nolink", h(/^!?\[(ref)\](?:\[\])?/).replace("ref", ue).getRegex()).getRegex();
13163
- var pe = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
13178
+ var pe = /(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/;
13179
+ var mt = h(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets", be).getRegex();
13180
+ var xt = h("reflink|nolink(?!\\()", "g").replace("reflink", h(/^!?\[(label)\]\[(ref)\]/).replace("label", mt).replace("ref", pe).getRegex()).replace("nolink", h(/^!?\[(ref)\](?:\[\])?/).replace("ref", pe).getRegex()).getRegex();
13181
+ var ce = /[hH][tT][tT][pP][sS]?|[fF][tT][pP]/;
13164
13182
  var bt = /[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/;
13165
13183
  var Rt = h(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g, bt).getRegex();
13166
- var ne = { _backpedal: A, anyPunctuation: pt, autolink: ct, blockSkip: We, br: ke, code: Ne, del: A, delLDelim: A, delRDelim: A, emStrongLDelim: Xe, emStrongRDelimAst: et, emStrongRDelimUnd: st, escape: Ge, link: kt, nolink: ft, punctuation: je, reflink: gt, reflinkSearch: xt, tag: dt, text: Qe, url: A };
13184
+ var ne = { _backpedal: A, anyPunctuation: pt, autolink: ct, blockSkip: We, br: ge, code: Ne, del: A, delLDelim: A, delRDelim: A, emStrongLDelim: Xe, emStrongRDelimAst: et, emStrongRDelimUnd: st, escape: Ge, link: kt, nolink: ft, punctuation: je, reflink: gt, reflinkSearch: xt, tag: dt, text: Qe, url: A };
13167
13185
  var Tt = { ...ne, emStrongLDelim: Ye, emStrongRDelimAst: rt, emStrongRDelimUnd: ot, link: h(/^!?\[(label)\]\((.*?)\)/).replace("label", U).getRegex(), reflink: h(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label", U).getRegex() };
13168
- var X = { ...ne, emStrongRDelimAst: tt, emStrongLDelim: Je, delLDelim: at, delRDelim: ut, url: h(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Rt).replace("protocol", pe).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: h(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", pe).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex() };
13169
- var Ot = { ...X, br: h(ke).replace("{2,}", "*").getRegex(), text: h(X.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
13186
+ var X = { ...ne, emStrongRDelimAst: tt, emStrongLDelim: Je, delLDelim: at, delRDelim: ut, url: h(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol", Rt).replace("protocol", ce).replace("email", /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, text: h(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace("protocol", ce).replace(/emailProtocol/g, /(?:mailto|xmpp):/).getRegex() };
13187
+ var Ot = { ...X, br: h(ge).replace("{2,}", "*").getRegex(), text: h(X.text).replace("\\b_", "\\b_| {2,}\\n").replace(/\{2,\}/g, "*").getRegex() };
13170
13188
  var j = { normal: te, gfm: Ze, pedantic: He };
13171
13189
  var D = { normal: ne, gfm: X, breaks: Ot, pedantic: Tt };
13172
13190
  var wt = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" };
13173
- var be = (l3) => wt[l3];
13191
+ var Re = (l3) => wt[l3];
13174
13192
  function O(l3, e) {
13175
13193
  if (e) {
13176
- if (x.escapeTest.test(l3)) return l3.replace(x.escapeReplace, be);
13177
- } else if (x.escapeTestNoEncode.test(l3)) return l3.replace(x.escapeReplaceNoEncode, be);
13194
+ if (x.escapeTest.test(l3)) return l3.replace(x.escapeReplace, Re);
13195
+ } else if (x.escapeTestNoEncode.test(l3)) return l3.replace(x.escapeReplaceNoEncode, Re);
13178
13196
  return l3;
13179
13197
  }
13180
- function Re(l3) {
13198
+ function Te(l3) {
13181
13199
  return l3.replace(x.numericCharacterReference, (e, t, n) => {
13182
13200
  let s = t === void 0 ? Number.parseInt(n, 16) : Number.parseInt(t, 10);
13183
13201
  return s === 0 || s > 1114111 || s >= 55296 && s <= 57343 ? "\uFFFD" : String.fromCodePoint(s);
@@ -13224,15 +13242,15 @@ function ie(l3) {
13224
13242
  function q(l3) {
13225
13243
  return l3.trim().toLowerCase().toUpperCase().toLowerCase();
13226
13244
  }
13227
- function Te(l3, e) {
13228
- if (l3.indexOf(e[1]) === -1) return -1;
13245
+ function oe(l3, e) {
13246
+ if (l3.indexOf(e[0]) === -1 && l3.indexOf(e[1]) === -1) return -1;
13229
13247
  let t = 0;
13230
13248
  for (let n = 0; n < l3.length; n++) if (l3[n] === "\\") n++;
13231
13249
  else if (l3[n] === e[0]) t++;
13232
13250
  else if (l3[n] === e[1] && (t--, t < 0)) return n;
13233
13251
  return t > 0 ? -2 : -1;
13234
13252
  }
13235
- function oe(l3, e = 0) {
13253
+ function ae(l3, e = 0) {
13236
13254
  let t = e, n = "";
13237
13255
  for (let s of l3) if (s === " ") {
13238
13256
  let r = 4 - t % 4;
@@ -13255,7 +13273,7 @@ function Oe(l3, e, t, n, s) {
13255
13273
  }
13256
13274
  return { type: u ? "image" : "link", raw: t, href: r, title: o, text: i, tokens: c };
13257
13275
  }
13258
- function yt(l3, e, t) {
13276
+ function Pt(l3, e, t) {
13259
13277
  let n = l3.match(t.other.indentCodeCompensation);
13260
13278
  if (n === null) return e;
13261
13279
  let s = n[1];
@@ -13291,12 +13309,12 @@ function we(l3, e, t, n) {
13291
13309
  }
13292
13310
  return false;
13293
13311
  }
13294
- var P = class {
13312
+ var y = class {
13295
13313
  options;
13296
13314
  rules;
13297
13315
  lexer;
13298
13316
  constructor(e) {
13299
- this.options = e || y;
13317
+ this.options = e || P;
13300
13318
  }
13301
13319
  space(e) {
13302
13320
  let t = this.rules.block.newline.exec(e);
@@ -13312,7 +13330,7 @@ var P = class {
13312
13330
  fences(e) {
13313
13331
  let t = this.rules.block.fences.exec(e);
13314
13332
  if (t) {
13315
- let n = t[0], s = yt(n, t[3] || "", this.rules);
13333
+ let n = t[0], s = Pt(n, t[3] || "", this.rules);
13316
13334
  return { type: "code", raw: n, lang: t[2] ? t[2].trim().replace(this.rules.inline.anyPunctuation, "$1") : t[2], text: s };
13317
13335
  }
13318
13336
  }
@@ -13389,19 +13407,19 @@ ${Z.join(`
13389
13407
  if (!(t = o.exec(e)) || this.rules.block.hr.test(e)) break;
13390
13408
  p = t[0], e = e.substring(p.length);
13391
13409
  let d = t[2].split(`
13392
- `, 1)[0], m = t[1].length, b = this.options.pedantic ? oe(d, m) : d.replace(this.rules.other.leadingSpaceTab, (M) => oe(M, m)), g = e.split(`
13410
+ `, 1)[0], m = t[1].length, b = this.options.pedantic ? ae(d, m) : d.replace(this.rules.other.leadingSpaceTab, (M) => ae(M, m)), g = e.split(`
13393
13411
  `, 1)[0], w = !b.trim(), f = 0;
13394
13412
  if (this.options.pedantic ? (f = 2, c = b.trimStart()) : w ? f = m + 1 : (f = b.search(this.rules.other.nonSpaceChar), f = f > 4 ? 1 : f, c = b.slice(f), f += m), w && this.rules.other.blankLine.test(g) && (p += g + `
13395
13413
  `, e = e.substring(g.length + 1), a = true), !a) {
13396
- let M = this.rules.other.nextBulletRegex(f), v = this.rules.other.hrRegex(f), Z = this.rules.other.fencesBeginRegex(f), ae = this.rules.other.headingBeginRegex(f), ye = this.rules.other.htmlBeginRegex(f), Pe = this.rules.other.blockquoteBeginRegex(f);
13414
+ let M = this.rules.other.nextBulletRegex(f), v = this.rules.other.hrRegex(f), Z = this.rules.other.fencesBeginRegex(f), le = this.rules.other.headingBeginRegex(f), Pe = this.rules.other.htmlBeginRegex(f), ye = this.rules.other.blockquoteBeginRegex(f);
13397
13415
  for (; e; ) {
13398
13416
  let K = e.split(`
13399
13417
  `, 1)[0], H;
13400
- if (g = K, this.options.pedantic ? (g = g.replace(this.rules.other.listReplaceNesting, " "), H = g) : H = g.replace(this.rules.other.leadingSpaceTab, (Se) => Se.replace(this.rules.other.tabCharGlobal, " ")), Z.test(g) || ae.test(g) || ye.test(g) || Pe.test(g) || M.test(g) || v.test(g)) break;
13418
+ if (g = K, this.options.pedantic ? (g = g.replace(this.rules.other.listReplaceNesting, " "), H = g) : H = g.replace(this.rules.other.leadingSpaceTab, (Se) => Se.replace(this.rules.other.tabCharGlobal, " ")), Z.test(g) || le.test(g) || Pe.test(g) || ye.test(g) || M.test(g) || v.test(g)) break;
13401
13419
  if (H.search(this.rules.other.nonSpaceChar) >= f || !g.trim()) c += `
13402
13420
  ` + H.slice(f);
13403
13421
  else {
13404
- if (w || b.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Z.test(b) || ae.test(b) || v.test(b)) break;
13422
+ if (w || b.replace(this.rules.other.tabCharGlobal, " ").search(this.rules.other.nonSpaceChar) >= 4 || Z.test(b) || le.test(b) || v.test(b)) break;
13405
13423
  c += `
13406
13424
  ` + g;
13407
13425
  }
@@ -13451,6 +13469,7 @@ ${Z.join(`
13451
13469
  def(e) {
13452
13470
  let t = this.rules.block.def.exec(e);
13453
13471
  if (t) {
13472
+ if (!this.rules.other.startAngleBracket.test(t[2]) && oe(t[2], "()") !== -1) return;
13454
13473
  let n = q(t[1]).replace(this.rules.other.multipleSpaceGlobal, " "), s = t[2] ? t[2].replace(this.rules.other.hrefBrackets, "$1").replace(this.rules.inline.anyPunctuation, "$1") : "", r = t[3] ? t[3].substring(1, t[3].length - 1).replace(this.rules.inline.anyPunctuation, "$1") : t[3];
13455
13474
  return { type: "def", tag: n, raw: L(t[0], `
13456
13475
  `), href: s, title: r };
@@ -13498,6 +13517,7 @@ ${Z.join(`
13498
13517
  if (t) return !this.lexer.state.inLink && this.rules.other.startATag.test(t[0]) ? this.lexer.state.inLink = true : this.lexer.state.inLink && this.rules.other.endATag.test(t[0]) && (this.lexer.state.inLink = false), !this.lexer.state.inRawBlock && this.rules.other.startPreScriptTag.test(t[0]) ? this.lexer.state.inRawBlock = true : this.lexer.state.inRawBlock && this.rules.other.endPreScriptTag.test(t[0]) && (this.lexer.state.inRawBlock = false), { type: "html", raw: t[0], inLink: this.lexer.state.inLink, inRawBlock: this.lexer.state.inRawBlock, block: false, text: t[0] };
13499
13518
  }
13500
13519
  link(e) {
13520
+ if (this.lexer.state.linkParenPossible === false) return;
13501
13521
  let t = this.rules.inline.link.exec(e);
13502
13522
  if (t) {
13503
13523
  let n = t[0].charAt(0) === "!" ? 2 : 1;
@@ -13508,7 +13528,7 @@ ${Z.join(`
13508
13528
  let i = L(s.slice(0, -1), "\\");
13509
13529
  if ((s.length - i.length) % 2 === 0) return;
13510
13530
  } else {
13511
- let i = Te(t[2], "()");
13531
+ let i = oe(t[2], "()");
13512
13532
  if (i === -2) return;
13513
13533
  if (i > -1) {
13514
13534
  let a = (t[0].indexOf("!") === 0 ? 5 : 4) + t[1].length + i;
@@ -13620,7 +13640,7 @@ ${Z.join(`
13620
13640
  let t = this.rules.inline.text.exec(e);
13621
13641
  if (t) {
13622
13642
  let n = this.lexer.state.inRawBlock;
13623
- return { type: "text", raw: t[0], text: n ? t[0] : Re(t[0]), escaped: n };
13643
+ return { type: "text", raw: t[0], text: n ? t[0] : Te(t[0]), escaped: n };
13624
13644
  }
13625
13645
  }
13626
13646
  };
@@ -13631,7 +13651,7 @@ var R = class l {
13631
13651
  inlineQueue;
13632
13652
  tokenizer;
13633
13653
  constructor(e) {
13634
- this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || y, this.options.tokenizer = this.options.tokenizer || new P(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, linkEmitted: false, top: true };
13654
+ this.tokens = [], this.tokens.links = /* @__PURE__ */ Object.create(null), this.options = e || P, this.options.tokenizer = this.options.tokenizer || new y(), this.tokenizer = this.options.tokenizer, this.tokenizer.options = this.options, this.tokenizer.lexer = this, this.inlineQueue = [], this.state = { inLink: false, inRawBlock: false, linkEmitted: false, linkParenPossible: true, top: true };
13635
13655
  let t = { other: x, block: j.normal, inline: D.normal };
13636
13656
  this.options.pedantic ? (t.block = j.pedantic, t.inline = D.pedantic) : this.options.gfm && (t.block = j.gfm, this.options.breaks ? t.inline = D.breaks : t.inline = D.gfm), this.tokenizer.rules = t;
13637
13657
  }
@@ -13767,6 +13787,15 @@ var R = class l {
13767
13787
  }
13768
13788
  inlineTokens(e, t = []) {
13769
13789
  this.tokenizer.lexer = this;
13790
+ let n = this.state.linkParenPossible;
13791
+ this.state.linkParenPossible = n && e.includes(")");
13792
+ try {
13793
+ return this.#e(e, t);
13794
+ } finally {
13795
+ this.state.linkParenPossible = n;
13796
+ }
13797
+ }
13798
+ #e(e, t) {
13770
13799
  let n = e;
13771
13800
  if (this.tokens.links && e.includes("[")) {
13772
13801
  let i = this.tokenizer.rules.inline.reflinkSearch, u = (a) => {
@@ -13866,7 +13895,7 @@ var S = class {
13866
13895
  options;
13867
13896
  parser;
13868
13897
  constructor(e) {
13869
- this.options = e || y;
13898
+ this.options = e || P;
13870
13899
  }
13871
13900
  space(e) {
13872
13901
  return "";
@@ -14017,7 +14046,7 @@ var T = class l2 {
14017
14046
  renderer;
14018
14047
  textRenderer;
14019
14048
  constructor(e) {
14020
- this.options = e || y, this.options.renderer = this.options.renderer || new S(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new z();
14049
+ this.options = e || P, this.options.renderer = this.options.renderer || new S(), this.renderer = this.options.renderer, this.renderer.options = this.options, this.renderer.parser = this, this.textRenderer = new z();
14021
14050
  }
14022
14051
  static parse(e, t) {
14023
14052
  return new l2(t).parse(e);
@@ -14168,7 +14197,7 @@ var _ = class {
14168
14197
  options;
14169
14198
  block;
14170
14199
  constructor(e) {
14171
- this.options = e || y;
14200
+ this.options = e || P;
14172
14201
  }
14173
14202
  static passThroughHooks = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens", "emStrongMask"]);
14174
14203
  static passThroughHooksRespectAsync = /* @__PURE__ */ new Set(["preprocess", "postprocess", "processAllTokens"]);
@@ -14200,7 +14229,7 @@ var F = class {
14200
14229
  Renderer = S;
14201
14230
  TextRenderer = z;
14202
14231
  Lexer = R;
14203
- Tokenizer = P;
14232
+ Tokenizer = y;
14204
14233
  Hooks = _;
14205
14234
  constructor(...e) {
14206
14235
  this.use(...e);
@@ -14262,7 +14291,7 @@ var F = class {
14262
14291
  s.renderer = r;
14263
14292
  }
14264
14293
  if (n.tokenizer) {
14265
- let r = this.defaults.tokenizer || new P(this.defaults);
14294
+ let r = this.defaults.tokenizer || new y(this.defaults);
14266
14295
  for (let o in n.tokenizer) {
14267
14296
  if (!(o in r)) throw new Error(`tokenizer '${o}' does not exist`);
14268
14297
  if (["options", "rules", "lexer"].includes(o)) continue;
@@ -14360,11 +14389,11 @@ k.options = k.setOptions = function(l3) {
14360
14389
  return E.setOptions(l3), k.defaults = E.defaults, W(k.defaults), k;
14361
14390
  };
14362
14391
  k.getDefaults = I;
14363
- k.defaults = y;
14364
- function Pt(...l3) {
14392
+ k.defaults = P;
14393
+ function yt(...l3) {
14365
14394
  return E.use(...l3), k.defaults = E.defaults, W(k.defaults), k;
14366
14395
  }
14367
- k.use = Pt;
14396
+ k.use = yt;
14368
14397
  k.walkTokens = function(l3, e) {
14369
14398
  return E.walkTokens(l3, e);
14370
14399
  };
@@ -14375,7 +14404,7 @@ k.Renderer = S;
14375
14404
  k.TextRenderer = z;
14376
14405
  k.Lexer = R;
14377
14406
  k.lexer = R.lex;
14378
- k.Tokenizer = P;
14407
+ k.Tokenizer = y;
14379
14408
  k.Hooks = _;
14380
14409
  k.parse = k;
14381
14410
  var gn = k.options;
@@ -15650,10 +15679,14 @@ var AgUiClient = class {
15650
15679
  const closed = this.#closedMessageIds;
15651
15680
  const cancelled = () => this.#cancelled;
15652
15681
  const pendingDeltas = /* @__PURE__ */ new Set();
15682
+ let runId;
15653
15683
  return {
15654
15684
  onRunInitialized() {
15655
15685
  h2.onRunStart();
15656
15686
  },
15687
+ onRunStartedEvent({ event }) {
15688
+ runId = event.runId;
15689
+ },
15657
15690
  onTextMessageStartEvent({ event }) {
15658
15691
  if (closed.has(event.messageId)) {
15659
15692
  console.warn(
@@ -15666,7 +15699,10 @@ var AgUiClient = class {
15666
15699
  },
15667
15700
  onTextMessageEndEvent({ event, textMessageBuffer }) {
15668
15701
  closed.add(event.messageId);
15669
- h2.onTextEnd(textMessageBuffer);
15702
+ h2.onTextEnd(textMessageBuffer, {
15703
+ messageId: event.messageId,
15704
+ ...runId === void 0 ? {} : { runId }
15705
+ });
15670
15706
  },
15671
15707
  onToolCallEndEvent({ event, toolCallName, toolCallArgs }) {
15672
15708
  const call = {
@@ -16323,7 +16359,7 @@ var RunHandlers = class {
16323
16359
  this.#host.stream.queue(buffer);
16324
16360
  this.#host.stream.countDelta();
16325
16361
  },
16326
- onTextEnd: (buffer) => {
16362
+ onTextEnd: (buffer, message) => {
16327
16363
  if (buffer === "") {
16328
16364
  this.#host.stream.end();
16329
16365
  return;
@@ -16333,7 +16369,7 @@ var RunHandlers = class {
16333
16369
  this.#host.transcript.revealWords(bubble);
16334
16370
  }
16335
16371
  attachCopyButtons(bubble, this.#host.strings());
16336
- this.#host.actions.attach(bubble);
16372
+ this.#host.actions.attach(bubble, message);
16337
16373
  this.#host.stream.end();
16338
16374
  this.#host.noteUnread();
16339
16375
  },
@@ -16999,7 +17035,9 @@ var AgUiChat = class extends HTMLElement {
16999
17035
  strings: () => this.#strings,
17000
17036
  retry: () => {
17001
17037
  void this.retryLastTurn();
17002
- }
17038
+ },
17039
+ // Late-bound: the history is built in the constructor, after this field.
17040
+ threadId: () => this.#history.threadId
17003
17041
  });
17004
17042
  #root;
17005
17043
  /** The screen-reader-only status region the run and its tool calls report into. */
@@ -19277,7 +19315,7 @@ function setControlValue(el2, value) {
19277
19315
  }
19278
19316
 
19279
19317
  // src/version.ts
19280
- var VERSION = "0.43.0";
19318
+ var VERSION = "0.44.0";
19281
19319
  export {
19282
19320
  ATTACHMENT_EVENT,
19283
19321
  AgUiChat,