Synced from monorepo
Synced from monorepo Changes: - Workspace server: report `/ready` as failed with dwell on hub connect failure - Refresh OIDC token for the Grok agent in the shell - ACP terminal output recorder - Cross-platform provider auth commands in the shell - Default `/resume` to Grok sessions with a hint for hidden external sessions - Resume sessions by title with `--resume` - Limit app-builder archive size - Data-driven tag labels for slash commands - Doctor fixes for tmux - Custom provider gateways and subprocess environment policy in the shell - `/tutorial` — opt-in onboarding tour of Grok Build - Soft and required CLI version checks in the shell - Privacy banner env overrides survive live settings updates - Add remote flag to override the image-edit model - Return profile fields from auth info even when the access token is expired - Add edit control on queued prompt rows - Keep fail-closed policy when clearing orphans with no team - Setting to disable the Ctrl+Space/F8 voice shortcut - Pass `--raw` to pw-record so Linux dictation works on older PipeWire - Validate git URLs when adding marketplace entries - Stop shipping stale tool-doc parameter and tool names - Re-point dashboard attach after `/fork` only when the parent was attached - Surface Grok Computer media-generation results as file-path chunks - Clear web background-task tray on kill and keep the task description - Show privacy upsell banner in agent view until acted on - Add tools-server client callback surface - Protect persistent global hook sources Source-Revision: 95d84f443eddcbed6cbfd6eed22e2eafe6b3939d
This commit is contained in:
parent
a5727c5960
commit
69f0ba880a
286 changed files with 22939 additions and 9624 deletions
|
|
@ -1037,6 +1037,7 @@ impl AgentBuilder {
|
|||
session_env: self.session_env.unwrap_or_default(),
|
||||
notification_handle: self.notification_handle.clone(),
|
||||
owner_session_id: self.owner_session_id.clone(),
|
||||
subagent: None,
|
||||
parent_scheduler_handle: self.parent_scheduler_handle.take(),
|
||||
skills: skill_info.clone(),
|
||||
state_path,
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ pub enum PromptAudience {
|
|||
Subagent,
|
||||
}
|
||||
use xai_grok_tools::bridge::ToolBridge;
|
||||
use xai_grok_tools::types::template_renderer::TemplateRenderer;
|
||||
/// Agent-specific inputs for system prompt rendering.
|
||||
///
|
||||
/// Serializable (JSON/YAML) so users can dump it and inspect fields.
|
||||
|
|
@ -259,12 +260,21 @@ impl PromptContext {
|
|||
/// MiniJinja so that `${{ tools.by_kind.* }}` variables resolve
|
||||
/// correctly regardless of prompt mode.
|
||||
pub async fn render(&self, tool_bridge: &ToolBridge) -> Option<String> {
|
||||
let renderer = tool_bridge.template_renderer_snapshot().await?;
|
||||
self.render_with_renderer(&renderer)
|
||||
}
|
||||
/// Render the full system prompt from a finalized tool-name renderer.
|
||||
///
|
||||
/// Hosts that do not own a [`ToolBridge`] use this path so they still
|
||||
/// consume the production base-template and prompt-body composition.
|
||||
pub fn render_with_renderer(&self, renderer: &TemplateRenderer) -> Option<String> {
|
||||
let placeholders = self.placeholders();
|
||||
let render = |template: &str| renderer.render_with_extra(template, &placeholders).ok();
|
||||
let prompt = match self.prompt_mode {
|
||||
PromptMode::Extend => {
|
||||
let decrypted;
|
||||
let base = match &self.system_prompt {
|
||||
TemplateOverride::Custom(s) => s.as_str(),
|
||||
TemplateOverride::Custom(template) => template.as_str(),
|
||||
TemplateOverride::Codex => {
|
||||
decrypted = apply_patch_template();
|
||||
&decrypted
|
||||
|
|
@ -278,21 +288,14 @@ impl PromptContext {
|
|||
&decrypted
|
||||
}
|
||||
};
|
||||
let mut p = tool_bridge.render_prompt(base, &placeholders).await?;
|
||||
if let Some(ref body) = self.prompt_body {
|
||||
p.push_str("\n\n");
|
||||
let rendered_body = tool_bridge
|
||||
.render_prompt(body, &placeholders)
|
||||
.await
|
||||
.unwrap_or_else(|| body.clone());
|
||||
p.push_str(&rendered_body);
|
||||
let mut prompt = render(base)?;
|
||||
if let Some(body) = &self.prompt_body {
|
||||
prompt.push_str("\n\n");
|
||||
prompt.push_str(&render(body).unwrap_or_else(|| body.clone()));
|
||||
}
|
||||
p
|
||||
}
|
||||
PromptMode::Full => {
|
||||
let body = self.prompt_body.as_deref().unwrap_or("");
|
||||
tool_bridge.render_prompt(body, &placeholders).await?
|
||||
prompt
|
||||
}
|
||||
PromptMode::Full => render(self.prompt_body.as_deref().unwrap_or(""))?,
|
||||
};
|
||||
Some(prompt)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue