@danypops/papyrus 0.27.12 → 0.27.13
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/extension/src/discuss.ts
CHANGED
|
@@ -83,9 +83,13 @@ export async function showDiscussions(ctx: ExtensionCommandContext): Promise<voi
|
|
|
83
83
|
if (choice === "Reply") {
|
|
84
84
|
const pending = (() => { try { return readDiscussionExtra(discussion.extra); } catch { return undefined; } })();
|
|
85
85
|
const question = `Reply to "${discussion.title}":`;
|
|
86
|
+
// Same fix as the live discuss tool: the title alone isn't the actual question -- show
|
|
87
|
+
// the most recent round's real content as context, not a bare title prompt.
|
|
88
|
+
const transcript = await callService<Record<string, unknown>, DiscussionAndRounds>("discuss.show", { id: discussion.id });
|
|
89
|
+
const context = transcript.rounds.at(-1)?.content?.trim() || undefined;
|
|
86
90
|
const answer = pending?.pendingOptions && pending.pendingOptions.length > 0 && pending.pendingOptionsMode
|
|
87
|
-
? await askQuestion(commandCtx, { question, options: pending.pendingOptions.map((title) => ({ title })), allowMultiple: pending.pendingOptionsMode === "multi" })
|
|
88
|
-
: await askQuestion(commandCtx, { question });
|
|
91
|
+
? await askQuestion(commandCtx, { question, context, options: pending.pendingOptions.map((title) => ({ title })), allowMultiple: pending.pendingOptionsMode === "multi" })
|
|
92
|
+
: await askQuestion(commandCtx, { question, context });
|
|
89
93
|
if (!answer) return; // canceled
|
|
90
94
|
await callService("discuss.reply", { id: discussion.id, actor: ACTOR, content: answer.content, ...(answer.selected ? { selected: answer.selected } : {}), source: SOURCE });
|
|
91
95
|
commandCtx.ui.notify(answer.selected ? `Selected: ${answer.selected.join(", ")}` : "Reply added.", "info");
|
|
@@ -39,20 +39,25 @@ function text(message: string, details: unknown = {}) {
|
|
|
39
39
|
* is available, never throws -- an unanswered live prompt still leaves the round it already
|
|
40
40
|
* recorded intact.
|
|
41
41
|
*/
|
|
42
|
-
async function liveAnswer(ctx: ExtensionContext, discussion: Artifact, onUpdate: AgentToolUpdateCallback | undefined, signal: AbortSignal | undefined): Promise<{ content: string; selected?: string[] } | undefined> {
|
|
42
|
+
async function liveAnswer(ctx: ExtensionContext, discussion: Artifact, latestContent: string | undefined, onUpdate: AgentToolUpdateCallback | undefined, signal: AbortSignal | undefined): Promise<{ content: string; selected?: string[] } | undefined> {
|
|
43
43
|
if (!ctx.hasUI) return undefined;
|
|
44
44
|
const pending = (() => { try { return readDiscussionExtra(discussion.extra); } catch { return undefined; } })();
|
|
45
45
|
const question = `Reply to "${discussion.title}":`;
|
|
46
|
+
// The discussion's title alone is often not the actual question -- a human staring at a bare
|
|
47
|
+
// "Reply to '<title>':" prompt with no visible content has no way to tell what's being asked.
|
|
48
|
+
// The just-recorded round's own content is the real question text; show it as context.
|
|
49
|
+
const context = latestContent?.trim() || undefined;
|
|
46
50
|
if (pending?.pendingOptions && pending.pendingOptions.length > 0 && pending.pendingOptionsMode) {
|
|
47
51
|
return askQuestion(ctx, {
|
|
48
52
|
question,
|
|
53
|
+
context,
|
|
49
54
|
options: pending.pendingOptions.map((title) => ({ title })),
|
|
50
55
|
allowMultiple: pending.pendingOptionsMode === "multi",
|
|
51
56
|
onUpdate,
|
|
52
57
|
signal,
|
|
53
58
|
});
|
|
54
59
|
}
|
|
55
|
-
return askQuestion(ctx, { question, onUpdate, signal });
|
|
60
|
+
return askQuestion(ctx, { question, context, onUpdate, signal });
|
|
56
61
|
}
|
|
57
62
|
|
|
58
63
|
/**
|
|
@@ -722,7 +727,7 @@ export function registerDomainTools(pi: ExtensionAPI): void {
|
|
|
722
727
|
? text(`Opened discussion ${artifactLine(result.discussion)}`, createArtifactDetails("discuss.open", result.discussion))
|
|
723
728
|
: text(`Round ${result.rounds[0]?.roundNumber} added to "${result.discussion.title}"`, createArtifactDetails("discuss.reply", result.discussion));
|
|
724
729
|
if (params.live !== true) return fallback;
|
|
725
|
-
const answer = await liveAnswer(ctx, result.discussion, onUpdate, signal);
|
|
730
|
+
const answer = await liveAnswer(ctx, result.discussion, result.rounds[0]?.content, onUpdate, signal);
|
|
726
731
|
if (!answer) return fallback;
|
|
727
732
|
const answered = await callService<Record<string, unknown>, DiscussionAndRounds>("discuss.reply", {
|
|
728
733
|
id: result.discussion.id, actor: "human", content: answer.content, ...(answer.selected ? { selected: answer.selected } : {}), source: "discuss-live",
|
package/package.json
CHANGED