@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/dispatch.js
CHANGED
|
@@ -14811,6 +14811,29 @@ function pathKeepsBytesOf(name) {
|
|
|
14811
14811
|
return extension === undefined || !MARKDOWN_EXTENSION.test(extension);
|
|
14812
14812
|
}
|
|
14813
14813
|
var artifactOwner = documentOwnerValidation(false);
|
|
14814
|
+
var SPEC_FORM_ROOT_RULE = "root walks every issue under that root: name no issue, project, artifact, version or ref with it.";
|
|
14815
|
+
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).";
|
|
14816
|
+
var SPEC_FORM_DOCUMENT_ARGUMENTS = ["issue", "project", "artifact", "version", "ref"];
|
|
14817
|
+
var specFormDocumentOwner = documentOwnerValidation(true);
|
|
14818
|
+
function specFormRefusal(value) {
|
|
14819
|
+
const input = value;
|
|
14820
|
+
if (input["root"] !== undefined) {
|
|
14821
|
+
return SPEC_FORM_DOCUMENT_ARGUMENTS.every((name) => input[name] === undefined) ? undefined : SPEC_FORM_ROOT_RULE;
|
|
14822
|
+
}
|
|
14823
|
+
return brokenParts([
|
|
14824
|
+
[specFormDocumentOwner.check(value), specFormDocumentOwner.message],
|
|
14825
|
+
[
|
|
14826
|
+
input["version"] === undefined || typeof input["artifact"] === "string",
|
|
14827
|
+
SPEC_FORM_VERSION_RULE
|
|
14828
|
+
]
|
|
14829
|
+
]);
|
|
14830
|
+
}
|
|
14831
|
+
var SPEC_FORM_RULE = `${specFormDocumentOwner.message} ${SPEC_FORM_VERSION_RULE} ${SPEC_FORM_ROOT_RULE}`;
|
|
14832
|
+
var specFormValidation = {
|
|
14833
|
+
check: (value) => specFormRefusal(value) === undefined,
|
|
14834
|
+
message: SPEC_FORM_RULE,
|
|
14835
|
+
refusal: (value) => specFormRefusal(value) ?? SPEC_FORM_RULE
|
|
14836
|
+
};
|
|
14814
14837
|
function artifactProblem(value) {
|
|
14815
14838
|
const input = value;
|
|
14816
14839
|
const extension = typeof input.path === "string" || typeof input.name !== "string" ? undefined : NAME_EXTENSION.exec(input.name.trim())?.[1];
|
|
@@ -15619,6 +15642,20 @@ var dispatchToolSpecs = [
|
|
|
15619
15642
|
}),
|
|
15620
15643
|
validation: documentOwnerValidation(true)
|
|
15621
15644
|
},
|
|
15645
|
+
{
|
|
15646
|
+
name: "dispatch_spec_form",
|
|
15647
|
+
example: { issue: "DSP-1" },
|
|
15648
|
+
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.",
|
|
15649
|
+
arguments: (z) => ({
|
|
15650
|
+
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
15651
|
+
project: z.string().describe("Project key owning the document.").optional(),
|
|
15652
|
+
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(),
|
|
15653
|
+
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(),
|
|
15654
|
+
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(),
|
|
15655
|
+
ref: z.string().describe("Optional dispatch:// document reference.").optional()
|
|
15656
|
+
}),
|
|
15657
|
+
validation: specFormValidation
|
|
15658
|
+
},
|
|
15622
15659
|
{
|
|
15623
15660
|
name: "dispatch_request_approval",
|
|
15624
15661
|
example: { issue: "DSP-1", summary: "A live sync replaces the nightly export." },
|
|
@@ -16920,7 +16957,134 @@ function claimTakeableAt(liveness, lastSeen = undefined) {
|
|
|
16920
16957
|
}
|
|
16921
16958
|
return new Date(seen + ISSUE_CLAIM_UNRESPONSIVE_GRACE_MS).toISOString();
|
|
16922
16959
|
}
|
|
16960
|
+
// ../contracts/src/dashboard-pages.json
|
|
16961
|
+
var dashboard_pages_default = {
|
|
16962
|
+
about: "Generated from the dashboard's route table by packages/dispatch/web/src/features/refs/dashboard-pages-file.ts; do not edit.",
|
|
16963
|
+
tabs: [
|
|
16964
|
+
{
|
|
16965
|
+
page: "verification",
|
|
16966
|
+
reference: "verification"
|
|
16967
|
+
},
|
|
16968
|
+
{
|
|
16969
|
+
page: "plan",
|
|
16970
|
+
reference: "plan"
|
|
16971
|
+
},
|
|
16972
|
+
{
|
|
16973
|
+
page: "steps",
|
|
16974
|
+
reference: "steps"
|
|
16975
|
+
},
|
|
16976
|
+
{
|
|
16977
|
+
page: "conversation",
|
|
16978
|
+
reference: "log"
|
|
16979
|
+
},
|
|
16980
|
+
{
|
|
16981
|
+
page: "children",
|
|
16982
|
+
reference: "children"
|
|
16983
|
+
},
|
|
16984
|
+
{
|
|
16985
|
+
page: "artifacts",
|
|
16986
|
+
reference: "artifacts"
|
|
16987
|
+
},
|
|
16988
|
+
{
|
|
16989
|
+
page: "activity",
|
|
16990
|
+
reference: "activity"
|
|
16991
|
+
},
|
|
16992
|
+
{
|
|
16993
|
+
page: "collaborators",
|
|
16994
|
+
reference: "collaborators"
|
|
16995
|
+
}
|
|
16996
|
+
],
|
|
16997
|
+
document_segments: [
|
|
16998
|
+
"artifacts",
|
|
16999
|
+
"artifact"
|
|
17000
|
+
],
|
|
17001
|
+
document_pages: {
|
|
17002
|
+
primary: [
|
|
17003
|
+
"/issues/{key}",
|
|
17004
|
+
"/issues/{key}/spec",
|
|
17005
|
+
"/issues/{key}/artifacts/{slug}",
|
|
17006
|
+
"/issues/{key}/artifact/{slug}"
|
|
17007
|
+
],
|
|
17008
|
+
verification: [
|
|
17009
|
+
"/issues/{key}/verification",
|
|
17010
|
+
"/issues/{key}/artifacts/{slug}",
|
|
17011
|
+
"/issues/{key}/artifact/{slug}"
|
|
17012
|
+
],
|
|
17013
|
+
plan: [
|
|
17014
|
+
"/issues/{key}/plan",
|
|
17015
|
+
"/issues/{key}/artifacts/{slug}",
|
|
17016
|
+
"/issues/{key}/artifact/{slug}"
|
|
17017
|
+
],
|
|
17018
|
+
decisions: [
|
|
17019
|
+
"/issues/{key}/decisions",
|
|
17020
|
+
"/issues/{key}/artifacts/{slug}",
|
|
17021
|
+
"/issues/{key}/artifact/{slug}"
|
|
17022
|
+
],
|
|
17023
|
+
issue: [
|
|
17024
|
+
"/issues/{key}/artifacts/{slug}",
|
|
17025
|
+
"/issues/{key}/artifact/{slug}"
|
|
17026
|
+
],
|
|
17027
|
+
project: [
|
|
17028
|
+
"/projects/{project}/documents/{slug}"
|
|
17029
|
+
],
|
|
17030
|
+
agent: [
|
|
17031
|
+
"/agents/{session}/artifacts/{slug}"
|
|
17032
|
+
]
|
|
17033
|
+
},
|
|
17034
|
+
references: [
|
|
17035
|
+
{
|
|
17036
|
+
href: "/issues/CORE-1/verification",
|
|
17037
|
+
ref: "dispatch://CORE-1/verification"
|
|
17038
|
+
},
|
|
17039
|
+
{
|
|
17040
|
+
href: "/issues/CORE-1/plan",
|
|
17041
|
+
ref: "dispatch://CORE-1/plan"
|
|
17042
|
+
},
|
|
17043
|
+
{
|
|
17044
|
+
href: "/issues/CORE-1/steps",
|
|
17045
|
+
ref: "dispatch://CORE-1/steps"
|
|
17046
|
+
},
|
|
17047
|
+
{
|
|
17048
|
+
href: "/issues/CORE-1/conversation",
|
|
17049
|
+
ref: "dispatch://CORE-1/log"
|
|
17050
|
+
},
|
|
17051
|
+
{
|
|
17052
|
+
href: "/issues/CORE-1/children",
|
|
17053
|
+
ref: "dispatch://CORE-1/children"
|
|
17054
|
+
},
|
|
17055
|
+
{
|
|
17056
|
+
href: "/issues/CORE-1/artifacts",
|
|
17057
|
+
ref: "dispatch://CORE-1/artifacts"
|
|
17058
|
+
},
|
|
17059
|
+
{
|
|
17060
|
+
href: "/issues/CORE-1/activity",
|
|
17061
|
+
ref: "dispatch://CORE-1/activity"
|
|
17062
|
+
},
|
|
17063
|
+
{
|
|
17064
|
+
href: "/issues/CORE-1/collaborators",
|
|
17065
|
+
ref: "dispatch://CORE-1/collaborators"
|
|
17066
|
+
},
|
|
17067
|
+
{
|
|
17068
|
+
href: "/issues/CORE-1/artifacts/notes-md",
|
|
17069
|
+
ref: "dispatch://CORE-1/artifact/notes-md"
|
|
17070
|
+
},
|
|
17071
|
+
{
|
|
17072
|
+
href: "/issues/CORE-1/artifacts/notes-md?v=2",
|
|
17073
|
+
ref: "dispatch://CORE-1/artifact/notes-md@v2"
|
|
17074
|
+
},
|
|
17075
|
+
{
|
|
17076
|
+
href: "/issues/CORE-1/artifact/notes-md",
|
|
17077
|
+
ref: "dispatch://CORE-1/artifact/notes-md"
|
|
17078
|
+
},
|
|
17079
|
+
{
|
|
17080
|
+
href: "/issues/CORE-1/artifact/notes-md?v=2",
|
|
17081
|
+
ref: "dispatch://CORE-1/artifact/notes-md@v2"
|
|
17082
|
+
}
|
|
17083
|
+
]
|
|
17084
|
+
};
|
|
17085
|
+
|
|
16923
17086
|
// ../contracts/src/dispatch-href.ts
|
|
17087
|
+
var DISPATCH_DASHBOARD_PAGES = dashboard_pages_default;
|
|
16924
17088
|
function hasControlCharacter(value) {
|
|
16925
17089
|
return /\p{Cc}/u.test(value);
|
|
16926
17090
|
}
|
|
@@ -16949,6 +17113,102 @@ function itemFromSearch(search) {
|
|
|
16949
17113
|
}
|
|
16950
17114
|
return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
|
|
16951
17115
|
}
|
|
17116
|
+
var DISPATCH_HREF_REFERENCES = [
|
|
17117
|
+
...DISPATCH_DASHBOARD_PAGES.references,
|
|
17118
|
+
{ href: "/issues/CORE-1", ref: "dispatch://CORE-1" },
|
|
17119
|
+
{ href: "/issues/CORE-1/spec", ref: "dispatch://CORE-1/spec" },
|
|
17120
|
+
{
|
|
17121
|
+
href: "/issues/CORE-1/decisions",
|
|
17122
|
+
ref: "dispatch://CORE-1/artifact/decisions-md"
|
|
17123
|
+
},
|
|
17124
|
+
{
|
|
17125
|
+
href: "/issues/CORE-1/decisions#b-ship-it",
|
|
17126
|
+
ref: "dispatch://CORE-1/artifact/decisions-md"
|
|
17127
|
+
},
|
|
17128
|
+
{
|
|
17129
|
+
href: "/issues/CORE-1/comments/11111111-1111-4111-8111-111111111111",
|
|
17130
|
+
ref: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111"
|
|
17131
|
+
},
|
|
17132
|
+
{
|
|
17133
|
+
href: "/issues/CORE-1/asks/22222222-2222-4222-8222-222222222222",
|
|
17134
|
+
ref: "dispatch://CORE-1/ask/22222222-2222-4222-8222-222222222222"
|
|
17135
|
+
},
|
|
17136
|
+
{
|
|
17137
|
+
href: "/issues/CORE-1/messages/33333333-3333-4333-8333-333333333333",
|
|
17138
|
+
ref: "dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333"
|
|
17139
|
+
},
|
|
17140
|
+
{
|
|
17141
|
+
href: "/issues/CORE-1/spec?comment=44444444-4444-4444-8444-444444444444",
|
|
17142
|
+
ref: "dispatch://CORE-1/comment/44444444-4444-4444-8444-444444444444"
|
|
17143
|
+
},
|
|
17144
|
+
{
|
|
17145
|
+
href: "/issues/CORE-1/artifacts/notes-md?comment=55555555-5555-4555-8555-555555555555",
|
|
17146
|
+
ref: "dispatch://CORE-1/comment/55555555-5555-4555-8555-555555555555"
|
|
17147
|
+
},
|
|
17148
|
+
{
|
|
17149
|
+
href: "/issues/CORE-1/spec?ask=66666666-6666-4666-8666-666666666666",
|
|
17150
|
+
ref: "dispatch://CORE-1/ask/66666666-6666-4666-8666-666666666666"
|
|
17151
|
+
},
|
|
17152
|
+
{
|
|
17153
|
+
href: "/issues/CORE-1/artifacts/notes-md?ask=77777777-7777-4777-8777-777777777777",
|
|
17154
|
+
ref: "dispatch://CORE-1/ask/77777777-7777-4777-8777-777777777777"
|
|
17155
|
+
},
|
|
17156
|
+
{
|
|
17157
|
+
href: "/projects/CORE/documents/handbook-md",
|
|
17158
|
+
ref: "dispatch://CORE/artifact/handbook-md"
|
|
17159
|
+
},
|
|
17160
|
+
{
|
|
17161
|
+
href: "/projects/CORE/documents/handbook-md?comment=88888888-8888-4888-8888-888888888888",
|
|
17162
|
+
ref: "dispatch://CORE/artifact/handbook-md/comment/88888888-8888-4888-8888-888888888888"
|
|
17163
|
+
},
|
|
17164
|
+
{
|
|
17165
|
+
href: "/projects/CORE/documents/handbook-md?ask=99999999-9999-4999-8999-999999999999",
|
|
17166
|
+
ref: "dispatch://CORE/artifact/handbook-md/ask/99999999-9999-4999-8999-999999999999"
|
|
17167
|
+
},
|
|
17168
|
+
{ href: "/issues/CORE-1/spec#b-ship-it", ref: "dispatch://CORE-1/spec#b-ship-it" },
|
|
17169
|
+
{
|
|
17170
|
+
href: "/issues/CORE-1/artifacts/notes-md#b-ship-it",
|
|
17171
|
+
ref: "dispatch://CORE-1/artifact/notes-md#b-ship-it"
|
|
17172
|
+
},
|
|
17173
|
+
{
|
|
17174
|
+
href: "/projects/CORE/documents/handbook-md#b-ship-it",
|
|
17175
|
+
ref: "dispatch://CORE/artifact/handbook-md#b-ship-it"
|
|
17176
|
+
},
|
|
17177
|
+
{
|
|
17178
|
+
href: "/issues/CORE-1/comments/11111111-1111-4111-8111-111111111111#b-b2",
|
|
17179
|
+
ref: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111#b-b2"
|
|
17180
|
+
},
|
|
17181
|
+
{
|
|
17182
|
+
href: "/issues/CORE-1/messages/33333333-3333-4333-8333-333333333333#b-b2",
|
|
17183
|
+
ref: "dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333#b-b2"
|
|
17184
|
+
},
|
|
17185
|
+
{
|
|
17186
|
+
href: "/issues/CORE-1/asks/22222222-2222-4222-8222-222222222222#b-b3",
|
|
17187
|
+
ref: "dispatch://CORE-1/ask/22222222-2222-4222-8222-222222222222#b-b3"
|
|
17188
|
+
},
|
|
17189
|
+
{
|
|
17190
|
+
href: "/projects/CORE/documents/handbook-md?comment=88888888-8888-4888-8888-888888888888#b-b2",
|
|
17191
|
+
ref: "dispatch://CORE/artifact/handbook-md/comment/88888888-8888-4888-8888-888888888888"
|
|
17192
|
+
},
|
|
17193
|
+
{
|
|
17194
|
+
href: "/projects/CORE/documents/handbook-md?ask=99999999-9999-4999-8999-999999999999#b-b2",
|
|
17195
|
+
ref: "dispatch://CORE/artifact/handbook-md/ask/99999999-9999-4999-8999-999999999999"
|
|
17196
|
+
},
|
|
17197
|
+
{
|
|
17198
|
+
href: "/issues/CORE-1/spec#b-d%C3%A9cision%3A1",
|
|
17199
|
+
ref: "dispatch://CORE-1/spec#b-d%C3%A9cision%3A1"
|
|
17200
|
+
},
|
|
17201
|
+
{ href: "/issues/CORE-1/spec#top", ref: "dispatch://CORE-1/spec" },
|
|
17202
|
+
{ href: "/issues/CORE-1/spec?v=2#b-ship-it", ref: "dispatch://CORE-1/artifact/spec@v2" },
|
|
17203
|
+
{
|
|
17204
|
+
href: "/issues/CORE-1/artifacts/notes-md?v=2#b-ship-it",
|
|
17205
|
+
ref: "dispatch://CORE-1/artifact/notes-md@v2"
|
|
17206
|
+
},
|
|
17207
|
+
{
|
|
17208
|
+
href: "/projects/CORE/documents/handbook-md?version=3#b-ship-it",
|
|
17209
|
+
ref: "dispatch://CORE/artifact/handbook-md@v3"
|
|
17210
|
+
}
|
|
17211
|
+
];
|
|
16952
17212
|
|
|
16953
17213
|
// ../contracts/src/dispatch-block-ref.ts
|
|
16954
17214
|
var encoder = new TextEncoder;
|
|
@@ -24528,6 +24788,9 @@ class DispatchClient {
|
|
|
24528
24788
|
async docRead(id, version, read = {}) {
|
|
24529
24789
|
return version === undefined ? this.#read(["api", "v1", "artifacts", id, "text"], undefined, read) : this.#read(["api", "v1", "artifacts", id, "versions", String(version)], undefined, read);
|
|
24530
24790
|
}
|
|
24791
|
+
async specForm(id, version) {
|
|
24792
|
+
return this.#json("GET", ["api", "v1", "artifacts", id, "spec-form"], undefined, version === undefined ? undefined : { version });
|
|
24793
|
+
}
|
|
24531
24794
|
async docReadWithBlocks(id, read = {}) {
|
|
24532
24795
|
return this.#read(["api", "v1", "artifacts", id, "text"], { blocks: true }, read);
|
|
24533
24796
|
}
|
|
@@ -25209,6 +25472,11 @@ ${issueReference}`;
|
|
|
25209
25472
|
}
|
|
25210
25473
|
|
|
25211
25474
|
// ../envoy-client/src/dispatch-commands/links.ts
|
|
25475
|
+
var issueTabReferences = new Map([
|
|
25476
|
+
...DISPATCH_DASHBOARD_PAGES.tabs.map(({ page, reference }) => [page, reference]),
|
|
25477
|
+
["log", "log"]
|
|
25478
|
+
]);
|
|
25479
|
+
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/([^/]+))?/?$`);
|
|
25212
25480
|
function dispatchRefFromUrl(value, serverUrl) {
|
|
25213
25481
|
let url;
|
|
25214
25482
|
let origin;
|
|
@@ -25228,7 +25496,7 @@ function dispatchRefFromUrl(value, serverUrl) {
|
|
|
25228
25496
|
const id = url.hash.startsWith("#b-") ? decodeBlockId(url.hash.slice(3)) : undefined;
|
|
25229
25497
|
return id === undefined || versionName !== undefined && url.searchParams.get(versionName) ? "" : `#b-${encodeBlockId(id)}`;
|
|
25230
25498
|
};
|
|
25231
|
-
const issuePage = url.pathname.match(
|
|
25499
|
+
const issuePage = url.pathname.match(issuePagePattern);
|
|
25232
25500
|
if (issuePage) {
|
|
25233
25501
|
const [, key = "", page, artifact, ask, comment, message] = issuePage;
|
|
25234
25502
|
const version = versionOf("v");
|
|
@@ -25246,7 +25514,7 @@ function dispatchRefFromUrl(value, serverUrl) {
|
|
|
25246
25514
|
if (page === "decisions")
|
|
25247
25515
|
return `dispatch://${key}/artifact/decisions-md`;
|
|
25248
25516
|
if (page !== undefined)
|
|
25249
|
-
return `dispatch://${key}/${page
|
|
25517
|
+
return `dispatch://${key}/${issueTabReferences.get(page) ?? page}`;
|
|
25250
25518
|
if (artifact !== undefined) {
|
|
25251
25519
|
const slug = decodeURIComponent(artifact);
|
|
25252
25520
|
return `dispatch://${key}/artifact/${slug}${version}${blockOf("v")}`;
|
|
@@ -31427,6 +31695,8 @@ function withEditedMark(words, at) {
|
|
|
31427
31695
|
}
|
|
31428
31696
|
|
|
31429
31697
|
// ../envoy-client/src/dispatch-owner.ts
|
|
31698
|
+
var issueViewReferences = DISPATCH_DASHBOARD_PAGES.tabs.map(({ reference }) => reference).filter((reference) => !["log", "activity", "children"].includes(reference));
|
|
31699
|
+
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/([^/]+))?$`);
|
|
31430
31700
|
function documentLabel(project, slug) {
|
|
31431
31701
|
return `${project}/${slug}`;
|
|
31432
31702
|
}
|
|
@@ -31519,10 +31789,10 @@ function parseDispatchRef(ref) {
|
|
|
31519
31789
|
artifact
|
|
31520
31790
|
};
|
|
31521
31791
|
}
|
|
31522
|
-
const issueReference = ref.match(
|
|
31792
|
+
const issueReference = ref.match(issueReferencePattern);
|
|
31523
31793
|
if (!issueReference)
|
|
31524
31794
|
return null;
|
|
31525
|
-
const [, issue, spec, log, children, comments, artifact, version, ask, comment, message] = issueReference;
|
|
31795
|
+
const [, issue, spec, log, children, comments, tab, artifact, version, ask, comment, message] = issueReference;
|
|
31526
31796
|
if (!issue || version !== undefined && Number(version) < 1)
|
|
31527
31797
|
return null;
|
|
31528
31798
|
const owner = { kind: "issue", issue };
|
|
@@ -31534,6 +31804,8 @@ function parseDispatchRef(ref) {
|
|
|
31534
31804
|
return { owner, kind: "children", id: children };
|
|
31535
31805
|
if (comments)
|
|
31536
31806
|
return { owner, kind: "comments", id: comments };
|
|
31807
|
+
if (tab)
|
|
31808
|
+
return { owner, kind: "tab", id: tab };
|
|
31537
31809
|
if (artifact) {
|
|
31538
31810
|
return {
|
|
31539
31811
|
owner,
|
|
@@ -35249,18 +35521,18 @@ function itemReplyTo(args, field) {
|
|
|
35249
35521
|
return block === undefined ? { id: replyTo } : { id: block.item.id, block: block.block };
|
|
35250
35522
|
}
|
|
35251
35523
|
function innerRefProblem(tool, ref, refText) {
|
|
35252
|
-
if (ref.kind !== "ask" && ref.kind !== "comment" && ref.kind !== "message" && ref.kind !== "log" && ref.kind !== "children" && ref.kind !== "comments" && ref.kind !== "block") {
|
|
35524
|
+
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") {
|
|
35253
35525
|
return;
|
|
35254
35526
|
}
|
|
35255
35527
|
if (tool === "dispatch_read" || tool === "dispatch_ask")
|
|
35256
35528
|
return;
|
|
35257
35529
|
const owner = refOwnerName(ref);
|
|
35258
35530
|
const itemKind = ref.item?.kind ?? ref.kind;
|
|
35259
|
-
const documentArgument = ref.kind === "block" && ref.item === undefined && tool !== "dispatch_comment" ? ` and artifact ${ref.id}` : tool === "dispatch_suggest" ? " and artifact <the document's slug>" : "";
|
|
35531
|
+
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>" : "";
|
|
35260
35532
|
const ownerArguments = ref.owner.kind === "issue" ? `issue ${ref.owner.issue}${documentArgument}` : `project ${ref.owner.project} and artifact ${ref.artifact}`;
|
|
35261
35533
|
const partRef = ref.pin === undefined ? refText : refText.slice(0, -`@v${ref.pin}`.length);
|
|
35262
35534
|
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}`;
|
|
35263
|
-
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}`;
|
|
35535
|
+
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}`;
|
|
35264
35536
|
return `ref ${refText} names ${item} on ${owner}; dispatch ${commandName(tool)} would act on ${owner} and drop the ${ref.kind}: ${fix}`;
|
|
35265
35537
|
}
|
|
35266
35538
|
var documentItemPattern = /^dispatch:\/\/([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)\/artifact\/[^/@]+(?:@v\d+)?\/(ask|comment)\/([^/]+)$/;
|
|
@@ -35621,6 +35893,9 @@ async function resolveOwnerArguments(tool, input, cwd, env, exec, dashboardUrls,
|
|
|
35621
35893
|
if (tool === "dispatch_result" && typeof retract === "string") {
|
|
35622
35894
|
return { args, ref, owner: null };
|
|
35623
35895
|
}
|
|
35896
|
+
if (tool === "dispatch_spec_form" && typeof args["root"] === "string") {
|
|
35897
|
+
return { args, ref, owner: null };
|
|
35898
|
+
}
|
|
35624
35899
|
const legionIssue = env.LEGION_ISSUE;
|
|
35625
35900
|
if (!legionIssue) {
|
|
35626
35901
|
problems.push(ownerRequiredProblem);
|
|
@@ -38490,6 +38765,162 @@ async function refuseRemovingOpenDecisionBlocks(client, tool, resolved, ops) {
|
|
|
38490
38765
|
`));
|
|
38491
38766
|
}
|
|
38492
38767
|
|
|
38768
|
+
// ../envoy-client/src/dispatch-commands/spec-form.ts
|
|
38769
|
+
function counted(count, noun) {
|
|
38770
|
+
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
38771
|
+
}
|
|
38772
|
+
function textCounts(texts) {
|
|
38773
|
+
const of = (kind) => texts?.[kind] ?? 0;
|
|
38774
|
+
return `${counted(of("statement"), "statement")}, ${counted(of("claim"), "claim")}, ${counted(of("purpose"), "purpose")} and ${counted(of("definition"), "definition")}`;
|
|
38775
|
+
}
|
|
38776
|
+
function readLine3(texts, name, version) {
|
|
38777
|
+
const read = Object.values(texts ?? {}).reduce((sum, count) => sum + count, 0);
|
|
38778
|
+
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.`;
|
|
38779
|
+
}
|
|
38780
|
+
function unreadLines(unread) {
|
|
38781
|
+
return (unread ?? []).map(({ line }) => line);
|
|
38782
|
+
}
|
|
38783
|
+
function approvalFormLines(result, name) {
|
|
38784
|
+
const form = result.spec_form;
|
|
38785
|
+
return form === undefined ? [] : [readLine3(form.texts, name, result.version), ...unreadLines(form.unread)];
|
|
38786
|
+
}
|
|
38787
|
+
function scopeLine(form) {
|
|
38788
|
+
switch (form.scope) {
|
|
38789
|
+
case "no_root":
|
|
38790
|
+
return "This server names no root of The Spec, so Dispatch refuses no approval request for its form.";
|
|
38791
|
+
case "outside":
|
|
38792
|
+
return `${form.name} is not under a root of The Spec, so Dispatch refuses no approval request of it for its form.`;
|
|
38793
|
+
case "not_spec":
|
|
38794
|
+
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.`;
|
|
38795
|
+
case "root":
|
|
38796
|
+
return `${form.name} belongs to a root of The Spec, so Dispatch refuses no approval request of it for its form.`;
|
|
38797
|
+
default:
|
|
38798
|
+
return `${form.name} has the scope ${form.scope}, so Dispatch refuses no approval request of it for its form.`;
|
|
38799
|
+
}
|
|
38800
|
+
}
|
|
38801
|
+
function documentLines(form) {
|
|
38802
|
+
const listed = form.finding_lines ?? [];
|
|
38803
|
+
const read = readLine3(form.texts, form.name, form.version);
|
|
38804
|
+
const unread = unreadLines(form.unread);
|
|
38805
|
+
if (!form.in_scope) {
|
|
38806
|
+
return form.findings_total === 0 ? [scopeLine(form), read, ...unread] : [scopeLine(form), "The findings below are for you to read.", ...listed, ...unread];
|
|
38807
|
+
}
|
|
38808
|
+
return form.findings_total === 0 ? [read, ...unread] : [...listed, ...unread];
|
|
38809
|
+
}
|
|
38810
|
+
function noVersionLine(name) {
|
|
38811
|
+
return `${name} has no version yet, so Dispatch read no text in it.`;
|
|
38812
|
+
}
|
|
38813
|
+
function playsSpecOrVerification(artifact) {
|
|
38814
|
+
if (artifact.kind !== "doc" || typeof artifact.issue_key !== "string")
|
|
38815
|
+
return false;
|
|
38816
|
+
return artifact.primary || artifact.role === "verification" || (artifact.role ?? "") === "" && artifact.slug === "verification-md";
|
|
38817
|
+
}
|
|
38818
|
+
async function latestForm(client, artifact) {
|
|
38819
|
+
try {
|
|
38820
|
+
return await client.specForm(artifact.id);
|
|
38821
|
+
} catch (error) {
|
|
38822
|
+
if (dispatchAnswered(error, 409) && error.code === "NO_VERSION")
|
|
38823
|
+
return;
|
|
38824
|
+
throw refusalWithCode(error);
|
|
38825
|
+
}
|
|
38826
|
+
}
|
|
38827
|
+
async function coveredForms(client, artifacts) {
|
|
38828
|
+
return Promise.all(artifacts.filter(playsSpecOrVerification).map(async (artifact) => ({ artifact, form: await latestForm(client, artifact) })));
|
|
38829
|
+
}
|
|
38830
|
+
async function issueForms(client, issue) {
|
|
38831
|
+
const read = await coveredForms(client, (await client.getIssue(issue)).artifacts ?? []);
|
|
38832
|
+
const lines = read.flatMap(({ artifact, form }) => form === undefined ? [noVersionLine(artifact.name)] : [`${form.name} version ${form.version}:`, ...documentLines(form)]);
|
|
38833
|
+
return {
|
|
38834
|
+
text: read.length === 0 ? `${issue} has no spec and no Verification document, so Dispatch read no document.` : lines.join(`
|
|
38835
|
+
`),
|
|
38836
|
+
details: {
|
|
38837
|
+
issue,
|
|
38838
|
+
documents: read.flatMap(({ form }) => form === undefined ? [] : [
|
|
38839
|
+
{
|
|
38840
|
+
artifact: form.artifact_id,
|
|
38841
|
+
version: form.version,
|
|
38842
|
+
scope: form.scope,
|
|
38843
|
+
refuses_approval: form.refuses_approval,
|
|
38844
|
+
findings_total: form.findings_total
|
|
38845
|
+
}
|
|
38846
|
+
])
|
|
38847
|
+
}
|
|
38848
|
+
};
|
|
38849
|
+
}
|
|
38850
|
+
async function rootForms(client, root) {
|
|
38851
|
+
const rootKey = (await client.getIssue(root)).key;
|
|
38852
|
+
const lines = [];
|
|
38853
|
+
const seen = new Set([rootKey]);
|
|
38854
|
+
let documents = 0;
|
|
38855
|
+
let findings = 0;
|
|
38856
|
+
const walk = async (parent, depth) => {
|
|
38857
|
+
const indent = " ".repeat(depth);
|
|
38858
|
+
for (const child of await client.listAllIssues({ parent })) {
|
|
38859
|
+
if (seen.has(child.key))
|
|
38860
|
+
continue;
|
|
38861
|
+
seen.add(child.key);
|
|
38862
|
+
const read = await coveredForms(client, await client.listIssueArtifacts(child.key));
|
|
38863
|
+
const totals = {};
|
|
38864
|
+
let issueFindings = 0;
|
|
38865
|
+
const documentRows = read.map(({ artifact, form }) => {
|
|
38866
|
+
if (form === undefined)
|
|
38867
|
+
return `${indent} ${noVersionLine(artifact.name)}`;
|
|
38868
|
+
documents += 1;
|
|
38869
|
+
issueFindings += form.findings_total;
|
|
38870
|
+
for (const [kind, count] of Object.entries(form.texts ?? {})) {
|
|
38871
|
+
totals[kind] = (totals[kind] ?? 0) + count;
|
|
38872
|
+
}
|
|
38873
|
+
return `${indent} ${form.name} version ${form.version} (scope ${form.scope}): ${textCounts(form.texts)}, with ${counted(form.findings_total, "finding")}.`;
|
|
38874
|
+
});
|
|
38875
|
+
findings += issueFindings;
|
|
38876
|
+
const issueLine = `${indent}${child.key} [${child.status}] ${child.title}`;
|
|
38877
|
+
lines.push(read.length === 0 ? `${issueLine}: no spec and no Verification document.` : `${issueLine}: ${textCounts(totals)}, with ${counted(issueFindings, "finding")}.`, ...documentRows);
|
|
38878
|
+
await walk(child.key, depth + 1);
|
|
38879
|
+
}
|
|
38880
|
+
};
|
|
38881
|
+
await walk(rootKey, 0);
|
|
38882
|
+
const issues = seen.size - 1;
|
|
38883
|
+
return {
|
|
38884
|
+
text: issues === 0 ? `Dispatch found no issue under ${rootKey}, so it read no document.` : [
|
|
38885
|
+
...lines,
|
|
38886
|
+
`Dispatch read ${counted(issues, "issue")} and ${counted(documents, "document")} under ${rootKey}.`
|
|
38887
|
+
].join(`
|
|
38888
|
+
`),
|
|
38889
|
+
details: { root: rootKey, issues, documents, findings }
|
|
38890
|
+
};
|
|
38891
|
+
}
|
|
38892
|
+
async function specFormCommand(context) {
|
|
38893
|
+
const { args, client, ownerArguments, documentOwner, resolveDocument } = context;
|
|
38894
|
+
const root = optionalString(args, "root");
|
|
38895
|
+
if (root !== undefined)
|
|
38896
|
+
return rootForms(client, root);
|
|
38897
|
+
const artifactReference = optionalString(args, "artifact") ?? (ownerArguments.ref?.kind === "spec" || ownerArguments.ref?.kind === "artifact" ? ownerArguments.ref.id : undefined);
|
|
38898
|
+
const owner = documentOwner();
|
|
38899
|
+
if (artifactReference === undefined && owner.kind === "issue") {
|
|
38900
|
+
return issueForms(client, owner.issue);
|
|
38901
|
+
}
|
|
38902
|
+
const resolved = await resolveDocument(owner, artifactReference);
|
|
38903
|
+
const version = optionalNumber(args, "version") ?? ownerArguments.ref?.version;
|
|
38904
|
+
let form;
|
|
38905
|
+
try {
|
|
38906
|
+
form = await client.specForm(resolved.artifact.id, version);
|
|
38907
|
+
} catch (error) {
|
|
38908
|
+
throw refusalWithCode(error);
|
|
38909
|
+
}
|
|
38910
|
+
return {
|
|
38911
|
+
text: documentLines(form).join(`
|
|
38912
|
+
`),
|
|
38913
|
+
details: {
|
|
38914
|
+
...resolved.owner.kind === "project" ? { project: resolved.owner.project } : { issue: resolved.issue?.key },
|
|
38915
|
+
artifact: form.artifact_id,
|
|
38916
|
+
version: form.version,
|
|
38917
|
+
scope: form.scope,
|
|
38918
|
+
refuses_approval: form.refuses_approval,
|
|
38919
|
+
findings_total: form.findings_total
|
|
38920
|
+
}
|
|
38921
|
+
};
|
|
38922
|
+
}
|
|
38923
|
+
|
|
38493
38924
|
// ../envoy-client/src/dispatch-commands/stored-text.ts
|
|
38494
38925
|
import { resolve as resolvePath2 } from "path";
|
|
38495
38926
|
|
|
@@ -39095,18 +39526,19 @@ async function requestApprovalCommand(context) {
|
|
|
39095
39526
|
actor,
|
|
39096
39527
|
summary: stringArg(args, "summary"),
|
|
39097
39528
|
...includeVerification ? { include_verification: true } : {}
|
|
39098
|
-
});
|
|
39529
|
+
}).catch((error) => Promise.reject(refusalWithCode(error)));
|
|
39099
39530
|
const gaps = result.coverage ?? [];
|
|
39100
39531
|
const coverageLines = result.coverage_unread ? [
|
|
39101
39532
|
`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.`
|
|
39102
39533
|
] : gaps.length === 0 ? [] : [
|
|
39103
39534
|
`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.`
|
|
39104
39535
|
];
|
|
39536
|
+
const trailing = [...approvalFormLines(result, resolved.artifact.name), ...coverageLines];
|
|
39105
39537
|
if (result.ask === null) {
|
|
39106
39538
|
return {
|
|
39107
39539
|
text: [
|
|
39108
39540
|
`${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.`,
|
|
39109
|
-
...
|
|
39541
|
+
...trailing
|
|
39110
39542
|
].join(`
|
|
39111
39543
|
`),
|
|
39112
39544
|
details: {
|
|
@@ -39122,7 +39554,7 @@ async function requestApprovalCommand(context) {
|
|
|
39122
39554
|
return {
|
|
39123
39555
|
text: [
|
|
39124
39556
|
`${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.`,
|
|
39125
|
-
...
|
|
39557
|
+
...trailing
|
|
39126
39558
|
].join(`
|
|
39127
39559
|
`),
|
|
39128
39560
|
details: { ...details, artifact: resolved.artifact.id, version: result.version }
|
|
@@ -40587,6 +41019,7 @@ var dispatchCommands = {
|
|
|
40587
41019
|
dispatch_send_to_agent: acting(sendToAgentCommand),
|
|
40588
41020
|
dispatch_doc_edit: acting(docEditCommand),
|
|
40589
41021
|
dispatch_doc_read: reading(docReadCommand),
|
|
41022
|
+
dispatch_spec_form: acting(specFormCommand),
|
|
40590
41023
|
dispatch_request_approval: acting(requestApprovalCommand),
|
|
40591
41024
|
dispatch_plan_approve: acting(planApproveCommand),
|
|
40592
41025
|
dispatch_review: acting(reviewCommand),
|