@danypops/papyrus 0.27.3 → 0.27.4
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.
|
@@ -35,6 +35,19 @@ import {
|
|
|
35
35
|
wrapTextWithAnsi,
|
|
36
36
|
} from "@earendil-works/pi-tui";
|
|
37
37
|
import { renderSingleSelectRows, type AskOption } from "./discuss-ask-layout.ts";
|
|
38
|
+
import { callService } from "./service-client.ts";
|
|
39
|
+
|
|
40
|
+
/** Temporary RCA instrumentation for the live-observed duplicate-picker defect. Fire-and-forget: never lets a logging failure affect the actual ask. Remove once root-caused. */
|
|
41
|
+
const DIAG_SOURCE = "papyrus-discuss-ask-diag";
|
|
42
|
+
function diag(message: string, fields?: Record<string, unknown>): void {
|
|
43
|
+
void callService("logs.append", {
|
|
44
|
+
source_id: DIAG_SOURCE,
|
|
45
|
+
source_label: "Discuss live-ask RCA",
|
|
46
|
+
level: "info",
|
|
47
|
+
message,
|
|
48
|
+
...(fields ? { fields } : {}),
|
|
49
|
+
}).catch(() => {});
|
|
50
|
+
}
|
|
38
51
|
|
|
39
52
|
/** See pi-ask-user's identical safeMarkdownTheme() comment: a broken theme Proxy throws only on
|
|
40
53
|
* property access, not construction, so a bare try/catch around getMarkdownTheme() alone would
|
|
@@ -1066,7 +1079,9 @@ async function askViaDialogs(
|
|
|
1066
1079
|
|
|
1067
1080
|
const selectOptions = options.map((o) => o.title);
|
|
1068
1081
|
if (allowFreeform) selectOptions.push(FREEFORM_SENTINEL);
|
|
1082
|
+
diag("askViaDialogs: calling ui.select", { dialogOpts: dialogOpts === undefined ? null : JSON.stringify(dialogOpts), promptPreview: prompt.slice(0, 80) });
|
|
1069
1083
|
const selected = (await ui.select(prompt, selectOptions, dialogOpts)) as string | undefined;
|
|
1084
|
+
diag("askViaDialogs: ui.select resolved", { selected: selected ?? null });
|
|
1070
1085
|
if (isCancelledInput(selected)) return null;
|
|
1071
1086
|
|
|
1072
1087
|
if (selected === FREEFORM_SENTINEL) {
|
|
@@ -1114,10 +1129,11 @@ const pendingByKey = new Map<string, Promise<AskAnswer | undefined>>();
|
|
|
1114
1129
|
* contexts all resolve to undefined.
|
|
1115
1130
|
*/
|
|
1116
1131
|
export async function askQuestion(ctx: ExtensionContext, params: AskQuestionParams): Promise<AskAnswer | undefined> {
|
|
1132
|
+
diag("askQuestion() called", { question: params.question, key: params.key, hasUI: ctx.hasUI, mode: ctx.mode, optionCount: params.options?.length ?? 0, alreadyPendingForKey: params.key !== undefined && pendingByKey.has(params.key) });
|
|
1117
1133
|
if (!ctx.hasUI || !ctx.ui) return undefined;
|
|
1118
1134
|
if (params.key !== undefined) {
|
|
1119
1135
|
const existing = pendingByKey.get(params.key);
|
|
1120
|
-
if (existing) return existing;
|
|
1136
|
+
if (existing) { diag("joining an already in-flight ask for this key", { key: params.key }); return existing; }
|
|
1121
1137
|
}
|
|
1122
1138
|
const promise = askQuestionUnguarded(ctx, params);
|
|
1123
1139
|
if (params.key !== undefined) {
|
|
@@ -1193,8 +1209,12 @@ async function askQuestionBlocking(
|
|
|
1193
1209
|
});
|
|
1194
1210
|
}
|
|
1195
1211
|
|
|
1212
|
+
diag("calling ctx.ui.custom()", { displayMode });
|
|
1196
1213
|
const customResult = await ctx.ui.custom<AskResponse | null>(factory, buildCustomUIOptions(displayMode, (handle) => { overlayHandle = handle; }));
|
|
1214
|
+
diag("ctx.ui.custom() resolved", { wasUndefined: customResult === undefined, result: customResult === undefined ? undefined : JSON.stringify(customResult) });
|
|
1215
|
+
if (customResult === undefined) diag("falling back to askViaDialogs -- about to call ctx.ui.select with dialogOpts", { explicitTimeout: params.timeout ?? null });
|
|
1197
1216
|
response = customResult !== undefined ? customResult : await askViaDialogs(ctx.ui, params.question, normalizedContext, options, allowMultiple, allowFreeform, allowComment, params.timeout);
|
|
1217
|
+
diag("askQuestionBlocking resolved", { response: response === null ? null : JSON.stringify(response) });
|
|
1198
1218
|
} finally {
|
|
1199
1219
|
removeOverlayInputListener?.();
|
|
1200
1220
|
}
|
package/package.json
CHANGED