@sjawhar/claude-envoy 2.31.1 → 2.31.2

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": "2.31.1"
5
+ "version": "2.31.2"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "2.31.1",
3
+ "version": "2.31.2",
4
4
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
5
5
  "mcpServers": {}
6
6
  }
package/dist/dispatch.js CHANGED
@@ -25608,6 +25608,12 @@ function withinWindow(items, now) {
25608
25608
  const start = now - SESSION_ANSWERS_WINDOW_MS;
25609
25609
  return items.filter((item) => Date.parse(item.at) >= start);
25610
25610
  }
25611
+ function windowOf(items, now) {
25612
+ return {
25613
+ words: sessionAnswersWords(withinWindow(items, now)),
25614
+ since: new Date(now - SESSION_ANSWERS_WINDOW_MS).toISOString()
25615
+ };
25616
+ }
25611
25617
  function sessionAnswersWords(items) {
25612
25618
  return items.map((item) => JSON.stringify([
25613
25619
  item.kind,
@@ -25624,7 +25630,7 @@ function leftOutLine(count, namesCommand) {
25624
25630
  const counted = `${count} older ${count === 1 ? "item" : "items"} left out to stay under ${MAX_CHARS_TEXT} characters`;
25625
25631
  return namesCommand ? `${counted}: run \`dispatch answers\` to read every one in full.` : `${counted}.`;
25626
25632
  }
25627
- function renderShown(items, options) {
25633
+ function renderSessionAnswers(items, options) {
25628
25634
  const inWindow = withinWindow(items, Number(options.now));
25629
25635
  const unsent = inWindow.length === items.length ? Math.max(0, (options.total ?? items.length) - items.length) : 0;
25630
25636
  const count = inWindow.length + unsent;
@@ -25652,7 +25658,7 @@ As read at ${options.cached.readAt}; this read failed: ${failureSentence(options
25652
25658
  ].join(`
25653
25659
 
25654
25660
  `);
25655
- return { text, shown: inWindow.slice(0, blocks.length) };
25661
+ return text;
25656
25662
  }
25657
25663
  function renderSessionAnswersList(items, options) {
25658
25664
  const shown = withinWindow(items, Number(options.now));
@@ -25725,24 +25731,19 @@ async function readSessionAnswers(options) {
25725
25731
  const entries = state.sessions.get(session) ?? new Map;
25726
25732
  state.sessions.set(session, entries);
25727
25733
  const carry = (cache, reason, noRoute = false) => {
25728
- const rendered = cache === undefined ? undefined : renderShown(cache.items, {
25729
- now: now(),
25734
+ const at = now();
25735
+ const text = cache === undefined ? undefined : renderSessionAnswers(cache.items, {
25736
+ now: at,
25730
25737
  total: cache.total,
25731
25738
  cached: { readAt: cache.read_at, reason },
25732
25739
  withoutCommand: noRoute
25733
25740
  });
25734
- if (cache === undefined || rendered === undefined) {
25741
+ if (cache === undefined || text === undefined) {
25735
25742
  if (noRoute)
25736
25743
  return { text: undefined, source: "unavailable", reason };
25737
25744
  return { text: sessionAnswersFailureLine(reason), source: "failure", reason };
25738
25745
  }
25739
- return {
25740
- text: rendered.text,
25741
- source: "cache",
25742
- readAt: cache.read_at,
25743
- words: sessionAnswersWords(rendered.shown),
25744
- reason
25745
- };
25746
+ return { text, source: "cache", readAt: cache.read_at, ...windowOf(cache.items, at), reason };
25746
25747
  };
25747
25748
  if (!dispatch.enabled) {
25748
25749
  const url = options.dispatchUrl;
@@ -25783,6 +25784,7 @@ async function readSessionAnswers(options) {
25783
25784
  retryNoRoute: false
25784
25785
  });
25785
25786
  const started = client.sessionAnswers(session, {
25787
+ since: new Date(now() - SESSION_ANSWERS_WINDOW_MS).toISOString(),
25786
25788
  maxChars: SESSION_ANSWERS_MAX_CHARS,
25787
25789
  signal: AbortSignal.timeout(READ_TIMEOUT_MS)
25788
25790
  }).then((response) => {
@@ -25834,12 +25836,12 @@ async function readSessionAnswers(options) {
25834
25836
  return noRoute();
25835
25837
  if ("failure" in outcome)
25836
25838
  return carry(current.cache, outcome.failure);
25837
- const rendered = renderShown(outcome.cache.items, { now: now(), total: outcome.cache.total });
25839
+ const at = now();
25838
25840
  return {
25839
- text: rendered?.text,
25841
+ text: renderSessionAnswers(outcome.cache.items, { now: at, total: outcome.cache.total }),
25840
25842
  source: "fresh",
25841
25843
  readAt: outcome.cache.read_at,
25842
- words: sessionAnswersWords(rendered?.shown ?? [])
25844
+ ...windowOf(outcome.cache.items, at)
25843
25845
  };
25844
25846
  }
25845
25847
  async function sessionAnswersSettled(session) {
@@ -52640,6 +52640,12 @@ function withinWindow(items, now) {
52640
52640
  const start = now - SESSION_ANSWERS_WINDOW_MS;
52641
52641
  return items.filter((item) => Date.parse(item.at) >= start);
52642
52642
  }
52643
+ function windowOf(items, now) {
52644
+ return {
52645
+ words: sessionAnswersWords(withinWindow(items, now)),
52646
+ since: new Date(now - SESSION_ANSWERS_WINDOW_MS).toISOString()
52647
+ };
52648
+ }
52643
52649
  function sessionAnswersWords(items) {
52644
52650
  return items.map((item) => JSON.stringify([
52645
52651
  item.kind,
@@ -52656,7 +52662,7 @@ function leftOutLine(count, namesCommand) {
52656
52662
  const counted = `${count} older ${count === 1 ? "item" : "items"} left out to stay under ${MAX_CHARS_TEXT} characters`;
52657
52663
  return namesCommand ? `${counted}: run \`dispatch answers\` to read every one in full.` : `${counted}.`;
52658
52664
  }
52659
- function renderShown(items, options) {
52665
+ function renderSessionAnswers(items, options) {
52660
52666
  const inWindow = withinWindow(items, Number(options.now));
52661
52667
  const unsent = inWindow.length === items.length ? Math.max(0, (options.total ?? items.length) - items.length) : 0;
52662
52668
  const count = inWindow.length + unsent;
@@ -52684,7 +52690,7 @@ As read at ${options.cached.readAt}; this read failed: ${failureSentence(options
52684
52690
  ].join(`
52685
52691
 
52686
52692
  `);
52687
- return { text, shown: inWindow.slice(0, blocks.length) };
52693
+ return text;
52688
52694
  }
52689
52695
  function renderSessionAnswersList(items, options) {
52690
52696
  const shown = withinWindow(items, Number(options.now));
@@ -52757,24 +52763,19 @@ async function readSessionAnswers(options) {
52757
52763
  const entries = state.sessions.get(session) ?? new Map;
52758
52764
  state.sessions.set(session, entries);
52759
52765
  const carry = (cache, reason, noRoute = false) => {
52760
- const rendered = cache === undefined ? undefined : renderShown(cache.items, {
52761
- now: now(),
52766
+ const at = now();
52767
+ const text = cache === undefined ? undefined : renderSessionAnswers(cache.items, {
52768
+ now: at,
52762
52769
  total: cache.total,
52763
52770
  cached: { readAt: cache.read_at, reason },
52764
52771
  withoutCommand: noRoute
52765
52772
  });
52766
- if (cache === undefined || rendered === undefined) {
52773
+ if (cache === undefined || text === undefined) {
52767
52774
  if (noRoute)
52768
52775
  return { text: undefined, source: "unavailable", reason };
52769
52776
  return { text: sessionAnswersFailureLine(reason), source: "failure", reason };
52770
52777
  }
52771
- return {
52772
- text: rendered.text,
52773
- source: "cache",
52774
- readAt: cache.read_at,
52775
- words: sessionAnswersWords(rendered.shown),
52776
- reason
52777
- };
52778
+ return { text, source: "cache", readAt: cache.read_at, ...windowOf(cache.items, at), reason };
52778
52779
  };
52779
52780
  if (!dispatch.enabled) {
52780
52781
  const url = options.dispatchUrl;
@@ -52815,6 +52816,7 @@ async function readSessionAnswers(options) {
52815
52816
  retryNoRoute: false
52816
52817
  });
52817
52818
  const started = client.sessionAnswers(session, {
52819
+ since: new Date(now() - SESSION_ANSWERS_WINDOW_MS).toISOString(),
52818
52820
  maxChars: SESSION_ANSWERS_MAX_CHARS,
52819
52821
  signal: AbortSignal.timeout(READ_TIMEOUT_MS)
52820
52822
  }).then((response) => {
@@ -52866,12 +52868,12 @@ async function readSessionAnswers(options) {
52866
52868
  return noRoute();
52867
52869
  if ("failure" in outcome)
52868
52870
  return carry(current.cache, outcome.failure);
52869
- const rendered = renderShown(outcome.cache.items, { now: now(), total: outcome.cache.total });
52871
+ const at = now();
52870
52872
  return {
52871
- text: rendered?.text,
52873
+ text: renderSessionAnswers(outcome.cache.items, { now: at, total: outcome.cache.total }),
52872
52874
  source: "fresh",
52873
52875
  readAt: outcome.cache.read_at,
52874
- words: sessionAnswersWords(rendered?.shown ?? [])
52876
+ ...windowOf(outcome.cache.items, at)
52875
52877
  };
52876
52878
  }
52877
52879
  async function sessionAnswersSettled(session) {
@@ -57446,7 +57448,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
57446
57448
 
57447
57449
  // package.json
57448
57450
  var name = "@sjawhar/claude-envoy";
57449
- var version2 = "2.31.1";
57451
+ var version2 = "2.31.2";
57450
57452
  var legion = {
57451
57453
  daemonApiVersion: 144
57452
57454
  };
@@ -24576,6 +24576,12 @@ function withinWindow(items, now) {
24576
24576
  const start = now - SESSION_ANSWERS_WINDOW_MS;
24577
24577
  return items.filter((item) => Date.parse(item.at) >= start);
24578
24578
  }
24579
+ function windowOf(items, now) {
24580
+ return {
24581
+ words: sessionAnswersWords(withinWindow(items, now)),
24582
+ since: new Date(now - SESSION_ANSWERS_WINDOW_MS).toISOString()
24583
+ };
24584
+ }
24579
24585
  function sessionAnswersWords(items) {
24580
24586
  return items.map((item) => JSON.stringify([
24581
24587
  item.kind,
@@ -24592,7 +24598,7 @@ function leftOutLine(count, namesCommand) {
24592
24598
  const counted = `${count} older ${count === 1 ? "item" : "items"} left out to stay under ${MAX_CHARS_TEXT} characters`;
24593
24599
  return namesCommand ? `${counted}: run \`dispatch answers\` to read every one in full.` : `${counted}.`;
24594
24600
  }
24595
- function renderShown(items, options) {
24601
+ function renderSessionAnswers(items, options) {
24596
24602
  const inWindow = withinWindow(items, Number(options.now));
24597
24603
  const unsent = inWindow.length === items.length ? Math.max(0, (options.total ?? items.length) - items.length) : 0;
24598
24604
  const count = inWindow.length + unsent;
@@ -24620,7 +24626,7 @@ As read at ${options.cached.readAt}; this read failed: ${failureSentence(options
24620
24626
  ].join(`
24621
24627
 
24622
24628
  `);
24623
- return { text, shown: inWindow.slice(0, blocks.length) };
24629
+ return text;
24624
24630
  }
24625
24631
  function renderSessionAnswersList(items, options) {
24626
24632
  const shown = withinWindow(items, Number(options.now));
@@ -24693,24 +24699,19 @@ async function readSessionAnswers(options) {
24693
24699
  const entries = state.sessions.get(session) ?? new Map;
24694
24700
  state.sessions.set(session, entries);
24695
24701
  const carry = (cache, reason, noRoute = false) => {
24696
- const rendered = cache === undefined ? undefined : renderShown(cache.items, {
24697
- now: now(),
24702
+ const at = now();
24703
+ const text = cache === undefined ? undefined : renderSessionAnswers(cache.items, {
24704
+ now: at,
24698
24705
  total: cache.total,
24699
24706
  cached: { readAt: cache.read_at, reason },
24700
24707
  withoutCommand: noRoute
24701
24708
  });
24702
- if (cache === undefined || rendered === undefined) {
24709
+ if (cache === undefined || text === undefined) {
24703
24710
  if (noRoute)
24704
24711
  return { text: undefined, source: "unavailable", reason };
24705
24712
  return { text: sessionAnswersFailureLine(reason), source: "failure", reason };
24706
24713
  }
24707
- return {
24708
- text: rendered.text,
24709
- source: "cache",
24710
- readAt: cache.read_at,
24711
- words: sessionAnswersWords(rendered.shown),
24712
- reason
24713
- };
24714
+ return { text, source: "cache", readAt: cache.read_at, ...windowOf(cache.items, at), reason };
24714
24715
  };
24715
24716
  if (!dispatch.enabled) {
24716
24717
  const url = options.dispatchUrl;
@@ -24751,6 +24752,7 @@ async function readSessionAnswers(options) {
24751
24752
  retryNoRoute: false
24752
24753
  });
24753
24754
  const started = client.sessionAnswers(session, {
24755
+ since: new Date(now() - SESSION_ANSWERS_WINDOW_MS).toISOString(),
24754
24756
  maxChars: SESSION_ANSWERS_MAX_CHARS,
24755
24757
  signal: AbortSignal.timeout(READ_TIMEOUT_MS)
24756
24758
  }).then((response) => {
@@ -24802,12 +24804,12 @@ async function readSessionAnswers(options) {
24802
24804
  return noRoute();
24803
24805
  if ("failure" in outcome)
24804
24806
  return carry(current.cache, outcome.failure);
24805
- const rendered = renderShown(outcome.cache.items, { now: now(), total: outcome.cache.total });
24807
+ const at = now();
24806
24808
  return {
24807
- text: rendered?.text,
24809
+ text: renderSessionAnswers(outcome.cache.items, { now: at, total: outcome.cache.total }),
24808
24810
  source: "fresh",
24809
24811
  readAt: outcome.cache.read_at,
24810
- words: sessionAnswersWords(rendered?.shown ?? [])
24812
+ ...windowOf(outcome.cache.items, at)
24811
24813
  };
24812
24814
  }
24813
24815
  async function sessionAnswersSettled(session) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "2.31.1",
3
+ "version": "2.31.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",