@sjawhar/claude-envoy 5.27.0 → 5.27.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.
- 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 +18 -4
- package/dist/envoy-channel.js +22 -7
- package/dist/session-hook.js +1 -0
- package/package.json +1 -1
package/.omp-plugin/plugin.json
CHANGED
package/dist/codex-hook.js
CHANGED
|
@@ -13650,6 +13650,7 @@ var GHOSTWISPR_TOPIC_PREFIX = "notifications.ghostwispr.";
|
|
|
13650
13650
|
function uncapturedTopicRefusal(topic, sessionID) {
|
|
13651
13651
|
return `${topic} was not registered: no stream subject captures it, so nothing would be delivered to ${sessionID} on it; follow a notifications.team.<name> topic instead`;
|
|
13652
13652
|
}
|
|
13653
|
+
var MESSAGE_NOT_SENT_PREFIX = "envoy: the message was not sent, and may be sent again later";
|
|
13653
13654
|
|
|
13654
13655
|
// ../contracts/src/legion-roles.ts
|
|
13655
13656
|
var LEGION_ROLES = [
|
package/dist/dispatch.js
CHANGED
|
@@ -14254,6 +14254,7 @@ var GHOSTWISPR_TOPIC_PREFIX = "notifications.ghostwispr.";
|
|
|
14254
14254
|
function uncapturedTopicRefusal(topic, sessionID) {
|
|
14255
14255
|
return `${topic} was not registered: no stream subject captures it, so nothing would be delivered to ${sessionID} on it; follow a notifications.team.<name> topic instead`;
|
|
14256
14256
|
}
|
|
14257
|
+
var MESSAGE_NOT_SENT_PREFIX = "envoy: the message was not sent, and may be sent again later";
|
|
14257
14258
|
|
|
14258
14259
|
// ../contracts/src/legion-roles.ts
|
|
14259
14260
|
var LEGION_ROLES = [
|
|
@@ -36260,6 +36261,7 @@ class EnvoyApiError extends Error {
|
|
|
36260
36261
|
claimReleased;
|
|
36261
36262
|
retryAfterSeconds;
|
|
36262
36263
|
refused;
|
|
36264
|
+
notSent;
|
|
36263
36265
|
constructor(details, shown = {}) {
|
|
36264
36266
|
let parsed;
|
|
36265
36267
|
try {
|
|
@@ -36268,7 +36270,9 @@ class EnvoyApiError extends Error {
|
|
|
36268
36270
|
parsed = result.data;
|
|
36269
36271
|
} catch {}
|
|
36270
36272
|
const redirected = shown.redirectTo === undefined ? "" : ` (a redirect to ${shown.redirectTo}, which this client does not follow)`;
|
|
36271
|
-
|
|
36273
|
+
const notSentAnswer = details.status === 503 && parsed?.error.startsWith(`${MESSAGE_NOT_SENT_PREFIX}: `) === true;
|
|
36274
|
+
const earlier = notSentAnswer && shown.afterUnanswered === true ? " An earlier attempt got no answer or a 5xx, so that attempt may have stored the message." : "";
|
|
36275
|
+
super(parsed === undefined ? `${details.method} ${details.url} failed with ${details.status}${redirected}: ${bodyForText(details.responseBody, shown.tokens ?? "", "the listener's error JSON")}` : `${parsed.error}${parsed.reason === undefined ? "" : ` (reason: ${parsed.reason})`}${parsed.expected === undefined ? "" : ` (expected: ${parsed.expected.join(", ")})`}${refusalStateText(parsed)}${earlier}`);
|
|
36272
36276
|
this.details = details;
|
|
36273
36277
|
this.expected = parsed?.expected;
|
|
36274
36278
|
this.code = parsed?.code;
|
|
@@ -36279,6 +36283,7 @@ class EnvoyApiError extends Error {
|
|
|
36279
36283
|
this.claimReleased = parsed?.claim_released;
|
|
36280
36284
|
this.retryAfterSeconds = parsed?.retry_after_seconds;
|
|
36281
36285
|
this.refused = parsed?.refused;
|
|
36286
|
+
this.notSent = notSentAnswer && shown.afterUnanswered !== true;
|
|
36282
36287
|
}
|
|
36283
36288
|
}
|
|
36284
36289
|
var mintedDedupeKey2 = new RegExp(MINTED_DEDUPE_KEY_PATTERN);
|
|
@@ -36372,10 +36377,12 @@ function createEnvoyClient(config) {
|
|
|
36372
36377
|
const request = async (path, init, options = {}) => {
|
|
36373
36378
|
const url = `${baseUrl}${path}`;
|
|
36374
36379
|
const tries = options.retry === false ? 1 : attempts;
|
|
36380
|
+
let unanswered = false;
|
|
36375
36381
|
for (let attempt = 0;attempt < tries; attempt += 1) {
|
|
36376
36382
|
options.onAttempt?.();
|
|
36377
36383
|
const outcome = await attemptOnce(url, init, options.timeoutMs ?? timeoutMs, options.actingSession);
|
|
36378
36384
|
if ("unanswered" in outcome) {
|
|
36385
|
+
unanswered = true;
|
|
36379
36386
|
options.onUnanswered?.();
|
|
36380
36387
|
if (attempt + 1 < tries) {
|
|
36381
36388
|
await waitForRetry(retryDelayMs);
|
|
@@ -36400,9 +36407,16 @@ function createEnvoyClient(config) {
|
|
|
36400
36407
|
url: shown(url),
|
|
36401
36408
|
status: response.status,
|
|
36402
36409
|
responseBody: body
|
|
36403
|
-
}, {
|
|
36410
|
+
}, {
|
|
36411
|
+
tokens: redacted,
|
|
36412
|
+
redirectTo: redirectOrigin(response, url, redacted),
|
|
36413
|
+
afterUnanswered: unanswered
|
|
36414
|
+
});
|
|
36404
36415
|
if (response.status >= 500) {
|
|
36405
|
-
|
|
36416
|
+
if (!error.notSent) {
|
|
36417
|
+
unanswered = true;
|
|
36418
|
+
options.onUnanswered?.();
|
|
36419
|
+
}
|
|
36406
36420
|
if (attempt + 1 < tries) {
|
|
36407
36421
|
await waitForRetry(retryDelayMs);
|
|
36408
36422
|
continue;
|
|
@@ -36478,7 +36492,7 @@ function createEnvoyClient(config) {
|
|
|
36478
36492
|
return taken;
|
|
36479
36493
|
response = EnvelopeResponseSchema.parse(raw);
|
|
36480
36494
|
} catch (error) {
|
|
36481
|
-
const refused = notSent || error instanceof EnvoyApiError && error.details.status < 500;
|
|
36495
|
+
const refused = notSent || error instanceof EnvoyApiError && (error.details.status < 500 || error.notSent);
|
|
36482
36496
|
if (refused && !unanswered)
|
|
36483
36497
|
throw error;
|
|
36484
36498
|
throw new EnvoySendUnconfirmedError(input.targetSessionID, idempotencyKey, made, error);
|
package/dist/envoy-channel.js
CHANGED
|
@@ -36450,6 +36450,7 @@ var GHOSTWISPR_TOPIC_PREFIX = "notifications.ghostwispr.";
|
|
|
36450
36450
|
function uncapturedTopicRefusal(topic, sessionID) {
|
|
36451
36451
|
return `${topic} was not registered: no stream subject captures it, so nothing would be delivered to ${sessionID} on it; follow a notifications.team.<name> topic instead`;
|
|
36452
36452
|
}
|
|
36453
|
+
var MESSAGE_NOT_SENT_PREFIX = "envoy: the message was not sent, and may be sent again later";
|
|
36453
36454
|
|
|
36454
36455
|
// ../contracts/src/legion-roles.ts
|
|
36455
36456
|
var LEGION_ROLES = [
|
|
@@ -58145,6 +58146,7 @@ class EnvoyApiError extends Error {
|
|
|
58145
58146
|
claimReleased;
|
|
58146
58147
|
retryAfterSeconds;
|
|
58147
58148
|
refused;
|
|
58149
|
+
notSent;
|
|
58148
58150
|
constructor(details, shown = {}) {
|
|
58149
58151
|
let parsed;
|
|
58150
58152
|
try {
|
|
@@ -58153,7 +58155,9 @@ class EnvoyApiError extends Error {
|
|
|
58153
58155
|
parsed = result.data;
|
|
58154
58156
|
} catch {}
|
|
58155
58157
|
const redirected = shown.redirectTo === undefined ? "" : ` (a redirect to ${shown.redirectTo}, which this client does not follow)`;
|
|
58156
|
-
|
|
58158
|
+
const notSentAnswer = details.status === 503 && parsed?.error.startsWith(`${MESSAGE_NOT_SENT_PREFIX}: `) === true;
|
|
58159
|
+
const earlier = notSentAnswer && shown.afterUnanswered === true ? " An earlier attempt got no answer or a 5xx, so that attempt may have stored the message." : "";
|
|
58160
|
+
super(parsed === undefined ? `${details.method} ${details.url} failed with ${details.status}${redirected}: ${bodyForText(details.responseBody, shown.tokens ?? "", "the listener's error JSON")}` : `${parsed.error}${parsed.reason === undefined ? "" : ` (reason: ${parsed.reason})`}${parsed.expected === undefined ? "" : ` (expected: ${parsed.expected.join(", ")})`}${refusalStateText(parsed)}${earlier}`);
|
|
58157
58161
|
this.details = details;
|
|
58158
58162
|
this.expected = parsed?.expected;
|
|
58159
58163
|
this.code = parsed?.code;
|
|
@@ -58164,6 +58168,7 @@ class EnvoyApiError extends Error {
|
|
|
58164
58168
|
this.claimReleased = parsed?.claim_released;
|
|
58165
58169
|
this.retryAfterSeconds = parsed?.retry_after_seconds;
|
|
58166
58170
|
this.refused = parsed?.refused;
|
|
58171
|
+
this.notSent = notSentAnswer && shown.afterUnanswered !== true;
|
|
58167
58172
|
}
|
|
58168
58173
|
}
|
|
58169
58174
|
var mintedDedupeKey2 = new RegExp(MINTED_DEDUPE_KEY_PATTERN);
|
|
@@ -58257,10 +58262,12 @@ function createEnvoyClient(config) {
|
|
|
58257
58262
|
const request = async (path, init, options = {}) => {
|
|
58258
58263
|
const url = `${baseUrl}${path}`;
|
|
58259
58264
|
const tries = options.retry === false ? 1 : attempts;
|
|
58265
|
+
let unanswered = false;
|
|
58260
58266
|
for (let attempt = 0;attempt < tries; attempt += 1) {
|
|
58261
58267
|
options.onAttempt?.();
|
|
58262
58268
|
const outcome = await attemptOnce(url, init, options.timeoutMs ?? timeoutMs, options.actingSession);
|
|
58263
58269
|
if ("unanswered" in outcome) {
|
|
58270
|
+
unanswered = true;
|
|
58264
58271
|
options.onUnanswered?.();
|
|
58265
58272
|
if (attempt + 1 < tries) {
|
|
58266
58273
|
await waitForRetry(retryDelayMs);
|
|
@@ -58285,9 +58292,16 @@ function createEnvoyClient(config) {
|
|
|
58285
58292
|
url: shown(url),
|
|
58286
58293
|
status: response.status,
|
|
58287
58294
|
responseBody: body
|
|
58288
|
-
}, {
|
|
58295
|
+
}, {
|
|
58296
|
+
tokens: redacted,
|
|
58297
|
+
redirectTo: redirectOrigin(response, url, redacted),
|
|
58298
|
+
afterUnanswered: unanswered
|
|
58299
|
+
});
|
|
58289
58300
|
if (response.status >= 500) {
|
|
58290
|
-
|
|
58301
|
+
if (!error.notSent) {
|
|
58302
|
+
unanswered = true;
|
|
58303
|
+
options.onUnanswered?.();
|
|
58304
|
+
}
|
|
58291
58305
|
if (attempt + 1 < tries) {
|
|
58292
58306
|
await waitForRetry(retryDelayMs);
|
|
58293
58307
|
continue;
|
|
@@ -58363,7 +58377,7 @@ function createEnvoyClient(config) {
|
|
|
58363
58377
|
return taken;
|
|
58364
58378
|
response = EnvelopeResponseSchema.parse(raw);
|
|
58365
58379
|
} catch (error) {
|
|
58366
|
-
const refused = notSent || error instanceof EnvoyApiError && error.details.status < 500;
|
|
58380
|
+
const refused = notSent || error instanceof EnvoyApiError && (error.details.status < 500 || error.notSent);
|
|
58367
58381
|
if (refused && !unanswered)
|
|
58368
58382
|
throw error;
|
|
58369
58383
|
throw new EnvoySendUnconfirmedError(input.targetSessionID, idempotencyKey, made, error);
|
|
@@ -62998,6 +63012,7 @@ var SESSION_STATE_GUIDE = "A session is live, unresponsive or gone, by how long
|
|
|
62998
63012
|
var DELIVERY_CONTRACT = "Delivery is at-least-once, possibly out of order across topics; use id for dedupe and at for freshness.";
|
|
62999
63013
|
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.";
|
|
63000
63014
|
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.";
|
|
63015
|
+
var NOT_SENT_GUIDE = "An error that says the message was not sent means nothing was stored, so the same message may " + "be sent again later.";
|
|
63001
63016
|
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>.";
|
|
63002
63017
|
var URGENCY_VALUES = EnvelopeSchema.shape.urgency.unwrap().options;
|
|
63003
63018
|
function messageMetadataShape(schema) {
|
|
@@ -63064,7 +63079,7 @@ var envoyToolSpecs = [
|
|
|
63064
63079
|
},
|
|
63065
63080
|
{
|
|
63066
63081
|
name: "envoy_send",
|
|
63067
|
-
description: `Send an Envoy agent-to-agent message directly to another session by session ID. The confirmation names the recipient's state. A message to an unresponsive session is stored and reaches it when it answers again, so an unresponsive recipient is not a failed send and no reason to send to someone else instead. ${SESSION_STATE_GUIDE} ${DELIVERY_CONTRACT} A send that is not confirmed delivered errs naming its idempotency_key; send the same message again with that idempotency_key within ${DELIVERY_DUPLICATE_WINDOW_HOURS} hours, and Envoy drops it as a repeat if the first copy arrived
|
|
63082
|
+
description: `Send an Envoy agent-to-agent message directly to another session by session ID. The confirmation names the recipient's state. A message to an unresponsive session is stored and reaches it when it answers again, so an unresponsive recipient is not a failed send and no reason to send to someone else instead. ${SESSION_STATE_GUIDE} ${DELIVERY_CONTRACT} A send that is not confirmed delivered errs naming its idempotency_key; send the same message again with that idempotency_key within ${DELIVERY_DUPLICATE_WINDOW_HOURS} hours, and Envoy drops it as a repeat if the first copy arrived. ${NOT_SENT_GUIDE}`,
|
|
63068
63083
|
arguments: (schema) => ({
|
|
63069
63084
|
session_id: schema.string().describe("Target session ID; find it with envoy_sessions or envoy_whoami."),
|
|
63070
63085
|
...messageArguments(schema),
|
|
@@ -63074,7 +63089,7 @@ var envoyToolSpecs = [
|
|
|
63074
63089
|
},
|
|
63075
63090
|
{
|
|
63076
63091
|
name: "envoy_publish",
|
|
63077
|
-
description: `Publish an Envoy message to a notifications. topic. ${STORED_DELIVERY} A role or built-in topic is delivered as its guide says. A role message has three possible answers. First, a live session holds the role, and the stream stores the forward for that holder's consumer. Its 200 says the stream stored it. It does not say that the holder read it. It names the holder and the state the listener resolved the holder in. Second, no live session holds the role: nobody claims it, or its holder is unresponsive or gone. The listener then keeps the message for one hour. This is a success. The result says that the listener kept the message, and its kept_until is the time that hour ends. For a holder that is not live, the result also names that holder and its state. The next session to hold the role live before kept_until gets the message. That can be the same holder when it answers again. If no session takes the message by kept_until, Envoy drops it. If the publish named your session as its source, Envoy then sends your session a message that names the dropped message, unless it dropped it more than an hour late. Third, the listener keeps nothing and errs, which tells you to reach the agent some other way: the holder refuses the message, or the forward is not stored within four seconds. A team topic (such as notifications.team.deploy-squad.all) is stored like every other, so a session subscribed to it that was away still receives it when it returns, and one that subscribes after you publish does not. A notifications. topic no stream subject captures is refused by name: nothing would store it. ${PUBLISH_COUNTS} ${SESSION_STATE_GUIDE} ${DELIVERY_CONTRACT}`,
|
|
63092
|
+
description: `Publish an Envoy message to a notifications. topic. ${STORED_DELIVERY} A role or built-in topic is delivered as its guide says. A role message has three possible answers. First, a live session holds the role, and the stream stores the forward for that holder's consumer. Its 200 says the stream stored it. It does not say that the holder read it. It names the holder and the state the listener resolved the holder in. Second, no live session holds the role: nobody claims it, or its holder is unresponsive or gone. The listener then keeps the message for one hour. This is a success. The result says that the listener kept the message, and its kept_until is the time that hour ends. For a holder that is not live, the result also names that holder and its state. The next session to hold the role live before kept_until gets the message. That can be the same holder when it answers again. If no session takes the message by kept_until, Envoy drops it. If the publish named your session as its source, Envoy then sends your session a message that names the dropped message, unless it dropped it more than an hour late. Third, the listener keeps nothing and errs, which tells you to reach the agent some other way: the holder refuses the message, or the forward is not stored within four seconds. A team topic (such as notifications.team.deploy-squad.all) is stored like every other, so a session subscribed to it that was away still receives it when it returns, and one that subscribes after you publish does not. A notifications. topic no stream subject captures is refused by name: nothing would store it. ${NOT_SENT_GUIDE} ${PUBLISH_COUNTS} ${SESSION_STATE_GUIDE} ${DELIVERY_CONTRACT}`,
|
|
63078
63093
|
arguments: (schema) => ({ topic: schema.string(), ...messageArguments(schema) }),
|
|
63079
63094
|
operation: EnvoyToolOperation.publish
|
|
63080
63095
|
},
|
|
@@ -63408,7 +63423,7 @@ var import_nats5 = __toESM(require_mod4(), 1);
|
|
|
63408
63423
|
|
|
63409
63424
|
// package.json
|
|
63410
63425
|
var name2 = "@sjawhar/claude-envoy";
|
|
63411
|
-
var version2 = "5.27.
|
|
63426
|
+
var version2 = "5.27.2";
|
|
63412
63427
|
var legion = {
|
|
63413
63428
|
daemonApiVersion: 256
|
|
63414
63429
|
};
|
package/dist/session-hook.js
CHANGED
|
@@ -17152,6 +17152,7 @@ var GHOSTWISPR_TOPIC_PREFIX = "notifications.ghostwispr.";
|
|
|
17152
17152
|
function uncapturedTopicRefusal(topic, sessionID) {
|
|
17153
17153
|
return `${topic} was not registered: no stream subject captures it, so nothing would be delivered to ${sessionID} on it; follow a notifications.team.<name> topic instead`;
|
|
17154
17154
|
}
|
|
17155
|
+
var MESSAGE_NOT_SENT_PREFIX = "envoy: the message was not sent, and may be sent again later";
|
|
17155
17156
|
|
|
17156
17157
|
// ../contracts/src/legion-roles.ts
|
|
17157
17158
|
var LEGION_ROLES = [
|