@pi-unipi/ask-user 2.1.0 → 2.1.2
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/package.json +3 -3
- package/tools.ts +20 -11
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/ask-user",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "Structured user input tool for Pi coding agent
|
|
3
|
+
"version": "2.1.2",
|
|
4
|
+
"description": "Structured user input tool for Pi coding agent — single-select, multi-select, freeform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.ts",
|
|
7
7
|
"license": "MIT",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@pi-unipi/core": "2.1.
|
|
43
|
+
"@pi-unipi/core": "2.1.2"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@earendil-works/pi-coding-agent": "^0.80.0",
|
package/tools.ts
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
COMPACTOR_INSTRUCTION,
|
|
12
12
|
UNIPI_EVENTS,
|
|
13
13
|
emitEvent,
|
|
14
|
+
withHerdrBlocked,
|
|
14
15
|
} from "@pi-unipi/core";
|
|
15
16
|
import type { NormalizedOption, AskUserResponse, SessionLauncherResult } from "./types.js";
|
|
16
17
|
import { renderAskUI, createRenderCall, createRenderResult } from "./ask-ui.js";
|
|
@@ -272,15 +273,19 @@ export function registerAskUserTools(pi: ExtensionAPI): void {
|
|
|
272
273
|
}
|
|
273
274
|
|
|
274
275
|
// Render interactive UI
|
|
275
|
-
const result = await
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
276
|
+
const result = await withHerdrBlocked(
|
|
277
|
+
pi,
|
|
278
|
+
"ask_user",
|
|
279
|
+
() => ctx.ui.custom<{ response: AskUserResponse } | null>(
|
|
280
|
+
renderAskUI({
|
|
281
|
+
question,
|
|
282
|
+
context,
|
|
283
|
+
options: normalizedOptions,
|
|
284
|
+
allowMultiple,
|
|
285
|
+
allowFreeform,
|
|
286
|
+
timeout,
|
|
287
|
+
}),
|
|
288
|
+
),
|
|
284
289
|
);
|
|
285
290
|
|
|
286
291
|
// Handle cancel
|
|
@@ -346,8 +351,12 @@ export function registerAskUserTools(pi: ExtensionAPI): void {
|
|
|
346
351
|
// Session launcher intercept: when user selects new_session, offer compact/direct/cancel
|
|
347
352
|
if (response.kind === "new_session") {
|
|
348
353
|
const prefill = response.prefill || "";
|
|
349
|
-
const launcherResult = await
|
|
350
|
-
|
|
354
|
+
const launcherResult = await withHerdrBlocked(
|
|
355
|
+
pi,
|
|
356
|
+
"ask_user: launch",
|
|
357
|
+
() => ctx.ui.custom<SessionLauncherResult | null>(
|
|
358
|
+
renderLauncherUI({ prefill }),
|
|
359
|
+
),
|
|
351
360
|
);
|
|
352
361
|
|
|
353
362
|
if (!launcherResult || launcherResult.action === "cancel") {
|