@sailsync/mcp 0.0.0-stage → 0.6.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -2
- package/dist/sailsync-mcp.cjs +215 -0
- package/package.json +18 -4
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// Subscriber stdio MCP -> subscriber HTTP API bridge. Requires Node 22; no SDK or
|
|
5
|
+
// browser cookies. Credentials stay in the environment, never tool arguments.
|
|
6
|
+
const fs = require('node:fs');
|
|
7
|
+
const path = require('node:path');
|
|
8
|
+
const readline = require('node:readline');
|
|
9
|
+
|
|
10
|
+
const MAX_BYTES = 2 * 1024 * 1024;
|
|
11
|
+
const VERSIONS = ['2025-11-25', '2025-06-18', '2025-03-26'];
|
|
12
|
+
const spec = {"openapi":"3.0.3","info":{"title":"SailSync subscriber API","version":"0.6.11","description":"Read sailing sessions, GPS, wind and saved race analysis, or connect an agent through MCP. Available on Standard, Racer and Gold with tiered account-wide data limits. Use a personal API token; write actions require extra permissions. See the [quickstart](/quickstart.html) and [agent recipes](/agents.html)."},"servers":[{"url":"https://www.sailsync.io","description":"Production — use a production-issued personal token"}],"security":[{"integrationToken":[]}],"paths":{"/api/integrations/v1/me":{"get":{"operationId":"getSailSyncAccount","summary":"Read current subscriber identity and implemented capabilities","parameters":[],"responses":{"200":{"description":"Current subscriber user ID, token scopes and implemented capabilities","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriberAccount"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"schema_version":"subscriber_api_v1","user_id":603,"plan":"gold","scopes":["data:read","sessions:write"],"capabilities":["account.read","sessions.owned.list","sessions.owned.read","tracks.owned.gps","events.public.list","events.public.read","event_days.access.read","sessions.accessible.read","tracks.accessible.gps","wind.read","analysis.catalog","analysis.facts","analysis.results","analysis.starts","analysis.lineups"],"compute_available":false,"imports_available":false,"flo_available":false,"limits":{"max_page_size":100,"data_minute":60,"data_hour":1200,"data_day":4800,"account_concurrency":4}}}}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"authentication_required"}}}}}},"403":{"description":"Authentication, eligibility, rollout or shared rate-limit error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"subscription_required"}}}}}},"404":{"description":"Authentication, eligibility, rollout or shared rate-limit error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_available"}}}}}},"429":{"description":"Authentication, eligibility, rollout or shared rate-limit error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"rate_limited"}}}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Authentication, eligibility, rollout or shared rate-limit error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"rate_limit_unavailable"}}}}}}},"tags":["Account"],"description":"Read your plan, token permissions and available capabilities."}},"/api/integrations/v1/sessions":{"get":{"operationId":"listOwnedSailSyncSessions","summary":"List sessions owned by this subscriber","description":"List your owned sessions, newest first. Date filters select sessions overlapping the requested window.","parameters":[{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"before_id","in":"query","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"boat_class","in":"query","schema":{"type":"string","minLength":1,"maxLength":80}},{"name":"from","in":"query","schema":{"type":"string","format":"date-time","maxLength":40}},{"name":"to","in":"query","schema":{"type":"string","format":"date-time","maxLength":40}}],"responses":{"200":{"description":"sessions array (id, name, class, session/effective UTC windows, first race number, track count), next_before_id cursor; no sharing credentials","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OwnedSessionPage"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"schema_version":"subscriber_sessions_v1","sessions":[{"id":364,"name":"Second","boat_class":"ILCA 6","start_time":"2026-10-23T05:00:00-07:00","end_time":"2026-10-23T06:00:00-07:00","effective_start_time":null,"effective_end_time":null,"first_race_number":1,"track_count":0}],"next_before_id":364}}}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription or required scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"The resource is unavailable or subscriber integrations are disabled.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid pagination or date/class filter","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"invalid_filter"}}}}}},"429":{"description":"Shared account quota exceeded; Retry-After header","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Shared limiter unavailable; fail closed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]},"post":{"operationId":"createOwnedSailSyncSession","summary":"Create an owned session with explicit UTC bounds and timezone","description":"Requires sessions:write. Create an owned session lasting up to 24 hours. Use UTC ISO8601 start/end times and a named timezone. Automatic race detection is off.","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":80,"pattern":"^[A-Za-z0-9_-]{8,80}$"}}],"responses":{"200":{"description":"Completed receipt or current state. Retry uses the same key and returns the original result.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"receipt_id":78,"operation":"session","initiator_user_id":600,"source_sha256":null,"result":{"completed":true,"session_id":345,"wind_version":"6cd8cec706fa11110d83fb46f97df1f9be43b4c570f3390e7c7f6a5173f595e6"}}}},"schema":{"$ref":"#/components/schemas/SessionImportReceipt"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Subscription, scope or boat limit denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Idempotency/version conflict or original result removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"idempotency_conflict"}}}}}},"413":{"description":"Input too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid input; safe code and optional numeric row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared account/service budget exhausted; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"rate_limited","budget":"output_hour","limit":1,"remaining":1,"reset_at":1793150286,"retry_after":3600}}}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; keep the original idempotency key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"name":{"type":"string","minLength":1,"maxLength":200},"boat_class":{"type":"string","minLength":1,"maxLength":80},"start_time":{"type":"string","minLength":1,"maxLength":40},"end_time":{"type":"string","minLength":1,"maxLength":40},"timezone":{"type":"string","minLength":1,"maxLength":80},"batch_reference":{"type":"string","minLength":1,"maxLength":80}},"required":["name","boat_class","start_time","end_time","timezone"]}}}},"tags":["Imports"]}},"/api/integrations/v1/sessions/{session_id}/tracks/{id}/points":{"get":{"operationId":"getOwnedSailSyncGpsPoints","summary":"Read full-resolution committed GPS within an owned session window","description":"Read committed boat positions within the session window. Timestamps already include the track offset. Follow next_cursor; restart the current track if its source changes.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":5000}},{"name":"cursor","in":"query","schema":{"type":"string","maxLength":2048}}],"responses":{"200":{"description":"available, window, full-resolution normalized GPS points, authorized point_count, source_ref, next_cursor","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"available":true,"session_id":385,"session_track_id":163,"resolution":"committed_full_resolution_gps","source_ref":"5341e104981e0b019a4200cff00ae797c877810318bf63603910043fb28c869c","time_basis":"session_epoch_seconds_with_track_offset","time_offset":7,"window":{"start":5000,"end":15000},"point_count":10001,"points":[{"time_epoch":5000,"lat":45,"lng":-71},{"time_epoch":5001,"lat":45,"lng":-71},{"time_epoch":5002,"lat":45,"lng":-71},{"time_epoch":5003,"lat":45,"lng":-71},{"time_epoch":5004,"lat":45,"lng":-71},{"time_epoch":5005,"lat":45,"lng":-71},{"time_epoch":5006,"lat":45,"lng":-71},{"time_epoch":5007,"lat":45,"lng":-71},{"time_epoch":5008,"lat":45,"lng":-71},{"time_epoch":5009,"lat":45,"lng":-71},{"time_epoch":5010,"lat":45,"lng":-71},{"time_epoch":5011,"lat":45,"lng":-71},{"time_epoch":5012,"lat":45,"lng":-71},{"time_epoch":5013,"lat":45,"lng":-71},{"time_epoch":5014,"lat":45,"lng":-71},{"time_epoch":5015,"lat":45,"lng":-71},{"time_epoch":5016,"lat":45,"lng":-71},{"time_epoch":5017,"lat":45,"lng":-71},{"time_epoch":5018,"lat":45,"lng":-71},{"time_epoch":5019,"lat":45,"lng":-71},{"time_epoch":5020,"lat":45,"lng":-71},{"time_epoch":5021,"lat":45,"lng":-71},{"time_epoch":5022,"lat":45,"lng":-71},{"time_epoch":5023,"lat":45,"lng":-71},{"time_epoch":5024,"lat":45,"lng":-71},{"time_epoch":5025,"lat":45,"lng":-71},{"time_epoch":5026,"lat":45,"lng":-71},{"time_epoch":5027,"lat":45,"lng":-71},{"time_epoch":5028,"lat":45,"lng":-71},{"time_epoch":5029,"lat":45,"lng":-71},{"time_epoch":5030,"lat":45,"lng":-71},{"time_epoch":5031,"lat":45,"lng":-71},{"time_epoch":5032,"lat":45,"lng":-71},{"time_epoch":5033,"lat":45,"lng":-71},{"time_epoch":5034,"lat":45,"lng":-71},{"time_epoch":5035,"lat":45,"lng":-71},{"time_epoch":5036,"lat":45,"lng":-71},{"time_epoch":5037,"lat":45,"lng":-71},{"time_epoch":5038,"lat":45,"lng":-71},{"time_epoch":5039,"lat":45,"lng":-71},{"time_epoch":5040,"lat":45,"lng":-71},{"time_epoch":5041,"lat":45,"lng":-71},{"time_epoch":5042,"lat":45,"lng":-71},{"time_epoch":5043,"lat":45,"lng":-71},{"time_epoch":5044,"lat":45,"lng":-71},{"time_epoch":5045,"lat":45,"lng":-71},{"time_epoch":5046,"lat":45,"lng":-71},{"time_epoch":5047,"lat":45,"lng":-71},{"time_epoch":5048,"lat":45,"lng":-71},{"time_epoch":5049,"lat":45,"lng":-71},{"time_epoch":5050,"lat":45,"lng":-71},{"time_epoch":5051,"lat":45,"lng":-71},{"time_epoch":5052,"lat":45,"lng":-71},{"time_epoch":5053,"lat":45,"lng":-71},{"time_epoch":5054,"lat":45,"lng":-71},{"time_epoch":5055,"lat":45,"lng":-71},{"time_epoch":5056,"lat":45,"lng":-71},{"time_epoch":5057,"lat":45,"lng":-71},{"time_epoch":5058,"lat":45,"lng":-71},{"time_epoch":5059,"lat":45,"lng":-71},{"time_epoch":5060,"lat":45,"lng":-71},{"time_epoch":5061,"lat":45,"lng":-71},{"time_epoch":5062,"lat":45,"lng":-71},{"time_epoch":5063,"lat":45,"lng":-71},{"time_epoch":5064,"lat":45,"lng":-71},{"time_epoch":5065,"lat":45,"lng":-71},{"time_epoch":5066,"lat":45,"lng":-71},{"time_epoch":5067,"lat":45,"lng":-71},{"time_epoch":5068,"lat":45,"lng":-71},{"time_epoch":5069,"lat":45,"lng":-71},{"time_epoch":5070,"lat":45,"lng":-71},{"time_epoch":5071,"lat":45,"lng":-71},{"time_epoch":5072,"lat":45,"lng":-71},{"time_epoch":5073,"lat":45,"lng":-71},{"time_epoch":5074,"lat":45,"lng":-71},{"time_epoch":5075,"lat":45,"lng":-71},{"time_epoch":5076,"lat":45,"lng":-71},{"time_epoch":5077,"lat":45,"lng":-71},{"time_epoch":5078,"lat":45,"lng":-71},{"time_epoch":5079,"lat":45,"lng":-71},{"time_epoch":5080,"lat":45,"lng":-71},{"time_epoch":5081,"lat":45,"lng":-71},{"time_epoch":5082,"lat":45,"lng":-71},{"time_epoch":5083,"lat":45,"lng":-71},{"time_epoch":5084,"lat":45,"lng":-71},{"time_epoch":5085,"lat":45,"lng":-71},{"time_epoch":5086,"lat":45,"lng":-71},{"time_epoch":5087,"lat":45,"lng":-71},{"time_epoch":5088,"lat":45,"lng":-71},{"time_epoch":5089,"lat":45,"lng":-71},{"time_epoch":5090,"lat":45,"lng":-71},{"time_epoch":5091,"lat":45,"lng":-71},{"time_epoch":5092,"lat":45,"lng":-71},{"time_epoch":5093,"lat":45,"lng":-71},{"time_epoch":5094,"lat":45,"lng":-71},{"time_epoch":5095,"lat":45,"lng":-71},{"time_epoch":5096,"lat":45,"lng":-71},{"time_epoch":5097,"lat":45,"lng":-71},{"time_epoch":5098,"lat":45,"lng":-71},{"time_epoch":5099,"lat":45,"lng":-71}],"next_cursor":"EXAMPLE_CURSOR_REPLACE_WITH_CURRENT_RESPONSE"}}},"schema":{"$ref":"#/components/schemas/GpsPage"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Current subscription or required token scope is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Session or boat track missing or not owned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_found"}}}}}},"409":{"description":"Source unavailable/changed; unavailable reason or restart paging","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/UnavailableGps"},{"$ref":"#/components/schemas/IntegrationError"}]},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"source_changed_restart_paging"}}}}}},"422":{"description":"Invalid page/cursor","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"invalid_page"}}}}}},"429":{"description":"Shared account read or data-read limit exceeded; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"rate_limited","budget":"upstream_hour","limit":2606832,"remaining":0,"reset_at":1793150290,"retry_after":3600}}}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]}},"/api/integrations/v1/sessions/{id}":{"get":{"operationId":"getOwnedSailSyncSession","summary":"Read safe owned-session metadata and discover track IDs","description":"Read session details and paginated track IDs. gps_supported identifies a supported source type; use the points endpoint to check data availability.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"before_track_id","in":"query","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Safe session metadata, tracks, next_before_track_id","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"schema_version":"subscriber_session_v1","session":{"id":346,"name":"Afternoon training","boat_class":"ILCA 6","first_race_number":1,"start_time":"2026-10-21T03:00:00-07:00","end_time":"2026-10-21T09:00:00-07:00"},"tracks":[{"session_track_id":149,"manual_track_id":125,"points_sha256":"2b3b1e0eeeacbafa87018a45571c4ea148057f9d9e8610aa27995785098b04ce","data_revision":1,"name":"Example Sailor","type":"boat","time_offset":0,"sailing_window":[1792576800,1792576810],"gps_supported":true}],"next_before_track_id":null}}},"schema":{"$ref":"#/components/schemas/OwnedSessionResponse"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Current subscription or required token scope is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Not owned or not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_found"}}}}}},"422":{"description":"Invalid page","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared account, service, rate or cost budget exceeded. Honor Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]}},"/api/integrations/v1/events":{"get":{"operationId":"listSailSyncEvents","summary":"Discover public events","description":"Discover public events. Follow next_page for more results.","parameters":[{"name":"q","in":"query","schema":{"type":"string","maxLength":120}},{"name":"boat_class","in":"query","schema":{"type":"string","maxLength":80}},{"name":"date_from","in":"query","schema":{"type":"string","maxLength":10}},{"name":"date_to","in":"query","schema":{"type":"string","maxLength":10}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"maximum":10000}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"events":[{"id":15,"title":"2026 ILCA 6 Worlds Dublin Ireland Race Reports","starts_on":"2026-09-07","ends_on":"2026-09-12","timezone":"Europe/Dublin","location":"National Yacht Club","description":"EMAIL: contact@sailsync.ai if you have any questions or issues.\n\nFind us on Instagram at @ilca.sailsync for highlights and reels!\n\nAccess AI-powered performance reports for each race (unofficial) below! \n\nPurchase includes:\n- Customized AI report\n- Access to 3D race replay on SailSync Web\n- Access to FLO AI chats about your sailing\n\nGeneral day reports are free and unlimited for this existing event. Customized reports remain separately available under the existing purchase terms.\n\nCustom reports are personalized to the sailor of your choice.\n\n** DTL-at-go is an estimate based on telemetry, NOT official RaceSense OCS data. **\n\nData: Vakaros RaceSense","boat_classes":["ILCA 6"]}],"page":1,"next_page":null,"total":1}}},"schema":{"$ref":"#/components/schemas/EventPage"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Events"]}},"/api/integrations/v1/events/{id}":{"get":{"operationId":"getSailSyncEvent","summary":"Read public event day/fleet/session assignments","description":"Read an event and its day/fleet sessions. Follow next_after_assignment_id for more sessions.","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"after_assignment_id","in":"query","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"event":{"id":15,"title":"2026 ILCA 6 Worlds Dublin Ireland Race Reports","starts_on":"2026-09-07","ends_on":"2026-09-12","timezone":"Europe/Dublin","location":"National Yacht Club","description":"EMAIL: contact@sailsync.ai if you have any questions or issues.\n\nFind us on Instagram at @ilca.sailsync for highlights and reels!\n\nAccess AI-powered performance reports for each race (unofficial) below! \n\nPurchase includes:\n- Customized AI report\n- Access to 3D race replay on SailSync Web\n- Access to FLO AI chats about your sailing\n\nGeneral day reports are free and unlimited for this existing event. Customized reports remain separately available under the existing purchase terms.\n\nCustom reports are personalized to the sailor of your choice.\n\n** DTL-at-go is an estimate based on telemetry, NOT official RaceSense OCS data. **\n\nData: Vakaros RaceSense","boat_classes":["ILCA 6"]},"sessions":[{"assignment_id":100,"session_id":3347,"date":"2026-09-07","division":"Blue","boat_class":"ILCA 6","races":[{"id":"6703","index":1,"display_number":1,"label":"Race 1","heat":null,"time_range":{"start":1788779701,"end":null}},{"id":"6704","index":2,"display_number":2,"label":"Race 2","heat":null,"time_range":{"start":1788784201,"end":null}},{"id":"6705","index":3,"display_number":3,"label":"Race 3","heat":null,"time_range":{"start":1788788701,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/100/access"},{"assignment_id":101,"session_id":3348,"date":"2026-09-07","division":"Yellow","boat_class":"ILCA 6","races":[{"id":"6706","index":1,"display_number":1,"label":"Race 1","heat":null,"time_range":{"start":1788779100.2499998,"end":null}},{"id":"6707","index":2,"display_number":2,"label":"Race 2","heat":null,"time_range":{"start":1788783601,"end":null}},{"id":"6708","index":3,"display_number":3,"label":"Race 3","heat":null,"time_range":{"start":1788788101,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/101/access"},{"assignment_id":102,"session_id":3362,"date":"2026-09-08","division":"Blue","boat_class":"ILCA 6","races":[{"id":"6733","index":1,"display_number":4,"label":"Race 4","heat":null,"time_range":{"start":1788866101,"end":null}},{"id":"6734","index":2,"display_number":5,"label":"Race 5","heat":null,"time_range":{"start":1788870901,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/102/access"},{"assignment_id":103,"session_id":3361,"date":"2026-09-08","division":"Yellow","boat_class":"ILCA 6","races":[{"id":"6731","index":1,"display_number":4,"label":"Race 4","heat":null,"time_range":{"start":1788865501,"end":null}},{"id":"6732","index":2,"display_number":5,"label":"Race 5","heat":null,"time_range":{"start":1788870301,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/103/access"},{"assignment_id":108,"session_id":3377,"date":"2026-09-09","division":"Gold","boat_class":"ILCA 6","races":[{"id":"6769","index":1,"display_number":1,"label":"Race 1","heat":null,"time_range":{"start":1788955980.7500002,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/108/access"},{"assignment_id":109,"session_id":3378,"date":"2026-09-09","division":"Silver","boat_class":"ILCA 6","races":[{"id":"6770","index":1,"display_number":1,"label":"Race 1","heat":null,"time_range":{"start":1788956581,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/109/access"},{"assignment_id":114,"session_id":3394,"date":"2026-09-10","division":"Gold","boat_class":"ILCA 6","races":[{"id":"6814","index":1,"display_number":2,"label":"Race 2","heat":null,"time_range":{"start":1789034701,"end":null}},{"id":"6815","index":2,"display_number":3,"label":"Race 3","heat":null,"time_range":{"start":1789040400,"end":null}},{"id":"6816","index":3,"display_number":4,"label":"Race 4","heat":null,"time_range":{"start":1789046820,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/114/access"},{"assignment_id":115,"session_id":3395,"date":"2026-09-10","division":"Silver","boat_class":"ILCA 6","races":[{"id":"6817","index":1,"display_number":2,"label":"Race 2","heat":null,"time_range":{"start":1789035301,"end":null}},{"id":"6818","index":2,"display_number":3,"label":"Race 3","heat":null,"time_range":{"start":1789041001,"end":null}},{"id":"6819","index":3,"display_number":4,"label":"Race 4","heat":null,"time_range":{"start":1789047421,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/115/access"},{"assignment_id":117,"session_id":3404,"date":"2026-09-11","division":"Gold","boat_class":"ILCA 6","races":[{"id":"6835","index":1,"display_number":5,"label":"Race 5","heat":null,"time_range":{"start":1789121101,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/117/access"},{"assignment_id":119,"session_id":3455,"date":"2026-09-12","division":"Finals","boat_class":"ILCA 6","races":[{"id":"6918","index":1,"display_number":1,"label":"Race 1","heat":null,"time_range":{"start":1789216381,"end":null}},{"id":"6919","index":2,"display_number":2,"label":"Race 2","heat":null,"time_range":{"start":1789218481,"end":null}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/119/access"},{"assignment_id":294,"session_id":3979,"date":"2026-09-12","division":"Gold","boat_class":"ILCA 6","races":[{"id":"7844","index":1,"display_number":6,"label":"Race 6","heat":null,"time_range":{"start":1789207501,"end":1789212088.9}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/294/access"},{"assignment_id":295,"session_id":3536,"date":"2026-09-12","division":"Silver","boat_class":"ILCA 6","races":[{"id":"7008","index":1,"display_number":6,"label":"Race 6","heat":null,"time_range":{"start":1789208101,"end":1789215901}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/295/access"},{"assignment_id":303,"session_id":3991,"date":"2026-09-11","division":"Silver","boat_class":"ILCA 6","races":[{"id":"7863","index":1,"display_number":5,"label":"Race 5","heat":null,"time_range":{"start":1789121701,"end":1789125701}}],"access_allowed":true,"access_path":"/api/integrations/v1/events/15/days/303/access"}],"next_after_assignment_id":null}}},"schema":{"$ref":"#/components/schemas/EventDetail"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_found"}}}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Events"]}},"/api/integrations/v1/events/{event_id}/days/{assignment_id}/access":{"get":{"operationId":"getSailSyncDayAccess","summary":"Resolve existing event-day access without spending report days","description":"Check your access to this event day and obtain its data path. This check does not spend report allowances or FLO credits.","parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"assignment_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"event_id":15,"assignment_id":119,"session_id":3455,"allowed":true,"state":"already_available","day":"2026-09-12","unit":null,"allowance_debited":0,"flo_credits_debited":0,"data_path":"/api/integrations/v1/sessions/3455/data"}}},"schema":{"$ref":"#/components/schemas/DayAccess"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Events"]}},"/api/integrations/v1/sessions/{session_id}/data":{"get":{"operationId":"getSailSyncSessionData","summary":"Read authorized session/race/track manifest","description":"Discover permitted tracks, race scopes, wind and analysis paths for a session.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"after_track_id","in":"query","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"session":{"id":3455,"name":"R1, R2 - 2026 ILCA 6 Worlds - Final Series","boat_class":"ILCA 6","first_race_number":1,"start":1789215781,"end":1789219800},"races":[{"id":"6918","index":1,"display_number":1,"label":"Race 1","heat":null,"time_range":{"start":1789216381,"end":null}},{"id":"6919","index":2,"display_number":2,"label":"Race 2","heat":null,"time_range":{"start":1789218481,"end":null}}],"tracks":[{"session_track_id":26071,"type":"pin","name":"Pin","time_offset":0,"sailing_window":[1789215792,1789222731],"gps_path":null},{"session_track_id":26074,"type":"mark","name":"R1 (markPort)","time_offset":0,"sailing_window":[1789215782,1789222771],"gps_path":null},{"session_track_id":26075,"type":"mark","name":"Finish (finishLeft)","time_offset":0,"sailing_window":[1789219279,1789221541],"gps_path":null},{"session_track_id":26077,"type":"start_boat","name":"Committee Boat","time_offset":0,"sailing_window":[1789215782,1789222836],"gps_path":null},{"session_track_id":26079,"type":"mark","name":"Finish (finishRight)","time_offset":0,"sailing_window":[1789217876,1789221529],"gps_path":null},{"session_track_id":26082,"type":"boat","name":"IRL-216116 | McMahon E.","time_offset":0,"sailing_window":[1789215781,1789222518],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26082/points"},{"session_track_id":26083,"type":"boat","name":"GBR-228016 | Nicholls M.","time_offset":0,"sailing_window":[1789215781,1789220834],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26083/points"},{"session_track_id":26084,"type":"boat","name":"POL-217327 | Barwinska A.","time_offset":0,"sailing_window":[1789215781,1789221499],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26084/points"},{"session_track_id":26085,"type":"boat","name":"DEN-220066 | Munch A.","time_offset":0,"sailing_window":[1789215781,1789221259],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26085/points"},{"session_track_id":26086,"type":"boat","name":"NED-211391 | Jonker M.","time_offset":0,"sailing_window":[1789215781,1789223351],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26086/points"},{"session_track_id":26087,"type":"boat","name":"GBR-226020 | Snellgrove H.","time_offset":0,"sailing_window":[1789215781,1789222129],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26087/points"},{"session_track_id":26088,"type":"boat","name":"BEL-211552 | Plasschaert E.","time_offset":0,"sailing_window":[1789215782,1789222385],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26088/points"},{"session_track_id":26089,"type":"boat","name":"HUN-211551 | Erdi M.","time_offset":0,"sailing_window":[1789215782,1789221348],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26089/points"},{"session_track_id":26090,"type":"boat","name":"FRA-212121 | Cervera L.","time_offset":0,"sailing_window":[1789215782,1789220922],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26090/points"},{"session_track_id":26091,"type":"boat","name":"USA-222035 | Rose C.","time_offset":0,"sailing_window":[1789215783,1789222333],"gps_path":"/api/integrations/v1/sessions/3455/data/tracks/26091/points"},{"session_track_id":26729,"type":"mark","name":"Gate 3B","time_offset":0,"sailing_window":[1789216371,1789219291],"gps_path":null},{"session_track_id":26731,"type":"mark","name":"Gate 3A","time_offset":0,"sailing_window":[1789216371,1789218471],"gps_path":null}],"next_after_track_id":null,"analysis_path":"/api/integrations/v1/sessions/3455/data/analysis","wind_path":"/api/integrations/v1/sessions/3455/data/wind","permissions":{"read":true,"write":false}}}},"schema":{"$ref":"#/components/schemas/SessionManifest"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_found"}}}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]}},"/api/integrations/v1/sessions/{session_id}/data/tracks/{track_id}/points":{"get":{"operationId":"getSailSyncGpsPoints","summary":"Read authorized committed full-resolution GPS positions","description":"Read committed GPS positions for a permitted boat track. Follow next_cursor until null; retain downloaded pages.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"track_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":5000}},{"name":"cursor","in":"query","schema":{"type":"string","maxLength":2048}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"available":true,"session_id":3455,"session_track_id":26082,"resolution":"committed_full_resolution_gps","source_ref":"0ef4be0ce0b1b9e0bcb8b72653f85d2728727287dfc7da5dd7878b18bad38154","time_basis":"session_epoch_seconds_with_track_offset","time_offset":0,"window":{"start":1789215781,"end":1789219800},"point_count":3303,"points":[{"time_epoch":1789215781.1,"lat":53.3144298,"lng":-6.1299651},{"time_epoch":1789215783.3,"lat":53.3144469,"lng":-6.1299779999999995},{"time_epoch":1789215786.5,"lat":53.3144924,"lng":-6.1300146}],"next_cursor":"EXAMPLE_CURSOR_REPLACE_WITH_CURRENT_RESPONSE"}}},"schema":{"$ref":"#/components/schemas/GpsPage"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_found"}}}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/UnavailableGps"},{"$ref":"#/components/schemas/IntegrationError"}]}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"rate_limited","budget":"repeat_hour","limit":1,"remaining":0,"reset_at":1793150290,"retry_after":3600}}}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]}},"/api/integrations/v1/sessions/{session_id}/data/wind":{"get":{"operationId":"getSailSyncWind","summary":"Read configured wind step series in bounded pages","description":"Read the configured wind step series. Use snapshot_ref as expected_snapshot on continuation.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"series","in":"query","schema":{"type":"string","enum":["direction","speed"]}},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":1000}},{"name":"offset","in":"query","schema":{"type":"integer","minimum":0,"maximum":9007199254740991}},{"name":"expected_snapshot","in":"query","schema":{"type":"string","maxLength":128}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"series":"direction","unit":"degrees","representation":"configured_session_step_series","snapshot_ref":"699e214a2028281ba73957ef2d3ddf8e91035bf88d6f01110f7b466456094817","total_count":3,"default_direction_deg":263,"default_speed_kt":null,"points":[{"t":1789216081,"direction":263},{"t":1789218181,"direction":262},{"t":1789218984.7654676,"direction":256}],"next_offset":null}}},"schema":{"$ref":"#/components/schemas/WindPage"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"stale_snapshot","reason":null}}}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]}},"/api/integrations/v1/sessions/{session_id}/data/analysis":{"get":{"operationId":"getSailSyncAnalysis","summary":"Read saved race catalog and available metrics scope IDs","description":"Discover race scopes, participating boats and snapshots. Missing or outdated analysis is reported explicitly; this does not start recalculation. Each discovered leg includes its coarse saved direction and basis; reaching legs are distinct from upwind/downwind. Optional direction chooses matching legs across races without recomputation. Missing legacy direction remains unknown, and a valid filter with no matches returns an empty races list.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"direction","in":"query","description":"Optional saved sailing direction. Upwind/downwind exclude reaches; mixed and unknown are explicit. Filters race-leg discovery and omits races with no matching legs. Use returned race id, leg_index and canonical snapshot with race results/facts. Does not recompute wind or race data.","schema":{"type":"string","enum":["upwind","downwind","reach","mixed","unknown"]}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"schema_version":"race_debrief_facts_v1","session_id":"3455","status":"ready","reason":null,"refresh_required":false,"freshness":"no_newer_recorded_inputs","access":{"allowed":true,"required_plans":["racer","gold"],"trial_activation_supported":false},"boats":[{"boat_id":"26082","name":"IRL-216116 | McMahon E."},{"boat_id":"26083","name":"GBR-228016 | Nicholls M."},{"boat_id":"26084","name":"POL-217327 | Barwinska A."},{"boat_id":"26085","name":"DEN-220066 | Munch A."},{"boat_id":"26086","name":"NED-211391 | Jonker M."},{"boat_id":"26087","name":"GBR-226020 | Snellgrove H."},{"boat_id":"26088","name":"BEL-211552 | Plasschaert E."},{"boat_id":"26089","name":"HUN-211551 | Erdi M."},{"boat_id":"26090","name":"FRA-212121 | Cervera L."},{"boat_id":"26091","name":"USA-222035 | Rose C."}],"races":[{"id":"6918","kind":"race","label":"Race 1","index":1,"display_number":1,"boat_ids":["26082","26083","26084","26085","26086","26087","26088","26089","26090","26091"],"available":true,"reason":null,"legs":[{"leg_index":1,"kind":"race_leg","direction":"unknown","direction_basis":null},{"leg_index":2,"kind":"race_leg","direction":"unknown","direction_basis":null},{"leg_index":3,"kind":"race_leg","direction":"unknown","direction_basis":null},{"leg_index":4,"kind":"race_leg","direction":"unknown","direction_basis":null},{"leg_index":5,"kind":"race_leg","direction":"unknown","direction_basis":null}],"snapshot":{"ref":"dbf5c1f09a60d24f03f3a78c35c3c40012f5ccb202a22f7be8bf50f616ae1636","schema_version":"race_debrief_facts_v1","artifact_run_id":"20261023T223430Z-327193c0","computed_at":"2026-10-23T22:34:30.105Z","revision_completeness":"partial","missing_revision_components":["artifact_source_revision_binding"],"freshness":"no_newer_recorded_inputs","refresh_required":false,"raw_gps_coverage_verified":false}},{"id":"6919","kind":"race","label":"Race 2","index":2,"display_number":2,"boat_ids":["26082","26083","26084","26085","26086","26087","26088","26089","26090","26091"],"available":true,"reason":null,"legs":[{"leg_index":1,"kind":"race_leg","direction":"unknown","direction_basis":null},{"leg_index":2,"kind":"race_leg","direction":"unknown","direction_basis":null},{"leg_index":3,"kind":"race_leg","direction":"unknown","direction_basis":null},{"leg_index":4,"kind":"race_leg","direction":"unknown","direction_basis":null},{"leg_index":5,"kind":"race_leg","direction":"unknown","direction_basis":null}],"snapshot":{"ref":"34a70ee95b9c64f6b7d04f09277e1b58f9773188d810f691f303c1fde5c6c1be","schema_version":"race_debrief_facts_v1","artifact_run_id":"20261023T223430Z-327193c0","computed_at":"2026-10-23T22:34:30.105Z","revision_completeness":"partial","missing_revision_components":["artifact_source_revision_binding"],"freshness":"no_newer_recorded_inputs","refresh_required":false,"raw_gps_coverage_verified":false}}],"comparison_policies":["named_rival","leading_finishers"],"filters":{},"matching_race_count":2,"matching_leg_count":10}}},"schema":{"$ref":"#/components/schemas/AnalysisCatalog"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_ready","reason":"saved_analysis_unavailable"}}}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]}},"/api/integrations/v1/sessions/{session_id}/data/races/{scope_id}/results":{"get":{"operationId":"getSailSyncRaceResults","summary":"Read saved race results and optional per-leg speed/VMG metrics","description":"Read results for one race, optionally including leg metrics. Positions remain fleet-relative across pages. Pass the returned snapshot ref when continuing. When leg_index is supplied, requested_leg includes exact-window applied wind_context with speed/direction, variation and configured coverage; current wind is not proof of saved-metric freshness.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"scope_id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"description":"Race id returned by the analysis catalog. Treat as an opaque string, not a displayed race number. Legacy IDs remain accepted."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"before_boat_id","in":"query","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"expected_snapshot","in":"query","schema":{"type":"string","maxLength":128}},{"name":"leg_index","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"schema_version":"subscriber_saved_analysis_v1","session_id":3455,"scope_id":"6918","snapshot":{"ref":"dbf5c1f09a60d24f03f3a78c35c3c40012f5ccb202a22f7be8bf50f616ae1636","schema_version":"race_debrief_facts_v1","artifact_run_id":"20261023T223430Z-327193c0","computed_at":"2026-10-23T22:34:30.105Z","revision_completeness":"partial","missing_revision_components":["artifact_source_revision_binding"],"freshness":"no_newer_recorded_inputs","refresh_required":false,"raw_gps_coverage_verified":false},"fleet_count":10,"next_before_boat_id":26089,"paging_order":"boat_id_descending","scope":"within_this_race_only","model_called":false,"results":[{"boat_id":"26091","boat_name":"USA-222035 | Rose C.","boat_color":"#42D4F4","status":"finished","finish_time":1789217476.8393393,"elapsed_seconds":1095.8393392562866,"legs_completed":5,"legs_expected":5,"result_source":"completion.elapsed_seconds","overall_order":2,"position":2,"finish_time_local":{"epoch":1789217476.8393393,"utc":"2026-09-12T12:51:16.839Z","local":"2026-09-12T05:51:16-07:00","label":"2026-09-12 05:51:16 PDT","time_zone":"America/Los_Angeles"},"last_recorded_leg_end_local":{"epoch":1789217477,"utc":"2026-09-12T12:51:17.000Z","local":"2026-09-12T05:51:17-07:00","label":"2026-09-12 05:51:17 PDT","time_zone":"America/Los_Angeles"}},{"boat_id":"26089","boat_name":"HUN-211551 | Erdi M.","boat_color":"#E6194B","status":"finished","finish_time":1789217485.7685676,"elapsed_seconds":1104.7685675621033,"legs_completed":5,"legs_expected":5,"result_source":"completion.elapsed_seconds","overall_order":3,"position":3,"finish_time_local":{"epoch":1789217485.7685676,"utc":"2026-09-12T12:51:25.768Z","local":"2026-09-12T05:51:25-07:00","label":"2026-09-12 05:51:25 PDT","time_zone":"America/Los_Angeles"},"last_recorded_leg_end_local":{"epoch":1789217486,"utc":"2026-09-12T12:51:26.000Z","local":"2026-09-12T05:51:26-07:00","label":"2026-09-12 05:51:26 PDT","time_zone":"America/Los_Angeles"}},{"boat_id":"26090","boat_name":"FRA-212121 | Cervera L.","boat_color":"#BFEF45","status":"finished","finish_time":1789217524.8534248,"elapsed_seconds":1143.8534247875214,"legs_completed":5,"legs_expected":5,"result_source":"completion.elapsed_seconds","overall_order":9,"position":9,"finish_time_local":{"epoch":1789217524.8534248,"utc":"2026-09-12T12:52:04.853Z","local":"2026-09-12T05:52:04-07:00","label":"2026-09-12 05:52:04 PDT","time_zone":"America/Los_Angeles"},"last_recorded_leg_end_local":{"epoch":1789217525,"utc":"2026-09-12T12:52:05.000Z","local":"2026-09-12T05:52:05-07:00","label":"2026-09-12 05:52:05 PDT","time_zone":"America/Los_Angeles"}}],"summary":{"boat_count":10,"finish_count":10,"partial_count":0,"not_started_count":0,"excluded_count":0,"other_count":0}}}},"schema":{"$ref":"#/components/schemas/RaceResultsPage"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"stale_snapshot","reason":null}}}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"snapshot_required","reason":null}}}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]}},"/api/integrations/v1/sessions/{session_id}/data/races/{scope_id}/starts":{"get":{"operationId":"getSailSyncStartStats","summary":"Read saved canonical start statistics for a race","description":"Read saved start statistics for one race. Missing metrics are omitted; pass the snapshot ref when continuing.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"scope_id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"description":"Race id returned by the analysis catalog. Treat as an opaque string, not a displayed race number. Legacy IDs remain accepted."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"before_boat_id","in":"query","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"expected_snapshot","in":"query","schema":{"type":"string","maxLength":128}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"schema_version":"subscriber_saved_analysis_v1","session_id":3455,"scope_id":"6918","snapshot":{"ref":"dbf5c1f09a60d24f03f3a78c35c3c40012f5ccb202a22f7be8bf50f616ae1636","schema_version":"race_debrief_facts_v1","artifact_run_id":"20261023T223430Z-327193c0","computed_at":"2026-10-23T22:34:30.105Z","revision_completeness":"partial","missing_revision_components":["artifact_source_revision_binding"],"freshness":"no_newer_recorded_inputs","refresh_required":false,"raw_gps_coverage_verified":false},"fleet_count":10,"next_before_boat_id":26089,"paging_order":"boat_id_descending","scope":"within_this_race_only","model_called":false,"start_stats":[{"boat_id":"26091","boat_name":"USA-222035 | Rose C.","boat_color":"#42D4F4","start_time":1789216381,"start_time_local":{"epoch":1789216381,"utc":"2026-09-12T12:33:01.000Z","local":"2026-09-12T05:33:01-07:00","label":"2026-09-12 05:33:01 PDT","time_zone":"America/Los_Angeles"},"cross_time":1789216384.5,"cross_time_local":{"epoch":1789216384.5,"utc":"2026-09-12T12:33:04.500Z","local":"2026-09-12T05:33:04-07:00","label":"2026-09-12 05:33:04 PDT","time_zone":"America/Los_Angeles"},"finish_position":2,"finish_status":"finished","elapsed_seconds":1095.839,"excluded_from_stats":false,"line_position_pct":22.204,"line_projection_pct_unclamped":22.204,"line_end_bucket":"pin","line_position_bias_vs_midline_m":5.9,"signed_distance_to_line_at_go_m":3.9,"distance_to_line_at_go_m":3.9,"time_late_to_cross_s":3.5,"sog_at_go_kt":5.6,"sog_15s_after_go_kt":5.2,"tack_at_go":"starboard","ocs":{"status":"clear","verdict":"clear","over_at_go":false,"evidence_kind":null,"evidence_version":"raw_start_evidence_v1","evidence_gate_enabled":true,"suppressed":false,"gap_window":null,"raw_coverage":{"atGo":true,"atCrossing":true,"bracketWindowSeconds":10},"cleared_time":null,"first_legal_cross_time":1789216384.5},"calculation_basis":{"start_evidence_version":"raw_start_evidence_v1","line_position_basis":"projection_on_start_line","distance_basis":"signed_distance_to_start_line_segment","speed_window_seconds":1,"wind_source":"effective_wind_function","start_line_source":"race.start_line"},"start_type":"windward","start_type_source":"leg1_maneuvers+geometry","windward_progress_m":{"5s":18.8,"10s":27,"15s":35.8,"30s":66.4,"60s":123.5},"mark_one_distance_at_go_m":736.3,"mark_one_progress_m":{"5s":6.2,"10s":12.4,"15s":19.2,"30s":43.3,"60s":81.9},"metrics":{"line_position_pct":22.204,"line_projection_pct_unclamped":22.204,"line_position_bias_vs_midline_m":5.9,"signed_distance_to_line_at_go_m":3.9,"distance_to_line_at_go_m":3.9,"time_late_to_cross_s":3.5,"sog_at_go_kt":5.6,"sog_15s_after_go_kt":5.2,"elapsed_seconds":1095.839,"mark_one_distance_at_go_m":736.3},"units":{"line_position_pct":"%","line_projection_pct_unclamped":"%","line_position_bias_vs_midline_m":"m","signed_distance_to_line_at_go_m":"m","distance_to_line_at_go_m":"m","time_late_to_cross_s":"s","sog_at_go_kt":"kt","sog_15s_after_go_kt":"kt","elapsed_seconds":"s","mark_one_distance_at_go_m":"m","mark_one_progress_m":"m","reach_favored_end_advantage_m":"m","reach_line_position_bias_m":"m"},"warnings":[]},{"boat_id":"26089","boat_name":"HUN-211551 | Erdi M.","boat_color":"#E6194B","start_time":1789216381,"start_time_local":{"epoch":1789216381,"utc":"2026-09-12T12:33:01.000Z","local":"2026-09-12T05:33:01-07:00","label":"2026-09-12 05:33:01 PDT","time_zone":"America/Los_Angeles"},"cross_time":1789216383.5,"cross_time_local":{"epoch":1789216383.5,"utc":"2026-09-12T12:33:03.500Z","local":"2026-09-12T05:33:03-07:00","label":"2026-09-12 05:33:03 PDT","time_zone":"America/Los_Angeles"},"finish_position":3,"finish_status":"finished","elapsed_seconds":1104.769,"excluded_from_stats":false,"line_position_pct":30.187,"line_projection_pct_unclamped":30.187,"line_end_bucket":"middle","line_position_bias_vs_midline_m":4.2,"signed_distance_to_line_at_go_m":3.2,"distance_to_line_at_go_m":3.2,"time_late_to_cross_s":2.5,"sog_at_go_kt":5.2,"sog_15s_after_go_kt":4.9,"tack_at_go":"starboard","ocs":{"status":"clear","verdict":"clear","over_at_go":false,"evidence_kind":null,"evidence_version":"raw_start_evidence_v1","evidence_gate_enabled":true,"suppressed":false,"gap_window":null,"raw_coverage":{"atGo":true,"atCrossing":true,"bracketWindowSeconds":10},"cleared_time":null,"first_legal_cross_time":1789216383.5},"calculation_basis":{"start_evidence_version":"raw_start_evidence_v1","line_position_basis":"projection_on_start_line","distance_basis":"signed_distance_to_start_line_segment","speed_window_seconds":1,"wind_source":"effective_wind_function","start_line_source":"race.start_line"},"start_type":"windward","start_type_source":"leg1_maneuvers+geometry","windward_progress_m":{"5s":18.4,"10s":25.7,"15s":34.5,"30s":64,"60s":120.4},"mark_one_distance_at_go_m":736,"mark_one_progress_m":{"5s":6.4,"10s":12.1,"15s":19.1,"30s":42.9,"60s":83.5},"metrics":{"line_position_pct":30.187,"line_projection_pct_unclamped":30.187,"line_position_bias_vs_midline_m":4.2,"signed_distance_to_line_at_go_m":3.2,"distance_to_line_at_go_m":3.2,"time_late_to_cross_s":2.5,"sog_at_go_kt":5.2,"sog_15s_after_go_kt":4.9,"elapsed_seconds":1104.769,"mark_one_distance_at_go_m":736},"units":{"line_position_pct":"%","line_projection_pct_unclamped":"%","line_position_bias_vs_midline_m":"m","signed_distance_to_line_at_go_m":"m","distance_to_line_at_go_m":"m","time_late_to_cross_s":"s","sog_at_go_kt":"kt","sog_15s_after_go_kt":"kt","elapsed_seconds":"s","mark_one_distance_at_go_m":"m","mark_one_progress_m":"m","reach_favored_end_advantage_m":"m","reach_line_position_bias_m":"m"},"warnings":[]},{"boat_id":"26090","boat_name":"FRA-212121 | Cervera L.","boat_color":"#BFEF45","start_time":1789216381,"start_time_local":{"epoch":1789216381,"utc":"2026-09-12T12:33:01.000Z","local":"2026-09-12T05:33:01-07:00","label":"2026-09-12 05:33:01 PDT","time_zone":"America/Los_Angeles"},"cross_time":1789216385,"cross_time_local":{"epoch":1789216385,"utc":"2026-09-12T12:33:05.000Z","local":"2026-09-12T05:33:05-07:00","label":"2026-09-12 05:33:05 PDT","time_zone":"America/Los_Angeles"},"finish_position":9,"finish_status":"finished","elapsed_seconds":1143.853,"excluded_from_stats":false,"line_position_pct":62.042,"line_projection_pct_unclamped":62.042,"line_end_bucket":"middle","line_position_bias_vs_midline_m":-2.6,"signed_distance_to_line_at_go_m":5.4,"distance_to_line_at_go_m":5.4,"time_late_to_cross_s":4,"sog_at_go_kt":4.7,"sog_15s_after_go_kt":3.9,"tack_at_go":"starboard","ocs":{"status":"clear","verdict":"clear","over_at_go":false,"evidence_kind":null,"evidence_version":"raw_start_evidence_v1","evidence_gate_enabled":true,"suppressed":false,"gap_window":null,"raw_coverage":{"atGo":true,"atCrossing":true,"bracketWindowSeconds":10},"cleared_time":null,"first_legal_cross_time":1789216385},"calculation_basis":{"start_evidence_version":"raw_start_evidence_v1","line_position_basis":"projection_on_start_line","distance_basis":"signed_distance_to_start_line_segment","speed_window_seconds":1,"wind_source":"effective_wind_function","start_line_source":"race.start_line"},"start_type":"windward","start_type_source":"leg1_maneuvers+geometry","windward_progress_m":{"5s":9.9,"10s":18.6,"15s":25.1,"30s":51.5,"60s":105.5},"mark_one_distance_at_go_m":741.6,"mark_one_progress_m":{"5s":8,"10s":15.9,"15s":22.9,"30s":51.5,"60s":107.7},"metrics":{"line_position_pct":62.042,"line_projection_pct_unclamped":62.042,"line_position_bias_vs_midline_m":-2.6,"signed_distance_to_line_at_go_m":5.4,"distance_to_line_at_go_m":5.4,"time_late_to_cross_s":4,"sog_at_go_kt":4.7,"sog_15s_after_go_kt":3.9,"elapsed_seconds":1143.853,"mark_one_distance_at_go_m":741.6},"units":{"line_position_pct":"%","line_projection_pct_unclamped":"%","line_position_bias_vs_midline_m":"m","signed_distance_to_line_at_go_m":"m","distance_to_line_at_go_m":"m","time_late_to_cross_s":"s","sog_at_go_kt":"kt","sog_15s_after_go_kt":"kt","elapsed_seconds":"s","mark_one_distance_at_go_m":"m","mark_one_progress_m":"m","reach_favored_end_advantage_m":"m","reach_line_position_bias_m":"m"},"warnings":[]}],"start_line":{"available":true,"unavailable_reason":null,"at_time":1789216381,"pin":{"track_id":26071,"lat":53.3127238,"lng":-6.1324707,"position_time":1789216380.9,"position_source":"mark_time_series_last_at_or_before","age_s":0.1},"committee":{"track_id":26077,"lat":53.3136055,"lng":-6.1323301,"position_time":1789216380.6,"position_source":"mark_time_series_last_at_or_before","age_s":0.4},"center":{"lat":53.3131647,"lng":-6.1324004},"length_m":98.5,"bearing_pin_to_committee_deg":5.4,"wind_direction_deg":263,"wind_source":"effective_wind_function","favored_end":"pin","favored_end_bias_m":21.2,"warnings":[],"favEnd":"Pin","bias":21.21881817342593,"start_type":"windward","start_type_source":"leg1_maneuvers+geometry"},"summary":{"boat_count":3,"start_type":"windward","pin_count":1,"middle_count":2,"committee_count":0,"unknown_count":0,"ocs_count":0,"unknown_start_verdict_count":0,"excluded_count":0},"units":{"line_position_pct":"%","line_projection_pct_unclamped":"%","line_position_bias_vs_midline_m":"m","signed_distance_to_line_at_go_m":"m","distance_to_line_at_go_m":"m","time_late_to_cross_s":"s","sog_at_go_kt":"kt","sog_15s_after_go_kt":"kt","elapsed_seconds":"s","mark_one_distance_at_go_m":"m","mark_one_progress_m":"m","reach_favored_end_advantage_m":"m","reach_line_position_bias_m":"m"}}}},"schema":{"$ref":"#/components/schemas/StartStatisticsPage"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]}},"/api/integrations/v1/sessions/{session_id}/data/races/{scope_id}/facts":{"get":{"operationId":"getSailSyncRaceFacts","summary":"Read saved per-leg speed, VMG, distance, timing and maneuver comparison","description":"Compare a subject boat with a named rival or leading finishers using saved race/leg facts. No FLO credits are spent. Each boat leg includes wind_context for its own exact leg boundaries: current applied wind speed/direction, variation and configured coverage. This is not raw sensor accuracy or proof saved metrics used the same wind revision.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"scope_id","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":100},"description":"Race id returned by the analysis catalog. Treat as an opaque string, not a displayed race number. Legacy IDs remain accepted."},{"name":"subject_id","in":"query","schema":{"type":"string","maxLength":30},"required":true},{"name":"rival_id","in":"query","schema":{"type":"string","maxLength":30}},{"name":"comparison_policy","in":"query","schema":{"type":"string","enum":["leading_finishers","named_rival"]}},{"name":"leg_index","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"expected_snapshot","in":"query","schema":{"type":"string","maxLength":128}}],"responses":{"200":{"description":"Authorized read response","content":{"application/json":{"examples":{"ilcaWorlds":{"summary":"ILCA 6 Worlds · September 12","description":"Captured from session 3455. Contact details are sanitized; example cursors are placeholders.","value":{"schema_version":"race_debrief_facts_v1","session_id":"3455","status":"ready","snapshot":{"ref":"dbf5c1f09a60d24f03f3a78c35c3c40012f5ccb202a22f7be8bf50f616ae1636","schema_version":"race_debrief_facts_v1","artifact_run_id":"20261023T223430Z-327193c0","computed_at":"2026-10-23T22:34:30.105Z","revision_completeness":"partial","missing_revision_components":["artifact_source_revision_binding"],"freshness":"no_newer_recorded_inputs","refresh_required":false,"raw_gps_coverage_verified":false},"scope":{"kind":"race","id":"6918","label":"Race 1","leg_index":1},"comparison":{"policy":"named_rival","subject_id":"26082","boat_ids":["26083"],"peers_requested":1,"peers_selected":1},"participants":[{"boat_id":"26082","name":"IRL-216116 | McMahon E.","role":"subject","comparison_color":"#42D4F4"},{"boat_id":"26083","name":"GBR-228016 | Nicholls M.","role":"rival","comparison_color":"#F58231"}],"fleet_count":10,"results":[{"boat_id":"26083","position":1,"status":"finished","finish_time":1789217473.4056194,"elapsed_seconds":1092.4056193828583,"result_source":"completion.elapsed_seconds"},{"boat_id":"26082","position":8,"status":"finished","finish_time":1789217517.643135,"elapsed_seconds":1136.6431350708008,"result_source":"completion.elapsed_seconds"}],"legs":[{"leg_index":1,"scope_id":"6918","snapshot_ref":"dbf5c1f09a60d24f03f3a78c35c3c40012f5ccb202a22f7be8bf50f616ae1636","passages":{"leg_index":1,"scope_id":"6918","direction":"upwind","is_reach":false,"subject":{"boat_id":"26082","entry":{"available":false,"time":null,"reason":"start_is_not_mark_passage","basis":"start"},"exit":{"available":true,"time":1789216807,"reason":null,"basis":"mark_rounding_time","scope_id":"6918","leg_index":1,"mark_ids":["26074"],"rounding_ids":["rounding:comment_6918:boat:26082:leg:1:mark:26074"],"quality":[]},"available":false,"reason":"start_is_not_mark_passage"},"pairs":[{"peer_id":"26083","available":false,"reason":"start_is_not_mark_passage","entry_gap_s":null,"exit_gap_s":null,"gap_change_s":null,"peer":{"boat_id":"26083","entry":{"available":false,"time":null,"reason":"start_is_not_mark_passage","basis":"start"},"exit":{"available":true,"time":1789216789,"reason":null,"basis":"mark_rounding_time","scope_id":"6918","leg_index":1,"mark_ids":["26074"],"rounding_ids":["rounding:comment_6918:boat:26083:leg:1:mark:26074"],"quality":[]},"available":false,"reason":"start_is_not_mark_passage"}}],"exit_gaps":[{"peer_id":"26083","gap_s":18,"reason":null}],"subject_order_at_entry":null,"subject_order_at_exit":{"position":9,"measured_boats":10,"fleet_boats":10,"tied_boats":0,"basis":"recorded_mark_passage_order","reason":null},"median_paired_change_s":null,"peers_requested":1,"peers_selected":1,"peers_measured":0,"coverage":{"eligible_count":1,"measured_count":0,"unavailable_count":1,"excluded_count":0,"unavailable_reasons":{"start_is_not_mark_passage":1}},"complete_peer_coverage":false,"basis":"recorded_mark_passage","raw_gps_coverage_verified":false},"boats":[{"boat_id":"26082","time_range":{"start":1789216381,"end":1789216807,"end_precise":1789216805.675883},"reason":null,"metrics":{"avg_sog_kt":{"value":4.592,"unit":"kn","reason":null},"avg_mark_vmg_kt":{"value":3.335,"unit":"kn","reason":null},"avg_vmg_kt":{"value":3.335,"unit":"kn","reason":null},"distance_m":{"value":1003,"unit":"m","reason":null},"duration_seconds":{"value":426,"unit":"s","reason":null}},"maneuver_loss":{"type":"tack","qualifying_count":3,"measured_count":3,"unavailable_loss_count":0,"minimum_count":1,"median_loss_m":3.776832305207659,"reason":null,"basis":"report_maneuver_loss_v1"}},{"boat_id":"26083","time_range":{"start":1789216381,"end":1789216789,"end_precise":1789216787.9516218},"reason":null,"metrics":{"avg_sog_kt":{"value":4.861,"unit":"kn","reason":null},"avg_mark_vmg_kt":{"value":3.546,"unit":"kn","reason":null},"avg_vmg_kt":{"value":3.562,"unit":"kn","reason":null},"distance_m":{"value":1017.7,"unit":"m","reason":null},"duration_seconds":{"value":408,"unit":"s","reason":null}},"maneuver_loss":{"type":"tack","qualifying_count":3,"measured_count":3,"unavailable_loss_count":0,"minimum_count":1,"median_loss_m":3.4477307808109128,"reason":null,"basis":"report_maneuver_loss_v1"}}],"peer_summary":{"metrics":{"avg_sog_kt":{"value":4.861,"measured_count":1,"selected_count":1,"statistic":"median_of_boat_leg_values"},"avg_mark_vmg_kt":{"value":3.546,"measured_count":1,"selected_count":1,"statistic":"median_of_boat_leg_values"},"avg_vmg_kt":{"value":3.562,"measured_count":1,"selected_count":1,"statistic":"median_of_boat_leg_values"},"distance_m":{"value":1017.7,"measured_count":1,"selected_count":1,"statistic":"median_of_boat_leg_values"},"duration_seconds":{"value":408,"measured_count":1,"selected_count":1,"statistic":"median_of_boat_leg_values"}},"maneuver_loss":{"value":3.4477307808109128,"measured_count":1,"selected_count":1,"statistic":"median_of_boat_leg_medians"},"exit_gap":{"value":18,"measured_count":1,"selected_count":1,"statistic":"median_exit_gap"}}}],"availability":{"geometry":"available_on_request","actions":"not_implemented","raw_gps":"not_checked"}}}},"schema":{"$ref":"#/components/schemas/RaceFacts"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current subscription/scope unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Resource hidden or not authorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Data missing/changed; inspect safe reason","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid filter/selection/snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared read/data quota; Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"A required limiter, budget service or backend is unavailable.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Sessions & data"]}},"/api/integrations/v1/sessions/{session_id}/flo/conversation":{"post":{"operationId":"openSailSyncFloConversation","summary":"Create or resume this account’s session FLO conversation","description":"Requires flo:write. Open or reuse a conversation for a session you can access.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"conversation_id":39,"session_id":373,"available_credit_microunits":2000000,"max_turn_credit_microunits":1000000,"unknown_usage_charge_policy":"declared_dispatched_call_maximum","integration_history_only":true}}},"schema":{"$ref":"#/components/schemas/FloConversation"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"402":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"scope_required"}}}}}},"404":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_available"}}}}}},"409":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["FLO"]}},"/api/integrations/v1/sessions/{session_id}/flo/conversations/{conversation_id}":{"get":{"operationId":"getSailSyncFloConversation","summary":"Read the latest 20 integration FLO turns","description":"Requires flo:write. Read this conversation and its latest 20 integration turns.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"conversation_id":41,"session_id":376,"available_credit_microunits":1999160,"max_turn_credit_microunits":1000000,"unknown_usage_charge_policy":"declared_dispatched_call_maximum","integration_history_only":true,"turns":[{"id":42,"conversation_id":41,"session_id":376,"status":"completed","cancel_requested":false,"reserved_credit_microunits":1000000,"charged_credit_microunits":840,"usage":{"model_calls":2,"prompt_tokens":200,"completion_tokens":40,"source_bytes_reserved":0},"answer":"The saved leg comparison supports this result [S1].","answer_format":"plain_text","citations":[{"id":"S1","kind":"results","scope_id":"6814","session_id":376,"snapshot_ref":"8da8b9c70f9c34d8cb3769511c26a2d92ae30aba8a58538395a48536e5e8e9fd"}],"error":null,"expires_at":"2026-10-27T17:21:09.473-07:00","settled_at":"2026-10-27T17:18:09.598-07:00","prompt":"Compare the saved race results"}]}}},"schema":{"$ref":"#/components/schemas/FloHistory"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"402":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["FLO"]}},"/api/integrations/v1/sessions/{session_id}/flo/conversations/{conversation_id}/turns":{"post":{"operationId":"askSailSyncFlo","summary":"Queue a bounded FLO turn using account credits","description":"Requires flo:write. Ask a question up to 4,000 UTF-8 bytes. Reuse the Idempotency-Key on retries and poll at five-second intervals. Credit reservations use microunits (1,000,000 = 1 FLO credit). Unknown usage after dispatch may be charged up to the reserved maximum.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":80,"pattern":"^[A-Za-z0-9_-]{8,80}$"}}],"responses":{"200":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"examples":{"completedRetry":{"summary":"Synthetic integration-test response","description":"Completed receipt returned when retrying the same request. Test IDs are illustrative.","value":{"id":42,"conversation_id":41,"session_id":376,"status":"completed","cancel_requested":false,"reserved_credit_microunits":1000000,"charged_credit_microunits":840,"usage":{"model_calls":2,"prompt_tokens":200,"completion_tokens":40,"source_bytes_reserved":0},"answer":"The saved leg comparison supports this result [S1].","answer_format":"plain_text","citations":[{"id":"S1","kind":"results","scope_id":"6814","session_id":376,"snapshot_ref":"8da8b9c70f9c34d8cb3769511c26a2d92ae30aba8a58538395a48536e5e8e9fd"}],"error":null,"expires_at":"2026-10-27T17:21:09.473-07:00","settled_at":"2026-10-27T17:18:09.598-07:00"}}},"schema":{"$ref":"#/components/schemas/FloTurn"}}}},"202":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"id":40,"conversation_id":39,"session_id":373,"status":"queued","cancel_requested":false,"reserved_credit_microunits":1000000,"charged_credit_microunits":0,"usage":{},"answer":null,"answer_format":"plain_text","citations":[],"error":null,"expires_at":"2026-10-27T17:21:09.357-07:00","settled_at":null}}},"schema":{"$ref":"#/components/schemas/FloTurn"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"402":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"insufficient_flo_credits","available_credit_microunits":0,"required_minimum_credit_microunits":601536}}}}}},"403":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"idempotency_conflict"}}}}}},"422":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"flo_queue_unavailable"}}}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["prompt"],"properties":{"prompt":{"type":"string","minLength":1,"maxLength":4000},"max_credit_microunits":{"type":"integer","minimum":1,"maximum":1000000,"default":1000000}}}}}},"tags":["FLO"]}},"/api/integrations/v1/sessions/{session_id}/flo/conversations/{conversation_id}/turns/{id}":{"get":{"operationId":"getSailSyncFloTurn","summary":"Read a FLO turn status, answer, citations and credit usage","description":"Requires flo:write. Read the turn status, answer, citations and credit charge. Poll no more than once every five seconds.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"id":42,"conversation_id":41,"session_id":376,"status":"completed","cancel_requested":false,"reserved_credit_microunits":1000000,"charged_credit_microunits":840,"usage":{"model_calls":2,"prompt_tokens":200,"completion_tokens":40,"source_bytes_reserved":0},"answer":"The saved leg comparison supports this result [S1].","answer_format":"plain_text","citations":[{"id":"S1","kind":"results","scope_id":"6814","session_id":376,"snapshot_ref":"8da8b9c70f9c34d8cb3769511c26a2d92ae30aba8a58538395a48536e5e8e9fd"}],"error":null,"expires_at":"2026-10-27T17:21:09.473-07:00","settled_at":"2026-10-27T17:18:09.598-07:00"}}},"schema":{"$ref":"#/components/schemas/FloTurn"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"authentication_required"}}}}}},"402":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_found"}}}}}},"409":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["FLO"]}},"/api/integrations/v1/sessions/{session_id}/flo/conversations/{conversation_id}/turns/{id}/cancel":{"post":{"operationId":"cancelSailSyncFloTurn","summary":"Cancel queued work or request cancellation of a running FLO turn","description":"Requires flo:write. Cancel a queued turn or request cancellation of a running turn. Already dispatched usage may still be charged.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"id":40,"conversation_id":39,"session_id":373,"status":"canceled","cancel_requested":false,"reserved_credit_microunits":1000000,"charged_credit_microunits":0,"usage":{},"answer":null,"answer_format":"plain_text","citations":[],"error":"flo_turn_canceled","expires_at":"2026-10-27T17:21:09.357-07:00","settled_at":"2026-10-27T17:18:09.399-07:00"}}},"schema":{"$ref":"#/components/schemas/FloTurn"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"402":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_found"}}}}}},"409":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Success, queued turn, permission/credit/budget/availability response. Use the returned turn ID for status; retry writes only with the same idempotency key.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["FLO"]}},"/api/integrations/v1/sessions/{session_id}/imports/tracks":{"post":{"operationId":"importSailSyncTrack","summary":"Import one normalized CSV and attach it to an owned session","description":"Requires sessions:write and an owned session. Upload UTF-8 CSV with header time_epoch,lat,lng: increasing UTC Unix seconds within the session window, 2–20,000 points, maximum 1 MiB. Retry with the same Idempotency-Key. Imports do not recalculate analysis. Local MCP also accepts file_path.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":80,"pattern":"^[A-Za-z0-9_-]{8,80}$"}}],"responses":{"200":{"description":"Completed receipt or current state. Retry uses the same key and returns the original result.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"receipt_id":79,"operation":"track","initiator_user_id":601,"source_sha256":"22f6a218614374b467af7f4951d194e83edd2b2725629174f36da74df02a8140","result":{"session_id":346,"session_track_id":149,"manual_track_id":125,"points_sha256":"2b3b1e0eeeacbafa87018a45571c4ea148057f9d9e8610aa27995785098b04ce","point_count":2,"already_attached":false,"compute_requested":false,"completed":true}}}},"schema":{"$ref":"#/components/schemas/TrackImportReceipt"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"authentication_required"}}}}}},"403":{"description":"Subscription, scope or boat limit denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"scope_required"}}}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_available"}}}}}},"409":{"description":"Idempotency/version conflict or original result removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"413":{"description":"Input too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid input; safe code and optional numeric row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"invalid_track_point","row":2}}}}}},"429":{"description":"Shared account/service budget exhausted; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; keep the original idempotency key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"label":{"type":"string","minLength":1,"maxLength":200},"file_format":{"type":"string","enum":["csv"]},"content_base64":{"type":"string","minLength":1,"maxLength":1398104},"batch_reference":{"type":"string","minLength":1,"maxLength":80}},"required":["label","file_format","content_base64"]}}}},"tags":["Imports"]}},"/api/integrations/v1/sessions/{session_id}/imports/wind":{"get":{"operationId":"getSailSyncWindVersion","summary":"Read current wind version before import","description":"Requires sessions:write and an owned session. Obtain the current wind version before replacing wind.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Completed receipt or current state. Retry uses the same key and returns the original result.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"session_id":347,"wind_version":"51d11f677e8229d907900c46d82d90dc20cdd5165efeed0a0867a930203789a0"}}},"schema":{"$ref":"#/components/schemas/WindVersion"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Subscription, scope or boat limit denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Idempotency/version conflict or original result removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"413":{"description":"Input too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid input; safe code and optional numeric row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared account/service budget exhausted; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; keep the original idempotency key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Imports"]},"post":{"operationId":"importSailSyncWind","summary":"Import normalized measured wind with explicit replacement consent","description":"Requires sessions:write and an owned session. Supply ordered UTC observations. Replacing existing wind requires replace=true and the current version. Reuse the Idempotency-Key on retries. This does not trigger recalculation.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":80,"pattern":"^[A-Za-z0-9_-]{8,80}$"}}],"responses":{"200":{"description":"Completed receipt or current state. Retry uses the same key and returns the original result.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"receipt_id":80,"operation":"wind","initiator_user_id":602,"source_sha256":"e5438a1e4df03f6974f514ce36b4a7f71b6d1d091fc2de1789543df6faeb9fcd","result":{"session_id":347,"wind_version":"46a8ec17741b1caa492d89219c6ff4b02f390a7d74f4d371d8bab0b7ab3da29e","observation_count":1,"compute_requested":false,"completed":true}}}},"schema":{"$ref":"#/components/schemas/WindImportReceipt"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Subscription, scope or boat limit denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Idempotency/version conflict or original result removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"wind_replacement_required"}}}}}},"413":{"description":"Input too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid input; safe code and optional numeric row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared account/service budget exhausted; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; keep the original idempotency key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"expected_wind_version":{"type":"string","pattern":"^[0-9a-f]{64}$"},"replace":{"type":"boolean"},"source":{"type":"string","minLength":1,"maxLength":200},"speed_unit":{"type":"string","enum":["knots"]},"direction_reference":{"type":"string","enum":["true_north_from"]},"observations":{"type":"array","minItems":1,"maxItems":2000,"items":{"type":"object","additionalProperties":false,"properties":{"timestamp":{"type":"string","minLength":1,"maxLength":40},"direction_deg":{"type":"number","minimum":0,"maximum":360},"speed":{"type":"number","minimum":0,"maximum":80}},"required":["timestamp","direction_deg","speed"]}},"batch_reference":{"type":"string","minLength":1,"maxLength":80}},"required":["expected_wind_version","replace","source","speed_unit","direction_reference","observations"]}}}},"tags":["Imports"]}},"/api/integrations/v1/sessions/{session_id}/imports/setup_inquiry":{"post":{"operationId":"requestSailSyncSessionSetup","summary":"Ask staff to help set up an owned session","description":"Requires sessions:write and an owned session. Request human help with race setup; follow the receipt for status.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":80,"pattern":"^[A-Za-z0-9_-]{8,80}$"}}],"responses":{"200":{"description":"Completed receipt or current state. Retry uses the same key and returns the original result.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"receipt_id":90,"operation":"inquiry","initiator_user_id":607,"source_sha256":null,"result":{"session_id":353,"staff_request_id":4,"status":"requested","automated_preparation":false,"completed":true}}}},"schema":{"$ref":"#/components/schemas/SetupInquiryReceipt"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Subscription, scope or boat limit denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Idempotency/version conflict or original result removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"413":{"description":"Input too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid input; safe code and optional numeric row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared account/service budget exhausted; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; keep the original idempotency key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"message":{"type":"string","minLength":1,"maxLength":6000},"batch_reference":{"type":"string","minLength":1,"maxLength":80}},"required":["message"]}}}},"tags":["Imports"]}},"/api/integrations/v1/sessions/{session_id}/imports/receipts/{id}":{"get":{"operationId":"getSailSyncImportReceipt","summary":"Read a completed import receipt or current staff inquiry status","description":"Requires sessions:write. Retrieve your import or setup receipt for a session you still own.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Completed receipt or current state. Retry uses the same key and returns the original result.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"receipt_id":83,"operation":"wind","initiator_user_id":602,"created_at":"2026-10-27T17:18:06.702-07:00","source_sha256":"960454e605b7b384c17bffbdaf9a7fde761cf07c56cf5b5545375dc4b647ee1e","result":{"completed":true,"session_id":347,"wind_version":"51d11f677e8229d907900c46d82d90dc20cdd5165efeed0a0867a930203789a0","compute_requested":false,"observation_count":1}}}},"schema":{"$ref":"#/components/schemas/ImportReceipt"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Subscription, scope or boat limit denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Idempotency/version conflict or original result removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"413":{"description":"Input too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid input; safe code and optional numeric row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Shared account/service budget exhausted; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; keep the original idempotency key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Imports"]}},"/api/integrations/v1/sessions/{session_id}/compute":{"post":{"operationId":"requestSailSyncRecalculation","summary":"Request bounded recalculation of an owned finished session","description":"Requires compute:write and an owned, finished session. Reuse the Idempotency-Key on retries. Acceptance is not completion; poll the returned request. Uncertain or ongoing work may block another request.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":80,"pattern":"^[A-Za-z0-9_-]{8,80}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{}}}}},"responses":{"200":{"description":"Existing request or status","content":{"application/json":{"examples":{"completedRetry":{"summary":"Synthetic integration-test response","description":"Completed receipt returned when retrying the same request. Test IDs are illustrative.","value":{"session_id":366,"request":{"id":28,"status":"completed","error":null,"source_revision":"a56d61f619725ce34b044d8b00d423b6032fcb11625d1c46656dcde2c41ceec3","dispatched_at":"2026-10-27T17:18:08.845-07:00","accepted_at":"2026-10-27T17:18:08.883-07:00","completed_at":"2026-10-27T17:18:08.910-07:00","queue_expires_at":"2026-10-27T17:23:08.794-07:00","overdue":false,"same_key_retry_safe":true,"dispatch_retry_allowed":false,"publication_fenced":true}}}},"schema":{"$ref":"#/components/schemas/ComputeReceipt"}}}},"202":{"description":"Queued, not proof of invocation or successful results","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"session_id":366,"request":{"id":28,"status":"queued","error":null,"source_revision":"a56d61f619725ce34b044d8b00d423b6032fcb11625d1c46656dcde2c41ceec3","dispatched_at":null,"accepted_at":null,"completed_at":null,"queue_expires_at":"2026-10-27T17:23:08.794-07:00","overdue":false,"same_key_retry_safe":true,"dispatch_retry_allowed":true,"publication_fenced":false}}}},"schema":{"$ref":"#/components/schemas/ComputeReceipt"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"authentication_required"}}}}}},"403":{"description":"Current scope/ownership denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"scope_required"}}}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_available"}}}}}},"409":{"description":"Flight unresolved, conflicting key or changed sources","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Input, source/track count or committed recording unsupported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"invalid_compute_request"}}}}}},"429":{"description":"Account/service budget or active-account/service guard; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; retain original key and check request status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"compute_queue_unavailable","compute_request_id":29}}}}}}},"tags":["Compute"]},"get":{"operationId":"getSailSyncComputeStatus","summary":"Read owned-session native status and private compute receipt","description":"Requires compute:write and current ownership. Poll at least 30 seconds apart. Once complete, use result_data_path to inspect the analysis.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"request_id","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"responses":{"200":{"description":"Existing request or status","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"session_id":366,"compute_status":{"state":"ready","computed_at":"2026-10-27T17:18:08-07:00","invoked_at":null,"last_attempt_failed":false,"can_retry":true},"request":{"id":28,"status":"completed","error":null,"source_revision":"a56d61f619725ce34b044d8b00d423b6032fcb11625d1c46656dcde2c41ceec3","dispatched_at":"2026-10-27T17:18:08.845-07:00","accepted_at":"2026-10-27T17:18:08.883-07:00","completed_at":"2026-10-27T17:18:08.910-07:00","queue_expires_at":"2026-10-27T17:23:08.794-07:00","overdue":false,"same_key_retry_safe":true,"dispatch_retry_allowed":false,"publication_fenced":true},"result_data_path":"/api/integrations/v1/sessions/366/data/analysis","poll_after_seconds":30,"publication_fenced":true}}},"schema":{"$ref":"#/components/schemas/ComputeStatus"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"example":{"error":"authentication_required"}}}},"403":{"description":"Current scope/ownership denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Flight unresolved, conflicting key or changed sources","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Input, source/track count or committed recording unsupported","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget or active-account/service guard; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; retain original key and check request status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"tags":["Compute"]}},"/api/integrations/v1/sessions/{session_id}/imports/track_file":{"post":{"operationId":"uploadOwnedSailSyncTrackFile","summary":"Upload a raw CSV, GPX, VKX or VTK file to an owned session","description":"Upload one explicitly selected raw CSV, GPX, VKX or VTK file (at most 20 MiB) into your own session. Local MCP reads file_path and sends multipart outside model JSON. Hosted MCP instead calls beginSailSyncTrackFileUpload; never send file bytes or a server filesystem path to hosted MCP. All points must fit the target session window. Does not recalculate metrics automatically.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":80,"pattern":"^[A-Za-z0-9_-]{8,80}$"}}],"responses":{"200":{"description":"Completed receipt or current state. Retry uses the same key and returns the original result.","content":{"application/json":{"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"receipt_id":79,"operation":"track","initiator_user_id":601,"source_sha256":"22f6a218614374b467af7f4951d194e83edd2b2725629174f36da74df02a8140","result":{"session_id":346,"session_track_id":149,"manual_track_id":125,"points_sha256":"2b3b1e0eeeacbafa87018a45571c4ea148057f9d9e8610aa27995785098b04ce","point_count":2,"already_attached":false,"compute_requested":false,"completed":true}}}},"schema":{"$ref":"#/components/schemas/TrackImportReceipt"}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"authentication_required"}}}}}},"403":{"description":"Subscription, scope or boat limit denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"scope_required"}}}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_available"}}}}}},"409":{"description":"Idempotency/version conflict or original result removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"413":{"description":"Input too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"415":{"description":"Use multipart/form-data with a file part.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid input; safe code and optional numeric row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"invalid_track_point","row":2}}}}}},"429":{"description":"Shared account/service budget exhausted; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; keep the original idempotency key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}},"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","additionalProperties":false,"required":["file","label","file_format"],"properties":{"file":{"type":"string","format":"binary","maxLength":20971520,"description":"Raw uncompressed file bytes; no archives."},"label":{"type":"string","minLength":1,"maxLength":200},"file_format":{"type":"string","enum":["csv","gpx","vkx","vtk"]},"timezone":{"type":"string","minLength":1,"maxLength":80,"description":"Explicit IANA timezone for naive CSV timestamps, e.g. Europe/Dublin."},"batch_reference":{"type":"string","minLength":1,"maxLength":80}}}}}},"tags":["Imports"]}},"/api/integrations/v1/sessions/{session_id}/imports/track_file_grant":{"post":{"operationId":"beginSailSyncTrackFileUpload","summary":"Prepare a hosted MCP track-file upload","description":"Requires sessions:write and direct ownership. Provide the exact raw byte size, SHA-256, label and format, plus a stable idempotency key. Returns a ten-minute, encrypted upload permission bound to this file and session. Send the file directly to the returned fixed SailSync URL as multipart, not through MCP. The upload returns the final import receipt; getSailSyncImportReceipt can inspect it. A compatible client or user-operated uploader must send the bytes; a hosted chat connector cannot automatically read local files. Existing shared import count/byte budgets are charged when bytes are imported, not for creating an empty permission. No object is stored at initiation.","tags":["Imports"],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":80,"pattern":"^[A-Za-z0-9_-]{8,80}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["label","file_format","byte_size","source_sha256"],"properties":{"label":{"type":"string","minLength":1,"maxLength":200},"file_format":{"type":"string","enum":["csv","gpx","vkx","vtk"]},"timezone":{"type":"string","minLength":1,"maxLength":80,"description":"Explicit IANA timezone for naive CSV timestamps, e.g. Europe/Dublin."},"batch_reference":{"type":"string","minLength":1,"maxLength":80},"byte_size":{"type":"integer","minimum":1,"maximum":20971520},"source_sha256":{"type":"string","pattern":"^[0-9a-f]{64}$"}}}}}},"responses":{"200":{"description":"Short-lived upload permission. No file has been stored or imported yet.","content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["upload_url","method","authorization","expires_in","instructions"],"properties":{"upload_url":{"type":"string"},"method":{"type":"string","enum":["POST"]},"authorization":{"type":"string"},"expires_in":{"type":"integer","minimum":1},"instructions":{"type":"string"}}},"examples":{"prepared":{"description":"Synthetic upload permission; deliberately not a usable credential.","value":{"upload_url":"https://www.sailsync.io/api/integrations/v1/sessions/42/imports/track_file_upload","method":"POST","authorization":"SailSyncUpload EXAMPLE_NOT_A_REAL_PERMISSION","expires_in":600,"instructions":"Send only the file multipart field with this Authorization header. The response is the final receipt."}}}}}},"401":{"description":"Missing, invalid, expired or revoked personal integration token.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"authentication_required"}}}}}},"403":{"description":"Subscription, scope or boat limit denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"scope_required"}}}}}},"404":{"description":"Not enabled or not owned/found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"not_available"}}}}}},"409":{"description":"Idempotency/version conflict or original result removed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"413":{"description":"Input too large","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid input; safe code and optional numeric row","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"},"examples":{"integrationTest":{"summary":"Synthetic integration-test response","description":"Sanitized test-account example. IDs are illustrative.","value":{"error":"invalid_track_point","row":2}}}}}},"429":{"description":"Shared account/service budget exhausted; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}},"headers":{"Retry-After":{"description":"Seconds before retrying.","schema":{"type":"integer"}}}},"503":{"description":"Unavailable; keep the original idempotency key","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}},"/api/integrations/v1/sessions/{session_id}/compute/wind_preview":{"post":{"operationId":"previewSailSyncLegWind","summary":"Preview wind evidence for one leg in an owned session","description":"Read-only bounded computation; requires data:read and compute:write. Uses a saved race id and one-based leg_index from analysis results, never a displayed race number. Returns evidence/uncertainty and input_version without changing configured wind. Inputs must be finished and analysis current. Unchanged previews are reused; new computations consume existing compute/input budgets. The dedicated windEstimate backend must be configured. Apply is not offered by this operation. Boat selection diagnostics report eligibility and exclusions, not confirmed solver contribution; inspect solver evidence. Applied-reference metadata does not independently verify measured wind. Rate-limit errors remain distinct from scientific uncertainty.","x-sailsync-read-only":true,"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["race_id","leg_index"],"properties":{"race_id":{"type":"integer","minimum":1,"maximum":9007199254740991},"leg_index":{"type":"integer","minimum":1,"maximum":100},"boat_ids":{"type":"array","minItems":2,"maxItems":24,"items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"expected_input_version":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64}}}}}},"responses":{"200":{"description":"Read-only preview and evidence; may abstain or report uncertainty","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegWindPreview"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"algorithm_version":"leg_wind_preview_v2","session_id":42,"race_id":1001,"leg_index":2,"input_version":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","preview_only":true,"status":"uncertain","sailing_mode":"upwind","candidate_direction":250,"observation_window":{"start_at":1793116800,"end_at":1793117400},"effective_range":null,"reasons":["seed_or_window_sensitive"],"safe_outputs":{"orientation":false,"auto_apply":false,"twa":false,"vmg":false,"start_line_bias":false},"reused":false,"wind_version":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","boat_selection":{"considered_boat_ids":[101,102,103],"included_boat_ids":[101,102],"excluded_boat_ids":[103],"excluded":[{"boat_id":103,"reason":"reaching_segment"}],"overflow_count":0,"inclusion_means":"eligible_for_proposal_not_confirmed_solver_contribution","submitted_to_solver":true,"solver_contribution":"see_solver_evidence_only"},"applied_wind_reference":{"status":"configured_series","measurement_status":"unverified","window":{"start_at":1793116800,"end_at":1793117400},"references":[{"t":1793116800,"direction":250,"source":"auto_estimate","status":"estimated","provenance":{}}],"overflow_count":0,"limitations":["configured_calculation_reference_does_not_verify_measurement_provenance"]}}}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope or compute access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Owned session or saved race/leg not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Stale analysis, changed inputs or unsupported leg window","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid preview request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"503":{"description":"Dedicated backend not configured or unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}},"/api/integrations/v1/sessions/{session_id}/compute/wind_apply":{"post":{"operationId":"applySailSyncLegWind","summary":"Apply a reviewed supported wind preview to its leg interval","description":"Requires data:read, compute:write and sessions:write on an owned session. Explicit manual adoption only; does not enable Auto or upgrade estimator quality flags. Requires a supported, unchanged preview still in the 15-minute server cache and matching wind/input versions. Refuses manual, legacy/unlabelled and measured direction intervals; there is no force replacement. Changes direction only, preserving speed and surrounding wind. Reuse Idempotency-Key for retries. Creates a durable receipt and never invokes Lambda or recalculation; use the separate recalculation operation when ready.","x-sailsync-required-scopes":["data:read","compute:write","sessions:write"],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","minLength":8,"maxLength":80,"pattern":"^[A-Za-z0-9_-]{8,80}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["race_id","leg_index","expected_input_version","expected_wind_version","confirmed"],"properties":{"race_id":{"type":"integer","minimum":1,"maximum":9007199254740991},"leg_index":{"type":"integer","minimum":1,"maximum":100},"boat_ids":{"type":"array","minItems":2,"maxItems":24,"items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"expected_input_version":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64},"expected_wind_version":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64},"confirmed":{"type":"boolean","enum":[true],"description":"Explicitly accept this supported estimate as the calculation direction for the reviewed leg interval."}}}}}},"responses":{"200":{"description":"Direction applied or unchanged idempotent retry; calculation wind and durable receipt returned","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegWindApplication"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"receipt_id":123,"session_id":42,"wind_version":"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","session":{"wind_angle":250,"wind_series":[{"t":1793116800,"direction":250,"source":"manual"}]},"effective_range":{"start_at":1793116800,"end_at":1793117400},"reused":false,"recalculation_needed":true,"compute_requested":false}}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope or compute access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Owned session or saved race/leg not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Expired, changed or unsupported preview, protected wind interval, conflicting retry or changed calculation wind","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid preview request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"503":{"description":"Dedicated backend not configured or unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}},"/api/integrations/v1/sessions/{session_id}/compute/wind_preview_batch":{"post":{"operationId":"previewSailSyncWindLegs","summary":"Compare wind previews for up to four saved race legs","description":"Read-only owned-session comparison batch; requires data:read and compute:write. Uses the same estimator and single-leg result cache. At most four distinct race/leg selections and 24 boats across their combined sources; source bytes/points and per-leg windows remain bounded. Uncached legs share one source read and one existing compute-budget reservation; a fully cached batch does not calculate again. No automatic fleet truncation, partial publication or wind changes. Review one result through the separate explicit Apply operation. Applying a result invalidates the other previews; this is not bulk Apply. Requires the batch-capable windEstimate deployment. Boat selection diagnostics report eligibility and exclusions, not confirmed solver contribution; inspect solver evidence. Applied-reference metadata does not independently verify measured wind. Rate-limit errors remain distinct from scientific uncertainty.","x-sailsync-read-only":true,"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["legs"],"properties":{"legs":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"object","additionalProperties":false,"required":["race_id","leg_index"],"properties":{"race_id":{"type":"integer","minimum":1,"maximum":9007199254740991},"leg_index":{"type":"integer","minimum":1,"maximum":100},"boat_ids":{"type":"array","minItems":2,"maxItems":24,"items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"expected_input_version":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64}}}}}}}}},"responses":{"200":{"description":"Coherent batch of per-leg previews; individual statuses may abstain or be uncertain","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegWindBatchPreview"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"session_id":42,"preview_only":true,"input_revision":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","wind_version":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","batch_version":"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd","results":[{"selection":{"race_id":1001,"leg_index":2},"preview":{"algorithm_version":"leg_wind_preview_v2","session_id":42,"race_id":1001,"leg_index":2,"input_version":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","preview_only":true,"status":"uncertain","sailing_mode":"upwind","candidate_direction":250,"observation_window":{"start_at":1793116800,"end_at":1793117400},"effective_range":null,"reasons":["seed_or_window_sensitive"],"safe_outputs":{"orientation":false,"auto_apply":false,"twa":false,"vmg":false,"start_line_bias":false},"reused":false,"wind_version":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}}]}}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope or compute access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Owned session or saved race/leg not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Stale analysis, changed inputs or unsupported leg window","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid preview request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"503":{"description":"Dedicated backend not configured or unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}},"/api/integrations/v1/sessions/{session_id}/compute/training_wind_proposal":{"post":{"operationId":"previewSailSyncTrainingWind","summary":"Create a read-only wind proposal for saved lineups or discovered training windows","description":"Owned finished sessions only; requires data:read and compute:write. Choose exactly one: lineup_ids (1–4 persisted lineup IDs) or discover:true (server selects up to four sustained classified windows spread across the session). Callers cannot supply time windows, sailing modes or boat selections. Requires fresh analysis and finalized pinned GPS sources; reaching, interrupted and mixed classifications abstain. Empty discovery returns results:[] with reasons and no compute reservation. GPS evidence may still abstain after discovery. Durable audit receipts coalesce retries. Discovery reports bounded_sample coverage, not whole-session coverage or calibrated accuracy. No fake race/lineup records, wind writes, automatic adoption, upload trigger changes or metrics recomputation. Proposal results cannot be passed to race-leg Apply. Requires the training-window-capable dedicated windEstimate deployment; older deployments fail closed.","x-sailsync-read-only":true,"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"properties":{"lineup_ids":{"type":"array","minItems":1,"maxItems":4,"uniqueItems":true,"items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"discover":{"type":"boolean","enum":[true],"description":"Server-selected windows; mutually exclusive with lineup_ids."}},"oneOf":[{"required":["lineup_ids"],"not":{"required":["discover"]}},{"required":["discover"],"not":{"required":["lineup_ids"]}}]}}}},"responses":{"200":{"description":"Durable preview-only training proposal; uncertain windows have no proposed direction","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrainingWindProposal"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"proposal_version":"training_wind_proposal_v1","algorithm_version":"leg_wind_preview_v2","session_id":42,"input_version":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","source_revision":"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd","preview_only":true,"automatic_adoption":false,"wind_changed":false,"compute_requested":false,"receipt_id":124,"reused":false,"results":[{"lineup_id":1101,"status":"insufficient","adoption":"not_enabled","effective_range":null,"proposed_direction":null,"reasons":["lineup_classification_uncertain"]}]}}}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope or compute access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Owned session or saved lineup not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Live session, unfinalized sources, stale analysis or changed inputs","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid preview request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"503":{"description":"Dedicated backend not configured or unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}},"/api/integrations/v1/wind_import_defaults":{"get":{"operationId":"getSailSyncWindImportDefaults","summary":"Read your account wind CSV defaults","description":"Shared with web/mobile. Optional exact ordered headers withhold a saved default on mismatch. Matching headers never prove device timezone, units or wind reference; review every file. Never accepts a user ID.","parameters":[{"name":"headers","in":"query","required":false,"schema":{"type":"array","minItems":1,"maxItems":128,"uniqueItems":true,"items":{"type":"string","minLength":1,"maxLength":256}}}],"responses":{"200":{"description":"Account defaults and revision, without any readings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WindCsvDefault"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"schema_version":1,"revision":0,"has_default":false,"schema_matches":null,"wind_import_default":null,"requires_confirmation":true,"averaging_window_seconds":300}}}}}},"401":{"description":"Integration authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope/access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Owned session not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Saved default revision conflict; read current default before retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid file/settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}},"put":{"operationId":"saveSailSyncWindImportDefaults","summary":"Save your account wind CSV defaults","description":"Requires data:read and sessions:write. Explicit user approval to remember interpretation only; no wind/source/session changes. Compare-and-swap expected_revision; on conflict or uncertain delivery read current defaults before deciding to retry.","x-sailsync-required-scopes":["data:read","sessions:write"],"x-sailsync-read-only":false,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["expected_revision","wind_import_default"],"properties":{"expected_revision":{"type":"integer","minimum":0,"maximum":2147483646},"wind_import_default":{"$ref":"#/components/schemas/WindCsvImportSettings"}}}}}},"responses":{"200":{"description":"Saved account defaults with incremented revision","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WindCsvDefault"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"schema_version":1,"revision":1,"has_default":true,"schema_matches":null,"wind_import_default":{"schema_version":1,"headers":["time","TWD","TWS"],"mapping":{"time":"time","direction":"TWD","speed":"TWS"},"timezone":"Etc/UTC","speed_unit":"knots","direction_reference":"true_north_from","wind_basis":"true"},"requires_confirmation":true,"averaging_window_seconds":300}}}}}},"401":{"description":"Integration authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope/access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Owned session not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Saved default revision conflict; read current default before retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid file/settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}},"delete":{"operationId":"clearSailSyncWindImportDefaults","summary":"Clear your account wind CSV defaults","description":"Requires data:read and sessions:write, explicit user approval and current revision. Retains a tombstone so older devices cannot overwrite the clear. No imported observations/session wind are deleted.","x-sailsync-required-scopes":["data:read","sessions:write"],"x-sailsync-read-only":false,"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["expected_revision"],"properties":{"expected_revision":{"type":"integer","minimum":0,"maximum":2147483646}}}}}},"responses":{"200":{"description":"Cleared defaults and current revision","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WindCsvDefault"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"schema_version":1,"revision":2,"has_default":false,"schema_matches":null,"wind_import_default":null,"requires_confirmation":true,"averaging_window_seconds":300}}}}}},"401":{"description":"Integration authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope/access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Owned session not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Saved default revision conflict; read current default before retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid file/settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}},"/api/integrations/v1/sessions/{session_id}/wind_inspection":{"post":{"operationId":"inspectSailSyncWindCsv","summary":"Inspect wind CSV content and get interpretation suggestions","description":"Owner only, data:read. Shared web/mobile inspection: column suggestions, timezone source, searchable IANA timezone options, exact-schema account defaults and supported units/reference/basis. Timestamp offsets are authoritative; GPS suggestions are approximate and require confirmation. The provided content may be a bounded CSV sample; review the complete source before importing. No defaults, observations or calculation wind are written. Uses shared bounded upload/parse budgets.","x-sailsync-read-only":true,"x-sailsync-required-scopes":["data:read"],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":false,"required":["csv_text"],"properties":{"csv_text":{"type":"string","minLength":1,"maxLength":262144,"description":"CSV content/sample, max 256 KiB UTF-8. Use stdio inspectSailSyncWindFile or REST multipart inspection for larger files."}}}}}},"responses":{"200":{"description":"Inspection suggestions and reviewable defaults only","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WindCsvInspection"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"headers":["time","TWD","TWS"],"sample":[{"time":"2026-10-27T16:00:00Z","TWD":"250","TWS":"6"}],"suggested_mapping":{"time":"time","direction":"TWD","speed":"TWS"},"timestamp_reference":"absolute","timezone_suggestion":{"timezone":"Etc/UTC","source":"timestamp_offsets","requires_confirmation":true},"timezone_options":["Etc/UTC","America/Los_Angeles"],"requires_confirmation":true,"inspection_only":true,"averaging_window_seconds":300,"account_default":{"schema_version":1,"revision":0,"has_default":false,"schema_matches":false,"wind_import_default":null,"requires_confirmation":true,"averaging_window_seconds":300}}}}}}},"401":{"description":"Integration authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope/access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Owned session not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Saved default revision conflict; read current default before retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid file/settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}},"/api/integrations/v1/sessions/{session_id}/wind_file_inspection":{"post":{"operationId":"inspectSailSyncWindFile","summary":"Inspect an explicitly selected local wind CSV up to 20 MiB","description":"Owner only, data:read. Shared web/mobile inspection: column suggestions, timezone source, searchable IANA timezone options, exact-schema account defaults and supported units/reference/basis. Timestamp offsets are authoritative; GPS suggestions are approximate and require confirmation. The provided content may be a bounded CSV sample; review the complete source before importing. No defaults, observations or calculation wind are written. Uses shared bounded upload/parse budgets. Local file_path is supported by stdio MCP only. Hosted MCP uses inspectSailSyncWindCsv; REST accepts multipart file.","x-sailsync-read-only":true,"x-sailsync-required-scopes":["data:read"],"x-sailsync-file-formats":["csv"],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"type":"object","additionalProperties":false,"required":["file"],"properties":{"file":{"type":"string","format":"binary"}}}}}},"responses":{"200":{"description":"Full-file inspection with no import/Apply","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WindCsvInspection"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"headers":["time","TWD","TWS"],"sample":[{"time":"2026-10-27T16:00:00Z","TWD":"250","TWS":"6"}],"suggested_mapping":{"time":"time","direction":"TWD","speed":"TWS"},"timestamp_reference":"absolute","timezone_suggestion":{"timezone":"Etc/UTC","source":"timestamp_offsets","requires_confirmation":true},"timezone_options":["Etc/UTC","America/Los_Angeles"],"requires_confirmation":true,"inspection_only":true,"averaging_window_seconds":300,"account_default":{"schema_version":1,"revision":0,"has_default":false,"schema_matches":false,"wind_import_default":null,"requires_confirmation":true,"averaging_window_seconds":300}}}}}}},"401":{"description":"Integration authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope/access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Owned session not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Saved default revision conflict; read current default before retry","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid file/settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Account/service budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}},"/api/integrations/v1/sessions/{session_id}/data/lineups":{"get":{"operationId":"getSailSyncLineupStats","summary":"Read saved lineup boat stats with inline wind speed, direction, variation and coverage","description":"Read-only saved full-lineup SOG, wind VMG and absolute TWA, with one shared applied wind_context per lineup. No FLO credits, GPS fetch or recomputation. Wind describes current configured calculation inputs, not raw sensor coverage, measured gusts, accuracy or verified alignment with saved metrics. Includes averaging/carried-value provenance and missing values. Page lineups with offset/next_offset; continue boats for an individual lineup with lineup_id and before_boat_id. Continuations require expected_snapshot. Missing saved lineup analysis returns not_ready; a computed empty lineup list is valid. Existing session/event-day permissions and data rate limits apply. Sailed distance is distance_m in metres. max_sog_3s_kt and max_sog_5s_kt are numeric saved rolling maximum speeds in knots; unavailable values are null. Saved direction/reaching labels are exposed with an applied-wind-reference basis. Optional direction filters apply before paging and are bound into the snapshot. Older artifacts lacking these fields return unknown; no classification, GPS fetch or recompute is performed by this read. Signed/absolute heel and pitch plus independent sensor support are included when persisted. Older artifacts return null with not_in_saved_artifact; no recalculation occurs on read. Original sensor sign is not windward/leeward. Wind-based VMG/TWA remain conditional on applied wind.","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"lineup_id","in":"query","description":"Optional opaque lineup id from this response; never a displayed lineup number.","schema":{"type":"string","maxLength":100}},{"name":"offset","in":"query","description":"Lineup page offset. Continuation requires expected_snapshot.","schema":{"type":"integer","minimum":0,"maximum":1000000,"default":0}},{"name":"limit","in":"query","description":"Maximum lineups in this page.","schema":{"type":"integer","minimum":1,"maximum":10,"default":5}},{"name":"boat_limit","in":"query","description":"Maximum saved boat rows per lineup.","schema":{"type":"integer","minimum":1,"maximum":100,"default":50}},{"name":"before_boat_id","in":"query","description":"Continue one lineup in descending boat-id order. Requires lineup_id and expected_snapshot; use that lineup next_before_boat_id.","schema":{"type":"integer","minimum":1,"maximum":9007199254740991}},{"name":"expected_snapshot","in":"query","description":"Opaque snapshot.ref from the first response. Required for either pagination cursor; changed session inputs reject continuation.","schema":{"type":"string","maxLength":100}},{"name":"direction","in":"query","description":"Optional saved sailing direction. Upwind/downwind exclude reaches; mixed and unknown are explicit. Applied before lineup pagination; repeat the same direction and expected_snapshot on continuation.","schema":{"type":"string","enum":["upwind","downwind","reach","mixed","unknown"]}}],"responses":{"200":{"description":"Saved lineup stats and exact-window applied wind","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LineupStatsPage"},"examples":{"trainingLineup":{"summary":"Saved lineup with one shared applied-wind summary","description":"Synthetic sanitized contract example; IDs and snapshot are illustrative. Use values from your current response for pagination.","value":{"schema_version":"subscriber_lineup_stats_v1","session_id":811,"snapshot":{"ref":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","schema_version":"race_debrief_facts_v1","artifact_run_id":null,"computed_at":"2026-10-28T20:00:00Z","revision_completeness":"partial","missing_revision_components":["artifact_source_revision_binding","artifact_run_id"],"freshness":"no_newer_recorded_inputs","refresh_required":false,"raw_gps_coverage_verified":false},"total_count":1,"returned_count":1,"lineups":[{"id":"71","index":1,"label":"Lineup 1","time_range":{"start":1793217600,"end":1793218200},"available":true,"reason":null,"metric_window_basis":"full_saved_lineup_window","wind_context":{"schema_version":"applied_wind_window_v1","input_version":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","basis":"applied_calculation_wind","metrics_alignment":"not_verified","requested_seconds":600,"session_overlap_seconds":600,"outside_session_seconds":0,"range_count":1,"limitations":["Configured coverage is not raw sensor coverage.","Variation describes applied values, not sensor accuracy.","Saved metrics may use older wind; correlation is not causation."],"speed":{"available":true,"mean":8.2,"unit":"kt","configured_seconds":600,"missing_seconds":0,"configured_coverage_percent":100,"observation_coverage":"not_resolved","sources":[{"kind":"configured_series","configured_seconds":600}],"sources_truncated":false,"stddev":1.2,"min":7,"max":9.4},"direction":{"available":true,"mean":0,"unit":"deg_true_from","configured_seconds":600,"missing_seconds":0,"configured_coverage_percent":100,"observation_coverage":"not_resolved","sources":[{"kind":"configured_series","configured_seconds":600}],"sources_truncated":false,"resultant_length":0.9998,"circular_stddev_deg":1,"end_minus_start_deg":2}},"boats":[{"boat_id":"25005","name":"Example sailor","metrics":{"avg_sog_kt":6.2,"avg_vmg_kt":4.3,"avg_abs_twa_deg":42,"max_sog_3s_kt":6.8,"max_sog_5s_kt":6.6,"distance_m":728.5,"avg_heel_deg":null,"avg_abs_heel_deg":null,"avg_pitch_deg":null,"avg_abs_pitch_deg":null},"direction":"upwind","is_reach":false,"classification_basis":"applied_wind_reference","attitude_context":{"schema_version":"lineup_attitude_v1","time_range":null,"averaging_basis":null,"sign_convention":"recorded_sensor_sign_not_windward_leeward","max_gap_seconds":null,"extrapolation":false,"valid_sensor_range_deg":[-180,180],"wind_independent":true,"sensors":{"heel":{"status":"unavailable","reason":"not_in_saved_artifact","supported_seconds":null,"coverage_fraction":null,"sample_count_in_window":null},"pitch":{"status":"unavailable","reason":"not_in_saved_artifact","supported_seconds":null,"coverage_fraction":null,"sample_count_in_window":null}}}}],"next_before_boat_id":null,"kind":"lineup","direction":"upwind"}],"units":{"avg_sog_kt":"kt","avg_vmg_kt":"kt","avg_abs_twa_deg":"deg","max_sog_3s_kt":"kt","max_sog_5s_kt":"kt","distance_m":"m","avg_heel_deg":"deg","avg_abs_heel_deg":"deg","avg_pitch_deg":"deg","avg_abs_pitch_deg":"deg"},"next_offset":null,"model_called":false,"wind_changed":false,"metrics_recomputed":false,"filters":{}}}}}}},"401":{"description":"Integration authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Scope/subscription required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Session or lineup unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Saved analysis unavailable or snapshot changed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid bounded filters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Data/read budget exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"503":{"description":"Rate limit service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}},"/api/integrations/v1/sessions/{session_id}/data/lineups/{lineup_id}/series":{"post":{"operationId":"prepareSailSyncLineupSeries","summary":"Prepare bounded aligned metrics for one saved lineup","description":"Explicit read-only preparation with data:read scope and shared hourly source/output/concurrency budgets. Select exact UTC bounds, boat IDs and metrics; averaging (default trailing5s) is separate from output interval (default2s). Reads complete committed source objects before cropping; a short output does not guarantee cheap source I/O. Caps eight boats,30min range,500 timestamps,6000 metric cells and1MiB result; excessive requests reject rather than silently coarsen or truncate. Five-minute cached results remain source-pinned and access-rechecked. SOG/COG use trailing-window endpoint displacement, not sailed-path average; turns can understate path speed. VMG/TWA use the applied calculation wind at sample time. Independent heel/pitch support preserves missingness; early unsupported windows are null. Nearby wind speed/direction context is returned only for verified applied-file intervals with lineage and original averaging resolution. No relative reference subtraction, gap curve, wind solve, report generation or saved metric mutation.","x-sailsync-read-only":true,"x-sailsync-required-scopes":["data:read"],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"integer","minimum":1}},{"name":"lineup_id","in":"path","required":true,"schema":{"type":"string","pattern":"^[1-9][0-9]*$","maxLength":16}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LineupMetricSeriesRequest"},"example":{"boat_ids":["101","102"],"metrics":["sog_kt","vmg_kt","heel_deg","abs_heel_deg"],"averaging_seconds":5,"sample_seconds":2}}}},"responses":{"200":{"description":"Bounded prepared series; missing source/metric coverage remains explicit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LineupMetricSeries"},"examples":{"fixture":{"summary":"Synthetic response fixture, not customer data","value":{"schema_version":"lineup_metric_series_v1","session_id":42,"lineup_id":"1001","lineup_time_range":{"start":1793116800,"end":1793116804},"time_range":{"start":1793116800,"end":1793116804},"snapshot":{"ref":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","input_version":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","source_pinned":true},"parameters":{"boat_ids":["101"],"metrics":["sog_kt"],"start_at":1793116800,"end_at":1793116804,"averaging_seconds":1,"sample_seconds":2,"averaging_alignment":"trailing","grid_anchor":1793116800,"include_exact_end":true},"timestamps":[1793116800,1793116802,1793116804],"boats":[{"boat_id":"101","source_ref":"dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd","available":true,"reason":null,"series":{"sog_kt":[null,5,5]},"support_seconds":{"sog_kt":[0,1,1]},"reasons":{"sog_kt":["averaging_window_outside_lineup",null,null]},"sample_validity":{"sog_kt":{"valid_samples":2,"total_samples":3}},"tack":["starboard","starboard","starboard"],"wind_axis_mode":["upwind_half_plane","upwind_half_plane","upwind_half_plane"]}],"units":{"sog_kt":"kt"},"calculation_wind_context":{"schema_version":"applied_wind_window_v1","input_version":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","basis":"applied_calculation_wind","metrics_alignment":"not_verified","requested_seconds":600,"session_overlap_seconds":600,"outside_session_seconds":0,"range_count":1,"limitations":["Configured coverage is not raw sensor coverage.","Variation describes applied values, not sensor accuracy.","Saved metrics may use older wind; correlation is not causation."],"speed":{"available":true,"mean":8.2,"unit":"kt","configured_seconds":600,"missing_seconds":0,"configured_coverage_percent":100,"observation_coverage":"not_resolved","sources":[{"kind":"configured_series","configured_seconds":600}],"sources_truncated":false,"stddev":1.2,"min":7,"max":9.4},"direction":{"available":true,"mean":0,"unit":"deg_true_from","configured_seconds":600,"missing_seconds":0,"configured_coverage_percent":100,"observation_coverage":"not_resolved","sources":[{"kind":"configured_series","configured_seconds":600}],"sources_truncated":false,"resultant_length":0.9998,"circular_stddev_deg":1,"end_minus_start_deg":2}},"applied_file_wind":{"schema_version":"applied_file_wind_series_v1","available":false,"reason":"no_verified_applied_file_wind","wind_input_version":"cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","time_range":{"start":1793116800,"end":1793116804},"direction_deg":[null,null,null],"speed_kt":[null,null,null],"direction_reasons":["not_file_backed","not_file_backed","not_file_backed"],"speed_reasons":["not_file_backed","not_file_backed","not_file_backed"],"effective_ranges":[],"coverage":{"direction":{"file_backed_seconds":0,"coverage_fraction":0,"carried_seconds":0,"observation_coverage":"not_resolved"},"speed":{"file_backed_seconds":0,"coverage_fraction":0,"carried_seconds":0,"observation_coverage":"not_resolved"}},"sampling_basis":"effective_applied_steps_at_output_timestamps","limitations":["Finer output does not reconstruct measured gusts."]},"policy":{"motion_basis":"trailing_window_endpoint_chord_velocity"},"preparation":{"cache_hit":false,"source_reads":1,"source_bytes":4096},"model_called":false,"wind_changed":false,"metrics_recomputed":false}}}}}},"401":{"description":"Integration authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"403":{"description":"Read scope or plan required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"404":{"description":"Session, authorized participant or saved lineup not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"409":{"description":"Saved analysis not ready or input/source snapshot changed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"413":{"description":"Source or request byte budget exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"415":{"description":"application/json required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"422":{"description":"Invalid selection or configured range/point/cell/output bounds exceeded","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"429":{"description":"Hourly/concurrency/repeat budget exceeded; honor Retry-After","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}},"503":{"description":"Budget service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationError"}}}}}}}},"components":{"securitySchemes":{"integrationToken":{"type":"http","scheme":"bearer","description":"ssi_ personal API token; environment secret for local MCP. Never place it in URLs or tool arguments."}},"schemas":{"IntegrationError":{"type":"object","required":["error"],"properties":{"error":{"type":"string","description":"Machine-readable error code."},"reason":{"type":"string","nullable":true},"budget":{"type":"string"},"limit":{"type":"integer"},"remaining":{"type":"integer"},"reset_at":{"type":"integer","description":"UTC Unix seconds."},"retry_after":{"type":"integer","description":"Seconds to wait before retrying."}},"additionalProperties":true,"description":"Machine-readable failure. Extra operation-specific detail fields may be present."},"SubscriberAccount":{"type":"object","required":["schema_version","user_id","plan","scopes","capabilities","compute_available","imports_available","flo_available","limits"],"properties":{"schema_version":{"type":"string","enum":["subscriber_api_v1"]},"user_id":{"type":"integer"},"plan":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"capabilities":{"type":"array","items":{"type":"string"}},"compute_available":{"type":"boolean"},"imports_available":{"type":"boolean"},"flo_available":{"type":"boolean"},"limits":{"type":"object","required":["max_page_size"],"properties":{"max_page_size":{"type":"integer"},"data_minute":{"type":"integer","minimum":1},"data_hour":{"type":"integer","minimum":1},"data_day":{"type":"integer","minimum":1},"account_concurrency":{"type":"integer","minimum":1}}}}},"OwnedSessionSummary":{"type":"object","required":["id","name","boat_class","start_time","end_time","effective_start_time","effective_end_time","first_race_number","track_count"],"properties":{"id":{"type":"integer"},"name":{"type":"string","nullable":true},"boat_class":{"type":"string","nullable":true},"start_time":{"type":"string","format":"date-time","nullable":true},"end_time":{"type":"string","format":"date-time","nullable":true},"effective_start_time":{"type":"string","format":"date-time","nullable":true},"effective_end_time":{"type":"string","format":"date-time","nullable":true},"first_race_number":{"type":"integer"},"track_count":{"type":"integer"}}},"OwnedSessionPage":{"type":"object","required":["schema_version","sessions","next_before_id"],"properties":{"schema_version":{"type":"string","enum":["subscriber_sessions_v1"]},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/OwnedSessionSummary"}},"next_before_id":{"type":"integer","nullable":true}}},"EpochWindow":{"type":"object","properties":{"start":{"type":"number","nullable":true},"end":{"type":"number","nullable":true},"end_precise":{"type":"number","nullable":true}},"additionalProperties":true,"description":"UTC Unix seconds; missing boundaries may be null."},"LocalTime":{"type":"object","properties":{"epoch":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"utc":{"type":"string","format":"date-time"},"local":{"type":"string"},"label":{"type":"string"},"time_zone":{"type":"string"}},"additionalProperties":true,"description":"Display time context can differ from the event venue; use epoch/utc for comparisons."},"RaceMetadata":{"type":"object","properties":{"id":{"type":"string","description":"Stable race identifier. Pass this value unchanged to race analysis endpoints; never use the display number as an ID."},"index":{"type":"integer"},"display_number":{"type":"integer"},"label":{"type":"string"},"heat":{"type":"string","nullable":true},"time_range":{"$ref":"#/components/schemas/EpochWindow"}},"additionalProperties":true,"required":["id","index","display_number","label","heat","time_range"]},"OwnedSessionDetail":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"name":{"type":"string","nullable":true},"boat_class":{"type":"string","nullable":true},"first_race_number":{"type":"integer"},"start_time":{"type":"string","format":"date-time"},"end_time":{"type":"string","format":"date-time"}},"additionalProperties":true,"required":["id","name","boat_class","first_race_number","start_time","end_time"]},"OwnedTrack":{"type":"object","properties":{"session_track_id":{"type":"integer","minimum":1},"manual_track_id":{"type":"integer","nullable":true},"points_sha256":{"type":"string","nullable":true},"data_revision":{"type":"integer","nullable":true},"name":{"type":"string"},"type":{"type":"string","nullable":true},"time_offset":{"type":"number","nullable":true},"sailing_window":{"type":"array","items":{"type":"number","nullable":true},"minItems":2,"maxItems":2,"nullable":true,"description":"Track sailing-window start and end in UTC Unix seconds."},"gps_supported":{"type":"boolean"}},"additionalProperties":true,"required":["session_track_id","manual_track_id","points_sha256","data_revision","name","type","time_offset","sailing_window","gps_supported"]},"OwnedSessionResponse":{"type":"object","properties":{"schema_version":{"type":"string","enum":["subscriber_session_v1"]},"session":{"$ref":"#/components/schemas/OwnedSessionDetail"},"tracks":{"type":"array","items":{"$ref":"#/components/schemas/OwnedTrack"}},"next_before_track_id":{"type":"integer","nullable":true}},"additionalProperties":true,"required":["schema_version","session","tracks","next_before_track_id"]},"GpsPoint":{"type":"object","properties":{"time_epoch":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"lat":{"type":"number","nullable":true,"minimum":-90,"maximum":90},"lng":{"type":"number","nullable":true,"minimum":-180,"maximum":180}},"additionalProperties":true,"description":"An invalid fix has null coordinates; keep it as a position barrier.","required":["time_epoch","lat","lng"]},"GpsPage":{"type":"object","properties":{"available":{"type":"boolean","enum":[true]},"session_id":{"type":"integer","minimum":1},"session_track_id":{"type":"integer","minimum":1},"resolution":{"type":"string","enum":["committed_full_resolution_gps"]},"source_ref":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."},"time_basis":{"type":"string","enum":["session_epoch_seconds_with_track_offset"]},"time_offset":{"type":"number"},"window":{"type":"object","required":["start","end"],"properties":{"start":{"type":"number","description":"UTC Unix seconds."},"end":{"type":"number","description":"UTC Unix seconds."}},"additionalProperties":true},"point_count":{"type":"integer","minimum":0},"points":{"type":"array","items":{"$ref":"#/components/schemas/GpsPoint"}},"next_cursor":{"type":"string","nullable":true,"description":"Signed continuation cursor, or null on the final page. Expires in 15 minutes."}},"additionalProperties":true,"required":["available","session_id","session_track_id","resolution","source_ref","time_basis","time_offset","window","point_count","points","next_cursor"]},"UnavailableGps":{"type":"object","properties":{"available":{"type":"boolean","enum":[false]},"reason":{"type":"string"},"points":{"type":"array","items":{"$ref":"#/components/schemas/GpsPoint"},"maxItems":0},"next_cursor":{"type":"string","nullable":true,"enum":[null]}},"additionalProperties":true,"description":"An unsupported, uncommitted or unavailable source returns HTTP 409 without an error key.","required":["available","reason","points","next_cursor"]},"SubscriberEvent":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"title":{"type":"string"},"starts_on":{"type":"string","format":"date","nullable":true},"ends_on":{"type":"string","format":"date","nullable":true},"timezone":{"type":"string","nullable":true},"location":{"type":"string","nullable":true},"description":{"type":"string","nullable":true},"boat_classes":{"type":"array","items":{"type":"string"}}},"additionalProperties":true,"required":["id","title","starts_on","ends_on","timezone","location","description","boat_classes"]},"EventPage":{"type":"object","properties":{"events":{"type":"array","items":{"$ref":"#/components/schemas/SubscriberEvent"}},"page":{"type":"integer","minimum":1},"next_page":{"type":"integer","nullable":true},"total":{"type":"integer","minimum":0}},"additionalProperties":true,"required":["events","page","next_page","total"]},"EventSession":{"type":"object","properties":{"assignment_id":{"type":"integer","minimum":1},"session_id":{"type":"integer","minimum":1},"date":{"type":"string","format":"date","nullable":true},"division":{"type":"string","nullable":true},"boat_class":{"type":"string","nullable":true},"races":{"type":"array","items":{"$ref":"#/components/schemas/RaceMetadata"}},"access_allowed":{"type":"boolean"},"access_path":{"type":"string","description":"Relative subscriber API path. This path does not independently grant access."}},"additionalProperties":true,"required":["assignment_id","session_id","date","division","boat_class","races","access_allowed","access_path"]},"EventDetail":{"type":"object","properties":{"event":{"$ref":"#/components/schemas/SubscriberEvent"},"sessions":{"type":"array","items":{"$ref":"#/components/schemas/EventSession"}},"next_after_assignment_id":{"type":"integer","nullable":true}},"additionalProperties":true,"required":["event","sessions","next_after_assignment_id"]},"DayAccess":{"type":"object","properties":{"event_id":{"type":"integer","minimum":1},"assignment_id":{"type":"integer","minimum":1},"session_id":{"type":"integer","minimum":1},"allowed":{"type":"boolean"},"state":{"type":"string","enum":["already_available","access_required"]},"day":{"type":"string","format":"date","nullable":true},"unit":{"type":"object","properties":{"report_date":{"type":"string","format":"date"},"fleet_key":{"type":"string"}},"additionalProperties":true,"nullable":true},"allowance_debited":{"type":"integer","enum":[0]},"flo_credits_debited":{"type":"integer","enum":[0]},"data_path":{"type":"string","description":"Relative subscriber API path. This path does not independently grant access.","nullable":true}},"additionalProperties":true,"required":["event_id","assignment_id","session_id","allowed","state","day","unit","allowance_debited","flo_credits_debited","data_path"]},"SessionManifest":{"type":"object","properties":{"session":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"name":{"type":"string","nullable":true},"boat_class":{"type":"string","nullable":true},"first_race_number":{"type":"integer"},"start":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"end":{"type":"number","description":"UTC Unix seconds, potentially fractional."}},"additionalProperties":true,"required":["id","name","boat_class","first_race_number","start","end"]},"races":{"type":"array","items":{"$ref":"#/components/schemas/RaceMetadata"}},"tracks":{"type":"array","items":{"type":"object","properties":{"session_track_id":{"type":"integer","minimum":1},"type":{"type":"string","nullable":true},"name":{"type":"string"},"time_offset":{"type":"number","nullable":true},"sailing_window":{"type":"array","items":{"type":"number","nullable":true},"minItems":2,"maxItems":2,"nullable":true,"description":"Track sailing-window start and end in UTC Unix seconds."},"gps_path":{"type":"string","description":"Relative subscriber API path. This path does not independently grant access.","nullable":true}},"additionalProperties":true,"required":["session_track_id","type","name","time_offset","sailing_window","gps_path"]}},"next_after_track_id":{"type":"integer","nullable":true},"analysis_path":{"type":"string","description":"Relative subscriber API path. This path does not independently grant access."},"wind_path":{"type":"string","description":"Relative subscriber API path. This path does not independently grant access."},"permissions":{"type":"object","properties":{"read":{"type":"boolean","enum":[true]},"write":{"type":"boolean","enum":[false]}},"additionalProperties":true,"required":["read","write"]},"lineups_path":{"type":"string","description":"Read-only saved lineup stats with inline applied wind_context; requires the same authorized session access."}},"additionalProperties":true,"required":["session","races","tracks","next_after_track_id","analysis_path","wind_path","permissions"]},"WindPoint":{"type":"object","properties":{"t":{"oneOf":[{"type":"number","nullable":true},{"type":"string"}],"description":"Numeric value in normal observations. Legacy saved rows may retain a numeric string or null."},"direction":{"oneOf":[{"type":"number","nullable":true},{"type":"string"}],"description":"Numeric value in normal observations. Legacy saved rows may retain a numeric string or null."},"avg_kt":{"oneOf":[{"type":"number","nullable":true},{"type":"string"}],"description":"Numeric value in normal observations. Legacy saved rows may retain a numeric string or null."},"gust_kt":{"oneOf":[{"type":"number","nullable":true},{"type":"string"}],"description":"Numeric value in normal observations. Legacy saved rows may retain a numeric string or null."},"lull_kt":{"oneOf":[{"type":"number","nullable":true},{"type":"string"}],"description":"Numeric value in normal observations. Legacy saved rows may retain a numeric string or null."},"source":{"type":"string","nullable":true},"derived_from":{"type":"object","nullable":true,"properties":{"race_id":{"oneOf":[{"type":"integer"},{"type":"string"}]},"race_start":{"type":"number"},"lineup_id":{"oneOf":[{"type":"integer"},{"type":"string"}]},"lineup_start":{"type":"number"},"level":{"type":"integer"},"v":{"type":"integer"}},"additionalProperties":true,"description":"Provenance metadata from the editor/automatic wind merge; present only on applicable rows."},"confidence":{"oneOf":[{"type":"number","nullable":true},{"type":"string"}],"description":"Numeric value in normal observations. Legacy saved rows may retain a numeric string or null."}},"additionalProperties":true,"description":"Configured wind row; available fields depend on series/source. Legacy metadata remains extensible.","nullable":true},"WindPage":{"type":"object","properties":{"series":{"type":"string","enum":["direction","speed"]},"unit":{"type":"string","enum":["degrees","knots"]},"representation":{"type":"string","enum":["configured_session_step_series"]},"snapshot_ref":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."},"total_count":{"type":"integer","minimum":0},"default_direction_deg":{"type":"number","nullable":true},"default_speed_kt":{"type":"number","nullable":true},"points":{"type":"array","items":{"$ref":"#/components/schemas/WindPoint"}},"next_offset":{"type":"integer","nullable":true}},"additionalProperties":true,"required":["series","unit","representation","snapshot_ref","total_count","default_direction_deg","default_speed_kt","points","next_offset"]},"AnalysisSnapshot":{"type":"object","properties":{"ref":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."},"schema_version":{"type":"string","enum":["race_debrief_facts_v1"]},"artifact_run_id":{"type":"string","nullable":true},"computed_at":{"type":"string","format":"date-time","nullable":true},"revision_completeness":{"type":"string","enum":["partial"]},"missing_revision_components":{"type":"array","items":{"type":"string"}},"freshness":{"type":"string"},"refresh_required":{"type":"boolean"},"raw_gps_coverage_verified":{"type":"boolean","enum":[false]}},"additionalProperties":true,"required":["ref","schema_version","artifact_run_id","computed_at","revision_completeness","missing_revision_components","freshness","refresh_required","raw_gps_coverage_verified"]},"AnalysisRace":{"type":"object","properties":{"id":{"type":"string","description":"Stable race identifier. Pass this value unchanged to race analysis endpoints; never use the display number as an ID."},"kind":{"type":"string","enum":["race"]},"label":{"type":"string","nullable":true},"index":{"type":"integer"},"display_number":{"type":"integer"},"boat_ids":{"type":"array","items":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."}},"available":{"type":"boolean"},"reason":{"type":"string","nullable":true},"legs":{"type":"array","items":{"type":"object","properties":{"leg_index":{"type":"integer","minimum":1},"kind":{"type":"string","enum":["race_leg"]},"direction":{"type":"string","enum":["upwind","downwind","reach","mixed","unknown"]},"direction_basis":{"type":"string","nullable":true,"enum":["saved_analysis",null],"description":"Saved classified segments for this course leg; no fresh wind solve. Unknown when missing; existing freshness/snapshot limitations apply."}},"additionalProperties":true,"required":["leg_index","kind","direction","direction_basis"]}},"snapshot":{"$ref":"#/components/schemas/AnalysisSnapshot"}},"additionalProperties":true,"required":["id","kind","label","index","display_number","boat_ids","available","reason","legs","snapshot"]},"AnalysisCatalog":{"type":"object","properties":{"schema_version":{"type":"string","enum":["race_debrief_facts_v1"]},"session_id":{"type":"string"},"status":{"type":"string","enum":["ready","not_ready"]},"reason":{"type":"string","nullable":true},"refresh_required":{"type":"boolean"},"freshness":{"type":"string"},"access":{"type":"object","properties":{"allowed":{"type":"boolean"},"required_plans":{"type":"array","items":{"type":"string"}},"trial_activation_supported":{"type":"boolean","enum":[false]}},"additionalProperties":true,"required":["allowed","required_plans","trial_activation_supported"]},"boats":{"type":"array","items":{"type":"object","properties":{"boat_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"name":{"type":"string","nullable":true}},"additionalProperties":true,"required":["boat_id","name"]}},"races":{"type":"array","items":{"$ref":"#/components/schemas/AnalysisRace"}},"comparison_policies":{"type":"array","items":{"type":"string","enum":["named_rival","leading_finishers"]}},"filters":{"type":"object","properties":{"direction":{"type":"string","enum":["upwind","downwind","reach","mixed","unknown"]}},"additionalProperties":false},"matching_race_count":{"type":"integer","minimum":0},"matching_leg_count":{"type":"integer","minimum":0}},"additionalProperties":true,"required":["schema_version","session_id","status","reason","refresh_required","freshness","access","boats","races","comparison_policies"]},"RaceResult":{"type":"object","properties":{"boat_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"boat_name":{"type":"string","nullable":true},"boat_color":{"type":"string","nullable":true},"status":{"type":"string","description":"Recorded/inferred completion status, e.g. finished, partial, not_started, excluded or unknown."},"finish_time":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"elapsed_seconds":{"type":"number"},"legs_completed":{"type":"integer"},"legs_expected":{"type":"integer"},"failed_leg_index":{"type":"integer"},"reason":{"type":"string"},"result_source":{"type":"string"},"last_recorded_leg_end":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"overall_order":{"type":"integer"},"position":{"type":"integer","description":"Fleet-relative position within this race, independent of page order."},"finish_time_local":{"$ref":"#/components/schemas/LocalTime"},"last_recorded_leg_end_local":{"$ref":"#/components/schemas/LocalTime"},"requested_leg":{"type":"object","properties":{"leg_index":{"type":"integer"},"time_range":{"$ref":"#/components/schemas/EpochWindow"},"metrics":{"type":"object","properties":{},"additionalProperties":true,"description":"Saved leg metrics. Keys depend on artifact version; units are supplied alongside metrics."},"wind_context":{"$ref":"#/components/schemas/AppliedWindWindow"}},"additionalProperties":true}},"additionalProperties":true,"required":["boat_id","status","legs_completed","legs_expected"]},"RaceResultsPage":{"type":"object","properties":{"schema_version":{"type":"string","enum":["subscriber_saved_analysis_v1"]},"session_id":{"type":"integer","minimum":1},"scope_id":{"type":"string"},"snapshot":{"$ref":"#/components/schemas/AnalysisSnapshot"},"fleet_count":{"type":"integer"},"next_before_boat_id":{"type":"integer","nullable":true},"paging_order":{"type":"string","enum":["boat_id_descending"]},"scope":{"type":"string","enum":["within_this_race_only"]},"model_called":{"type":"boolean","enum":[false]},"results":{"type":"array","items":{"$ref":"#/components/schemas/RaceResult"}},"summary":{"type":"object","properties":{"boat_count":{"type":"integer"},"finish_count":{"type":"integer"},"partial_count":{"type":"integer"},"not_started_count":{"type":"integer"},"excluded_count":{"type":"integer"},"other_count":{"type":"integer"},"requested_leg_index":{"type":"integer","nullable":true}},"additionalProperties":true}},"additionalProperties":true,"description":"On an empty continuation page summary may be absent. Positions remain fleet-relative.","required":["schema_version","session_id","scope_id","snapshot","fleet_count","next_before_boat_id","paging_order","scope","model_called","results"]},"StartStatistics":{"type":"object","properties":{"boat_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"boat_name":{"type":"string"},"boat_color":{"type":"string"},"start_time":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"cross_time":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"start_time_local":{"$ref":"#/components/schemas/LocalTime"},"cross_time_local":{"$ref":"#/components/schemas/LocalTime"},"finish_position":{"type":"integer"},"finish_status":{"type":"string"},"excluded_from_stats":{"type":"boolean"},"line_end_bucket":{"type":"string"},"tack_at_go":{"type":"string"},"ocs":{"type":"object","properties":{"status":{"type":"string"},"verdict":{"type":"string"},"over_at_go":{"type":"boolean"},"evidence_kind":{"type":"string","nullable":true},"evidence_version":{"type":"string"},"suppressed":{"type":"boolean"},"first_legal_cross_time":{"type":"number","nullable":true},"cleared_time":{"type":"number","nullable":true}},"additionalProperties":true,"description":"Saved OCS evidence/verdict. Additional raw-coverage and exclusion fields depend on the artifact."},"calculation_basis":{"type":"object","properties":{},"additionalProperties":true,"description":"Saved computation provenance for these start metrics."},"start_type":{"type":"string"},"start_type_source":{"type":"string"},"windward_progress_m":{"type":"object","additionalProperties":{"type":"number","nullable":true},"description":"Metric/horizon name to numeric value; unavailable values may be null."},"mark_one_progress_m":{"type":"object","additionalProperties":{"type":"number","nullable":true},"description":"Metric/horizon name to numeric value; unavailable values may be null."},"reach_favored_end":{"type":"string"},"metrics":{"type":"object","additionalProperties":{"type":"number","nullable":true},"description":"Metric/horizon name to numeric value; unavailable values may be null."},"units":{"type":"object","additionalProperties":{"type":"string"},"description":"Metric name to its unit."},"warnings":{"type":"array","items":{"type":"string"}},"line_position_pct":{"type":"number"},"line_projection_pct_unclamped":{"type":"number"},"line_position_bias_vs_midline_m":{"type":"number"},"signed_distance_to_line_at_go_m":{"type":"number"},"distance_to_line_at_go_m":{"type":"number"},"time_late_to_cross_s":{"type":"number"},"sog_at_go_kt":{"type":"number"},"sog_15s_after_go_kt":{"type":"number"},"elapsed_seconds":{"type":"number"},"mark_one_distance_at_go_m":{"type":"number"},"reach_line_position_bias_m":{"type":"number"},"reach_favored_end_advantage_m":{"type":"number"}},"additionalProperties":true,"description":"Absent metrics are omitted, not zero. Reaching starts can omit windward-referenced fields.","required":["boat_id"]},"StartStatisticsPage":{"type":"object","properties":{"schema_version":{"type":"string","enum":["subscriber_saved_analysis_v1"]},"session_id":{"type":"integer","minimum":1},"scope_id":{"type":"string"},"snapshot":{"$ref":"#/components/schemas/AnalysisSnapshot"},"fleet_count":{"type":"integer"},"next_before_boat_id":{"type":"integer","nullable":true},"paging_order":{"type":"string","enum":["boat_id_descending"]},"scope":{"type":"string","enum":["within_this_race_only"]},"model_called":{"type":"boolean","enum":[false]},"start_stats":{"type":"array","items":{"$ref":"#/components/schemas/StartStatistics"}},"start_line":{"type":"object","properties":{"available":{"type":"boolean"},"unavailable_reason":{"type":"string","nullable":true},"at_time":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"pin":{"type":"object","properties":{},"additionalProperties":true},"committee":{"type":"object","properties":{},"additionalProperties":true},"center":{"type":"object","properties":{},"additionalProperties":true},"length_m":{"type":"number"},"bearing_pin_to_committee_deg":{"type":"number"},"wind_direction_deg":{"type":"number"},"favored_end":{"type":"string"},"favored_end_bias_m":{"type":"number"},"start_type":{"type":"string"}},"additionalProperties":true,"nullable":true},"summary":{"type":"object","properties":{},"additionalProperties":true},"units":{"type":"object","additionalProperties":{"type":"string"},"description":"Metric name to its unit."},"missing_boat_ids":{"type":"array","items":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."}}},"additionalProperties":true,"description":"An empty page may omit start_line/summary/units. Start-line geometry and evidence are extensible saved-artifact fields.","required":["schema_version","session_id","scope_id","snapshot","fleet_count","next_before_boat_id","paging_order","scope","model_called","start_stats"]},"MeasuredMetric":{"type":"object","properties":{"value":{"type":"number","nullable":true},"unit":{"type":"string"},"reason":{"type":"string","nullable":true}},"additionalProperties":true,"required":["value","unit","reason"]},"Statistic":{"type":"object","properties":{"value":{"type":"number","nullable":true},"measured_count":{"type":"integer"},"selected_count":{"type":"integer"},"statistic":{"type":"string"}},"additionalProperties":true,"required":["value","measured_count","selected_count","statistic"]},"ManeuverLoss":{"type":"object","properties":{"type":{"type":"string","nullable":true},"qualifying_count":{"type":"integer"},"measured_count":{"type":"integer"},"unavailable_loss_count":{"type":"integer"},"minimum_count":{"type":"integer"},"median_loss_m":{"type":"number","nullable":true},"reason":{"type":"string","nullable":true},"basis":{"type":"string"}},"additionalProperties":true,"required":["type","qualifying_count","measured_count","unavailable_loss_count","minimum_count","median_loss_m","reason","basis"]},"MarkPassage":{"type":"object","properties":{"available":{"type":"boolean"},"time":{"type":"number","nullable":true},"reason":{"type":"string","nullable":true},"basis":{"type":"string"},"scope_id":{"type":"string"},"leg_index":{"type":"integer"},"mark_ids":{"type":"array","items":{"type":"string"}},"rounding_ids":{"type":"array","items":{"type":"string"}},"quality":{"type":"array","items":{"type":"object","properties":{},"additionalProperties":true,"description":"Saved mark-passage quality metadata."}}},"additionalProperties":true,"required":["available","time","reason","basis"]},"PassageInterval":{"type":"object","properties":{"boat_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"entry":{"$ref":"#/components/schemas/MarkPassage"},"exit":{"$ref":"#/components/schemas/MarkPassage"},"available":{"type":"boolean"},"reason":{"type":"string","nullable":true}},"additionalProperties":true,"required":["boat_id","entry","exit","available","reason"]},"LegPassages":{"type":"object","properties":{"leg_index":{"type":"integer"},"scope_id":{"type":"string"},"direction":{"type":"string","nullable":true},"is_reach":{"type":"boolean","nullable":true},"subject":{"$ref":"#/components/schemas/PassageInterval"},"pairs":{"type":"array","items":{"type":"object","properties":{"peer_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"available":{"type":"boolean"},"reason":{"type":"string","nullable":true},"entry_gap_s":{"type":"number","nullable":true},"exit_gap_s":{"type":"number","nullable":true},"gap_change_s":{"type":"number","nullable":true},"peer":{"$ref":"#/components/schemas/PassageInterval"}},"additionalProperties":true,"required":["peer_id","available","reason","entry_gap_s","exit_gap_s","gap_change_s","peer"]}},"exit_gaps":{"type":"array","items":{"type":"object","properties":{"peer_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"gap_s":{"type":"number","nullable":true},"reason":{"type":"string","nullable":true}},"additionalProperties":true,"required":["peer_id","gap_s","reason"]}},"subject_order_at_entry":{"type":"object","properties":{"position":{"type":"integer","nullable":true},"measured_boats":{"type":"integer"},"fleet_boats":{"type":"integer"},"tied_boats":{"type":"integer"},"basis":{"type":"string"},"reason":{"type":"string","nullable":true}},"additionalProperties":true,"nullable":true},"subject_order_at_exit":{"type":"object","properties":{"position":{"type":"integer","nullable":true},"measured_boats":{"type":"integer"},"fleet_boats":{"type":"integer"},"tied_boats":{"type":"integer"},"basis":{"type":"string"},"reason":{"type":"string","nullable":true}},"additionalProperties":true,"nullable":true},"median_paired_change_s":{"type":"number","nullable":true},"peers_requested":{"type":"integer"},"peers_selected":{"type":"integer"},"peers_measured":{"type":"integer"},"coverage":{"type":"object","properties":{"eligible_count":{"type":"integer"},"measured_count":{"type":"integer"},"unavailable_count":{"type":"integer"},"excluded_count":{"type":"integer"},"unavailable_reasons":{"type":"object","additionalProperties":{"type":"integer"}}},"additionalProperties":true},"complete_peer_coverage":{"type":"boolean"},"basis":{"type":"string"},"raw_gps_coverage_verified":{"type":"boolean"}},"additionalProperties":true,"required":["leg_index","scope_id","direction","is_reach","subject","pairs","exit_gaps","subject_order_at_entry","subject_order_at_exit","median_paired_change_s","peers_requested","peers_selected","peers_measured","coverage","complete_peer_coverage","basis","raw_gps_coverage_verified"]},"BoatLegFacts":{"type":"object","properties":{"boat_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"time_range":{"type":"object","properties":{"start":{"type":"number","nullable":true},"end":{"type":"number","nullable":true},"end_precise":{"type":"number","nullable":true}},"additionalProperties":true,"description":"UTC Unix seconds; missing boundaries may be null.","nullable":true},"reason":{"type":"string","nullable":true},"metrics":{"type":"object","properties":{"avg_sog_kt":{"$ref":"#/components/schemas/MeasuredMetric"},"avg_mark_vmg_kt":{"$ref":"#/components/schemas/MeasuredMetric"},"avg_vmg_kt":{"$ref":"#/components/schemas/MeasuredMetric"},"distance_m":{"$ref":"#/components/schemas/MeasuredMetric"},"duration_seconds":{"$ref":"#/components/schemas/MeasuredMetric"}},"additionalProperties":true,"required":["avg_sog_kt","avg_mark_vmg_kt","avg_vmg_kt","distance_m","duration_seconds"]},"maneuver_loss":{"$ref":"#/components/schemas/ManeuverLoss"},"maneuvers":{"type":"array","items":{"type":"object","properties":{"maneuver_id":{"type":"string"},"boat_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"time":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"type":{"type":"string","enum":["tack","gybe"]},"loss_m":{"type":"number","nullable":true}},"additionalProperties":true}},"wind_context":{"$ref":"#/components/schemas/AppliedWindWindow","description":"Optional additive applied-wind context for this boat’s exact saved leg window. Legacy performance metrics are unchanged."}},"additionalProperties":true,"description":"maneuvers is an optional newer field; older deployed responses may omit it.","required":["boat_id","time_range","reason","metrics","maneuver_loss"]},"LegFacts":{"type":"object","properties":{"leg_index":{"type":"integer"},"scope_id":{"type":"string"},"snapshot_ref":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."},"passages":{"$ref":"#/components/schemas/LegPassages"},"boats":{"type":"array","items":{"$ref":"#/components/schemas/BoatLegFacts"}},"peer_summary":{"type":"object","properties":{"metrics":{"type":"object","properties":{"avg_sog_kt":{"$ref":"#/components/schemas/Statistic"},"avg_mark_vmg_kt":{"$ref":"#/components/schemas/Statistic"},"avg_vmg_kt":{"$ref":"#/components/schemas/Statistic"},"distance_m":{"$ref":"#/components/schemas/Statistic"},"duration_seconds":{"$ref":"#/components/schemas/Statistic"}},"additionalProperties":true},"maneuver_loss":{"$ref":"#/components/schemas/Statistic"},"exit_gap":{"$ref":"#/components/schemas/Statistic"}},"additionalProperties":true}},"additionalProperties":true,"required":["leg_index","scope_id","snapshot_ref","passages","boats","peer_summary"]},"RaceFacts":{"type":"object","properties":{"schema_version":{"type":"string","enum":["race_debrief_facts_v1"]},"session_id":{"type":"string"},"status":{"type":"string","enum":["ready"]},"snapshot":{"$ref":"#/components/schemas/AnalysisSnapshot"},"scope":{"type":"object","properties":{"kind":{"type":"string","enum":["race"]},"id":{"type":"string"},"label":{"type":"string","nullable":true},"leg_index":{"type":"integer","nullable":true}},"additionalProperties":true,"required":["kind","id","label","leg_index"]},"comparison":{"type":"object","properties":{"policy":{"type":"string","enum":["named_rival","leading_finishers"]},"subject_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"boat_ids":{"type":"array","items":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."}},"peers_requested":{"type":"integer"},"peers_selected":{"type":"integer"},"reason":{"type":"string","nullable":true},"selection_basis":{"type":"string"},"tie_policy":{"type":"string"}},"additionalProperties":true,"required":["policy","subject_id","boat_ids","peers_requested","peers_selected"]},"participants":{"type":"array","items":{"type":"object","properties":{"boat_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"name":{"type":"string","nullable":true},"role":{"type":"string"},"comparison_color":{"type":"string"}},"additionalProperties":true,"required":["boat_id","name","role","comparison_color"]}},"fleet_count":{"type":"integer"},"results":{"type":"array","items":{"type":"object","properties":{"boat_id":{"type":"string","description":"Decimal session-track ID. Analysis endpoints serialize boat IDs as strings."},"position":{"type":"integer","description":"Fleet-relative position within this race, independent of page order."},"status":{"type":"string","description":"Recorded/inferred completion status, e.g. finished, partial, not_started, excluded or unknown."},"finish_time":{"type":"number","description":"UTC Unix seconds, potentially fractional."},"elapsed_seconds":{"type":"number"},"result_source":{"type":"string"},"reason":{"type":"string"}},"additionalProperties":true,"required":["boat_id","status"]}},"legs":{"type":"array","items":{"$ref":"#/components/schemas/LegFacts"}},"availability":{"type":"object","properties":{"geometry":{"type":"string"},"actions":{"type":"string"},"raw_gps":{"type":"string"}},"additionalProperties":true,"required":["geometry","actions","raw_gps"]}},"additionalProperties":true,"required":["schema_version","session_id","status","snapshot","scope","comparison","participants","fleet_count","results","legs","availability"]},"FloConversation":{"type":"object","properties":{"conversation_id":{"type":"integer","minimum":1},"session_id":{"type":"integer","minimum":1},"available_credit_microunits":{"type":"integer"},"max_turn_credit_microunits":{"type":"integer"},"unknown_usage_charge_policy":{"type":"string","enum":["declared_dispatched_call_maximum"]},"integration_history_only":{"type":"boolean","enum":[true]}},"additionalProperties":true,"required":["conversation_id","session_id","available_credit_microunits","max_turn_credit_microunits","unknown_usage_charge_policy","integration_history_only"]},"FloCitation":{"type":"object","properties":{"id":{"type":"string"},"kind":{"type":"string"},"scope_id":{"type":"string"},"session_id":{"type":"integer","minimum":1},"snapshot_ref":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."}},"additionalProperties":true,"description":"Evidence reference for the answer; extra fields depend on the tool/citation kind."},"FloTurn":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"conversation_id":{"type":"integer","minimum":1},"session_id":{"type":"integer","minimum":1},"status":{"type":"string","enum":["queued","running","completed","failed","canceled"]},"cancel_requested":{"type":"boolean"},"reserved_credit_microunits":{"type":"integer"},"charged_credit_microunits":{"type":"integer"},"usage":{"type":"object","properties":{"model_calls":{"type":"integer"},"prompt_tokens":{"type":"integer"},"completion_tokens":{"type":"integer"},"source_bytes_reserved":{"type":"integer"}},"additionalProperties":true,"description":"Recorded usage fields; queued turns can have an empty object."},"answer":{"type":"string","nullable":true},"answer_format":{"type":"string","enum":["plain_text"]},"citations":{"type":"array","items":{"$ref":"#/components/schemas/FloCitation"}},"error":{"type":"string","nullable":true},"expires_at":{"type":"string","format":"date-time"},"settled_at":{"type":"string","format":"date-time","nullable":true},"prompt":{"type":"string","description":"Only included in conversation history."}},"additionalProperties":true,"required":["id","conversation_id","session_id","status","cancel_requested","reserved_credit_microunits","charged_credit_microunits","usage","answer","answer_format","citations","error","expires_at","settled_at"]},"FloHistory":{"type":"object","properties":{"conversation_id":{"type":"integer","minimum":1},"session_id":{"type":"integer","minimum":1},"available_credit_microunits":{"type":"integer"},"max_turn_credit_microunits":{"type":"integer"},"unknown_usage_charge_policy":{"type":"string","enum":["declared_dispatched_call_maximum"]},"integration_history_only":{"type":"boolean","enum":[true]},"turns":{"type":"array","items":{"$ref":"#/components/schemas/FloTurn"}}},"additionalProperties":true,"required":["conversation_id","session_id","available_credit_microunits","max_turn_credit_microunits","unknown_usage_charge_policy","integration_history_only","turns"]},"SessionImportResult":{"type":"object","properties":{"session_id":{"type":"integer","minimum":1},"wind_version":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."},"completed":{"type":"boolean","enum":[true]}},"additionalProperties":true,"required":["session_id","wind_version","completed"]},"TrackImportResult":{"type":"object","properties":{"session_id":{"type":"integer","minimum":1},"session_track_id":{"type":"integer","minimum":1},"manual_track_id":{"type":"integer","minimum":1},"points_sha256":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."},"point_count":{"type":"integer","minimum":2},"already_attached":{"type":"boolean"},"compute_requested":{"type":"boolean","enum":[false]},"completed":{"type":"boolean","enum":[true]}},"additionalProperties":true,"required":["session_id","session_track_id","manual_track_id","points_sha256","point_count","already_attached","compute_requested","completed"]},"WindImportResult":{"type":"object","properties":{"session_id":{"type":"integer","minimum":1},"wind_version":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."},"observation_count":{"type":"integer"},"compute_requested":{"type":"boolean","enum":[false]},"completed":{"type":"boolean","enum":[true]}},"additionalProperties":true,"required":["session_id","wind_version","observation_count","compute_requested","completed"]},"SetupInquiryResult":{"type":"object","properties":{"session_id":{"type":"integer","minimum":1},"staff_request_id":{"type":"integer","minimum":1},"status":{"type":"string"},"automated_preparation":{"type":"boolean","enum":[false]},"completed":{"type":"boolean","enum":[true]}},"additionalProperties":true,"required":["session_id","staff_request_id","status","automated_preparation","completed"]},"SessionImportReceipt":{"type":"object","properties":{"receipt_id":{"type":"integer","minimum":1},"operation":{"type":"string","enum":["session"]},"initiator_user_id":{"type":"integer","minimum":1},"source_sha256":{"type":"string","nullable":true},"result":{"$ref":"#/components/schemas/SessionImportResult"}},"additionalProperties":true,"required":["receipt_id","operation","initiator_user_id","source_sha256","result"]},"TrackImportReceipt":{"type":"object","properties":{"receipt_id":{"type":"integer","minimum":1},"operation":{"type":"string","enum":["track"]},"initiator_user_id":{"type":"integer","minimum":1},"source_sha256":{"type":"string","nullable":true},"result":{"$ref":"#/components/schemas/TrackImportResult"}},"additionalProperties":true,"required":["receipt_id","operation","initiator_user_id","source_sha256","result"]},"WindImportReceipt":{"type":"object","properties":{"receipt_id":{"type":"integer","minimum":1},"operation":{"type":"string","enum":["wind"]},"initiator_user_id":{"type":"integer","minimum":1},"source_sha256":{"type":"string","nullable":true},"result":{"$ref":"#/components/schemas/WindImportResult"}},"additionalProperties":true,"required":["receipt_id","operation","initiator_user_id","source_sha256","result"]},"SetupInquiryReceipt":{"type":"object","properties":{"receipt_id":{"type":"integer","minimum":1},"operation":{"type":"string","enum":["inquiry"]},"initiator_user_id":{"type":"integer","minimum":1},"source_sha256":{"type":"string","nullable":true},"result":{"$ref":"#/components/schemas/SetupInquiryResult"}},"additionalProperties":true,"required":["receipt_id","operation","initiator_user_id","source_sha256","result"]},"ImportReceipt":{"oneOf":[{"allOf":[{"$ref":"#/components/schemas/SessionImportReceipt"},{"type":"object","properties":{"created_at":{"type":"string","format":"date-time"}},"additionalProperties":true,"required":["created_at"]}]},{"allOf":[{"$ref":"#/components/schemas/TrackImportReceipt"},{"type":"object","properties":{"created_at":{"type":"string","format":"date-time"}},"additionalProperties":true,"required":["created_at"]}]},{"allOf":[{"$ref":"#/components/schemas/WindImportReceipt"},{"type":"object","properties":{"created_at":{"type":"string","format":"date-time"}},"additionalProperties":true,"required":["created_at"]}]},{"allOf":[{"$ref":"#/components/schemas/SetupInquiryReceipt"},{"type":"object","properties":{"created_at":{"type":"string","format":"date-time"}},"additionalProperties":true,"required":["created_at"]}]},{"allOf":[{"$ref":"#/components/schemas/LegWindApplicationReceipt"},{"type":"object","properties":{"created_at":{"type":"string","format":"date-time"}},"additionalProperties":true,"required":["created_at"]}]}]},"WindVersion":{"type":"object","properties":{"session_id":{"type":"integer","minimum":1},"wind_version":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."}},"additionalProperties":true,"required":["session_id","wind_version"]},"ComputeRequest":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"status":{"type":"string","enum":["queued","dispatched","unknown","completed","reused","failed"]},"error":{"type":"string","nullable":true},"source_revision":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."},"dispatched_at":{"type":"string","format":"date-time","nullable":true},"accepted_at":{"type":"string","format":"date-time","nullable":true},"completed_at":{"type":"string","format":"date-time","nullable":true},"queue_expires_at":{"type":"string","format":"date-time"},"overdue":{"type":"boolean"},"same_key_retry_safe":{"type":"boolean","enum":[true]},"dispatch_retry_allowed":{"type":"boolean"},"publication_fenced":{"type":"boolean"}},"additionalProperties":true,"required":["id","status","error","source_revision","dispatched_at","accepted_at","completed_at","queue_expires_at","overdue","same_key_retry_safe","dispatch_retry_allowed","publication_fenced"]},"ComputeReceipt":{"type":"object","properties":{"session_id":{"type":"integer","minimum":1},"request":{"$ref":"#/components/schemas/ComputeRequest"}},"additionalProperties":true,"required":["session_id","request"]},"ComputeStatus":{"type":"object","properties":{"session_id":{"type":"integer","minimum":1},"compute_status":{"type":"object","properties":{"state":{"type":"string","enum":["ready","computing","recomputing","stale","absent"]},"computed_at":{"type":"string","format":"date-time","nullable":true},"invoked_at":{"type":"string","format":"date-time","nullable":true},"last_attempt_failed":{"type":"boolean"},"can_retry":{"type":"boolean"}},"additionalProperties":true,"required":["state","computed_at","invoked_at","last_attempt_failed","can_retry"]},"request":{"type":"object","properties":{"id":{"type":"integer","minimum":1},"status":{"type":"string","enum":["queued","dispatched","unknown","completed","reused","failed"]},"error":{"type":"string","nullable":true},"source_revision":{"type":"string","description":"Opaque content/snapshot digest; compare for equality, do not interpret."},"dispatched_at":{"type":"string","format":"date-time","nullable":true},"accepted_at":{"type":"string","format":"date-time","nullable":true},"completed_at":{"type":"string","format":"date-time","nullable":true},"queue_expires_at":{"type":"string","format":"date-time"},"overdue":{"type":"boolean"},"same_key_retry_safe":{"type":"boolean","enum":[true]},"dispatch_retry_allowed":{"type":"boolean"},"publication_fenced":{"type":"boolean"}},"additionalProperties":true,"required":["id","status","error","source_revision","dispatched_at","accepted_at","completed_at","queue_expires_at","overdue","same_key_retry_safe","dispatch_retry_allowed","publication_fenced"],"nullable":true},"result_data_path":{"type":"string","description":"Relative subscriber API path. This path does not independently grant access."},"poll_after_seconds":{"type":"integer","enum":[30]},"publication_fenced":{"type":"boolean"}},"additionalProperties":true,"required":["session_id","compute_status","request","result_data_path","poll_after_seconds","publication_fenced"]},"LegWindPreview":{"type":"object","required":["algorithm_version","session_id","race_id","leg_index","input_version","preview_only","status","observation_window","safe_outputs","reused","wind_version"],"properties":{"algorithm_version":{"type":"string","enum":["leg_wind_preview_v1","leg_wind_preview_v2"]},"session_id":{"type":"integer"},"race_id":{"type":"integer","description":"Saved race id; not a displayed race number."},"leg_index":{"type":"integer","description":"One-based leg number."},"input_version":{"type":"string","pattern":"^[a-f0-9]{64}$"},"source_fingerprint":{"type":"string","description":"Opaque source-version fingerprint, not a storage locator."},"preview_only":{"type":"boolean","enum":[true]},"reused":{"type":"boolean","description":"True when an unchanged result was reused without another computation."},"sailing_mode":{"type":"string","enum":["upwind","downwind","reach","offset"]},"status":{"type":"string","enum":["supported","uncertain","insufficient","carried_forward","orientation_only"]},"candidate_direction":{"type":"number","nullable":true,"minimum":0,"maximum":360,"description":"Wind-from direction in degrees true. A carried_forward value is the supplied reference, not a fresh estimate. Never use this field without status/evidence."},"course_axis_direction":{"type":"number","nullable":true,"description":"Separate course orientation; never a wind measurement."},"observation_window":{"type":"object","required":["start_at","end_at"],"properties":{"start_at":{"type":"number","description":"UTC Unix seconds, inclusive."},"end_at":{"type":"number","description":"UTC Unix seconds at the end of the observation window."}}},"effective_range":{"type":"object","required":["start_at","end_at"],"properties":{"start_at":{"type":"number","description":"UTC Unix seconds, inclusive."},"end_at":{"type":"number","description":"UTC Unix seconds at the end of the observation window."}},"nullable":true,"description":"Proposed range only; no configured wind is changed."},"reasons":{"type":"array","items":{"type":"string"}},"uncertainty":{"type":"object","nullable":true,"properties":{"kind":{"type":"string","enum":["empirical_variant_envelope"]},"max_deviation_degrees":{"type":"number","nullable":true},"calibrated":{"type":"boolean","enum":[false]}}},"evidence":{"type":"object","nullable":true,"description":"Contributing boat ids, usable/carried seconds, per-side support, rejection counts and bounded sampling variants. No raw GPS. Empirical sensitivity is not a calibrated confidence interval.","properties":{"contributing_boats":{"type":"array","items":{"type":"string","description":"Session track id."},"maxItems":24},"usable_seconds":{"type":"number"},"carried_seconds":{"type":"number"},"age_seconds":{"type":"number","nullable":true}}},"safe_outputs":{"type":"object","required":["orientation","auto_apply","twa","vmg","start_line_bias"],"properties":{"orientation":{"type":"boolean"},"auto_apply":{"type":"boolean","enum":[false]},"twa":{"type":"boolean","enum":[false]},"vmg":{"type":"boolean","enum":[false]},"start_line_bias":{"type":"boolean","enum":[false]}},"description":"Preview rollout never authorizes automatic writes or precise TWA/VMG/start-line-bias analysis."},"wind_version":{"type":"string","pattern":"^[a-f0-9]{64}$","description":"Current configured-wind version for explicit Apply."},"boat_selection":{"$ref":"#/components/schemas/WindProposalBoatSelection"},"applied_wind_reference":{"$ref":"#/components/schemas/WindProposalAppliedReference"}}},"LegWindApplication":{"type":"object","required":["receipt_id","session_id","wind_version","session","effective_range","reused","recalculation_needed","compute_requested"],"properties":{"receipt_id":{"type":"integer"},"session_id":{"type":"integer"},"wind_version":{"type":"string"},"session":{"type":"object","description":"Updated configured wind_angle, wind_series, wind_speed_series and avg_wind_speed. Merge these fields without resetting replay state."},"effective_range":{"type":"object","required":["start_at","end_at"],"properties":{"start_at":{"type":"number","description":"UTC Unix seconds, inclusive."},"end_at":{"type":"number","description":"UTC Unix seconds at the end of the observation window."}}},"reused":{"type":"boolean"},"recalculation_needed":{"type":"boolean","enum":[true]},"compute_requested":{"type":"boolean","enum":[false]}}},"LegWindApplicationReceiptResult":{"type":"object","required":["session_id","wind_version","session","effective_range","recalculation_needed","compute_requested"],"properties":{"session_id":{"type":"integer"},"wind_version":{"type":"string"},"session":{"type":"object","description":"Updated configured wind_angle, wind_series, wind_speed_series and avg_wind_speed. Merge these fields without resetting replay state."},"effective_range":{"type":"object","required":["start_at","end_at"],"properties":{"start_at":{"type":"number","description":"UTC Unix seconds, inclusive."},"end_at":{"type":"number","description":"UTC Unix seconds at the end of the observation window."}}},"recalculation_needed":{"type":"boolean","enum":[true]},"compute_requested":{"type":"boolean","enum":[false]}},"description":"Historical application result, not proof this is still the current wind. A retry of Apply rechecks the current wind version."},"LegWindApplicationReceipt":{"type":"object","properties":{"receipt_id":{"type":"integer","minimum":1},"operation":{"type":"string","enum":["wind_estimate"]},"initiator_user_id":{"type":"integer","minimum":1},"source_sha256":{"type":"string","nullable":true},"result":{"$ref":"#/components/schemas/LegWindApplicationReceiptResult"}},"additionalProperties":true,"required":["receipt_id","operation","initiator_user_id","source_sha256","result"]},"LegWindBatchPreview":{"type":"object","required":["session_id","preview_only","input_revision","wind_version","batch_version","results"],"properties":{"session_id":{"type":"integer"},"preview_only":{"type":"boolean","enum":[true]},"input_revision":{"type":"string"},"wind_version":{"type":"string"},"batch_version":{"type":"string"},"results":{"type":"array","minItems":1,"maxItems":4,"items":{"type":"object","required":["selection","preview"],"properties":{"selection":{"type":"object","additionalProperties":false,"required":["race_id","leg_index"],"properties":{"race_id":{"type":"integer","minimum":1,"maximum":9007199254740991},"leg_index":{"type":"integer","minimum":1,"maximum":100},"boat_ids":{"type":"array","minItems":2,"maxItems":24,"items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"expected_input_version":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64}}},"preview":{"$ref":"#/components/schemas/LegWindPreview"}}}}}},"TrainingWindPreview":{"type":"object","required":["algorithm_version","session_id","race_id","leg_index","input_version","preview_only","status","observation_window","safe_outputs","scope_kind"],"properties":{"algorithm_version":{"enum":["leg_wind_preview_v2"]},"session_id":{"type":"integer"},"race_id":{"type":"integer","nullable":true,"enum":[null]},"leg_index":{"type":"integer","nullable":true,"enum":[null]},"input_version":{"type":"string","pattern":"^[a-f0-9]{64}$"},"source_fingerprint":{"type":"string","description":"Opaque source-version fingerprint, not a storage locator."},"preview_only":{"type":"boolean","enum":[true]},"reused":{"type":"boolean","description":"True when an unchanged result was reused without another computation."},"sailing_mode":{"type":"string","enum":["upwind","downwind","reach","offset"]},"status":{"type":"string","enum":["supported","uncertain","insufficient","carried_forward","orientation_only"]},"candidate_direction":{"type":"number","nullable":true,"minimum":0,"maximum":360,"description":"Wind-from direction in degrees true. A carried_forward value is the supplied reference, not a fresh estimate. Never use this field without status/evidence."},"course_axis_direction":{"type":"number","nullable":true,"description":"Separate course orientation; never a wind measurement."},"observation_window":{"type":"object","required":["start_at","end_at"],"properties":{"start_at":{"type":"number","description":"UTC Unix seconds, inclusive."},"end_at":{"type":"number","description":"UTC Unix seconds at the end of the observation window."}}},"effective_range":{"type":"object","nullable":true,"enum":[null]},"reasons":{"type":"array","items":{"type":"string"}},"uncertainty":{"type":"object","nullable":true,"properties":{"kind":{"type":"string","enum":["empirical_variant_envelope"]},"max_deviation_degrees":{"type":"number","nullable":true},"calibrated":{"type":"boolean","enum":[false]}}},"evidence":{"type":"object","nullable":true,"description":"Contributing boat ids, usable/carried seconds, per-side support, rejection counts and bounded sampling variants. No raw GPS. Empirical sensitivity is not a calibrated confidence interval.","properties":{"contributing_boats":{"type":"array","items":{"type":"string","description":"Session track id."},"maxItems":24},"usable_seconds":{"type":"number"},"carried_seconds":{"type":"number"},"age_seconds":{"type":"number","nullable":true}}},"safe_outputs":{"type":"object","required":["orientation","auto_apply","twa","vmg","start_line_bias"],"properties":{"orientation":{"enum":[false]},"auto_apply":{"type":"boolean","enum":[false]},"twa":{"type":"boolean","enum":[false]},"vmg":{"type":"boolean","enum":[false]},"start_line_bias":{"type":"boolean","enum":[false]}},"description":"Preview rollout never authorizes automatic writes or precise TWA/VMG/start-line-bias analysis."},"wind_version":{"type":"string","pattern":"^[a-f0-9]{64}$","description":"Current configured-wind version for explicit Apply."},"scope_kind":{"enum":["lineup","training_window"]},"lineup_id":{"type":"integer","minimum":1,"nullable":true},"window_id":{"type":"string","pattern":"^[a-f0-9]{64}$","description":"Server-selected training window identity; never a race or saved lineup ID."},"boat_selection":{"$ref":"#/components/schemas/WindProposalBoatSelection"},"applied_wind_reference":{"$ref":"#/components/schemas/WindProposalAppliedReference"}}},"TrainingWindProposal":{"type":"object","required":["proposal_version","algorithm_version","session_id","input_version","source_revision","preview_only","automatic_adoption","wind_changed","compute_requested","receipt_id","reused","results"],"properties":{"proposal_version":{"enum":["training_wind_proposal_v1"]},"algorithm_version":{"enum":["leg_wind_preview_v2"]},"session_id":{"type":"integer"},"input_version":{"type":"string"},"source_revision":{"type":"string"},"preview_only":{"enum":[true]},"automatic_adoption":{"enum":[false]},"wind_changed":{"enum":[false]},"compute_requested":{"enum":[false]},"receipt_id":{"type":"integer"},"reused":{"type":"boolean"},"results":{"type":"array","minItems":0,"maxItems":4,"items":{"type":"object","required":["status","adoption","effective_range","proposed_direction"],"properties":{"lineup_id":{"type":"integer"},"status":{"type":"string","enum":["supported","uncertain","insufficient","carried_forward"]},"adoption":{"enum":["not_enabled"]},"effective_range":{"type":"object","nullable":true,"enum":[null]},"proposed_direction":{"type":"number","minimum":0,"maximum":360,"nullable":true},"preview":{"allOf":[{"$ref":"#/components/schemas/TrainingWindPreview"}],"nullable":true},"reasons":{"type":"array","items":{"type":"string"}},"scope_kind":{"enum":["training_window"]},"window_id":{"type":"string","pattern":"^[a-f0-9]{64}$","description":"Server-selected training window identity; never a race or saved lineup ID."},"boat_selection":{"$ref":"#/components/schemas/WindProposalBoatSelection"},"applied_wind_reference":{"$ref":"#/components/schemas/WindProposalAppliedReference"}}}},"discovery":{"type":"object","description":"Present only for discover:true. Bounded classification screening; no claim of full-session coverage.","properties":{"policy":{"enum":["classified_training_windows_v1","classified_training_cohorts_v2"]},"coverage":{"enum":["bounded_sample"]},"candidate_count":{"type":"integer","minimum":0},"selected_count":{"type":"integer","minimum":0,"maximum":4},"reasons":{"type":"array","items":{"type":"string"}}}}}},"WindCsvImportSettings":{"type":"object","additionalProperties":false,"required":["schema_version","headers","mapping","timezone","speed_unit","direction_reference","wind_basis"],"properties":{"schema_version":{"type":"integer","enum":[1]},"headers":{"type":"array","minItems":1,"maxItems":128,"uniqueItems":true,"items":{"type":"string","minLength":1,"maxLength":256}},"mapping":{"type":"object","additionalProperties":false,"required":["time"],"properties":{"time":{"type":"string","nullable":false,"maxLength":256},"direction":{"type":"string","nullable":true,"maxLength":256},"speed":{"type":"string","nullable":true,"maxLength":256}}},"timezone":{"type":"string","minLength":1,"maxLength":100},"speed_unit":{"type":"string","nullable":true,"enum":["knots","m/s","km/h",null]},"direction_reference":{"type":"string","nullable":true,"enum":["true_north_from","magnetic_from","sensor_relative",null]},"wind_basis":{"type":"string","enum":["true","apparent"]}}},"WindCsvDefault":{"type":"object","required":["schema_version","revision","has_default","requires_confirmation","averaging_window_seconds"],"properties":{"schema_version":{"type":"integer","enum":[1]},"revision":{"type":"integer","minimum":0},"has_default":{"type":"boolean"},"schema_matches":{"type":"boolean","nullable":true},"wind_import_default":{"description":"Saved interpretation settings, or null when no default exists, was cleared or does not match the requested headers.","oneOf":[{"$ref":"#/components/schemas/WindCsvImportSettings"},{"type":"object","nullable":true,"enum":[null]}]},"requires_confirmation":{"type":"boolean","enum":[true]},"averaging_window_seconds":{"type":"integer","enum":[300]}}},"WindCsvInspection":{"type":"object","required":["headers","sample","suggested_mapping","timezone_options","requires_confirmation","inspection_only","account_default"],"properties":{"headers":{"type":"array","items":{"type":"string"}},"sample":{"type":"array","maxItems":5,"items":{"type":"object","additionalProperties":true}},"suggested_mapping":{"type":"object","additionalProperties":true},"timezone_suggestion":{"type":"object","nullable":true,"properties":{"timezone":{"type":"string"},"source":{"type":"string","enum":["timestamp_offsets","event","file_gps","session_gps"]},"requires_confirmation":{"type":"boolean","enum":[true]}}},"timezone_options":{"type":"array","items":{"type":"string"}},"timestamp_reference":{"type":"string","enum":["absolute","local_or_mixed"]},"requires_confirmation":{"type":"boolean","enum":[true]},"inspection_only":{"type":"boolean","enum":[true]},"averaging_window_seconds":{"type":"integer","enum":[300]},"account_default":{"$ref":"#/components/schemas/WindCsvDefault"},"supported_interpretations":{"type":"object","additionalProperties":true}}},"AppliedWindMetric":{"type":"object","description":"Applied step-value statistics, not raw instrument coverage or measured gusts. Mean may be absent or null; opposing directions have no reliable circular mean.","required":["available","configured_seconds","missing_seconds","configured_coverage_percent","observation_coverage","unit","sources"],"properties":{"available":{"type":"boolean"},"mean":{"type":"number","nullable":true},"unit":{"type":"string","enum":["kt","deg_true_from"]},"configured_seconds":{"type":"number","minimum":0},"missing_seconds":{"type":"number","minimum":0},"configured_coverage_percent":{"type":"number","minimum":0,"maximum":100},"observation_coverage":{"type":"string","enum":["not_resolved"]},"stddev":{"type":"number"},"min":{"type":"number"},"max":{"type":"number"},"resultant_length":{"type":"number","minimum":0,"maximum":1},"circular_stddev_deg":{"type":"number","nullable":true},"end_minus_start_deg":{"type":"number"},"reason":{"type":"string","nullable":true},"sources":{"type":"array","maxItems":16,"items":{"type":"object","description":"Sanitized source kind, configured duration, and optional averaging/filter provenance; no storage keys, URLs or raw samples."}},"sources_truncated":{"type":"boolean"}}},"AppliedWindWindow":{"type":"object","description":"Read-only current applied wind for the exact selected window. Uses duration-weighted speed and circular direction, independent speed keys, configured first/last-value hold and scalar fallback. Does not prove saved performance metrics use the same wind version, establish raw sensor coverage, or trigger calculation.","required":["schema_version","input_version","basis","metrics_alignment","requested_seconds","session_overlap_seconds","outside_session_seconds","range_count","direction","speed","limitations"],"properties":{"schema_version":{"type":"string","enum":["applied_wind_window_v1"]},"input_version":{"type":"string","pattern":"^[0-9a-f]{64}$"},"basis":{"type":"string","enum":["applied_calculation_wind"]},"metrics_alignment":{"type":"string","enum":["not_verified"]},"requested_seconds":{"type":"number","minimum":0},"session_overlap_seconds":{"type":"number","minimum":0},"outside_session_seconds":{"type":"number","minimum":0},"range_count":{"type":"integer","minimum":1,"maximum":12},"direction":{"$ref":"#/components/schemas/AppliedWindMetric"},"speed":{"$ref":"#/components/schemas/AppliedWindMetric"},"limitations":{"type":"array","items":{"type":"string"}}}},"LineupBoatStats":{"type":"object","required":["boat_id","name","metrics","direction","is_reach","classification_basis","attitude_context"],"properties":{"boat_id":{"type":"string"},"name":{"type":"string","nullable":true},"metrics":{"type":"object","description":"Saved full-lineup metrics. Distance is sailed distance in metres (distance_m), not relative gain. Rolling 3s/5s SOG maxima are numeric knots. Missing/non-finite values are null; zero is valid. Signed/absolute heel and pitch are duration-weighted over independently supported sensor intervals, not zero-filled GPS coverage. Their window/support policy is explicit in attitude_context.","required":["avg_sog_kt","avg_vmg_kt","avg_abs_twa_deg","max_sog_3s_kt","max_sog_5s_kt","distance_m","avg_heel_deg","avg_abs_heel_deg","avg_pitch_deg","avg_abs_pitch_deg"],"properties":{"avg_sog_kt":{"type":"number","nullable":true},"avg_vmg_kt":{"type":"number","nullable":true},"avg_abs_twa_deg":{"type":"number","nullable":true},"max_sog_3s_kt":{"type":"number","nullable":true},"max_sog_5s_kt":{"type":"number","nullable":true},"distance_m":{"type":"number","nullable":true,"description":"Sailed distance in metres."},"avg_heel_deg":{"type":"number","nullable":true,"description":"Signed mean recorded sensor degrees over supported intervals; see attitude_context for independent coverage. Null for older artifacts or unsupported sensor data."},"avg_abs_heel_deg":{"type":"number","nullable":true,"description":"Mean absolute recorded sensor degrees over supported intervals; see attitude_context for independent coverage. Null for older artifacts or unsupported sensor data."},"avg_pitch_deg":{"type":"number","nullable":true,"description":"Signed mean recorded sensor degrees over supported intervals; see attitude_context for independent coverage. Null for older artifacts or unsupported sensor data."},"avg_abs_pitch_deg":{"type":"number","nullable":true,"description":"Mean absolute recorded sensor degrees over supported intervals; see attitude_context for independent coverage. Null for older artifacts or unsupported sensor data."}}},"direction":{"type":"string","enum":["upwind","downwind","reach","unknown"],"description":"Coarse saved classification against the applied wind reference; not proof of measured wind or accurate TWA."},"is_reach":{"type":"boolean","nullable":true,"description":"Saved reaching classification; null when not persisted."},"classification_basis":{"type":"string","nullable":true,"enum":["applied_wind_reference",null]},"attitude_context":{"$ref":"#/components/schemas/LineupAttitudeContext"}}},"LineupStats":{"type":"object","required":["id","index","label","time_range","available","reason","metric_window_basis","wind_context","boats","next_before_boat_id","kind","direction"],"properties":{"id":{"type":"string","description":"Opaque lineup id; pass unchanged as lineup_id. No database-storage terminology is exposed."},"index":{"type":"integer"},"label":{"type":"string"},"time_range":{"anyOf":[{"$ref":"#/components/schemas/EpochWindow"},{"type":"object","nullable":true,"enum":[null]}]},"available":{"type":"boolean"},"reason":{"type":"string","nullable":true},"metric_window_basis":{"type":"string","enum":["full_saved_lineup_window"]},"wind_context":{"anyOf":[{"$ref":"#/components/schemas/AppliedWindWindow"},{"type":"object","nullable":true,"enum":[null]}]},"boats":{"type":"array","maxItems":100,"items":{"$ref":"#/components/schemas/LineupBoatStats"}},"next_before_boat_id":{"type":"integer","nullable":true},"kind":{"type":"string","enum":["lineup"],"description":"Saved analysis scope; does not imply drill intent or exclude overlap with a race."},"direction":{"type":"string","enum":["upwind","downwind","reach","mixed","unknown"],"description":"Agreement across all authorized saved boats, independent of boat pagination. Any missing classification is unknown; differing known classifications are mixed. Legacy artifacts may need recomputation to populate labels."}}},"LineupStatsPage":{"type":"object","required":["schema_version","session_id","snapshot","total_count","returned_count","lineups","units","next_offset","model_called","wind_changed","metrics_recomputed"],"properties":{"schema_version":{"type":"string","enum":["subscriber_lineup_stats_v1"]},"session_id":{"type":"integer"},"snapshot":{"$ref":"#/components/schemas/AnalysisSnapshot"},"total_count":{"type":"integer","minimum":0},"returned_count":{"type":"integer","minimum":0,"maximum":10},"lineups":{"type":"array","maxItems":10,"items":{"$ref":"#/components/schemas/LineupStats"}},"units":{"type":"object","additionalProperties":{"type":"string"}},"next_offset":{"type":"integer","nullable":true},"model_called":{"type":"boolean","enum":[false]},"wind_changed":{"type":"boolean","enum":[false]},"metrics_recomputed":{"type":"boolean","enum":[false]},"filters":{"type":"object","properties":{"direction":{"type":"string","enum":["upwind","downwind","reach","mixed","unknown"]}},"additionalProperties":false}}},"LineupAttitudeContext":{"type":"object","description":"Persisted raw-sensor evidence, independent of wind and GPS coverage. Original sensor sign is preserved; sign alone does not establish windward/leeward heel. Integration is linear between valid adjacent samples within max_gap_seconds, without extrapolation; invalid/missing/conflicting duplicate samples break support. Counts are unique valid timestamps in the lineup window. ABS mean integrates magnitude before averaging, including signed zero crossings. Older artifacts are explicitly unavailable and are never recomputed by this read.","required":["schema_version","time_range","averaging_basis","sign_convention","max_gap_seconds","extrapolation","valid_sensor_range_deg","wind_independent","sensors"],"properties":{"schema_version":{"type":"string","enum":["lineup_attitude_v1"]},"time_range":{"type":"object","nullable":true,"required":["start","end"],"properties":{"start":{"type":"number"},"end":{"type":"number"}}},"averaging_basis":{"type":"string","nullable":true,"enum":["duration_weighted_piecewise_linear_supported_intervals",null]},"sign_convention":{"type":"string","enum":["recorded_sensor_sign_not_windward_leeward"]},"max_gap_seconds":{"type":"number","nullable":true,"description":"Default10seconds matches general timestamp coverage policy; this is an evidence support policy, not sensor accuracy.","minimum":0,"exclusiveMinimum":true,"maximum":30},"extrapolation":{"type":"boolean","enum":[false]},"valid_sensor_range_deg":{"type":"array","items":{"type":"number"},"minItems":2,"maxItems":2},"wind_independent":{"type":"boolean","enum":[true]},"sensors":{"type":"object","required":["heel","pitch"],"properties":{"heel":{"type":"object","required":["status","reason","supported_seconds","coverage_fraction","sample_count_in_window"],"properties":{"status":{"type":"string","enum":["complete","partial","unavailable"]},"reason":{"type":"string","nullable":true,"enum":["not_in_saved_artifact","invalid_saved_attitude_summary","no_valid_sensor_samples","no_supported_sensor_intervals",null]},"supported_seconds":{"type":"number","nullable":true,"minimum":0},"coverage_fraction":{"type":"number","nullable":true,"minimum":0,"maximum":1},"sample_count_in_window":{"type":"integer","nullable":true,"minimum":0}}},"pitch":{"type":"object","required":["status","reason","supported_seconds","coverage_fraction","sample_count_in_window"],"properties":{"status":{"type":"string","enum":["complete","partial","unavailable"]},"reason":{"type":"string","nullable":true,"enum":["not_in_saved_artifact","invalid_saved_attitude_summary","no_valid_sensor_samples","no_supported_sensor_intervals",null]},"supported_seconds":{"type":"number","nullable":true,"minimum":0},"coverage_fraction":{"type":"number","nullable":true,"minimum":0,"maximum":1},"sample_count_in_window":{"type":"integer","nullable":true,"minimum":0}}}}}}},"WindProposalBoatSelection":{"type":"object","additionalProperties":false,"description":"Eligibility diagnostics only. Inclusion does not prove solver participation or useful GPS evidence. Lists are capped; overflow_count reports omitted diagnostics.","required":["considered_boat_ids","included_boat_ids","excluded_boat_ids","excluded","overflow_count","inclusion_means","submitted_to_solver","solver_contribution"],"properties":{"considered_boat_ids":{"type":"array","maxItems":24,"items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"included_boat_ids":{"type":"array","maxItems":24,"items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"excluded_boat_ids":{"type":"array","maxItems":24,"items":{"type":"integer","minimum":1,"maximum":9007199254740991}},"excluded":{"type":"array","maxItems":24,"items":{"type":"object","additionalProperties":false,"required":["boat_id","reason"],"properties":{"boat_id":{"type":"integer","minimum":1},"reason":{"type":"string","maxLength":128}}}},"overflow_count":{"type":"integer","minimum":0},"inclusion_means":{"enum":["eligible_for_proposal_not_confirmed_solver_contribution"]},"submitted_to_solver":{"type":"boolean"},"solver_contribution":{"enum":["see_solver_evidence_only"]}}},"WindProposalAppliedReference":{"type":"object","additionalProperties":false,"description":"Bounded configured calculation reference, not independent verification of measurement provenance. File-backed measured context requires the aligned series reader.","required":["status","measurement_status"],"properties":{"status":{"enum":["unavailable","fixed_configured","configured_series"]},"measurement_status":{"enum":["unverified"]},"fixed_direction":{"type":"number","minimum":0,"maximum":360},"window":{"type":"object","additionalProperties":false,"required":["start_at","end_at"],"properties":{"start_at":{"type":"number"},"end_at":{"type":"number"}}},"references":{"type":"array","maxItems":24,"items":{"type":"object","additionalProperties":false,"required":["direction","status","provenance"],"properties":{"t":{"type":"number"},"direction":{"type":"number","minimum":0,"maximum":360},"source":{"type":"string","maxLength":128},"status":{"enum":["carried","estimated","applied_observation_average","configured","unknown"]},"provenance":{"type":"object","description":"Allowlisted bounded saved provenance, not independently verified sensor evidence.","additionalProperties":true},"observation_window":{"type":"object","additionalProperties":false,"required":["start_at","end_at"],"properties":{"start_at":{"type":"number"},"end_at":{"type":"number"}}},"effective_range":{"type":"object","additionalProperties":false,"required":["start_at","end_at"],"properties":{"start_at":{"type":"number"},"end_at":{"type":"number"}}}}}},"overflow_count":{"type":"integer","minimum":0},"limitations":{"type":"array","maxItems":8,"items":{"type":"string","maxLength":256}}}},"LineupMetricSeriesRequest":{"type":"object","additionalProperties":false,"properties":{"boat_ids":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[1-9][0-9]*$","maxLength":16}},"metrics":{"type":"array","minItems":1,"maxItems":9,"uniqueItems":true,"items":{"type":"string","enum":["sog_kt","vmg_kt","signed_twa_deg","abs_twa_deg","cog_deg","heel_deg","abs_heel_deg","pitch_deg","abs_pitch_deg"]}},"start_at":{"type":"number"},"end_at":{"type":"number"},"averaging_seconds":{"type":"number","minimum":1,"maximum":30,"default":5},"sample_seconds":{"type":"number","minimum":1,"maximum":30,"default":2},"expected_snapshot":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64}},"required":["metrics"],"description":"One saved lineup. Times are UTC epoch seconds within its original bounds. Averaging and output sampling are independent. Explicit selection required if the saved cohort exceeds eight boats. Limits reject rather than silently omit/coarsen/truncate."},"AppliedFileWindSeries":{"type":"object","additionalProperties":false,"properties":{"schema_version":{"enum":["applied_file_wind_series_v1"]},"available":{"type":"boolean"},"reason":{"type":"string","nullable":true},"wind_input_version":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64},"time_range":{"type":"object","additionalProperties":false,"properties":{"start":{"type":"number"},"end":{"type":"number"}},"required":["start","end"]},"direction_deg":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"speed_kt":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"direction_reasons":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"speed_reasons":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"effective_ranges":{"type":"array","maxItems":1024,"items":{"type":"object","additionalProperties":false,"properties":{"start":{"type":"number"},"end":{"type":"number"},"direction":{"type":"object","additionalProperties":false,"properties":{"available":{"type":"boolean"},"value":{"type":"number","nullable":true},"reason":{"type":"string","nullable":true},"source_id":{"type":"integer","minimum":1},"application_ref":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64},"averaging_window_seconds":{"type":"number","minimum":0},"coverage_status":{"enum":["carried","averaged"]},"direction_reference":{"enum":["true_north_from"]},"wind_basis":{"enum":["true"]}},"required":["available","value","reason"]},"speed":{"type":"object","additionalProperties":false,"properties":{"available":{"type":"boolean"},"value":{"type":"number","nullable":true},"reason":{"type":"string","nullable":true},"source_id":{"type":"integer","minimum":1},"application_ref":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64},"averaging_window_seconds":{"type":"number","minimum":0},"coverage_status":{"enum":["carried","averaged"]},"direction_reference":{"enum":["true_north_from"]},"wind_basis":{"enum":["true"]}},"required":["available","value","reason"]}},"required":["start","end","direction","speed"]}},"coverage":{"type":"object","additionalProperties":false,"properties":{"direction":{"type":"object","additionalProperties":false,"properties":{"file_backed_seconds":{"type":"number","minimum":0},"coverage_fraction":{"type":"number","minimum":0,"maximum":1},"carried_seconds":{"type":"number","minimum":0},"observation_coverage":{"enum":["not_resolved"]}},"required":["file_backed_seconds","coverage_fraction","carried_seconds","observation_coverage"]},"speed":{"type":"object","additionalProperties":false,"properties":{"file_backed_seconds":{"type":"number","minimum":0},"coverage_fraction":{"type":"number","minimum":0,"maximum":1},"carried_seconds":{"type":"number","minimum":0},"observation_coverage":{"enum":["not_resolved"]}},"required":["file_backed_seconds","coverage_fraction","carried_seconds","observation_coverage"]}},"required":["direction","speed"]},"sampling_basis":{"enum":["effective_applied_steps_at_output_timestamps"]},"limitations":{"type":"array","maxItems":8,"items":{"type":"string"}}},"required":["schema_version","available","reason","wind_input_version","time_range","direction_deg","speed_kt","direction_reasons","speed_reasons","effective_ranges","coverage","sampling_basis","limitations"],"description":"Shared aligned context only for verifiably applied uploaded-file wind. Chart-only uploads do not qualify. Latest application version, averaging and true/from reference must match. Later edits can make lineage unknown. Denser output is not finer measurement resolution. Carried applied values are distinguished from fresh observations."},"LineupMetricSeries":{"type":"object","additionalProperties":false,"properties":{"schema_version":{"enum":["lineup_metric_series_v1"]},"session_id":{"type":"integer"},"lineup_id":{"type":"string"},"lineup_time_range":{"type":"object","additionalProperties":false,"properties":{"start":{"type":"number"},"end":{"type":"number"}},"required":["start","end"]},"time_range":{"type":"object","additionalProperties":false,"properties":{"start":{"type":"number"},"end":{"type":"number"}},"required":["start","end"]},"snapshot":{"type":"object","additionalProperties":false,"properties":{"ref":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64},"input_version":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64},"source_pinned":{"enum":[true]}},"required":["ref","input_version","source_pinned"]},"parameters":{"type":"object","additionalProperties":false,"properties":{"boat_ids":{"type":"array","minItems":1,"maxItems":8,"uniqueItems":true,"items":{"type":"string","pattern":"^[1-9][0-9]*$","maxLength":16}},"metrics":{"type":"array","minItems":1,"maxItems":9,"uniqueItems":true,"items":{"type":"string","enum":["sog_kt","vmg_kt","signed_twa_deg","abs_twa_deg","cog_deg","heel_deg","abs_heel_deg","pitch_deg","abs_pitch_deg"]}},"start_at":{"type":"number"},"end_at":{"type":"number"},"averaging_seconds":{"type":"number","minimum":1,"maximum":30,"default":5},"sample_seconds":{"type":"number","minimum":1,"maximum":30,"default":2},"averaging_alignment":{"enum":["trailing"]},"grid_anchor":{"type":"number"},"include_exact_end":{"enum":[true]}},"required":["boat_ids","metrics","start_at","end_at","averaging_seconds","sample_seconds","averaging_alignment","grid_anchor","include_exact_end"]},"timestamps":{"type":"array","maxItems":500,"items":{"type":"number"}},"boats":{"type":"array","maxItems":8,"items":{"type":"object","additionalProperties":false,"properties":{"boat_id":{"type":"string","pattern":"^[1-9][0-9]*$"},"source_ref":{"type":"string","pattern":"^[a-f0-9]{64}$","minLength":64,"maxLength":64,"nullable":true},"available":{"type":"boolean"},"reason":{"type":"string","nullable":true},"series":{"type":"object","additionalProperties":false,"properties":{"sog_kt":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"vmg_kt":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"signed_twa_deg":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"abs_twa_deg":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"cog_deg":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"heel_deg":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"abs_heel_deg":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"pitch_deg":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}},"abs_pitch_deg":{"type":"array","maxItems":500,"items":{"type":"number","nullable":true}}}},"support_seconds":{"type":"object","additionalProperties":false,"properties":{"sog_kt":{"type":"array","maxItems":500,"items":{"type":"number","minimum":0,"maximum":30}},"vmg_kt":{"type":"array","maxItems":500,"items":{"type":"number","minimum":0,"maximum":30}},"signed_twa_deg":{"type":"array","maxItems":500,"items":{"type":"number","minimum":0,"maximum":30}},"abs_twa_deg":{"type":"array","maxItems":500,"items":{"type":"number","minimum":0,"maximum":30}},"cog_deg":{"type":"array","maxItems":500,"items":{"type":"number","minimum":0,"maximum":30}},"heel_deg":{"type":"array","maxItems":500,"items":{"type":"number","minimum":0,"maximum":30}},"abs_heel_deg":{"type":"array","maxItems":500,"items":{"type":"number","minimum":0,"maximum":30}},"pitch_deg":{"type":"array","maxItems":500,"items":{"type":"number","minimum":0,"maximum":30}},"abs_pitch_deg":{"type":"array","maxItems":500,"items":{"type":"number","minimum":0,"maximum":30}}}},"reasons":{"type":"object","additionalProperties":false,"properties":{"sog_kt":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"vmg_kt":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"signed_twa_deg":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"abs_twa_deg":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"cog_deg":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"heel_deg":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"abs_heel_deg":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"pitch_deg":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}},"abs_pitch_deg":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true}}}},"sample_validity":{"type":"object","additionalProperties":false,"properties":{"sog_kt":{"type":"object","additionalProperties":false,"properties":{"valid_samples":{"type":"integer","minimum":0,"maximum":500},"total_samples":{"type":"integer","minimum":0,"maximum":500}},"required":["valid_samples","total_samples"]},"vmg_kt":{"type":"object","additionalProperties":false,"properties":{"valid_samples":{"type":"integer","minimum":0,"maximum":500},"total_samples":{"type":"integer","minimum":0,"maximum":500}},"required":["valid_samples","total_samples"]},"signed_twa_deg":{"type":"object","additionalProperties":false,"properties":{"valid_samples":{"type":"integer","minimum":0,"maximum":500},"total_samples":{"type":"integer","minimum":0,"maximum":500}},"required":["valid_samples","total_samples"]},"abs_twa_deg":{"type":"object","additionalProperties":false,"properties":{"valid_samples":{"type":"integer","minimum":0,"maximum":500},"total_samples":{"type":"integer","minimum":0,"maximum":500}},"required":["valid_samples","total_samples"]},"cog_deg":{"type":"object","additionalProperties":false,"properties":{"valid_samples":{"type":"integer","minimum":0,"maximum":500},"total_samples":{"type":"integer","minimum":0,"maximum":500}},"required":["valid_samples","total_samples"]},"heel_deg":{"type":"object","additionalProperties":false,"properties":{"valid_samples":{"type":"integer","minimum":0,"maximum":500},"total_samples":{"type":"integer","minimum":0,"maximum":500}},"required":["valid_samples","total_samples"]},"abs_heel_deg":{"type":"object","additionalProperties":false,"properties":{"valid_samples":{"type":"integer","minimum":0,"maximum":500},"total_samples":{"type":"integer","minimum":0,"maximum":500}},"required":["valid_samples","total_samples"]},"pitch_deg":{"type":"object","additionalProperties":false,"properties":{"valid_samples":{"type":"integer","minimum":0,"maximum":500},"total_samples":{"type":"integer","minimum":0,"maximum":500}},"required":["valid_samples","total_samples"]},"abs_pitch_deg":{"type":"object","additionalProperties":false,"properties":{"valid_samples":{"type":"integer","minimum":0,"maximum":500},"total_samples":{"type":"integer","minimum":0,"maximum":500}},"required":["valid_samples","total_samples"]}}},"tack":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true,"enum":["port","starboard",null]}},"wind_axis_mode":{"type":"array","maxItems":500,"items":{"type":"string","nullable":true,"enum":["upwind_half_plane","downwind_half_plane","crosswind",null]}}},"required":["boat_id","source_ref","available","reason","series","support_seconds","reasons","sample_validity","tack","wind_axis_mode"]}},"units":{"type":"object","additionalProperties":false,"properties":{"sog_kt":{"enum":["kt"]},"vmg_kt":{"enum":["kt"]},"signed_twa_deg":{"enum":["deg"]},"abs_twa_deg":{"enum":["deg"]},"cog_deg":{"enum":["deg"]},"heel_deg":{"enum":["deg"]},"abs_heel_deg":{"enum":["deg"]},"pitch_deg":{"enum":["deg"]},"abs_pitch_deg":{"enum":["deg"]}}},"calculation_wind_context":{"$ref":"#/components/schemas/AppliedWindWindow"},"applied_file_wind":{"$ref":"#/components/schemas/AppliedFileWindSeries"},"policy":{"type":"object","additionalProperties":true},"preparation":{"type":"object","additionalProperties":false,"properties":{"cache_hit":{"type":"boolean"},"source_reads":{"type":"integer","minimum":0,"maximum":8},"source_bytes":{"type":"integer","minimum":0}},"required":["cache_hit","source_reads","source_bytes"]},"model_called":{"enum":[false]},"wind_changed":{"enum":[false]},"metrics_recomputed":{"enum":[false]},"sampling_time_range":{"type":"object","additionalProperties":false,"properties":{"start":{"type":"number"},"end":{"type":"number"}},"required":["start","end"],"description":"Intersection of saved lineup with effective session bounds; averaging must stay inside this permitted domain."}},"required":["schema_version","session_id","lineup_id","lineup_time_range","time_range","snapshot","parameters","timestamps","boats","units","calculation_wind_context","applied_file_wind","policy","preparation","model_called","wind_changed","metrics_recomputed"]}}}};
|
|
13
|
+
|
|
14
|
+
function resolve(schema) {
|
|
15
|
+
if (Array.isArray(schema)) return schema.map(resolve);
|
|
16
|
+
if (!schema || typeof schema !== 'object') return schema;
|
|
17
|
+
if (schema.$ref) {
|
|
18
|
+
if (!schema.$ref.startsWith('#/components/schemas/')) throw new Error('Unsupported schema reference');
|
|
19
|
+
return resolve(spec.components.schemas[schema.$ref.split('/').at(-1)]);
|
|
20
|
+
}
|
|
21
|
+
return Object.fromEntries(Object.entries(schema).map(([key, value]) => [key, resolve(value)]));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const tools = Object.entries(spec.paths).flatMap(([url, methods]) => Object.entries(methods).filter(([, operation]) => operation['x-sailsync-mcp'] !== false).map(([method, operation]) => {
|
|
25
|
+
const properties = {}, required = [];
|
|
26
|
+
for (const parameter of operation.parameters || []) {
|
|
27
|
+
const name = parameter.in === 'header' ? 'idempotency_key' : parameter.name;
|
|
28
|
+
properties[name] = resolve(parameter.schema);
|
|
29
|
+
if (parameter.required) required.push(name);
|
|
30
|
+
}
|
|
31
|
+
const multipart = operation.requestBody?.content['multipart/form-data'];
|
|
32
|
+
const body = resolve(operation.requestBody?.content['application/json']?.schema);
|
|
33
|
+
Object.assign(properties, body?.properties);
|
|
34
|
+
required.push(...(body?.required || []));
|
|
35
|
+
let inputSchema = { type: 'object', additionalProperties: false, properties, required };
|
|
36
|
+
if (operation.operationId === 'importSailSyncTrack') {
|
|
37
|
+
const fileProperties = { ...properties, file_path: { type: 'string', minLength: 1, maxLength: 4096,
|
|
38
|
+
description: 'Absolute path to the one local CSV you explicitly want uploaded (max 1 MiB). No URL, directory or symbolic link.' } };
|
|
39
|
+
delete fileProperties.content_base64;
|
|
40
|
+
inputSchema = { type: 'object', additionalProperties: false, properties: { ...properties, file_path: fileProperties.file_path },
|
|
41
|
+
required: required.filter(k => k !== 'content_base64'), oneOf: [inputSchema, { type: 'object', additionalProperties: false,
|
|
42
|
+
properties: fileProperties, required: [...required.filter(k => k !== 'content_base64'), 'file_path'] }] };
|
|
43
|
+
}
|
|
44
|
+
if (multipart) {
|
|
45
|
+
const schema = resolve(multipart.schema);
|
|
46
|
+
Object.assign(properties, schema.properties);
|
|
47
|
+
delete properties.file;
|
|
48
|
+
properties.file_path = { type: 'string', minLength: 1, maxLength: 4096, description: 'Absolute path to one explicitly selected regular file in the operation’s supported formats, at most 20 MiB. No URL or symbolic link.' };
|
|
49
|
+
required.push(...schema.required.filter(key => key !== 'file'), 'file_path');
|
|
50
|
+
inputSchema = { type: 'object', additionalProperties: false, properties, required };
|
|
51
|
+
}
|
|
52
|
+
return { multipart: !!multipart, formats: operation['x-sailsync-file-formats'] || ['csv','gpx','vkx','vtk'], url, method: method.toUpperCase(), parameters: operation.parameters || [], hasJsonBody: !!body, bodyKeys: Object.keys(body?.properties || {}),
|
|
53
|
+
definition: { name: operation.operationId, description: [operation.summary, operation.description].filter(Boolean).join('. '),
|
|
54
|
+
inputSchema,
|
|
55
|
+
annotations: { readOnlyHint: operation['x-sailsync-read-only'] ?? method === 'get', idempotentHint: true } } };
|
|
56
|
+
}));
|
|
57
|
+
|
|
58
|
+
function valid(value, schema) {
|
|
59
|
+
if (schema.oneOf) return schema.oneOf.filter(s => valid(value, s)).length === 1;
|
|
60
|
+
if (schema.enum && !schema.enum.includes(value)) return false;
|
|
61
|
+
if (value === null && schema.nullable === true) return true;
|
|
62
|
+
switch (schema.type) {
|
|
63
|
+
case 'boolean': return typeof value === 'boolean';
|
|
64
|
+
case 'object':
|
|
65
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) &&
|
|
66
|
+
(schema.required || []).every(key => Object.hasOwn(value, key)) &&
|
|
67
|
+
Object.entries(value).every(([key, item]) => schema.properties?.[key]
|
|
68
|
+
? valid(item, schema.properties[key]) : schema.additionalProperties !== false);
|
|
69
|
+
case 'array': return Array.isArray(value) && value.length >= (schema.minItems || 0) &&
|
|
70
|
+
value.length <= (schema.maxItems || Infinity) && value.every(item => valid(item, schema.items));
|
|
71
|
+
case 'string': return typeof value === 'string' && value.length >= (schema.minLength || 0) &&
|
|
72
|
+
value.length <= (schema.maxLength || Infinity) && (!schema.pattern || new RegExp(schema.pattern).test(value));
|
|
73
|
+
case 'integer': if (!Number.isInteger(value)) return false; // falls through
|
|
74
|
+
case 'number': return typeof value === 'number' && Number.isFinite(value) &&
|
|
75
|
+
value >= (schema.minimum ?? -Infinity) && value <= (schema.maximum ?? Infinity);
|
|
76
|
+
default: return true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function configuration() {
|
|
81
|
+
const base = new URL(process.env.SAILSYNC_API_URL || 'https://www.sailsync.io');
|
|
82
|
+
const local = ['localhost', '127.0.0.1', '[::1]'].includes(base.hostname);
|
|
83
|
+
const remote = ['dev.sailsync.io', 'www.sailsync.io'].includes(base.hostname);
|
|
84
|
+
if ((!local && !(remote && base.protocol === 'https:')) || !['http:', 'https:'].includes(base.protocol) ||
|
|
85
|
+
base.username || base.password || base.pathname !== '/' || base.search || base.hash) {
|
|
86
|
+
throw new Error('Set SAILSYNC_API_URL to a local app origin or HTTPS SailSync staging/production origin');
|
|
87
|
+
}
|
|
88
|
+
const token = process.env.SAILSYNC_API_TOKEN;
|
|
89
|
+
if (!/^ssi_[A-Za-z0-9_-]{43}$/.test(token || '')) throw new Error('Set SAILSYNC_API_TOKEN to a personal integration token');
|
|
90
|
+
return { base, token };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function localFile(filePath, maximum, formats) {
|
|
94
|
+
if (!path.isAbsolute(filePath) || !formats.includes(path.extname(filePath).toLowerCase().slice(1))) throw new Error('Invalid file');
|
|
95
|
+
const fd = fs.openSync(filePath, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK | (fs.constants.O_NOFOLLOW || 0));
|
|
96
|
+
try {
|
|
97
|
+
const stat = fs.fstatSync(fd);
|
|
98
|
+
if (!stat.isFile() || stat.size < 1 || stat.size > maximum) throw new Error('File limit');
|
|
99
|
+
const buffer = Buffer.alloc(maximum + 1);
|
|
100
|
+
let total = 0, count;
|
|
101
|
+
while (total <= maximum && (count = fs.readSync(fd, buffer, total, buffer.length - total, null)) > 0) total += count;
|
|
102
|
+
if (!total || total > maximum) throw new Error('File limit');
|
|
103
|
+
return buffer.subarray(0, total);
|
|
104
|
+
} finally { fs.closeSync(fd); }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
async function callTool(config, tool, args) {
|
|
108
|
+
if (tool.definition.name === 'importSailSyncTrack' && args.file_path !== undefined) {
|
|
109
|
+
try { args = { ...args, content_base64: localFile(args.file_path, 1024 * 1024, ['csv']).toString('base64') }; }
|
|
110
|
+
catch (_) { return { content: [{ type: 'text', text: 'Choose one readable, regular local CSV file no larger than 1 MiB. No upload was sent.' }], isError: true }; }
|
|
111
|
+
}
|
|
112
|
+
let url = tool.url;
|
|
113
|
+
const headers = { Authorization: `Bearer ${config.token}`, Accept: 'application/json' };
|
|
114
|
+
for (const parameter of tool.parameters) {
|
|
115
|
+
if (parameter.in === 'path') url = url.replace(`{${parameter.name}}`, encodeURIComponent(args[parameter.name]));
|
|
116
|
+
if (parameter.in === 'header') headers[parameter.name] = args.idempotency_key;
|
|
117
|
+
}
|
|
118
|
+
const target = new URL(url, config.base);
|
|
119
|
+
for (const parameter of tool.parameters) {
|
|
120
|
+
if (parameter.in === 'query' && Object.hasOwn(args, parameter.name)) {
|
|
121
|
+
if (Array.isArray(args[parameter.name])) args[parameter.name].forEach(value=>target.searchParams.append(`${parameter.name}[]`,String(value)));
|
|
122
|
+
else target.searchParams.set(parameter.name,String(args[parameter.name]));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
const options = { method: tool.method, headers, redirect: 'error', signal: AbortSignal.timeout(30000) };
|
|
126
|
+
if (tool.multipart) {
|
|
127
|
+
try {
|
|
128
|
+
const bytes = localFile(args.file_path, 20 * 1024 * 1024, tool.formats);
|
|
129
|
+
const form = new FormData();
|
|
130
|
+
form.append('file', new Blob([bytes]), `upload.${args.file_format || tool.formats[0]}`);
|
|
131
|
+
for (const key of ['label', 'file_format', 'timezone', 'batch_reference']) {
|
|
132
|
+
if (args[key] !== undefined) form.append(key, args[key]);
|
|
133
|
+
}
|
|
134
|
+
options.body = form;
|
|
135
|
+
options.signal = AbortSignal.timeout(120000);
|
|
136
|
+
} catch (_) {
|
|
137
|
+
return { content: [{ type: 'text', text: `Choose one readable, regular local ${tool.formats.map(format=>format.toUpperCase()).join(', ')} file no larger than 20 MiB. No upload was sent.` }], isError: true };
|
|
138
|
+
}
|
|
139
|
+
} else if (tool.hasJsonBody) {
|
|
140
|
+
headers['Content-Type'] = 'application/json';
|
|
141
|
+
options.body = JSON.stringify(Object.fromEntries(tool.bodyKeys.map(key => [key, args[key]])));
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
const response = await fetch(target, options);
|
|
145
|
+
const chunks = [];
|
|
146
|
+
let size = 0;
|
|
147
|
+
for await (const chunk of response.body) {
|
|
148
|
+
size += chunk.length;
|
|
149
|
+
if (size > MAX_BYTES) throw new Error('Response limit');
|
|
150
|
+
chunks.push(chunk);
|
|
151
|
+
}
|
|
152
|
+
const result = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
153
|
+
const retryAfter = Number(response.headers.get('Retry-After'));
|
|
154
|
+
if (response.status === 429 && Number.isFinite(retryAfter) && retryAfter > 0) result.retry_after = retryAfter;
|
|
155
|
+
return { content: [{ type: 'text', text: JSON.stringify(result) }], structuredContent: result, isError: !response.ok };
|
|
156
|
+
} catch (_) {
|
|
157
|
+
// Never print fetch exception internals or credentials.
|
|
158
|
+
return { content: [{ type: 'text', text: 'SailSync subscriber API unavailable or response invalid. Retry writes only with the same idempotency key; check turn status before submitting another paid turn.' }], isError: true };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
async function main() {
|
|
163
|
+
const config = configuration();
|
|
164
|
+
let initialized = false;
|
|
165
|
+
let negotiated = false;
|
|
166
|
+
const reply = value => process.stdout.write(`${JSON.stringify(value)}\n`);
|
|
167
|
+
const error = (id, code, message) => reply({ jsonrpc: '2.0', id, error: { code, message } });
|
|
168
|
+
const input = readline.createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
169
|
+
for await (const line of input) {
|
|
170
|
+
let message;
|
|
171
|
+
try {
|
|
172
|
+
if (Buffer.byteLength(line) > 2 * 1024 * 1024) throw new Error('Input limit');
|
|
173
|
+
message = JSON.parse(line);
|
|
174
|
+
} catch (_) { error(null, -32700, 'Invalid or oversized JSON'); continue; }
|
|
175
|
+
if (!message || Array.isArray(message) || message.jsonrpc !== '2.0' || typeof message.method !== 'string' ||
|
|
176
|
+
(Object.hasOwn(message, 'id') && message.id !== null && typeof message.id !== 'string' &&
|
|
177
|
+
!(typeof message.id === 'number' && Number.isFinite(message.id)))) {
|
|
178
|
+
error(message?.id ?? null, -32600, 'Invalid request'); continue;
|
|
179
|
+
}
|
|
180
|
+
if (!Object.hasOwn(message, 'id')) {
|
|
181
|
+
if (message.method === 'notifications/initialized' && negotiated) initialized = true;
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const { id, method, params = {} } = message;
|
|
185
|
+
if (method === 'initialize') {
|
|
186
|
+
if (negotiated || !params || typeof params.protocolVersion !== 'string') {
|
|
187
|
+
error(id, -32602, 'Invalid initialization'); continue;
|
|
188
|
+
}
|
|
189
|
+
negotiated = true;
|
|
190
|
+
reply({ jsonrpc: '2.0', id, result: { protocolVersion: VERSIONS.includes(params.protocolVersion) ? params.protocolVersion : VERSIONS[0],
|
|
191
|
+
capabilities: { tools: { listChanged: false } }, serverInfo: { name: 'sailsync-subscriber', version: spec.info.version },
|
|
192
|
+
instructions: 'SailSync account tools. Standard, Racer and Gold have different account-wide data limits. Read getSailSyncAccount limits, respect concurrency, and wait retry_after seconds on rate limits. This version supports authorized event/session discovery, existing day access, committed normalized GPS, configured wind and saved race metrics. Event-day access resolution spends no report day. Optional FLO requires explicit flo:write scope and uses your credits. Optional owned-session creation and track-file/wind imports require sessions:write; retry writes only with the same idempotency key. Optional recalculation requires compute:write and direct ownership of finished sessions. Report generation is not available yet. Access follows current account permissions; never request app passwords or sharing codes.' } });
|
|
193
|
+
} else if (method === 'ping') {
|
|
194
|
+
reply({ jsonrpc: '2.0', id, result: {} });
|
|
195
|
+
} else if (!initialized) {
|
|
196
|
+
error(id, -32000, 'Initialize the MCP connection first');
|
|
197
|
+
} else if (method === 'tools/list') {
|
|
198
|
+
reply({ jsonrpc: '2.0', id, result: { tools: tools.map(tool => tool.definition) } });
|
|
199
|
+
} else if (method === 'tools/call') {
|
|
200
|
+
const tool = tools.find(item => item.definition.name === params?.name);
|
|
201
|
+
const args = params?.arguments === undefined ? {} : params.arguments;
|
|
202
|
+
if (!tool || !valid(args, tool.definition.inputSchema)) {
|
|
203
|
+
error(id, -32602, 'Unknown tool or invalid arguments'); continue;
|
|
204
|
+
}
|
|
205
|
+
reply({ jsonrpc: '2.0', id, result: await callTool(config, tool, args) });
|
|
206
|
+
} else {
|
|
207
|
+
error(id, -32601, 'Method not found');
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
main().catch(() => {
|
|
213
|
+
process.stderr.write('Subscriber MCP bridge failed. Check SAILSYNC_API_URL and SAILSYNC_API_TOKEN.\n');
|
|
214
|
+
process.exitCode = 1;
|
|
215
|
+
});
|