@sjawhar/claude-envoy 4.11.3 → 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.3"
5
+ "version": "4.12.0"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-envoy",
3
- "version": "4.11.3",
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.3";
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)
@@ -46,11 +46,12 @@ what is missing. Do not guess, and do not widen the scope yourself.
46
46
  - You make no GitHub write of any kind: no pull request, review, comment, label, or status, through
47
47
  `gh` or any other route.
48
48
  - Read a piped command's status with `${PIPESTATUS[0]}`, or with `set -o pipefail` inside a
49
- subshell of that one line; never set `pipefail` at the top level of your shell, where a later
50
- `cmd | head` exits 141 and reads as a failure although it did its job. Never pipe a write — a
51
- `dispatch` command that records something, or any command whose own output tells you what it
52
- did — into `head`, `tail` or `grep`: the status you read would be the pager's, and the line
53
- that says what happened is the line you cut.
49
+ subshell of that one line; never set `-e`, `-u` or `pipefail` at the top level of your shell,
50
+ where under `pipefail` a later `cmd | head` exits 141 and reads as a failure although it did its
51
+ job, and under `-e` or `-u` a later command that fails or reads an unset variable ends the call
52
+ there. Never pipe a write — a `dispatch` command that records something, or any command whose
53
+ own output tells you what it did — into `head`, `tail` or `grep`: the status you read would be
54
+ the pager's, and the line that says what happened is the line you cut.
54
55
  - Make your own scratch with `mktemp -d` and delete only the paths you made, each by its exact
55
56
  path. Never delete by a glob in a shared directory: every role of this issue writes into the
56
57
  same `$TMPDIR` on the issue's volume, so a sweep like `rm -rf "$TMPDIR"/tmp.*` deletes
@@ -54,11 +54,12 @@ are not findings. When nothing changes the work, say so in one line.
54
54
  `--ignore-working-copy`, because every other jj command records the working copy. When you are
55
55
  not sure that a command only reads, do not run it.
56
56
  - Read a piped command's status with `${PIPESTATUS[0]}`, or with `set -o pipefail` inside a
57
- subshell of that one line; never set `pipefail` at the top level of your shell, where a later
58
- `cmd | head` exits 141 and reads as a failure although it did its job. Never pipe a write — a
59
- `dispatch` command that records something, or any command whose own output tells you what it
60
- did — into `head`, `tail` or `grep`: the status you read would be the pager's, and the line
61
- that says what happened is the line you cut.
57
+ subshell of that one line; never set `-e`, `-u` or `pipefail` at the top level of your shell,
58
+ where under `pipefail` a later `cmd | head` exits 141 and reads as a failure although it did its
59
+ job, and under `-e` or `-u` a later command that fails or reads an unset variable ends the call
60
+ there. Never pipe a write — a `dispatch` command that records something, or any command whose
61
+ own output tells you what it did — into `head`, `tail` or `grep`: the status you read would be
62
+ the pager's, and the line that says what happened is the line you cut.
62
63
  - Your session also carries the Dispatch and Envoy tools: read with them if you need to, but write
63
64
  nothing through them — no issue, comment, ask, message, suggestion or document edit, and nothing
64
65
  sent or published.
@@ -105,11 +105,12 @@ name the command that would. Then one line on check 2. Nothing else.
105
105
  `--ignore-working-copy`, because every other jj command records the working copy. When you are
106
106
  not sure that a command only reads, do not run it: mark the claim unverified and name the command.
107
107
  - Read a piped command's status with `${PIPESTATUS[0]}`, or with `set -o pipefail` inside a
108
- subshell of that one line; never set `pipefail` at the top level of your shell, where a later
109
- `cmd | head` exits 141 and reads as a failure although it did its job. Never pipe a write — a
110
- `dispatch` command that records something, or any command whose own output tells you what it
111
- did — into `head`, `tail` or `grep`: the status you read would be the pager's, and the line
112
- that says what happened is the line you cut.
108
+ subshell of that one line; never set `-e`, `-u` or `pipefail` at the top level of your shell,
109
+ where under `pipefail` a later `cmd | head` exits 141 and reads as a failure although it did its
110
+ job, and under `-e` or `-u` a later command that fails or reads an unset variable ends the call
111
+ there. Never pipe a write — a `dispatch` command that records something, or any command whose
112
+ own output tells you what it did — into `head`, `tail` or `grep`: the status you read would be
113
+ the pager's, and the line that says what happened is the line you cut.
113
114
  - Your session also carries the Dispatch and Envoy tools: read with them if you need to, but write
114
115
  nothing through them — no issue, comment, ask, message, suggestion or document edit, and nothing
115
116
  sent or published.
@@ -20,7 +20,7 @@ Review only the supplied diff and changed-file context. Return findings with fil
20
20
 
21
21
  Do not demand abstraction before two real change axes exist. Do not flag code the pull request leaves unchanged. A range your task names limits what you must read, not what you flag: a smell you see in code the pull request changed before that range is a finding. Do not make claims without evidence.
22
22
 
23
- - Read a piped command's status with `${PIPESTATUS[0]}`, or with `set -o pipefail` inside a subshell of that one line; never set `pipefail` at the top level of your shell, where a later `cmd | head` exits 141 and reads as a failure although it did its job. Never pipe a write — a `dispatch` command that records something, or any command whose own output tells you what it did — into `head`, `tail` or `grep`: the status you read would be the pager's, and the line that says what happened is the line you cut.
23
+ - Read a piped command's status with `${PIPESTATUS[0]}`, or with `set -o pipefail` inside a subshell of that one line; never set `-e`, `-u` or `pipefail` at the top level of your shell, where under `pipefail` a later `cmd | head` exits 141 and reads as a failure although it did its job, and under `-e` or `-u` a later command that fails or reads an unset variable ends the call there. Never pipe a write — a `dispatch` command that records something, or any command whose own output tells you what it did — into `head`, `tail` or `grep`: the status you read would be the pager's, and the line that says what happened is the line you cut.
24
24
  - Make your own scratch with `mktemp -d` and delete only the paths you made, each by its exact path. Never delete by a glob in a shared directory: every role of this issue writes into the same `$TMPDIR` on the issue's volume, so a sweep like `rm -rf "$TMPDIR"/tmp.*` deletes directories another role has open.
25
25
 
26
26
  ## Output
@@ -20,7 +20,7 @@ Review only the supplied diff and changed-file context. Return findings with fil
20
20
 
21
21
  Do not report issues in code the pull request leaves unchanged, other than the unchanged consumers the rubric's check 2 finds. A range your task names limits what you must read, not what you report: a defect you see in code the pull request changed before that range is a finding. Do not report speculative findings. If an apparent breakage is intentional, report it only when the scope or consequences are unclear.
22
22
 
23
- - Read a piped command's status with `${PIPESTATUS[0]}`, or with `set -o pipefail` inside a subshell of that one line; never set `pipefail` at the top level of your shell, where a later `cmd | head` exits 141 and reads as a failure although it did its job. Never pipe a write — a `dispatch` command that records something, or any command whose own output tells you what it did — into `head`, `tail` or `grep`: the status you read would be the pager's, and the line that says what happened is the line you cut.
23
+ - Read a piped command's status with `${PIPESTATUS[0]}`, or with `set -o pipefail` inside a subshell of that one line; never set `-e`, `-u` or `pipefail` at the top level of your shell, where under `pipefail` a later `cmd | head` exits 141 and reads as a failure although it did its job, and under `-e` or `-u` a later command that fails or reads an unset variable ends the call there. Never pipe a write — a `dispatch` command that records something, or any command whose own output tells you what it did — into `head`, `tail` or `grep`: the status you read would be the pager's, and the line that says what happened is the line you cut.
24
24
  - Make your own scratch with `mktemp -d` and delete only the paths you made, each by its exact path. Never delete by a glob in a shared directory: every role of this issue writes into the same `$TMPDIR` on the issue's volume, so a sweep like `rm -rf "$TMPDIR"/tmp.*` deletes directories another role has open.
25
25
 
26
26
  ## Output
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/claude-envoy",
3
- "version": "4.11.3",
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",