@sjawhar/pi-envoy 8.14.2 → 8.16.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
CHANGED
|
@@ -17297,22 +17297,31 @@ async function refuseOpenDecisionBlocks(client, tool, resolved) {
|
|
|
17297
17297
|
const asks = new Map(documentAsks.map((ask) => [ask.block_id, ask]));
|
|
17298
17298
|
const lines = version2.markdown.split(`
|
|
17299
17299
|
`);
|
|
17300
|
+
const stillOpen = (named, state) => {
|
|
17301
|
+
const next = state === "answered" ? "fold the answer into the text" : "write the decision into the text";
|
|
17302
|
+
return `${named}, ${state} but still open in version ${latest}: ${next} with dispatch doc-edit, which writes a version that carries it`;
|
|
17303
|
+
};
|
|
17300
17304
|
const open = blocks.flatMap((block) => {
|
|
17301
17305
|
const ask = asks.get(block.id);
|
|
17306
|
+
const openers = lines.filter((line) => line.includes(`ask{#${block.id} `) || line.includes(`ask{#${block.id}}`));
|
|
17307
|
+
const states = openers.map((line) => /\bstate="(\w+)"/.exec(line)?.[1]);
|
|
17302
17308
|
const named = ask === undefined ? `block ${block.id}` : `${JSON.stringify(ask.question)} (block ${block.id}, ask ${ask.id})`;
|
|
17303
|
-
const states = lines.filter((line) => line.includes(`ask{#${block.id} `) || line.includes(`ask{#${block.id}}`)).map((line) => /\bstate="(\w+)"/.exec(line)?.[1]);
|
|
17304
17309
|
if (states.length === 0)
|
|
17305
17310
|
return [`${named}, which version ${latest} does not hold yet`];
|
|
17306
17311
|
if (!states.includes("open") && states.some((state) => state !== undefined))
|
|
17307
17312
|
return [];
|
|
17308
|
-
if (ask
|
|
17313
|
+
if (ask !== undefined)
|
|
17314
|
+
return ask.state === "open" ? [named] : [stillOpen(named, ask.state)];
|
|
17315
|
+
const attribute = (name) => openers.map((line) => new RegExp(`\\b${name}="([^"]+)"`).exec(line)?.[1]).find((value) => value !== undefined);
|
|
17316
|
+
const sourceId = attribute("copied_from");
|
|
17317
|
+
const document = attribute("copied_from_document");
|
|
17318
|
+
if (sourceId === undefined || document === undefined) {
|
|
17309
17319
|
return [`${named}, whose ask Dispatch has not opened yet`];
|
|
17310
|
-
|
|
17311
|
-
|
|
17312
|
-
const
|
|
17313
|
-
|
|
17314
|
-
|
|
17315
|
-
];
|
|
17320
|
+
}
|
|
17321
|
+
const source = parseDispatchRef(document);
|
|
17322
|
+
const where = source === null ? document : source.owner.kind === "project" ? documentLabel(source.owner.project, source.id) : `${source.owner.issue} ${source.id}`;
|
|
17323
|
+
const ref = source?.owner.kind === "issue" ? dispatchChildRef(dispatchIssueRef(source.owner.issue), "ask", sourceId) : dispatchChildRef(document, "ask", sourceId);
|
|
17324
|
+
return [`${named}, a copy of ask ${ref}, which is open on ${where}: answer it there`];
|
|
17316
17325
|
});
|
|
17317
17326
|
if (open.length === 0)
|
|
17318
17327
|
return;
|
|
@@ -148,6 +148,20 @@ artifact by the slug the upload printed or by its filename, and a project docume
|
|
|
148
148
|
slug also arrives on `artifact.created` events. Dispatch suffixes a slug two documents would share, so one document's
|
|
149
149
|
filename can be another's slug (`plan v2` takes `plan-v2`, then a document named `plan-v2` takes `plan-v2-2`): a bare
|
|
150
150
|
`--artifact` that names both is refused with each one's id, while a `dispatch://` reference's document part is always the slug.
|
|
151
|
+
A document you upload holding a copy of another document's `:::ask` block, under the same `#id` and with the same
|
|
152
|
+
question, options, `multiple` and urgency, on the same issue (or the same project for a project document), opens no
|
|
153
|
+
ask: the copy shows the state and answer of the ask it was copied from, names it and its document in `copied_from` and
|
|
154
|
+
`copied_from_document`, and cannot be answered there. Answer the original: its answer or resolution shows on the copy a
|
|
155
|
+
few seconds later. A copy may hold the original's earlier wording, from before someone reworded it. It stays a copy
|
|
156
|
+
while the original is open, and shows an answer or resolution given while the original still asked that wording; an
|
|
157
|
+
answer or resolution given after the rewording decides a question the copy does not ask, so the copy opens its own ask
|
|
158
|
+
instead. A copy whose text you change opens a new ask. Once the original's block leaves its document, its copies share
|
|
159
|
+
one new ask: the first copy to settle opens it and the others name it.
|
|
160
|
+
|
|
161
|
+
An answered or resolved ask's question is fixed. Editing its block's question, options, `multiple` or urgency in the
|
|
162
|
+
document, or uploading a version that changes them, does not change the ask: a few seconds later the block is written
|
|
163
|
+
back to the question the answer was given on, beside its answer. To ask something new, write a new ask block with its
|
|
164
|
+
own `#id`. An open ask's block is its text: edit it and the ask changes with it.
|
|
151
165
|
|
|
152
166
|
A picture meant to be seen inline in a message, comment or ask is not uploaded with `dispatch artifact`: pass its local
|
|
153
167
|
path with that command's `--image`, once per picture (PNG, JPEG, GIF or WebP by its bytes, at most 25 MiB each). Each is uploaded to the issue (a
|