@nativestudio/cli 0.3.0-rc.2 → 0.3.0-rc.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPATIBILITY.json +37 -8
- package/LICENSE +201 -21
- package/components/runtime.json +33 -4
- package/components/runtime.tgz +0 -0
- package/dist/_chunks/chunk-27KI24GK.js +1 -0
- package/dist/_chunks/chunk-2S7FI3HF.js +1 -0
- package/dist/_chunks/chunk-3RNDOAQI.js +1 -0
- package/dist/_chunks/{chunk-C33A2DW4.js → chunk-3TOXIJ7K.js} +1 -1
- package/dist/_chunks/chunk-4AD4PNUX.js +1 -0
- package/dist/_chunks/chunk-5Y7J2OYL.js +45 -0
- package/dist/_chunks/chunk-76E5R3OC.js +1 -0
- package/dist/_chunks/chunk-7I7ARCY7.js +1 -0
- package/dist/_chunks/chunk-7IVAYDU3.js +1 -0
- package/dist/_chunks/chunk-7P2NA6TH.js +1 -0
- package/dist/_chunks/chunk-DLW42PJ6.js +1 -0
- package/dist/_chunks/chunk-DMA53YVU.js +1 -0
- package/dist/_chunks/chunk-ETK7GYCB.js +1 -0
- package/dist/_chunks/chunk-FFXSXE3G.js +1 -0
- package/dist/_chunks/chunk-H4FH6STZ.js +1 -0
- package/dist/_chunks/chunk-KOCUZ3AE.js +1 -0
- package/dist/_chunks/chunk-LDBXGRCQ.js +1 -0
- package/dist/_chunks/chunk-LTNJ45JP.js +1 -0
- package/dist/_chunks/chunk-MZWEFYHE.js +1 -0
- package/dist/_chunks/{chunk-VDNNFVTZ.js → chunk-OW6R4MAQ.js} +1 -1
- package/dist/_chunks/chunk-PQCA4X5H.js +1 -0
- package/dist/_chunks/chunk-QGK6G6YS.js +1 -0
- package/dist/_chunks/chunk-SM2I7TJ3.js +1 -0
- package/dist/_chunks/chunk-TT7IA5HB.js +1 -0
- package/dist/_chunks/chunk-VXYZCCCQ.js +1 -0
- package/dist/_chunks/chunk-VYCNG6TR.js +1 -0
- package/dist/_chunks/chunk-WLQMICJN.js +1 -0
- package/dist/_chunks/chunk-WTJVS2VS.js +1 -0
- package/dist/_chunks/chunk-X5MVC46N.js +1 -0
- package/dist/_chunks/chunk-X5PBZTKX.js +1 -0
- package/dist/_chunks/chunk-ZMJYBUS3.js +1 -0
- package/dist/_chunks/chunk-ZYXHPTT2.js +1 -0
- package/dist/_chunks/component-contract-2JHTRTOB.js +1 -0
- package/dist/_chunks/component-preflight-6OWDQAZT.js +1 -0
- package/dist/_chunks/connect-7TJDWXV4.js +1 -0
- package/dist/_chunks/device-management-JPS4HG34.js +1 -0
- package/dist/_chunks/device-preflight-GTQ67H7C.js +1 -0
- package/dist/_chunks/devices-inventory-E6ZLXCVR.js +1 -0
- package/dist/_chunks/devices-main-2BMCANKU.js +1 -0
- package/dist/_chunks/files-JJ6YOULB.js +1 -0
- package/dist/_chunks/host-component-ZYQ5ETVL.js +1 -0
- package/dist/_chunks/host-help-VNLA3YOV.js +1 -0
- package/dist/_chunks/host-main-KLWW7R47.js +1 -0
- package/dist/_chunks/http-profile-3VVSWYA5.js +1 -0
- package/dist/_chunks/library-main-3WWH7UYV.js +1 -0
- package/dist/_chunks/local-main-5BW63USP.js +1 -0
- package/dist/_chunks/local-mcp-AARKBDU5.js +1 -0
- package/dist/_chunks/main-LGYJ3ZCN.js +2 -0
- package/dist/_chunks/mcp-BLSK636Q.js +1 -0
- package/dist/_chunks/oauth-RPME2XYB.js +1 -0
- package/dist/_chunks/observe-entry-JVZAMB7N.js +1 -0
- package/dist/_chunks/remote-client-25Z65VJU.js +1 -0
- package/dist/_chunks/render-main-6Z3DKCWL.js +1 -0
- package/dist/_chunks/series-main-FBERVYWG.js +1 -0
- package/dist/_chunks/source-import-PNMCMTK7.js +1 -0
- package/dist/_chunks/src-7HSJFRVQ.js +1 -0
- package/dist/_chunks/stdio-main-HNLJCG45.js +1 -0
- package/dist/_chunks/workspace-main-QX5JGEMR.js +1 -0
- package/dist/_types/cli/local/desktop-contract.d.ts +1981 -22
- package/dist/_types/cli/local/desktop-device-contract.d.ts +807 -0
- package/dist/_types/cli/local/desktop-device-navigation.d.ts +3 -0
- package/dist/_types/cli/local/desktop-device-owner.d.ts +273 -0
- package/dist/_types/cli/local/desktop-device-state.d.ts +455 -0
- package/dist/_types/cli/local/desktop-library.d.ts +853 -0
- package/dist/_types/cli/local/desktop-owner.d.ts +787 -4
- package/dist/_types/cli/local/ledger.d.ts +76 -20
- package/dist/_types/cli/local/manager.d.ts +1233 -49
- package/dist/_types/cli/local/mcp-tools.d.ts +313 -54
- package/dist/_types/cli/local/releases.d.ts +30 -7
- package/dist/_types/cli/local-management.d.ts +9 -2
- package/dist/_types/cli/local-navigation.d.ts +1 -0
- package/dist/_types/contracts/agent-execution-lifecycle.d.ts +55 -43
- package/dist/_types/contracts/agent-execution-oauth.d.ts +2 -2
- package/dist/_types/contracts/agent-execution-registration.d.ts +59 -15
- package/dist/_types/contracts/agent-execution-selection.d.ts +7 -7
- package/dist/_types/contracts/agent-host-contract.d.ts +189 -0
- package/dist/_types/contracts/agent-host-execution.d.ts +92 -61
- package/dist/_types/contracts/agent-host-generic-transport.d.ts +4 -4
- package/dist/_types/contracts/agent-host-legacy-release.d.ts +31 -0
- package/dist/_types/contracts/agent-host-protocol.d.ts +71 -0
- package/dist/_types/contracts/agent-host-wire.d.ts +263 -0
- package/dist/_types/contracts/agent-host.d.ts +126 -65
- package/dist/_types/contracts/artifact-discovery.d.ts +143 -11
- package/dist/_types/contracts/audio.d.ts +166 -0
- package/dist/_types/contracts/component-status.d.ts +241 -0
- package/dist/_types/contracts/composition-authoring.d.ts +8 -8
- package/dist/_types/contracts/composition-frame-render.d.ts +4 -4
- package/dist/_types/contracts/composition-observation.d.ts +1 -1
- package/dist/_types/contracts/composition-render-base.d.ts +5 -4
- package/dist/_types/contracts/composition-render.d.ts +8 -8
- package/dist/_types/contracts/composition-repair.d.ts +10 -10
- package/dist/_types/contracts/composition-source-review.d.ts +13 -13
- package/dist/_types/contracts/consistency-profile.d.ts +102 -6
- package/dist/_types/contracts/continuity-evaluation.d.ts +1 -1
- package/dist/_types/contracts/delivery-completion.d.ts +1 -1
- package/dist/_types/contracts/delivery-manifest.d.ts +25 -11729
- package/dist/_types/contracts/delivery-operations.d.ts +207 -3915
- package/dist/_types/contracts/delivery-summary.d.ts +4 -4
- package/dist/_types/contracts/delivery-validation.d.ts +25 -2
- package/dist/_types/contracts/device-onboarding.d.ts +35 -0
- package/dist/_types/contracts/device-render.d.ts +113 -0
- package/dist/_types/contracts/editor-intelligence.d.ts +392 -2531
- package/dist/_types/contracts/enterprise-brand.d.ts +302 -0
- package/dist/_types/contracts/exploration-recommendation.d.ts +263 -11607
- package/dist/_types/contracts/external-agent-access.d.ts +4 -6
- package/dist/_types/contracts/federation-event-link-receiver.d.ts +200 -0
- package/dist/_types/contracts/federation-event-link.d.ts +485 -0
- package/dist/_types/contracts/federation-result.d.ts +239 -0
- package/dist/_types/contracts/final-ready.d.ts +24 -24
- package/dist/_types/contracts/final-render.d.ts +1742 -6949
- package/dist/_types/contracts/human-identity.d.ts +13 -0
- package/dist/_types/contracts/human-links.d.ts +58 -0
- package/dist/_types/contracts/index.d.ts +26 -0
- package/dist/_types/contracts/interface/common.d.ts +18 -0
- package/dist/_types/contracts/interface/execution-output.d.ts +9 -6
- package/dist/_types/contracts/interface/media-output.d.ts +118 -0
- package/dist/_types/contracts/interface/operation.d.ts +89 -0
- package/dist/_types/contracts/interface/production-snapshot.d.ts +106 -199
- package/dist/_types/contracts/interface/query.d.ts +85 -0
- package/dist/_types/contracts/keyframe-generation.d.ts +31 -2
- package/dist/_types/contracts/keyframe-review.d.ts +7 -7
- package/dist/_types/contracts/lifecycle-event-projections.d.ts +19 -4
- package/dist/_types/contracts/lifecycle-events.d.ts +54 -2
- package/dist/_types/contracts/local-execution/agent-component-status.d.ts +109 -0
- package/dist/_types/contracts/local-execution/agent-context.d.ts +385 -0
- package/dist/_types/contracts/local-execution/agent-evidence.d.ts +79 -0
- package/dist/_types/contracts/local-execution/agent-grant.d.ts +31 -0
- package/dist/_types/contracts/local-execution/agent-review.d.ts +529 -71
- package/dist/_types/contracts/local-execution/audio-profile.d.ts +6 -0
- package/dist/_types/contracts/local-execution/common.d.ts +12 -11
- package/dist/_types/contracts/local-execution/completion.d.ts +41 -45
- package/dist/_types/contracts/local-execution/components.d.ts +45 -0
- package/dist/_types/contracts/local-execution/cpu-preparation.d.ts +46 -0
- package/dist/_types/contracts/local-execution/cpu-resources.d.ts +55 -0
- package/dist/_types/contracts/local-execution/cpu-speech-job.d.ts +70 -0
- package/dist/_types/contracts/local-execution/cpu-speech.d.ts +161 -0
- package/dist/_types/contracts/local-execution/descriptor.d.ts +38 -0
- package/dist/_types/contracts/local-execution/device-authority.d.ts +31 -0
- package/dist/_types/contracts/local-execution/device-inventory.d.ts +108 -0
- package/dist/_types/contracts/local-execution/device-workspace.d.ts +11 -0
- package/dist/_types/contracts/local-execution/device.d.ts +24 -55
- package/dist/_types/contracts/local-execution/enrollment-credential.d.ts +141 -0
- package/dist/_types/contracts/local-execution/enrollment-handoff.d.ts +44 -0
- package/dist/_types/contracts/local-execution/external-generation.d.ts +199 -0
- package/dist/_types/contracts/local-execution/index.d.ts +36 -0
- package/dist/_types/contracts/local-execution/ipc.d.ts +2809 -231
- package/dist/_types/contracts/local-execution/library-command.d.ts +620 -0
- package/dist/_types/contracts/local-execution/library-result.d.ts +428 -0
- package/dist/_types/contracts/local-execution/library.d.ts +873 -0
- package/dist/_types/contracts/local-execution/lifecycle.d.ts +262 -48
- package/dist/_types/contracts/local-execution/local-navigation.d.ts +304 -67
- package/dist/_types/contracts/local-execution/management.d.ts +407 -0
- package/dist/_types/contracts/local-execution/media-recipe.d.ts +207 -0
- package/dist/_types/contracts/local-execution/media-validation-request.d.ts +232 -0
- package/dist/_types/contracts/local-execution/media-validation.d.ts +262 -0
- package/dist/_types/contracts/local-execution/object-transfer.d.ts +155 -0
- package/dist/_types/contracts/local-execution/offline.d.ts +59 -0
- package/dist/_types/contracts/local-execution/preview.d.ts +177 -3561
- package/dist/_types/contracts/local-execution/processor-capability.d.ts +49 -0
- package/dist/_types/contracts/local-execution/processor-direct.d.ts +290 -0
- package/dist/_types/contracts/local-execution/processor-recipes.d.ts +1194 -0
- package/dist/_types/contracts/local-execution/processor-toolchain.d.ts +47 -0
- package/dist/_types/contracts/local-execution/processor.d.ts +6424 -0
- package/dist/_types/contracts/local-execution/project-source-direct.d.ts +201 -0
- package/dist/_types/contracts/local-execution/qwen-tts.d.ts +31 -0
- package/dist/_types/contracts/local-execution/recognition.d.ts +170 -0
- package/dist/_types/contracts/local-execution/speech.d.ts +95 -0
- package/dist/_types/contracts/local-execution/tool-selection.d.ts +71 -5
- package/dist/_types/contracts/local-execution/whisper.d.ts +24 -0
- package/dist/_types/contracts/local-execution/work.d.ts +124 -3402
- package/dist/_types/contracts/local-execution/workspace.d.ts +141 -0
- package/dist/_types/contracts/mcp-capabilities.d.ts +16 -0
- package/dist/_types/contracts/media-category.d.ts +11 -0
- package/dist/_types/contracts/media-observation.d.ts +930 -9
- package/dist/_types/contracts/native-speech-model.d.ts +53 -0
- package/dist/_types/contracts/native-speech-options.d.ts +25 -0
- package/dist/_types/contracts/native-tool-authority.d.ts +25 -21
- package/dist/_types/contracts/native-tool-execution.d.ts +60 -39
- package/dist/_types/contracts/navigation-context.d.ts +76 -8
- package/dist/_types/contracts/navigation-groups.d.ts +2 -2
- package/dist/_types/contracts/navigation.d.ts +79 -26
- package/dist/_types/contracts/observation-profile.d.ts +3 -3
- package/dist/_types/contracts/production-creation.d.ts +30 -0
- package/dist/_types/contracts/production-feedback.d.ts +452 -0
- package/dist/_types/contracts/production.d.ts +30 -0
- package/dist/_types/contracts/programmatic-composition.d.ts +24 -24
- package/dist/_types/contracts/programmatic-exploration.d.ts +362 -5999
- package/dist/_types/contracts/programmatic-video-review.d.ts +5 -5
- package/dist/_types/contracts/project-library.d.ts +30 -0
- package/dist/_types/contracts/project.d.ts +30 -0
- package/dist/_types/contracts/provider-catalog.d.ts +3 -3
- package/dist/_types/contracts/provider-models.d.ts +209 -8
- package/dist/_types/contracts/provider.d.ts +66 -1
- package/dist/_types/contracts/reference-preview.d.ts +20 -0
- package/dist/_types/contracts/render-readiness.d.ts +175 -0
- package/dist/_types/contracts/repair-lifecycle.d.ts +64 -396
- package/dist/_types/contracts/repair-plan.d.ts +18 -100
- package/dist/_types/contracts/repair-strategy.d.ts +163 -4478
- package/dist/_types/contracts/review-intelligence-final-output.d.ts +418 -8150
- package/dist/_types/contracts/review-intelligence.d.ts +455 -11423
- package/dist/_types/contracts/review1-repair-source.d.ts +6 -6
- package/dist/_types/contracts/review1-repair-strategy.d.ts +4 -4
- package/dist/_types/contracts/rough-cut-manifest.d.ts +27 -7
- package/dist/_types/contracts/rough-cut-profile.d.ts +12 -3
- package/dist/_types/contracts/rough-cut-review.d.ts +144 -12495
- package/dist/_types/contracts/rough-cut.d.ts +1170 -5673
- package/dist/_types/contracts/series-canon.d.ts +97 -0
- package/dist/_types/contracts/series-character.d.ts +23 -0
- package/dist/_types/contracts/series-improvement.d.ts +1639 -0
- package/dist/_types/contracts/series-standard.d.ts +1641 -0
- package/dist/_types/contracts/shares.d.ts +135 -0
- package/dist/_types/contracts/shot-preparation-basis.d.ts +2 -2
- package/dist/_types/contracts/shot-preparation.d.ts +4 -4
- package/dist/_types/contracts/sound-making-plan.d.ts +210 -2
- package/dist/_types/contracts/speech-cost.d.ts +96 -0
- package/dist/_types/contracts/speech-parameters.d.ts +39 -0
- package/dist/_types/contracts/speech.d.ts +603 -23
- package/dist/_types/contracts/temporal-evidence-operation.d.ts +2 -1
- package/dist/_types/contracts/timeline-audio.d.ts +20 -4
- package/dist/_types/contracts/timeline-manifest.d.ts +40 -8
- package/dist/_types/contracts/timeline-source-sound.d.ts +42 -4
- package/dist/_types/contracts/timeline-v2.d.ts +124 -16
- package/dist/_types/contracts/timeline-version-reader.d.ts +288 -40
- package/dist/_types/contracts/timeline-visual-layers.d.ts +124 -16
- package/dist/_types/contracts/timeline.d.ts +50 -4850
- package/dist/_types/contracts/transcription.d.ts +1 -1
- package/dist/_types/contracts/video-generation.d.ts +35 -2
- package/dist/_types/contracts/video-review.d.ts +7 -7
- package/dist/_types/contracts/visual-exploration.d.ts +3 -3
- package/dist/_types/contracts/visual-layer-render.d.ts +298 -47
- package/dist/_types/contracts/visual-sequence.d.ts +22 -0
- package/dist/_types/contracts/voice-consistency.d.ts +183 -0
- package/dist/_types/contracts/voice-profile/contracts.d.ts +821 -0
- package/dist/_types/contracts/voice-profile/identity.d.ts +27 -0
- package/dist/_types/contracts/voice-profile/interface.d.ts +89 -0
- package/dist/_types/contracts/voice-profile/reference.d.ts +106 -0
- package/dist/_types/contracts/voice-review.d.ts +1194 -0
- package/dist/_types/contracts/workspace.d.ts +83 -0
- package/dist/_types/sdk/errors.d.ts +9 -3
- package/dist/_types/sdk/local-runtime/components.d.ts +2 -0
- package/dist/_types/sdk/local-runtime/device-client.d.ts +181 -19
- package/dist/_types/sdk/local-runtime/library.d.ts +268 -0
- package/dist/_types/sdk/local-runtime/workspace.d.ts +186 -0
- package/dist/_types/sdk/local-runtime-client.d.ts +1934 -96
- package/dist/entry.js +1 -1
- package/dist/local-management.js +1 -1
- package/dist/local-navigation.js +1 -1
- package/dist/native/helper.exe +0 -0
- package/dist/native/helper.json +1 -0
- package/package.json +2 -8
- package/README.md +0 -95
- package/dist/_chunks/chunk-66CUOZVI.js +0 -1
- package/dist/_chunks/chunk-6NVIN2NI.js +0 -1
- package/dist/_chunks/chunk-7S3DJ2QE.js +0 -1
- package/dist/_chunks/chunk-BVSTJQJI.js +0 -1
- package/dist/_chunks/chunk-C753RRRA.js +0 -1
- package/dist/_chunks/chunk-E57YVMQ4.js +0 -1
- package/dist/_chunks/chunk-GJ7BZJLW.js +0 -1
- package/dist/_chunks/chunk-HLKERZIE.js +0 -1
- package/dist/_chunks/chunk-K6LVS2IN.js +0 -1
- package/dist/_chunks/chunk-KHKUJXQX.js +0 -1
- package/dist/_chunks/chunk-PUNG4ND7.js +0 -1
- package/dist/_chunks/chunk-VC3ODN3M.js +0 -1
- package/dist/_chunks/chunk-VPYAXWXY.js +0 -1
- package/dist/_chunks/files-FZEK2ZZJ.js +0 -1
- package/dist/_chunks/local-main-NLFS74Q4.js +0 -1
- package/dist/_chunks/local-mcp-OLHBBVNN.js +0 -1
- package/dist/_chunks/main-VRIQTI6R.js +0 -2
- package/dist/_chunks/mcp-EIMXNRH3.js +0 -1
- package/dist/_chunks/oauth-F7EZGVME.js +0 -1
- package/dist/_chunks/project-connect-MXM7IY55.js +0 -1
- package/dist/_chunks/src-7F6ZEU3U.js +0 -1
- package/dist/_chunks/stdio-main-KOGQ5OWF.js +0 -1
- package/dist/native/Bootstrap.ps1 +0 -90
- package/dist/native/JobNative.cs +0 -127
- package/dist/native/JobRunner.cs +0 -360
- package/dist/native/NativeMain.cs +0 -146
- package/dist/native/PipeBridge.cs +0 -260
- package/dist/native/PrivateAccess.cs +0 -152
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{withRemoteClient}from"./chunk-X5PBZTKX.js";import{readInput}from"./chunk-QGK6G6YS.js";import{observeProduction}from"./chunk-2S7FI3HF.js";import"./chunk-27KI24GK.js";import"./chunk-7I7ARCY7.js";import"./chunk-DLW42PJ6.js";import"./chunk-WTJVS2VS.js";import"./chunk-KOCUZ3AE.js";import{NativeStudioSdkError}from"./chunk-TT7IA5HB.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-X5PBZTKX.js";import"./chunk-QGK6G6YS.js";import"./chunk-2S7FI3HF.js";import"./chunk-27KI24GK.js";import"./chunk-7I7ARCY7.js";import"./chunk-DLW42PJ6.js";import"./chunk-WTJVS2VS.js";import"./chunk-KOCUZ3AE.js";import"./chunk-TT7IA5HB.js";export{withRemoteClient};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{callerRenderConnection,renderReceiptScope}from"./chunk-3RNDOAQI.js";import"./chunk-VYCNG6TR.js";import"./chunk-3TOXIJ7K.js";import{readInput}from"./chunk-QGK6G6YS.js";import"./chunk-76E5R3OC.js";import"./chunk-2UYKJ6YN.js";import{DeviceRenderDownloadSchema,DeviceRenderIntentSchema,DeviceRenderReadSchema,DeviceRenderReceiptHandoffSchema,PreparedDeviceRenderSchema,renderDeviceSelection}from"./chunk-2S7FI3HF.js";import{clientHome}from"./chunk-27KI24GK.js";import"./chunk-7I7ARCY7.js";import{directory,optional,sha256,write}from"./chunk-DLW42PJ6.js";import{CapabilityVersionMismatchSchema,InterfaceSemanticStatusSchema}from"./chunk-WTJVS2VS.js";import"./chunk-KOCUZ3AE.js";import{NativeStudioSdkError}from"./chunk-TT7IA5HB.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});var savedRenderFailure=z.strictObject({code:z.string().regex(/^[A-Z][A-Z0-9_]{0,119}$/),outcome:z.enum(["NO_WRITE","REJECTED"]),semanticStatus:InterfaceSemanticStatusSchema,details:CapabilityVersionMismatchSchema.optional()});function requestPrefix(root,scope,requestId){const binding=scope.resource+"#"+sha256(scope.profile)+"#"+scope.projectId;return{binding,prefix:join(root,sha256(binding+"\n"+requestId))}}async function findRequest(root,conn,requestId){const legacy=requestPrefix(root,conn.scope,requestId);if(!conn.externalCredential)return{...legacy,saved:await optional(legacy.prefix+".request.json")};const{principalId,grantId}=await renderReceiptScope(conn.studio,conn.scope);const current=requestPrefix(root,{...conn.scope,profile:`oauth-grant:${principalId}/${grantId}`},requestId);const saved=await optional(current.prefix+".request.json");if(saved!==null)return{...current,saved};const old=await optional(legacy.prefix+".request.json");return old===null?{...current,saved:null}:{...legacy,saved:old}}function unknownReceipt(productionId,idempotencyKey){return{exitCode:1,output:{semanticStatus:"BLOCKED",error:{code:"OUTCOME_UNKNOWN",outcome:"UNKNOWN"},idempotencyKey,productionId,nextAction:"Read the original receipt with the same request or its prepared command."}}}async function readNativeReceipt(conn,prepared,prefix){try{return{exitCode:0,output:await conn.studio.deviceRenders.receipt(prepared)}}catch(error){if(!(error instanceof NativeStudioSdkError)||!["NOT_FOUND","OUTCOME_UNKNOWN","TRANSPORT_UNAVAILABLE","REQUEST_ABORTED"].includes(error.code))throw error;if(error.code==="NOT_FOUND"&&prefix){const failure=savedRenderFailure.safeParse(await optional(prefix+".failure.json").catch(()=>null));if(failure.success){const{code,outcome,semanticStatus,details}=failure.data;throw new NativeStudioSdkError(code,semanticStatus,outcome,null,[],details)}}return unknownReceipt(prepared.command.productionId,prepared.command.idempotencyKey)}}async function readTransferredReceipt(flags,env,stdin){if([...flags.keys()].some(key=>!["--input","--mcp-url","--token-file"].includes(key)))throw Error();const{scope,prepared}=DeviceRenderReceiptHandoffSchema.parse(await readInput(flags.get("--input"),stdin,true));if(prepared.command.tenantId!==scope.tenantId)throw Error();const conn=await callerRenderConnection(env,new Map([...flags,["--project",scope.projectId]]),false);try{if(conn.scope.resource!==scope.resource||conn.scope.tenantId!==scope.tenantId)throw new NativeStudioSdkError("FORBIDDEN","BLOCKED","NO_WRITE");const verified=await renderReceiptScope(conn.studio,conn.scope);if(verified.principalId!==scope.principalId||verified.grantId!==scope.grantId)throw new NativeStudioSdkError("FORBIDDEN","BLOCKED","NO_WRITE");await assertRenderProject(conn.studio,verified,prepared.command.productionId);return await readNativeReceipt(conn,prepared)}finally{await conn.close().catch(()=>{})}}async function readRenderSetup(kind,flags,env){const allowed=["--kind","--production","--project","--mcp-url","--token-file",kind==="receipt"?"--request":"--device"];if([...flags.keys()].some(key=>!allowed.includes(key)))throw Error();const renderKind=DeviceRenderReadSchema.shape.kind.parse(flags.get("--kind"));const productionId=z.uuid().parse(flags.get("--production"));const requestId=kind==="receipt"?z.uuid().parse(flags.get("--request")):void 0;const deviceId=z.uuid().optional().parse(flags.get("--device"));const conn=await callerRenderConnection(env,flags,false);const{scope,studio}=conn;try{await assertRenderProject(studio,scope,productionId);if(requestId){const home=await clientHome(env).catch(error=>{if(error.code==="ENOENT")return null;throw error});if(!home)return unknownReceipt(productionId,requestId);const{binding,prefix,saved}=await findRequest(join(home,"renders"),conn,requestId);if(!saved)return unknownReceipt(productionId,requestId);const{scope:savedScope,intent,prepared}=receipt.parse(saved);if(savedScope!==binding||intent.kind!==renderKind||prepared.kind!==renderKind||intent.productionId!==productionId||prepared.command.productionId!==productionId||prepared.command.tenantId!==scope.tenantId||intent.idempotencyKey!==requestId||prepared.command.idempotencyKey!==requestId||prepared.command.deviceExecution.deviceId!==intent.deviceId||prepared.command.deviceExecution.validationMode!==intent.validationMode)throw new NativeStudioSdkError("REVISION_CONFLICT","REVISION_CONFLICT","NO_WRITE");return await readNativeReceipt(conn,prepared,prefix)}const[basis,candidates]=await Promise.all([studio.deviceRenders.basis({kind:renderKind,productionId}),studio.deviceRenders.list({kind:renderKind,projectId:scope.projectId,deviceId})]);const{state}=renderDeviceSelection(candidates,deviceId);const eligible=basis.basis!==null&&state==="AVAILABLE";const selectionBlocker=state==="DEVICE_SELECTION_REQUIRED"||state==="INCOMPLETE_INVENTORY"?[state]:[];return{exitCode:eligible?0:4,output:{semanticStatus:eligible?"SUCCESS":"BLOCKED",productionId,...basis,blockers:[...basis.blockers,...selectionBlocker],eligible,candidates,deviceStatus:state==="INCOMPLETE_INVENTORY"?"INCONCLUSIVE":state==="UNAVAILABLE"?"UNAVAILABLE":"AVAILABLE"}}}finally{await conn.close().catch(()=>{})}}async function renderCommand(argv,env,stdin=process.stdin){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","--input"].includes(k))throw Error();flags.set(k,v)}if(flags.has("--input")){if(kind!=="receipt")throw Error();return readTransferredReceipt(flags,env,stdin)}if(kind==="eligibility"||kind==="receipt")return readRenderSetup(kind,flags,env);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);try{await assertRenderProject(conn.studio,conn.scope,intent.productionId);const root=await directory(join(await clientHome(env,true),"renders"));const{binding,prefix,saved:previous}=await findRequest(root,conn,intent.idempotencyKey);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};return await readNativeReceipt(conn,old.prepared,prefix)}const prepared=await conn.studio.deviceRenders.prepare(intent);try{await write(prefix+".request.json",JSON.stringify({scope:binding,intent,prepared}),true)}catch(error){if(error.code!=="EEXIST")throw error;return unknownReceipt(intent.productionId,intent.idempotencyKey)}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,...e.capabilityMismatch&&{details:e.capabilityMismatch}}),true).catch(()=>{});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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var actions={list:{command:"series.list",fields:{"--project":"projectId","--after":"after","--limit":"limit"}},get:{command:"series.get",fields:{"--project":"projectId","--series":"seriesId","--version":"version"}},binding:{command:"series.binding",fields:{"--project":"projectId","--production":"productionId","--revision":"productionRevision","--at-revision":"atRevision"}},publish:{command:"series.publish",fields:{}},bind:{command:"series.bind",fields:{}},receipt:{command:"series.receipt",fields:{}},"brand-command":{command:"series.brand.command",fields:{}},"brand-get":{command:"series.brand.get",fields:{}},"brand-receipt":{command:"series.brand.receipt",fields:{}},"canon-record":{command:"series.canon.record",fields:{}},"canon-get":{command:"series.canon.get",fields:{}},"canon-receipt":{command:"series.canon.receipt",fields:{}},"improvement-command":{command:"series.improvement.command",fields:{}},"improvement-query":{command:"series.improvement.query",fields:{}},"improvement-receipt":{command:"series.improvement.receipt",fields:{}}};var connectionOptions=new Set(["--tenant","--origin","--mcp-url","--profile","--token-env","--token-file","--transport","--capability-version"]);var numericFields=new Set(["limit","version","productionRevision","atRevision"]);var receiptCommands={publish:"receipt",bind:"receipt","brand-command":"brand-receipt","canon-record":"canon-receipt","improvement-command":"improvement-receipt"};var seriesHelp={commands:["nvs series list --project <uuid> [--after <uuid>] [--limit <1..40>]","nvs series get --project <uuid> --series <uuid> [--version <n>]","nvs series publish --input <json|->","nvs series bind --input <json|->","nvs series binding --project <uuid> --production <uuid> [--revision <n> | --at-revision <n>]","nvs series receipt --input <json|->","nvs series brand-command|brand-get|brand-receipt --input <json|->","nvs series canon-record|canon-get|canon-receipt --input <json|->","nvs series improvement-command|improvement-query|improvement-receipt --input <json|->"],connection:"Uses the saved tenant OAuth connection. Explicit connection flags match nvs call.",capabilityVersion:"Optional on member MCP. Pass --capability-version with the version from capabilities describe.",continuation:"List and read a series, bind its exact version, then use the returned production and profile revisions in production operations.",json:{publish:["projectId","seriesId","expectedVersion","content","reason","idempotencyKey"],bind:["projectId","productionId","seriesId","version","expectedProductionRevision","expectedProfileVersion","reason","idempotencyKey"],receipt:["projectId","idempotencyKey"],characterVariants:"Optionally pass characterVariantIds when binding; read approved choices through series get.",binding:"Use --at-revision with a native media receipt's productionRevision to read the series version in effect for that output.",brandCommand:"Use action PUBLISH, GRANT or REVOKE in the brand owner project. Use brand-receipt with projectId and idempotencyKey to recover."}};async function runSeriesCli([verb,...args],stdin,call){if((!verb||verb==="help"||verb==="--help")&&!args.length)return{exitCode:0,output:seriesHelp};if(!verb||!Object.hasOwn(actions,verb))throw Error("INVALID_INPUT");const action=actions[verb];const fields=action.fields;const argv=["call",action.command];const seen=new Set;const data={};let input;for(let index=0;index<args.length;index+=2){const flag=args[index],value=args[index+1];if(!value||value.startsWith("--")||seen.has(flag))throw Error("INVALID_INPUT");seen.add(flag);if(connectionOptions.has(flag))argv.push(flag,value);else if(flag==="--input")input=value;else{const field=fields[flag];if(!Object.hasOwn(fields,flag)||!field)throw Error("INVALID_INPUT");if(numericFields.has(field)&&!/^[1-9]\d{0,15}$/.test(value))throw Error("INVALID_INPUT");data[field]=numericFields.has(field)?Number(value):value}}if(input?Object.keys(data).length:!Object.keys(fields).length||!data.projectId)throw Error("INVALID_INPUT");async function*generatedInput(){yield Buffer.from(JSON.stringify(data))}const result=await call([...argv,"--input",input??"-"],input?stdin:generatedInput());const output=result.output;const recovery=receiptCommands[verb];return output?.error?.outcome==="UNKNOWN"&&recovery?{...result,output:{...output,nextSteps:[`nvs series ${recovery} --input <original-project-and-request-key-json|->`]}}:result}export{runSeriesCli,seriesHelp};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{profileAuthorization}from"./chunk-3TOXIJ7K.js";import{readCredential,readInput}from"./chunk-QGK6G6YS.js";import{NativeStudioAgentClient}from"./chunk-2S7FI3HF.js";import{profileHttpOrigin}from"./chunk-7P2NA6TH.js";import{defaultConnection,tenantConnection}from"./chunk-27KI24GK.js";import"./chunk-7I7ARCY7.js";import"./chunk-DLW42PJ6.js";import"./chunk-WTJVS2VS.js";import"./chunk-KOCUZ3AE.js";import"./chunk-TT7IA5HB.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,DeviceEnrollmentHandoffSchema,DeviceEnrollmentObservationSchema,DeviceEnrollmentScopeSchema,DeviceEnrollmentTicketSchema,DeviceRenderAdmissionSchema,DeviceRenderDownloadSchema,DeviceRenderIntentSchema,DeviceRenderReadSchema,DeviceRenderReceiptHandoffSchema,DeviceStatusInputSchema,DeviceStatusSchema,FinalRenderViewSchema,LocalLibraryAdmissionSchema,LocalLibraryCommandQuerySchema,LocalLibraryCommandSchema,LocalLibraryCommandStatusSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionQuerySchema,LocalLibraryReferenceSchema,McpEntryToolNames,NativeStudioAgentClient,NativeStudioDeviceRenders,NativeStudioMcpClient,NativeStudioNavigationClient,NativeStudioNavigationFacade,NativeStudioRuntimeAuthorityClient,NavigationGroupIdSchema,NavigationGroups,NavigationProfile,NavigationProfileKey,NavigationToolNames,PreparedDeviceRenderSchema,ProjectDeviceListSchema,RoughCutViewSchema,TenantRenderMediaTicketSchema,WorkspaceDeviceListInputSchema,WorkspaceDeviceListSchema,WorkspaceStatusSchema,assertCarrierCoverage,issueDeviceEnrollment,lookupDeviceEnrollment,navigationGroup,observeProduction,queryPages,readFederationLifecycleResult,recoverDeviceEnrollment,renderDeviceSelection,sdkCarrierDifferences,sdkImageMediaTools,sdkMcpTools,sdkOperations,submitDeviceEnrollment,validateDeviceEnrollmentHandoff,verifyWebhookNotification,waitForOperation}from"./chunk-2S7FI3HF.js";import{CapabilityVersionMismatchSchema,CapabilityVersionSchema,InterfaceSemanticStatusSchema}from"./chunk-WTJVS2VS.js";import{NativeStudioSdkError,sdkInputError}from"./chunk-TT7IA5HB.js";export{CapabilityDescribeSchema,CapabilityGroupsSchema,CapabilityInvocationInputSchema,CapabilityInvocationOutputSchema,CapabilityVersionMismatchSchema,CapabilityVersionSchema,DeviceDiscoveryInputSchema,DeviceEnrollmentHandoffSchema,DeviceEnrollmentObservationSchema,DeviceEnrollmentScopeSchema,DeviceEnrollmentTicketSchema,DeviceRenderAdmissionSchema,DeviceRenderDownloadSchema,DeviceRenderIntentSchema,DeviceRenderReadSchema,DeviceRenderReceiptHandoffSchema,DeviceStatusInputSchema,DeviceStatusSchema,FinalRenderViewSchema,InterfaceSemanticStatusSchema,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,WorkspaceStatusSchema,assertCarrierCoverage,issueDeviceEnrollment,lookupDeviceEnrollment,navigationGroup,observeProduction,queryPages,readFederationLifecycleResult,recoverDeviceEnrollment,renderDeviceSelection,sdkCarrierDifferences,sdkImageMediaTools,sdkInputError,sdkMcpTools,sdkOperations,submitDeviceEnrollment,validateDeviceEnrollmentHandoff,verifyWebhookNotification,waitForOperation};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{StdioLines}from"./chunk-JFC6ZIGA.js";import{readCredential}from"./chunk-QGK6G6YS.js";import{defaultConnection}from"./chunk-27KI24GK.js";import{FileOAuthProvider}from"./chunk-7I7ARCY7.js";import"./chunk-DLW42PJ6.js";import"./chunk-WTJVS2VS.js";import{secureEndpoint}from"./chunk-KOCUZ3AE.js";import"./chunk-TT7IA5HB.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-RPME2XYB.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-VYCNG6TR.js";import"./chunk-3TOXIJ7K.js";import"./chunk-QGK6G6YS.js";import"./chunk-76E5R3OC.js";import"./chunk-2UYKJ6YN.js";import"./chunk-2S7FI3HF.js";import"./chunk-27KI24GK.js";import"./chunk-7I7ARCY7.js";import"./chunk-DLW42PJ6.js";import"./chunk-WTJVS2VS.js";import"./chunk-KOCUZ3AE.js";import"./chunk-TT7IA5HB.js";export{workspaceCommand,workspaceProject};
|