openmates 0.11.0-alpha.5 → 0.11.0-alpha.6

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.
@@ -4858,10 +4858,22 @@ function getUploadUrl(apiUrl) {
4858
4858
  }
4859
4859
  return "https://upload.openmates.org";
4860
4860
  }
4861
+ function getUploadOrigin(apiUrl) {
4862
+ try {
4863
+ const url = new URL(apiUrl);
4864
+ if (url.hostname === "localhost") return "http://localhost:5173";
4865
+ if (url.hostname.startsWith("api.")) {
4866
+ return `${url.protocol}//app.${url.hostname.slice(4)}`;
4867
+ }
4868
+ } catch {
4869
+ }
4870
+ return "https://app.openmates.org";
4871
+ }
4861
4872
  async function uploadFile(filePath, session) {
4862
4873
  const filename = basename2(filePath);
4863
4874
  const fileBytes = readFileSync4(filePath);
4864
4875
  const uploadUrl = `${getUploadUrl(session.apiUrl)}/v1/upload/file`;
4876
+ const origin = getUploadOrigin(session.apiUrl);
4865
4877
  const cookies = [];
4866
4878
  if (session.cookies?.auth_refresh_token) {
4867
4879
  cookies.push(`auth_refresh_token=${session.cookies.auth_refresh_token}`);
@@ -4877,6 +4889,7 @@ async function uploadFile(filePath, session) {
4877
4889
  method: "POST",
4878
4890
  body: formData,
4879
4891
  headers: {
4892
+ Origin: origin,
4880
4893
  ...cookies.length > 0 ? { Cookie: cookies.join("; ") } : {}
4881
4894
  },
4882
4895
  signal: AbortSignal.timeout(10 * 60 * 1e3)
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  getExtForLang,
4
4
  serializeToYaml
5
- } from "./chunk-OS5XPQOD.js";
5
+ } from "./chunk-NU4XR6MF.js";
6
6
  export {
7
7
  getExtForLang,
8
8
  serializeToYaml
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  getExtForLang,
7
7
  parseNewChatSuggestionText,
8
8
  serializeToYaml
9
- } from "./chunk-OS5XPQOD.js";
9
+ } from "./chunk-NU4XR6MF.js";
10
10
  export {
11
11
  MATE_NAMES,
12
12
  MEMORY_TYPE_REGISTRY,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openmates",
3
- "version": "0.11.0-alpha.5",
3
+ "version": "0.11.0-alpha.6",
4
4
  "description": "OpenMates CLI and SDK",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",