@sjawhar/pi-legion-envoy 0.41.0 → 0.41.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/dist/envoy.js +29 -9
- package/dist/legion.js +29 -9
- package/dist/skills/dispatch/SKILL.md +25 -14
- package/package.json +1 -1
package/dist/envoy.js
CHANGED
|
@@ -29700,15 +29700,22 @@ var AskEditedEventPayloadSchema = object({
|
|
|
29700
29700
|
edited_by: object({ kind: string2(), id: string2() }).passthrough()
|
|
29701
29701
|
});
|
|
29702
29702
|
var CommentEventPayloadSchema = object({
|
|
29703
|
+
id: string2().optional(),
|
|
29703
29704
|
artifact_name: string2().optional(),
|
|
29704
29705
|
body: string2().optional(),
|
|
29705
29706
|
reply_to: string2().nullish(),
|
|
29706
29707
|
ask_id: string2().nullish(),
|
|
29707
29708
|
ask_question: string2().optional(),
|
|
29708
29709
|
anchor: object({ quote: string2().optional() }).nullish(),
|
|
29709
|
-
suggestion: object({ replace_with: string2().optional() }).nullish()
|
|
29710
|
+
suggestion: object({ replace_with: string2().optional() }).nullish(),
|
|
29711
|
+
author: object({ kind: string2(), id: string2().optional() }).passthrough().optional(),
|
|
29712
|
+
created_at: string2().optional()
|
|
29713
|
+
});
|
|
29714
|
+
var MessageEventPayloadSchema = object({
|
|
29715
|
+
id: string2().optional(),
|
|
29716
|
+
body: string2().optional(),
|
|
29717
|
+
author: object({ kind: string2(), id: string2().optional() }).passthrough().optional()
|
|
29710
29718
|
});
|
|
29711
|
-
var MessageEventPayloadSchema = object({ body: string2().optional() });
|
|
29712
29719
|
var ChildStatusEventPayloadSchema = object({
|
|
29713
29720
|
child_key: string2().optional(),
|
|
29714
29721
|
from: string2().optional(),
|
|
@@ -30988,6 +30995,8 @@ var DISPATCH_PAYLOAD_SCHEMAS = {
|
|
|
30988
30995
|
"ask.resolved": AskEventPayloadSchema,
|
|
30989
30996
|
"comment.created": CommentEventPayloadSchema,
|
|
30990
30997
|
"comment.resolved": CommentEventPayloadSchema,
|
|
30998
|
+
"comment.reopened": CommentEventPayloadSchema,
|
|
30999
|
+
"comment.edited": CommentEventPayloadSchema,
|
|
30991
31000
|
"suggestion.accepted": CommentEventPayloadSchema,
|
|
30992
31001
|
"suggestion.rejected": CommentEventPayloadSchema,
|
|
30993
31002
|
"message.created": MessageEventPayloadSchema,
|
|
@@ -31757,7 +31766,7 @@ async function resolveOwnerArguments(tool, args, cwd, env, exec) {
|
|
|
31757
31766
|
return { args, ref: null, owner: null };
|
|
31758
31767
|
const refArgument = args.ref;
|
|
31759
31768
|
const ref = typeof refArgument === "string" ? parseDispatchRef(refArgument) ?? (() => {
|
|
31760
|
-
throw new Error("ref must be a valid dispatch:// reference");
|
|
31769
|
+
throw new Error("ref must be a valid dispatch:// reference such as dispatch://KEY-1, " + "dispatch://KEY-1/ask/<uuid>, dispatch://KEY-1/comment/<uuid>, " + "dispatch://KEY-1/artifact/<slug>, or dispatch://PROJECT/artifact/<slug>");
|
|
31761
31770
|
})() : null;
|
|
31762
31771
|
const issueArgument = args.issue;
|
|
31763
31772
|
const projectArgument = args.project;
|
|
@@ -31829,13 +31838,23 @@ async function resolveArtifact(client, owner, artifactReference) {
|
|
|
31829
31838
|
if (artifactReference === undefined) {
|
|
31830
31839
|
throw new Error("artifact is required for a project document");
|
|
31831
31840
|
}
|
|
31832
|
-
|
|
31833
|
-
|
|
31834
|
-
|
|
31835
|
-
|
|
31841
|
+
try {
|
|
31842
|
+
return {
|
|
31843
|
+
owner,
|
|
31844
|
+
artifact: await client.getProjectArtifact(owner.project, artifactReference)
|
|
31845
|
+
};
|
|
31846
|
+
} catch (error) {
|
|
31847
|
+
if (!(error instanceof DispatchServiceError) || error.status !== 404)
|
|
31848
|
+
throw error;
|
|
31849
|
+
const artifacts = await client.listProjectArtifacts(owner.project);
|
|
31850
|
+
const artifact = artifacts.find((candidate) => candidate.name === artifactReference);
|
|
31851
|
+
if (!artifact)
|
|
31852
|
+
throw error;
|
|
31853
|
+
return { owner, artifact };
|
|
31854
|
+
}
|
|
31836
31855
|
}
|
|
31837
31856
|
const issue = await client.getIssue(owner.issue);
|
|
31838
|
-
const artifact = artifactReference === undefined || artifactReference === "spec" ? issue.artifacts.find((candidate) => candidate.primary || candidate.id === issue.primary_artifact_id) : issue.artifacts.find((candidate) => candidate.id === artifactReference || candidate.slug === artifactReference);
|
|
31857
|
+
const artifact = artifactReference === undefined || artifactReference === "spec" ? issue.artifacts.find((candidate) => candidate.primary || candidate.id === issue.primary_artifact_id) : issue.artifacts.find((candidate) => candidate.id === artifactReference || candidate.slug === artifactReference || candidate.name === artifactReference);
|
|
31839
31858
|
if (!artifact) {
|
|
31840
31859
|
throw new Error(`artifact ${artifactReference ?? "spec"} was not found on issue ${issue.key}`);
|
|
31841
31860
|
}
|
|
@@ -32201,8 +32220,9 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
32201
32220
|
};
|
|
32202
32221
|
const artifactOwner = documentOwner();
|
|
32203
32222
|
const result = artifactOwner.kind === "project" ? await client.projectArtifact(artifactOwner.project, artifactInput) : await client.artifact(issue(), artifactInput);
|
|
32223
|
+
const artifactRef = artifactOwner.kind === "project" ? `dispatch://${artifactOwner.project}/artifact/${result.artifact.slug}` : `dispatch://${issue()}/artifact/${result.artifact.slug}`;
|
|
32204
32224
|
return {
|
|
32205
|
-
text: `Uploaded ${result.artifact.name} as version ${result.version.number}`,
|
|
32225
|
+
text: `Uploaded ${result.artifact.name} as version ${result.version.number} (artifact slug ${result.artifact.slug}; ${artifactRef})`,
|
|
32206
32226
|
details: artifactOwner.kind === "project" ? {
|
|
32207
32227
|
...documentResultDetails(result.artifact),
|
|
32208
32228
|
version: result.version.number
|
package/dist/legion.js
CHANGED
|
@@ -29699,15 +29699,22 @@ var AskEditedEventPayloadSchema = object({
|
|
|
29699
29699
|
edited_by: object({ kind: string2(), id: string2() }).passthrough()
|
|
29700
29700
|
});
|
|
29701
29701
|
var CommentEventPayloadSchema = object({
|
|
29702
|
+
id: string2().optional(),
|
|
29702
29703
|
artifact_name: string2().optional(),
|
|
29703
29704
|
body: string2().optional(),
|
|
29704
29705
|
reply_to: string2().nullish(),
|
|
29705
29706
|
ask_id: string2().nullish(),
|
|
29706
29707
|
ask_question: string2().optional(),
|
|
29707
29708
|
anchor: object({ quote: string2().optional() }).nullish(),
|
|
29708
|
-
suggestion: object({ replace_with: string2().optional() }).nullish()
|
|
29709
|
+
suggestion: object({ replace_with: string2().optional() }).nullish(),
|
|
29710
|
+
author: object({ kind: string2(), id: string2().optional() }).passthrough().optional(),
|
|
29711
|
+
created_at: string2().optional()
|
|
29712
|
+
});
|
|
29713
|
+
var MessageEventPayloadSchema = object({
|
|
29714
|
+
id: string2().optional(),
|
|
29715
|
+
body: string2().optional(),
|
|
29716
|
+
author: object({ kind: string2(), id: string2().optional() }).passthrough().optional()
|
|
29709
29717
|
});
|
|
29710
|
-
var MessageEventPayloadSchema = object({ body: string2().optional() });
|
|
29711
29718
|
var ChildStatusEventPayloadSchema = object({
|
|
29712
29719
|
child_key: string2().optional(),
|
|
29713
29720
|
from: string2().optional(),
|
|
@@ -31435,6 +31442,8 @@ var DISPATCH_PAYLOAD_SCHEMAS = {
|
|
|
31435
31442
|
"ask.resolved": AskEventPayloadSchema,
|
|
31436
31443
|
"comment.created": CommentEventPayloadSchema,
|
|
31437
31444
|
"comment.resolved": CommentEventPayloadSchema,
|
|
31445
|
+
"comment.reopened": CommentEventPayloadSchema,
|
|
31446
|
+
"comment.edited": CommentEventPayloadSchema,
|
|
31438
31447
|
"suggestion.accepted": CommentEventPayloadSchema,
|
|
31439
31448
|
"suggestion.rejected": CommentEventPayloadSchema,
|
|
31440
31449
|
"message.created": MessageEventPayloadSchema,
|
|
@@ -32197,7 +32206,7 @@ async function resolveOwnerArguments(tool, args, cwd, env, exec) {
|
|
|
32197
32206
|
return { args, ref: null, owner: null };
|
|
32198
32207
|
const refArgument = args.ref;
|
|
32199
32208
|
const ref = typeof refArgument === "string" ? parseDispatchRef(refArgument) ?? (() => {
|
|
32200
|
-
throw new Error("ref must be a valid dispatch:// reference");
|
|
32209
|
+
throw new Error("ref must be a valid dispatch:// reference such as dispatch://KEY-1, " + "dispatch://KEY-1/ask/<uuid>, dispatch://KEY-1/comment/<uuid>, " + "dispatch://KEY-1/artifact/<slug>, or dispatch://PROJECT/artifact/<slug>");
|
|
32201
32210
|
})() : null;
|
|
32202
32211
|
const issueArgument = args.issue;
|
|
32203
32212
|
const projectArgument = args.project;
|
|
@@ -32269,13 +32278,23 @@ async function resolveArtifact(client, owner, artifactReference) {
|
|
|
32269
32278
|
if (artifactReference === undefined) {
|
|
32270
32279
|
throw new Error("artifact is required for a project document");
|
|
32271
32280
|
}
|
|
32272
|
-
|
|
32273
|
-
|
|
32274
|
-
|
|
32275
|
-
|
|
32281
|
+
try {
|
|
32282
|
+
return {
|
|
32283
|
+
owner,
|
|
32284
|
+
artifact: await client.getProjectArtifact(owner.project, artifactReference)
|
|
32285
|
+
};
|
|
32286
|
+
} catch (error) {
|
|
32287
|
+
if (!(error instanceof DispatchServiceError) || error.status !== 404)
|
|
32288
|
+
throw error;
|
|
32289
|
+
const artifacts = await client.listProjectArtifacts(owner.project);
|
|
32290
|
+
const artifact = artifacts.find((candidate) => candidate.name === artifactReference);
|
|
32291
|
+
if (!artifact)
|
|
32292
|
+
throw error;
|
|
32293
|
+
return { owner, artifact };
|
|
32294
|
+
}
|
|
32276
32295
|
}
|
|
32277
32296
|
const issue = await client.getIssue(owner.issue);
|
|
32278
|
-
const artifact = artifactReference === undefined || artifactReference === "spec" ? issue.artifacts.find((candidate) => candidate.primary || candidate.id === issue.primary_artifact_id) : issue.artifacts.find((candidate) => candidate.id === artifactReference || candidate.slug === artifactReference);
|
|
32297
|
+
const artifact = artifactReference === undefined || artifactReference === "spec" ? issue.artifacts.find((candidate) => candidate.primary || candidate.id === issue.primary_artifact_id) : issue.artifacts.find((candidate) => candidate.id === artifactReference || candidate.slug === artifactReference || candidate.name === artifactReference);
|
|
32279
32298
|
if (!artifact) {
|
|
32280
32299
|
throw new Error(`artifact ${artifactReference ?? "spec"} was not found on issue ${issue.key}`);
|
|
32281
32300
|
}
|
|
@@ -32641,8 +32660,9 @@ Open anchored asks/comments: ${marks.join(", ")}`,
|
|
|
32641
32660
|
};
|
|
32642
32661
|
const artifactOwner = documentOwner();
|
|
32643
32662
|
const result = artifactOwner.kind === "project" ? await client.projectArtifact(artifactOwner.project, artifactInput) : await client.artifact(issue(), artifactInput);
|
|
32663
|
+
const artifactRef = artifactOwner.kind === "project" ? `dispatch://${artifactOwner.project}/artifact/${result.artifact.slug}` : `dispatch://${issue()}/artifact/${result.artifact.slug}`;
|
|
32644
32664
|
return {
|
|
32645
|
-
text: `Uploaded ${result.artifact.name} as version ${result.version.number}`,
|
|
32665
|
+
text: `Uploaded ${result.artifact.name} as version ${result.version.number} (artifact slug ${result.artifact.slug}; ${artifactRef})`,
|
|
32646
32666
|
details: artifactOwner.kind === "project" ? {
|
|
32647
32667
|
...documentResultDetails(result.artifact),
|
|
32648
32668
|
version: result.version.number
|
|
@@ -5,8 +5,8 @@ description: "Use when asking Sami a question, updating the spec, commenting on
|
|
|
5
5
|
|
|
6
6
|
# Dispatch
|
|
7
7
|
|
|
8
|
-
Dispatch is your issue's living spec, asks, comments, and artifacts. The
|
|
9
|
-
scratch pad. Anything meant for a human goes through a `dispatch_*` tool.
|
|
8
|
+
Dispatch is your issue's or project document's living spec, asks, comments, and artifacts. The
|
|
9
|
+
transcript is your scratch pad. Anything meant for a human goes through a `dispatch_*` tool.
|
|
10
10
|
|
|
11
11
|
The server enforces high signal: an ask question is at most 800 characters with at most eight
|
|
12
12
|
options; comment and message bodies are at most 2,000 characters; an artifact is at most 25 MiB.
|
|
@@ -143,6 +143,7 @@ dispatch_doc_read({ issue?, project?, artifact?, version?, ref? })
|
|
|
143
143
|
It returns live or versioned markdown with open marks. `issue` with an omitted `artifact`
|
|
144
144
|
reads the issue specification; a project needs `artifact`; and a
|
|
145
145
|
`dispatch://PROJECT/artifact/<slug>` ref supplies both. Then write narrative with:
|
|
146
|
+
|
|
146
147
|
```ts
|
|
147
148
|
dispatch_doc_edit({ issue?, project?, artifact, ops, summary? })
|
|
148
149
|
```
|
|
@@ -162,15 +163,22 @@ type EditOp = {
|
|
|
162
163
|
```
|
|
163
164
|
|
|
164
165
|
Target `replace` and `delete` by the document's plain text: inline-code and link text match
|
|
165
|
-
without Markdown syntax, and a table-cell anchor is its cell text.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
166
|
+
without Markdown syntax, and a table-cell anchor is its cell text. Quote code-block contents
|
|
167
|
+
without their Markdown fences. A quote must stay within one textblock; split changes that
|
|
168
|
+
span separate blocks into separate operations.
|
|
169
|
+
|
|
170
|
+
`replace` requires `find` and `with`; `delete` requires `find`; `insert` requires `markdown`
|
|
171
|
+
and exactly one of `after` or `before`. An insert anchor is a quote, `"start"`, `"end"`, or
|
|
172
|
+
`"heading:Title"`. Ordinary inserts create a sibling block before or after the quote or
|
|
173
|
+
heading's enclosing document block; `"start"` and `"end"` select the document edges.
|
|
174
|
+
|
|
175
|
+
At a table-cell quote, pipe-table body-row fragments extend that table before or after the
|
|
176
|
+
matched row; omit table header and delimiter rows. Short rows are padded to the table width;
|
|
177
|
+
rows wider than the table are rejected.
|
|
178
|
+
Deleting a cell's quoted text removes that text, not the surrounding row or table.
|
|
179
|
+
Use `replace` for inline continuation. Use zero-based `occurrence` for a repeated target;
|
|
180
|
+
re-read a missing or ambiguous target before retrying. Pass `summary` to name the version
|
|
181
|
+
when recording a decision. Never paste progress into a message.
|
|
174
182
|
|
|
175
183
|
## Comments and suggestions
|
|
176
184
|
|
|
@@ -185,7 +193,9 @@ It returns issue or project-document owner details plus `comment` and, for write
|
|
|
185
193
|
(`reply_to`/`reply_to_ask`) takes no `quote`; it belongs to its parent's anchor. Use `reply_to`
|
|
186
194
|
to continue a comment thread at its root; a reply to a resolved thread reopens it. Use
|
|
187
195
|
`reply_to_ask` to reply directly under a question asked with `dispatch_ask`. The two are
|
|
188
|
-
mutually exclusive. Comments are edited only by their author from the dashboard.
|
|
196
|
+
mutually exclusive. Comments are edited only by their author from the dashboard. A delivered
|
|
197
|
+
`comment.created` event carries the comment `id`; reply to it with
|
|
198
|
+
`dispatch_comment({ reply_to: <id> })`.
|
|
189
199
|
|
|
190
200
|
Propose an exact replacement instead of describing it:
|
|
191
201
|
|
|
@@ -222,6 +232,7 @@ document; it must not include `artifact`. Exactly one of `path` and `content` is
|
|
|
222
232
|
inline form sends JSON with `Content-Type: application/json`. It returns issue or
|
|
223
233
|
project-document owner details plus `artifact`, `version`, and its write `topic`. Uploading the
|
|
224
234
|
same `name` creates its next version. Use `content` when the text is already in the call.
|
|
235
|
+
Address an existing artifact by the slug shown in the upload result or by its filename.
|
|
225
236
|
|
|
226
237
|
## Messages
|
|
227
238
|
|
|
@@ -321,8 +332,8 @@ dispatch_doc_edit({
|
|
|
321
332
|
ops: [
|
|
322
333
|
{
|
|
323
334
|
op: "replace",
|
|
324
|
-
find: "
|
|
325
|
-
with: "
|
|
335
|
+
find: "Release pending.",
|
|
336
|
+
with: "Release merged and ready for deployment.",
|
|
326
337
|
},
|
|
327
338
|
],
|
|
328
339
|
summary: "Recorded merged release",
|