@sjawhar/pi-envoy 14.1.0 → 14.2.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/dispatch.js +248 -90
- package/dist/envoy.js +185 -38
- package/package.json +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -14861,93 +14861,6 @@ function itemFromSearch(search) {
|
|
|
14861
14861
|
return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
|
|
14862
14862
|
}
|
|
14863
14863
|
|
|
14864
|
-
// ../contracts/src/dispatch-block-ref.ts
|
|
14865
|
-
var encoder = new TextEncoder;
|
|
14866
|
-
function encodeBlockId(id) {
|
|
14867
|
-
let encoded = "";
|
|
14868
|
-
for (const character of id) {
|
|
14869
|
-
for (const byte of encoder.encode(character)) {
|
|
14870
|
-
const bare = byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte >= 97 && byte <= 122 || byte === 45;
|
|
14871
|
-
encoded += bare ? String.fromCharCode(byte) : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
14872
|
-
}
|
|
14873
|
-
}
|
|
14874
|
-
return encoded;
|
|
14875
|
-
}
|
|
14876
|
-
function decodeBlockId(encoded) {
|
|
14877
|
-
if (encoded === "" || encoded.includes("@")) {
|
|
14878
|
-
return;
|
|
14879
|
-
}
|
|
14880
|
-
let id;
|
|
14881
|
-
try {
|
|
14882
|
-
id = decodeURIComponent(encoded);
|
|
14883
|
-
} catch {
|
|
14884
|
-
return;
|
|
14885
|
-
}
|
|
14886
|
-
return id === "" || hasControlCharacter(id) ? undefined : id;
|
|
14887
|
-
}
|
|
14888
|
-
var MAX_BLOCK_PIN = 9223372036854775807n;
|
|
14889
|
-
function parseBlockFragment(encoded) {
|
|
14890
|
-
const at = encoded.indexOf("@");
|
|
14891
|
-
const pin = at === -1 ? undefined : encoded.slice(at + 1).match(/^v([1-9][0-9]*)$/)?.[1];
|
|
14892
|
-
if (at !== -1 && (pin === undefined || BigInt(pin) > MAX_BLOCK_PIN)) {
|
|
14893
|
-
return;
|
|
14894
|
-
}
|
|
14895
|
-
const block = decodeBlockId(at === -1 ? encoded : encoded.slice(0, at));
|
|
14896
|
-
if (block === undefined) {
|
|
14897
|
-
return;
|
|
14898
|
-
}
|
|
14899
|
-
return pin === undefined ? { block } : { block, pin };
|
|
14900
|
-
}
|
|
14901
|
-
// ../contracts/src/dispatch-snippet.ts
|
|
14902
|
-
var HTML_ENTITIES = [
|
|
14903
|
-
["<", "<"],
|
|
14904
|
-
[">", ">"],
|
|
14905
|
-
["'", "'"],
|
|
14906
|
-
[""", '"'],
|
|
14907
|
-
["&", "&"]
|
|
14908
|
-
];
|
|
14909
|
-
function decodeEntities(text) {
|
|
14910
|
-
let decoded = text;
|
|
14911
|
-
for (const [entity, character] of HTML_ENTITIES) {
|
|
14912
|
-
decoded = decoded.replaceAll(entity, character);
|
|
14913
|
-
}
|
|
14914
|
-
return decoded;
|
|
14915
|
-
}
|
|
14916
|
-
function hasOnlyBalancedMarkers(snippet) {
|
|
14917
|
-
let marked = false;
|
|
14918
|
-
for (const marker of snippet.matchAll(/<mark>|<\/mark>/gu)) {
|
|
14919
|
-
if (marker[0] === "<mark>") {
|
|
14920
|
-
if (marked)
|
|
14921
|
-
return false;
|
|
14922
|
-
marked = true;
|
|
14923
|
-
} else {
|
|
14924
|
-
if (!marked)
|
|
14925
|
-
return false;
|
|
14926
|
-
marked = false;
|
|
14927
|
-
}
|
|
14928
|
-
}
|
|
14929
|
-
return !marked;
|
|
14930
|
-
}
|
|
14931
|
-
function snippetSegments(snippet) {
|
|
14932
|
-
if (!hasOnlyBalancedMarkers(snippet)) {
|
|
14933
|
-
return snippet === "" ? [] : [{ text: decodeEntities(snippet), mark: false }];
|
|
14934
|
-
}
|
|
14935
|
-
let mark = false;
|
|
14936
|
-
const segments = [];
|
|
14937
|
-
for (const part of snippet.split(/(<mark>|<\/mark>)/u)) {
|
|
14938
|
-
if (part === "<mark>") {
|
|
14939
|
-
mark = true;
|
|
14940
|
-
} else if (part === "</mark>") {
|
|
14941
|
-
mark = false;
|
|
14942
|
-
} else if (part !== "") {
|
|
14943
|
-
segments.push({ text: decodeEntities(part), mark });
|
|
14944
|
-
}
|
|
14945
|
-
}
|
|
14946
|
-
return segments;
|
|
14947
|
-
}
|
|
14948
|
-
function snippetText(snippet) {
|
|
14949
|
-
return snippetSegments(snippet).map(({ text, mark }) => mark ? `**${text}**` : text).join("");
|
|
14950
|
-
}
|
|
14951
14864
|
// ../contracts/src/dispatch-text-rules.ts
|
|
14952
14865
|
var SESSION_ID_PATTERN = "[^/?#\\s\\p{Z}\\p{Cc}<>\"'`\\[\\]|]+";
|
|
14953
14866
|
var sessionIdOnly = new RegExp(`^${SESSION_ID_PATTERN}$`, "u");
|
|
@@ -14963,6 +14876,7 @@ var PICTURE_TYPES = {
|
|
|
14963
14876
|
function isPictureType(mime) {
|
|
14964
14877
|
return PICTURE_TYPES[mime] === true;
|
|
14965
14878
|
}
|
|
14879
|
+
|
|
14966
14880
|
// ../contracts/src/dispatch-tools.ts
|
|
14967
14881
|
function dispatchToolSchema(spec, z, opts) {
|
|
14968
14882
|
const shape = spec.arguments(z);
|
|
@@ -15524,6 +15438,249 @@ var dispatchToolSpecs = [
|
|
|
15524
15438
|
strict: true
|
|
15525
15439
|
}
|
|
15526
15440
|
];
|
|
15441
|
+
|
|
15442
|
+
// ../contracts/src/dispatch-block-ref.ts
|
|
15443
|
+
var encoder = new TextEncoder;
|
|
15444
|
+
function encodeBlockId(id) {
|
|
15445
|
+
let encoded = "";
|
|
15446
|
+
for (const character of id) {
|
|
15447
|
+
for (const byte of encoder.encode(character)) {
|
|
15448
|
+
const bare = byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte >= 97 && byte <= 122 || byte === 45;
|
|
15449
|
+
encoded += bare ? String.fromCharCode(byte) : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
15450
|
+
}
|
|
15451
|
+
}
|
|
15452
|
+
return encoded;
|
|
15453
|
+
}
|
|
15454
|
+
var MAX_BLOCK_ID_BYTES = 256;
|
|
15455
|
+
function decodeBlockId(encoded) {
|
|
15456
|
+
if (encoded === "" || encoded.includes("@")) {
|
|
15457
|
+
return;
|
|
15458
|
+
}
|
|
15459
|
+
let id;
|
|
15460
|
+
try {
|
|
15461
|
+
id = decodeURIComponent(encoded);
|
|
15462
|
+
} catch {
|
|
15463
|
+
return;
|
|
15464
|
+
}
|
|
15465
|
+
return id === "" || hasControlCharacter(id) ? undefined : id;
|
|
15466
|
+
}
|
|
15467
|
+
var MAX_BLOCK_PIN = 9223372036854775807n;
|
|
15468
|
+
function parseBlockFragment(encoded) {
|
|
15469
|
+
const at = encoded.indexOf("@");
|
|
15470
|
+
const pin = at === -1 ? undefined : encoded.slice(at + 1).match(/^v([1-9][0-9]*)$/)?.[1];
|
|
15471
|
+
if (at !== -1 && (pin === undefined || BigInt(pin) > MAX_BLOCK_PIN)) {
|
|
15472
|
+
return;
|
|
15473
|
+
}
|
|
15474
|
+
const block = decodeBlockId(at === -1 ? encoded : encoded.slice(0, at));
|
|
15475
|
+
if (block === undefined) {
|
|
15476
|
+
return;
|
|
15477
|
+
}
|
|
15478
|
+
return pin === undefined ? { block } : { block, pin };
|
|
15479
|
+
}
|
|
15480
|
+
var PROJECT_KEY = PROJECT_KEY_PATTERN.source.slice(1, -1);
|
|
15481
|
+
var ISSUE_KEY = `${PROJECT_KEY}-[1-9][0-9]*`;
|
|
15482
|
+
var DOCUMENT_SLUG = "[a-z0-9]+(?:-[a-z0-9]+)*";
|
|
15483
|
+
var ISSUE_KEY_ONLY = new RegExp(`^${ISSUE_KEY}$`);
|
|
15484
|
+
var BLOCK_REFERENCE = new RegExp(`^dispatch://(?:(${ISSUE_KEY})/spec|(${ISSUE_KEY}|${PROJECT_KEY})/artifact/(${DOCUMENT_SLUG}))#b-(.*)$`, "s");
|
|
15485
|
+
var ITEM_BLOCK_REFERENCE = new RegExp(`^dispatch://(?:${ISSUE_KEY}/(comment|message)|${PROJECT_KEY}/artifact/${DOCUMENT_SLUG}/(comment))/([^/?#]+)#b-(.*)$`, "s");
|
|
15486
|
+
var atIdBound = `dispatch://CORE-1/spec#b-${"x".repeat(MAX_BLOCK_ID_BYTES)}`;
|
|
15487
|
+
var DISPATCH_BLOCK_POINTER_VALUES = [
|
|
15488
|
+
{
|
|
15489
|
+
value: "dispatch://CORE-1/spec#b-x",
|
|
15490
|
+
ok: true,
|
|
15491
|
+
why: "a block of an issue's primary document"
|
|
15492
|
+
},
|
|
15493
|
+
{
|
|
15494
|
+
value: "dispatch://CORE-1/artifact/notes-md#b-x",
|
|
15495
|
+
ok: true,
|
|
15496
|
+
why: "a block of an issue's document"
|
|
15497
|
+
},
|
|
15498
|
+
{
|
|
15499
|
+
value: "dispatch://CORE/artifact/handbook-md#b-x",
|
|
15500
|
+
ok: true,
|
|
15501
|
+
why: "a block of a project's document"
|
|
15502
|
+
},
|
|
15503
|
+
{
|
|
15504
|
+
value: "dispatch://CORE/artifact/spec#b-x",
|
|
15505
|
+
ok: true,
|
|
15506
|
+
why: "a project's document whose slug is spec"
|
|
15507
|
+
},
|
|
15508
|
+
{ value: "dispatch://CORE-1/spec#b-d%C3%A9cision%3A1", ok: true, why: "a Unicode id" },
|
|
15509
|
+
{ value: "dispatch://CORE-1/spec#b-x@v2", ok: true, why: "a pinned block" },
|
|
15510
|
+
{ value: "dispatch://CORE-1/spec#b-x@v9223372036854775807", ok: true, why: "the largest pin" },
|
|
15511
|
+
{
|
|
15512
|
+
value: "dispatch://CORE-1/spec#b-x dispatch://CORE/artifact/handbook-md#b-y",
|
|
15513
|
+
ok: true,
|
|
15514
|
+
why: "two references separated by one space"
|
|
15515
|
+
},
|
|
15516
|
+
{ value: "", ok: true, why: "no pointers" },
|
|
15517
|
+
{ value: atIdBound, ok: true, why: "an id of exactly 256 bytes" },
|
|
15518
|
+
{
|
|
15519
|
+
value: "dispatch://CORE-1/artifact/spec#b-x",
|
|
15520
|
+
ok: false,
|
|
15521
|
+
why: "an issue's primary document is written /spec"
|
|
15522
|
+
},
|
|
15523
|
+
{ value: "dispatch://CORE-1/spec", ok: false, why: "a document, not a block" },
|
|
15524
|
+
{
|
|
15525
|
+
value: "dispatch://agent/s1/artifact/x#b-y",
|
|
15526
|
+
ok: false,
|
|
15527
|
+
why: "an agent's document has no blocks to point at"
|
|
15528
|
+
},
|
|
15529
|
+
{ value: "dispatch://CORE-1/spec#b-d%c3%a9", ok: false, why: "lower-case hex" },
|
|
15530
|
+
{ value: "dispatch://CORE-1/spec#b-%41", ok: false, why: "an over-encoded ASCII letter" },
|
|
15531
|
+
{ value: "dispatch://CORE-1/spec#b-x%2Dy", ok: false, why: "an over-encoded -" },
|
|
15532
|
+
{ value: "dispatch://CORE-1/spec#b-%FF", ok: false, why: "invalid UTF-8" },
|
|
15533
|
+
{ value: "dispatch://CORE-1/spec#b-%0A", ok: false, why: "a control character" },
|
|
15534
|
+
{ value: "dispatch://CORE-1/spec#x", ok: false, why: "a fragment that is not b-" },
|
|
15535
|
+
{ value: "dispatch://CORE-1/spec#c-x", ok: false, why: "a fragment that is not b-" },
|
|
15536
|
+
{ value: "dispatch://CORE-1/spec#b-", ok: false, why: "an empty id" },
|
|
15537
|
+
{ value: `${atIdBound}x`, ok: false, why: "an id over 256 bytes" },
|
|
15538
|
+
{ value: "dispatch://CORE-1/artifact/notes-md@v2#b-x", ok: false, why: "a versioned document" },
|
|
15539
|
+
{ value: "dispatch://CORE-1#b-x", ok: false, why: "an issue names no document" },
|
|
15540
|
+
{
|
|
15541
|
+
value: "dispatch://CORE-1/spec#b-x@v9223372036854775808",
|
|
15542
|
+
ok: false,
|
|
15543
|
+
why: "a pin past the largest"
|
|
15544
|
+
},
|
|
15545
|
+
{ value: "dispatch://CORE-1/spec#b-x@v01", ok: false, why: "a pin with a leading zero" },
|
|
15546
|
+
{ value: "dispatch://CORE-1/spec#b-x@v0", ok: false, why: "a pin of zero" },
|
|
15547
|
+
{
|
|
15548
|
+
value: "https://dispatch.example/issues/CORE-1/spec#b-x",
|
|
15549
|
+
ok: false,
|
|
15550
|
+
why: "a dashboard URL of a block"
|
|
15551
|
+
},
|
|
15552
|
+
{ value: "dispatch://CORE-1/spec#b-x.", ok: false, why: "trailing punctuation" },
|
|
15553
|
+
{ value: "dispatch://CORE-1/spec#b-x)", ok: false, why: "a trailing parenthesis" },
|
|
15554
|
+
{
|
|
15555
|
+
value: "dispatch://CORE-1/spec#b-x,dispatch://CORE-1/spec#b-y",
|
|
15556
|
+
ok: false,
|
|
15557
|
+
why: "references joined by a comma"
|
|
15558
|
+
},
|
|
15559
|
+
{
|
|
15560
|
+
value: "dispatch://CORE-1/spec#b-x dispatch://CORE-1/spec#b-x",
|
|
15561
|
+
ok: false,
|
|
15562
|
+
why: "a repeated reference"
|
|
15563
|
+
},
|
|
15564
|
+
{
|
|
15565
|
+
value: "dispatch://CORE-1/spec#b-x dispatch://CORE-1/spec#b-y",
|
|
15566
|
+
ok: false,
|
|
15567
|
+
why: "a doubled space"
|
|
15568
|
+
},
|
|
15569
|
+
{ value: " dispatch://CORE-1/spec#b-x", ok: false, why: "a leading space" },
|
|
15570
|
+
{ value: "dispatch://CORE-1/spec#b-x ", ok: false, why: "a trailing space" },
|
|
15571
|
+
{
|
|
15572
|
+
value: "dispatch://CORE-1/spec#b-x\tdispatch://CORE-1/spec#b-y",
|
|
15573
|
+
ok: false,
|
|
15574
|
+
why: "a tab between references"
|
|
15575
|
+
},
|
|
15576
|
+
{
|
|
15577
|
+
value: "dispatch://CORE-1/spec#b-x\uFEFFdispatch://CORE-1/spec#b-y",
|
|
15578
|
+
ok: false,
|
|
15579
|
+
why: "U+FEFF between references"
|
|
15580
|
+
},
|
|
15581
|
+
{
|
|
15582
|
+
value: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111#b-b2",
|
|
15583
|
+
ok: false,
|
|
15584
|
+
why: "a block of an issue's comment",
|
|
15585
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
15586
|
+
},
|
|
15587
|
+
{
|
|
15588
|
+
value: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111#b-b2@v1",
|
|
15589
|
+
ok: false,
|
|
15590
|
+
why: "a block of a revision of an issue's comment",
|
|
15591
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
15592
|
+
},
|
|
15593
|
+
{
|
|
15594
|
+
value: "dispatch://CORE/artifact/handbook-md/comment/88888888-8888-4888-8888-888888888888#b-b2",
|
|
15595
|
+
ok: false,
|
|
15596
|
+
why: "a block of a project document's comment",
|
|
15597
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
15598
|
+
},
|
|
15599
|
+
{
|
|
15600
|
+
value: "dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333#b-b2",
|
|
15601
|
+
ok: false,
|
|
15602
|
+
why: "a block of an issue message",
|
|
15603
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
15604
|
+
},
|
|
15605
|
+
{
|
|
15606
|
+
value: "dispatch://CORE-1/artifact/notes-md/comment/c1#b-x",
|
|
15607
|
+
ok: false,
|
|
15608
|
+
why: "an issue document's comment, a shape no reference has",
|
|
15609
|
+
problem: "is not a block reference as Dispatch writes one"
|
|
15610
|
+
},
|
|
15611
|
+
{
|
|
15612
|
+
value: "dispatch://CORE-1/comment/%ZZ#b-x",
|
|
15613
|
+
ok: false,
|
|
15614
|
+
why: "a comment id that does not decode",
|
|
15615
|
+
problem: "is not a block reference as Dispatch writes one"
|
|
15616
|
+
},
|
|
15617
|
+
{
|
|
15618
|
+
value: "dispatch://CORE-1/spec#b-x dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333#b-b2",
|
|
15619
|
+
ok: false,
|
|
15620
|
+
why: "a document's block, then an issue message's",
|
|
15621
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
15622
|
+
}
|
|
15623
|
+
];
|
|
15624
|
+
var TYPED_BLOCK_ID_SHORTCUT_EXCLUDED = `
|
|
15625
|
+
\r "#&'.<=>\`}`;
|
|
15626
|
+
function typedBlockIdAttribute(id) {
|
|
15627
|
+
if (id !== "" && ![...TYPED_BLOCK_ID_SHORTCUT_EXCLUDED].some((stop) => id.includes(stop))) {
|
|
15628
|
+
return `#${id}`;
|
|
15629
|
+
}
|
|
15630
|
+
const value = id.replaceAll("&", "&").replaceAll('"', """).replaceAll(`
|
|
15631
|
+
`, "
").replaceAll("\r", "
");
|
|
15632
|
+
return `id="${value}"`;
|
|
15633
|
+
}
|
|
15634
|
+
// ../contracts/src/dispatch-snippet.ts
|
|
15635
|
+
var HTML_ENTITIES = [
|
|
15636
|
+
["<", "<"],
|
|
15637
|
+
[">", ">"],
|
|
15638
|
+
["'", "'"],
|
|
15639
|
+
[""", '"'],
|
|
15640
|
+
["&", "&"]
|
|
15641
|
+
];
|
|
15642
|
+
function decodeEntities(text) {
|
|
15643
|
+
let decoded = text;
|
|
15644
|
+
for (const [entity, character] of HTML_ENTITIES) {
|
|
15645
|
+
decoded = decoded.replaceAll(entity, character);
|
|
15646
|
+
}
|
|
15647
|
+
return decoded;
|
|
15648
|
+
}
|
|
15649
|
+
function hasOnlyBalancedMarkers(snippet) {
|
|
15650
|
+
let marked = false;
|
|
15651
|
+
for (const marker of snippet.matchAll(/<mark>|<\/mark>/gu)) {
|
|
15652
|
+
if (marker[0] === "<mark>") {
|
|
15653
|
+
if (marked)
|
|
15654
|
+
return false;
|
|
15655
|
+
marked = true;
|
|
15656
|
+
} else {
|
|
15657
|
+
if (!marked)
|
|
15658
|
+
return false;
|
|
15659
|
+
marked = false;
|
|
15660
|
+
}
|
|
15661
|
+
}
|
|
15662
|
+
return !marked;
|
|
15663
|
+
}
|
|
15664
|
+
function snippetSegments(snippet) {
|
|
15665
|
+
if (!hasOnlyBalancedMarkers(snippet)) {
|
|
15666
|
+
return snippet === "" ? [] : [{ text: decodeEntities(snippet), mark: false }];
|
|
15667
|
+
}
|
|
15668
|
+
let mark = false;
|
|
15669
|
+
const segments = [];
|
|
15670
|
+
for (const part of snippet.split(/(<mark>|<\/mark>)/u)) {
|
|
15671
|
+
if (part === "<mark>") {
|
|
15672
|
+
mark = true;
|
|
15673
|
+
} else if (part === "</mark>") {
|
|
15674
|
+
mark = false;
|
|
15675
|
+
} else if (part !== "") {
|
|
15676
|
+
segments.push({ text: decodeEntities(part), mark });
|
|
15677
|
+
}
|
|
15678
|
+
}
|
|
15679
|
+
return segments;
|
|
15680
|
+
}
|
|
15681
|
+
function snippetText(snippet) {
|
|
15682
|
+
return snippetSegments(snippet).map(({ text, mark }) => mark ? `**${text}**` : text).join("");
|
|
15683
|
+
}
|
|
15527
15684
|
// ../contracts/src/envelope.ts
|
|
15528
15685
|
var isSubject = (value) => typeof value === "string" && value.length > 0;
|
|
15529
15686
|
var EnvelopeSchema = object({
|
|
@@ -15912,7 +16069,7 @@ function parseCommand(argv, io) {
|
|
|
15912
16069
|
for (let index = 0;index < rest.length; index++) {
|
|
15913
16070
|
const token = rest[index];
|
|
15914
16071
|
if (!token.startsWith("--")) {
|
|
15915
|
-
if (
|
|
16072
|
+
if (ISSUE_KEY2.test(token) && surface.flags.has("--issue")) {
|
|
15916
16073
|
if (index === 0) {
|
|
15917
16074
|
if (claim("issue", `the issue key ${token}`, false))
|
|
15918
16075
|
args["issue"] = token;
|
|
@@ -16031,7 +16188,7 @@ function appendedItem(kind, flag, value, number) {
|
|
|
16031
16188
|
const parsed = number(flag, value);
|
|
16032
16189
|
return parsed === undefined ? undefined : { value: parsed };
|
|
16033
16190
|
}
|
|
16034
|
-
var
|
|
16191
|
+
var ISSUE_KEY2 = /^[A-Z][A-Z0-9]*-\d+$/;
|
|
16035
16192
|
function quoteWord(value) {
|
|
16036
16193
|
return BARE_WORD.test(value) ? value : `'${value.replaceAll("'", "'\\''")}'`;
|
|
16037
16194
|
}
|
|
@@ -19523,7 +19680,8 @@ async function refuseOpenDecisionBlocks(client, tool, resolved) {
|
|
|
19523
19680
|
const stillOpen = (named, state) => state === "answered" ? `${named}, answered but still open in version ${latest}: it settles into a version on its own in about two seconds; wait for that version` : `${named}, ${state} but still open in version ${latest}: write the decision into the text with dispatch doc-edit, which writes a version that carries it`;
|
|
19524
19681
|
const open = blocks.flatMap((block) => {
|
|
19525
19682
|
const ask = asks.get(block.id);
|
|
19526
|
-
const
|
|
19683
|
+
const id = typedBlockIdAttribute(block.id);
|
|
19684
|
+
const openers = lines.filter((line) => line.includes(`ask{${id} `) || line.includes(`ask{${id}}`));
|
|
19527
19685
|
const states = openers.map((line) => /\bstate="(\w+)"/.exec(line)?.[1]);
|
|
19528
19686
|
const named = ask === undefined ? `block ${block.id}` : `${JSON.stringify(ask.question)} (block ${block.id}, ask ${ask.id})`;
|
|
19529
19687
|
if (states.length === 0)
|
package/dist/envoy.js
CHANGED
|
@@ -29984,43 +29984,6 @@ function itemFromSearch(search) {
|
|
|
29984
29984
|
return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
|
|
29985
29985
|
}
|
|
29986
29986
|
|
|
29987
|
-
// ../contracts/src/dispatch-block-ref.ts
|
|
29988
|
-
var encoder = new TextEncoder;
|
|
29989
|
-
function encodeBlockId(id) {
|
|
29990
|
-
let encoded = "";
|
|
29991
|
-
for (const character of id) {
|
|
29992
|
-
for (const byte of encoder.encode(character)) {
|
|
29993
|
-
const bare = byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte >= 97 && byte <= 122 || byte === 45;
|
|
29994
|
-
encoded += bare ? String.fromCharCode(byte) : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
29995
|
-
}
|
|
29996
|
-
}
|
|
29997
|
-
return encoded;
|
|
29998
|
-
}
|
|
29999
|
-
function decodeBlockId(encoded) {
|
|
30000
|
-
if (encoded === "" || encoded.includes("@")) {
|
|
30001
|
-
return;
|
|
30002
|
-
}
|
|
30003
|
-
let id;
|
|
30004
|
-
try {
|
|
30005
|
-
id = decodeURIComponent(encoded);
|
|
30006
|
-
} catch {
|
|
30007
|
-
return;
|
|
30008
|
-
}
|
|
30009
|
-
return id === "" || hasControlCharacter(id) ? undefined : id;
|
|
30010
|
-
}
|
|
30011
|
-
var MAX_BLOCK_PIN = 9223372036854775807n;
|
|
30012
|
-
function parseBlockFragment(encoded) {
|
|
30013
|
-
const at = encoded.indexOf("@");
|
|
30014
|
-
const pin = at === -1 ? undefined : encoded.slice(at + 1).match(/^v([1-9][0-9]*)$/)?.[1];
|
|
30015
|
-
if (at !== -1 && (pin === undefined || BigInt(pin) > MAX_BLOCK_PIN)) {
|
|
30016
|
-
return;
|
|
30017
|
-
}
|
|
30018
|
-
const block = decodeBlockId(at === -1 ? encoded : encoded.slice(0, at));
|
|
30019
|
-
if (block === undefined) {
|
|
30020
|
-
return;
|
|
30021
|
-
}
|
|
30022
|
-
return pin === undefined ? { block } : { block, pin };
|
|
30023
|
-
}
|
|
30024
29987
|
// ../contracts/src/dispatch-text-rules.ts
|
|
30025
29988
|
var SESSION_ID_PATTERN = "[^/?#\\s\\p{Z}\\p{Cc}<>\"'`\\[\\]|]+";
|
|
30026
29989
|
var sessionIdOnly = new RegExp(`^${SESSION_ID_PATTERN}$`, "u");
|
|
@@ -30033,6 +29996,7 @@ var PICTURE_TYPES = {
|
|
|
30033
29996
|
function isPictureType(mime) {
|
|
30034
29997
|
return PICTURE_TYPES[mime] === true;
|
|
30035
29998
|
}
|
|
29999
|
+
|
|
30036
30000
|
// ../contracts/src/dispatch-tools.ts
|
|
30037
30001
|
function dispatchToolSchema(spec, z, opts) {
|
|
30038
30002
|
const shape = spec.arguments(z);
|
|
@@ -30594,6 +30558,189 @@ var dispatchToolSpecs = [
|
|
|
30594
30558
|
strict: true
|
|
30595
30559
|
}
|
|
30596
30560
|
];
|
|
30561
|
+
|
|
30562
|
+
// ../contracts/src/dispatch-block-ref.ts
|
|
30563
|
+
var encoder = new TextEncoder;
|
|
30564
|
+
function encodeBlockId(id) {
|
|
30565
|
+
let encoded = "";
|
|
30566
|
+
for (const character of id) {
|
|
30567
|
+
for (const byte of encoder.encode(character)) {
|
|
30568
|
+
const bare = byte >= 48 && byte <= 57 || byte >= 65 && byte <= 90 || byte >= 97 && byte <= 122 || byte === 45;
|
|
30569
|
+
encoded += bare ? String.fromCharCode(byte) : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
30570
|
+
}
|
|
30571
|
+
}
|
|
30572
|
+
return encoded;
|
|
30573
|
+
}
|
|
30574
|
+
var MAX_BLOCK_ID_BYTES = 256;
|
|
30575
|
+
function decodeBlockId(encoded) {
|
|
30576
|
+
if (encoded === "" || encoded.includes("@")) {
|
|
30577
|
+
return;
|
|
30578
|
+
}
|
|
30579
|
+
let id;
|
|
30580
|
+
try {
|
|
30581
|
+
id = decodeURIComponent(encoded);
|
|
30582
|
+
} catch {
|
|
30583
|
+
return;
|
|
30584
|
+
}
|
|
30585
|
+
return id === "" || hasControlCharacter(id) ? undefined : id;
|
|
30586
|
+
}
|
|
30587
|
+
var MAX_BLOCK_PIN = 9223372036854775807n;
|
|
30588
|
+
function parseBlockFragment(encoded) {
|
|
30589
|
+
const at = encoded.indexOf("@");
|
|
30590
|
+
const pin = at === -1 ? undefined : encoded.slice(at + 1).match(/^v([1-9][0-9]*)$/)?.[1];
|
|
30591
|
+
if (at !== -1 && (pin === undefined || BigInt(pin) > MAX_BLOCK_PIN)) {
|
|
30592
|
+
return;
|
|
30593
|
+
}
|
|
30594
|
+
const block = decodeBlockId(at === -1 ? encoded : encoded.slice(0, at));
|
|
30595
|
+
if (block === undefined) {
|
|
30596
|
+
return;
|
|
30597
|
+
}
|
|
30598
|
+
return pin === undefined ? { block } : { block, pin };
|
|
30599
|
+
}
|
|
30600
|
+
var PROJECT_KEY = PROJECT_KEY_PATTERN.source.slice(1, -1);
|
|
30601
|
+
var ISSUE_KEY = `${PROJECT_KEY}-[1-9][0-9]*`;
|
|
30602
|
+
var DOCUMENT_SLUG = "[a-z0-9]+(?:-[a-z0-9]+)*";
|
|
30603
|
+
var ISSUE_KEY_ONLY = new RegExp(`^${ISSUE_KEY}$`);
|
|
30604
|
+
var BLOCK_REFERENCE = new RegExp(`^dispatch://(?:(${ISSUE_KEY})/spec|(${ISSUE_KEY}|${PROJECT_KEY})/artifact/(${DOCUMENT_SLUG}))#b-(.*)$`, "s");
|
|
30605
|
+
var ITEM_BLOCK_REFERENCE = new RegExp(`^dispatch://(?:${ISSUE_KEY}/(comment|message)|${PROJECT_KEY}/artifact/${DOCUMENT_SLUG}/(comment))/([^/?#]+)#b-(.*)$`, "s");
|
|
30606
|
+
var atIdBound = `dispatch://CORE-1/spec#b-${"x".repeat(MAX_BLOCK_ID_BYTES)}`;
|
|
30607
|
+
var DISPATCH_BLOCK_POINTER_VALUES = [
|
|
30608
|
+
{
|
|
30609
|
+
value: "dispatch://CORE-1/spec#b-x",
|
|
30610
|
+
ok: true,
|
|
30611
|
+
why: "a block of an issue's primary document"
|
|
30612
|
+
},
|
|
30613
|
+
{
|
|
30614
|
+
value: "dispatch://CORE-1/artifact/notes-md#b-x",
|
|
30615
|
+
ok: true,
|
|
30616
|
+
why: "a block of an issue's document"
|
|
30617
|
+
},
|
|
30618
|
+
{
|
|
30619
|
+
value: "dispatch://CORE/artifact/handbook-md#b-x",
|
|
30620
|
+
ok: true,
|
|
30621
|
+
why: "a block of a project's document"
|
|
30622
|
+
},
|
|
30623
|
+
{
|
|
30624
|
+
value: "dispatch://CORE/artifact/spec#b-x",
|
|
30625
|
+
ok: true,
|
|
30626
|
+
why: "a project's document whose slug is spec"
|
|
30627
|
+
},
|
|
30628
|
+
{ value: "dispatch://CORE-1/spec#b-d%C3%A9cision%3A1", ok: true, why: "a Unicode id" },
|
|
30629
|
+
{ value: "dispatch://CORE-1/spec#b-x@v2", ok: true, why: "a pinned block" },
|
|
30630
|
+
{ value: "dispatch://CORE-1/spec#b-x@v9223372036854775807", ok: true, why: "the largest pin" },
|
|
30631
|
+
{
|
|
30632
|
+
value: "dispatch://CORE-1/spec#b-x dispatch://CORE/artifact/handbook-md#b-y",
|
|
30633
|
+
ok: true,
|
|
30634
|
+
why: "two references separated by one space"
|
|
30635
|
+
},
|
|
30636
|
+
{ value: "", ok: true, why: "no pointers" },
|
|
30637
|
+
{ value: atIdBound, ok: true, why: "an id of exactly 256 bytes" },
|
|
30638
|
+
{
|
|
30639
|
+
value: "dispatch://CORE-1/artifact/spec#b-x",
|
|
30640
|
+
ok: false,
|
|
30641
|
+
why: "an issue's primary document is written /spec"
|
|
30642
|
+
},
|
|
30643
|
+
{ value: "dispatch://CORE-1/spec", ok: false, why: "a document, not a block" },
|
|
30644
|
+
{
|
|
30645
|
+
value: "dispatch://agent/s1/artifact/x#b-y",
|
|
30646
|
+
ok: false,
|
|
30647
|
+
why: "an agent's document has no blocks to point at"
|
|
30648
|
+
},
|
|
30649
|
+
{ value: "dispatch://CORE-1/spec#b-d%c3%a9", ok: false, why: "lower-case hex" },
|
|
30650
|
+
{ value: "dispatch://CORE-1/spec#b-%41", ok: false, why: "an over-encoded ASCII letter" },
|
|
30651
|
+
{ value: "dispatch://CORE-1/spec#b-x%2Dy", ok: false, why: "an over-encoded -" },
|
|
30652
|
+
{ value: "dispatch://CORE-1/spec#b-%FF", ok: false, why: "invalid UTF-8" },
|
|
30653
|
+
{ value: "dispatch://CORE-1/spec#b-%0A", ok: false, why: "a control character" },
|
|
30654
|
+
{ value: "dispatch://CORE-1/spec#x", ok: false, why: "a fragment that is not b-" },
|
|
30655
|
+
{ value: "dispatch://CORE-1/spec#c-x", ok: false, why: "a fragment that is not b-" },
|
|
30656
|
+
{ value: "dispatch://CORE-1/spec#b-", ok: false, why: "an empty id" },
|
|
30657
|
+
{ value: `${atIdBound}x`, ok: false, why: "an id over 256 bytes" },
|
|
30658
|
+
{ value: "dispatch://CORE-1/artifact/notes-md@v2#b-x", ok: false, why: "a versioned document" },
|
|
30659
|
+
{ value: "dispatch://CORE-1#b-x", ok: false, why: "an issue names no document" },
|
|
30660
|
+
{
|
|
30661
|
+
value: "dispatch://CORE-1/spec#b-x@v9223372036854775808",
|
|
30662
|
+
ok: false,
|
|
30663
|
+
why: "a pin past the largest"
|
|
30664
|
+
},
|
|
30665
|
+
{ value: "dispatch://CORE-1/spec#b-x@v01", ok: false, why: "a pin with a leading zero" },
|
|
30666
|
+
{ value: "dispatch://CORE-1/spec#b-x@v0", ok: false, why: "a pin of zero" },
|
|
30667
|
+
{
|
|
30668
|
+
value: "https://dispatch.example/issues/CORE-1/spec#b-x",
|
|
30669
|
+
ok: false,
|
|
30670
|
+
why: "a dashboard URL of a block"
|
|
30671
|
+
},
|
|
30672
|
+
{ value: "dispatch://CORE-1/spec#b-x.", ok: false, why: "trailing punctuation" },
|
|
30673
|
+
{ value: "dispatch://CORE-1/spec#b-x)", ok: false, why: "a trailing parenthesis" },
|
|
30674
|
+
{
|
|
30675
|
+
value: "dispatch://CORE-1/spec#b-x,dispatch://CORE-1/spec#b-y",
|
|
30676
|
+
ok: false,
|
|
30677
|
+
why: "references joined by a comma"
|
|
30678
|
+
},
|
|
30679
|
+
{
|
|
30680
|
+
value: "dispatch://CORE-1/spec#b-x dispatch://CORE-1/spec#b-x",
|
|
30681
|
+
ok: false,
|
|
30682
|
+
why: "a repeated reference"
|
|
30683
|
+
},
|
|
30684
|
+
{
|
|
30685
|
+
value: "dispatch://CORE-1/spec#b-x dispatch://CORE-1/spec#b-y",
|
|
30686
|
+
ok: false,
|
|
30687
|
+
why: "a doubled space"
|
|
30688
|
+
},
|
|
30689
|
+
{ value: " dispatch://CORE-1/spec#b-x", ok: false, why: "a leading space" },
|
|
30690
|
+
{ value: "dispatch://CORE-1/spec#b-x ", ok: false, why: "a trailing space" },
|
|
30691
|
+
{
|
|
30692
|
+
value: "dispatch://CORE-1/spec#b-x\tdispatch://CORE-1/spec#b-y",
|
|
30693
|
+
ok: false,
|
|
30694
|
+
why: "a tab between references"
|
|
30695
|
+
},
|
|
30696
|
+
{
|
|
30697
|
+
value: "dispatch://CORE-1/spec#b-x\uFEFFdispatch://CORE-1/spec#b-y",
|
|
30698
|
+
ok: false,
|
|
30699
|
+
why: "U+FEFF between references"
|
|
30700
|
+
},
|
|
30701
|
+
{
|
|
30702
|
+
value: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111#b-b2",
|
|
30703
|
+
ok: false,
|
|
30704
|
+
why: "a block of an issue's comment",
|
|
30705
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
30706
|
+
},
|
|
30707
|
+
{
|
|
30708
|
+
value: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111#b-b2@v1",
|
|
30709
|
+
ok: false,
|
|
30710
|
+
why: "a block of a revision of an issue's comment",
|
|
30711
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
30712
|
+
},
|
|
30713
|
+
{
|
|
30714
|
+
value: "dispatch://CORE/artifact/handbook-md/comment/88888888-8888-4888-8888-888888888888#b-b2",
|
|
30715
|
+
ok: false,
|
|
30716
|
+
why: "a block of a project document's comment",
|
|
30717
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
30718
|
+
},
|
|
30719
|
+
{
|
|
30720
|
+
value: "dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333#b-b2",
|
|
30721
|
+
ok: false,
|
|
30722
|
+
why: "a block of an issue message",
|
|
30723
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
30724
|
+
},
|
|
30725
|
+
{
|
|
30726
|
+
value: "dispatch://CORE-1/artifact/notes-md/comment/c1#b-x",
|
|
30727
|
+
ok: false,
|
|
30728
|
+
why: "an issue document's comment, a shape no reference has",
|
|
30729
|
+
problem: "is not a block reference as Dispatch writes one"
|
|
30730
|
+
},
|
|
30731
|
+
{
|
|
30732
|
+
value: "dispatch://CORE-1/comment/%ZZ#b-x",
|
|
30733
|
+
ok: false,
|
|
30734
|
+
why: "a comment id that does not decode",
|
|
30735
|
+
problem: "is not a block reference as Dispatch writes one"
|
|
30736
|
+
},
|
|
30737
|
+
{
|
|
30738
|
+
value: "dispatch://CORE-1/spec#b-x dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333#b-b2",
|
|
30739
|
+
ok: false,
|
|
30740
|
+
why: "a document's block, then an issue message's",
|
|
30741
|
+
problem: "a block[] attribute points only at a block of a document"
|
|
30742
|
+
}
|
|
30743
|
+
];
|
|
30597
30744
|
// ../contracts/src/envelope.ts
|
|
30598
30745
|
var isSubject = (value) => typeof value === "string" && value.length > 0;
|
|
30599
30746
|
var EnvelopeSchema = object({
|
|
@@ -37759,7 +37906,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
37759
37906
|
|
|
37760
37907
|
// package.json
|
|
37761
37908
|
var name = "@sjawhar/pi-envoy";
|
|
37762
|
-
var version2 = "14.
|
|
37909
|
+
var version2 = "14.2.0";
|
|
37763
37910
|
var package_default = {
|
|
37764
37911
|
name,
|
|
37765
37912
|
version: version2,
|