@sjawhar/claude-envoy 6.21.2 → 6.22.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.
@@ -2,5 +2,5 @@
2
2
  "name": "claude-envoy",
3
3
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
4
4
  "mcpServers": "./.mcp.json",
5
- "version": "6.21.2"
5
+ "version": "6.22.1"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "6.21.2",
3
+ "version": "6.22.1",
4
4
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
5
5
  "mcpServers": {}
6
6
  }
@@ -16325,12 +16325,22 @@ function itemFromSearch(search) {
16325
16325
 
16326
16326
  // ../contracts/src/dispatch-block-ref.ts
16327
16327
  var encoder = new TextEncoder;
16328
+ var NONPLAIN_CHARACTER = /[^A-Za-z0-9-]/u;
16329
+ function percentEncoded(byte) {
16330
+ return `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
16331
+ }
16328
16332
  function encodeBlockId(id) {
16329
- let encoded = "";
16330
- for (const character of id) {
16331
- for (const byte of encoder.encode(character)) {
16332
- const bare = byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte >= 97 && byte <= 122 || byte === 45;
16333
- encoded += bare ? String.fromCharCode(byte) : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
16333
+ const start = id.search(NONPLAIN_CHARACTER);
16334
+ if (start === -1)
16335
+ return id;
16336
+ let encoded = id.slice(0, start);
16337
+ for (const character of id.slice(start)) {
16338
+ const code = character.charCodeAt(0);
16339
+ if (code >= 128) {
16340
+ for (const byte of encoder.encode(character))
16341
+ encoded += percentEncoded(byte);
16342
+ } else {
16343
+ encoded += NONPLAIN_CHARACTER.test(character) ? percentEncoded(code) : character;
16334
16344
  }
16335
16345
  }
16336
16346
  return encoded;
@@ -16949,6 +16959,14 @@ var DISPATCH_READING_SURFACES = [
16949
16959
  rendered: false,
16950
16960
  surface: "plan-task-line"
16951
16961
  },
16962
+ {
16963
+ files: ["packages/dispatch/web/src/features/issue-page/spec-filter/SpecFilterBody.tsx"],
16964
+ reach: "/issues/<ISSUE>/spec with the new issue page on, a decision cell or because line",
16965
+ reason: "The Spec view draws what decided a statement as one line of plain text with no markup: a decision's quote, the first sentence of the answer's or the decision's words, and the question an answer answers, each cut to one line by `specDecidedBy` (`spec-filter/spec-decided-by.ts`), which names each reference from the page's published names via `one-line.ts`'s `referenceStandIns` before the view draws the string, rather than mounting `PlainText` or `usePlainHeadline`. It passes no source record: the plain string reads no per-record question map for `#id` references and makes no per-record reads, drawing only from the page's published names.",
16966
+ record: false,
16967
+ rendered: false,
16968
+ surface: "spec-decision-line"
16969
+ },
16952
16970
  {
16953
16971
  files: [
16954
16972
  "packages/dispatch/web/src/features/doc/ApprovalChip.tsx",
@@ -24442,6 +24460,10 @@ function pauseFor(ms, signal) {
24442
24460
  signal.addEventListener("abort", stop, { once: true });
24443
24461
  return promise;
24444
24462
  }
24463
+ function armTimer(ms, cut) {
24464
+ const timer = setTimeout(cut, ms);
24465
+ return () => clearTimeout(timer);
24466
+ }
24445
24467
  function keyEchoed(response, key) {
24446
24468
  return key !== "" && keyNamedBack(response) === key;
24447
24469
  }
@@ -25621,13 +25643,14 @@ class DispatchClient {
25621
25643
  async#attempt(url, method, headers, body, silenceMs, limit, transport) {
25622
25644
  const cut = new AbortController;
25623
25645
  const silent = () => cut.abort(new WriteAttemptSilent(silenceMs));
25624
- let timer = setTimeout(silent, silenceMs);
25646
+ const armSilence = this.writeRetry.armSilence ?? armTimer;
25647
+ let disarm = armSilence(silenceMs, silent);
25625
25648
  let answered = false;
25626
25649
  const progress = () => {
25627
25650
  if (answered)
25628
25651
  return;
25629
- clearTimeout(timer);
25630
- timer = setTimeout(silent, silenceMs);
25652
+ disarm();
25653
+ disarm = armSilence(silenceMs, silent);
25631
25654
  };
25632
25655
  try {
25633
25656
  return await this.#fetch(url, {
@@ -25642,7 +25665,7 @@ class DispatchClient {
25642
25665
  throw error;
25643
25666
  } finally {
25644
25667
  answered = true;
25645
- clearTimeout(timer);
25668
+ disarm();
25646
25669
  }
25647
25670
  }
25648
25671
  async#endWrite(method, url, state, event, answer, failure, write, routeSpent, via) {
package/dist/dispatch.js CHANGED
@@ -16925,12 +16925,22 @@ function itemFromSearch(search) {
16925
16925
 
16926
16926
  // ../contracts/src/dispatch-block-ref.ts
16927
16927
  var encoder = new TextEncoder;
16928
+ var NONPLAIN_CHARACTER = /[^A-Za-z0-9-]/u;
16929
+ function percentEncoded(byte) {
16930
+ return `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
16931
+ }
16928
16932
  function encodeBlockId(id) {
16929
- let encoded = "";
16930
- for (const character of id) {
16931
- for (const byte of encoder.encode(character)) {
16932
- const bare = byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte >= 97 && byte <= 122 || byte === 45;
16933
- encoded += bare ? String.fromCharCode(byte) : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
16933
+ const start = id.search(NONPLAIN_CHARACTER);
16934
+ if (start === -1)
16935
+ return id;
16936
+ let encoded = id.slice(0, start);
16937
+ for (const character of id.slice(start)) {
16938
+ const code = character.charCodeAt(0);
16939
+ if (code >= 128) {
16940
+ for (const byte of encoder.encode(character))
16941
+ encoded += percentEncoded(byte);
16942
+ } else {
16943
+ encoded += NONPLAIN_CHARACTER.test(character) ? percentEncoded(code) : character;
16934
16944
  }
16935
16945
  }
16936
16946
  return encoded;
@@ -17549,6 +17559,14 @@ var DISPATCH_READING_SURFACES = [
17549
17559
  rendered: false,
17550
17560
  surface: "plan-task-line"
17551
17561
  },
17562
+ {
17563
+ files: ["packages/dispatch/web/src/features/issue-page/spec-filter/SpecFilterBody.tsx"],
17564
+ reach: "/issues/<ISSUE>/spec with the new issue page on, a decision cell or because line",
17565
+ reason: "The Spec view draws what decided a statement as one line of plain text with no markup: a decision's quote, the first sentence of the answer's or the decision's words, and the question an answer answers, each cut to one line by `specDecidedBy` (`spec-filter/spec-decided-by.ts`), which names each reference from the page's published names via `one-line.ts`'s `referenceStandIns` before the view draws the string, rather than mounting `PlainText` or `usePlainHeadline`. It passes no source record: the plain string reads no per-record question map for `#id` references and makes no per-record reads, drawing only from the page's published names.",
17566
+ record: false,
17567
+ rendered: false,
17568
+ surface: "spec-decision-line"
17569
+ },
17552
17570
  {
17553
17571
  files: [
17554
17572
  "packages/dispatch/web/src/features/doc/ApprovalChip.tsx",
@@ -20942,9 +20960,29 @@ function thematicBreak(text) {
20942
20960
  function setextUnderline(text) {
20943
20961
  return /^(?:=+|-+)[ \t]*$/.test(text);
20944
20962
  }
20963
+ var fenceCharactersRead = 0;
20945
20964
  function fenceColons(text) {
20946
- const trimmed = text.replace(/^[ \t]+|[ \t]+$/g, "");
20947
- return /^:+$/.test(trimmed) ? trimmed.length : 0;
20965
+ let read = 0;
20966
+ let start = 0;
20967
+ for (;start < text.length; start++) {
20968
+ read++;
20969
+ if (text[start] !== " " && text[start] !== "\t")
20970
+ break;
20971
+ }
20972
+ let end = text.length;
20973
+ for (;end > start; end--) {
20974
+ read++;
20975
+ if (text[end - 1] !== " " && text[end - 1] !== "\t")
20976
+ break;
20977
+ }
20978
+ let colons = start;
20979
+ for (;colons < end; colons++) {
20980
+ read++;
20981
+ if (text[colons] !== ":")
20982
+ break;
20983
+ }
20984
+ fenceCharactersRead += read;
20985
+ return colons === end && end > start ? end - start : 0;
20948
20986
  }
20949
20987
 
20950
20988
  // ../envoy-client/src/dispatch-file-text.ts
@@ -23708,6 +23746,10 @@ function pauseFor(ms, signal) {
23708
23746
  signal.addEventListener("abort", stop, { once: true });
23709
23747
  return promise;
23710
23748
  }
23749
+ function armTimer(ms, cut) {
23750
+ const timer = setTimeout(cut, ms);
23751
+ return () => clearTimeout(timer);
23752
+ }
23711
23753
  function keyEchoed(response, key) {
23712
23754
  return key !== "" && keyNamedBack(response) === key;
23713
23755
  }
@@ -24887,13 +24929,14 @@ class DispatchClient {
24887
24929
  async#attempt(url, method, headers, body, silenceMs, limit, transport) {
24888
24930
  const cut = new AbortController;
24889
24931
  const silent = () => cut.abort(new WriteAttemptSilent(silenceMs));
24890
- let timer = setTimeout(silent, silenceMs);
24932
+ const armSilence = this.writeRetry.armSilence ?? armTimer;
24933
+ let disarm = armSilence(silenceMs, silent);
24891
24934
  let answered = false;
24892
24935
  const progress = () => {
24893
24936
  if (answered)
24894
24937
  return;
24895
- clearTimeout(timer);
24896
- timer = setTimeout(silent, silenceMs);
24938
+ disarm();
24939
+ disarm = armSilence(silenceMs, silent);
24897
24940
  };
24898
24941
  try {
24899
24942
  return await this.#fetch(url, {
@@ -24908,7 +24951,7 @@ class DispatchClient {
24908
24951
  throw error;
24909
24952
  } finally {
24910
24953
  answered = true;
24911
- clearTimeout(timer);
24954
+ disarm();
24912
24955
  }
24913
24956
  }
24914
24957
  async#endWrite(method, url, state, event, answer, failure, write, routeSpent, via) {
@@ -41924,19 +41967,38 @@ ${result.text}`);
41924
41967
  return code;
41925
41968
  }
41926
41969
 
41927
- // ../envoy-client/bin/dispatch.ts
41928
- var pending = [];
41929
- var writeTo = (stream) => (chunk) => {
41970
+ // ../envoy-client/src/process-exit.ts
41971
+ async function exitProcess(code, flushMs) {
41972
+ const flushed = Promise.all([ended(process.stdout), ended(process.stderr)]);
41973
+ if (flushMs === undefined)
41974
+ await flushed;
41975
+ else
41976
+ await Promise.race([flushed, Bun.sleep(flushMs)]);
41977
+ process.exit(code);
41978
+ }
41979
+ function ended(stream) {
41930
41980
  const { promise, resolve } = Promise.withResolvers();
41931
- stream.write(chunk, () => resolve());
41932
- pending.push(promise);
41933
- };
41981
+ if (stream.destroyed || stream.writableFinished) {
41982
+ resolve();
41983
+ } else {
41984
+ stream.once("error", () => resolve());
41985
+ stream.end(() => resolve());
41986
+ }
41987
+ return promise;
41988
+ }
41989
+
41990
+ // ../envoy-client/bin/dispatch.ts
41934
41991
  var code = await runDispatchCli(Bun.argv.slice(2), process.env, {
41935
- stdout: writeTo(process.stdout),
41936
- stdoutBytes: writeTo(process.stdout),
41937
- stderr: writeTo(process.stderr),
41992
+ stdout: (text) => {
41993
+ process.stdout.write(text);
41994
+ },
41995
+ stdoutBytes: (bytes) => {
41996
+ process.stdout.write(bytes);
41997
+ },
41998
+ stderr: (text) => {
41999
+ process.stderr.write(text);
42000
+ },
41938
42001
  readText: readFileText,
41939
42002
  cwd: process.cwd()
41940
42003
  });
41941
- await Promise.all(pending);
41942
- process.exit(code);
42004
+ await exitProcess(code);
@@ -39125,12 +39125,22 @@ function itemFromSearch(search) {
39125
39125
 
39126
39126
  // ../contracts/src/dispatch-block-ref.ts
39127
39127
  var encoder = new TextEncoder;
39128
+ var NONPLAIN_CHARACTER = /[^A-Za-z0-9-]/u;
39129
+ function percentEncoded(byte) {
39130
+ return `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
39131
+ }
39128
39132
  function encodeBlockId(id) {
39129
- let encoded = "";
39130
- for (const character of id) {
39131
- for (const byte of encoder.encode(character)) {
39132
- const bare = byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte >= 97 && byte <= 122 || byte === 45;
39133
- encoded += bare ? String.fromCharCode(byte) : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
39133
+ const start = id.search(NONPLAIN_CHARACTER);
39134
+ if (start === -1)
39135
+ return id;
39136
+ let encoded = id.slice(0, start);
39137
+ for (const character of id.slice(start)) {
39138
+ const code = character.charCodeAt(0);
39139
+ if (code >= 128) {
39140
+ for (const byte of encoder.encode(character))
39141
+ encoded += percentEncoded(byte);
39142
+ } else {
39143
+ encoded += NONPLAIN_CHARACTER.test(character) ? percentEncoded(code) : character;
39134
39144
  }
39135
39145
  }
39136
39146
  return encoded;
@@ -39749,6 +39759,14 @@ var DISPATCH_READING_SURFACES = [
39749
39759
  rendered: false,
39750
39760
  surface: "plan-task-line"
39751
39761
  },
39762
+ {
39763
+ files: ["packages/dispatch/web/src/features/issue-page/spec-filter/SpecFilterBody.tsx"],
39764
+ reach: "/issues/<ISSUE>/spec with the new issue page on, a decision cell or because line",
39765
+ reason: "The Spec view draws what decided a statement as one line of plain text with no markup: a decision's quote, the first sentence of the answer's or the decision's words, and the question an answer answers, each cut to one line by `specDecidedBy` (`spec-filter/spec-decided-by.ts`), which names each reference from the page's published names via `one-line.ts`'s `referenceStandIns` before the view draws the string, rather than mounting `PlainText` or `usePlainHeadline`. It passes no source record: the plain string reads no per-record question map for `#id` references and makes no per-record reads, drawing only from the page's published names.",
39766
+ record: false,
39767
+ rendered: false,
39768
+ surface: "spec-decision-line"
39769
+ },
39752
39770
  {
39753
39771
  files: [
39754
39772
  "packages/dispatch/web/src/features/doc/ApprovalChip.tsx",
@@ -48952,6 +48970,10 @@ function pauseFor(ms, signal) {
48952
48970
  signal.addEventListener("abort", stop, { once: true });
48953
48971
  return promise;
48954
48972
  }
48973
+ function armTimer(ms, cut) {
48974
+ const timer = setTimeout(cut, ms);
48975
+ return () => clearTimeout(timer);
48976
+ }
48955
48977
  function keyEchoed(response, key) {
48956
48978
  return key !== "" && keyNamedBack(response) === key;
48957
48979
  }
@@ -50131,13 +50153,14 @@ class DispatchClient {
50131
50153
  async#attempt(url, method, headers, body, silenceMs, limit, transport) {
50132
50154
  const cut = new AbortController;
50133
50155
  const silent = () => cut.abort(new WriteAttemptSilent(silenceMs));
50134
- let timer = setTimeout(silent, silenceMs);
50156
+ const armSilence = this.writeRetry.armSilence ?? armTimer;
50157
+ let disarm = armSilence(silenceMs, silent);
50135
50158
  let answered = false;
50136
50159
  const progress = () => {
50137
50160
  if (answered)
50138
50161
  return;
50139
- clearTimeout(timer);
50140
- timer = setTimeout(silent, silenceMs);
50162
+ disarm();
50163
+ disarm = armSilence(silenceMs, silent);
50141
50164
  };
50142
50165
  try {
50143
50166
  return await this.#fetch(url, {
@@ -50152,7 +50175,7 @@ class DispatchClient {
50152
50175
  throw error;
50153
50176
  } finally {
50154
50177
  answered = true;
50155
- clearTimeout(timer);
50178
+ disarm();
50156
50179
  }
50157
50180
  }
50158
50181
  async#endWrite(method, url, state, event, answer, failure, write, routeSpent, via) {
@@ -66092,6 +66115,14 @@ var NATS_DIAL_PLAN = {
66092
66115
  maxDelayMs: 4000,
66093
66116
  budgetMs: 25000
66094
66117
  };
66118
+ var PROCESS_CLOCK = {
66119
+ now: () => performance.now(),
66120
+ sleep: (ms) => delay(ms),
66121
+ arm: (ms, expire) => {
66122
+ const timer = setTimeout(expire, ms);
66123
+ return () => clearTimeout(timer);
66124
+ }
66125
+ };
66095
66126
  var NATS_DIAL_TOKEN_DROPPED = "the hub refused the session's broker token twice, so the token was dropped and another trade started";
66096
66127
  var NATS_MIN_REDIAL_BOUND_MS = 500;
66097
66128
 
@@ -66143,12 +66174,13 @@ function brokerDialRefusals(credential, random) {
66143
66174
  };
66144
66175
  }
66145
66176
  async function connectNats(connect, options, plan, hooks = {}) {
66146
- const started = performance.now();
66147
- const elapsed = () => performance.now() - started;
66177
+ const clock = hooks.clock ?? PROCESS_CLOCK;
66178
+ const started = clock.now();
66179
+ const elapsed = () => clock.now() - started;
66148
66180
  const timeout = options.timeout ?? NATS_DIAL_TIMEOUT_MS;
66149
66181
  const servers = Array.isArray(options.servers) ? Math.max(1, options.servers.length) : 1;
66150
66182
  const brokerRefusals = brokerDialRefusals(hooks.credential, hooks.random ?? Math.random);
66151
- const wait = hooks.delay ?? delay;
66183
+ const wait = hooks.delay ?? ((ms) => clock.sleep(ms));
66152
66184
  let delayMs = plan.firstDelayMs;
66153
66185
  let failed;
66154
66186
  for (let attempt = 1;; attempt += 1) {
@@ -66161,7 +66193,7 @@ async function connectNats(connect, options, plan, hooks = {}) {
66161
66193
  const nc = await boundedDial(connect, {
66162
66194
  ...options,
66163
66195
  timeout: Math.min(bound, Math.max(NATS_MIN_REDIAL_BOUND_MS, Math.floor(bound / servers)))
66164
- }, bound);
66196
+ }, bound, clock);
66165
66197
  keepWholeTimeout(nc, timeout);
66166
66198
  brokerRefusals?.admitted(dialedAt);
66167
66199
  return nc;
@@ -66190,7 +66222,7 @@ function keepWholeTimeout(nc, timeout) {
66190
66222
  opened.timeout = timeout;
66191
66223
  delete opened.abandonSignal;
66192
66224
  }
66193
- async function boundedDial(connect, options, boundMs) {
66225
+ async function boundedDial(connect, options, boundMs, clock) {
66194
66226
  const abandon = new AbortController;
66195
66227
  const withAbandon = {
66196
66228
  ...options,
@@ -66198,10 +66230,10 @@ async function boundedDial(connect, options, boundMs) {
66198
66230
  };
66199
66231
  const dialing = connect(withAbandon);
66200
66232
  const expired = Promise.withResolvers();
66201
- const timer = setTimeout(() => {
66233
+ const disarm = clock.arm(boundMs, () => {
66202
66234
  abandon.abort();
66203
66235
  expired.reject(new NatsDialBoundError(`the NATS dial did not complete within ${boundMs} ms`));
66204
- }, boundMs);
66236
+ });
66205
66237
  try {
66206
66238
  return await Promise.race([dialing, expired.promise]);
66207
66239
  } catch (error) {
@@ -66210,7 +66242,7 @@ async function boundedDial(connect, options, boundMs) {
66210
66242
  });
66211
66243
  throw error;
66212
66244
  } finally {
66213
- clearTimeout(timer);
66245
+ disarm();
66214
66246
  }
66215
66247
  }
66216
66248
 
@@ -67090,6 +67122,8 @@ async function registerWithRelay({
67090
67122
  import { BlockList, isIP } from "net";
67091
67123
  var SLACK_BOT_TOKEN_SECRET = "LEGION_SLACK_BOT_TOKEN";
67092
67124
  var SLACK_POST_API_URL_VARIABLE = "SLACK_POST_API_URL";
67125
+ var SLACK_ANSWER_MS = 1e4;
67126
+ var POSTER_FLUSH_MS = 5000;
67093
67127
  var POST_TIMEOUT_MS = 30000;
67094
67128
  var SLACK_ERROR_CODES = [
67095
67129
  "access_denied",
@@ -67170,12 +67204,23 @@ const out = (value) => {
67170
67204
  if (token !== "") line = line.split(token).join("[redacted]");
67171
67205
  process.stdout.write(line + "\\n");
67172
67206
  };
67207
+ const exit = async () => {
67208
+ const flushed = Promise.withResolvers();
67209
+ if (process.stdout.destroyed || process.stdout.writableFinished) {
67210
+ flushed.resolve();
67211
+ } else {
67212
+ process.stdout.once("error", () => flushed.resolve());
67213
+ process.stdout.end(() => flushed.resolve());
67214
+ }
67215
+ await Promise.race([flushed.promise, Bun.sleep(${POSTER_FLUSH_MS})]);
67216
+ process.exit(0);
67217
+ };
67173
67218
  let sent = false;
67174
67219
  try {
67175
67220
  const input = JSON.parse(await Bun.stdin.text());
67176
67221
  if (token === "") {
67177
67222
  out({ invalid: "the poster's environment carries no LEGION_SLACK_BOT_TOKEN" });
67178
- process.exit(0);
67223
+ await exit();
67179
67224
  }
67180
67225
  const base = (process.env.SLACK_POST_API_URL || "https://slack.com/api").replace(/\\/+$/, "");
67181
67226
  let status = 0;
@@ -67186,13 +67231,13 @@ try {
67186
67231
  method: "POST",
67187
67232
  headers: { Authorization: "Bearer " + token, "Content-Type": "application/json; charset=utf-8" },
67188
67233
  body: JSON.stringify({ channel: input.channel, thread_ts: input.thread_ts, text: input.text }),
67189
- signal: AbortSignal.timeout(10000),
67234
+ signal: AbortSignal.timeout(${SLACK_ANSWER_MS}),
67190
67235
  });
67191
67236
  status = response.status;
67192
67237
  raw = await response.text();
67193
67238
  } catch {
67194
67239
  out({ unanswered: true });
67195
- process.exit(0);
67240
+ await exit();
67196
67241
  }
67197
67242
  let answer;
67198
67243
  try {
@@ -67213,6 +67258,7 @@ try {
67213
67258
  } catch {
67214
67259
  out(sent ? { unanswered: true } : { invalid: "a reply the poster could not read" });
67215
67260
  }
67261
+ await exit();
67216
67262
  `;
67217
67263
  var MAY_HAVE_POSTED = "the reply may have been posted, and posting it again may put it in the thread twice";
67218
67264
  var AGENT_SECRETS_INJECTION = `agent-secrets: ${SLACK_BOT_TOKEN_SECRET} from `;
@@ -67220,7 +67266,19 @@ var URL_CANDIDATE = /(?<![a-z0-9+.-])[a-z][a-z0-9+.-]{0,31}:\/\/[^\s<>|"'`]+/gi;
67220
67266
  var WEB_SCHEME = /^https?:\/\//i;
67221
67267
  var BARE_HOST = /(?<![\w@./:%-])((?:[a-z0-9-]{1,63}\.)*[a-z0-9-]{1,63})\.?(:\d{1,5})?(?![\w-])/gi;
67222
67268
  var BARE_IPV6 = /(?<![\w@./:%-])\[([0-9a-f:.]{2,45})(?:%[\w.-]{1,32})?\](?::\d{1,5})?/gi;
67223
- var TRAILING_PUNCTUATION = /[.,;:!?)\]}]+$/;
67269
+ var TRAILING_PUNCTUATION = ".,;:!?)]}";
67270
+ var trailingCharactersRead = 0;
67271
+ function withoutTrailingPunctuation(url) {
67272
+ let end = url.length;
67273
+ let read = 0;
67274
+ for (;end > 0; end--) {
67275
+ read++;
67276
+ if (!TRAILING_PUNCTUATION.includes(url.charAt(end - 1)))
67277
+ break;
67278
+ }
67279
+ trailingCharactersRead += read;
67280
+ return url.slice(0, end);
67281
+ }
67224
67282
  var CLUSTER_ADDRESSES = new BlockList;
67225
67283
  for (const [network, prefix] of [
67226
67284
  ["0.0.0.0", 8],
@@ -67249,7 +67307,7 @@ function linkInsideCluster(text, env) {
67249
67307
  for (const match of decoded.matchAll(URL_CANDIDATE)) {
67250
67308
  if (!WEB_SCHEME.test(match[0]))
67251
67309
  continue;
67252
- for (const written of new Set([match[0], match[0].replace(TRAILING_PUNCTUATION, "")])) {
67310
+ for (const written of new Set([match[0], withoutTrailingPunctuation(match[0])])) {
67253
67311
  const host = hostOf(written);
67254
67312
  if (host !== undefined && insideCluster(host, dispatchHost, true))
67255
67313
  return written;
@@ -67810,7 +67868,7 @@ var import_nats5 = __toESM(require_mod4(), 1);
67810
67868
 
67811
67869
  // package.json
67812
67870
  var name2 = "@sjawhar/claude-envoy";
67813
- var version2 = "6.21.2";
67871
+ var version2 = "6.22.1";
67814
67872
  var package_default = {
67815
67873
  name: name2,
67816
67874
  version: version2,
@@ -19912,12 +19912,22 @@ function itemFromSearch(search) {
19912
19912
 
19913
19913
  // ../contracts/src/dispatch-block-ref.ts
19914
19914
  var encoder3 = new TextEncoder;
19915
+ var NONPLAIN_CHARACTER = /[^A-Za-z0-9-]/u;
19916
+ function percentEncoded(byte) {
19917
+ return `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
19918
+ }
19915
19919
  function encodeBlockId(id) {
19916
- let encoded = "";
19917
- for (const character of id) {
19918
- for (const byte of encoder3.encode(character)) {
19919
- const bare = byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte >= 97 && byte <= 122 || byte === 45;
19920
- encoded += bare ? String.fromCharCode(byte) : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
19920
+ const start = id.search(NONPLAIN_CHARACTER);
19921
+ if (start === -1)
19922
+ return id;
19923
+ let encoded = id.slice(0, start);
19924
+ for (const character of id.slice(start)) {
19925
+ const code = character.charCodeAt(0);
19926
+ if (code >= 128) {
19927
+ for (const byte of encoder3.encode(character))
19928
+ encoded += percentEncoded(byte);
19929
+ } else {
19930
+ encoded += NONPLAIN_CHARACTER.test(character) ? percentEncoded(code) : character;
19921
19931
  }
19922
19932
  }
19923
19933
  return encoded;
@@ -20536,6 +20546,14 @@ var DISPATCH_READING_SURFACES = [
20536
20546
  rendered: false,
20537
20547
  surface: "plan-task-line"
20538
20548
  },
20549
+ {
20550
+ files: ["packages/dispatch/web/src/features/issue-page/spec-filter/SpecFilterBody.tsx"],
20551
+ reach: "/issues/<ISSUE>/spec with the new issue page on, a decision cell or because line",
20552
+ reason: "The Spec view draws what decided a statement as one line of plain text with no markup: a decision's quote, the first sentence of the answer's or the decision's words, and the question an answer answers, each cut to one line by `specDecidedBy` (`spec-filter/spec-decided-by.ts`), which names each reference from the page's published names via `one-line.ts`'s `referenceStandIns` before the view draws the string, rather than mounting `PlainText` or `usePlainHeadline`. It passes no source record: the plain string reads no per-record question map for `#id` references and makes no per-record reads, drawing only from the page's published names.",
20553
+ record: false,
20554
+ rendered: false,
20555
+ surface: "spec-decision-line"
20556
+ },
20539
20557
  {
20540
20558
  files: [
20541
20559
  "packages/dispatch/web/src/features/doc/ApprovalChip.tsx",
@@ -27346,6 +27364,10 @@ function pauseFor(ms, signal) {
27346
27364
  signal.addEventListener("abort", stop, { once: true });
27347
27365
  return promise;
27348
27366
  }
27367
+ function armTimer(ms, cut) {
27368
+ const timer = setTimeout(cut, ms);
27369
+ return () => clearTimeout(timer);
27370
+ }
27349
27371
  function keyEchoed(response, key) {
27350
27372
  return key !== "" && keyNamedBack(response) === key;
27351
27373
  }
@@ -28525,13 +28547,14 @@ class DispatchClient {
28525
28547
  async#attempt(url, method, headers, body, silenceMs, limit, transport) {
28526
28548
  const cut = new AbortController;
28527
28549
  const silent = () => cut.abort(new WriteAttemptSilent(silenceMs));
28528
- let timer = setTimeout(silent, silenceMs);
28550
+ const armSilence = this.writeRetry.armSilence ?? armTimer;
28551
+ let disarm = armSilence(silenceMs, silent);
28529
28552
  let answered = false;
28530
28553
  const progress = () => {
28531
28554
  if (answered)
28532
28555
  return;
28533
- clearTimeout(timer);
28534
- timer = setTimeout(silent, silenceMs);
28556
+ disarm();
28557
+ disarm = armSilence(silenceMs, silent);
28535
28558
  };
28536
28559
  try {
28537
28560
  return await this.#fetch(url, {
@@ -28546,7 +28569,7 @@ class DispatchClient {
28546
28569
  throw error;
28547
28570
  } finally {
28548
28571
  answered = true;
28549
- clearTimeout(timer);
28572
+ disarm();
28550
28573
  }
28551
28574
  }
28552
28575
  async#endWrite(method, url, state, event, answer, failure, write, routeSpent, via) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "6.21.2",
3
+ "version": "6.22.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",