@sjawhar/claude-envoy 6.12.0 → 6.12.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/README.md +6 -4
- package/dist/codex-hook.js +11398 -11401
- package/dist/dispatch.js +4598 -4601
- package/dist/envoy-channel.js +74 -65
- package/dist/session-hook.js +40 -43
- package/legion/skills/legion-architect/SKILL.md +2 -2
- package/legion/skills/legion-architect/references/acceptance.md +1 -1
- package/legion/skills/legion-architect/references/decomposition.md +2 -2
- package/legion/skills/legion-architect/references/operations.md +1 -1
- package/legion/skills/legion-controller/SKILL.md +5 -5
- package/legion/skills/legion-controller/references/backlog-stewardship.md +3 -3
- package/legion/skills/legion-controller/references/consolidation.md +1 -1
- package/legion/skills/legion-controller/references/daily-report.md +6 -17
- package/legion/skills/legion-controller/references/escalation.md +1 -1
- package/legion/skills/legion-controller/references/finding-asks-steps.md +4 -4
- package/legion/skills/legion-controller/references/finding-asks.md +16 -15
- package/legion/skills/legion-controller/references/operations-steps.md +2 -2
- package/legion/skills/legion-controller/references/operations.md +5 -5
- package/legion/skills/legion-controller/references/park-asks.md +2 -2
- package/legion/skills/legion-controller/references/triage.md +1 -1
- package/legion/skills/legion-oracle/SKILL.md +1 -1
- package/legion/skills/legion-worker/references/conflicts-and-rewrites.md +0 -2
- package/legion/skills/legion-worker/references/findings-steps.md +5 -5
- package/legion/skills/legion-worker/references/findings.md +13 -22
- package/package.json +1 -1
- package/skills/dispatch/SKILL.md +7 -3
- package/skills/dispatch-first/SKILL.md +1 -1
- package/skills/dispatch-writing-specs/SKILL.md +1 -1
- package/src/envoy-client.ts +3 -2
- package/src/user-turn-router.ts +19 -15
package/src/envoy-client.ts
CHANGED
|
@@ -77,9 +77,10 @@ function recorded(credential: RequestCredential): {
|
|
|
77
77
|
* `envoy-send` command keeps every rule a session's own send keeps:
|
|
78
78
|
* - one idempotency key for the message, on every attempt, so the listener stores it at most
|
|
79
79
|
* once however many attempts reach it;
|
|
80
|
-
* - an attempt that got no answer or a 5xx is sent again under that key, after 250 ms;
|
|
80
|
+
* - an attempt that got no answer, a 408 or a 5xx is sent again under that key, after 250 ms;
|
|
81
81
|
* - a send that may have arrived is told so (`EnvoySendUnconfirmedError`), naming the key that
|
|
82
|
-
* resends it safely, never "failed"
|
|
82
|
+
* resends it safely, never "failed": one an attempt of which got no answer, a 5xx or a 408, which
|
|
83
|
+
* a hop in front of the listener can send after it forwarded the send;
|
|
83
84
|
* - each attempt's credential waits the attempt less the request's reserve
|
|
84
85
|
* (`credentialDeadline`), and a credential that could not be minted lets the request go
|
|
85
86
|
* without it, which a listener that asks for no credential answers. A listener that wants one
|
package/src/user-turn-router.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
// is Dispatch recording that this session accepted that very attempt, and what it injects is
|
|
18
18
|
// the body Dispatch answers with, never the frame's own text.
|
|
19
19
|
import { comparableLines } from "@legion/contracts"
|
|
20
|
+
import { mayHaveReachedServer } from "@legion/contracts/http-status"
|
|
20
21
|
import type { DispatchDelivery, RenderInboundResult } from "@legion/envoy-client/delivery"
|
|
21
22
|
import {
|
|
22
23
|
type DispatchClient,
|
|
@@ -106,22 +107,26 @@ export function acceptLanded(messageId: string, error: DispatchWriteLandedError)
|
|
|
106
107
|
|
|
107
108
|
/** Whether a post that ended in `error` may or may not have been posted: it ended with no
|
|
108
109
|
* definitive answer while an attempt of it may have reached Dispatch
|
|
109
|
-
* (`DispatchWriteUnsettledError`: an earlier attempt got a 5xx or failed in transport,
|
|
110
|
-
* was cut off for silence or by the deadline), or on a
|
|
111
|
-
*
|
|
112
|
-
*
|
|
110
|
+
* (`DispatchWriteUnsettledError`: an earlier attempt got a 5xx or a 408 or failed in transport,
|
|
111
|
+
* or the last was cut off for silence or by the deadline), or on a status after which the request
|
|
112
|
+
* may have reached Dispatch (`mayHaveReachedServer`: a 5xx or a 408, a gateway's included), which
|
|
113
|
+
* can follow a write Dispatch committed. The Dispatch client's keyed POST, which every host's
|
|
114
|
+
* reply goes through, already ends a 5xx or a 408 as `DispatchWriteUnsettledError`
|
|
115
|
+
* (`answerEvent`'s `may-have-run`), so the second test holds for such an error that reaches here
|
|
116
|
+
* unclassified. Dispatch's other 4xx, and an error raised before anything was sent, say it was
|
|
117
|
+
* not posted. */
|
|
113
118
|
function mayHaveBeenPosted(error: unknown): boolean {
|
|
114
119
|
return (
|
|
115
120
|
error instanceof DispatchWriteUnsettledError ||
|
|
116
|
-
(error instanceof DispatchServiceError && error.status
|
|
121
|
+
(error instanceof DispatchServiceError && mayHaveReachedServer(error.status))
|
|
117
122
|
)
|
|
118
123
|
}
|
|
119
124
|
|
|
120
125
|
/** What stderr says of a reply to message `messageId` whose post ended in `error`. One Dispatch
|
|
121
126
|
* made and gave no copy of its answer for (`DispatchWriteLandedError`) is posted, and the
|
|
122
127
|
* error's message says what was made; one that may have landed (`mayHaveBeenPosted`: a
|
|
123
|
-
* `DispatchWriteUnsettledError`, or a
|
|
124
|
-
* so; any other was not posted, whether Dispatch refused it (
|
|
128
|
+
* `DispatchWriteUnsettledError`, a 5xx or a 408) may or may not have been posted, and the line
|
|
129
|
+
* says so; any other was not posted, whether Dispatch refused it (another `DispatchServiceError`,
|
|
125
130
|
* such as a 409) or it never reached Dispatch, and the error's message says which. Every host of
|
|
126
131
|
* this package says it in these words (`./codex/codex-user-turns`). */
|
|
127
132
|
export function replyWarning(messageId: string, error: unknown): string {
|
|
@@ -137,8 +142,8 @@ export function replyWarning(messageId: string, error: unknown): string {
|
|
|
137
142
|
/** What stderr says of a BTW answer to message `messageId` whose post ended in `error`. One
|
|
138
143
|
* Dispatch made and gave no copy of its answer for (`DispatchWriteLandedError`) answered the
|
|
139
144
|
* attempt, so no error reply follows it; one that may have landed (`mayHaveBeenPosted`: a
|
|
140
|
-
* `DispatchWriteUnsettledError`, or a
|
|
141
|
-
* so; any other was not posted, whether Dispatch refused it or it never reached Dispatch, and
|
|
145
|
+
* `DispatchWriteUnsettledError`, a 5xx or a 408) may or may not have been posted, and the line
|
|
146
|
+
* says so; any other was not posted, whether Dispatch refused it or it never reached Dispatch, and
|
|
142
147
|
* the error's message says which. */
|
|
143
148
|
export function btwAnswerWarning(messageId: string, error: unknown): string {
|
|
144
149
|
if (error instanceof DispatchWriteLandedError) {
|
|
@@ -419,12 +424,11 @@ export function createUserTurnRouter(options: UserTurnRouterOptions): UserTurnRo
|
|
|
419
424
|
await reply(delivery, { ...result, followUp })
|
|
420
425
|
}
|
|
421
426
|
|
|
422
|
-
/** Posts one reply to a delivery, naming on stderr
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
*
|
|
427
|
-
* (`replyWarning`). */
|
|
427
|
+
/** Posts one reply to a delivery, naming on stderr how it ended (`replyWarning`): posted, where
|
|
428
|
+
* Dispatch made it and gave no copy of its answer (`DispatchWriteLandedError`), and the error's
|
|
429
|
+
* message says what was made; may or may not have been posted, where `mayHaveBeenPosted` says
|
|
430
|
+
* an attempt may have reached Dispatch; and not posted otherwise, which Dispatch refused or
|
|
431
|
+
* never received. */
|
|
428
432
|
const answer = async (delivery: DispatchDelivery, body: string | undefined): Promise<void> => {
|
|
429
433
|
if (body === undefined) return
|
|
430
434
|
await post(delivery, { body }).catch((error: unknown) => {
|