/** * `agentsmarket webhook register --events=` — register a webhook * URL for skill invocation lifecycle events (vertical wedge). * * Flow: * 1. Verify logged in (loadConfig); hint exit if not. * 2. Parse + validate URL (https://, ≤ 2048 chars). * 3. Parse --events (comma-separated). Allowed (mirrors the server's * KNOWN_WEBHOOK_EVENTS): * - invocation.completed * - settling.created * - settling.settled * 4. POST /v1/webhooks with auth headers + body. * Server returns the webhook row + secret (returned ONCE). * 5. Save the webhook (id, url, events, secret) to local config so users * can re-verify deliveries offline. * File: ~/.config/agentsmarket/webhooks.json (mode 0600). * 6. Print success summary with the secret prominently displayed. * * File layout (webhooks.json): * { * "webhooks": [ * { * "id": "hook_...", * "url": "https://example.com/hook", * "events": ["invocation.completed"], * "secret": "64 hex chars", * "registered_at": "2026-09-25T12:00:00.000Z" * } * ] * } * * Notes: * - The server returns the secret only once; subsequent GETs omit it. * - To rotate: register a new webhook + DELETE the old one * (`agentsmarket webhook delete ` — not yet implemented). */ export interface RegisterWebhookOptions { url: string; events: string[]; } export interface WebhookRecord { id: string; url: string; events: string[]; secret: string; registered_at: string; } interface WebhooksFile { webhooks: WebhookRecord[]; } export declare function validateWebhookUrl(raw: string): { valid: boolean; hostname?: string; error?: string; }; export declare const ALLOWED_WEBHOOK_EVENTS: readonly string[]; export declare function parseEvents(raw: string): { valid: boolean; events: string[]; error?: string; }; export declare function getWebhooksPath(): string; export declare function loadWebhooksFile(): WebhooksFile; export declare function saveWebhooksFile(file: WebhooksFile): void; export declare function appendLocalWebhook(record: WebhookRecord): void; export declare function registerWebhookCommand(opts: RegisterWebhookOptions): Promise; export {};