@nativestudio/cli 0.3.0-rc.15 → 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.
Files changed (124) hide show
  1. package/COMPATIBILITY.json +8 -8
  2. package/components/runtime.json +4 -4
  3. package/components/runtime.tgz +0 -0
  4. package/dist/_chunks/chunk-3KBIDTXT.js +1 -0
  5. package/dist/_chunks/{chunk-ZADAXKKY.js → chunk-4IFMG2ZS.js} +1 -1
  6. package/dist/_chunks/chunk-4NJIT52T.js +1 -0
  7. package/dist/_chunks/{chunk-NPDLPC5B.js → chunk-53EULX5D.js} +1 -1
  8. package/dist/_chunks/{chunk-I5KYSPUJ.js → chunk-65X56WAQ.js} +1 -1
  9. package/dist/_chunks/{chunk-BX2SNMA4.js → chunk-744IEPTK.js} +1 -1
  10. package/dist/_chunks/{chunk-CFZNDURD.js → chunk-BR26X3ZF.js} +1 -1
  11. package/dist/_chunks/chunk-C7CSZFV6.js +1 -0
  12. package/dist/_chunks/chunk-CW67UB2I.js +1 -0
  13. package/dist/_chunks/{chunk-O47YYPL7.js → chunk-GKDGSAI5.js} +1 -1
  14. package/dist/_chunks/{chunk-6UYY5KHI.js → chunk-HAOCQVMU.js} +1 -1
  15. package/dist/_chunks/{chunk-BBTZJB2G.js → chunk-HI5SIUX7.js} +1 -1
  16. package/dist/_chunks/{chunk-OVIR77ET.js → chunk-IHTF6VEC.js} +1 -1
  17. package/dist/_chunks/chunk-K25YVVTT.js +1 -0
  18. package/dist/_chunks/{chunk-ZOODOQBH.js → chunk-KYNC2BSW.js} +1 -1
  19. package/dist/_chunks/{chunk-TTB7CYC5.js → chunk-ORFGJBJA.js} +1 -1
  20. package/dist/_chunks/chunk-SDTAJ7FI.js +1 -0
  21. package/dist/_chunks/{chunk-AAGFHT2D.js → chunk-TWC3NXFA.js} +1 -1
  22. package/dist/_chunks/{chunk-PB2HLRXG.js → chunk-UGOXJEDU.js} +1 -1
  23. package/dist/_chunks/{chunk-SAPEOZ2V.js → chunk-UMCOLDHH.js} +1 -1
  24. package/dist/_chunks/{connect-RIODOO3C.js → connect-OY623MMA.js} +1 -1
  25. package/dist/_chunks/{device-management-VECG3RA4.js → device-management-CXSZFF53.js} +1 -1
  26. package/dist/_chunks/device-preflight-6HKPPZ5L.js +1 -0
  27. package/dist/_chunks/{devices-inventory-E6TE4H7T.js → devices-inventory-K553HAF3.js} +1 -1
  28. package/dist/_chunks/{devices-main-7JHMJNGV.js → devices-main-LBDRDV2M.js} +1 -1
  29. package/dist/_chunks/host-main-ZMBFHY55.js +1 -0
  30. package/dist/_chunks/http-profile-D65WSTZU.js +1 -0
  31. package/dist/_chunks/{library-main-AWUEMZFQ.js → library-main-RNDPNKYK.js} +1 -1
  32. package/dist/_chunks/{local-main-BNFNAPRG.js → local-main-RC4RM3OB.js} +1 -1
  33. package/dist/_chunks/{local-mcp-HU6MII3G.js → local-mcp-LQCQ3WLF.js} +1 -1
  34. package/dist/_chunks/{main-BSMCHALI.js → main-CPIMF4PS.js} +2 -2
  35. package/dist/_chunks/mcp-HQQJCKHS.js +1 -0
  36. package/dist/_chunks/{observe-entry-D7F6OQ7Y.js → observe-entry-4GPGZ3NJ.js} +1 -1
  37. package/dist/_chunks/remote-client-6XHMNMXK.js +1 -0
  38. package/dist/_chunks/{render-main-O3IN6EFV.js → render-main-ATCEBECW.js} +1 -1
  39. package/dist/_chunks/{source-import-Y2Z3BVWY.js → source-import-HIL7NW3L.js} +1 -1
  40. package/dist/_chunks/src-MRFJOTKK.js +1 -0
  41. package/dist/_chunks/stdio-main-T4ORVLSX.js +1 -0
  42. package/dist/_chunks/workspace-main-44ECTGHC.js +1 -0
  43. package/dist/_types/cli/local/desktop-contract.d.ts +13 -13
  44. package/dist/_types/cli/local/desktop-device-contract.d.ts +3 -3
  45. package/dist/_types/cli/local/desktop-device-owner.d.ts +1 -1
  46. package/dist/_types/cli/local/desktop-device-state.d.ts +2 -2
  47. package/dist/_types/cli/local/desktop-library.d.ts +1 -1
  48. package/dist/_types/cli/local/desktop-owner.d.ts +3 -3
  49. package/dist/_types/cli/local/manager.d.ts +2 -2
  50. package/dist/_types/cli/local/mcp-tools.d.ts +2 -2
  51. package/dist/_types/cli/local-management.d.ts +1 -1
  52. package/dist/_types/contracts/agent-execution-lifecycle.d.ts +55 -43
  53. package/dist/_types/contracts/agent-execution-oauth.d.ts +2 -2
  54. package/dist/_types/contracts/agent-execution-registration.d.ts +59 -15
  55. package/dist/_types/contracts/agent-execution-selection.d.ts +7 -7
  56. package/dist/_types/contracts/agent-host-contract.d.ts +189 -0
  57. package/dist/_types/contracts/agent-host-execution.d.ts +92 -61
  58. package/dist/_types/contracts/agent-host-generic-transport.d.ts +4 -4
  59. package/dist/_types/contracts/agent-host-legacy-release.d.ts +31 -0
  60. package/dist/_types/contracts/agent-host-protocol.d.ts +71 -0
  61. package/dist/_types/contracts/agent-host-wire.d.ts +263 -0
  62. package/dist/_types/contracts/agent-host.d.ts +126 -65
  63. package/dist/_types/contracts/artifact-discovery.d.ts +16 -16
  64. package/dist/_types/contracts/composition-observation.d.ts +1 -1
  65. package/dist/_types/contracts/delivery-operations.d.ts +1 -1
  66. package/dist/_types/contracts/delivery-summary.d.ts +1 -1
  67. package/dist/_types/contracts/device-onboarding.d.ts +35 -0
  68. package/dist/_types/contracts/device-render.d.ts +32 -0
  69. package/dist/_types/contracts/exploration-recommendation.d.ts +2 -2
  70. package/dist/_types/contracts/federation-event-link-receiver.d.ts +200 -0
  71. package/dist/_types/contracts/federation-event-link.d.ts +485 -0
  72. package/dist/_types/contracts/federation-result.d.ts +239 -0
  73. package/dist/_types/contracts/final-ready.d.ts +2 -2
  74. package/dist/_types/contracts/final-render.d.ts +2 -2
  75. package/dist/_types/contracts/index.d.ts +7 -0
  76. package/dist/_types/contracts/interface/execution-output.d.ts +9 -6
  77. package/dist/_types/contracts/interface/production-snapshot.d.ts +5 -5
  78. package/dist/_types/contracts/keyframe-generation.d.ts +2 -2
  79. package/dist/_types/contracts/keyframe-review.d.ts +1 -1
  80. package/dist/_types/contracts/lifecycle-event-projections.d.ts +2 -2
  81. package/dist/_types/contracts/lifecycle-events.d.ts +2 -2
  82. package/dist/_types/contracts/local-execution/device-inventory.d.ts +34 -2
  83. package/dist/_types/contracts/local-execution/index.d.ts +1 -0
  84. package/dist/_types/contracts/local-execution/ipc.d.ts +6 -6
  85. package/dist/_types/contracts/local-execution/library.d.ts +2 -2
  86. package/dist/_types/contracts/local-execution/processor.d.ts +7 -7
  87. package/dist/_types/contracts/local-execution/workspace.d.ts +1 -1
  88. package/dist/_types/contracts/mcp-capabilities.d.ts +15 -0
  89. package/dist/_types/contracts/media-observation.d.ts +3 -3
  90. package/dist/_types/contracts/native-tool-authority.d.ts +25 -21
  91. package/dist/_types/contracts/native-tool-execution.d.ts +60 -39
  92. package/dist/_types/contracts/navigation-context.d.ts +25 -6
  93. package/dist/_types/contracts/navigation-groups.d.ts +1 -1
  94. package/dist/_types/contracts/navigation.d.ts +17 -5
  95. package/dist/_types/contracts/repair-strategy.d.ts +1 -1
  96. package/dist/_types/contracts/review-intelligence-final-output.d.ts +1 -1
  97. package/dist/_types/contracts/rough-cut.d.ts +1 -1
  98. package/dist/_types/contracts/shares.d.ts +19 -19
  99. package/dist/_types/contracts/speech.d.ts +5 -5
  100. package/dist/_types/contracts/temporal-evidence-operation.d.ts +1 -1
  101. package/dist/_types/contracts/video-generation.d.ts +2 -2
  102. package/dist/_types/contracts/video-review.d.ts +1 -1
  103. package/dist/_types/contracts/visual-exploration.d.ts +2 -2
  104. package/dist/_types/contracts/voice-profile/contracts.d.ts +4 -4
  105. package/dist/_types/sdk/local-runtime/workspace.d.ts +4 -4
  106. package/dist/_types/sdk/local-runtime-client.d.ts +3 -3
  107. package/dist/entry.js +1 -1
  108. package/dist/local-management.js +1 -1
  109. package/dist/local-navigation.js +1 -1
  110. package/package.json +1 -1
  111. package/dist/_chunks/chunk-5UJEP7FY.js +0 -1
  112. package/dist/_chunks/chunk-H6EZKOYR.js +0 -1
  113. package/dist/_chunks/chunk-NQVUVPW5.js +0 -1
  114. package/dist/_chunks/chunk-PDQYFIQQ.js +0 -1
  115. package/dist/_chunks/chunk-VOGKKZQH.js +0 -1
  116. package/dist/_chunks/chunk-YV447AB5.js +0 -1
  117. package/dist/_chunks/device-preflight-73KVSHZG.js +0 -1
  118. package/dist/_chunks/host-main-KDORT44Q.js +0 -1
  119. package/dist/_chunks/http-profile-QINBH2FP.js +0 -1
  120. package/dist/_chunks/mcp-3VZZFXNG.js +0 -1
  121. package/dist/_chunks/remote-client-XIJ6RQLU.js +0 -1
  122. package/dist/_chunks/src-3S6CAUSJ.js +0 -1
  123. package/dist/_chunks/stdio-main-T4WMBNKB.js +0 -1
  124. package/dist/_chunks/workspace-main-KWFTVTZG.js +0 -1
@@ -1,2 +1,2 @@
1
- import{loginLink,openLoginBrowser}from"./chunk-OW6R4MAQ.js";import{readInput}from"./chunk-U5FT4VBR.js";import{NativeStudioAccountClient,accountError,accountServerOrigin,clientHome,connectionStatus,readAccount,requireAccount,saveAccount,withAccountLock}from"./chunk-AAGFHT2D.js";import"./chunk-SKAVQ4UW.js";import{write}from"./chunk-RUPH3HZ2.js";import"./chunk-YV447AB5.js";import"./chunk-6UYY5KHI.js";import"./chunk-KOCUZ3AE.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";var aliases={find:"studio.start",overview:"studio.navigate",next:"studio.navigate",resume:"operation.get",skill:"workspace.caller"};var auth=new Set(["--tenant","--origin","--mcp-url","--profile","--token-env","--token-file"]);var fields={find:{"--query":"search","--project":"projectId","--limit":"limit","--next":"next","--attention":"attention"},overview:{"--production":"productionId","--project":"projectId","--goal":"goal","--limit":"actionLimit","--next":"actionNext"},next:{"--production":"productionId","--project":"projectId","--goal":"goal","--limit":"actionLimit","--next":"actionNext"},resume:{"--production":"productionId","--operation":"operationId"},search:{"--query":"query","--project":"projectId","--group":"group","--family":"family","--limit":"limit","--next":"next"},describe:{"--tool":"tool","--project":"projectId","--reference":"schemaCursor"},groups:{"--project":"projectId"},skill:{}};var NavigationCliCommands=new Set([...Object.keys(aliases),"capabilities"]);async function runNavigationCli(argv,stdin,call){const kind=argv[0]==="capabilities"?argv[1]?.startsWith("--")||!argv[1]?"groups":argv[1]:argv[0];const operation=argv[0]==="capabilities"?{groups:"studio.capability.groups",search:"studio.capability.search",describe:"studio.capability.describe"}[kind]:aliases[kind];const offset=argv[0]==="capabilities"&&argv[1]===kind?2:1;if(!operation||!fields[kind])throw Error("INVALID_INPUT");const forwarded=["call",operation],body={},seen=new Set;let input;for(let i=offset;i<argv.length;i+=2){const flag=argv[i],value=argv[i+1];if(!value||value.startsWith("--")||seen.has(flag))throw Error("INVALID_INPUT");seen.add(flag);if(auth.has(flag))forwarded.push(flag,value);else if(flag==="--input"&&kind!=="skill")input=value;else{const key=fields[kind][flag];if(!key)throw Error("INVALID_INPUT");body[key]=flag==="--limit"?Number(value):value}}if(input&&Object.keys(body).length)throw Error("INVALID_INPUT");forwarded.push("--input",input??"-");const generated=async function*(){yield Buffer.from(JSON.stringify(body))};const result=await call(forwarded,input?stdin:generated());return kind==="skill"&&result.exitCode===0?{...result,output:result.output.skill}:result}import{randomBytes,randomUUID,createHash,timingSafeEqual}from"node:crypto";import{createServer}from"node:http";import{join}from"node:path";async function accountSignals(timeout,run){const cancelled=new AbortController,signal=AbortSignal.any([AbortSignal.timeout(timeout),cancelled.signal]);const stop=()=>cancelled.abort();process.once("SIGINT",stop);process.once("SIGTERM",stop);try{return await run(signal)}finally{process.off("SIGINT",stop);process.off("SIGTERM",stop)}}async function runAccountLogin(argv,environment,hooks={}){const options=new Map;for(let i=1;i<argv.length;i+=2){const key=argv[i],value=argv[i+1];if(!key||!["--server","--browser","--timeout-ms"].includes(key)||!value||value.startsWith("--")||options.has(key))accountError("ACCOUNT_LOGIN_INPUT_INVALID");options.set(key,value)}const configured=options.get("--server")??environment.NATIVESTUDIO_STUDIO_ORIGIN;if(!configured)return{exitCode:2,output:{semanticStatus:"NEEDS_INPUT",error:{code:"ACCOUNT_SERVER_REQUIRED",outcome:"NO_WRITE"},nextSteps:["nvs login --server <Studio-origin> (no Project required)"]}};const origin=accountServerOrigin(configured),browser=options.get("--browser")??"auto",timeout=options.get("--timeout-ms")??"180000";if(!["auto","manual"].includes(browser)||!/^\d+$/.test(timeout)||Number(timeout)<1e3||Number(timeout)>3e5)accountError("ACCOUNT_LOGIN_INPUT_INVALID");const root=await clientHome(environment,true);return withAccountLock(root,()=>accountSignals(Number(timeout),async signal=>{if((await readAccount(root))?.state==="REVOKE_PENDING")accountError("ACCOUNT_LOGOUT_OUTCOME_UNKNOWN","UNKNOWN");const client=new NativeStudioAccountClient({serverOrigin:origin});await client.metadata(signal);const verifier=randomBytes(32).toString("base64url"),state=randomBytes(32).toString("base64url"),path="/account-callback/"+randomUUID();let finish,receiving=false,sent=false;const callback=new Promise(done=>{finish=done});const server=createServer({maxHeaderSize:8192,headersTimeout:5e3,requestTimeout:5e3},(req,res)=>{res.setHeader("cache-control","no-store");res.setHeader("content-type","text/plain; charset=utf-8");res.setHeader("x-content-type-options","nosniff");const address=server.address(),host=address&&typeof address!=="string"?`127.0.0.1:${address.port}`:"";if(receiving||req.method!=="GET"||req.headers.host!==host||req.headers.origin||!req.url||!req.url.startsWith(path+"?")||req.url.length>2048){res.writeHead(400).end("Invalid account callback.");return}const url=new URL(req.url,`http://${host}`),received=url.searchParams.get("state");const keys=[...url.searchParams.keys()];if(url.pathname!==path||new Set(keys).size!==keys.length||keys.some(k=>!["state","iss","code","error"].includes(k))||!received||Buffer.byteLength(received)!==Buffer.byteLength(state)||!timingSafeEqual(Buffer.from(received),Buffer.from(state))||url.searchParams.get("iss")!==origin||(url.searchParams.has("error")?url.searchParams.get("error")!=="access_denied"||url.searchParams.has("code"):!/^[A-Za-z0-9_-]{43}$/.test(url.searchParams.get("code")??""))){res.writeHead(400).end("Invalid account callback.");return}receiving=true;res.end("Account confirmation received. Return to NativeStudio CLI.");finish(url.searchParams.get("code"))});server.maxConnections=8;const expired=()=>finish(null);signal.addEventListener("abort",expired,{once:true});const attempt=join(root,"account-login-attempt.json");let attemptFile;try{await new Promise((done,fail)=>{server.once("error",fail);server.listen(0,"127.0.0.1",done)});const address=server.address();if(!address||typeof address==="string")throw Error();const redirectUri=`http://127.0.0.1:${address.port}${path}`;const started=await client.start({redirectUri,state,codeChallenge:createHash("sha256").update(verifier).digest("base64url")},signal);const url=`${origin}/cli-authorize?requestId=${started.requestId}`;signal.throwIfAborted();if(hooks.authorize)await hooks.authorize(url,signal);else{process.stderr.write(`CLI account login request: ${started.requestId}
2
- `);if(browser==="manual")loginLink(url);else await openLoginBrowser(url,signal)}const code=await callback;if(!code)accountError(signal.aborted?signal.reason?.name==="TimeoutError"?"ACCOUNT_LOGIN_TIMED_OUT":"ACCOUNT_LOGIN_CANCELLED":"ACCOUNT_LOGIN_DENIED");const marker={version:1,serverOrigin:origin,requestId:started.requestId,state:"EXCHANGE_UNRESOLVED"};attemptFile=join(root,`account-login-attempt-${started.requestId}.json`);await write(attemptFile,JSON.stringify(marker),true);await write(attempt,JSON.stringify(marker));signal.throwIfAborted();sent=true;const session=await client.exchange({requestId:started.requestId,redirectUri,code,codeVerifier:verifier},signal);if(Date.parse(session.expiresAt)<=Date.now()||Date.parse(session.expiresAt)>Date.now()+36e5+3e4)accountError("ACCOUNT_SESSION_INVALID","UNKNOWN");await saveAccount(root,{version:1,epoch:randomUUID(),state:"ACTIVE",serverOrigin:origin,accessToken:session.accessToken,expiresAt:session.expiresAt,principalId:session.account.principalId,workspaceId:null,projectId:null});await write(attempt,JSON.stringify({...marker,state:"COMPLETED"}));await write(attemptFile,JSON.stringify({...marker,state:"COMPLETED"}));return{exitCode:0,output:{semanticStatus:"SUCCESS",authenticated:true,credentialPurpose:"CLI_ACCOUNT",serverOrigin:origin,expiresAt:session.expiresAt,account:session.account,nextSteps:["nvs workspaces","nvs workspace --id <workspace-id>","nvs projects"]}}}catch(error){if(sent){if(error instanceof NativeStudioSdkError&&error.outcome!=="UNKNOWN"){await write(attempt,JSON.stringify({version:1,state:"REJECTED"}));if(attemptFile)await write(attemptFile,JSON.stringify({version:1,state:"REJECTED"}));throw error}accountError("ACCOUNT_LOGIN_OUTCOME_UNKNOWN","UNKNOWN")}if(error instanceof NativeStudioSdkError&&error.outcome==="UNKNOWN")accountError("ACCOUNT_LOGIN_OUTCOME_UNKNOWN","UNKNOWN");if(signal.aborted)accountError(signal.reason?.name==="TimeoutError"?"ACCOUNT_LOGIN_TIMED_OUT":"ACCOUNT_LOGIN_CANCELLED");throw error}finally{signal.removeEventListener("abort",expired);server.closeAllConnections();await new Promise(done=>server.close(()=>done()))}}))}import{randomUUID as randomUUID2}from"node:crypto";import{z}from"zod";var AccountCommands=new Set(["whoami","workspaces","workspace","projects","project","logout"]);async function runAccountCommand(argv,environment){const command=argv[0],options=new Map;for(let i=1;i<argv.length;i+=2){const key=argv[i],value=argv[i+1];if(!key||!["--id","--limit","--next"].includes(key)||!value||value.startsWith("--")||options.has(key))accountError("ACCOUNT_COMMAND_INPUT_INVALID");options.set(key,value)}if(["workspace","project"].includes(command??"")?options.size!==1||!options.has("--id"):command==="projects"?options.has("--id"):options.size!==0)accountError("ACCOUNT_COMMAND_INPUT_INVALID");const root=await clientHome(environment,true);return withAccountLock(root,()=>accountSignals(15e3,async signal=>{const stored=await readAccount(root);if(command==="logout"){if(!stored||stored.state==="SIGNED_OUT")return{exitCode:0,output:{semanticStatus:"SUCCESS",authenticated:false,changed:false}};const client2=new NativeStudioAccountClient({serverOrigin:stored.serverOrigin,accessToken:stored.accessToken});const pending={...stored,state:"REVOKE_PENDING",workspaceId:null,projectId:null};await saveAccount(root,pending);try{await client2.logout(signal);await saveAccount(root,{...pending,state:"SIGNED_OUT",accessToken:null})}catch{accountError("ACCOUNT_LOGOUT_OUTCOME_UNKNOWN","UNKNOWN")}return{exitCode:0,output:{semanticStatus:"SUCCESS",authenticated:false,changed:true,nextSteps:["nvs login --server <Studio-origin>"]}}}const account=requireAccount(stored),client=new NativeStudioAccountClient({serverOrigin:account.serverOrigin,accessToken:account.accessToken});if(command==="whoami"||command==="workspaces"||command==="workspace"){const value2=await client.me(signal);if(value2.account.principalId!==account.principalId)accountError("ACCOUNT_IDENTITY_MISMATCH");if(command==="workspace"){const id=z.uuid().parse(options.get("--id"));if(!value2.account.tenants.some(t=>t.id===id))accountError("WORKSPACE_NOT_AUTHORIZED");await saveAccount(root,{...account,workspaceId:id,projectId:account.workspaceId===id?account.projectId:null,epoch:account.workspaceId===id?account.epoch:randomUUID2()});return{exitCode:0,output:{semanticStatus:"SUCCESS",workspaceId:id,nextSteps:["nvs projects"]}}}return{exitCode:0,output:{semanticStatus:"SUCCESS",authenticated:true,credentialPurpose:"CLI_ACCOUNT",verification:"LIVE_NATIVE_ACCOUNT",...command==="workspaces"?{workspaces:value2.account.tenants}:{account:value2.account,workspaceId:account.workspaceId,projectId:account.projectId,expiresAt:account.expiresAt},nextSteps:["nvs workspace --id <workspace-id>"]}}}if(!account.workspaceId)accountError("WORKSPACE_SELECTION_REQUIRED");if(command==="projects"){const limit=options.has("--limit")?z.coerce.number().int().min(1).max(100).parse(options.get("--limit")):void 0;const value2=await client.projects({tenantId:account.workspaceId,limit,next:options.get("--next")},signal);if(value2.items.some(p=>p.tenantId!==account.workspaceId))accountError("ACCOUNT_RESPONSE_SCOPE_MISMATCH");return{exitCode:0,output:{semanticStatus:"SUCCESS",...value2,nextSteps:["nvs project --id <project-id>"]}}}if(command!=="project")accountError("ACCOUNT_COMMAND_INPUT_INVALID");const projectId=z.uuid().parse(options.get("--id")),value=await client.project({tenantId:account.workspaceId,projectId},signal);if(value.project.id!==projectId||value.project.tenantId!==account.workspaceId)accountError("ACCOUNT_RESPONSE_SCOPE_MISMATCH");if(value.project.lifecycle!=="ACTIVE")accountError("PROJECT_ARCHIVED");await saveAccount(root,{...account,projectId});return{exitCode:0,output:{semanticStatus:"SUCCESS",project:value.project,connectionPage:`${account.serverOrigin}/projects/${projectId}/settings`,nextSteps:["Use the existing workspace connection; run nvs connect if this workspace is not connected.","nvs status"]}}}))}var exits={SUCCESS:0,ACCEPTED:0,INVALID_INPUT:2,NOT_FOUND:3,BLOCKED:4,CAPABILITY_UNAVAILABLE:4,REVISION_CONFLICT:5};async function runRemoteCli(argv,environment=process.env,stdin=process.stdin){try{if(argv[0]==="connect")return await(await import("./connect-RIODOO3C.js")).runConnect(argv,environment);if(argv[0]==="login")return await runAccountLogin(argv,environment);if(argv[0]==="render")return await(await import("./render-main-O3IN6EFV.js")).renderCommand(argv.slice(1),environment);if(argv[0]==="devices")return await(await import("./devices-main-7JHMJNGV.js")).devicesCommand(argv.slice(1),environment,stdin);if(argv[0]==="import")return await(await import("./source-import-Y2Z3BVWY.js")).importSourceCommand(argv.slice(1),environment,stdin);if(AccountCommands.has(argv[0]??"")){const business=await(await import("./workspace-main-KWFTVTZG.js")).workspaceCommand(argv,environment);return business??await runAccountCommand(argv,environment)}if(argv.length===1&&argv[0]==="status")return await connectionStatus(environment);if(NavigationCliCommands.has(argv[0]??""))return await runNavigationCli(argv,stdin,(args2,input2)=>runRemoteCli(args2,environment,input2));if(["auth-start","auth-complete"].includes(argv[0]??""))return await(await import("./oauth-QBJ62PIA.js")).runOAuthCommand(argv,stdin);if(!argv.length||argv.length===1&&["help","--help"].includes(argv[0]))return{exitCode:0,output:{product:"NativeStudio CLI",start:["nvs login --server <Studio-origin> \u2014 sign in/register your account in the browser; no project required.","nvs workspaces; nvs workspace --id <id>; nvs projects; nvs project --id <id>","nvs connect (authorizes the selected workspace once; supports its Projects and devices)","nvs status","nvs skill \u2014 read the configured SKILL download URL through the existing connection","nvs find --query <intent>"],navigation:["nvs capabilities","nvs overview --production <uuid>","nvs next --production <uuid>","nvs resume --production <uuid> --operation <op_original>"],agentConnection:{command:"nvs",args:["mcp"],note:"Uses the private saved connection; no token in Agent configuration."},commands:["login --server <Studio-origin> | whoami | logout \u2014 independent account session","workspaces | workspace --id <id> | projects [--limit <n>] [--next <cursor>] | project --id <id>","connect [--mcp-url <workspace-connection-url>] \u2014 authorize the workspace once for its Projects and devices","status","observe --input <scope-json|-> [--max-polls <1..1000>] [--timeout-ms <1..1800000>] \u2014 bounded JSON Lines feedback/events; Ctrl-C ends observation only","skill \u2014 read the configured SKILL download URL/status; no automatic download","find --query <text> [--project <uuid>]","overview | next --production <uuid> [--goal <text>]","resume --production <uuid> --operation <op_original>","capabilities [groups | search --query <text> --group <group> | describe --tool <name>]","devices inventory [--device <uuid>] [--after <uuid>] [--limit <1..50>] [--mcp-url <workspace-url> --token-file <private-file>] \u2014 read Workspace device registration and connection facts; no project required","devices list --kind preview|final|library|<processor-kind> [--project <uuid>] [--device <uuid>] [--mcp-url <workspace-url> --token-file <private-file>] \u2014 read candidates for this Project task; connection alone does not imply eligibility","devices enroll|revoke|receipt --input <json|-> \u2014 uses the saved tenant OAuth and original native command","render preview|final --production <uuid> --request <stable-uuid> [--project <uuid>] [--device <uuid>] [--validation-mode TENANT_TRUSTED_VALIDATOR] \u2014 tenant device only; saves original receipt","render status|download --kind preview|final --production <uuid> --render <uuid> [--project <uuid>] [--output <file>]","mcp \u2014 connect the Agent using the private saved connection","local help \u2014 installed Runtime, scoped local MCP, explicit exact-version updates","host help \u2014 enroll/prove/connect an execution device using the external Agent's existing MCP session; discover the separate SKILL URL with nvs skill or workspace_caller.skill"],advanced:["operations","mcp --profile <private-file> | --mcp-url <endpoint> --token-env <NAME>|--token-file <private-file>","call <operation> --input <file|-> --tenant <uuid> --token-env <NAME> --origin <https-origin>","call <operation> --input <file|-> --tenant <uuid> --token-file <private-file> --mcp-url <https-endpoint>","auth-start --profile <new-private-file> --mcp-url <resource> --callback <receiver-url>","auth-complete --profile <private-file> --input <callback-json-file|->","call <operation> --profile <private-file> --tenant <uuid> --input <file|->","import project|original --input <intent.json|-> --file <media> --tenant <uuid> --origin <https-origin> --token-file <private-file>"],note:"No automatic write retry. Transport abort does not cancel native Jobs."}};const{sdkOperations,sdkMcpTools,sdkCarrierDifferences,assertCarrierCoverage}=await import("./src-3S6CAUSJ.js");if(argv.length===1&&argv[0]==="operations"){assertCarrierCoverage(sdkOperations,sdkCarrierDifferences);return{exitCode:0,output:{operations:Object.entries(sdkOperations).map(([name2,spec])=>({name:name2,readOnly:spec.readOnly??null,http:spec.request!==null,mcp:sdkMcpTools[name2],carrierDifference:Object.hasOwn(sdkCarrierDifferences,name2)?sdkCarrierDifferences[name2]:null}))}}}const[command,name,...args]=argv;if(command!=="call"||!name||!Object.hasOwn(sdkOperations,name))throw Error();if(name==="rough-cut.media-ticket"||name==="final-render.media-ticket")throw Error();const options=new Map;const allowed=["--input","--tenant","--origin","--mcp-url","--token-env","--token-file","--profile","--transport"];for(let i=0;i<args.length;i+=2){const key2=args[i],value=args[i+1];if(!key2||!allowed.includes(key2)||!value||value.startsWith("--")||options.has(key2))throw Error();options.set(key2,value)}if(!options.has("--input"))throw Error();const key=name;const privateInput=["provider.configure","webhook.configure","webhook.secret.prepare"].includes(key);const input=await readInput(options.get("--input"),stdin,privateInput);const output=await(await import("./remote-client-XIJ6RQLU.js")).withRemoteClient(options,environment,sdkMcpTools[key]===null,studio=>studio.call(key,input));const status=output?.semanticStatus;return{exitCode:status?exits[status]??1:0,output}}catch(error){const e=error instanceof NativeStudioSdkError?error:null;const accountRecovery={ACCOUNT_LOGIN_OUTCOME_UNKNOWN:["Start a fresh nvs login --server <Studio-origin>; never replay the old exchange."],ACCOUNT_LOGOUT_OUTCOME_UNKNOWN:["Retry nvs logout explicitly; local account use remains locked."],ACCOUNT_LOGIN_REQUIRED:["nvs login --server <Studio-origin>"],ACCOUNT_SESSION_EXPIRED_OR_REVOKED:["nvs login --server <Studio-origin>"],WORKSPACE_SELECTION_REQUIRED:["nvs workspaces","nvs workspace --id <workspace-id>"],CONNECTION_ACCOUNT_MISMATCH:["nvs whoami","nvs workspaces","nvs project --id <project-id>","nvs connect --mcp-url <workspace-connection-url>"],ACCOUNT_PROJECT_SELECTION_REQUIRED:["nvs whoami","nvs workspace --id <workspace-id>","nvs project --id <project-id>"],AUTHORIZED_CONNECTION_NOT_SELECTED:["Authorization may exist. Inspect Web grants; select the intended account/project before creating a fresh connection."]};return{exitCode:e?exits[e.semanticStatus]??1:2,output:{semanticStatus:e?.semanticStatus??"INVALID_INPUT",error:{code:e?.code??"INVALID_INPUT",outcome:e?.outcome??"NO_WRITE",...e?.issues.length?{issues:e.issues}:{}},...e&&accountRecovery[e.code]?{nextSteps:accountRecovery[e.code]}:{},...["TENANT_CONNECTION_REQUIRED","OAUTH_OUTCOME_UNKNOWN"].includes(e?.code??"")?{nextSteps:["nvs connect --mcp-url <workspace-connection-url>","nvs help"]}:{}}}}}export{runRemoteCli};
1
+ import{loginLink,openLoginBrowser}from"./chunk-OW6R4MAQ.js";import{readInput}from"./chunk-U5FT4VBR.js";import{NativeStudioAccountClient,accountError,accountServerOrigin,clientHome,connectionStatus,defaultConnection,readAccount,requireAccount,saveAccount,withAccountLock}from"./chunk-TWC3NXFA.js";import"./chunk-SKAVQ4UW.js";import{write}from"./chunk-RUPH3HZ2.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import"./chunk-KOCUZ3AE.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";var aliases={find:"studio.start",overview:"studio.navigate",next:"studio.navigate",resume:"operation.get",skill:"workspace.caller"};var auth=new Set(["--tenant","--origin","--mcp-url","--profile","--token-env","--token-file"]);var fields={find:{"--query":"search","--project":"projectId","--limit":"limit","--next":"next","--attention":"attention"},overview:{"--production":"productionId","--project":"projectId","--goal":"goal","--limit":"actionLimit","--next":"actionNext"},next:{"--production":"productionId","--project":"projectId","--goal":"goal","--limit":"actionLimit","--next":"actionNext"},resume:{"--production":"productionId","--operation":"operationId"},search:{"--query":"query","--project":"projectId","--group":"group","--family":"family","--limit":"limit","--next":"next"},describe:{"--tool":"tool","--project":"projectId","--reference":"schemaCursor"},groups:{"--project":"projectId"},skill:{}};var NavigationCliCommands=new Set([...Object.keys(aliases),"capabilities"]);async function runNavigationCli(argv,stdin,call){const kind=argv[0]==="capabilities"?argv[1]?.startsWith("--")||!argv[1]?"groups":argv[1]:argv[0];const operation=argv[0]==="capabilities"?{groups:"studio.capability.groups",search:"studio.capability.search",describe:"studio.capability.describe"}[kind]:aliases[kind];const offset=argv[0]==="capabilities"&&argv[1]===kind?2:1;if(!operation||!fields[kind])throw Error("INVALID_INPUT");const forwarded=["call",operation],body={},seen=new Set;let input;for(let i=offset;i<argv.length;i+=2){const flag=argv[i],value=argv[i+1];if(!value||value.startsWith("--")||seen.has(flag))throw Error("INVALID_INPUT");seen.add(flag);if(auth.has(flag))forwarded.push(flag,value);else if(flag==="--input"&&kind!=="skill")input=value;else{const key=fields[kind][flag];if(!key)throw Error("INVALID_INPUT");body[key]=flag==="--limit"?Number(value):value}}if(input&&Object.keys(body).length)throw Error("INVALID_INPUT");forwarded.push("--input",input??"-");const generated=async function*(){yield Buffer.from(JSON.stringify(body))};const result=await call(forwarded,input?stdin:generated());return kind==="skill"&&result.exitCode===0?{...result,output:result.output.skill}:result}import{randomBytes,randomUUID,createHash,timingSafeEqual}from"node:crypto";import{createServer}from"node:http";import{join}from"node:path";async function accountSignals(timeout,run){const cancelled=new AbortController,signal=AbortSignal.any([AbortSignal.timeout(timeout),cancelled.signal]);const stop=()=>cancelled.abort();process.once("SIGINT",stop);process.once("SIGTERM",stop);try{return await run(signal)}finally{process.off("SIGINT",stop);process.off("SIGTERM",stop)}}async function runAccountLogin(argv,environment,hooks={}){const options=new Map;for(let i=1;i<argv.length;i+=2){const key=argv[i],value=argv[i+1];if(!key||!["--server","--browser","--timeout-ms"].includes(key)||!value||value.startsWith("--")||options.has(key))accountError("ACCOUNT_LOGIN_INPUT_INVALID");options.set(key,value)}const configured=options.get("--server")??environment.NATIVESTUDIO_STUDIO_ORIGIN;if(!configured)return{exitCode:2,output:{semanticStatus:"NEEDS_INPUT",error:{code:"ACCOUNT_SERVER_REQUIRED",outcome:"NO_WRITE"},nextSteps:["nvs login --server <Studio-origin> (no Project required)"]}};const origin=accountServerOrigin(configured),browser=options.get("--browser")??"auto",timeout=options.get("--timeout-ms")??"180000";if(!["auto","manual"].includes(browser)||!/^\d+$/.test(timeout)||Number(timeout)<1e3||Number(timeout)>3e5)accountError("ACCOUNT_LOGIN_INPUT_INVALID");const root=await clientHome(environment,true);return withAccountLock(root,()=>accountSignals(Number(timeout),async signal=>{if((await readAccount(root))?.state==="REVOKE_PENDING")accountError("ACCOUNT_LOGOUT_OUTCOME_UNKNOWN","UNKNOWN");const client=new NativeStudioAccountClient({serverOrigin:origin});await client.metadata(signal);const verifier=randomBytes(32).toString("base64url"),state=randomBytes(32).toString("base64url"),path="/account-callback/"+randomUUID();let finish,receiving=false,sent=false;const callback=new Promise(done=>{finish=done});const server=createServer({maxHeaderSize:8192,headersTimeout:5e3,requestTimeout:5e3},(req,res)=>{res.setHeader("cache-control","no-store");res.setHeader("content-type","text/plain; charset=utf-8");res.setHeader("x-content-type-options","nosniff");const address=server.address(),host=address&&typeof address!=="string"?`127.0.0.1:${address.port}`:"";if(receiving||req.method!=="GET"||req.headers.host!==host||req.headers.origin||!req.url||!req.url.startsWith(path+"?")||req.url.length>2048){res.writeHead(400).end("Invalid account callback.");return}const url=new URL(req.url,`http://${host}`),received=url.searchParams.get("state");const keys=[...url.searchParams.keys()];if(url.pathname!==path||new Set(keys).size!==keys.length||keys.some(k=>!["state","iss","code","error"].includes(k))||!received||Buffer.byteLength(received)!==Buffer.byteLength(state)||!timingSafeEqual(Buffer.from(received),Buffer.from(state))||url.searchParams.get("iss")!==origin||(url.searchParams.has("error")?url.searchParams.get("error")!=="access_denied"||url.searchParams.has("code"):!/^[A-Za-z0-9_-]{43}$/.test(url.searchParams.get("code")??""))){res.writeHead(400).end("Invalid account callback.");return}receiving=true;res.end("Account confirmation received. Return to NativeStudio CLI.");finish(url.searchParams.get("code"))});server.maxConnections=8;const expired=()=>finish(null);signal.addEventListener("abort",expired,{once:true});const attempt=join(root,"account-login-attempt.json");let attemptFile;try{await new Promise((done,fail)=>{server.once("error",fail);server.listen(0,"127.0.0.1",done)});const address=server.address();if(!address||typeof address==="string")throw Error();const redirectUri=`http://127.0.0.1:${address.port}${path}`;const started=await client.start({redirectUri,state,codeChallenge:createHash("sha256").update(verifier).digest("base64url")},signal);const url=`${origin}/cli-authorize?requestId=${started.requestId}`;signal.throwIfAborted();if(hooks.authorize)await hooks.authorize(url,signal);else{process.stderr.write(`CLI account login request: ${started.requestId}
2
+ `);if(browser==="manual")loginLink(url);else await openLoginBrowser(url,signal)}const code=await callback;if(!code)accountError(signal.aborted?signal.reason?.name==="TimeoutError"?"ACCOUNT_LOGIN_TIMED_OUT":"ACCOUNT_LOGIN_CANCELLED":"ACCOUNT_LOGIN_DENIED");const marker={version:1,serverOrigin:origin,requestId:started.requestId,state:"EXCHANGE_UNRESOLVED"};attemptFile=join(root,`account-login-attempt-${started.requestId}.json`);await write(attemptFile,JSON.stringify(marker),true);await write(attempt,JSON.stringify(marker));signal.throwIfAborted();sent=true;const session=await client.exchange({requestId:started.requestId,redirectUri,code,codeVerifier:verifier},signal);if(Date.parse(session.expiresAt)<=Date.now()||Date.parse(session.expiresAt)>Date.now()+36e5+3e4)accountError("ACCOUNT_SESSION_INVALID","UNKNOWN");await saveAccount(root,{version:1,epoch:randomUUID(),state:"ACTIVE",serverOrigin:origin,accessToken:session.accessToken,expiresAt:session.expiresAt,principalId:session.account.principalId,workspaceId:null,projectId:null});await write(attempt,JSON.stringify({...marker,state:"COMPLETED"}));await write(attemptFile,JSON.stringify({...marker,state:"COMPLETED"}));return{exitCode:0,output:{semanticStatus:"SUCCESS",authenticated:true,credentialPurpose:"CLI_ACCOUNT",serverOrigin:origin,expiresAt:session.expiresAt,account:session.account,nextSteps:["nvs workspaces","nvs workspace --id <workspace-id>","nvs projects"]}}}catch(error){if(sent){if(error instanceof NativeStudioSdkError&&error.outcome!=="UNKNOWN"){await write(attempt,JSON.stringify({version:1,state:"REJECTED"}));if(attemptFile)await write(attemptFile,JSON.stringify({version:1,state:"REJECTED"}));throw error}accountError("ACCOUNT_LOGIN_OUTCOME_UNKNOWN","UNKNOWN")}if(error instanceof NativeStudioSdkError&&error.outcome==="UNKNOWN")accountError("ACCOUNT_LOGIN_OUTCOME_UNKNOWN","UNKNOWN");if(signal.aborted)accountError(signal.reason?.name==="TimeoutError"?"ACCOUNT_LOGIN_TIMED_OUT":"ACCOUNT_LOGIN_CANCELLED");throw error}finally{signal.removeEventListener("abort",expired);server.closeAllConnections();await new Promise(done=>server.close(()=>done()))}}))}import{randomUUID as randomUUID2}from"node:crypto";import{z}from"zod";var AccountCommands=new Set(["whoami","workspaces","workspace","projects","project","logout"]);async function runAccountCommand(argv,environment){const command=argv[0],options=new Map;for(let i=1;i<argv.length;i+=2){const key=argv[i],value=argv[i+1];if(!key||!["--id","--limit","--next"].includes(key)||!value||value.startsWith("--")||options.has(key))accountError("ACCOUNT_COMMAND_INPUT_INVALID");options.set(key,value)}if(["workspace","project"].includes(command??"")?options.size!==1||!options.has("--id"):command==="projects"?options.has("--id"):options.size!==0)accountError("ACCOUNT_COMMAND_INPUT_INVALID");const root=await clientHome(environment,true);return withAccountLock(root,()=>accountSignals(15e3,async signal=>{const stored=await readAccount(root);if(command==="logout"){if(!stored||stored.state==="SIGNED_OUT")return{exitCode:0,output:{semanticStatus:"SUCCESS",authenticated:false,changed:false}};const client2=new NativeStudioAccountClient({serverOrigin:stored.serverOrigin,accessToken:stored.accessToken});const pending={...stored,state:"REVOKE_PENDING",workspaceId:null,projectId:null};await saveAccount(root,pending);try{await client2.logout(signal);await saveAccount(root,{...pending,state:"SIGNED_OUT",accessToken:null})}catch{accountError("ACCOUNT_LOGOUT_OUTCOME_UNKNOWN","UNKNOWN")}return{exitCode:0,output:{semanticStatus:"SUCCESS",authenticated:false,changed:true,nextSteps:["nvs login --server <Studio-origin>"]}}}const account=requireAccount(stored),client=new NativeStudioAccountClient({serverOrigin:account.serverOrigin,accessToken:account.accessToken});if(command==="whoami"||command==="workspaces"||command==="workspace"){const value2=await client.me(signal);if(value2.account.principalId!==account.principalId)accountError("ACCOUNT_IDENTITY_MISMATCH");if(command==="workspace"){const id=z.uuid().parse(options.get("--id"));if(!value2.account.tenants.some(t=>t.id===id))accountError("WORKSPACE_NOT_AUTHORIZED");await saveAccount(root,{...account,workspaceId:id,projectId:account.workspaceId===id?account.projectId:null,epoch:account.workspaceId===id?account.epoch:randomUUID2()});return{exitCode:0,output:{semanticStatus:"SUCCESS",workspaceId:id,nextSteps:["nvs projects"]}}}return{exitCode:0,output:{semanticStatus:"SUCCESS",authenticated:true,credentialPurpose:"CLI_ACCOUNT",verification:"LIVE_NATIVE_ACCOUNT",...command==="workspaces"?{workspaces:value2.account.tenants}:{account:value2.account,workspaceId:account.workspaceId,projectId:account.projectId,expiresAt:account.expiresAt},nextSteps:["nvs workspace --id <workspace-id>"]}}}if(!account.workspaceId)accountError("WORKSPACE_SELECTION_REQUIRED");if(command==="projects"){const limit=options.has("--limit")?z.coerce.number().int().min(1).max(100).parse(options.get("--limit")):void 0;const value2=await client.projects({tenantId:account.workspaceId,limit,next:options.get("--next")},signal);if(value2.items.some(p=>p.tenantId!==account.workspaceId))accountError("ACCOUNT_RESPONSE_SCOPE_MISMATCH");return{exitCode:0,output:{semanticStatus:"SUCCESS",...value2,nextSteps:["nvs project --id <project-id>"]}}}if(command!=="project")accountError("ACCOUNT_COMMAND_INPUT_INVALID");const projectId=z.uuid().parse(options.get("--id")),value=await client.project({tenantId:account.workspaceId,projectId},signal);if(value.project.id!==projectId||value.project.tenantId!==account.workspaceId)accountError("ACCOUNT_RESPONSE_SCOPE_MISMATCH");if(value.project.lifecycle!=="ACTIVE")accountError("PROJECT_ARCHIVED");await saveAccount(root,{...account,projectId});return{exitCode:0,output:{semanticStatus:"SUCCESS",project:value.project,connectionPage:`${account.serverOrigin}/projects/${projectId}/settings`,nextSteps:["Use the existing workspace connection; run nvs connect if this workspace is not connected.","nvs status"]}}}))}var exits={SUCCESS:0,ACCEPTED:0,INVALID_INPUT:2,NOT_FOUND:3,BLOCKED:4,CAPABILITY_UNAVAILABLE:4,REVISION_CONFLICT:5};async function runRemoteCli(argv,environment=process.env,stdin=process.stdin){try{if(argv[0]==="connect")return await(await import("./connect-OY623MMA.js")).runConnect(argv,environment);if(argv[0]==="login")return await runAccountLogin(argv,environment);if(argv[0]==="render")return await(await import("./render-main-ATCEBECW.js")).renderCommand(argv.slice(1),environment);if(argv[0]==="devices")return await(await import("./devices-main-LBDRDV2M.js")).devicesCommand(argv.slice(1),environment,stdin);if(argv[0]==="import")return await(await import("./source-import-HIL7NW3L.js")).importSourceCommand(argv.slice(1),environment,stdin);if(AccountCommands.has(argv[0]??"")){const business=await(await import("./workspace-main-44ECTGHC.js")).workspaceCommand(argv,environment);return business??await runAccountCommand(argv,environment)}if(argv.length===1&&argv[0]==="status")return await connectionStatus(environment);if(NavigationCliCommands.has(argv[0]??""))return await runNavigationCli(argv,stdin,(args2,input2)=>runRemoteCli(args2,environment,input2));if(["auth-start","auth-complete"].includes(argv[0]??""))return await(await import("./oauth-QBJ62PIA.js")).runOAuthCommand(argv,stdin);if(!argv.length||argv.length===1&&["help","--help"].includes(argv[0]))return{exitCode:0,output:{product:"NativeStudio CLI",start:["nvs login --server <Studio-origin> \u2014 sign in/register your account in the browser; no project required.","nvs workspaces; nvs workspace --id <id>; nvs projects; nvs project --id <id>","nvs connect (authorizes the selected workspace once; supports its Projects and devices)","nvs status","nvs skill \u2014 read the configured SKILL download URL through the existing connection","nvs find --query <intent>"],navigation:["nvs capabilities","nvs overview --production <uuid>","nvs next --production <uuid>","nvs resume --production <uuid> --operation <op_original>"],agentConnection:{command:"nvs",args:["mcp"],note:"Uses the private saved connection; no token in Agent configuration."},commands:["login --server <Studio-origin> | whoami | logout \u2014 independent account session","workspaces | workspace --id <id> | projects [--limit <n>] [--next <cursor>] | project --id <id>","connect [--mcp-url <workspace-connection-url>] \u2014 authorize the workspace once for its Projects and devices","status","observe --input <scope-json|-> [--max-polls <1..1000>] [--timeout-ms <1..1800000>] \u2014 bounded JSON Lines feedback/events; Ctrl-C ends observation only","skill \u2014 read the configured SKILL download URL/status; no automatic download","find --query <text> [--project <uuid>]","overview | next --production <uuid> [--goal <text>]","resume --production <uuid> --operation <op_original>","capabilities [groups | search --query <text> --group <group> | describe --tool <name>]","devices inventory [--device <uuid>] [--after <uuid>] [--limit <1..50>] [--mcp-url <workspace-url> --token-file <private-file>] \u2014 read Workspace device registration and connection facts; no project required","devices list --kind preview|final|library|<processor-kind> [--project <uuid>] [--device <uuid>] [--mcp-url <workspace-url> --token-file <private-file>] \u2014 read candidates for this Project task; connection alone does not imply eligibility","devices enroll|revoke|receipt --input <json|-> \u2014 uses the saved tenant OAuth and original native command","render preview|final --production <uuid> --request <stable-uuid> [--project <uuid>] [--device <uuid>] [--validation-mode TENANT_TRUSTED_VALIDATOR] \u2014 tenant device only; saves original receipt","render status|download --kind preview|final --production <uuid> --render <uuid> [--project <uuid>] [--output <file>]","mcp \u2014 connect the Agent using the private saved connection","local help \u2014 installed Runtime, scoped local MCP, explicit exact-version updates","host help \u2014 enroll/prove/connect an execution device using the external Agent's existing MCP session; discover the separate SKILL URL with nvs skill or workspace_caller.skill"],advanced:["operations","mcp --profile <private-file> | --mcp-url <endpoint> --token-env <NAME>|--token-file <private-file>","call <operation> --input <file|-> --tenant <uuid> --token-env <NAME> --origin <https-origin>","call <operation> --input <file|-> --tenant <uuid> --token-file <private-file> --mcp-url <https-endpoint>","auth-start --profile <new-private-file> --mcp-url <resource> --callback <receiver-url>","auth-complete --profile <private-file> --input <callback-json-file|->","call <operation> --profile <private-file> --tenant <uuid> --input <file|->","import project|original --input <intent.json|-> --file <media> --tenant <uuid> --origin <https-origin> --token-file <private-file>"],note:"No automatic write retry. Transport abort does not cancel native Jobs."}};const{sdkOperations,sdkMcpTools,sdkCarrierDifferences,assertCarrierCoverage}=await import("./src-MRFJOTKK.js");if(argv.length===1&&argv[0]==="operations"){assertCarrierCoverage(sdkOperations,sdkCarrierDifferences);return{exitCode:0,output:{operations:Object.entries(sdkOperations).map(([name2,spec])=>({name:name2,readOnly:spec.readOnly??null,http:spec.request!==null,mcp:sdkMcpTools[name2],carrierDifference:Object.hasOwn(sdkCarrierDifferences,name2)?sdkCarrierDifferences[name2]:null}))}}}const[command,name,...args]=argv;if(command!=="call"||!name||!Object.hasOwn(sdkOperations,name))throw Error();if(name==="rough-cut.media-ticket"||name==="final-render.media-ticket")throw Error();const options=new Map;const allowed=["--input","--tenant","--origin","--mcp-url","--token-env","--token-file","--profile","--transport"];for(let i=0;i<args.length;i+=2){const key2=args[i],value=args[i+1];if(!key2||!allowed.includes(key2)||!value||value.startsWith("--")||options.has(key2))throw Error();options.set(key2,value)}if(!options.has("--input"))throw Error();const key=name;const privateInput=["provider.configure","webhook.configure","webhook.secret.prepare"].includes(key);await defaultConnection(options,environment,true);const input=await readInput(options.get("--input"),stdin,privateInput);const output=await(await import("./remote-client-6XHMNMXK.js")).withRemoteClient(options,environment,sdkMcpTools[key]===null,studio=>studio.call(key,input));const status=output?.semanticStatus;return{exitCode:status?exits[status]??1:0,output}}catch(error){const e=error instanceof NativeStudioSdkError?error:null;const accountRecovery={ACCOUNT_LOGIN_OUTCOME_UNKNOWN:["Start a fresh nvs login --server <Studio-origin>; never replay the old exchange."],ACCOUNT_LOGOUT_OUTCOME_UNKNOWN:["Retry nvs logout explicitly; local account use remains locked."],ACCOUNT_LOGIN_REQUIRED:["nvs login --server <Studio-origin>"],ACCOUNT_SESSION_EXPIRED_OR_REVOKED:["nvs login --server <Studio-origin>"],WORKSPACE_SELECTION_REQUIRED:["nvs workspaces","nvs workspace --id <workspace-id>"],CONNECTION_ACCOUNT_MISMATCH:["nvs whoami","nvs workspaces","nvs project --id <project-id>","nvs connect --mcp-url <workspace-connection-url>"],ACCOUNT_PROJECT_SELECTION_REQUIRED:["nvs whoami","nvs workspace --id <workspace-id>","nvs project --id <project-id>"],AUTHORIZED_CONNECTION_NOT_SELECTED:["Authorization may exist. Inspect Web grants; select the intended account/workspace before creating a fresh connection."]};return{exitCode:e?exits[e.semanticStatus]??1:2,output:{semanticStatus:e?.semanticStatus??"INVALID_INPUT",error:{code:e?.code??"INVALID_INPUT",outcome:e?.outcome??"NO_WRITE",...e?.issues.length?{issues:e.issues}:{}},...e&&accountRecovery[e.code]?{nextSteps:accountRecovery[e.code]}:{},...["TENANT_CONNECTION_REQUIRED","OAUTH_OUTCOME_UNKNOWN"].includes(e?.code??"")?{nextSteps:["nvs connect --mcp-url <workspace-connection-url>","nvs help"]}:{}}}}}export{runRemoteCli};
@@ -0,0 +1 @@
1
+ import{connectRemoteMcp}from"./chunk-65X56WAQ.js";import"./chunk-2UYKJ6YN.js";import"./chunk-4NJIT52T.js";import"./chunk-C7CSZFV6.js";import"./chunk-CW67UB2I.js";import"./chunk-HAOCQVMU.js";import"./chunk-KOCUZ3AE.js";import"./chunk-HTUTYIRU.js";export{connectRemoteMcp};
@@ -1 +1 @@
1
- import{withRemoteClient}from"./chunk-CFZNDURD.js";import{readInput}from"./chunk-U5FT4VBR.js";import{observeProduction}from"./chunk-VOGKKZQH.js";import"./chunk-PDQYFIQQ.js";import"./chunk-AAGFHT2D.js";import"./chunk-SKAVQ4UW.js";import"./chunk-RUPH3HZ2.js";import"./chunk-YV447AB5.js";import"./chunk-6UYY5KHI.js";import"./chunk-KOCUZ3AE.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";async function runObservationCli(argv,emit,signal,environment=process.env,stdin=process.stdin){const lifetime=new AbortController;let timer;const observationSignal=AbortSignal.any([signal,lifetime.signal]);try{const options=new Map;const allowed=["--input","--tenant","--profile","--origin","--mcp-url","--token-env","--token-file","--transport","--max-polls","--timeout-ms","--max-events","--max-bytes"];for(let n=0;n<argv.length;n+=2){const key=argv[n],value=argv[n+1];if(!key||!allowed.includes(key)||!value||value.startsWith("--")||options.has(key))throw Error();options.set(key,value)}if(!options.has("--input"))throw Error();const number=key=>{const value=options.get(key);if(value!==void 0&&!/^[1-9][0-9]{0,8}$/.test(value))throw Error();return value===void 0?{}:{[key.slice(2).replace(/-([a-z])/g,(_,x)=>x.toUpperCase())]:Number(value)}};const limits=Object.assign({},...["--max-polls","--timeout-ms","--max-events","--max-bytes"].map(number));const timeout=Number(options.get("--timeout-ms")??3e5);if(!Number.isSafeInteger(timeout)||timeout<1||timeout>18e5)throw Error();timer=setTimeout(()=>lifetime.abort(),timeout);const input=await readInput(options.get("--input"),stdin,false,observationSignal);if(typeof input.productionId!=="string")throw Error();const productionId=input.productionId;await withRemoteClient(options,environment,false,async client=>{for await(const page of observeProduction(client,{...input,productionId},{...limits,signal:observationSignal})){observationSignal.throwIfAborted();await emit({kind:"production.events",data:page},observationSignal)}},{signal:observationSignal,maxJsonBytes:128*1024});await emit({kind:"observation.ended",reason:"POLL_LIMIT",nativeWorkCancelled:false},observationSignal);return 0}catch(error){if(signal.aborted)return 130;if(lifetime.signal.aborted)return 0;const e=error instanceof NativeStudioSdkError?error:null;await emit({kind:"observation.ended",reason:lifetime.signal.aborted?"OBSERVATION_LIMIT":e?.code??"INVALID_INPUT",outcome:e?.outcome??"NO_WRITE",nativeWorkCancelled:false},observationSignal).catch(()=>{});return lifetime.signal.aborted||e?.code==="OBSERVATION_LIMIT"?0:e?4:2}finally{if(timer)clearTimeout(timer);lifetime.abort()}}async function runObservationEntry(argv){const controller=new AbortController;const stop=()=>controller.abort();process.on("SIGINT",stop);process.on("SIGTERM",stop);try{return await runObservationCli(argv,(value,writeSignal)=>new Promise((resolve,reject)=>{if(writeSignal.aborted){reject(writeSignal.reason);return}const aborted=()=>{cleanup();reject(writeSignal.reason)};const failed=error=>{cleanup();controller.abort();reject(error)};const cleanup=()=>{writeSignal.removeEventListener("abort",aborted);process.stdout.off("error",failed)};writeSignal.addEventListener("abort",aborted,{once:true});process.stdout.once("error",failed);process.stdout.write(JSON.stringify(value)+"\n",error=>{cleanup();if(error)reject(error);else resolve()})}),controller.signal)}finally{controller.abort();process.stdin.pause();process.off("SIGINT",stop);process.off("SIGTERM",stop)}}export{runObservationEntry};
1
+ import{withRemoteClient}from"./chunk-BR26X3ZF.js";import{readInput}from"./chunk-U5FT4VBR.js";import{observeProduction}from"./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{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";async function runObservationCli(argv,emit,signal,environment=process.env,stdin=process.stdin){const lifetime=new AbortController;let timer;const observationSignal=AbortSignal.any([signal,lifetime.signal]);try{const options=new Map;const allowed=["--input","--tenant","--profile","--origin","--mcp-url","--token-env","--token-file","--transport","--max-polls","--timeout-ms","--max-events","--max-bytes"];for(let n=0;n<argv.length;n+=2){const key=argv[n],value=argv[n+1];if(!key||!allowed.includes(key)||!value||value.startsWith("--")||options.has(key))throw Error();options.set(key,value)}if(!options.has("--input"))throw Error();const number=key=>{const value=options.get(key);if(value!==void 0&&!/^[1-9][0-9]{0,8}$/.test(value))throw Error();return value===void 0?{}:{[key.slice(2).replace(/-([a-z])/g,(_,x)=>x.toUpperCase())]:Number(value)}};const limits=Object.assign({},...["--max-polls","--timeout-ms","--max-events","--max-bytes"].map(number));const timeout=Number(options.get("--timeout-ms")??3e5);if(!Number.isSafeInteger(timeout)||timeout<1||timeout>18e5)throw Error();timer=setTimeout(()=>lifetime.abort(),timeout);const input=await readInput(options.get("--input"),stdin,false,observationSignal);if(typeof input.productionId!=="string")throw Error();const productionId=input.productionId;await withRemoteClient(options,environment,false,async client=>{for await(const page of observeProduction(client,{...input,productionId},{...limits,signal:observationSignal})){observationSignal.throwIfAborted();await emit({kind:"production.events",data:page},observationSignal)}},{signal:observationSignal,maxJsonBytes:128*1024});await emit({kind:"observation.ended",reason:"POLL_LIMIT",nativeWorkCancelled:false},observationSignal);return 0}catch(error){if(signal.aborted)return 130;if(lifetime.signal.aborted)return 0;const e=error instanceof NativeStudioSdkError?error:null;await emit({kind:"observation.ended",reason:lifetime.signal.aborted?"OBSERVATION_LIMIT":e?.code??"INVALID_INPUT",outcome:e?.outcome??"NO_WRITE",nativeWorkCancelled:false},observationSignal).catch(()=>{});return lifetime.signal.aborted||e?.code==="OBSERVATION_LIMIT"?0:e?4:2}finally{if(timer)clearTimeout(timer);lifetime.abort()}}async function runObservationEntry(argv){const controller=new AbortController;const stop=()=>controller.abort();process.on("SIGINT",stop);process.on("SIGTERM",stop);try{return await runObservationCli(argv,(value,writeSignal)=>new Promise((resolve,reject)=>{if(writeSignal.aborted){reject(writeSignal.reason);return}const aborted=()=>{cleanup();reject(writeSignal.reason)};const failed=error=>{cleanup();controller.abort();reject(error)};const cleanup=()=>{writeSignal.removeEventListener("abort",aborted);process.stdout.off("error",failed)};writeSignal.addEventListener("abort",aborted,{once:true});process.stdout.once("error",failed);process.stdout.write(JSON.stringify(value)+"\n",error=>{cleanup();if(error)reject(error);else resolve()})}),controller.signal)}finally{controller.abort();process.stdin.pause();process.off("SIGINT",stop);process.off("SIGTERM",stop)}}export{runObservationEntry};
@@ -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-BBTZJB2G.js";import"./chunk-ZOODOQBH.js";import"./chunk-FX5UVDTH.js";import"./chunk-U5FT4VBR.js";import"./chunk-I5KYSPUJ.js";import"./chunk-2UYKJ6YN.js";import{DeviceRenderDownloadSchema,DeviceRenderIntentSchema,DeviceRenderReadSchema,PreparedDeviceRenderSchema}from"./chunk-VOGKKZQH.js";import"./chunk-PDQYFIQQ.js";import{clientHome}from"./chunk-AAGFHT2D.js";import"./chunk-SKAVQ4UW.js";import{directory,optional,sha256,write}from"./chunk-RUPH3HZ2.js";import"./chunk-YV447AB5.js";import"./chunk-6UYY5KHI.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
+ 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-VOGKKZQH.js";import"./chunk-PDQYFIQQ.js";import{profileHttpOrigin}from"./chunk-SAPEOZ2V.js";import{defaultConnection,tenantConnection}from"./chunk-AAGFHT2D.js";import"./chunk-SKAVQ4UW.js";import"./chunk-RUPH3HZ2.js";import"./chunk-YV447AB5.js";import"./chunk-6UYY5KHI.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};
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};
@@ -0,0 +1 @@
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};
@@ -48,6 +48,7 @@ export declare const DesktopOwnerRequestSchema: z.ZodDiscriminatedUnion<[z.ZodOb
48
48
  search: z.ZodOptional<z.ZodString>;
49
49
  tenantId: z.ZodUUID;
50
50
  limit: z.ZodDefault<z.ZodInt>;
51
+ after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
51
52
  deviceId: z.ZodUUID;
52
53
  mediaCategory: z.ZodOptional<z.ZodEnum<{
53
54
  IMAGE: "IMAGE";
@@ -55,7 +56,6 @@ export declare const DesktopOwnerRequestSchema: z.ZodDiscriminatedUnion<[z.ZodOb
55
56
  AUDIO: "AUDIO";
56
57
  DOCUMENT: "DOCUMENT";
57
58
  }>>;
58
- after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
59
59
  projectId: z.ZodUUID;
60
60
  action: z.ZodLiteral<"scoped-list">;
61
61
  }, z.core.$strict>, z.ZodObject<{
@@ -689,10 +689,10 @@ export declare const DesktopOwnerRequestSchema: z.ZodDiscriminatedUnion<[z.ZodOb
689
689
  operation: z.ZodEnum<{
690
690
  check: "check";
691
691
  status: "status";
692
- configuration: "configuration";
693
692
  start: "start";
694
- stop: "stop";
693
+ configuration: "configuration";
695
694
  recovery: "recovery";
695
+ stop: "stop";
696
696
  }>;
697
697
  }, z.core.$strict>, z.ZodObject<{
698
698
  operation: z.ZodEnum<{
@@ -727,8 +727,8 @@ export declare const DesktopRuntimeStatusSchema: z.ZodObject<{
727
727
  state: z.ZodEnum<{
728
728
  UNAVAILABLE: "UNAVAILABLE";
729
729
  RUNNING: "RUNNING";
730
- INSTALL_REQUIRED: "INSTALL_REQUIRED";
731
730
  STOPPED: "STOPPED";
731
+ INSTALL_REQUIRED: "INSTALL_REQUIRED";
732
732
  }>;
733
733
  activeVersion: z.ZodNullable<z.ZodString>;
734
734
  phase: z.ZodString;
@@ -1382,8 +1382,8 @@ export declare const desktopOwnerResponses: {
1382
1382
  revision: z.ZodInt;
1383
1383
  connection: z.ZodDefault<z.ZodNullable<z.ZodObject<{
1384
1384
  phase: z.ZodEnum<{
1385
- READY: "READY";
1386
1385
  CONNECTED: "CONNECTED";
1386
+ READY: "READY";
1387
1387
  CONNECTING: "CONNECTING";
1388
1388
  }>;
1389
1389
  expiresAt: z.ZodISODateTime;
@@ -1596,8 +1596,8 @@ export declare const desktopOwnerResponses: {
1596
1596
  }, z.core.$strict>;
1597
1597
  scheduling: z.ZodObject<{
1598
1598
  state: z.ZodEnum<{
1599
- READY: "READY";
1600
1599
  PAUSED: "PAUSED";
1600
+ READY: "READY";
1601
1601
  WAITING_FOR_IDLE: "WAITING_FOR_IDLE";
1602
1602
  AT_CAPACITY: "AT_CAPACITY";
1603
1603
  DRAINING: "DRAINING";
@@ -2013,8 +2013,8 @@ export declare const desktopOwnerResponses: {
2013
2013
  state: z.ZodEnum<{
2014
2014
  UNAVAILABLE: "UNAVAILABLE";
2015
2015
  RUNNING: "RUNNING";
2016
- INSTALL_REQUIRED: "INSTALL_REQUIRED";
2017
2016
  STOPPED: "STOPPED";
2017
+ INSTALL_REQUIRED: "INSTALL_REQUIRED";
2018
2018
  }>;
2019
2019
  activeVersion: z.ZodNullable<z.ZodString>;
2020
2020
  phase: z.ZodString;
@@ -2031,8 +2031,8 @@ export declare const desktopOwnerResponses: {
2031
2031
  state: z.ZodEnum<{
2032
2032
  UNAVAILABLE: "UNAVAILABLE";
2033
2033
  RUNNING: "RUNNING";
2034
- INSTALL_REQUIRED: "INSTALL_REQUIRED";
2035
2034
  STOPPED: "STOPPED";
2035
+ INSTALL_REQUIRED: "INSTALL_REQUIRED";
2036
2036
  }>;
2037
2037
  activeVersion: z.ZodNullable<z.ZodString>;
2038
2038
  phase: z.ZodString;
@@ -2049,8 +2049,8 @@ export declare const desktopOwnerResponses: {
2049
2049
  state: z.ZodEnum<{
2050
2050
  UNAVAILABLE: "UNAVAILABLE";
2051
2051
  RUNNING: "RUNNING";
2052
- INSTALL_REQUIRED: "INSTALL_REQUIRED";
2053
2052
  STOPPED: "STOPPED";
2053
+ INSTALL_REQUIRED: "INSTALL_REQUIRED";
2054
2054
  }>;
2055
2055
  activeVersion: z.ZodNullable<z.ZodString>;
2056
2056
  phase: z.ZodString;
@@ -2067,8 +2067,8 @@ export declare const desktopOwnerResponses: {
2067
2067
  state: z.ZodEnum<{
2068
2068
  UNAVAILABLE: "UNAVAILABLE";
2069
2069
  RUNNING: "RUNNING";
2070
- INSTALL_REQUIRED: "INSTALL_REQUIRED";
2071
2070
  STOPPED: "STOPPED";
2071
+ INSTALL_REQUIRED: "INSTALL_REQUIRED";
2072
2072
  }>;
2073
2073
  activeVersion: z.ZodNullable<z.ZodString>;
2074
2074
  phase: z.ZodString;
@@ -2085,8 +2085,8 @@ export declare const desktopOwnerResponses: {
2085
2085
  state: z.ZodEnum<{
2086
2086
  UNAVAILABLE: "UNAVAILABLE";
2087
2087
  RUNNING: "RUNNING";
2088
- INSTALL_REQUIRED: "INSTALL_REQUIRED";
2089
2088
  STOPPED: "STOPPED";
2089
+ INSTALL_REQUIRED: "INSTALL_REQUIRED";
2090
2090
  }>;
2091
2091
  activeVersion: z.ZodNullable<z.ZodString>;
2092
2092
  phase: z.ZodString;
@@ -2103,8 +2103,8 @@ export declare const desktopOwnerResponses: {
2103
2103
  state: z.ZodEnum<{
2104
2104
  UNAVAILABLE: "UNAVAILABLE";
2105
2105
  RUNNING: "RUNNING";
2106
- INSTALL_REQUIRED: "INSTALL_REQUIRED";
2107
2106
  STOPPED: "STOPPED";
2107
+ INSTALL_REQUIRED: "INSTALL_REQUIRED";
2108
2108
  }>;
2109
2109
  activeVersion: z.ZodNullable<z.ZodString>;
2110
2110
  phase: z.ZodString;
@@ -2121,8 +2121,8 @@ export declare const desktopOwnerResponses: {
2121
2121
  state: z.ZodEnum<{
2122
2122
  UNAVAILABLE: "UNAVAILABLE";
2123
2123
  RUNNING: "RUNNING";
2124
- INSTALL_REQUIRED: "INSTALL_REQUIRED";
2125
2124
  STOPPED: "STOPPED";
2125
+ INSTALL_REQUIRED: "INSTALL_REQUIRED";
2126
2126
  }>;
2127
2127
  activeVersion: z.ZodNullable<z.ZodString>;
2128
2128
  phase: z.ZodString;
@@ -379,8 +379,8 @@ export declare const DesktopDeviceStateSchema: z.ZodObject<{
379
379
  connectorId: z.ZodNullable<z.ZodUUID>;
380
380
  connection: z.ZodDefault<z.ZodNullable<z.ZodObject<{
381
381
  phase: z.ZodEnum<{
382
- READY: "READY";
383
382
  CONNECTED: "CONNECTED";
383
+ READY: "READY";
384
384
  CONNECTING: "CONNECTING";
385
385
  }>;
386
386
  expiresAt: z.ZodISODateTime;
@@ -505,8 +505,8 @@ export declare const DesktopDeviceViewSchema: z.ZodObject<{
505
505
  revision: z.ZodInt;
506
506
  connection: z.ZodDefault<z.ZodNullable<z.ZodObject<{
507
507
  phase: z.ZodEnum<{
508
- READY: "READY";
509
508
  CONNECTED: "CONNECTED";
509
+ READY: "READY";
510
510
  CONNECTING: "CONNECTING";
511
511
  }>;
512
512
  expiresAt: z.ZodISODateTime;
@@ -604,8 +604,8 @@ export declare const DesktopDeviceReplySchema: z.ZodObject<{
604
604
  revision: z.ZodInt;
605
605
  connection: z.ZodDefault<z.ZodNullable<z.ZodObject<{
606
606
  phase: z.ZodEnum<{
607
- READY: "READY";
608
607
  CONNECTED: "CONNECTED";
608
+ READY: "READY";
609
609
  CONNECTING: "CONNECTING";
610
610
  }>;
611
611
  expiresAt: z.ZodISODateTime;
@@ -6,7 +6,7 @@ export declare function runDesktopDeviceRequest(home: string, raw: unknown, poli
6
6
  view: {
7
7
  revision: number;
8
8
  connection: {
9
- phase: "READY" | "CONNECTED" | "CONNECTING";
9
+ phase: "CONNECTED" | "READY" | "CONNECTING";
10
10
  expiresAt: string;
11
11
  deviceRevision: number;
12
12
  tenantMediaProcessing?: true | undefined;
@@ -140,7 +140,7 @@ export declare class DesktopDeviceRecords {
140
140
  })[];
141
141
  connectorId: string | null;
142
142
  connection: {
143
- phase: "READY" | "CONNECTED" | "CONNECTING";
143
+ phase: "CONNECTED" | "READY" | "CONNECTING";
144
144
  expiresAt: string;
145
145
  deviceRevision: number;
146
146
  tenantMediaProcessing?: true | undefined;
@@ -359,7 +359,7 @@ export declare class DesktopDeviceRecords {
359
359
  })[];
360
360
  connectorId: string | null;
361
361
  connection: {
362
- phase: "READY" | "CONNECTED" | "CONNECTING";
362
+ phase: "CONNECTED" | "READY" | "CONNECTING";
363
363
  expiresAt: string;
364
364
  deviceRevision: number;
365
365
  tenantMediaProcessing?: true | undefined;
@@ -62,6 +62,7 @@ export declare const DesktopLibraryRequestSchema: z.ZodObject<{
62
62
  search: z.ZodOptional<z.ZodString>;
63
63
  tenantId: z.ZodUUID;
64
64
  limit: z.ZodDefault<z.ZodInt>;
65
+ after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
65
66
  deviceId: z.ZodUUID;
66
67
  mediaCategory: z.ZodOptional<z.ZodEnum<{
67
68
  IMAGE: "IMAGE";
@@ -69,7 +70,6 @@ export declare const DesktopLibraryRequestSchema: z.ZodObject<{
69
70
  AUDIO: "AUDIO";
70
71
  DOCUMENT: "DOCUMENT";
71
72
  }>>;
72
- after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
73
73
  projectId: z.ZodUUID;
74
74
  action: z.ZodLiteral<"scoped-list">;
75
75
  }, z.core.$strict>, z.ZodObject<{
@@ -225,7 +225,7 @@ export declare function runDesktopOwnerRequest(home: string, raw: unknown, bundl
225
225
  ownerStagingBytes?: number | undefined;
226
226
  };
227
227
  scheduling: {
228
- state: "READY" | "PAUSED" | "WAITING_FOR_IDLE" | "AT_CAPACITY" | "DRAINING";
228
+ state: "PAUSED" | "READY" | "WAITING_FOR_IDLE" | "AT_CAPACITY" | "DRAINING";
229
229
  activeJobs: number;
230
230
  idleObservationCurrent: boolean;
231
231
  };
@@ -268,7 +268,7 @@ export declare function runDesktopOwnerRequest(home: string, raw: unknown, bundl
268
268
  view: {
269
269
  revision: number;
270
270
  connection: {
271
- phase: "READY" | "CONNECTED" | "CONNECTING";
271
+ phase: "CONNECTED" | "READY" | "CONNECTING";
272
272
  expiresAt: string;
273
273
  deviceRevision: number;
274
274
  tenantMediaProcessing?: true | undefined;
@@ -789,7 +789,7 @@ export declare function runDesktopOwnerRequest(home: string, raw: unknown, bundl
789
789
  channelFingerprint: string | null;
790
790
  } | {
791
791
  protocol: "NVS_DESKTOP_RUNTIME_STATUS_V1";
792
- state: "UNAVAILABLE" | "RUNNING" | "INSTALL_REQUIRED" | "STOPPED";
792
+ state: "UNAVAILABLE" | "RUNNING" | "STOPPED" | "INSTALL_REQUIRED";
793
793
  activeVersion: string | null;
794
794
  phase: string;
795
795
  toolMode?: "INSTALLED" | "MANAGED" | null | undefined;
@@ -997,8 +997,8 @@ export declare class LocalInstallationManager {
997
997
  } | {
998
998
  tenantId: string;
999
999
  limit: number;
1000
- deviceId: string;
1001
1000
  after: string | null;
1001
+ deviceId: string;
1002
1002
  projectId: string;
1003
1003
  action: "scoped-list";
1004
1004
  search?: string | undefined;
@@ -1660,7 +1660,7 @@ export declare class LocalInstallationManager {
1660
1660
  ownerStagingBytes?: number | undefined;
1661
1661
  };
1662
1662
  scheduling: {
1663
- state: "READY" | "PAUSED" | "WAITING_FOR_IDLE" | "AT_CAPACITY" | "DRAINING";
1663
+ state: "PAUSED" | "READY" | "WAITING_FOR_IDLE" | "AT_CAPACITY" | "DRAINING";
1664
1664
  activeJobs: number;
1665
1665
  idleObservationCurrent: boolean;
1666
1666
  };
@@ -7,6 +7,7 @@ export declare const localTools: {
7
7
  search: z.ZodOptional<z.ZodString>;
8
8
  tenantId: z.ZodUUID;
9
9
  limit: z.ZodDefault<z.ZodInt>;
10
+ after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
10
11
  deviceId: z.ZodUUID;
11
12
  mediaCategory: z.ZodOptional<z.ZodEnum<{
12
13
  IMAGE: "IMAGE";
@@ -14,7 +15,6 @@ export declare const localTools: {
14
15
  AUDIO: "AUDIO";
15
16
  DOCUMENT: "DOCUMENT";
16
17
  }>>;
17
- after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
18
18
  projectId: z.ZodUUID;
19
19
  }, z.core.$strict>;
20
20
  };
@@ -108,6 +108,7 @@ export declare class LocalMcpTools {
108
108
  search: z.ZodOptional<z.ZodString>;
109
109
  tenantId: z.ZodUUID;
110
110
  limit: z.ZodDefault<z.ZodInt>;
111
+ after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
111
112
  deviceId: z.ZodUUID;
112
113
  mediaCategory: z.ZodOptional<z.ZodEnum<{
113
114
  IMAGE: "IMAGE";
@@ -115,7 +116,6 @@ export declare class LocalMcpTools {
115
116
  AUDIO: "AUDIO";
116
117
  DOCUMENT: "DOCUMENT";
117
118
  }>>;
118
- after: z.ZodDefault<z.ZodNullable<z.ZodString>>;
119
119
  projectId: z.ZodUUID;
120
120
  }, z.core.$strict> | z.ZodObject<{
121
121
  tenantId: z.ZodUUID;
@@ -6,7 +6,7 @@ export { DesktopOwnerRequestSchema, desktopOwnerResponses } from "./local/deskto
6
6
  /** Human installation owner surface; never part of scoped MCP discovery. */
7
7
  export declare function runLocalManagement(home: string, operation: "status" | "start" | "stop"): Promise<{
8
8
  protocol: "NVS_DESKTOP_RUNTIME_STATUS_V1";
9
- state: "UNAVAILABLE" | "RUNNING" | "INSTALL_REQUIRED" | "STOPPED";
9
+ state: "UNAVAILABLE" | "RUNNING" | "STOPPED" | "INSTALL_REQUIRED";
10
10
  activeVersion: string | null;
11
11
  phase: string;
12
12
  toolMode?: "INSTALLED" | "MANAGED" | null | undefined;