feat: 将插件 stdin 协议定为 v1,并按声明注入凭据
进程外插件改为只读环境变量和自身配置,避免读宿主 appsettings;宿主按 plugin.json 声明注入 LLM / OpenWeather 等凭据。
This commit is contained in:
@@ -391,7 +391,28 @@ public sealed class ConfigurableWorkflowRunner(
|
||||
{
|
||||
Dictionary<string, object?> declared = FilterDeclaredInputs(plugin.Manifest, inputs);
|
||||
node.Config.TryGetValue("credentialId", out string? credentialId);
|
||||
Dictionary<string, object?> outputs = await plugins.RunAsync(plugin, declared, credentialId, cancellationToken);
|
||||
Dictionary<string, string> bindings = new(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (KeyValuePair<string, string> pair in node.Config)
|
||||
{
|
||||
const string prefix = "credential:";
|
||||
if (!pair.Key.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string name = pair.Key[prefix.Length..].Trim();
|
||||
if (!string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(pair.Value))
|
||||
{
|
||||
bindings[name] = pair.Value;
|
||||
}
|
||||
}
|
||||
|
||||
Dictionary<string, object?> outputs = await plugins.RunAsync(
|
||||
plugin,
|
||||
declared,
|
||||
credentialId,
|
||||
bindings,
|
||||
cancellationToken);
|
||||
string? stderr = null;
|
||||
if (outputs.Remove("_stderr", out object? stderrValue))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user