@sjawhar/claude-envoy 4.11.4 → 4.12.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.
@@ -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": "4.11.4"
5
+ "version": "4.12.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "4.11.4",
3
+ "version": "4.12.0",
4
4
  "description": "Put Envoy events into the Claude Code session's own conversation and expose Envoy MCP tools.",
5
5
  "mcpServers": {}
6
6
  }
@@ -57724,6 +57724,44 @@ var legionConsumerLag = object({
57724
57724
  stalled: boolean2(),
57725
57725
  unavailable: nonEmptyString2.optional()
57726
57726
  });
57727
+ var legionPauseActor = discriminatedUnion("kind", [
57728
+ object({ kind: literal("controller"), session: nonEmptyString2 }),
57729
+ object({ kind: literal("operator") })
57730
+ ]);
57731
+ var pauseFields = {
57732
+ id: number2().int().positive(),
57733
+ since: timestamp,
57734
+ by: legionPauseActor,
57735
+ reason: nonEmptyString2
57736
+ };
57737
+ var legionPause = object({
57738
+ ...pauseFields,
57739
+ endedAt: timestamp.optional(),
57740
+ endedBy: legionPauseActor.optional()
57741
+ });
57742
+ var legionEndedPause = object({
57743
+ ...pauseFields,
57744
+ endedAt: timestamp,
57745
+ endedBy: legionPauseActor
57746
+ });
57747
+ var legionPauseStop = object({
57748
+ claim: nonEmptyString2,
57749
+ issue: issueKey,
57750
+ role: _enum2(LEGION_ROLES),
57751
+ askedAt: timestamp
57752
+ });
57753
+ var legionPauseHeldRow = object({
57754
+ id: number2().int().positive(),
57755
+ kind: nonEmptyString2,
57756
+ issue: nonEmptyString2,
57757
+ claim: nonEmptyString2.optional(),
57758
+ waitedSeconds: number2().int().nonnegative()
57759
+ });
57760
+ var legionPaused = object({
57761
+ ...pauseFields,
57762
+ waitsOn: array(legionPauseStop),
57763
+ held: array(legionPauseHeldRow)
57764
+ });
57727
57765
  var LegionStateResponse = object({
57728
57766
  daemon: daemonInfo,
57729
57767
  contract: legionContract.optional(),
@@ -57734,6 +57772,8 @@ var LegionStateResponse = object({
57734
57772
  strandedClaims: array(legionStrandedClaim),
57735
57773
  wakesWaiting: array(legionWakeWaiting).optional(),
57736
57774
  claimsToRefresh: number2().int().nonnegative().optional(),
57775
+ paused: legionPaused.optional(),
57776
+ lastPause: legionEndedPause.optional(),
57737
57777
  controllerLocator: legionControllerLocator.optional(),
57738
57778
  agentSecretsLogin: legionAgentSecretsLoginView.optional(),
57739
57779
  capabilities: array(legionCapabilityState),
@@ -57822,7 +57862,8 @@ var legionResumeRecord = object({
57822
57862
  at: timestamp,
57823
57863
  podReadyAt: timestamp.optional(),
57824
57864
  firstTurnAt: timestamp.optional(),
57825
- stuck: boolean2()
57865
+ stuck: boolean2(),
57866
+ pause: number2().int().positive().optional()
57826
57867
  });
57827
57868
  var legionHoldRecord = object({
57828
57869
  id: number2().int().positive(),
@@ -57942,6 +57983,20 @@ var LegionWaveReleaseResponse = object({
57942
57983
  started: array(issueKey),
57943
57984
  held: array(legionBlockedIssue)
57944
57985
  });
57986
+ var LegionProjectPauseResponse = object({
57987
+ pause: legionPause
57988
+ });
57989
+ var LegionProjectResumeResponse = object({
57990
+ pause: legionEndedPause,
57991
+ released: number2().int().nonnegative()
57992
+ });
57993
+ var LegionPauseFailureResponse = object({
57994
+ code: nonEmptyString2,
57995
+ error: nonEmptyString2,
57996
+ setting: nonEmptyString2.optional(),
57997
+ pause: legionPause.optional(),
57998
+ lastPause: legionEndedPause.optional()
57999
+ });
57945
58000
  var LegionGrantRequest = strictObject({
57946
58001
  sessionId: nonEmptyString2,
57947
58002
  secret: nonEmptyString2,
@@ -57986,6 +58041,16 @@ var LegionIssueStatusRequest = strictObject({
57986
58041
  issue: nonEmptyString2,
57987
58042
  status: _enum2(["todo", "backlog", "icebox"])
57988
58043
  });
58044
+ var LegionProjectPauseRequest = strictObject({
58045
+ grantId: nonEmptyString2,
58046
+ reason: nonEmptyString2
58047
+ });
58048
+ var LegionProjectResumeRequest = strictObject({
58049
+ grantId: nonEmptyString2
58050
+ });
58051
+ var LegionOperatorProjectPauseRequest = strictObject({
58052
+ reason: nonEmptyString2
58053
+ });
57989
58054
  var LegionGateRegisterRequest = strictObject({
57990
58055
  grantId: nonEmptyString2,
57991
58056
  issue: nonEmptyString2,
@@ -58218,6 +58283,8 @@ function createLegionDaemonClient(baseUrl, fetchFn = fetch) {
58218
58283
  issueStatus: (input) => post("/legion/v1/issues/status", LegionIssueStatusRequest, LegionEmptyResponse, input),
58219
58284
  freshSession: (input) => post("/legion/v1/claims/fresh-session", LegionClaimRequest, LegionFreshSessionResponse, input),
58220
58285
  compact: (input) => post("/legion/v1/claims/compact", LegionClaimRequest, LegionCompactResponse, input),
58286
+ projectPause: (input) => post("/legion/v1/project/pause", LegionProjectPauseRequest, LegionProjectPauseResponse, input),
58287
+ projectResume: (input) => post("/legion/v1/project/resume", LegionProjectResumeRequest, LegionProjectResumeResponse, input),
58221
58288
  gateRegister: (input) => post("/legion/v1/gates/register", LegionGateRegisterRequest, LegionEmptyResponse, input),
58222
58289
  waveRelease: (input) => post("/legion/v1/waves/release", LegionWaveReleaseRequest, LegionWaveReleaseResponse, input),
58223
58290
  phaseBackward: (input) => post("/legion/v1/phase/backward", LegionPhaseBackwardRequest, LegionEmptyResponse, input),
@@ -58420,9 +58487,9 @@ var import_nats2 = __toESM(require_mod4(), 1);
58420
58487
 
58421
58488
  // package.json
58422
58489
  var name2 = "@sjawhar/claude-envoy";
58423
- var version2 = "4.11.4";
58490
+ var version2 = "4.12.0";
58424
58491
  var legion = {
58425
- daemonApiVersion: 168
58492
+ daemonApiVersion: 178
58426
58493
  };
58427
58494
 
58428
58495
  // ../pi-shared/src/agent-stream.ts
@@ -60737,7 +60804,7 @@ function phaseOpParameters(zod) {
60737
60804
  }
60738
60805
  var PHASE_OP_SENTENCES = {
60739
60806
  readRecord: "read_record returns the record of `issue` from the daemon's state, your own issue when you leave `issue` out. " + "A held issue names in `heldFrom` the phase the hold took it out of. A failed claim carries `failure`: the " + "`cause` word for what failed it, the `detail` sentence beside that word, `at`, when it failed, and " + "`attempts`, the four counts it failed with. A todo written on a held root releases the hold and starts " + "that phase again, as the architect's retry_or_escalate with retry does. ",
60740
- readReleaseRecords: "read_release_records returns this deployment's idle-release records from `since` (an RFC 3339 time) on, read with this session's own claim: " + "every release, resume and hold the daemon recorded, and over them the counts of releases, of the releases among them that suspended no " + "role, of resumes by wake kind and of holds by reason, the pod-hours released, the share of releases woken again within ten minutes, and " + "the median, 90th percentile and maximum seconds from a wake to the woken role's first turn. A release that suspended no role is woken by " + "nothing, so the pod-hours released and the woken share count the releases that suspended a role alone. ",
60807
+ readReleaseRecords: "read_release_records returns this deployment's idle-release records from `since` (an RFC 3339 time) on, read with this session's own claim: " + "every release, resume and hold the daemon recorded, and over them the counts of releases, of the releases among them that suspended no " + "role, of resumes by wake kind and of holds by reason, the pod-hours released, the share of releases woken again within ten minutes, and " + "the median, 90th percentile and maximum seconds from a wake to the woken role's first turn. A wake that a project pause held is " + "counted as `heldByPause` and left out of those seconds, since its wait measures the pause. A release that suspended no role is woken by " + "nothing, so the pod-hours released and the woken share count the releases that suspended a role alone. ",
60741
60808
  requestBackwardMove: "request_backward_move returns an issue to an earlier phase (`to`, `reason`). A phase worker moves its own issue. " + "The architect that owns an issue in accepting moves it, named by `issue`, back to implementing or testing. That move counts a review round. "
60742
60809
  };
60743
60810
  var STALE_ENTRY_INSTRUCTION = "End this turn without completing. The task of the entry the phase is on is owed to this claim, and the daemon sends it by itself. " + "That task is work of its own: do what it asks at the head it names and complete it with a handoff of its own, never this completion's " + "record, commit or verdict";
@@ -60852,10 +60919,19 @@ async function releaseRecords(runtime, since) {
60852
60919
  });
60853
60920
  const asOf = runtime.now?.() ?? new Date;
60854
60921
  const wokenAt = new Map;
60922
+ const heldWakes = new Map;
60855
60923
  for (const resume of records.resumes) {
60924
+ const at = Date.parse(resume.at);
60925
+ if (resume.pause !== undefined) {
60926
+ const held = heldWakes.get(resume.issue);
60927
+ if (held === undefined)
60928
+ heldWakes.set(resume.issue, [at]);
60929
+ else
60930
+ held.push(at);
60931
+ continue;
60932
+ }
60856
60933
  if (resume.release === 0)
60857
60934
  continue;
60858
- const at = Date.parse(resume.at);
60859
60935
  const first = wokenAt.get(resume.release);
60860
60936
  if (first === undefined || at < first)
60861
60937
  wokenAt.set(resume.release, at);
@@ -60869,13 +60945,28 @@ async function releaseRecords(runtime, since) {
60869
60945
  continue;
60870
60946
  }
60871
60947
  const from = Date.parse(release.at);
60872
- const woken = wokenAt.get(release.id);
60948
+ let woken = wokenAt.get(release.id);
60949
+ for (const at of heldWakes.get(release.issue) ?? []) {
60950
+ if (at >= from && (woken === undefined || at < woken))
60951
+ woken = at;
60952
+ }
60873
60953
  releasedMs += Math.max((woken ?? asOf.getTime()) - from, 0);
60874
60954
  if (woken !== undefined && woken - from <= WOKEN_SOON_MS)
60875
60955
  wokenSoon += 1;
60876
60956
  }
60877
60957
  const wakeable = records.releases.length - suspendedNoRole;
60878
- const waits = records.resumes.flatMap((resume) => resume.firstTurnAt === undefined ? [] : [(Date.parse(resume.firstTurnAt) - Date.parse(resume.at)) / 1000]).sort((one, other) => one - other);
60958
+ let heldByPause = 0;
60959
+ let withoutFirstTurn = 0;
60960
+ const waits = [];
60961
+ for (const resume of records.resumes) {
60962
+ if (resume.pause !== undefined)
60963
+ heldByPause += 1;
60964
+ else if (resume.firstTurnAt === undefined)
60965
+ withoutFirstTurn += 1;
60966
+ else
60967
+ waits.push((Date.parse(resume.firstTurnAt) - Date.parse(resume.at)) / 1000);
60968
+ }
60969
+ waits.sort((one, other) => one - other);
60879
60970
  const whole = (value) => value === null ? null : Math.round(value);
60880
60971
  return {
60881
60972
  since,
@@ -60898,7 +60989,8 @@ async function releaseRecords(runtime, since) {
60898
60989
  },
60899
60990
  wakeToFirstTurnSeconds: {
60900
60991
  measured: waits.length,
60901
- withoutFirstTurn: records.resumes.length - waits.length,
60992
+ withoutFirstTurn,
60993
+ heldByPause,
60902
60994
  median: whole(percentile(waits, 0.5)),
60903
60995
  p90: whole(percentile(waits, 0.9)),
60904
60996
  max: whole(waits.at(-1) ?? null)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "4.11.4",
3
+ "version": "4.12.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Claude Code plugin for Legion's Envoy bus",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "AGENTS.md"
20
20
  ],
21
21
  "legion": {
22
- "daemonApiVersion": 168
22
+ "daemonApiVersion": 178
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",