Automatisierungsvorschlaege nur mit n8n-Anbindung (#726)
An instance without n8n has no use for workflow proposals. New instance
setting automation.enabled ("this instance works with n8n"), off by default:
- off: automation_find/automation_propose refuse, no candidates are put to
agents, and the escalation tool does not mention proposals at all;
- the switch sits in the settings card for external MCP servers; the
approvals view says proposals are off instead of standing empty.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
184a507e3d
commit
a17ac2957f
@@ -11,3 +11,6 @@ public sealed record AutomationProposalDto(
|
||||
string Status, string? Reason, DateTime CreatedAt, DateTime? DecidedAt, long? Answers);
|
||||
|
||||
public sealed record AutomationDecisionDto(bool Accept, string? Reason);
|
||||
|
||||
/// <summary>#726: Whether the instance works with n8n.</summary>
|
||||
public sealed record AutomationSettingsDto(bool Enabled);
|
||||
|
||||
@@ -387,6 +387,18 @@ internal static class ApiEndpoints
|
||||
p.Status, p.Reason, p.CreatedAt, p.DecidedAt, p.Answers)).ToList());
|
||||
});
|
||||
|
||||
// #726: whether this instance works with n8n — only then do agents propose workflows.
|
||||
staging.MapGet("/automations/settings", (AppHost host) => Results.Ok(new AutomationSettingsDto(host.Instance.Automation.Enabled)));
|
||||
|
||||
staging.MapPut("/automations/settings", (AppHost host, AutomationSettingsDto input) =>
|
||||
{
|
||||
host.Instance.Automation.Enabled = input.Enabled;
|
||||
host.SaveInstance(new InstanceChange(InstanceChangeKind.Settings));
|
||||
return Results.Ok(new OutcomeDto(true, input.Enabled
|
||||
? "n8n connection on: agents may propose workflows, and recurring routine is put to them."
|
||||
: "n8n connection off: no workflow proposals, no candidates."));
|
||||
});
|
||||
|
||||
staging.MapGet("/automations/{id:long}/workflow", async (AppHost host, long id, CancellationToken ct) =>
|
||||
host.Automations is { } automations && (await automations.ListAsync(null, 1000, ct)).FirstOrDefault(p => p.Id == id) is { } proposal
|
||||
? Results.Text(proposal.WorkflowJson, "application/json")
|
||||
|
||||
Reference in New Issue
Block a user