@sjawhar/claude-envoy 6.24.0 → 6.25.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/.claude-plugin/plugin.json +1 -1
- package/.omp-plugin/plugin.json +1 -1
- package/dist/codex-hook.js +443 -10
- package/dist/dispatch.js +443 -10
- package/dist/envoy-channel.js +444 -11
- package/dist/session-hook.js +443 -10
- package/package.json +1 -1
package/dist/session-hook.js
CHANGED
|
@@ -14229,6 +14229,29 @@ function pathKeepsBytesOf(name) {
|
|
|
14229
14229
|
return extension === undefined || !MARKDOWN_EXTENSION.test(extension);
|
|
14230
14230
|
}
|
|
14231
14231
|
var artifactOwner = documentOwnerValidation(false);
|
|
14232
|
+
var SPEC_FORM_ROOT_RULE = "root walks every issue under that root: name no issue, project, artifact, version or ref with it.";
|
|
14233
|
+
var SPEC_FORM_VERSION_RULE = "A version number belongs to one document, and an issue has several: with version, name the document with artifact (--artifact).";
|
|
14234
|
+
var SPEC_FORM_DOCUMENT_ARGUMENTS = ["issue", "project", "artifact", "version", "ref"];
|
|
14235
|
+
var specFormDocumentOwner = documentOwnerValidation(true);
|
|
14236
|
+
function specFormRefusal(value) {
|
|
14237
|
+
const input = value;
|
|
14238
|
+
if (input["root"] !== undefined) {
|
|
14239
|
+
return SPEC_FORM_DOCUMENT_ARGUMENTS.every((name) => input[name] === undefined) ? undefined : SPEC_FORM_ROOT_RULE;
|
|
14240
|
+
}
|
|
14241
|
+
return brokenParts([
|
|
14242
|
+
[specFormDocumentOwner.check(value), specFormDocumentOwner.message],
|
|
14243
|
+
[
|
|
14244
|
+
input["version"] === undefined || typeof input["artifact"] === "string",
|
|
14245
|
+
SPEC_FORM_VERSION_RULE
|
|
14246
|
+
]
|
|
14247
|
+
]);
|
|
14248
|
+
}
|
|
14249
|
+
var SPEC_FORM_RULE = `${specFormDocumentOwner.message} ${SPEC_FORM_VERSION_RULE} ${SPEC_FORM_ROOT_RULE}`;
|
|
14250
|
+
var specFormValidation = {
|
|
14251
|
+
check: (value) => specFormRefusal(value) === undefined,
|
|
14252
|
+
message: SPEC_FORM_RULE,
|
|
14253
|
+
refusal: (value) => specFormRefusal(value) ?? SPEC_FORM_RULE
|
|
14254
|
+
};
|
|
14232
14255
|
function artifactProblem(value) {
|
|
14233
14256
|
const input = value;
|
|
14234
14257
|
const extension = typeof input.path === "string" || typeof input.name !== "string" ? undefined : NAME_EXTENSION.exec(input.name.trim())?.[1];
|
|
@@ -15037,6 +15060,20 @@ var dispatchToolSpecs = [
|
|
|
15037
15060
|
}),
|
|
15038
15061
|
validation: documentOwnerValidation(true)
|
|
15039
15062
|
},
|
|
15063
|
+
{
|
|
15064
|
+
name: "dispatch_spec_form",
|
|
15065
|
+
example: { issue: "DSP-1" },
|
|
15066
|
+
description: "Read the form of a document's texts of The Spec, as an approval request would judge them. " + "It lists each statement, check, component purpose and term that breaks the form, with its rule. " + "It writes nothing. " + "It says whether the document is under a root of The Spec, and how many texts it read. " + "With root, it lists each issue under that root and the form of each document that the root covers.",
|
|
15067
|
+
arguments: (z) => ({
|
|
15068
|
+
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
15069
|
+
project: z.string().describe("Project key owning the document.").optional(),
|
|
15070
|
+
artifact: z.string().describe("Optional document artifact id, slug, or filename. Without it, the command reads the latest settled version of the spec and of the Verification document of the issue.").optional(),
|
|
15071
|
+
version: z.number({ int: true, min: 1 }).describe("Optional version number of the document that artifact or ref names: a version belongs to one document, so a version with an issue and no artifact is refused. Without it, the command reads the latest settled version, which an approval request would name.").optional(),
|
|
15072
|
+
root: z.string().describe("An issue key. The command lists each issue under that root, with the form of the spec and the Verification document of each issue. Name no other argument with it.").optional(),
|
|
15073
|
+
ref: z.string().describe("Optional dispatch:// document reference.").optional()
|
|
15074
|
+
}),
|
|
15075
|
+
validation: specFormValidation
|
|
15076
|
+
},
|
|
15040
15077
|
{
|
|
15041
15078
|
name: "dispatch_request_approval",
|
|
15042
15079
|
example: { issue: "DSP-1", summary: "A live sync replaces the nightly export." },
|
|
@@ -16338,7 +16375,134 @@ function claimTakeableAt(liveness, lastSeen = undefined) {
|
|
|
16338
16375
|
}
|
|
16339
16376
|
return new Date(seen + ISSUE_CLAIM_UNRESPONSIVE_GRACE_MS).toISOString();
|
|
16340
16377
|
}
|
|
16378
|
+
// ../contracts/src/dashboard-pages.json
|
|
16379
|
+
var dashboard_pages_default = {
|
|
16380
|
+
about: "Generated from the dashboard's route table by packages/dispatch/web/src/features/refs/dashboard-pages-file.ts; do not edit.",
|
|
16381
|
+
tabs: [
|
|
16382
|
+
{
|
|
16383
|
+
page: "verification",
|
|
16384
|
+
reference: "verification"
|
|
16385
|
+
},
|
|
16386
|
+
{
|
|
16387
|
+
page: "plan",
|
|
16388
|
+
reference: "plan"
|
|
16389
|
+
},
|
|
16390
|
+
{
|
|
16391
|
+
page: "steps",
|
|
16392
|
+
reference: "steps"
|
|
16393
|
+
},
|
|
16394
|
+
{
|
|
16395
|
+
page: "conversation",
|
|
16396
|
+
reference: "log"
|
|
16397
|
+
},
|
|
16398
|
+
{
|
|
16399
|
+
page: "children",
|
|
16400
|
+
reference: "children"
|
|
16401
|
+
},
|
|
16402
|
+
{
|
|
16403
|
+
page: "artifacts",
|
|
16404
|
+
reference: "artifacts"
|
|
16405
|
+
},
|
|
16406
|
+
{
|
|
16407
|
+
page: "activity",
|
|
16408
|
+
reference: "activity"
|
|
16409
|
+
},
|
|
16410
|
+
{
|
|
16411
|
+
page: "collaborators",
|
|
16412
|
+
reference: "collaborators"
|
|
16413
|
+
}
|
|
16414
|
+
],
|
|
16415
|
+
document_segments: [
|
|
16416
|
+
"artifacts",
|
|
16417
|
+
"artifact"
|
|
16418
|
+
],
|
|
16419
|
+
document_pages: {
|
|
16420
|
+
primary: [
|
|
16421
|
+
"/issues/{key}",
|
|
16422
|
+
"/issues/{key}/spec",
|
|
16423
|
+
"/issues/{key}/artifacts/{slug}",
|
|
16424
|
+
"/issues/{key}/artifact/{slug}"
|
|
16425
|
+
],
|
|
16426
|
+
verification: [
|
|
16427
|
+
"/issues/{key}/verification",
|
|
16428
|
+
"/issues/{key}/artifacts/{slug}",
|
|
16429
|
+
"/issues/{key}/artifact/{slug}"
|
|
16430
|
+
],
|
|
16431
|
+
plan: [
|
|
16432
|
+
"/issues/{key}/plan",
|
|
16433
|
+
"/issues/{key}/artifacts/{slug}",
|
|
16434
|
+
"/issues/{key}/artifact/{slug}"
|
|
16435
|
+
],
|
|
16436
|
+
decisions: [
|
|
16437
|
+
"/issues/{key}/decisions",
|
|
16438
|
+
"/issues/{key}/artifacts/{slug}",
|
|
16439
|
+
"/issues/{key}/artifact/{slug}"
|
|
16440
|
+
],
|
|
16441
|
+
issue: [
|
|
16442
|
+
"/issues/{key}/artifacts/{slug}",
|
|
16443
|
+
"/issues/{key}/artifact/{slug}"
|
|
16444
|
+
],
|
|
16445
|
+
project: [
|
|
16446
|
+
"/projects/{project}/documents/{slug}"
|
|
16447
|
+
],
|
|
16448
|
+
agent: [
|
|
16449
|
+
"/agents/{session}/artifacts/{slug}"
|
|
16450
|
+
]
|
|
16451
|
+
},
|
|
16452
|
+
references: [
|
|
16453
|
+
{
|
|
16454
|
+
href: "/issues/CORE-1/verification",
|
|
16455
|
+
ref: "dispatch://CORE-1/verification"
|
|
16456
|
+
},
|
|
16457
|
+
{
|
|
16458
|
+
href: "/issues/CORE-1/plan",
|
|
16459
|
+
ref: "dispatch://CORE-1/plan"
|
|
16460
|
+
},
|
|
16461
|
+
{
|
|
16462
|
+
href: "/issues/CORE-1/steps",
|
|
16463
|
+
ref: "dispatch://CORE-1/steps"
|
|
16464
|
+
},
|
|
16465
|
+
{
|
|
16466
|
+
href: "/issues/CORE-1/conversation",
|
|
16467
|
+
ref: "dispatch://CORE-1/log"
|
|
16468
|
+
},
|
|
16469
|
+
{
|
|
16470
|
+
href: "/issues/CORE-1/children",
|
|
16471
|
+
ref: "dispatch://CORE-1/children"
|
|
16472
|
+
},
|
|
16473
|
+
{
|
|
16474
|
+
href: "/issues/CORE-1/artifacts",
|
|
16475
|
+
ref: "dispatch://CORE-1/artifacts"
|
|
16476
|
+
},
|
|
16477
|
+
{
|
|
16478
|
+
href: "/issues/CORE-1/activity",
|
|
16479
|
+
ref: "dispatch://CORE-1/activity"
|
|
16480
|
+
},
|
|
16481
|
+
{
|
|
16482
|
+
href: "/issues/CORE-1/collaborators",
|
|
16483
|
+
ref: "dispatch://CORE-1/collaborators"
|
|
16484
|
+
},
|
|
16485
|
+
{
|
|
16486
|
+
href: "/issues/CORE-1/artifacts/notes-md",
|
|
16487
|
+
ref: "dispatch://CORE-1/artifact/notes-md"
|
|
16488
|
+
},
|
|
16489
|
+
{
|
|
16490
|
+
href: "/issues/CORE-1/artifacts/notes-md?v=2",
|
|
16491
|
+
ref: "dispatch://CORE-1/artifact/notes-md@v2"
|
|
16492
|
+
},
|
|
16493
|
+
{
|
|
16494
|
+
href: "/issues/CORE-1/artifact/notes-md",
|
|
16495
|
+
ref: "dispatch://CORE-1/artifact/notes-md"
|
|
16496
|
+
},
|
|
16497
|
+
{
|
|
16498
|
+
href: "/issues/CORE-1/artifact/notes-md?v=2",
|
|
16499
|
+
ref: "dispatch://CORE-1/artifact/notes-md@v2"
|
|
16500
|
+
}
|
|
16501
|
+
]
|
|
16502
|
+
};
|
|
16503
|
+
|
|
16341
16504
|
// ../contracts/src/dispatch-href.ts
|
|
16505
|
+
var DISPATCH_DASHBOARD_PAGES = dashboard_pages_default;
|
|
16342
16506
|
function hasControlCharacter(value) {
|
|
16343
16507
|
return /\p{Cc}/u.test(value);
|
|
16344
16508
|
}
|
|
@@ -16367,6 +16531,102 @@ function itemFromSearch(search) {
|
|
|
16367
16531
|
}
|
|
16368
16532
|
return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
|
|
16369
16533
|
}
|
|
16534
|
+
var DISPATCH_HREF_REFERENCES = [
|
|
16535
|
+
...DISPATCH_DASHBOARD_PAGES.references,
|
|
16536
|
+
{ href: "/issues/CORE-1", ref: "dispatch://CORE-1" },
|
|
16537
|
+
{ href: "/issues/CORE-1/spec", ref: "dispatch://CORE-1/spec" },
|
|
16538
|
+
{
|
|
16539
|
+
href: "/issues/CORE-1/decisions",
|
|
16540
|
+
ref: "dispatch://CORE-1/artifact/decisions-md"
|
|
16541
|
+
},
|
|
16542
|
+
{
|
|
16543
|
+
href: "/issues/CORE-1/decisions#b-ship-it",
|
|
16544
|
+
ref: "dispatch://CORE-1/artifact/decisions-md"
|
|
16545
|
+
},
|
|
16546
|
+
{
|
|
16547
|
+
href: "/issues/CORE-1/comments/11111111-1111-4111-8111-111111111111",
|
|
16548
|
+
ref: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111"
|
|
16549
|
+
},
|
|
16550
|
+
{
|
|
16551
|
+
href: "/issues/CORE-1/asks/22222222-2222-4222-8222-222222222222",
|
|
16552
|
+
ref: "dispatch://CORE-1/ask/22222222-2222-4222-8222-222222222222"
|
|
16553
|
+
},
|
|
16554
|
+
{
|
|
16555
|
+
href: "/issues/CORE-1/messages/33333333-3333-4333-8333-333333333333",
|
|
16556
|
+
ref: "dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333"
|
|
16557
|
+
},
|
|
16558
|
+
{
|
|
16559
|
+
href: "/issues/CORE-1/spec?comment=44444444-4444-4444-8444-444444444444",
|
|
16560
|
+
ref: "dispatch://CORE-1/comment/44444444-4444-4444-8444-444444444444"
|
|
16561
|
+
},
|
|
16562
|
+
{
|
|
16563
|
+
href: "/issues/CORE-1/artifacts/notes-md?comment=55555555-5555-4555-8555-555555555555",
|
|
16564
|
+
ref: "dispatch://CORE-1/comment/55555555-5555-4555-8555-555555555555"
|
|
16565
|
+
},
|
|
16566
|
+
{
|
|
16567
|
+
href: "/issues/CORE-1/spec?ask=66666666-6666-4666-8666-666666666666",
|
|
16568
|
+
ref: "dispatch://CORE-1/ask/66666666-6666-4666-8666-666666666666"
|
|
16569
|
+
},
|
|
16570
|
+
{
|
|
16571
|
+
href: "/issues/CORE-1/artifacts/notes-md?ask=77777777-7777-4777-8777-777777777777",
|
|
16572
|
+
ref: "dispatch://CORE-1/ask/77777777-7777-4777-8777-777777777777"
|
|
16573
|
+
},
|
|
16574
|
+
{
|
|
16575
|
+
href: "/projects/CORE/documents/handbook-md",
|
|
16576
|
+
ref: "dispatch://CORE/artifact/handbook-md"
|
|
16577
|
+
},
|
|
16578
|
+
{
|
|
16579
|
+
href: "/projects/CORE/documents/handbook-md?comment=88888888-8888-4888-8888-888888888888",
|
|
16580
|
+
ref: "dispatch://CORE/artifact/handbook-md/comment/88888888-8888-4888-8888-888888888888"
|
|
16581
|
+
},
|
|
16582
|
+
{
|
|
16583
|
+
href: "/projects/CORE/documents/handbook-md?ask=99999999-9999-4999-8999-999999999999",
|
|
16584
|
+
ref: "dispatch://CORE/artifact/handbook-md/ask/99999999-9999-4999-8999-999999999999"
|
|
16585
|
+
},
|
|
16586
|
+
{ href: "/issues/CORE-1/spec#b-ship-it", ref: "dispatch://CORE-1/spec#b-ship-it" },
|
|
16587
|
+
{
|
|
16588
|
+
href: "/issues/CORE-1/artifacts/notes-md#b-ship-it",
|
|
16589
|
+
ref: "dispatch://CORE-1/artifact/notes-md#b-ship-it"
|
|
16590
|
+
},
|
|
16591
|
+
{
|
|
16592
|
+
href: "/projects/CORE/documents/handbook-md#b-ship-it",
|
|
16593
|
+
ref: "dispatch://CORE/artifact/handbook-md#b-ship-it"
|
|
16594
|
+
},
|
|
16595
|
+
{
|
|
16596
|
+
href: "/issues/CORE-1/comments/11111111-1111-4111-8111-111111111111#b-b2",
|
|
16597
|
+
ref: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111#b-b2"
|
|
16598
|
+
},
|
|
16599
|
+
{
|
|
16600
|
+
href: "/issues/CORE-1/messages/33333333-3333-4333-8333-333333333333#b-b2",
|
|
16601
|
+
ref: "dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333#b-b2"
|
|
16602
|
+
},
|
|
16603
|
+
{
|
|
16604
|
+
href: "/issues/CORE-1/asks/22222222-2222-4222-8222-222222222222#b-b3",
|
|
16605
|
+
ref: "dispatch://CORE-1/ask/22222222-2222-4222-8222-222222222222#b-b3"
|
|
16606
|
+
},
|
|
16607
|
+
{
|
|
16608
|
+
href: "/projects/CORE/documents/handbook-md?comment=88888888-8888-4888-8888-888888888888#b-b2",
|
|
16609
|
+
ref: "dispatch://CORE/artifact/handbook-md/comment/88888888-8888-4888-8888-888888888888"
|
|
16610
|
+
},
|
|
16611
|
+
{
|
|
16612
|
+
href: "/projects/CORE/documents/handbook-md?ask=99999999-9999-4999-8999-999999999999#b-b2",
|
|
16613
|
+
ref: "dispatch://CORE/artifact/handbook-md/ask/99999999-9999-4999-8999-999999999999"
|
|
16614
|
+
},
|
|
16615
|
+
{
|
|
16616
|
+
href: "/issues/CORE-1/spec#b-d%C3%A9cision%3A1",
|
|
16617
|
+
ref: "dispatch://CORE-1/spec#b-d%C3%A9cision%3A1"
|
|
16618
|
+
},
|
|
16619
|
+
{ href: "/issues/CORE-1/spec#top", ref: "dispatch://CORE-1/spec" },
|
|
16620
|
+
{ href: "/issues/CORE-1/spec?v=2#b-ship-it", ref: "dispatch://CORE-1/artifact/spec@v2" },
|
|
16621
|
+
{
|
|
16622
|
+
href: "/issues/CORE-1/artifacts/notes-md?v=2#b-ship-it",
|
|
16623
|
+
ref: "dispatch://CORE-1/artifact/notes-md@v2"
|
|
16624
|
+
},
|
|
16625
|
+
{
|
|
16626
|
+
href: "/projects/CORE/documents/handbook-md?version=3#b-ship-it",
|
|
16627
|
+
ref: "dispatch://CORE/artifact/handbook-md@v3"
|
|
16628
|
+
}
|
|
16629
|
+
];
|
|
16370
16630
|
|
|
16371
16631
|
// ../contracts/src/dispatch-block-ref.ts
|
|
16372
16632
|
var encoder = new TextEncoder;
|
|
@@ -26281,6 +26541,9 @@ class DispatchClient {
|
|
|
26281
26541
|
async docRead(id, version, read = {}) {
|
|
26282
26542
|
return version === undefined ? this.#read(["api", "v1", "artifacts", id, "text"], undefined, read) : this.#read(["api", "v1", "artifacts", id, "versions", String(version)], undefined, read);
|
|
26283
26543
|
}
|
|
26544
|
+
async specForm(id, version) {
|
|
26545
|
+
return this.#json("GET", ["api", "v1", "artifacts", id, "spec-form"], undefined, version === undefined ? undefined : { version });
|
|
26546
|
+
}
|
|
26284
26547
|
async docReadWithBlocks(id, read = {}) {
|
|
26285
26548
|
return this.#read(["api", "v1", "artifacts", id, "text"], { blocks: true }, read);
|
|
26286
26549
|
}
|
|
@@ -26962,6 +27225,11 @@ ${issueReference}`;
|
|
|
26962
27225
|
}
|
|
26963
27226
|
|
|
26964
27227
|
// ../envoy-client/src/dispatch-commands/links.ts
|
|
27228
|
+
var issueTabReferences = new Map([
|
|
27229
|
+
...DISPATCH_DASHBOARD_PAGES.tabs.map(({ page, reference }) => [page, reference]),
|
|
27230
|
+
["log", "log"]
|
|
27231
|
+
]);
|
|
27232
|
+
var issuePagePattern = new RegExp(`^/issues/([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)(?:/(spec|decisions|${[...issueTabReferences.keys()].join("|")})|/(?:${DISPATCH_DASHBOARD_PAGES.document_segments.join("|")})/([^/]+)|/asks/([^/]+)|/comments/([^/]+)|/messages/([^/]+))?/?$`);
|
|
26965
27233
|
function dispatchRefFromUrl(value, serverUrl) {
|
|
26966
27234
|
let url;
|
|
26967
27235
|
let origin;
|
|
@@ -26981,7 +27249,7 @@ function dispatchRefFromUrl(value, serverUrl) {
|
|
|
26981
27249
|
const id = url.hash.startsWith("#b-") ? decodeBlockId(url.hash.slice(3)) : undefined;
|
|
26982
27250
|
return id === undefined || versionName !== undefined && url.searchParams.get(versionName) ? "" : `#b-${encodeBlockId(id)}`;
|
|
26983
27251
|
};
|
|
26984
|
-
const issuePage = url.pathname.match(
|
|
27252
|
+
const issuePage = url.pathname.match(issuePagePattern);
|
|
26985
27253
|
if (issuePage) {
|
|
26986
27254
|
const [, key = "", page, artifact, ask, comment, message] = issuePage;
|
|
26987
27255
|
const version = versionOf("v");
|
|
@@ -26999,7 +27267,7 @@ function dispatchRefFromUrl(value, serverUrl) {
|
|
|
26999
27267
|
if (page === "decisions")
|
|
27000
27268
|
return `dispatch://${key}/artifact/decisions-md`;
|
|
27001
27269
|
if (page !== undefined)
|
|
27002
|
-
return `dispatch://${key}/${page
|
|
27270
|
+
return `dispatch://${key}/${issueTabReferences.get(page) ?? page}`;
|
|
27003
27271
|
if (artifact !== undefined) {
|
|
27004
27272
|
const slug = decodeURIComponent(artifact);
|
|
27005
27273
|
return `dispatch://${key}/artifact/${slug}${version}${blockOf("v")}`;
|
|
@@ -27407,6 +27675,8 @@ async function resolveOrigin(env, exec, cwd) {
|
|
|
27407
27675
|
}
|
|
27408
27676
|
|
|
27409
27677
|
// ../envoy-client/src/dispatch-owner.ts
|
|
27678
|
+
var issueViewReferences = DISPATCH_DASHBOARD_PAGES.tabs.map(({ reference }) => reference).filter((reference) => !["log", "activity", "children"].includes(reference));
|
|
27679
|
+
var issueReferencePattern = new RegExp(`^dispatch://([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)(?:/(spec)|/(log|activity)|/(children)|/(comments)|/(${issueViewReferences.join("|")})|/artifact/([^/@]+)(?:@v(\\d+))?|/ask/([^/]+)|/comment/([^/]+)|/message/([^/]+))?$`);
|
|
27410
27680
|
function documentLabel(project, slug) {
|
|
27411
27681
|
return `${project}/${slug}`;
|
|
27412
27682
|
}
|
|
@@ -27499,10 +27769,10 @@ function parseDispatchRef(ref) {
|
|
|
27499
27769
|
artifact
|
|
27500
27770
|
};
|
|
27501
27771
|
}
|
|
27502
|
-
const issueReference = ref.match(
|
|
27772
|
+
const issueReference = ref.match(issueReferencePattern);
|
|
27503
27773
|
if (!issueReference)
|
|
27504
27774
|
return null;
|
|
27505
|
-
const [, issue, spec, log, children, comments, artifact, version, ask, comment, message] = issueReference;
|
|
27775
|
+
const [, issue, spec, log, children, comments, tab, artifact, version, ask, comment, message] = issueReference;
|
|
27506
27776
|
if (!issue || version !== undefined && Number(version) < 1)
|
|
27507
27777
|
return null;
|
|
27508
27778
|
const owner = { kind: "issue", issue };
|
|
@@ -27514,6 +27784,8 @@ function parseDispatchRef(ref) {
|
|
|
27514
27784
|
return { owner, kind: "children", id: children };
|
|
27515
27785
|
if (comments)
|
|
27516
27786
|
return { owner, kind: "comments", id: comments };
|
|
27787
|
+
if (tab)
|
|
27788
|
+
return { owner, kind: "tab", id: tab };
|
|
27517
27789
|
if (artifact) {
|
|
27518
27790
|
return {
|
|
27519
27791
|
owner,
|
|
@@ -30770,18 +31042,18 @@ function itemReplyTo(args, field) {
|
|
|
30770
31042
|
return block === undefined ? { id: replyTo } : { id: block.item.id, block: block.block };
|
|
30771
31043
|
}
|
|
30772
31044
|
function innerRefProblem(tool, ref, refText) {
|
|
30773
|
-
if (ref.kind !== "ask" && ref.kind !== "comment" && ref.kind !== "message" && ref.kind !== "log" && ref.kind !== "children" && ref.kind !== "comments" && ref.kind !== "block") {
|
|
31045
|
+
if (ref.kind !== "ask" && ref.kind !== "comment" && ref.kind !== "message" && ref.kind !== "log" && ref.kind !== "children" && ref.kind !== "comments" && ref.kind !== "tab" && ref.kind !== "block") {
|
|
30774
31046
|
return;
|
|
30775
31047
|
}
|
|
30776
31048
|
if (tool === "dispatch_read" || tool === "dispatch_ask")
|
|
30777
31049
|
return;
|
|
30778
31050
|
const owner = refOwnerName(ref);
|
|
30779
31051
|
const itemKind = ref.item?.kind ?? ref.kind;
|
|
30780
|
-
const documentArgument = ref.kind === "block" && ref.item === undefined && tool !== "dispatch_comment" ? ` and artifact ${ref.id}` : tool === "dispatch_suggest" ? " and artifact <the document's slug>" : "";
|
|
31052
|
+
const documentArgument = ref.kind === "block" && ref.item === undefined && tool !== "dispatch_comment" ? ` and artifact ${ref.id}` : tool === "dispatch_suggest" || ref.kind === "tab" && tool !== "dispatch_comment" ? " and artifact <the document's slug>" : "";
|
|
30781
31053
|
const ownerArguments = ref.owner.kind === "issue" ? `issue ${ref.owner.issue}${documentArgument}` : `project ${ref.owner.project} and artifact ${ref.artifact}`;
|
|
30782
31054
|
const partRef = ref.pin === undefined ? refText : refText.slice(0, -`@v${ref.pin}`.length);
|
|
30783
31055
|
const fix = tool === "dispatch_comment" && itemKind === "ask" ? `reply under it with reply_to_ask ${ref.item === undefined ? ref.id : partRef} and ${ownerArguments}` : tool === "dispatch_comment" && itemKind === "comment" ? `reply in its thread with reply_to ${ref.id} and ${ownerArguments}` : `read it with dispatch read, or name ${owner} with ${ownerArguments}`;
|
|
30784
|
-
const item = ref.kind === "ask" ? "an ask" : ref.kind === "log" ? "the event log" : ref.kind === "children" ? "the children" : ref.kind === "comments" ? "the comments" : ref.kind === "block" ? `block ${ref.block}${ref.item === undefined ? "" : ` of ${article(ref.item.kind)}`}` : `a ${ref.kind}`;
|
|
31056
|
+
const item = ref.kind === "ask" ? "an ask" : ref.kind === "log" ? "the event log" : ref.kind === "children" ? "the children" : ref.kind === "comments" ? "the comments" : ref.kind === "tab" ? `the ${ref.id} tab` : ref.kind === "block" ? `block ${ref.block}${ref.item === undefined ? "" : ` of ${article(ref.item.kind)}`}` : `a ${ref.kind}`;
|
|
30785
31057
|
return `ref ${refText} names ${item} on ${owner}; dispatch ${commandName(tool)} would act on ${owner} and drop the ${ref.kind}: ${fix}`;
|
|
30786
31058
|
}
|
|
30787
31059
|
var documentItemPattern = /^dispatch:\/\/([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)\/artifact\/[^/@]+(?:@v\d+)?\/(ask|comment)\/([^/]+)$/;
|
|
@@ -31142,6 +31414,9 @@ async function resolveOwnerArguments(tool, input, cwd, env, exec, dashboardUrls,
|
|
|
31142
31414
|
if (tool === "dispatch_result" && typeof retract === "string") {
|
|
31143
31415
|
return { args, ref, owner: null };
|
|
31144
31416
|
}
|
|
31417
|
+
if (tool === "dispatch_spec_form" && typeof args["root"] === "string") {
|
|
31418
|
+
return { args, ref, owner: null };
|
|
31419
|
+
}
|
|
31145
31420
|
const legionIssue = env.LEGION_ISSUE;
|
|
31146
31421
|
if (!legionIssue) {
|
|
31147
31422
|
problems.push(ownerRequiredProblem);
|
|
@@ -35030,6 +35305,162 @@ async function refuseRemovingOpenDecisionBlocks(client, tool, resolved, ops) {
|
|
|
35030
35305
|
`));
|
|
35031
35306
|
}
|
|
35032
35307
|
|
|
35308
|
+
// ../envoy-client/src/dispatch-commands/spec-form.ts
|
|
35309
|
+
function counted(count, noun) {
|
|
35310
|
+
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
35311
|
+
}
|
|
35312
|
+
function textCounts(texts) {
|
|
35313
|
+
const of = (kind) => texts?.[kind] ?? 0;
|
|
35314
|
+
return `${counted(of("statement"), "statement")}, ${counted(of("claim"), "claim")}, ${counted(of("purpose"), "purpose")} and ${counted(of("definition"), "definition")}`;
|
|
35315
|
+
}
|
|
35316
|
+
function readLine2(texts, name, version) {
|
|
35317
|
+
const read = Object.values(texts ?? {}).reduce((sum, count) => sum + count, 0);
|
|
35318
|
+
return read === 0 ? `Dispatch found no text of The Spec in ${name} version ${version}, so it decided nothing about its form.` : `Dispatch read the form of ${textCounts(texts)}: no text breaks it.`;
|
|
35319
|
+
}
|
|
35320
|
+
function unreadLines(unread) {
|
|
35321
|
+
return (unread ?? []).map(({ line }) => line);
|
|
35322
|
+
}
|
|
35323
|
+
function approvalFormLines(result, name) {
|
|
35324
|
+
const form = result.spec_form;
|
|
35325
|
+
return form === undefined ? [] : [readLine2(form.texts, name, result.version), ...unreadLines(form.unread)];
|
|
35326
|
+
}
|
|
35327
|
+
function scopeLine(form) {
|
|
35328
|
+
switch (form.scope) {
|
|
35329
|
+
case "no_root":
|
|
35330
|
+
return "This server names no root of The Spec, so Dispatch refuses no approval request for its form.";
|
|
35331
|
+
case "outside":
|
|
35332
|
+
return `${form.name} is not under a root of The Spec, so Dispatch refuses no approval request of it for its form.`;
|
|
35333
|
+
case "not_spec":
|
|
35334
|
+
return `${form.name} is not the spec or the Verification document of its issue, so Dispatch refuses no approval request of it for its form.`;
|
|
35335
|
+
case "root":
|
|
35336
|
+
return `${form.name} belongs to a root of The Spec, so Dispatch refuses no approval request of it for its form.`;
|
|
35337
|
+
default:
|
|
35338
|
+
return `${form.name} has the scope ${form.scope}, so Dispatch refuses no approval request of it for its form.`;
|
|
35339
|
+
}
|
|
35340
|
+
}
|
|
35341
|
+
function documentLines(form) {
|
|
35342
|
+
const listed = form.finding_lines ?? [];
|
|
35343
|
+
const read = readLine2(form.texts, form.name, form.version);
|
|
35344
|
+
const unread = unreadLines(form.unread);
|
|
35345
|
+
if (!form.in_scope) {
|
|
35346
|
+
return form.findings_total === 0 ? [scopeLine(form), read, ...unread] : [scopeLine(form), "The findings below are for you to read.", ...listed, ...unread];
|
|
35347
|
+
}
|
|
35348
|
+
return form.findings_total === 0 ? [read, ...unread] : [...listed, ...unread];
|
|
35349
|
+
}
|
|
35350
|
+
function noVersionLine(name) {
|
|
35351
|
+
return `${name} has no version yet, so Dispatch read no text in it.`;
|
|
35352
|
+
}
|
|
35353
|
+
function playsSpecOrVerification(artifact) {
|
|
35354
|
+
if (artifact.kind !== "doc" || typeof artifact.issue_key !== "string")
|
|
35355
|
+
return false;
|
|
35356
|
+
return artifact.primary || artifact.role === "verification" || (artifact.role ?? "") === "" && artifact.slug === "verification-md";
|
|
35357
|
+
}
|
|
35358
|
+
async function latestForm(client, artifact) {
|
|
35359
|
+
try {
|
|
35360
|
+
return await client.specForm(artifact.id);
|
|
35361
|
+
} catch (error) {
|
|
35362
|
+
if (dispatchAnswered(error, 409) && error.code === "NO_VERSION")
|
|
35363
|
+
return;
|
|
35364
|
+
throw refusalWithCode(error);
|
|
35365
|
+
}
|
|
35366
|
+
}
|
|
35367
|
+
async function coveredForms(client, artifacts) {
|
|
35368
|
+
return Promise.all(artifacts.filter(playsSpecOrVerification).map(async (artifact) => ({ artifact, form: await latestForm(client, artifact) })));
|
|
35369
|
+
}
|
|
35370
|
+
async function issueForms(client, issue) {
|
|
35371
|
+
const read = await coveredForms(client, (await client.getIssue(issue)).artifacts ?? []);
|
|
35372
|
+
const lines = read.flatMap(({ artifact, form }) => form === undefined ? [noVersionLine(artifact.name)] : [`${form.name} version ${form.version}:`, ...documentLines(form)]);
|
|
35373
|
+
return {
|
|
35374
|
+
text: read.length === 0 ? `${issue} has no spec and no Verification document, so Dispatch read no document.` : lines.join(`
|
|
35375
|
+
`),
|
|
35376
|
+
details: {
|
|
35377
|
+
issue,
|
|
35378
|
+
documents: read.flatMap(({ form }) => form === undefined ? [] : [
|
|
35379
|
+
{
|
|
35380
|
+
artifact: form.artifact_id,
|
|
35381
|
+
version: form.version,
|
|
35382
|
+
scope: form.scope,
|
|
35383
|
+
refuses_approval: form.refuses_approval,
|
|
35384
|
+
findings_total: form.findings_total
|
|
35385
|
+
}
|
|
35386
|
+
])
|
|
35387
|
+
}
|
|
35388
|
+
};
|
|
35389
|
+
}
|
|
35390
|
+
async function rootForms(client, root) {
|
|
35391
|
+
const rootKey = (await client.getIssue(root)).key;
|
|
35392
|
+
const lines = [];
|
|
35393
|
+
const seen = new Set([rootKey]);
|
|
35394
|
+
let documents = 0;
|
|
35395
|
+
let findings = 0;
|
|
35396
|
+
const walk = async (parent, depth) => {
|
|
35397
|
+
const indent = " ".repeat(depth);
|
|
35398
|
+
for (const child of await client.listAllIssues({ parent })) {
|
|
35399
|
+
if (seen.has(child.key))
|
|
35400
|
+
continue;
|
|
35401
|
+
seen.add(child.key);
|
|
35402
|
+
const read = await coveredForms(client, await client.listIssueArtifacts(child.key));
|
|
35403
|
+
const totals = {};
|
|
35404
|
+
let issueFindings = 0;
|
|
35405
|
+
const documentRows = read.map(({ artifact, form }) => {
|
|
35406
|
+
if (form === undefined)
|
|
35407
|
+
return `${indent} ${noVersionLine(artifact.name)}`;
|
|
35408
|
+
documents += 1;
|
|
35409
|
+
issueFindings += form.findings_total;
|
|
35410
|
+
for (const [kind, count] of Object.entries(form.texts ?? {})) {
|
|
35411
|
+
totals[kind] = (totals[kind] ?? 0) + count;
|
|
35412
|
+
}
|
|
35413
|
+
return `${indent} ${form.name} version ${form.version} (scope ${form.scope}): ${textCounts(form.texts)}, with ${counted(form.findings_total, "finding")}.`;
|
|
35414
|
+
});
|
|
35415
|
+
findings += issueFindings;
|
|
35416
|
+
const issueLine = `${indent}${child.key} [${child.status}] ${child.title}`;
|
|
35417
|
+
lines.push(read.length === 0 ? `${issueLine}: no spec and no Verification document.` : `${issueLine}: ${textCounts(totals)}, with ${counted(issueFindings, "finding")}.`, ...documentRows);
|
|
35418
|
+
await walk(child.key, depth + 1);
|
|
35419
|
+
}
|
|
35420
|
+
};
|
|
35421
|
+
await walk(rootKey, 0);
|
|
35422
|
+
const issues = seen.size - 1;
|
|
35423
|
+
return {
|
|
35424
|
+
text: issues === 0 ? `Dispatch found no issue under ${rootKey}, so it read no document.` : [
|
|
35425
|
+
...lines,
|
|
35426
|
+
`Dispatch read ${counted(issues, "issue")} and ${counted(documents, "document")} under ${rootKey}.`
|
|
35427
|
+
].join(`
|
|
35428
|
+
`),
|
|
35429
|
+
details: { root: rootKey, issues, documents, findings }
|
|
35430
|
+
};
|
|
35431
|
+
}
|
|
35432
|
+
async function specFormCommand(context) {
|
|
35433
|
+
const { args, client, ownerArguments, documentOwner, resolveDocument } = context;
|
|
35434
|
+
const root = optionalString(args, "root");
|
|
35435
|
+
if (root !== undefined)
|
|
35436
|
+
return rootForms(client, root);
|
|
35437
|
+
const artifactReference = optionalString(args, "artifact") ?? (ownerArguments.ref?.kind === "spec" || ownerArguments.ref?.kind === "artifact" ? ownerArguments.ref.id : undefined);
|
|
35438
|
+
const owner = documentOwner();
|
|
35439
|
+
if (artifactReference === undefined && owner.kind === "issue") {
|
|
35440
|
+
return issueForms(client, owner.issue);
|
|
35441
|
+
}
|
|
35442
|
+
const resolved = await resolveDocument(owner, artifactReference);
|
|
35443
|
+
const version = optionalNumber(args, "version") ?? ownerArguments.ref?.version;
|
|
35444
|
+
let form;
|
|
35445
|
+
try {
|
|
35446
|
+
form = await client.specForm(resolved.artifact.id, version);
|
|
35447
|
+
} catch (error) {
|
|
35448
|
+
throw refusalWithCode(error);
|
|
35449
|
+
}
|
|
35450
|
+
return {
|
|
35451
|
+
text: documentLines(form).join(`
|
|
35452
|
+
`),
|
|
35453
|
+
details: {
|
|
35454
|
+
...resolved.owner.kind === "project" ? { project: resolved.owner.project } : { issue: resolved.issue?.key },
|
|
35455
|
+
artifact: form.artifact_id,
|
|
35456
|
+
version: form.version,
|
|
35457
|
+
scope: form.scope,
|
|
35458
|
+
refuses_approval: form.refuses_approval,
|
|
35459
|
+
findings_total: form.findings_total
|
|
35460
|
+
}
|
|
35461
|
+
};
|
|
35462
|
+
}
|
|
35463
|
+
|
|
35033
35464
|
// ../envoy-client/src/dispatch-commands/stored-text.ts
|
|
35034
35465
|
import { resolve as resolvePath2 } from "path";
|
|
35035
35466
|
|
|
@@ -35805,18 +36236,19 @@ async function requestApprovalCommand(context) {
|
|
|
35805
36236
|
actor,
|
|
35806
36237
|
summary: stringArg(args, "summary"),
|
|
35807
36238
|
...includeVerification ? { include_verification: true } : {}
|
|
35808
|
-
});
|
|
36239
|
+
}).catch((error) => Promise.reject(refusalWithCode(error)));
|
|
35809
36240
|
const gaps = result.coverage ?? [];
|
|
35810
36241
|
const coverageLines = result.coverage_unread ? [
|
|
35811
36242
|
`Coverage of ${resolved.artifact.name}: unread. Dispatch could not read what the spec's requirements lack, so no line here says there is no gap; the request is recorded either way. Read the coverage again with dispatch read --issue, and mark each requirement the spec states with a requirement block and write a check that serves it, in the issue's Verification document, before the work starts.`
|
|
35812
36243
|
] : gaps.length === 0 ? [] : [
|
|
35813
36244
|
`Coverage of ${resolved.artifact.name}: ${gaps.map((gap) => `${gap}.`).join(" ")} Mark each requirement the spec states with a requirement block and write a check that serves it, in the issue's Verification document, before the work starts.`
|
|
35814
36245
|
];
|
|
36246
|
+
const trailing = [...approvalFormLines(result, resolved.artifact.name), ...coverageLines];
|
|
35815
36247
|
if (result.ask === null) {
|
|
35816
36248
|
return {
|
|
35817
36249
|
text: [
|
|
35818
36250
|
`${resolved.artifact.name} (document id ${resolved.artifact.id}) is already approved at version ${result.version} by ${result.approval.by?.id ?? "unknown"}; no new request was opened. A change outside the decision blocks after approval makes it stale, so request again only for such a version, once the human has agreed to every point in it, with a --summary naming what changed since version ${result.version}; the human's own answer to a decision block carries the approval when that answer is the whole change.`,
|
|
35819
|
-
...
|
|
36251
|
+
...trailing
|
|
35820
36252
|
].join(`
|
|
35821
36253
|
`),
|
|
35822
36254
|
details: {
|
|
@@ -35832,7 +36264,7 @@ async function requestApprovalCommand(context) {
|
|
|
35832
36264
|
return {
|
|
35833
36265
|
text: [
|
|
35834
36266
|
`${outcome}${waitsOn === undefined ? "" : ` It waits on ${waitsOn}.`} The human's Inbox asks: ${JSON.stringify(result.ask.question)}. The answer arrives as artifact.approved or artifact.changes_requested. An edit before the answer moves this request to the new version and leaves it waiting on you, and a change outside the decision blocks after approval makes the approval stale: either way, request again for the new version once the human has agreed to every point in it, which hands this request back or opens a new one, with a --summary naming what changed since the earlier approval. The human's own answer to a decision block carries the approval when that answer is the whole change since the approved version, and answers an open request Approve in their name: request nothing then.`,
|
|
35835
|
-
...
|
|
36267
|
+
...trailing
|
|
35836
36268
|
].join(`
|
|
35837
36269
|
`),
|
|
35838
36270
|
details: { ...details, artifact: resolved.artifact.id, version: result.version }
|
|
@@ -37297,6 +37729,7 @@ var dispatchCommands = {
|
|
|
37297
37729
|
dispatch_send_to_agent: acting(sendToAgentCommand),
|
|
37298
37730
|
dispatch_doc_edit: acting(docEditCommand),
|
|
37299
37731
|
dispatch_doc_read: reading(docReadCommand),
|
|
37732
|
+
dispatch_spec_form: acting(specFormCommand),
|
|
37300
37733
|
dispatch_request_approval: acting(requestApprovalCommand),
|
|
37301
37734
|
dispatch_plan_approve: acting(planApproveCommand),
|
|
37302
37735
|
dispatch_review: acting(reviewCommand),
|