@team-agent/installer 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/crates/team-agent/src/cli/send.rs +9 -2
- package/crates/team-agent/src/coordinator/backoff.rs +83 -2
- package/crates/team-agent/src/coordinator/tick.rs +327 -167
- package/crates/team-agent/src/mcp_server/helpers.rs +24 -5
- package/crates/team-agent/src/mcp_server/normalize.rs +13 -6
- package/crates/team-agent/src/mcp_server/tests/send.rs +310 -212
- package/crates/team-agent/src/messaging/helpers.rs +30 -10
- package/crates/team-agent/src/messaging/send.rs +71 -14
- package/crates/team-agent/src/messaging/tests/basic.rs +25 -7
- package/crates/team-agent/src/messaging/tests/runtime.rs +489 -125
- package/crates/team-agent/src/messaging/types.rs +19 -4
- package/package.json +4 -4
|
@@ -146,7 +146,10 @@ impl serde_json::ser::Formatter for PythonJsonFormatter {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
fn begin_object_value<W: ?Sized + std::io::Write>(
|
|
149
|
+
fn begin_object_value<W: ?Sized + std::io::Write>(
|
|
150
|
+
&mut self,
|
|
151
|
+
writer: &mut W,
|
|
152
|
+
) -> std::io::Result<()> {
|
|
150
153
|
writer.write_all(b": ")
|
|
151
154
|
}
|
|
152
155
|
}
|
|
@@ -171,7 +174,11 @@ pub(crate) fn ensure_object(value: &mut Value) {
|
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
176
|
|
|
174
|
-
pub(crate) fn insert_array(
|
|
177
|
+
pub(crate) fn insert_array(
|
|
178
|
+
obj: &mut serde_json::Map<String, Value>,
|
|
179
|
+
key: &str,
|
|
180
|
+
value: Option<&[Value]>,
|
|
181
|
+
) {
|
|
175
182
|
if let Some(items) = value {
|
|
176
183
|
obj.insert(key.to_string(), Value::Array(items.to_vec()));
|
|
177
184
|
}
|
|
@@ -198,11 +205,20 @@ pub(crate) fn object_fields(value: Value) -> serde_json::Map<String, Value> {
|
|
|
198
205
|
}
|
|
199
206
|
|
|
200
207
|
pub(crate) fn delivery_outcome_value(out: &DeliveryOutcome) -> Value {
|
|
201
|
-
serde_json::json!({
|
|
208
|
+
let mut value = serde_json::json!({
|
|
202
209
|
"ok": out.ok,
|
|
203
210
|
"status": enum_value(out.status),
|
|
204
211
|
"message_id": out.message_id,
|
|
205
|
-
})
|
|
212
|
+
});
|
|
213
|
+
if let Some(obj) = value.as_object_mut() {
|
|
214
|
+
if let Some(reason) = out.reason {
|
|
215
|
+
obj.insert("reason".to_string(), enum_value(reason));
|
|
216
|
+
}
|
|
217
|
+
if let Some(warning) = out.verification.as_deref() {
|
|
218
|
+
obj.insert("warning".to_string(), Value::String(warning.to_string()));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
value
|
|
206
222
|
}
|
|
207
223
|
|
|
208
224
|
pub(crate) fn latest_task_for_assignee(workspace: &Path, agent_id: &str) -> Option<String> {
|
|
@@ -218,7 +234,10 @@ pub(crate) fn latest_task_for_assignee(workspace: &Path, agent_id: &str) -> Opti
|
|
|
218
234
|
.and_then(Value::as_str)
|
|
219
235
|
.unwrap_or("")
|
|
220
236
|
.to_ascii_lowercase();
|
|
221
|
-
if matches!(
|
|
237
|
+
if matches!(
|
|
238
|
+
status.as_str(),
|
|
239
|
+
"done" | "success" | "failed" | "blocked" | "cancelled"
|
|
240
|
+
) {
|
|
222
241
|
continue;
|
|
223
242
|
}
|
|
224
243
|
if let Some(id) = task.get("id").and_then(text_of_value) {
|
|
@@ -65,7 +65,10 @@ pub fn normalize_change_kind(value: Option<&str>, description: &str) -> ChangeKi
|
|
|
65
65
|
ChangeKind::Created
|
|
66
66
|
} else if desc.contains("removed") || desc.contains("deleted") {
|
|
67
67
|
ChangeKind::Deleted
|
|
68
|
-
} else if desc.contains("verified")
|
|
68
|
+
} else if desc.contains("verified")
|
|
69
|
+
|| desc.contains("observed")
|
|
70
|
+
|| desc.contains("inspected")
|
|
71
|
+
{
|
|
69
72
|
ChangeKind::Observed
|
|
70
73
|
} else {
|
|
71
74
|
ChangeKind::Modified
|
|
@@ -127,6 +130,7 @@ pub fn compact_tool_result(result: &Value) -> ToolResult {
|
|
|
127
130
|
"ok",
|
|
128
131
|
"status",
|
|
129
132
|
"reason",
|
|
133
|
+
"warning",
|
|
130
134
|
"error",
|
|
131
135
|
"message_id",
|
|
132
136
|
"agent_id",
|
|
@@ -195,7 +199,10 @@ pub fn compact_tool_result(result: &Value) -> ToolResult {
|
|
|
195
199
|
Ok(ToolOk { fields })
|
|
196
200
|
}
|
|
197
201
|
|
|
198
|
-
pub(crate) fn normalize_changes(
|
|
202
|
+
pub(crate) fn normalize_changes(
|
|
203
|
+
value: Option<&Value>,
|
|
204
|
+
envelope_summary: &str,
|
|
205
|
+
) -> Vec<NormalizedChange> {
|
|
199
206
|
items_from_value(value)
|
|
200
207
|
.iter()
|
|
201
208
|
.filter_map(|item| {
|
|
@@ -267,7 +274,9 @@ pub(crate) fn normalize_risks(value: Option<&Value>) -> Vec<NormalizedRisk> {
|
|
|
267
274
|
.filter_map(|item| match item {
|
|
268
275
|
Value::Object(obj) => Some(NormalizedRisk {
|
|
269
276
|
severity: normalize_risk_severity(
|
|
270
|
-
obj.get("severity")
|
|
277
|
+
obj.get("severity")
|
|
278
|
+
.or_else(|| obj.get("level"))
|
|
279
|
+
.and_then(Value::as_str),
|
|
271
280
|
),
|
|
272
281
|
description: obj
|
|
273
282
|
.get("description")
|
|
@@ -325,9 +334,7 @@ pub(crate) fn normalize_next_actions(value: Option<&Value>) -> Vec<NormalizedNex
|
|
|
325
334
|
.or_else(|| obj.get("todo"))
|
|
326
335
|
.or_else(|| obj.get("message"))
|
|
327
336
|
.and_then(text_of_value)
|
|
328
|
-
.map(|description| NormalizedNextAction {
|
|
329
|
-
description,
|
|
330
|
-
}),
|
|
337
|
+
.map(|description| NormalizedNextAction { description }),
|
|
331
338
|
scalar => text_of_value(scalar).map(|description| NormalizedNextAction { description }),
|
|
332
339
|
})
|
|
333
340
|
.collect()
|