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
+16 -2
View File
@@ -83,7 +83,11 @@ func (s *chatToolService) run(ctx context.Context, sessionID, tool, id string, a
return fail("Nothing was shown: html is not valid UTF-8.")
}
item := protocol.ChatShownItem{Kind: protocol.ChatShownHTML, Title: boundedLine(in.Title, 200), HTML: in.HTML, HTMLBytes: len(in.HTML), HeightHint: clampHeightHint(in.HeightHint)}
return &item, chattools.Result{Text: fmt.Sprintf("Shown in the operator's Pipelines chat (%s, sandboxed: scripts and network are disabled; it follows the operator's light or dark theme only if it styles itself for dark mode).", humanBytes(int64(len(in.HTML))))}
text := fmt.Sprintf("Shown in the operator's Pipelines chat (%s, sandboxed: scripts and network are disabled; it follows the operator's light or dark theme only if it styles itself for dark mode).", humanBytes(int64(len(in.HTML))))
if warnings := shownHTMLWarnings(in.HTML); len(warnings) > 0 {
text += " Warning: " + strings.Join(warnings, " ")
}
return &item, chattools.Result{Text: text}
case chattools.ToolShowDiff:
var in struct {
Path string `json:"path"`
@@ -111,11 +115,21 @@ func (s *chatToolService) run(ctx context.Context, sessionID, tool, id string, a
Message string `json:"message"`
At string `json:"at"`
AfterMinutes *int64 `json:"after_minutes"`
RunID *int64 `json:"run_id"`
On string `json:"on"`
}
if err := decode(&in); err != nil {
return fail("Nothing was scheduled: %v", err)
}
return nil, s.runScheduleFollowup(ctx, sessionID, in.Message, in.At, in.AfterMinutes)
return nil, s.runScheduleFollowup(ctx, sessionID, in.Message, in.At, in.AfterMinutes, in.RunID, in.On)
case chattools.ToolCancelFollowup:
var in struct {
ID string `json:"id"`
}
if err := decode(&in); err != nil {
return fail("Nothing was canceled: %v", err)
}
return nil, s.runCancelFollowup(ctx, sessionID, in.ID)
case chattools.ToolNotify:
var in struct {
Title string `json:"title"`