Skip to content

Commit df1a5e8

Browse files
authored
Inline create-API-key flow on orchestration cards (warpdotdev#11124)
1 parent b495c6f commit df1a5e8

18 files changed

Lines changed: 1493 additions & 295 deletions

app/src/ai/agent/conversation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2491,6 +2491,7 @@ impl AIConversation {
24912491
ctx.emit(
24922492
BlocklistAIHistoryEvent::OrchestrationConfigUpdated {
24932493
conversation_id: self.id,
2494+
from_restore: false,
24942495
},
24952496
);
24962497
}
@@ -2651,6 +2652,7 @@ impl AIConversation {
26512652
) {
26522653
ctx.emit(BlocklistAIHistoryEvent::OrchestrationConfigUpdated {
26532654
conversation_id: self.id,
2655+
from_restore: false,
26542656
});
26552657
}
26562658
}

app/src/ai/ai_document_view.rs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -292,17 +292,15 @@ impl AIDocumentView {
292292
}
293293
BlocklistAIHistoryEvent::OrchestrationConfigUpdated {
294294
conversation_id: cid,
295+
from_restore,
295296
} => {
296-
// Re-render so the config block picks up changes
297-
// only for our document's conversation.
298297
let our_conv = AIDocumentModel::as_ref(ctx)
299298
.get_conversation_id_for_document_id(&document_id);
300299
if our_conv.as_ref() == Some(cid) {
301-
// Lazily create the config block view if it
302-
// wasn't available at construction time (the
303-
// plan sidebar can open before the server
304-
// sends the orchestration config).
305-
if me.orchestration_config_block.is_none() {
300+
// Lazily create the config block view if the
301+
// plan sidebar opened before the orchestration
302+
// config arrived.
303+
let was_freshly_created = if me.orchestration_config_block.is_none() {
306304
let conv_id = *cid;
307305
// TODO: introduce DocumentId / PlanId newtypes to make this
308306
// conversion type-safe.
@@ -311,6 +309,18 @@ impl AIDocumentView {
311309
Some(ctx.add_typed_action_view(move |ctx| {
312310
OrchestrationConfigBlockView::new(conv_id, plan_id, ctx)
313311
}));
312+
true
313+
} else {
314+
false
315+
};
316+
// Arm auto-pop for live agent dispatches but
317+
// not for restore-hydrated events.
318+
if was_freshly_created && !*from_restore {
319+
if let Some(block) = &me.orchestration_config_block {
320+
block.update(ctx, |block, ctx| {
321+
block.arm_for_fresh_dispatch(ctx);
322+
});
323+
}
314324
}
315325
ctx.notify();
316326
}

app/src/ai/blocklist/history_model.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2402,10 +2402,12 @@ pub enum BlocklistAIHistoryEvent {
24022402
conversation_id: AIConversationId,
24032403
},
24042404

2405-
/// Emitted when a conversation's orchestration config is updated reactively
2406-
/// from an incoming `OrchestrationConfigSnapshot` message.
2405+
/// Emitted when a conversation's orchestration config is updated
2406+
/// (live wire snapshot, user edit, or restore-hydration).
2407+
/// Consumers that perform UI side effects should gate on `!from_restore`.
24072408
OrchestrationConfigUpdated {
24082409
conversation_id: AIConversationId,
2410+
from_restore: bool,
24092411
},
24102412

24112413
/// Emitted when a conversation's `conversation_usage_metadata` is updated

0 commit comments

Comments
 (0)