{"openapi":"3.1.0","info":{"title":"Commercial Sales Assistant API","version":"1.0.0","description":"Unified public schema for assistant-driven commercial follow-up across B2C Admissions Concierge and B2B For Schools workflows. The schema is public; lead queues and workflow writes require Authorization Bearer credentials."},"servers":[{"url":"https://daigakujoho.com"}],"tags":[{"name":"B2C Admissions Concierge","description":"Student and parent paid consultation leads, reply drafts, payment request, and report delivery."},{"name":"B2B For Schools","description":"School-side inbound partnership leads, outbound prospecting, reply conversion, scope confirmation, payment request, payment evidence watch, and repair delivery."},{"name":"Acquisition Buyer","description":"Asset buyer inquiries from the public acquisition data room, proof-pack menu, and valuation-readiness flow."}],"x-canonical-schemas":["/api/admissions-concierge/operator-openapi","/api/for-schools/operator-openapi"],"x-assistant-playbook":["Call this schema first, then use the canonical route-specific OpenAPI files when a deeper field contract is needed.","Use Authorization Bearer credentials only on protected lead, action, outreach, and conversion endpoints.","For B2C Admissions Concierge, fetch /api/admissions-concierge/operator-leads, use tonightDecisionPack, parentPurchaseApprovalPack, and paymentRequestPack to prepare the reply, then record the sent action with /api/admissions-concierge/operator-actions. After report_delivered, use post_report_growth once to collect proof, offer one second-school mini-plan, and ask for one referral; then record post_report_follow_up_sent.","For B2C Admissions Concierge, present the 48-hour safe purchase rule as risk reversal only: stop before payment if scope is not a fit, give one free correction reply when a promised report section is missing, and never convert this into an admission guarantee.","For B2B For Schools inbound leads, fetch /api/for-schools/operator-leads, open with surfaceDiagnosisPack, ask for one official URL, then follow send_school_reply -> request_official_url -> prepare_scope_confirmation -> scope_confirmed -> send_payment_request -> watch_payment -> deliver_school_repair.","For B2B For Schools, present repairGuaranteePromise as the 48-hour repair guarantee for procurement risk reversal only: stop before payment if scope is not a fit, give one free correction reply when a promised repair deliverable is missing, and never sell ranking, inquiry-volume, or admission guarantees.","For B2B outbound, fetch /api/for-schools/operator-prospects, handle find_contact_route first when contactEmail is missing, record contact_route_found with official contact evidence, record outreach_sent only after first email is sent, then convert school_replied prospects through /api/for-schools/operator-prospect-leads.","Use GET /api/commercial/operator-readiness before assuming email, payment, inbound, or persistence automation is configured. It never returns secret values; it reports env names, presence, manual invoice fallback readiness, and copy-ready manualClosePackets for operator-reviewed closes when providers are missing or failing.","Use POST /api/commercial/operator-send-buyer-reply only after replyReadiness.sendAllowed is true. It sends the queue item buyerReplyDraft by itemId, or the exact submitted-lead postSubmitAssistantClosePacket when bodySource=postSubmitAssistantClosePacket, never an arbitrary recipient. Use bodySource=postSubmitAssistantClosePacket for submitted B2C/B2B close packets so assistants do not repeat intake questions. Payment buyerReplyDraft bodyOverride must include purchasePolicyUrl; otherwise the send endpoint blocks with payment_policy_missing_from_body_override. Exact paid fulfillmentPacket.copyText bodyOverride is exempt from the purchasePolicyUrl guard. For paid delivery, the cockpit may use subjectOverride and bodyOverride=fulfillmentPacket.copyText, then record report_delivered or repair_delivered only after emailSent=true.","Use postSubmitAssistantClosePacket before generic assistantPacket for submitted B2C/B2B leads. It is the exact post-submit close instruction and prevents assistants from asking the same SKU, school-list, or school package question again.","Use POST /api/commercial/operator-autopilot for assistant autopilot. Defaults to dryRun=true, runs exactly one highest-priority send_then_record queue item, prefers postSubmitAssistantClosePacket for submitted B2C/B2B close packets when assistantSendMode and recordAfterSend match the selected action, and with dryRun=false sends buyerReplyDraft or the selected postSubmitAssistantClosePacket then records recommendedActionPayload only after emailSent=true. Optional recordDryRunEvent can persist a handoff execution event for scheduled dry-runs. When no safe candidate exists, scheduled dry-runs can persist an idle heartbeat event without sending email or recording CRM action.","GET /api/commercial/operator-autopilot-cron is the 3060 local cron entrypoint. It is protected by CRON_SECRET and defaults to dry-run unless COMMERCIAL_OPERATOR_AUTOPILOT_MODE=send is set server-side. Cron dry-runs persist a handoff execution event when a candidate is selected or an idle heartbeat when no candidate is safe.","Use POST /api/commercial/operator-send-follow-up only after followUpDraft.sendAllowed is true. It sends the queue item followUpDraft by itemId, never an arbitrary recipient, and does not automatically record recommendedActionPayload. In watch_payment it can send one payment-help follow-up, but it does not record payment_confirmed; a successful follow-up execution event disables repeat follow-up sends for that queue item.","Use POST /api/commercial/operator-reply-intake when a buyer or school replies by email. It classifies reply intent and returns a safe triage object plus replyDraft for operator-reviewed customer replies; do not record payment_confirmed from buyer email alone. Refund or cancellation questions become refund_cancellation_question and purchase_policy_answer only; do not record refund, cancel, delivery, or payment status from that reply alone. Missing promised deliverable or free correction requests become deliverable_correction_request with correction_request_answer and free_correction_request_does_not_record_workflow_action.","Reply-intake objection intents include price_objection, guarantee_objection, manual_invoice_question, procurement_roi_objection, and competitor_alternative_question. Objection replies are safe reply drafts only; review and send replyDraft, but do not record workflow progress from an objection alone. Competitor or alternative-tool questions are customer replies only: competitor_alternative_question returns competitor_alternative_answer and should explain that Manavision, PassNavi, and StudySapuri are discovery portals while daigakujoho sells post-portal decision output and official answer repair. Asset buyer proof pack requests are customer replies only: asset_proof_pack_request returns asset_proof_pack_answer for traffic proof pack, revenue proof pack, automation proof pack, or risk cleanup proof pack and includes selected proof pack artifacts such as traffic proof artifact, revenue proof artifact, automation proof artifact, and risk cleanup artifact; it is not a valuation number and not a valuation guarantee, and asset_proof_pack_reply_does_not_record_workflow_action. NDA/private data-room requests are human-reviewed handoffs only: acquisition_private_data_room_request returns acquisition_private_data_room_handoff, does not release private data-room URLs or non-public artifacts, and private_data_room_reply_does_not_release_private_data. Acquisition or valuation questions are customer replies only: acquisition_inquiry returns acquisition_next_step_answer with the public data room, proof-to-valuation underwriting checklist, and buyer qualification request; it does not quote an asking price, valuation number, multiple, or revenue guarantee, and acquisition_inquiry_reply_does_not_record_workflow_action. Proof or sample requests are customer replies only: proof_sample_request returns proof_sample_answer with the public deliverable sample and inbox proof links, but does not record workflow progress from that reply alone. Sample/proof accepted and payment requested becomes post_sample_payment_request with payment_request_ready_answer; record payment_requested only after the buyer-facing payment request was sent and never record payment_confirmed from the reply alone.","Acquisition buyer inquiries enter the unified operator queue through POST /api/commercial/acquisition-inquiry. They become acquisition_buyer asset_buyer_inquiry work items with acquisition_next_step_answer, the public data room, the proof-to-valuation checklist, and buyer qualification fields; successful acquisition_qualification_sent execution event blocks repeat sending through actionTimeline. Do not invent a valuation number, asking price, multiple, or revenue guarantee.","Acquisition buyer work items include acquisitionClosingPacket with schema commercial.acquisition_closing_packet.v1. Use Acquisition Closing Packet to choose selectedProofPack, ndaGate, assistantSendMode=send_selected_public_proof_pack_before_private_data, humanReviewRequired, and privateDataRoomBoundary. private_data_room_requires_human_review means assistants must send only selected public proof first and queue human review before private data-room URLs, non-public artifacts, asking price, multiple, or private metrics.","Use POST /api/commercial/operator-reply-intake-record only when the server should analyze the inbound reply and record one safe action from its own generated plan. It does not accept arbitrary record endpoints or recordBody.","Use POST /api/commercial/operator-payment-evidence-record only after external payment provider evidence exists. It records payment_confirmed for Admissions Concierge or For Schools itemIds such as admissions_concierge:{leadId} and for_schools:{leadId}; it does not accept arbitrary record endpoints or recordBody. After success, read postPaymentFulfillment, then send fulfillmentPacket.copyText through /api/commercial/operator-send-buyer-reply with subjectOverride from fulfillmentPacket.title and recordActionAfterDelivery only after emailSent=true.","Use POST /api/commercial/operator-payment-evidence-import for payment provider webhook or import automation. Send x-commercial-payment-evidence-secret; do not give payment providers the operator cockpit token.","Use /api/commercial/operator-inbound-replies as the provider-agnostic inbox before reply intake. It stores sanitized text, not raw HTML, and can match replies by itemId or contactEmail.","Use POST /api/commercial/operator-inbound-autopilot to run exactly one matched inbound reply through reply-intake and dry-run the generated replyDraft first. Read assistantHandoff (commercial.operator_inbound_autopilot_assistant_handoff.v1) before enabling dryRun=false: it gives sendEndpoint, sendRequestBody, reviewBeforeSendSource, recordActionAfterSend, completionCondition, acquisitionClosingPacketSource, acquisitionClosingPacketSnapshot, and safetyChecklist. For post_sample_payment_request with a queue payment action, replySendMode=queue_buyer_reply_draft uses the queue-owned paymentRequestPack buyerReplyDraft instead of the generic reply-intake draft, then can record the queue-owned payment request action after emailSent=true. asset_proof_pack_request, acquisition_private_data_room_request, and acquisition_inquiry stay reply_intake_draft only and never record valuation, deal state, or workflow action from inbound handling; when queue.acquisitionClosingPacket exists, acquisitionClosingPacketSnapshot tells assistants to send_selected_public_proof_pack_before_private_data and private_data_room_requires_human_review. It does not accept recordEndpoint or recordBody from request.","GET /api/commercial/operator-inbound-autopilot-cron is the 3060 local cron entrypoint for matched inbound replies. It is protected by CRON_SECRET and defaults to dry-run unless COMMERCIAL_OPERATOR_INBOUND_AUTOPILOT_MODE=send is set server-side. Cron dry-runs persist a handoff execution event when a matched reply is selected.","Use POST /api/commercial/operator-inbound-email for real mailbox or forwarder automation. Forwarders should use a dedicated inbound email secret, not the operator token.","Use payment_confirmed only after external payment evidence exists; do not mark report_delivered, repair_delivered, or scope_confirmed until the promised output, school repair kit, or scope confirmation actually happened. Do not turn post_report_growth or post_delivery_growth into subscription drip pressure.","Post an execution event after every recommendedActionPayload attempt through /api/commercial/operator-execution-events, including success, failure, and human handoff.","Use highIntentSignals as demand evidence, not as permission to email an anonymous visitor.","Do not promise admission results.","Do not promise placement, ranking, or admission outcomes.","Do not invent official facts, fees, deadlines, Open Campus dates, or admission requirements.","Ask for one official URL before drafting claims for a school."],"paths":{"/api/commercial/operator-openapi":{"get":{"summary":"Get the unified commercial sales assistant OpenAPI schema","description":"Public static OpenAPI 3.1 schema that points assistants to the B2C and B2B commercial sales workflows.","responses":{"200":{"description":"Unified commercial operator schema","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialSalesAssistantOpenApi"}}}}}}},"/api/commercial/acquisition-inquiry":{"post":{"tags":["Acquisition Buyer"],"summary":"Submit an acquisition buyer inquiry","description":"Public no-store endpoint behind the Acquisition Inquiry Form on /services. It accepts buyer identity, target asset, proof pack priority, timeline, and NDA/data-room next step, then creates a CommercialAcquisitionInquiryLead for the unified operator queue. It is not a valuation request endpoint and does not return a valuation number.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","buyerType","targetAsset","proofPackPriority","timeline","ndaPreference","message","consent"],"properties":{"email":{"type":"string","format":"email"},"buyerName":{"type":"string"},"buyerType":{"type":"string"},"targetAsset":{"type":"string"},"proofPackPriority":{"type":"string"},"timeline":{"type":"string"},"ndaPreference":{"type":"string"},"message":{"type":"string","minLength":20},"sourcePath":{"type":"string"},"consent":{"type":"boolean","const":true}}}}}},"responses":{"200":{"description":"Acquisition inquiry accepted and queued","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"accepted":{"type":"boolean"},"leadId":{"type":"string"},"acquisitionInquiryPack":{"type":"object"},"buyerReplyPack":{"type":"object"},"fallbackMailto":{"type":"string"}}}}}},"400":{"description":"Valid email, consent, and acquisition context are required"}}}},"/api/commercial/operator-queue":{"get":{"summary":"Get the unified commercial operator next-best-action queue","description":"Protected private, no-store queue that merges B2C Admissions Concierge leads, B2B For Schools leads, B2B outbound school prospects, and acquisition buyer inquiries into a single assistant-ready action list. Use Authorization Bearer credentials.","security":[{"BearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}}],"responses":{"200":{"description":"Commercial Operator Queue","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialOperatorQueue"}}}},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token is not configured"}}}},"/api/commercial/operator-autopilot":{"post":{"summary":"Run one safe Commercial Operator autopilot step","description":"Protected private, no-store assistant autopilot runner. Runs exactly one highest-priority send_then_record commercial work item from /api/commercial/operator-queue. Defaults to dryRun=true. Optional recordDryRunEvent can persist a handoff execution event for scheduled dry-runs. When no safe candidate exists, scheduled dry-runs can persist an idle heartbeat event without sending email or recording CRM action. Does not accept arbitrary recipient email or arbitrary record endpoint; it uses the selected queue item buyerReplyDraft or selected postSubmitAssistantClosePacket and recommendedActionPayload only, and prefers postSubmitAssistantClosePacket for submitted B2C/B2B close packets when assistantSendMode and recordAfterSend match the selected action.","security":[{"BearerAuth":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialOperatorAutopilotRequest"}}}},"responses":{"200":{"description":"Commercial Operator Autopilot run result","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialOperatorAutopilotRunResult"}}}},"400":{"description":"Invalid autopilot request"},"401":{"description":"Missing or invalid Authorization Bearer token"},"409":{"description":"No send_then_record candidate is currently safe to run"},"503":{"description":"Operator token is not configured"}}}},"/api/commercial/operator-autopilot-cron":{"get":{"summary":"Run Commercial Operator autopilot from 3060 local cron","description":"Runs the commercial autopilot from the 3060 local cron. Protected by CRON_SECRET. Defaults to dry-run unless COMMERCIAL_OPERATOR_AUTOPILOT_MODE=send is configured server-side. Cron dry-runs persist a handoff execution event when a candidate is selected or an idle heartbeat when no candidate is safe. The route does not accept query-string overrides for send mode, recipient, or record endpoint.","security":[{"CronSecret":[]}],"responses":{"200":{"description":"Commercial Operator Autopilot Cron result","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialOperatorAutopilotCronResult"}}}},"401":{"description":"Missing or invalid CRON_SECRET authorization header"},"503":{"description":"CRON_SECRET or operator token is not configured"}}}},"/api/commercial/operator-readiness":{"get":{"summary":"Get safe Commercial Operator Readiness configuration status","description":"Protected private, no-store readiness endpoint for assistant and operator setup checks. Use before assuming email, payment, inbound, or persistence automation is configured. It never returns secret values; it returns env names, presence-derived status, SKU-level readiness coverageItems, table-level Supabase persistence readiness, and whether a manual invoice fallback remains necessary.","security":[{"BearerAuth":[]}],"responses":{"200":{"description":"Commercial Operator Readiness","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialOperatorReadinessResult"}}}},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token is not configured"}}}},"/api/commercial/operator-execution-events":{"get":{"summary":"List recent Commercial Operator Execution Events","description":"Protected private, no-store execution event stream. Execution events preserve success, failure, and human handoff results after assistant or cockpit attempts so browser changes do not erase the operational trail.","security":[{"BearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}}],"responses":{"200":{"description":"Commercial Operator Execution Events","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialOperatorExecutionEvents"}}}},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token or persistence service is not configured"}}},"post":{"summary":"Record a Commercial Operator Execution Event","description":"Post an execution event after every recommendedActionPayload attempt. Use status success when the workflow write succeeded, failed when the write or external send failed, and handoff when the item is queued for human review.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialOperatorExecutionEventRequest"}}}},"responses":{"200":{"description":"Commercial Operator Execution Event recorded","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"configured":{"type":"boolean"},"inserted":{"type":"boolean"},"event":{"$ref":"#/components/schemas/CommercialOperatorExecutionEvent"},"reason":{"type":"string"}}}}}},"400":{"description":"Invalid operator execution event payload"},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/commercial/operator-inbound-replies":{"get":{"summary":"Record or list inbound commercial email replies","description":"Protected private, no-store provider-agnostic inbox for commercial email replies. Does not store raw HTML. Use itemId when available; otherwise the server tries contactEmail matching. Use matched replies with /api/commercial/operator-reply-intake-record.","security":[{"BearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}}],"responses":{"200":{"description":"Commercial inbound replies","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialInboundRepliesResult"}}}},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token or persistence service is not configured"}}},"post":{"summary":"Record or list inbound commercial email replies","description":"Protected private, no-store provider-agnostic inbox for buyer or school email replies. Does not store raw HTML. Use itemId when available; otherwise the server tries contactEmail matching. Manual cockpit import can POST provider manual-cockpit.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialInboundReplyRequest"}}}},"responses":{"200":{"description":"Inbound commercial email reply recorded","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialInboundReplyResult"}}}},"400":{"description":"Invalid inbound reply payload"},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/commercial/operator-inbound-autopilot":{"post":{"summary":"Run one matched inbound reply through reply-intake autopilot","description":"Protected private, no-store assistant runner for inbound email replies. Runs exactly one matched inbound reply through reply-intake, skips matched inbound replies whose replyDraft is not sendRecommended, then uses /api/commercial/operator-send-buyer-reply. Defaults to dryRun=true and returns assistantHandoff so OpenClaw/Hermes can see sendEndpoint, sendRequestBody, reviewBeforeSendSource, recordActionAfterSend, completionCondition, acquisitionClosingPacketSource, and acquisitionClosingPacketSnapshot before using dryRun=false. post_sample_payment_request can use the queue-owned paymentRequestPack buyerReplyDraft with replySendMode=queue_buyer_reply_draft when the queue recommendedActionPayload is payment_requested or payment_request_sent, and can record the queue-owned payment request action after emailSent=true. asset_proof_pack_request, acquisition_private_data_room_request, and acquisition_inquiry stay reply_intake_draft only and never record valuation, deal state, or workflow action from inbound handling; when queue.acquisitionClosingPacket exists, acquisitionClosingPacketSnapshot tells assistants to send_selected_public_proof_pack_before_private_data and private_data_room_requires_human_review. Does not accept arbitrary recipient email, recordEndpoint, or recordBody from request.","security":[{"BearerAuth":[]}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialInboundAutopilotRequest"}}}},"responses":{"200":{"description":"Matched inbound reply analyzed and replyDraft prepared or sent","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialInboundAutopilotRunResult"}}}},"400":{"description":"Invalid inbound autopilot request"},"401":{"description":"Missing or invalid Authorization Bearer token"},"409":{"description":"No matched inbound reply is available"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/commercial/operator-inbound-autopilot-cron":{"get":{"summary":"Run inbound reply autopilot from 3060 local cron","description":"Runs inbound reply autopilot from the 3060 local cron. Protected by CRON_SECRET. Defaults to dry-run unless COMMERCIAL_OPERATOR_INBOUND_AUTOPILOT_MODE=send is configured server-side. Cron dry-runs persist a handoff execution event when a matched reply is selected. The route does not accept query-string overrides for send mode, recipient, recordEndpoint, or recordBody.","security":[{"CronSecret":[]}],"responses":{"200":{"description":"Commercial Inbound Autopilot Cron result","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialInboundAutopilotCronResult"}}}},"401":{"description":"Missing or invalid CRON_SECRET authorization header"},"503":{"description":"CRON_SECRET or operator token is not configured"}}}},"/api/commercial/operator-inbound-email":{"post":{"summary":"Receive inbound commercial email from a mailbox forwarder","description":"Protected private, no-store forwarder adapter for real mailbox automation. Supports Cloudflare Email Routing, Gmail Apps Script, Resend inbound, and generic email-forwarder payloads. Forwarders should use a dedicated inbound email secret, not the operator token. Send the secret as x-commercial-inbound-secret or Authorization Bearer. The endpoint stores sanitized text, not raw HTML, then matches by itemId or contactEmail for reply intake.","security":[{"CommercialInboundEmailSecret":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialInboundEmailForwarderRequest"}}}},"responses":{"200":{"description":"Inbound commercial email normalized and recorded","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialInboundEmailForwarderResult"}}}},"400":{"description":"Invalid inbound email payload"},"401":{"description":"Missing or invalid inbound email secret"},"503":{"description":"Inbound email secret or persistence service is not configured"}}}},"/api/commercial/operator-send-buyer-reply":{"post":{"summary":"Send the selected buyerReplyDraft or postSubmitAssistantClosePacket email","description":"Protected private, no-store send tool for assistant-driven commercial email work. Uses itemId from /api/commercial/operator-queue, sends that queue item buyerReplyDraft or exact postSubmitAssistantClosePacket when bodySource=postSubmitAssistantClosePacket, checks replyReadiness.sendAllowed, and does not accept arbitrary recipient email. Use bodySource=postSubmitAssistantClosePacket for submitted B2C/B2B close packets. Payment buyerReplyDraft bodyOverride must include purchasePolicyUrl. Exact paid fulfillmentPacket.copyText bodyOverride is exempt from the purchasePolicyUrl guard.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialBuyerReplySendRequest"}}}},"responses":{"200":{"description":"Buyer reply prepared or sent","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialBuyerReplySendResult"}}}},"400":{"description":"Invalid buyer reply send request"},"401":{"description":"Missing or invalid Authorization Bearer token"},"404":{"description":"Queue item ID not found"},"409":{"description":"Reply readiness gate, contact email, or payment_policy_missing_from_body_override prevents sending"},"503":{"description":"Email provider missing_resend_api_key or operator token is not configured"}}}},"/api/commercial/operator-send-follow-up":{"post":{"summary":"Send the selected followUpDraft email","description":"Protected private, no-store send tool for assistant-driven commercial follow-up. Uses itemId from /api/commercial/operator-queue, sends that queue item followUpDraft, checks followUpDraft.sendAllowed, and does not accept arbitrary recipient email. It records a Commercial Operator Execution Event but does not automatically record recommendedActionPayload. The watch_payment payment-help follow-up does not record payment_confirmed; a successful follow-up execution event is used by the queue to stop repeat follow-up sends.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialFollowUpSendRequest"}}}},"responses":{"200":{"description":"Follow-up prepared or sent","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialFollowUpSendResult"}}}},"400":{"description":"Invalid follow-up send request"},"401":{"description":"Missing or invalid Authorization Bearer token"},"404":{"description":"Queue item ID not found"},"409":{"description":"Follow-up gate or contact email prevents sending"},"503":{"description":"Email provider missing_resend_api_key or operator token is not configured"}}}},"/api/commercial/operator-reply-intake":{"post":{"summary":"Triage an inbound buyer or school reply","description":"Protected private, no-store reply intake for assistant-driven commercial email work. Uses itemId from /api/commercial/operator-queue and a pasted inbound reply. Does not accept arbitrary record endpoints or arbitrary recipients. It returns recordAllowed, recordEndpoint, recordBody, evidenceNote, nextStep, and replyDraft for operator-reviewed customer replies. payment_evidence_claim_requires_external_confirmation means assistants must check external payment evidence and must not record payment_confirmed from buyer email alone. Objection replies are safe reply drafts only for price_objection, guarantee_objection, manual_invoice_question, procurement_roi_objection, and competitor_alternative_question. Competitor or alternative-tool questions are customer replies only: competitor_alternative_question returns competitor_alternative_answer and should explain that Manavision, PassNavi, and StudySapuri are discovery portals while daigakujoho sells post-portal decision output and official answer repair. Asset buyer proof pack requests are customer replies only: asset_proof_pack_request returns asset_proof_pack_answer for traffic proof pack, revenue proof pack, automation proof pack, or risk cleanup proof pack and includes selected proof pack artifacts such as traffic proof artifact, revenue proof artifact, automation proof artifact, and risk cleanup artifact; it is not a valuation number and not a valuation guarantee, and asset_proof_pack_reply_does_not_record_workflow_action. NDA/private data-room requests are human-reviewed handoffs only: acquisition_private_data_room_request returns acquisition_private_data_room_handoff, does not release private data-room URLs or non-public artifacts, and private_data_room_reply_does_not_release_private_data. Acquisition or valuation questions are customer replies only: acquisition_inquiry returns acquisition_next_step_answer with the public data room, proof-to-valuation underwriting checklist, and buyer qualification request; it does not quote an asking price, valuation number, multiple, or revenue guarantee, and acquisition_inquiry_reply_does_not_record_workflow_action. Sample/proof accepted and payment requested becomes post_sample_payment_request with payment_request_ready_answer; record payment_requested only after the buyer-facing payment request was sent. Refund or cancellation questions are refund_cancellation_question with purchase_policy_answer and refund_cancellation_reply_does_not_record_workflow_action. Missing promised deliverable or free correction requests are deliverable_correction_request with correction_request_answer and free_correction_request_does_not_record_workflow_action. Use Authorization Bearer credentials.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialReplyIntakeRequest"}}}},"responses":{"200":{"description":"Inbound reply triaged","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialReplyIntakeResult"}}}},"400":{"description":"Invalid reply intake request"},"401":{"description":"Missing or invalid Authorization Bearer token"},"404":{"description":"Queue item ID not found"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/commercial/operator-reply-intake-record":{"post":{"summary":"Analyze and record a safe inbound reply action","description":"Protected private, no-store one-click reply automation. Uses itemId from /api/commercial/operator-queue and a pasted inbound reply. Executes only the server-generated reply-intake record plan. Does not accept arbitrary record endpoints or recordBody. Will not record payment_confirmed from buyer email alone; payment claims return a handoff instead. Use Authorization Bearer credentials.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialReplyIntakeRecordRequest"}}}},"responses":{"200":{"description":"Safe reply action recorded","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialReplyIntakeRecordResult"}}}},"400":{"description":"Invalid reply intake record request"},"401":{"description":"Missing or invalid Authorization Bearer token"},"404":{"description":"Queue item ID not found"},"409":{"description":"Reply was analyzed but no automatic record is allowed"},"502":{"description":"Source workflow action failed"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/commercial/operator-payment-evidence-record":{"post":{"summary":"Record external payment provider evidence","description":"Protected private, no-store payment evidence automation. Uses itemId from /api/commercial/operator-queue and reviewed external payment provider evidence, then records payment_confirmed for Admissions Concierge or For Schools when payer, amount, and lead match. Use admissions_concierge:{leadId} or for_schools:{leadId}. Does not accept arbitrary record endpoints or recordBody. Will not record payment_confirmed from buyer email alone; buyer email claims must go through reply intake and remain a handoff until external payment provider evidence exists. Use Authorization Bearer credentials.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialPaymentEvidenceRecordRequest"}}}},"responses":{"200":{"description":"External payment evidence recorded","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialPaymentEvidenceRecordResult"}}}},"400":{"description":"Invalid payment evidence record request"},"401":{"description":"Missing or invalid Authorization Bearer token"},"404":{"description":"Queue item ID not found"},"409":{"description":"Payment evidence is insufficient, email-derived, amount-mismatched, or unsupported for this segment"},"502":{"description":"Source workflow action failed"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/commercial/operator-payment-evidence-import":{"post":{"summary":"Import external payment provider evidence","description":"Protected private, no-store payment evidence import adapter for provider webhooks or scheduled import jobs. Supports generic JSON and Stripe-like payloads with itemId in metadata, client_reference_id, or top-level itemId. Uses a dedicated payment evidence import secret, not the operator token. Send the secret as x-commercial-payment-evidence-secret or Authorization Bearer. Do not use the operator cockpit token for payment webhooks.","security":[{"CommercialPaymentEvidenceSecret":[]},{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialPaymentEvidenceImportRequest"}}}},"responses":{"200":{"description":"Imported payment evidence recorded","headers":{"Cache-Control":{"schema":{"type":"string","const":"private, no-store"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommercialPaymentEvidenceImportResult"}}}},"400":{"description":"Invalid payment evidence import payload"},"401":{"description":"Missing or invalid payment evidence import secret"},"404":{"description":"Queue item ID not found"},"409":{"description":"Payment evidence is insufficient, email-derived, amount-mismatched, or unsupported for this segment"},"502":{"description":"Source workflow action failed"},"503":{"description":"Payment evidence import secret is not configured"}}}},"/api/admissions-concierge/operator-openapi":{"get":{"tags":["B2C Admissions Concierge"],"summary":"Get the canonical Admissions Concierge operator schema","description":"Public route-specific schema for Admissions Concierge operator leads and sales workflow actions.","responses":{"200":{"description":"Admissions Concierge Operator API schema"}}}},"/api/admissions-concierge/operator-leads":{"get":{"tags":["B2C Admissions Concierge"],"summary":"List Admissions Concierge leads for assistant follow-up","description":"Protected queue of paid consultation leads with assistantReplyDrafts, salesReplyChecklist, tonightDecisionPack, parentPurchaseApprovalPack, paymentRequestPack, paymentStatus, dealStatus, latestOperatorAction, and nextOperatorAction.","security":[{"BearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}}],"responses":{"200":{"description":"Admissions Concierge lead queue","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"source":{"type":"string","enum":["primary","backup","none"]},"leads":{"type":"array","items":{"$ref":"#/components/schemas/AdmissionsConciergeLead"}}}}}}},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/admissions-concierge/operator-actions":{"post":{"tags":["B2C Admissions Concierge"],"summary":"Record an Admissions Concierge sales workflow action","description":"Record first reply, missing information request, payment request, payment confirmation, report delivery, or closed-lost state after the operator or assistant takes the action.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdmissionsOperatorActionRequest"}}}},"responses":{"200":{"description":"Operator action recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorActionResult"}}}},"400":{"description":"Invalid operator action payload"},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/for-schools/operator-openapi":{"get":{"tags":["B2B For Schools"],"summary":"Get the canonical For Schools operator schema","description":"Public route-specific schema for school-side inbound leads, outbound prospects, outreach actions, and lead conversion.","responses":{"200":{"description":"For Schools Operator API schema"}}}},"/api/for-schools/operator-leads":{"get":{"tags":["B2B For Schools"],"summary":"List school-side inbound leads for assistant follow-up","description":"Protected queue of school partnership leads with schoolReplyPack, surfaceDiagnosisPack, paymentRequestPack, operatorReplyPacket, latestOperatorAction, and nextOperatorAction.","security":[{"BearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":50,"default":20}}],"responses":{"200":{"description":"For Schools lead queue","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"source":{"type":"string","enum":["primary","backup","none"]},"leads":{"type":"array","items":{"$ref":"#/components/schemas/ForSchoolsLead"}}}}}}},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/for-schools/operator-actions":{"post":{"tags":["B2B For Schools"],"summary":"Record a school-side inbound sales workflow action","description":"Record school reply sent, official URL requested, scope confirmed, payment request sent, external payment confirmed, repair delivered, or closed-lost state after the action happened.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchoolOperatorActionRequest"}}}},"responses":{"200":{"description":"School operator action recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorActionResult"}}}},"400":{"description":"Invalid operator action payload"},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/for-schools/operator-prospects":{"get":{"tags":["B2B For Schools"],"summary":"List outbound school prospects","description":"Protected outbound queue built from canonical school data. Use it to prepare first-contact outreach before waiting for inbound form submissions.","security":[{"BearerAuth":[]}],"parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":40,"default":12}}],"responses":{"200":{"description":"Outbound school prospect queue","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"prospects":{"type":"array","items":{"$ref":"#/components/schemas/SchoolOutreachProspect"}}}}}}},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token is not configured"}}}},"/api/for-schools/operator-outreach-actions":{"post":{"tags":["B2B For Schools"],"summary":"Record an outbound prospect pipeline action","description":"Record contact_route_found, outreach_sent, school_replied, or closed_lost for a school prospect.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchoolOutreachActionRequest"}}}},"responses":{"200":{"description":"Outbound action recorded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OperatorActionResult"}}}},"400":{"description":"Invalid outreach action payload"},"401":{"description":"Missing or invalid Authorization Bearer token"},"503":{"description":"Operator token or persistence service is not configured"}}}},"/api/for-schools/operator-prospect-leads":{"post":{"tags":["B2B For Schools"],"summary":"Convert a replied outbound prospect into a payable school lead","description":"Create a For Schools lead from a school_replied outbound prospect and return schoolReplyPack, surfaceDiagnosisPack, paymentRequestPack, and conversionPacket.","security":[{"BearerAuth":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchoolProspectLeadConversionRequest"}}}},"responses":{"200":{"description":"Outbound reply converted to a payable lead","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchoolProspectLeadConversionResult"}}}},"400":{"description":"Invalid lead conversion payload"},"401":{"description":"Missing or invalid Authorization Bearer token"},"404":{"description":"Prospect ID not found"},"503":{"description":"Operator token or persistence service is not configured"}}}}},"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"Use the same non-public operator bearer credential for all protected commercial endpoints."},"CronSecret":{"type":"http","scheme":"bearer","description":"Local cron Authorization Bearer credential backed by CRON_SECRET. It is only for cron entrypoints, not operator cockpit access."},"CommercialInboundEmailSecret":{"type":"apiKey","in":"header","name":"x-commercial-inbound-secret","description":"Dedicated inbound email forwarder secret for /api/commercial/operator-inbound-email. Do not use the operator cockpit token for mailbox forwarders."},"CommercialPaymentEvidenceSecret":{"type":"apiKey","in":"header","name":"x-commercial-payment-evidence-secret","description":"Dedicated payment evidence import secret for /api/commercial/operator-payment-evidence-import. Do not use the operator cockpit token for payment provider webhooks."}},"schemas":{"CommercialSalesAssistantOpenApi":{"type":"object","description":"The OpenAPI 3.1 document returned by this route."},"CommercialOperatorReadinessResult":{"type":"object","required":["ok","schema","generatedAt","summary","checks","nextBestSetupActions","setupArtifacts","manualClosePackets","safety"],"description":"Commercial Operator Readiness result. Use it before assuming email, payment, inbound, or persistence automation is configured. It never returns secret values and reports whether direct payment URLs are ready, whether manual invoice fallback remains necessary, whether setupArtifacts should be copied into the Supabase SQL Editor, selected payment provider, Resend, or mailbox forwarder setup task, and which manual close packet should be used when provider automation is missing or failing.","properties":{"ok":{"type":"boolean","const":true},"schema":{"type":"string","const":"commercial.operator_readiness.v1"},"generatedAt":{"type":"string"},"summary":{"$ref":"#/components/schemas/CommercialOperatorReadinessSummary"},"checks":{"type":"array","items":{"$ref":"#/components/schemas/CommercialOperatorReadinessCheck"}},"nextBestSetupActions":{"type":"array","items":{"type":"string"},"description":"Prioritized setup actions for checks that are missing, in manual_fallback, or need attention."},"setupArtifacts":{"type":"array","items":{"$ref":"#/components/schemas/CommercialOperatorReadinessSetupArtifact"},"description":"Copy-ready setup artifacts for missing commercial automation prerequisites. Examples include a SQL migration packet for primary CRM tables, a payment provider setup packet, and an email automation setup packet."},"manualClosePackets":{"type":"array","items":{"$ref":"#/components/schemas/CommercialOperatorReadinessManualClosePacket"},"description":"Copy-ready manual close packets for hot B2C and B2B leads when email, payment, inbound, or payment-evidence providers are missing, partial, or temporarily failing."},"safety":{"type":"array","items":{"type":"string"},"description":"Contains never_returns_secret_values and related handling notes."}}},"CommercialOperatorReadinessSummary":{"type":"object","required":["totalChecks","readyCount","manualFallbackCount","missingCount","attentionCount","automationCoverageLabel","paymentDirectUrlCoverageLabel","paymentDirectUrlReadyCount","paymentDirectUrlTotalCount","paymentManualFallbackSkuCount","paymentManualInvoiceStillRequired","paymentMissingSkuLabels","paymentMissingEnvVars"],"properties":{"totalChecks":{"type":"integer"},"readyCount":{"type":"integer"},"manualFallbackCount":{"type":"integer"},"missingCount":{"type":"integer"},"attentionCount":{"type":"integer"},"automationCoverageLabel":{"type":"string"},"paymentDirectUrlCoverageLabel":{"type":"string","description":"Operator-facing direct payment coverage headline, for example 0/6 direct payment URLs ready; manual_invoice fallback still required."},"paymentDirectUrlReadyCount":{"type":"integer"},"paymentDirectUrlTotalCount":{"type":"integer"},"paymentManualFallbackSkuCount":{"type":"integer"},"paymentManualInvoiceStillRequired":{"type":"boolean","description":"True when at least one public B2C or B2B SKU still lacks a direct payment URL and assistants must keep using manual_invoice fallback."},"paymentMissingSkuLabels":{"type":"array","items":{"type":"string"},"description":"Public SKU labels that still need a direct payment URL before direct checkout can be claimed ready."},"paymentMissingEnvVars":{"type":"array","items":{"type":"string"},"description":"Payment URL env names that are missing for direct checkout coverage. Secret values are never returned."}}},"CommercialOperatorReadinessCheck":{"type":"object","required":["id","label","status","summary","nextAction","envVars","evidence","secretExposure"],"description":"One commercial setup check. Status manual_fallback means the workflow can continue manually but the assistant should not treat that capability as automated. Payment checks may include coverageItems for SKU-level readiness. Supabase checks may include coverageItems for table-level Supabase persistence readiness and can expose primary_crm_table_missing without returning secrets.","properties":{"id":{"type":"string"},"label":{"type":"string"},"status":{"type":"string","enum":["ready","manual_fallback","missing","attention"]},"summary":{"type":"string"},"nextAction":{"type":"string"},"envVars":{"type":"array","items":{"type":"string"},"description":"Environment variable names only. Secret values are never returned."},"evidence":{"type":"array","items":{"type":"string"},"description":"Presence-derived evidence such as direct_url_ready or ENV_NAME:present. Never contains secret values."},"coverageItems":{"type":"array","items":{"$ref":"#/components/schemas/CommercialOperatorReadinessCoverageItem"},"description":"Optional SKU-level readiness rows for checks such as B2C/B2B payment URLs. Each row reports env names and presence-derived evidence only."},"secretExposure":{"type":"string","const":"never_returns_secret_values"}}},"CommercialOperatorReadinessCoverageItem":{"type":"object","required":["id","label","status","envVars","evidence","nextAction","secretExposure"],"description":"SKU-level readiness item. It reports whether a specific paid offer has a direct payment URL via its package env var or shared fallback. Secret values are never returned.","properties":{"id":{"type":"string"},"label":{"type":"string"},"status":{"type":"string","enum":["ready","manual_fallback","missing","attention"]},"envVars":{"type":"array","items":{"type":"string"},"description":"Environment variable names only, such as CONCIERGE_PAYMENT_URL_ACTION_PLAN."},"evidence":{"type":"array","items":{"type":"string"},"description":"Presence-derived evidence only, such as ENV_NAME:present or ENV_NAME:missing."},"nextAction":{"type":"string"},"secretExposure":{"type":"string","const":"never_returns_secret_values"}}},"CommercialOperatorReadinessSetupArtifact":{"type":"object","required":["id","label","kind","path","summary","copyText","safety","secretExposure"],"description":"Copy-ready setup artifact. SQL artifacts contain no secret values and are intended for a human operator to paste into the Supabase SQL Editor or apply through a Postgres migration user. A payment provider setup packet contains the six public SKU amounts, direct URL env names, metadata.itemId rule, and the payment evidence import endpoint without exposing secret values. An email automation setup packet contains the outbound email provider setup, mailbox forwarder endpoint/header, supported provider values, and payment_confirmed safety boundary without exposing secret values.","properties":{"id":{"type":"string"},"label":{"type":"string"},"kind":{"type":"string","enum":["sql_migration","payment_provider_setup","email_automation_setup"]},"path":{"type":"string"},"summary":{"type":"string"},"copyText":{"type":"string","description":"Artifact body. For commercial_crm_primary_tables_sql this is the content of scripts/supabase/commercial_crm_tables.sql. For payment_provider_setup_pack this mirrors docs/payment-provider-setup.md and can be copied into the selected payment provider setup task. For commercial_email_automation_setup_pack this mirrors docs/email-automation-setup.md and can be copied into the selected Resend and mailbox-forwarder setup task."},"safety":{"type":"array","items":{"type":"string"}},"secretExposure":{"type":"string","const":"never_returns_secret_values"}}},"CommercialOperatorReadinessManualClosePacket":{"type":"object","required":["id","label","segment","useWhen","triggerCheckIds","steps","copyText","safety","secretExposure"],"description":"Copy-ready manual close packet. Use it only for operator-reviewed buyer replies when provider automation is missing, partial, or failing. It contains no secret values and keeps payment_confirmed blocked until external payment evidence exists. Acquisition buyer packets are data-room handoffs, not valuation quotes.","properties":{"id":{"type":"string","enum":["manual_close_revenue_rescue","manual_close_admissions_concierge","manual_close_for_schools","manual_close_acquisition_buyer"]},"label":{"type":"string"},"segment":{"type":"string","enum":["shared","admissions_concierge","for_schools","acquisition_buyer"]},"useWhen":{"type":"array","items":{"type":"string"}},"triggerCheckIds":{"type":"array","items":{"type":"string"}},"steps":{"type":"array","items":{"type":"string"}},"copyText":{"type":"string","description":"Operator-reviewed fallback copy. Replace placeholders from the selected queue item, send from the owned mailbox, record payment_request_sent only after the buyer-facing request is sent, and never record payment_confirmed until external evidence exists."},"safety":{"type":"array","items":{"type":"string"}},"secretExposure":{"type":"string","const":"never_returns_secret_values"}}},"CommercialOperatorQueue":{"type":"object","required":["ok","schema","generatedAt","limit","sources","summary","highIntentSignals","workItems"],"properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_queue.v1"},"generatedAt":{"type":"string"},"limit":{"type":"integer"},"sources":{"type":"object","properties":{"admissionsConcierge":{"$ref":"#/components/schemas/CommercialQueueSourceStatus"},"forSchools":{"$ref":"#/components/schemas/CommercialQueueSourceStatus"},"schoolOutreach":{"$ref":"#/components/schemas/CommercialQueueSourceStatus"},"acquisitionBuyer":{"$ref":"#/components/schemas/CommercialQueueSourceStatus"},"highIntentSignals":{"$ref":"#/components/schemas/CommercialQueueSourceStatus"}}},"summary":{"$ref":"#/components/schemas/CommercialQueueSummary"},"highIntentSignals":{"type":"array","description":"Anonymous demand evidence from For Schools commercial asset events. Use as prioritization evidence only, not as permission to email a visitor.","items":{"$ref":"#/components/schemas/CommercialHighIntentSignal"}},"workItems":{"type":"array","items":{"$ref":"#/components/schemas/CommercialOperatorWorkItem"}}}},"CommercialOperatorAutopilotRequest":{"type":"object","description":"Request body for protected assistant autopilot. Defaults to dryRun=true. Optional recordDryRunEvent can persist a handoff execution event for scheduled dry-runs. When no safe candidate exists, scheduled dry-runs can persist an idle heartbeat event without sending email or recording CRM action. Optional itemId can target one queue item, but the endpoint still requires replyReadiness.sendAllowed, actionExecution.mode send_then_record, and a queue-owned recommendedActionPayload.","properties":{"dryRun":{"type":"boolean","default":true,"description":"Defaults to dryRun=true. When true, select and validate one item without sending email or recording CRM action."},"recordDryRunEvent":{"type":"boolean","default":false,"description":"When dryRun=true, persist a Commercial Operator Execution Event with status handoff after a safe candidate is selected, or an idle heartbeat event when no safe candidate exists. Intended for scheduled cron evidence, not normal manual dry-run debugging."},"limit":{"type":"integer","minimum":1,"maximum":50,"default":30},"itemId":{"type":["string","null"],"description":"Optional queue item id from /api/commercial/operator-queue."},"operator":{"type":["string","null"],"description":"Non-secret operator or assistant label."}}},"CommercialOperatorAutopilotRunResult":{"type":"object","required":["ok","schema","generatedAt","dryRun","selected","selectedItem","queueSummary","sendResult","recordResult","executionEvent","reason","safety"],"description":"Result for protected commercial autopilot. Schema commercial.operator_autopilot_run.v1. Runs exactly one highest-priority send_then_record commercial work item. Does not accept arbitrary recipient email or arbitrary record endpoint. If dryRun=false, it sends buyerReplyDraft or the selected postSubmitAssistantClosePacket and records recommendedActionPayload only after emailSent=true.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_autopilot_run.v1"},"generatedAt":{"type":"string"},"dryRun":{"type":"boolean"},"selected":{"type":"boolean"},"selectedItem":{"anyOf":[{"type":"object","properties":{"itemId":{"type":"string"},"segment":{"type":"string"},"kind":{"type":"string"},"title":{"type":"string"},"buyerLabel":{"type":"string"},"amountJPY":{"type":"integer"},"priorityScore":{"type":"integer"},"nextOperatorAction":{"type":"string"},"recordEndpoint":{"type":["string","null"]},"recordAction":{"type":["string","null"]},"buyerReplyBodySource":{"type":"string","enum":["buyerReplyDraft","postSubmitAssistantClosePacket"]}}},{"type":"null"}]},"queueSummary":{"type":"object","properties":{"totalItems":{"type":"integer"},"eligibleItems":{"type":"integer"},"inspectedLimit":{"type":"integer"}}},"sendResult":{"anyOf":[{"$ref":"#/components/schemas/CommercialBuyerReplySendResult"},{"type":"null"}]},"recordResult":{"anyOf":[{"type":"object","properties":{"ok":{"type":"boolean"},"endpoint":{"type":["string","null"]},"status":{"type":["integer","null"]},"action":{"type":["string","null"]},"reason":{"type":"string"},"response":{}}},{"type":"null"}]},"executionEvent":{"anyOf":[{"$ref":"#/components/schemas/CommercialOperatorExecutionEvent"},{"type":"object"},{"type":"null"}]},"reason":{"type":"string"},"safety":{"type":"array","items":{"type":"string"}}}},"CommercialOperatorAutopilotCronResult":{"type":"object","required":["ok","schema","generatedAt","mode","dryRun","schedule","autopilot","reason"],"description":"3060 local cron wrapper for Commercial Operator Autopilot. Schema commercial.operator_autopilot_cron.v1. Defaults to dry-run unless COMMERCIAL_OPERATOR_AUTOPILOT_MODE=send is configured server-side. Cron dry-runs persist a handoff execution event when a candidate is selected or an idle heartbeat when no candidate is safe. Protected by CRON_SECRET.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_autopilot_cron.v1"},"generatedAt":{"type":"string"},"mode":{"type":"string"},"dryRun":{"type":"boolean"},"schedule":{"type":"string"},"autopilot":{"$ref":"#/components/schemas/CommercialOperatorAutopilotRunResult"},"reason":{"type":"string"}}},"CommercialQueueSourceStatus":{"type":"object","properties":{"ok":{"type":"boolean"},"source":{"type":"string"},"limit":{"type":"integer"},"count":{"type":"integer"},"reason":{"type":"string"}}},"CommercialQueueSummary":{"type":"object","required":["totalItems","urgentCount","totalPipelineValueJPY","highIntentSignalCount","highIntentSignalSessions","bySegment","byNextOperatorAction"],"properties":{"totalItems":{"type":"integer"},"urgentCount":{"type":"integer"},"totalPipelineValueJPY":{"type":"integer"},"highIntentSignalCount":{"type":"integer"},"highIntentSignalSessions":{"type":"integer"},"bySegment":{"type":"object","additionalProperties":{"type":"integer"}},"byNextOperatorAction":{"type":"object","additionalProperties":{"type":"integer"}}}},"CommercialHighIntentSignal":{"type":"object","required":["eventName","label","closeStage","priorityScore","count","sessions","visitors","pagePath","sourceType","lastSeenAt","assistantNextStep","humanGate","nextAction","evidence"],"description":"Aggregated anonymous commercial asset interaction from analytics_events. These signals prove demand but do not identify a reachable buyer.","properties":{"eventName":{"type":"string"},"label":{"type":"string"},"closeStage":{"type":"string","enum":["anonymous_interest","close_packet_copied","checkout_handoff","ready_for_payment_request"],"description":"Commercial close stage inferred from the event. Higher stages are closer to payment and should be reviewed before broad anonymous interest."},"priorityScore":{"type":"integer","description":"0-99 commercial priority score derived from closeStage, sessions, and event count. Sort descending before count-only demand reads."},"count":{"type":"integer"},"sessions":{"type":"integer"},"visitors":{"type":"integer"},"pagePath":{"type":["string","null"]},"sourceType":{"type":["string","null"]},"lastSeenAt":{"type":["string","null"]},"assistantNextStep":{"type":"string","description":"Assistant-facing instruction for the next action. It is more specific than nextAction and must be read before drafting replies."},"humanGate":{"type":"string","description":"Conditions that require human review. Anonymous signals still require an identifiable lead or inbound reply before email."},"nextAction":{"type":"string"},"evidence":{"type":"array","items":{"type":"string"}}}},"CommercialAcquisitionInquiryLead":{"type":"object","required":["leadId","email","buyerType","targetAsset","proofPackPriority","timeline","ndaPreference","message","acquisitionInquiryPack","buyerReplyPack","assistantBrief","dealStatus","createdAt"],"description":"Acquisition buyer lead created by POST /api/commercial/acquisition-inquiry. Acquisition buyer inquiries enter the unified operator queue as acquisition_buyer asset_buyer_inquiry items; do not treat them as valuation guarantees.","properties":{"leadId":{"type":"string"},"email":{"type":"string","format":"email"},"buyerName":{"type":["string","null"]},"buyerType":{"type":"string"},"targetAsset":{"type":"string"},"proofPackPriority":{"type":"string"},"timeline":{"type":"string"},"ndaPreference":{"type":"string"},"message":{"type":"string"},"sourcePath":{"type":["string","null"]},"acquisitionInquiryPack":{"type":"object"},"buyerReplyPack":{"type":"object"},"assistantBrief":{"type":"object"},"dealStatus":{"type":"string"},"ownerNotified":{"type":"boolean"},"buyerEmailed":{"type":"boolean"},"createdAt":{"type":"string"}}},"CommercialAcquisitionClosingPacket":{"type":"object","required":["schema","stage","selectedProofPack","ndaGate","assistantSendMode","humanReviewRequired","privateDataRoomBoundary","requiredBuyerEvidence","assistantNextSteps","proofLinks","safetyChecklist","copyText"],"description":"Acquisition Closing Packet for acquisition_buyer work items. It tells assistants which selected public proof pack to send before private data, when NDA or data-room access requires human review, and which safety boundaries block valuation or private artifact release.","properties":{"schema":{"type":"string","const":"commercial.acquisition_closing_packet.v1"},"stage":{"type":"string","const":"acquisition_qualification"},"selectedProofPack":{"type":"object","required":["value","label","publicProofUrl","buyerQuestion"],"properties":{"value":{"type":"string"},"label":{"type":"string"},"publicProofUrl":{"type":"string"},"buyerQuestion":{"type":"string"}}},"ndaGate":{"type":"string"},"assistantSendMode":{"type":"string","description":"Expected value: send_selected_public_proof_pack_before_private_data."},"humanReviewRequired":{"type":"boolean"},"privateDataRoomBoundary":{"type":"string","description":"private_data_room_requires_human_review: do not release private data-room URLs, non-public artifacts, asking price, multiple, or private metrics without human review."},"requiredBuyerEvidence":{"type":"array","items":{"type":"string"}},"assistantNextSteps":{"type":"array","items":{"type":"string"}},"proofLinks":{"type":"array","items":{"type":"object","required":["label","url"],"properties":{"label":{"type":"string"},"url":{"type":"string"}}}},"safetyChecklist":{"type":"array","items":{"type":"string"}},"copyText":{"type":"string"}}},"CommercialPostSubmitAssistantClosePacket":{"type":"object","required":["schema","leadId","subject","copyText","assistantSendMode","recordAfterSend","sourcePath","purchasePolicyUrl","humanReviewRequiredWhen"],"description":"Exact post-submit close packet for submitted Admissions Concierge and For Schools leads. Use postSubmitAssistantClosePacket before generic assistantPacket so assistants do not repeat the same SKU, school-list, or school package question again.","properties":{"schema":{"type":"string","enum":["admissions_concierge.post_submit_assistant_close_packet.v1","for_schools.post_submit_assistant_close_packet.v1"]},"leadId":{"type":"string"},"subject":{"type":"string"},"copyText":{"type":"string"},"assistantSendMode":{"type":"string","enum":["send_after_lead_accepted","operator_review"]},"recordAfterSend":{"type":"string"},"sourcePath":{"type":"string"},"purchasePolicyUrl":{"type":"string"},"oneRemainingQuestion":{"type":"string"},"oneOfficialUrlQuestion":{"type":"string"},"paymentRequestPackCondition":{"type":"string"},"scopeConfirmationCondition":{"type":"string"},"sendAfterLeadAccepted":{"type":"boolean"},"humanReviewRequiredWhen":{"type":"array","items":{"type":"string"}}}},"CommercialOperatorWorkItem":{"type":"object","required":["itemId","segment","kind","title","buyerLabel","amountJPY","priorityScore","priorityReasons","nextOperatorAction","protectedDetailEndpoint","recordActionEndpoint","buyerReplyDraft","completionGuard","fulfillmentPacket","followUpPlan","followUpDraft","pipelineState","actionTimeline","replyReadiness","actionExecution","assistantPacket"],"properties":{"itemId":{"type":"string"},"segment":{"type":"string","enum":["admissions_concierge","for_schools","school_outreach","acquisition_buyer"]},"kind":{"type":"string","enum":["inbound_lead","outbound_prospect","asset_buyer_inquiry"]},"title":{"type":"string"},"buyerLabel":{"type":"string"},"contactEmail":{"type":["string","null"]},"amountJPY":{"type":"integer"},"priorityScore":{"type":"integer"},"priorityReasons":{"type":"array","items":{"type":"string"}},"nextOperatorAction":{"type":"string"},"paymentStatus":{"type":["string","null"]},"createdAt":{"type":["string","null"]},"protectedDetailEndpoint":{"type":"string"},"recordActionEndpoint":{"type":"string"},"recommendedActionPayload":{"anyOf":[{"type":"object","properties":{"endpoint":{"type":"string"},"method":{"type":"string","const":"POST"},"body":{"type":"object"},"safetyNote":{"type":"string"}}},{"type":"null"}]},"buyerReplyDraft":{"$ref":"#/components/schemas/CommercialBuyerReplyDraft"},"completionGuard":{"anyOf":[{"$ref":"#/components/schemas/CommercialCompletionGuard"},{"type":"null"}]},"fulfillmentPacket":{"anyOf":[{"$ref":"#/components/schemas/CommercialFulfillmentPacket"},{"type":"null"}]},"followUpPlan":{"$ref":"#/components/schemas/CommercialFollowUpPlan"},"followUpDraft":{"$ref":"#/components/schemas/CommercialFollowUpDraft"},"pipelineState":{"$ref":"#/components/schemas/CommercialPipelineState"},"actionTimeline":{"type":"array","items":{"$ref":"#/components/schemas/CommercialActionTimelineItem"}},"replyReadiness":{"$ref":"#/components/schemas/CommercialReplyReadiness"},"actionExecution":{"$ref":"#/components/schemas/CommercialActionExecution"},"acquisitionClosingPacket":{"anyOf":[{"$ref":"#/components/schemas/CommercialAcquisitionClosingPacket"},{"type":"null"}]},"postSubmitAssistantClosePacket":{"anyOf":[{"$ref":"#/components/schemas/CommercialPostSubmitAssistantClosePacket"},{"type":"null"}]},"assistantPacket":{"type":"string"}}},"CommercialReplyReadiness":{"type":"object","required":["mode","label","sendAllowed","recordAllowed","handoffToHuman","reason","requiredBeforeSend","prohibitedActions","primaryCTA"],"description":"Final send gate for assistant-driven commercial email work. Use replyReadiness as the final send gate before emailing or recording an action.","properties":{"mode":{"type":"string","enum":["send_now","wait","record_only","needs_human"]},"label":{"type":"string"},"sendAllowed":{"type":"boolean"},"recordAllowed":{"type":"boolean"},"handoffToHuman":{"type":"boolean"},"reason":{"type":"string"},"requiredBeforeSend":{"type":"array","items":{"type":"string"}},"prohibitedActions":{"type":"array","items":{"type":"string"}},"primaryCTA":{"type":"string"}}},"CommercialActionExecution":{"type":"object","required":["mode","label","canRecordNow","recordEndpoint","recordMethod","recordAction","recordBody","recordAfter","requiredEvidence","onSuccess","onFailure","humanHandoffReason","assistantInstruction","copyText"],"description":"Execution and CRM handoff contract for assistant-driven commercial work. Use actionExecution to record successful sends or external events, and to choose wait or human handoff on failure.","properties":{"mode":{"type":"string","enum":["send_then_record","record_external_event","wait_only","human_handoff"]},"label":{"type":"string"},"canRecordNow":{"type":"boolean"},"recordEndpoint":{"type":["string","null"]},"recordMethod":{"type":["string","null"],"enum":["POST",null]},"recordAction":{"type":["string","null"]},"recordBody":{"anyOf":[{"type":"object"},{"type":"null"}]},"recordAfter":{"type":"string"},"requiredEvidence":{"type":"array","items":{"type":"string"}},"onSuccess":{"type":"string"},"onFailure":{"type":"string"},"humanHandoffReason":{"type":["string","null"]},"assistantInstruction":{"type":"string"},"copyText":{"type":"string"}}},"CommercialActionTimelineItem":{"type":"object","required":["rank","action","label","operator","note","createdAt"],"description":"Recent action timeline for this commercial work item. Use actionTimeline before sending a reply so you do not repeat a recent outreach, payment request, or delivery action.","properties":{"rank":{"type":"integer"},"action":{"type":"string"},"label":{"type":"string"},"operator":{"type":["string","null"]},"note":{"type":["string","null"]},"createdAt":{"type":["string","null"]}}},"CommercialPipelineState":{"type":"object","required":["stage","statusLabel","urgency","blocker","lastActionLabel","lastActionAt","actionCount","shouldStop","stopReason","nextBestOutcome"],"description":"Current commercial pipeline state derived from latestOperatorAction, outreach pipelineStage, and nextOperatorAction. Use pipelineState.statusLabel and pipelineState.blocker to decide whether the item is waiting, blocked, or ready to close.","properties":{"stage":{"type":"string"},"statusLabel":{"type":"string"},"urgency":{"type":"string","enum":["low","normal","high","stop"]},"blocker":{"type":["string","null"]},"lastActionLabel":{"type":["string","null"]},"lastActionAt":{"type":["string","null"]},"actionCount":{"type":"integer"},"shouldStop":{"type":"boolean"},"stopReason":{"type":["string","null"]},"nextBestOutcome":{"type":"string"}}},"CommercialFollowUpPlan":{"type":"object","required":["stage","cadenceLabel","nextCheckpoint","assistantDirective","nextSteps","fallbackIfNoReply","stopConditions","copyText"],"description":"Copy-ready follow-up plan that tells assistants when to remind, when to stop, and which close-loop action should happen next. Use followUpPlan.copyText to decide when to send reminders or close-loop follow-up.","properties":{"stage":{"type":"string"},"cadenceLabel":{"type":"string"},"nextCheckpoint":{"type":"string"},"assistantDirective":{"type":"string"},"nextSteps":{"type":"array","items":{"type":"string"}},"fallbackIfNoReply":{"type":"string"},"stopConditions":{"type":"array","items":{"type":"string"}},"copyText":{"type":"string"}}},"CommercialFollowUpDraft":{"type":"object","required":["subject","body","copyText","mailtoHref","sendAllowed","reason","safetyChecklist","recordActionAfterSend"],"description":"Structured one-time follow-up email draft for an operator to review. Use followUpDraft only when followUpDraft.sendAllowed is true; this is not an automatic drip campaign and should not bypass replyReadiness, pipelineState, or actionTimeline. In watch_payment, followUpDraft may be a payment-help follow-up that helps with invoice or payment-link friction, does not record payment_confirmed, and is disabled after a successful follow-up execution event.","properties":{"subject":{"type":"string"},"body":{"type":"string"},"copyText":{"type":"string"},"mailtoHref":{"type":"string"},"sendAllowed":{"type":"boolean"},"reason":{"type":"string","description":"follow_up_send_allowed or follow_up_wait_only with the current safety gate outcome."},"safetyChecklist":{"type":"array","items":{"type":"string"}},"recordActionAfterSend":{"type":["string","null"]}}},"CommercialFulfillmentPacket":{"type":"object","required":["title","stage","copyText","deliveryChecklist","recordActionAfterDelivery"],"description":"Copy-ready paid delivery or school repair handoff packet. Use fulfillmentPacket.copyText for paid delivery or school repair handoff after payment, scope, or official URL evidence is confirmed.","properties":{"title":{"type":"string"},"stage":{"type":"string"},"copyText":{"type":"string"},"deliveryChecklist":{"type":"array","items":{"type":"string"}},"recordActionAfterDelivery":{"type":["string","null"]}}},"CommercialCompletionGuard":{"type":"object","required":["action","label","evidencePrompt","requiredConfirmations","recordButtonLabel","evidenceNoteRequired","evidenceNoteLabel","evidenceNotePlaceholder","evidenceNoteTargetField"],"description":"Completion guard that must be satisfied before recording recommendedActionPayload. Use it to avoid marking unsent replies, unverified payments, undelivered reports, or unconfirmed school scope as complete. If evidenceNoteRequired is true, write the evidence summary into evidenceNoteTargetField before POST.","properties":{"action":{"type":"string"},"label":{"type":"string"},"evidencePrompt":{"type":"string"},"requiredConfirmations":{"type":"array","items":{"type":"string"}},"recordButtonLabel":{"type":"string"},"evidenceNoteRequired":{"type":"boolean"},"evidenceNoteLabel":{"type":"string"},"evidenceNotePlaceholder":{"type":"string"},"evidenceNoteTargetField":{"type":"string","enum":["note","replyNote"]}}},"CommercialBuyerReplyDraft":{"type":"object","required":["subject","body","copyText","mailtoHref","purchasePolicyUrl","safetyChecklist","nextOperatorActionAfterSend"],"description":"Buyer-facing reply draft generated from the next-best-action queue. Use this for the actual customer email; assistantPacket remains the internal reasoning and operator context packet. Queue-owned payment drafts include purchasePolicyUrl before asking for payment.","properties":{"subject":{"type":"string"},"body":{"type":"string"},"copyText":{"type":"string"},"mailtoHref":{"type":"string"},"purchasePolicyUrl":{"type":["string","null"],"format":"uri","description":"Public purchase policy URL included when this draft asks for payment."},"safetyChecklist":{"type":"array","items":{"type":"string"}},"nextOperatorActionAfterSend":{"type":["string","null"]}}},"CommercialBuyerReplySendRequest":{"type":"object","required":["itemId"],"description":"Request body for protected assistant email sending. Uses itemId from /api/commercial/operator-queue. Does not accept arbitrary recipient email; the server sends only the selected queue item buyerReplyDraft or exact postSubmitAssistantClosePacket when bodySource=postSubmitAssistantClosePacket. Use bodySource=postSubmitAssistantClosePacket for submitted B2C/B2B close packets.","properties":{"itemId":{"type":"string"},"operator":{"type":["string","null"],"description":"Non-secret operator or assistant label."},"bodySource":{"type":"string","enum":["buyerReplyDraft","postSubmitAssistantClosePacket"],"default":"buyerReplyDraft","description":"Selects the queue-owned body to send. Use bodySource=postSubmitAssistantClosePacket only when the queue item exposes postSubmitAssistantClosePacket and the lead already submitted a B2C/B2B form."},"subjectOverride":{"type":["string","null"],"description":"Optional reviewed subject override for personalization."},"bodyOverride":{"type":["string","null"],"description":"Optional reviewed body override for personalization. Payment buyerReplyDraft bodyOverride must include purchasePolicyUrl."},"dryRun":{"type":"boolean","description":"When true, validate the item and return the prepared send payload without sending email."}}},"CommercialBuyerReplySendResult":{"type":"object","required":["ok","schema","emailPrepared","emailSent","providerConfigured","dryRun","reason"],"description":"Result for protected buyer reply sending. Schema commercial.operator_buyer_reply_send.v1. Use emailPrepared/emailSent/providerConfigured to decide whether to record recommendedActionPayload, retry, or hand off. A provider failure may return missing_resend_api_key.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_buyer_reply_send.v1"},"itemId":{"type":"string"},"buyerLabel":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"bodySource":{"type":"string","enum":["buyerReplyDraft","postSubmitAssistantClosePacket"]},"emailPrepared":{"type":"boolean"},"emailSent":{"type":"boolean"},"providerConfigured":{"type":"boolean"},"dryRun":{"type":"boolean"},"recommendedActionPayload":{"anyOf":[{"type":"object","properties":{"endpoint":{"type":"string"},"method":{"type":"string","const":"POST"},"body":{"type":"object"},"safetyNote":{"type":"string"}}},{"type":"null"}]},"actionExecution":{"$ref":"#/components/schemas/CommercialActionExecution"},"executionEvent":{"type":"object"},"reason":{"type":"string"}}},"CommercialFollowUpSendRequest":{"type":"object","required":["itemId"],"description":"Request body for protected assistant follow-up sending. Uses itemId from /api/commercial/operator-queue. Does not accept arbitrary recipient email; the server sends only the selected queue item followUpDraft.","properties":{"itemId":{"type":"string"},"operator":{"type":["string","null"],"description":"Non-secret operator or assistant label."},"subjectOverride":{"type":["string","null"],"description":"Optional reviewed subject override for personalization."},"bodyOverride":{"type":["string","null"],"description":"Optional reviewed body override for personalization."},"dryRun":{"type":"boolean","description":"When true, validate the item and return the prepared follow-up payload without sending email."}}},"CommercialFollowUpSendResult":{"type":"object","required":["ok","schema","emailPrepared","followUpSent","emailSent","providerConfigured","dryRun","reason"],"description":"Result for protected follow-up sending. Schema commercial.operator_follow_up_send.v1. Use followUpSent/emailSent/providerConfigured to decide whether to wait, retry, or hand off. The endpoint records execution events but does not automatically record recommendedActionPayload. A provider failure may return missing_resend_api_key.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_follow_up_send.v1"},"itemId":{"type":"string"},"buyerLabel":{"type":"string"},"to":{"type":"string"},"subject":{"type":"string"},"emailPrepared":{"type":"boolean"},"followUpSent":{"type":"boolean"},"emailSent":{"type":"boolean"},"providerConfigured":{"type":"boolean"},"dryRun":{"type":"boolean"},"recordActionAfterSend":{"type":["string","null"]},"executionEvent":{"type":"object"},"reason":{"type":"string"}}},"CommercialReplyIntakeRequest":{"type":"object","required":["itemId","replyText"],"description":"Request body for protected inbound reply triage. Uses itemId from /api/commercial/operator-queue. Does not accept arbitrary record endpoints, arbitrary recipients, or source workflow actions.","properties":{"itemId":{"type":"string"},"replyText":{"type":"string","description":"Pasted inbound buyer or school reply body."},"replyFrom":{"type":["string","null"],"description":"Optional From header or sender label from the inbound email."},"operator":{"type":["string","null"],"description":"Non-secret operator or assistant label."},"dryRun":{"type":"boolean","description":"When true, classify the reply without writing a Commercial Operator Execution Event."}}},"CommercialReplyDraft":{"type":"object","required":["kind","subject","body","copyText","sendRecommended","sendEndpoint","sendBody","safety"],"description":"Operator-reviewed customer reply draft generated by reply intake. reply_draft_does_not_record_workflow_action means this draft never records CRM/source state. payment_claim_requires_external_payment_evidence appears when the buyer claims payment. sendEndpoint is limited to /api/commercial/operator-send-buyer-reply and sendBody never accepts arbitrary recipient email.","properties":{"kind":{"type":"string","enum":["purchase_intent_reply","payment_request_ready_answer","payment_evidence_handoff","objection_reply_draft","competitor_alternative_answer","proof_sample_answer","asset_proof_pack_answer","acquisition_next_step_answer","acquisition_private_data_room_handoff","purchase_policy_answer","correction_request_answer","delivery_scope_answer","missing_info_ack","official_url_ack","scope_confirmation_ack","stop_request_ack","human_handoff_reply"]},"subject":{"type":"string"},"body":{"type":"string"},"copyText":{"type":"string","description":"Subject plus body, ready for human/assistant review before sending."},"sendRecommended":{"type":"boolean"},"sendEndpoint":{"type":["string","null"],"description":"Either /api/commercial/operator-send-buyer-reply or null when the reply should stay human-review only."},"sendBody":{"anyOf":[{"type":"object","required":["itemId","dryRun","operator","subjectOverride","bodyOverride"],"properties":{"itemId":{"type":"string"},"dryRun":{"type":"boolean","const":true},"operator":{"type":"string","const":"commercial_reply_intake_draft"},"subjectOverride":{"type":"string"},"bodyOverride":{"type":"string"}}},{"type":"null"}]},"safety":{"type":"array","items":{"type":"string"}}}},"CommercialReplyTriage":{"type":"object","required":["intent","confidence","recordAllowed","recordEndpoint","recordMethod","recordAction","recordBody","replyDraft","evidenceNote","nextStep","safetyChecklist","assistantInstruction"],"description":"Safe triage object for inbound replies. recordAllowed true means the returned recordEndpoint and recordBody are safe to review and submit; replyDraft gives reviewed customer-facing copy; payment_evidence_claim_requires_external_confirmation means payment provider evidence is required first.","properties":{"intent":{"type":"string","enum":["purchase_intent","post_sample_payment_request","payment_evidence_claim","price_objection","guarantee_objection","manual_invoice_question","procurement_roi_objection","competitor_alternative_question","proof_sample_request","asset_proof_pack_request","acquisition_inquiry","acquisition_private_data_room_request","refund_cancellation_question","deliverable_correction_request","missing_info_provided","official_url_provided","scope_confirmed","school_contact_provided","stop_request","delivery_question","unknown"]},"confidence":{"type":"string","enum":["low","medium","high"]},"recordAllowed":{"type":"boolean"},"recordEndpoint":{"type":["string","null"]},"recordMethod":{"type":["string","null"],"enum":["POST",null]},"recordAction":{"type":["string","null"]},"recordBody":{"anyOf":[{"type":"object"},{"type":"null"}]},"replyDraft":{"$ref":"#/components/schemas/CommercialReplyDraft"},"evidenceNote":{"type":"string"},"nextStep":{"type":"string"},"safetyChecklist":{"type":"array","items":{"type":"string"}},"assistantInstruction":{"type":"string"}}},"CommercialReplyIntakeResult":{"type":"object","required":["ok","schema","reason"],"description":"Result for protected inbound reply triage. Schema commercial.operator_reply_intake.v1. It classifies reply intent and returns a safe triage object with replyDraft. Do not record payment_confirmed from buyer email alone.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_reply_intake.v1"},"itemId":{"type":"string"},"buyerLabel":{"type":"string"},"triage":{"$ref":"#/components/schemas/CommercialReplyTriage"},"executionEvent":{"type":"object"},"reason":{"type":"string"}}},"CommercialReplyIntakeRecordRequest":{"type":"object","required":["itemId","replyText"],"description":"Request body for one-click inbound reply automation. Uses itemId from /api/commercial/operator-queue and pasted replyText. Does not accept arbitrary record endpoints or recordBody; the server regenerates the reply-intake plan before recording.","properties":{"itemId":{"type":"string"},"replyText":{"type":"string","description":"Pasted inbound buyer or school reply body."},"replyFrom":{"type":["string","null"],"description":"Optional From header or sender label from the inbound email."},"operator":{"type":["string","null"],"description":"Non-secret operator or assistant label."},"dryRun":{"type":"boolean","description":"When true, analyze and return the safe record plan without writing the source workflow."}}},"CommercialReplyIntakeRecordResult":{"type":"object","required":["ok","schema","actionRecorded","sourceResult","reason"],"description":"Result for protected one-click inbound reply automation. Schema commercial.operator_reply_intake_record.v1. Executes only the server-generated reply-intake record plan. Does not accept arbitrary record endpoints or recordBody. Will not record payment_confirmed from buyer email alone.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_reply_intake_record.v1"},"itemId":{"type":"string"},"buyerLabel":{"type":"string"},"triage":{"$ref":"#/components/schemas/CommercialReplyTriage"},"actionRecorded":{"type":"boolean"},"sourceResult":{"anyOf":[{"type":"object"},{"type":"null"}]},"executionEvent":{"type":"object"},"reason":{"type":"string"}}},"CommercialPaymentEvidenceRecordRequest":{"type":"object","required":["itemId","provider","amountJPY","evidenceNote"],"description":"Request body for protected external payment provider evidence recording. Uses itemId from /api/commercial/operator-queue. Supports Admissions Concierge and For Schools itemIds: admissions_concierge:{leadId} or for_schools:{leadId}. Does not accept arbitrary record endpoints or recordBody; the server builds the fixed payment_confirmed action after matching amount and item.","properties":{"itemId":{"type":"string"},"provider":{"type":"string","description":"External payment provider or ledger source, not buyer email or reply intake."},"providerEventId":{"type":["string","null"],"description":"Payment provider charge, invoice, checkout session, or transfer event ID."},"amountJPY":{"type":"integer","description":"Paid amount in JPY. Must match the queue item amount."},"currency":{"type":"string","const":"JPY"},"paidAt":{"type":["string","null"],"description":"External provider payment timestamp when available."},"payerEmail":{"type":["string","null"]},"paymentUrl":{"type":["string","null"],"description":"Provider dashboard or receipt URL when available."},"evidenceNote":{"type":"string","description":"Reviewed note tying provider evidence to payer, amount, and lead."},"operator":{"type":["string","null"],"description":"Non-secret operator or assistant label."},"dryRun":{"type":"boolean","description":"When true, validate evidence and return the fixed record action without writing the source workflow."}}},"CommercialPaymentEvidenceRecordResult":{"type":"object","required":["ok","schema","paymentEvidenceRecorded","actionRecorded","recordAction","sourceResult","postPaymentFulfillment","reason"],"description":"Result for protected payment evidence automation. Schema commercial.operator_payment_evidence_record.v1. Records payment_confirmed for Admissions Concierge and For Schools only from external payment provider evidence. Does not accept arbitrary record endpoints or recordBody. Will not record payment_confirmed from buyer email alone. On success, postPaymentFulfillment tells the assistant how to move into paid delivery without guessing.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_payment_evidence_record.v1"},"itemId":{"type":"string"},"buyerLabel":{"type":"string"},"paymentEvidenceRecorded":{"type":"boolean"},"actionRecorded":{"type":"boolean"},"recordAction":{"type":["string","null"],"enum":["payment_confirmed",null]},"sourceResult":{"anyOf":[{"type":"object"},{"type":"null"}]},"executionEvent":{"type":"object"},"postPaymentFulfillment":{"anyOf":[{"$ref":"#/components/schemas/CommercialPostPaymentFulfillment"},{"type":"null"}]},"reason":{"type":"string"}}},"CommercialPostPaymentFulfillment":{"type":"object","required":["schema","itemId","buyerLabel","segment","queueItemReady","expectedNextOperatorAction","sendEndpoint","subjectOverrideSource","bodyOverrideSource","recordActionAfterDelivery","fulfillmentPacket","nextStep","safetyChecklist"],"description":"Machine-readable next step after payment evidence is recorded. Schema commercial.post_payment_fulfillment.v1. Use postPaymentFulfillment after payment evidence is recorded to send the paid report or school repair packet.","properties":{"schema":{"type":"string","const":"commercial.post_payment_fulfillment.v1"},"itemId":{"type":"string"},"buyerLabel":{"type":"string"},"segment":{"type":"string","enum":["admissions_concierge","for_schools"]},"queueItemReady":{"type":"boolean","description":"True when the refreshed queue item already exposes fulfillmentPacket for the expected delivery step."},"expectedNextOperatorAction":{"type":"string","enum":["deliver_report","deliver_school_repair"]},"sendEndpoint":{"type":"string","const":"/api/commercial/operator-send-buyer-reply"},"subjectOverrideSource":{"type":"string","const":"fulfillmentPacket.title"},"bodyOverrideSource":{"type":"string","const":"fulfillmentPacket.copyText"},"recordActionAfterDelivery":{"type":"string","enum":["report_delivered","repair_delivered"]},"fulfillmentPacket":{"anyOf":[{"$ref":"#/components/schemas/CommercialFulfillmentPacket"},{"type":"null"}]},"nextStep":{"type":"string"},"safetyChecklist":{"type":"array","items":{"type":"string"}}}},"CommercialPaymentEvidenceImportRequest":{"type":"object","description":"Payment evidence import request for generic provider imports or Stripe-like webhook payloads. itemId should be present at top-level, metadata.itemId, metadata.commercialItemId, or client_reference_id. The endpoint normalizes provider evidence, amountJPY, payer email, paidAt, and evidenceNote before calling the same protected payment evidence recorder.","properties":{"itemId":{"type":["string","null"]},"provider":{"type":["string","null"],"description":"Provider label. Omit for Stripe-like events."},"providerEventId":{"type":["string","null"]},"amountJPY":{"type":["integer","null"]},"currency":{"type":["string","null"],"description":"Must normalize to JPY for recording."},"paidAt":{"type":["string","null"]},"payerEmail":{"type":["string","null"]},"paymentUrl":{"type":["string","null"]},"evidenceNote":{"type":["string","null"]},"dryRun":{"type":"boolean"},"metadata":{"type":["object","null"],"properties":{"itemId":{"type":["string","null"]},"commercialItemId":{"type":["string","null"]}}},"client_reference_id":{"type":["string","null"],"description":"Stripe Checkout alias for the commercial queue itemId."},"data":{"type":["object","null"],"description":"Stripe-like event wrapper; recognized shape is data.object."}}},"CommercialPaymentEvidenceImportResult":{"allOf":[{"$ref":"#/components/schemas/CommercialPaymentEvidenceRecordResult"}],"description":"Result from /api/commercial/operator-payment-evidence-import. The import adapter returns the same commercial.operator_payment_evidence_record.v1 result after normalizing provider evidence."},"CommercialInboundReplyRequest":{"type":"object","required":["from","text"],"description":"Request body for the provider-agnostic inbound email reply inbox. Does not store raw HTML. Use itemId when available; otherwise the server tries contactEmail matching. Manual cockpit import can POST provider manual-cockpit.","properties":{"provider":{"type":["string","null"],"description":"Email source label such as manual-cockpit, gmail, resend, or forwarder."},"messageId":{"type":["string","null"],"description":"Optional provider message ID for dedupe or audit."},"from":{"type":"string","description":"Raw From header or sender label."},"fromEmail":{"type":["string","null"],"description":"Optional normalized sender email; extracted from from when omitted."},"to":{"type":["string","null"]},"subject":{"type":["string","null"]},"text":{"type":"string","description":"Plain-text reply body. If only html is supplied, the server strips tags and stores sanitized text."},"html":{"type":["string","null"],"description":"Optional raw HTML input. The server uses it only to derive sanitized text and does not persist raw HTML."},"receivedAt":{"type":["string","null"]},"itemId":{"type":["string","null"],"description":"Queue item ID from /api/commercial/operator-queue when available."},"operator":{"type":["string","null"],"description":"Non-secret operator or assistant label."}}},"CommercialInboundEmailForwarderRequest":{"type":"object","required":["from"],"description":"Forwarder request body for real inbound mailbox automation. Supports Cloudflare Email Routing, Gmail Apps Script, Resend inbound, and generic email-forwarder payloads. Forwarders should use a dedicated inbound email secret, not the operator token. Raw HTML may be supplied as html or bodyHtml, but the endpoint stores sanitized text only.","properties":{"provider":{"type":["string","null"],"enum":["email-forwarder","cloudflare-email-routing","gmail-apps-script","resend-inbound",null]},"messageId":{"type":["string","null"]},"id":{"type":["string","null"],"description":"Provider message ID alias."},"emailId":{"type":["string","null"],"description":"Provider email ID alias."},"from":{"type":["string","null"]},"sender":{"type":["string","null"]},"envelopeFrom":{"type":["string","null"]},"fromEmail":{"type":["string","null"]},"to":{"type":["string","null"]},"recipient":{"type":["string","null"]},"envelopeTo":{"type":["string","null"]},"subject":{"type":["string","null"]},"text":{"type":["string","null"]},"bodyText":{"type":["string","null"]},"plainText":{"type":["string","null"]},"strippedText":{"type":["string","null"]},"html":{"type":["string","null"]},"bodyHtml":{"type":["string","null"]},"receivedAt":{"type":["string","null"]},"timestamp":{"type":["string","null"]},"itemId":{"type":["string","null"]},"metadata":{"type":["object","null"],"properties":{"itemId":{"type":["string","null"]}}},"headers":{"type":["object","null"],"description":"Optional normalized email headers. Recognized fields include from, to, subject, date, message-id, and messageId."}}},"CommercialInboundEmailForwarderResult":{"type":"object","required":["ok","configured","inserted","inboundReply","reason"],"description":"Result after normalizing a real inbound mailbox email into commercial.operator_inbound_reply.v1.","properties":{"ok":{"type":"boolean"},"configured":{"type":"boolean"},"inserted":{"type":"boolean"},"inboundReply":{"anyOf":[{"$ref":"#/components/schemas/CommercialInboundReply"},{"type":"null"}]},"reason":{"type":"string"}}},"CommercialInboundReply":{"type":"object","required":["schema","inboundReplyId","from","text","receivedAt","itemId","buyerLabel","matchStatus","createdAt","replyIntakeRecordReady"],"description":"Sanitized inbound email reply stored in analytics_events as commercial.operator_inbound_reply.v1. It stores sanitized text, not raw HTML.","properties":{"schema":{"type":"string","const":"commercial.operator_inbound_reply.v1"},"inboundReplyId":{"type":"string"},"provider":{"type":["string","null"]},"messageId":{"type":["string","null"]},"from":{"type":"string"},"fromEmail":{"type":["string","null"]},"to":{"type":["string","null"]},"subject":{"type":["string","null"]},"text":{"type":"string"},"receivedAt":{"type":"string"},"itemId":{"type":["string","null"]},"buyerLabel":{"type":["string","null"]},"matchStatus":{"type":"string","enum":["matched_by_item_id","matched_by_contact_email","unmatched"]},"createdAt":{"type":"string"},"replyIntakeRecordReady":{"type":"boolean"}}},"CommercialInboundReplyResult":{"type":"object","required":["ok","configured","inserted","inboundReply","reason"],"description":"Result after recording a sanitized inbound commercial reply. Schema commercial.operator_inbound_reply.v1.","properties":{"ok":{"type":"boolean"},"configured":{"type":"boolean"},"inserted":{"type":"boolean"},"inboundReply":{"anyOf":[{"$ref":"#/components/schemas/CommercialInboundReply"},{"type":"null"}]},"reason":{"type":"string"}}},"CommercialInboundRepliesResult":{"type":"object","required":["ok","schema","generatedAt","source","configured","replies"],"description":"Recent sanitized inbound commercial replies. Schema commercial.operator_inbound_replies.v1. Use matched replies with operator-reply-intake-record.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_inbound_replies.v1"},"generatedAt":{"type":"string"},"source":{"type":"string","enum":["analytics_events","none"]},"configured":{"type":"boolean"},"replies":{"type":"array","items":{"$ref":"#/components/schemas/CommercialInboundReply"}},"reason":{"type":"string"}}},"CommercialInboundAutopilotRequest":{"type":"object","description":"Request body for inbound reply autopilot. Runs exactly one matched inbound reply through reply-intake, skips matched inbound replies whose replyDraft is not sendRecommended, can use the queue-owned paymentRequestPack buyerReplyDraft for post_sample_payment_request, can record the queue-owned payment request action after emailSent=true, keeps asset_proof_pack_request, acquisition_private_data_room_request, and acquisition_inquiry as reply_intake_draft only, and does not accept recordEndpoint or recordBody from request.","properties":{"dryRun":{"type":"boolean","default":true,"description":"Defaults to dryRun=true. When false, sends the selected replySendMode; queue_buyer_reply_draft can record the queue-owned payment request action only after emailSent=true."},"recordDryRunEvent":{"type":"boolean","default":false,"description":"Optional handoff execution event for scheduled dry-runs."},"limit":{"type":"integer","minimum":1,"maximum":50,"default":20},"inboundReplyId":{"type":["string","null"]},"itemId":{"type":["string","null"]},"operator":{"type":["string","null"]}}},"CommercialInboundAutopilotSkippedReply":{"type":"object","required":["inboundReplyId","itemId","buyerLabel","intent","reason"],"description":"A matched inbound reply skipped by inbound autopilot because it was not safe or useful to send automatically.","properties":{"inboundReplyId":{"type":"string"},"itemId":{"type":["string","null"]},"buyerLabel":{"type":["string","null"]},"intent":{"type":["string","null"]},"reason":{"type":"string"}}},"CommercialInboundAutopilotAssistantHandoff":{"type":"object","required":["schema","inboundReplyId","itemId","buyerLabel","intent","replySendMode","sendEndpoint","sendRequestBody","reviewBeforeSendSource","sendAllowedNow","recordActionAfterSend","recordEndpointSource","completionCondition","acquisitionClosingPacketSource","acquisitionClosingPacketSnapshot","nextStep","safetyChecklist"],"description":"Assistant-facing handoff for commercial.operator_inbound_autopilot_assistant_handoff.v1. It turns the selected inbound reply, triage, sendResult, and recordResult into one stable next-step packet for OpenClaw/Hermes so they do not need to infer send mode or workflow recording from multiple low-level fields.","properties":{"schema":{"type":"string","const":"commercial.operator_inbound_autopilot_assistant_handoff.v1"},"inboundReplyId":{"type":"string"},"itemId":{"type":"string"},"buyerLabel":{"type":["string","null"]},"intent":{"type":"string"},"replySendMode":{"type":"string","enum":["reply_intake_draft","queue_buyer_reply_draft"]},"sendEndpoint":{"type":"string","const":"/api/commercial/operator-inbound-autopilot"},"sendRequestBody":{"type":"object","required":["dryRun","inboundReplyId","itemId","operator"],"properties":{"dryRun":{"type":"boolean","const":false},"inboundReplyId":{"type":"string"},"itemId":{"type":"string"},"operator":{"type":"string","const":"commercial_operator_inbound_autopilot"}}},"reviewBeforeSendSource":{"type":"string","enum":["triage.replyDraft.copyText","queue.paymentRequestPack.buyerReplyDraft"]},"sendAllowedNow":{"type":"boolean"},"recordActionAfterSend":{"type":["string","null"]},"recordEndpointSource":{"type":["string","null"],"enum":["queue.recommendedActionPayload.endpoint",null]},"completionCondition":{"type":"string","enum":["emailSent=true","emailSent=true_and_recordResult.ok=true"]},"acquisitionClosingPacketSource":{"type":["string","null"],"enum":["queue.acquisitionClosingPacket",null],"description":"Present only for acquisition buyer replies when the selected queue work item has acquisitionClosingPacket."},"acquisitionClosingPacketSnapshot":{"anyOf":[{"type":"object","required":["schema","selectedProofPack","ndaGate","assistantSendMode","humanReviewRequired","privateDataRoomBoundary","assistantNextSteps","safetyChecklist"],"properties":{"schema":{"type":"string","const":"commercial.acquisition_closing_packet.v1"},"selectedProofPack":{"type":"object","required":["value","label","publicProofUrl","buyerQuestion"],"properties":{"value":{"type":"string"},"label":{"type":"string"},"publicProofUrl":{"type":"string"},"buyerQuestion":{"type":"string"}}},"ndaGate":{"type":"string"},"assistantSendMode":{"type":"string","description":"Usually send_selected_public_proof_pack_before_private_data."},"humanReviewRequired":{"type":"boolean"},"privateDataRoomBoundary":{"type":"string","description":"Includes private_data_room_requires_human_review when private data is requested."},"assistantNextSteps":{"type":"array","items":{"type":"string"}},"safetyChecklist":{"type":"array","items":{"type":"string"}}}},{"type":"null"}]},"nextStep":{"type":"string"},"safetyChecklist":{"type":"array","items":{"type":"string"}}}},"CommercialInboundAutopilotRunResult":{"type":"object","required":["ok","schema","generatedAt","dryRun","selected","selectedInboundReply","skippedInboundReplies","triage","replySendMode","sendResult","recordResult","executionEvent","assistantHandoff","reason","safety"],"description":"Result for commercial.operator_inbound_autopilot_run.v1. Runs exactly one matched inbound reply through reply-intake, reports skippedInboundReplies for non-sendable matched replies, prepares or sends the selected replySendMode, and returns assistantHandoff plus recordResult. post_sample_payment_request can use the queue-owned paymentRequestPack buyerReplyDraft and record the queue-owned payment request action only after emailSent=true. asset_proof_pack_request, acquisition_private_data_room_request, and acquisition_inquiry stay reply_intake_draft only and never record valuation, deal state, or workflow action from inbound handling.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_inbound_autopilot_run.v1"},"generatedAt":{"type":"string"},"dryRun":{"type":"boolean"},"selected":{"type":"boolean"},"selectedInboundReply":{"anyOf":[{"$ref":"#/components/schemas/CommercialInboundReply"},{"type":"null"}]},"skippedInboundReplies":{"type":"array","items":{"$ref":"#/components/schemas/CommercialInboundAutopilotSkippedReply"}},"triage":{"anyOf":[{"$ref":"#/components/schemas/CommercialReplyTriage"},{"type":"null"}]},"replySendMode":{"type":["string","null"],"enum":["reply_intake_draft","queue_buyer_reply_draft",null],"description":"reply_intake_draft uses the generated reply-intake draft. asset_proof_pack_request, acquisition_private_data_room_request, and acquisition_inquiry stay reply_intake_draft only and never record valuation, deal state, or workflow action from inbound handling. queue_buyer_reply_draft uses the queue-owned buyerReplyDraft, including paymentRequestPack for post_sample_payment_request when payment is ready."},"sendResult":{"anyOf":[{"$ref":"#/components/schemas/CommercialBuyerReplySendResult"},{"type":"null"}]},"recordResult":{"anyOf":[{"type":"object","properties":{"ok":{"type":"boolean"},"endpoint":{"type":["string","null"]},"status":{"type":["integer","null"]},"action":{"type":["string","null"]},"reason":{"type":"string"},"response":{}}},{"type":"null"}]},"assistantHandoff":{"anyOf":[{"$ref":"#/components/schemas/CommercialInboundAutopilotAssistantHandoff"},{"type":"null"}]},"executionEvent":{"anyOf":[{"type":"object"},{"type":"null"}]},"reason":{"type":"string"},"safety":{"type":"array","items":{"type":"string"}}}},"CommercialInboundAutopilotCronResult":{"type":"object","required":["ok","schema","generatedAt","mode","dryRun","schedule","inboundAutopilot","reason"],"description":"3060 local cron wrapper for Commercial Inbound Autopilot. Schema commercial.operator_inbound_autopilot_cron.v1. Defaults to dry-run unless COMMERCIAL_OPERATOR_INBOUND_AUTOPILOT_MODE=send is configured server-side. Cron dry-runs persist a handoff execution event when a matched reply is selected. Protected by CRON_SECRET.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_inbound_autopilot_cron.v1"},"generatedAt":{"type":"string"},"mode":{"type":"string"},"dryRun":{"type":"boolean"},"schedule":{"type":"string"},"inboundAutopilot":{"$ref":"#/components/schemas/CommercialInboundAutopilotRunResult"},"reason":{"type":"string"}}},"CommercialOperatorExecutionEvents":{"type":"object","required":["ok","schema","generatedAt","source","configured","events"],"description":"Recent execution events for the Commercial Operator Cockpit. Execution events preserve success, failure, and human handoff results across browser sessions.","properties":{"ok":{"type":"boolean"},"schema":{"type":"string","const":"commercial.operator_execution_events.v1"},"generatedAt":{"type":"string"},"source":{"type":"string","enum":["analytics_events","none"]},"configured":{"type":"boolean"},"events":{"type":"array","items":{"$ref":"#/components/schemas/CommercialOperatorExecutionEvent"}},"reason":{"type":"string"}}},"CommercialOperatorExecutionEventRequest":{"type":"object","required":["itemId","buyerLabel","status","summary","detail","nextStep"],"description":"Post an execution event after every recommendedActionPayload attempt. Include enough detail for a human operator or assistant to decide whether to refresh, retry, wait, or hand off.","properties":{"eventId":{"type":"string"},"itemId":{"type":"string"},"buyerLabel":{"type":"string"},"recordAction":{"type":["string","null"]},"status":{"type":"string","enum":["success","failed","handoff"]},"summary":{"type":"string"},"detail":{"type":"string"},"retryEndpoint":{"type":["string","null"]},"nextStep":{"type":"string"},"operator":{"type":["string","null"]},"createdAt":{"type":"string"}}},"CommercialOperatorExecutionEvent":{"allOf":[{"$ref":"#/components/schemas/CommercialOperatorExecutionEventRequest"},{"type":"object","required":["schema","eventId","createdAt"],"properties":{"schema":{"type":"string","const":"commercial.operator_execution_event.v1"},"eventId":{"type":"string"},"createdAt":{"type":"string"}}}]},"CommercialLeadQueue":{"type":"object","description":"Assistant-level view of all commercial queues.","properties":{"admissionsConcierge":{"type":"array","items":{"$ref":"#/components/schemas/AdmissionsConciergeLead"}},"forSchools":{"type":"array","items":{"$ref":"#/components/schemas/ForSchoolsLead"}},"schoolOutreach":{"type":"array","items":{"$ref":"#/components/schemas/SchoolOutreachProspect"}}}},"AdmissionsConciergeLead":{"type":"object","required":["leadId","email","concern","recommendedOffer","nextOperatorAction"],"properties":{"leadId":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":"string"},"concern":{"type":"string"},"recommendedOffer":{"type":"string"},"assistantReplyDrafts":{"type":"array","items":{"$ref":"#/components/schemas/AssistantReplyDraft"}},"tonightDecisionPack":{"$ref":"#/components/schemas/TonightDecisionPack"},"parentPurchaseApprovalPack":{"$ref":"#/components/schemas/ParentPurchaseApprovalPack"},"paymentRequestPack":{"$ref":"#/components/schemas/PaymentRequestPack"},"paymentStatus":{"type":"string","enum":["not_requested","payment_link_ready","invoice_sent","paid","refunded"]},"dealStatus":{"type":"string","enum":["new","needs_info","qualified","payment_pending","paid","fulfilled","closed"]},"nextOperatorAction":{"type":"string","enum":["send_first_reply","request_missing_info","send_payment_nudge","watch_payment","deliver_report","post_report_growth","none"]},"latestOperatorAction":{"$ref":"#/components/schemas/OperatorActionRecord"}}},"ForSchoolsLead":{"type":"object","required":["leadId","schoolName","email","currentIssue","recommendedPackage","nextOperatorAction"],"properties":{"leadId":{"type":"string"},"schoolName":{"type":"string"},"contactName":{"type":"string"},"email":{"type":"string","format":"email"},"websiteUrl":{"type":["string","null"]},"currentIssue":{"type":"string"},"recommendedPackage":{"type":"string"},"amountJPY":{"type":"integer"},"schoolReplyPack":{"$ref":"#/components/schemas/SchoolReplyPack"},"surfaceDiagnosisPack":{"$ref":"#/components/schemas/SurfaceDiagnosisPack"},"paymentRequestPack":{"$ref":"#/components/schemas/PaymentRequestPack"},"operatorReplyPacket":{"type":"string"},"paymentStatus":{"type":"string","enum":["not_requested","payment_link_ready","invoice_sent","paid","refunded"]},"nextOperatorAction":{"type":"string","enum":["send_school_reply","request_official_url","prepare_scope_confirmation","send_payment_request","watch_payment","deliver_school_repair","none"]},"latestOperatorAction":{"$ref":"#/components/schemas/OperatorActionRecord"}}},"SchoolOutreachProspect":{"type":"object","required":["prospectId","schoolName","contactEmail","contactRoutePack","commercialScore","nextOperatorAction"],"properties":{"prospectId":{"type":"string"},"schoolName":{"type":"string"},"prefecture":{"type":"string"},"schoolType":{"type":"string"},"surfaceUrl":{"type":"string"},"contactSearchUrl":{"type":"string"},"contactEmail":{"type":["string","null"]},"contactRoutePack":{"$ref":"#/components/schemas/SchoolOutreachContactRoutePack"},"commercialScore":{"type":"integer","minimum":0,"maximum":100},"riskLabel":{"type":"string"},"riskSummary":{"type":"string"},"recommendedPackage":{"type":"string"},"outreachSubject":{"type":"string"},"outreachBody":{"type":"string"},"outreachMailto":{"type":"string"},"operatorOutreachPacket":{"type":"string"},"pipelineStage":{"type":"string","enum":["new_target","contact_found","outreach_sent","replied","closed_lost"]},"nextOperatorAction":{"type":"string","enum":["find_contact_route","send_outreach","wait_for_reply","convert_reply_to_lead","none"]}}},"SchoolOutreachContactRoutePack":{"type":"object","required":["schema","contactSearchUrl","contactUrl","contactEmail","officialContactEvidenceRequired","recordEndpoint","recordAction","assistantInstruction","guardrails"],"properties":{"schema":{"type":"string","const":"for_schools.outreach_contact_route_pack.v1"},"contactSearchUrl":{"type":"string"},"contactUrl":{"type":["string","null"]},"contactEmail":{"type":["string","null"]},"officialContactEvidenceRequired":{"type":"array","items":{"type":"string"}},"recordEndpoint":{"type":"string","const":"/api/for-schools/operator-outreach-actions"},"recordAction":{"type":"string","const":"contact_route_found"},"assistantInstruction":{"type":"string"},"guardrails":{"type":"array","items":{"type":"string"}}}},"AssistantReplyDraft":{"type":"object","properties":{"kind":{"type":"string","enum":["first_reply","parent_summary","payment_nudge","missing_info_question"]},"subject":{"type":"string"},"body":{"type":"string"},"whenToUse":{"type":"string"},"nextDealStatus":{"type":"string"}}},"TonightDecisionPack":{"type":"object","required":["schema","primaryCandidate","safetyCandidate","tonightOfficialPages","discardRule"],"properties":{"schema":{"type":"string","const":"admissions_concierge.tonight_decision_pack.v1"},"decisionMode":{"type":"string"},"candidateSchools":{"type":"array","items":{"type":"string"}},"primaryCandidate":{"type":"string"},"safetyCandidate":{"type":"string"},"tonightOfficialPages":{"type":"array","items":{"type":"string"}},"discardRule":{"type":"string"},"parentMemoLine":{"type":"string"},"firstQuestion":{"type":"string"},"paidReportSections":{"type":"array","items":{"type":"string"}},"assistantOpeningLine":{"type":"string"}}},"SchoolReplyPack":{"type":"object","required":["schema","subject","body","packageName","amountJPY","purchaseReplyText"],"properties":{"schema":{"type":"string","const":"for_schools.lead_reply_pack.v1"},"subject":{"type":"string"},"body":{"type":"string"},"packageName":{"type":"string"},"amountJPY":{"type":"integer"},"nextSchoolAction":{"type":"string"},"purchaseReplyText":{"type":"string"},"riskBoundaries":{"type":"array","items":{"type":"string"}},"repairGuaranteePromise":{"type":"array","items":{"type":"string"},"description":"For Schools 48-hour repair guarantee. Procurement risk reversal only; not a ranking, inquiry-volume, or admission guarantee."}}},"SurfaceDiagnosisPack":{"type":"object","required":["schema","exposureRisk","riskLabel","riskSummary","firstOfficialUrlRequest"],"properties":{"schema":{"type":"string","const":"for_schools.surface_diagnosis_pack.v1"},"exposureRisk":{"type":"string","enum":["official_url_missing","open_campus_bridge_missing","ai_answer_stale","comparison_context_missing"]},"riskLabel":{"type":"string"},"riskSummary":{"type":"string"},"firstOfficialUrlRequest":{"type":"string"},"recommendedRepair":{"type":"string"},"paidDeliverables":{"type":"array","items":{"type":"string"}},"assistantOpeningLine":{"type":"string"}}},"PaymentRequestPack":{"type":"object","required":["schema","leadId","amountJPY","purchasePolicyUrl","paymentMode","paymentInstruction","confirmationText"],"description":"Payment request packet for admissions_concierge.payment_request_pack.v1 or for_schools.payment_request_pack.v1. Use manual_invoice when no direct payment URL is configured.","properties":{"schema":{"type":"string","enum":["admissions_concierge.payment_request_pack.v1","for_schools.payment_request_pack.v1"]},"leadId":{"type":"string"},"offerName":{"type":"string"},"packageName":{"type":"string"},"amountJPY":{"type":"integer"},"paymentUrl":{"type":["string","null"]},"purchasePolicyUrl":{"type":"string","format":"uri","description":"Public purchase policy URL to include before asking for payment."},"paymentMode":{"type":"string","enum":["direct_url","manual_invoice"]},"paymentActionLabel":{"type":"string"},"paymentInstruction":{"type":"string"},"confirmationText":{"type":"string"},"scopeSummary":{"type":"string"},"repairGuaranteePromise":{"type":"array","items":{"type":"string"},"description":"For Schools 48-hour repair guarantee when schema is for_schools.payment_request_pack.v1."}}},"ParentPurchaseApprovalPack":{"type":"object","required":["schema","leadId","offerName","amountJPY","parentApprovalMemo","familyDecisionQuestion","budgetBoundary","nextReplyText","assistantClosingChecklist"],"description":"B2C parent purchase approval packet for admissions_concierge.parent_purchase_approval_pack.v1. Use it before paymentRequestPack when the buyer needs family approval.","properties":{"schema":{"type":"string","const":"admissions_concierge.parent_purchase_approval_pack.v1"},"leadId":{"type":"string"},"offerName":{"type":"string"},"amountJPY":{"type":"integer"},"parentApprovalMemo":{"type":"string"},"familyDecisionQuestion":{"type":"string"},"budgetBoundary":{"type":"string"},"nextReplyText":{"type":"string"},"assistantClosingChecklist":{"type":"array","items":{"type":"string"}}}},"AdmissionsOperatorActionRequest":{"type":"object","required":["leadId","action"],"properties":{"leadId":{"type":"string"},"action":{"type":"string","enum":["first_reply_sent","missing_info_sent","payment_requested","payment_confirmed","report_delivered","post_report_follow_up_sent","closed_lost"]},"draftKind":{"type":"string","enum":["first_reply","parent_summary","payment_nudge","missing_info_question"]},"operator":{"type":"string","description":"Non-secret operator or assistant label."},"note":{"type":"string","maxLength":1000},"nextDealStatus":{"type":"string"},"paymentStatus":{"type":"string"}}},"SchoolOperatorActionRequest":{"type":"object","required":["leadId","action"],"properties":{"leadId":{"type":"string"},"action":{"type":"string","enum":["school_reply_sent","official_url_requested","scope_confirmed","payment_request_sent","payment_confirmed","repair_delivered","closed_lost"]},"operator":{"type":"string","description":"Non-secret operator or assistant label."},"note":{"type":"string","maxLength":1000}}},"SchoolOutreachActionRequest":{"type":"object","required":["prospectId","action"],"properties":{"prospectId":{"type":"string"},"action":{"type":"string","enum":["contact_route_found","outreach_sent","school_replied","closed_lost"]},"operator":{"type":"string","description":"Non-secret operator or assistant label."},"note":{"type":"string","maxLength":1000},"contactUrl":{"type":"string"},"replyLeadId":{"type":"string"}}},"SchoolProspectLeadConversionRequest":{"type":"object","required":["prospectId","contactName","email"],"properties":{"prospectId":{"type":"string"},"contactName":{"type":"string"},"email":{"type":"string","format":"email"},"role":{"type":["string","null"]},"replyNote":{"type":["string","null"],"maxLength":1200},"contactUrl":{"type":["string","null"]},"operator":{"type":["string","null"],"description":"Non-secret operator or assistant label."}}},"SchoolProspectLeadConversionResult":{"type":"object","properties":{"ok":{"type":"boolean"},"converted":{"type":"boolean"},"convertedLeadId":{"type":"string"},"schoolReplyPack":{"$ref":"#/components/schemas/SchoolReplyPack"},"surfaceDiagnosisPack":{"$ref":"#/components/schemas/SurfaceDiagnosisPack"},"paymentRequestPack":{"$ref":"#/components/schemas/PaymentRequestPack"},"conversionPacket":{"type":"string"}}},"OperatorActionRecord":{"type":"object","properties":{"action":{"type":"string","enum":["first_reply_sent","missing_info_sent","payment_requested","payment_confirmed","report_delivered","post_report_follow_up_sent","closed_lost","school_reply_sent","official_url_requested","scope_confirmed","payment_request_sent","payment_confirmed","repair_delivered","closed_lost","contact_route_found","outreach_sent","school_replied","closed_lost"]},"operator":{"type":["string","null"]},"note":{"type":["string","null"]},"createdAt":{"type":["string","null"]}}},"OperatorActionResult":{"type":"object","properties":{"ok":{"type":"boolean"},"configured":{"type":"boolean"},"actionLogged":{"type":"boolean"},"outreachActionLogged":{"type":"boolean"},"leadId":{"type":"string"},"prospectId":{"type":"string"},"action":{"type":"string","enum":["first_reply_sent","missing_info_sent","payment_requested","payment_confirmed","report_delivered","post_report_follow_up_sent","closed_lost","school_reply_sent","official_url_requested","scope_confirmed","payment_request_sent","payment_confirmed","repair_delivered","closed_lost","contact_route_found","outreach_sent","school_replied","closed_lost"]},"reason":{"type":"string"}}}}}}