@sjawhar/claude-envoy 4.14.4 → 4.14.6
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.
- package/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/dist/codex-hook.js +1 -0
- package/dist/dispatch.js +1 -0
- package/dist/envoy-channel.js +48 -4
- package/dist/session-hook.js +1 -0
- package/package.json +1 -1
- package/scripts/check-packed-skills.sh +5 -2
- package/src/legion-claim.ts +2 -0
package/.omp-plugin/plugin.json
CHANGED
package/dist/codex-hook.js
CHANGED
|
@@ -16714,6 +16714,7 @@ var EnvelopeSchema = object({
|
|
|
16714
16714
|
expires_at: number2().int().optional(),
|
|
16715
16715
|
kept_at: number2().int().optional(),
|
|
16716
16716
|
mention_dedupe_keys: record(string2(), string2()).optional(),
|
|
16717
|
+
role: string2().min(1).optional(),
|
|
16717
16718
|
payload_summary: string2().min(1),
|
|
16718
16719
|
payload: string2().optional(),
|
|
16719
16720
|
payload_ref: string2().optional(),
|
package/dist/dispatch.js
CHANGED
|
@@ -18011,6 +18011,7 @@ var EnvelopeSchema = object({
|
|
|
18011
18011
|
expires_at: number2().int().optional(),
|
|
18012
18012
|
kept_at: number2().int().optional(),
|
|
18013
18013
|
mention_dedupe_keys: record(string2(), string2()).optional(),
|
|
18014
|
+
role: string2().min(1).optional(),
|
|
18014
18015
|
payload_summary: string2().min(1),
|
|
18015
18016
|
payload: string2().optional(),
|
|
18016
18017
|
payload_ref: string2().optional(),
|
package/dist/envoy-channel.js
CHANGED
|
@@ -39493,6 +39493,7 @@ var EnvelopeSchema = object({
|
|
|
39493
39493
|
expires_at: number2().int().optional(),
|
|
39494
39494
|
kept_at: number2().int().optional(),
|
|
39495
39495
|
mention_dedupe_keys: record(string2(), string2()).optional(),
|
|
39496
|
+
role: string2().min(1).optional(),
|
|
39496
39497
|
payload_summary: string2().min(1),
|
|
39497
39498
|
payload: string2().optional(),
|
|
39498
39499
|
payload_ref: string2().optional(),
|
|
@@ -57145,7 +57146,7 @@ var SESSION_STATE_GUIDE = "A session is live, unresponsive or gone, by how long
|
|
|
57145
57146
|
var DELIVERY_CONTRACT = "Delivery is at-least-once, possibly out of order across topics; use id for dedupe and at for freshness.";
|
|
57146
57147
|
var PUBLISH_COUNTS = "The answer counts who gets it: recipients is every session other than you that the message " + `goes to, one that is stopped and gets it when it runs again within ${DELIVERY_DUPLICATE_WINDOW_HOURS} hours included, and ` + "recipients_connected is how many of those are running now. A listener that counts neither " + "sends neither, and a role topic names its holder instead.";
|
|
57147
57148
|
var STORED_DELIVERY = "Every notification topic is stored (agent, dispatch, github, slack, legion, ghostwispr, " + "whatsapp, team; a role message reaches its holder as a stored copy on the holder's agent " + "topic), and reaches each subscribed session once from the durable consumer its listener " + "relays to it, also one that was away or restarted. A 200 means the stream stored the message " + "for each subscribed session's consumer, not that any recipient has read it.";
|
|
57148
|
-
var TOPIC_GUIDE = "Topic guide (all are under notifications.): agent.<session_id> (subscribe: own inbox); role.<role> " + "(publish-to; holders claim via envoy_role_set). > matches one or more trailing tokens and does not " + "match the base subject. Envoy registers the concrete base when you subscribe to <subject>.>, so " + "the recommended default remains github.<owner>.<repo>.pr.<n>.>. <owner> and <repo> are one token " + "each, with every dot in the name written _ (sjawhar/.github is github.sjawhar._github; " + "acme/site.io is github.acme.site_io), and a topic spelled with the dot receives nothing. " + "Default PR subscription: " + "github.<owner>.<repo>.pr.<n>.> (it receives the quiet PR family): pr.<n> (lifecycle: " + "opened/synchronize/closed; closed carries merged, merge_commit_sha, merged_by, head_sha), " + "pr.<n>.comment, pr.<n>.review, pr.<n>.mention, pr.<n>.checks (one settlement event per commit whose checks settle, the head or not, naming its sha: " + "passed/failed/cancelled/skipped check runs with failing names and URLs, and statuses, each commit status as " + "{context, state, created_at} with state success, failure or error and created_at the time GitHub created it, " + "left out when none is recorded; for each context keep the entry with the later created_at, and keep a context " + 'that a settlement leaves out as it was; re-fires with superseded_settlement: "true" ' + "when new runs appear, or a commit status is new or changes state, for the same commit). Other GitHub: issue.<n>, issue.<n>.comment, " + "issue.<n>.mention, mention, push.branch.<name>, push.tag.<name>, workflow.<file>.<action> (only " + "runs without an associated PR); slack.<team>.<channel>.message|mention and " + "slack.<team>.<channel>.thread.<ts>.message|mention; ghostwispr.<session>.<kind>; " + "whatsapp.<phone>.<jid>.<kind>; envoy.exceptions.<original-topic>.";
|
|
57149
|
+
var TOPIC_GUIDE = "Topic guide (all are under notifications.): agent.<session_id> (subscribe: own inbox); role.<role> " + "(publish-to; holders claim via envoy_role_set). > matches one or more trailing tokens and does not " + "match the base subject. Envoy registers the concrete base when you subscribe to <subject>.>, so " + "the recommended default remains github.<owner>.<repo>.pr.<n>.>. <owner> and <repo> are one token " + "each, with every dot in the name written _ (sjawhar/.github is github.sjawhar._github; " + "acme/site.io is github.acme.site_io), and a topic spelled with the dot receives nothing. " + "Default PR subscription: " + "github.<owner>.<repo>.pr.<n>.> (it receives the quiet PR family): pr.<n> (lifecycle: " + "opened/synchronize/closed; closed carries merged, merge_commit_sha, merged_by, head_sha), " + "pr.<n>.comment, pr.<n>.review, pr.<n>.mention, pr.<n>.checks (one settlement event per commit whose checks settle, the head or not, naming its sha: " + "passed/failed/cancelled/skipped check runs with failing names and URLs, check_runs, each check's latest run as " + "{name, id, conclusion} with conclusion GitHub's own word for that run where one is recorded (for example " + "success, skipped, neutral or timed_out; a skipped check ran nothing on that commit), and statuses, each commit status as " + "{context, state, created_at} with state success, failure or error and created_at the time GitHub created it, " + "left out when none is recorded; for each context keep the entry with the later created_at, and keep a context " + 'that a settlement leaves out as it was; re-fires with superseded_settlement: "true" ' + "when new runs appear, or a commit status is new or changes state, for the same commit). Other GitHub: issue.<n>, issue.<n>.comment, " + "issue.<n>.mention, mention, push.branch.<name>, push.tag.<name>, workflow.<file>.<action> (only " + "runs without an associated PR); slack.<team>.<channel>.message|mention and " + "slack.<team>.<channel>.thread.<ts>.message|mention; ghostwispr.<session>.<kind>; " + "whatsapp.<phone>.<jid>.<kind>; envoy.exceptions.<original-topic>.";
|
|
57149
57150
|
var URGENCY_VALUES = EnvelopeSchema.shape.urgency.unwrap().options;
|
|
57150
57151
|
function messageMetadataShape(schema) {
|
|
57151
57152
|
return {
|
|
@@ -58530,7 +58531,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
58530
58531
|
|
|
58531
58532
|
// package.json
|
|
58532
58533
|
var name2 = "@sjawhar/claude-envoy";
|
|
58533
|
-
var version2 = "4.14.
|
|
58534
|
+
var version2 = "4.14.6";
|
|
58534
58535
|
var legion = {
|
|
58535
58536
|
daemonApiVersion: 178
|
|
58536
58537
|
};
|
|
@@ -59846,9 +59847,14 @@ function claimRoleAtFirstTurn(host, role, firstTurn) {
|
|
|
59846
59847
|
clearTimeout(bound);
|
|
59847
59848
|
(async () => {
|
|
59848
59849
|
try {
|
|
59849
|
-
await host.claimRole(role)
|
|
59850
|
+
await claimRoleAgainOnBusy(() => host.claimRole(role), role, {
|
|
59851
|
+
log: host.log,
|
|
59852
|
+
firstDelayMs: host.roleClaimRetryFirstDelayMs,
|
|
59853
|
+
signal: host.signal
|
|
59854
|
+
});
|
|
59850
59855
|
} catch (error) {
|
|
59851
|
-
|
|
59856
|
+
if (!host.signal?.aborted)
|
|
59857
|
+
stopAfterRegistration(host, role, error);
|
|
59852
59858
|
}
|
|
59853
59859
|
done.resolve();
|
|
59854
59860
|
})();
|
|
@@ -59858,6 +59864,43 @@ function claimRoleAtFirstTurn(host, role, firstTurn) {
|
|
|
59858
59864
|
firstTurn(claim);
|
|
59859
59865
|
return done.promise;
|
|
59860
59866
|
}
|
|
59867
|
+
var ROLE_CLAIM_RETRY_FIRST_DELAY_MS = 1000;
|
|
59868
|
+
var ROLE_CLAIM_RETRY_MAX_DELAY_MS = 30000;
|
|
59869
|
+
async function claimRoleAgainOnBusy(claim, role, options) {
|
|
59870
|
+
let wait = options.firstDelayMs ?? ROLE_CLAIM_RETRY_FIRST_DELAY_MS;
|
|
59871
|
+
for (let attempt = 1;; attempt++) {
|
|
59872
|
+
try {
|
|
59873
|
+
await claim();
|
|
59874
|
+
return;
|
|
59875
|
+
} catch (error) {
|
|
59876
|
+
if (!listenerAskedToClaimAgain(error) || options.signal?.aborted)
|
|
59877
|
+
throw error;
|
|
59878
|
+
if (options.maxAttempts !== undefined && attempt >= options.maxAttempts)
|
|
59879
|
+
throw error;
|
|
59880
|
+
options.log(`claim of Envoy role ${role} was answered 503 at attempt ${attempt}, so nothing was claimed; claiming it again in ${wait} ms: ${messageFor(error)}`);
|
|
59881
|
+
const waited = Promise.withResolvers();
|
|
59882
|
+
const timer = setTimeout(waited.resolve, wait);
|
|
59883
|
+
timer.unref?.();
|
|
59884
|
+
const abort = () => {
|
|
59885
|
+
clearTimeout(timer);
|
|
59886
|
+
waited.resolve();
|
|
59887
|
+
};
|
|
59888
|
+
options.signal?.addEventListener("abort", abort, { once: true });
|
|
59889
|
+
await waited.promise;
|
|
59890
|
+
options.signal?.removeEventListener("abort", abort);
|
|
59891
|
+
if (options.signal?.aborted)
|
|
59892
|
+
throw error;
|
|
59893
|
+
wait = Math.min(wait * 2, ROLE_CLAIM_RETRY_MAX_DELAY_MS);
|
|
59894
|
+
}
|
|
59895
|
+
}
|
|
59896
|
+
}
|
|
59897
|
+
function listenerAskedToClaimAgain(error) {
|
|
59898
|
+
if (!(error instanceof Error) || error.name !== "EnvoyApiError" || !("details" in error)) {
|
|
59899
|
+
return false;
|
|
59900
|
+
}
|
|
59901
|
+
const { details } = error;
|
|
59902
|
+
return typeof details === "object" && details !== null && "status" in details && details.status === 503;
|
|
59903
|
+
}
|
|
59861
59904
|
|
|
59862
59905
|
// src/legion-phase-hook.ts
|
|
59863
59906
|
import { randomUUID as randomUUID4 } from "crypto";
|
|
@@ -60656,6 +60699,7 @@ function startLegionClaim(deps) {
|
|
|
60656
60699
|
firstTurnBoundMs: claimFirstTurnBoundMs(deps.env ?? process.env, paneReminderLog(deps.log)),
|
|
60657
60700
|
onRoleRegained: (listener) => deps.session.onRoleRegained(listener),
|
|
60658
60701
|
log: deps.log,
|
|
60702
|
+
signal: deps.signal,
|
|
60659
60703
|
stopping: "stopping the pane so the daemon launches it again",
|
|
60660
60704
|
stop: () => {
|
|
60661
60705
|
if (!deps.signal.aborted)
|
package/dist/session-hook.js
CHANGED
|
@@ -16918,6 +16918,7 @@ var EnvelopeSchema = object({
|
|
|
16918
16918
|
expires_at: number2().int().optional(),
|
|
16919
16919
|
kept_at: number2().int().optional(),
|
|
16920
16920
|
mention_dedupe_keys: record(string2(), string2()).optional(),
|
|
16921
|
+
role: string2().min(1).optional(),
|
|
16921
16922
|
payload_summary: string2().min(1),
|
|
16922
16923
|
payload: string2().optional(),
|
|
16923
16924
|
payload_ref: string2().optional(),
|
package/package.json
CHANGED
|
@@ -31,7 +31,10 @@ refuse() {
|
|
|
31
31
|
listing=$(tar -tvzf "$tar_file")
|
|
32
32
|
members=$(tar -tzf "$tar_file")
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
# Each lookup reads the listing from a here-string, never from `printf … | grep -q`: grep -q exits
|
|
35
|
+
# at its first match, and a printf still writing then dies of SIGPIPE, which pipefail turns into
|
|
36
|
+
# exit 141 and so into a refusal of a member the tarball holds.
|
|
37
|
+
if ! grep -qxF package/skills/dispatch-first/SKILL.md <<<"$members"; then
|
|
35
38
|
refuse "$tar_file holds no package/skills/dispatch-first/SKILL.md, which the dispatch-first hook reads on every session: pack it with the prepack that resolves skills/<name> (scripts/pack-skills.sh)"
|
|
36
39
|
fi
|
|
37
40
|
|
|
@@ -42,7 +45,7 @@ fi
|
|
|
42
45
|
|
|
43
46
|
names=$(printf '%s\n' "$members" | sed -n 's|^package/skills/\([^/]*\)/.*|\1|p' | sort -u)
|
|
44
47
|
while IFS= read -r name; do
|
|
45
|
-
if !
|
|
48
|
+
if ! grep -qxF "package/skills/$name/SKILL.md" <<<"$members"; then
|
|
46
49
|
refuse "$tar_file packs package/skills/$name with no SKILL.md, so the skill it ships is incomplete"
|
|
47
50
|
fi
|
|
48
51
|
done <<< "$names"
|
package/src/legion-claim.ts
CHANGED
|
@@ -319,6 +319,8 @@ export function startLegionClaim(deps: {
|
|
|
319
319
|
firstTurnBoundMs: claimFirstTurnBoundMs(deps.env ?? process.env, paneReminderLog(deps.log)),
|
|
320
320
|
onRoleRegained: (listener) => deps.session.onRoleRegained(listener),
|
|
321
321
|
log: deps.log,
|
|
322
|
+
// The server's shutdown: a claim answered 503 is not made again once it aborts.
|
|
323
|
+
signal: deps.signal,
|
|
322
324
|
stopping: "stopping the pane so the daemon launches it again",
|
|
323
325
|
// A boot the shutdown aborted stops nothing: this server is already going, and `stop`
|
|
324
326
|
// would SIGTERM the `claude` it runs under on its way out.
|