Record externally completed agent config imports (#34981)

## Why

Clients that complete an external agent config import outside the app server need a way to include the result in import history.

## What changed

- Add `externalAgentConfig/import/recordHistory` to persist completed item results and return a generated import ID.
- Store the optional provider ID for regular imports and expose it when reading import history.
- Update the generated JSON and TypeScript protocol schemas for the new request, response, and history field.

## Testing

- Cover recording and reading an externally completed import through the app-server protocol.
- Cover provider ID persistence and updates in the state runtime.

GitOrigin-RevId: 935401e899ec9eeb38f54c182e45a16642411deb
This commit is contained in:
charlesgong-openai authored and copyberry committed 2026-07-23 17:55:22 +00:00
1 parent 8d34c06672
commit ce803c45ae
22 files changed
+632 -22

No files matched your search

@@ -741,8 +741,8 @@ pub struct ExternalAgentConfigImportParams {
/// Optional identifier for the product that initiated the import.
#[ts(optional = nullable)]
pub source: Option<String>,
/// Opaque provider identifier supplied by the caller for analytics attribution. This does not
/// select the migration source.
/// Opaque provider identifier supplied by the caller for analytics attribution and import
/// history display. This does not select the migration source.
#[ts(optional = nullable)]
pub provider_id: Option<String>,
/// Migration-source selector used to produce the migration items. Pass the same value to
@@ -790,11 +790,29 @@ pub struct ExternalAgentConfigImportTypeResult {
pub failures: Vec<ExternalAgentConfigImportItemTypeFailure>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ExternalAgentConfigImportHistoryRecordParams {
/// Opaque provider identifier for the externally completed import.
pub provider_id: String,
/// Completed results grouped by imported item type.
pub item_type_results: Vec<ExternalAgentConfigImportTypeResult>,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ExternalAgentConfigImportHistoryRecordResponse {
pub import_id: String,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, JsonSchema, TS)]
#[serde(rename_all = "camelCase")]
#[ts(export_to = "v2/")]
pub struct ExternalAgentConfigImportHistory {
pub import_id: String,
pub provider_id: Option<String>,
pub completed_at_ms: i64,
pub successes: Vec<ExternalAgentConfigImportItemTypeSuccess>,
pub failures: Vec<ExternalAgentConfigImportItemTypeFailure>,