feat: add ERP agent pet bridge and startup guide
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Lskj.Cli
|
||||
{
|
||||
internal sealed class CliException : Exception
|
||||
{
|
||||
public CliException(string code, string message, int exitCode)
|
||||
: base(message)
|
||||
{
|
||||
Code = code;
|
||||
ExitCode = exitCode;
|
||||
}
|
||||
|
||||
public string Code { get; private set; }
|
||||
public int ExitCode { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
namespace Lskj.AgentBridge
|
||||
{
|
||||
public sealed class BridgeUatGrant
|
||||
{
|
||||
[JsonProperty("authorizationId")]
|
||||
public string AuthorizationId { get; set; }
|
||||
|
||||
[JsonProperty("caseCode")]
|
||||
public string CaseCode { get; set; }
|
||||
|
||||
[JsonProperty("token")]
|
||||
public string Token { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
|
||||
<EnableWindowsTargeting>true</EnableWindowsTargeting>
|
||||
<ImplicitUsings>disable</ImplicitUsings>
|
||||
<Nullable>disable</Nullable>
|
||||
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
<AssemblyName>lserp-agent-cli</AssemblyName>
|
||||
<RootNamespace>Lskj.Cli</RootNamespace>
|
||||
<Version>0.4.0</Version>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Deterministic>true</Deterministic>
|
||||
<DebugType>none</DebugType>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="BridgeCliStandaloneTypes.cs" />
|
||||
<Compile Include="..\Lskj.Cli\BridgeOnlyCliApplication.cs" Link="BridgeOnlyCliApplication.cs" />
|
||||
<Compile Include="..\Lskj.Cli\BridgeCliClient.cs" Link="BridgeCliClient.cs" />
|
||||
<Compile Include="..\Lskj.Cli\BridgeCommands.cs" Link="BridgeCommands.cs" />
|
||||
<Compile Include="..\Lskj.Cli\BridgeSessionScope.cs" Link="BridgeSessionScope.cs" />
|
||||
<Compile Include="..\Lskj.Cli\CommandLine.cs" Link="CommandLine.cs" />
|
||||
<Compile Include="..\Lskj.Cli\OutputWriter.cs" Link="OutputWriter.cs" />
|
||||
<Compile Include="..\Lskj.Cli\StrictCliJsonSyntax.cs" Link="StrictCliJsonSyntax.cs" />
|
||||
<Compile Include="..\Lskj.Cli\WorkflowCommands.cs" Link="WorkflowCommands.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace Lskj.Cli
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
Console.OutputEncoding = new UTF8Encoding(false);
|
||||
Console.InputEncoding = new UTF8Encoding(false, true);
|
||||
try
|
||||
{
|
||||
return new BridgeOnlyCliApplication().Run(args);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
OutputWriter.WriteError(
|
||||
"unhandled_error",
|
||||
"命令执行发生未分类错误,详细信息不会通过 CLI 输出。",
|
||||
10);
|
||||
return 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
# lserp-agent-cli
|
||||
|
||||
桌宠和 AstrBot 随包使用的 Windows x64 本地桥 CLI。
|
||||
|
||||
- 只连接当前登录 ERP 发布的命名管道。
|
||||
- 不读取或接收 ERP/SQL Server 登录密码。
|
||||
- 不包含数据库直连、账套登录、客户配置采集或验收管理命令。
|
||||
- 所有账套、数据库、用户、子系统、权限和低代码模块信息由 ERP 服务端会话注入。
|
||||
- 写操作必须先取得短时计划,再经过 ERP 原生确认、幂等校验、事务和审计。
|
||||
|
||||
```text
|
||||
lserp-agent-cli version
|
||||
lserp-agent-cli bridge context <ERP会话范围>
|
||||
lserp-agent-cli workflow capabilities <ERP会话范围>
|
||||
lserp-agent-cli workflow plan purchase-invoice --input <严格JSON文件> <ERP会话范围>
|
||||
lserp-agent-cli workflow execute <planId> --idempotency-key-stdin <ERP会话范围>
|
||||
```
|
||||
|
||||
`<ERP会话范围>` 必须完整展开,不能只传 PID:
|
||||
|
||||
```text
|
||||
--erp-process-id <PID>
|
||||
--expected-database-scope-fingerprint <64位小写SHA-256>
|
||||
--expected-user-id <用户编号>
|
||||
--expected-user-name <用户名>
|
||||
--expected-account-book <账套>
|
||||
--expected-subsystem-id <子系统编号>
|
||||
--expected-is-administrator <true|false>
|
||||
```
|
||||
|
||||
完整的 `lserp-cli.exe` 是管理员配置与客户验收工具,作为单独的旧版
|
||||
.NET Framework 4/x86 Windows 构建交付,不应放入普通桌宠运行时目录。
|
||||
Reference in New Issue
Block a user