@tryarcanist/cli 0.1.184 → 0.1.185
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/index.js +51 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2298,6 +2298,54 @@ function resolveAuthoritativePromptEventsWithDiagnostics(raw) {
|
|
|
2298
2298
|
};
|
|
2299
2299
|
}
|
|
2300
2300
|
|
|
2301
|
+
// ../../shared/transcript/prompt-display.ts
|
|
2302
|
+
var WRAPPED_CONTENT_BLOCK_RE = /<(user_content|instruction_content)\b[^>]*>[\s\S]*?<\/\1>/gi;
|
|
2303
|
+
var SCAFFOLDING_LINE_PATTERNS = [
|
|
2304
|
+
/^IMPORTANT: The content above is /i,
|
|
2305
|
+
/^Previous Slack message\b/i,
|
|
2306
|
+
/^Current Slack message author:/i,
|
|
2307
|
+
/^Thread context(?:\s*\([^)]*\))?\s*[.:]/i,
|
|
2308
|
+
// Synthetic bootstrap prefix only: a single-token repo URL/ref value. A
|
|
2309
|
+
// user's prose line like "Repository: our monorepo is huge" has spaces and
|
|
2310
|
+
// is left intact.
|
|
2311
|
+
/^Repository:\s+\S+$/i,
|
|
2312
|
+
/^Issue (?:title|body|description|metadata)\s*:/i,
|
|
2313
|
+
/^Triggering comment\s*:/i,
|
|
2314
|
+
/^Review body\s*:/i,
|
|
2315
|
+
/^Recent comments\s*:/i,
|
|
2316
|
+
/^<\/?(?:user_content|instruction_content)\b/i
|
|
2317
|
+
];
|
|
2318
|
+
var SCAFFOLDING_MARKERS = [
|
|
2319
|
+
/<\/?(?:user_content|instruction_content)\b/i,
|
|
2320
|
+
/^IMPORTANT: The content above is /im,
|
|
2321
|
+
/^Previous Slack message\b/im,
|
|
2322
|
+
/^Current Slack message author:/im,
|
|
2323
|
+
/^Repository:\s+\S+$/im,
|
|
2324
|
+
/^\[arcanist:review-loop\b/im
|
|
2325
|
+
];
|
|
2326
|
+
function promptContainsScaffolding(text) {
|
|
2327
|
+
return SCAFFOLDING_MARKERS.some((pattern) => pattern.test(text));
|
|
2328
|
+
}
|
|
2329
|
+
function stripPromptScaffolding(text) {
|
|
2330
|
+
const withoutBlocks = text.replace(WRAPPED_CONTENT_BLOCK_RE, "");
|
|
2331
|
+
const kept = withoutBlocks.split(/\r?\n/).filter((line) => !SCAFFOLDING_LINE_PATTERNS.some((pattern) => pattern.test(line.trim())));
|
|
2332
|
+
return kept.join("\n").replace(/\n{3,}/g, "\n\n").trim();
|
|
2333
|
+
}
|
|
2334
|
+
function derivePromptDisplayText(prompt) {
|
|
2335
|
+
if (prompt.prompt.trimStart().startsWith("[arcanist:review-loop")) {
|
|
2336
|
+
const reply2 = prompt.replyToText?.trim();
|
|
2337
|
+
if (reply2 && reply2 !== prompt.prompt.trim() && !promptContainsScaffolding(reply2)) return reply2;
|
|
2338
|
+
return prompt.prompt.trim();
|
|
2339
|
+
}
|
|
2340
|
+
const reply = prompt.replyToText?.trim();
|
|
2341
|
+
if (reply && !promptContainsScaffolding(reply)) return reply;
|
|
2342
|
+
if (promptContainsScaffolding(prompt.prompt)) {
|
|
2343
|
+
const recovered = stripPromptScaffolding(prompt.prompt);
|
|
2344
|
+
if (recovered) return recovered;
|
|
2345
|
+
}
|
|
2346
|
+
return reply || prompt.prompt.trim();
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2301
2349
|
// ../../shared/types/error-codes.ts
|
|
2302
2350
|
var ERROR_CODES = [
|
|
2303
2351
|
"auth",
|
|
@@ -2560,7 +2608,7 @@ function renderSessionTranscript(exportData) {
|
|
|
2560
2608
|
lines.push(`**Prompt Status:** ${prompt.status}${prompt.error ? ` | ${prompt.error}` : ""}`);
|
|
2561
2609
|
lines.push("");
|
|
2562
2610
|
lines.push("**User:**\n");
|
|
2563
|
-
lines.push(prompt.prompt);
|
|
2611
|
+
lines.push(derivePromptDisplayText({ prompt: prompt.prompt, replyToText: prompt.replyToText }));
|
|
2564
2612
|
lines.push("");
|
|
2565
2613
|
if (events.length > 0) {
|
|
2566
2614
|
lines.push("**Assistant:**\n");
|
|
@@ -2675,7 +2723,8 @@ function formatPromptLabel(promptId, promptLabels) {
|
|
|
2675
2723
|
function buildPromptLabelMap(prompts) {
|
|
2676
2724
|
const labels = /* @__PURE__ */ new Map();
|
|
2677
2725
|
for (const prompt of prompts) {
|
|
2678
|
-
|
|
2726
|
+
const text = derivePromptDisplayText({ prompt: prompt.prompt, replyToText: prompt.replyToText });
|
|
2727
|
+
labels.set(prompt.promptId, text.replace(/\s+/g, " ").trim().slice(0, PROMPT_LABEL_MAX_CHARS));
|
|
2679
2728
|
}
|
|
2680
2729
|
return labels;
|
|
2681
2730
|
}
|