@nativestudio/sdk 0.3.0-rc.20 → 0.3.0-rc.21
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/COMPATIBILITY.json +4 -4
- package/dist/_chunks/{chunk-VI7HPZJC.js → chunk-2QDPFLIO.js} +1 -1
- package/dist/_chunks/chunk-7DXSLHXW.js +1 -0
- package/dist/_chunks/{chunk-D3KLEDOI.js → chunk-ASUZJSEP.js} +1 -1
- package/dist/_chunks/{chunk-3Q24IPBK.js → chunk-K3TIFCD3.js} +1 -1
- package/dist/_chunks/{chunk-O6YL4JVI.js → chunk-NNDKZ5H5.js} +1 -1
- package/dist/_chunks/chunk-Q53Q74OP.js +1 -0
- package/dist/_chunks/chunk-UKPD77FB.js +1 -0
- package/dist/_chunks/chunk-VXBIT7XN.js +1 -0
- package/dist/_chunks/{chunk-SXZY76XB.js → chunk-WNXKJRZ6.js} +1 -1
- package/dist/_types/contracts/interface/operation.d.ts +59 -0
- package/dist/_types/contracts/interface/production-snapshot.d.ts +25 -0
- package/dist/_types/contracts/interface/query.d.ts +25 -0
- package/dist/_types/contracts/lifecycle-event-projections.d.ts +2 -2
- package/dist/_types/contracts/navigation-context.d.ts +49 -1
- package/dist/_types/contracts/navigation.d.ts +1 -1
- package/dist/_types/sdk/catalog/core.d.ts +108 -0
- package/dist/_types/sdk/catalog/federation.d.ts +223 -40
- package/dist/_types/sdk/catalog/lifecycle-events.d.ts +2 -2
- package/dist/_types/sdk/catalog/mcp.d.ts +3 -0
- package/dist/_types/sdk/catalog/navigation.d.ts +86 -4
- package/dist/_types/sdk/catalog/reference-preview.d.ts +36 -0
- package/dist/_types/sdk/navigation-facade.d.ts +103 -3
- package/dist/_types/sdk/observe.d.ts +18 -0
- package/dist/host-protocol.js +1 -1
- package/dist/index.js +1 -1
- package/dist/local-runtime.js +1 -1
- package/dist/mcp-discovery.js +1 -1
- package/dist/runtime-authority.js +1 -1
- package/package.json +1 -1
- package/dist/_chunks/chunk-GJULDJSV.js +0 -1
- package/dist/_chunks/chunk-OHONXDFL.js +0 -1
- package/dist/_chunks/chunk-S64F3WZK.js +0 -1
- package/dist/_chunks/chunk-XNROPEWC.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LocalManagementCommandSchema,WorkspaceCallerSchema}from"./chunk-
|
|
1
|
+
import{LocalManagementCommandSchema,WorkspaceCallerSchema}from"./chunk-7DXSLHXW.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 +1 @@
|
|
|
1
|
-
import{canonicalFederationCatalogJson}from"./chunk-S64F3WZK.js";import{AgentHostExecutionGetSchema,AgentHostExecutionInputSchema,AgentHostNativeToolAuthoritySchema}from"./chunk-VI7HPZJC.js";import{AgentHostScopeSchema,AgentHostSelectionSchema,CurrentHostInstallationTransportSchema,CurrentHostSelectionSchema,HOST_PROTOCOL,HostChoiceSchema,HostDelegationDigest,HostProtocolDigest,HostReferenceSchema,HostScopeSchema,NativeRuntimePublicKeySchema}from"./chunk-O6YL4JVI.js";import{z as z2}from"zod";import"zod";var AgentExecutionContractDigest=HostDelegationDigest;var AgentHostGenericInstallationTransportSchema=CurrentHostInstallationTransportSchema;var id=z2.uuid().regex(/^[0-9a-f-]{36}$/);var key=z2.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var digest=z2.string().regex(/^[a-f0-9]{64}$/);var https=z2.url().max(2048).refine(v=>{const u=new URL(v);return u.protocol==="https:"&&!u.username&&!u.password&&!u.search&&!u.hash});var AgentExecutionLimitsSchema=z2.strictObject({grantMaxSeconds:z2.int().positive().max(30*86400),executionMaxSeconds:z2.int().min(10).max(21600),leaseMaxSeconds:z2.int().positive(),renewWindowSeconds:z2.int().positive(),renewBeforeSeconds:z2.int().positive(),assertionSeconds:z2.literal(60),clockSkewSeconds:z2.literal(5)}).refine(v=>v.renewBeforeSeconds<=v.renewWindowSeconds&&v.renewWindowSeconds<v.leaseMaxSeconds&&v.leaseMaxSeconds<=v.executionMaxSeconds);var AgentExecutionCapabilitiesSchema=z2.strictObject({protocol:z2.literal("delegated-mcp-execution"),protocolVersion:z2.literal(1),contractDigest:digest,issuer:https.refine(v=>new URL(v).origin===v),resource:https,endpoints:z2.strictObject({capabilities:https,authorize:https,token:https,identity:https,bind:https,bindingQuery:https,access:https,accessQuery:https,leaseRenew:https,leaseQuery:https,close:https}),supportedProfiles:z2.tuple([z2.literal("stateless-json-v1")]),limits:AgentExecutionLimitsSchema}).refine(v=>new URL(v.resource).origin===v.issuer&&Object.values(v.endpoints).every(e=>new URL(e).origin===v.issuer));var AgentExecutionDescriptorSchema=z2.strictObject({schemaVersion:z2.literal(1),runtimeKey:key,installationId:key,displayName:z2.string().min(1).max(160),redirectUri:https,publicJwk:NativeRuntimePublicKeySchema});var AgentExecutionProfileSchema=z2.strictObject({schemaVersion:z2.union([z2.literal(1),z2.literal(2)]),profileKey:key,revision:z2.int().positive(),capabilities:AgentExecutionCapabilitiesSchema,capabilityDigest:digest,nativeToolCapabilityDigest:digest,redirectOrigins:z2.array(https.refine(v=>new URL(v).origin===v)).min(1).max(16),scopes:z2.array(z2.string().regex(/^[A-Za-z0-9:_-]{1,128}$/)).min(1).max(32),bootstrap:z2.strictObject({slotKey:z2.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),entryTool:z2.string().regex(/^[A-Za-z0-9_.-]{1,128}$/),argumentsMode:z2.literal("task-input")})});var CurrentAgentExecutionProfileSchema=AgentExecutionProfileSchema.extend({schemaVersion:z2.literal(2),capabilities:AgentExecutionCapabilitiesSchema.safeExtend({contractDigest:z2.literal(AgentExecutionContractDigest)})});var AgentExecutionRegistrationSchema=AgentExecutionDescriptorSchema.extend({clientId:key,registrationRevision:z2.int().positive(),issuer:https,resource:https,keyId:z2.string().regex(/^[A-Za-z0-9_-]{43}$/),protocol:z2.literal("delegated-mcp-execution"),protocolVersion:z2.literal(1),contractDigest:digest,capabilityDigest:digest});var ApproveAgentExecutionRegistrationSchema=AgentHostScopeSchema.extend({requestId:id,bindingId:id,expectedBindingRevision:z2.int().positive(),expectedConfigurationVersion:z2.int().positive(),profileKey:key,expectedProfileRevision:z2.int().positive(),descriptor:AgentExecutionDescriptorSchema});var AgentExecutionRegistrationGetSchema=AgentHostScopeSchema.extend({clientId:id});var RevokeAgentExecutionRegistrationSchema=AgentExecutionRegistrationGetSchema.extend({requestId:id,expectedRevision:z2.int().positive()});var AgentExecutionRegistrationViewSchema=AgentExecutionRegistrationGetSchema.extend({schemaVersion:z2.literal(1),revision:z2.int().positive(),enabled:z2.boolean(),bindingId:id,bindingRevision:z2.int().positive(),configurationVersion:z2.int().positive(),profile:AgentExecutionProfileSchema,registration:AgentExecutionRegistrationSchema,approvedByPrincipalId:id,createdAt:z2.iso.datetime(),revokedAt:z2.iso.datetime().nullable()}).refine(v=>v.clientId===v.registration.clientId&&v.enabled===(v.revokedAt===null)&&v.registration.capabilityDigest===v.profile.capabilityDigest&&v.registration.resource===v.profile.capabilities.resource&&v.registration.issuer===v.profile.capabilities.issuer);import{z as z5}from"zod";import{z as z4}from"zod";import{z as z3}from"zod";var id2=z3.uuid();var opaque=z3.string().min(1).max(4096);var digest2=z3.string().regex(/^[a-f0-9]{64}$/);var AgentExecutionConsentSchema=z3.strictObject({response_type:z3.literal("code"),client_id:id2,redirect_uri:z3.url().max(2048),resource:z3.url().max(2048),scope:z3.string().min(1).max(4096),state:z3.string().min(1).max(512),code_challenge:z3.string().regex(/^[A-Za-z0-9_-]{43}$/),code_challenge_method:z3.literal("S256")});var ApproveAgentExecutionConsentSchema=AgentHostScopeSchema.extend({profileKey:z3.string().regex(/^[A-Za-z0-9_-]{1,160}$/),requestId:id2,consent:AgentExecutionConsentSchema,expiresInSeconds:z3.int().min(60).max(30*86400)});var AgentExecutionGrantSchema=z3.strictObject({protocolVersion:z3.literal(1),clientId:id2,registrationRevision:z3.int().positive(),resource:z3.url().max(2048),grantRef:id2,grantRevision:z3.int().positive(),expiresAt:z3.iso.datetime(),scopes:z3.array(z3.string().min(1).max(128)).min(1).max(32)});var AgentExecutionTokenFormSchema=z3.discriminatedUnion("grant_type",[z3.strictObject({grant_type:z3.literal("authorization_code"),client_id:id2,resource:z3.url().max(2048),registration_revision:z3.string().regex(/^[1-9][0-9]{0,14}$/),code:opaque,code_verifier:z3.string().regex(/^[A-Za-z0-9._~-]{43,128}$/),redirect_uri:z3.url().max(2048),client_assertion_type:z3.literal("urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),client_assertion:opaque}),z3.strictObject({grant_type:z3.literal("refresh_token"),client_id:id2,resource:z3.url().max(2048),registration_revision:z3.string().regex(/^[1-9][0-9]{0,14}$/),refresh_token:opaque,client_assertion_type:z3.literal("urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),client_assertion:opaque})]);var AgentExecutionAssertionSchema=z3.strictObject({iss:id2,sub:id2,aud:z3.url().max(2048),iat:z3.int().nonnegative(),exp:z3.int().positive(),jti:id2,requestDigest:digest2}).refine(v=>v.exp===v.iat+60);var id3=z4.uuid();var key2=z4.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var digest3=z4.string().regex(/^[a-f0-9]{64}$/);var time=z4.iso.datetime();var AgentExecutionIdentitySchema=z4.strictObject({authorityRef:key2,executionId:key2,installationId:key2,installationRevisionId:key2,invocationId:id3,inputDigest:digest3});var AgentExecutionLeaseSchema=z4.strictObject({protocolVersion:z4.literal(1),bindingId:key2,executionId:key2,leaseRevision:z4.int().positive(),expiresAt:time,hardExpiresAt:time,renewedAt:time,renewBeforeSeconds:z4.int().positive()});var AgentExecutionBindingReceiptSchema=AgentExecutionIdentitySchema.extend({protocolVersion:z4.literal(1),bindingId:key2,grantRef:key2,grantRevision:z4.int().positive(),hardExpiresAt:time,boundAt:time,lease:AgentExecutionLeaseSchema});var AgentExecutionAccessMetadataSchema=z4.strictObject({protocolVersion:z4.literal(1),bindingId:key2,executionId:key2,accessGeneration:z4.int().positive(),expiresAt:time});var AgentExecutionPayloadSchemas={identity:z4.strictObject({}),bind:AgentExecutionIdentitySchema.extend({deadlineAt:time}),bindingQuery:z4.strictObject({authorityRef:key2,executionId:key2,originalRequestId:id3}),access:z4.strictObject({bindingId:key2,executionId:key2,expectedAccessGeneration:z4.int().nonnegative()}),accessQuery:z4.strictObject({bindingId:key2,executionId:key2,originalRequestId:id3}),leaseRenew:z4.strictObject({bindingId:key2,executionId:key2,expectedLeaseRevision:z4.int().positive()}),leaseQuery:z4.strictObject({bindingId:key2,executionId:key2,originalRequestId:id3}),close:z4.strictObject({bindingId:key2,executionId:key2,reason:z4.enum(["FINISHED","CANCELLED","ABORTED"])})};var envelope=z4.strictObject({protocolVersion:z4.literal(1),contractDigest:z4.literal(AgentExecutionContractDigest),capabilityDigest:digest3,requestId:id3,clientId:id3,registrationRevision:z4.int().positive(),resource:z4.url().max(2048),grantRef:id3,grantRevision:z4.int().positive(),payload:z4.unknown(),clientAssertion:z4.string().min(1).max(4096)});var AgentExecutionRequestSchemas={identity:envelope.extend({payload:AgentExecutionPayloadSchemas.identity}),bind:envelope.extend({payload:AgentExecutionPayloadSchemas.bind}),bindingQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.bindingQuery}),access:envelope.extend({payload:AgentExecutionPayloadSchemas.access}),accessQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.accessQuery}),leaseRenew:envelope.extend({payload:AgentExecutionPayloadSchemas.leaseRenew}),leaseQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.leaseQuery}),close:envelope.extend({payload:AgentExecutionPayloadSchemas.close})};var AgentExecutionQualificationSchema=z4.strictObject({protocol:z4.literal("NVS_GENERIC_EXECUTION_QUALIFICATION_V1"),transport:AgentHostGenericInstallationTransportSchema,selection:AgentHostSelectionSchema,checkedAt:time,executionClass:z4.enum(["LIVE","TEST_ONLY"])});var AgentExecutionPermitSchema=z4.strictObject({schemaVersion:z4.literal(1),proof:AgentHostNativeToolAuthoritySchema,input:AgentHostExecutionInputSchema,inputDigest:digest3,guidance:z4.strictObject({version:z4.string().min(1).max(100),instructions:z4.string().min(1).max(2e4)}),registration:AgentExecutionRegistrationViewSchema,grant:AgentExecutionGrantSchema,qualification:AgentExecutionQualificationSchema,requestedByPrincipalId:id3,createdAt:time}).refine(v=>v.proof.transport?.protocol==="NVS_AGENT_HOST_V1"&&v.proof.tenantId===v.registration.tenantId&&v.proof.projectId===v.registration.projectId&&v.proof.productionId===v.input.productionId&&v.proof.executionId===v.input.executionId&&v.proof.hostRequestId===v.input.hostRequestId&&v.proof.bindingId===v.registration.bindingId&&v.proof.configurationVersion===v.registration.configurationVersion&&v.proof.capabilityDigest===v.registration.profile.nativeToolCapabilityDigest&&v.proof.transport.capabilityDigest===v.registration.profile.capabilityDigest&&v.grant.clientId===v.registration.clientId&&v.grant.resource===v.registration.registration.resource&&v.grant.registrationRevision===v.registration.registration.registrationRevision&&v.qualification.transport.installationId===v.proof.transport.installationId&&v.qualification.transport.installationRevisionId===v.proof.transport.installationRevisionId&&v.qualification.transport.capabilityDigest===v.proof.transport.capabilityDigest&&v.qualification.transport.slotKey===v.proof.transport.slotKey&&Date.parse(v.proof.expiresAt)<=Date.parse(v.grant.expiresAt)&&v.input.tenantId===v.proof.tenantId&&v.input.projectId===v.proof.projectId&&v.registration.enabled&&v.proof.transport.installationId===v.registration.registration.installationId&&v.proof.transport.slotKey===v.registration.profile.bootstrap.slotKey&&v.proof.executionClass===v.qualification.executionClass);var AgentExecutionBindingSchema=z4.strictObject({protocol:z4.literal("delegated-mcp-execution"),protocolVersion:z4.literal(1),contractDigest:z4.literal(AgentExecutionContractDigest),capabilityDigest:digest3,issuer:z4.url(),resource:z4.url(),slotKey:z4.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),registration:AgentExecutionRegistrationViewSchema.shape.registration,grant:AgentExecutionGrantSchema,endpoints:AgentExecutionRegistrationViewSchema.shape.profile.shape.capabilities.shape.endpoints,limits:AgentExecutionRegistrationViewSchema.shape.profile.shape.capabilities.shape.limits,bootstrap:AgentExecutionRegistrationViewSchema.shape.profile.shape.bootstrap,transportPolicy:z4.strictObject({profile:z4.literal("stateless-json-v1")}),runtimePolicy:z4.strictObject({sandbox:z4.literal("read-only"),webSearch:z4.literal("disabled"),localExecution:z4.literal("disabled"),toolExposure:z4.literal("direct"),maxTurns:z4.literal(1)})});var AgentExecutionInstallationObservationSchema=z4.strictObject({schemaVersion:z4.literal(3),installationId:key2,installationRevisionId:key2,slotKey:z4.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),binding:AgentExecutionBindingSchema,identity:AgentExecutionGrantSchema.extend({decision:z4.enum(["ALLOW","DRAIN","DENY","UNKNOWN"]),observedAt:time}),checkedAt:time});var AgentExecutionBootstrapInputSchema=z4.strictObject({nativeStudio:AgentHostExecutionInputSchema.safeExtend({nativeToolAuthority:AgentHostNativeToolAuthoritySchema})});var key3=z5.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var sha=z5.string().regex(/^[a-f0-9]{64}$/);var time2=z5.iso.datetime({offset:true}).max(80);var HostInstallationIdentitySchema=z5.strictObject({installationId:key3,installationRevisionId:key3,slotKey:z5.string().regex(/^[a-z0-9_-]{1,64}$/)});var HostInstallationHeaderSchema=z5.strictObject({contract:z5.literal("nvs-agent-host-installation/1"),hostContractDigest:z5.literal(HostProtocolDigest),scope:HostScopeSchema,selection:HostChoiceSchema,installation:HostInstallationIdentitySchema.extend({enabled:z5.boolean(),available:z5.boolean()}).strict()});var HostInstallationSchema=HostInstallationHeaderSchema.extend({execution:AgentExecutionInstallationObservationSchema}).strict();var HostTaskCancelSchema=z5.strictObject({contract:z5.literal("nvs-agent-task-cancel/1"),hostContractDigest:z5.literal(HostProtocolDigest),requestId:z5.uuid(),originalRequestId:z5.uuid(),inputDigest:sha,installation:HostInstallationIdentitySchema}).refine(v=>v.requestId!==v.originalRequestId);var HostAuthorizationObservationSchema=z5.strictObject({schemaVersion:z5.literal(1),protocol:z5.literal("delegated-mcp-execution"),protocolVersion:z5.literal(1),contractDigest:z5.literal(HostDelegationDigest),capabilityDigest:sha,decision:z5.enum(["NOT_OBSERVED","ALLOW","DRAIN","DENY","UNKNOWN"]),checkedAt:time2,expiresAt:time2.optional(),hardExpiresAt:time2.optional(),leaseRevision:z5.int().positive().optional(),reasonCode:HostReferenceSchema.optional()});var HostTaskResponseSchema=z5.strictObject({contract:z5.literal("nvs-agent-task/1"),hostContractDigest:z5.literal(HostProtocolDigest),requestId:z5.uuid(),runKey:key3,inputDigest:sha,scope:HostScopeSchema,selection:HostChoiceSchema,installation:HostInstallationIdentitySchema,authorityRef:z5.uuid(),executionAuthorization:HostAuthorizationObservationSchema,status:z5.enum(["accepted","running","succeeded","failed","cancelled","unknown"]),cancelRequested:z5.boolean(),createdAt:time2,updatedAt:time2,timing:z5.strictObject({acceptedAt:time2,deadlineAt:time2,limitSource:z5.literal("TASK_POLICY")})}).refine(v=>Date.parse(v.updatedAt)>=Date.parse(v.createdAt)&&Date.parse(v.timing.deadlineAt)>Date.parse(v.timing.acceptedAt));var HostTaskRequestSchema=z5.strictObject({contract:z5.literal("nvs-agent-task/1"),hostContractDigest:z5.literal(HostProtocolDigest),requestId:z5.uuid(),scope:HostScopeSchema,selection:HostChoiceSchema,installation:HostInstallationIdentitySchema,inputDigest:sha,input:z5.record(z5.string(),z5.json()),authorization:z5.strictObject({authorityRef:z5.uuid(),expiresAt:time2,contractDigest:z5.literal(HostDelegationDigest),capabilityDigest:sha})});import{z as z6}from"zod";var sha2=z6.string().regex(/^[a-f0-9]{64}$/);var ReleaseLegacyHostExecutionSchema=AgentHostExecutionGetSchema.extend({requestId:z6.uuid(),expectedRevision:z6.int().positive(),hostRequestId:z6.uuid(),snapshotFingerprint:sha2,evidenceRef:z6.string().min(1).max(512).refine(v=>Array.from(v).every(c=>{const n=c.codePointAt(0);return n>=32&&(n<127||n>159)&&(n<55296||n>57343)})),evidenceSha256:sha2,decision:z6.literal("RELEASE_NATIVE_DISPATCH_FENCE")});var LegacyHostExecutionReleaseSchema=ReleaseLegacyHostExecutionSchema.extend({releasedByPrincipalId:z6.uuid(),releasedAt:z6.iso.datetime({offset:true})});import{z as z7}from"zod";var canonicalHostContractJson=canonicalFederationCatalogJson;var bounded=z7.unknown().refine(value=>{try{canonicalHostContractJson(value);return true}catch{return false}},{abort:true});var digest4=z7.string().regex(/^sha256:[a-f0-9]{64}$/);var jsonSchema=z7.record(z7.string(),z7.json());var operations={"installation.read":{method:"GET",path:"/nvs-agent-host/v1/installations/{installationId}"},"task.submit":{method:"POST",path:"/nvs-agent-host/v1/tasks"},"task.by-request":{method:"GET",path:"/nvs-agent-host/v1/tasks/by-request"},"task.get":{method:"GET",path:"/nvs-agent-host/v1/tasks/{runKey}"},"task.cancel":{method:"POST",path:"/nvs-agent-host/v1/tasks/{runKey}/cancel"}};var eventing={standard:"EventSDK",notificationProfile:"eventsdk/1.2",receiptProfile:"eventsdk/1.1",requiredForHostExecution:false,defaultReceive:false,subscriberKinds:["SYSTEM","AGENT_RUNTIME","HOST_BOT"],authorization:"INDEPENDENT_CURRENT_AUTHORITY",wake:"RECEIVER_OWNED",adoption:"RECEIVER_OWNER_GOAL_REQUIRED",receiptMeaning:"LOCAL_APPLIED_IS_NOT_AGENT_ADOPTION",operations:{catalog:"federation.catalog",select:"federation.subscription.set",read:"federation.subscription.get",handoff:"federation.subscription.handoff",contract:"federation.subscription.contract",resultReference:"federation.result.reference",resultRead:"federation.result.read",receiptInspection:"federation.delivery.inspect",receiptHandoff:"federation.receipt-inbound.handoff"}};var semanticChecks=["OPAQUE_SCOPE_IS_NOT_NATIVE_TENANT_MAPPING","JSON_SCHEMA_PLUS_SEMANTIC_CHECKS_REQUIRED","I_JSON_FINITE_PLAIN_DENSE_JSON_NO_DUPLICATE_KEYS_OR_LONE_SURROGATES","HOST_REFERENCES_1_TO_256_UNICODE_CODEPOINTS_WITHOUT_C0_C1_CONTROLS","CURRENT_REGISTRATION_CONSENT_GRANT_PERMIT_LEASE_ACCESS_REQUIRED","INSTALLATION_RECHECK_BEFORE_AND_AFTER_NATIVE_MANIFEST","INPUT_SHA256_CANONICAL_COMPLETE_INPUT_INCLUDING_NATIVE_PROOF","EXACT_REQUEST_INPUT_SCOPE_CHOICE_INSTALLATION_AUTHORITY_AND_TASK","RESPONSE_TIME_ORDER_FRESH_AUTHORIZATION_AND_DEADLINES_WITHIN_NATIVE_PROOF","SUBMIT_DEADLINE_INCLUDES_CREDENTIAL_ACCESS_AND_NATIVE_AUTHORITY_EXPIRY","NO_WRITE_BEFORE_DISPATCH_UNKNOWN_AFTER_DISPATCH_NO_AUTOMATIC_RETRY","RECOVERY_OBSERVES_ORIGINAL_REQUEST_WITHOUT_RESUBMISSION","CANCEL_USES_DISTINCT_REQUEST_AND_EXACT_ORIGINAL_TASK","HOST_REPORT_IS_NOT_PRODUCTION_TRUTH_OR_RESULT_ADOPTION","SUBSCRIPTION_EXECUTION_AND_CONTENT_AUTHORITY_ARE_INDEPENDENT"];var route=value=>z7.strictObject({method:z7.literal(value.method),path:z7.literal(value.path)});var AgentHostContractDocumentSchema=bounded.pipe(z7.strictObject({contract:z7.literal("nvs-agent-host-contract/1"),hostProtocol:z7.literal(HOST_PROTOCOL),hostContractDigest:z7.literal(HostProtocolDigest),delegationContractDigest:z7.literal(HostDelegationDigest),nativeSelectionVersion:z7.literal(2),nativeProfileVersion:z7.literal(2),schemaDialect:z7.literal("https://json-schema.org/draft/2020-12/schema"),origin:z7.literal("DEPLOYMENT_REGISTERED_ONLY"),credential:z7.literal("PRIVATE_BEARER_NEVER_HUMAN_TOKEN"),scopeQuery:z7.tuple([z7.literal("scopeNamespace"),z7.literal("scopeRef")]),requestQuery:z7.literal("requestId"),operations:z7.strictObject({"installation.read":route(operations["installation.read"]),"task.submit":route(operations["task.submit"]),"task.by-request":route(operations["task.by-request"]),"task.get":route(operations["task.get"]),"task.cancel":route(operations["task.cancel"])}),schemas:z7.strictObject({selection:jsonSchema,installation:jsonSchema,taskRequest:jsonSchema,taskResponse:jsonSchema,taskCancel:jsonSchema}),semanticChecks:z7.array(z7.enum(semanticChecks)).length(semanticChecks.length).refine(values=>values.every((v,i)=>v===semanticChecks[i])),maxTaskBytes:z7.literal(131072),currentAuthority:z7.literal("NOT_OBSERVED"),eventing:z7.strictObject({standard:z7.literal(eventing.standard),notificationProfile:z7.literal(eventing.notificationProfile),receiptProfile:z7.literal(eventing.receiptProfile),requiredForHostExecution:z7.literal(false),defaultReceive:z7.literal(false),subscriberKinds:z7.tuple([z7.literal("SYSTEM"),z7.literal("AGENT_RUNTIME"),z7.literal("HOST_BOT")]),authorization:z7.literal(eventing.authorization),wake:z7.literal(eventing.wake),adoption:z7.literal(eventing.adoption),receiptMeaning:z7.literal(eventing.receiptMeaning),operations:z7.strictObject({catalog:z7.literal(eventing.operations.catalog),select:z7.literal(eventing.operations.select),read:z7.literal(eventing.operations.read),handoff:z7.literal(eventing.operations.handoff),contract:z7.literal(eventing.operations.contract),resultReference:z7.literal(eventing.operations.resultReference),resultRead:z7.literal(eventing.operations.resultRead),receiptInspection:z7.literal(eventing.operations.receiptInspection),receiptHandoff:z7.literal(eventing.operations.receiptHandoff)})}),qualification:z7.literal("NVS_DECLARATION_ONLY")}));var AgentHostContractInputSchema=AgentHostScopeSchema.extend({expectedDigest:digest4.optional()}).strict();var AgentHostContractSchema=bounded.pipe(AgentHostScopeSchema.extend({document:AgentHostContractDocumentSchema,digest:digest4,maxReplyBytes:z7.literal(131072)}).strict());function createAgentHostContractDocument(){const schema=value=>z7.toJSONSchema(value,{target:"draft-2020-12",io:"input"});return AgentHostContractDocumentSchema.parse({contract:"nvs-agent-host-contract/1",hostProtocol:HOST_PROTOCOL,hostContractDigest:HostProtocolDigest,delegationContractDigest:HostDelegationDigest,nativeSelectionVersion:2,nativeProfileVersion:2,schemaDialect:"https://json-schema.org/draft/2020-12/schema",origin:"DEPLOYMENT_REGISTERED_ONLY",credential:"PRIVATE_BEARER_NEVER_HUMAN_TOKEN",scopeQuery:["scopeNamespace","scopeRef"],requestQuery:"requestId",operations,schemas:{selection:schema(CurrentHostSelectionSchema),installation:schema(HostInstallationSchema),taskRequest:schema(HostTaskRequestSchema),taskResponse:schema(HostTaskResponseSchema),taskCancel:schema(HostTaskCancelSchema)},semanticChecks,maxTaskBytes:131072,currentAuthority:"NOT_OBSERVED",eventing,qualification:"NVS_DECLARATION_ONLY"})}export{CurrentAgentExecutionProfileSchema,HostInstallationIdentitySchema,HostInstallationSchema,HostTaskCancelSchema,HostTaskResponseSchema,HostTaskRequestSchema,ReleaseLegacyHostExecutionSchema,LegacyHostExecutionReleaseSchema,canonicalHostContractJson,AgentHostContractDocumentSchema,AgentHostContractInputSchema,AgentHostContractSchema,createAgentHostContractDocument};
|
|
1
|
+
import{canonicalFederationCatalogJson}from"./chunk-VXBIT7XN.js";import{AgentHostExecutionGetSchema,AgentHostExecutionInputSchema,AgentHostNativeToolAuthoritySchema}from"./chunk-2QDPFLIO.js";import{AgentHostScopeSchema,AgentHostSelectionSchema,CurrentHostInstallationTransportSchema,CurrentHostSelectionSchema,HOST_PROTOCOL,HostChoiceSchema,HostDelegationDigest,HostProtocolDigest,HostReferenceSchema,HostScopeSchema,NativeRuntimePublicKeySchema}from"./chunk-NNDKZ5H5.js";import{z as z2}from"zod";import"zod";var AgentExecutionContractDigest=HostDelegationDigest;var AgentHostGenericInstallationTransportSchema=CurrentHostInstallationTransportSchema;var id=z2.uuid().regex(/^[0-9a-f-]{36}$/);var key=z2.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var digest=z2.string().regex(/^[a-f0-9]{64}$/);var https=z2.url().max(2048).refine(v=>{const u=new URL(v);return u.protocol==="https:"&&!u.username&&!u.password&&!u.search&&!u.hash});var AgentExecutionLimitsSchema=z2.strictObject({grantMaxSeconds:z2.int().positive().max(30*86400),executionMaxSeconds:z2.int().min(10).max(21600),leaseMaxSeconds:z2.int().positive(),renewWindowSeconds:z2.int().positive(),renewBeforeSeconds:z2.int().positive(),assertionSeconds:z2.literal(60),clockSkewSeconds:z2.literal(5)}).refine(v=>v.renewBeforeSeconds<=v.renewWindowSeconds&&v.renewWindowSeconds<v.leaseMaxSeconds&&v.leaseMaxSeconds<=v.executionMaxSeconds);var AgentExecutionCapabilitiesSchema=z2.strictObject({protocol:z2.literal("delegated-mcp-execution"),protocolVersion:z2.literal(1),contractDigest:digest,issuer:https.refine(v=>new URL(v).origin===v),resource:https,endpoints:z2.strictObject({capabilities:https,authorize:https,token:https,identity:https,bind:https,bindingQuery:https,access:https,accessQuery:https,leaseRenew:https,leaseQuery:https,close:https}),supportedProfiles:z2.tuple([z2.literal("stateless-json-v1")]),limits:AgentExecutionLimitsSchema}).refine(v=>new URL(v.resource).origin===v.issuer&&Object.values(v.endpoints).every(e=>new URL(e).origin===v.issuer));var AgentExecutionDescriptorSchema=z2.strictObject({schemaVersion:z2.literal(1),runtimeKey:key,installationId:key,displayName:z2.string().min(1).max(160),redirectUri:https,publicJwk:NativeRuntimePublicKeySchema});var AgentExecutionProfileSchema=z2.strictObject({schemaVersion:z2.union([z2.literal(1),z2.literal(2)]),profileKey:key,revision:z2.int().positive(),capabilities:AgentExecutionCapabilitiesSchema,capabilityDigest:digest,nativeToolCapabilityDigest:digest,redirectOrigins:z2.array(https.refine(v=>new URL(v).origin===v)).min(1).max(16),scopes:z2.array(z2.string().regex(/^[A-Za-z0-9:_-]{1,128}$/)).min(1).max(32),bootstrap:z2.strictObject({slotKey:z2.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),entryTool:z2.string().regex(/^[A-Za-z0-9_.-]{1,128}$/),argumentsMode:z2.literal("task-input")})});var CurrentAgentExecutionProfileSchema=AgentExecutionProfileSchema.extend({schemaVersion:z2.literal(2),capabilities:AgentExecutionCapabilitiesSchema.safeExtend({contractDigest:z2.literal(AgentExecutionContractDigest)})});var AgentExecutionRegistrationSchema=AgentExecutionDescriptorSchema.extend({clientId:key,registrationRevision:z2.int().positive(),issuer:https,resource:https,keyId:z2.string().regex(/^[A-Za-z0-9_-]{43}$/),protocol:z2.literal("delegated-mcp-execution"),protocolVersion:z2.literal(1),contractDigest:digest,capabilityDigest:digest});var ApproveAgentExecutionRegistrationSchema=AgentHostScopeSchema.extend({requestId:id,bindingId:id,expectedBindingRevision:z2.int().positive(),expectedConfigurationVersion:z2.int().positive(),profileKey:key,expectedProfileRevision:z2.int().positive(),descriptor:AgentExecutionDescriptorSchema});var AgentExecutionRegistrationGetSchema=AgentHostScopeSchema.extend({clientId:id});var RevokeAgentExecutionRegistrationSchema=AgentExecutionRegistrationGetSchema.extend({requestId:id,expectedRevision:z2.int().positive()});var AgentExecutionRegistrationViewSchema=AgentExecutionRegistrationGetSchema.extend({schemaVersion:z2.literal(1),revision:z2.int().positive(),enabled:z2.boolean(),bindingId:id,bindingRevision:z2.int().positive(),configurationVersion:z2.int().positive(),profile:AgentExecutionProfileSchema,registration:AgentExecutionRegistrationSchema,approvedByPrincipalId:id,createdAt:z2.iso.datetime(),revokedAt:z2.iso.datetime().nullable()}).refine(v=>v.clientId===v.registration.clientId&&v.enabled===(v.revokedAt===null)&&v.registration.capabilityDigest===v.profile.capabilityDigest&&v.registration.resource===v.profile.capabilities.resource&&v.registration.issuer===v.profile.capabilities.issuer);import{z as z5}from"zod";import{z as z4}from"zod";import{z as z3}from"zod";var id2=z3.uuid();var opaque=z3.string().min(1).max(4096);var digest2=z3.string().regex(/^[a-f0-9]{64}$/);var AgentExecutionConsentSchema=z3.strictObject({response_type:z3.literal("code"),client_id:id2,redirect_uri:z3.url().max(2048),resource:z3.url().max(2048),scope:z3.string().min(1).max(4096),state:z3.string().min(1).max(512),code_challenge:z3.string().regex(/^[A-Za-z0-9_-]{43}$/),code_challenge_method:z3.literal("S256")});var ApproveAgentExecutionConsentSchema=AgentHostScopeSchema.extend({profileKey:z3.string().regex(/^[A-Za-z0-9_-]{1,160}$/),requestId:id2,consent:AgentExecutionConsentSchema,expiresInSeconds:z3.int().min(60).max(30*86400)});var AgentExecutionGrantSchema=z3.strictObject({protocolVersion:z3.literal(1),clientId:id2,registrationRevision:z3.int().positive(),resource:z3.url().max(2048),grantRef:id2,grantRevision:z3.int().positive(),expiresAt:z3.iso.datetime(),scopes:z3.array(z3.string().min(1).max(128)).min(1).max(32)});var AgentExecutionTokenFormSchema=z3.discriminatedUnion("grant_type",[z3.strictObject({grant_type:z3.literal("authorization_code"),client_id:id2,resource:z3.url().max(2048),registration_revision:z3.string().regex(/^[1-9][0-9]{0,14}$/),code:opaque,code_verifier:z3.string().regex(/^[A-Za-z0-9._~-]{43,128}$/),redirect_uri:z3.url().max(2048),client_assertion_type:z3.literal("urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),client_assertion:opaque}),z3.strictObject({grant_type:z3.literal("refresh_token"),client_id:id2,resource:z3.url().max(2048),registration_revision:z3.string().regex(/^[1-9][0-9]{0,14}$/),refresh_token:opaque,client_assertion_type:z3.literal("urn:ietf:params:oauth:client-assertion-type:jwt-bearer"),client_assertion:opaque})]);var AgentExecutionAssertionSchema=z3.strictObject({iss:id2,sub:id2,aud:z3.url().max(2048),iat:z3.int().nonnegative(),exp:z3.int().positive(),jti:id2,requestDigest:digest2}).refine(v=>v.exp===v.iat+60);var id3=z4.uuid();var key2=z4.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var digest3=z4.string().regex(/^[a-f0-9]{64}$/);var time=z4.iso.datetime();var AgentExecutionIdentitySchema=z4.strictObject({authorityRef:key2,executionId:key2,installationId:key2,installationRevisionId:key2,invocationId:id3,inputDigest:digest3});var AgentExecutionLeaseSchema=z4.strictObject({protocolVersion:z4.literal(1),bindingId:key2,executionId:key2,leaseRevision:z4.int().positive(),expiresAt:time,hardExpiresAt:time,renewedAt:time,renewBeforeSeconds:z4.int().positive()});var AgentExecutionBindingReceiptSchema=AgentExecutionIdentitySchema.extend({protocolVersion:z4.literal(1),bindingId:key2,grantRef:key2,grantRevision:z4.int().positive(),hardExpiresAt:time,boundAt:time,lease:AgentExecutionLeaseSchema});var AgentExecutionAccessMetadataSchema=z4.strictObject({protocolVersion:z4.literal(1),bindingId:key2,executionId:key2,accessGeneration:z4.int().positive(),expiresAt:time});var AgentExecutionPayloadSchemas={identity:z4.strictObject({}),bind:AgentExecutionIdentitySchema.extend({deadlineAt:time}),bindingQuery:z4.strictObject({authorityRef:key2,executionId:key2,originalRequestId:id3}),access:z4.strictObject({bindingId:key2,executionId:key2,expectedAccessGeneration:z4.int().nonnegative()}),accessQuery:z4.strictObject({bindingId:key2,executionId:key2,originalRequestId:id3}),leaseRenew:z4.strictObject({bindingId:key2,executionId:key2,expectedLeaseRevision:z4.int().positive()}),leaseQuery:z4.strictObject({bindingId:key2,executionId:key2,originalRequestId:id3}),close:z4.strictObject({bindingId:key2,executionId:key2,reason:z4.enum(["FINISHED","CANCELLED","ABORTED"])})};var envelope=z4.strictObject({protocolVersion:z4.literal(1),contractDigest:z4.literal(AgentExecutionContractDigest),capabilityDigest:digest3,requestId:id3,clientId:id3,registrationRevision:z4.int().positive(),resource:z4.url().max(2048),grantRef:id3,grantRevision:z4.int().positive(),payload:z4.unknown(),clientAssertion:z4.string().min(1).max(4096)});var AgentExecutionRequestSchemas={identity:envelope.extend({payload:AgentExecutionPayloadSchemas.identity}),bind:envelope.extend({payload:AgentExecutionPayloadSchemas.bind}),bindingQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.bindingQuery}),access:envelope.extend({payload:AgentExecutionPayloadSchemas.access}),accessQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.accessQuery}),leaseRenew:envelope.extend({payload:AgentExecutionPayloadSchemas.leaseRenew}),leaseQuery:envelope.extend({payload:AgentExecutionPayloadSchemas.leaseQuery}),close:envelope.extend({payload:AgentExecutionPayloadSchemas.close})};var AgentExecutionQualificationSchema=z4.strictObject({protocol:z4.literal("NVS_GENERIC_EXECUTION_QUALIFICATION_V1"),transport:AgentHostGenericInstallationTransportSchema,selection:AgentHostSelectionSchema,checkedAt:time,executionClass:z4.enum(["LIVE","TEST_ONLY"])});var AgentExecutionPermitSchema=z4.strictObject({schemaVersion:z4.literal(1),proof:AgentHostNativeToolAuthoritySchema,input:AgentHostExecutionInputSchema,inputDigest:digest3,guidance:z4.strictObject({version:z4.string().min(1).max(100),instructions:z4.string().min(1).max(2e4)}),registration:AgentExecutionRegistrationViewSchema,grant:AgentExecutionGrantSchema,qualification:AgentExecutionQualificationSchema,requestedByPrincipalId:id3,createdAt:time}).refine(v=>v.proof.transport?.protocol==="NVS_AGENT_HOST_V1"&&v.proof.tenantId===v.registration.tenantId&&v.proof.projectId===v.registration.projectId&&v.proof.productionId===v.input.productionId&&v.proof.executionId===v.input.executionId&&v.proof.hostRequestId===v.input.hostRequestId&&v.proof.bindingId===v.registration.bindingId&&v.proof.configurationVersion===v.registration.configurationVersion&&v.proof.capabilityDigest===v.registration.profile.nativeToolCapabilityDigest&&v.proof.transport.capabilityDigest===v.registration.profile.capabilityDigest&&v.grant.clientId===v.registration.clientId&&v.grant.resource===v.registration.registration.resource&&v.grant.registrationRevision===v.registration.registration.registrationRevision&&v.qualification.transport.installationId===v.proof.transport.installationId&&v.qualification.transport.installationRevisionId===v.proof.transport.installationRevisionId&&v.qualification.transport.capabilityDigest===v.proof.transport.capabilityDigest&&v.qualification.transport.slotKey===v.proof.transport.slotKey&&Date.parse(v.proof.expiresAt)<=Date.parse(v.grant.expiresAt)&&v.input.tenantId===v.proof.tenantId&&v.input.projectId===v.proof.projectId&&v.registration.enabled&&v.proof.transport.installationId===v.registration.registration.installationId&&v.proof.transport.slotKey===v.registration.profile.bootstrap.slotKey&&v.proof.executionClass===v.qualification.executionClass);var AgentExecutionBindingSchema=z4.strictObject({protocol:z4.literal("delegated-mcp-execution"),protocolVersion:z4.literal(1),contractDigest:z4.literal(AgentExecutionContractDigest),capabilityDigest:digest3,issuer:z4.url(),resource:z4.url(),slotKey:z4.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),registration:AgentExecutionRegistrationViewSchema.shape.registration,grant:AgentExecutionGrantSchema,endpoints:AgentExecutionRegistrationViewSchema.shape.profile.shape.capabilities.shape.endpoints,limits:AgentExecutionRegistrationViewSchema.shape.profile.shape.capabilities.shape.limits,bootstrap:AgentExecutionRegistrationViewSchema.shape.profile.shape.bootstrap,transportPolicy:z4.strictObject({profile:z4.literal("stateless-json-v1")}),runtimePolicy:z4.strictObject({sandbox:z4.literal("read-only"),webSearch:z4.literal("disabled"),localExecution:z4.literal("disabled"),toolExposure:z4.literal("direct"),maxTurns:z4.literal(1)})});var AgentExecutionInstallationObservationSchema=z4.strictObject({schemaVersion:z4.literal(3),installationId:key2,installationRevisionId:key2,slotKey:z4.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),binding:AgentExecutionBindingSchema,identity:AgentExecutionGrantSchema.extend({decision:z4.enum(["ALLOW","DRAIN","DENY","UNKNOWN"]),observedAt:time}),checkedAt:time});var AgentExecutionBootstrapInputSchema=z4.strictObject({nativeStudio:AgentHostExecutionInputSchema.safeExtend({nativeToolAuthority:AgentHostNativeToolAuthoritySchema})});var key3=z5.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var sha=z5.string().regex(/^[a-f0-9]{64}$/);var time2=z5.iso.datetime({offset:true}).max(80);var HostInstallationIdentitySchema=z5.strictObject({installationId:key3,installationRevisionId:key3,slotKey:z5.string().regex(/^[a-z0-9_-]{1,64}$/)});var HostInstallationHeaderSchema=z5.strictObject({contract:z5.literal("nvs-agent-host-installation/1"),hostContractDigest:z5.literal(HostProtocolDigest),scope:HostScopeSchema,selection:HostChoiceSchema,installation:HostInstallationIdentitySchema.extend({enabled:z5.boolean(),available:z5.boolean()}).strict()});var HostInstallationSchema=HostInstallationHeaderSchema.extend({execution:AgentExecutionInstallationObservationSchema}).strict();var HostTaskCancelSchema=z5.strictObject({contract:z5.literal("nvs-agent-task-cancel/1"),hostContractDigest:z5.literal(HostProtocolDigest),requestId:z5.uuid(),originalRequestId:z5.uuid(),inputDigest:sha,installation:HostInstallationIdentitySchema}).refine(v=>v.requestId!==v.originalRequestId);var HostAuthorizationObservationSchema=z5.strictObject({schemaVersion:z5.literal(1),protocol:z5.literal("delegated-mcp-execution"),protocolVersion:z5.literal(1),contractDigest:z5.literal(HostDelegationDigest),capabilityDigest:sha,decision:z5.enum(["NOT_OBSERVED","ALLOW","DRAIN","DENY","UNKNOWN"]),checkedAt:time2,expiresAt:time2.optional(),hardExpiresAt:time2.optional(),leaseRevision:z5.int().positive().optional(),reasonCode:HostReferenceSchema.optional()});var HostTaskResponseSchema=z5.strictObject({contract:z5.literal("nvs-agent-task/1"),hostContractDigest:z5.literal(HostProtocolDigest),requestId:z5.uuid(),runKey:key3,inputDigest:sha,scope:HostScopeSchema,selection:HostChoiceSchema,installation:HostInstallationIdentitySchema,authorityRef:z5.uuid(),executionAuthorization:HostAuthorizationObservationSchema,status:z5.enum(["accepted","running","succeeded","failed","cancelled","unknown"]),cancelRequested:z5.boolean(),createdAt:time2,updatedAt:time2,timing:z5.strictObject({acceptedAt:time2,deadlineAt:time2,limitSource:z5.literal("TASK_POLICY")})}).refine(v=>Date.parse(v.updatedAt)>=Date.parse(v.createdAt)&&Date.parse(v.timing.deadlineAt)>Date.parse(v.timing.acceptedAt));var HostTaskRequestSchema=z5.strictObject({contract:z5.literal("nvs-agent-task/1"),hostContractDigest:z5.literal(HostProtocolDigest),requestId:z5.uuid(),scope:HostScopeSchema,selection:HostChoiceSchema,installation:HostInstallationIdentitySchema,inputDigest:sha,input:z5.record(z5.string(),z5.json()),authorization:z5.strictObject({authorityRef:z5.uuid(),expiresAt:time2,contractDigest:z5.literal(HostDelegationDigest),capabilityDigest:sha})});import{z as z6}from"zod";var sha2=z6.string().regex(/^[a-f0-9]{64}$/);var ReleaseLegacyHostExecutionSchema=AgentHostExecutionGetSchema.extend({requestId:z6.uuid(),expectedRevision:z6.int().positive(),hostRequestId:z6.uuid(),snapshotFingerprint:sha2,evidenceRef:z6.string().min(1).max(512).refine(v=>Array.from(v).every(c=>{const n=c.codePointAt(0);return n>=32&&(n<127||n>159)&&(n<55296||n>57343)})),evidenceSha256:sha2,decision:z6.literal("RELEASE_NATIVE_DISPATCH_FENCE")});var LegacyHostExecutionReleaseSchema=ReleaseLegacyHostExecutionSchema.extend({releasedByPrincipalId:z6.uuid(),releasedAt:z6.iso.datetime({offset:true})});import{z as z7}from"zod";var canonicalHostContractJson=canonicalFederationCatalogJson;var bounded=z7.unknown().refine(value=>{try{canonicalHostContractJson(value);return true}catch{return false}},{abort:true});var digest4=z7.string().regex(/^sha256:[a-f0-9]{64}$/);var jsonSchema=z7.record(z7.string(),z7.json());var operations={"installation.read":{method:"GET",path:"/nvs-agent-host/v1/installations/{installationId}"},"task.submit":{method:"POST",path:"/nvs-agent-host/v1/tasks"},"task.by-request":{method:"GET",path:"/nvs-agent-host/v1/tasks/by-request"},"task.get":{method:"GET",path:"/nvs-agent-host/v1/tasks/{runKey}"},"task.cancel":{method:"POST",path:"/nvs-agent-host/v1/tasks/{runKey}/cancel"}};var eventing={standard:"EventSDK",notificationProfile:"eventsdk/1.2",receiptProfile:"eventsdk/1.1",requiredForHostExecution:false,defaultReceive:false,subscriberKinds:["SYSTEM","AGENT_RUNTIME","HOST_BOT"],authorization:"INDEPENDENT_CURRENT_AUTHORITY",wake:"RECEIVER_OWNED",adoption:"RECEIVER_OWNER_GOAL_REQUIRED",receiptMeaning:"LOCAL_APPLIED_IS_NOT_AGENT_ADOPTION",operations:{catalog:"federation.catalog",select:"federation.subscription.set",read:"federation.subscription.get",handoff:"federation.subscription.handoff",contract:"federation.subscription.contract",resultReference:"federation.result.reference",resultRead:"federation.result.read",receiptInspection:"federation.delivery.inspect",receiptHandoff:"federation.receipt-inbound.handoff"}};var semanticChecks=["OPAQUE_SCOPE_IS_NOT_NATIVE_TENANT_MAPPING","JSON_SCHEMA_PLUS_SEMANTIC_CHECKS_REQUIRED","I_JSON_FINITE_PLAIN_DENSE_JSON_NO_DUPLICATE_KEYS_OR_LONE_SURROGATES","HOST_REFERENCES_1_TO_256_UNICODE_CODEPOINTS_WITHOUT_C0_C1_CONTROLS","CURRENT_REGISTRATION_CONSENT_GRANT_PERMIT_LEASE_ACCESS_REQUIRED","INSTALLATION_RECHECK_BEFORE_AND_AFTER_NATIVE_MANIFEST","INPUT_SHA256_CANONICAL_COMPLETE_INPUT_INCLUDING_NATIVE_PROOF","EXACT_REQUEST_INPUT_SCOPE_CHOICE_INSTALLATION_AUTHORITY_AND_TASK","RESPONSE_TIME_ORDER_FRESH_AUTHORIZATION_AND_DEADLINES_WITHIN_NATIVE_PROOF","SUBMIT_DEADLINE_INCLUDES_CREDENTIAL_ACCESS_AND_NATIVE_AUTHORITY_EXPIRY","NO_WRITE_BEFORE_DISPATCH_UNKNOWN_AFTER_DISPATCH_NO_AUTOMATIC_RETRY","RECOVERY_OBSERVES_ORIGINAL_REQUEST_WITHOUT_RESUBMISSION","CANCEL_USES_DISTINCT_REQUEST_AND_EXACT_ORIGINAL_TASK","HOST_REPORT_IS_NOT_PRODUCTION_TRUTH_OR_RESULT_ADOPTION","SUBSCRIPTION_EXECUTION_AND_CONTENT_AUTHORITY_ARE_INDEPENDENT"];var route=value=>z7.strictObject({method:z7.literal(value.method),path:z7.literal(value.path)});var AgentHostContractDocumentSchema=bounded.pipe(z7.strictObject({contract:z7.literal("nvs-agent-host-contract/1"),hostProtocol:z7.literal(HOST_PROTOCOL),hostContractDigest:z7.literal(HostProtocolDigest),delegationContractDigest:z7.literal(HostDelegationDigest),nativeSelectionVersion:z7.literal(2),nativeProfileVersion:z7.literal(2),schemaDialect:z7.literal("https://json-schema.org/draft/2020-12/schema"),origin:z7.literal("DEPLOYMENT_REGISTERED_ONLY"),credential:z7.literal("PRIVATE_BEARER_NEVER_HUMAN_TOKEN"),scopeQuery:z7.tuple([z7.literal("scopeNamespace"),z7.literal("scopeRef")]),requestQuery:z7.literal("requestId"),operations:z7.strictObject({"installation.read":route(operations["installation.read"]),"task.submit":route(operations["task.submit"]),"task.by-request":route(operations["task.by-request"]),"task.get":route(operations["task.get"]),"task.cancel":route(operations["task.cancel"])}),schemas:z7.strictObject({selection:jsonSchema,installation:jsonSchema,taskRequest:jsonSchema,taskResponse:jsonSchema,taskCancel:jsonSchema}),semanticChecks:z7.array(z7.enum(semanticChecks)).length(semanticChecks.length).refine(values=>values.every((v,i)=>v===semanticChecks[i])),maxTaskBytes:z7.literal(131072),currentAuthority:z7.literal("NOT_OBSERVED"),eventing:z7.strictObject({standard:z7.literal(eventing.standard),notificationProfile:z7.literal(eventing.notificationProfile),receiptProfile:z7.literal(eventing.receiptProfile),requiredForHostExecution:z7.literal(false),defaultReceive:z7.literal(false),subscriberKinds:z7.tuple([z7.literal("SYSTEM"),z7.literal("AGENT_RUNTIME"),z7.literal("HOST_BOT")]),authorization:z7.literal(eventing.authorization),wake:z7.literal(eventing.wake),adoption:z7.literal(eventing.adoption),receiptMeaning:z7.literal(eventing.receiptMeaning),operations:z7.strictObject({catalog:z7.literal(eventing.operations.catalog),select:z7.literal(eventing.operations.select),read:z7.literal(eventing.operations.read),handoff:z7.literal(eventing.operations.handoff),contract:z7.literal(eventing.operations.contract),resultReference:z7.literal(eventing.operations.resultReference),resultRead:z7.literal(eventing.operations.resultRead),receiptInspection:z7.literal(eventing.operations.receiptInspection),receiptHandoff:z7.literal(eventing.operations.receiptHandoff)})}),qualification:z7.literal("NVS_DECLARATION_ONLY")}));var AgentHostContractInputSchema=AgentHostScopeSchema.extend({expectedDigest:digest4.optional()}).strict();var AgentHostContractSchema=bounded.pipe(AgentHostScopeSchema.extend({document:AgentHostContractDocumentSchema,digest:digest4,maxReplyBytes:z7.literal(131072)}).strict());function createAgentHostContractDocument(){const schema=value=>z7.toJSONSchema(value,{target:"draft-2020-12",io:"input"});return AgentHostContractDocumentSchema.parse({contract:"nvs-agent-host-contract/1",hostProtocol:HOST_PROTOCOL,hostContractDigest:HostProtocolDigest,delegationContractDigest:HostDelegationDigest,nativeSelectionVersion:2,nativeProfileVersion:2,schemaDialect:"https://json-schema.org/draft/2020-12/schema",origin:"DEPLOYMENT_REGISTERED_ONLY",credential:"PRIVATE_BEARER_NEVER_HUMAN_TOKEN",scopeQuery:["scopeNamespace","scopeRef"],requestQuery:"requestId",operations,schemas:{selection:schema(CurrentHostSelectionSchema),installation:schema(HostInstallationSchema),taskRequest:schema(HostTaskRequestSchema),taskResponse:schema(HostTaskResponseSchema),taskCancel:schema(HostTaskCancelSchema)},semanticChecks,maxTaskBytes:131072,currentAuthority:"NOT_OBSERVED",eventing,qualification:"NVS_DECLARATION_ONLY"})}export{CurrentAgentExecutionProfileSchema,HostInstallationIdentitySchema,HostInstallationSchema,HostTaskCancelSchema,HostTaskResponseSchema,HostTaskRequestSchema,ReleaseLegacyHostExecutionSchema,LegacyHostExecutionReleaseSchema,canonicalHostContractJson,AgentHostContractDocumentSchema,AgentHostContractInputSchema,AgentHostContractSchema,createAgentHostContractDocument};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HumanLinksSchema,InterfaceSemanticStatusSchema,NextActionSchema,OperationIdSchema,ProductionIdSchema,ProductionStateSchema,TenantIdSchema,WorkSummarySchema}from"./chunk-AFUVP2DC.js";import{z}from"zod";var HOST_PROTOCOL="NVS_AGENT_HOST_V1";var HostProtocolDocument={protocol:HOST_PROTOCOL,schemaVersion:1,authorityOwner:"native-video-studio",root:"/nvs-agent-host/v1",scope:["namespace","ref"],selection:["agentKey","agentVersion","modelOptionKey"],operations:["installation.read","task.submit","task.by-request","task.get","task.cancel"],correlation:["requestId","inputDigest","installationId","installationRevisionId","authorityRef"],outcomes:["accepted","running","succeeded","failed","cancelled","unknown"],semantics:"HOST_REPORTED_ONLY"};var HostDelegationDocument={protocol:"delegated-mcp-execution",protocolVersion:1,profileVersion:2,authorityOwner:"native-video-studio",hostProtocol:HOST_PROTOCOL,transportProfile:"stateless-json-v1",authorization:["registration","consent","grant","permit","lease","access"],assertionSeconds:60,clockSkewSeconds:5,executionMaxSeconds:21600};var HostProtocolDigest="c4b254f091c364e0fab8d43ad551f296a3bce2996bdb2c5349307c62295c1769";var HostDelegationDigest="03e0bad50c7c6ecf7979db72c0927fa43904d8fbad67ae02447a87a9263f2730";var HostReferenceSchema=z.string().min(1).max(256).refine(v=>Array.from(v).every(c=>{const n=c.codePointAt(0);return n>=32&&(n<127||n>159)&&(n<55296||n>57343)}));var HostScopeSchema=z.strictObject({namespace:HostReferenceSchema,ref:HostReferenceSchema});var HostChoiceSchema=z.strictObject({agentKey:HostReferenceSchema,agentVersion:HostReferenceSchema,modelOptionKey:HostReferenceSchema});var CurrentHostSelectionSchema=HostChoiceSchema.extend({contractVersion:z.literal(2),hostKey:z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),hostScope:HostScopeSchema}).strict();var HistoricalHostSelectionSchema=z.object({hostKey:z.string().min(1).max(64)}).catchall(z.union([HostReferenceSchema,z.number().int().nonnegative()])).refine(v=>!Object.hasOwn(v,"contractVersion")&&Object.keys(v).length<=32);var HostBearerSchema=z.string().min(16).max(4096).regex(/^[A-Za-z0-9._~+/-]+={0,2}$/).meta({writeOnly:true});var CurrentHostInstallationTransportSchema=z.strictObject({protocol:z.literal(HOST_PROTOCOL),hostContractDigest:z.literal(HostProtocolDigest),installationId:z.string().regex(/^[A-Za-z0-9_-]{1,160}$/),installationRevisionId:z.string().regex(/^[A-Za-z0-9_-]{1,160}$/),slotKey:z.string().regex(/^[a-z0-9_-]{1,64}$/),contractDigest:z.literal(HostDelegationDigest),capabilityDigest:z.string().regex(/^[a-f0-9]{64}$/)});var HistoricalHostTransportSchema=z.strictObject({protocol:HostReferenceSchema.refine(v=>v!==HOST_PROTOCOL),installationId:HostReferenceSchema,installationRevisionId:HostReferenceSchema,slotKey:HostReferenceSchema,contractDigest:z.string().regex(/^[a-f0-9]{64}$/).optional(),capabilityDigest:z.string().regex(/^[a-f0-9]{64}$/).optional()});import{z as z3}from"zod";import{z as z2}from"zod";var Id=z2.uuid().toLowerCase();var ReadId=z2.uuid().regex(/^[0-9a-f-]{36}$/);var Key=z2.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);var Revision=z2.int().min(0).max(999999999);var AgentHostScopeSchema=z2.strictObject({tenantId:Id,projectId:Id});var ReadScope=z2.strictObject({tenantId:ReadId,projectId:ReadId});var AgentHostSelectionSchema=CurrentHostSelectionSchema;var AgentHostReadSelectionSchema=z2.union([CurrentHostSelectionSchema,HistoricalHostSelectionSchema]);var ConfigureAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z2.int().min(0).max(999999998),selection:AgentHostSelectionSchema,apiCredential:HostBearerSchema});var RevokeAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z2.int().min(1).max(999999998)});var AgentHostBindingSchema=ReadScope.extend({bindingId:ReadId,revision:Revision.refine(value=>value>0),configurationVersion:Revision.refine(value=>value>0),enabled:z2.boolean(),selection:AgentHostReadSelectionSchema,updatedAt:z2.iso.datetime({offset:true})}).refine(value=>value.configurationVersion<=value.revision);var CurrentAgentHostBindingSchema=AgentHostBindingSchema.safeExtend({selection:CurrentHostSelectionSchema});var UpdateAgentHostSelectionSchema=ConfigureAgentHostSchema.omit({apiCredential:true}).extend({expectedRevision:z2.int().min(1).max(999999998),expectedConfigurationVersion:z2.int().positive().max(999999998)});var AgentHostCurrentSchema=z2.strictObject({binding:AgentHostBindingSchema.nullable()});var AgentHostHistoryQuerySchema=AgentHostScopeSchema.extend({limit:z2.int().min(1).max(100).default(20),beforeVersion:z2.int().positive().max(999999999).optional()});var AgentHostConfigurationVersionSchema=ReadScope.extend({bindingId:ReadId,version:z2.int().positive().max(999999999),selection:AgentHostReadSelectionSchema,createdByPrincipalId:ReadId,createdAt:z2.iso.datetime({offset:true}),revokedAt:z2.iso.datetime({offset:true}).nullable()});var AgentHostHistoryPageSchema=z2.strictObject({items:z2.array(AgentHostConfigurationVersionSchema).max(100),hasMore:z2.boolean(),nextBeforeVersion:z2.int().positive().max(999999999).nullable()}).refine(page2=>page2.hasMore===(page2.nextBeforeVersion!==null)&&(!page2.hasMore||page2.items.length>0));var AgentHostReadinessSchema=ReadScope.extend({binding:AgentHostBindingSchema.nullable(),registeredHostKeys:z2.array(Key).max(16),configurationStatus:z2.enum(["NOT_CONFIGURED","REVOKED","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CONFIGURATION_CHANGED","CONFIGURED"]),remoteCredentialVerification:z2.enum(["NOT_CHECKED","VERIFIED"]),nativeToolAuthority:z2.enum(["NOT_CONNECTED","UNVERIFIED","VERIFIED"]),executionAvailability:z2.enum(["UNAVAILABLE","AVAILABLE"]),reason:z2.enum(["NATIVE_TOOL_AUTHORITY_NOT_CONNECTED","NATIVE_TOOL_AUTHORITY_NOT_QUALIFIED","CONFIGURATION_CHANGED"]).nullable(),checkedAt:z2.iso.datetime({offset:true})}).refine(v=>{const verified=v.nativeToolAuthority==="VERIFIED";return(v.binding===null||v.binding.tenantId===v.tenantId&&v.binding.projectId===v.projectId)&&verified===(v.remoteCredentialVerification==="VERIFIED")&&verified===(v.executionAvailability==="AVAILABLE")&&verified===(v.reason===null)&&(!verified||v.configurationStatus==="CONFIGURED"&&v.binding?.enabled===true)});var AgentHostFailureSchema=z2.strictObject({semanticStatus:z2.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z2.strictObject({code:z2.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","REVISION_CONFLICT","REQUEST_CONFLICT","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CREDENTIAL_SCOPE_MISMATCH","BINDING_REVOKED","INTERNAL_OPERATIONAL_FAILURE"]),message:z2.literal("Agent Host operation did not complete")})});var id=z3.uuid().regex(/^[0-9a-f-]{36}$/);var requestId=z3.uuid().toLowerCase();var key=z3.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var NativeRuntimePublicKeySchema=z3.strictObject({kty:z3.literal("EC"),crv:z3.literal("P-256"),x:z3.string().regex(/^[A-Za-z0-9_-]{43}$/),y:z3.string().regex(/^[A-Za-z0-9_-]{43}$/)});var ConfigureNativeToolGrantSchema=AgentHostScopeSchema.extend({requestId,bindingId:requestId,expectedBindingRevision:z3.int().positive(),expectedConfigurationVersion:z3.int().positive(),runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,expiresAt:z3.iso.datetime({offset:true})});var NativeToolGrantGetSchema=AgentHostScopeSchema.extend({grantId:requestId});var RevokeNativeToolGrantSchema=NativeToolGrantGetSchema.extend({requestId,expectedRevision:z3.int().positive()});var NativeRuntimeProofRequestSchema=NativeToolGrantGetSchema.extend({assertion:z3.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).max(4096).meta({writeOnly:true})});var NativeRuntimeStatusClaimsSchema=z3.strictObject({iss:key,sub:key,aud:z3.url().max(2048),grantId:id,installationRevisionId:key,jti:id,iat:z3.int().nonnegative(),exp:z3.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeRuntimeProofClaimsSchema=z3.strictObject({iss:key,sub:key,aud:z3.url().max(2048),grantId:id,grantRevision:z3.int().positive(),installationRevisionId:key,challengeId:id,jti:id,iat:z3.int().nonnegative(),exp:z3.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeToolGrantViewSchema=z3.strictObject({tenantId:id,projectId:id}).extend({protocol:z3.literal("NATIVESTUDIO_RUNTIME_REGISTRATION_V1"),grantId:id,bindingId:id,bindingRevision:z3.int().positive(),configurationVersion:z3.int().positive(),selection:AgentHostReadSelectionSchema,runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,resource:z3.url().max(2048),revision:z3.int().positive(),enabled:z3.boolean(),createdByPrincipalId:id,runtimePrincipalId:id,createdAt:z3.iso.datetime({offset:true}),expiresAt:z3.iso.datetime({offset:true}),challengeId:id,challengeExpiresAt:z3.iso.datetime({offset:true}),verifiedAt:z3.iso.datetime({offset:true}).nullable(),revokedAt:z3.iso.datetime({offset:true}).nullable()}).refine(v=>{const resource=new URL(v.resource);return resource.protocol==="https:"&&!resource.username&&!resource.password&&!resource.search&&!resource.hash&&resource.pathname===`/mcp/native/v1/projects/${v.projectId}`&&v.enabled===(v.revokedAt===null)&&Date.parse(v.challengeExpiresAt)<=Date.parse(v.expiresAt)});import{z as z4}from"zod";var EXTERNAL_EVENT_TYPES=["production.work_changed","production.started","production.failed","production.cancelled","finding.opened","artifact.created","shot.candidate_ready","shot.accepted","review.completed","rough_cut.ready","final_render.ready","approval.required","production.completed","delivery.validation_failed"];var ExternalEventTypeSchema=z4.enum(EXTERNAL_EVENT_TYPES);var LifecycleEventScopeSchema=z4.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema}).strict();var ExternalLifecycleEventSchema=z4.object({schemaVersion:z4.literal(1),eventId:z4.uuid(),tenantId:TenantIdSchema,productionId:ProductionIdSchema,projectId:z4.uuid(),type:ExternalEventTypeSchema,target:z4.object({type:z4.string().min(1).max(60),id:z4.uuid()}).strict(),occurredAt:z4.iso.datetime(),basis:z4.object({productionRevision:z4.number().int().positive()}).strict(),payload:z4.object({sourceEventType:z4.string().min(1).max(100),artifactId:z4.uuid().optional(),candidateId:z4.uuid().optional(),reviewId:z4.uuid().optional(),findingId:z4.uuid().optional(),shotId:z4.uuid().optional(),manifestId:z4.uuid().optional(),validationId:z4.uuid().optional(),action:z4.string().max(40).optional(),result:z4.string().max(40).optional(),executionClass:z4.enum(["LIVE","TEST_ONLY"]).optional()}).strict()}).strict();var WebhookEndpointSchema=z4.url().max(2048).refine(value=>{const u=new URL(value);return u.protocol==="https:"&&!u.username&&!u.password&&!u.hash&&(!u.port||u.port==="443")&&!u.hostname.startsWith("[")});var ConfigureWebhookSchema=LifecycleEventScopeSchema.extend({subscriptionId:z4.uuid(),expectedRevision:z4.number().int().nonnegative(),idempotencyKey:z4.string().min(1).max(128),endpoint:WebhookEndpointSchema,eventTypes:z4.array(ExternalEventTypeSchema).min(1).max(EXTERNAL_EVENT_TYPES.length).refine(v=>new Set(v).size===v.length),signingSecret:z4.string().min(32).max(256)}).strict();var PrepareWebhookSecretSchema=LifecycleEventScopeSchema.extend({subscriptionId:z4.uuid(),secretRef:z4.uuid(),signingSecret:z4.string().min(32).max(256)}).strict();var WebhookSecretReferenceSchema=PrepareWebhookSecretSchema.omit({signingSecret:true});var ConfigureWebhookReferenceSchema=ConfigureWebhookSchema.omit({signingSecret:true}).extend({secretRef:z4.uuid()}).strict();var WebhookAvailabilitySchema=z4.discriminatedUnion("status",[z4.strictObject({status:z4.literal("AVAILABLE"),reason:z4.literal("SIGNING_STORAGE_READY")}),z4.strictObject({status:z4.literal("UNCONFIGURED"),reason:z4.literal("SIGNING_STORAGE_NOT_CONFIGURED")}),z4.strictObject({status:z4.literal("UNAVAILABLE"),reason:z4.literal("SIGNING_STORAGE_UNAVAILABLE")})]);var DisableWebhookSchema=LifecycleEventScopeSchema.extend({subscriptionId:z4.uuid(),expectedRevision:z4.number().int().positive(),idempotencyKey:z4.string().min(1).max(128)}).strict();var ReplayWebhookSchema=DisableWebhookSchema.extend({eventId:z4.uuid()}).strict();var QueryLifecycleEventsSchema=LifecycleEventScopeSchema.extend({kind:z4.enum(["subscriptions","events","deliveries","attempts"]),subscriptionId:z4.uuid().optional(),deliveryId:z4.uuid().optional(),after:z4.uuid().optional(),limit:z4.number().int().min(1).max(50).default(20)}).strict().refine(v=>v.kind!=="attempts"||!!v.deliveryId);var WebhookSubscriptionSchema=LifecycleEventScopeSchema.extend({subscriptionId:z4.uuid(),version:z4.number().int().positive(),revision:z4.number().int().positive(),state:z4.enum(["ACTIVE","DISABLED","DEGRADED"]),endpoint:WebhookEndpointSchema,eventTypes:z4.array(ExternalEventTypeSchema),updatedAt:z4.iso.datetime()}).strict();import{z as z5}from"zod";var ProductionEventCursorSchema=z5.strictObject({v:z5.literal(1),t:z5.uuid(),p:z5.uuid(),e:z5.uuid(),n:z5.string().regex(/^(0|[1-9][0-9]{0,18})$/)});var ProductionFeedbackInputSchema=LifecycleEventScopeSchema.extend({operationId:OperationIdSchema.optional(),ifNoneMatch:z5.string().regex(/^[a-f0-9]{64}$/).optional()}).strict();var ProductionFeedbackSchema=LifecycleEventScopeSchema.extend({projectId:z5.uuid(),operationId:OperationIdSchema.nullable(),productionRevision:z5.int().positive(),state:ProductionStateSchema,semanticStatus:InterfaceSemanticStatusSchema,work:WorkSummarySchema,blockers:z5.array(z5.string().min(1).max(1e3)).max(100),nextActions:z5.array(NextActionSchema).max(50),media:z5.strictObject({previewReady:z5.boolean(),finalRenderReady:z5.boolean(),deliveryComplete:z5.boolean()}),humanLinks:HumanLinksSchema}).strict();var ProductionFeedbackResultSchema=LifecycleEventScopeSchema.extend({condition:z5.enum(["CURRENT","NOT_MODIFIED"]),etag:z5.string().regex(/^[a-f0-9]{64}$/),cursor:z5.string().min(1).max(4096),retryAfterMs:z5.int().min(1e3).max(3e4),feedback:ProductionFeedbackSchema.nullable()}).strict().refine(v=>v.condition==="CURRENT"===(v.feedback!==null));var ReadProductionEventsSchema=ProductionFeedbackInputSchema.extend({after:z5.string().min(1).max(4096).optional(),start:z5.enum(["CURRENT","BEGINNING"]).default("CURRENT"),limit:z5.int().min(1).max(50).default(20)}).strict();var ProductionEventReadSchema=z5.strictObject({items:z5.array(ExternalLifecycleEventSchema).max(50),nextCursor:z5.string().min(1).max(4096),watermark:z5.string().min(1).max(4096),hasMore:z5.boolean(),current:ProductionFeedbackResultSchema});import{z as z6}from"zod";function orderedFederationWindow(value){return Date.parse(value.notBefore)<Date.parse(value.expiresAt)}var FederationFailureCodeSchema=z6.enum(["FEDERATION_FORBIDDEN","FEDERATION_UNCONFIGURED","FEDERATION_INVALID_INPUT","FEDERATION_INVALID_ID","FEDERATION_INVALID_REFERENCE","FEDERATION_INVALID_MODE","FEDERATION_INVALID_GRANT_VERSION","FEDERATION_INVALID_REVISION","FEDERATION_INVALID_STATE","FEDERATION_INVALID_SOURCE","FEDERATION_INVALID_VALIDITY","FEDERATION_REMOTE_SERVICE_REQUIRED","FEDERATION_EVENT_NOT_ALLOWED","FEDERATION_EVENT_NOT_SELECTED","FEDERATION_SCOPE_MISMATCH","FEDERATION_PRODUCTION_NOT_FOUND","FEDERATION_ROUTE_NOT_FOUND","FEDERATION_STREAM_NOT_FOUND","FEDERATION_CONNECTION_CONFLICT","FEDERATION_GRANT_CONFLICT","FEDERATION_GRANT_VERSION_CONFLICT","FEDERATION_ROUTE_IDENTITY_CONFLICT","FEDERATION_REVISION_CONFLICT","FEDERATION_IDEMPOTENCY_CONFLICT","FEDERATION_CONCURRENT_CHANGE","FEDERATION_ROUTE_CAPACITY","FEDERATION_SUBSCRIPTION_CAPACITY","FEDERATION_SUBSCRIPTION_NOT_FOUND","FEDERATION_SUBSCRIBER_IDENTITY_CONFLICT","FEDERATION_SUBSCRIPTION_CANCELLED","FEDERATION_INITIAL_SELECTION_REQUIRED","FEDERATION_SELECTION_EXCEEDS_AUTHORITY","FEDERATION_SELECTION_EXCEEDS_GRANT","FEDERATION_RESYNC_REQUIRED","FEDERATION_GAP_NOT_REPAIRED","FEDERATION_HOLD_REQUIRED","FEDERATION_RECOVERY_EXHAUSTED","FEDERATION_BINDING_NOT_FOUND","FEDERATION_INBOX_NOT_FOUND","FEDERATION_INBOUND_CONFLICT","FEDERATION_INBOX_NOT_QUARANTINED","FEDERATION_RESULT_NOT_FOUND","FEDERATION_RESULT_MISMATCH","FEDERATION_CONTRACT_MISMATCH","FEDERATION_RECEIPT_ROUTE_NOT_FOUND","FEDERATION_RECEIPT_DELIVERY_NOT_FOUND","FEDERATION_RECEIPT_CONFLICT"]);var ref=z6.string().min(1).max(256).refine(v=>Array.from(v).every(c=>{const code=c.codePointAt(0);return code>=32&&code!==127&&(code<55296||code>57343)}));var types=z6.array(ExternalEventTypeSchema).min(1).max(14).refine(v=>new Set(v).size===v.length);var uuid=z6.uuid().toLowerCase();var FederationScopeSchema=LifecycleEventScopeSchema.extend({tenantId:uuid.brand(),productionId:uuid.brand()});var routeInput=FederationScopeSchema.extend({routeId:uuid,requestId:ref,expectedRevision:z6.int().nonnegative(),remoteService:ref,remoteTenant:ref,grantRef:ref,grantVersion:z6.int().min(1).max(2147483647),grantEventTypes:types,selectedEventTypes:types,notBefore:z6.iso.datetime(),expiresAt:z6.iso.datetime(),state:z6.enum(["ACTIVE","PAUSED"]),publicationMode:z6.enum(["FIXED","ON_DEMAND"]).default("ON_DEMAND")}).strict();var FederationRouteConfigureSchema=routeInput.refine(orderedFederationWindow).refine(v=>v.selectedEventTypes.every(type=>v.grantEventTypes.includes(type)));var FederationRouteSchema=routeInput.omit({requestId:true,expectedRevision:true}).extend({connectionRef:ref,source:z6.string().min(1).max(2048),serviceRef:z6.literal("native-video-studio"),revision:z6.int().positive(),epoch:uuid,position:z6.string().regex(/^(0|[1-9][0-9]{0,18})$/),gap:z6.boolean(),publicationMode:z6.enum(["FIXED","ON_DEMAND"]).default("FIXED")}).strict();var FederationSubscriptionSetSchema=FederationScopeSchema.extend({subscriptionId:uuid,routeId:uuid,requestId:ref,expectedRevision:z6.int().nonnegative(),subscriberKind:z6.enum(["SYSTEM","AGENT_RUNTIME","HOST_BOT"]),subscriberRef:ref,eventTypes:types,expiresAt:z6.iso.datetime(),state:z6.enum(["ACTIVE","PAUSED","CANCELLED"])}).strict();var FederationSubscriptionGetSchema=FederationScopeSchema.extend({subscriptionId:uuid}).strict();var FederationSubscriptionSchema=FederationSubscriptionSetSchema.omit({requestId:true,expectedRevision:true}).extend({revision:z6.int().positive(),startCursor:z6.string().min(1).max(4096),effective:z6.enum(["ACTIVE","PAUSED","CANCELLED","EXPIRED","BLOCKED"])}).strict();var FederationBootstrapSchema=FederationScopeSchema.extend({cursor:z6.string().min(1).max(4096),feedback:ProductionFeedbackSchema}).strict().refine(v=>v.tenantId===v.feedback.tenantId&&v.productionId===v.feedback.productionId);var FederationSubscriptionResultSchema=FederationScopeSchema.extend({subscription:FederationSubscriptionSchema,bootstrap:FederationBootstrapSchema}).strict().refine(v=>v.tenantId===v.subscription.tenantId&&v.productionId===v.subscription.productionId&&v.bootstrap.tenantId===v.tenantId&&v.bootstrap.productionId===v.productionId);var FederationCatalogSchema=FederationScopeSchema.extend({configuration:z6.enum(["CONFIGURED","UNCONFIGURED"]),transport:z6.literal("NOT_OBSERVED"),profile:z6.literal("eventsdk/1.2"),runtimeSubscription:z6.literal("EXPLICIT_SELECTION"),runtimeWake:z6.literal("RECEIVER_OWNED"),defaultPublication:z6.literal(false),bootstrap:FederationBootstrapSchema,routes:z6.array(FederationRouteSchema).max(32),events:z6.array(z6.strictObject({type:ExternalEventTypeSchema,wireType:ref,dataschema:ref,defaultEnabled:z6.literal(false)})).max(14)}).strict().refine(v=>v.routes.every(r=>r.tenantId===v.tenantId&&r.productionId===v.productionId)&&v.bootstrap.tenantId===v.tenantId&&v.bootstrap.productionId===v.productionId);var FederationQuerySchema=FederationScopeSchema.extend({kind:z6.enum(["routes","subscriptions","deliveries"]),routeId:uuid.optional(),eventId:uuid.optional(),deliveryId:z6.string().regex(/^[0-9a-f]{64}$/).optional(),after:z6.string().min(1).max(64).optional(),limit:z6.int().min(1).max(50).default(20)}).strict().refine(v=>!v.after||(v.kind==="deliveries"?/^[0-9a-f]{64}$/.test(v.after):z6.uuid().safeParse(v.after).success)).refine(v=>v.kind==="deliveries"||!v.eventId&&!v.deliveryId);var FederationDeliverySchema=FederationScopeSchema.extend({routeId:uuid,eventId:uuid,deliveryId:z6.string().regex(/^[0-9a-f]{64}$/),eventType:ExternalEventTypeSchema,state:z6.enum(["PENDING","UNKNOWN","PUBLISHED","HOLD"]),attempts:z6.int().nonnegative(),acknowledgement:z6.enum(["BROKER_STORED","NOT_CONFIRMED"]),reason:z6.string().max(100).nullable()}).strict();var page=(kind,item)=>FederationScopeSchema.extend({kind:z6.literal(kind),items:z6.array(item).max(50),next:(kind==="deliveries"?z6.string().regex(/^[0-9a-f]{64}$/):uuid).nullable()}).strict();var FederationQueryResultSchema=z6.discriminatedUnion("kind",[page("routes",FederationRouteSchema),page("subscriptions",FederationSubscriptionSchema),page("deliveries",FederationDeliverySchema)]).refine(v=>v.items.every(item=>{const r=item;return r.tenantId===v.tenantId&&r.productionId===v.productionId}));var FederationReceiptInputSchema=FederationScopeSchema.extend({requestId:ref}).strict();var FederationRecoverSchema=FederationScopeSchema.extend({kind:z6.enum(["RETRY_HOLD","REPAIR_GAP"]),routeId:uuid,requestId:ref,expectedRevision:z6.int().positive(),reason:ref,deliveryId:z6.string().regex(/^[0-9a-f]{64}$/).optional(),expectedAttempts:z6.int().nonnegative().optional(),acknowledgeDuplicateRisk:z6.literal(true).optional()}).strict().refine(v=>v.kind==="RETRY_HOLD"?v.deliveryId!==void 0&&v.expectedAttempts!==void 0&&v.acknowledgeDuplicateRisk===true:v.deliveryId===void 0&&v.expectedAttempts===void 0&&v.acknowledgeDuplicateRisk===void 0);var FederationRecoverySchema=FederationScopeSchema.extend({kind:z6.enum(["RETRY_HOLD","REPAIR_GAP"]),requestId:ref,recoveryId:uuid,routeId:uuid,revision:z6.int().positive(),epoch:uuid,position:z6.string().regex(/^(0|[1-9][0-9]{0,18})$/),gap:z6.boolean(),deliveryId:z6.string().regex(/^[0-9a-f]{64}$/).nullable(),attempts:z6.int().nonnegative().nullable(),recoveryCount:z6.int().min(0).max(3).nullable(),effect:z6.literal("TRANSPORT_ONLY")}).strict().refine(v=>v.kind==="RETRY_HOLD"?v.deliveryId!==null&&v.attempts!==null&&v.recoveryCount!==null&&v.recoveryCount>0:v.deliveryId===null&&v.attempts===null&&v.recoveryCount===null&&!v.gap);var FederationObservationSchema=FederationScopeSchema.extend({asOf:z6.iso.datetime(),routes:z6.array(z6.strictObject({routeId:uuid,state:z6.enum(["ACTIVE","PAUSED"]),gap:z6.boolean(),position:z6.string(),sourceHead:z6.string().nullable(),sourceLag:z6.string().nullable(),pending:z6.int().nonnegative(),unknown:z6.int().nonnegative(),hold:z6.int().nonnegative(),published:z6.int().nonnegative(),demandBlocked:z6.int().nonnegative(),inFlight:z6.int().nonnegative(),oldestUnsettledEventAt:z6.iso.datetime().nullable(),lastTickAt:z6.iso.datetime().nullable(),faultCode:z6.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/).nullable()})).max(32),workers:z6.array(z6.strictObject({source:z6.string().min(1).max(2048),workerRef:ref,instanceId:uuid,status:z6.enum(["STARTING","CONNECTED","RECONNECTING","DISABLED","SHADOW","CONFIGURATION_ERROR","STOPPED"]),observedAt:z6.iso.datetime(),configurationRevision:z6.string().regex(/^sha256:[a-f0-9]{64}$/).nullable(),fresh:z6.boolean(),connected:z6.boolean()})).max(32),workersTruncated:z6.boolean(),meaning:z6.literal("BROKER_ACK_IS_NOT_APPLIED")}).strict();var FederationReceiptSchema=FederationReceiptInputSchema.extend({result:z6.union([FederationRouteSchema,FederationSubscriptionResultSchema,FederationRecoverySchema]).nullable()}).strict().refine(v=>!v.result||v.result.tenantId===v.tenantId&&v.result.productionId===v.productionId);export{HOST_PROTOCOL,HostProtocolDocument,HostDelegationDocument,HostProtocolDigest,HostDelegationDigest,HostReferenceSchema,HostScopeSchema,HostChoiceSchema,CurrentHostSelectionSchema,CurrentHostInstallationTransportSchema,HistoricalHostTransportSchema,AgentHostScopeSchema,AgentHostSelectionSchema,AgentHostReadSelectionSchema,ConfigureAgentHostSchema,RevokeAgentHostSchema,AgentHostBindingSchema,UpdateAgentHostSelectionSchema,AgentHostCurrentSchema,AgentHostHistoryQuerySchema,AgentHostHistoryPageSchema,AgentHostReadinessSchema,NativeRuntimePublicKeySchema,ConfigureNativeToolGrantSchema,NativeToolGrantGetSchema,RevokeNativeToolGrantSchema,NativeRuntimeProofRequestSchema,NativeToolGrantViewSchema,ExternalEventTypeSchema,LifecycleEventScopeSchema,ExternalLifecycleEventSchema,ConfigureWebhookSchema,PrepareWebhookSecretSchema,WebhookSecretReferenceSchema,ConfigureWebhookReferenceSchema,WebhookAvailabilitySchema,DisableWebhookSchema,ReplayWebhookSchema,QueryLifecycleEventsSchema,WebhookSubscriptionSchema,ProductionFeedbackInputSchema,ProductionFeedbackResultSchema,ReadProductionEventsSchema,ProductionEventReadSchema,orderedFederationWindow,FederationFailureCodeSchema,FederationScopeSchema,FederationRouteConfigureSchema,FederationRouteSchema,FederationSubscriptionSetSchema,FederationSubscriptionGetSchema,FederationSubscriptionResultSchema,FederationCatalogSchema,FederationQuerySchema,FederationDeliverySchema,FederationQueryResultSchema,FederationReceiptInputSchema,FederationRecoverSchema,FederationRecoverySchema,FederationObservationSchema,FederationReceiptSchema};
|
|
1
|
+
import{HumanLinksSchema,InterfaceSemanticStatusSchema,NextActionSchema,OperationIdSchema,ProductionIdSchema,ProductionStateSchema,TenantIdSchema,WorkSummarySchema}from"./chunk-AFUVP2DC.js";import{z}from"zod";var HOST_PROTOCOL="NVS_AGENT_HOST_V1";var HostProtocolDocument={protocol:HOST_PROTOCOL,schemaVersion:1,authorityOwner:"native-video-studio",root:"/nvs-agent-host/v1",scope:["namespace","ref"],selection:["agentKey","agentVersion","modelOptionKey"],operations:["installation.read","task.submit","task.by-request","task.get","task.cancel"],correlation:["requestId","inputDigest","installationId","installationRevisionId","authorityRef"],outcomes:["accepted","running","succeeded","failed","cancelled","unknown"],semantics:"HOST_REPORTED_ONLY"};var HostDelegationDocument={protocol:"delegated-mcp-execution",protocolVersion:1,profileVersion:2,authorityOwner:"native-video-studio",hostProtocol:HOST_PROTOCOL,transportProfile:"stateless-json-v1",authorization:["registration","consent","grant","permit","lease","access"],assertionSeconds:60,clockSkewSeconds:5,executionMaxSeconds:21600};var HostProtocolDigest="c4b254f091c364e0fab8d43ad551f296a3bce2996bdb2c5349307c62295c1769";var HostDelegationDigest="03e0bad50c7c6ecf7979db72c0927fa43904d8fbad67ae02447a87a9263f2730";var HostReferenceSchema=z.string().min(1).max(256).refine(v=>Array.from(v).every(c=>{const n=c.codePointAt(0);return n>=32&&(n<127||n>159)&&(n<55296||n>57343)}));var HostScopeSchema=z.strictObject({namespace:HostReferenceSchema,ref:HostReferenceSchema});var HostChoiceSchema=z.strictObject({agentKey:HostReferenceSchema,agentVersion:HostReferenceSchema,modelOptionKey:HostReferenceSchema});var CurrentHostSelectionSchema=HostChoiceSchema.extend({contractVersion:z.literal(2),hostKey:z.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/),hostScope:HostScopeSchema}).strict();var HistoricalHostSelectionSchema=z.object({hostKey:z.string().min(1).max(64)}).catchall(z.union([HostReferenceSchema,z.number().int().nonnegative()])).refine(v=>!Object.hasOwn(v,"contractVersion")&&Object.keys(v).length<=32);var HostBearerSchema=z.string().min(16).max(4096).regex(/^[A-Za-z0-9._~+/-]+={0,2}$/).meta({writeOnly:true});var CurrentHostInstallationTransportSchema=z.strictObject({protocol:z.literal(HOST_PROTOCOL),hostContractDigest:z.literal(HostProtocolDigest),installationId:z.string().regex(/^[A-Za-z0-9_-]{1,160}$/),installationRevisionId:z.string().regex(/^[A-Za-z0-9_-]{1,160}$/),slotKey:z.string().regex(/^[a-z0-9_-]{1,64}$/),contractDigest:z.literal(HostDelegationDigest),capabilityDigest:z.string().regex(/^[a-f0-9]{64}$/)});var HistoricalHostTransportSchema=z.strictObject({protocol:HostReferenceSchema.refine(v=>v!==HOST_PROTOCOL),installationId:HostReferenceSchema,installationRevisionId:HostReferenceSchema,slotKey:HostReferenceSchema,contractDigest:z.string().regex(/^[a-f0-9]{64}$/).optional(),capabilityDigest:z.string().regex(/^[a-f0-9]{64}$/).optional()});import{z as z3}from"zod";import{z as z2}from"zod";var Id=z2.uuid().toLowerCase();var ReadId=z2.uuid().regex(/^[0-9a-f-]{36}$/);var Key=z2.string().regex(/^[a-z0-9][a-z0-9_-]{0,63}$/);var Revision=z2.int().min(0).max(999999999);var AgentHostScopeSchema=z2.strictObject({tenantId:Id,projectId:Id});var ReadScope=z2.strictObject({tenantId:ReadId,projectId:ReadId});var AgentHostSelectionSchema=CurrentHostSelectionSchema;var AgentHostReadSelectionSchema=z2.union([CurrentHostSelectionSchema,HistoricalHostSelectionSchema]);var ConfigureAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z2.int().min(0).max(999999998),selection:AgentHostSelectionSchema,apiCredential:HostBearerSchema});var RevokeAgentHostSchema=AgentHostScopeSchema.extend({requestId:Id,bindingId:Id,expectedRevision:z2.int().min(1).max(999999998)});var AgentHostBindingSchema=ReadScope.extend({bindingId:ReadId,revision:Revision.refine(value=>value>0),configurationVersion:Revision.refine(value=>value>0),enabled:z2.boolean(),selection:AgentHostReadSelectionSchema,updatedAt:z2.iso.datetime({offset:true})}).refine(value=>value.configurationVersion<=value.revision);var CurrentAgentHostBindingSchema=AgentHostBindingSchema.safeExtend({selection:CurrentHostSelectionSchema});var UpdateAgentHostSelectionSchema=ConfigureAgentHostSchema.omit({apiCredential:true}).extend({expectedRevision:z2.int().min(1).max(999999998),expectedConfigurationVersion:z2.int().positive().max(999999998)});var AgentHostCurrentSchema=z2.strictObject({binding:AgentHostBindingSchema.nullable()});var AgentHostHistoryQuerySchema=AgentHostScopeSchema.extend({limit:z2.int().min(1).max(100).default(20),beforeVersion:z2.int().positive().max(999999999).optional()});var AgentHostConfigurationVersionSchema=ReadScope.extend({bindingId:ReadId,version:z2.int().positive().max(999999999),selection:AgentHostReadSelectionSchema,createdByPrincipalId:ReadId,createdAt:z2.iso.datetime({offset:true}),revokedAt:z2.iso.datetime({offset:true}).nullable()});var AgentHostHistoryPageSchema=z2.strictObject({items:z2.array(AgentHostConfigurationVersionSchema).max(100),hasMore:z2.boolean(),nextBeforeVersion:z2.int().positive().max(999999999).nullable()}).refine(page2=>page2.hasMore===(page2.nextBeforeVersion!==null)&&(!page2.hasMore||page2.items.length>0));var AgentHostReadinessSchema=ReadScope.extend({binding:AgentHostBindingSchema.nullable(),registeredHostKeys:z2.array(Key).max(16),configurationStatus:z2.enum(["NOT_CONFIGURED","REVOKED","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CONFIGURATION_CHANGED","CONFIGURED"]),remoteCredentialVerification:z2.enum(["NOT_CHECKED","VERIFIED"]),nativeToolAuthority:z2.enum(["NOT_CONNECTED","UNVERIFIED","VERIFIED"]),executionAvailability:z2.enum(["UNAVAILABLE","AVAILABLE"]),reason:z2.enum(["NATIVE_TOOL_AUTHORITY_NOT_CONNECTED","NATIVE_TOOL_AUTHORITY_NOT_QUALIFIED","CONFIGURATION_CHANGED"]).nullable(),checkedAt:z2.iso.datetime({offset:true})}).refine(v=>{const verified=v.nativeToolAuthority==="VERIFIED";return(v.binding===null||v.binding.tenantId===v.tenantId&&v.binding.projectId===v.projectId)&&verified===(v.remoteCredentialVerification==="VERIFIED")&&verified===(v.executionAvailability==="AVAILABLE")&&verified===(v.reason===null)&&(!verified||v.configurationStatus==="CONFIGURED"&&v.binding?.enabled===true)});var AgentHostFailureSchema=z2.strictObject({semanticStatus:z2.enum(["INVALID_INPUT","NOT_FOUND","BLOCKED","REVISION_CONFLICT","CAPABILITY_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE"]),error:z2.strictObject({code:z2.enum(["INVALID_INPUT","UNAUTHENTICATED","FORBIDDEN","NOT_FOUND","REVISION_CONFLICT","REQUEST_CONFLICT","HOST_UNAVAILABLE","CREDENTIAL_UNAVAILABLE","CREDENTIAL_SCOPE_MISMATCH","BINDING_REVOKED","INTERNAL_OPERATIONAL_FAILURE"]),message:z2.literal("Agent Host operation did not complete")})});var id=z3.uuid().regex(/^[0-9a-f-]{36}$/);var requestId=z3.uuid().toLowerCase();var key=z3.string().regex(/^[A-Za-z0-9_-]{1,160}$/);var NativeRuntimePublicKeySchema=z3.strictObject({kty:z3.literal("EC"),crv:z3.literal("P-256"),x:z3.string().regex(/^[A-Za-z0-9_-]{43}$/),y:z3.string().regex(/^[A-Za-z0-9_-]{43}$/)});var ConfigureNativeToolGrantSchema=AgentHostScopeSchema.extend({requestId,bindingId:requestId,expectedBindingRevision:z3.int().positive(),expectedConfigurationVersion:z3.int().positive(),runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,expiresAt:z3.iso.datetime({offset:true})});var NativeToolGrantGetSchema=AgentHostScopeSchema.extend({grantId:requestId});var RevokeNativeToolGrantSchema=NativeToolGrantGetSchema.extend({requestId,expectedRevision:z3.int().positive()});var NativeRuntimeProofRequestSchema=NativeToolGrantGetSchema.extend({assertion:z3.string().regex(/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/).max(4096).meta({writeOnly:true})});var NativeRuntimeStatusClaimsSchema=z3.strictObject({iss:key,sub:key,aud:z3.url().max(2048),grantId:id,installationRevisionId:key,jti:id,iat:z3.int().nonnegative(),exp:z3.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeRuntimeProofClaimsSchema=z3.strictObject({iss:key,sub:key,aud:z3.url().max(2048),grantId:id,grantRevision:z3.int().positive(),installationRevisionId:key,challengeId:id,jti:id,iat:z3.int().nonnegative(),exp:z3.int().positive()}).refine(v=>v.exp>v.iat&&v.exp-v.iat<=60);var NativeToolGrantViewSchema=z3.strictObject({tenantId:id,projectId:id}).extend({protocol:z3.literal("NATIVESTUDIO_RUNTIME_REGISTRATION_V1"),grantId:id,bindingId:id,bindingRevision:z3.int().positive(),configurationVersion:z3.int().positive(),selection:AgentHostReadSelectionSchema,runtimeKey:key,installationId:key,installationRevisionId:key,publicKey:NativeRuntimePublicKeySchema,resource:z3.url().max(2048),revision:z3.int().positive(),enabled:z3.boolean(),createdByPrincipalId:id,runtimePrincipalId:id,createdAt:z3.iso.datetime({offset:true}),expiresAt:z3.iso.datetime({offset:true}),challengeId:id,challengeExpiresAt:z3.iso.datetime({offset:true}),verifiedAt:z3.iso.datetime({offset:true}).nullable(),revokedAt:z3.iso.datetime({offset:true}).nullable()}).refine(v=>{const resource=new URL(v.resource);return resource.protocol==="https:"&&!resource.username&&!resource.password&&!resource.search&&!resource.hash&&resource.pathname===`/mcp/native/v1/projects/${v.projectId}`&&v.enabled===(v.revokedAt===null)&&Date.parse(v.challengeExpiresAt)<=Date.parse(v.expiresAt)});import{z as z4}from"zod";var EXTERNAL_EVENT_TYPES=["production.work_changed","production.started","production.failed","production.cancelled","finding.opened","artifact.created","shot.candidate_ready","shot.accepted","review.completed","rough_cut.ready","final_render.ready","approval.required","production.completed","delivery.validation_failed"];var ExternalEventTypeSchema=z4.enum(EXTERNAL_EVENT_TYPES);var LifecycleEventScopeSchema=z4.object({tenantId:TenantIdSchema,productionId:ProductionIdSchema}).strict();var ExternalLifecycleEventSchema=z4.object({schemaVersion:z4.literal(1),eventId:z4.uuid(),tenantId:TenantIdSchema,productionId:ProductionIdSchema,projectId:z4.uuid(),type:ExternalEventTypeSchema,target:z4.object({type:z4.string().min(1).max(60),id:z4.uuid()}).strict(),occurredAt:z4.iso.datetime(),basis:z4.object({productionRevision:z4.number().int().positive()}).strict(),payload:z4.object({sourceEventType:z4.string().min(1).max(100),artifactId:z4.uuid().optional(),candidateId:z4.uuid().optional(),reviewId:z4.uuid().optional(),findingId:z4.uuid().optional(),shotId:z4.uuid().optional(),manifestId:z4.uuid().optional(),validationId:z4.uuid().optional(),action:z4.string().max(40).optional(),result:z4.string().max(40).optional(),executionClass:z4.enum(["LIVE","TEST_ONLY"]).optional()}).strict()}).strict();var WebhookEndpointSchema=z4.url().max(2048).refine(value=>{const u=new URL(value);return u.protocol==="https:"&&!u.username&&!u.password&&!u.hash&&(!u.port||u.port==="443")&&!u.hostname.startsWith("[")});var ConfigureWebhookSchema=LifecycleEventScopeSchema.extend({subscriptionId:z4.uuid(),expectedRevision:z4.number().int().nonnegative(),idempotencyKey:z4.string().min(1).max(128),endpoint:WebhookEndpointSchema,eventTypes:z4.array(ExternalEventTypeSchema).min(1).max(EXTERNAL_EVENT_TYPES.length).refine(v=>new Set(v).size===v.length),signingSecret:z4.string().min(32).max(256)}).strict();var PrepareWebhookSecretSchema=LifecycleEventScopeSchema.extend({subscriptionId:z4.uuid(),secretRef:z4.uuid(),signingSecret:z4.string().min(32).max(256)}).strict();var WebhookSecretReferenceSchema=PrepareWebhookSecretSchema.omit({signingSecret:true});var ConfigureWebhookReferenceSchema=ConfigureWebhookSchema.omit({signingSecret:true}).extend({secretRef:z4.uuid()}).strict();var WebhookAvailabilitySchema=z4.discriminatedUnion("status",[z4.strictObject({status:z4.literal("AVAILABLE"),reason:z4.literal("SIGNING_STORAGE_READY")}),z4.strictObject({status:z4.literal("UNCONFIGURED"),reason:z4.literal("SIGNING_STORAGE_NOT_CONFIGURED")}),z4.strictObject({status:z4.literal("UNAVAILABLE"),reason:z4.literal("SIGNING_STORAGE_UNAVAILABLE")})]);var DisableWebhookSchema=LifecycleEventScopeSchema.extend({subscriptionId:z4.uuid(),expectedRevision:z4.number().int().positive(),idempotencyKey:z4.string().min(1).max(128)}).strict();var ReplayWebhookSchema=DisableWebhookSchema.extend({eventId:z4.uuid()}).strict();var QueryLifecycleEventsSchema=LifecycleEventScopeSchema.extend({kind:z4.enum(["subscriptions","events","deliveries","attempts"]),subscriptionId:z4.uuid().optional(),deliveryId:z4.uuid().optional(),after:z4.uuid().optional(),limit:z4.number().int().min(1).max(50).default(20)}).strict().refine(v=>v.kind!=="attempts"||!!v.deliveryId);var WebhookSubscriptionSchema=LifecycleEventScopeSchema.extend({subscriptionId:z4.uuid(),version:z4.number().int().positive(),revision:z4.number().int().positive(),state:z4.enum(["ACTIVE","DISABLED","DEGRADED"]),endpoint:WebhookEndpointSchema,eventTypes:z4.array(ExternalEventTypeSchema),updatedAt:z4.iso.datetime()}).strict();import{z as z5}from"zod";var ProductionEventCursorSchema=z5.strictObject({v:z5.literal(1),t:z5.uuid(),p:z5.uuid(),e:z5.uuid(),n:z5.string().regex(/^(0|[1-9][0-9]{0,18})$/)});var ProductionFeedbackInputSchema=LifecycleEventScopeSchema.extend({operationId:OperationIdSchema.optional(),ifNoneMatch:z5.string().regex(/^[a-f0-9]{64}$/).optional()}).strict();var ProductionFeedbackSchema=LifecycleEventScopeSchema.extend({projectId:z5.uuid(),operationId:OperationIdSchema.nullable(),productionRevision:z5.int().positive(),state:ProductionStateSchema,semanticStatus:InterfaceSemanticStatusSchema,work:WorkSummarySchema,blockers:z5.array(z5.string().min(1).max(1e3)).max(100),nextActions:z5.array(NextActionSchema).max(50),media:z5.strictObject({previewReady:z5.boolean(),finalRenderReady:z5.boolean(),deliveryComplete:z5.boolean()}),humanLinks:HumanLinksSchema}).strict();var ProductionFeedbackResultSchema=LifecycleEventScopeSchema.extend({condition:z5.enum(["CURRENT","NOT_MODIFIED"]),etag:z5.string().regex(/^[a-f0-9]{64}$/),cursor:z5.string().min(1).max(4096),retryAfterMs:z5.int().min(1e3).max(3e4),feedback:ProductionFeedbackSchema.nullable()}).strict().refine(v=>v.condition==="CURRENT"===(v.feedback!==null));var ReadProductionEventsSchema=ProductionFeedbackInputSchema.extend({after:z5.string().min(1).max(4096).optional(),start:z5.enum(["CURRENT","BEGINNING"]).default("CURRENT"),limit:z5.int().min(1).max(50).default(20)}).strict();var ProductionEventReadSchema=z5.strictObject({items:z5.array(ExternalLifecycleEventSchema).max(50),nextCursor:z5.string().min(1).max(4096),watermark:z5.string().min(1).max(4096),hasMore:z5.boolean(),current:ProductionFeedbackResultSchema});import{z as z6}from"zod";function orderedFederationWindow(value){return Date.parse(value.notBefore)<Date.parse(value.expiresAt)}var FederationFailureCodeSchema=z6.enum(["FEDERATION_FORBIDDEN","FEDERATION_UNCONFIGURED","FEDERATION_INVALID_INPUT","FEDERATION_INVALID_ID","FEDERATION_INVALID_REFERENCE","FEDERATION_INVALID_MODE","FEDERATION_INVALID_GRANT_VERSION","FEDERATION_INVALID_REVISION","FEDERATION_INVALID_STATE","FEDERATION_INVALID_SOURCE","FEDERATION_INVALID_VALIDITY","FEDERATION_REMOTE_SERVICE_REQUIRED","FEDERATION_EVENT_NOT_ALLOWED","FEDERATION_EVENT_NOT_SELECTED","FEDERATION_SCOPE_MISMATCH","FEDERATION_PRODUCTION_NOT_FOUND","FEDERATION_ROUTE_NOT_FOUND","FEDERATION_STREAM_NOT_FOUND","FEDERATION_CONNECTION_CONFLICT","FEDERATION_GRANT_CONFLICT","FEDERATION_GRANT_VERSION_CONFLICT","FEDERATION_ROUTE_IDENTITY_CONFLICT","FEDERATION_REVISION_CONFLICT","FEDERATION_IDEMPOTENCY_CONFLICT","FEDERATION_CONCURRENT_CHANGE","FEDERATION_ROUTE_CAPACITY","FEDERATION_SUBSCRIPTION_CAPACITY","FEDERATION_SUBSCRIPTION_NOT_FOUND","FEDERATION_SUBSCRIBER_IDENTITY_CONFLICT","FEDERATION_SUBSCRIPTION_CANCELLED","FEDERATION_INITIAL_SELECTION_REQUIRED","FEDERATION_SELECTION_EXCEEDS_AUTHORITY","FEDERATION_SELECTION_EXCEEDS_GRANT","FEDERATION_RESYNC_REQUIRED","FEDERATION_GAP_NOT_REPAIRED","FEDERATION_HOLD_REQUIRED","FEDERATION_RECOVERY_EXHAUSTED","FEDERATION_BINDING_NOT_FOUND","FEDERATION_INBOX_NOT_FOUND","FEDERATION_INBOUND_CONFLICT","FEDERATION_INBOX_NOT_QUARANTINED","FEDERATION_RESULT_NOT_FOUND","FEDERATION_RESULT_MISMATCH","FEDERATION_CONTRACT_MISMATCH","FEDERATION_RECEIPT_ROUTE_NOT_FOUND","FEDERATION_RECEIPT_DELIVERY_NOT_FOUND","FEDERATION_RECEIPT_CONFLICT"]);var ref=z6.string().min(1).max(256).refine(v=>Array.from(v).every(c=>{const code=c.codePointAt(0);return code>=32&&code!==127&&(code<55296||code>57343)}));var types=z6.array(ExternalEventTypeSchema).min(1).max(14).refine(v=>new Set(v).size===v.length);var uuid=z6.uuid().toLowerCase();var FederationScopeSchema=LifecycleEventScopeSchema.extend({tenantId:uuid.brand(),productionId:uuid.brand()});var routeInput=FederationScopeSchema.extend({routeId:uuid,requestId:ref,expectedRevision:z6.int().nonnegative(),remoteService:ref,remoteTenant:ref,grantRef:ref,grantVersion:z6.int().min(1).max(2147483647),grantEventTypes:types,selectedEventTypes:types,notBefore:z6.iso.datetime(),expiresAt:z6.iso.datetime(),state:z6.enum(["ACTIVE","PAUSED"]),publicationMode:z6.enum(["FIXED","ON_DEMAND"]).default("ON_DEMAND")}).strict();var FederationRouteConfigureSchema=routeInput.refine(orderedFederationWindow).refine(v=>v.selectedEventTypes.every(type=>v.grantEventTypes.includes(type)));var FederationRouteSchema=routeInput.omit({requestId:true,expectedRevision:true}).extend({connectionRef:ref,source:z6.string().min(1).max(2048),serviceRef:z6.literal("native-video-studio"),revision:z6.int().positive(),epoch:uuid,position:z6.string().regex(/^(0|[1-9][0-9]{0,18})$/),gap:z6.boolean(),publicationMode:z6.enum(["FIXED","ON_DEMAND"]).default("FIXED")}).strict();var FederationSubscriptionSetSchema=FederationScopeSchema.extend({subscriptionId:uuid,routeId:uuid,requestId:ref,expectedRevision:z6.int().nonnegative(),subscriberKind:z6.enum(["SYSTEM","AGENT_RUNTIME","HOST_BOT"]),subscriberRef:ref,eventTypes:types,expiresAt:z6.iso.datetime(),state:z6.enum(["ACTIVE","PAUSED","CANCELLED"])}).strict();var FederationSubscriptionGetSchema=FederationScopeSchema.extend({subscriptionId:uuid}).strict();var FederationSubscriptionSchema=FederationSubscriptionSetSchema.omit({requestId:true,expectedRevision:true}).extend({revision:z6.int().positive(),startCursor:z6.string().min(1).max(4096),effective:z6.enum(["ACTIVE","PAUSED","CANCELLED","EXPIRED","BLOCKED"])}).strict();var FederationBootstrapSchema=FederationScopeSchema.extend({cursor:z6.string().min(1).max(4096),feedback:ProductionFeedbackSchema}).strict().refine(v=>v.tenantId===v.feedback.tenantId&&v.productionId===v.feedback.productionId);var FederationSubscriptionResultSchema=FederationScopeSchema.extend({subscription:FederationSubscriptionSchema,bootstrap:FederationBootstrapSchema}).strict().refine(v=>v.tenantId===v.subscription.tenantId&&v.productionId===v.subscription.productionId&&v.bootstrap.tenantId===v.tenantId&&v.bootstrap.productionId===v.productionId);var FederationCatalogSchema=FederationScopeSchema.extend({configuration:z6.enum(["CONFIGURED","UNCONFIGURED"]),transport:z6.literal("NOT_OBSERVED"),profile:z6.literal("eventsdk/1.2"),runtimeSubscription:z6.literal("EXPLICIT_SELECTION"),runtimeWake:z6.literal("RECEIVER_OWNED"),defaultPublication:z6.literal(false),bootstrap:FederationBootstrapSchema,routes:z6.array(FederationRouteSchema).max(32),events:z6.array(z6.strictObject({type:ExternalEventTypeSchema,wireType:ref,dataschema:ref,defaultEnabled:z6.literal(false)})).max(14)}).strict().refine(v=>v.routes.every(r=>r.tenantId===v.tenantId&&r.productionId===v.productionId)&&v.bootstrap.tenantId===v.tenantId&&v.bootstrap.productionId===v.productionId);var FederationQuerySchema=FederationScopeSchema.extend({kind:z6.enum(["routes","subscriptions","deliveries"]),routeId:uuid.optional(),eventId:uuid.optional(),deliveryId:z6.string().regex(/^[0-9a-f]{64}$/).optional(),after:z6.string().min(1).max(64).optional(),limit:z6.int().min(1).max(50).default(20)}).strict().refine(v=>!v.after||(v.kind==="deliveries"?/^[0-9a-f]{64}$/.test(v.after):z6.uuid().safeParse(v.after).success)).refine(v=>v.kind==="deliveries"||!v.eventId&&!v.deliveryId);var FederationDeliverySchema=FederationScopeSchema.extend({routeId:uuid,eventId:uuid,deliveryId:z6.string().regex(/^[0-9a-f]{64}$/),eventType:ExternalEventTypeSchema,state:z6.enum(["PENDING","UNKNOWN","PUBLISHED","HOLD"]),attempts:z6.int().nonnegative(),acknowledgement:z6.enum(["BROKER_STORED","NOT_CONFIRMED"]),reason:z6.string().max(100).nullable()}).strict();var page=(kind,item)=>FederationScopeSchema.extend({kind:z6.literal(kind),items:z6.array(item).max(50),next:(kind==="deliveries"?z6.string().regex(/^[0-9a-f]{64}$/):uuid).nullable()}).strict();var FederationQueryResultSchema=z6.discriminatedUnion("kind",[page("routes",FederationRouteSchema),page("subscriptions",FederationSubscriptionSchema),page("deliveries",FederationDeliverySchema)]).refine(v=>v.items.every(item=>{const r=item;return r.tenantId===v.tenantId&&r.productionId===v.productionId}));var FederationReceiptInputSchema=FederationScopeSchema.extend({requestId:ref}).strict();var FederationRecoverSchema=FederationScopeSchema.extend({kind:z6.enum(["RETRY_HOLD","REPAIR_GAP"]),routeId:uuid,requestId:ref,expectedRevision:z6.int().positive(),reason:ref,deliveryId:z6.string().regex(/^[0-9a-f]{64}$/).optional(),expectedAttempts:z6.int().nonnegative().optional(),acknowledgeDuplicateRisk:z6.literal(true).optional()}).strict().refine(v=>v.kind==="RETRY_HOLD"?v.deliveryId!==void 0&&v.expectedAttempts!==void 0&&v.acknowledgeDuplicateRisk===true:v.deliveryId===void 0&&v.expectedAttempts===void 0&&v.acknowledgeDuplicateRisk===void 0);var FederationRecoverySchema=FederationScopeSchema.extend({kind:z6.enum(["RETRY_HOLD","REPAIR_GAP"]),requestId:ref,recoveryId:uuid,routeId:uuid,revision:z6.int().positive(),epoch:uuid,position:z6.string().regex(/^(0|[1-9][0-9]{0,18})$/),gap:z6.boolean(),deliveryId:z6.string().regex(/^[0-9a-f]{64}$/).nullable(),attempts:z6.int().nonnegative().nullable(),recoveryCount:z6.int().min(0).max(3).nullable(),effect:z6.literal("TRANSPORT_ONLY")}).strict().refine(v=>v.kind==="RETRY_HOLD"?v.deliveryId!==null&&v.attempts!==null&&v.recoveryCount!==null&&v.recoveryCount>0:v.deliveryId===null&&v.attempts===null&&v.recoveryCount===null&&!v.gap);var FederationObservationSchema=FederationScopeSchema.extend({asOf:z6.iso.datetime(),routes:z6.array(z6.strictObject({routeId:uuid,state:z6.enum(["ACTIVE","PAUSED"]),gap:z6.boolean(),position:z6.string(),sourceHead:z6.string().nullable(),sourceLag:z6.string().nullable(),pending:z6.int().nonnegative(),unknown:z6.int().nonnegative(),hold:z6.int().nonnegative(),published:z6.int().nonnegative(),demandBlocked:z6.int().nonnegative(),inFlight:z6.int().nonnegative(),oldestUnsettledEventAt:z6.iso.datetime().nullable(),lastTickAt:z6.iso.datetime().nullable(),faultCode:z6.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/).nullable()})).max(32),workers:z6.array(z6.strictObject({source:z6.string().min(1).max(2048),workerRef:ref,instanceId:uuid,status:z6.enum(["STARTING","CONNECTED","RECONNECTING","DISABLED","SHADOW","CONFIGURATION_ERROR","STOPPED"]),observedAt:z6.iso.datetime(),configurationRevision:z6.string().regex(/^sha256:[a-f0-9]{64}$/).nullable(),fresh:z6.boolean(),connected:z6.boolean()})).max(32),workersTruncated:z6.boolean(),meaning:z6.literal("BROKER_ACK_IS_NOT_APPLIED")}).strict();var FederationReceiptSchema=FederationReceiptInputSchema.extend({result:z6.union([FederationRouteSchema,FederationSubscriptionResultSchema,FederationRecoverySchema]).nullable()}).strict().refine(v=>!v.result||v.result.tenantId===v.tenantId&&v.result.productionId===v.productionId);export{HOST_PROTOCOL,HostProtocolDocument,HostDelegationDocument,HostProtocolDigest,HostDelegationDigest,HostReferenceSchema,HostScopeSchema,HostChoiceSchema,CurrentHostSelectionSchema,CurrentHostInstallationTransportSchema,HistoricalHostTransportSchema,AgentHostScopeSchema,AgentHostSelectionSchema,AgentHostReadSelectionSchema,ConfigureAgentHostSchema,RevokeAgentHostSchema,AgentHostBindingSchema,UpdateAgentHostSelectionSchema,AgentHostCurrentSchema,AgentHostHistoryQuerySchema,AgentHostHistoryPageSchema,AgentHostReadinessSchema,NativeRuntimePublicKeySchema,ConfigureNativeToolGrantSchema,NativeToolGrantGetSchema,RevokeNativeToolGrantSchema,NativeRuntimeProofRequestSchema,NativeToolGrantViewSchema,EXTERNAL_EVENT_TYPES,ExternalEventTypeSchema,LifecycleEventScopeSchema,ExternalLifecycleEventSchema,ConfigureWebhookSchema,PrepareWebhookSecretSchema,WebhookSecretReferenceSchema,ConfigureWebhookReferenceSchema,WebhookAvailabilitySchema,DisableWebhookSchema,ReplayWebhookSchema,QueryLifecycleEventsSchema,WebhookSubscriptionSchema,ProductionFeedbackInputSchema,ProductionFeedbackResultSchema,ReadProductionEventsSchema,ProductionEventReadSchema,orderedFederationWindow,FederationFailureCodeSchema,FederationScopeSchema,FederationRouteConfigureSchema,FederationRouteSchema,FederationSubscriptionSetSchema,FederationSubscriptionGetSchema,FederationSubscriptionResultSchema,FederationCatalogSchema,FederationQuerySchema,FederationDeliverySchema,FederationQueryResultSchema,FederationReceiptInputSchema,FederationRecoverSchema,FederationRecoverySchema,FederationObservationSchema,FederationReceiptSchema};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{FederationFailureCodeSchema}from"./chunk-NNDKZ5H5.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=>{return[operation2.inspect,operation2.failure?.next].every(read=>{if(!read)return true;const selected=read.tool==="studio_capability_query"?read.arguments:read;return hintsMatch(read.arguments)&&hintsMatch(selected.arguments)&&(selected.tool!=="operation_get"||selected.arguments.operationId===operation2.id)})})}var envelopes=new Set(["choices","related","operations","activeOperations","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;const next=record.failure?.next;if((next?.capability==="operation.get"||next?.capability==="production.snapshot")&&typeof record.id==="string"&&typeof record.productionId==="string"&&(!next.input||!same(next.input.productionId,record.productionId)||scope.tenantId!==void 0&&!same(next.input.tenantId,scope.tenantId)||next.capability==="operation.get"&&next.input.operationId!==record.id))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};
|