@sjawhar/claude-envoy 6.25.0 → 6.25.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": "6.25.0"
5
+ "version": "6.25.2"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "6.25.0",
3
+ "version": "6.25.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
  }
@@ -68943,7 +68943,7 @@ var import_nats5 = __toESM(require_mod4(), 1);
68943
68943
 
68944
68944
  // package.json
68945
68945
  var name2 = "@sjawhar/claude-envoy";
68946
- var version2 = "6.25.0";
68946
+ var version2 = "6.25.2";
68947
68947
  var package_default = {
68948
68948
  name: name2,
68949
68949
  version: version2,
@@ -69343,23 +69343,20 @@ class AgentStreamPublisher {
69343
69343
  this.#deps.publish(subject, JSON.stringify(this.#settingsFrame(kept)));
69344
69344
  this.#fitCommands(subject);
69345
69345
  }
69346
- setContext(subject, usage) {
69346
+ setContext(subject, usage, timing) {
69347
69347
  if (usage === undefined || !(usage.contextWindow > 0)) {
69348
- if (this.#context === "cleared")
69348
+ if (this.#context?.kind === "context-cleared")
69349
69349
  return;
69350
- this.#context = "cleared";
69350
+ this.#context = { kind: "context-cleared", ...timing };
69351
69351
  this.#contextJson = undefined;
69352
69352
  } else {
69353
69353
  if (typeof usage.percent !== "number" && !(usage.tokens > 0))
69354
69354
  return;
69355
- const kept = {
69356
- contextWindow: usage.contextWindow,
69357
- tokens: usage.tokens
69358
- };
69359
- const json = JSON.stringify(kept);
69355
+ const figures = { contextWindow: usage.contextWindow, tokens: usage.tokens };
69356
+ const json = JSON.stringify(figures);
69360
69357
  if (json === this.#contextJson)
69361
69358
  return;
69362
- this.#context = kept;
69359
+ this.#context = { kind: "context", ...figures, ...timing };
69363
69360
  this.#contextJson = json;
69364
69361
  }
69365
69362
  this.#seq += 1;
@@ -69407,10 +69404,7 @@ class AgentStreamPublisher {
69407
69404
  return { ...settings, kind: "settings", seq: this.#settingsSeq, v: AGENT_STREAM_PROTOCOL };
69408
69405
  }
69409
69406
  #contextFrame(context) {
69410
- if (context === "cleared") {
69411
- return { kind: "context-cleared", seq: this.#contextSeq, v: AGENT_STREAM_PROTOCOL };
69412
- }
69413
- return { ...context, kind: "context", seq: this.#contextSeq, v: AGENT_STREAM_PROTOCOL };
69407
+ return { ...context, seq: this.#contextSeq, v: AGENT_STREAM_PROTOCOL };
69414
69408
  }
69415
69409
  record(subject, raw, streaming, dispatchMessageId) {
69416
69410
  const entry = this.#keep(raw, streaming, dispatchMessageId);
@@ -72187,12 +72181,13 @@ function claimRoleAtFirstTurn(host, role, replaces, firstTurn) {
72187
72181
  clearTimeout(bound);
72188
72182
  done.resolve();
72189
72183
  };
72190
- const claim = () => {
72184
+ const claim = (by) => {
72191
72185
  if (ran)
72192
72186
  return;
72193
72187
  ran = true;
72194
72188
  clearTimeout(bound);
72195
72189
  host.signal?.removeEventListener("abort", stop);
72190
+ host.recordClaimStep?.({ claimedBy: by, at: Date.now() });
72196
72191
  (async () => {
72197
72192
  try {
72198
72193
  await claimRoleAgainOnBusy(() => host.claimRole(role, replaces), role, {
@@ -72207,13 +72202,14 @@ function claimRoleAtFirstTurn(host, role, replaces, firstTurn) {
72207
72202
  done.resolve();
72208
72203
  })();
72209
72204
  };
72210
- const bound = setTimeout(claim, host.firstTurnBoundMs);
72205
+ host.recordClaimStep?.({ armed: Date.now(), boundMs: host.firstTurnBoundMs });
72206
+ const bound = setTimeout(() => claim("bound"), host.firstTurnBoundMs);
72211
72207
  bound.unref?.();
72212
72208
  if (host.signal?.aborted === true)
72213
72209
  stop();
72214
72210
  else
72215
72211
  host.signal?.addEventListener("abort", stop, { once: true });
72216
- firstTurn(claim);
72212
+ firstTurn(() => claim("first-turn"));
72217
72213
  return done.promise;
72218
72214
  }
72219
72215
  var ROLE_CLAIM_RETRY_FIRST_DELAY_MS = 1000;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "6.25.0",
3
+ "version": "6.25.2",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
@@ -92,5 +92,5 @@ A bare id or path, or `dispatch://` outside Dispatch, is no link: give the `http
92
92
 
93
93
  ## Setup and the HTTP API
94
94
 
95
- - Use a personal token from **Settings → Agent tokens**, as `DISPATCH_TOKEN` or `dispatch.token` in the session's `envoy.json`.
95
+ - A person signs a session in (`dispatch login --help`); else a personal token from **Settings → Agent tokens**, as `DISPATCH_TOKEN` or `dispatch.token` in the session's `envoy.json`.
96
96
  - `GET /api/v1` lists every route; never guess one. Branch on an error's `code`, not its text.