@sjawhar/pi-envoy 17.7.0 → 17.9.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.
- package/README.md +42 -43
- package/dist/dispatch.js +81 -85
- package/dist/envoy.js +705 -1415
- package/dist/skills/approval-review/SKILL.md +256 -0
- package/dist/skills/approval-review/references/never-decide.md +154 -0
- package/dist/skills/approval-review/references/reviewer-principles.md +54 -0
- package/dist/skills/envoy/SKILL.md +96 -22
- package/dist/skills/envoy/references/deliveries.md +71 -15
- package/dist/skills/envoy/references/legion.md +34 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,23 +9,23 @@ phase worker or the controller with — is the separate plugin `@sjawhar/pi-legi
|
|
|
9
9
|
beside this one in a Legion deployment; it reaches this plugin through the in-process interface
|
|
10
10
|
described in `packages/pi-shared/AGENTS.md`.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
A topic subscription is an interest registered with the listener, which filters the session's own
|
|
13
|
+
durable consumer on it; the session's NATS connection holds one subject, the relay the listener
|
|
14
|
+
serves that consumer on. A role claim is
|
|
15
|
+
different: the listener arbitrates the core-NATS role lane for the current live holder, then
|
|
16
|
+
forwards the message with its original role topic to the holder's direct agent subject.
|
|
15
17
|
`envoy_unsubscribe` manages only normal topic subscriptions; it does not relinquish a held role,
|
|
16
18
|
and it keeps open, listing them as kept, the subscriptions another plugin holds for that role.
|
|
17
|
-
The
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
one hour of the keep, and the publish answers 202 to say the listener kept it. On the core path a
|
|
28
|
-
session does not recover a role message it missed.
|
|
19
|
+
The stream captures every agent subject, so it stores each forward there, and the holder's own
|
|
20
|
+
consumer delivers it once — also after a restart or a dropped connection (below). No session
|
|
21
|
+
answers a receipt: a message sent through the listener's `POST /v1/messages/publish` waits only
|
|
22
|
+
for the stream's acknowledgement that it stored the forward, and answers the sender with an error
|
|
23
|
+
once four seconds pass without one. A role message no live holder can take is kept for the
|
|
24
|
+
session that claims the role next: that session is handed it once, within one hour of the keep,
|
|
25
|
+
and the publish answers 202 to say the listener kept it. A
|
|
26
|
+
`notifications.team.<name>` topic is stored like any other followed topic; every other
|
|
27
|
+
`notifications.` topic the stream does not capture is refused by name, at publish and at
|
|
28
|
+
subscribe, because no session would ever be delivered it.
|
|
29
29
|
|
|
30
30
|
This extension claims the role for the session the host has open, and every automatic claim is
|
|
31
31
|
soft: it names the session it continues, which is a fork's or branch's parent, or the session
|
|
@@ -87,35 +87,33 @@ details result, including subscriptions whose stream currently has no matching e
|
|
|
87
87
|
The session's messages come from a durable consumer the listener keeps for it on Envoy's
|
|
88
88
|
notification stream and relays on `notifications.envoy.deliver.<session id>`, which
|
|
89
89
|
the session subscribes before it registers: its own agent subject, the stored copies of role
|
|
90
|
-
messages to a role it holds, and every followed topic
|
|
90
|
+
messages to a role it holds, and every followed topic, in stream order. No session receives from
|
|
91
|
+
any other NATS subscription. The
|
|
91
92
|
session answers each frame `received` as it decodes and `done` once Oh My Pi wrote the card or
|
|
92
93
|
turn to the session file, so a frame not written when the session stops, or published while it
|
|
93
|
-
was down or disconnected, comes again and is shown once, for up to 72 hours.
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
was down or disconnected, comes again and is shown once, for up to 72 hours. A
|
|
95
|
+
`notifications.team.<name>` topic is stored and delivered like any other followed topic.
|
|
96
|
+
"Consumer delivery" in `AGENTS.md` has the rules, and
|
|
96
97
|
`packages/envoy/AGENTS.md`, "Session consumers", states them once for every host.
|
|
97
98
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
its listener (`POST /v1/replay`) for what the stream stored on its own agent subject and on each
|
|
103
|
-
topic it follows, after the place it last read to, and shows each missed message once, as a card
|
|
104
|
-
saying it was published while the connection was down. The session pings NATS every 10 seconds
|
|
99
|
+
A message published while the session's NATS connection was down, or while the session was not
|
|
100
|
+
running, waits in that consumer: nothing has to be fetched back. It is shown once when the
|
|
101
|
+
session returns, as a card whose last line says it was published while the connection was down.
|
|
102
|
+
The session pings NATS every 10 seconds
|
|
105
103
|
and drops a connection that leaves two pings unanswered, so a connection that stops answering
|
|
106
|
-
without closing is left within 30 seconds and redialed
|
|
107
|
-
|
|
108
|
-
delivery
|
|
109
|
-
runs nothing.
|
|
110
|
-
|
|
111
|
-
registered
|
|
112
|
-
followed the topic, or published before the session first ran this plugin. A message the session
|
|
104
|
+
without closing is left within 30 seconds and redialed, and the listener restarts the relay at
|
|
105
|
+
the consumer's ack floor. A targeted Dispatch
|
|
106
|
+
delivery shown this way (BTW, Aside, Steer, a person's Send) is shown as that card only and
|
|
107
|
+
runs nothing. What the consumer does not hold: anything older than 72 hours, anything published
|
|
108
|
+
before the session followed the topic, and anything published before the session first
|
|
109
|
+
registered. A message the session
|
|
113
110
|
fails to show three times is replaced by one card naming it and saying how to read it. The
|
|
114
|
-
session file keeps what it was shown
|
|
115
|
-
|
|
116
|
-
showing a message and recording it can show it twice, never lose it.
|
|
117
|
-
|
|
118
|
-
|
|
111
|
+
session file keeps what it was shown, so a restart shows nothing again (up to 20,000 messages
|
|
112
|
+
shown in 72 hours); a crash between
|
|
113
|
+
showing a message and recording it can show it twice, never lose it. A registration the listener
|
|
114
|
+
can give no consumer is refused by name, and the session says once that Envoy inbound is
|
|
115
|
+
unavailable and asks again at every heartbeat. "Each frame shown once" in `AGENTS.md` has the
|
|
116
|
+
full rules.
|
|
119
117
|
|
|
120
118
|
## Session identity
|
|
121
119
|
|
|
@@ -195,12 +193,13 @@ pane that still loads the pre-split package beside the new ones.
|
|
|
195
193
|
|
|
196
194
|
The tarball is self-contained: it ships `dist/envoy.js` — bundling every dependency except the OMP
|
|
197
195
|
host packages (`@legion/pi-shared`, `@legion/contracts` and `@legion/envoy-client` are inlined) —
|
|
198
|
-
`dist/THIRD_PARTY_NOTICES`, and the
|
|
196
|
+
`dist/THIRD_PARTY_NOTICES`, and the eleven skills it ships: the eight every session with Dispatch
|
|
199
197
|
reads, `agent-secrets`, `asd-ste100`, `dispatch`, `dispatch-first`, `dispatch-writing-specs`,
|
|
200
|
-
`envoy`, `outside-message` and `plain-words`,
|
|
201
|
-
`thermonuclear-code-quality` and
|
|
202
|
-
|
|
203
|
-
|
|
198
|
+
`envoy`, `outside-message` and `plain-words`; `approval-review`, which only a session judging an
|
|
199
|
+
approval request reads; and the reviewer's pair, `thermonuclear-code-quality` and
|
|
200
|
+
`thermonuclear-deep-review`, which ships here so one copy of each rubric reaches both harnesses.
|
|
201
|
+
All eleven are staged from the repository's `skills/` at `dist/skills`. The manifest declares
|
|
202
|
+
`omp.skills: ["dist/skills"]` alongside `omp.extensions`:
|
|
204
203
|
OMP's own plugin discovery only reads `skill://`-resolvable skills from `<plugin root>/skills` or
|
|
205
204
|
from directories a manifest's `omp.skills` array names, and this package ships skills at
|
|
206
205
|
`dist/skills` (not the plugin root itself), so the field is required for every session to see them
|
package/dist/dispatch.js
CHANGED
|
@@ -14604,6 +14604,9 @@ function isPictureType(mime) {
|
|
|
14604
14604
|
}
|
|
14605
14605
|
|
|
14606
14606
|
// ../contracts/src/subject.ts
|
|
14607
|
+
var AGENT_TOPIC_PREFIX = "notifications.agent.";
|
|
14608
|
+
var ROLE_TOPIC_PREFIX = "notifications.role.";
|
|
14609
|
+
var LEGION_NOTICE_TOPIC_PREFIX = "notifications.legion.";
|
|
14607
14610
|
var DISPATCH_TOPIC_PREFIX = "notifications.dispatch.";
|
|
14608
14611
|
var DISPATCH_ISSUE_TOPIC_PREFIX = `${DISPATCH_TOPIC_PREFIX}issue.`;
|
|
14609
14612
|
var DISPATCH_DOCUMENT_TOPIC_PREFIX = `${DISPATCH_TOPIC_PREFIX}document.`;
|
|
@@ -14613,6 +14616,7 @@ function dispatchIssueSubject(issueKey, type) {
|
|
|
14613
14616
|
function dispatchDocumentSubject(project, slug, type) {
|
|
14614
14617
|
return `${DISPATCH_DOCUMENT_TOPIC_PREFIX}${project}.${slug}.${type}`;
|
|
14615
14618
|
}
|
|
14619
|
+
var GHOSTWISPR_TOPIC_PREFIX = "notifications.ghostwispr.";
|
|
14616
14620
|
|
|
14617
14621
|
// ../contracts/src/legion-roles.ts
|
|
14618
14622
|
var GATED_STEPS = ["decisions", "criteria", "spec"];
|
|
@@ -27406,8 +27410,34 @@ function sessionEnvoySettings(file, env, options) {
|
|
|
27406
27410
|
});
|
|
27407
27411
|
}
|
|
27408
27412
|
|
|
27413
|
+
// ../envoy-client/src/stream-topics.ts
|
|
27414
|
+
var EXCEPTION_TOPIC_PREFIX = "notifications.envoy.exceptions.";
|
|
27415
|
+
var STREAM_SUBJECT_PREFIXES = [
|
|
27416
|
+
AGENT_TOPIC_PREFIX,
|
|
27417
|
+
DISPATCH_TOPIC_PREFIX,
|
|
27418
|
+
"notifications.github.",
|
|
27419
|
+
"notifications.slack.",
|
|
27420
|
+
LEGION_NOTICE_TOPIC_PREFIX,
|
|
27421
|
+
GHOSTWISPR_TOPIC_PREFIX,
|
|
27422
|
+
"notifications.whatsapp.",
|
|
27423
|
+
"notifications.team.",
|
|
27424
|
+
`${EXCEPTION_TOPIC_PREFIX}${AGENT_TOPIC_PREFIX}`,
|
|
27425
|
+
`${EXCEPTION_TOPIC_PREFIX}notifications.team.`
|
|
27426
|
+
];
|
|
27427
|
+
function streamStores(topic) {
|
|
27428
|
+
return STREAM_SUBJECT_PREFIXES.some((prefix) => topic.length > prefix.length && topic.startsWith(prefix));
|
|
27429
|
+
}
|
|
27430
|
+
function streamDeliversNothing(topic) {
|
|
27431
|
+
return topic.startsWith("notifications.") && !topic.startsWith(ROLE_TOPIC_PREFIX) && !streamStores(topic);
|
|
27432
|
+
}
|
|
27433
|
+
var PRIVATE_STREAM_SUBJECTS = [
|
|
27434
|
+
`${AGENT_TOPIC_PREFIX}>`,
|
|
27435
|
+
`${LEGION_NOTICE_TOPIC_PREFIX}>`,
|
|
27436
|
+
`${EXCEPTION_TOPIC_PREFIX}${AGENT_TOPIC_PREFIX}>`,
|
|
27437
|
+
`${EXCEPTION_TOPIC_PREFIX}notifications.team.>`
|
|
27438
|
+
];
|
|
27439
|
+
|
|
27409
27440
|
// ../envoy-client/src/transport.ts
|
|
27410
|
-
var REPLAY_TIMEOUT_MS = 1e4;
|
|
27411
27441
|
var SessionStateSchema = _enum2(["live", "unresponsive", "gone"]);
|
|
27412
27442
|
var UNRESPONSIVE_RULE = "An unresponsive session is not dead: it keeps its role claims and its issue claims, and a " + "message sent to it is stored until it answers. Start no replacement for it and take no claim " + `from it until it is gone, or until ${ISSUE_CLAIM_UNRESPONSIVE_GRACE_MS / 60000} minutes ` + "have passed since its last_seen, the time of its last registration.";
|
|
27413
27443
|
var WireStateSchema = SessionStateSchema.default("live");
|
|
@@ -27419,16 +27449,13 @@ var InterestWireSchema = object({
|
|
|
27419
27449
|
updated_at: number2().int().optional(),
|
|
27420
27450
|
warnings: array(string2()).optional()
|
|
27421
27451
|
});
|
|
27422
|
-
var DeliveryAnswerWireSchema =
|
|
27423
|
-
|
|
27424
|
-
|
|
27425
|
-
|
|
27426
|
-
|
|
27427
|
-
|
|
27428
|
-
|
|
27429
|
-
}),
|
|
27430
|
-
object({ mode: literal("core"), reason: string2() })
|
|
27431
|
-
]);
|
|
27452
|
+
var DeliveryAnswerWireSchema = object({
|
|
27453
|
+
mode: literal("consumer"),
|
|
27454
|
+
subject: string2().min(1),
|
|
27455
|
+
stream_id: string2(),
|
|
27456
|
+
gap: boolean2(),
|
|
27457
|
+
consumer_start: number2().int().nonnegative().optional()
|
|
27458
|
+
});
|
|
27432
27459
|
var SessionWireSchema = object({
|
|
27433
27460
|
session_id: string2(),
|
|
27434
27461
|
machine_id: string2(),
|
|
@@ -27443,7 +27470,8 @@ var SessionWireSchema = object({
|
|
|
27443
27470
|
last_seen: number2().int().optional(),
|
|
27444
27471
|
state: WireStateSchema,
|
|
27445
27472
|
plugin: string2().optional(),
|
|
27446
|
-
plugin_version: string2().optional()
|
|
27473
|
+
plugin_version: string2().optional(),
|
|
27474
|
+
delivery: string2().optional()
|
|
27447
27475
|
});
|
|
27448
27476
|
var RoleWireSchema = object({
|
|
27449
27477
|
role: string2(),
|
|
@@ -27463,13 +27491,13 @@ var RoleHeldWireSchema = object({
|
|
|
27463
27491
|
var ErrorWireSchema = object({
|
|
27464
27492
|
error: string2(),
|
|
27465
27493
|
code: string2().optional(),
|
|
27494
|
+
reason: string2().optional(),
|
|
27466
27495
|
expected: array(string2()).optional(),
|
|
27467
27496
|
state: SessionStateSchema.optional(),
|
|
27468
27497
|
holder: string2().optional(),
|
|
27469
27498
|
holder_state: SessionStateSchema.optional(),
|
|
27470
27499
|
last_seen: number2().int().optional(),
|
|
27471
|
-
claim_released: boolean2().optional()
|
|
27472
|
-
unresponsive: array(string2()).optional()
|
|
27500
|
+
claim_released: boolean2().optional()
|
|
27473
27501
|
});
|
|
27474
27502
|
var EnvelopeResponseSchema = EnvelopeSchema.extend({
|
|
27475
27503
|
recipient: string2().optional(),
|
|
@@ -27477,46 +27505,30 @@ var EnvelopeResponseSchema = EnvelopeSchema.extend({
|
|
|
27477
27505
|
holder_state: SessionStateSchema.optional(),
|
|
27478
27506
|
recipient_state: SessionStateSchema.optional(),
|
|
27479
27507
|
last_seen: number2().int().optional(),
|
|
27480
|
-
unresponsive: array(string2()).optional(),
|
|
27481
27508
|
duplicate: boolean2().optional()
|
|
27482
27509
|
});
|
|
27483
27510
|
var PublishResponseSchema = EnvelopeResponseSchema.extend({
|
|
27484
27511
|
kept: boolean2().optional(),
|
|
27485
27512
|
kept_reason: _enum2(["unclaimed", "holder_lapsed"]).optional()
|
|
27486
27513
|
});
|
|
27487
|
-
var
|
|
27488
|
-
|
|
27489
|
-
|
|
27490
|
-
created: string2(),
|
|
27491
|
-
first_seq: number2().int().nonnegative(),
|
|
27492
|
-
last_seq: number2().int().nonnegative()
|
|
27493
|
-
}),
|
|
27494
|
-
subjects: array(object({
|
|
27495
|
-
subject: string2(),
|
|
27496
|
-
messages: array(object({
|
|
27497
|
-
seq: number2().int().positive(),
|
|
27498
|
-
subject: string2(),
|
|
27499
|
-
time: string2(),
|
|
27500
|
-
data: string2()
|
|
27501
|
-
})),
|
|
27502
|
-
next_after: number2().int().nonnegative(),
|
|
27503
|
-
more: boolean2(),
|
|
27504
|
-
refused: string2().optional()
|
|
27505
|
-
}))
|
|
27514
|
+
var DeliveryRefusalSchema = object({
|
|
27515
|
+
mode: string2(),
|
|
27516
|
+
reason: string2().optional()
|
|
27506
27517
|
});
|
|
27507
|
-
var
|
|
27508
|
-
var DELIVERY_UNREADABLE = "unreadable_answer";
|
|
27518
|
+
var DELIVERY_UNREADABLE = "answered a delivery field this build cannot read";
|
|
27509
27519
|
function parseSubscribeAnswer(body) {
|
|
27510
27520
|
const interest = InterestWireSchema.parse(body);
|
|
27511
27521
|
const raw = typeof body === "object" && body !== null && "delivery" in body ? body.delivery : undefined;
|
|
27512
27522
|
if (raw === undefined || raw === null) {
|
|
27513
|
-
|
|
27523
|
+
throw new Error(`the listener answered no delivery for ${interest.session_id}: it predates session consumers, and a session receives only what its own consumer holds`);
|
|
27514
27524
|
}
|
|
27515
27525
|
const delivery = DeliveryAnswerWireSchema.safeParse(raw);
|
|
27516
|
-
|
|
27517
|
-
|
|
27518
|
-
|
|
27519
|
-
|
|
27526
|
+
if (!delivery.success) {
|
|
27527
|
+
const named = DeliveryRefusalSchema.safeParse(raw);
|
|
27528
|
+
const said = named.success ? `answered delivery mode ${named.data.mode}${named.data.reason === undefined ? "" : ` (${named.data.reason})`}` : DELIVERY_UNREADABLE;
|
|
27529
|
+
throw new Error(`the listener gave ${interest.session_id} no consumer: it ${said}, and a session receives only what its own consumer holds`);
|
|
27530
|
+
}
|
|
27531
|
+
return { ...interest, delivery: delivery.data };
|
|
27520
27532
|
}
|
|
27521
27533
|
function expandSubscriptionTopics(topics) {
|
|
27522
27534
|
const expanded = new Set;
|
|
@@ -27530,27 +27542,20 @@ function expandSubscriptionTopics(topics) {
|
|
|
27530
27542
|
if (segments.length < 2 || segments.some((segment) => segment.length === 0)) {
|
|
27531
27543
|
throw new TypeError(`cannot expand Envoy wildcard topic "${topic}": its concrete base must have at least two non-empty segments`);
|
|
27532
27544
|
}
|
|
27533
|
-
|
|
27545
|
+
if (!streamDeliversNothing(base))
|
|
27546
|
+
expanded.add(base);
|
|
27534
27547
|
expanded.add(topic);
|
|
27535
27548
|
}
|
|
27536
27549
|
return [...expanded];
|
|
27537
27550
|
}
|
|
27538
27551
|
function refusalStateText(parsed) {
|
|
27539
|
-
const sentences = [];
|
|
27540
27552
|
const state = parsed.holder_state ?? parsed.state;
|
|
27541
|
-
if (state
|
|
27542
|
-
const who = parsed.holder === undefined ? "That session" : `Holder ${parsed.holder}`;
|
|
27543
|
-
const seen = parsed.last_seen === undefined || parsed.last_seen <= 0 ? "" : `, last seen ${new Date(parsed.last_seen).toISOString()}`;
|
|
27544
|
-
sentences.push(`${who} is ${state}${seen}.`);
|
|
27545
|
-
}
|
|
27546
|
-
const stored = parsed.unresponsive ?? [];
|
|
27547
|
-
if (stored.length > 0) {
|
|
27548
|
-
const one = stored.length === 1;
|
|
27549
|
-
sentences.push(`Envoy stored the message for ${stored.join(", ")}.`, `${one ? "That session" : "Those sessions"} stopped answering, so ${one ? "it" : "they"} did not fail this send.`);
|
|
27550
|
-
}
|
|
27551
|
-
if (sentences.length === 0)
|
|
27553
|
+
if (state === undefined)
|
|
27552
27554
|
return "";
|
|
27553
|
-
|
|
27555
|
+
const who = parsed.holder === undefined ? "That session" : `Holder ${parsed.holder}`;
|
|
27556
|
+
const seen = parsed.last_seen === undefined || parsed.last_seen <= 0 ? "" : `, last seen ${new Date(parsed.last_seen).toISOString()}`;
|
|
27557
|
+
const sentences = [`${who} is ${state}${seen}.`];
|
|
27558
|
+
if (state === "unresponsive")
|
|
27554
27559
|
sentences.push(UNRESPONSIVE_RULE);
|
|
27555
27560
|
return ` ${sentences.join(" ")}`;
|
|
27556
27561
|
}
|
|
@@ -27560,11 +27565,11 @@ class EnvoyApiError extends Error {
|
|
|
27560
27565
|
name = "EnvoyApiError";
|
|
27561
27566
|
expected;
|
|
27562
27567
|
code;
|
|
27568
|
+
reason;
|
|
27563
27569
|
holder;
|
|
27564
27570
|
sessionState;
|
|
27565
27571
|
lastSeen;
|
|
27566
27572
|
claimReleased;
|
|
27567
|
-
unresponsive;
|
|
27568
27573
|
constructor(details) {
|
|
27569
27574
|
let parsed;
|
|
27570
27575
|
try {
|
|
@@ -27572,15 +27577,15 @@ class EnvoyApiError extends Error {
|
|
|
27572
27577
|
if (result.success)
|
|
27573
27578
|
parsed = result.data;
|
|
27574
27579
|
} catch {}
|
|
27575
|
-
super(parsed === undefined ? `${details.method} ${details.url} failed with ${details.status}: ${details.responseBody}` : `${parsed.error}${parsed.expected === undefined ? "" : ` (expected: ${parsed.expected.join(", ")})`}${refusalStateText(parsed)}`);
|
|
27580
|
+
super(parsed === undefined ? `${details.method} ${details.url} failed with ${details.status}: ${details.responseBody}` : `${parsed.error}${parsed.reason === undefined ? "" : ` (reason: ${parsed.reason})`}${parsed.expected === undefined ? "" : ` (expected: ${parsed.expected.join(", ")})`}${refusalStateText(parsed)}`);
|
|
27576
27581
|
this.details = details;
|
|
27577
27582
|
this.expected = parsed?.expected;
|
|
27578
27583
|
this.code = parsed?.code;
|
|
27584
|
+
this.reason = parsed?.reason;
|
|
27579
27585
|
this.holder = parsed?.holder;
|
|
27580
27586
|
this.sessionState = parsed?.holder_state ?? parsed?.state;
|
|
27581
27587
|
this.lastSeen = parsed?.last_seen;
|
|
27582
27588
|
this.claimReleased = parsed?.claim_released;
|
|
27583
|
-
this.unresponsive = parsed?.unresponsive;
|
|
27584
27589
|
}
|
|
27585
27590
|
}
|
|
27586
27591
|
var mintedDedupeKey2 = new RegExp(MINTED_DEDUPE_KEY_PATTERN);
|
|
@@ -27690,23 +27695,24 @@ function createEnvoyClient(config) {
|
|
|
27690
27695
|
headers: { "Content-Type": "application/json" },
|
|
27691
27696
|
body: JSON.stringify(body)
|
|
27692
27697
|
}, options);
|
|
27698
|
+
const subscribeBody = (input) => ({
|
|
27699
|
+
session_id: input.sessionID,
|
|
27700
|
+
dir: input.directory,
|
|
27701
|
+
topics: expandSubscriptionTopics(input.topics),
|
|
27702
|
+
port: input.port,
|
|
27703
|
+
title: input.title,
|
|
27704
|
+
...input.capabilities === undefined ? {} : { capabilities: input.capabilities },
|
|
27705
|
+
driving: input.driving,
|
|
27706
|
+
...input.selfSubscribed === undefined ? {} : { self_subscribed: input.selfSubscribed },
|
|
27707
|
+
delivery: input.delivery,
|
|
27708
|
+
...input.clientInstanceID === undefined ? {} : { client_instance_id: input.clientInstanceID },
|
|
27709
|
+
host: machineID(),
|
|
27710
|
+
...input.place === undefined ? {} : { tmux_place: input.place },
|
|
27711
|
+
plugin: input.plugin.name,
|
|
27712
|
+
plugin_version: input.plugin.version
|
|
27713
|
+
});
|
|
27693
27714
|
return {
|
|
27694
|
-
subscribe: async (input) => parseSubscribeAnswer(JSON.parse(await post("/v1/interests/subscribe", {
|
|
27695
|
-
session_id: input.sessionID,
|
|
27696
|
-
dir: input.directory,
|
|
27697
|
-
topics: expandSubscriptionTopics(input.topics),
|
|
27698
|
-
port: input.port,
|
|
27699
|
-
title: input.title,
|
|
27700
|
-
...input.capabilities === undefined ? {} : { capabilities: input.capabilities },
|
|
27701
|
-
driving: input.driving,
|
|
27702
|
-
...input.selfSubscribed === undefined ? {} : { self_subscribed: input.selfSubscribed },
|
|
27703
|
-
...input.delivery === undefined ? {} : { delivery: input.delivery },
|
|
27704
|
-
...input.clientInstanceID === undefined ? {} : { client_instance_id: input.clientInstanceID },
|
|
27705
|
-
host: machineID(),
|
|
27706
|
-
...input.place === undefined ? {} : { tmux_place: input.place },
|
|
27707
|
-
plugin: input.plugin.name,
|
|
27708
|
-
plugin_version: input.plugin.version
|
|
27709
|
-
}, { actingSession: input.sessionID }))),
|
|
27715
|
+
subscribe: async (input) => parseSubscribeAnswer(JSON.parse(await post("/v1/interests/subscribe", subscribeBody(input), { actingSession: input.sessionID }))),
|
|
27710
27716
|
unsubscribe: async (input) => {
|
|
27711
27717
|
await post("/v1/interests/unsubscribe", {
|
|
27712
27718
|
session_id: input.sessionID,
|
|
@@ -27765,7 +27771,6 @@ function createEnvoyClient(config) {
|
|
|
27765
27771
|
envelope: response,
|
|
27766
27772
|
...response.holder === undefined ? {} : { holder: response.holder },
|
|
27767
27773
|
...response.holder_state === undefined ? {} : { holderState: response.holder_state },
|
|
27768
|
-
unresponsive: response.unresponsive ?? [],
|
|
27769
27774
|
...response.kept === undefined ? {} : { kept: response.kept },
|
|
27770
27775
|
...response.kept_reason === undefined ? {} : { keptReason: response.kept_reason }
|
|
27771
27776
|
};
|
|
@@ -27814,16 +27819,7 @@ function createEnvoyClient(config) {
|
|
|
27814
27819
|
search.set("include", input.include);
|
|
27815
27820
|
const query = search.size === 0 ? "" : `?${search.toString()}`;
|
|
27816
27821
|
return SessionWireSchema.array().parse(JSON.parse(await request(`/v1/sessions${query}`, {})));
|
|
27817
|
-
}
|
|
27818
|
-
replay: async (input) => ReplayWireSchema.parse(JSON.parse(await post("/v1/replay", {
|
|
27819
|
-
session_id: input.sessionID,
|
|
27820
|
-
subjects: input.subjects.map((cursor) => cursor.after === undefined ? { subject: cursor.subject } : { subject: cursor.subject, after: cursor.after }),
|
|
27821
|
-
...input.maxMessages === undefined ? {} : { max_messages: input.maxMessages }
|
|
27822
|
-
}, {
|
|
27823
|
-
timeoutMs: input.timeoutMs ?? REPLAY_TIMEOUT_MS,
|
|
27824
|
-
retry: false,
|
|
27825
|
-
actingSession: input.sessionID
|
|
27826
|
-
})))
|
|
27822
|
+
}
|
|
27827
27823
|
};
|
|
27828
27824
|
}
|
|
27829
27825
|
function waitForRetry(delayMs) {
|