@signalridge/pi-subagents 1.10.1 → 1.10.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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/agent-runner.ts +3 -1
- package/src/supervisor.ts +7 -4
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
package/src/agent-runner.ts
CHANGED
|
@@ -1126,7 +1126,9 @@ export async function runAgent(
|
|
|
1126
1126
|
const supervisorTools =
|
|
1127
1127
|
ctx.hasUI && !isolated && options.supervisorQuestions !== false
|
|
1128
1128
|
? createSupervisorTool({
|
|
1129
|
-
|
|
1129
|
+
// Use the canonical agent type, not display_name: the question must
|
|
1130
|
+
// identify the actual subagent that requested the decision.
|
|
1131
|
+
agentLabel: agentConfig?.name ?? type,
|
|
1130
1132
|
ask: {
|
|
1131
1133
|
input: (title, placeholder) => ctx.ui.input(title, placeholder),
|
|
1132
1134
|
select: (title, choices) => ctx.ui.select(title, choices),
|
package/src/supervisor.ts
CHANGED
|
@@ -36,7 +36,7 @@ export interface SupervisorAsk {
|
|
|
36
36
|
export interface SupervisorToolContext {
|
|
37
37
|
/** The parent's UI. Omitted when there is no human to ask. */
|
|
38
38
|
ask?: SupervisorAsk;
|
|
39
|
-
/**
|
|
39
|
+
/** Actual type/name of the asking agent, for the prompt title. */
|
|
40
40
|
agentLabel: string;
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -82,7 +82,10 @@ export function createSupervisorTool(context: SupervisorToolContext) {
|
|
|
82
82
|
const question = truncateCodePoints(sanitizeDisplayText(params.question), MAX_QUESTION, "…").trim();
|
|
83
83
|
if (!question) return textResult("Ask a non-empty question.", true);
|
|
84
84
|
|
|
85
|
-
const title = `${context.agentLabel} asks`;
|
|
85
|
+
const title = `${sanitizeDisplayText(context.agentLabel)} asks`;
|
|
86
|
+
// Pi 0.85.1 ignores ui.input()'s placeholder argument. Keep the
|
|
87
|
+
// question in the title so the human sees it in both old and new hosts.
|
|
88
|
+
const promptTitle = `${title}: ${question}`;
|
|
86
89
|
const options = (params.options ?? [])
|
|
87
90
|
.map((option) => truncateCodePoints(sanitizeDisplayText(option), MAX_OPTION, "…").trim())
|
|
88
91
|
.filter((option) => option.length > 0)
|
|
@@ -92,8 +95,8 @@ export function createSupervisorTool(context: SupervisorToolContext) {
|
|
|
92
95
|
try {
|
|
93
96
|
answer =
|
|
94
97
|
options.length > 0
|
|
95
|
-
? await ask.select(
|
|
96
|
-
: await ask.input(
|
|
98
|
+
? await ask.select(promptTitle, options)
|
|
99
|
+
: await ask.input(promptTitle);
|
|
97
100
|
} catch (error: unknown) {
|
|
98
101
|
// A dialog that cannot open must not fail the child's whole run; it
|
|
99
102
|
// is told nobody answered and carries on under its own judgement.
|