pub enum Command {
Show 18 variants
Decide {
decision_id: String,
version: u64,
answer: Answer,
edited_args: Option<Value>,
reason: Option<String>,
expanded: bool,
evidence: Vec<String>,
},
ChangeImage {
decision_id: String,
version: u64,
from: String,
change: ImageChange,
preview: bool,
},
CancelAnswer {
decision_id: String,
},
Send {
session_id: String,
text: String,
images: Vec<ImageData>,
},
Steer {
session_id: String,
text: String,
},
StopTurn {
session_id: String,
},
Queue {
session_id: String,
text: String,
images: Vec<ImageData>,
},
StopAll {
reason: Option<String>,
},
ResumeAll,
SetMode {
session_id: String,
mode: Mode,
},
NewThread {
agent: String,
session_id: String,
text: String,
images: Vec<ImageData>,
},
AddAgent {
draft: Box<AgentDraft>,
digest: String,
replaces: Option<String>,
},
ChangeAgent {
agent: String,
version: u64,
draft: Box<AgentDraft>,
digest: String,
},
PauseAgent {
agent: String,
},
ResumeAgent {
agent: String,
},
RemoveAgent {
agent: String,
version: u64,
digest: String,
},
CopyRuleToAgent {
agent: String,
rule_id: String,
},
SubmitDrawn {
session_id: String,
surface_id: String,
version: u64,
action_id: String,
values: Map<String, Value>,
},
}Expand description
A command from a surface (spec 3.3 §6). Every command runs as an authenticated
Caller, whose subject, surface and Origin reach its audit record.
A message sent while a turn of its session runs reaches that turn (§6 “steer”): the
engine offers it through Source::steer, the runtime screens it as it screens a turn’s
own message, and the agent takes it at its next safe point. A turn that ends first hands
the message back, and it goes as the session’s next message, once.
| Command | A turn of the session runs | Answers |
|---|---|---|
Send | Offered to the turn; it waits in the session’s queue until the turn takes it or hands it back | At once: Queued |
Steer | The same | Once the message has a fate: Steered, or Queued when handed back |
Queue | Never offered: the session’s next message | At once: Queued |
§Example
use adk_surface::{Answer, Command};
let command: Command = serde_json::from_value(serde_json::json!({
"type": "decide",
"decisionId": "apr_1",
"version": 1,
"answer": "allowOnce",
}))
.unwrap();
assert!(matches!(command, Command::Decide { answer: Answer::AllowOnce, .. }));Variants§
Decide
Answers a decision at the version the surface saw (S-I2).
Fields
ChangeImage
Tightens the crop of one of a decision’s images or covers more of it, then holds the
call again with the new image in its place (spec 3.7 §8.2, board choice A8): the crop
only shrinks and covering only grows. The decision at version closes; the call with
the new image waits for the person’s answer.
Fields
change: ImageChangeThe change.
CancelAnswer
Cancels a spoken “allow once” inside its cancel window (§7.2).
Send
Sends a message; queued instead while a decision of the session is open (S-I4). A running turn of the session is offered it and takes it at its agent’s next safe point; a turn that ends first leaves it queued as the session’s next message.
Fields
images: Vec<ImageData>The images the person sent with it (spec 3.3 §5.1): at most
MAX_IMAGES. A message with images is never offered to a
running turn; it goes as the session’s next.
Steer
Sends a message to the running turn of the caller’s own session and waits for what
became of it (§6 “steer”): Steered when the turn took it,
Queued or Sent when it was handed
back and goes as the session’s next message. A person sends it, never an agent.
StopTurn
Stops the running turn of the caller’s own session (spec 3.3 §5.1): a person only; the agent waits for the next message, and nothing held for a decision is answered.
Queue
Queues a message as the session’s next, after its open decisions (S-I4): never offered to a running turn.
Fields
images: Vec<ImageData>The images the person sent with it (spec 3.3 §5.1): at most
MAX_IMAGES. A message with images is never offered to a
running turn; it goes as the session’s next.
StopAll
Stops every agent (S-I10).
ResumeAll
Resumes after a stop: the web home or a paired local terminal only (S-I10).
SetMode
Changes how much a session’s agent acts on its own.
NewThread
Starts a thread with agent: the session’s first message goes to it, and its
harness stamps the session as its own (spec 3.3 §5.7 “Threads”).
Fields
images: Vec<ImageData>The images the person sent with it (spec 3.3 §5.1): at most
MAX_IMAGES. A message with images is never offered to a
running turn; it goes as the session’s next.
AddAgent
Adds an agent by hand, previewed with digest (spec 3.3 §5.7).
Fields
draft: Box<AgentDraft>The definition.
ChangeAgent
Changes an agent at the version seen, previewed with digest (spec 3.3 §5.7).
Fields
draft: Box<AgentDraft>The definition after the change.
PauseAgent
Pauses an agent (spec 3.3 §5.7).
ResumeAgent
Resumes an agent paused by hand: the web home or a paired local terminal (S-I10).
RemoveAgent
Removes an agent at the version seen, previewed with digest (spec 3.3 §5.7).
Fields
CopyRuleToAgent
Copies one of the person’s standing rules to an agent, pinned to it (spec 3.3 §5.7 “Copy one of your rules”, S-I19).
SubmitDrawn
Sends a form an agent drew, from the version the person saw (spec 3.3 §7.4 rule 5):
never runs its tool, but asks for the call, which the drawing agent holds for the
person’s decision. Only a person at a screen sends one (keyboard, pointer,
touch). Feature genui.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Command
impl<'de> Deserialize<'de> for Command
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Command
impl JsonSchema for Command
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreimpl StructuralPartialEq for Command
Auto Trait Implementations§
impl Forget for Command
impl Freeze for Commandwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
*const LeafNode<String, Value> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Value)>>: Freeze,
PhantomData<String>: Freeze,
PhantomData<[u32; 4]>: Freeze,
PhantomData<ImageData>: Freeze,
*const AgentDraft is !null: Freeze,
PhantomData<AgentDraft>: Freeze,
impl Move for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnsafeUnpin for Commandwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
*const LeafNode<String, Value> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Value)>>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
PhantomData<[u32; 4]>: UnsafeUnpin,
PhantomData<ImageData>: UnsafeUnpin,
*const AgentDraft is !null: UnsafeUnpin,
PhantomData<AgentDraft>: UnsafeUnpin,
impl UnwindSafe for Command
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more