9a6363b80e
The server now names a user turn's origin (followup, auto_continue, auto_switch, scheduled) on chat messages, user frames and queued prompts, from the prompt's operation id while it holds the prompt and from its own text prefixes in history read later. Origin is a new field, so older clients keep treating these as ordinary user turns. The app draws an agent follow-up, auto-continue and account-switch prompt as a quiet outlined card on the agent's side with an icon, label and the schedule facts from the preamble; the operator's own scheduled message keeps its bubble with a small Scheduled mark. Find searches the drawn text. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
83 lines
2.7 KiB
Dart
83 lines
2.7 KiB
Dart
import 'package:pipelines_app/core/api_gateway.dart';
|
|
|
|
/// `?followups=1`: the prompts the operator did not type just now, between
|
|
/// ordinary turns: an agent's follow-up (timed and run-triggered), the
|
|
/// server's auto-continue and account switch, and the operator's own
|
|
/// scheduled message.
|
|
List<JsonMap> chatFollowupMessages(String chat) {
|
|
var minute = 0;
|
|
int at() => DateTime.utc(2026, 12, 3, 9, minute += 7).millisecondsSinceEpoch;
|
|
JsonMap user(String id, String text, [JsonMap extra = const {}]) => {
|
|
'id': '$chat-fu-$id',
|
|
'role': 'user',
|
|
'created_at': at(),
|
|
'parts': [
|
|
{'type': 'text', 'text': text},
|
|
],
|
|
...extra,
|
|
};
|
|
JsonMap reply(String id, String text) => {
|
|
'id': '$chat-fu-$id',
|
|
'role': 'assistant',
|
|
'created_at': at(),
|
|
'parts': [
|
|
{'type': 'text', 'text': text},
|
|
],
|
|
};
|
|
return [
|
|
user('q', 'Deploy the release and keep an eye on it.', {
|
|
'client': 'Laptop',
|
|
}),
|
|
reply(
|
|
'a1',
|
|
'Started run 42. I scheduled a follow-up to check it in 30 minutes.',
|
|
),
|
|
user(
|
|
'f1',
|
|
'[Follow-up you scheduled at 2026-12-03T09:14:00Z with '
|
|
'schedule_followup] Check whether run 42 finished and report the '
|
|
'deploy status.',
|
|
{
|
|
'client': 'Agent follow-up',
|
|
'operation_id': 'followup-1a2b',
|
|
'origin': 'followup',
|
|
},
|
|
),
|
|
reply('a2', 'Run 42 finished; the deploy is healthy.'),
|
|
user(
|
|
'f2',
|
|
'[Follow-up you scheduled at 2026-12-03T09:28:00Z with '
|
|
'schedule_followup, for when run 43 finishes; delivered at '
|
|
'2026-12-04T09:28:00Z at the latest] Review the canary results.'
|
|
'\n\n[Pipelines: run 43 is now succeeded; read it with pipelines '
|
|
'inspect 43.]',
|
|
{'client': 'Agent follow-up', 'origin': 'followup'},
|
|
),
|
|
reply('a3', 'You\'ve hit your 5-hour limit · resets 2pm'),
|
|
user('c1', 'Review the canary results.', {
|
|
'client': 'Pipelines (automatic)',
|
|
'operation_id': 'auto-continue-a3',
|
|
'origin': 'auto_continue',
|
|
}),
|
|
reply('a4', 'The canary results look good.'),
|
|
user(
|
|
's1',
|
|
'[Sent automatically by Pipelines] Usage ran out on ada@example.com, '
|
|
'so Pipelines switched this chat to bob@example.com. Before '
|
|
'continuing: briefly check your progress against my original '
|
|
'request and your plan.',
|
|
{
|
|
'client': 'Pipelines (automatic)',
|
|
'operation_id': 'auto-switch-a4',
|
|
'origin': 'auto_switch',
|
|
},
|
|
),
|
|
reply('a5', 'Still on track; continuing.'),
|
|
user('l1', 'Summarise the release for the team channel.', {
|
|
'client': 'Laptop',
|
|
'origin': 'scheduled',
|
|
}),
|
|
reply('a6', 'Here is the summary for the team channel.'),
|
|
];
|
|
}
|