@sjawhar/claude-envoy 6.24.0 → 6.25.1
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/skills/dispatch/SKILL.md +1 -1
package/dist/envoy-channel.js
CHANGED
|
@@ -37011,6 +37011,29 @@ function pathKeepsBytesOf(name) {
|
|
|
37011
37011
|
return extension === undefined || !MARKDOWN_EXTENSION.test(extension);
|
|
37012
37012
|
}
|
|
37013
37013
|
var artifactOwner = documentOwnerValidation(false);
|
|
37014
|
+
var SPEC_FORM_ROOT_RULE = "root walks every issue under that root: name no issue, project, artifact, version or ref with it.";
|
|
37015
|
+
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).";
|
|
37016
|
+
var SPEC_FORM_DOCUMENT_ARGUMENTS = ["issue", "project", "artifact", "version", "ref"];
|
|
37017
|
+
var specFormDocumentOwner = documentOwnerValidation(true);
|
|
37018
|
+
function specFormRefusal(value) {
|
|
37019
|
+
const input = value;
|
|
37020
|
+
if (input["root"] !== undefined) {
|
|
37021
|
+
return SPEC_FORM_DOCUMENT_ARGUMENTS.every((name) => input[name] === undefined) ? undefined : SPEC_FORM_ROOT_RULE;
|
|
37022
|
+
}
|
|
37023
|
+
return brokenParts([
|
|
37024
|
+
[specFormDocumentOwner.check(value), specFormDocumentOwner.message],
|
|
37025
|
+
[
|
|
37026
|
+
input["version"] === undefined || typeof input["artifact"] === "string",
|
|
37027
|
+
SPEC_FORM_VERSION_RULE
|
|
37028
|
+
]
|
|
37029
|
+
]);
|
|
37030
|
+
}
|
|
37031
|
+
var SPEC_FORM_RULE = `${specFormDocumentOwner.message} ${SPEC_FORM_VERSION_RULE} ${SPEC_FORM_ROOT_RULE}`;
|
|
37032
|
+
var specFormValidation = {
|
|
37033
|
+
check: (value) => specFormRefusal(value) === undefined,
|
|
37034
|
+
message: SPEC_FORM_RULE,
|
|
37035
|
+
refusal: (value) => specFormRefusal(value) ?? SPEC_FORM_RULE
|
|
37036
|
+
};
|
|
37014
37037
|
function artifactProblem(value) {
|
|
37015
37038
|
const input = value;
|
|
37016
37039
|
const extension = typeof input.path === "string" || typeof input.name !== "string" ? undefined : NAME_EXTENSION.exec(input.name.trim())?.[1];
|
|
@@ -37819,6 +37842,20 @@ var dispatchToolSpecs = [
|
|
|
37819
37842
|
}),
|
|
37820
37843
|
validation: documentOwnerValidation(true)
|
|
37821
37844
|
},
|
|
37845
|
+
{
|
|
37846
|
+
name: "dispatch_spec_form",
|
|
37847
|
+
example: { issue: "DSP-1" },
|
|
37848
|
+
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.",
|
|
37849
|
+
arguments: (z) => ({
|
|
37850
|
+
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
37851
|
+
project: z.string().describe("Project key owning the document.").optional(),
|
|
37852
|
+
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(),
|
|
37853
|
+
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(),
|
|
37854
|
+
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(),
|
|
37855
|
+
ref: z.string().describe("Optional dispatch:// document reference.").optional()
|
|
37856
|
+
}),
|
|
37857
|
+
validation: specFormValidation
|
|
37858
|
+
},
|
|
37822
37859
|
{
|
|
37823
37860
|
name: "dispatch_request_approval",
|
|
37824
37861
|
example: { issue: "DSP-1", summary: "A live sync replaces the nightly export." },
|
|
@@ -39120,7 +39157,134 @@ function claimTakeableAt(liveness, lastSeen = undefined) {
|
|
|
39120
39157
|
}
|
|
39121
39158
|
return new Date(seen + ISSUE_CLAIM_UNRESPONSIVE_GRACE_MS).toISOString();
|
|
39122
39159
|
}
|
|
39160
|
+
// ../contracts/src/dashboard-pages.json
|
|
39161
|
+
var dashboard_pages_default = {
|
|
39162
|
+
about: "Generated from the dashboard's route table by packages/dispatch/web/src/features/refs/dashboard-pages-file.ts; do not edit.",
|
|
39163
|
+
tabs: [
|
|
39164
|
+
{
|
|
39165
|
+
page: "verification",
|
|
39166
|
+
reference: "verification"
|
|
39167
|
+
},
|
|
39168
|
+
{
|
|
39169
|
+
page: "plan",
|
|
39170
|
+
reference: "plan"
|
|
39171
|
+
},
|
|
39172
|
+
{
|
|
39173
|
+
page: "steps",
|
|
39174
|
+
reference: "steps"
|
|
39175
|
+
},
|
|
39176
|
+
{
|
|
39177
|
+
page: "conversation",
|
|
39178
|
+
reference: "log"
|
|
39179
|
+
},
|
|
39180
|
+
{
|
|
39181
|
+
page: "children",
|
|
39182
|
+
reference: "children"
|
|
39183
|
+
},
|
|
39184
|
+
{
|
|
39185
|
+
page: "artifacts",
|
|
39186
|
+
reference: "artifacts"
|
|
39187
|
+
},
|
|
39188
|
+
{
|
|
39189
|
+
page: "activity",
|
|
39190
|
+
reference: "activity"
|
|
39191
|
+
},
|
|
39192
|
+
{
|
|
39193
|
+
page: "collaborators",
|
|
39194
|
+
reference: "collaborators"
|
|
39195
|
+
}
|
|
39196
|
+
],
|
|
39197
|
+
document_segments: [
|
|
39198
|
+
"artifacts",
|
|
39199
|
+
"artifact"
|
|
39200
|
+
],
|
|
39201
|
+
document_pages: {
|
|
39202
|
+
primary: [
|
|
39203
|
+
"/issues/{key}",
|
|
39204
|
+
"/issues/{key}/spec",
|
|
39205
|
+
"/issues/{key}/artifacts/{slug}",
|
|
39206
|
+
"/issues/{key}/artifact/{slug}"
|
|
39207
|
+
],
|
|
39208
|
+
verification: [
|
|
39209
|
+
"/issues/{key}/verification",
|
|
39210
|
+
"/issues/{key}/artifacts/{slug}",
|
|
39211
|
+
"/issues/{key}/artifact/{slug}"
|
|
39212
|
+
],
|
|
39213
|
+
plan: [
|
|
39214
|
+
"/issues/{key}/plan",
|
|
39215
|
+
"/issues/{key}/artifacts/{slug}",
|
|
39216
|
+
"/issues/{key}/artifact/{slug}"
|
|
39217
|
+
],
|
|
39218
|
+
decisions: [
|
|
39219
|
+
"/issues/{key}/decisions",
|
|
39220
|
+
"/issues/{key}/artifacts/{slug}",
|
|
39221
|
+
"/issues/{key}/artifact/{slug}"
|
|
39222
|
+
],
|
|
39223
|
+
issue: [
|
|
39224
|
+
"/issues/{key}/artifacts/{slug}",
|
|
39225
|
+
"/issues/{key}/artifact/{slug}"
|
|
39226
|
+
],
|
|
39227
|
+
project: [
|
|
39228
|
+
"/projects/{project}/documents/{slug}"
|
|
39229
|
+
],
|
|
39230
|
+
agent: [
|
|
39231
|
+
"/agents/{session}/artifacts/{slug}"
|
|
39232
|
+
]
|
|
39233
|
+
},
|
|
39234
|
+
references: [
|
|
39235
|
+
{
|
|
39236
|
+
href: "/issues/CORE-1/verification",
|
|
39237
|
+
ref: "dispatch://CORE-1/verification"
|
|
39238
|
+
},
|
|
39239
|
+
{
|
|
39240
|
+
href: "/issues/CORE-1/plan",
|
|
39241
|
+
ref: "dispatch://CORE-1/plan"
|
|
39242
|
+
},
|
|
39243
|
+
{
|
|
39244
|
+
href: "/issues/CORE-1/steps",
|
|
39245
|
+
ref: "dispatch://CORE-1/steps"
|
|
39246
|
+
},
|
|
39247
|
+
{
|
|
39248
|
+
href: "/issues/CORE-1/conversation",
|
|
39249
|
+
ref: "dispatch://CORE-1/log"
|
|
39250
|
+
},
|
|
39251
|
+
{
|
|
39252
|
+
href: "/issues/CORE-1/children",
|
|
39253
|
+
ref: "dispatch://CORE-1/children"
|
|
39254
|
+
},
|
|
39255
|
+
{
|
|
39256
|
+
href: "/issues/CORE-1/artifacts",
|
|
39257
|
+
ref: "dispatch://CORE-1/artifacts"
|
|
39258
|
+
},
|
|
39259
|
+
{
|
|
39260
|
+
href: "/issues/CORE-1/activity",
|
|
39261
|
+
ref: "dispatch://CORE-1/activity"
|
|
39262
|
+
},
|
|
39263
|
+
{
|
|
39264
|
+
href: "/issues/CORE-1/collaborators",
|
|
39265
|
+
ref: "dispatch://CORE-1/collaborators"
|
|
39266
|
+
},
|
|
39267
|
+
{
|
|
39268
|
+
href: "/issues/CORE-1/artifacts/notes-md",
|
|
39269
|
+
ref: "dispatch://CORE-1/artifact/notes-md"
|
|
39270
|
+
},
|
|
39271
|
+
{
|
|
39272
|
+
href: "/issues/CORE-1/artifacts/notes-md?v=2",
|
|
39273
|
+
ref: "dispatch://CORE-1/artifact/notes-md@v2"
|
|
39274
|
+
},
|
|
39275
|
+
{
|
|
39276
|
+
href: "/issues/CORE-1/artifact/notes-md",
|
|
39277
|
+
ref: "dispatch://CORE-1/artifact/notes-md"
|
|
39278
|
+
},
|
|
39279
|
+
{
|
|
39280
|
+
href: "/issues/CORE-1/artifact/notes-md?v=2",
|
|
39281
|
+
ref: "dispatch://CORE-1/artifact/notes-md@v2"
|
|
39282
|
+
}
|
|
39283
|
+
]
|
|
39284
|
+
};
|
|
39285
|
+
|
|
39123
39286
|
// ../contracts/src/dispatch-href.ts
|
|
39287
|
+
var DISPATCH_DASHBOARD_PAGES = dashboard_pages_default;
|
|
39124
39288
|
function hasControlCharacter(value) {
|
|
39125
39289
|
return /\p{Cc}/u.test(value);
|
|
39126
39290
|
}
|
|
@@ -39149,6 +39313,102 @@ function itemFromSearch(search) {
|
|
|
39149
39313
|
}
|
|
39150
39314
|
return ask === null ? { id, kind: "comment" } : { id, kind: "ask" };
|
|
39151
39315
|
}
|
|
39316
|
+
var DISPATCH_HREF_REFERENCES = [
|
|
39317
|
+
...DISPATCH_DASHBOARD_PAGES.references,
|
|
39318
|
+
{ href: "/issues/CORE-1", ref: "dispatch://CORE-1" },
|
|
39319
|
+
{ href: "/issues/CORE-1/spec", ref: "dispatch://CORE-1/spec" },
|
|
39320
|
+
{
|
|
39321
|
+
href: "/issues/CORE-1/decisions",
|
|
39322
|
+
ref: "dispatch://CORE-1/artifact/decisions-md"
|
|
39323
|
+
},
|
|
39324
|
+
{
|
|
39325
|
+
href: "/issues/CORE-1/decisions#b-ship-it",
|
|
39326
|
+
ref: "dispatch://CORE-1/artifact/decisions-md"
|
|
39327
|
+
},
|
|
39328
|
+
{
|
|
39329
|
+
href: "/issues/CORE-1/comments/11111111-1111-4111-8111-111111111111",
|
|
39330
|
+
ref: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111"
|
|
39331
|
+
},
|
|
39332
|
+
{
|
|
39333
|
+
href: "/issues/CORE-1/asks/22222222-2222-4222-8222-222222222222",
|
|
39334
|
+
ref: "dispatch://CORE-1/ask/22222222-2222-4222-8222-222222222222"
|
|
39335
|
+
},
|
|
39336
|
+
{
|
|
39337
|
+
href: "/issues/CORE-1/messages/33333333-3333-4333-8333-333333333333",
|
|
39338
|
+
ref: "dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333"
|
|
39339
|
+
},
|
|
39340
|
+
{
|
|
39341
|
+
href: "/issues/CORE-1/spec?comment=44444444-4444-4444-8444-444444444444",
|
|
39342
|
+
ref: "dispatch://CORE-1/comment/44444444-4444-4444-8444-444444444444"
|
|
39343
|
+
},
|
|
39344
|
+
{
|
|
39345
|
+
href: "/issues/CORE-1/artifacts/notes-md?comment=55555555-5555-4555-8555-555555555555",
|
|
39346
|
+
ref: "dispatch://CORE-1/comment/55555555-5555-4555-8555-555555555555"
|
|
39347
|
+
},
|
|
39348
|
+
{
|
|
39349
|
+
href: "/issues/CORE-1/spec?ask=66666666-6666-4666-8666-666666666666",
|
|
39350
|
+
ref: "dispatch://CORE-1/ask/66666666-6666-4666-8666-666666666666"
|
|
39351
|
+
},
|
|
39352
|
+
{
|
|
39353
|
+
href: "/issues/CORE-1/artifacts/notes-md?ask=77777777-7777-4777-8777-777777777777",
|
|
39354
|
+
ref: "dispatch://CORE-1/ask/77777777-7777-4777-8777-777777777777"
|
|
39355
|
+
},
|
|
39356
|
+
{
|
|
39357
|
+
href: "/projects/CORE/documents/handbook-md",
|
|
39358
|
+
ref: "dispatch://CORE/artifact/handbook-md"
|
|
39359
|
+
},
|
|
39360
|
+
{
|
|
39361
|
+
href: "/projects/CORE/documents/handbook-md?comment=88888888-8888-4888-8888-888888888888",
|
|
39362
|
+
ref: "dispatch://CORE/artifact/handbook-md/comment/88888888-8888-4888-8888-888888888888"
|
|
39363
|
+
},
|
|
39364
|
+
{
|
|
39365
|
+
href: "/projects/CORE/documents/handbook-md?ask=99999999-9999-4999-8999-999999999999",
|
|
39366
|
+
ref: "dispatch://CORE/artifact/handbook-md/ask/99999999-9999-4999-8999-999999999999"
|
|
39367
|
+
},
|
|
39368
|
+
{ href: "/issues/CORE-1/spec#b-ship-it", ref: "dispatch://CORE-1/spec#b-ship-it" },
|
|
39369
|
+
{
|
|
39370
|
+
href: "/issues/CORE-1/artifacts/notes-md#b-ship-it",
|
|
39371
|
+
ref: "dispatch://CORE-1/artifact/notes-md#b-ship-it"
|
|
39372
|
+
},
|
|
39373
|
+
{
|
|
39374
|
+
href: "/projects/CORE/documents/handbook-md#b-ship-it",
|
|
39375
|
+
ref: "dispatch://CORE/artifact/handbook-md#b-ship-it"
|
|
39376
|
+
},
|
|
39377
|
+
{
|
|
39378
|
+
href: "/issues/CORE-1/comments/11111111-1111-4111-8111-111111111111#b-b2",
|
|
39379
|
+
ref: "dispatch://CORE-1/comment/11111111-1111-4111-8111-111111111111#b-b2"
|
|
39380
|
+
},
|
|
39381
|
+
{
|
|
39382
|
+
href: "/issues/CORE-1/messages/33333333-3333-4333-8333-333333333333#b-b2",
|
|
39383
|
+
ref: "dispatch://CORE-1/message/33333333-3333-4333-8333-333333333333#b-b2"
|
|
39384
|
+
},
|
|
39385
|
+
{
|
|
39386
|
+
href: "/issues/CORE-1/asks/22222222-2222-4222-8222-222222222222#b-b3",
|
|
39387
|
+
ref: "dispatch://CORE-1/ask/22222222-2222-4222-8222-222222222222#b-b3"
|
|
39388
|
+
},
|
|
39389
|
+
{
|
|
39390
|
+
href: "/projects/CORE/documents/handbook-md?comment=88888888-8888-4888-8888-888888888888#b-b2",
|
|
39391
|
+
ref: "dispatch://CORE/artifact/handbook-md/comment/88888888-8888-4888-8888-888888888888"
|
|
39392
|
+
},
|
|
39393
|
+
{
|
|
39394
|
+
href: "/projects/CORE/documents/handbook-md?ask=99999999-9999-4999-8999-999999999999#b-b2",
|
|
39395
|
+
ref: "dispatch://CORE/artifact/handbook-md/ask/99999999-9999-4999-8999-999999999999"
|
|
39396
|
+
},
|
|
39397
|
+
{
|
|
39398
|
+
href: "/issues/CORE-1/spec#b-d%C3%A9cision%3A1",
|
|
39399
|
+
ref: "dispatch://CORE-1/spec#b-d%C3%A9cision%3A1"
|
|
39400
|
+
},
|
|
39401
|
+
{ href: "/issues/CORE-1/spec#top", ref: "dispatch://CORE-1/spec" },
|
|
39402
|
+
{ href: "/issues/CORE-1/spec?v=2#b-ship-it", ref: "dispatch://CORE-1/artifact/spec@v2" },
|
|
39403
|
+
{
|
|
39404
|
+
href: "/issues/CORE-1/artifacts/notes-md?v=2#b-ship-it",
|
|
39405
|
+
ref: "dispatch://CORE-1/artifact/notes-md@v2"
|
|
39406
|
+
},
|
|
39407
|
+
{
|
|
39408
|
+
href: "/projects/CORE/documents/handbook-md?version=3#b-ship-it",
|
|
39409
|
+
ref: "dispatch://CORE/artifact/handbook-md@v3"
|
|
39410
|
+
}
|
|
39411
|
+
];
|
|
39152
39412
|
|
|
39153
39413
|
// ../contracts/src/dispatch-block-ref.ts
|
|
39154
39414
|
var encoder = new TextEncoder;
|
|
@@ -49828,6 +50088,9 @@ class DispatchClient {
|
|
|
49828
50088
|
async docRead(id, version, read = {}) {
|
|
49829
50089
|
return version === undefined ? this.#read(["api", "v1", "artifacts", id, "text"], undefined, read) : this.#read(["api", "v1", "artifacts", id, "versions", String(version)], undefined, read);
|
|
49830
50090
|
}
|
|
50091
|
+
async specForm(id, version) {
|
|
50092
|
+
return this.#json("GET", ["api", "v1", "artifacts", id, "spec-form"], undefined, version === undefined ? undefined : { version });
|
|
50093
|
+
}
|
|
49831
50094
|
async docReadWithBlocks(id, read = {}) {
|
|
49832
50095
|
return this.#read(["api", "v1", "artifacts", id, "text"], { blocks: true }, read);
|
|
49833
50096
|
}
|
|
@@ -51917,6 +52180,11 @@ function formatZodIssues(issues, schema, tool) {
|
|
|
51917
52180
|
}
|
|
51918
52181
|
|
|
51919
52182
|
// ../envoy-client/src/dispatch-commands/links.ts
|
|
52183
|
+
var issueTabReferences = new Map([
|
|
52184
|
+
...DISPATCH_DASHBOARD_PAGES.tabs.map(({ page, reference }) => [page, reference]),
|
|
52185
|
+
["log", "log"]
|
|
52186
|
+
]);
|
|
52187
|
+
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/([^/]+))?/?$`);
|
|
51920
52188
|
function dispatchRefFromUrl(value, serverUrl) {
|
|
51921
52189
|
let url;
|
|
51922
52190
|
let origin;
|
|
@@ -51936,7 +52204,7 @@ function dispatchRefFromUrl(value, serverUrl) {
|
|
|
51936
52204
|
const id = url.hash.startsWith("#b-") ? decodeBlockId(url.hash.slice(3)) : undefined;
|
|
51937
52205
|
return id === undefined || versionName !== undefined && url.searchParams.get(versionName) ? "" : `#b-${encodeBlockId(id)}`;
|
|
51938
52206
|
};
|
|
51939
|
-
const issuePage = url.pathname.match(
|
|
52207
|
+
const issuePage = url.pathname.match(issuePagePattern);
|
|
51940
52208
|
if (issuePage) {
|
|
51941
52209
|
const [, key = "", page, artifact, ask, comment, message] = issuePage;
|
|
51942
52210
|
const version = versionOf("v");
|
|
@@ -51954,7 +52222,7 @@ function dispatchRefFromUrl(value, serverUrl) {
|
|
|
51954
52222
|
if (page === "decisions")
|
|
51955
52223
|
return `dispatch://${key}/artifact/decisions-md`;
|
|
51956
52224
|
if (page !== undefined)
|
|
51957
|
-
return `dispatch://${key}/${page
|
|
52225
|
+
return `dispatch://${key}/${issueTabReferences.get(page) ?? page}`;
|
|
51958
52226
|
if (artifact !== undefined) {
|
|
51959
52227
|
const slug = decodeURIComponent(artifact);
|
|
51960
52228
|
return `dispatch://${key}/artifact/${slug}${version}${blockOf("v")}`;
|
|
@@ -52362,6 +52630,8 @@ async function resolveOrigin(env, exec, cwd) {
|
|
|
52362
52630
|
}
|
|
52363
52631
|
|
|
52364
52632
|
// ../envoy-client/src/dispatch-owner.ts
|
|
52633
|
+
var issueViewReferences = DISPATCH_DASHBOARD_PAGES.tabs.map(({ reference }) => reference).filter((reference) => !["log", "activity", "children"].includes(reference));
|
|
52634
|
+
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/([^/]+))?$`);
|
|
52365
52635
|
function documentLabel(project, slug) {
|
|
52366
52636
|
return `${project}/${slug}`;
|
|
52367
52637
|
}
|
|
@@ -52454,10 +52724,10 @@ function parseDispatchRef(ref) {
|
|
|
52454
52724
|
artifact
|
|
52455
52725
|
};
|
|
52456
52726
|
}
|
|
52457
|
-
const issueReference = ref.match(
|
|
52727
|
+
const issueReference = ref.match(issueReferencePattern);
|
|
52458
52728
|
if (!issueReference)
|
|
52459
52729
|
return null;
|
|
52460
|
-
const [, issue, spec, log, children, comments, artifact, version, ask, comment, message] = issueReference;
|
|
52730
|
+
const [, issue, spec, log, children, comments, tab, artifact, version, ask, comment, message] = issueReference;
|
|
52461
52731
|
if (!issue || version !== undefined && Number(version) < 1)
|
|
52462
52732
|
return null;
|
|
52463
52733
|
const owner = { kind: "issue", issue };
|
|
@@ -52469,6 +52739,8 @@ function parseDispatchRef(ref) {
|
|
|
52469
52739
|
return { owner, kind: "children", id: children };
|
|
52470
52740
|
if (comments)
|
|
52471
52741
|
return { owner, kind: "comments", id: comments };
|
|
52742
|
+
if (tab)
|
|
52743
|
+
return { owner, kind: "tab", id: tab };
|
|
52472
52744
|
if (artifact) {
|
|
52473
52745
|
return {
|
|
52474
52746
|
owner,
|
|
@@ -55725,18 +55997,18 @@ function itemReplyTo(args, field) {
|
|
|
55725
55997
|
return block === undefined ? { id: replyTo } : { id: block.item.id, block: block.block };
|
|
55726
55998
|
}
|
|
55727
55999
|
function innerRefProblem(tool, ref, refText) {
|
|
55728
|
-
if (ref.kind !== "ask" && ref.kind !== "comment" && ref.kind !== "message" && ref.kind !== "log" && ref.kind !== "children" && ref.kind !== "comments" && ref.kind !== "block") {
|
|
56000
|
+
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") {
|
|
55729
56001
|
return;
|
|
55730
56002
|
}
|
|
55731
56003
|
if (tool === "dispatch_read" || tool === "dispatch_ask")
|
|
55732
56004
|
return;
|
|
55733
56005
|
const owner = refOwnerName(ref);
|
|
55734
56006
|
const itemKind = ref.item?.kind ?? ref.kind;
|
|
55735
|
-
const documentArgument = ref.kind === "block" && ref.item === undefined && tool !== "dispatch_comment" ? ` and artifact ${ref.id}` : tool === "dispatch_suggest" ? " and artifact <the document's slug>" : "";
|
|
56007
|
+
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>" : "";
|
|
55736
56008
|
const ownerArguments = ref.owner.kind === "issue" ? `issue ${ref.owner.issue}${documentArgument}` : `project ${ref.owner.project} and artifact ${ref.artifact}`;
|
|
55737
56009
|
const partRef = ref.pin === undefined ? refText : refText.slice(0, -`@v${ref.pin}`.length);
|
|
55738
56010
|
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}`;
|
|
55739
|
-
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}`;
|
|
56011
|
+
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}`;
|
|
55740
56012
|
return `ref ${refText} names ${item} on ${owner}; dispatch ${commandName(tool)} would act on ${owner} and drop the ${ref.kind}: ${fix}`;
|
|
55741
56013
|
}
|
|
55742
56014
|
var documentItemPattern = /^dispatch:\/\/([A-Z][A-Z0-9]{1,9}-[1-9][0-9]*)\/artifact\/[^/@]+(?:@v\d+)?\/(ask|comment)\/([^/]+)$/;
|
|
@@ -56097,6 +56369,9 @@ async function resolveOwnerArguments(tool, input, cwd, env, exec, dashboardUrls,
|
|
|
56097
56369
|
if (tool === "dispatch_result" && typeof retract === "string") {
|
|
56098
56370
|
return { args, ref, owner: null };
|
|
56099
56371
|
}
|
|
56372
|
+
if (tool === "dispatch_spec_form" && typeof args["root"] === "string") {
|
|
56373
|
+
return { args, ref, owner: null };
|
|
56374
|
+
}
|
|
56100
56375
|
const legionIssue = env.LEGION_ISSUE;
|
|
56101
56376
|
if (!legionIssue) {
|
|
56102
56377
|
problems.push(ownerRequiredProblem);
|
|
@@ -59614,6 +59889,162 @@ async function refuseRemovingOpenDecisionBlocks(client, tool, resolved, ops) {
|
|
|
59614
59889
|
`));
|
|
59615
59890
|
}
|
|
59616
59891
|
|
|
59892
|
+
// ../envoy-client/src/dispatch-commands/spec-form.ts
|
|
59893
|
+
function counted(count, noun) {
|
|
59894
|
+
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
59895
|
+
}
|
|
59896
|
+
function textCounts(texts) {
|
|
59897
|
+
const of = (kind) => texts?.[kind] ?? 0;
|
|
59898
|
+
return `${counted(of("statement"), "statement")}, ${counted(of("claim"), "claim")}, ${counted(of("purpose"), "purpose")} and ${counted(of("definition"), "definition")}`;
|
|
59899
|
+
}
|
|
59900
|
+
function readLine2(texts, name, version) {
|
|
59901
|
+
const read = Object.values(texts ?? {}).reduce((sum, count) => sum + count, 0);
|
|
59902
|
+
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.`;
|
|
59903
|
+
}
|
|
59904
|
+
function unreadLines(unread) {
|
|
59905
|
+
return (unread ?? []).map(({ line }) => line);
|
|
59906
|
+
}
|
|
59907
|
+
function approvalFormLines(result, name) {
|
|
59908
|
+
const form = result.spec_form;
|
|
59909
|
+
return form === undefined ? [] : [readLine2(form.texts, name, result.version), ...unreadLines(form.unread)];
|
|
59910
|
+
}
|
|
59911
|
+
function scopeLine(form) {
|
|
59912
|
+
switch (form.scope) {
|
|
59913
|
+
case "no_root":
|
|
59914
|
+
return "This server names no root of The Spec, so Dispatch refuses no approval request for its form.";
|
|
59915
|
+
case "outside":
|
|
59916
|
+
return `${form.name} is not under a root of The Spec, so Dispatch refuses no approval request of it for its form.`;
|
|
59917
|
+
case "not_spec":
|
|
59918
|
+
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.`;
|
|
59919
|
+
case "root":
|
|
59920
|
+
return `${form.name} belongs to a root of The Spec, so Dispatch refuses no approval request of it for its form.`;
|
|
59921
|
+
default:
|
|
59922
|
+
return `${form.name} has the scope ${form.scope}, so Dispatch refuses no approval request of it for its form.`;
|
|
59923
|
+
}
|
|
59924
|
+
}
|
|
59925
|
+
function documentLines(form) {
|
|
59926
|
+
const listed = form.finding_lines ?? [];
|
|
59927
|
+
const read = readLine2(form.texts, form.name, form.version);
|
|
59928
|
+
const unread = unreadLines(form.unread);
|
|
59929
|
+
if (!form.in_scope) {
|
|
59930
|
+
return form.findings_total === 0 ? [scopeLine(form), read, ...unread] : [scopeLine(form), "The findings below are for you to read.", ...listed, ...unread];
|
|
59931
|
+
}
|
|
59932
|
+
return form.findings_total === 0 ? [read, ...unread] : [...listed, ...unread];
|
|
59933
|
+
}
|
|
59934
|
+
function noVersionLine(name) {
|
|
59935
|
+
return `${name} has no version yet, so Dispatch read no text in it.`;
|
|
59936
|
+
}
|
|
59937
|
+
function playsSpecOrVerification(artifact) {
|
|
59938
|
+
if (artifact.kind !== "doc" || typeof artifact.issue_key !== "string")
|
|
59939
|
+
return false;
|
|
59940
|
+
return artifact.primary || artifact.role === "verification" || (artifact.role ?? "") === "" && artifact.slug === "verification-md";
|
|
59941
|
+
}
|
|
59942
|
+
async function latestForm(client, artifact) {
|
|
59943
|
+
try {
|
|
59944
|
+
return await client.specForm(artifact.id);
|
|
59945
|
+
} catch (error) {
|
|
59946
|
+
if (dispatchAnswered(error, 409) && error.code === "NO_VERSION")
|
|
59947
|
+
return;
|
|
59948
|
+
throw refusalWithCode(error);
|
|
59949
|
+
}
|
|
59950
|
+
}
|
|
59951
|
+
async function coveredForms(client, artifacts) {
|
|
59952
|
+
return Promise.all(artifacts.filter(playsSpecOrVerification).map(async (artifact) => ({ artifact, form: await latestForm(client, artifact) })));
|
|
59953
|
+
}
|
|
59954
|
+
async function issueForms(client, issue) {
|
|
59955
|
+
const read = await coveredForms(client, (await client.getIssue(issue)).artifacts ?? []);
|
|
59956
|
+
const lines = read.flatMap(({ artifact, form }) => form === undefined ? [noVersionLine(artifact.name)] : [`${form.name} version ${form.version}:`, ...documentLines(form)]);
|
|
59957
|
+
return {
|
|
59958
|
+
text: read.length === 0 ? `${issue} has no spec and no Verification document, so Dispatch read no document.` : lines.join(`
|
|
59959
|
+
`),
|
|
59960
|
+
details: {
|
|
59961
|
+
issue,
|
|
59962
|
+
documents: read.flatMap(({ form }) => form === undefined ? [] : [
|
|
59963
|
+
{
|
|
59964
|
+
artifact: form.artifact_id,
|
|
59965
|
+
version: form.version,
|
|
59966
|
+
scope: form.scope,
|
|
59967
|
+
refuses_approval: form.refuses_approval,
|
|
59968
|
+
findings_total: form.findings_total
|
|
59969
|
+
}
|
|
59970
|
+
])
|
|
59971
|
+
}
|
|
59972
|
+
};
|
|
59973
|
+
}
|
|
59974
|
+
async function rootForms(client, root) {
|
|
59975
|
+
const rootKey = (await client.getIssue(root)).key;
|
|
59976
|
+
const lines = [];
|
|
59977
|
+
const seen = new Set([rootKey]);
|
|
59978
|
+
let documents = 0;
|
|
59979
|
+
let findings = 0;
|
|
59980
|
+
const walk = async (parent, depth) => {
|
|
59981
|
+
const indent = " ".repeat(depth);
|
|
59982
|
+
for (const child of await client.listAllIssues({ parent })) {
|
|
59983
|
+
if (seen.has(child.key))
|
|
59984
|
+
continue;
|
|
59985
|
+
seen.add(child.key);
|
|
59986
|
+
const read = await coveredForms(client, await client.listIssueArtifacts(child.key));
|
|
59987
|
+
const totals = {};
|
|
59988
|
+
let issueFindings = 0;
|
|
59989
|
+
const documentRows = read.map(({ artifact, form }) => {
|
|
59990
|
+
if (form === undefined)
|
|
59991
|
+
return `${indent} ${noVersionLine(artifact.name)}`;
|
|
59992
|
+
documents += 1;
|
|
59993
|
+
issueFindings += form.findings_total;
|
|
59994
|
+
for (const [kind, count] of Object.entries(form.texts ?? {})) {
|
|
59995
|
+
totals[kind] = (totals[kind] ?? 0) + count;
|
|
59996
|
+
}
|
|
59997
|
+
return `${indent} ${form.name} version ${form.version} (scope ${form.scope}): ${textCounts(form.texts)}, with ${counted(form.findings_total, "finding")}.`;
|
|
59998
|
+
});
|
|
59999
|
+
findings += issueFindings;
|
|
60000
|
+
const issueLine = `${indent}${child.key} [${child.status}] ${child.title}`;
|
|
60001
|
+
lines.push(read.length === 0 ? `${issueLine}: no spec and no Verification document.` : `${issueLine}: ${textCounts(totals)}, with ${counted(issueFindings, "finding")}.`, ...documentRows);
|
|
60002
|
+
await walk(child.key, depth + 1);
|
|
60003
|
+
}
|
|
60004
|
+
};
|
|
60005
|
+
await walk(rootKey, 0);
|
|
60006
|
+
const issues = seen.size - 1;
|
|
60007
|
+
return {
|
|
60008
|
+
text: issues === 0 ? `Dispatch found no issue under ${rootKey}, so it read no document.` : [
|
|
60009
|
+
...lines,
|
|
60010
|
+
`Dispatch read ${counted(issues, "issue")} and ${counted(documents, "document")} under ${rootKey}.`
|
|
60011
|
+
].join(`
|
|
60012
|
+
`),
|
|
60013
|
+
details: { root: rootKey, issues, documents, findings }
|
|
60014
|
+
};
|
|
60015
|
+
}
|
|
60016
|
+
async function specFormCommand(context) {
|
|
60017
|
+
const { args, client, ownerArguments, documentOwner, resolveDocument } = context;
|
|
60018
|
+
const root = optionalString(args, "root");
|
|
60019
|
+
if (root !== undefined)
|
|
60020
|
+
return rootForms(client, root);
|
|
60021
|
+
const artifactReference = optionalString(args, "artifact") ?? (ownerArguments.ref?.kind === "spec" || ownerArguments.ref?.kind === "artifact" ? ownerArguments.ref.id : undefined);
|
|
60022
|
+
const owner = documentOwner();
|
|
60023
|
+
if (artifactReference === undefined && owner.kind === "issue") {
|
|
60024
|
+
return issueForms(client, owner.issue);
|
|
60025
|
+
}
|
|
60026
|
+
const resolved = await resolveDocument(owner, artifactReference);
|
|
60027
|
+
const version = optionalNumber(args, "version") ?? ownerArguments.ref?.version;
|
|
60028
|
+
let form;
|
|
60029
|
+
try {
|
|
60030
|
+
form = await client.specForm(resolved.artifact.id, version);
|
|
60031
|
+
} catch (error) {
|
|
60032
|
+
throw refusalWithCode(error);
|
|
60033
|
+
}
|
|
60034
|
+
return {
|
|
60035
|
+
text: documentLines(form).join(`
|
|
60036
|
+
`),
|
|
60037
|
+
details: {
|
|
60038
|
+
...resolved.owner.kind === "project" ? { project: resolved.owner.project } : { issue: resolved.issue?.key },
|
|
60039
|
+
artifact: form.artifact_id,
|
|
60040
|
+
version: form.version,
|
|
60041
|
+
scope: form.scope,
|
|
60042
|
+
refuses_approval: form.refuses_approval,
|
|
60043
|
+
findings_total: form.findings_total
|
|
60044
|
+
}
|
|
60045
|
+
};
|
|
60046
|
+
}
|
|
60047
|
+
|
|
59617
60048
|
// ../envoy-client/src/dispatch-commands/stored-text.ts
|
|
59618
60049
|
import { resolve as resolvePath2 } from "path";
|
|
59619
60050
|
|
|
@@ -60389,18 +60820,19 @@ async function requestApprovalCommand(context) {
|
|
|
60389
60820
|
actor,
|
|
60390
60821
|
summary: stringArg(args, "summary"),
|
|
60391
60822
|
...includeVerification ? { include_verification: true } : {}
|
|
60392
|
-
});
|
|
60823
|
+
}).catch((error) => Promise.reject(refusalWithCode(error)));
|
|
60393
60824
|
const gaps = result.coverage ?? [];
|
|
60394
60825
|
const coverageLines = result.coverage_unread ? [
|
|
60395
60826
|
`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.`
|
|
60396
60827
|
] : gaps.length === 0 ? [] : [
|
|
60397
60828
|
`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.`
|
|
60398
60829
|
];
|
|
60830
|
+
const trailing = [...approvalFormLines(result, resolved.artifact.name), ...coverageLines];
|
|
60399
60831
|
if (result.ask === null) {
|
|
60400
60832
|
return {
|
|
60401
60833
|
text: [
|
|
60402
60834
|
`${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.`,
|
|
60403
|
-
...
|
|
60835
|
+
...trailing
|
|
60404
60836
|
].join(`
|
|
60405
60837
|
`),
|
|
60406
60838
|
details: {
|
|
@@ -60416,7 +60848,7 @@ async function requestApprovalCommand(context) {
|
|
|
60416
60848
|
return {
|
|
60417
60849
|
text: [
|
|
60418
60850
|
`${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.`,
|
|
60419
|
-
...
|
|
60851
|
+
...trailing
|
|
60420
60852
|
].join(`
|
|
60421
60853
|
`),
|
|
60422
60854
|
details: { ...details, artifact: resolved.artifact.id, version: result.version }
|
|
@@ -61881,6 +62313,7 @@ var dispatchCommands = {
|
|
|
61881
62313
|
dispatch_send_to_agent: acting(sendToAgentCommand),
|
|
61882
62314
|
dispatch_doc_edit: acting(docEditCommand),
|
|
61883
62315
|
dispatch_doc_read: reading(docReadCommand),
|
|
62316
|
+
dispatch_spec_form: acting(specFormCommand),
|
|
61884
62317
|
dispatch_request_approval: acting(requestApprovalCommand),
|
|
61885
62318
|
dispatch_plan_approve: acting(planApproveCommand),
|
|
61886
62319
|
dispatch_review: acting(reviewCommand),
|
|
@@ -68510,7 +68943,7 @@ var import_nats5 = __toESM(require_mod4(), 1);
|
|
|
68510
68943
|
|
|
68511
68944
|
// package.json
|
|
68512
68945
|
var name2 = "@sjawhar/claude-envoy";
|
|
68513
|
-
var version2 = "6.
|
|
68946
|
+
var version2 = "6.25.1";
|
|
68514
68947
|
var package_default = {
|
|
68515
68948
|
name: name2,
|
|
68516
68949
|
version: version2,
|