{
  "name": "scorpiox-crontab",
  "version": "1.5.0",
  "description": "Pure C crontab engine — 5-field cron parser, natural-language describer, next-run calculator, and background multi-job scheduler with process execution, stdout/stderr capture, JSON persistence, per-job run timeout and cancel, per-job working folder + environment overrides, and per-job retry on failure (N extra attempts with a fixed backoff). Powers the Personal Cron Server WinUI3 app. Exit-code contract: -2 = stopped by the job's timeout, -3 = stopped by Cancel.",
  "exports": [
    {
      "name": "crontab_version",
      "return": "const char*",
      "csharp_return": "IntPtr",
      "args": []
    },
    {
      "name": "crontab_validate_expr",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "expr",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "err_buf",
          "type": "char*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "err_buf_len",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_describe_expr",
      "return": "const char*",
      "csharp_return": "IntPtr",
      "args": [
        {
          "name": "expr",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        }
      ]
    },
    {
      "name": "crontab_calc_next",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "expr",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "from_time",
          "type": "int64_t",
          "csharp_type": "long"
        },
        {
          "name": "next_time",
          "type": "int64_t*",
          "csharp_type": "out long"
        }
      ]
    },
    {
      "name": "crontab_get_next_runs_json",
      "return": "const char*",
      "csharp_return": "IntPtr",
      "args": [
        {
          "name": "expr",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "count",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_create",
      "return": "void*",
      "csharp_return": "IntPtr",
      "args": [
        {
          "name": "storage_dir",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        }
      ]
    },
    {
      "name": "crontab_destroy",
      "return": "void",
      "csharp_return": "void",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        }
      ]
    },
    {
      "name": "crontab_start",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        }
      ]
    },
    {
      "name": "crontab_stop",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        }
      ]
    },
    {
      "name": "crontab_is_running",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        }
      ]
    },
    {
      "name": "crontab_add_job",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "name",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "expr",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "cmd",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "enabled",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_update_job",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "job_id",
          "type": "int",
          "csharp_type": "int"
        },
        {
          "name": "name",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "expr",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "cmd",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "enabled",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_delete_job",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "job_id",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_run_now",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "job_id",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_get_jobs_json",
      "return": "const char*",
      "csharp_return": "IntPtr",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        }
      ]
    },
    {
      "name": "crontab_get_job_logs_json",
      "return": "const char*",
      "csharp_return": "IntPtr",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "job_id",
          "type": "int",
          "csharp_type": "int"
        },
        {
          "name": "limit",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_cancel_job",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "job_id",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_set_job_timeout",
      "return": "int",
      "csharp_return": "int",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "job_id",
          "type": "int",
          "csharp_type": "int"
        },
        {
          "name": "max_runtime_sec",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_set_job_paths",
      "return": "int",
      "csharp_return": "int",
      "added": "1.3.0",
      "notes": "C9. workdir '' = inherit (lpCurrentDirectory NULL). env = newline-separated KEY=VALUE layered on the parent environment. 0 ok, -1 unknown id, -2 workdir not an existing directory or an env line with no '='.",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "job_id",
          "type": "int",
          "csharp_type": "int"
        },
        {
          "name": "workdir",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        },
        {
          "name": "env",
          "type": "const char*",
          "csharp_type": "string",
          "marshal": "UnmanagedType.LPUTF8Str"
        }
      ]
    },
    {
      "name": "crontab_set_job_overlap_policy",
      "return": "int",
      "csharp_return": "int",
      "added": "1.4.0",
      "notes": "C19. policy 0=skip (default, byte-for-byte the 1.3.0 behaviour), 1=queue (exactly ONE due occurrence is held and runs the instant the in-flight run releases), 2=parallel (a second concurrent run of the same job, bounded by CRON_MAX_CONCURRENT). 0 accepted, -1 unknown job id, -2 policy out of range. Setting skip clears any held occurrence.",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "job_id",
          "type": "int",
          "csharp_type": "int"
        },
        {
          "name": "policy",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    },
    {
      "name": "crontab_set_job_retry",
      "return": "int",
      "csharp_return": "int",
      "added": "1.5.0",
      "notes": "C21. max_attempts 0..10 EXTRA attempts after the first (0 = never retry, the default and byte-for-byte the 1.4.0 behaviour), backoff_sec 0..3600 seconds between attempts (0 = immediately). 0 accepted, -1 unknown job id, -2 out of range. A run retries when it exits non-zero EXCEPT -3 (Cancel); -2 (timeout) and -1 (spawn failure) do retry. Every attempt is its own log row carrying a 1-based \"attempt\"; crontab_get_jobs_json carries retry_max / retry_backoff_sec.",
      "args": [
        {
          "name": "handle",
          "type": "void*",
          "csharp_type": "IntPtr"
        },
        {
          "name": "job_id",
          "type": "int",
          "csharp_type": "int"
        },
        {
          "name": "max_attempts",
          "type": "int",
          "csharp_type": "int"
        },
        {
          "name": "backoff_sec",
          "type": "int",
          "csharp_type": "int"
        }
      ]
    }
  ]
}