@sjawhar/pi-legion-envoy 5.30.7 → 5.30.9
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 +23 -8
- package/dist/legion.js +16 -8
- package/package.json +1 -1
package/dist/envoy.js
CHANGED
|
@@ -29918,6 +29918,9 @@ function claimHolds(claim, titles) {
|
|
|
29918
29918
|
return titles.has(claim.actor.id) ? "holds" : "lapsed";
|
|
29919
29919
|
}
|
|
29920
29920
|
// ../contracts/src/dispatch-href.ts
|
|
29921
|
+
function hasControlCharacter(value) {
|
|
29922
|
+
return /\p{Cc}/u.test(value);
|
|
29923
|
+
}
|
|
29921
29924
|
function itemFromSearch(search) {
|
|
29922
29925
|
const params = new URLSearchParams(search);
|
|
29923
29926
|
const ask = params.get("ask");
|
|
@@ -29938,6 +29941,9 @@ function itemFromSearch(search) {
|
|
|
29938
29941
|
} catch {
|
|
29939
29942
|
return null;
|
|
29940
29943
|
}
|
|
29944
|
+
if (hasControlCharacter(id)) {
|
|
29945
|
+
return null;
|
|
29946
|
+
}
|
|
29941
29947
|
return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
|
|
29942
29948
|
}
|
|
29943
29949
|
// ../contracts/src/dispatch-snippet.ts
|
|
@@ -34081,17 +34087,19 @@ async function refuseRemovingOpenDecisionBlocks(client, tool, resolved, ops) {
|
|
|
34081
34087
|
].join(`
|
|
34082
34088
|
`));
|
|
34083
34089
|
}
|
|
34084
|
-
function refusalWithCode(error48,
|
|
34090
|
+
function refusalWithCode(error48, ...clauses) {
|
|
34091
|
+
const suffix = clauses.filter((clause) => clause !== "").join("; ");
|
|
34092
|
+
const joined = suffix === "" ? "" : `; ${suffix}`;
|
|
34085
34093
|
if (error48 instanceof DispatchGatewayError) {
|
|
34086
34094
|
let told = error48.message;
|
|
34087
|
-
if (
|
|
34088
|
-
told = error48.mayHaveReachedDispatch ? `${error48.answer}${
|
|
34095
|
+
if (joined !== "") {
|
|
34096
|
+
told = error48.mayHaveReachedDispatch ? `${error48.answer}${joined}` : `${error48.answer}, so ${error48.advice}${joined}`;
|
|
34089
34097
|
}
|
|
34090
34098
|
return new DispatchGatewayError(error48.status, error48.answer, error48.advice, `${error48.code}: ${told}`);
|
|
34091
34099
|
}
|
|
34092
34100
|
if (!(error48 instanceof DispatchServiceError))
|
|
34093
34101
|
return error48;
|
|
34094
|
-
return new DispatchServiceError(error48.code, error48.status, `${error48.code}: ${error48.message}${
|
|
34102
|
+
return new DispatchServiceError(error48.code, error48.status, `${error48.code}: ${error48.message}${joined}`, error48.candidates, error48.current, error48.mismatches);
|
|
34095
34103
|
}
|
|
34096
34104
|
function dispatchAnswered(error48, status) {
|
|
34097
34105
|
return error48 instanceof DispatchServiceError && error48.fromDispatch && error48.status === status;
|
|
@@ -34277,7 +34285,7 @@ async function executeDispatchTool(input) {
|
|
|
34277
34285
|
} catch (error48) {
|
|
34278
34286
|
const told = writeMayHaveLanded(error48) ? "the reason may or may not have been posted, and the close was not sent: read the issue's messages before retrying, since retrying this call posts its reason again" : "the reason was not posted, so the close was not sent";
|
|
34279
34287
|
if (error48 instanceof DispatchServiceError)
|
|
34280
|
-
throw refusalWithCode(error48,
|
|
34288
|
+
throw refusalWithCode(error48, told);
|
|
34281
34289
|
throw withAccount(error48, told);
|
|
34282
34290
|
}
|
|
34283
34291
|
}
|
|
@@ -34297,14 +34305,14 @@ async function executeDispatchTool(input) {
|
|
|
34297
34305
|
actor
|
|
34298
34306
|
});
|
|
34299
34307
|
} catch (error48) {
|
|
34300
|
-
const taken = dispatchAnswered(error48, 500) && newLinks.length > 0 ?
|
|
34308
|
+
const taken = dispatchAnswered(error48, 500) && newLinks.length > 0 ? `one of ${newLinks.join(", ")} may already be linked from another issue (a URL links exactly one issue)` : "";
|
|
34301
34309
|
if (closingNote === undefined)
|
|
34302
34310
|
throw refusalWithCode(error48, taken);
|
|
34303
34311
|
const posted = `the reason already landed as message ${closingNote.id} (${closingNote.ref})`;
|
|
34304
34312
|
const fix = error48 instanceof DispatchGatewayError && error48.transient ? "" : "fix what refused the close, then ";
|
|
34305
34313
|
const landed = writeMayHaveLanded(error48) ? `${posted}, and the close may or may not have taken effect. Read the issue's status before retrying: done means it closed; otherwise retry with a reason that points at message ${closingNote.id}, since retrying this call posts its reason again` : `${posted} but the issue did not close. Retrying this call posts its reason again, so ${fix}retry with a reason that points at message ${closingNote.id}`;
|
|
34306
34314
|
if (error48 instanceof DispatchServiceError)
|
|
34307
|
-
throw refusalWithCode(error48,
|
|
34315
|
+
throw refusalWithCode(error48, taken, landed);
|
|
34308
34316
|
throw withAccount(error48, landed);
|
|
34309
34317
|
}
|
|
34310
34318
|
const linkCount = `(${after.external_links.length} ${after.external_links.length === 1 ? "link" : "links"})`;
|
|
@@ -35997,6 +36005,12 @@ async function copySessionID(copyToClipboard2, sessionID) {
|
|
|
35997
36005
|
var codec2 = import_nats2.StringCodec();
|
|
35998
36006
|
var NATS_RETRY_INTERVAL_MS = 15000;
|
|
35999
36007
|
var CAPABILITIES_WITHOUT_BTW = DELIVERY_CAPABILITIES.filter((capability) => capability !== "btw");
|
|
36008
|
+
var ClaimIdentitySchema = DedupeIdentitySchema.extend({
|
|
36009
|
+
event_id: DedupeIdentitySchema.shape.event_id.catch(undefined),
|
|
36010
|
+
dedupe_key: DedupeIdentitySchema.shape.dedupe_key.catch(undefined),
|
|
36011
|
+
source: DedupeIdentitySchema.shape.source.catch(undefined),
|
|
36012
|
+
source_event_id: DedupeIdentitySchema.shape.source_event_id.catch(undefined)
|
|
36013
|
+
});
|
|
36000
36014
|
var ROLE_CLAIM_ENTRY = "envoy-role-claim";
|
|
36001
36015
|
var OPEN_ASKS_TIMEOUT_MS = 3000;
|
|
36002
36016
|
var USER_TURN_ACCEPT_TIMEOUT_MS = 1e4;
|
|
@@ -36252,7 +36266,8 @@ function envoyExtension(pi) {
|
|
|
36252
36266
|
}
|
|
36253
36267
|
for (const topic of subscriptionRemovedTopics(raw, sessionID) ?? [])
|
|
36254
36268
|
closeIntentionally(topic);
|
|
36255
|
-
const
|
|
36269
|
+
const dedupeIdentity = ClaimIdentitySchema.safeParse(rendered.envelope);
|
|
36270
|
+
const claim2 = rendered.skip ? undefined : delivered.claim(dedupeIdentity.success ? dedupeIdentity.data : undefined);
|
|
36256
36271
|
if (claim2 !== undefined) {
|
|
36257
36272
|
const envelope2 = rendered.envelope;
|
|
36258
36273
|
if (envelope2 !== undefined) {
|
package/dist/legion.js
CHANGED
|
@@ -30087,6 +30087,9 @@ function claimHolds(claim, titles) {
|
|
|
30087
30087
|
return titles.has(claim.actor.id) ? "holds" : "lapsed";
|
|
30088
30088
|
}
|
|
30089
30089
|
// ../contracts/src/dispatch-href.ts
|
|
30090
|
+
function hasControlCharacter(value) {
|
|
30091
|
+
return /\p{Cc}/u.test(value);
|
|
30092
|
+
}
|
|
30090
30093
|
function itemFromSearch(search) {
|
|
30091
30094
|
const params = new URLSearchParams(search);
|
|
30092
30095
|
const ask = params.get("ask");
|
|
@@ -30107,6 +30110,9 @@ function itemFromSearch(search) {
|
|
|
30107
30110
|
} catch {
|
|
30108
30111
|
return null;
|
|
30109
30112
|
}
|
|
30113
|
+
if (hasControlCharacter(id)) {
|
|
30114
|
+
return null;
|
|
30115
|
+
}
|
|
30110
30116
|
return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
|
|
30111
30117
|
}
|
|
30112
30118
|
// ../contracts/src/dispatch-snippet.ts
|
|
@@ -32949,17 +32955,19 @@ async function refuseRemovingOpenDecisionBlocks(client, tool, resolved, ops) {
|
|
|
32949
32955
|
].join(`
|
|
32950
32956
|
`));
|
|
32951
32957
|
}
|
|
32952
|
-
function refusalWithCode(error48,
|
|
32958
|
+
function refusalWithCode(error48, ...clauses) {
|
|
32959
|
+
const suffix = clauses.filter((clause) => clause !== "").join("; ");
|
|
32960
|
+
const joined = suffix === "" ? "" : `; ${suffix}`;
|
|
32953
32961
|
if (error48 instanceof DispatchGatewayError) {
|
|
32954
32962
|
let told = error48.message;
|
|
32955
|
-
if (
|
|
32956
|
-
told = error48.mayHaveReachedDispatch ? `${error48.answer}${
|
|
32963
|
+
if (joined !== "") {
|
|
32964
|
+
told = error48.mayHaveReachedDispatch ? `${error48.answer}${joined}` : `${error48.answer}, so ${error48.advice}${joined}`;
|
|
32957
32965
|
}
|
|
32958
32966
|
return new DispatchGatewayError(error48.status, error48.answer, error48.advice, `${error48.code}: ${told}`);
|
|
32959
32967
|
}
|
|
32960
32968
|
if (!(error48 instanceof DispatchServiceError))
|
|
32961
32969
|
return error48;
|
|
32962
|
-
return new DispatchServiceError(error48.code, error48.status, `${error48.code}: ${error48.message}${
|
|
32970
|
+
return new DispatchServiceError(error48.code, error48.status, `${error48.code}: ${error48.message}${joined}`, error48.candidates, error48.current, error48.mismatches);
|
|
32963
32971
|
}
|
|
32964
32972
|
function dispatchAnswered(error48, status) {
|
|
32965
32973
|
return error48 instanceof DispatchServiceError && error48.fromDispatch && error48.status === status;
|
|
@@ -33145,7 +33153,7 @@ async function executeDispatchTool(input) {
|
|
|
33145
33153
|
} catch (error48) {
|
|
33146
33154
|
const told = writeMayHaveLanded(error48) ? "the reason may or may not have been posted, and the close was not sent: read the issue's messages before retrying, since retrying this call posts its reason again" : "the reason was not posted, so the close was not sent";
|
|
33147
33155
|
if (error48 instanceof DispatchServiceError)
|
|
33148
|
-
throw refusalWithCode(error48,
|
|
33156
|
+
throw refusalWithCode(error48, told);
|
|
33149
33157
|
throw withAccount(error48, told);
|
|
33150
33158
|
}
|
|
33151
33159
|
}
|
|
@@ -33165,14 +33173,14 @@ async function executeDispatchTool(input) {
|
|
|
33165
33173
|
actor
|
|
33166
33174
|
});
|
|
33167
33175
|
} catch (error48) {
|
|
33168
|
-
const taken = dispatchAnswered(error48, 500) && newLinks.length > 0 ?
|
|
33176
|
+
const taken = dispatchAnswered(error48, 500) && newLinks.length > 0 ? `one of ${newLinks.join(", ")} may already be linked from another issue (a URL links exactly one issue)` : "";
|
|
33169
33177
|
if (closingNote === undefined)
|
|
33170
33178
|
throw refusalWithCode(error48, taken);
|
|
33171
33179
|
const posted = `the reason already landed as message ${closingNote.id} (${closingNote.ref})`;
|
|
33172
33180
|
const fix = error48 instanceof DispatchGatewayError && error48.transient ? "" : "fix what refused the close, then ";
|
|
33173
33181
|
const landed = writeMayHaveLanded(error48) ? `${posted}, and the close may or may not have taken effect. Read the issue's status before retrying: done means it closed; otherwise retry with a reason that points at message ${closingNote.id}, since retrying this call posts its reason again` : `${posted} but the issue did not close. Retrying this call posts its reason again, so ${fix}retry with a reason that points at message ${closingNote.id}`;
|
|
33174
33182
|
if (error48 instanceof DispatchServiceError)
|
|
33175
|
-
throw refusalWithCode(error48,
|
|
33183
|
+
throw refusalWithCode(error48, taken, landed);
|
|
33176
33184
|
throw withAccount(error48, landed);
|
|
33177
33185
|
}
|
|
33178
33186
|
const linkCount = `(${after.external_links.length} ${after.external_links.length === 1 ? "link" : "links"})`;
|
|
@@ -33826,7 +33834,7 @@ import { logger } from "@oh-my-pi/pi-utils";
|
|
|
33826
33834
|
// package.json
|
|
33827
33835
|
var package_default = {
|
|
33828
33836
|
name: "@sjawhar/pi-legion-envoy",
|
|
33829
|
-
version: "5.30.
|
|
33837
|
+
version: "5.30.9",
|
|
33830
33838
|
type: "module",
|
|
33831
33839
|
omp: {
|
|
33832
33840
|
extensions: [
|