// AUTO-GENERATED by scripts/gen-hook-config.ts — DO NOT EDIT.
// Run `npm run codegen` (or `npx tsx packages/myco/scripts/gen-hook-config.ts`) to regenerate.
//
// This file bakes the hook-relevant subset of every symbiont manifest into
// a typed const so hooks don't pay for YAML I/O + Zod parsing on every
// short-lived hook process. Keep it checked into git so tests don't need
// a build step.

import type {
  CapturePrompts,
  CaptureRule,
  SymbiontRegistration,
} from '../symbionts/manifest-schema.js';

export interface HookConfigEntry {
  hookResponse?: NonNullable<SymbiontRegistration['hookResponse']>;
  capturePrompts?: CapturePrompts;
  captureRules?: CaptureRule[];
}

export const HOOK_CONFIG: Readonly<Record<string, HookConfigEntry>> = {
  "antigravity": {
    "hookResponse": {
      "format": "antigravity-inject-steps"
    }
  },
  "claude-code": {
    "capturePrompts": {
      "shapes": [
        {
          "name": "teammate_message",
          "match": {
            "type": "user",
            "fieldNotEquals": {
              "isMeta": true
            }
          },
          "textAt": "message.content",
          "textStartsWith": "<teammate-message",
          "dedupeBy": "uuid"
        },
        {
          "name": "user_prompt",
          "match": {
            "type": "user",
            "hasField": "promptId",
            "fieldNotEquals": {
              "isMeta": true
            }
          },
          "textAt": "message.content",
          "dedupeBy": "promptId"
        },
        {
          "name": "queued_command",
          "match": {
            "type": "attachment",
            "fieldEquals": {
              "attachment.type": "queued_command"
            }
          },
          "textAt": "attachment.prompt",
          "dedupeBy": "uuid"
        }
      ],
      "resetBoundaries": [
        {
          "match": {
            "type": "assistant",
            "fieldEquals": {
              "message.stop_reason": "end_turn"
            }
          }
        }
      ],
      "interruptMarker": "[Request interrupted by user for tool use]"
    },
    "captureRules": [
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<command-message>"
        },
        "action": "drop",
        "reason": "claude-code-slash-command-dispatch",
        "trim": true
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<command-name>"
        },
        "action": "drop",
        "reason": "claude-code-builtin-command-dispatch",
        "trim": true
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<local-command-stdout>"
        },
        "action": "drop",
        "reason": "claude-code-builtin-command-stdout",
        "trim": true
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<task-notification>"
        },
        "action": "classify",
        "reason": "claude-code-task-notification",
        "trim": true,
        "set_origin": "system"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<skill>"
        },
        "action": "classify",
        "reason": "claude-code-skill-envelope",
        "trim": true,
        "set_origin": "system"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<teammate-message "
        },
        "action": "classify",
        "reason": "claude-code-teammate-message",
        "trim": true,
        "set_origin": "agent_dispatch"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<environment_context>"
        },
        "action": "classify",
        "reason": "claude-code-environment-context",
        "trim": true,
        "set_origin": "system"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<<autonomous-loop"
        },
        "action": "classify",
        "reason": "claude-code-autonomous-loop",
        "trim": true,
        "set_origin": "system"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<local-command-caveat>"
        },
        "action": "classify",
        "reason": "claude-code-local-command-caveat",
        "trim": true,
        "set_origin": "system"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<persisted-output>"
        },
        "action": "classify",
        "reason": "claude-code-persisted-output",
        "trim": true,
        "set_origin": "system"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<system-reminder>"
        },
        "action": "classify",
        "reason": "claude-code-system-reminder",
        "trim": true,
        "set_origin": "system"
      }
    ]
  },
  "codex": {
    "capturePrompts": {
      "shapes": [
        {
          "name": "user_message",
          "match": {
            "type": "response_item",
            "fieldEquals": {
              "payload.type": "message",
              "payload.role": "user"
            }
          },
          "textAt": "payload.content[0].text"
        }
      ],
      "resetBoundaries": [
        {
          "match": {
            "type": "turn_context"
          },
          "changeOn": "payload.turn_id"
        }
      ],
      "interruptMarker": "<turn_aborted>"
    },
    "captureRules": [
      {
        "event": "session_start",
        "scope": "any_agent",
        "when": {
          "transcript_path_missing": true
        },
        "action": "drop",
        "reason": "ephemeral-sub-invocation",
        "trim": true
      },
      {
        "event": "user_prompt",
        "scope": "any_agent",
        "when": {
          "transcript_path_missing": true
        },
        "action": "drop",
        "reason": "ephemeral-sub-invocation",
        "trim": true
      },
      {
        "event": "session_start",
        "scope": "this_agent",
        "when": {
          "transcript_meta_field_exists": "source.subagent"
        },
        "action": "drop",
        "reason": "subagent-thread-spawn",
        "trim": true
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "transcript_meta_field_exists": "source.subagent"
        },
        "action": "drop",
        "reason": "subagent-thread-spawn",
        "trim": true
      },
      {
        "event": "session_start",
        "scope": "this_agent",
        "when": {
          "transcript_meta_field_equals": {
            "path": "source",
            "value": "exec"
          }
        },
        "action": "drop",
        "reason": "noninteractive-exec",
        "trim": true
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "transcript_meta_field_equals": {
            "path": "source",
            "value": "exec"
          }
        },
        "action": "drop",
        "reason": "noninteractive-exec",
        "trim": true
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "# AGENTS.md instructions"
        },
        "action": "drop",
        "reason": "agents-md-context-injection",
        "trim": true
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<subagent_notification>"
        },
        "action": "classify",
        "reason": "codex-subagent-notification",
        "trim": true,
        "set_origin": "agent_dispatch"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<environment_context>"
        },
        "action": "classify",
        "reason": "codex-environment-context",
        "trim": true,
        "set_origin": "system"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<skill>"
        },
        "action": "classify",
        "reason": "codex-skill-envelope",
        "trim": true,
        "set_origin": "system"
      },
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_contains": "## My request for Codex:"
        },
        "action": "rewrite_prompt",
        "reason": "codex-desktop-file-preamble",
        "extract_after": "## My request for Codex:\n",
        "trim": true
      }
    ]
  },
  "copilot": {},
  "cursor": {
    "hookResponse": {
      "format": "json",
      "fieldNames": {
        "additionalContext": "additional_context",
        "continue": "continue",
        "stopReason": "stop_reason",
        "userMessage": "user_message",
        "followupMessage": "followup_message",
        "systemMessage": "system_message"
      }
    },
    "captureRules": [
      {
        "event": "user_prompt",
        "scope": "this_agent",
        "when": {
          "prompt_starts_with": "<user_query>"
        },
        "action": "rewrite_prompt",
        "reason": "strip Cursor user_query envelope",
        "strip_envelope": {
          "open": "<user_query>",
          "close": "</user_query>"
        },
        "trim": true
      }
    ]
  },
  "opencode": {},
  "pi": {},
  "windsurf": {}
} as const;
