@giladbarnea/pi-simple-team 1.0.3 → 1.0.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.
- package/child-tools.ts +10 -8
- package/index.ts +15 -11
- package/package.json +1 -1
package/child-tools.ts
CHANGED
|
@@ -63,15 +63,15 @@ export function registerChildTools(pi: ExtensionAPI, config: ChildRuntimeConfig)
|
|
|
63
63
|
defineTool({
|
|
64
64
|
name: "teamsend",
|
|
65
65
|
label: "Team Send",
|
|
66
|
-
description: "Send a message to
|
|
66
|
+
description: "Send a message to teammate(s) (not main). To message the main agent, use teammain. Returns once the runtime accepts the send request, not after recipients reply.",
|
|
67
67
|
promptSnippet: "Send a message to teammate(s)",
|
|
68
68
|
promptGuidelines: [
|
|
69
|
-
"Use teamsend to talk to teammates.
|
|
69
|
+
"Use teamsend to talk to teammates. From your POV (sender), it is fire-and-forget. From the recipient’s POV, it’s pushed to context as soon as possible.",
|
|
70
70
|
],
|
|
71
71
|
parameters: Type.Object({
|
|
72
72
|
to: Type.Array(Type.String(), { description: "Recipient teammate names" }),
|
|
73
73
|
message: Type.String({ description: "Message to send" }),
|
|
74
|
-
interrupt: Type.Optional(Type.Boolean({ description: "Abort busy recipients before delivering this message" })),
|
|
74
|
+
interrupt: Type.Optional(Type.Boolean({ description: "Abort busy recipients before delivering this message." })),
|
|
75
75
|
}),
|
|
76
76
|
async execute(_toolCallId, params, signal) {
|
|
77
77
|
return toolResult(await callParent(config, "teamsend", params, signal));
|
|
@@ -79,13 +79,14 @@ export function registerChildTools(pi: ExtensionAPI, config: ChildRuntimeConfig)
|
|
|
79
79
|
}),
|
|
80
80
|
);
|
|
81
81
|
|
|
82
|
+
// TODO: should be renamed `sendmain` across the project.
|
|
82
83
|
pi.registerTool(
|
|
83
84
|
defineTool({
|
|
84
85
|
name: "teammain",
|
|
85
86
|
label: "Team Main",
|
|
86
|
-
description: "Send a message to the main agent
|
|
87
|
-
promptSnippet: "Send a message to the main agent
|
|
88
|
-
promptGuidelines: ["Use teammain to update or ask the main agent.
|
|
87
|
+
description: "Send a message to the main agent.",
|
|
88
|
+
promptSnippet: "Send a message to the main agent.",
|
|
89
|
+
promptGuidelines: ["Use teammain to update or ask the main agent. Main agent sees the big picture and has been aware of the team’s actions and status updates since the team was created."],
|
|
89
90
|
parameters: Type.Object({
|
|
90
91
|
message: Type.String({ description: "Message to send to the main agent" }),
|
|
91
92
|
}),
|
|
@@ -101,9 +102,10 @@ export function registerChildTools(pi: ExtensionAPI, config: ChildRuntimeConfig)
|
|
|
101
102
|
label: "Team Status",
|
|
102
103
|
description: "Set your public status and read everyone's public status.",
|
|
103
104
|
promptSnippet: "Set/read the public team status map",
|
|
105
|
+
// TODO: If this typing system supports it, I want gerund and phrase optionality to be a XOR
|
|
104
106
|
parameters: Type.Object({
|
|
105
|
-
|
|
106
|
-
phrase: Type.Optional(Type.String({ description: "Short status phrase" })),
|
|
107
|
+
gerund: Type.Optional(Type.String({ description: "One-word gerund status." })),
|
|
108
|
+
phrase: Type.Optional(Type.String({ description: "Short status phrase. Verb-oriented." })),
|
|
107
109
|
}),
|
|
108
110
|
async execute(_toolCallId, params, signal) {
|
|
109
111
|
return toolResult(await callParent(config, "teamstatus", params, signal));
|
package/index.ts
CHANGED
|
@@ -357,6 +357,7 @@ function logStatusDeclaration(team: TeamState, participant: string, word?: strin
|
|
|
357
357
|
});
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
+
// TODO: participants is unused. Smell.
|
|
360
361
|
function startTeammate(team: TeamState, teammateSpec: TeammateSpec, participants: string[]): TeammateState {
|
|
361
362
|
const teammateName = compactName(teammateSpec.name);
|
|
362
363
|
const thinking = teammateSpec.thinking ?? defaultThinkingLevel;
|
|
@@ -529,10 +530,10 @@ async function handleCallbackRequest(request: http.IncomingMessage, response: ht
|
|
|
529
530
|
}
|
|
530
531
|
|
|
531
532
|
if (tool === "teamstatus") {
|
|
532
|
-
const
|
|
533
|
+
const gerund = args.gerund as string | undefined;
|
|
533
534
|
const phrase = args.phrase as string | undefined;
|
|
534
|
-
updateStatus(team, from,
|
|
535
|
-
logStatusDeclaration(team, from,
|
|
535
|
+
updateStatus(team, from, gerund, phrase);
|
|
536
|
+
logStatusDeclaration(team, from, gerund, phrase);
|
|
536
537
|
writeJson(response, 200, { team: team.name, status: formatStatus(team) });
|
|
537
538
|
return;
|
|
538
539
|
}
|
|
@@ -567,12 +568,13 @@ export default function (pi: ExtensionAPI) {
|
|
|
567
568
|
closeCallbackServerIfUnused();
|
|
568
569
|
});
|
|
569
570
|
|
|
571
|
+
// TODO: Should also "start" the entire team automatically, making `teammate_start` redundant. Solves the respective smell.
|
|
570
572
|
pi.registerTool(
|
|
571
573
|
defineTool({
|
|
572
574
|
name: "team_spawn",
|
|
573
575
|
label: "Team Spawn",
|
|
574
|
-
description: "Spawn a persistent team of RPC Pi teammates with fresh context windows. The main agent is included automatically; do not specify it as a teammate.",
|
|
575
|
-
promptSnippet: "Spawn persistent RPC Pi teammate processes",
|
|
576
|
+
description: "Spawn a persistent team of RPC Pi teammates with fresh context windows. The main agent (you) is included automatically; do not specify it as a teammate.",
|
|
577
|
+
promptSnippet: "Spawn persistent RPC Pi teammate processes. Currently, manually ‘starting’ the teammates is required after spawn. Unless required, don’t fill up your time by repeatedly busy-polling team information. Don’t bash sleep to wait for progress; instead, set your status to advertise that you are counting on teammates to send you a message updating important milestones or request for help, and that otherwise you are staying idle; Send this actively to the team; Then end your turn by sending a simple message to the user, and finally stay put.",
|
|
576
578
|
renderShell: "self",
|
|
577
579
|
renderCall: (args, theme, context) => renderTeamToolCall("team_spawn", args, theme, context),
|
|
578
580
|
renderResult: (result, options, theme, context) => renderTeamToolResult("team_spawn", result, options, theme, context),
|
|
@@ -633,7 +635,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
633
635
|
defineTool({
|
|
634
636
|
name: "teamsend",
|
|
635
637
|
label: "Team Send",
|
|
636
|
-
description: "Send a message from main to teammate(s). Fire-and-forget; does not wait for replies.",
|
|
638
|
+
description: "Send a message from main to teammate(s). Fire-and-forget; does not wait for replies. Teammates will send you messages as they deem appropriate by way of push.",
|
|
637
639
|
promptSnippet: "Send a message from main to teammate(s)",
|
|
638
640
|
renderShell: "self",
|
|
639
641
|
renderCall: (args, theme, context) => renderTeamToolCall("teamsend", args, theme, context),
|
|
@@ -665,21 +667,23 @@ export default function (pi: ExtensionAPI) {
|
|
|
665
667
|
renderResult: (result, options, theme, context) => renderTeamToolResult("teamstatus", result, options, theme, context),
|
|
666
668
|
parameters: Type.Object({
|
|
667
669
|
team: Type.Optional(Type.String({ description: "Team name; optional for listing all statuses or when exactly one team exists" })),
|
|
668
|
-
|
|
669
|
-
|
|
670
|
+
// TODO: make gerund and phrase optionality a XOR.
|
|
671
|
+
gerund: Type.Optional(Type.String({ description: "Set one-word gerund main status" })),
|
|
672
|
+
phrase: Type.Optional(Type.String({ description: "Short main status verb-oriented phrase." })),
|
|
670
673
|
}),
|
|
671
674
|
async execute(_toolCallId, params) {
|
|
672
|
-
if (!params.team && params.
|
|
675
|
+
if (!params.team && params.gerund === undefined && params.phrase === undefined) {
|
|
673
676
|
return toolResult({ teams: allStatuses(owner) });
|
|
674
677
|
}
|
|
675
678
|
const team = resolveTeam(owner, params.team);
|
|
676
|
-
updateStatus(team, "main", params.
|
|
677
|
-
logStatusDeclaration(team, "main", params.
|
|
679
|
+
updateStatus(team, "main", params.gerund, params.phrase);
|
|
680
|
+
logStatusDeclaration(team, "main", params.gerund, params.phrase);
|
|
678
681
|
return toolResult({ team: team.name, status: formatStatus(team) });
|
|
679
682
|
},
|
|
680
683
|
}),
|
|
681
684
|
);
|
|
682
685
|
|
|
686
|
+
// TODO: main could use more automatic meta/discoverability information in the return payload. To help orient around what has been read already, what hasn't been read, inside and outside the filtered space, how long is the log, etc.
|
|
683
687
|
pi.registerTool(
|
|
684
688
|
defineTool({
|
|
685
689
|
name: "teamlog",
|