fix: return recovery action descriptors (#174)
Co-authored-by: AgentRun Codex <agentrun-codex@users.noreply.github.com>
This commit is contained in:
@@ -126,12 +126,12 @@ export async function removeProviderProfile(profileValue: string, options: Provi
|
||||
configHashSuffix: hashDataKey(data, "config.toml") ?? stringPath(annotations, [`${credentialAnnotationPrefix}-config-hash-suffix`]),
|
||||
updatedAt: new Date().toISOString(),
|
||||
valuesPrinted: false,
|
||||
pollCommands: {
|
||||
list: "./scripts/agentrun provider-profiles list",
|
||||
show: `./scripts/agentrun provider-profiles show ${profile}`,
|
||||
setKey: `./scripts/agentrun provider-profiles set-key ${profile} --key-stdin`,
|
||||
setConfig: `./scripts/agentrun provider-profiles set-config ${profile} --config-stdin`,
|
||||
},
|
||||
pollActions: [
|
||||
providerActionDescriptor({ action: "list-provider-profiles", operation: "list", resourceKind: "provider-profile", resourceName: "*" }),
|
||||
providerActionDescriptor({ action: "inspect-provider-profile", operation: "describe", resourceKind: "provider-profile", resourceName: profile, profile }),
|
||||
providerActionDescriptor({ action: "set-provider-key", operation: "set-key", resourceKind: "provider-profile", resourceName: profile, profile, inputKind: "credential" }),
|
||||
providerActionDescriptor({ action: "set-provider-config", operation: "set-config", resourceKind: "provider-profile", resourceName: profile, profile, inputKind: "config" }),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -184,12 +184,12 @@ export async function setProviderProfileConfig(profileValue: string, body: unkno
|
||||
configTomlPrinted: false,
|
||||
credentialValuesPrinted: false,
|
||||
valuesPrinted: false,
|
||||
pollCommands: {
|
||||
config: `./scripts/agentrun provider-profiles config ${profile}`,
|
||||
show: `./scripts/agentrun provider-profiles show ${profile}`,
|
||||
setKey: `./scripts/agentrun provider-profiles set-key ${profile} --key-stdin`,
|
||||
validate: `./scripts/agentrun provider-profiles validate ${profile} --wait --timeout-ms 120000`,
|
||||
},
|
||||
pollActions: [
|
||||
providerActionDescriptor({ action: "inspect-provider-config", operation: "config", resourceKind: "provider-profile", resourceName: profile, profile }),
|
||||
providerActionDescriptor({ action: "inspect-provider-profile", operation: "describe", resourceKind: "provider-profile", resourceName: profile, profile }),
|
||||
providerActionDescriptor({ action: "set-provider-key", operation: "set-key", resourceKind: "provider-profile", resourceName: profile, profile, inputKind: "credential" }),
|
||||
providerActionDescriptor({ action: "validate-provider-profile", operation: "validate", resourceKind: "provider-profile", resourceName: profile, profile, wait: true, timeoutMs: 120_000 }),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -241,10 +241,24 @@ export async function setProviderProfileCredential(profileValue: string, body: u
|
||||
delegatedBy,
|
||||
requiresExternalBridgeUpdate: profileUsesMoonBridge(profile, renderedConfig.configToml),
|
||||
valuesPrinted: false,
|
||||
pollCommands: {
|
||||
show: `./scripts/agentrun provider-profiles show ${profile}`,
|
||||
validate: `./scripts/agentrun provider-profiles validate ${profile} --wait --timeout-ms 120000`,
|
||||
},
|
||||
pollActions: [
|
||||
providerActionDescriptor({ action: "inspect-provider-profile", operation: "describe", resourceKind: "provider-profile", resourceName: profile, profile }),
|
||||
providerActionDescriptor({ action: "validate-provider-profile", operation: "validate", resourceKind: "provider-profile", resourceName: profile, profile, wait: true, timeoutMs: 120_000 }),
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
function providerActionDescriptor(input: { action: string; operation: string; resourceKind: string; resourceName: string; profile?: string | null; inputKind?: string | null; wait?: boolean; timeoutMs?: number | null }): JsonRecord {
|
||||
return {
|
||||
action: input.action,
|
||||
operation: input.operation,
|
||||
resourceKind: input.resourceKind,
|
||||
resourceName: input.resourceName,
|
||||
profile: input.profile ?? null,
|
||||
...(input.inputKind ? { inputKind: input.inputKind } : {}),
|
||||
...(input.wait === true ? { wait: true } : {}),
|
||||
...(input.timeoutMs !== undefined ? { timeoutMs: input.timeoutMs } : {}),
|
||||
valuesPrinted: false,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user