@nativestudio/cli 0.3.0-rc.1 → 0.3.0-rc.11

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 (185) hide show
  1. package/COMPATIBILITY.json +33 -8
  2. package/LICENSE +201 -21
  3. package/components/runtime.json +29 -4
  4. package/components/runtime.tgz +0 -0
  5. package/dist/_chunks/chunk-37PAJCKA.js +1 -0
  6. package/dist/_chunks/{chunk-G42IS5JF.js → chunk-3AVC742O.js} +1 -1
  7. package/dist/_chunks/chunk-4U4Y2K73.js +1 -0
  8. package/dist/_chunks/chunk-65FQPXKC.js +1 -0
  9. package/dist/_chunks/chunk-6DVZBKNV.js +1 -0
  10. package/dist/_chunks/{chunk-25EDDZQA.js → chunk-6LU6GJKW.js} +1 -1
  11. package/dist/_chunks/chunk-6N433ZWR.js +1 -0
  12. package/dist/_chunks/chunk-EGUJ2YRX.js +1 -0
  13. package/dist/_chunks/{chunk-MSOMVWKN.js → chunk-FU3524Z6.js} +1 -1
  14. package/dist/_chunks/chunk-GZBWA4YN.js +1 -0
  15. package/dist/_chunks/chunk-HR34UMPP.js +1 -0
  16. package/dist/_chunks/chunk-HTUTYIRU.js +1 -0
  17. package/dist/_chunks/chunk-KB2GVAN7.js +1 -0
  18. package/dist/_chunks/chunk-L543FEDK.js +1 -0
  19. package/dist/_chunks/chunk-LISB5W7B.js +1 -0
  20. package/dist/_chunks/chunk-LUAH3KAS.js +1 -0
  21. package/dist/_chunks/chunk-M2KVQQ4X.js +1 -0
  22. package/dist/_chunks/chunk-ODGPV7MM.js +1 -0
  23. package/dist/_chunks/chunk-PUBMDP4E.js +1 -0
  24. package/dist/_chunks/chunk-Q57YFNK5.js +1 -0
  25. package/dist/_chunks/chunk-QAJH4RJQ.js +1 -0
  26. package/dist/_chunks/chunk-WFRRNWO5.js +1 -0
  27. package/dist/_chunks/connect-5YMO6MAR.js +1 -0
  28. package/dist/_chunks/device-management-2OTGEBJQ.js +1 -0
  29. package/dist/_chunks/device-preflight-XPHFZGLO.js +1 -0
  30. package/dist/_chunks/devices-inventory-VWNTU5TE.js +1 -0
  31. package/dist/_chunks/devices-main-VQ4APRVS.js +1 -0
  32. package/dist/_chunks/{files-TBJVDQWU.js → files-TTIQ7LYJ.js} +1 -1
  33. package/dist/_chunks/host-main-H7DPLV7B.js +1 -0
  34. package/dist/_chunks/http-profile-MNJX6OXO.js +1 -0
  35. package/dist/_chunks/library-main-SAC3V2ML.js +1 -0
  36. package/dist/_chunks/local-main-D6B3APK6.js +1 -0
  37. package/dist/_chunks/local-mcp-ONCANLPH.js +1 -0
  38. package/dist/_chunks/main-PW6HB3NC.js +2 -0
  39. package/dist/_chunks/mcp-ZIGBYFUW.js +1 -0
  40. package/dist/_chunks/oauth-HC6TI7HB.js +1 -0
  41. package/dist/_chunks/render-main-GYWKP72O.js +1 -0
  42. package/dist/_chunks/source-import-BC5GNCUZ.js +1 -0
  43. package/dist/_chunks/src-R6DNU336.js +1 -0
  44. package/dist/_chunks/{stdio-main-JEADWO7U.js → stdio-main-RIJS5REB.js} +1 -1
  45. package/dist/_chunks/workspace-main-GNSKHKBG.js +1 -0
  46. package/dist/_types/cli/local/desktop-contract.d.ts +1969 -1
  47. package/dist/_types/cli/local/desktop-device-contract.d.ts +779 -0
  48. package/dist/_types/cli/local/desktop-device-navigation.d.ts +3 -0
  49. package/dist/_types/cli/local/desktop-device-owner.d.ts +244 -0
  50. package/dist/_types/cli/local/desktop-device-state.d.ts +397 -0
  51. package/dist/_types/cli/local/desktop-library.d.ts +853 -0
  52. package/dist/_types/cli/local/desktop-owner.d.ts +735 -1
  53. package/dist/_types/cli/local/ledger.d.ts +64 -10
  54. package/dist/_types/cli/local/manager.d.ts +1146 -43
  55. package/dist/_types/cli/local/mcp-tools.d.ts +287 -46
  56. package/dist/_types/cli/local/releases.d.ts +28 -5
  57. package/dist/_types/cli/local-management.d.ts +5 -0
  58. package/dist/_types/cli/local-navigation.d.ts +1 -0
  59. package/dist/_types/contracts/artifact-discovery.d.ts +76 -4
  60. package/dist/_types/contracts/audio.d.ts +4 -0
  61. package/dist/_types/contracts/composition-authoring.d.ts +8 -8
  62. package/dist/_types/contracts/composition-frame-render.d.ts +4 -4
  63. package/dist/_types/contracts/composition-render-base.d.ts +5 -4
  64. package/dist/_types/contracts/composition-render.d.ts +8 -8
  65. package/dist/_types/contracts/composition-repair.d.ts +10 -10
  66. package/dist/_types/contracts/composition-source-review.d.ts +12 -12
  67. package/dist/_types/contracts/delivery-manifest.d.ts +25 -11729
  68. package/dist/_types/contracts/delivery-operations.d.ts +51 -3909
  69. package/dist/_types/contracts/delivery-summary.d.ts +2 -2
  70. package/dist/_types/contracts/delivery-validation.d.ts +23 -0
  71. package/dist/_types/contracts/device-render.d.ts +77 -0
  72. package/dist/_types/contracts/editor-intelligence.d.ts +114 -2491
  73. package/dist/_types/contracts/exploration-recommendation.d.ts +263 -11607
  74. package/dist/_types/contracts/external-agent-access.d.ts +4 -6
  75. package/dist/_types/contracts/final-ready.d.ts +22 -22
  76. package/dist/_types/contracts/final-render.d.ts +1569 -6940
  77. package/dist/_types/contracts/human-identity.d.ts +13 -0
  78. package/dist/_types/contracts/index.d.ts +4 -0
  79. package/dist/_types/contracts/interface/media-output.d.ts +28 -0
  80. package/dist/_types/contracts/interface/production-snapshot.d.ts +15 -193
  81. package/dist/_types/contracts/keyframe-generation.d.ts +29 -0
  82. package/dist/_types/contracts/local-execution/agent-context.d.ts +365 -0
  83. package/dist/_types/contracts/local-execution/agent-evidence.d.ts +79 -0
  84. package/dist/_types/contracts/local-execution/agent-grant.d.ts +31 -0
  85. package/dist/_types/contracts/local-execution/agent-review.d.ts +496 -64
  86. package/dist/_types/contracts/local-execution/common.d.ts +12 -11
  87. package/dist/_types/contracts/local-execution/completion.d.ts +41 -45
  88. package/dist/_types/contracts/local-execution/components.d.ts +45 -0
  89. package/dist/_types/contracts/local-execution/descriptor.d.ts +38 -0
  90. package/dist/_types/contracts/local-execution/device-authority.d.ts +31 -0
  91. package/dist/_types/contracts/local-execution/device-inventory.d.ts +76 -0
  92. package/dist/_types/contracts/local-execution/device-workspace.d.ts +11 -0
  93. package/dist/_types/contracts/local-execution/device.d.ts +19 -51
  94. package/dist/_types/contracts/local-execution/external-generation.d.ts +199 -0
  95. package/dist/_types/contracts/local-execution/index.d.ts +26 -0
  96. package/dist/_types/contracts/local-execution/ipc.d.ts +2756 -228
  97. package/dist/_types/contracts/local-execution/library-command.d.ts +620 -0
  98. package/dist/_types/contracts/local-execution/library-result.d.ts +408 -0
  99. package/dist/_types/contracts/local-execution/library.d.ts +873 -0
  100. package/dist/_types/contracts/local-execution/lifecycle.d.ts +242 -42
  101. package/dist/_types/contracts/local-execution/local-navigation.d.ts +275 -56
  102. package/dist/_types/contracts/local-execution/management.d.ts +400 -0
  103. package/dist/_types/contracts/local-execution/media-recipe.d.ts +207 -0
  104. package/dist/_types/contracts/local-execution/media-validation-request.d.ts +232 -0
  105. package/dist/_types/contracts/local-execution/media-validation.d.ts +262 -0
  106. package/dist/_types/contracts/local-execution/object-transfer.d.ts +155 -0
  107. package/dist/_types/contracts/local-execution/offline.d.ts +59 -0
  108. package/dist/_types/contracts/local-execution/preview.d.ts +144 -3564
  109. package/dist/_types/contracts/local-execution/processor-capability.d.ts +39 -0
  110. package/dist/_types/contracts/local-execution/processor-direct.d.ts +290 -0
  111. package/dist/_types/contracts/local-execution/processor-recipes.d.ts +1122 -0
  112. package/dist/_types/contracts/local-execution/processor.d.ts +6173 -0
  113. package/dist/_types/contracts/local-execution/project-source-direct.d.ts +201 -0
  114. package/dist/_types/contracts/local-execution/qwen-tts.d.ts +31 -0
  115. package/dist/_types/contracts/local-execution/recognition.d.ts +170 -0
  116. package/dist/_types/contracts/local-execution/speech.d.ts +95 -0
  117. package/dist/_types/contracts/local-execution/tool-selection.d.ts +45 -5
  118. package/dist/_types/contracts/local-execution/whisper.d.ts +24 -0
  119. package/dist/_types/contracts/local-execution/work.d.ts +111 -3403
  120. package/dist/_types/contracts/local-execution/workspace.d.ts +141 -0
  121. package/dist/_types/contracts/media-category.d.ts +11 -0
  122. package/dist/_types/contracts/media-observation.d.ts +929 -8
  123. package/dist/_types/contracts/navigation.d.ts +25 -15
  124. package/dist/_types/contracts/observation-profile.d.ts +3 -3
  125. package/dist/_types/contracts/programmatic-composition.d.ts +24 -24
  126. package/dist/_types/contracts/programmatic-exploration.d.ts +348 -5985
  127. package/dist/_types/contracts/provider-catalog.d.ts +3 -3
  128. package/dist/_types/contracts/provider-models.d.ts +16 -8
  129. package/dist/_types/contracts/provider.d.ts +66 -1
  130. package/dist/_types/contracts/reference-preview.d.ts +19 -0
  131. package/dist/_types/contracts/repair-lifecycle.d.ts +52 -384
  132. package/dist/_types/contracts/repair-plan.d.ts +16 -98
  133. package/dist/_types/contracts/repair-strategy.d.ts +162 -4481
  134. package/dist/_types/contracts/review-intelligence-final-output.d.ts +317 -8139
  135. package/dist/_types/contracts/review-intelligence.d.ts +450 -11420
  136. package/dist/_types/contracts/rough-cut-manifest.d.ts +8 -3
  137. package/dist/_types/contracts/rough-cut-profile.d.ts +12 -3
  138. package/dist/_types/contracts/rough-cut-review.d.ts +134 -12494
  139. package/dist/_types/contracts/rough-cut.d.ts +1073 -5675
  140. package/dist/_types/contracts/sound-making-plan.d.ts +3 -2
  141. package/dist/_types/contracts/speech-cost.d.ts +81 -0
  142. package/dist/_types/contracts/speech.d.ts +149 -0
  143. package/dist/_types/contracts/temporal-evidence-operation.d.ts +1 -0
  144. package/dist/_types/contracts/timeline-audio.d.ts +1 -0
  145. package/dist/_types/contracts/timeline-manifest.d.ts +2 -0
  146. package/dist/_types/contracts/timeline-source-sound.d.ts +1 -0
  147. package/dist/_types/contracts/timeline-v2.d.ts +4 -0
  148. package/dist/_types/contracts/timeline-version-reader.d.ts +10 -0
  149. package/dist/_types/contracts/timeline-visual-layers.d.ts +4 -0
  150. package/dist/_types/contracts/timeline.d.ts +50 -4850
  151. package/dist/_types/contracts/transcription.d.ts +1 -1
  152. package/dist/_types/contracts/video-generation.d.ts +33 -0
  153. package/dist/_types/contracts/visual-layer-render.d.ts +58 -15
  154. package/dist/_types/contracts/visual-sequence.d.ts +22 -0
  155. package/dist/_types/contracts/workspace.d.ts +32 -0
  156. package/dist/_types/sdk/errors.d.ts +8 -3
  157. package/dist/_types/sdk/local-runtime/components.d.ts +2 -0
  158. package/dist/_types/sdk/local-runtime/device-client.d.ts +127 -17
  159. package/dist/_types/sdk/local-runtime/library.d.ts +268 -0
  160. package/dist/_types/sdk/local-runtime/workspace.d.ts +186 -0
  161. package/dist/_types/sdk/local-runtime-client.d.ts +1773 -89
  162. package/dist/entry.js +1 -1
  163. package/dist/local-management.js +1 -1
  164. package/dist/local-navigation.js +1 -1
  165. package/dist/native/JobNative.cs +10 -0
  166. package/dist/native/JobRunner.cs +24 -3
  167. package/dist/native/NativeMain.cs +15 -0
  168. package/package.json +2 -8
  169. package/README.md +0 -78
  170. package/dist/_chunks/chunk-6NVIN2NI.js +0 -1
  171. package/dist/_chunks/chunk-E57YVMQ4.js +0 -1
  172. package/dist/_chunks/chunk-EAZKDCLD.js +0 -1
  173. package/dist/_chunks/chunk-GIEYSDCG.js +0 -1
  174. package/dist/_chunks/chunk-GJ7BZJLW.js +0 -1
  175. package/dist/_chunks/chunk-HLKERZIE.js +0 -1
  176. package/dist/_chunks/chunk-QC7RLTGU.js +0 -1
  177. package/dist/_chunks/chunk-RUMDDTON.js +0 -1
  178. package/dist/_chunks/chunk-U2UKGYGF.js +0 -1
  179. package/dist/_chunks/local-main-SOERK22D.js +0 -1
  180. package/dist/_chunks/local-mcp-JLPXXIDW.js +0 -1
  181. package/dist/_chunks/main-4SNF5EKE.js +0 -2
  182. package/dist/_chunks/mcp-EIMXNRH3.js +0 -1
  183. package/dist/_chunks/oauth-257CEUQH.js +0 -1
  184. package/dist/_chunks/project-connect-6MH2QG6G.js +0 -1
  185. package/dist/_chunks/src-7F6ZEU3U.js +0 -1
@@ -1,20 +1,45 @@
1
1
  {
2
2
  "protocol": "NVS_PRODUCT_COMPATIBILITY_V1",
3
3
  "product": "@nativestudio/cli",
4
- "version": "0.3.0-rc.1",
4
+ "version": "0.3.0-rc.11",
5
5
  "source": {
6
- "head": "5de1fe58abdd64d067a177bc2df274c2aded863c",
7
- "fileDigest": "9f7d91f329c3d7d3dcd9723623c15c6c080d4593c00d7865adc806647f151e5d",
6
+ "head": "e5214407efc5896ff42c735382281b7827c22e2f",
7
+ "fileDigest": "f173df4faa5ffd63385d28e804b54264a0abc5e86ae8fbc5451ee689eb0c7f77",
8
8
  "dirty": false,
9
- "remoteMainHead": "5de1fe58abdd64d067a177bc2df274c2aded863c"
9
+ "remoteMainHead": "e5214407efc5896ff42c735382281b7827c22e2f"
10
10
  },
11
11
  "node": ">=24.12 <25",
12
12
  "discoveryProfile": "contextual-v1",
13
13
  "accountProtocol": "NVS_CLI_ACCOUNT_V1",
14
14
  "component": {
15
- "protocol": "NVS_PRODUCT_COMPONENT_V1",
16
- "version": "0.3.0-rc.1",
17
- "byteSize": 251947,
18
- "sha512": "8258686c13d9fd1622d93ce143a266d7853e623bef64de051cd62ea4876b6c5b650f5c5783608d25471dc0388d5f92ae87f49e1f95d73ce78e0726e5f4bf539a"
15
+ "protocol": "NVS_PRODUCT_COMPONENT_V2",
16
+ "version": "0.3.0-rc.11",
17
+ "byteSize": 3284123,
18
+ "sha512": "a6881dcf7977c711bcaf63a63ea1b3e6e2a32ab7f5c4867e81f1a85f87f6a19a2e50aef35ea97d6b508a5879730edfda40350c56d323a1c9e19d7dabd42747a8",
19
+ "descriptor": {
20
+ "protocol": "NVS_RUNTIME_DESCRIPTOR_V1",
21
+ "version": "0.3.0-rc.11",
22
+ "node": {
23
+ "major": 24,
24
+ "minMinor": 12
25
+ },
26
+ "ipcProtocol": "NVS_LOCAL_IPC_V1",
27
+ "workProtocol": "NVS_LOCAL_WORK_V2",
28
+ "journalSchema": 1,
29
+ "rendererDigest": "b78e6c0d169c852f7227d3bbdefc79d378c364471a9edf18c1b047597a45bc81",
30
+ "profileDigest": "9c66c6384e7c5b63a182f8ad0cde0e2713c933d7c5319eb803b5059a84b9750e",
31
+ "compatibleRenderers": [
32
+ {
33
+ "rendererDigest": "2b8e9eab1b560d799f85e1180097699ef0c4f1cf34aa4ad79f17f53ca5e36d70",
34
+ "profileDigest": "7c1379a543fb3cf43cc87bfa571cd1994a5c82a6b1fc3b3cce75e23b13e8a4fc"
35
+ }
36
+ ]
37
+ },
38
+ "resources": {
39
+ "captions": {
40
+ "byteSize": 17615831,
41
+ "sha512": "b9f4ad02b647ce8f96d8a34cb774812e39bea78a58d0075b94674e2e6f1c6e3ed43c1960bc26b5cd9eae5836a023f40700aed2fb8d48d15f73fd028451f1c948"
42
+ }
43
+ }
19
44
  }
20
45
  }
package/LICENSE CHANGED
@@ -1,21 +1,201 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 NativeStudio contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,6 +1,31 @@
1
1
  {
2
- "protocol": "NVS_PRODUCT_COMPONENT_V1",
3
- "version": "0.3.0-rc.1",
4
- "byteSize": 251947,
5
- "sha512": "8258686c13d9fd1622d93ce143a266d7853e623bef64de051cd62ea4876b6c5b650f5c5783608d25471dc0388d5f92ae87f49e1f95d73ce78e0726e5f4bf539a"
2
+ "protocol": "NVS_PRODUCT_COMPONENT_V2",
3
+ "version": "0.3.0-rc.11",
4
+ "byteSize": 3284123,
5
+ "sha512": "a6881dcf7977c711bcaf63a63ea1b3e6e2a32ab7f5c4867e81f1a85f87f6a19a2e50aef35ea97d6b508a5879730edfda40350c56d323a1c9e19d7dabd42747a8",
6
+ "descriptor": {
7
+ "protocol": "NVS_RUNTIME_DESCRIPTOR_V1",
8
+ "version": "0.3.0-rc.11",
9
+ "node": {
10
+ "major": 24,
11
+ "minMinor": 12
12
+ },
13
+ "ipcProtocol": "NVS_LOCAL_IPC_V1",
14
+ "workProtocol": "NVS_LOCAL_WORK_V2",
15
+ "journalSchema": 1,
16
+ "rendererDigest": "b78e6c0d169c852f7227d3bbdefc79d378c364471a9edf18c1b047597a45bc81",
17
+ "profileDigest": "9c66c6384e7c5b63a182f8ad0cde0e2713c933d7c5319eb803b5059a84b9750e",
18
+ "compatibleRenderers": [
19
+ {
20
+ "rendererDigest": "2b8e9eab1b560d799f85e1180097699ef0c4f1cf34aa4ad79f17f53ca5e36d70",
21
+ "profileDigest": "7c1379a543fb3cf43cc87bfa571cd1994a5c82a6b1fc3b3cce75e23b13e8a4fc"
22
+ }
23
+ ]
24
+ },
25
+ "resources": {
26
+ "captions": {
27
+ "byteSize": 17615831,
28
+ "sha512": "b9f4ad02b647ce8f96d8a34cb774812e39bea78a58d0075b94674e2e6f1c6e3ed43c1960bc26b5cd9eae5836a023f40700aed2fb8d48d15f73fd028451f1c948"
29
+ }
30
+ }
6
31
  }
Binary file
@@ -0,0 +1 @@
1
+ import{ContinuationSchema,DeliveryOutputProfileSchema,PrincipalIdSchema,ProductionIdSchema,ProjectIdSchema,QueryLimitSchema,QueryPageInfoSchema,TenantIdSchema}from"./chunk-VPYAXWXY.js";import{z}from"zod";var HumanEmailSchema=z.string().trim().max(254).toLowerCase().pipe(z.email()).refine(v=>/^[\x21-\x7e]+$/.test(v),"Use an ASCII email address");var HumanPasswordSchema=z.string().max(512).superRefine((v,c)=>{const points=[...v];const control=points.some(c2=>c2.codePointAt(0)<32||c2.codePointAt(0)===127);if(points.length<15||points.length>128||control)c.addIssue({code:"custom",message:"Password must contain 15\u2013128 characters"})});var HumanCodePurposeSchema=z.enum(["REGISTER","RESET_PASSWORD","LINK_EMAIL"]);var HumanCodeRequestSchema=z.strictObject({email:HumanEmailSchema,purpose:HumanCodePurposeSchema});var HumanCodeRequestedSchema=z.strictObject({accepted:z.literal(true),challengeId:z.uuid(),retryAfterSeconds:z.literal(60),expiresInSeconds:z.literal(600)});var proof={challengeId:z.uuid(),email:HumanEmailSchema,code:z.string().regex(/^\d{6}$/),password:HumanPasswordSchema};var HumanRegisterSchema=z.strictObject({...proof,displayName:z.string().trim().min(1).max(80)});var HumanResetSchema=z.strictObject(proof);var HumanLoginSchema=z.strictObject({email:HumanEmailSchema,password:z.string().max(512),rememberMe:z.boolean().optional()});var HumanTenantSchema=z.strictObject({id:z.uuid(),displayName:z.string().max(200)});var HumanAccountSchema=z.strictObject({principalId:z.uuid(),displayName:z.string().max(200),email:HumanEmailSchema.nullable(),tenants:z.array(HumanTenantSchema).max(100)});var HumanDesktopSessionSchema=z.strictObject({tenantId:z.uuid(),scopeKey:z.string().regex(/^[a-f0-9]{64}$/),expiresAt:z.int().positive(),sessionExpiresAt:z.int().positive().optional(),rememberMe:z.boolean(),account:HumanAccountSchema.omit({tenants:true})}).refine(({rememberMe,expiresAt,sessionExpiresAt})=>sessionExpiresAt===void 0||rememberMe&&sessionExpiresAt>=expiresAt,"Desktop persistence requires consent and the session deadline");var ShortHumanSessionSchema=z.strictObject({accessToken:z.string().regex(/^nvsh_[A-Za-z0-9_-]{43}$/),expiresAt:z.iso.datetime(),account:HumanAccountSchema});var HumanRefreshTokenSchema=z.string().regex(/^nvshr_[A-Za-z0-9_-]{43}$/);var HumanRefreshSchema=z.strictObject({refreshToken:HumanRefreshTokenSchema});var HumanSessionSchema=ShortHumanSessionSchema.extend({refreshToken:HumanRefreshTokenSchema.optional(),sessionId:z.uuid().optional(),sessionExpiresAt:z.iso.datetime().optional()}).refine(session=>{const{refreshToken,sessionId,sessionExpiresAt,expiresAt}=session;if(!refreshToken)return sessionId===void 0&&sessionExpiresAt===void 0;return!!sessionId&&!!sessionExpiresAt&&Date.parse(expiresAt)<=Date.parse(sessionExpiresAt)},"Persistent session requires its exact identity and absolute expiry");var HumanIdentityAvailabilitySchema=z.strictObject({passwordLogin:z.boolean(),emailVerification:z.boolean()});var HumanIdentityFailureSchema=z.strictObject({code:z.enum(["INVALID_INPUT","INVALID_CREDENTIALS","INVALID_CODE","RATE_LIMITED","MAIL_UNAVAILABLE","UNAVAILABLE","UNAUTHENTICATED","CONFLICT"])});var CliAccountRedirectSchema=z.string().max(256).refine(value=>{try{const url=new URL(value);return url.protocol==="http:"&&url.hostname==="127.0.0.1"&&Number(url.port)>0&&!url.username&&!url.password&&!url.search&&!url.hash&&/^\/account-callback\/[a-f0-9-]{36}$/.test(url.pathname)&&url.href===value}catch{return false}},"Owned loopback account callback required");var proofKey=z.string().regex(/^[A-Za-z0-9_-]{43}$/);var CliAccountRequestIdSchema=z.uuid();var CliAccountStartSchema=z.strictObject({redirectUri:CliAccountRedirectSchema,state:proofKey,codeChallenge:proofKey});var CliAccountStartedSchema=z.strictObject({requestId:z.uuid(),expiresAt:z.iso.datetime()});var CliAccountPreviewSchema=CliAccountStartedSchema.extend({redirectUri:CliAccountRedirectSchema});var CliAccountDecisionSchema=z.strictObject({requestId:z.uuid(),approved:z.boolean(),expectedPrincipalId:z.uuid()});var CliAccountExchangeSchema=z.strictObject({requestId:z.uuid(),code:proofKey,codeVerifier:proofKey,redirectUri:CliAccountRedirectSchema});var CliAccountSessionSchema=ShortHumanSessionSchema.extend({credentialPurpose:z.literal("CLI_ACCOUNT")});var CliAccountIdentitySchema=z.strictObject({credentialPurpose:z.literal("CLI_ACCOUNT"),account:HumanAccountSchema});import{z as z2}from"zod";var ProductionLifecycleSchema=z2.enum(["ACTIVE","COMPLETED","FAILED","CANCELLED"]);var ProductionPhaseSchema=z2.enum(["INTAKE","PLANNING","PREPARING_GENERATION","GENERATING","SHOT_REVIEW","ASSEMBLING","ROUGH_CUT_REVIEW","FINAL_READY","FINAL_RENDERING","DELIVERY_VALIDATION"]);var ProductionConditionSchema=z2.enum(["RUNNABLE","RUNNING","WAITING_PROVIDER","WAITING_HUMAN","BLOCKED","RETRYING"]);var CreateProductionInputSchema=z2.object({tenantId:TenantIdSchema,projectId:ProjectIdSchema,principalId:PrincipalIdSchema});var ProductionStateSchema=z2.object({lifecycle:ProductionLifecycleSchema,phase:ProductionPhaseSchema,condition:ProductionConditionSchema,revision:z2.int().positive(),blockingReason:z2.string().min(1).nullable(),waitingReason:z2.string().min(1).nullable()});var ProductionSchema=z2.object({id:ProductionIdSchema,tenantId:TenantIdSchema,projectId:ProjectIdSchema,state:ProductionStateSchema,activeBriefVersion:z2.int().positive().nullable().default(null),activeStoryVersion:z2.int().positive().nullable().default(null),activeSceneShotPlanVersion:z2.int().positive().nullable().default(null),createdByPrincipalId:PrincipalIdSchema,createdAt:z2.iso.datetime({offset:true}),updatedAt:z2.iso.datetime({offset:true})});import{z as z3}from"zod";var ProjectLifecycleSchema=z3.enum(["ACTIVE","ARCHIVED"]);var CreateProjectInputSchema=z3.object({tenantId:TenantIdSchema,principalId:PrincipalIdSchema,idempotencyKey:z3.string().trim().min(1).max(200),name:z3.string().trim().min(1).max(200)});var CreateProjectRequestSchema=CreateProjectInputSchema.omit({principalId:true}).strict();var ProjectSchema=z3.object({id:ProjectIdSchema,tenantId:TenantIdSchema,name:z3.string().min(1),lifecycle:ProjectLifecycleSchema,defaultActiveProductionId:ProductionIdSchema.nullable(),revision:z3.int().positive(),createdByPrincipalId:PrincipalIdSchema,createdAt:z3.iso.datetime({offset:true}),updatedAt:z3.iso.datetime({offset:true})});var CreatedProjectResultSchema=z3.object({project:ProjectSchema,production:ProductionSchema});import{z as z4}from"zod";var ProjectLibraryQuerySchema=z4.strictObject({tenantId:TenantIdSchema,limit:QueryLimitSchema,next:ContinuationSchema.optional()});var ProjectLibraryScopeSchema=z4.strictObject({tenantId:TenantIdSchema,projectId:ProjectIdSchema});var ProjectLibraryPageSchema=z4.strictObject({items:z4.array(ProjectSchema).max(100),page:QueryPageInfoSchema});var ProjectWorkspaceSchema=z4.strictObject({project:ProjectSchema,productions:z4.array(ProductionSchema).max(100),possiblyTruncated:z4.boolean()});var SourceLibraryQuerySchema=ProjectLibraryQuerySchema.extend({projectId:ProjectIdSchema.optional()});var SourceLibraryItemSchema=z4.strictObject({artifactId:z4.uuid(),representationId:z4.uuid(),projectId:ProjectIdSchema,kind:z4.enum(["REFERENCE_IMAGE","REFERENCE_VIDEO","PRODUCT_INFORMATION"]),originalName:z4.string().max(255),checksumSha256:z4.string().regex(/^[0-9a-f]{64}$/),contentType:z4.enum(["image/png","image/jpeg","image/webp","text/plain","application/json","video/mp4"]),byteSize:z4.int().positive().max(8388608),width:z4.int().positive().nullable(),height:z4.int().positive().nullable(),createdAt:z4.iso.datetime({offset:true})});var SourceLibraryPageSchema=z4.strictObject({items:z4.array(SourceLibraryItemSchema).max(100),page:QueryPageInfoSchema});var SourceLibraryMediaSchema=ProjectLibraryScopeSchema.extend({artifactId:z4.uuid()});var StudioInputContentSchema=z4.strictObject({schemaVersion:z4.literal(1),productionId:z4.uuid(),projectTitle:z4.string().trim().min(1).max(200),name:z4.string().trim().max(300),intent:z4.string().trim().min(1).max(2e3),aspectRatio:z4.enum(["16:9","9:16"]),targetDurationSeconds:z4.int().min(30).max(60),outputProfile:DeliveryOutputProfileSchema,sourceArtifactIds:z4.array(z4.uuid()).max(12)});export{HumanTenantSchema,CliAccountStartSchema,CliAccountStartedSchema,CliAccountExchangeSchema,CliAccountSessionSchema,CliAccountIdentitySchema,ProductionStateSchema,ProductionSchema,CreateProjectRequestSchema,ProjectSchema,CreatedProjectResultSchema,ProjectLibraryQuerySchema,ProjectLibraryScopeSchema,ProjectLibraryPageSchema,ProjectWorkspaceSchema,SourceLibraryQuerySchema,SourceLibraryItemSchema,SourceLibraryPageSchema,SourceLibraryMediaSchema,StudioInputContentSchema};
@@ -1 +1 @@
1
- import{FileOAuthProvider,withProfileLock}from"./chunk-MSOMVWKN.js";import{remoteFetch,remoteResponse}from"./chunk-PUNG4ND7.js";import{readInput}from"./chunk-25EDDZQA.js";import{NativeStudioSdkError}from"./chunk-6NVIN2NI.js";import{auth}from"@modelcontextprotocol/client";import{extractWWWAuthenticateParams}from"@modelcontextprotocol/client";async function oauthResourceMetadataUrl(resource,signal){const response=await remoteResponse(resource,{method:"GET",headers:{accept:"application/json, text/event-stream"},...signal?{signal}:{}});try{if(response.status===401)return extractWWWAuthenticateParams(response).resourceMetadataUrl;if(![200,204,405,406].includes(response.status))throw Error();return void 0}finally{await response.body?.cancel()}}function uncertainExchange(){throw new NativeStudioSdkError("OAUTH_OUTCOME_UNKNOWN","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}async function beginExchange(provider,kind){if(provider.data.pendingExchange)uncertainExchange();provider.data.version=2;provider.data.pendingExchange=kind;await provider.save()}async function runOAuthCommand(argv,stdin,signal){const fetchFn=(input,init)=>remoteFetch(input,{...init,...signal?{signal:AbortSignal.any([signal,...init?.signal?[init.signal]:[]])}:{}});const[command,...args]=argv,options=new Map;for(let i=0;i<args.length;i+=2){const key=args[i],value=args[i+1];if(!key||!["--profile","--mcp-url","--callback","--scope","--input"].includes(key)||!value||value.startsWith("--")||options.has(key))throw Error();options.set(key,value)}const path=options.get("--profile");if(!path)throw Error();return withProfileLock(path,async()=>{if(command==="auth-start"){if(!options.has("--mcp-url")||!options.has("--callback")||options.has("--input"))throw Error();const provider2=await FileOAuthProvider.create(path,options.get("--mcp-url"),options.get("--callback"),options.get("--scope")??"nvs:read nvs:write");const resourceMetadataUrl=await oauthResourceMetadataUrl(provider2.data.resource,signal);await auth(provider2,{serverUrl:provider2.data.resource,scope:provider2.data.scope,...resourceMetadataUrl?{resourceMetadataUrl}:{},fetchFn});return{exitCode:0,output:{semanticStatus:"NEEDS_INPUT",authorizationUrl:provider2.data.authorizationUrl,profileSaved:true}}}if(!options.has("--input")||options.size!==2||command!=="auth-complete")throw Error();const provider=await FileOAuthProvider.load(path),raw=await readInput(options.get("--input"),stdin);if(typeof raw.callbackUrl!=="string"||Object.keys(raw).some(k=>k!=="callbackUrl"))throw Error();const url=new URL(raw.callbackUrl),expected=new URL(provider.data.redirect);if(url.origin!==expected.origin||url.pathname!==expected.pathname||url.searchParams.getAll("code").length!==1||url.searchParams.getAll("state").length!==1||url.searchParams.getAll("iss").length!==1||url.searchParams.get("state")!==provider.data.state)throw Error();const code=url.searchParams.get("code"),iss=url.searchParams.get("iss");const issuer=provider.data.discovery?.authorizationServerMetadata?.issuer??provider.data.discovery?.authorizationServerUrl;if(issuer&&issuer!==iss)throw Error();await beginExchange(provider,"CODE");try{const result=await auth(provider,{serverUrl:provider.data.resource,authorizationCode:code,iss,fetchFn});if(result!=="AUTHORIZED"||provider.data.pendingExchange||!provider.data.token)uncertainExchange()}catch{uncertainExchange()}return{exitCode:0,output:{semanticStatus:"SUCCESS",connected:true,expiresAt:provider.data.expiresAt}}})}async function profileAuthorization(path,signal){return withProfileLock(path,async()=>{const provider=await FileOAuthProvider.load(path);if(provider.data.pendingExchange)uncertainExchange();if(!provider.data.token)throw Error();if(!provider.data.expiresAt||provider.data.expiresAt<Date.now()+3e4){await beginExchange(provider,"REFRESH");try{const result=await auth(provider,{serverUrl:provider.data.resource,fetchFn:(input,init)=>remoteFetch(input,{...init,...signal?{signal:AbortSignal.any([signal,...init?.signal?[init.signal]:[]])}:{}})});if(result!=="AUTHORIZED"||provider.data.pendingExchange)uncertainExchange()}catch{uncertainExchange()}}return{resource:provider.data.resource,authorization:"Bearer "+provider.data.token.access_token}})}export{runOAuthCommand,profileAuthorization};
1
+ import{FileOAuthProvider,withProfileLock}from"./chunk-FU3524Z6.js";import{readInput}from"./chunk-6LU6GJKW.js";import{remoteFetch,remoteResponse}from"./chunk-PUNG4ND7.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";import{auth}from"@modelcontextprotocol/client";import{extractWWWAuthenticateParams}from"@modelcontextprotocol/client";async function oauthResourceMetadataUrl(resource,signal){const response=await remoteResponse(resource,{method:"GET",headers:{accept:"application/json, text/event-stream"},...signal?{signal}:{}});try{if(response.status===401)return extractWWWAuthenticateParams(response).resourceMetadataUrl;if(![200,204,405,406].includes(response.status))throw Error();return void 0}finally{await response.body?.cancel()}}function uncertainExchange(){throw new NativeStudioSdkError("OAUTH_OUTCOME_UNKNOWN","INTERNAL_OPERATIONAL_FAILURE","UNKNOWN")}async function beginExchange(provider,kind){if(provider.data.pendingExchange)uncertainExchange();provider.data.version=2;provider.data.pendingExchange=kind;await provider.save()}async function runOAuthCommand(argv,stdin,signal){const fetchFn=(input,init)=>remoteFetch(input,{...init,...signal?{signal:AbortSignal.any([signal,...init?.signal?[init.signal]:[]])}:{}});const[command,...args]=argv,options=new Map;for(let i=0;i<args.length;i+=2){const key=args[i],value=args[i+1];if(!key||!["--profile","--mcp-url","--callback","--scope","--input"].includes(key)||!value||value.startsWith("--")||options.has(key))throw Error();options.set(key,value)}const path=options.get("--profile");if(!path)throw Error();return withProfileLock(path,async()=>{if(command==="auth-start"){if(!options.has("--mcp-url")||!options.has("--callback")||options.has("--input"))throw Error();const provider2=await FileOAuthProvider.create(path,options.get("--mcp-url"),options.get("--callback"),options.get("--scope")??"nvs:read nvs:write");const resourceMetadataUrl=await oauthResourceMetadataUrl(provider2.data.resource,signal);await auth(provider2,{serverUrl:provider2.data.resource,scope:provider2.data.scope,...resourceMetadataUrl?{resourceMetadataUrl}:{},fetchFn});return{exitCode:0,output:{semanticStatus:"NEEDS_INPUT",authorizationUrl:provider2.data.authorizationUrl,profileSaved:true}}}if(!options.has("--input")||options.size!==2||command!=="auth-complete")throw Error();const provider=await FileOAuthProvider.load(path),raw=await readInput(options.get("--input"),stdin);if(typeof raw.callbackUrl!=="string"||Object.keys(raw).some(k=>k!=="callbackUrl"))throw Error();const url=new URL(raw.callbackUrl),expected=new URL(provider.data.redirect);if(url.origin!==expected.origin||url.pathname!==expected.pathname||url.searchParams.getAll("code").length!==1||url.searchParams.getAll("state").length!==1||url.searchParams.getAll("iss").length!==1||url.searchParams.get("state")!==provider.data.state)throw Error();const code=url.searchParams.get("code"),iss=url.searchParams.get("iss");const issuer=provider.data.discovery?.authorizationServerMetadata?.issuer??provider.data.discovery?.authorizationServerUrl;if(issuer&&issuer!==iss)throw Error();await beginExchange(provider,"CODE");try{const result=await auth(provider,{serverUrl:provider.data.resource,authorizationCode:code,iss,fetchFn});if(result!=="AUTHORIZED"||provider.data.pendingExchange||!provider.data.token)uncertainExchange()}catch{uncertainExchange()}return{exitCode:0,output:{semanticStatus:"SUCCESS",connected:true,expiresAt:provider.data.expiresAt}}})}async function profileAuthorization(path,signal){return withProfileLock(path,async()=>{const provider=await FileOAuthProvider.load(path);if(provider.data.pendingExchange)uncertainExchange();if(!provider.data.token)throw Error();if(!provider.data.expiresAt||provider.data.expiresAt<Date.now()+3e4){await beginExchange(provider,"REFRESH");try{const result=await auth(provider,{serverUrl:provider.data.resource,fetchFn:(input,init)=>remoteFetch(input,{...init,...signal?{signal:AbortSignal.any([signal,...init?.signal?[init.signal]:[]])}:{}})});if(result!=="AUTHORIZED"||provider.data.pendingExchange)uncertainExchange()}catch{uncertainExchange()}}return{resource:provider.data.resource,authorization:"Bearer "+provider.data.token.access_token}})}export{runOAuthCommand,profileAuthorization};
@@ -0,0 +1 @@
1
+ import{desktopAutomation,desktopInstallationIdentity}from"./chunk-65FQPXKC.js";import{LocalInstallationManager,ownerClient,socketAbsent}from"./chunk-WFRRNWO5.js";import{LocalClientError,fail}from"./chunk-KB2GVAN7.js";import{LocalLibraryCallSchema,LocalLibraryGetSchema,LocalLibraryImportSchema,LocalLibraryItemSchema,LocalLibraryPageSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionSchema,LocalLibraryReadReplySchema,LocalLibraryReferenceSchema,LocalLibraryUsageSchema}from"./chunk-GZBWA4YN.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";import{z}from"zod";import{isAbsolute}from"node:path";import{constants}from"node:fs";import{open}from"node:fs/promises";import{createHash}from"node:crypto";var same=(a,b)=>a.dev===b.dev&&a.ino===b.ino&&a.size===b.size&&a.mtimeMs===b.mtimeMs&&a.ctimeMs===b.ctimeMs;async function captureLibraryImport(path,seed){const file2=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW).catch(()=>{throw new NativeStudioSdkError("LOCAL_LIBRARY_FILE_UNAVAILABLE","INVALID_INPUT","NO_WRITE")});try{const before=await file2.stat(),hash=createHash("sha256");if(!before.isFile()||before.size>128*1024*1024)fail("LOCAL_LIBRARY_FILE_INVALID");let size=0;for await(const bytes of file2.createReadStream({autoClose:false,start:0})){size+=bytes.length;if(size>before.size)fail("LOCAL_LIBRARY_FILE_CHANGED");hash.update(bytes)}if(size!==before.size||!same(before,await file2.stat()))fail("LOCAL_LIBRARY_FILE_CHANGED");const{tenantId,projectId,deviceId,contentType,...fields}=seed;return LocalLibraryImportSchema.parse({...fields,reference:{tenantId,projectId,deviceId,fileId:seed.requestId,versionId:seed.requestId,contentType,byteSize:size,checksumSha256:hash.digest("hex")}})}catch(error){if(error instanceof NativeStudioSdkError)throw error;throw new NativeStudioSdkError(error instanceof LocalClientError?error.code:"LOCAL_LIBRARY_FILE_UNAVAILABLE","INVALID_INPUT","NO_WRITE")}finally{await file2.close()}}async function importLibraryFile(library,path,raw){const input=LocalLibraryImportSchema.parse(raw),file2=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW).catch(()=>{throw new NativeStudioSdkError("LOCAL_LIBRARY_FILE_UNAVAILABLE","INVALID_INPUT","NO_WRITE")});let dispatched=false;try{const before=await file2.stat();if(!before.isFile()||before.size!==input.reference.byteSize)fail("LOCAL_LIBRARY_FILE_CHANGED");dispatched=true;const result=await library.import(input,file2.createReadStream({autoClose:false,start:0}));if(!same(before,await file2.stat()))fail("LOCAL_LIBRARY_IMPORT_UNKNOWN");return result}catch(error){if(error instanceof NativeStudioSdkError)throw error;throw new NativeStudioSdkError(error instanceof LocalClientError?error.code:"LOCAL_LIBRARY_IMPORT_UNAVAILABLE","BLOCKED",dispatched?"UNKNOWN":"NO_WRITE")}finally{await file2.close()}}var file=z.string().min(1).max(4096).refine(isAbsolute);var DesktopLibraryImportSeedSchema=LocalLibraryImportSchema.omit({reference:true}).extend({...LocalLibraryReferenceSchema.pick({tenantId:true,projectId:true,deviceId:true,contentType:true}).shape});var DesktopLibraryRequestSchema=z.strictObject({operation:z.literal("library"),call:LocalLibraryCallSchema});var DesktopLibraryImportRequestSchema=z.strictObject({operation:z.literal("library-import"),input:LocalLibraryImportSchema,file});var DesktopLibraryPrepareRequestSchema=z.strictObject({operation:z.literal("library-import-prepare"),seed:DesktopLibraryImportSeedSchema,file});var DesktopLibraryMediaRequestSchema=z.strictObject({operation:z.literal("library-media"),input:LocalLibraryGetSchema,method:z.enum(["GET","HEAD"]).default("GET"),range:z.string().min(1).max(100).optional()});var DesktopLibraryReplySchema=z.union([LocalLibraryItemSchema.nullable(),LocalLibraryPageSchema,LocalLibraryProjectionPageSchema,LocalLibraryProjectionSchema,LocalLibraryUsageSchema,LocalLibraryReadReplySchema]);async function client(home){const manager=await LocalInstallationManager.open(home),config=await manager.configuration();if(!(await manager.status()).running){const policy=await desktopAutomation(home),installation=await desktopInstallationIdentity(manager);if(!policy?.enabled||policy.installationFingerprint!==installation?.fingerprint||!await socketAbsent(config.stateDirectory))fail("RUNTIME_STATUS_REQUIRED");await manager.start()}return ownerClient(config.stateDirectory)}async function runDesktopLibraryRequest(home,raw){const input=DesktopLibraryRequestSchema.parse(raw);return(await client(home)).library.call(input.call)}async function prepareDesktopLibraryImport(raw){const input=DesktopLibraryPrepareRequestSchema.parse(raw);return DesktopLibraryImportRequestSchema.parse({operation:"library-import",file:input.file,input:await captureLibraryImport(input.file,input.seed)})}async function runDesktopLibraryImport(home,raw){const input=DesktopLibraryImportRequestSchema.parse(raw);return importLibraryFile((await client(home)).library,input.file,input.input)}async function runDesktopLibraryMedia(home,raw){const input=DesktopLibraryMediaRequestSchema.parse(raw);return(await client(home)).library.media(input.input,{method:input.method,...input.range?{range:input.range}:{}})}export{DesktopLibraryImportSeedSchema,DesktopLibraryRequestSchema,DesktopLibraryImportRequestSchema,DesktopLibraryPrepareRequestSchema,DesktopLibraryMediaRequestSchema,DesktopLibraryReplySchema,runDesktopLibraryRequest,prepareDesktopLibraryImport,runDesktopLibraryImport,runDesktopLibraryMedia};
@@ -0,0 +1 @@
1
+ import{DesktopDeviceScopeSchema}from"./chunk-EGUJ2YRX.js";import{fail,optional,read,sha256,write}from"./chunk-KB2GVAN7.js";import{canonicalLocalJson}from"./chunk-GZBWA4YN.js";import{join}from"node:path";import{z}from"zod";var digest=z.string().regex(/^[a-f0-9]{64}$/);var DesktopAutomationSchema=z.strictObject({enabled:z.boolean(),scope:DesktopDeviceScopeSchema,deviceId:z.uuid(),deviceRevision:z.int().positive(),installationFingerprint:digest});async function desktopInstallationIdentity(manager){const active=(await manager.ledger.current()).value.active;if(!active)return null;const tools=active.toolsConfigPath?JSON.parse((await read(active.toolsConfigPath,32768)).toString()):null;return{version:active.descriptor.version,workProtocol:active.descriptor.workProtocol,fingerprint:sha256(canonicalLocalJson({descriptor:active.descriptor,files:active.files,tools}))}}async function desktopAutomation(home){const value=await optional(join(home,"desktop-execution-policy.json"));return value?DesktopAutomationSchema.parse(value):null}function canResumeDesktop(policy,state,installation){if(!policy?.enabled||!installation||!state.device||policy.installationFingerprint!==installation.fingerprint||canonicalLocalJson(policy.scope)!==canonicalLocalJson(state.scope)||policy.deviceId!==state.device.deviceId||policy.deviceRevision!==state.device.revision)return false;return state.device.revokedAt===null}async function rememberDesktopAutomation(home,state,installation,expectedFingerprint){if(!installation||installation.fingerprint!==expectedFingerprint||!state.device)fail("DEVICE_PLAN_CHANGED");const value=DesktopAutomationSchema.parse({enabled:true,scope:state.scope,deviceId:state.device.deviceId,deviceRevision:state.device.revision,installationFingerprint:expectedFingerprint});await write(join(home,"desktop-execution-policy.json"),canonicalLocalJson(value));return value}async function disableDesktopAutomation(home){const policy=await desktopAutomation(home);if(policy)await write(join(home,"desktop-execution-policy.json"),canonicalLocalJson({...policy,enabled:false}))}export{desktopInstallationIdentity,desktopAutomation,canResumeDesktop,rememberDesktopAutomation,disableDesktopAutomation};
@@ -0,0 +1 @@
1
+ import{FileOAuthProvider,withProfileLock}from"./chunk-FU3524Z6.js";import{directory,optional,privateDirectory,write}from"./chunk-KB2GVAN7.js";import{CliAccountExchangeSchema,CliAccountIdentitySchema,CliAccountSessionSchema,CliAccountStartSchema,CliAccountStartedSchema,ProjectLibraryPageSchema,ProjectWorkspaceSchema}from"./chunk-37PAJCKA.js";import{secureEndpoint}from"./chunk-PUNG4ND7.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";import{join}from"node:path";import{z as z2}from"zod";import{z}from"zod";function accountServerOrigin(value){const url=new URL(value);if(url.pathname!=="/"||url.search||url.hash||url.username||url.password||!(url.protocol==="https:"||url.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(url.hostname)))throw new NativeStudioSdkError("ACCOUNT_SERVER_ORIGIN_REQUIRED","INVALID_INPUT","NO_WRITE");return url.origin}var NativeStudioAccountClient=class{constructor(options){this.options=options;this.serverOrigin=accountServerOrigin(options.serverOrigin);if(options.accessToken&&!/^nvsh_[A-Za-z0-9_-]{43}$/.test(options.accessToken))throw new NativeStudioSdkError("INVALID_ACCOUNT_CREDENTIAL","INVALID_INPUT","NO_WRITE")}options;serverOrigin;async request(action,schema,options={}){if(options.credential&&!this.options.accessToken)throw new NativeStudioSdkError("ACCOUNT_LOGIN_REQUIRED","INVALID_INPUT","NO_WRITE");const write2=options.body!==void 0;let response;try{response=await(this.options.fetch??fetch)(`${this.serverOrigin}/api/cli-account/${action}${options.query?"?"+options.query:""}`,{method:write2?"POST":"GET",cache:"no-store",redirect:"error",credentials:"omit",signal:AbortSignal.any([AbortSignal.timeout(15e3),...options.signal?[options.signal]:[]]),headers:{...write2?{"content-type":"application/json"}:{},...options.credential?{authorization:"Bearer "+this.options.accessToken}:{}},...write2?{body:JSON.stringify(options.body)}:{}})}catch{throw new NativeStudioSdkError("ACCOUNT_TRANSPORT_FAILED","BLOCKED",write2?"UNKNOWN":"NO_WRITE")}if(!response.ok){await response.body?.cancel();throw new NativeStudioSdkError(response.status===401?"ACCOUNT_SESSION_EXPIRED_OR_REVOKED":"ACCOUNT_REQUEST_REJECTED","BLOCKED",write2&&response.status>=500?"UNKNOWN":"REJECTED",response.status)}try{if(!(response.headers.get("content-type")??"").startsWith("application/json"))throw Error();const reader=response.body?.getReader();if(!reader)throw Error();const chunks=[];let size=0;try{while(true){const part=await reader.read();if(part.done)break;size+=part.value.byteLength;if(size>1024*1024){await reader.cancel();throw Error()}chunks.push(part.value)}}finally{reader.releaseLock()}const bytes=new Uint8Array(size);let offset=0;for(const part of chunks){bytes.set(part,offset);offset+=part.length}return schema.parse(JSON.parse(new TextDecoder().decode(bytes)))}catch{throw new NativeStudioSdkError("ACCOUNT_RESPONSE_INVALID","BLOCKED",write2?"UNKNOWN":"NO_WRITE")}}async metadata(signal){return this.request("metadata",z.strictObject({protocol:z.literal("NVS_CLI_ACCOUNT_V1"),serverOrigin:z.literal(this.serverOrigin)}),{signal})}start(input,signal){return this.request("start",CliAccountStartedSchema,{body:CliAccountStartSchema.parse(input),signal})}exchange(input,signal){return this.request("exchange",CliAccountSessionSchema,{body:CliAccountExchangeSchema.parse(input),signal})}me(signal){return this.request("me",CliAccountIdentitySchema,{credential:true,signal})}logout(signal){return this.request("logout",z.strictObject({changed:z.literal(true)}),{credential:true,body:{},signal})}async projects(input,signal){const value=z.strictObject({tenantId:z.uuid(),limit:z.number().int().min(1).max(100).optional(),next:z.string().min(1).max(8192).optional()}).parse(input);const result=await this.request("projects",ProjectLibraryPageSchema,{credential:true,signal,query:new URLSearchParams({tenantId:value.tenantId,...value.limit?{limit:String(value.limit)}:{},...value.next?{next:value.next}:{}})});if(result.items.some(p=>p.tenantId!==value.tenantId))throw new NativeStudioSdkError("ACCOUNT_RESPONSE_SCOPE_MISMATCH","BLOCKED","NO_WRITE");return result}async project(input,signal){const value=z.strictObject({tenantId:z.uuid(),projectId:z.uuid()}).parse(input);const result=await this.request("project",ProjectWorkspaceSchema,{credential:true,signal,query:new URLSearchParams(value)});if(result.project.id!==value.projectId||result.project.tenantId!==value.tenantId)throw new NativeStudioSdkError("ACCOUNT_RESPONSE_SCOPE_MISMATCH","BLOCKED","NO_WRITE");return result}};var AccountStateSchema=z2.strictObject({version:z2.literal(1),epoch:z2.uuid(),serverOrigin:z2.string().refine(v=>{try{return accountServerOrigin(v)===v}catch{return false}}),principalId:z2.uuid(),expiresAt:z2.iso.datetime(),workspaceId:z2.uuid().nullable(),projectId:z2.uuid().nullable(),state:z2.enum(["ACTIVE","REVOKE_PENDING","SIGNED_OUT"]),accessToken:z2.string().regex(/^nvsh_[A-Za-z0-9_-]{43}$/).nullable()}).refine(v=>v.state==="SIGNED_OUT"===(v.accessToken===null)&&(!v.projectId||Boolean(v.workspaceId)));function accountError(code,outcome="NO_WRITE"){throw new NativeStudioSdkError(code,outcome==="UNKNOWN"?"INTERNAL_OPERATIONAL_FAILURE":["ACCOUNT_LOGIN_INPUT_INVALID","ACCOUNT_COMMAND_INPUT_INVALID"].includes(code)?"INVALID_INPUT":"BLOCKED",outcome)}async function readAccount(root){const value=await optional(join(root,"account.json"));if(value===null)return null;const parsed=AccountStateSchema.safeParse(value);if(!parsed.success)accountError("ACCOUNT_STATE_INVALID");return parsed.data}async function saveAccount(root,value){const account=AccountStateSchema.parse(value);await write(join(root,"account.json"),JSON.stringify(account))}async function withAccountLock(root,action){try{return await withProfileLock(join(root,"account.json"),action)}catch(error){if(error.code==="EEXIST")accountError("ACCOUNT_COMMAND_BUSY");throw error}}function requireAccount(value){if(!value)accountError("ACCOUNT_LOGIN_REQUIRED");if(value.state==="REVOKE_PENDING")accountError("ACCOUNT_LOGOUT_OUTCOME_UNKNOWN","UNKNOWN");if(value.state!=="ACTIVE"||Date.parse(value.expiresAt)<=Date.now())accountError("ACCOUNT_LOGIN_REQUIRED");return value}import{homedir}from"node:os";import{isAbsolute,join as join2}from"node:path";import{realpath}from"node:fs/promises";function connectionError(code){throw new NativeStudioSdkError(code,"INVALID_INPUT","NO_WRITE")}async function clientHome(environment,create=false){const path=environment.NATIVESTUDIO_CLIENT_HOME??join2(homedir(),".nativestudio","client");if(!isAbsolute(path))connectionError("CLIENT_HOME_ABSOLUTE_REQUIRED");if(create)return directory(path);await privateDirectory(path);const root=await realpath(path);if(/(?:^|[\\/])(?:node_modules|_npx)(?:[\\/]|$)/.test(root))connectionError("CLIENT_HOME_PRIVATE_REQUIRED");return root}import{join as join3}from"node:path";var uuid="[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";var tenantPath=new RegExp(`^/mcp/external/v1/tenants/(${uuid})$`,"i");function tenantConnection(resource){const url=secureEndpoint(resource),match=tenantPath.exec(url.pathname);if(!match)connectionError("TENANT_MCP_URL_REQUIRED");return{resource:url.href,tenantId:match[1].toLowerCase()}}async function saveConnection(root,profile,expectedEpoch){return withAccountLock(root,()=>saveConnectionLocked(root,profile,expectedEpoch))}async function saveConnectionLocked(root,profile,expectedEpoch){if(!/^profile-[0-9a-f-]{36}\.json$/.test(profile))throw Error();const provider=await FileOAuthProvider.load(join3(root,profile));const scope=tenantConnection(provider.data.resource);if(!provider.data.token?.access_token||provider.data.pendingExchange)throw Error();const account=await readAccount(root);if(account?.epoch!==expectedEpoch)connectionError("ACCOUNT_CHANGED_DURING_CONNECTION");if(account&&(account.state!=="ACTIVE"||account.workspaceId!==scope.tenantId))connectionError("ACCOUNT_WORKSPACE_SELECTION_REQUIRED");await write(join3(root,"connection.json"),JSON.stringify({version:3,profile,...scope,...account?{accountEpoch:account.epoch}:{}}));return{scope:provider.data.token.scope??provider.data.scope,expiresAt:provider.data.expiresAt}}async function loadConnection(environment){let root;try{root=await clientHome(environment)}catch(e){if(e.code==="ENOENT")return null;throw e}const value=await optional(join3(root,"connection.json"));if(value===null)return null;if(value.version!==3||typeof value.profile!=="string"||!/^profile-[0-9a-f-]{36}\.json$/.test(value.profile)||typeof value.resource!=="string")connectionError("CONNECTION_INVALID");const scope=tenantConnection(value.resource);if(scope.tenantId!==value.tenantId||value.projectId!==void 0)connectionError("CONNECTION_SCOPE_MISMATCH");const account=await readAccount(root);if(value.accountEpoch!==void 0&&(!account||typeof value.accountEpoch!=="string"))connectionError("CONNECTION_ACCOUNT_MISMATCH");if(account&&(account.state!=="ACTIVE"||value.accountEpoch!==account.epoch||scope.tenantId!==account.workspaceId))connectionError("CONNECTION_ACCOUNT_MISMATCH");const profile=join3(root,value.profile),provider=await FileOAuthProvider.load(profile);if(provider.data.resource!==scope.resource||!provider.data.token?.access_token)connectionError("CONNECTION_PROFILE_MISMATCH");return{...scope,profile,scope:provider.data.token.scope??provider.data.scope,requestedScope:provider.data.scope,expiresAt:provider.data.expiresAt,exchangeUnresolved:Boolean(provider.data.pendingExchange)}}var authentication=["--profile","--origin","--mcp-url","--token-env","--token-file"];async function defaultConnection(options,environment,tenant){if(authentication.some(key=>options.has(key)))return;const connection=await loadConnection(environment);if(!connection)connectionError("TENANT_CONNECTION_REQUIRED");if(options.has("--tenant")&&options.get("--tenant")!==connection.tenantId)connectionError("CONNECTION_SCOPE_MISMATCH");options.set("--profile",connection.profile);if(tenant)options.set("--tenant",connection.tenantId)}async function connectionStatus(environment){const value=await loadConnection(environment);return{exitCode:0,output:value?{semanticStatus:"SUCCESS",connected:true,credentialPurpose:"TENANT_MCP",accountSessionVerified:false,verification:"LOCAL_METADATA_ONLY",resource:value.resource,tenantId:value.tenantId,scope:value.scope,requestedScope:value.requestedScope,expiresAt:value.expiresAt,credentialState:value.exchangeUnresolved?"EXCHANGE_UNRESOLVED":typeof value.expiresAt==="number"&&value.expiresAt>Date.now()+3e4?"CACHED":"REFRESH_REQUIRED",nextSteps:value.exchangeUnresolved?["Wait for the active authorization command. If it returned OAUTH_OUTCOME_UNKNOWN, run nvs connect --mcp-url <workspace-connection-url>."]:["nvs find --query <intent>","nvs capabilities","nvs mcp"]}:{semanticStatus:"NEEDS_INPUT",connected:false,credentialPurpose:"TENANT_MCP",accountSessionVerified:false,nextSteps:["Open Agent access in the workspace settings, then authorize the workspace once.","nvs connect --mcp-url <workspace-connection-url>"]}}}export{accountServerOrigin,NativeStudioAccountClient,accountError,readAccount,saveAccount,withAccountLock,requireAccount,connectionError,clientHome,tenantConnection,saveConnection,loadConnection,defaultConnection,connectionStatus};
@@ -1 +1 @@
1
- import{privateAccess}from"./chunk-GIEYSDCG.js";import{open,constants}from"node:fs/promises";import{resolve}from"node:path";var limit=18*1024*1024;async function readInput(path,stdin){let bytes;if(path==="-"){const chunks=[];let size=0;for await(const chunk of stdin){size+=chunk.byteLength;if(size>limit)throw Error();chunks.push(Buffer.from(chunk))}bytes=Buffer.concat(chunks)}else{const handle=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW);try{const stat=await handle.stat();if(!stat.isFile()||stat.size>limit)throw Error();bytes=Buffer.alloc(limit+1);let used=0;while(used<bytes.byteLength){const read=await handle.read(bytes,used,bytes.byteLength-used,null);if(!read.bytesRead)break;used+=read.bytesRead}if(used>limit)throw Error();bytes=bytes.subarray(0,used)}finally{await handle.close()}}const value=JSON.parse(new TextDecoder("utf-8",{fatal:true}).decode(bytes));if(!value||typeof value!=="object"||Array.isArray(value))throw Error();return value}async function readCredential(options,environment){if(options.has("--token-file")===options.has("--token-env"))throw Error();let token;const key=options.get("--token-env");if(key){if(!/^[A-Z][A-Z0-9_]{0,127}$/.test(key))throw Error();token=environment[key]??""}else{if(process.platform==="win32")await privateAccess(resolve(options.get("--token-file")),"file");const handle=await open(options.get("--token-file"),constants.O_RDONLY|constants.O_NOFOLLOW);try{const stat=await handle.stat();if(!stat.isFile()||process.platform!=="win32"&&(stat.mode&63)!==0||stat.size>8192)throw Error();const bytes=Buffer.alloc(8193);const{bytesRead}=await handle.read(bytes,0,bytes.length,0);if(bytesRead>8192)throw Error();token=bytes.subarray(0,bytesRead).toString("utf8").trim()}finally{await handle.close()}}if(!/^[A-Za-z0-9._~-]{1,8192}$/.test(token))throw Error();return"Bearer "+token}export{readInput,readCredential};
1
+ import{privateAccess}from"./chunk-KB2GVAN7.js";import{open,constants}from"node:fs/promises";import{resolve}from"node:path";var limit=18*1024*1024;async function readInput(path,stdin){let bytes;if(path==="-"){const chunks=[];let size=0;for await(const chunk of stdin){size+=chunk.byteLength;if(size>limit)throw Error();chunks.push(Buffer.from(chunk))}bytes=Buffer.concat(chunks)}else{const handle=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW);try{const stat=await handle.stat();if(!stat.isFile()||stat.size>limit)throw Error();bytes=Buffer.alloc(limit+1);let used=0;while(used<bytes.byteLength){const read=await handle.read(bytes,used,bytes.byteLength-used,null);if(!read.bytesRead)break;used+=read.bytesRead}if(used>limit)throw Error();bytes=bytes.subarray(0,used)}finally{await handle.close()}}const value=JSON.parse(new TextDecoder("utf-8",{fatal:true}).decode(bytes));if(!value||typeof value!=="object"||Array.isArray(value))throw Error();return value}async function readCredential(options,environment){if(options.has("--token-file")===options.has("--token-env"))throw Error();let token;const key=options.get("--token-env");if(key){if(!/^[A-Z][A-Z0-9_]{0,127}$/.test(key))throw Error();token=environment[key]??""}else{if(process.platform==="win32")await privateAccess(resolve(options.get("--token-file")),"file");const handle=await open(options.get("--token-file"),constants.O_RDONLY|constants.O_NOFOLLOW);try{const stat=await handle.stat();if(!stat.isFile()||process.platform!=="win32"&&(stat.mode&63)!==0||stat.size>8192)throw Error();const bytes=Buffer.alloc(8193);const{bytesRead}=await handle.read(bytes,0,bytes.length,0);if(bytesRead>8192)throw Error();token=bytes.subarray(0,bytesRead).toString("utf8").trim()}finally{await handle.close()}}if(!/^[A-Za-z0-9._~-]{1,8192}$/.test(token))throw Error();return"Bearer "+token}export{readInput,readCredential};
@@ -0,0 +1 @@
1
+ import{localCliVersion}from"./chunk-2UYKJ6YN.js";import{NativeStudioMcpClient}from"./chunk-PUBMDP4E.js";import{remoteFetch,secureEndpoint}from"./chunk-PUNG4ND7.js";import{NativeStudioSdkError}from"./chunk-HTUTYIRU.js";import{Client,StreamableHTTPClientTransport}from"@modelcontextprotocol/client";async function connectRemoteMcp(endpoint,authorization,tenantId){const url=secureEndpoint(endpoint);const client=new Client({name:"native-studio-remote-cli",version:(await localCliVersion()).version},{versionNegotiation:{mode:"auto"}});try{const transport=new StreamableHTTPClientTransport(url,{requestInit:{headers:{authorization}},fetch:remoteFetch});await client.connect(transport);return{studio:new NativeStudioMcpClient({tenantId,client}),close:()=>client.close()}}catch{await client.close();throw new NativeStudioSdkError("TRANSPORT_UNAVAILABLE","INTERNAL_OPERATIONAL_FAILURE","NO_WRITE")}}export{connectRemoteMcp};
@@ -0,0 +1 @@
1
+ import{directory,entries,fail,privateAccess,read,sha256,write}from"./chunk-KB2GVAN7.js";import{LocalDeviceTransportConfigurationSchema,LocalDeviceViewSchema,LocalFinalRenderAdmissionSchema,LocalManagementCommandSchema,LocalManagementResultSchema,LocalPreviewAdmissionSchema,StartLocalFinalRenderSchema,StartLocalPreviewSchema,canonicalLocalJson}from"./chunk-GZBWA4YN.js";import{z}from"zod";var DesktopDeviceScopeSchema=z.strictObject({origin:z.url().refine(value=>{const u=new URL(value);return u.origin===value&&(u.protocol==="https:"||u.protocol==="http:"&&["127.0.0.1","localhost","[::1]"].includes(u.hostname))}),tenantId:z.uuid(),principalId:z.uuid()});var digest=z.string().regex(/^[a-f0-9]{64}$/);var DesktopDeviceCallSchema=z.discriminatedUnion("action",[z.strictObject({action:z.literal("inspect")}),z.strictObject({action:z.literal("prove")}),z.strictObject({action:z.literal("media-validation-capability")}),z.strictObject({action:z.literal("media-processing-capability")}),z.strictObject({action:z.literal("connect"),expectedRevision:z.int().nonnegative(),installationFingerprint:digest.optional()}),z.strictObject({action:z.literal("remember-enable"),expectedRevision:z.int().nonnegative(),installationFingerprint:digest}),z.strictObject({action:z.literal("connection-recover")}),z.strictObject({action:z.literal("enroll"),label:z.string().trim().min(1).max(120)}),z.strictObject({action:z.literal("revoke")}),z.strictObject({action:z.literal("preview"),input:StartLocalPreviewSchema.omit({tenantId:true,placement:true,idempotencyKey:true}),mode:z.enum(["local-only","local-preferred"])}),z.strictObject({action:z.literal("final"),input:StartLocalFinalRenderSchema.omit({tenantId:true,placement:true,idempotencyKey:true}),mode:z.enum(["local-only","local-preferred"])}),z.strictObject({action:z.literal("dispatch"),fingerprint:digest}),z.strictObject({action:z.literal("record"),fingerprint:digest,result:LocalManagementResultSchema}),z.strictObject({action:z.literal("refused"),fingerprint:digest})]);var DesktopDeviceRequestSchema=z.strictObject({operation:z.literal("device"),scope:DesktopDeviceScopeSchema,call:DesktopDeviceCallSchema});var DesktopDeviceStateSchema=z.strictObject({revision:z.int().nonnegative(),scope:DesktopDeviceScopeSchema,enrollment:LocalManagementCommandSchema.options[0].shape.input.nullable(),device:LocalDeviceViewSchema.nullable(),previews:z.array(z.union([LocalPreviewAdmissionSchema,LocalFinalRenderAdmissionSchema])).max(20),connectorId:z.uuid().nullable(),connection:z.strictObject({phase:z.enum(["CONNECTING","READY","CONNECTED"]),expiresAt:z.iso.datetime(),tenantMediaProcessing:z.literal(true).optional(),processorCapabilities:LocalDeviceTransportConfigurationSchema.shape.processorCapabilities,deviceRevision:z.int().positive(),tenantMediaValidation:z.literal(true).optional()}).nullable().default(null),pending:z.strictObject({command:LocalManagementCommandSchema,fingerprint:digest,phase:z.enum(["PREPARED","SENDING","REFUSED"])}).nullable()});var DesktopDeviceViewSchema=DesktopDeviceStateSchema.omit({scope:true,enrollment:true,connectorId:true,pending:true,device:true}).extend({installation:z.strictObject({version:z.string().min(1).max(100),fingerprint:digest,workProtocol:z.enum(["NVS_LOCAL_WORK_V1","NVS_LOCAL_WORK_V2"]).optional()}).nullable().optional(),automaticConnection:z.boolean().optional(),device:z.strictObject({deviceId:z.uuid(),label:z.string().max(120),revision:z.int().positive(),revokedAt:z.iso.datetime().nullable()}).nullable(),pending:z.strictObject({kind:z.enum(["ENROLL","REVOKE_DEVICE","PREVIEW","FINAL_RENDER"]),phase:z.enum(["PREPARED","SENDING","REFUSED"]),fingerprint:digest}).nullable()});var DesktopDeviceReplySchema=z.strictObject({view:DesktopDeviceViewSchema,command:LocalManagementCommandSchema.optional(),mediaValidationSupported:z.boolean().optional(),mediaProcessingSupported:z.boolean().optional(),localLibrarySupported:z.boolean().optional(),compositionProcessingSupported:z.boolean().optional()});import{join}from"node:path";var recordRoot=(home,scope)=>join(home,"devices",sha256(canonicalLocalJson(scope)));var DesktopDeviceRecords=class _DesktopDeviceRecords{constructor(root,scope){this.root=root;this.scope=scope}root;scope;static async open(home,raw){const scope=DesktopDeviceScopeSchema.parse(raw);return new _DesktopDeviceRecords(await directory(recordRoot(home,scope)),scope)}static async inspect(home,raw){const scope=DesktopDeviceScopeSchema.parse(raw);const root=recordRoot(home,scope);try{await privateAccess(join(home,"devices"),"directory");await privateAccess(root,"directory")}catch(error){if(error.code==="ENOENT")return null;throw error}return new _DesktopDeviceRecords(root,scope).current()}async current(){const names=(await entries(this.root)).filter(n=>/^\d{12}\.json$/.test(n)).sort();let state={revision:0,scope:this.scope,enrollment:null,device:null,previews:[],connectorId:null,connection:null,pending:null};for(const[index,name]of names.entries()){const next=DesktopDeviceStateSchema.parse(JSON.parse((await read(join(this.root,name),262144,true)).toString()));if(next.revision!==index+1||canonicalLocalJson(next.scope)!==canonicalLocalJson(this.scope))fail("DEVICE_HISTORY_INVALID");state=next}return state}async save(before,fields){if((await this.current()).revision!==before.revision)fail("REVISION_CONFLICT");const next=DesktopDeviceStateSchema.parse({...before,...fields,revision:before.revision+1});try{await write(join(this.root,String(next.revision).padStart(12,"0")+".json"),canonicalLocalJson(next),true)}catch(e){if(e.code==="EEXIST")fail("REVISION_CONFLICT");throw e}return next}keyPath(){return join(this.root,"device-key.json")}connectorPath(id){return join(this.root,id+".connector.json")}};async function desktopDeviceConnector(home,scope){const records=await DesktopDeviceRecords.open(home,scope),state=await records.current();if(!state.connectorId)fail("LOCAL_AUTHORIZATION_REQUIRED");return records.connectorPath(state.connectorId)}export{DesktopDeviceScopeSchema,DesktopDeviceRequestSchema,DesktopDeviceReplySchema,DesktopDeviceRecords,desktopDeviceConnector};
@@ -1 +1 @@
1
- import{secureEndpoint}from"./chunk-PUNG4ND7.js";import{privateAccess,privateDirectory,write}from"./chunk-GIEYSDCG.js";import{randomBytes}from"node:crypto";import{open,unlink,constants}from"node:fs/promises";import{dirname,resolve}from"node:path";var FileOAuthProvider=class _FileOAuthProvider{constructor(path,data){this.path=path;this.data=data}path;data;static async create(path,resource,redirect,scope){secureEndpoint(resource);secureEndpoint(redirect);if(!["nvs:read","nvs:read nvs:write"].includes(scope))throw Error();if(process.platform==="win32")await privateDirectory(dirname(resolve(path)));const data={version:1,resource,redirect,scope,state:randomBytes(24).toString("base64url")};await write(resolve(path),JSON.stringify(data),true);return new _FileOAuthProvider(path,data)}static async load(path){if(process.platform==="win32")await privateAccess(resolve(path),"file");const file=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW);let data;try{const stat=await file.stat();if(!stat.isFile()||stat.nlink!==1||process.platform!=="win32"&&(stat.uid!==process.getuid?.()||(stat.mode&63)!==0)||stat.size>65536)throw Error();const bytes=Buffer.alloc(65537);const{bytesRead}=await file.read(bytes,0,bytes.length,0);if(bytesRead>65536)throw Error();data=JSON.parse(bytes.subarray(0,bytesRead).toString("utf8"))}finally{await file.close()}if(![1,2].includes(data.version)||typeof data.state!=="string"||data.state.length<16)throw Error();if(data.pendingExchange!==void 0&&!["CODE","REFRESH"].includes(data.pendingExchange))throw Error();if(data.version===2!==(data.pendingExchange!==void 0))throw Error();secureEndpoint(data.resource);secureEndpoint(data.redirect);if(!["nvs:read","nvs:read nvs:write"].includes(data.scope))throw Error();return new _FileOAuthProvider(path,data)}async save(){if(process.platform==="win32")await privateDirectory(dirname(resolve(this.path)));await write(resolve(this.path),JSON.stringify(this.data))}get redirectUrl(){return this.data.redirect}get clientMetadata(){return{client_name:"NativeStudio CLI",redirect_uris:[this.data.redirect],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],scope:this.data.scope,application_type:"native"}}state(){return this.data.state}clientInformation(){return this.data.client}async saveClientInformation(value){this.data.client=value;await this.save()}tokens(){return this.data.token}async saveTokens(value){this.data.token=value;this.data.expiresAt=Date.now()+(value.expires_in??600)*1e3;this.data.version=1;delete this.data.pendingExchange;await this.save()}async redirectToAuthorization(url){this.data.authorizationUrl=url.href;await this.save()}async saveCodeVerifier(value){this.data.verifier=value;await this.save()}codeVerifier(){if(!this.data.verifier)throw Error();return this.data.verifier}async saveDiscoveryState(value){this.data.discovery=value;await this.save()}discoveryState(){return this.data.discovery}};async function withProfileLock(path,action){if(process.platform==="win32")await privateDirectory(dirname(resolve(path)));const file=await open(path+".lock","wx",384);try{return await action()}finally{await file.close();await unlink(path+".lock")}}export{FileOAuthProvider,withProfileLock};
1
+ import{privateAccess,privateDirectory,write}from"./chunk-KB2GVAN7.js";import{secureEndpoint}from"./chunk-PUNG4ND7.js";import{randomBytes}from"node:crypto";import{open,unlink,constants}from"node:fs/promises";import{dirname,resolve}from"node:path";var FileOAuthProvider=class _FileOAuthProvider{constructor(path,data){this.path=path;this.data=data}path;data;static async create(path,resource,redirect,scope){secureEndpoint(resource);secureEndpoint(redirect);if(!["nvs:read","nvs:read nvs:write"].includes(scope))throw Error();if(process.platform==="win32")await privateDirectory(dirname(resolve(path)));const data={version:1,resource,redirect,scope,state:randomBytes(24).toString("base64url")};await write(resolve(path),JSON.stringify(data),true);return new _FileOAuthProvider(path,data)}static async load(path){if(process.platform==="win32")await privateAccess(resolve(path),"file");const file=await open(path,constants.O_RDONLY|constants.O_NOFOLLOW);let data;try{const stat=await file.stat();if(!stat.isFile()||stat.nlink!==1||process.platform!=="win32"&&(stat.uid!==process.getuid?.()||(stat.mode&63)!==0)||stat.size>65536)throw Error();const bytes=Buffer.alloc(65537);const{bytesRead}=await file.read(bytes,0,bytes.length,0);if(bytesRead>65536)throw Error();data=JSON.parse(bytes.subarray(0,bytesRead).toString("utf8"))}finally{await file.close()}if(![1,2].includes(data.version)||typeof data.state!=="string"||data.state.length<16)throw Error();if(data.pendingExchange!==void 0&&!["CODE","REFRESH"].includes(data.pendingExchange))throw Error();if(data.version===2!==(data.pendingExchange!==void 0))throw Error();secureEndpoint(data.resource);secureEndpoint(data.redirect);if(!["nvs:read","nvs:read nvs:write"].includes(data.scope))throw Error();return new _FileOAuthProvider(path,data)}async save(){if(process.platform==="win32")await privateDirectory(dirname(resolve(this.path)));await write(resolve(this.path),JSON.stringify(this.data))}get redirectUrl(){return this.data.redirect}get clientMetadata(){return{client_name:"NativeStudio CLI",redirect_uris:[this.data.redirect],token_endpoint_auth_method:"none",grant_types:["authorization_code","refresh_token"],response_types:["code"],scope:this.data.scope,application_type:"native"}}state(){return this.data.state}clientInformation(){return this.data.client}async saveClientInformation(value){this.data.client=value;await this.save()}tokens(){return this.data.token}async saveTokens(value){this.data.token=value;this.data.expiresAt=Date.now()+(value.expires_in??600)*1e3;this.data.version=1;delete this.data.pendingExchange;await this.save()}async redirectToAuthorization(url){this.data.authorizationUrl=url.href;await this.save()}async saveCodeVerifier(value){this.data.verifier=value;await this.save()}codeVerifier(){if(!this.data.verifier)throw Error();return this.data.verifier}async saveDiscoveryState(value){this.data.discovery=value;await this.save()}discoveryState(){return this.data.discovery}};async function withProfileLock(path,action){if(process.platform==="win32")await privateDirectory(dirname(resolve(path)));const file=await open(path+".lock","wx",384);try{return await action()}finally{await file.close();await unlink(path+".lock")}}export{FileOAuthProvider,withProfileLock};