Add versioned script library, reconcile permit refusals and compact helper captures
This commit is contained in:
@@ -72,6 +72,19 @@ struct Cancel {
|
||||
#[derive(Deserialize, schemars::JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct Empty {}
|
||||
#[derive(Deserialize, schemars::JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct PublishScript {
|
||||
tenant_id: Uuid,
|
||||
input: crate::script_library::Publish,
|
||||
}
|
||||
#[derive(Deserialize, schemars::JsonSchema)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct PlanScript {
|
||||
tenant_id: Uuid,
|
||||
revision_id: Uuid,
|
||||
input: crate::script_library::Selection,
|
||||
}
|
||||
fn tool<T: schemars::JsonSchema>(name: &'static str, description: &'static str) -> Tool {
|
||||
let schema = schemars::schema_for!(T).to_value();
|
||||
let map = schema.as_object().cloned().unwrap_or_default();
|
||||
@@ -91,6 +104,18 @@ fn tools() -> Vec<Tool> {
|
||||
"inventory.get_device",
|
||||
"Read stored inventory of one authorized device.",
|
||||
),
|
||||
tool::<Devices>(
|
||||
"scripts.list",
|
||||
"Read tenant script revisions, including the exact script and execution identity.",
|
||||
),
|
||||
tool::<PublishScript>(
|
||||
"scripts.publish",
|
||||
"Save an immutable script revision. Use expected_version zero for a new name or the current version to publish an edit.",
|
||||
),
|
||||
tool::<PlanScript>(
|
||||
"scripts.plan",
|
||||
"Plan the selected immutable script revision against fixed assets. Submit the returned plan for WebUI approval via operations.submit.",
|
||||
),
|
||||
tool::<Devices>(
|
||||
"updates.list_releases",
|
||||
"Read immutable signed agent release metadata for the authorized tenant; never approves or applies an update.",
|
||||
@@ -208,6 +233,28 @@ impl Adapter {
|
||||
let i: crate::monitoring::LogQuery = parse(args)?;
|
||||
crate::monitoring::query(&self.state, &p, i).await
|
||||
}
|
||||
"scripts.list" => {
|
||||
let i: Devices = parse(args)?;
|
||||
crate::script_library::list(
|
||||
&self.state,
|
||||
&p,
|
||||
i.tenant_id,
|
||||
crate::pagination::PageQuery {
|
||||
cursor: i.cursor,
|
||||
limit: i.limit,
|
||||
},
|
||||
)
|
||||
.await
|
||||
}
|
||||
"scripts.publish" => {
|
||||
let i: PublishScript = parse(args)?;
|
||||
crate::script_library::publish(&self.state, &p, i.tenant_id, i.input).await
|
||||
}
|
||||
"scripts.plan" => {
|
||||
let i: PlanScript = parse(args)?;
|
||||
crate::script_library::plan(&self.state, &p, i.tenant_id, i.revision_id, i.input)
|
||||
.await
|
||||
}
|
||||
"operations.plan" => {
|
||||
let i: Plan = parse(args)?;
|
||||
crate::jobs::plan_request(&self.state, &p, i.tenant_id, i.input).await
|
||||
|
||||
Reference in New Issue
Block a user