@sjawhar/pi-envoy 15.0.0 → 15.0.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/dispatch.js +33 -2
- package/dist/envoy.js +44 -3
- package/package.json +1 -1
package/dist/dispatch.js
CHANGED
|
@@ -15328,7 +15328,7 @@ var dispatchToolSpecs = [
|
|
|
15328
15328
|
name: "dispatch_artifact",
|
|
15329
15329
|
example: { issue: "DSP-1", name: "design.md", content: `# Design
|
|
15330
15330
|
` },
|
|
15331
|
-
description: "Attach a local file or inline text as an issue artifact or project document. Do not use it to edit a live document; use " + "dispatch doc-edit instead. Never upload a document's own name to change it (spec.md replaces the spec whole); edit it with dispatch doc-edit. Uploading the same name again makes its next version. Exactly one of path or content is required; a markdown document is at most 1 MiB and any other file at most 25 MiB. " + "Markdown is also refused with 413 CAP_EXCEEDED when it makes more than 65,536 elements (a block weighs 3, and an empty list item, quote, footnote definition or typed block 3 more for the empty paragraph it holds; a table cell 4, a hard line break 3, an image 3, a piece of inline HTML 2, an autolink 2, a footnote reference 2; inline syntax, marks, lines of text and backslash escapes or character references 1 each), or when a new version would leave the document's stored markdown (what its text reads back as) longer than 1 MiB or making more than 65,536 elements, and longer or heavier than before; shorten it or split it across documents. " + "In a table row, write every | in a cell as \\|, in code too: a | after two backslashes ends the cell, and a row with more cells than its table is refused. " + "Markdown holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK; a new version of a document is held to it only for the asks it writes or changes. " + `${OWNER_REFERENCE}`,
|
|
15331
|
+
description: "Attach a local file or inline text as an issue artifact or project document. Do not use it to edit a live document; use " + "dispatch doc-edit instead. Never upload a document's own name to change it (spec.md replaces the spec whole); edit it with dispatch doc-edit. Uploading the same name again makes its next version, and so does uploading a document's slug (plan-md for plan.md). Exactly one of path or content is required; a markdown document is at most 1 MiB and any other file at most 25 MiB. " + "Markdown is also refused with 413 CAP_EXCEEDED when it makes more than 65,536 elements (a block weighs 3, and an empty list item, quote, footnote definition or typed block 3 more for the empty paragraph it holds; a table cell 4, a hard line break 3, an image 3, a piece of inline HTML 2, an autolink 2, a footnote reference 2; inline syntax, marks, lines of text and backslash escapes or character references 1 each), or when a new version would leave the document's stored markdown (what its text reads back as) longer than 1 MiB or making more than 65,536 elements, and longer or heavier than before; shorten it or split it across documents. " + "In a table row, write every | in a cell as \\|, in code too: a | after two backslashes ends the cell, and a row with more cells than its table is refused. " + "Markdown holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK; a new version of a document is held to it only for the asks it writes or changes. " + `${OWNER_REFERENCE}`,
|
|
15332
15332
|
arguments: (z) => ({
|
|
15333
15333
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
15334
15334
|
project: z.string().describe("Project key for an unlinked document.").optional(),
|
|
@@ -16593,6 +16593,35 @@ var KEYED_LAYER_MEMORY_MS = 5 * 60000;
|
|
|
16593
16593
|
var KEYED_LAYER_SEEN = new Map;
|
|
16594
16594
|
var KEYED_LAYER_PROBES = new Map;
|
|
16595
16595
|
var KEY_LAYER_PROBE_MS = 5000;
|
|
16596
|
+
function keyedLayerMemory() {
|
|
16597
|
+
const wall = Date.now();
|
|
16598
|
+
const now = performance.now();
|
|
16599
|
+
const kept = {};
|
|
16600
|
+
for (const [origin, seen] of KEYED_LAYER_SEEN) {
|
|
16601
|
+
const age = now - seen;
|
|
16602
|
+
if (age >= 0 && age < KEYED_LAYER_MEMORY_MS) {
|
|
16603
|
+
kept[origin] = new Date(wall - age).toISOString();
|
|
16604
|
+
}
|
|
16605
|
+
}
|
|
16606
|
+
return kept;
|
|
16607
|
+
}
|
|
16608
|
+
function rememberKeyedLayer(saved) {
|
|
16609
|
+
if (typeof saved !== "object" || saved === null)
|
|
16610
|
+
return;
|
|
16611
|
+
const wall = Date.now();
|
|
16612
|
+
const now = performance.now();
|
|
16613
|
+
for (const [origin, at] of Object.entries(saved)) {
|
|
16614
|
+
if (typeof at !== "string")
|
|
16615
|
+
continue;
|
|
16616
|
+
const age = wall - Date.parse(at);
|
|
16617
|
+
if (!(age >= 0 && age < KEYED_LAYER_MEMORY_MS))
|
|
16618
|
+
continue;
|
|
16619
|
+
const seen = now - age;
|
|
16620
|
+
const known = KEYED_LAYER_SEEN.get(origin);
|
|
16621
|
+
if (known === undefined || known < seen)
|
|
16622
|
+
KEYED_LAYER_SEEN.set(origin, seen);
|
|
16623
|
+
}
|
|
16624
|
+
}
|
|
16596
16625
|
function keyEchoed(response, key) {
|
|
16597
16626
|
const echoed = response.headers.get(IDEMPOTENCY_KEY_HEADER)?.trim() ?? "";
|
|
16598
16627
|
return echoed.replace(/^"(.*)"$/, "$1") === key;
|
|
@@ -21094,13 +21123,15 @@ function loadSessionMemory(dir, sessionId) {
|
|
|
21094
21123
|
const pictures = shownPictures(sessionId);
|
|
21095
21124
|
for (const address of stringList(state.pictures))
|
|
21096
21125
|
pictures.add(address);
|
|
21126
|
+
rememberKeyedLayer(state.keyedLayer);
|
|
21097
21127
|
return new Set(stringList(state.follows));
|
|
21098
21128
|
}
|
|
21099
21129
|
function writeMemory(dir, sessionId, follows) {
|
|
21100
21130
|
const state = {
|
|
21101
21131
|
advice: [...adviceMemory()],
|
|
21102
21132
|
pictures: [...shownPictures(sessionId)],
|
|
21103
|
-
follows: [...follows]
|
|
21133
|
+
follows: [...follows],
|
|
21134
|
+
keyedLayer: keyedLayerMemory()
|
|
21104
21135
|
};
|
|
21105
21136
|
writeAtomically(join3(dir, "state.json"), `${JSON.stringify(state)}
|
|
21106
21137
|
`);
|
package/dist/envoy.js
CHANGED
|
@@ -30448,7 +30448,7 @@ var dispatchToolSpecs = [
|
|
|
30448
30448
|
name: "dispatch_artifact",
|
|
30449
30449
|
example: { issue: "DSP-1", name: "design.md", content: `# Design
|
|
30450
30450
|
` },
|
|
30451
|
-
description: "Attach a local file or inline text as an issue artifact or project document. Do not use it to edit a live document; use " + "dispatch doc-edit instead. Never upload a document's own name to change it (spec.md replaces the spec whole); edit it with dispatch doc-edit. Uploading the same name again makes its next version. Exactly one of path or content is required; a markdown document is at most 1 MiB and any other file at most 25 MiB. " + "Markdown is also refused with 413 CAP_EXCEEDED when it makes more than 65,536 elements (a block weighs 3, and an empty list item, quote, footnote definition or typed block 3 more for the empty paragraph it holds; a table cell 4, a hard line break 3, an image 3, a piece of inline HTML 2, an autolink 2, a footnote reference 2; inline syntax, marks, lines of text and backslash escapes or character references 1 each), or when a new version would leave the document's stored markdown (what its text reads back as) longer than 1 MiB or making more than 65,536 elements, and longer or heavier than before; shorten it or split it across documents. " + "In a table row, write every | in a cell as \\|, in code too: a | after two backslashes ends the cell, and a row with more cells than its table is refused. " + "Markdown holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK; a new version of a document is held to it only for the asks it writes or changes. " + `${OWNER_REFERENCE}`,
|
|
30451
|
+
description: "Attach a local file or inline text as an issue artifact or project document. Do not use it to edit a live document; use " + "dispatch doc-edit instead. Never upload a document's own name to change it (spec.md replaces the spec whole); edit it with dispatch doc-edit. Uploading the same name again makes its next version, and so does uploading a document's slug (plan-md for plan.md). Exactly one of path or content is required; a markdown document is at most 1 MiB and any other file at most 25 MiB. " + "Markdown is also refused with 413 CAP_EXCEEDED when it makes more than 65,536 elements (a block weighs 3, and an empty list item, quote, footnote definition or typed block 3 more for the empty paragraph it holds; a table cell 4, a hard line break 3, an image 3, a piece of inline HTML 2, an autolink 2, a footnote reference 2; inline syntax, marks, lines of text and backslash escapes or character references 1 each), or when a new version would leave the document's stored markdown (what its text reads back as) longer than 1 MiB or making more than 65,536 elements, and longer or heavier than before; shorten it or split it across documents. " + "In a table row, write every | in a cell as \\|, in code too: a | after two backslashes ends the cell, and a row with more cells than its table is refused. " + "Markdown holding an ask block whose body breaks its content rule (one or more question paragraphs, then at most one bullet list of options, last) is refused with 400 INVALID_ASK_BLOCK; a new version of a document is held to it only for the asks it writes or changes. " + `${OWNER_REFERENCE}`,
|
|
30452
30452
|
arguments: (z) => ({
|
|
30453
30453
|
issue: z.string().describe(ISSUE_REFERENCE).optional(),
|
|
30454
30454
|
project: z.string().describe("Project key for an unlinked document.").optional(),
|
|
@@ -37062,6 +37062,7 @@ async function readDocumentBlocks(client, target, context) {
|
|
|
37062
37062
|
const decoder = new TextDecoder;
|
|
37063
37063
|
return {
|
|
37064
37064
|
name: resolved.artifact.name,
|
|
37065
|
+
slug: resolved.artifact.slug,
|
|
37065
37066
|
blocks: live.blocks.map((block) => ({
|
|
37066
37067
|
id: block.id,
|
|
37067
37068
|
text: decoder.decode(live.bytes.subarray(block.from, block.to))
|
|
@@ -37992,7 +37993,7 @@ var import_nats2 = __toESM(require_mod4(), 1);
|
|
|
37992
37993
|
|
|
37993
37994
|
// package.json
|
|
37994
37995
|
var name = "@sjawhar/pi-envoy";
|
|
37995
|
-
var version2 = "15.0.
|
|
37996
|
+
var version2 = "15.0.1";
|
|
37996
37997
|
var package_default = {
|
|
37997
37998
|
name,
|
|
37998
37999
|
version: version2,
|
|
@@ -41045,7 +41046,7 @@ async function readAsks(deps, call, first) {
|
|
|
41045
41046
|
return { asks, textMissing, asksPartial: false };
|
|
41046
41047
|
}
|
|
41047
41048
|
const name = uploadName(call.input);
|
|
41048
|
-
const currentIds = read !== "not-found" && read.name === name ? new Set(read.blocks.map((block) => block.id)) : undefined;
|
|
41049
|
+
const currentIds = read !== "not-found" && (read.name === name || read.slug === name) ? new Set(read.blocks.map((block) => block.id)) : undefined;
|
|
41049
41050
|
return {
|
|
41050
41051
|
asks: first.filter((ask) => ask.id === undefined || currentIds?.has(ask.id) !== true),
|
|
41051
41052
|
textMissing: false,
|
|
@@ -41245,6 +41246,40 @@ var OPERATORS = ["&&", "||", ";;", "|&", ";", "&", "|", "(", ")"];
|
|
|
41245
41246
|
var REDIRECT = /^(\d*)(&>>|&>|<<<|<<-|<<|<>|<&|>&|>>|>\||<|>)/;
|
|
41246
41247
|
var QUOTED_DELIMITER = /^(?:'[A-Za-z_][A-Za-z0-9_]*'|"[A-Za-z_][A-Za-z0-9_]*")$/;
|
|
41247
41248
|
var EXPANDING = "$`~*?[";
|
|
41249
|
+
function heredocSubstitution(text, from) {
|
|
41250
|
+
if (!text.startsWith("$(", from))
|
|
41251
|
+
return;
|
|
41252
|
+
const opener = /^[^\S\n]*cat[^\S\n]+(?:-[^\S\n]+)?<<(-?)[^\S\n]*(?:'([^']*)'|"([^"\\`]*)")[^\S\n]*\n/.exec(text.slice(from + 2));
|
|
41253
|
+
if (opener === null)
|
|
41254
|
+
return;
|
|
41255
|
+
const delimiter = opener[2] ?? opener[3] ?? "";
|
|
41256
|
+
if (delimiter === "")
|
|
41257
|
+
return;
|
|
41258
|
+
const strip = opener[1] === "-";
|
|
41259
|
+
const body = [];
|
|
41260
|
+
let index = from + 2 + opener[0].length;
|
|
41261
|
+
while (index <= text.length) {
|
|
41262
|
+
const stop = text.indexOf(`
|
|
41263
|
+
`, index);
|
|
41264
|
+
const line = text.slice(index, stop === -1 ? text.length : stop);
|
|
41265
|
+
if ((strip ? line.replace(/^\t+/, "") : line) === delimiter) {
|
|
41266
|
+
const rest = text.slice(stop === -1 ? text.length : stop + 1);
|
|
41267
|
+
const close = /^\s*\)/.exec(rest);
|
|
41268
|
+
if (close === null)
|
|
41269
|
+
return;
|
|
41270
|
+
return {
|
|
41271
|
+
end: (stop === -1 ? text.length : stop + 1) + close[0].length,
|
|
41272
|
+
value: body.join(`
|
|
41273
|
+
`).replace(/\n+$/, "")
|
|
41274
|
+
};
|
|
41275
|
+
}
|
|
41276
|
+
if (stop === -1)
|
|
41277
|
+
break;
|
|
41278
|
+
body.push(strip ? line.replace(/^\t+/, "") : line);
|
|
41279
|
+
index = stop + 1;
|
|
41280
|
+
}
|
|
41281
|
+
return;
|
|
41282
|
+
}
|
|
41248
41283
|
function expansionEnd(text, from) {
|
|
41249
41284
|
if (text[from] === "`") {
|
|
41250
41285
|
let index = from + 1;
|
|
@@ -41322,6 +41357,12 @@ function readWord(text, from) {
|
|
|
41322
41357
|
while (index < text.length && text[index] !== '"') {
|
|
41323
41358
|
const inner = text[index];
|
|
41324
41359
|
if (REFUSED_DOUBLE_QUOTED2.includes(inner)) {
|
|
41360
|
+
const here = inner === "$" ? heredocSubstitution(text, index) : undefined;
|
|
41361
|
+
if (here !== undefined) {
|
|
41362
|
+
value += here.value;
|
|
41363
|
+
index = here.end;
|
|
41364
|
+
continue;
|
|
41365
|
+
}
|
|
41325
41366
|
unread.push(inner);
|
|
41326
41367
|
refused = true;
|
|
41327
41368
|
if (inner === "\\") {
|