{
  "repo": "tidbcloud/escalation-base",
  "binary": "feishu-messager-server",
  "binary_path": "feishu_messager_v2/cmd/feishu-messager-server/main.go",
  "surface_kind": "mixed_service",
  "type": "mixed_service",
  "extensions": {
    "notes": [
      "Fresh codex rescan rebuilt feishu-messager around the current v2 module instead of the legacy v1 Gin wrapper. Runtime surface is one Cobra binary that starts a service manager, an API server, and a background message-backcall poller.",
      "Conditions matter here: urgent vs normal requests branch into different call chains, raw_mode and receiver type decide webhook vs chat APIs, overseas numbers only call Twilio when enabled, and callback delivery only fires after Lark read receipts are observed."
    ]
  },
  "services": [
    {
      "name": "FeishuMessagerLifecycle",
      "package": "feishu_messager_v2/cmd/feishu-messager-server/main.go",
      "methods": [
        {
          "name": "LoadConfig",
          "name_key": "FeishuMessagerLifecycle.LoadConfig",
          "input": "--config path",
          "output": "root config loaded and validated",
          "type": "local"
        },
        {
          "name": "SetupDeps",
          "name_key": "FeishuMessagerLifecycle.SetupDeps",
          "input": "RootConfig",
          "output": "logger, DB provider, client sets, service manager, and API server initialized",
          "type": "local"
        },
        {
          "name": "RunBackgroundServices",
          "name_key": "FeishuMessagerLifecycle.RunBackgroundServices",
          "input": "service.Manager",
          "output": "runnable background services started",
          "type": "local"
        },
        {
          "name": "RunAPIServer",
          "name_key": "FeishuMessagerLifecycle.RunAPIServer",
          "input": "controller.APIServer",
          "output": "HTTP API listener started",
          "type": "local"
        },
        {
          "name": "ShutdownAPIServer",
          "name_key": "FeishuMessagerLifecycle.ShutdownAPIServer",
          "input": "shutdown context",
          "output": "API server shut down",
          "type": "local"
        },
        {
          "name": "ShutdownServices",
          "name_key": "FeishuMessagerLifecycle.ShutdownServices",
          "input": "service.Manager",
          "output": "background services stopped",
          "type": "local"
        }
      ]
    },
    {
      "name": "FeishuMessagerHTTP",
      "package": "feishu_messager_v2/pkg/controller",
      "methods": [
        {
          "name": "MessageForward",
          "name_key": "FeishuMessagerHTTP.MessageForward",
          "input": "SendMessageReq JSON body",
          "output": "SendMessageResp or API error",
          "type": "http",
          "http_method": "POST",
          "http_path": "/messageForward"
        }
      ]
    },
    {
      "name": "FeishuMessageService",
      "package": "feishu_messager_v2/pkg/service/message",
      "methods": [
        {
          "name": "SendMessageCard",
          "name_key": "FeishuMessageService.SendMessageCard",
          "input": "entity.Message",
          "output": "message ID if a chat API call was used",
          "type": "local"
        },
        {
          "name": "SendUrgentMessageCard",
          "name_key": "FeishuMessageService.SendUrgentMessageCard",
          "input": "entity.Message with raw_mode=true",
          "output": "message ID after urgent escalation side effects",
          "type": "local"
        }
      ]
    },
    {
      "name": "FeishuMessageBackCallService",
      "package": "feishu_messager_v2/pkg/service/message_backcall",
      "methods": [
        {
          "name": "Run",
          "name_key": "FeishuMessageBackCallService.Run",
          "input": "context",
          "output": "background read-receipt poller running",
          "type": "local"
        },
        {
          "name": "AddWatchMessage",
          "name_key": "FeishuMessageBackCallService.AddWatchMessage",
          "input": "clientKey, messageId",
          "output": "message tracked for read callback",
          "type": "local"
        },
        {
          "name": "PollMessages",
          "name_key": "FeishuMessageBackCallService.PollMessages",
          "input": "tracked unread messages",
          "output": "messages marked read when users have opened them",
          "type": "local"
        },
        {
          "name": "CallbackReadMessages",
          "name_key": "FeishuMessageBackCallService.CallbackReadMessages",
          "input": "messages marked read",
          "output": "callback endpoint notified for read messages",
          "type": "local"
        },
        {
          "name": "GarbageCollect",
          "name_key": "FeishuMessageBackCallService.GarbageCollect",
          "input": "messages marked notified",
          "output": "completed watch entries removed",
          "type": "local"
        }
      ]
    },
    {
      "name": "FeishuNotifyService",
      "package": "feishu_messager_v2/pkg/service/notify",
      "methods": [
        {
          "name": "Notify",
          "name_key": "FeishuNotifyService.Notify",
          "input": "error message text",
          "output": "best-effort Lark notification",
          "type": "local"
        }
      ]
    }
  ]
}
