Skip to content

Commit 6d12db2

Browse files
🧩 Refactor(Workflow): 瘦身 Core.Contract 至 Dashboard 公共契约面-新增 ITriggerManager/IRealPluginManagerBridge/WorkflowEventNames、IDeviceHttpClient 提升至 Contract、拆分 IBlockScriptService 移除内部模型依赖、迁移 12 个内部数据模型与 9 个内部接口至 KitX.Workflow 库
1 parent 51da134 commit 6d12db2

22 files changed

Lines changed: 110 additions & 788 deletions

KitX Core Contracts/KitX.Core.Contract/Device/IDeviceService.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
22
using System.ComponentModel;
3+
using System.Net.Http;
4+
using System.Threading;
35
using System.Threading.Tasks;
46
using System.Collections.Generic;
57
using KitX.Shared.CSharp.Device;
@@ -238,3 +240,26 @@ public class MainDeviceChangedEventArgs : EventArgs
238240
/// </summary>
239241
public string NewMainDeviceId { get; set; } = string.Empty;
240242
}
243+
244+
/// <summary>
245+
/// Device HTTP client interface — sends requests to remote DevicesServer instances.
246+
/// Used for cross-device plugin invocation via the /Api/V1/Plugin/Invoke endpoint.
247+
/// (Moved to Contract so the Workflow library can depend on the abstraction without
248+
/// referencing KitX.Core.)
249+
/// </summary>
250+
public interface IDeviceHttpClient
251+
{
252+
/// <summary>
253+
/// Invokes a plugin method on a remote device via HTTP POST to /Api/V1/Plugin/Invoke.
254+
/// </summary>
255+
/// <param name="targetDevice">Target device info (contains IPv4 and DevicesServerPort)</param>
256+
/// <param name="token">Valid session token for the target device</param>
257+
/// <param name="request">The Request object to send</param>
258+
/// <param name="ct">Cancellation token</param>
259+
/// <returns>HTTP response from remote device, or null on network error</returns>
260+
Task<HttpResponseMessage?> InvokePluginAsync(
261+
DeviceInfo targetDevice,
262+
string token,
263+
KitX.Shared.CSharp.WebCommand.Request request,
264+
CancellationToken ct = default);
265+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
namespace KitX.Core.Contract.Event;
2+
3+
/// <summary>
4+
/// Event-bus channel names shared between the Workflow library and its host
5+
/// (KitX.Core / KitX.Dashboard). Centralized here so the workflow library can
6+
/// publish/subscribe on the <see cref="IEventService"/> bus without referencing
7+
/// KitX.Core's own <c>EventNames</c> table.
8+
/// </summary>
9+
public static class WorkflowEventNames
10+
{
11+
/// <summary>
12+
/// Plugin response event (carries a RequestId so callers can correlate
13+
/// a fire-and-forget plugin invocation with its reply).
14+
/// </summary>
15+
public const string PluginResponse = "PluginResponse";
16+
17+
/// <summary>
18+
/// Workflow execution result event (success or failure of a workflow run).
19+
/// </summary>
20+
public const string WorkflowExecutionResult = "WorkflowExecutionResult";
21+
}

KitX Core Contracts/KitX.Core.Contract/Workflow/BlockDefinition.cs

Lines changed: 0 additions & 45 deletions
This file was deleted.

KitX Core Contracts/KitX.Core.Contract/Workflow/BlockScript.cs

Lines changed: 0 additions & 93 deletions
This file was deleted.

KitX Core Contracts/KitX.Core.Contract/Workflow/BlockScriptModels.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

KitX Core Contracts/KitX.Core.Contract/Workflow/FlowControlType.cs

Lines changed: 0 additions & 32 deletions
This file was deleted.

KitX Core Contracts/KitX.Core.Contract/Workflow/IBlockScriptParser.cs

Lines changed: 0 additions & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)