@nativestudio/sdk 0.3.0-rc.19 → 0.3.0-rc.20

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.
Files changed (35) hide show
  1. package/COMPATIBILITY.json +4 -4
  2. package/dist/_chunks/{chunk-36S4YZBR.js → chunk-D3KLEDOI.js} +1 -1
  3. package/dist/_chunks/chunk-GJULDJSV.js +1 -0
  4. package/dist/_chunks/chunk-OHONXDFL.js +1 -0
  5. package/dist/_chunks/{chunk-NE4PLRWR.js → chunk-SXZY76XB.js} +1 -1
  6. package/dist/_chunks/{chunk-K7VYP4O5.js → chunk-XNROPEWC.js} +1 -1
  7. package/dist/_types/contracts/enterprise-brand.d.ts +302 -0
  8. package/dist/_types/contracts/index.d.ts +6 -0
  9. package/dist/_types/contracts/local-execution/ipc.d.ts +3 -3
  10. package/dist/_types/contracts/local-execution/lifecycle.d.ts +1 -1
  11. package/dist/_types/contracts/local-execution/local-navigation.d.ts +5 -5
  12. package/dist/_types/contracts/render-readiness.d.ts +175 -0
  13. package/dist/_types/contracts/series-canon.d.ts +97 -0
  14. package/dist/_types/contracts/series-character.d.ts +23 -0
  15. package/dist/_types/contracts/series-improvement.d.ts +1639 -0
  16. package/dist/_types/contracts/series-standard.d.ts +1641 -0
  17. package/dist/_types/sdk/catalog/carriers.d.ts +4 -0
  18. package/dist/_types/sdk/catalog/enterprise-brand.d.ts +462 -0
  19. package/dist/_types/sdk/catalog/mcp.d.ts +16 -0
  20. package/dist/_types/sdk/catalog/navigation.d.ts +155 -0
  21. package/dist/_types/sdk/catalog/series-standard.d.ts +5402 -0
  22. package/dist/_types/sdk/client.d.ts +3 -1
  23. package/dist/_types/sdk/device-renders.d.ts +55 -7
  24. package/dist/_types/sdk/index.d.ts +2 -1
  25. package/dist/_types/sdk/local-runtime-client.d.ts +2 -2
  26. package/dist/_types/sdk/mcp-client.d.ts +5 -1
  27. package/dist/_types/sdk/mcp-port.d.ts +2 -0
  28. package/dist/index.d.ts +2 -2
  29. package/dist/index.js +1 -1
  30. package/dist/local-runtime.js +1 -1
  31. package/dist/mcp-discovery.js +1 -1
  32. package/dist/runtime-authority.js +1 -1
  33. package/package.json +1 -1
  34. package/dist/_chunks/chunk-GZB5CEXU.js +0 -1
  35. package/dist/_chunks/chunk-TI3VMKZE.js +0 -1
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "protocol": "NVS_PRODUCT_COMPATIBILITY_V1",
3
3
  "product": "@nativestudio/sdk",
4
- "version": "0.3.0-rc.19",
4
+ "version": "0.3.0-rc.20",
5
5
  "source": {
6
- "head": "65f172585d3e99a7d1a61f8473027d5aa3de0de9",
7
- "fileDigest": "b02c547c8f12edfc80d406f3d4997f51f02b5997233abc92a030a6e324216eef",
6
+ "head": "be3ecdb415f12a3d526993f08b0dd3c6174edc33",
7
+ "fileDigest": "a605a1f262d4cf170d797ad8dbbac2d5c96c06896bc85cf0ce67f1c03a8bc9c1",
8
8
  "dirty": false,
9
- "remoteMainHead": "65f172585d3e99a7d1a61f8473027d5aa3de0de9"
9
+ "remoteMainHead": "be3ecdb415f12a3d526993f08b0dd3c6174edc33"
10
10
  },
11
11
  "node": ">=24.12 <25",
12
12
  "discoveryProfile": "contextual-v1",
@@ -1 +1 @@
1
- import{LocalManagementCommandSchema,WorkspaceCallerSchema}from"./chunk-K7VYP4O5.js";import{z}from"zod";var DeviceEnrollmentScopeSchema=z.strictObject({origin:WorkspaceCallerSchema.shape.serverOrigin,tenantId:z.uuid(),principalId:z.uuid()});var DeviceEnrollmentHandoffSchema=z.strictObject({protocol:z.literal("NVS_DEVICE_ENROLLMENT_HANDOFF_V1"),scope:DeviceEnrollmentScopeSchema,command:LocalManagementCommandSchema.options[0],fingerprint:z.string().regex(/^[a-f0-9]{64}$/)}).refine(({scope,command})=>scope.tenantId.toLowerCase()===command.input.tenantId.toLowerCase()&&scope.principalId.toLowerCase()===command.input.expectedPrincipalId?.toLowerCase(),{message:"Enrollment must match the target workspace and member"});export{DeviceEnrollmentScopeSchema,DeviceEnrollmentHandoffSchema};
1
+ import{LocalManagementCommandSchema,WorkspaceCallerSchema}from"./chunk-XNROPEWC.js";import{z}from"zod";var DeviceEnrollmentScopeSchema=z.strictObject({origin:WorkspaceCallerSchema.shape.serverOrigin,tenantId:z.uuid(),principalId:z.uuid()});var DeviceEnrollmentHandoffSchema=z.strictObject({protocol:z.literal("NVS_DEVICE_ENROLLMENT_HANDOFF_V1"),scope:DeviceEnrollmentScopeSchema,command:LocalManagementCommandSchema.options[0],fingerprint:z.string().regex(/^[a-f0-9]{64}$/)}).refine(({scope,command})=>scope.tenantId.toLowerCase()===command.input.tenantId.toLowerCase()&&scope.principalId.toLowerCase()===command.input.expectedPrincipalId?.toLowerCase(),{message:"Enrollment must match the target workspace and member"});export{DeviceEnrollmentScopeSchema,DeviceEnrollmentHandoffSchema};
@@ -0,0 +1 @@
1
+ import{FederationFailureCodeSchema}from"./chunk-O6YL4JVI.js";import{CapabilityVersionMismatchSchema,InterfaceSemanticStatusSchema,TenantIdSchema}from"./chunk-AFUVP2DC.js";import{NativeStudioSdkError,sdkInputError}from"./chunk-TT7IA5HB.js";function descriptorOperation(input,output,request,expectedPath){return Object.freeze({...operation(input,output,request,[],{readOnly:true}),expectedPath})}function operation(input,output,request,identity=[],options={}){return Object.freeze({input,output,request,identity,readOnly:options.readOnly,expectedPath:void 0,identityWhenPresent:options.identityWhenPresent??[]})}function path(...parts){return"/v1/"+parts.map(value=>encodeURIComponent(value)).join("/")}function pageQuery(input){return{limit:input.limit,next:input.next}}function mcpOperation(input,output,readOnly,identity=[],expectedPath){return Object.freeze({input,output,request:null,readOnly,identity,expectedPath,identityWhenPresent:[]})}var scopeKeys=["tenantId","projectId","productionId"];function navigationResponseMatches(value){if(!value||typeof value!=="object")return true;const result=value;if(result.evidence?.source!=="production_snapshot")return true;if(!result.actions?.items||!result.operations?.items)return false;const same2=(a,b)=>typeof a==="string"&&typeof b==="string"&&a.toLowerCase()===b.toLowerCase();const hintsMatch=input=>!input||scopeKeys.every(key=>input[key]===void 0||same2(input[key],result[key]));return result.actions.items.every(action=>scopeKeys.every(key=>same2(action.context[key],result[key]))&&action.context.revision===result.evidence.revision&&hintsMatch(action.inputHints?.knownInputs)&&hintsMatch(action.inspect?.arguments))&&result.operations.items.every(operation2=>{const inspect=operation2.inspect;const input=inspect?.tool==="studio_capability_query"?inspect.arguments.arguments:inspect?.arguments;return hintsMatch(inspect?.arguments)&&hintsMatch(input)&&(!inspect||input?.operationId===operation2.id)})}var envelopes=new Set(["choices","related","operations","items","project","production","productions","artifact","primaryRepresentation","relations","storyVersion","planVersion","version","manifest","timeline","basis","review","selection","decision","target","admission","policy","finalDelivery","receipt","render","evidence","source","sourceIdentity","preparation","link","body","latestReview","finalReady","approval","binding","standard","snapshot","sequence","frames","frameOutput","acceptance","reference","candidate","connection","scope","profile","current","feedback","share","ownerContext","comparison","candidates","reviewContext","input","recordDraft","owner","output","result","briefVersion","deliveryTarget","deliverySnapshot","validation","preparations","view","generationDrafts","request","generation","handoff","mediaRead","reviewTarget","reviews"]);var uuid=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function same(left,right){if(Array.isArray(left)||Array.isArray(right))return Array.isArray(left)&&Array.isArray(right)&&left.length===right.length&&left.every((item,i)=>same(item,right[i]));if(left&&right&&typeof left==="object"&&typeof right==="object"){const a=left,b=right;const keys=Object.keys(a);return keys.length===Object.keys(b).length&&keys.every(key=>Object.hasOwn(b,key)&&same(a[key],b[key]))}return typeof left==="string"&&typeof right==="string"&&uuid.test(left)&&uuid.test(right)?left.toLowerCase()===right.toLowerCase():left===right}function scopeMatches(value,scope,depth=0){if(!value||typeof value!=="object")return true;if(depth>12)return false;if(Array.isArray(value))return value.every(item=>scopeMatches(item,scope,depth+1));const record=value;for(const key of["tenantId","projectId","productionId"])if(scope[key]!==void 0&&record[key]!==void 0&&record[key]!==null&&!same(record[key],scope[key]))return false;return Object.entries(record).every(([key,item])=>{if(key==="feedback"&&item&&typeof item==="object"&&scope.operationId!==void 0&&!same(item.operationId,scope.operationId))return false;return!envelopes.has(key)||scopeMatches(item,scope,depth+1)})}function targetsMatch(value,parts,expected){if(!parts.length)return same(value,expected);const[part,...rest]=parts;if(part==="*")return Array.isArray(value)&&value.every(item=>targetsMatch(item,rest,expected));return!!value&&typeof value==="object"&&targetsMatch(value[part],rest,expected)}function deviceBound(request,result){const target=request;const receipt=result?.deviceExecution;if(target.mode===void 0)return receipt?.target==="TENANT_DEVICE"&&typeof result?.runtimeJobId==="string"&&(!target.deviceId||same(target.deviceId,receipt.deviceId));return!!receipt&&receipt.mode===target.mode&&!!receipt.runtimeJobId&&(!target.validationMode||target.validationMode===receipt.validationMode)&&(!target.deviceId||same(target.deviceId,receipt.deviceId))}function deviceJobMatches(result){const value=result;return value?.runtimeJobId===void 0||value.deviceExecution?.runtimeJobId===void 0||same(value.runtimeJobId,value.deviceExecution.runtimeJobId)}function assertResponseBindings(result,input,identity,method,pathOrBindings,additionalBindings=[]){if(result===null)return;const expectedPath=typeof pathOrBindings==="string"?pathOrBindings:void 0;const identityWhenPresent=typeof pathOrBindings==="string"||pathOrBindings===void 0?additionalBindings:pathOrBindings;const record=result;const basis=input.basis;const basisInput=basis?.input;const nested=input.scope??basis?.scope??basisInput?.scope??basis;if(input.deviceExecution!==void 0&&!deviceBound(input.deviceExecution,result)||!deviceJobMatches(result)||!scopeMatches(result,input)||!navigationResponseMatches(result)||nested!==void 0&&!scopeMatches(result,nested)||expectedPath!==void 0&&(typeof record?.path!=="string"||record.path.replace(/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}/gi,id=>id.toLowerCase())!==expectedPath.replace(/[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}/gi,id=>id.toLowerCase()))||[...identity,...identityWhenPresent.filter(([,target])=>!!record&&Object.hasOwn(record,target))].some(([key,target,whenStatus])=>{if(whenStatus!==void 0&&record?.semanticStatus!==whenStatus)return false;const expected=key.split(".").reduce((value,field)=>value&&typeof value==="object"?value[field]:void 0,input);return expected!==void 0&&!targetsMatch(result,target.split("."),expected)})||Array.isArray(record?.items)&&typeof input.limit==="number"&&record.items.length>input.limit)throw new NativeStudioSdkError("RESPONSE_SCOPE_MISMATCH","INTERNAL_OPERATIONAL_FAILURE",method==="POST"?"UNKNOWN":"NO_WRITE")}import{z}from"zod";var NativeToolAuthorityFailureSchema=z.strictObject({semanticStatus:z.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z.strictObject({code:z.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","BINDING_UNAVAILABLE","REQUEST_CONFLICT","REVISION_CONFLICT","GRANT_CONFLICT","GRANT_EXPIRED","GRANT_REVOKED","PROOF_INVALID","PROOF_REPLAY","CHALLENGE_EXPIRED","PERMIT_UNAVAILABLE","QUALIFICATION_UNAVAILABLE","CREDENTIAL_INVALID","CREDENTIAL_EXPIRED","CREDENTIAL_UNAVAILABLE","CREDENTIAL_LIMIT","HOST_RUN_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),message:z.literal("Native tool authority operation did not complete")})});function abortable(promise,signal){if(signal.aborted){void promise.catch(()=>{});return Promise.reject(signal.reason)}return new Promise((resolve,reject)=>{const abort=()=>reject(signal.reason);signal.addEventListener("abort",abort,{once:true});promise.then(resolve,reject).finally(()=>signal.removeEventListener("abort",abort))})}async function boundedResponseBytes(response,limit,signal){const length=response.headers.get("content-length");if(length!==null&&(!/^\d+$/.test(length)||Number(length)>limit)){void response.body?.cancel().catch(()=>{});throw new NativeStudioSdkError("RESPONSE_TOO_LARGE","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}if(!response.body)return new Uint8Array;const reader=response.body.getReader();const chunks=[];let size=0;try{while(true){const next=await abortable(reader.read(),signal);if(next.done)break;size+=next.value.byteLength;if(size>limit)throw new NativeStudioSdkError("RESPONSE_TOO_LARGE","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN");chunks.push(next.value)}const result=new Uint8Array(size);let offset=0;for(const chunk of chunks){result.set(chunk,offset);offset+=chunk.byteLength}return result}finally{void reader.cancel().catch(()=>{});reader.releaseLock()}}var nativeFailureCodes=new Set([...NativeToolAuthorityFailureSchema.shape.error.shape.code.options,...FederationFailureCodeSchema.options,"REQUEST_CONFLICT","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CREDENTIAL_SCOPE_MISMATCH","BINDING_REVOKED","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","INVALID_INPUT","REVISION_CONFLICT","STALE_BASIS","BLOCKED","CAPABILITY_UNAVAILABLE","DEVICE_UNAVAILABLE","CAPABILITY_VERSION_MISMATCH","PROVIDER_UNAVAILABLE","BUDGET_BLOCKED","CANCELLED","SUPERSEDED","INTERNAL_OPERATIONAL_FAILURE","IDEMPOTENCY_CONFLICT","CONTINUITY_CONFLICT","INPUT_UNAVAILABLE","AUDIO_UNAVAILABLE","CAPTION_UNAVAILABLE","TEST_EVIDENCE_DENIED","CONFLICT","INVALID_MEDIA","LEASE_LOST","SOURCE_UNAVAILABLE","TOOL_AUTHORITY_UNAVAILABLE","ACTIVE_EXECUTION_EXISTS","BINDING_UNAVAILABLE","PROVIDER_CAPABILITY_UNAVAILABLE","REPLAY_EXHAUSTED","RESYNC_REQUIRED"]);var statuses={400:["INVALID_INPUT"],413:["INVALID_INPUT"],415:["INVALID_INPUT"],401:["BLOCKED"],403:["BLOCKED"],404:["NOT_FOUND"],409:["REVISION_CONFLICT","STALE_BASIS","BLOCKED","CAPABILITY_UNAVAILABLE","BUDGET_BLOCKED","CANCELLED","SUPERSEDED"],422:["INVALID_INPUT"],429:["BUDGET_BLOCKED","PROVIDER_UNAVAILABLE"]};function failureOutcome(write,status,declared){if(!write)return"NO_WRITE";if(declared==="NO_WRITE"||declared==="UNKNOWN"||declared==="REJECTED")return declared;return["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","STALE_BASIS","BUDGET_BLOCKED"].includes(status)?"REJECTED":"UNKNOWN"}async function nativeFailure(response,signal){try{if(response.headers.get("content-type")?.split(";")[0]?.trim()!=="application/json")return null;const bytes=await boundedResponseBytes(response,64*1024,signal);const raw=JSON.parse(new TextDecoder("utf-8",{fatal:true}).decode(bytes));if(!raw||typeof raw!=="object"||Array.isArray(raw))return null;const record=raw;const status=InterfaceSemanticStatusSchema.safeParse(record.semanticStatus);if(!status.success||!(statuses[response.status]??(response.status>=500?["INTERNAL_OPERATIONAL_FAILURE","PROVIDER_UNAVAILABLE","CAPABILITY_UNAVAILABLE"]:[])).includes(status.data))return null;const error=record.error;const code=error?.code;const mismatch=capabilityMismatch(code,status.data,error?.details);const known=typeof code==="string"&&nativeFailureCodes.has(code)&&(code!=="CAPABILITY_VERSION_MISMATCH"||!!mismatch);return{semanticStatus:status.data,code:known?code:status.data,mismatch,outcome:error&&typeof error==="object"&&!Array.isArray(error)&&(known||error.outcome==="UNKNOWN")?error.outcome:void 0}}catch{return null}finally{void response.body?.cancel().catch(()=>{})}}function capabilityMismatch(code,status,detail){if(code==="CAPABILITY_VERSION_MISMATCH"&&status==="CAPABILITY_UNAVAILABLE")return CapabilityVersionMismatchSchema.safeParse(detail).data}var NativeStudioHttpTransport=class{constructor(config){this.config=config;try{this.origin=new URL(config.baseUrl);if(this.origin.username||this.origin.password||this.origin.search||this.origin.hash||this.origin.pathname!=="/"||this.origin.protocol!=="https:"&&!(this.origin.protocol==="http:"&&["localhost","127.0.0.1","[::1]"].includes(this.origin.hostname)))sdkInputError()}catch{sdkInputError()}this.timeout=config.timeoutMs??3e4;this.jsonLimit=config.maxJsonBytes??18*1024*1024;if(!Number.isSafeInteger(this.timeout)||this.timeout<1||this.timeout>3e5||!Number.isSafeInteger(this.jsonLimit)||this.jsonLimit<1024||this.jsonLimit>32*1024*1024)sdkInputError()}config;origin;timeout;jsonLimit;async response(request,options){const write=request.method==="POST"&&!request.readOnly;if(!request.path.startsWith("/v1/")||request.path.includes("?")||request.path.includes("#")||request.path.includes(".."))sdkInputError();const url=new URL(request.path,this.origin);if(url.origin!==this.origin.origin||!url.pathname.startsWith("/v1/")||!["GET","POST"].includes(request.method)||!TenantIdSchema.safeParse(request.tenantId).success)sdkInputError();for(const[key,value]of Object.entries(request.query??{}))if(value!==void 0)url.searchParams.set(key,String(value));let body;try{if(request.importedVideo){const v=request.importedVideo;if(request.method!=="POST"||request.body!==void 0||!/^\/v1\/productions\/[a-f0-9-]{36}\/imported-visuals\/originals\/bytes$/i.test(request.path)||!(v.bytes instanceof Uint8Array)||v.bytes.length<32||v.bytes.length>128*1024*1024||!/^[A-Za-z0-9_-]+$/.test(v.metadata)||v.metadata.length>8192)sdkInputError();body=new Uint8Array(v.bytes)}else body=request.body===void 0?void 0:JSON.stringify(request.body);if(typeof body==="string"&&new TextEncoder().encode(body).byteLength>18*1024*1024)sdkInputError()}catch{sdkInputError()}const timeout=AbortSignal.timeout(this.timeout);const signal=options.signal?AbortSignal.any([options.signal,timeout]):timeout;if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");let authorization;if(request.authentication==="runtime-proof"){if(request.method!=="POST"||!/^\/v1\/projects\/[0-9a-f-]{36}\/(?:native-tool-grants\/[0-9a-f-]{36}\/(?:proof|status)|productions\/[0-9a-f-]{36}\/native-tool-credentials\/exchange)$/.test(request.path))sdkInputError()}else{try{authorization=await abortable(Promise.resolve().then(()=>this.config.authorization(signal)),signal)}catch{throw new NativeStudioSdkError(signal.aborted?"REQUEST_ABORTED":"UNAUTHENTICATED","BLOCKED","NO_WRITE")}if(typeof authorization!=="string"||!/^Bearer [A-Za-z0-9._~+/-]+={0,2}$/.test(authorization)||authorization.length>16384)throw new NativeStudioSdkError("UNAUTHENTICATED","BLOCKED","NO_WRITE")}if(signal.aborted)throw new NativeStudioSdkError("REQUEST_ABORTED","BLOCKED","NO_WRITE");try{const pending=Promise.resolve().then(()=>(this.config.fetch??fetch)(url,{method:request.method,redirect:"error",cache:"no-store",signal,headers:{...authorization===void 0?{}:{authorization},"x-native-tenant-id":request.tenantId,accept:"application/json",...request.body===void 0?{}:{"content-type":"application/json"},...request.importedVideo?{"content-type":"video/mp4","x-native-import-metadata":request.importedVideo.metadata}:{}},...body===void 0?{}:{body}}));void pending.then(late=>{if(signal.aborted)void late.body?.cancel().catch(()=>{})},()=>{});const response=await abortable(pending,signal);if(!response.ok){const status=response.status;const native=await nativeFailure(response,signal);const code=status===401?"UNAUTHENTICATED":status===403?"FORBIDDEN":status===404?"NOT_FOUND":status===400||status===413||status===415||status===422?"INVALID_INPUT":status===409?"REVISION_CONFLICT":"HTTP_FAILURE";const semanticStatus=status===401||status===403?"BLOCKED":status===404?"NOT_FOUND":status===400||status===413||status===415||status===422?"INVALID_INPUT":status===409?"REVISION_CONFLICT":"INTERNAL_OPERATIONAL_FAILURE";throw new NativeStudioSdkError(native?.code??code,native?.semanticStatus??semanticStatus,failureOutcome(write,native?.semanticStatus??semanticStatus,native?.outcome),status,[],native?.mismatch)}return{response,signal}}catch(error){if(error instanceof NativeStudioSdkError)throw error;throw new NativeStudioSdkError(write?"OUTCOME_UNKNOWN":signal.aborted?"REQUEST_ABORTED":"TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE",write?"UNKNOWN":"NO_WRITE")}}async json(request,schema,options={}){const limit=options.maxJsonBytes??this.jsonLimit;if(!Number.isSafeInteger(limit)||limit<1024||limit>this.jsonLimit)sdkInputError();const{response,signal}=await this.response(request,options);try{const contentType=response.headers.get("content-type")?.split(";")[0]?.trim();if(contentType!=="application/json"){void response.body?.cancel().catch(()=>{});throw new Error}const bytes=await boundedResponseBytes(response,limit,signal);return schema.parse(JSON.parse(new TextDecoder("utf-8",{fatal:true}).decode(bytes)))}catch(error){if(error instanceof NativeStudioSdkError)throw new NativeStudioSdkError(error.code,error.semanticStatus,request.method==="POST"&&!request.readOnly?"UNKNOWN":"NO_WRITE",error.status);throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE",request.method==="POST"&&!request.readOnly?"UNKNOWN":"NO_WRITE")}}async binary(request,contentTypes,limit,options={}){if(request.method!=="GET"||!Number.isSafeInteger(limit)||limit<1||limit>128*1024*1024)sdkInputError();const{response,signal}=await this.response(request,options);const contentType=response.headers.get("content-type")?.split(";")[0]?.trim()??"";if(!contentTypes.includes(contentType)){await response.body?.cancel().catch(()=>{});throw new NativeStudioSdkError("RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}try{return{bytes:await boundedResponseBytes(response,limit,signal),contentType,etag:response.headers.get("etag")}}catch(error){throw new NativeStudioSdkError(error instanceof NativeStudioSdkError?error.code:signal.aborted?"REQUEST_ABORTED":"RESPONSE_INVALID","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}}};export{abortable,boundedResponseBytes,descriptorOperation,operation,path,pageQuery,mcpOperation,assertResponseBindings,nativeFailureCodes,failureOutcome,capabilityMismatch,NativeStudioHttpTransport};