id: daily_collect_approval
namespace: studio.nas_kb_memory_governance

description: |
  Daily collection from active Hermes profiles, meow-chan curation, approval-package preview, HTML detail publishing, and Feishu three-person approval creation. This stage must not write NAS.

triggers:
  - id: daily_0800
    type: io.kestra.plugin.core.trigger.Schedule
    cron: "0 8 * * *"
    timezone: Asia/Shanghai

tasks:
  - id: preflight
    type: io.kestra.plugin.core.http.Request
    uri: http://host.docker.internal:19092/v1/nas-kb/run
    method: POST
    timeout: PT60S
    headers:
      Authorization: "Bearer {{ secret('KESTRA_AGENT_BRIDGE_TOKEN') }}"
      Content-Type: application/json
    body: |
      {
        "request_id": "{{ execution.id }}-preflight",
        "task_key": "preflight"
      }

  - id: collect_and_create_approval
    type: io.kestra.plugin.core.http.Request
    uri: http://host.docker.internal:19092/v1/nas-kb/run
    method: POST
    timeout: PT1800S
    headers:
      Authorization: "Bearer {{ secret('KESTRA_AGENT_BRIDGE_TOKEN') }}"
      Content-Type: application/json
    body: |
      {
        "request_id": "{{ execution.id }}-daily",
        "task_key": "daily_collect_and_create_approval",
        "dry_run": false
      }
