@nativestudio/cli 0.3.0-rc.16 → 0.3.0-rc.17
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 +8 -8
- package/components/runtime.json +4 -4
- package/components/runtime.tgz +0 -0
- package/dist/_chunks/{chunk-VLEWCWYF.js → chunk-3KBIDTXT.js} +1 -1
- package/dist/_chunks/{chunk-B7BQERMR.js → chunk-4IFMG2ZS.js} +1 -1
- package/dist/_chunks/chunk-4NJIT52T.js +1 -0
- package/dist/_chunks/{chunk-5LSB6HDP.js → chunk-53EULX5D.js} +1 -1
- package/dist/_chunks/{chunk-RT77PT3A.js → chunk-65X56WAQ.js} +1 -1
- package/dist/_chunks/{chunk-U6ZG2G7W.js → chunk-744IEPTK.js} +1 -1
- package/dist/_chunks/{chunk-EML7OS3I.js → chunk-BR26X3ZF.js} +1 -1
- package/dist/_chunks/chunk-C7CSZFV6.js +1 -0
- package/dist/_chunks/{chunk-JLQCUXCT.js → chunk-GKDGSAI5.js} +1 -1
- package/dist/_chunks/{chunk-SRB5ZFKO.js → chunk-HI5SIUX7.js} +1 -1
- package/dist/_chunks/{chunk-PYUYK3FV.js → chunk-IHTF6VEC.js} +1 -1
- package/dist/_chunks/{chunk-LOYAGAAN.js → chunk-K25YVVTT.js} +1 -1
- package/dist/_chunks/{chunk-BGH3Y5UX.js → chunk-KYNC2BSW.js} +1 -1
- package/dist/_chunks/{chunk-35XQP7RY.js → chunk-ORFGJBJA.js} +1 -1
- package/dist/_chunks/{chunk-MT5XZ67U.js → chunk-SDTAJ7FI.js} +1 -1
- package/dist/_chunks/{chunk-XVQWVJWD.js → chunk-UGOXJEDU.js} +1 -1
- package/dist/_chunks/{device-management-ELAPFWM2.js → device-management-CXSZFF53.js} +1 -1
- package/dist/_chunks/{device-preflight-27RDJVBU.js → device-preflight-6HKPPZ5L.js} +1 -1
- package/dist/_chunks/{devices-inventory-2XEJPPO5.js → devices-inventory-K553HAF3.js} +1 -1
- package/dist/_chunks/{devices-main-UMF3ZBHA.js → devices-main-LBDRDV2M.js} +1 -1
- package/dist/_chunks/host-main-ZMBFHY55.js +1 -0
- package/dist/_chunks/{library-main-L7SY7V7L.js → library-main-RNDPNKYK.js} +1 -1
- package/dist/_chunks/{local-main-7FONRY6F.js → local-main-RC4RM3OB.js} +1 -1
- package/dist/_chunks/{local-mcp-ELFJBJG6.js → local-mcp-LQCQ3WLF.js} +1 -1
- package/dist/_chunks/{main-XWUYQQ32.js → main-CPIMF4PS.js} +2 -2
- package/dist/_chunks/mcp-HQQJCKHS.js +1 -0
- package/dist/_chunks/{observe-entry-3CHBX74Y.js → observe-entry-4GPGZ3NJ.js} +1 -1
- package/dist/_chunks/remote-client-6XHMNMXK.js +1 -0
- package/dist/_chunks/{render-main-ZXYQ7EV5.js → render-main-ATCEBECW.js} +1 -1
- package/dist/_chunks/{source-import-ZWR26CMU.js → source-import-HIL7NW3L.js} +1 -1
- package/dist/_chunks/src-MRFJOTKK.js +1 -0
- package/dist/_chunks/stdio-main-T4ORVLSX.js +1 -0
- package/dist/_chunks/{workspace-main-NYDAQGB4.js → workspace-main-44ECTGHC.js} +1 -1
- package/dist/_types/contracts/device-onboarding.d.ts +12 -6
- package/dist/_types/contracts/device-render.d.ts +12 -6
- package/dist/_types/contracts/federation-event-link-receiver.d.ts +200 -0
- package/dist/_types/contracts/federation-event-link.d.ts +485 -0
- package/dist/_types/contracts/index.d.ts +3 -0
- package/dist/_types/contracts/local-execution/device-inventory.d.ts +12 -6
- package/dist/_types/contracts/mcp-capabilities.d.ts +15 -0
- package/dist/_types/contracts/navigation-context.d.ts +21 -2
- package/dist/_types/contracts/navigation.d.ts +12 -0
- package/dist/entry.js +1 -1
- package/dist/local-management.js +1 -1
- package/dist/local-navigation.js +1 -1
- package/package.json +1 -1
- package/dist/_chunks/chunk-TQIJBUSP.js +0 -1
- package/dist/_chunks/chunk-WAADGZEV.js +0 -1
- package/dist/_chunks/host-main-WYTVTQ4Z.js +0 -1
- package/dist/_chunks/mcp-ACNG635V.js +0 -1
- package/dist/_chunks/remote-client-WIZVKP3O.js +0 -1
- package/dist/_chunks/src-TR4JNPGI.js +0 -1
- package/dist/_chunks/stdio-main-QQLYSRD4.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withRemoteClient}from"./chunk-BR26X3ZF.js";import"./chunk-U5FT4VBR.js";import"./chunk-4NJIT52T.js";import"./chunk-C7CSZFV6.js";import"./chunk-TWC3NXFA.js";import"./chunk-SKAVQ4UW.js";import"./chunk-RUPH3HZ2.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import"./chunk-KOCUZ3AE.js";import"./chunk-HTUTYIRU.js";export{withRemoteClient};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{callerRenderConnection}from"./chunk-
|
|
1
|
+
import{callerRenderConnection}from"./chunk-HI5SIUX7.js";import"./chunk-KYNC2BSW.js";import"./chunk-FX5UVDTH.js";import"./chunk-U5FT4VBR.js";import"./chunk-65X56WAQ.js";import"./chunk-2UYKJ6YN.js";import{DeviceRenderDownloadSchema,DeviceRenderIntentSchema,DeviceRenderReadSchema,PreparedDeviceRenderSchema}from"./chunk-4NJIT52T.js";import"./chunk-C7CSZFV6.js";import{clientHome}from"./chunk-TWC3NXFA.js";import"./chunk-SKAVQ4UW.js";import{directory,optional,sha256,write}from"./chunk-RUPH3HZ2.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import"./chunk-KOCUZ3AE.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";import{z}from"zod";import{join,resolve}from"node:path";async function assertRenderProject(studio,scope,productionId,options){const snapshot=await studio.call("production.snapshot",{productionId},options);if(snapshot.tenantId!==scope.tenantId||snapshot.projectId!==scope.projectId||snapshot.productionId!==productionId)throw new NativeStudioSdkError("FORBIDDEN","BLOCKED","NO_WRITE")}var receipt=z.strictObject({scope:z.string(),intent:DeviceRenderIntentSchema,prepared:PreparedDeviceRenderSchema});async function renderCommand(argv,env){const[kind,...args]=argv,flags=new Map;for(let i=0;i<args.length;i+=2){const k=args[i],v=args[i+1];if(!k||!v||v.startsWith("--")||flags.has(k)||!["--production","--project","--request","--device","--profile-id","--validation-mode","--kind","--render","--role","--output","--mcp-url","--token-file"].includes(k))throw Error();flags.set(k,v)}if(kind==="status"||kind==="download"){const allowed=new Set(["--kind","--project","--production","--render","--mcp-url","--token-file",...kind==="download"?["--role","--output"]:[]]);if(Array.from(flags.keys()).some(key=>!allowed.has(key)))throw Error();const input=DeviceRenderReadSchema.parse({kind:flags.get("--kind"),productionId:flags.get("--production"),renderId:flags.get("--render")});const conn2=await callerRenderConnection(env,flags,false);try{if(kind==="status"){const view=await conn2.studio.deviceRenders.get(input);if(view.projectId!==conn2.scope.projectId)throw new NativeStudioSdkError("FORBIDDEN","BLOCKED","NO_WRITE");return{exitCode:0,output:view}}const filename=flags.get("--output");if(!filename)throw Error();const request=DeviceRenderDownloadSchema.parse({...input,role:flags.get("--role")??"VIDEO"});const output=await conn2.studio.deviceRenders.download(request,void 0,conn2.scope.projectId);if(output.object.projectId!==conn2.scope.projectId)throw new NativeStudioSdkError("FORBIDDEN","BLOCKED","NO_WRITE");await write(resolve(filename),output.bytes,true);return{exitCode:0,output:{semanticStatus:"SUCCESS",renderId:output.renderId,representationId:output.representationId,byteSize:output.object.byteSize,checksumSha256:output.object.checksumSha256}}}finally{await conn2.close().catch(()=>{})}}if(["--kind","--render","--role","--output"].some(key=>flags.has(key)))throw Error();const intent=DeviceRenderIntentSchema.parse({kind,productionId:flags.get("--production"),idempotencyKey:z.uuid().parse(flags.get("--request")),...flags.has("--device")?{deviceId:flags.get("--device")}:{},...flags.has("--profile-id")?{profileId:flags.get("--profile-id")}:{},...flags.has("--validation-mode")?{validationMode:flags.get("--validation-mode")}:{}});const conn=await callerRenderConnection(env,flags);const binding=conn.scope.resource+"#"+sha256(conn.scope.profile)+"#"+conn.scope.projectId;try{await assertRenderProject(conn.studio,conn.scope,intent.productionId);const root=await directory(join(await clientHome(env,true),"renders"));const prefix=join(root,sha256(binding+"\n"+intent.idempotencyKey));const previous=await optional(prefix+".request.json");if(previous){const old=receipt.parse(previous);if(old.scope!==binding||JSON.stringify(old.intent)!==JSON.stringify(intent))throw new NativeStudioSdkError("REVISION_CONFLICT","REVISION_CONFLICT","NO_WRITE");const result=await optional(prefix+".result.json");if(result)return{exitCode:0,output:result};const failure=await optional(prefix+".failure.json");if(failure)return{exitCode:1,output:{semanticStatus:"BLOCKED",error:failure}};try{const recovered=await conn.studio.deviceRenders.receipt(old.prepared);await write(prefix+".result.json",JSON.stringify(recovered),true);return{exitCode:0,output:recovered}}catch(error){if(error instanceof NativeStudioSdkError&&error.code==="REVISION_CONFLICT")throw error}return{exitCode:1,output:{semanticStatus:"BLOCKED",error:{code:"OUTCOME_UNKNOWN",outcome:"UNKNOWN"},idempotencyKey:intent.idempotencyKey,productionId:intent.productionId,nextAction:"Repeat this command with the original request ID to observe its receipt."}}}const prepared=await conn.studio.deviceRenders.prepare(intent);await write(prefix+".request.json",JSON.stringify({scope:binding,intent,prepared}),true);let output;try{output=await conn.studio.deviceRenders.start(prepared)}catch(e){if(e instanceof NativeStudioSdkError&&e.outcome!=="UNKNOWN")await write(prefix+".failure.json",JSON.stringify({code:e.code,outcome:e.outcome,semanticStatus:e.semanticStatus}),true);throw e}try{await write(prefix+".result.json",JSON.stringify(output),true)}catch{throw new NativeStudioSdkError("OUTCOME_UNKNOWN","BLOCKED","UNKNOWN")}return{exitCode:0,output}}finally{await conn.close().catch(()=>{})}}export{renderCommand};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{profileAuthorization}from"./chunk-FX5UVDTH.js";import{readCredential,readInput}from"./chunk-U5FT4VBR.js";import{NativeStudioAgentClient}from"./chunk-
|
|
1
|
+
import{profileAuthorization}from"./chunk-FX5UVDTH.js";import{readCredential,readInput}from"./chunk-U5FT4VBR.js";import{NativeStudioAgentClient}from"./chunk-4NJIT52T.js";import"./chunk-C7CSZFV6.js";import{profileHttpOrigin}from"./chunk-UMCOLDHH.js";import{defaultConnection,tenantConnection}from"./chunk-TWC3NXFA.js";import"./chunk-SKAVQ4UW.js";import"./chunk-RUPH3HZ2.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import"./chunk-KOCUZ3AE.js";import"./chunk-HTUTYIRU.js";import{constants,open}from"node:fs/promises";async function sourceBytes(path,maxBytes){const file=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW);try{const stat=await file.stat();if(!stat.isFile()||stat.size<1||stat.size>maxBytes)throw Error();const bytes=Buffer.alloc(stat.size);let offset=0;while(offset<bytes.length){const{bytesRead}=await file.read(bytes,offset,bytes.length-offset,offset);if(!bytesRead)throw Error();offset+=bytesRead}if((await file.read(Buffer.alloc(1),0,1,offset)).bytesRead)throw Error();return bytes}finally{await file.close()}}async function importSourceCommand([kind,...args],env,stdin){if(kind!=="project"&&kind!=="original")throw Error();const flags=new Map;for(let index=0;index<args.length;index+=2){const name=args[index],value=args[index+1];if(!name||!value||value.startsWith("--")||flags.has(name)||!["--input","--file","--tenant","--origin","--mcp-url","--profile","--token-env","--token-file"].includes(name))throw Error();flags.set(name,value)}await defaultConnection(flags,env,true);const profile=flags.get("--profile");if(profile?["--origin","--mcp-url","--token-env","--token-file"].some(key=>flags.has(key)):flags.has("--origin")===flags.has("--mcp-url"))throw Error();const connected=profile?await profileAuthorization(profile):null;const resource=connected?.resource??flags.get("--mcp-url");const scope=resource?tenantConnection(resource):null;if(scope&&flags.has("--tenant")&&flags.get("--tenant")!==scope.tenantId)throw Error();const input=flags.get("--input"),file=flags.get("--file"),tenantId=scope?.tenantId??flags.get("--tenant"),baseUrl=flags.get("--origin")??(connected&&profile?await profileHttpOrigin(profile,connected.resource):resource?new URL(resource).origin:void 0);if(!input||!file||!tenantId||!baseUrl)throw Error();const authorization=connected?.authorization??await readCredential(flags,env);const studio=new NativeStudioAgentClient({tenantId,baseUrl,authorization:()=>authorization});const intent=await readInput(input,stdin);const bytes=await sourceBytes(file,(kind==="project"?8:128)*1024*1024);const receipt=kind==="project"?await studio.directSources.importProjectSource(intent,bytes):await studio.directSources.importOriginal(intent,bytes);if(receipt.state==="SUBMITTED")return{exitCode:0,output:receipt};const output="registration"in receipt?{artifactId:receipt.registration.artifact.id,representationId:receipt.registration.primaryRepresentation.id}:{artifactId:receipt.original.artifactId,representationId:receipt.original.representationId,sourceId:receipt.original.sourceId,version:receipt.original.version};return{exitCode:0,output:{state:receipt.state,...output}}}export{importSourceCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{CapabilityDescribeSchema,CapabilityGroupsSchema,CapabilityInvocationInputSchema,CapabilityInvocationOutputSchema,DeviceDiscoveryInputSchema,DeviceRenderAdmissionSchema,DeviceRenderDownloadSchema,DeviceRenderIntentSchema,DeviceRenderReadSchema,LocalLibraryCommandStatusSchema,McpEntryToolNames,NativeStudioAgentClient,NativeStudioDeviceRenders,NativeStudioMcpClient,NativeStudioNavigationClient,NativeStudioNavigationFacade,NativeStudioRuntimeAuthorityClient,NavigationGroupIdSchema,NavigationGroups,NavigationProfile,NavigationProfileKey,NavigationToolNames,PreparedDeviceRenderSchema,TenantRenderMediaTicketSchema,WorkspaceDeviceListInputSchema,WorkspaceDeviceListSchema,assertCarrierCoverage,navigationGroup,observeProduction,queryPages,readFederationLifecycleResult,sdkCarrierDifferences,sdkImageMediaTools,sdkMcpTools,sdkOperations,verifyWebhookNotification,waitForOperation}from"./chunk-4NJIT52T.js";import{FinalRenderViewSchema,LocalLibraryAdmissionSchema,LocalLibraryCommandQuerySchema,LocalLibraryCommandSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionQuerySchema,LocalLibraryReferenceSchema,ProjectDeviceListSchema,RoughCutViewSchema}from"./chunk-C7CSZFV6.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import{NativeStudioSdkError,sdkInputError}from"./chunk-HTUTYIRU.js";export{CapabilityDescribeSchema,CapabilityGroupsSchema,CapabilityInvocationInputSchema,CapabilityInvocationOutputSchema,DeviceDiscoveryInputSchema,DeviceRenderAdmissionSchema,DeviceRenderDownloadSchema,DeviceRenderIntentSchema,DeviceRenderReadSchema,FinalRenderViewSchema,LocalLibraryAdmissionSchema,LocalLibraryCommandQuerySchema,LocalLibraryCommandSchema,LocalLibraryCommandStatusSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionQuerySchema,LocalLibraryReferenceSchema,McpEntryToolNames,NativeStudioAgentClient,NativeStudioDeviceRenders,NativeStudioMcpClient,NativeStudioNavigationClient,NativeStudioNavigationFacade,NativeStudioRuntimeAuthorityClient,NativeStudioSdkError,NavigationGroupIdSchema,NavigationGroups,NavigationProfile,NavigationProfileKey,NavigationToolNames,PreparedDeviceRenderSchema,ProjectDeviceListSchema,RoughCutViewSchema,TenantRenderMediaTicketSchema,WorkspaceDeviceListInputSchema,WorkspaceDeviceListSchema,assertCarrierCoverage,navigationGroup,observeProduction,queryPages,readFederationLifecycleResult,sdkCarrierDifferences,sdkImageMediaTools,sdkInputError,sdkMcpTools,sdkOperations,verifyWebhookNotification,waitForOperation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{StdioLines}from"./chunk-JFC6ZIGA.js";import{readCredential}from"./chunk-U5FT4VBR.js";import{defaultConnection}from"./chunk-TWC3NXFA.js";import{FileOAuthProvider}from"./chunk-SKAVQ4UW.js";import"./chunk-RUPH3HZ2.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import{secureEndpoint}from"./chunk-KOCUZ3AE.js";import"./chunk-HTUTYIRU.js";async function stdioRelayConfig(argv,environment){const options=new Map;for(let i=0;i<argv.length;i+=2){const key=argv[i],value=argv[i+1];if(!key||!["--profile","--mcp-url","--token-env","--token-file","--timeout-ms","--discovery"].includes(key)||!value||value.startsWith("--")||options.has(key))throw Error();options.set(key,value)}await defaultConnection(options,environment,false);const discovery=options.get("--discovery");if(discovery!==void 0&&discovery!=="contextual-v1")throw Error();const timeout=options.get("--timeout-ms")??"30000";if(!/^\d+$/.test(timeout))throw Error();const timeoutMs=Number(timeout);if(!Number.isSafeInteger(timeoutMs)||timeoutMs<100||timeoutMs>3e5)throw Error();const profile=options.get("--profile");let endpoint,read;if(profile){if(options.has("--mcp-url")||options.has("--token-env")||options.has("--token-file"))throw Error();endpoint=secureEndpoint((await FileOAuthProvider.load(profile)).data.resource);read=async signal=>{const{profileAuthorization}=await import("./oauth-QBJ62PIA.js");const value=await profileAuthorization(profile,signal);if(secureEndpoint(value.resource).href!==endpoint.href)throw Error();return value.authorization}}else{if(!options.has("--mcp-url"))throw Error();endpoint=secureEndpoint(options.get("--mcp-url"));await readCredential(options,environment);read=()=>readCredential(options,environment)}let tail=Promise.resolve();return{endpoint,timeoutMs,...discovery?{discovery}:{},authorization(signal){const current=tail.then(()=>{signal.throwIfAborted();return read(signal)});tail=current.catch(()=>{});return current}}}import{isJSONRPCResultResponse}from"@modelcontextprotocol/client";var StdioContextualMenu=class{clear(){}request(request){return request}response(request,message){if(request.method!=="initialize"||!isJSONRPCResultResponse(message))return message;return{...message,result:{...message.result,instructions:["Navigation guidance: standard tools/list is stable. Begin with workspace_caller, then discover missing capabilities with studio_capability_groups/search/describe. Execute discovered reads through studio_capability_query and writes through studio_capability_invoke, passing the original complete input under arguments. Capability names such as studio_start and studio_navigate are targets, not additional menu tools. Describe never installs tools. Follow native evidence, inspect links and exact original request identities; reconcile uncertain writes without replay.",...typeof message.result.instructions==="string"?[message.result.instructions]:[]].join("\n")}}}};import{StreamableHTTPClientTransport,deserializeMessage,serializeMessage,isJSONRPCRequest,isJSONRPCNotification,isJSONRPCResultResponse as isJSONRPCResultResponse2,isJSONRPCErrorResponse}from"@modelcontextprotocol/client";var STDIO_RESPONSE_LIMIT=32*1024*1024;function stdioRelayFetch(config,shutdown){return async(input,init)=>{const target=new URL(input instanceof Request?input.url:String(input));if(target.href!==config.endpoint.href)throw Error();const signal=AbortSignal.any([shutdown,...init?.signal?[init.signal]:[],AbortSignal.timeout(config.timeoutMs)]);const authorization=await config.authorization(signal);signal.throwIfAborted();const headers=new Headers(init?.headers);headers.set("authorization",authorization);const response=await fetch(input,{...init,headers,signal,redirect:"error"});if(!response.body)return response;const declared=response.headers.get("content-length");if(declared&&(!/^\d+$/.test(declared)||Number(declared)>STDIO_RESPONSE_LIMIT)){await response.body.cancel();throw Error()}const reader=response.body.getReader();let size=0;const body=new ReadableStream({async pull(controller){try{const part=await reader.read();if(part.done){reader.releaseLock();controller.close();return}size+=part.value.byteLength;if(size>STDIO_RESPONSE_LIMIT){await reader.cancel();throw Error()}controller.enqueue(part.value)}catch(error){controller.error(error)}},async cancel(reason){await reader.cancel(reason);reader.releaseLock()}});return new Response(body,{status:response.status,statusText:response.statusText,headers:response.headers})}}var inputLimit=18*1024*1024;var concurrency=32;async function serveRemoteMcpStdio(config,input,output){const shutdown=new AbortController;const pending=new Map;const transport=new StreamableHTTPClientTransport(config.endpoint,{fetch:stdioRelayFetch(config,shutdown.signal),onInsufficientScope:"throw",reconnectionOptions:{maxRetries:0,maxReconnectionDelay:1,initialReconnectionDelay:1,reconnectionDelayGrowFactor:1}});const lines=new StdioLines(inputLimit);let queuedBytes=0,sends=0,stopped=false;let finish;const closed=new Promise(resolve=>{finish=resolve});const menu=config.discovery==="contextual-v1"?new StdioContextualMenu:void 0;function discard(id){const item=pending.get(id);if(item)clearTimeout(item.timer);pending.delete(id);return item}function write(message){if(stopped)return;const frame=serializeMessage(message);const bytes=Buffer.byteLength(frame);if(bytes>STDIO_RESPONSE_LIMIT||queuedBytes+bytes>STDIO_RESPONSE_LIMIT){void close(1);return}queuedBytes+=bytes;output.write(frame,error=>{queuedBytes-=bytes;if(error)void close(1)})}function fail(id,noWrite=false){const item=discard(id);item?.abort.abort();write({jsonrpc:"2.0",id,error:{code:-32603,message:"Remote MCP request unavailable",data:{semanticStatus:"INTERNAL_OPERATIONAL_FAILURE",outcome:noWrite?"NO_WRITE":"UNKNOWN"}}})}async function forward(message){if(isJSONRPCNotification(message)&&message.method==="notifications/cancelled"){const id=message.params?.requestId;if(typeof id==="string"||typeof id==="number")discard(id)?.abort.abort();if((transport.protocolVersion??"")>="2026-07-28")return}const request=isJSONRPCRequest(message)?message:null;if(request&&(pending.has(request.id)||pending.size>=concurrency||sends>=concurrency)){if(pending.has(request.id)){void close(2);return}fail(request.id,true);return}if(!request&&sends>=concurrency){void close(2);return}if(request){const version=request.method==="initialize"?request.params?.protocolVersion:request.params?._meta?.["io.modelcontextprotocol/protocolVersion"];if(typeof version==="string")transport.setProtocolVersion(version);const abort=new AbortController;const timer=setTimeout(()=>{if(pending.has(request.id))fail(request.id)},config.timeoutMs);timer.unref();pending.set(request.id,{abort,timer,request})}sends++;try{await transport.send(request&&menu?menu.request(request):message,request?{requestSignal:pending.get(request.id).abort.signal,onRequestStreamEnd:()=>{if(pending.has(request.id))fail(request.id)}}:{requestSignal:shutdown.signal})}catch{if(request&&pending.has(request.id))fail(request.id)}finally{sends--}}transport.onmessage=message=>{if(isJSONRPCResultResponse2(message)||isJSONRPCErrorResponse(message)){if(message.id===void 0)return;const item=discard(message.id);if(!item)return;if(item.request.method==="initialize"&&isJSONRPCResultResponse2(message)&&typeof message.result.protocolVersion==="string")transport.setProtocolVersion(message.result.protocolVersion);if(menu)message=menu.response(item.request,message)}if(isJSONRPCNotification(message)&&message.method==="notifications/tools/list_changed")menu?.clear();write(message)};transport.onerror=()=>{};function data(chunk){if(stopped)return;const bytes=Buffer.isBuffer(chunk)?chunk:Buffer.from(chunk);try{lines.push(bytes,line=>{void forward(deserializeMessage(new TextDecoder("utf-8",{fatal:true}).decode(line)));return!stopped})}catch{void close(2)}}function end(){void close(lines.incomplete?2:0)}function streamError(){void close(1)}async function close(code=0){if(stopped)return;stopped=true;shutdown.abort();for(const item of pending.values()){clearTimeout(item.timer);item.abort.abort()}pending.clear();menu?.clear();lines.clear();input.off("data",data).off("end",end).off("error",streamError);input.pause();output.off("error",streamError);try{await transport.close()}catch{code||=1}finish(code)}await transport.start();input.on("data",data).once("end",end).once("error",streamError);output.once("error",streamError);return{close,closed}}async function runMcpStdio(argv,environment){try{const config=await stdioRelayConfig(argv,environment);const handle=await serveRemoteMcpStdio(config,process.stdin,process.stdout);const stop=()=>{void handle.close()};process.once("SIGINT",stop);process.once("SIGTERM",stop);const code=await handle.closed;process.off("SIGINT",stop);process.off("SIGTERM",stop);if(code)process.stderr.write("NativeStudio MCP stdio connection failed.\n");return code}catch{process.stderr.write("NativeStudio MCP stdio configuration failed; run nvs status and nvs connect after account sign-in, or use explicit credentials.\n");return 2}}export{runMcpStdio};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{workspaceCommand,workspaceProject}from"./chunk-
|
|
1
|
+
import{workspaceCommand,workspaceProject}from"./chunk-KYNC2BSW.js";import"./chunk-FX5UVDTH.js";import"./chunk-U5FT4VBR.js";import"./chunk-65X56WAQ.js";import"./chunk-2UYKJ6YN.js";import"./chunk-4NJIT52T.js";import"./chunk-C7CSZFV6.js";import"./chunk-TWC3NXFA.js";import"./chunk-SKAVQ4UW.js";import"./chunk-RUPH3HZ2.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import"./chunk-KOCUZ3AE.js";import"./chunk-HTUTYIRU.js";export{workspaceCommand,workspaceProject};
|
|
@@ -15,15 +15,21 @@ export declare const DeviceSetupRecoverySchema: z.ZodObject<{
|
|
|
15
15
|
WAIT: "WAIT";
|
|
16
16
|
INSPECT_EXISTING: "INSPECT_EXISTING";
|
|
17
17
|
}>;
|
|
18
|
-
inspect: z.ZodObject<{
|
|
19
|
-
tool: z.
|
|
20
|
-
workspace_caller: "workspace_caller";
|
|
21
|
-
workspace_devices_list: "workspace_devices_list";
|
|
22
|
-
}>;
|
|
18
|
+
inspect: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
19
|
+
tool: z.ZodLiteral<"workspace_caller">;
|
|
23
20
|
arguments: z.ZodObject<{
|
|
24
21
|
tenantId: z.ZodUUID;
|
|
25
22
|
}, z.core.$strict>;
|
|
26
|
-
}, z.core.$strict
|
|
23
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
24
|
+
tool: z.ZodLiteral<"studio_capability_query">;
|
|
25
|
+
arguments: z.ZodObject<{
|
|
26
|
+
tenantId: z.ZodUUID;
|
|
27
|
+
tool: z.ZodLiteral<"workspace_devices_list">;
|
|
28
|
+
arguments: z.ZodObject<{
|
|
29
|
+
tenantId: z.ZodUUID;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
}, z.core.$strict>], "tool">;
|
|
27
33
|
guidance: z.ZodString;
|
|
28
34
|
}, z.core.$strict>;
|
|
29
35
|
export type DeviceSetupRecovery = z.infer<typeof DeviceSetupRecoverySchema>;
|
|
@@ -89,15 +89,21 @@ export declare const ProjectDeviceListSchema: z.ZodObject<{
|
|
|
89
89
|
WAIT: "WAIT";
|
|
90
90
|
INSPECT_EXISTING: "INSPECT_EXISTING";
|
|
91
91
|
}>;
|
|
92
|
-
inspect: z.ZodObject<{
|
|
93
|
-
tool: z.
|
|
94
|
-
workspace_caller: "workspace_caller";
|
|
95
|
-
workspace_devices_list: "workspace_devices_list";
|
|
96
|
-
}>;
|
|
92
|
+
inspect: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
93
|
+
tool: z.ZodLiteral<"workspace_caller">;
|
|
97
94
|
arguments: z.ZodObject<{
|
|
98
95
|
tenantId: z.ZodUUID;
|
|
99
96
|
}, z.core.$strict>;
|
|
100
|
-
}, z.core.$strict
|
|
97
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
98
|
+
tool: z.ZodLiteral<"studio_capability_query">;
|
|
99
|
+
arguments: z.ZodObject<{
|
|
100
|
+
tenantId: z.ZodUUID;
|
|
101
|
+
tool: z.ZodLiteral<"workspace_devices_list">;
|
|
102
|
+
arguments: z.ZodObject<{
|
|
103
|
+
tenantId: z.ZodUUID;
|
|
104
|
+
}, z.core.$strict>;
|
|
105
|
+
}, z.core.$strict>;
|
|
106
|
+
}, z.core.$strict>], "tool">;
|
|
101
107
|
guidance: z.ZodString;
|
|
102
108
|
}, z.core.$strict>>;
|
|
103
109
|
}, z.core.$strict>;
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const EventReceiverLocatorSchema: z.ZodObject<{
|
|
3
|
+
ref: z.ZodUUID;
|
|
4
|
+
proof: z.ZodString;
|
|
5
|
+
}, z.core.$strict>;
|
|
6
|
+
export declare const EventReceiverAccessSchema: z.ZodObject<{
|
|
7
|
+
ref: z.ZodUUID;
|
|
8
|
+
proof: z.ZodString;
|
|
9
|
+
tenantId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "TenantId", "out">>;
|
|
10
|
+
}, z.core.$strict>;
|
|
11
|
+
export declare const EventReceiverBeginInputSchema: z.ZodObject<{
|
|
12
|
+
authorization: z.ZodString;
|
|
13
|
+
resume: z.ZodOptional<z.ZodObject<{
|
|
14
|
+
ref: z.ZodUUID;
|
|
15
|
+
proof: z.ZodString;
|
|
16
|
+
}, z.core.$strict>>;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
export declare const EventReceiverBeginSchema: z.ZodObject<{
|
|
19
|
+
ref: z.ZodUUID;
|
|
20
|
+
proof: z.ZodString;
|
|
21
|
+
expiresAt: z.ZodISODateTime;
|
|
22
|
+
}, z.core.$strict>;
|
|
23
|
+
export declare const EventReceiverPrepareSchema: z.ZodObject<{
|
|
24
|
+
ref: z.ZodUUID;
|
|
25
|
+
proof: z.ZodString;
|
|
26
|
+
tenantId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "TenantId", "out">>;
|
|
27
|
+
productionId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "ProductionId", "out">>;
|
|
28
|
+
sourceSelection: z.ZodObject<{
|
|
29
|
+
scope: z.ZodObject<{
|
|
30
|
+
namespace: z.ZodString;
|
|
31
|
+
ref: z.ZodString;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
resourceNamespace: z.ZodString;
|
|
34
|
+
changeKinds: z.ZodArray<z.ZodString>;
|
|
35
|
+
resourcePrefixes: z.ZodArray<z.ZodString>;
|
|
36
|
+
}, z.core.$strict>;
|
|
37
|
+
expiresAt: z.ZodPipe<z.ZodISODateTime, z.ZodTransform<string, string>>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export declare const EventReceiverDecideSchema: z.ZodObject<{
|
|
40
|
+
ref: z.ZodUUID;
|
|
41
|
+
proof: z.ZodString;
|
|
42
|
+
tenantId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "TenantId", "out">>;
|
|
43
|
+
consentBinding: z.ZodOptional<z.ZodString>;
|
|
44
|
+
decision: z.ZodEnum<{
|
|
45
|
+
allow: "allow";
|
|
46
|
+
deny: "deny";
|
|
47
|
+
}>;
|
|
48
|
+
}, z.core.$strict>;
|
|
49
|
+
export declare const EventReceiverChoiceSchema: z.ZodObject<{
|
|
50
|
+
tenantId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "TenantId", "out">>;
|
|
51
|
+
productionId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "ProductionId", "out">>;
|
|
52
|
+
sourceSelection: z.ZodObject<{
|
|
53
|
+
scope: z.ZodObject<{
|
|
54
|
+
namespace: z.ZodString;
|
|
55
|
+
ref: z.ZodString;
|
|
56
|
+
}, z.core.$strict>;
|
|
57
|
+
resourceNamespace: z.ZodString;
|
|
58
|
+
changeKinds: z.ZodArray<z.ZodString>;
|
|
59
|
+
resourcePrefixes: z.ZodArray<z.ZodString>;
|
|
60
|
+
}, z.core.$strict>;
|
|
61
|
+
expiresAt: z.ZodISODateTime;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
export declare const EventReceiverViewSchema: z.ZodObject<{
|
|
64
|
+
ref: z.ZodUUID;
|
|
65
|
+
state: z.ZodEnum<{
|
|
66
|
+
EXPIRED: "EXPIRED";
|
|
67
|
+
PENDING: "PENDING";
|
|
68
|
+
DENIED: "DENIED";
|
|
69
|
+
APPROVED: "APPROVED";
|
|
70
|
+
CONSUMED: "CONSUMED";
|
|
71
|
+
}>;
|
|
72
|
+
expiresAt: z.ZodISODateTime;
|
|
73
|
+
source: z.ZodObject<{
|
|
74
|
+
displayName: z.ZodString;
|
|
75
|
+
serviceRef: z.ZodString;
|
|
76
|
+
tenantRef: z.ZodString;
|
|
77
|
+
installationSource: z.ZodString;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
eventType: z.ZodLiteral<"com.nativestudio.federation.resource.changed.v1">;
|
|
80
|
+
effect: z.ZodLiteral<"REFRESH_HINT">;
|
|
81
|
+
choice: z.ZodNullable<z.ZodObject<{
|
|
82
|
+
tenantId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "TenantId", "out">>;
|
|
83
|
+
productionId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "ProductionId", "out">>;
|
|
84
|
+
sourceSelection: z.ZodObject<{
|
|
85
|
+
scope: z.ZodObject<{
|
|
86
|
+
namespace: z.ZodString;
|
|
87
|
+
ref: z.ZodString;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
resourceNamespace: z.ZodString;
|
|
90
|
+
changeKinds: z.ZodArray<z.ZodString>;
|
|
91
|
+
resourcePrefixes: z.ZodArray<z.ZodString>;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
expiresAt: z.ZodISODateTime;
|
|
94
|
+
}, z.core.$strict>>;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
/** Native API -> first-party BFF only; the BFF removes callback correlation from its UI view. */
|
|
97
|
+
export declare const EventReceiverInspectionSchema: z.ZodObject<{
|
|
98
|
+
view: z.ZodObject<{
|
|
99
|
+
ref: z.ZodUUID;
|
|
100
|
+
state: z.ZodEnum<{
|
|
101
|
+
EXPIRED: "EXPIRED";
|
|
102
|
+
PENDING: "PENDING";
|
|
103
|
+
DENIED: "DENIED";
|
|
104
|
+
APPROVED: "APPROVED";
|
|
105
|
+
CONSUMED: "CONSUMED";
|
|
106
|
+
}>;
|
|
107
|
+
expiresAt: z.ZodISODateTime;
|
|
108
|
+
source: z.ZodObject<{
|
|
109
|
+
displayName: z.ZodString;
|
|
110
|
+
serviceRef: z.ZodString;
|
|
111
|
+
tenantRef: z.ZodString;
|
|
112
|
+
installationSource: z.ZodString;
|
|
113
|
+
}, z.core.$strict>;
|
|
114
|
+
eventType: z.ZodLiteral<"com.nativestudio.federation.resource.changed.v1">;
|
|
115
|
+
effect: z.ZodLiteral<"REFRESH_HINT">;
|
|
116
|
+
choice: z.ZodNullable<z.ZodObject<{
|
|
117
|
+
tenantId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "TenantId", "out">>;
|
|
118
|
+
productionId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "ProductionId", "out">>;
|
|
119
|
+
sourceSelection: z.ZodObject<{
|
|
120
|
+
scope: z.ZodObject<{
|
|
121
|
+
namespace: z.ZodString;
|
|
122
|
+
ref: z.ZodString;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
resourceNamespace: z.ZodString;
|
|
125
|
+
changeKinds: z.ZodArray<z.ZodString>;
|
|
126
|
+
resourcePrefixes: z.ZodArray<z.ZodString>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
expiresAt: z.ZodISODateTime;
|
|
129
|
+
}, z.core.$strict>>;
|
|
130
|
+
}, z.core.$strict>;
|
|
131
|
+
callback: z.ZodObject<{
|
|
132
|
+
redirectUri: z.ZodURL;
|
|
133
|
+
state: z.ZodString;
|
|
134
|
+
issuer: z.ZodURL;
|
|
135
|
+
}, z.core.$strict>;
|
|
136
|
+
}, z.core.$strict>;
|
|
137
|
+
export declare const EventReceiverReviewSchema: z.ZodObject<{
|
|
138
|
+
view: z.ZodObject<{
|
|
139
|
+
ref: z.ZodUUID;
|
|
140
|
+
state: z.ZodEnum<{
|
|
141
|
+
EXPIRED: "EXPIRED";
|
|
142
|
+
PENDING: "PENDING";
|
|
143
|
+
DENIED: "DENIED";
|
|
144
|
+
APPROVED: "APPROVED";
|
|
145
|
+
CONSUMED: "CONSUMED";
|
|
146
|
+
}>;
|
|
147
|
+
expiresAt: z.ZodISODateTime;
|
|
148
|
+
source: z.ZodObject<{
|
|
149
|
+
displayName: z.ZodString;
|
|
150
|
+
serviceRef: z.ZodString;
|
|
151
|
+
tenantRef: z.ZodString;
|
|
152
|
+
installationSource: z.ZodString;
|
|
153
|
+
}, z.core.$strict>;
|
|
154
|
+
eventType: z.ZodLiteral<"com.nativestudio.federation.resource.changed.v1">;
|
|
155
|
+
effect: z.ZodLiteral<"REFRESH_HINT">;
|
|
156
|
+
choice: z.ZodNullable<z.ZodObject<{
|
|
157
|
+
tenantId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "TenantId", "out">>;
|
|
158
|
+
productionId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "ProductionId", "out">>;
|
|
159
|
+
sourceSelection: z.ZodObject<{
|
|
160
|
+
scope: z.ZodObject<{
|
|
161
|
+
namespace: z.ZodString;
|
|
162
|
+
ref: z.ZodString;
|
|
163
|
+
}, z.core.$strict>;
|
|
164
|
+
resourceNamespace: z.ZodString;
|
|
165
|
+
changeKinds: z.ZodArray<z.ZodString>;
|
|
166
|
+
resourcePrefixes: z.ZodArray<z.ZodString>;
|
|
167
|
+
}, z.core.$strict>;
|
|
168
|
+
expiresAt: z.ZodISODateTime;
|
|
169
|
+
}, z.core.$strict>>;
|
|
170
|
+
}, z.core.$strict>;
|
|
171
|
+
consentBinding: z.ZodString;
|
|
172
|
+
}, z.core.$strict>;
|
|
173
|
+
export declare const EventReceiverDecisionSchema: z.ZodObject<{
|
|
174
|
+
ref: z.ZodUUID;
|
|
175
|
+
redirectUri: z.ZodURL;
|
|
176
|
+
}, z.core.$strict>;
|
|
177
|
+
export declare const EventReceiverPortalSchema: z.ZodObject<{
|
|
178
|
+
tenantId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "TenantId", "out">>;
|
|
179
|
+
productionId: z.ZodPipe<z.ZodUUID, z.core.$ZodBranded<z.ZodUUID, "ProductionId", "out">>;
|
|
180
|
+
role: z.ZodLiteral<"RECEIVER">;
|
|
181
|
+
protocol: z.ZodLiteral<"event-link/1">;
|
|
182
|
+
sdkVersion: z.ZodLiteral<"0.4.0">;
|
|
183
|
+
configuration: z.ZodEnum<{
|
|
184
|
+
CONFIGURED: "CONFIGURED";
|
|
185
|
+
UNCONFIGURED: "UNCONFIGURED";
|
|
186
|
+
}>;
|
|
187
|
+
authorizationEndpoint: z.ZodNullable<z.ZodURL>;
|
|
188
|
+
tokenEndpoint: z.ZodNullable<z.ZodURL>;
|
|
189
|
+
eventType: z.ZodLiteral<"com.nativestudio.federation.resource.changed.v1">;
|
|
190
|
+
dataSchema: z.ZodLiteral<"urn:nativestudio:federation:resource-change:v1">;
|
|
191
|
+
effect: z.ZodLiteral<"REFRESH_HINT">;
|
|
192
|
+
defaultReceive: z.ZodLiteral<false>;
|
|
193
|
+
}, z.core.$strict>;
|
|
194
|
+
export type EventReceiverChoice = z.infer<typeof EventReceiverChoiceSchema>;
|
|
195
|
+
export type EventReceiverView = z.infer<typeof EventReceiverViewSchema>;
|
|
196
|
+
export type EventReceiverPortal = z.infer<typeof EventReceiverPortalSchema>;
|
|
197
|
+
export type EventReceiverInspection = z.infer<typeof EventReceiverInspectionSchema>;
|
|
198
|
+
export type EventReceiverReview = z.infer<typeof EventReceiverReviewSchema>;
|
|
199
|
+
export type EventReceiverDecision = z.infer<typeof EventReceiverDecisionSchema>;
|
|
200
|
+
export type EventReceiverBegin = z.infer<typeof EventReceiverBeginSchema>;
|