@sjawhar/pi-envoy 16.9.0 → 16.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dispatch.js +324 -222
- package/dist/envoy.js +261 -189
- package/dist/skills/dispatch/SKILL.md +2 -1
- package/dist/skills/dispatch-first/SKILL.md +2 -2
- package/package.json +1 -1
package/dist/envoy.js
CHANGED
|
@@ -29836,6 +29836,8 @@ var CommentEventPayloadSchema = object({
|
|
|
29836
29836
|
project_key: string2().optional(),
|
|
29837
29837
|
artifact_slug: string2().optional(),
|
|
29838
29838
|
body: string2().optional(),
|
|
29839
|
+
body_truncated: boolean2().optional(),
|
|
29840
|
+
payload_omitted: boolean2().optional(),
|
|
29839
29841
|
reply_to: string2().nullish(),
|
|
29840
29842
|
ask_id: string2().nullish(),
|
|
29841
29843
|
ask_question: string2().optional(),
|
|
@@ -29861,6 +29863,8 @@ var CommentEventPayloadSchema = object({
|
|
|
29861
29863
|
var MessageEventPayloadSchema = object({
|
|
29862
29864
|
id: string2().optional(),
|
|
29863
29865
|
body: string2().optional(),
|
|
29866
|
+
body_truncated: boolean2().optional(),
|
|
29867
|
+
payload_omitted: boolean2().optional(),
|
|
29864
29868
|
target: string2().nullish(),
|
|
29865
29869
|
in_reply_to: string2().nullish(),
|
|
29866
29870
|
reply_body: string2().optional(),
|
|
@@ -30164,12 +30168,14 @@ function componentsArgument(z) {
|
|
|
30164
30168
|
}).describe("Attach the issue to architecture components. Attach the root before decomposing it; children inherit unless they choose.");
|
|
30165
30169
|
}
|
|
30166
30170
|
var SPEC_WRITING_POINTER = "Write a spec as skill://dispatch-writing-specs says.";
|
|
30167
|
-
function imagesArgument(z, owner
|
|
30168
|
-
return z.array(z.string({ min: 1 }), { min: 1 }).describe(`Optional local picture files to show inline: PNG, JPEG, GIF or WebP (by their bytes, not their name), each at most 25 MiB. Each is uploaded to ${owner} and appended after a blank line as one  line, in this order; those lines count toward
|
|
30171
|
+
function imagesArgument(z, owner) {
|
|
30172
|
+
return z.array(z.string({ min: 1 }), { min: 1 }).describe(`Optional local picture files to show inline: PNG, JPEG, GIF or WebP (by their bytes, not their name), each at most 25 MiB. Each is uploaded to ${owner} and appended after a blank line as one  line, in this order; those lines count toward the bound Dispatch holds the text to, which it names in its refusal.`).optional();
|
|
30169
30173
|
}
|
|
30170
30174
|
var ASK_URGENCIES = ["low", "med", "high", "blocking"];
|
|
30171
|
-
var
|
|
30172
|
-
var
|
|
30175
|
+
var DISPATCH_BLOCK_UNITS = 32000;
|
|
30176
|
+
var DISPATCH_ITEM_BLOCKS = 32768;
|
|
30177
|
+
var BODY_BLOCK_RULE = `Each block (a paragraph, list, quote, table or code block) holds at most ${DISPATCH_BLOCK_UNITS} ` + `characters and a body at most ${DISPATCH_ITEM_BLOCKS} blocks; Dispatch refuses a longer one and ` + "names it, and `dispatch limits` prints the bounds.";
|
|
30178
|
+
var ASK_BOUND_RULE = "Dispatch bounds an ask's question and its options together, refuses a longer one and names " + "the bound, and `dispatch limits` prints it. An ask is short and asks one thing; its reasoning " + "goes in the document, not in the question.";
|
|
30173
30179
|
var DISPATCH_HANDOFF_BODY_MAX = 262144;
|
|
30174
30180
|
var HANDOFF_PHASE_PATTERN = /^[a-z][a-z0-9-]{0,31}$/;
|
|
30175
30181
|
var HANDOFF_PHASE_RULE_WORDS = "a lowercase letter, then up to 31 lowercase letters, digits or hyphens, such as implement";
|
|
@@ -30188,16 +30194,12 @@ function handoffProblem(value) {
|
|
|
30188
30194
|
return HANDOFF_PHASE_RULE;
|
|
30189
30195
|
if (typeof body !== "string")
|
|
30190
30196
|
return;
|
|
30191
|
-
const bytes = new TextEncoder().encode(body).length;
|
|
30192
|
-
if (bytes > DISPATCH_HANDOFF_BODY_MAX) {
|
|
30193
|
-
return `body is ${bytes - DISPATCH_HANDOFF_BODY_MAX} bytes over the ${DISPATCH_HANDOFF_BODY_MAX}-byte limit (${bytes}/${DISPATCH_HANDOFF_BODY_MAX})`;
|
|
30194
|
-
}
|
|
30195
30197
|
if (!isJsonObjectText(body)) {
|
|
30196
30198
|
return 'body is not one JSON object: a handoff body is a JSON object such as {"schemaVersion":1}';
|
|
30197
30199
|
}
|
|
30198
30200
|
return;
|
|
30199
30201
|
}
|
|
30200
|
-
var HANDOFF_RULE = `${HANDOFF_PHASE_RULE}; the body is one JSON object
|
|
30202
|
+
var HANDOFF_RULE = `${HANDOFF_PHASE_RULE}; the body is one JSON object.`;
|
|
30201
30203
|
var handoffValidation = {
|
|
30202
30204
|
check: (value) => handoffProblem(value) === undefined,
|
|
30203
30205
|
message: HANDOFF_RULE,
|
|
@@ -30262,7 +30264,7 @@ var dispatchToolSpecs = [
|
|
|
30262
30264
|
arguments: (z) => ({
|
|
30263
30265
|
issue: z.string().describe(ISSUE_REFERENCE),
|
|
30264
30266
|
status: z.enum(ISSUE_STATUSES).describe("New lifecycle status.").optional(),
|
|
30265
|
-
reason: z.string(
|
|
30267
|
+
reason: z.string().describe(`Required with status done, and only with it: why the issue is closing. Posted on the issue as a message before it closes. ${BODY_BLOCK_RULE}`).optional(),
|
|
30266
30268
|
title: z.string({ min: 1, max: ISSUE_TITLE_MAX }).describe("Replacement title, at most 1,000 characters.").optional(),
|
|
30267
30269
|
labels: z.array(z.string({ min: 1, max: 40 }), { max: 20 }).describe("Replacement label set, at most 20 labels of up to 40 characters; replaces every existing label.").optional(),
|
|
30268
30270
|
priority: z.number({ int: true, min: 0, max: 3 }).nullable().optional().describe("Coarse priority: 0 is P0 (highest) through 3 is P3 (lowest); null clears it."),
|
|
@@ -30308,13 +30310,13 @@ var dispatchToolSpecs = [
|
|
|
30308
30310
|
}
|
|
30309
30311
|
]
|
|
30310
30312
|
},
|
|
30311
|
-
description: "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. A question about the design an issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, never offer it cut down, and keep an option not to act (Hold). Set urgency high " + "when your work halts on the answer, and keep working on everything else. " + "Anchor a to-do about a document passage, thread reply_to/reply_to_ask, or cite a dispatch:// " + `reference \u2014 it must be answerable from its own text and anchor alone, never "see above". ` + `A quote anchor is pinned to its block.
|
|
30313
|
+
description: "Open a to-do or permission only a human can give, or a decision that has no document to " + "live in. A question about the design an issue's document records is not this tool: write " + "it into that document as a decision block (dispatch doc-edit inserting an ask block at the " + "end of the section it concerns), at every phase, approved spec or not; the block reaches " + "the Inbox and its answer lands next to its context. Never give an ask an Approve option: a " + "document is approved through dispatch request-approval. Do not use this tool for a status " + "update or discussion; use dispatch message instead. Never create an issue to park a " + "question: the question is an ask on the issue it concerns. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " For an action only a human can perform, state what it changes and risks as constraints. " + "Anything that requires a human to do, including a credential or grant renewal, is an ask, " + "never a message. Measure what you can first, and put the measurement and the size of the " + "population it covers in the question; drop an option that cannot fix most of that " + "population, never offer it cut down, and keep an option not to act (Hold). Set urgency high " + "when your work halts on the answer, and keep working on everything else. " + "Anchor a to-do about a document passage, thread reply_to/reply_to_ask, or cite a dispatch:// " + `reference \u2014 it must be answerable from its own text and anchor alone, never "see above". ` + `A quote anchor is pinned to its block. ${ASK_BOUND_RULE} The lines images appends count ` + `toward that bound, and an ask has at most 8 options. ${RELATED_CHECK_RESULT} ` + `An ask among the related items says whether it is answered, by whom and with which options. ${OWNER_REFERENCE}`,
|
|
30312
30314
|
arguments: (z) => ({
|
|
30313
30315
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
30314
30316
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
30315
30317
|
artifact: z.string().describe("Project document artifact id, slug, or filename.").optional(),
|
|
30316
30318
|
ref: z.string().describe("Optional dispatch:// reference (issue, document, block, message, or ask); appended to the question and rendered as a link.").optional(),
|
|
30317
|
-
question: z.string(
|
|
30319
|
+
question: z.string().describe(`${ASK_QUESTION_CONTRACT} ${ASK_BOUND_RULE}`),
|
|
30318
30320
|
options: z.array(z.object({
|
|
30319
30321
|
label: z.string().describe("Selectable option label."),
|
|
30320
30322
|
description: z.string().optional().describe("What this option costs.")
|
|
@@ -30326,7 +30328,7 @@ var dispatchToolSpecs = [
|
|
|
30326
30328
|
quote: z.string().describe("Exact text the decision concerns."),
|
|
30327
30329
|
occurrence: z.number({ int: true, min: 0 }).describe("Zero-based occurrence of the quote.").optional()
|
|
30328
30330
|
}).describe("Optional document location for the question.").optional(),
|
|
30329
|
-
images: imagesArgument(z, "the issue (or the project document's project)"
|
|
30331
|
+
images: imagesArgument(z, "the issue (or the project document's project)")
|
|
30330
30332
|
}),
|
|
30331
30333
|
validation: documentOwnerValidation(true)
|
|
30332
30334
|
},
|
|
@@ -30349,7 +30351,7 @@ var dispatchToolSpecs = [
|
|
|
30349
30351
|
description: "Edit an open question in place. Use it to correct or refine the same decision; retract the " + "old ask and open a new one when the decision itself changes. " + ASK_QUESTION_CONTRACT + " " + ASK_OPTIONS_CONTRACT + " Previous text remains in the event log. Only the asking session can edit it; answered or " + "resolved asks cannot be edited. An ask that lives as an `ask` block in a document is written " + "in the document too, changing only the fields you name - pass urgency alone and the " + "question's wording, formatting, links and comment anchors are untouched - so the edit " + "writes a document version and closes a spec's design gate until that version is approved; " + "text the block cannot carry back unchanged is refused, naming the field - an option label " + 'containing ": ", the separator between a label and its description, is one example.',
|
|
30350
30352
|
arguments: (z) => ({
|
|
30351
30353
|
ask: z.string().describe("Ask id (uuid); an 8+ hex prefix unique among this session's own open asks works too."),
|
|
30352
|
-
question: z.string(
|
|
30354
|
+
question: z.string().optional().describe(`${ASK_QUESTION_CONTRACT} Replaces the ask's question. ${ASK_BOUND_RULE}`),
|
|
30353
30355
|
options: z.array(z.object({
|
|
30354
30356
|
label: z.string().describe("Selectable option label."),
|
|
30355
30357
|
description: z.string().optional().describe("What this option costs.")
|
|
@@ -30401,7 +30403,7 @@ var dispatchToolSpecs = [
|
|
|
30401
30403
|
{
|
|
30402
30404
|
name: "dispatch_comment",
|
|
30403
30405
|
example: { issue: "DSP-1", body: "Looks good." },
|
|
30404
|
-
description: "Add review feedback to an issue or project document quote, or reply to a question asked with dispatch ask. " + "Do not use it for an exact replacement; use " + `dispatch suggest instead. A quote anchor is pinned to its block. A reply under an open ask asks for clarification, not an answer: answer it with reply_to_ask, or reword the ask with dispatch edit-ask, rather than opening a second ask.
|
|
30406
|
+
description: "Add review feedback to an issue or project document quote, or reply to a question asked with dispatch ask. " + "Do not use it for an exact replacement; use " + `dispatch suggest instead. A quote anchor is pinned to its block. A reply under an open ask asks for clarification, not an answer: answer it with reply_to_ask, or reword the ask with dispatch edit-ask, rather than opening a second ask. ${BODY_BLOCK_RULE} The lines images appends count toward it. ${OWNER_REFERENCE}`,
|
|
30405
30407
|
arguments: (z) => ({
|
|
30406
30408
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
30407
30409
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
@@ -30409,11 +30411,11 @@ var dispatchToolSpecs = [
|
|
|
30409
30411
|
ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
|
|
30410
30412
|
quote: z.string().describe("Optional exact quoted document text.").optional(),
|
|
30411
30413
|
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional(),
|
|
30412
|
-
body: z.string(
|
|
30414
|
+
body: z.string().describe(`Review comment. ${BODY_BLOCK_RULE}`),
|
|
30413
30415
|
reply_to: z.string().describe("A comment id (uuid); replying to any comment in a thread continues that thread (an " + "ask's clarification thread included). A block reference to one block of the comment " + "(dispatch://KEY/comment/<id>#b-<block id>) replies to that comment and names the " + "passage the reply answers. To reply to an ask, use reply_to_ask with the ask id, or " + "with a reference to one of its parts, instead.").optional(),
|
|
30414
30416
|
reply_to_ask: z.string().describe("Optional ask id to reply to, threading this comment under that question. A block " + "reference to one part of the ask (dispatch://KEY/ask/<id>#b-<part id>, the id an " + "option or the answer carries) threads under that ask and names the part the reply " + "answers. Mutually exclusive with reply_to.").optional(),
|
|
30415
30417
|
turn: z.enum(["agent", "human"]).describe("Only with reply_to_ask: who holds the turn after this reply. agent: a progress note - " + "you keep the turn and the ask stays 'Waiting on agents' for the human; human (default): " + "you need the human to act - the ask returns to 'Waiting on you'. human does not " + "apply to an approval request a newer version moved: it stays with you until dispatch " + "request-approval hands it back at the current version.").optional(),
|
|
30416
|
-
images: imagesArgument(z, "the issue (or the project document's project)"
|
|
30418
|
+
images: imagesArgument(z, "the issue (or the project document's project)")
|
|
30417
30419
|
}),
|
|
30418
30420
|
validation: commentValidation
|
|
30419
30421
|
},
|
|
@@ -30425,7 +30427,7 @@ var dispatchToolSpecs = [
|
|
|
30425
30427
|
quote: "old wording",
|
|
30426
30428
|
replace_with: "new wording"
|
|
30427
30429
|
},
|
|
30428
|
-
description: "Propose an exact replacement for quoted document text. Do not use it for general feedback; use " + `dispatch comment instead.
|
|
30430
|
+
description: "Propose an exact replacement for quoted document text. Do not use it for general feedback; use " + `dispatch comment instead. ${BODY_BLOCK_RULE} ${OWNER_REFERENCE}`,
|
|
30429
30431
|
arguments: (z) => ({
|
|
30430
30432
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
30431
30433
|
project: z.string().describe("Project key owning the document.").optional(),
|
|
@@ -30433,7 +30435,7 @@ var dispatchToolSpecs = [
|
|
|
30433
30435
|
ref: z.string().describe("Optional dispatch:// issue or document reference.").optional(),
|
|
30434
30436
|
quote: z.string().describe("Exact document text to replace."),
|
|
30435
30437
|
replace_with: z.string().describe("Replacement text; a CR LF or a lone carriage return in it is written as a line feed."),
|
|
30436
|
-
body: z.string(
|
|
30438
|
+
body: z.string().describe(`Optional rationale. ${BODY_BLOCK_RULE}`).optional(),
|
|
30437
30439
|
occurrence: z.number({ int: true, min: 0 }).describe("Optional zero-based occurrence of quote.").optional()
|
|
30438
30440
|
}),
|
|
30439
30441
|
validation: documentOwnerValidation(true, true)
|
|
@@ -30441,12 +30443,12 @@ var dispatchToolSpecs = [
|
|
|
30441
30443
|
{
|
|
30442
30444
|
name: "dispatch_message",
|
|
30443
30445
|
example: { issue: "DSP-1", body: "Implementation started." },
|
|
30444
|
-
description: "Post a note humans must read now: a reply to a human's message or a deliverable that landed. A to-do only a human can " + "complete is an ask (dispatch ask), so it reaches their inbox. Never progress or status updates - Dispatch is a high-signal " + "record, not a log. Not a design decision (write it as a decision block in the document) or document feedback (dispatch comment). " + "To answer a human's direct message to this session - one sent from the Agents page, which names no issue - pass that message's bare id as " + "in_reply_to and no issue; the reply lands in that conversation. Another call with the same in_reply_to and new text posts a follow-up, " + "threaded under this session's first reply; the same text again posts nothing. dispatch read --message <id> reads " + "that conversation back. " + "Every other message names its issue; keep --issue whenever the frame you answer gave one. A BTW, Aside or Steer " + "frame carries a reply_with command: answer with it, on that issue. On Oh My Pi an Agents-page Send or Aside " + "arrives as a user message: answer in the conversation, with no dispatch message. " +
|
|
30446
|
+
description: "Post a note humans must read now: a reply to a human's message or a deliverable that landed. A to-do only a human can " + "complete is an ask (dispatch ask), so it reaches their inbox. Never progress or status updates - Dispatch is a high-signal " + "record, not a log. Not a design decision (write it as a decision block in the document) or document feedback (dispatch comment). " + "To answer a human's direct message to this session - one sent from the Agents page, which names no issue - pass that message's bare id as " + "in_reply_to and no issue; the reply lands in that conversation. Another call with the same in_reply_to and new text posts a follow-up, " + "threaded under this session's first reply; the same text again posts nothing. dispatch read --message <id> reads " + "that conversation back. " + "Every other message names its issue; keep --issue whenever the frame you answer gave one. A BTW, Aside or Steer " + "frame carries a reply_with command: answer with it, on that issue. On Oh My Pi an Agents-page Send or Aside " + "arrives as a user message: answer in the conversation, with no dispatch message. " + `${BODY_BLOCK_RULE} The lines images appends count toward it. ${ISSUE_REFERENCE}`,
|
|
30445
30447
|
arguments: (z) => ({
|
|
30446
30448
|
issue: z.string().describe(`${ISSUE_REFERENCE} Omit it only when in_reply_to answers a human's direct message to this session.`).optional(),
|
|
30447
|
-
body: z.string(
|
|
30449
|
+
body: z.string().describe(`Update text. ${BODY_BLOCK_RULE}`),
|
|
30448
30450
|
in_reply_to: z.string().describe("Optional message id or dispatch://KEY/message/<id> reference to reply to, threading " + "this message under it so the reply stays with the original in the Conversation. " + "A block reference to one block of the message (dispatch://KEY/message/<id>#b-<block id>) " + "replies to that message and names the passage the reply answers. " + "A bare id with no issue answers a human's direct message to this session; a " + "dispatch://KEY/message/<id> names the issue its message lives on, so that form is a " + "reply on that issue.").optional(),
|
|
30449
|
-
images: imagesArgument(z, "the issue (a reply to a direct message: your own conversation, dispatch://agent/<your session id>)"
|
|
30451
|
+
images: imagesArgument(z, "the issue (a reply to a direct message: your own conversation, dispatch://agent/<your session id>)")
|
|
30450
30452
|
}),
|
|
30451
30453
|
validation: messageValidation
|
|
30452
30454
|
},
|
|
@@ -30708,6 +30710,13 @@ var dispatchToolSpecs = [
|
|
|
30708
30710
|
arguments: () => ({}),
|
|
30709
30711
|
strict: true
|
|
30710
30712
|
},
|
|
30713
|
+
{
|
|
30714
|
+
name: "dispatch_limits",
|
|
30715
|
+
example: {},
|
|
30716
|
+
description: "The bounds this Dispatch server holds a write to, read from the server itself: how long one block of a body may be and how many blocks a body may hold, how many options an ask may have and how long an ask's question and options are together, how long a body an event carries whole may be, and how many bytes a request, a document and a handoff body may hold. Dispatch refuses a text over a bound and names the block or the field it passed; no tool and no command cuts or refuses your text before the server reads it, so these numbers are what decides whether a write is taken.",
|
|
30717
|
+
arguments: () => ({}),
|
|
30718
|
+
strict: true
|
|
30719
|
+
},
|
|
30711
30720
|
{
|
|
30712
30721
|
name: "dispatch_handoff_write",
|
|
30713
30722
|
example: {
|
|
@@ -35004,6 +35013,9 @@ class DispatchClient {
|
|
|
35004
35013
|
async whoami() {
|
|
35005
35014
|
return this.#json("GET", ["api", "v1", "whoami"]);
|
|
35006
35015
|
}
|
|
35016
|
+
async limits() {
|
|
35017
|
+
return this.#json("GET", ["api", "v1", "limits"]);
|
|
35018
|
+
}
|
|
35007
35019
|
async inbox(assignee) {
|
|
35008
35020
|
return this.#json("GET", ["api", "v1", "inbox"], undefined, { assignee });
|
|
35009
35021
|
}
|
|
@@ -35940,6 +35952,40 @@ function eventPictures(event) {
|
|
|
35940
35952
|
}
|
|
35941
35953
|
return typeof text === "string" ? pictureAddresses(text) : [];
|
|
35942
35954
|
}
|
|
35955
|
+
function carriedItem(event) {
|
|
35956
|
+
const resource = event.type.startsWith("comment.") || event.type.startsWith("suggestion.") ? "comment" : event.type.startsWith("message.") ? "message" : undefined;
|
|
35957
|
+
if (resource === undefined || !isObject3(event.payload))
|
|
35958
|
+
return;
|
|
35959
|
+
const id = event.payload["id"];
|
|
35960
|
+
if (typeof id !== "string" || id === "")
|
|
35961
|
+
return;
|
|
35962
|
+
return { resource, id, issueKey: event.issue_key };
|
|
35963
|
+
}
|
|
35964
|
+
function bodyWasCut(payload) {
|
|
35965
|
+
return isObject3(payload) && (payload["body_truncated"] === true || payload["payload_omitted"] === true);
|
|
35966
|
+
}
|
|
35967
|
+
function wholeItemRoute(item) {
|
|
35968
|
+
return `GET /api/v1/${item.resource === "comment" ? "comments" : "messages"}/${item.id}`;
|
|
35969
|
+
}
|
|
35970
|
+
function carriedBodyNote(event) {
|
|
35971
|
+
if (!bodyWasCut(event.payload))
|
|
35972
|
+
return;
|
|
35973
|
+
const what = isObject3(event.payload) && event.payload["payload_omitted"] === true ? "this event carries no body: it was too large for the bus" : "the body is its first part only";
|
|
35974
|
+
const item = carriedItem(event);
|
|
35975
|
+
return item === undefined ? what : `${what}; read it whole with ${wholeItemRoute(item)}`;
|
|
35976
|
+
}
|
|
35977
|
+
async function wholeCarriedBody(client, item, session) {
|
|
35978
|
+
try {
|
|
35979
|
+
if (item.resource === "comment") {
|
|
35980
|
+
const read = await client.getComment(item.id);
|
|
35981
|
+
return [read.comment, ...read.replies].find((comment) => comment.id === item.id)?.body;
|
|
35982
|
+
}
|
|
35983
|
+
const read = item.issueKey === null ? session === undefined ? undefined : await client.getMessageThread(item.id, session) : await client.getMessage(item.issueKey, item.id);
|
|
35984
|
+
return read === undefined ? undefined : [read.message, ...read.replies].find((message) => message.id === item.id)?.body;
|
|
35985
|
+
} catch {
|
|
35986
|
+
return;
|
|
35987
|
+
}
|
|
35988
|
+
}
|
|
35943
35989
|
function senderLabel(envelope) {
|
|
35944
35990
|
const sender = envelope.source_session ?? envelope.source ?? "unknown";
|
|
35945
35991
|
return envelope.sender?.title === undefined ? sender : `${sender} (${envelope.sender.title})`;
|
|
@@ -36145,7 +36191,13 @@ function dispatchReplyRef(event, topic, inReplyTo, comment) {
|
|
|
36145
36191
|
function isObject3(value) {
|
|
36146
36192
|
return typeof value === "object" && value !== null;
|
|
36147
36193
|
}
|
|
36148
|
-
function
|
|
36194
|
+
function withWholeBody(event, body) {
|
|
36195
|
+
if (body === undefined || !isObject3(event.payload) || !bodyWasCut(event.payload))
|
|
36196
|
+
return event;
|
|
36197
|
+
const { body_truncated: _cut, payload_omitted: _omitted, ...carried } = event.payload;
|
|
36198
|
+
return { ...event, payload: { ...carried, body } };
|
|
36199
|
+
}
|
|
36200
|
+
function parseDispatchFrame(rawPayload, wholeBody) {
|
|
36149
36201
|
let value;
|
|
36150
36202
|
try {
|
|
36151
36203
|
value = JSON.parse(rawPayload);
|
|
@@ -36157,7 +36209,7 @@ function parseDispatchFrame(rawPayload) {
|
|
|
36157
36209
|
if (targeted.success) {
|
|
36158
36210
|
const wireFrame = value;
|
|
36159
36211
|
return {
|
|
36160
|
-
event: targeted.data.event,
|
|
36212
|
+
event: withWholeBody(targeted.data.event, wholeBody),
|
|
36161
36213
|
notify: wireFrame.event.notify,
|
|
36162
36214
|
quiet: wireFrame.event.quiet,
|
|
36163
36215
|
delivery: targeted.data.delivery
|
|
@@ -36191,7 +36243,7 @@ function parseDispatchFrame(rawPayload) {
|
|
|
36191
36243
|
return { raw: value };
|
|
36192
36244
|
const wireEvent = value;
|
|
36193
36245
|
return {
|
|
36194
|
-
event: parsed.data,
|
|
36246
|
+
event: withWholeBody(parsed.data, wholeBody),
|
|
36195
36247
|
notify: wireEvent.notify,
|
|
36196
36248
|
quiet: wireEvent.quiet,
|
|
36197
36249
|
delivery: undefined
|
|
@@ -36203,7 +36255,7 @@ function inboundTimestamp(milliseconds) {
|
|
|
36203
36255
|
const date = new Date(Math.floor(milliseconds / 1000) * 1000);
|
|
36204
36256
|
return Number.isNaN(date.getTime()) ? "unknown" : date.toISOString().replace(".000Z", "Z");
|
|
36205
36257
|
}
|
|
36206
|
-
function renderInbound(raw, sessionID, subject) {
|
|
36258
|
+
function renderInbound(raw, sessionID, subject, wholeBody) {
|
|
36207
36259
|
let value;
|
|
36208
36260
|
try {
|
|
36209
36261
|
value = JSON.parse(raw);
|
|
@@ -36239,6 +36291,8 @@ function renderInbound(raw, sessionID, subject) {
|
|
|
36239
36291
|
let rejectedDelivery;
|
|
36240
36292
|
let malformedDelivery = false;
|
|
36241
36293
|
let pictures = [];
|
|
36294
|
+
let bodyNote;
|
|
36295
|
+
let cutItem;
|
|
36242
36296
|
let inReplyTo = envelope.in_reply_to;
|
|
36243
36297
|
let askAuthor;
|
|
36244
36298
|
let trailer = "";
|
|
@@ -36248,7 +36302,7 @@ function renderInbound(raw, sessionID, subject) {
|
|
|
36248
36302
|
if (envelope.payload === undefined) {
|
|
36249
36303
|
dispatchIssue = "payload";
|
|
36250
36304
|
} else {
|
|
36251
|
-
const frame = parseDispatchFrame(envelope.payload);
|
|
36305
|
+
const frame = parseDispatchFrame(envelope.payload, wholeBody);
|
|
36252
36306
|
if ("event" in frame) {
|
|
36253
36307
|
const quiet = frame.quiet === undefined ? frame.notify === false : frame.quiet === true;
|
|
36254
36308
|
if (quiet && topic?.startsWith(DISPATCH_TOPIC_PREFIX) === true) {
|
|
@@ -36309,6 +36363,7 @@ function renderInbound(raw, sessionID, subject) {
|
|
|
36309
36363
|
replyFields: {},
|
|
36310
36364
|
issueKey: frame.event.issue_key,
|
|
36311
36365
|
body: message.data.body,
|
|
36366
|
+
...message.data.body_truncated === true ? { bodyTruncated: true } : {},
|
|
36312
36367
|
...typeof message.data.broadcast_id === "string" ? { broadcastId: message.data.broadcast_id } : {}
|
|
36313
36368
|
};
|
|
36314
36369
|
dispatchReply = {
|
|
@@ -36331,7 +36386,8 @@ function renderInbound(raw, sessionID, subject) {
|
|
|
36331
36386
|
replyPath: dispatchReplyPath("comment", requested.data.comment_id),
|
|
36332
36387
|
replyFields: { target: requested.data.target },
|
|
36333
36388
|
issueKey: frame.event.issue_key,
|
|
36334
|
-
body: comment.data.body
|
|
36389
|
+
body: comment.data.body,
|
|
36390
|
+
...comment.data.body_truncated === true ? { bodyTruncated: true } : {}
|
|
36335
36391
|
};
|
|
36336
36392
|
}
|
|
36337
36393
|
}
|
|
@@ -36346,6 +36402,9 @@ function renderInbound(raw, sessionID, subject) {
|
|
|
36346
36402
|
...compactRecord ?? { payload: dispatchPayloadForReader(frame.event, sessionID) }
|
|
36347
36403
|
};
|
|
36348
36404
|
dispatchActor = frame.event.actor;
|
|
36405
|
+
bodyNote = carriedBodyNote(frame.event);
|
|
36406
|
+
if (bodyWasCut(frame.event.payload))
|
|
36407
|
+
cutItem = carriedItem(frame.event);
|
|
36349
36408
|
pictures = eventPictures(frame.event);
|
|
36350
36409
|
if (frame.event.type === "artifact.human_edited") {
|
|
36351
36410
|
const edit = ArtifactHumanEditedEventPayloadSchema.safeParse(frame.event.payload);
|
|
@@ -36411,6 +36470,7 @@ function renderInbound(raw, sessionID, subject) {
|
|
|
36411
36470
|
...summaryIsHead ? {} : { summary: payloadSummary },
|
|
36412
36471
|
...message === undefined ? {} : { message }
|
|
36413
36472
|
},
|
|
36473
|
+
...bodyNote === undefined ? {} : { body_note: bodyNote },
|
|
36414
36474
|
...foreignSession === undefined ? {} : {
|
|
36415
36475
|
note: `body names session ${foreignSession}; the sender is ${envelope.source_session ?? "unknown"}`
|
|
36416
36476
|
},
|
|
@@ -36426,7 +36486,8 @@ ${trailer}`,
|
|
|
36426
36486
|
...delivery === undefined ? {} : { delivery },
|
|
36427
36487
|
...rejectedDelivery === undefined ? {} : { rejectedDelivery },
|
|
36428
36488
|
...malformedDelivery ? { malformedDelivery: true } : {},
|
|
36429
|
-
...pictures.length === 0 ? {} : { pictures }
|
|
36489
|
+
...pictures.length === 0 ? {} : { pictures },
|
|
36490
|
+
...cutItem === undefined ? {} : { cutItem }
|
|
36430
36491
|
};
|
|
36431
36492
|
}
|
|
36432
36493
|
|
|
@@ -38926,148 +38987,6 @@ function readDispatchFirstContext(skillFile) {
|
|
|
38926
38987
|
`);
|
|
38927
38988
|
}
|
|
38928
38989
|
|
|
38929
|
-
// ../envoy-client/src/tool-input-errors.ts
|
|
38930
|
-
class ToolInputError extends Error {
|
|
38931
|
-
tool;
|
|
38932
|
-
problems;
|
|
38933
|
-
constructor(tool, problems) {
|
|
38934
|
-
const count = problems.length;
|
|
38935
|
-
const cli = isDispatchTool(tool);
|
|
38936
|
-
const help = cli ? [
|
|
38937
|
-
`Allowed flags: ${commandFlags(tool).join(", ")}`,
|
|
38938
|
-
`Example: ${commandLine(tool, exampleFor(tool))}`
|
|
38939
|
-
] : [];
|
|
38940
|
-
super([
|
|
38941
|
-
`${cli ? `dispatch ${commandName(tool)}` : tool} was not called: ${count} problem${count === 1 ? "" : "s"}`,
|
|
38942
|
-
...problems.map((problem) => `- ${problem}`),
|
|
38943
|
-
...help.map((line) => `- ${line}`)
|
|
38944
|
-
].join(`
|
|
38945
|
-
`));
|
|
38946
|
-
this.name = "ToolInputError";
|
|
38947
|
-
this.tool = tool;
|
|
38948
|
-
this.problems = problems;
|
|
38949
|
-
}
|
|
38950
|
-
}
|
|
38951
|
-
function isDispatchTool(tool) {
|
|
38952
|
-
return dispatchToolSpecs.some((spec) => spec.name === tool);
|
|
38953
|
-
}
|
|
38954
|
-
function exampleFor(tool) {
|
|
38955
|
-
const spec = dispatchToolSpecs.find((candidate) => candidate.name === tool);
|
|
38956
|
-
return { ...spec?.example };
|
|
38957
|
-
}
|
|
38958
|
-
function unwrap(schema) {
|
|
38959
|
-
let current = schema;
|
|
38960
|
-
while (current !== undefined) {
|
|
38961
|
-
const def = current.def;
|
|
38962
|
-
if (!("innerType" in def) || !(def.type === "optional" || def.type === "nullable" || def.type === "default"))
|
|
38963
|
-
break;
|
|
38964
|
-
current = def.innerType;
|
|
38965
|
-
}
|
|
38966
|
-
return current;
|
|
38967
|
-
}
|
|
38968
|
-
function shapeOf(schema) {
|
|
38969
|
-
const unwrapped = unwrap(schema);
|
|
38970
|
-
if (unwrapped === undefined)
|
|
38971
|
-
return;
|
|
38972
|
-
const def = unwrapped.def;
|
|
38973
|
-
return def.type === "object" && "shape" in def ? def.shape : undefined;
|
|
38974
|
-
}
|
|
38975
|
-
function schemaAt(schema, path) {
|
|
38976
|
-
let current = schema;
|
|
38977
|
-
for (const key of path) {
|
|
38978
|
-
const unwrapped = unwrap(current);
|
|
38979
|
-
if (unwrapped === undefined)
|
|
38980
|
-
return;
|
|
38981
|
-
const def = unwrapped.def;
|
|
38982
|
-
if (def.type === "object" && "shape" in def) {
|
|
38983
|
-
current = shapeOf(unwrapped)?.[String(key)];
|
|
38984
|
-
} else if (def.type === "array" && "element" in def) {
|
|
38985
|
-
current = def.element;
|
|
38986
|
-
} else {
|
|
38987
|
-
return;
|
|
38988
|
-
}
|
|
38989
|
-
}
|
|
38990
|
-
return unwrap(current);
|
|
38991
|
-
}
|
|
38992
|
-
function describeInput(value) {
|
|
38993
|
-
if (value === null)
|
|
38994
|
-
return "null";
|
|
38995
|
-
if (Array.isArray(value))
|
|
38996
|
-
return "an array";
|
|
38997
|
-
switch (typeof value) {
|
|
38998
|
-
case "number":
|
|
38999
|
-
case "boolean":
|
|
39000
|
-
return String(value);
|
|
39001
|
-
case "string":
|
|
39002
|
-
return "a string";
|
|
39003
|
-
case "object":
|
|
39004
|
-
return "an object";
|
|
39005
|
-
default:
|
|
39006
|
-
return typeof value;
|
|
39007
|
-
}
|
|
39008
|
-
}
|
|
39009
|
-
function describeExpected(expected, schema) {
|
|
39010
|
-
switch (expected) {
|
|
39011
|
-
case "int":
|
|
39012
|
-
return "an integer";
|
|
39013
|
-
case "object": {
|
|
39014
|
-
const shape = shapeOf(schema);
|
|
39015
|
-
const keys = shape === undefined ? [] : Object.entries(shape).map(([key, field]) => `${key}${field.def.type === "optional" ? "?" : ""}`);
|
|
39016
|
-
return keys.length === 0 ? "an object" : `an object {${keys.join(", ")}}`;
|
|
39017
|
-
}
|
|
39018
|
-
case "array":
|
|
39019
|
-
return "an array";
|
|
39020
|
-
default:
|
|
39021
|
-
return `a ${expected}`;
|
|
39022
|
-
}
|
|
39023
|
-
}
|
|
39024
|
-
function pathText(path, cliTool) {
|
|
39025
|
-
const [head, ...rest] = path.map(String);
|
|
39026
|
-
if (cliTool === undefined || head === undefined)
|
|
39027
|
-
return path.map(String).join(".");
|
|
39028
|
-
let flag = fieldFlag(cliTool, head);
|
|
39029
|
-
let index = 0;
|
|
39030
|
-
for (;index < rest.length && /^\d+$/.test(rest[index]); index++) {
|
|
39031
|
-
flag += `[${rest[index]}]`;
|
|
39032
|
-
}
|
|
39033
|
-
const tail = rest.slice(index).map((segment) => /^\d+$/.test(segment) ? `[${segment}]` : `.${segment}`).join("").replace(/^\./, "");
|
|
39034
|
-
return tail === "" ? flag : `${flag} ${tail}`;
|
|
39035
|
-
}
|
|
39036
|
-
function formatZodIssues(issues, schema, tool) {
|
|
39037
|
-
const cliTool = isDispatchTool(tool) ? tool : undefined;
|
|
39038
|
-
const allowed = Object.keys(shapeOf(schema) ?? {}).join(", ");
|
|
39039
|
-
return issues.flatMap((issue) => {
|
|
39040
|
-
const path = pathText(issue.path, cliTool);
|
|
39041
|
-
switch (issue.code) {
|
|
39042
|
-
case "invalid_type":
|
|
39043
|
-
return issue.input === undefined ? [`${path} is required (${issue.expected})`] : [
|
|
39044
|
-
`${path} must be ${describeExpected(issue.expected, schemaAt(schema, issue.path))}, not ${describeInput(issue.input)}`
|
|
39045
|
-
];
|
|
39046
|
-
case "unrecognized_keys": {
|
|
39047
|
-
if (cliTool !== undefined && issue.path.length === 0) {
|
|
39048
|
-
return issue.keys.map((key) => `unknown flag ${fieldFlag(cliTool, key)}`);
|
|
39049
|
-
}
|
|
39050
|
-
const here = Object.keys(shapeOf(schemaAt(schema, issue.path)) ?? {}).join(", ") || allowed;
|
|
39051
|
-
const where = path === "" ? "" : ` in ${path}`;
|
|
39052
|
-
return issue.keys.map((key) => `unknown field "${key}"${where}; allowed: ${here}`);
|
|
39053
|
-
}
|
|
39054
|
-
case "invalid_value":
|
|
39055
|
-
return [
|
|
39056
|
-
`${path} must be one of ${issue.values.map(String).join("|")}; got ${JSON.stringify(issue.input)}`
|
|
39057
|
-
];
|
|
39058
|
-
case "too_big":
|
|
39059
|
-
if (issue.origin === "array" && Array.isArray(issue.input)) {
|
|
39060
|
-
return [`${path} has ${issue.input.length} items; the limit is ${issue.maximum}`];
|
|
39061
|
-
}
|
|
39062
|
-
return [`${path} ${issue.message}`];
|
|
39063
|
-
case "custom":
|
|
39064
|
-
return [issue.message];
|
|
39065
|
-
default:
|
|
39066
|
-
return [path === "" ? issue.message : `${path}: ${issue.message}`];
|
|
39067
|
-
}
|
|
39068
|
-
});
|
|
39069
|
-
}
|
|
39070
|
-
|
|
39071
38990
|
// ../envoy-client/src/dispatch-picture-tools.ts
|
|
39072
38991
|
var PICTURE_TYPE_NAMES = "a PNG, JPEG, GIF or WebP";
|
|
39073
38992
|
var AGENT_ARTIFACT_REF = new RegExp(`^dispatch://agent/(${SESSION_ID_PATTERN})/artifact/([^/@]+)(?:@v(\\d+))?$`, "u");
|
|
@@ -39606,6 +39525,148 @@ async function readSessionAnswers(options) {
|
|
|
39606
39525
|
};
|
|
39607
39526
|
}
|
|
39608
39527
|
|
|
39528
|
+
// ../envoy-client/src/tool-input-errors.ts
|
|
39529
|
+
class ToolInputError extends Error {
|
|
39530
|
+
tool;
|
|
39531
|
+
problems;
|
|
39532
|
+
constructor(tool, problems) {
|
|
39533
|
+
const count = problems.length;
|
|
39534
|
+
const cli = isDispatchTool(tool);
|
|
39535
|
+
const help = cli ? [
|
|
39536
|
+
`Allowed flags: ${commandFlags(tool).join(", ")}`,
|
|
39537
|
+
`Example: ${commandLine(tool, exampleFor(tool))}`
|
|
39538
|
+
] : [];
|
|
39539
|
+
super([
|
|
39540
|
+
`${cli ? `dispatch ${commandName(tool)}` : tool} was not called: ${count} problem${count === 1 ? "" : "s"}`,
|
|
39541
|
+
...problems.map((problem) => `- ${problem}`),
|
|
39542
|
+
...help.map((line) => `- ${line}`)
|
|
39543
|
+
].join(`
|
|
39544
|
+
`));
|
|
39545
|
+
this.name = "ToolInputError";
|
|
39546
|
+
this.tool = tool;
|
|
39547
|
+
this.problems = problems;
|
|
39548
|
+
}
|
|
39549
|
+
}
|
|
39550
|
+
function isDispatchTool(tool) {
|
|
39551
|
+
return dispatchToolSpecs.some((spec) => spec.name === tool);
|
|
39552
|
+
}
|
|
39553
|
+
function exampleFor(tool) {
|
|
39554
|
+
const spec = dispatchToolSpecs.find((candidate) => candidate.name === tool);
|
|
39555
|
+
return { ...spec?.example };
|
|
39556
|
+
}
|
|
39557
|
+
function unwrap(schema) {
|
|
39558
|
+
let current = schema;
|
|
39559
|
+
while (current !== undefined) {
|
|
39560
|
+
const def = current.def;
|
|
39561
|
+
if (!("innerType" in def) || !(def.type === "optional" || def.type === "nullable" || def.type === "default"))
|
|
39562
|
+
break;
|
|
39563
|
+
current = def.innerType;
|
|
39564
|
+
}
|
|
39565
|
+
return current;
|
|
39566
|
+
}
|
|
39567
|
+
function shapeOf(schema) {
|
|
39568
|
+
const unwrapped = unwrap(schema);
|
|
39569
|
+
if (unwrapped === undefined)
|
|
39570
|
+
return;
|
|
39571
|
+
const def = unwrapped.def;
|
|
39572
|
+
return def.type === "object" && "shape" in def ? def.shape : undefined;
|
|
39573
|
+
}
|
|
39574
|
+
function schemaAt(schema, path) {
|
|
39575
|
+
let current = schema;
|
|
39576
|
+
for (const key of path) {
|
|
39577
|
+
const unwrapped = unwrap(current);
|
|
39578
|
+
if (unwrapped === undefined)
|
|
39579
|
+
return;
|
|
39580
|
+
const def = unwrapped.def;
|
|
39581
|
+
if (def.type === "object" && "shape" in def) {
|
|
39582
|
+
current = shapeOf(unwrapped)?.[String(key)];
|
|
39583
|
+
} else if (def.type === "array" && "element" in def) {
|
|
39584
|
+
current = def.element;
|
|
39585
|
+
} else {
|
|
39586
|
+
return;
|
|
39587
|
+
}
|
|
39588
|
+
}
|
|
39589
|
+
return unwrap(current);
|
|
39590
|
+
}
|
|
39591
|
+
function describeInput(value) {
|
|
39592
|
+
if (value === null)
|
|
39593
|
+
return "null";
|
|
39594
|
+
if (Array.isArray(value))
|
|
39595
|
+
return "an array";
|
|
39596
|
+
switch (typeof value) {
|
|
39597
|
+
case "number":
|
|
39598
|
+
case "boolean":
|
|
39599
|
+
return String(value);
|
|
39600
|
+
case "string":
|
|
39601
|
+
return "a string";
|
|
39602
|
+
case "object":
|
|
39603
|
+
return "an object";
|
|
39604
|
+
default:
|
|
39605
|
+
return typeof value;
|
|
39606
|
+
}
|
|
39607
|
+
}
|
|
39608
|
+
function describeExpected(expected, schema) {
|
|
39609
|
+
switch (expected) {
|
|
39610
|
+
case "int":
|
|
39611
|
+
return "an integer";
|
|
39612
|
+
case "object": {
|
|
39613
|
+
const shape = shapeOf(schema);
|
|
39614
|
+
const keys = shape === undefined ? [] : Object.entries(shape).map(([key, field]) => `${key}${field.def.type === "optional" ? "?" : ""}`);
|
|
39615
|
+
return keys.length === 0 ? "an object" : `an object {${keys.join(", ")}}`;
|
|
39616
|
+
}
|
|
39617
|
+
case "array":
|
|
39618
|
+
return "an array";
|
|
39619
|
+
default:
|
|
39620
|
+
return `a ${expected}`;
|
|
39621
|
+
}
|
|
39622
|
+
}
|
|
39623
|
+
function pathText(path, cliTool) {
|
|
39624
|
+
const [head, ...rest] = path.map(String);
|
|
39625
|
+
if (cliTool === undefined || head === undefined)
|
|
39626
|
+
return path.map(String).join(".");
|
|
39627
|
+
let flag = fieldFlag(cliTool, head);
|
|
39628
|
+
let index = 0;
|
|
39629
|
+
for (;index < rest.length && /^\d+$/.test(rest[index]); index++) {
|
|
39630
|
+
flag += `[${rest[index]}]`;
|
|
39631
|
+
}
|
|
39632
|
+
const tail = rest.slice(index).map((segment) => /^\d+$/.test(segment) ? `[${segment}]` : `.${segment}`).join("").replace(/^\./, "");
|
|
39633
|
+
return tail === "" ? flag : `${flag} ${tail}`;
|
|
39634
|
+
}
|
|
39635
|
+
function formatZodIssues(issues, schema, tool) {
|
|
39636
|
+
const cliTool = isDispatchTool(tool) ? tool : undefined;
|
|
39637
|
+
const allowed = Object.keys(shapeOf(schema) ?? {}).join(", ");
|
|
39638
|
+
return issues.flatMap((issue) => {
|
|
39639
|
+
const path = pathText(issue.path, cliTool);
|
|
39640
|
+
switch (issue.code) {
|
|
39641
|
+
case "invalid_type":
|
|
39642
|
+
return issue.input === undefined ? [`${path} is required (${issue.expected})`] : [
|
|
39643
|
+
`${path} must be ${describeExpected(issue.expected, schemaAt(schema, issue.path))}, not ${describeInput(issue.input)}`
|
|
39644
|
+
];
|
|
39645
|
+
case "unrecognized_keys": {
|
|
39646
|
+
if (cliTool !== undefined && issue.path.length === 0) {
|
|
39647
|
+
return issue.keys.map((key) => `unknown flag ${fieldFlag(cliTool, key)}`);
|
|
39648
|
+
}
|
|
39649
|
+
const here = Object.keys(shapeOf(schemaAt(schema, issue.path)) ?? {}).join(", ") || allowed;
|
|
39650
|
+
const where = path === "" ? "" : ` in ${path}`;
|
|
39651
|
+
return issue.keys.map((key) => `unknown field "${key}"${where}; allowed: ${here}`);
|
|
39652
|
+
}
|
|
39653
|
+
case "invalid_value":
|
|
39654
|
+
return [
|
|
39655
|
+
`${path} must be one of ${issue.values.map(String).join("|")}; got ${JSON.stringify(issue.input)}`
|
|
39656
|
+
];
|
|
39657
|
+
case "too_big":
|
|
39658
|
+
if (issue.origin === "array" && Array.isArray(issue.input)) {
|
|
39659
|
+
return [`${path} has ${issue.input.length} items; the limit is ${issue.maximum}`];
|
|
39660
|
+
}
|
|
39661
|
+
return [`${path} ${issue.message}`];
|
|
39662
|
+
case "custom":
|
|
39663
|
+
return [issue.message];
|
|
39664
|
+
default:
|
|
39665
|
+
return [path === "" ? issue.message : `${path}: ${issue.message}`];
|
|
39666
|
+
}
|
|
39667
|
+
});
|
|
39668
|
+
}
|
|
39669
|
+
|
|
39609
39670
|
// ../envoy-client/src/dispatch-execute.ts
|
|
39610
39671
|
var triageAdviceShown = new Set;
|
|
39611
39672
|
var nativeIssueKeyPattern = /^[A-Z][A-Z0-9]{1,9}-[0-9]+$/;
|
|
@@ -39625,6 +39686,7 @@ var issueFreeTools = {
|
|
|
39625
39686
|
dispatch_open_asks: true,
|
|
39626
39687
|
dispatch_answers: true,
|
|
39627
39688
|
dispatch_whoami: true,
|
|
39689
|
+
dispatch_limits: true,
|
|
39628
39690
|
dispatch_inbox: true,
|
|
39629
39691
|
dispatch_architecture_sync: true
|
|
39630
39692
|
};
|
|
@@ -41041,7 +41103,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
41041
41103
|
|
|
41042
41104
|
// package.json
|
|
41043
41105
|
var name = "@sjawhar/pi-envoy";
|
|
41044
|
-
var version2 = "16.
|
|
41106
|
+
var version2 = "16.10.0";
|
|
41045
41107
|
var package_default = {
|
|
41046
41108
|
name,
|
|
41047
41109
|
version: version2,
|
|
@@ -42159,22 +42221,18 @@ function handledAttempts(entries) {
|
|
|
42159
42221
|
function typedInputReply(text, outcome) {
|
|
42160
42222
|
const typed = /^\/\S+/.exec(text)?.[0];
|
|
42161
42223
|
const command = typed ?? "This message";
|
|
42162
|
-
let reply;
|
|
42163
42224
|
if ("error" in outcome)
|
|
42164
|
-
|
|
42165
|
-
|
|
42166
|
-
|
|
42167
|
-
|
|
42168
|
-
|
|
42169
|
-
|
|
42170
|
-
|
|
42171
|
-
|
|
42172
|
-
|
|
42173
|
-
}
|
|
42174
|
-
|
|
42175
|
-
if (reply === undefined || reply.length <= DISPATCH_BODY_MAX)
|
|
42176
|
-
return reply;
|
|
42177
|
-
return `${reply.slice(0, DISPATCH_BODY_MAX - 1)}\u2026`;
|
|
42225
|
+
return `${command} was not run: ${outcome.error}`;
|
|
42226
|
+
if ("hostVersion" in outcome) {
|
|
42227
|
+
return typed === undefined ? undefined : `${typed} was not run: this session's Oh My Pi ${outcome.hostVersion} cannot run commands sent from Dispatch; nothing was sent.`;
|
|
42228
|
+
}
|
|
42229
|
+
if (outcome.handled === "terminal-only") {
|
|
42230
|
+
return `${command} runs only in the session's own terminal; nothing was sent.`;
|
|
42231
|
+
}
|
|
42232
|
+
if (outcome.handled === "unavailable") {
|
|
42233
|
+
return `${command} was not run: this session's host cannot run typed input from Dispatch; nothing was sent.`;
|
|
42234
|
+
}
|
|
42235
|
+
return outcome.output?.trim() ? outcome.output : undefined;
|
|
42178
42236
|
}
|
|
42179
42237
|
|
|
42180
42238
|
// src/envoy-session.ts
|
|
@@ -46743,6 +46801,7 @@ function liveSessionSettings(live) {
|
|
|
46743
46801
|
var codec2 = import_nats2.StringCodec();
|
|
46744
46802
|
var NATS_RETRY_INTERVAL_MS = 15000;
|
|
46745
46803
|
var DELIVERY_PICTURES_TIMEOUT_MS = 20000;
|
|
46804
|
+
var WHOLE_BODY_TIMEOUT_MS = 1e4;
|
|
46746
46805
|
var BTW_EVENTS_LIMIT = 1000;
|
|
46747
46806
|
var REPLAYED_BTW_NOTE = "This BTW was asked while this session was not taking messages. It is shown for your information only: it runs no side turn and needs no answer. Dispatch shows whether it was answered.";
|
|
46748
46807
|
var CAPABILITIES_WITHOUT_BTW = DELIVERY_CAPABILITIES.filter((capability) => capability !== "btw");
|
|
@@ -47278,8 +47337,15 @@ function envoyExtension(pi) {
|
|
|
47278
47337
|
return typedInputReply(turn.body, { error: messageFor(error) });
|
|
47279
47338
|
}).then(async (reply) => {
|
|
47280
47339
|
refreshAgentStreamSettings(sessionID);
|
|
47281
|
-
if (reply
|
|
47340
|
+
if (reply === undefined)
|
|
47341
|
+
return;
|
|
47342
|
+
try {
|
|
47282
47343
|
await postDispatchReply(delivery, { body: reply }, replySessionID);
|
|
47344
|
+
} catch (error) {
|
|
47345
|
+
if (!(error instanceof DispatchServiceError) || !error.fromDispatch)
|
|
47346
|
+
throw error;
|
|
47347
|
+
await postDispatchReply(delivery, { body: `Your command ran, and Dispatch refused its output: ${error.message}` }, replySessionID);
|
|
47348
|
+
}
|
|
47283
47349
|
}).catch((error) => {
|
|
47284
47350
|
logger3.warn("envoy: the reply to a person's typed input did not reach Dispatch", {
|
|
47285
47351
|
attempt: delivery.attempt,
|
|
@@ -47318,7 +47384,7 @@ function envoyExtension(pi) {
|
|
|
47318
47384
|
}
|
|
47319
47385
|
};
|
|
47320
47386
|
const deliver = async (topic, subject, raw, reply, receivedAt, relayed) => {
|
|
47321
|
-
|
|
47387
|
+
let rendered = renderInbound(raw, sessionID, subject);
|
|
47322
47388
|
const directSubject = agentSubject(sessionID);
|
|
47323
47389
|
if (expectsLaneReceipt({
|
|
47324
47390
|
subject,
|
|
@@ -47374,6 +47440,12 @@ function envoyExtension(pi) {
|
|
|
47374
47440
|
claim.settle();
|
|
47375
47441
|
return;
|
|
47376
47442
|
}
|
|
47443
|
+
if (rendered.cutItem !== undefined) {
|
|
47444
|
+
const dispatch = timedDispatchClient(WHOLE_BODY_TIMEOUT_MS);
|
|
47445
|
+
const body = dispatch === undefined ? undefined : await wholeCarriedBody(dispatch, rendered.cutItem, sessionID);
|
|
47446
|
+
if (body !== undefined)
|
|
47447
|
+
rendered = renderInbound(raw, sessionID, subject, body);
|
|
47448
|
+
}
|
|
47377
47449
|
const envelope = rendered.envelope;
|
|
47378
47450
|
if (envelope !== undefined)
|
|
47379
47451
|
noteInbox(envelope);
|