@openrouter/sdk 1.4.25 → 1.5.0
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/esm/funcs/apiKeysList.d.ts +1 -1
- package/esm/funcs/apiKeysList.js +3 -2
- package/esm/funcs/apiKeysUpdate.d.ts +4 -2
- package/esm/funcs/apiKeysUpdate.js +5 -3
- package/esm/funcs/chatSend.d.ts +4 -2
- package/esm/funcs/containersPromoteContainerFile.d.ts +1 -1
- package/esm/funcs/containersPromoteContainerFile.js +2 -2
- package/esm/funcs/embeddingsGenerate.d.ts +1 -1
- package/esm/funcs/embeddingsGenerate.js +2 -2
- package/esm/funcs/{endUsersCreate.d.ts → externalUsersCreate.d.ts} +3 -3
- package/esm/funcs/{endUsersCreate.js → externalUsersCreate.js} +11 -11
- package/esm/funcs/{endUsersDelete.d.ts → externalUsersDelete.d.ts} +3 -3
- package/esm/funcs/{endUsersDelete.js → externalUsersDelete.js} +8 -8
- package/esm/funcs/{endUsersGet.d.ts → externalUsersGet.d.ts} +3 -3
- package/esm/funcs/{endUsersGet.js → externalUsersGet.js} +10 -10
- package/esm/funcs/{endUsersList.d.ts → externalUsersList.d.ts} +3 -3
- package/esm/funcs/{endUsersList.js → externalUsersList.js} +10 -10
- package/esm/funcs/{endUsersUpdate.d.ts → externalUsersUpdate.d.ts} +3 -3
- package/esm/funcs/{endUsersUpdate.js → externalUsersUpdate.js} +11 -11
- package/esm/funcs/filesUpload.d.ts +1 -1
- package/esm/funcs/filesUpload.js +2 -2
- package/esm/funcs/guardrailsListKeyAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListKeyAssignments.js +2 -2
- package/esm/funcs/guardrailsListMemberAssignments.d.ts +1 -1
- package/esm/funcs/guardrailsListMemberAssignments.js +2 -2
- package/esm/funcs/imagesGenerate.d.ts +4 -2
- package/esm/funcs/internsGetInternConnections.d.ts +21 -0
- package/esm/funcs/internsGetInternConnections.js +105 -0
- package/esm/funcs/internsGetInternDaemon.d.ts +1 -1
- package/esm/funcs/internsGetInternDaemon.js +1 -1
- package/esm/funcs/internsGetInternIcon.d.ts +20 -0
- package/esm/funcs/internsGetInternIcon.js +109 -0
- package/esm/funcs/internsSignInternDaemonAccessRequest.d.ts +22 -0
- package/esm/funcs/internsSignInternDaemonAccessRequest.js +109 -0
- package/esm/funcs/internsSignInternDaemonRequest.d.ts +20 -0
- package/esm/funcs/internsSignInternDaemonRequest.js +109 -0
- package/esm/funcs/modelsListForUser.js +1 -0
- package/esm/funcs/privateEndpointsUpdatePricing.d.ts +1 -1
- package/esm/funcs/privateEndpointsUpdatePricing.js +1 -1
- package/esm/funcs/responsesSend.d.ts +4 -2
- package/esm/funcs/vaultDeleteInternVaultSecret.d.ts +1 -1
- package/esm/funcs/vaultDeleteInternVaultSecret.js +2 -2
- package/esm/funcs/vaultDeleteVaultSecret.d.ts +1 -1
- package/esm/funcs/vaultDeleteVaultSecret.js +2 -2
- package/esm/funcs/vaultListInternConnections.d.ts +20 -0
- package/esm/funcs/vaultListInternConnections.js +104 -0
- package/esm/funcs/vaultStoreVaultSecret.d.ts +1 -1
- package/esm/funcs/vaultStoreVaultSecret.js +2 -2
- package/esm/funcs/videoGenerationGenerate.d.ts +1 -1
- package/esm/funcs/videoGenerationGenerate.js +2 -2
- package/esm/lib/config.d.ts +3 -3
- package/esm/lib/config.js +3 -3
- package/esm/lib/encodings.d.ts +10 -9
- package/esm/lib/encodings.js +29 -13
- package/esm/lib/http.d.ts +1 -1
- package/esm/lib/http.js +1 -1
- package/esm/lib/security.d.ts +5 -4
- package/esm/lib/security.js +4 -5
- package/esm/models/additionaltoolsitem.d.ts +16 -1
- package/esm/models/additionaltoolsitem.js +10 -0
- package/esm/models/alignment.d.ts +1 -1
- package/esm/models/alignmentplugin.d.ts +9 -8
- package/esm/models/alignmentplugin.js +3 -2
- package/esm/models/alignmentrule.d.ts +31 -0
- package/esm/models/alignmentrule.js +25 -0
- package/esm/models/alignmentrulerecord.d.ts +7 -3
- package/esm/models/alignmentrulerecord.js +2 -1
- package/esm/models/armorautomode.d.ts +44 -0
- package/esm/models/armorautomode.js +49 -0
- package/esm/models/armorcontext.d.ts +22 -0
- package/esm/models/armorcontext.js +25 -0
- package/esm/models/armorenvironmententry.d.ts +14 -0
- package/esm/models/armorenvironmententry.js +14 -0
- package/esm/models/armorplugin.d.ts +92 -0
- package/esm/models/armorplugin.js +60 -0
- package/esm/models/armorrule.d.ts +30 -0
- package/esm/models/armorrule.js +16 -0
- package/esm/models/armorsafeguardresult.d.ts +69 -0
- package/esm/models/armorsafeguardresult.js +83 -0
- package/esm/models/batchlistitem.d.ts +8 -0
- package/esm/models/batchlistitem.js +3 -0
- package/esm/models/batchobject.d.ts +13 -0
- package/esm/models/batchobject.js +6 -0
- package/esm/models/batchsubmitbody.d.ts +5 -0
- package/esm/models/batchsubmitbody.js +2 -0
- package/esm/models/byokkey.d.ts +3 -3
- package/esm/models/byokkey.js +1 -1
- package/esm/models/byokproviderslug.d.ts +2 -0
- package/esm/models/byokproviderslug.js +2 -0
- package/esm/models/chatcontenttext.d.ts +1 -1
- package/esm/models/chatfunctiontool.d.ts +4 -0
- package/esm/models/chatfunctiontool.js +7 -0
- package/esm/models/chatrequest.d.ts +16 -9
- package/esm/models/chatrequest.js +9 -6
- package/esm/models/chatresult.d.ts +10 -0
- package/esm/models/chatresult.js +5 -0
- package/esm/models/chatstreamchunk.d.ts +7 -0
- package/esm/models/chatstreamchunk.js +5 -0
- package/esm/models/chatwebsearchshorthand.d.ts +1 -1
- package/esm/models/clientclosedrequestresponseerrordata.d.ts +17 -0
- package/esm/models/clientclosedrequestresponseerrordata.js +16 -0
- package/esm/models/computeruseservertool.d.ts +5 -5
- package/esm/models/computeruseservertool.js +5 -5
- package/esm/models/createbyokkeyrequest.d.ts +3 -3
- package/esm/models/createbyokkeyrequest.js +1 -1
- package/esm/models/createexternaluserrequest.d.ts +15 -0
- package/esm/models/createexternaluserrequest.js +13 -0
- package/esm/models/createguardrailrequest.d.ts +10 -0
- package/esm/models/createguardrailrequest.js +4 -0
- package/esm/models/createobservabilitydestinationrequest.d.ts +5 -0
- package/esm/models/createobservabilitydestinationrequest.js +2 -0
- package/esm/models/customtool.d.ts +2 -0
- package/esm/models/customtool.js +11 -0
- package/esm/models/decisionsboxanswer.d.ts +21 -0
- package/esm/models/decisionsboxanswer.js +26 -0
- package/esm/models/decisionsboxquestion.d.ts +34 -0
- package/esm/models/decisionsboxquestion.js +23 -0
- package/esm/models/decisionsrequest.d.ts +6 -5
- package/esm/models/decisionsrequest.js +3 -0
- package/esm/models/decisionsresponse.d.ts +4 -3
- package/esm/models/decisionsresponse.js +3 -0
- package/esm/models/deferredbm25search.d.ts +17 -0
- package/esm/models/deferredbm25search.js +19 -0
- package/esm/models/deferredcustomsearch.d.ts +21 -0
- package/esm/models/deferredcustomsearch.js +23 -0
- package/esm/models/deferredregexsearch.d.ts +17 -0
- package/esm/models/deferredregexsearch.js +19 -0
- package/esm/models/deferredtoolscontrol.d.ts +62 -0
- package/esm/models/deferredtoolscontrol.js +38 -0
- package/esm/models/deferredtoolssearchstrategy.d.ts +14 -0
- package/esm/models/deferredtoolssearchstrategy.js +18 -0
- package/esm/models/errors/batchpaymentrequiredresponseerror.d.ts +16 -0
- package/esm/models/errors/batchpaymentrequiredresponseerror.js +5 -0
- package/esm/models/errors/clientclosedrequestresponseerror.d.ts +39 -0
- package/esm/models/errors/clientclosedrequestresponseerror.js +47 -0
- package/esm/models/errors/index.d.ts +1 -0
- package/esm/models/errors/index.js +1 -0
- package/esm/models/{enduser.d.ts → externaluser.d.ts} +5 -5
- package/esm/models/{enduser.js → externaluser.js} +6 -5
- package/esm/models/externaluserresponse.d.ts +11 -0
- package/esm/models/externaluserresponse.js +15 -0
- package/esm/models/guardrail.d.ts +8 -0
- package/esm/models/guardrail.js +4 -0
- package/esm/models/imagegenerationproviderpreferences.d.ts +12 -0
- package/esm/models/imagegenerationproviderpreferences.js +3 -0
- package/esm/models/index.d.ts +34 -6
- package/esm/models/index.js +34 -6
- package/esm/models/inputsunion.d.ts +7 -4
- package/esm/models/inputsunion.js +9 -0
- package/esm/models/inputtext.d.ts +1 -1
- package/esm/models/intern.d.ts +12 -0
- package/esm/models/intern.js +6 -0
- package/esm/models/internconnection.d.ts +118 -0
- package/esm/models/internconnection.js +105 -0
- package/esm/models/internconnectionlist.d.ts +11 -0
- package/esm/models/internconnectionlist.js +15 -0
- package/esm/models/jevrouterplugin.d.ts +5 -0
- package/esm/models/jevrouterplugin.js +2 -0
- package/esm/models/keybudget.d.ts +80 -0
- package/esm/models/keybudget.js +58 -0
- package/esm/models/legacywebsearchservertool.d.ts +1 -1
- package/esm/models/listexternalusersresponse.d.ts +15 -0
- package/esm/models/listexternalusersresponse.js +21 -0
- package/esm/models/messagesmessageparam.d.ts +7 -6
- package/esm/models/messagesmessageparam.js +4 -0
- package/esm/models/messagesrequest.d.ts +11 -4
- package/esm/models/messagesrequest.js +6 -0
- package/esm/models/namespacefunctiontool.d.ts +5 -5
- package/esm/models/namespacefunctiontool.js +5 -5
- package/esm/models/observabilityarizedestination.d.ts +4 -0
- package/esm/models/observabilityarizedestination.js +2 -0
- package/esm/models/observabilitybraintrustdestination.d.ts +4 -0
- package/esm/models/observabilitybraintrustdestination.js +2 -0
- package/esm/models/observabilityclickhousedestination.d.ts +4 -0
- package/esm/models/observabilityclickhousedestination.js +2 -0
- package/esm/models/observabilitydatadogdestination.d.ts +4 -0
- package/esm/models/observabilitydatadogdestination.js +2 -0
- package/esm/models/observabilitygrafanadestination.d.ts +4 -0
- package/esm/models/observabilitygrafanadestination.js +2 -0
- package/esm/models/observabilitylangfusedestination.d.ts +4 -0
- package/esm/models/observabilitylangfusedestination.js +2 -0
- package/esm/models/observabilitylangsmithdestination.d.ts +4 -0
- package/esm/models/observabilitylangsmithdestination.js +2 -0
- package/esm/models/observabilitynewrelicdestination.d.ts +4 -0
- package/esm/models/observabilitynewrelicdestination.js +2 -0
- package/esm/models/observabilityopikdestination.d.ts +4 -0
- package/esm/models/observabilityopikdestination.js +2 -0
- package/esm/models/observabilityotelcollectordestination.d.ts +4 -0
- package/esm/models/observabilityotelcollectordestination.js +2 -0
- package/esm/models/observabilityposthogdestination.d.ts +4 -0
- package/esm/models/observabilityposthogdestination.js +2 -0
- package/esm/models/observabilityrampdestination.d.ts +4 -0
- package/esm/models/observabilityrampdestination.js +2 -0
- package/esm/models/observabilitys3destination.d.ts +4 -0
- package/esm/models/observabilitys3destination.js +2 -0
- package/esm/models/observabilitysentrydestination.d.ts +4 -0
- package/esm/models/observabilitysentrydestination.js +2 -0
- package/esm/models/observabilitysnowflakedestination.d.ts +4 -0
- package/esm/models/observabilitysnowflakedestination.js +2 -0
- package/esm/models/observabilityweavedestination.d.ts +4 -0
- package/esm/models/observabilityweavedestination.js +2 -0
- package/esm/models/observabilitywebhookdestination.d.ts +8 -4
- package/esm/models/observabilitywebhookdestination.js +5 -4
- package/esm/models/openresponseserrorfield.d.ts +1 -0
- package/esm/models/openresponseserrorfield.js +1 -0
- package/esm/models/openresponseserrormetadata.d.ts +1 -1
- package/esm/models/openresponsesresult.d.ts +19 -3
- package/esm/models/openresponsesresult.js +14 -0
- package/esm/models/operations/{createenduser.d.ts → createexternaluser.d.ts} +8 -8
- package/esm/models/operations/createexternaluser.js +23 -0
- package/esm/models/operations/deleteexternaluser.d.ts +58 -0
- package/esm/models/operations/{deleteenduser.js → deleteexternaluser.js} +5 -5
- package/esm/models/operations/getcurrentkey.d.ts +5 -0
- package/esm/models/operations/getcurrentkey.js +4 -1
- package/esm/models/operations/{updateenduser.d.ts → getexternaluser.d.ts} +7 -10
- package/esm/models/operations/{getenduser.js → getexternaluser.js} +5 -5
- package/esm/models/operations/{deleteenduser.d.ts → getinternconnections.d.ts} +9 -9
- package/esm/models/operations/getinternconnections.js +21 -0
- package/esm/models/operations/{getenduser.d.ts → getinternicon.d.ts} +14 -9
- package/esm/models/operations/getinternicon.js +22 -0
- package/esm/models/operations/index.d.ts +10 -5
- package/esm/models/operations/index.js +10 -5
- package/esm/models/operations/list.d.ts +5 -0
- package/esm/models/operations/list.js +2 -0
- package/esm/models/operations/listbatches.d.ts +4 -4
- package/esm/models/operations/listbatches.js +3 -3
- package/esm/models/operations/listbyokkeys.d.ts +2 -0
- package/esm/models/operations/listbyokkeys.js +2 -0
- package/esm/models/operations/{listendusers.d.ts → listexternalusers.d.ts} +11 -11
- package/esm/models/operations/listexternalusers.js +38 -0
- package/esm/models/operations/listinternconnections.d.ts +75 -0
- package/esm/models/operations/listinternconnections.js +36 -0
- package/esm/models/operations/listmodelsuser.d.ts +29 -0
- package/esm/models/operations/listmodelsuser.js +21 -0
- package/esm/models/operations/signinterndaemonaccessrequest.d.ts +72 -0
- package/esm/models/operations/signinterndaemonaccessrequest.js +38 -0
- package/esm/models/operations/signinterndaemonrequest.d.ts +72 -0
- package/esm/models/operations/signinterndaemonrequest.js +38 -0
- package/esm/models/operations/updateexternaluser.d.ts +61 -0
- package/esm/models/operations/updateexternaluser.js +24 -0
- package/esm/models/operations/updatekeys.d.ts +5 -0
- package/esm/models/operations/updatekeys.js +2 -0
- package/esm/models/oranthropiccontentblock.d.ts +2 -1
- package/esm/models/oranthropiccontentblock.js +2 -0
- package/esm/models/oranthropictoolsearchresult.d.ts +17 -0
- package/esm/models/oranthropictoolsearchresult.js +21 -0
- package/esm/models/oranthropictoolsearchresultparam.d.ts +23 -0
- package/esm/models/oranthropictoolsearchresultparam.js +20 -0
- package/esm/models/outputapplypatchservertoolitem.d.ts +7 -2
- package/esm/models/outputapplypatchservertoolitem.js +5 -3
- package/esm/models/outputarmorblockeditem.d.ts +71 -0
- package/esm/models/outputarmorblockeditem.js +60 -0
- package/esm/models/outputdatetimeitem.d.ts +7 -2
- package/esm/models/outputdatetimeitem.js +5 -3
- package/esm/models/outputimagegenerationservertoolitem.d.ts +7 -2
- package/esm/models/outputimagegenerationservertoolitem.js +5 -3
- package/esm/models/outputitems.d.ts +5 -1
- package/esm/models/outputitems.js +4 -0
- package/esm/models/outputsearchmodelsservertoolitem.d.ts +7 -2
- package/esm/models/outputsearchmodelsservertoolitem.js +5 -3
- package/esm/models/outputtoolsearchcallitem.d.ts +26 -0
- package/esm/models/outputtoolsearchcallitem.js +30 -0
- package/esm/models/outputtoolsearchservertoolitem.d.ts +30 -2
- package/esm/models/outputtoolsearchservertoolitem.js +36 -3
- package/esm/models/outputwebsearchservertoolitem.d.ts +7 -2
- package/esm/models/outputwebsearchservertoolitem.js +5 -3
- package/esm/models/preview20250311websearchservertool.d.ts +1 -1
- package/esm/models/previewwebsearchservertool.d.ts +1 -1
- package/esm/models/privateendpointpricing.d.ts +10 -0
- package/esm/models/privateendpointpricing.js +15 -0
- package/esm/models/promptcachebreakpoint.d.ts +3 -1
- package/esm/models/promptcachebreakpoint.js +2 -0
- package/esm/models/promptcacheoptions.d.ts +1 -1
- package/esm/models/providername.d.ts +2 -0
- package/esm/models/providername.js +2 -0
- package/esm/models/provideroptions.d.ts +12 -0
- package/esm/models/provideroptions.js +3 -0
- package/esm/models/providerresponse.d.ts +2 -0
- package/esm/models/providerresponse.js +2 -0
- package/esm/models/publicendpoint.d.ts +11 -2
- package/esm/models/publicendpoint.js +5 -0
- package/esm/models/publicservicetier.d.ts +17 -0
- package/esm/models/publicservicetier.js +16 -0
- package/esm/models/responsesrequest.d.ts +42 -6
- package/esm/models/responsesrequest.js +22 -0
- package/esm/models/signinterndaemonrequest.d.ts +54 -0
- package/esm/models/signinterndaemonrequest.js +30 -0
- package/esm/models/signinterndaemonresponse.d.ts +32 -0
- package/esm/models/signinterndaemonresponse.js +27 -0
- package/esm/models/speechinput.d.ts +12 -0
- package/esm/models/speechinput.js +12 -0
- package/esm/models/speechinputreferenceimage.d.ts +1 -1
- package/esm/models/speechrequest.d.ts +10 -4
- package/esm/models/speechrequest.js +3 -1
- package/esm/models/speechturn.d.ts +25 -0
- package/esm/models/speechturn.js +15 -0
- package/esm/models/switchyardrouterplugin.d.ts +1 -1
- package/esm/models/tokenexchangerequest.d.ts +7 -6
- package/esm/models/tokenexchangerequest.js +4 -2
- package/esm/models/tokenexchangeresponse.d.ts +3 -0
- package/esm/models/toolsearchcallitem.d.ts +47 -0
- package/esm/models/toolsearchcallitem.js +42 -0
- package/esm/models/toolsearchoutputitem.d.ts +150 -0
- package/esm/models/toolsearchoutputitem.js +181 -0
- package/esm/models/updatebyokkeyrequest.d.ts +3 -3
- package/esm/models/updatebyokkeyrequest.js +1 -1
- package/esm/models/updateexternaluserrequest.d.ts +15 -0
- package/esm/models/updateexternaluserrequest.js +18 -0
- package/esm/models/updateguardrailrequest.d.ts +10 -0
- package/esm/models/updateguardrailrequest.js +4 -0
- package/esm/models/updateobservabilitydestinationrequest.d.ts +5 -0
- package/esm/models/updateobservabilitydestinationrequest.js +2 -0
- package/esm/models/videogenerationrequest.d.ts +12 -0
- package/esm/models/videogenerationrequest.js +3 -0
- package/esm/models/videogenerationresponse.d.ts +11 -0
- package/esm/models/videogenerationresponse.js +3 -0
- package/esm/models/webfetchengineenum.d.ts +2 -2
- package/esm/models/webfetchengineenum.js +1 -1
- package/esm/models/webfetchservertoolconfig.d.ts +1 -1
- package/esm/models/websearchconfig.d.ts +1 -1
- package/esm/models/websearchengineenum.d.ts +2 -2
- package/esm/models/websearchengineenum.js +1 -1
- package/esm/models/websearchservertool.d.ts +1 -1
- package/esm/models/websearchservertoolconfig.d.ts +1 -1
- package/esm/models/workspacebudget.d.ts +4 -4
- package/esm/models/workspacebudget.js +3 -3
- package/esm/sdk/apikeys.d.ts +3 -1
- package/esm/sdk/apikeys.js +3 -1
- package/esm/sdk/betaresponses.d.ts +4 -2
- package/esm/sdk/chat.d.ts +4 -2
- package/esm/sdk/endusers.d.ts +10 -10
- package/esm/sdk/endusers.js +15 -15
- package/esm/sdk/externalusers.d.ts +44 -0
- package/esm/sdk/externalusers.js +60 -0
- package/esm/sdk/images.d.ts +3 -2
- package/esm/sdk/interns.d.ts +31 -1
- package/esm/sdk/interns.js +43 -1
- package/esm/sdk/privateendpoints.d.ts +1 -1
- package/esm/sdk/privateendpoints.js +1 -1
- package/esm/sdk/responses.d.ts +4 -2
- package/esm/sdk/sdk.d.ts +5 -2
- package/esm/sdk/sdk.js +7 -3
- package/esm/sdk/vault.d.ts +7 -0
- package/esm/sdk/vault.js +10 -0
- package/jsr.json +1 -1
- package/package.json +6 -6
- package/esm/models/batchlisttimestamp.d.ts +0 -12
- package/esm/models/batchlisttimestamp.js +0 -15
- package/esm/models/createenduserrequest.d.ts +0 -15
- package/esm/models/createenduserrequest.js +0 -13
- package/esm/models/enduserresponse.d.ts +0 -11
- package/esm/models/enduserresponse.js +0 -15
- package/esm/models/listendusersresponse.d.ts +0 -15
- package/esm/models/listendusersresponse.js +0 -21
- package/esm/models/operations/createenduser.js +0 -23
- package/esm/models/operations/listendusers.js +0 -38
- package/esm/models/operations/updateenduser.js +0 -24
- package/esm/models/updateenduserrequest.d.ts +0 -15
- package/esm/models/updateenduserrequest.js +0 -18
package/esm/lib/encodings.js
CHANGED
|
@@ -10,6 +10,20 @@ export class EncodingError extends Error {
|
|
|
10
10
|
this.name = "EncodingError";
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
const reservedEscapes = /%(2[346bcf]|3[abdf]|40|5[bd])/gi;
|
|
14
|
+
function encodeKeyChars(v, charEncoding) {
|
|
15
|
+
return encodeChars(v, charEncoding === "percentExceptReserved" ? "percent" : charEncoding);
|
|
16
|
+
}
|
|
17
|
+
function encodeChars(v, charEncoding) {
|
|
18
|
+
switch (charEncoding) {
|
|
19
|
+
case "percent":
|
|
20
|
+
return encodeURIComponent(v);
|
|
21
|
+
case "percentExceptReserved":
|
|
22
|
+
return encodeURIComponent(v).replace(reservedEscapes, (m) => decodeURIComponent(m));
|
|
23
|
+
default:
|
|
24
|
+
return v;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
13
27
|
export function encodeMatrix(key, value, options) {
|
|
14
28
|
let out = "";
|
|
15
29
|
const pairs = options?.explode
|
|
@@ -19,7 +33,7 @@ export function encodeMatrix(key, value, options) {
|
|
|
19
33
|
return;
|
|
20
34
|
}
|
|
21
35
|
const encodeString = (v) => {
|
|
22
|
-
return options?.charEncoding
|
|
36
|
+
return encodeChars(v, options?.charEncoding);
|
|
23
37
|
};
|
|
24
38
|
const encodeValue = (v) => encodeString(serializeValue(v));
|
|
25
39
|
pairs.forEach(([pk, pv]) => {
|
|
@@ -43,7 +57,7 @@ export function encodeMatrix(key, value, options) {
|
|
|
43
57
|
if (encValue == null) {
|
|
44
58
|
return;
|
|
45
59
|
}
|
|
46
|
-
const keyPrefix =
|
|
60
|
+
const keyPrefix = encodeKeyChars(pk, options?.charEncoding);
|
|
47
61
|
tmp = `${keyPrefix}=${encValue}`;
|
|
48
62
|
// trim trailing '=' if value was empty
|
|
49
63
|
if (tmp === `${keyPrefix}=`) {
|
|
@@ -66,7 +80,7 @@ export function encodeLabel(key, value, options) {
|
|
|
66
80
|
return;
|
|
67
81
|
}
|
|
68
82
|
const encodeString = (v) => {
|
|
69
|
-
return options?.charEncoding
|
|
83
|
+
return encodeChars(v, options?.charEncoding);
|
|
70
84
|
};
|
|
71
85
|
const encodeValue = (v) => encodeString(serializeValue(v));
|
|
72
86
|
pairs.forEach(([pk, pv]) => {
|
|
@@ -85,7 +99,7 @@ export function encodeLabel(key, value, options) {
|
|
|
85
99
|
}
|
|
86
100
|
else {
|
|
87
101
|
const k = options?.explode && isPlainObject(value)
|
|
88
|
-
? `${
|
|
102
|
+
? `${encodeKeyChars(pk, options?.charEncoding)}=`
|
|
89
103
|
: "";
|
|
90
104
|
encValue = `${k}${encodeValue(pv)}`;
|
|
91
105
|
}
|
|
@@ -103,7 +117,7 @@ function formEncoder(sep) {
|
|
|
103
117
|
return;
|
|
104
118
|
}
|
|
105
119
|
const encodeString = (v) => {
|
|
106
|
-
return options?.charEncoding
|
|
120
|
+
return encodeChars(v, options?.charEncoding);
|
|
107
121
|
};
|
|
108
122
|
const encodeValue = (v) => encodeString(serializeValue(v));
|
|
109
123
|
const encodedSep = encodeString(sep);
|
|
@@ -127,7 +141,7 @@ function formEncoder(sep) {
|
|
|
127
141
|
if (encValue == null) {
|
|
128
142
|
return;
|
|
129
143
|
}
|
|
130
|
-
tmp = `${
|
|
144
|
+
tmp = `${encodeKeyChars(pk, options?.charEncoding)}=${encValue}`;
|
|
131
145
|
// If we end up with the nothing then skip forward
|
|
132
146
|
if (!tmp || tmp === "=") {
|
|
133
147
|
return;
|
|
@@ -146,7 +160,7 @@ export function encodeBodyForm(key, value, options) {
|
|
|
146
160
|
? explode(key, value)
|
|
147
161
|
: [[key, value]];
|
|
148
162
|
const encodeString = (v) => {
|
|
149
|
-
return options?.charEncoding
|
|
163
|
+
return encodeChars(v, options?.charEncoding);
|
|
150
164
|
};
|
|
151
165
|
const encodeValue = (v) => encodeString(serializeValue(v));
|
|
152
166
|
pairs.forEach(([pk, pv]) => {
|
|
@@ -164,7 +178,7 @@ export function encodeBodyForm(key, value, options) {
|
|
|
164
178
|
else {
|
|
165
179
|
encValue = `${encodeValue(pv)}`;
|
|
166
180
|
}
|
|
167
|
-
tmp = `${
|
|
181
|
+
tmp = `${encodeKeyChars(pk, options?.charEncoding)}=${encValue}`;
|
|
168
182
|
// If we end up with the nothing then skip forward
|
|
169
183
|
if (!tmp || tmp === "=") {
|
|
170
184
|
return;
|
|
@@ -188,7 +202,7 @@ export function encodeDeepObjectObject(key, value, options) {
|
|
|
188
202
|
}
|
|
189
203
|
let out = "";
|
|
190
204
|
const encodeString = (v) => {
|
|
191
|
-
return options?.charEncoding
|
|
205
|
+
return encodeChars(v, options?.charEncoding);
|
|
192
206
|
};
|
|
193
207
|
if (!isPlainObject(value)) {
|
|
194
208
|
throw new EncodingError(`Expected parameter '${key}' to be an object.`);
|
|
@@ -205,7 +219,7 @@ export function encodeDeepObjectObject(key, value, options) {
|
|
|
205
219
|
}
|
|
206
220
|
const pairs = Array.isArray(cv) ? cv : [cv];
|
|
207
221
|
const encoded = mapDefined(pairs, (v) => {
|
|
208
|
-
return `${
|
|
222
|
+
return `${encodeKeyChars(pk, options?.charEncoding)}=${encodeString(serializeValue(v))}`;
|
|
209
223
|
})?.join("&");
|
|
210
224
|
out += encoded == null ? "" : `&${encoded}`;
|
|
211
225
|
});
|
|
@@ -216,10 +230,12 @@ export function encodeJSON(key, value, options) {
|
|
|
216
230
|
return;
|
|
217
231
|
}
|
|
218
232
|
const encodeString = (v) => {
|
|
219
|
-
return options?.charEncoding
|
|
233
|
+
return encodeChars(v, options?.charEncoding);
|
|
220
234
|
};
|
|
221
235
|
const encVal = encodeString(JSON.stringify(value, jsonReplacer));
|
|
222
|
-
return options?.explode
|
|
236
|
+
return options?.explode
|
|
237
|
+
? encVal
|
|
238
|
+
: `${encodeKeyChars(key, options?.charEncoding)}=${encVal}`;
|
|
223
239
|
}
|
|
224
240
|
export const encodeSimple = (key, value, options) => {
|
|
225
241
|
let out = "";
|
|
@@ -230,7 +246,7 @@ export const encodeSimple = (key, value, options) => {
|
|
|
230
246
|
return;
|
|
231
247
|
}
|
|
232
248
|
const encodeString = (v) => {
|
|
233
|
-
return options?.charEncoding
|
|
249
|
+
return encodeChars(v, options?.charEncoding);
|
|
234
250
|
};
|
|
235
251
|
const encodeValue = (v) => encodeString(serializeValue(v));
|
|
236
252
|
pairs.forEach(([pk, pv]) => {
|
package/esm/lib/http.d.ts
CHANGED
|
@@ -17,11 +17,11 @@ export type BeforeRequestHook = (req: Request) => Awaitable<Request | void>;
|
|
|
17
17
|
export type RequestErrorHook = (err: unknown, req: Request) => Awaitable<void>;
|
|
18
18
|
export type ResponseHook = (res: Response, req: Request) => Awaitable<void>;
|
|
19
19
|
export declare class HTTPClient {
|
|
20
|
-
private options;
|
|
21
20
|
private fetcher;
|
|
22
21
|
private requestHooks;
|
|
23
22
|
private requestErrorHooks;
|
|
24
23
|
private responseHooks;
|
|
24
|
+
private options;
|
|
25
25
|
constructor(options?: HTTPClientOptions);
|
|
26
26
|
request(request: Request): Promise<Response>;
|
|
27
27
|
/**
|
package/esm/lib/http.js
CHANGED
|
@@ -16,10 +16,10 @@ const DEFAULT_FETCHER = (input, init) => {
|
|
|
16
16
|
};
|
|
17
17
|
export class HTTPClient {
|
|
18
18
|
constructor(options = {}) {
|
|
19
|
-
this.options = options;
|
|
20
19
|
this.requestHooks = [];
|
|
21
20
|
this.requestErrorHooks = [];
|
|
22
21
|
this.responseHooks = [];
|
|
22
|
+
this.options = options;
|
|
23
23
|
this.fetcher = options.fetcher || DEFAULT_FETCHER;
|
|
24
24
|
}
|
|
25
25
|
async request(request) {
|
package/esm/lib/security.d.ts
CHANGED
|
@@ -6,10 +6,11 @@ type OAuth2PasswordFlow = {
|
|
|
6
6
|
clientSecret?: string | undefined;
|
|
7
7
|
tokenURL: string;
|
|
8
8
|
};
|
|
9
|
-
export declare
|
|
10
|
-
Incomplete
|
|
11
|
-
UnrecognisedSecurityType
|
|
12
|
-
}
|
|
9
|
+
export declare const SecurityErrorCode: {
|
|
10
|
+
readonly Incomplete: "incomplete";
|
|
11
|
+
readonly UnrecognisedSecurityType: "unrecognized_security_type";
|
|
12
|
+
};
|
|
13
|
+
export type SecurityErrorCode = (typeof SecurityErrorCode)[keyof typeof SecurityErrorCode];
|
|
13
14
|
export declare class SecurityError extends Error {
|
|
14
15
|
code: SecurityErrorCode;
|
|
15
16
|
constructor(code: SecurityErrorCode, message: string);
|
package/esm/lib/security.js
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* @generated-id: 0502afa7922e
|
|
4
4
|
*/
|
|
5
5
|
import { env } from "./env.js";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
})(SecurityErrorCode || (SecurityErrorCode = {}));
|
|
6
|
+
export const SecurityErrorCode = {
|
|
7
|
+
Incomplete: "incomplete",
|
|
8
|
+
UnrecognisedSecurityType: "unrecognized_security_type",
|
|
9
|
+
};
|
|
11
10
|
export class SecurityError extends Error {
|
|
12
11
|
constructor(code, message) {
|
|
13
12
|
super(message);
|
|
@@ -48,6 +48,11 @@ export declare const AdditionalToolsItemTypeFunction: {
|
|
|
48
48
|
readonly Function: "function";
|
|
49
49
|
};
|
|
50
50
|
export type AdditionalToolsItemTypeFunction = ClosedEnum<typeof AdditionalToolsItemTypeFunction>;
|
|
51
|
+
export declare const AdditionalToolsItemAllowedCaller: {
|
|
52
|
+
readonly Direct: "direct";
|
|
53
|
+
readonly Programmatic: "programmatic";
|
|
54
|
+
};
|
|
55
|
+
export type AdditionalToolsItemAllowedCaller = OpenEnum<typeof AdditionalToolsItemAllowedCaller>;
|
|
51
56
|
/**
|
|
52
57
|
* Function tool definition
|
|
53
58
|
*/
|
|
@@ -59,14 +64,18 @@ export type AdditionalToolsItemToolFunction = {
|
|
|
59
64
|
} | null;
|
|
60
65
|
strict?: boolean | null | undefined;
|
|
61
66
|
type: AdditionalToolsItemTypeFunction;
|
|
67
|
+
allowedCallers?: Array<AdditionalToolsItemAllowedCaller> | null | undefined;
|
|
62
68
|
/**
|
|
63
69
|
* Lets the model keep working after calling this tool instead of waiting for its output. The tool is still executed by the client; return the result in a later request as a `function_call_output` with the original `call_id`. Only honored by providers whose Responses API supports async tools; ignored elsewhere.
|
|
64
70
|
*/
|
|
65
71
|
async?: boolean | undefined;
|
|
66
72
|
/**
|
|
67
|
-
* Withhold this tool from the model until `openrouter:tool_search` finds it.
|
|
73
|
+
* Withhold this tool from the model until `openrouter:tool_search` finds it. Where the request declares no search tool, OpenRouter may add `openrouter:tool_search` to serve the flag, and otherwise sends the tool in full. A request that declares the search tool itself must keep at least one tool non-deferred.
|
|
68
74
|
*/
|
|
69
75
|
deferLoading?: boolean | undefined;
|
|
76
|
+
outputSchema?: {
|
|
77
|
+
[k: string]: any;
|
|
78
|
+
} | null | undefined;
|
|
70
79
|
};
|
|
71
80
|
export type AdditionalToolsItemToolUnion = ComputerUseServerTool | NamespaceTool | AdditionalToolsItemToolFunction | FileSearchServerTool | CodeInterpreterServerTool | McpServerTool | CustomTool | PreviewWebSearchServerTool | Preview20250311WebSearchServerTool | LegacyWebSearchServerTool | WebSearchServerTool | ImageGenerationServerTool | CodexLocalShellTool | ShellServerTool | ApplyPatchServerTool | AdvisorServerToolOpenRouter | SubagentServerToolOpenRouter | DatetimeServerTool | FilesServerTool | FusionServerToolOpenRouter | ImageGenerationServerToolOpenRouter | SearchModelsServerToolOpenRouter | WebFetchServerTool | WebSearchServerToolOpenRouter | ApplyPatchServerToolOpenRouter | BashServerTool | ShellServerToolOpenRouter | ToolSearchServerTool | AdditionalToolsItemTool;
|
|
72
81
|
export declare const TypeAdditionalTools: {
|
|
@@ -95,6 +104,8 @@ export declare function additionalToolsItemToolToJSON(additionalToolsItemTool: A
|
|
|
95
104
|
/** @internal */
|
|
96
105
|
export declare const AdditionalToolsItemTypeFunction$outboundSchema: z.ZodEnum<typeof AdditionalToolsItemTypeFunction>;
|
|
97
106
|
/** @internal */
|
|
107
|
+
export declare const AdditionalToolsItemAllowedCaller$outboundSchema: z.ZodType<string, AdditionalToolsItemAllowedCaller>;
|
|
108
|
+
/** @internal */
|
|
98
109
|
export type AdditionalToolsItemToolFunction$Outbound = {
|
|
99
110
|
description?: string | null | undefined;
|
|
100
111
|
name: string;
|
|
@@ -103,8 +114,12 @@ export type AdditionalToolsItemToolFunction$Outbound = {
|
|
|
103
114
|
} | null;
|
|
104
115
|
strict?: boolean | null | undefined;
|
|
105
116
|
type: string;
|
|
117
|
+
allowed_callers?: Array<string> | null | undefined;
|
|
106
118
|
async?: boolean | undefined;
|
|
107
119
|
defer_loading?: boolean | undefined;
|
|
120
|
+
output_schema?: {
|
|
121
|
+
[k: string]: any;
|
|
122
|
+
} | null | undefined;
|
|
108
123
|
};
|
|
109
124
|
/** @internal */
|
|
110
125
|
export declare const AdditionalToolsItemToolFunction$outboundSchema: z.ZodType<AdditionalToolsItemToolFunction$Outbound, AdditionalToolsItemToolFunction>;
|
|
@@ -45,6 +45,10 @@ export const AdditionalToolsItemRole = {
|
|
|
45
45
|
export const AdditionalToolsItemTypeFunction = {
|
|
46
46
|
Function: "function",
|
|
47
47
|
};
|
|
48
|
+
export const AdditionalToolsItemAllowedCaller = {
|
|
49
|
+
Direct: "direct",
|
|
50
|
+
Programmatic: "programmatic",
|
|
51
|
+
};
|
|
48
52
|
export const TypeAdditionalTools = {
|
|
49
53
|
AdditionalTools: "additional_tools",
|
|
50
54
|
};
|
|
@@ -68,17 +72,23 @@ export function additionalToolsItemToolToJSON(additionalToolsItemTool) {
|
|
|
68
72
|
/** @internal */
|
|
69
73
|
export const AdditionalToolsItemTypeFunction$outboundSchema = z.enum(AdditionalToolsItemTypeFunction);
|
|
70
74
|
/** @internal */
|
|
75
|
+
export const AdditionalToolsItemAllowedCaller$outboundSchema = openEnums.outboundSchema(AdditionalToolsItemAllowedCaller);
|
|
76
|
+
/** @internal */
|
|
71
77
|
export const AdditionalToolsItemToolFunction$outboundSchema = z.object({
|
|
72
78
|
description: z.nullable(z.string()).optional(),
|
|
73
79
|
name: z.string(),
|
|
74
80
|
parameters: z.nullable(z.record(z.string(), z.any())),
|
|
75
81
|
strict: z.nullable(z.boolean()).optional(),
|
|
76
82
|
type: AdditionalToolsItemTypeFunction$outboundSchema,
|
|
83
|
+
allowedCallers: z.nullable(z.array(AdditionalToolsItemAllowedCaller$outboundSchema)).optional(),
|
|
77
84
|
async: z.boolean().optional(),
|
|
78
85
|
deferLoading: z.boolean().optional(),
|
|
86
|
+
outputSchema: z.nullable(z.record(z.string(), z.any())).optional(),
|
|
79
87
|
}).transform((v) => {
|
|
80
88
|
return remap$(v, {
|
|
89
|
+
allowedCallers: "allowed_callers",
|
|
81
90
|
deferLoading: "defer_loading",
|
|
91
|
+
outputSchema: "output_schema",
|
|
82
92
|
});
|
|
83
93
|
});
|
|
84
94
|
export function additionalToolsItemToolFunctionToJSON(additionalToolsItemToolFunction) {
|
|
@@ -7,7 +7,7 @@ import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
|
7
7
|
*/
|
|
8
8
|
export type Alignment = {
|
|
9
9
|
/**
|
|
10
|
-
* One record per evaluated assistant message of the request, in the order the messages were produced.
|
|
10
|
+
* One record per evaluated assistant message of the request, in the order the messages were produced. Empty when no message of the request had content to evaluate.
|
|
11
11
|
*/
|
|
12
12
|
calls: Array<AlignmentCallRecord>;
|
|
13
13
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as z from "zod/v4";
|
|
2
2
|
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
import { AlignmentRule, AlignmentRule$Outbound } from "./alignmentrule.js";
|
|
3
4
|
/**
|
|
4
|
-
* `enforce`: a turn that breaks a rule is withheld, retried, and finally returned as an error. `audit`: every turn is evaluated and returned. Default `
|
|
5
|
+
* `enforce`: a turn that breaks a rule is withheld, retried, and finally returned as an error. `audit`: every turn is evaluated and returned. Default `audit`.
|
|
5
6
|
*/
|
|
6
7
|
export declare const AlignmentPluginMode: {
|
|
7
8
|
readonly Enforce: "enforce";
|
|
8
9
|
readonly Audit: "audit";
|
|
9
10
|
};
|
|
10
11
|
/**
|
|
11
|
-
* `enforce`: a turn that breaks a rule is withheld, retried, and finally returned as an error. `audit`: every turn is evaluated and returned. Default `
|
|
12
|
+
* `enforce`: a turn that breaks a rule is withheld, retried, and finally returned as an error. `audit`: every turn is evaluated and returned. Default `audit`.
|
|
12
13
|
*/
|
|
13
14
|
export type AlignmentPluginMode = OpenEnum<typeof AlignmentPluginMode>;
|
|
14
15
|
/**
|
|
15
|
-
* Beta. States the listed rules to the model and evaluates every turn against them
|
|
16
|
+
* Beta. States the listed rules to the model and evaluates every turn against them; the configuration, metadata, and error shapes may change.
|
|
16
17
|
*/
|
|
17
18
|
export type AlignmentPlugin = {
|
|
18
19
|
id: "alignment";
|
|
@@ -25,15 +26,15 @@ export type AlignmentPlugin = {
|
|
|
25
26
|
*/
|
|
26
27
|
maxRetries?: number | undefined;
|
|
27
28
|
/**
|
|
28
|
-
* `enforce`: a turn that breaks a rule is withheld, retried, and finally returned as an error. `audit`: every turn is evaluated and returned. Default `
|
|
29
|
+
* `enforce`: a turn that breaks a rule is withheld, retried, and finally returned as an error. `audit`: every turn is evaluated and returned. Default `audit`.
|
|
29
30
|
*/
|
|
30
31
|
mode?: AlignmentPluginMode | undefined;
|
|
31
32
|
/**
|
|
32
|
-
*
|
|
33
|
+
* Rules the reply must follow. Each rule is evaluated on its own.
|
|
33
34
|
*/
|
|
34
|
-
rules: Array<
|
|
35
|
+
rules: Array<AlignmentRule>;
|
|
35
36
|
/**
|
|
36
|
-
* Probability at or above which a rule is broken. Default 0.7.
|
|
37
|
+
* Probability at or above which a rule is broken, from 0.01 to 1. Default 0.7.
|
|
37
38
|
*/
|
|
38
39
|
threshold?: number | undefined;
|
|
39
40
|
};
|
|
@@ -45,7 +46,7 @@ export type AlignmentPlugin$Outbound = {
|
|
|
45
46
|
instruct?: boolean | undefined;
|
|
46
47
|
max_retries?: number | undefined;
|
|
47
48
|
mode?: string | undefined;
|
|
48
|
-
rules: Array<
|
|
49
|
+
rules: Array<AlignmentRule$Outbound>;
|
|
49
50
|
threshold?: number | undefined;
|
|
50
51
|
};
|
|
51
52
|
/** @internal */
|
|
@@ -5,8 +5,9 @@
|
|
|
5
5
|
import * as z from "zod/v4";
|
|
6
6
|
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
7
|
import * as openEnums from "../types/enums.js";
|
|
8
|
+
import { AlignmentRule$outboundSchema, } from "./alignmentrule.js";
|
|
8
9
|
/**
|
|
9
|
-
* `enforce`: a turn that breaks a rule is withheld, retried, and finally returned as an error. `audit`: every turn is evaluated and returned. Default `
|
|
10
|
+
* `enforce`: a turn that breaks a rule is withheld, retried, and finally returned as an error. `audit`: every turn is evaluated and returned. Default `audit`.
|
|
10
11
|
*/
|
|
11
12
|
export const AlignmentPluginMode = {
|
|
12
13
|
Enforce: "enforce",
|
|
@@ -20,7 +21,7 @@ export const AlignmentPlugin$outboundSchema = z.object({
|
|
|
20
21
|
instruct: z.boolean().optional(),
|
|
21
22
|
maxRetries: z.int().optional(),
|
|
22
23
|
mode: AlignmentPluginMode$outboundSchema.optional(),
|
|
23
|
-
rules: z.array(
|
|
24
|
+
rules: z.array(AlignmentRule$outboundSchema),
|
|
24
25
|
threshold: z.number().optional(),
|
|
25
26
|
}).transform((v) => {
|
|
26
27
|
return remap$(v, {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { OpenEnum } from "../types/enums.js";
|
|
3
|
+
export declare const Watch: {
|
|
4
|
+
readonly Content: "content";
|
|
5
|
+
readonly ToolCalls: "tool_calls";
|
|
6
|
+
readonly Refusal: "refusal";
|
|
7
|
+
readonly Images: "images";
|
|
8
|
+
readonly Audio: "audio";
|
|
9
|
+
};
|
|
10
|
+
export type Watch = OpenEnum<typeof Watch>;
|
|
11
|
+
export type AlignmentRule = {
|
|
12
|
+
/**
|
|
13
|
+
* Text that states what the reply must do or must not do.
|
|
14
|
+
*/
|
|
15
|
+
rule: string;
|
|
16
|
+
/**
|
|
17
|
+
* Fields of the assistant message the rule applies to. The rule is evaluated on a message that has at least one of them and is not applicable to any other message.
|
|
18
|
+
*/
|
|
19
|
+
watch: Array<Watch>;
|
|
20
|
+
};
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const Watch$outboundSchema: z.ZodType<string, Watch>;
|
|
23
|
+
/** @internal */
|
|
24
|
+
export type AlignmentRule$Outbound = {
|
|
25
|
+
rule: string;
|
|
26
|
+
watch: Array<string>;
|
|
27
|
+
};
|
|
28
|
+
/** @internal */
|
|
29
|
+
export declare const AlignmentRule$outboundSchema: z.ZodType<AlignmentRule$Outbound, AlignmentRule>;
|
|
30
|
+
export declare function alignmentRuleToJSON(alignmentRule: AlignmentRule): string;
|
|
31
|
+
//# sourceMappingURL=alignmentrule.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 8aa3253017e1
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import * as openEnums from "../types/enums.js";
|
|
7
|
+
export const Watch = {
|
|
8
|
+
Content: "content",
|
|
9
|
+
ToolCalls: "tool_calls",
|
|
10
|
+
Refusal: "refusal",
|
|
11
|
+
Images: "images",
|
|
12
|
+
Audio: "audio",
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const Watch$outboundSchema = openEnums
|
|
16
|
+
.outboundSchema(Watch);
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const AlignmentRule$outboundSchema = z.object({
|
|
19
|
+
rule: z.string(),
|
|
20
|
+
watch: z.array(Watch$outboundSchema),
|
|
21
|
+
});
|
|
22
|
+
export function alignmentRuleToJSON(alignmentRule) {
|
|
23
|
+
return JSON.stringify(AlignmentRule$outboundSchema.parse(alignmentRule));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=alignmentrule.js.map
|
|
@@ -3,13 +3,17 @@ import { Result as SafeParseResult } from "../types/fp.js";
|
|
|
3
3
|
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
4
4
|
export type AlignmentRuleRecord = {
|
|
5
5
|
/**
|
|
6
|
-
* Whether
|
|
6
|
+
* Whether the message has a field the rule watches. Only an applicable rule is evaluated.
|
|
7
|
+
*/
|
|
8
|
+
applicable: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Whether probability is at or above the threshold. False when the rule is not applicable.
|
|
7
11
|
*/
|
|
8
12
|
broken: boolean;
|
|
9
13
|
/**
|
|
10
|
-
* The evaluator's probability that the turn breaks the rule.
|
|
14
|
+
* The evaluator's probability that the turn breaks the rule; null when the rule is not applicable.
|
|
11
15
|
*/
|
|
12
|
-
probability: number;
|
|
16
|
+
probability: number | null;
|
|
13
17
|
};
|
|
14
18
|
/** @internal */
|
|
15
19
|
export declare const AlignmentRuleRecord$inboundSchema: z.ZodType<AlignmentRuleRecord, unknown>;
|
|
@@ -6,8 +6,9 @@ import * as z from "zod/v4";
|
|
|
6
6
|
import { safeParse } from "../lib/schemas.js";
|
|
7
7
|
/** @internal */
|
|
8
8
|
export const AlignmentRuleRecord$inboundSchema = z.object({
|
|
9
|
+
applicable: z.boolean(),
|
|
9
10
|
broken: z.boolean(),
|
|
10
|
-
probability: z.number(),
|
|
11
|
+
probability: z.nullable(z.number()),
|
|
11
12
|
});
|
|
12
13
|
export function alignmentRuleRecordFromJSON(jsonString) {
|
|
13
14
|
return safeParse(jsonString, (x) => AlignmentRuleRecord$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AlignmentRuleRecord' from JSON`);
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ArmorEnvironmentEntry, ArmorEnvironmentEntry$Outbound } from "./armorenvironmententry.js";
|
|
3
|
+
import { ArmorRule, ArmorRule$Outbound } from "./armorrule.js";
|
|
4
|
+
export type Allow = ArmorRule | string;
|
|
5
|
+
export type Environment = ArmorEnvironmentEntry | string;
|
|
6
|
+
export type HardDeny = ArmorRule | string;
|
|
7
|
+
export type SoftDeny = ArmorRule | string;
|
|
8
|
+
export type ArmorAutoMode = {
|
|
9
|
+
allow?: Array<ArmorRule | string> | undefined;
|
|
10
|
+
environment?: Array<ArmorEnvironmentEntry | string> | undefined;
|
|
11
|
+
hardDeny?: Array<ArmorRule | string> | undefined;
|
|
12
|
+
softDeny?: Array<ArmorRule | string> | undefined;
|
|
13
|
+
};
|
|
14
|
+
/** @internal */
|
|
15
|
+
export type Allow$Outbound = ArmorRule$Outbound | string;
|
|
16
|
+
/** @internal */
|
|
17
|
+
export declare const Allow$outboundSchema: z.ZodType<Allow$Outbound, Allow>;
|
|
18
|
+
export declare function allowToJSON(allow: Allow): string;
|
|
19
|
+
/** @internal */
|
|
20
|
+
export type Environment$Outbound = ArmorEnvironmentEntry$Outbound | string;
|
|
21
|
+
/** @internal */
|
|
22
|
+
export declare const Environment$outboundSchema: z.ZodType<Environment$Outbound, Environment>;
|
|
23
|
+
export declare function environmentToJSON(environment: Environment): string;
|
|
24
|
+
/** @internal */
|
|
25
|
+
export type HardDeny$Outbound = ArmorRule$Outbound | string;
|
|
26
|
+
/** @internal */
|
|
27
|
+
export declare const HardDeny$outboundSchema: z.ZodType<HardDeny$Outbound, HardDeny>;
|
|
28
|
+
export declare function hardDenyToJSON(hardDeny: HardDeny): string;
|
|
29
|
+
/** @internal */
|
|
30
|
+
export type SoftDeny$Outbound = ArmorRule$Outbound | string;
|
|
31
|
+
/** @internal */
|
|
32
|
+
export declare const SoftDeny$outboundSchema: z.ZodType<SoftDeny$Outbound, SoftDeny>;
|
|
33
|
+
export declare function softDenyToJSON(softDeny: SoftDeny): string;
|
|
34
|
+
/** @internal */
|
|
35
|
+
export type ArmorAutoMode$Outbound = {
|
|
36
|
+
allow?: Array<ArmorRule$Outbound | string> | undefined;
|
|
37
|
+
environment?: Array<ArmorEnvironmentEntry$Outbound | string> | undefined;
|
|
38
|
+
hard_deny?: Array<ArmorRule$Outbound | string> | undefined;
|
|
39
|
+
soft_deny?: Array<ArmorRule$Outbound | string> | undefined;
|
|
40
|
+
};
|
|
41
|
+
/** @internal */
|
|
42
|
+
export declare const ArmorAutoMode$outboundSchema: z.ZodType<ArmorAutoMode$Outbound, ArmorAutoMode>;
|
|
43
|
+
export declare function armorAutoModeToJSON(armorAutoMode: ArmorAutoMode): string;
|
|
44
|
+
//# sourceMappingURL=armorautomode.d.ts.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 01d4fa4d2f15
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { ArmorEnvironmentEntry$outboundSchema, } from "./armorenvironmententry.js";
|
|
8
|
+
import { ArmorRule$outboundSchema, } from "./armorrule.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export const Allow$outboundSchema = z.union([
|
|
11
|
+
ArmorRule$outboundSchema,
|
|
12
|
+
z.string(),
|
|
13
|
+
]);
|
|
14
|
+
export function allowToJSON(allow) {
|
|
15
|
+
return JSON.stringify(Allow$outboundSchema.parse(allow));
|
|
16
|
+
}
|
|
17
|
+
/** @internal */
|
|
18
|
+
export const Environment$outboundSchema = z.union([ArmorEnvironmentEntry$outboundSchema, z.string()]);
|
|
19
|
+
export function environmentToJSON(environment) {
|
|
20
|
+
return JSON.stringify(Environment$outboundSchema.parse(environment));
|
|
21
|
+
}
|
|
22
|
+
/** @internal */
|
|
23
|
+
export const HardDeny$outboundSchema = z
|
|
24
|
+
.union([ArmorRule$outboundSchema, z.string()]);
|
|
25
|
+
export function hardDenyToJSON(hardDeny) {
|
|
26
|
+
return JSON.stringify(HardDeny$outboundSchema.parse(hardDeny));
|
|
27
|
+
}
|
|
28
|
+
/** @internal */
|
|
29
|
+
export const SoftDeny$outboundSchema = z
|
|
30
|
+
.union([ArmorRule$outboundSchema, z.string()]);
|
|
31
|
+
export function softDenyToJSON(softDeny) {
|
|
32
|
+
return JSON.stringify(SoftDeny$outboundSchema.parse(softDeny));
|
|
33
|
+
}
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const ArmorAutoMode$outboundSchema = z.object({
|
|
36
|
+
allow: z.array(z.union([ArmorRule$outboundSchema, z.string()])).optional(),
|
|
37
|
+
environment: z.array(z.union([ArmorEnvironmentEntry$outboundSchema, z.string()])).optional(),
|
|
38
|
+
hardDeny: z.array(z.union([ArmorRule$outboundSchema, z.string()])).optional(),
|
|
39
|
+
softDeny: z.array(z.union([ArmorRule$outboundSchema, z.string()])).optional(),
|
|
40
|
+
}).transform((v) => {
|
|
41
|
+
return remap$(v, {
|
|
42
|
+
hardDeny: "hard_deny",
|
|
43
|
+
softDeny: "soft_deny",
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
export function armorAutoModeToJSON(armorAutoMode) {
|
|
47
|
+
return JSON.stringify(ArmorAutoMode$outboundSchema.parse(armorAutoMode));
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=armorautomode.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
import { ArmorAutoMode, ArmorAutoMode$Outbound } from "./armorautomode.js";
|
|
3
|
+
/**
|
|
4
|
+
* The Armor context: Claude Code's `classifier_context` (v1), with `auto_mode.{hard_deny,soft_deny,allow}` rules as strings or `{ id, instructions, threshold? }` objects and `auto_mode.environment` entries as `"Name: value"` strings or `{ name, value }` objects. `threshold` applies when Armor evaluates; when the provider evaluates natively (Anthropic dangerous-tool-use beta) rules are judged at the provider's own boundary.
|
|
5
|
+
*/
|
|
6
|
+
export type ArmorContext = {
|
|
7
|
+
autoMode?: ArmorAutoMode | undefined;
|
|
8
|
+
v: number;
|
|
9
|
+
additionalProperties?: {
|
|
10
|
+
[k: string]: any;
|
|
11
|
+
} | undefined;
|
|
12
|
+
};
|
|
13
|
+
/** @internal */
|
|
14
|
+
export type ArmorContext$Outbound = {
|
|
15
|
+
auto_mode?: ArmorAutoMode$Outbound | undefined;
|
|
16
|
+
v: number;
|
|
17
|
+
[additionalProperties: string]: unknown;
|
|
18
|
+
};
|
|
19
|
+
/** @internal */
|
|
20
|
+
export declare const ArmorContext$outboundSchema: z.ZodType<ArmorContext$Outbound, ArmorContext>;
|
|
21
|
+
export declare function armorContextToJSON(armorContext: ArmorContext): string;
|
|
22
|
+
//# sourceMappingURL=armorcontext.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: 5139f873564e
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
import { remap as remap$ } from "../lib/primitives.js";
|
|
7
|
+
import { ArmorAutoMode$outboundSchema, } from "./armorautomode.js";
|
|
8
|
+
/** @internal */
|
|
9
|
+
export const ArmorContext$outboundSchema = z.object({
|
|
10
|
+
autoMode: ArmorAutoMode$outboundSchema.optional(),
|
|
11
|
+
v: z.number(),
|
|
12
|
+
additionalProperties: z.record(z.string(), z.any()).optional(),
|
|
13
|
+
}).transform((v) => {
|
|
14
|
+
return {
|
|
15
|
+
...v.additionalProperties,
|
|
16
|
+
...remap$(v, {
|
|
17
|
+
autoMode: "auto_mode",
|
|
18
|
+
additionalProperties: null,
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
export function armorContextToJSON(armorContext) {
|
|
23
|
+
return JSON.stringify(ArmorContext$outboundSchema.parse(armorContext));
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=armorcontext.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as z from "zod/v4";
|
|
2
|
+
export type ArmorEnvironmentEntry = {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
};
|
|
6
|
+
/** @internal */
|
|
7
|
+
export type ArmorEnvironmentEntry$Outbound = {
|
|
8
|
+
name: string;
|
|
9
|
+
value: string;
|
|
10
|
+
};
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare const ArmorEnvironmentEntry$outboundSchema: z.ZodType<ArmorEnvironmentEntry$Outbound, ArmorEnvironmentEntry>;
|
|
13
|
+
export declare function armorEnvironmentEntryToJSON(armorEnvironmentEntry: ArmorEnvironmentEntry): string;
|
|
14
|
+
//# sourceMappingURL=armorenvironmententry.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
* @generated-id: e4e542230452
|
|
4
|
+
*/
|
|
5
|
+
import * as z from "zod/v4";
|
|
6
|
+
/** @internal */
|
|
7
|
+
export const ArmorEnvironmentEntry$outboundSchema = z.object({
|
|
8
|
+
name: z.string(),
|
|
9
|
+
value: z.string(),
|
|
10
|
+
});
|
|
11
|
+
export function armorEnvironmentEntryToJSON(armorEnvironmentEntry) {
|
|
12
|
+
return JSON.stringify(ArmorEnvironmentEntry$outboundSchema.parse(armorEnvironmentEntry));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=armorenvironmententry.js.map
|