@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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{runDesktopDeviceRequest}from"./chunk-B7BQERMR.js";import"./chunk-PYUYK3FV.js";import"./chunk-MT5XZ67U.js";import"./chunk-U6ZG2G7W.js";import{DesktopDeviceRequestSchema}from"./chunk-JLQCUXCT.js";import"./chunk-VLEWCWYF.js";import{readInput}from"./chunk-U5FT4VBR.js";import"./chunk-WAADGZEV.js";import{LocalClientError}from"./chunk-RUPH3HZ2.js";import"./chunk-HAOCQVMU.js";import"./chunk-HTUTYIRU.js";import{homedir}from"node:os";import{join,resolve}from"node:path";var actions=new Set(["inspect","enroll","revoke","dispatch","record","refused","prove","connect","connection-recover","media-validation-capability","media-processing-capability"]);async function runHostCli(argv,stdin=process.stdin){let entered=false;let mutation=false;try{if(!argv.length||argv.length===1&&argv[0]==="help")return{exitCode:0,output:{protocol:"NVS_EXTERNAL_HOST_V1",agentRuntime:"EXTERNAL",commands:["host device --input <json|-> [--home <private-client-home>]"],actions:[...actions],guidance:"Use your existing tenant MCP for device_enroll/device_management_receipt. Keep the device key local. Read workspace_caller.skill (or nvs skill with an existing CLI connection) for the configured download URL; CLI and SDK install through latest."}};const[command,...rest]=argv,options=new Map;if(command!=="device")throw Error();for(let i=0;i<rest.length;i+=2){const key=rest[i],value=rest[i+1];if(!key||!["--input","--home"].includes(key)||!value||value.startsWith("--")||options.has(key))throw Error();options.set(key,value)}const file=options.get("--input");if(!file)throw Error();const request=DesktopDeviceRequestSchema.parse(await readInput(file,stdin));if(!actions.has(request.call.action))throw Error();mutation=!["inspect","media-validation-capability","media-processing-capability"].includes(request.call.action);const home=resolve(options.get("--home")??process.env.NATIVESTUDIO_CLIENT_HOME??join(homedir(),".nativestudio/client"));entered=true;const output=await runDesktopDeviceRequest(home,request,{allowedPendingKinds:["ENROLL","REVOKE_DEVICE"]});return{exitCode:0,output}}catch(error){const code=error instanceof LocalClientError?error.code:!entered?"INVALID_INPUT":"INTERNAL_OPERATIONAL_FAILURE";const uncertain=entered&&mutation&&code!=="DEVICE_COMMAND_UNSUPPORTED"||/(?:UNKNOWN|RECOVERY_REQUIRED|PROOF_UNAVAILABLE)/.test(code)||code==="INTERNAL_OPERATIONAL_FAILURE";return{exitCode:2,output:{semanticStatus:code==="INVALID_INPUT"?"INVALID_INPUT":"BLOCKED",error:{code,outcome:uncertain?"UNKNOWN":"NO_WRITE"}}}}}export{runHostCli};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{connectRemoteMcp}from"./chunk-RT77PT3A.js";import"./chunk-2UYKJ6YN.js";import"./chunk-TQIJBUSP.js";import"./chunk-WAADGZEV.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import"./chunk-KOCUZ3AE.js";import"./chunk-HTUTYIRU.js";export{connectRemoteMcp};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{withRemoteClient}from"./chunk-EML7OS3I.js";import"./chunk-U5FT4VBR.js";import"./chunk-TQIJBUSP.js";import"./chunk-WAADGZEV.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 +0,0 @@
|
|
|
1
|
-
import{CapabilityDescribeSchema,CapabilityGroupsSchema,DeviceDiscoveryInputSchema,DeviceRenderAdmissionSchema,DeviceRenderDownloadSchema,DeviceRenderIntentSchema,DeviceRenderReadSchema,LocalLibraryCommandStatusSchema,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-TQIJBUSP.js";import{FinalRenderViewSchema,LocalLibraryAdmissionSchema,LocalLibraryCommandQuerySchema,LocalLibraryCommandSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionQuerySchema,LocalLibraryReferenceSchema,ProjectDeviceListSchema,RoughCutViewSchema}from"./chunk-WAADGZEV.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import{NativeStudioSdkError,sdkInputError}from"./chunk-HTUTYIRU.js";export{CapabilityDescribeSchema,CapabilityGroupsSchema,DeviceDiscoveryInputSchema,DeviceRenderAdmissionSchema,DeviceRenderDownloadSchema,DeviceRenderIntentSchema,DeviceRenderReadSchema,FinalRenderViewSchema,LocalLibraryAdmissionSchema,LocalLibraryCommandQuerySchema,LocalLibraryCommandSchema,LocalLibraryCommandStatusSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionQuerySchema,LocalLibraryReferenceSchema,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};
|
|
@@ -1 +0,0 @@
|
|
|
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. Use studio_start, studio_navigate and studio_capability_groups; describe returns a bounded public definition, not a tool-menu change. Follow native evidence and exact typed commands.",...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};
|