refactor(proto): drop unused Agent business messages
This commit is contained in:
@@ -121,6 +121,7 @@
|
||||
- Agent 旧静态制品入口:现行命令从未提供 `StaticArtifactRaw/Expected`,旧激活分支及只服务于旧 `static-cell-artifact-v0.2` Schema 的手写解析器无法证明 Asterisk 实际加载。结构测试先复现残留,再移除旧 RPC 参数、解析器与专属测试;保留当前隔离 Mock 的 `LoadedSIP` revision 回报及 Dispatcher SIP 版本准入校验。此变更不等于真实 Agent/Asterisk 已加载或管理平台已审批,历史 Schema/来源事实另行辨析。
|
||||
- Agent 旧 spool 准入边界:隔离测试先复现现行 Agent 对同一恢复根目录中旧 `.uploads`、`.upload-locks` 与逐执行 `state.json` 均会照常启动;现于创建会话和媒体状态前只读检查这些遗留标记,发现时明确拒绝启动并保留原文件。测试核实没有写新会话、没有修改标记;仅对配置的恢复根目录生效,不替代现存数据的人工核查或处置。
|
||||
- Agent 旧 spool 代码:旧执行状态、实时事件、上传尝试、失败事实及上传锁只由旧模块彼此调用,没有现行命令或录音恢复调用;删除专属实现与测试。录音恢复仍复用的原子写、目录同步、文件名校验等小函数移至 `internal/agent/file_state.go`,通过现行录音重试/未知结果测试确认恢复能力保持。删除源码不删除任何磁盘 spool;旧文件在当前恢复根目录触发上述拒绝启动,不能视作已经补传或处置。
|
||||
- Agent Proto 旧消息:先用描述符结构测试复现 `ConfigReference` 等废弃定义仍可被发现,再按当前八个服务方法及现行 Go 引用追踪字段依赖;删除无调用者的 26 个旧消息和 3 个旧枚举,不改现行请求/响应的字段号。使用本地 Buf 重新生成 Go 类型,核对七项来源/hash;现行录音客户端、获批执行、控制及会话测试保持通过。固定 `agent.v1` 仍是有效的内部协议值;这不构成真实 Agent/Asterisk 或外部 SaaS 验收。
|
||||
|
||||
## 验收台账
|
||||
|
||||
|
||||
+161
-2506
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
agentpb "git.ipao.vip/rogee/go-sip/gen/agent"
|
||||
"google.golang.org/protobuf/reflect/protoreflect"
|
||||
)
|
||||
|
||||
func TestAgentControlServiceOnlyExposesApprovedMethods(t *testing.T) {
|
||||
@@ -22,6 +23,29 @@ func TestAgentControlServiceOnlyExposesApprovedMethods(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentProtoOmitsRetiredBusinessPayloads(t *testing.T) {
|
||||
file := agentpb.File_agent_agent_proto
|
||||
for _, name := range []string{
|
||||
"ConfigReference", "UploadPolicy", "ExecutionBinding",
|
||||
"GetBootstrapRequest", "GetBootstrapResponse", "SetAdmissionStateRequest", "SetAdmissionStateResponse",
|
||||
"ExecuteRequest", "ExecuteResponse", "ExecuteAuthorizedRequest", "ExecuteAuthorizedResponse",
|
||||
"GetExecutionPermitRequest", "ExecutionPermit", "GetExecutionPermitResponse",
|
||||
"ApplyTaskControlRequest", "ApplyTaskControlResponse",
|
||||
"QueryExecutionRequest", "ExecutionSnapshot", "QueryExecutionResponse",
|
||||
"ExecutionFact", "ReportExecutionEventRequest", "ReportExecutionEventResponse",
|
||||
"RequestUploadRequest", "RequestUploadResponse", "CompleteUploadRequest", "CompleteUploadResponse",
|
||||
} {
|
||||
if file.Messages().ByName(protoreflect.Name(name)) != nil {
|
||||
t.Fatalf("retired Agent Proto message %s is still declared", name)
|
||||
}
|
||||
}
|
||||
for _, name := range []string{"ExecutionState", "UploadState", "FactKind"} {
|
||||
if file.Enums().ByName(protoreflect.Name(name)) != nil {
|
||||
t.Fatalf("retired Agent Proto enum %s is still declared", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAgentServerUsesLoadedSIPInsteadOfRetiredStaticArtifact(t *testing.T) {
|
||||
options := reflect.TypeOf(ServerOptions{})
|
||||
for _, name := range []string{"StaticArtifactRaw", "StaticArtifactExpected"} {
|
||||
|
||||
+3
-241
@@ -71,42 +71,12 @@ enum ActiveCallPolicy {
|
||||
ACTIVE_CALL_POLICY_HANGUP = 2;
|
||||
}
|
||||
|
||||
enum ExecutionState {
|
||||
EXECUTION_STATE_UNSPECIFIED = 0;
|
||||
EXECUTION_STATE_PREPARED = 1;
|
||||
EXECUTION_STATE_PERMIT_GRANTED = 2;
|
||||
EXECUTION_STATE_DISPATCHING = 3;
|
||||
EXECUTION_STATE_OBSERVED = 4;
|
||||
EXECUTION_STATE_UNKNOWN = 5;
|
||||
EXECUTION_STATE_TERMINAL = 6;
|
||||
}
|
||||
|
||||
enum AssetKind {
|
||||
ASSET_KIND_UNSPECIFIED = 0;
|
||||
ASSET_KIND_RECORDING = 1;
|
||||
ASSET_KIND_TRANSCRIPT = 2;
|
||||
}
|
||||
|
||||
enum UploadState {
|
||||
UPLOAD_STATE_UNSPECIFIED = 0;
|
||||
UPLOAD_STATE_REQUESTED = 1;
|
||||
UPLOAD_STATE_COMPLETED = 3;
|
||||
UPLOAD_STATE_FAILED = 4;
|
||||
reserved 2, 5;
|
||||
reserved "UPLOAD_STATE_UPLOADING", "UPLOAD_STATE_EXPIRED";
|
||||
}
|
||||
|
||||
enum FactKind {
|
||||
FACT_KIND_UNSPECIFIED = 0;
|
||||
FACT_KIND_EXECUTION_ACCEPTED = 1;
|
||||
FACT_KIND_CALL_STATUS = 2;
|
||||
FACT_KIND_CALL_FINISHED = 3;
|
||||
FACT_KIND_TRANSCRIPT_UPDATED = 4;
|
||||
FACT_KIND_TRANSCRIPT_FAILED = 5;
|
||||
FACT_KIND_CONTACT_OPT_OUT = 6;
|
||||
FACT_KIND_RECORDING_PROGRESS = 7;
|
||||
}
|
||||
|
||||
message RequestMeta {
|
||||
string protocol_version = 1;
|
||||
string request_id = 2;
|
||||
@@ -180,10 +150,9 @@ message ResourceSample {
|
||||
string missing_reason = 11;
|
||||
}
|
||||
|
||||
// Project-local v0.1 status convention: exactly one kind="sip" entry identifies
|
||||
// the SIP artifact loaded by the Agent/Asterisk; state="applied" means that exact
|
||||
// artifact is active. revision and config_sha256 must match the approved artifact.
|
||||
// Missing, duplicate, or mismatched SIP entries are unknown and fail closed.
|
||||
// Optional status metadata is not an admission grant. The Dispatcher checks
|
||||
// GetLoadedSIP revisions separately; a Mock status cannot prove Asterisk loaded
|
||||
// the approved configuration.
|
||||
message AppliedConfig {
|
||||
string kind = 1;
|
||||
string revision = 2;
|
||||
@@ -215,35 +184,6 @@ message Session {
|
||||
bytes session_credential = 4;
|
||||
}
|
||||
|
||||
message ConfigReference {
|
||||
string kind = 1;
|
||||
string version = 2;
|
||||
string sha256 = 3;
|
||||
string source = 4;
|
||||
}
|
||||
|
||||
message UploadPolicy {
|
||||
bool enabled = 1;
|
||||
int64 max_asset_bytes = 2;
|
||||
repeated string allowed_hosts = 4;
|
||||
reserved 3;
|
||||
reserved "min_retention_ms";
|
||||
}
|
||||
|
||||
message ExecutionBinding {
|
||||
string tenant_id = 1;
|
||||
string tenant_key = 2;
|
||||
string execution_id = 3;
|
||||
string task_id = 4;
|
||||
string task_item_id = 5;
|
||||
int64 task_revision = 6;
|
||||
string call_id = 7;
|
||||
string attempt_id = 8;
|
||||
string agent_version_id = 9;
|
||||
string route_policy_id = 10;
|
||||
string caller_profile_id = 11;
|
||||
}
|
||||
|
||||
message AssetDescriptor {
|
||||
AssetKind kind = 1;
|
||||
string asset_id = 2;
|
||||
@@ -288,73 +228,6 @@ message ActivateAgentResponse {
|
||||
Failure failure = 4;
|
||||
}
|
||||
|
||||
message GetBootstrapRequest {
|
||||
RequestMeta meta = 1;
|
||||
string agent_id = 2;
|
||||
string cell_id = 3;
|
||||
string boot_id = 4;
|
||||
uint64 session_generation = 5;
|
||||
}
|
||||
|
||||
message GetBootstrapResponse {
|
||||
ResponseMeta meta = 1;
|
||||
ActivationState state = 2;
|
||||
repeated ConfigReference runtime_configs = 3;
|
||||
UploadPolicy upload_policy = 4;
|
||||
Failure failure = 5;
|
||||
}
|
||||
|
||||
message SetAdmissionStateRequest {
|
||||
RequestMeta meta = 1;
|
||||
AgentBinding target = 2;
|
||||
AdmissionState state = 3;
|
||||
string barrier_id = 4;
|
||||
uint64 expected_admission_generation = 5;
|
||||
string reason = 6;
|
||||
}
|
||||
|
||||
message SetAdmissionStateResponse {
|
||||
OperationReceipt receipt = 1;
|
||||
uint64 applied_admission_generation = 2;
|
||||
}
|
||||
|
||||
message ExecuteRequest {
|
||||
RequestMeta meta = 1;
|
||||
ExecutionBinding binding = 2;
|
||||
bytes call_execute_json = 3;
|
||||
string config_sha256 = 4;
|
||||
uint64 admission_generation = 5;
|
||||
string resource_reservation_id = 6;
|
||||
string permit_id = 7;
|
||||
}
|
||||
|
||||
message ExecuteResponse {
|
||||
OperationReceipt receipt = 1;
|
||||
ExecutionState state = 2;
|
||||
}
|
||||
|
||||
// Versioned project-local D→Agent execution contract. Only the Dispatcher
|
||||
// evaluates the task/line schedule, allowlist, route and effective duration.
|
||||
// The Agent checks the authorized deadline and transport/session identity; it
|
||||
// never selects another trunk or recalculates outbound business policy.
|
||||
message ExecuteAuthorizedRequest {
|
||||
string schema_version = 1; // agent-authorized-origination.v0.1
|
||||
RequestMeta meta = 2;
|
||||
ExecutionBinding binding = 3;
|
||||
string selected_trunk_id = 4;
|
||||
string caller_id = 5;
|
||||
string callee = 6;
|
||||
int64 ring_timeout_ms = 7;
|
||||
int64 max_call_duration_ms = 8;
|
||||
int64 dial_before_unix_ms = 9; // Exclusive D-issued deadline.
|
||||
string bound_snapshot_sha256 = 10;
|
||||
}
|
||||
|
||||
message ExecuteAuthorizedResponse {
|
||||
OperationReceipt receipt = 1;
|
||||
ExecutionState state = 2;
|
||||
}
|
||||
|
||||
// Exact, immutable task/provider bytes and SIP revision accompany each
|
||||
// authorized execution. Provider bytes may contain credentials: never log
|
||||
// or persist this request body. The Agent checks session, binding and
|
||||
@@ -392,46 +265,6 @@ message GetLoadedSIPResponse {
|
||||
map<string, int64> trunk_revision = 1;
|
||||
}
|
||||
|
||||
message GetExecutionPermitRequest {
|
||||
RequestMeta meta = 1;
|
||||
ExecutionBinding binding = 2;
|
||||
string resource_reservation_id = 3;
|
||||
int64 expected_task_revision = 4;
|
||||
uint64 admission_generation = 5;
|
||||
string config_sha256 = 6;
|
||||
}
|
||||
|
||||
message ExecutionPermit {
|
||||
string permit_id = 1;
|
||||
string resource_reservation_id = 2;
|
||||
int64 issued_at_unix_ms = 3;
|
||||
int64 expires_at_unix_ms = 4;
|
||||
string dispatcher_epoch = 5;
|
||||
uint64 session_generation = 6;
|
||||
string fencing_token = 7;
|
||||
string config_sha256 = 8;
|
||||
}
|
||||
|
||||
message GetExecutionPermitResponse {
|
||||
OperationReceipt receipt = 1;
|
||||
ExecutionPermit permit = 2;
|
||||
}
|
||||
|
||||
message ApplyTaskControlRequest {
|
||||
RequestMeta meta = 1;
|
||||
ExecutionBinding binding = 2;
|
||||
ControlAction action = 3;
|
||||
ActiveCallPolicy active_call_policy = 4;
|
||||
int64 expected_task_revision = 5;
|
||||
string reason = 6;
|
||||
}
|
||||
|
||||
message ApplyTaskControlResponse {
|
||||
OperationReceipt receipt = 1;
|
||||
int64 applied_task_revision = 2;
|
||||
ExecutionState state = 3;
|
||||
}
|
||||
|
||||
// Current task-level control has no external command ID, revision CAS or
|
||||
// execution binding. The authenticated session must match dispatcher_id.
|
||||
message ApplyApprovedTaskControlRequest {
|
||||
@@ -447,55 +280,6 @@ message ApplyApprovedTaskControlResponse {
|
||||
bool accepted = 1;
|
||||
}
|
||||
|
||||
message QueryExecutionRequest {
|
||||
RequestMeta meta = 1;
|
||||
ExecutionBinding binding = 2;
|
||||
}
|
||||
|
||||
message ExecutionSnapshot {
|
||||
ExecutionBinding binding = 1;
|
||||
ExecutionState state = 2;
|
||||
string call_state = 3;
|
||||
string attempt_id = 4;
|
||||
string reason_code = 5;
|
||||
int64 observed_at_unix_ms = 6;
|
||||
bool unknown = 7;
|
||||
repeated AssetDescriptor assets = 8;
|
||||
}
|
||||
|
||||
message QueryExecutionResponse {
|
||||
ResponseMeta meta = 1;
|
||||
ExecutionSnapshot snapshot = 2;
|
||||
Failure failure = 3;
|
||||
}
|
||||
|
||||
message ExecutionFact {
|
||||
string fact_id = 1;
|
||||
string content_sha256 = 2;
|
||||
ExecutionBinding binding = 3;
|
||||
FactKind kind = 4;
|
||||
int64 observed_at_unix_ms = 5;
|
||||
string source_boot_id = 6;
|
||||
uint64 source_sequence = 7;
|
||||
bytes payload_json = 8;
|
||||
}
|
||||
|
||||
message ReportExecutionEventRequest {
|
||||
RequestMeta meta = 1;
|
||||
ExecutionFact fact = 2;
|
||||
}
|
||||
|
||||
message ReportExecutionEventResponse {
|
||||
OperationReceipt receipt = 1;
|
||||
}
|
||||
|
||||
message RequestUploadRequest {
|
||||
RequestMeta meta = 1;
|
||||
ExecutionBinding binding = 2;
|
||||
AssetDescriptor asset = 3;
|
||||
string upload_id = 4;
|
||||
}
|
||||
|
||||
message UploadGrant {
|
||||
string upload_id = 1;
|
||||
string target_url = 2;
|
||||
@@ -507,28 +291,6 @@ message UploadGrant {
|
||||
string bucket = 8;
|
||||
}
|
||||
|
||||
message RequestUploadResponse {
|
||||
OperationReceipt receipt = 1;
|
||||
UploadGrant grant = 2;
|
||||
UploadState state = 3;
|
||||
}
|
||||
|
||||
message CompleteUploadRequest {
|
||||
RequestMeta meta = 1;
|
||||
ExecutionBinding binding = 2;
|
||||
AssetDescriptor asset = 3;
|
||||
string upload_id = 4;
|
||||
int64 uploaded_size_bytes = 5;
|
||||
string uploaded_checksum_sha256 = 6;
|
||||
}
|
||||
|
||||
message CompleteUploadResponse {
|
||||
OperationReceipt receipt = 1;
|
||||
UploadState state = 2;
|
||||
reserved 3;
|
||||
reserved "oss_id";
|
||||
}
|
||||
|
||||
// These facts refer only to the Dispatcher-approved execution identified by
|
||||
// source_event_id; no audio bytes or temporary credential is persisted in MQ.
|
||||
message RequestRecordingUploadRequest {
|
||||
|
||||
+4
-4
@@ -34,13 +34,13 @@
|
||||
},
|
||||
{
|
||||
"path": "proto/agent/agent.proto",
|
||||
"bytes": 14375,
|
||||
"sha256": "f9a721c8d2bc560ed07ec6deedd7ebc080b248069d2e657f7a906405e1cb1e4f"
|
||||
"bytes": 8626,
|
||||
"sha256": "9a76ca785c6466b9d5eb217a9c28cda80bb738f308210df66ad6818c2e74805c"
|
||||
},
|
||||
{
|
||||
"path": "gen/agent/agent.pb.go",
|
||||
"bytes": 183338,
|
||||
"sha256": "a5b86b1f8e9a8866bb99bb67747a82107064985c730aee70c33fa9b6c0e23341"
|
||||
"bytes": 104492,
|
||||
"sha256": "e1deb02528c51837cdc0c66c4344b4e09704e7db096de8b3fe527654f98e4647"
|
||||
},
|
||||
{
|
||||
"path": "gen/agent/agent_grpc.pb.go",
|
||||
|
||||
Reference in New Issue
Block a user