pub struct LocalSourceBuilder { /* private fields */ }Expand description
Builds a LocalSource.
Implementations§
Source§impl LocalSourceBuilder
impl LocalSourceBuilder
Sourcepub fn sessions(self, sessions: Arc<dyn SessionService>) -> Self
pub fn sessions(self, sessions: Arc<dyn SessionService>) -> Self
The session store the agents write.
Sourcepub fn approvals(self, approvals: Arc<dyn ApprovalService>) -> Self
pub fn approvals(self, approvals: Arc<dyn ApprovalService>) -> Self
The approval service held calls are submitted to.
Sourcepub fn kernel(self, kernel: Kernel, target: impl Into<String>) -> Self
pub fn kernel(self, kernel: Kernel, target: impl Into<String>) -> Self
An in-process kernel, whose processes of target run the turns surfaces send.
Sourcepub fn harness(self, harness: Arc<Harness>) -> Self
pub fn harness(self, harness: Arc<Harness>) -> Self
A harness: its runner’s sessions and kill switch unless set, its modes and standing rules.
Sourcepub fn runner(self, runner: Arc<Runner>) -> Self
pub fn runner(self, runner: Arc<Runner>) -> Self
A runner for apps without a harness: its sessions and kill switch unless set.
Sourcepub fn governance(self, governance: GovernanceControl) -> Self
pub fn governance(self, governance: GovernanceControl) -> Self
The kill switch “Stop all” freezes when there is no kernel.
Sourcepub fn daily_limit(self, micro_usd: u64) -> Self
pub fn daily_limit(self, micro_usd: u64) -> Self
The daily spending limit in micro-USD, over the one in force in the kernel’s area of this source’s turns.
Sourcepub fn agents(self, agents: AgentsHandle) -> Self
pub fn agents(self, agents: AgentsHandle) -> Self
The agent table of a kernel this source does not run turns on — a kernel built after
the source, such as the one adk-rust up serves the terminal’s commands for — so
“Always allow” on an added agent’s card makes a rule for that agent alone (spec 3.3
S-I19). A kernel brings its own.
§Example
use adk_kernel::agents::AgentsHandle;
use adk_session::InMemorySessionService;
let source = adk_surface::LocalSource::builder("adk-rust")
.sessions(std::sync::Arc::new(InMemorySessionService::new()))
.agents(AgentsHandle::new())
.build()
.unwrap();Sourcepub fn artifacts(self, artifacts: Arc<dyn ArtifactService>) -> Self
pub fn artifacts(self, artifacts: Arc<dyn ArtifactService>) -> Self
The artifact service a held call’s evidence images live in (spec 3.7 §8.2): cards show them, each checked against its digest, and a person may cut one smaller or cover more of it before it leaves.
§Example
use std::sync::Arc;
use adk_artifact::InMemoryArtifactService;
use adk_session::InMemorySessionService;
let source = adk_surface::LocalSource::builder("desk")
.sessions(Arc::new(InMemorySessionService::new()))
.artifacts(Arc::new(InMemoryArtifactService::new()))
.build()
.unwrap();Sourcepub fn runs(self, runs: Arc<dyn DurableRunStore>) -> Self
pub fn runs(self, runs: Arc<dyn DurableRunStore>) -> Self
The durable run store whose runs wait on decisions: a decision whose run ended while it waits says its answer is used when the agent picks the thread up again (spec 3.7 §8.2, board choice A12).
Sourcepub fn eval_fixtures(self, root: impl Into<PathBuf>) -> Self
pub fn eval_fixtures(self, root: impl Into<PathBuf>) -> Self
The folder labelled examples are saved under (spec 3.7 §8.2, board choice V13): the
annotated viewer writes adk-eval cases to the .test.json files in it, and each
case’s image beside its file, so cargo adk eval reads them. Without it, the viewer
shows answers and exports them but saves no examples.
§Example
use std::sync::Arc;
use adk_artifact::InMemoryArtifactService;
use adk_session::InMemorySessionService;
let source = adk_surface::LocalSource::builder("desk")
.sessions(Arc::new(InMemorySessionService::new()))
.artifacts(Arc::new(InMemoryArtifactService::new()))
.eval_fixtures(std::env::temp_dir().join("evals"))
.build()
.unwrap();Sourcepub fn build(self) -> Result<LocalSource>
pub fn build(self) -> Result<LocalSource>
The source.
§Errors
Returns surface.invalid when no session store was given and no harness or runner
brings one.
Trait Implementations§
Source§impl Debug for LocalSourceBuilder
impl Debug for LocalSourceBuilder
Auto Trait Implementations§
impl !RefUnwindSafe for LocalSourceBuilder
impl !UnwindSafe for LocalSourceBuilder
impl Forget for LocalSourceBuilder
impl Freeze for LocalSourceBuilderwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<dyn SessionService> is !null: Freeze,
PhantomData<ArcInner<dyn SessionService>>: Freeze,
*const ArcInner<dyn ApprovalService> is !null: Freeze,
PhantomData<ArcInner<dyn ApprovalService>>: Freeze,
*const ArcInner<KernelInner> is !null: Freeze,
PhantomData<ArcInner<KernelInner>>: Freeze,
*const ArcInner<Harness> is !null: Freeze,
PhantomData<ArcInner<Harness>>: Freeze,
*const ArcInner<Runner> is !null: Freeze,
PhantomData<ArcInner<Runner>>: Freeze,
*const ArcInner<ControlState> is !null: Freeze,
PhantomData<ArcInner<ControlState>>: Freeze,
*const ArcInner<RwLock<Weak<AgentsInner>>> is !null: Freeze,
PhantomData<ArcInner<RwLock<Weak<AgentsInner>>>>: Freeze,
*const ArcInner<dyn ArtifactService> is !null: Freeze,
PhantomData<ArcInner<dyn ArtifactService>>: Freeze,
*const ArcInner<dyn DurableRunStore> is !null: Freeze,
PhantomData<ArcInner<dyn DurableRunStore>>: Freeze,
impl Move for LocalSourceBuilder
impl Send for LocalSourceBuilder
impl Sync for LocalSourceBuilder
impl Unpin for LocalSourceBuilder
impl UnsafeUnpin for LocalSourceBuilderwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<dyn SessionService> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn SessionService>>: UnsafeUnpin,
*const ArcInner<dyn ApprovalService> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn ApprovalService>>: UnsafeUnpin,
*const ArcInner<KernelInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<KernelInner>>: UnsafeUnpin,
*const ArcInner<Harness> is !null: UnsafeUnpin,
PhantomData<ArcInner<Harness>>: UnsafeUnpin,
*const ArcInner<Runner> is !null: UnsafeUnpin,
PhantomData<ArcInner<Runner>>: UnsafeUnpin,
*const ArcInner<ControlState> is !null: UnsafeUnpin,
PhantomData<ArcInner<ControlState>>: UnsafeUnpin,
*const ArcInner<RwLock<Weak<AgentsInner>>> is !null: UnsafeUnpin,
PhantomData<ArcInner<RwLock<Weak<AgentsInner>>>>: UnsafeUnpin,
*const ArcInner<dyn ArtifactService> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn ArtifactService>>: UnsafeUnpin,
*const ArcInner<dyn DurableRunStore> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn DurableRunStore>>: UnsafeUnpin,
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> 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