Chat tools: follow-up ids, cancel_followup, run-triggered follow-ups, show_html warnings

- schedule_followup returns the follow-up id and lists pending follow-ups;
  count-then-queue is serialised so the 3-pending bound holds under
  concurrent calls.
- cancel_followup {id} removes one of the chat's undelivered follow-ups.
- schedule_followup {run_id, on: finished|attention} queues a durable
  follow-up (7-day deadline) that is released with the run's state when the
  run ends or waits on a human; run must exist and not already meet the
  condition; watches are re-armed from the restored queue after a restart.
- show_html results warn about scripts, remote resources (blocked by the
  sandbox) and missing dark-mode support.
- The ambiguous-call error advice fits each tool instead of always
  suggesting a different title.
- references/chat.md and the SKILL.md chat paragraph document the above, and
  questions are no longer described as Claude-only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 00:23:22 +00:00
parent accb9970b6
commit d275ffe643
13 changed files with 737 additions and 43 deletions
+1 -1
View File
@@ -75,7 +75,7 @@ func TestHandshakeListAndCall(t *testing.T) {
t.Fatalf("tool without description or schema: %v", entry)
}
}
if strings.Join(names, ",") != "show_file,show_image,show_html,show_diff,notify,show_run,schedule_followup" {
if strings.Join(names, ",") != "show_file,show_image,show_html,show_diff,notify,show_run,schedule_followup,cancel_followup" {
t.Fatalf("tools = %v", names)
}
if list["id"] != "l" {
+29 -8
View File
@@ -10,6 +10,8 @@ const (
ToolNotify = "notify"
// ToolScheduleFollowup queues a prompt into the calling chat for later.
ToolScheduleFollowup = "schedule_followup"
// ToolCancelFollowup removes a follow-up this chat scheduled.
ToolCancelFollowup = "cancel_followup"
)
// MaxHTMLBytes bounds one show_html document. A larger one is refused, never
@@ -29,12 +31,16 @@ const (
MaxFollowupMinutes = 7 * 24 * 60
MaxPendingFollowups = 3
MaxFollowupTextBytes = 8 << 10
// A run-triggered follow-up (run_id with on) is delivered when the run
// reaches the condition, or after MaxFollowupMinutes at the latest.
FollowupOnFinished = "finished"
FollowupOnAttention = "attention"
)
// IsTool reports whether name is one of the Pipelines tools.
func IsTool(name string) bool {
switch name {
case ToolShowFile, ToolShowImage, ToolShowHTML, ToolShowDiff, ToolShowRun, ToolNotify, ToolScheduleFollowup:
case ToolShowFile, ToolShowImage, ToolShowHTML, ToolShowDiff, ToolShowRun, ToolNotify, ToolScheduleFollowup, ToolCancelFollowup:
return true
}
return false
@@ -48,7 +54,7 @@ const Instructions = "These tools act on Pipelines, the app the operator reads t
"Pipelines already notifies them when your reply ends and when you ask a question or need an approval, so do not notify for those " +
"(a notify replaces this turn's end-of-reply notification). It reaches every Pipelines app they are signed in to and their phone, " +
"and clears everywhere once they open the chat. " +
"Use show_run to follow a pipeline run live in the chat, and schedule_followup to come back to this chat later (for example to check on a run). " +
"Use show_run to follow a pipeline run live in the chat, and schedule_followup to come back to this chat later (at a time, or when a run finishes or needs the operator; cancel_followup removes one). " +
"Every show_* result names the shown item's id: pass it as replace to update that card instead of adding another. " +
"Your thinking is not shown to the operator: before asking them a question (for example with AskUserQuestion), " +
"write what you found and why you are asking as a normal message, because the question form shows only the question and its options."
@@ -182,14 +188,29 @@ func definitions() []toolDefinition {
{
Name: ToolScheduleFollowup,
Title: "Schedule a follow-up in this chat",
Description: "Queue a message to yourself in this chat, delivered as a new prompt at a later time (for example to check on a long run). " +
"The operator sees it in the chat as a scheduled message from the agent and can remove it. " +
"Give at (an RFC 3339 time) or after_minutes, between 1 minute and 7 days from now. At most 3 follow-ups can be pending per chat. " +
"It is delivered when the chat is free at that time, so do not wait for it in the current turn.",
Description: "Queue a message to yourself in this chat, delivered as a new prompt later: at a time (at, an RFC 3339 time, or after_minutes, " +
"between 1 minute and 7 days from now), or when a pipeline run reaches a state (run_id with on: finished when it ends, " +
"attention when it waits on the operator's decision or ends, whichever is first; delivered after 7 days at the latest). " +
"The operator sees it in the chat as a scheduled message from the agent and can remove it. At most 3 follow-ups can be pending per chat. " +
"It is delivered when the chat is free, so do not wait for it in the current turn. " +
"The result names the follow-up's id (for cancel_followup) and lists the chat's pending follow-ups.",
InputSchema: objectSchema([]string{"message"}, map[string]any{
"message": stringProperty("What the follow-up prompt should say: enough for you to know what to do then."),
"at": stringProperty("When to deliver it, as an RFC 3339 time such as 2026-05-01T09:30:00Z. Give this or after_minutes."),
"after_minutes": map[string]any{"type": "integer", "description": "Minutes from now to deliver it (1-10080). Give this or at."},
"at": stringProperty("When to deliver it, as an RFC 3339 time such as 2026-05-01T09:30:00Z. Give this, after_minutes, or run_id."),
"after_minutes": map[string]any{"type": "integer", "description": "Minutes from now to deliver it (1-10080). Give this, at, or run_id."},
"run_id": map[string]any{"type": "integer", "description": "Deliver it when this pipeline run reaches on, instead of at a time."},
"on": map[string]any{"type": "string", "enum": []string{FollowupOnFinished, FollowupOnAttention},
"description": "With run_id: finished (the run ended: succeeded, failed, canceled or interrupted) or attention (it waits on a human decision, or ended). Default finished."},
}),
Annotations: map[string]any{"readOnlyHint": false, "destructiveHint": false, "openWorldHint": false},
},
{
Name: ToolCancelFollowup,
Title: "Cancel a follow-up in this chat",
Description: "Remove a follow-up this chat scheduled with schedule_followup and that has not been delivered yet. " +
"The result lists the follow-ups still pending.",
InputSchema: objectSchema([]string{"id"}, map[string]any{
"id": stringProperty("The follow-up's id, from the schedule_followup result."),
}),
Annotations: map[string]any{"readOnlyHint": false, "destructiveHint": false, "openWorldHint": false},
},
+4
View File
@@ -27,6 +27,10 @@ func TestValidateArgumentsRefusesUnknownAndMistypedFields(t *testing.T) {
{ToolNotify, `{"title":"t","message":"m","priority":"urgent"}`, "priority must be one of low, default, high"},
{ToolScheduleFollowup, `{"message":"m","after_minutes":5}`, ""},
{ToolScheduleFollowup, `{"message":"m","in_minutes":5,"delay":1}`, `unknown arguments "delay", "in_minutes"`},
{ToolScheduleFollowup, `{"message":"m","run_id":7,"on":"attention"}`, ""},
{ToolScheduleFollowup, `{"message":"m","run_id":7,"on":"done"}`, "on must be one of finished, attention"},
{ToolCancelFollowup, `{"id":"followup-1"}`, ""},
{ToolCancelFollowup, `{}`, "id is required"},
}
for _, c := range cases {
err := ValidateArguments(c.tool, json.RawMessage(c.args))