@voicethere/agent 0.23.2 → 0.25.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.
@@ -1080,6 +1080,14 @@ function buildIdleEnv(sessionId) {
1080
1080
  ...process.env.IDLE_TIMEOUT_SEC ? { IDLE_TIMEOUT_SEC: process.env.IDLE_TIMEOUT_SEC } : {}
1081
1081
  };
1082
1082
  }
1083
+ function speakKindFields(options) {
1084
+ if (options?.kind !== "filler")
1085
+ return {};
1086
+ return {
1087
+ kind: "filler",
1088
+ ...options.fillerKind ? { fillerKind: options.fillerKind } : {}
1089
+ };
1090
+ }
1083
1091
  function speakControlAvailableFor(sessionId) {
1084
1092
  return speakControlAvailableBySessionId.get(sessionId) ?? false;
1085
1093
  }
@@ -1117,7 +1125,8 @@ function speak(sessionId, text, options) {
1117
1125
  type: "speak",
1118
1126
  sessionId,
1119
1127
  text,
1120
- ...options?.interruptible === false ? { interruptible: false } : {}
1128
+ ...options?.interruptible === false ? { interruptible: false } : {},
1129
+ ...speakKindFields(options)
1121
1130
  });
1122
1131
  warnSpeakControlUnavailable(sessionId);
1123
1132
  return handle({ requestId, status: "unsupported", playedMs: 0 });
@@ -1149,7 +1158,8 @@ function speak(sessionId, text, options) {
1149
1158
  requestId,
1150
1159
  ...options?.interruptible === false ? { interruptible: false } : {},
1151
1160
  ...turnId ? { turnId } : {},
1152
- ...inReplyTo ? { inReplyTo } : {}
1161
+ ...inReplyTo ? { inReplyTo } : {},
1162
+ ...speakKindFields(options)
1153
1163
  });
1154
1164
  return {
1155
1165
  requestId,
@@ -1154,6 +1154,14 @@ function buildIdleEnv(sessionId) {
1154
1154
  ...process.env.IDLE_TIMEOUT_SEC ? { IDLE_TIMEOUT_SEC: process.env.IDLE_TIMEOUT_SEC } : {}
1155
1155
  };
1156
1156
  }
1157
+ function speakKindFields(options) {
1158
+ if (options?.kind !== "filler")
1159
+ return {};
1160
+ return {
1161
+ kind: "filler",
1162
+ ...options.fillerKind ? { fillerKind: options.fillerKind } : {}
1163
+ };
1164
+ }
1157
1165
  function speakControlAvailableFor(sessionId) {
1158
1166
  return speakControlAvailableBySessionId.get(sessionId) ?? false;
1159
1167
  }
@@ -1191,7 +1199,8 @@ function speak(sessionId, text, options) {
1191
1199
  type: "speak",
1192
1200
  sessionId,
1193
1201
  text,
1194
- ...options?.interruptible === false ? { interruptible: false } : {}
1202
+ ...options?.interruptible === false ? { interruptible: false } : {},
1203
+ ...speakKindFields(options)
1195
1204
  });
1196
1205
  warnSpeakControlUnavailable(sessionId);
1197
1206
  return handle({ requestId, status: "unsupported", playedMs: 0 });
@@ -1223,7 +1232,8 @@ function speak(sessionId, text, options) {
1223
1232
  requestId,
1224
1233
  ...options?.interruptible === false ? { interruptible: false } : {},
1225
1234
  ...turnId ? { turnId } : {},
1226
- ...inReplyTo ? { inReplyTo } : {}
1235
+ ...inReplyTo ? { inReplyTo } : {},
1236
+ ...speakKindFields(options)
1227
1237
  });
1228
1238
  return {
1229
1239
  requestId,
@@ -31724,6 +31724,14 @@ function buildIdleEnv(sessionId) {
31724
31724
  ...process.env.IDLE_TIMEOUT_SEC ? { IDLE_TIMEOUT_SEC: process.env.IDLE_TIMEOUT_SEC } : {}
31725
31725
  };
31726
31726
  }
31727
+ function speakKindFields(options) {
31728
+ if (options?.kind !== "filler")
31729
+ return {};
31730
+ return {
31731
+ kind: "filler",
31732
+ ...options.fillerKind ? { fillerKind: options.fillerKind } : {}
31733
+ };
31734
+ }
31727
31735
  function speakControlAvailableFor(sessionId) {
31728
31736
  return speakControlAvailableBySessionId.get(sessionId) ?? false;
31729
31737
  }
@@ -31761,7 +31769,8 @@ function speak(sessionId, text, options) {
31761
31769
  type: "speak",
31762
31770
  sessionId,
31763
31771
  text,
31764
- ...options?.interruptible === false ? { interruptible: false } : {}
31772
+ ...options?.interruptible === false ? { interruptible: false } : {},
31773
+ ...speakKindFields(options)
31765
31774
  });
31766
31775
  warnSpeakControlUnavailable(sessionId);
31767
31776
  return handle({ requestId, status: "unsupported", playedMs: 0 });
@@ -31793,7 +31802,8 @@ function speak(sessionId, text, options) {
31793
31802
  requestId,
31794
31803
  ...options?.interruptible === false ? { interruptible: false } : {},
31795
31804
  ...turnId ? { turnId } : {},
31796
- ...inReplyTo ? { inReplyTo } : {}
31805
+ ...inReplyTo ? { inReplyTo } : {},
31806
+ ...speakKindFields(options)
31797
31807
  });
31798
31808
  return {
31799
31809
  requestId,
@@ -34990,6 +35000,24 @@ var ConversationHistory = class {
34990
35000
 
34991
35001
  // dist/llm/agent/link-extractor.js
34992
35002
  var LINK_MARK = "\uE000";
35003
+ var BARE_DOMAIN_TLDS = /* @__PURE__ */ new Set([
35004
+ "com",
35005
+ "org",
35006
+ "net",
35007
+ "dev",
35008
+ "io",
35009
+ "ai",
35010
+ "app",
35011
+ "co",
35012
+ "cloud",
35013
+ "eu",
35014
+ "de",
35015
+ "uk",
35016
+ "us"
35017
+ ]);
35018
+ var DOMAIN_RE = /^((?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+([a-z]{2,63}))(\/[^\s]*)?/i;
35019
+ var DOMAIN_PREFIX_RE = /^[a-z0-9][a-z0-9.-]*$/i;
35020
+ var ALNUM_RE = /[\p{L}\p{N}]/u;
34993
35021
  var SCHEMES = ["https://", "http://"];
34994
35022
  var START_RE = /\[|https?:\/\//i;
34995
35023
  var BARE_RE = /^https?:\/\/\S*/i;
@@ -35055,6 +35083,85 @@ function hasHost(url2) {
35055
35083
  var LinkExtractor = class {
35056
35084
  buf = "";
35057
35085
  links = [];
35086
+ /**
35087
+ * The emitted tail of the current word when it is made only of host
35088
+ * characters (`[a-z0-9.-]`), and the character before that word. A word
35089
+ * such as "voicethere" is spoken before ".dev" arrives; the lead lets the
35090
+ * domain still be recognised, so streaming gives the same result as one push.
35091
+ */
35092
+ lead = "";
35093
+ leadPrev = "";
35094
+ consume(n) {
35095
+ const taken = this.buf.slice(0, n);
35096
+ this.buf = this.buf.slice(n);
35097
+ const s = this.lead + taken;
35098
+ let k = -1;
35099
+ for (let j = s.length - 1; j >= 0; j -= 1) {
35100
+ if (!/[a-z0-9.-]/i.test(s[j])) {
35101
+ k = j;
35102
+ break;
35103
+ }
35104
+ }
35105
+ if (k >= 0) {
35106
+ this.leadPrev = s[k];
35107
+ this.lead = s.slice(k + 1);
35108
+ } else {
35109
+ this.lead = s;
35110
+ }
35111
+ if (this.lead.length > MAX_HOLD) {
35112
+ this.lead = "";
35113
+ this.leadPrev = "x";
35114
+ }
35115
+ return taken;
35116
+ }
35117
+ /** After a link: the text now ends in a mark, so no word is open. */
35118
+ closeWord() {
35119
+ this.lead = "";
35120
+ this.leadPrev = LINK_MARK;
35121
+ }
35122
+ /** The first bare domain (or possible start of one at the tail) in the buffer. */
35123
+ scanDomain(final) {
35124
+ const off = this.lead.length;
35125
+ const ctx = this.lead + this.buf;
35126
+ for (let i = 0; i < ctx.length; i += 1) {
35127
+ if (!/[a-z0-9]/i.test(ctx[i]))
35128
+ continue;
35129
+ const before = i === 0 ? this.leadPrev : ctx[i - 1];
35130
+ if (!(before === "" || /[\s("']/.test(before)))
35131
+ continue;
35132
+ const rest = ctx.slice(i);
35133
+ const m = DOMAIN_RE.exec(rest);
35134
+ if (!m) {
35135
+ if (!final && rest.length <= MAX_HOLD && rest.includes(".") && DOMAIN_PREFIX_RE.test(rest)) {
35136
+ return { index: i, hold: true, off };
35137
+ }
35138
+ continue;
35139
+ }
35140
+ const host = m[1];
35141
+ const path2 = m[3] ?? "";
35142
+ const end = m[0].length;
35143
+ if (!final && end === rest.length && end <= MAX_HOLD) {
35144
+ return { index: i, hold: true, off };
35145
+ }
35146
+ const next = rest[end] ?? "";
35147
+ if (!final && !path2 && next === "." && end + 1 === rest.length) {
35148
+ return { index: i, hold: true, off };
35149
+ }
35150
+ if (!BARE_DOMAIN_TLDS.has(m[2].toLowerCase()))
35151
+ continue;
35152
+ if (!path2) {
35153
+ if (next && /[\p{L}\p{N}@_-]/u.test(next))
35154
+ continue;
35155
+ if (next === "." && ALNUM_RE.test(rest[end + 1] ?? ""))
35156
+ continue;
35157
+ }
35158
+ const { url: url2 } = trimUrl(host + path2);
35159
+ if (i < off && host.length < off - i)
35160
+ continue;
35161
+ return { index: i, hold: false, off, host, url: url2 };
35162
+ }
35163
+ return void 0;
35164
+ }
35058
35165
  push(delta) {
35059
35166
  this.buf += delta;
35060
35167
  return this.drain(false);
@@ -35072,54 +35179,65 @@ var LinkExtractor = class {
35072
35179
  this.links = [];
35073
35180
  return all;
35074
35181
  }
35075
- add(url2, label) {
35182
+ add(url2, label, sourceText) {
35076
35183
  const trimmed = label?.trim();
35077
35184
  this.links.push({
35078
35185
  url: url2,
35079
35186
  ...trimmed ? { label: trimmed } : {},
35080
- secure: /^https:\/\//i.test(url2)
35187
+ secure: /^https:\/\//i.test(url2),
35188
+ ...sourceText ? { sourceText } : {}
35081
35189
  });
35082
35190
  }
35083
35191
  drain(final) {
35084
35192
  let out = "";
35085
35193
  for (; ; ) {
35086
35194
  const m = START_RE.exec(this.buf);
35195
+ const d = this.scanDomain(final);
35196
+ if (d && (!m || Math.max(0, d.index - d.off) < m.index)) {
35197
+ const spoken = Math.max(0, d.off - d.index);
35198
+ out += this.consume(Math.max(0, d.index - d.off));
35199
+ if (d.hold)
35200
+ return out;
35201
+ this.add("https://" + d.url, d.host, d.url);
35202
+ this.consume(d.url.length - spoken);
35203
+ out += d.host.slice(spoken) + LINK_MARK;
35204
+ this.closeWord();
35205
+ continue;
35206
+ }
35087
35207
  if (!m) {
35088
35208
  const hold = final ? 0 : partialSchemeSuffix(this.buf);
35089
- out += this.buf.slice(0, this.buf.length - hold);
35090
- this.buf = this.buf.slice(this.buf.length - hold);
35209
+ out += this.consume(this.buf.length - hold);
35091
35210
  return out;
35092
35211
  }
35093
- out += this.buf.slice(0, m.index);
35094
- this.buf = this.buf.slice(m.index);
35212
+ out += this.consume(m.index);
35095
35213
  if (this.buf[0] === "[") {
35096
35214
  const md = MARKDOWN_RE.exec(this.buf);
35097
35215
  if (md && hasHost(md[2])) {
35098
35216
  this.add(md[2], md[1]);
35099
35217
  out += `${md[1]}${LINK_MARK}`;
35100
- this.buf = this.buf.slice(md[0].length);
35218
+ this.consume(md[0].length);
35219
+ this.closeWord();
35101
35220
  continue;
35102
35221
  }
35103
35222
  if (!final && this.buf.length <= MAX_HOLD && MARKDOWN_PREFIX_RE.test(this.buf)) {
35104
35223
  return out;
35105
35224
  }
35106
- out += "[";
35107
- this.buf = this.buf.slice(1);
35225
+ out += this.consume(1);
35108
35226
  continue;
35109
35227
  }
35110
35228
  const bare = BARE_RE.exec(this.buf);
35111
35229
  if (!final && bare[0].length === this.buf.length && this.buf.length <= MAX_HOLD) {
35112
35230
  return out;
35113
35231
  }
35114
- const { url: url2, rest } = trimUrl(bare[0]);
35232
+ const { url: url2 } = trimUrl(bare[0]);
35115
35233
  if (!hasHost(url2)) {
35116
- out += bare[0];
35117
- this.buf = this.buf.slice(bare[0].length);
35234
+ out += this.consume(bare[0].length);
35118
35235
  continue;
35119
35236
  }
35120
35237
  this.add(url2);
35121
35238
  out += LINK_MARK;
35122
- this.buf = rest + this.buf.slice(bare[0].length);
35239
+ this.consume(url2.length);
35240
+ this.closeWord();
35123
35241
  }
35124
35242
  }
35125
35243
  };
@@ -35451,7 +35569,7 @@ ${validated.errors.map((e) => `${e.path || "(root)"}: ${e.message}`).join("\n")}
35451
35569
  t.linksDropped += 1;
35452
35570
  return;
35453
35571
  }
35454
- if (linksRequireToolSource && !t.toolResults.some((r) => r.includes(link.url))) {
35572
+ if (linksRequireToolSource && !t.toolResults.some((r) => r.includes(link.url) || link.sourceText !== void 0 && r.includes(link.sourceText))) {
35455
35573
  t.linksDropped += 1;
35456
35574
  return;
35457
35575
  }
@@ -35475,11 +35593,15 @@ ${validated.errors.map((e) => `${e.path || "(root)"}: ${e.message}`).join("\n")}
35475
35593
  }
35476
35594
  }
35477
35595
  }
35478
- function speakAnnouncement(s, turnId, text, interruptible) {
35596
+ function sendFillerMessage(s, turnId, text) {
35597
+ sendToClient(s.sessionId, { type: "assistant_filler", turnId, text });
35598
+ }
35599
+ function speakAnnouncement(s, turnId, text, interruptible, fillerKind) {
35600
+ const opts2 = fillerKind ? { turnId, kind: "filler", fillerKind } : { turnId };
35479
35601
  if (interruptible) {
35480
- return speak(s.sessionId, text, { turnId });
35602
+ return speak(s.sessionId, text, opts2);
35481
35603
  }
35482
- const h = announce(s.sessionId, text, { turnId });
35604
+ const h = announce(s.sessionId, text, opts2);
35483
35605
  trackAnnouncement(s, h.done);
35484
35606
  return h;
35485
35607
  }
@@ -35548,7 +35670,8 @@ ${validated.errors.map((e) => `${e.path || "(root)"}: ${e.message}`).join("\n")}
35548
35670
  t.toolCallSpoken = true;
35549
35671
  if (kind === "toolWait")
35550
35672
  t.toolWaitSpoken += 1;
35551
- speakAnnouncement(s, t.turnId, text, fillersInterruptible);
35673
+ speakAnnouncement(s, t.turnId, text, fillersInterruptible, kind);
35674
+ sendFillerMessage(s, t.turnId, text);
35552
35675
  return void 0;
35553
35676
  }
35554
35677
  function armFiller(s, t, kind, delayMs, afterMs) {
@@ -36075,7 +36198,8 @@ ${validated.errors.map((e) => `${e.path || "(root)"}: ${e.message}`).join("\n")}
36075
36198
  if (t.fillerSpoken || signal.aborted)
36076
36199
  return;
36077
36200
  t.fillerSpoken = true;
36078
- speakAnnouncement(s, t.turnId, fillerLegacy.text, fillerLegacy.interruptible ?? D.fillerInterruptible);
36201
+ speakAnnouncement(s, t.turnId, fillerLegacy.text, fillerLegacy.interruptible ?? D.fillerInterruptible, "toolWait");
36202
+ sendFillerMessage(s, t.turnId, fillerLegacy.text);
36079
36203
  }, fillerLegacy.afterMs ?? D.fillerAfterMs);
36080
36204
  }
36081
36205
  let results;
@@ -31724,6 +31724,14 @@ function buildIdleEnv(sessionId) {
31724
31724
  ...process.env.IDLE_TIMEOUT_SEC ? { IDLE_TIMEOUT_SEC: process.env.IDLE_TIMEOUT_SEC } : {}
31725
31725
  };
31726
31726
  }
31727
+ function speakKindFields(options) {
31728
+ if (options?.kind !== "filler")
31729
+ return {};
31730
+ return {
31731
+ kind: "filler",
31732
+ ...options.fillerKind ? { fillerKind: options.fillerKind } : {}
31733
+ };
31734
+ }
31727
31735
  function speakControlAvailableFor(sessionId) {
31728
31736
  return speakControlAvailableBySessionId.get(sessionId) ?? false;
31729
31737
  }
@@ -31761,7 +31769,8 @@ function speak(sessionId, text, options) {
31761
31769
  type: "speak",
31762
31770
  sessionId,
31763
31771
  text,
31764
- ...options?.interruptible === false ? { interruptible: false } : {}
31772
+ ...options?.interruptible === false ? { interruptible: false } : {},
31773
+ ...speakKindFields(options)
31765
31774
  });
31766
31775
  warnSpeakControlUnavailable(sessionId);
31767
31776
  return handle({ requestId, status: "unsupported", playedMs: 0 });
@@ -31793,7 +31802,8 @@ function speak(sessionId, text, options) {
31793
31802
  requestId,
31794
31803
  ...options?.interruptible === false ? { interruptible: false } : {},
31795
31804
  ...turnId ? { turnId } : {},
31796
- ...inReplyTo ? { inReplyTo } : {}
31805
+ ...inReplyTo ? { inReplyTo } : {},
31806
+ ...speakKindFields(options)
31797
31807
  });
31798
31808
  return {
31799
31809
  requestId,
@@ -34990,6 +35000,24 @@ var ConversationHistory = class {
34990
35000
 
34991
35001
  // dist/llm/agent/link-extractor.js
34992
35002
  var LINK_MARK = "\uE000";
35003
+ var BARE_DOMAIN_TLDS = /* @__PURE__ */ new Set([
35004
+ "com",
35005
+ "org",
35006
+ "net",
35007
+ "dev",
35008
+ "io",
35009
+ "ai",
35010
+ "app",
35011
+ "co",
35012
+ "cloud",
35013
+ "eu",
35014
+ "de",
35015
+ "uk",
35016
+ "us"
35017
+ ]);
35018
+ var DOMAIN_RE = /^((?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+([a-z]{2,63}))(\/[^\s]*)?/i;
35019
+ var DOMAIN_PREFIX_RE = /^[a-z0-9][a-z0-9.-]*$/i;
35020
+ var ALNUM_RE = /[\p{L}\p{N}]/u;
34993
35021
  var SCHEMES = ["https://", "http://"];
34994
35022
  var START_RE = /\[|https?:\/\//i;
34995
35023
  var BARE_RE = /^https?:\/\/\S*/i;
@@ -35055,6 +35083,85 @@ function hasHost(url2) {
35055
35083
  var LinkExtractor = class {
35056
35084
  buf = "";
35057
35085
  links = [];
35086
+ /**
35087
+ * The emitted tail of the current word when it is made only of host
35088
+ * characters (`[a-z0-9.-]`), and the character before that word. A word
35089
+ * such as "voicethere" is spoken before ".dev" arrives; the lead lets the
35090
+ * domain still be recognised, so streaming gives the same result as one push.
35091
+ */
35092
+ lead = "";
35093
+ leadPrev = "";
35094
+ consume(n) {
35095
+ const taken = this.buf.slice(0, n);
35096
+ this.buf = this.buf.slice(n);
35097
+ const s = this.lead + taken;
35098
+ let k = -1;
35099
+ for (let j = s.length - 1; j >= 0; j -= 1) {
35100
+ if (!/[a-z0-9.-]/i.test(s[j])) {
35101
+ k = j;
35102
+ break;
35103
+ }
35104
+ }
35105
+ if (k >= 0) {
35106
+ this.leadPrev = s[k];
35107
+ this.lead = s.slice(k + 1);
35108
+ } else {
35109
+ this.lead = s;
35110
+ }
35111
+ if (this.lead.length > MAX_HOLD) {
35112
+ this.lead = "";
35113
+ this.leadPrev = "x";
35114
+ }
35115
+ return taken;
35116
+ }
35117
+ /** After a link: the text now ends in a mark, so no word is open. */
35118
+ closeWord() {
35119
+ this.lead = "";
35120
+ this.leadPrev = LINK_MARK;
35121
+ }
35122
+ /** The first bare domain (or possible start of one at the tail) in the buffer. */
35123
+ scanDomain(final) {
35124
+ const off = this.lead.length;
35125
+ const ctx = this.lead + this.buf;
35126
+ for (let i = 0; i < ctx.length; i += 1) {
35127
+ if (!/[a-z0-9]/i.test(ctx[i]))
35128
+ continue;
35129
+ const before = i === 0 ? this.leadPrev : ctx[i - 1];
35130
+ if (!(before === "" || /[\s("']/.test(before)))
35131
+ continue;
35132
+ const rest = ctx.slice(i);
35133
+ const m = DOMAIN_RE.exec(rest);
35134
+ if (!m) {
35135
+ if (!final && rest.length <= MAX_HOLD && rest.includes(".") && DOMAIN_PREFIX_RE.test(rest)) {
35136
+ return { index: i, hold: true, off };
35137
+ }
35138
+ continue;
35139
+ }
35140
+ const host = m[1];
35141
+ const path2 = m[3] ?? "";
35142
+ const end = m[0].length;
35143
+ if (!final && end === rest.length && end <= MAX_HOLD) {
35144
+ return { index: i, hold: true, off };
35145
+ }
35146
+ const next = rest[end] ?? "";
35147
+ if (!final && !path2 && next === "." && end + 1 === rest.length) {
35148
+ return { index: i, hold: true, off };
35149
+ }
35150
+ if (!BARE_DOMAIN_TLDS.has(m[2].toLowerCase()))
35151
+ continue;
35152
+ if (!path2) {
35153
+ if (next && /[\p{L}\p{N}@_-]/u.test(next))
35154
+ continue;
35155
+ if (next === "." && ALNUM_RE.test(rest[end + 1] ?? ""))
35156
+ continue;
35157
+ }
35158
+ const { url: url2 } = trimUrl(host + path2);
35159
+ if (i < off && host.length < off - i)
35160
+ continue;
35161
+ return { index: i, hold: false, off, host, url: url2 };
35162
+ }
35163
+ return void 0;
35164
+ }
35058
35165
  push(delta) {
35059
35166
  this.buf += delta;
35060
35167
  return this.drain(false);
@@ -35072,54 +35179,65 @@ var LinkExtractor = class {
35072
35179
  this.links = [];
35073
35180
  return all;
35074
35181
  }
35075
- add(url2, label) {
35182
+ add(url2, label, sourceText) {
35076
35183
  const trimmed = label?.trim();
35077
35184
  this.links.push({
35078
35185
  url: url2,
35079
35186
  ...trimmed ? { label: trimmed } : {},
35080
- secure: /^https:\/\//i.test(url2)
35187
+ secure: /^https:\/\//i.test(url2),
35188
+ ...sourceText ? { sourceText } : {}
35081
35189
  });
35082
35190
  }
35083
35191
  drain(final) {
35084
35192
  let out = "";
35085
35193
  for (; ; ) {
35086
35194
  const m = START_RE.exec(this.buf);
35195
+ const d = this.scanDomain(final);
35196
+ if (d && (!m || Math.max(0, d.index - d.off) < m.index)) {
35197
+ const spoken = Math.max(0, d.off - d.index);
35198
+ out += this.consume(Math.max(0, d.index - d.off));
35199
+ if (d.hold)
35200
+ return out;
35201
+ this.add("https://" + d.url, d.host, d.url);
35202
+ this.consume(d.url.length - spoken);
35203
+ out += d.host.slice(spoken) + LINK_MARK;
35204
+ this.closeWord();
35205
+ continue;
35206
+ }
35087
35207
  if (!m) {
35088
35208
  const hold = final ? 0 : partialSchemeSuffix(this.buf);
35089
- out += this.buf.slice(0, this.buf.length - hold);
35090
- this.buf = this.buf.slice(this.buf.length - hold);
35209
+ out += this.consume(this.buf.length - hold);
35091
35210
  return out;
35092
35211
  }
35093
- out += this.buf.slice(0, m.index);
35094
- this.buf = this.buf.slice(m.index);
35212
+ out += this.consume(m.index);
35095
35213
  if (this.buf[0] === "[") {
35096
35214
  const md = MARKDOWN_RE.exec(this.buf);
35097
35215
  if (md && hasHost(md[2])) {
35098
35216
  this.add(md[2], md[1]);
35099
35217
  out += `${md[1]}${LINK_MARK}`;
35100
- this.buf = this.buf.slice(md[0].length);
35218
+ this.consume(md[0].length);
35219
+ this.closeWord();
35101
35220
  continue;
35102
35221
  }
35103
35222
  if (!final && this.buf.length <= MAX_HOLD && MARKDOWN_PREFIX_RE.test(this.buf)) {
35104
35223
  return out;
35105
35224
  }
35106
- out += "[";
35107
- this.buf = this.buf.slice(1);
35225
+ out += this.consume(1);
35108
35226
  continue;
35109
35227
  }
35110
35228
  const bare = BARE_RE.exec(this.buf);
35111
35229
  if (!final && bare[0].length === this.buf.length && this.buf.length <= MAX_HOLD) {
35112
35230
  return out;
35113
35231
  }
35114
- const { url: url2, rest } = trimUrl(bare[0]);
35232
+ const { url: url2 } = trimUrl(bare[0]);
35115
35233
  if (!hasHost(url2)) {
35116
- out += bare[0];
35117
- this.buf = this.buf.slice(bare[0].length);
35234
+ out += this.consume(bare[0].length);
35118
35235
  continue;
35119
35236
  }
35120
35237
  this.add(url2);
35121
35238
  out += LINK_MARK;
35122
- this.buf = rest + this.buf.slice(bare[0].length);
35239
+ this.consume(url2.length);
35240
+ this.closeWord();
35123
35241
  }
35124
35242
  }
35125
35243
  };
@@ -35451,7 +35569,7 @@ ${validated.errors.map((e) => `${e.path || "(root)"}: ${e.message}`).join("\n")}
35451
35569
  t.linksDropped += 1;
35452
35570
  return;
35453
35571
  }
35454
- if (linksRequireToolSource && !t.toolResults.some((r) => r.includes(link.url))) {
35572
+ if (linksRequireToolSource && !t.toolResults.some((r) => r.includes(link.url) || link.sourceText !== void 0 && r.includes(link.sourceText))) {
35455
35573
  t.linksDropped += 1;
35456
35574
  return;
35457
35575
  }
@@ -35475,11 +35593,15 @@ ${validated.errors.map((e) => `${e.path || "(root)"}: ${e.message}`).join("\n")}
35475
35593
  }
35476
35594
  }
35477
35595
  }
35478
- function speakAnnouncement(s, turnId, text, interruptible) {
35596
+ function sendFillerMessage(s, turnId, text) {
35597
+ sendToClient(s.sessionId, { type: "assistant_filler", turnId, text });
35598
+ }
35599
+ function speakAnnouncement(s, turnId, text, interruptible, fillerKind) {
35600
+ const opts2 = fillerKind ? { turnId, kind: "filler", fillerKind } : { turnId };
35479
35601
  if (interruptible) {
35480
- return speak(s.sessionId, text, { turnId });
35602
+ return speak(s.sessionId, text, opts2);
35481
35603
  }
35482
- const h = announce(s.sessionId, text, { turnId });
35604
+ const h = announce(s.sessionId, text, opts2);
35483
35605
  trackAnnouncement(s, h.done);
35484
35606
  return h;
35485
35607
  }
@@ -35548,7 +35670,8 @@ ${validated.errors.map((e) => `${e.path || "(root)"}: ${e.message}`).join("\n")}
35548
35670
  t.toolCallSpoken = true;
35549
35671
  if (kind === "toolWait")
35550
35672
  t.toolWaitSpoken += 1;
35551
- speakAnnouncement(s, t.turnId, text, fillersInterruptible);
35673
+ speakAnnouncement(s, t.turnId, text, fillersInterruptible, kind);
35674
+ sendFillerMessage(s, t.turnId, text);
35552
35675
  return void 0;
35553
35676
  }
35554
35677
  function armFiller(s, t, kind, delayMs, afterMs) {
@@ -36075,7 +36198,8 @@ ${validated.errors.map((e) => `${e.path || "(root)"}: ${e.message}`).join("\n")}
36075
36198
  if (t.fillerSpoken || signal.aborted)
36076
36199
  return;
36077
36200
  t.fillerSpoken = true;
36078
- speakAnnouncement(s, t.turnId, fillerLegacy.text, fillerLegacy.interruptible ?? D.fillerInterruptible);
36201
+ speakAnnouncement(s, t.turnId, fillerLegacy.text, fillerLegacy.interruptible ?? D.fillerInterruptible, "toolWait");
36202
+ sendFillerMessage(s, t.turnId, fillerLegacy.text);
36079
36203
  }, fillerLegacy.afterMs ?? D.fillerAfterMs);
36080
36204
  }
36081
36205
  let results;