@sjawhar/pi-legion-envoy 0.20.2 → 0.21.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/dist/envoy.js +31 -17
- package/dist/legion.js +31 -17
- package/dist/skills/dispatch/SKILL.md +2 -2
- package/package.json +1 -1
package/dist/envoy.js
CHANGED
|
@@ -29930,6 +29930,10 @@ var handoffMessageSchema = object({
|
|
|
29930
29930
|
// ../contracts/src/subject.ts
|
|
29931
29931
|
var AGENT_TOPIC_PREFIX = "notifications.agent.";
|
|
29932
29932
|
var ROLE_TOPIC_PREFIX = "notifications.role.";
|
|
29933
|
+
var DISPATCH_ISSUE_TOPIC_PREFIX = "notifications.dispatch.issue.";
|
|
29934
|
+
function dispatchIssueSubject(issueKey, type) {
|
|
29935
|
+
return `${DISPATCH_ISSUE_TOPIC_PREFIX}${issueKey}.${type}`;
|
|
29936
|
+
}
|
|
29933
29937
|
function agentSubject(session) {
|
|
29934
29938
|
return `${AGENT_TOPIC_PREFIX}${session}`;
|
|
29935
29939
|
}
|
|
@@ -30838,7 +30842,10 @@ function parseDispatchFrame(rawPayload) {
|
|
|
30838
30842
|
return { raw: rawPayload };
|
|
30839
30843
|
}
|
|
30840
30844
|
const parsed = DispatchEventSchema.safeParse(value);
|
|
30841
|
-
|
|
30845
|
+
if (!parsed.success)
|
|
30846
|
+
return { raw: value };
|
|
30847
|
+
const wireEvent = value;
|
|
30848
|
+
return { event: parsed.data, notify: wireEvent.notify };
|
|
30842
30849
|
}
|
|
30843
30850
|
function inboundTimestamp(milliseconds) {
|
|
30844
30851
|
if (milliseconds === undefined)
|
|
@@ -30883,6 +30890,9 @@ function renderInbound(raw, sessionID, subject) {
|
|
|
30883
30890
|
} else {
|
|
30884
30891
|
const frame = parseDispatchFrame(envelope.payload);
|
|
30885
30892
|
if ("event" in frame) {
|
|
30893
|
+
if (frame.notify === false && (subject ?? envelope.topic)?.startsWith(DISPATCH_ISSUE_TOPIC_PREFIX) === true) {
|
|
30894
|
+
return { skip: true, content: "", envelope };
|
|
30895
|
+
}
|
|
30886
30896
|
if (frame.event.actor.kind === "session" && frame.event.actor.id === sessionID) {
|
|
30887
30897
|
return { skip: true, content: "", envelope };
|
|
30888
30898
|
}
|
|
@@ -31336,9 +31346,6 @@ class DispatchClient {
|
|
|
31336
31346
|
var nativeIssueKeyPattern = /^[A-Z][A-Z0-9]{1,9}-[0-9]+$/;
|
|
31337
31347
|
var externalIssueRefPattern = /^([^/\s]+)\/([^/\s#]+)#([1-9][0-9]*)$/;
|
|
31338
31348
|
var bareIssueNumberPattern = /^[1-9][0-9]*$/;
|
|
31339
|
-
function dispatchTopic(issue) {
|
|
31340
|
-
return `notifications.dispatch.issue.${issue}.>`;
|
|
31341
|
-
}
|
|
31342
31349
|
function stringArg(args, name) {
|
|
31343
31350
|
const value = args[name];
|
|
31344
31351
|
if (typeof value !== "string")
|
|
@@ -31561,7 +31568,7 @@ async function executeDispatchTool(input) {
|
|
|
31561
31568
|
});
|
|
31562
31569
|
return {
|
|
31563
31570
|
text: `Created ${created.key}: ${created.title}`,
|
|
31564
|
-
details: { issue: created.key, topic:
|
|
31571
|
+
details: { issue: created.key, topic: dispatchIssueSubject(created.key, ">") }
|
|
31565
31572
|
};
|
|
31566
31573
|
}
|
|
31567
31574
|
case "dispatch_ask": {
|
|
@@ -31581,7 +31588,11 @@ async function executeDispatchTool(input) {
|
|
|
31581
31588
|
});
|
|
31582
31589
|
return {
|
|
31583
31590
|
text: `Opened ask ${ask.id}: ${ask.question}`,
|
|
31584
|
-
details: {
|
|
31591
|
+
details: {
|
|
31592
|
+
issue: ask.issue_key,
|
|
31593
|
+
topic: dispatchIssueSubject(ask.issue_key, ">"),
|
|
31594
|
+
ask: ask.id
|
|
31595
|
+
}
|
|
31585
31596
|
};
|
|
31586
31597
|
}
|
|
31587
31598
|
case "dispatch_comment": {
|
|
@@ -31602,7 +31613,7 @@ async function executeDispatchTool(input) {
|
|
|
31602
31613
|
text: `Posted comment ${comment.id}`,
|
|
31603
31614
|
details: {
|
|
31604
31615
|
issue: comment.issue_key,
|
|
31605
|
-
topic:
|
|
31616
|
+
topic: dispatchIssueSubject(comment.issue_key, ">"),
|
|
31606
31617
|
comment: comment.id
|
|
31607
31618
|
}
|
|
31608
31619
|
};
|
|
@@ -31623,7 +31634,7 @@ async function executeDispatchTool(input) {
|
|
|
31623
31634
|
text: `Posted suggestion ${comment.id}`,
|
|
31624
31635
|
details: {
|
|
31625
31636
|
issue: comment.issue_key,
|
|
31626
|
-
topic:
|
|
31637
|
+
topic: dispatchIssueSubject(comment.issue_key, ">"),
|
|
31627
31638
|
comment: comment.id
|
|
31628
31639
|
}
|
|
31629
31640
|
};
|
|
@@ -31634,7 +31645,7 @@ async function executeDispatchTool(input) {
|
|
|
31634
31645
|
text: `Posted message ${message.id}`,
|
|
31635
31646
|
details: {
|
|
31636
31647
|
issue: message.issue_key,
|
|
31637
|
-
topic:
|
|
31648
|
+
topic: dispatchIssueSubject(message.issue_key, ">"),
|
|
31638
31649
|
message: message.id
|
|
31639
31650
|
}
|
|
31640
31651
|
};
|
|
@@ -31652,7 +31663,7 @@ async function executeDispatchTool(input) {
|
|
|
31652
31663
|
text: edited.version === null ? `Applied ${edited.applied} ops (no new version)` : `Applied ${edited.applied} ops (version ${edited.version.number})`,
|
|
31653
31664
|
details: {
|
|
31654
31665
|
issue: resolved.issue.key,
|
|
31655
|
-
topic:
|
|
31666
|
+
topic: dispatchIssueSubject(resolved.issue.key, ">"),
|
|
31656
31667
|
applied: edited.applied,
|
|
31657
31668
|
...edited.version === null ? {} : { version: edited.version.number }
|
|
31658
31669
|
}
|
|
@@ -31668,7 +31679,10 @@ async function executeDispatchTool(input) {
|
|
|
31668
31679
|
text: marks.length === 0 ? document.markdown : `${document.markdown}
|
|
31669
31680
|
|
|
31670
31681
|
Open anchored asks/comments: ${marks.join(", ")}`,
|
|
31671
|
-
details: {
|
|
31682
|
+
details: {
|
|
31683
|
+
issue: resolved.issue.key,
|
|
31684
|
+
topic: dispatchIssueSubject(resolved.issue.key, ">")
|
|
31685
|
+
}
|
|
31672
31686
|
};
|
|
31673
31687
|
}
|
|
31674
31688
|
case "dispatch_artifact": {
|
|
@@ -31693,7 +31707,7 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
31693
31707
|
text: `Uploaded ${result.artifact.name} as version ${result.version.number}`,
|
|
31694
31708
|
details: {
|
|
31695
31709
|
issue: result.artifact.issue_key,
|
|
31696
|
-
topic:
|
|
31710
|
+
topic: dispatchIssueSubject(result.artifact.issue_key, ">"),
|
|
31697
31711
|
artifact: result.artifact.id,
|
|
31698
31712
|
version: result.version.number
|
|
31699
31713
|
}
|
|
@@ -31704,7 +31718,7 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
31704
31718
|
const ask = await client.getAsk(issueArguments.ref.id);
|
|
31705
31719
|
return {
|
|
31706
31720
|
text: askSummary(ask),
|
|
31707
|
-
details: { issue: ask.issue_key, topic:
|
|
31721
|
+
details: { issue: ask.issue_key, topic: dispatchIssueSubject(ask.issue_key, ">") }
|
|
31708
31722
|
};
|
|
31709
31723
|
}
|
|
31710
31724
|
if (issueArguments.ref?.kind === "comment") {
|
|
@@ -31713,7 +31727,7 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
31713
31727
|
text: commentSummary(comment),
|
|
31714
31728
|
details: {
|
|
31715
31729
|
issue: comment.comment.issue_key,
|
|
31716
|
-
topic:
|
|
31730
|
+
topic: dispatchIssueSubject(comment.comment.issue_key, ">")
|
|
31717
31731
|
}
|
|
31718
31732
|
};
|
|
31719
31733
|
}
|
|
@@ -31721,18 +31735,18 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
31721
31735
|
if (issueArguments.ref?.kind === "log") {
|
|
31722
31736
|
return {
|
|
31723
31737
|
text: logSummary(read.issue, read.events),
|
|
31724
|
-
details: { issue: read.issue.key, topic:
|
|
31738
|
+
details: { issue: read.issue.key, topic: dispatchIssueSubject(read.issue.key, ">") }
|
|
31725
31739
|
};
|
|
31726
31740
|
}
|
|
31727
31741
|
if (issueArguments.ref?.kind === "children") {
|
|
31728
31742
|
return {
|
|
31729
31743
|
text: childrenSummary(read.issue),
|
|
31730
|
-
details: { issue: read.issue.key, topic:
|
|
31744
|
+
details: { issue: read.issue.key, topic: dispatchIssueSubject(read.issue.key, ">") }
|
|
31731
31745
|
};
|
|
31732
31746
|
}
|
|
31733
31747
|
return {
|
|
31734
31748
|
text: issueSummary(read.issue, read.events),
|
|
31735
|
-
details: { issue: read.issue.key, topic:
|
|
31749
|
+
details: { issue: read.issue.key, topic: dispatchIssueSubject(read.issue.key, ">") }
|
|
31736
31750
|
};
|
|
31737
31751
|
}
|
|
31738
31752
|
default:
|
package/dist/legion.js
CHANGED
|
@@ -29928,6 +29928,10 @@ var handoffMessageSchema = object({
|
|
|
29928
29928
|
// ../contracts/src/subject.ts
|
|
29929
29929
|
var AGENT_TOPIC_PREFIX = "notifications.agent.";
|
|
29930
29930
|
var ROLE_TOPIC_PREFIX = "notifications.role.";
|
|
29931
|
+
var DISPATCH_ISSUE_TOPIC_PREFIX = "notifications.dispatch.issue.";
|
|
29932
|
+
function dispatchIssueSubject(issueKey, type) {
|
|
29933
|
+
return `${DISPATCH_ISSUE_TOPIC_PREFIX}${issueKey}.${type}`;
|
|
29934
|
+
}
|
|
29931
29935
|
function agentSubject(session) {
|
|
29932
29936
|
return `${AGENT_TOPIC_PREFIX}${session}`;
|
|
29933
29937
|
}
|
|
@@ -31330,7 +31334,10 @@ function parseDispatchFrame(rawPayload) {
|
|
|
31330
31334
|
return { raw: rawPayload };
|
|
31331
31335
|
}
|
|
31332
31336
|
const parsed = DispatchEventSchema.safeParse(value);
|
|
31333
|
-
|
|
31337
|
+
if (!parsed.success)
|
|
31338
|
+
return { raw: value };
|
|
31339
|
+
const wireEvent = value;
|
|
31340
|
+
return { event: parsed.data, notify: wireEvent.notify };
|
|
31334
31341
|
}
|
|
31335
31342
|
function inboundTimestamp(milliseconds) {
|
|
31336
31343
|
if (milliseconds === undefined)
|
|
@@ -31375,6 +31382,9 @@ function renderInbound(raw, sessionID, subject) {
|
|
|
31375
31382
|
} else {
|
|
31376
31383
|
const frame = parseDispatchFrame(envelope.payload);
|
|
31377
31384
|
if ("event" in frame) {
|
|
31385
|
+
if (frame.notify === false && (subject ?? envelope.topic)?.startsWith(DISPATCH_ISSUE_TOPIC_PREFIX) === true) {
|
|
31386
|
+
return { skip: true, content: "", envelope };
|
|
31387
|
+
}
|
|
31378
31388
|
if (frame.event.actor.kind === "session" && frame.event.actor.id === sessionID) {
|
|
31379
31389
|
return { skip: true, content: "", envelope };
|
|
31380
31390
|
}
|
|
@@ -31821,9 +31831,6 @@ class DispatchClient {
|
|
|
31821
31831
|
var nativeIssueKeyPattern = /^[A-Z][A-Z0-9]{1,9}-[0-9]+$/;
|
|
31822
31832
|
var externalIssueRefPattern = /^([^/\s]+)\/([^/\s#]+)#([1-9][0-9]*)$/;
|
|
31823
31833
|
var bareIssueNumberPattern = /^[1-9][0-9]*$/;
|
|
31824
|
-
function dispatchTopic(issue) {
|
|
31825
|
-
return `notifications.dispatch.issue.${issue}.>`;
|
|
31826
|
-
}
|
|
31827
31834
|
function stringArg(args, name) {
|
|
31828
31835
|
const value = args[name];
|
|
31829
31836
|
if (typeof value !== "string")
|
|
@@ -32046,7 +32053,7 @@ async function executeDispatchTool(input) {
|
|
|
32046
32053
|
});
|
|
32047
32054
|
return {
|
|
32048
32055
|
text: `Created ${created.key}: ${created.title}`,
|
|
32049
|
-
details: { issue: created.key, topic:
|
|
32056
|
+
details: { issue: created.key, topic: dispatchIssueSubject(created.key, ">") }
|
|
32050
32057
|
};
|
|
32051
32058
|
}
|
|
32052
32059
|
case "dispatch_ask": {
|
|
@@ -32066,7 +32073,11 @@ async function executeDispatchTool(input) {
|
|
|
32066
32073
|
});
|
|
32067
32074
|
return {
|
|
32068
32075
|
text: `Opened ask ${ask.id}: ${ask.question}`,
|
|
32069
|
-
details: {
|
|
32076
|
+
details: {
|
|
32077
|
+
issue: ask.issue_key,
|
|
32078
|
+
topic: dispatchIssueSubject(ask.issue_key, ">"),
|
|
32079
|
+
ask: ask.id
|
|
32080
|
+
}
|
|
32070
32081
|
};
|
|
32071
32082
|
}
|
|
32072
32083
|
case "dispatch_comment": {
|
|
@@ -32087,7 +32098,7 @@ async function executeDispatchTool(input) {
|
|
|
32087
32098
|
text: `Posted comment ${comment.id}`,
|
|
32088
32099
|
details: {
|
|
32089
32100
|
issue: comment.issue_key,
|
|
32090
|
-
topic:
|
|
32101
|
+
topic: dispatchIssueSubject(comment.issue_key, ">"),
|
|
32091
32102
|
comment: comment.id
|
|
32092
32103
|
}
|
|
32093
32104
|
};
|
|
@@ -32108,7 +32119,7 @@ async function executeDispatchTool(input) {
|
|
|
32108
32119
|
text: `Posted suggestion ${comment.id}`,
|
|
32109
32120
|
details: {
|
|
32110
32121
|
issue: comment.issue_key,
|
|
32111
|
-
topic:
|
|
32122
|
+
topic: dispatchIssueSubject(comment.issue_key, ">"),
|
|
32112
32123
|
comment: comment.id
|
|
32113
32124
|
}
|
|
32114
32125
|
};
|
|
@@ -32119,7 +32130,7 @@ async function executeDispatchTool(input) {
|
|
|
32119
32130
|
text: `Posted message ${message.id}`,
|
|
32120
32131
|
details: {
|
|
32121
32132
|
issue: message.issue_key,
|
|
32122
|
-
topic:
|
|
32133
|
+
topic: dispatchIssueSubject(message.issue_key, ">"),
|
|
32123
32134
|
message: message.id
|
|
32124
32135
|
}
|
|
32125
32136
|
};
|
|
@@ -32137,7 +32148,7 @@ async function executeDispatchTool(input) {
|
|
|
32137
32148
|
text: edited.version === null ? `Applied ${edited.applied} ops (no new version)` : `Applied ${edited.applied} ops (version ${edited.version.number})`,
|
|
32138
32149
|
details: {
|
|
32139
32150
|
issue: resolved.issue.key,
|
|
32140
|
-
topic:
|
|
32151
|
+
topic: dispatchIssueSubject(resolved.issue.key, ">"),
|
|
32141
32152
|
applied: edited.applied,
|
|
32142
32153
|
...edited.version === null ? {} : { version: edited.version.number }
|
|
32143
32154
|
}
|
|
@@ -32153,7 +32164,10 @@ async function executeDispatchTool(input) {
|
|
|
32153
32164
|
text: marks.length === 0 ? document.markdown : `${document.markdown}
|
|
32154
32165
|
|
|
32155
32166
|
Open anchored asks/comments: ${marks.join(", ")}`,
|
|
32156
|
-
details: {
|
|
32167
|
+
details: {
|
|
32168
|
+
issue: resolved.issue.key,
|
|
32169
|
+
topic: dispatchIssueSubject(resolved.issue.key, ">")
|
|
32170
|
+
}
|
|
32157
32171
|
};
|
|
32158
32172
|
}
|
|
32159
32173
|
case "dispatch_artifact": {
|
|
@@ -32178,7 +32192,7 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
32178
32192
|
text: `Uploaded ${result.artifact.name} as version ${result.version.number}`,
|
|
32179
32193
|
details: {
|
|
32180
32194
|
issue: result.artifact.issue_key,
|
|
32181
|
-
topic:
|
|
32195
|
+
topic: dispatchIssueSubject(result.artifact.issue_key, ">"),
|
|
32182
32196
|
artifact: result.artifact.id,
|
|
32183
32197
|
version: result.version.number
|
|
32184
32198
|
}
|
|
@@ -32189,7 +32203,7 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
32189
32203
|
const ask = await client.getAsk(issueArguments.ref.id);
|
|
32190
32204
|
return {
|
|
32191
32205
|
text: askSummary(ask),
|
|
32192
|
-
details: { issue: ask.issue_key, topic:
|
|
32206
|
+
details: { issue: ask.issue_key, topic: dispatchIssueSubject(ask.issue_key, ">") }
|
|
32193
32207
|
};
|
|
32194
32208
|
}
|
|
32195
32209
|
if (issueArguments.ref?.kind === "comment") {
|
|
@@ -32198,7 +32212,7 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
32198
32212
|
text: commentSummary(comment),
|
|
32199
32213
|
details: {
|
|
32200
32214
|
issue: comment.comment.issue_key,
|
|
32201
|
-
topic:
|
|
32215
|
+
topic: dispatchIssueSubject(comment.comment.issue_key, ">")
|
|
32202
32216
|
}
|
|
32203
32217
|
};
|
|
32204
32218
|
}
|
|
@@ -32206,18 +32220,18 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
32206
32220
|
if (issueArguments.ref?.kind === "log") {
|
|
32207
32221
|
return {
|
|
32208
32222
|
text: logSummary(read.issue, read.events),
|
|
32209
|
-
details: { issue: read.issue.key, topic:
|
|
32223
|
+
details: { issue: read.issue.key, topic: dispatchIssueSubject(read.issue.key, ">") }
|
|
32210
32224
|
};
|
|
32211
32225
|
}
|
|
32212
32226
|
if (issueArguments.ref?.kind === "children") {
|
|
32213
32227
|
return {
|
|
32214
32228
|
text: childrenSummary(read.issue),
|
|
32215
|
-
details: { issue: read.issue.key, topic:
|
|
32229
|
+
details: { issue: read.issue.key, topic: dispatchIssueSubject(read.issue.key, ">") }
|
|
32216
32230
|
};
|
|
32217
32231
|
}
|
|
32218
32232
|
return {
|
|
32219
32233
|
text: issueSummary(read.issue, read.events),
|
|
32220
|
-
details: { issue: read.issue.key, topic:
|
|
32234
|
+
details: { issue: read.issue.key, topic: dispatchIssueSubject(read.issue.key, ">") }
|
|
32221
32235
|
};
|
|
32222
32236
|
}
|
|
32223
32237
|
default:
|
|
@@ -141,8 +141,8 @@ A write result's `details.topic` subscribes the host to the issue. Events render
|
|
|
141
141
|
dispatch <KEY> · <type> · by <actor>
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
The issue topic carries every Dispatch event; `notify` only controls agent wake and routed delivery.
|
|
145
|
+
After a restart, catch up with:
|
|
146
146
|
|
|
147
147
|
```ts
|
|
148
148
|
dispatch_read({ issue?, ref? })
|