@pi-unipi/ask-user 2.0.13 → 2.1.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/handoff.ts +0 -0
- package/index.ts +3 -1
- package/launcher-ui.ts +0 -0
- package/package.json +5 -5
- package/tools.ts +20 -11
package/handoff.ts
CHANGED
|
File without changes
|
package/index.ts
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
* multi-select, and freeform modes. Includes bundled skill for agent guidance.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import { dirname } from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
8
10
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
9
11
|
import {
|
|
10
12
|
UNIPI_EVENTS,
|
|
@@ -17,7 +19,7 @@ import { registerAskUserTools } from "./tools.js";
|
|
|
17
19
|
import { registerAskUserCommands } from "./commands.js";
|
|
18
20
|
|
|
19
21
|
/** Package version */
|
|
20
|
-
const VERSION = getPackageVersion(
|
|
22
|
+
const VERSION = getPackageVersion(dirname(fileURLToPath(import.meta.url)));
|
|
21
23
|
|
|
22
24
|
export default function (pi: ExtensionAPI) {
|
|
23
25
|
|
package/launcher-ui.ts
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-unipi/ask-user",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Structured user input tool for Pi coding agent
|
|
3
|
+
"version": "2.1.1",
|
|
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,11 +40,11 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@pi-unipi/core": "2.
|
|
43
|
+
"@pi-unipi/core": "2.1.1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"@earendil-works/pi-coding-agent": "^0.
|
|
47
|
-
"@earendil-works/pi-tui": "^0.
|
|
46
|
+
"@earendil-works/pi-coding-agent": "^0.80.0",
|
|
47
|
+
"@earendil-works/pi-tui": "^0.80.0",
|
|
48
48
|
"typebox": "^1.1.38"
|
|
49
49
|
},
|
|
50
50
|
"pi": {
|
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") {
|