@eaera-com/cms-sdk 0.1.98 → 0.1.99

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.
@@ -1,6 +1,6 @@
1
1
  import { createError } from 'h3';
2
2
  import { ofetch } from 'ofetch';
3
- import { e as QWENPAW_LIST_TIMEOUT_MS, d as QWENPAW_DEFAULT_AGENT_ID, f as QWENPAW_MAX_HISTORY_TURNS } from './qwenpaw.constant-DHSj9A-0.js';
3
+ import { e as QWENPAW_LIST_TIMEOUT_MS, d as QWENPAW_DEFAULT_AGENT_ID, f as QWENPAW_MAX_HISTORY_TURNS } from './qwenpaw.constant-BSzwf_Ut.js';
4
4
 
5
5
  const chatsHeaders = (extra = {}) => ({
6
6
  accept: "application/json",
@@ -1,4 +1,4 @@
1
- import { h as QWENPAW_CHANNEL, d as QWENPAW_DEFAULT_AGENT_ID, i as QWENPAW_CHAT_TIMEOUT_MS, j as QWENPAW_STOP_TIMEOUT_MS, k as QWENPAW_UPLOAD_TIMEOUT_MS } from './qwenpaw.constant-DHSj9A-0.js';
1
+ import { h as QWENPAW_CHANNEL, d as QWENPAW_DEFAULT_AGENT_ID, i as QWENPAW_CHAT_TIMEOUT_MS, j as QWENPAW_STOP_TIMEOUT_MS, k as QWENPAW_UPLOAD_TIMEOUT_MS } from './qwenpaw.constant-BSzwf_Ut.js';
2
2
  import { createError } from 'h3';
3
3
 
4
4
  const buildConsoleChatBody = (target, text, files = []) => ({
@@ -2,7 +2,7 @@ import { getCookie, createError, setCookie } from 'h3';
2
2
  import { ofetch } from 'ofetch';
3
3
  import { useRuntimeConfig } from '#imports';
4
4
  import { T as TOKEN_STORAGE_KEY } from './storage.constant-CVWam5ls.js';
5
- import { d as QWENPAW_DEFAULT_AGENT_ID, l as QWENPAW_RUNTIME_CONFIG_KEY, m as QWENPAW_EXCHANGE_ACTION_PATH, n as QWENPAW_EXCHANGE_TIMEOUT_MS, o as QWENPAW_CONFIGURATION_ERROR_CODES, p as QWENPAW_COOKIE_BASE_URL, q as QWENPAW_COOKIE_MAX_AGE } from './qwenpaw.constant-DHSj9A-0.js';
5
+ import { d as QWENPAW_DEFAULT_AGENT_ID, l as QWENPAW_RUNTIME_CONFIG_KEY, m as QWENPAW_COOKIE_BASE_URL, n as QWENPAW_EXCHANGE_ACTION_PATH, o as QWENPAW_EXCHANGE_TIMEOUT_MS, p as QWENPAW_CONFIGURATION_ERROR_CODES, q as QWENPAW_COOKIE_MAX_AGE } from './qwenpaw.constant-BSzwf_Ut.js';
6
6
 
7
7
  class QwenpawExchangeError extends Error {
8
8
  constructor(code, configurationError, message) {
@@ -27,6 +27,11 @@ const setQwenpawSessionCookies = (event, connection) => {
27
27
  path: "/",
28
28
  maxAge: QWENPAW_COOKIE_MAX_AGE
29
29
  };
30
+ console.log("[qwenpaw] exchange saved connection →", {
31
+ agentId: connection.agentId,
32
+ agentIdIsConstant: connection.agentId === QWENPAW_DEFAULT_AGENT_ID,
33
+ baseUrl: connection.baseUrl
34
+ });
30
35
  setCookie(event, QWENPAW_COOKIE_BASE_URL, connection.baseUrl, common);
31
36
  };
32
37
  const readCookieValue = (event, name) => {
@@ -35,10 +40,16 @@ const readCookieValue = (event, name) => {
35
40
  };
36
41
  const resolveQwenpawConnection = (event, overrides = {}) => {
37
42
  const config = resolveQwenpawServerConfig(event);
38
- return {
43
+ const resolved = {
39
44
  baseUrl: overrides.baseUrl || readCookieValue(event, QWENPAW_COOKIE_BASE_URL) || config.baseUrl,
40
45
  agentId: QWENPAW_DEFAULT_AGENT_ID
41
46
  };
47
+ console.log("[qwenpaw] resolveQwenpawConnection →", {
48
+ agentId: resolved.agentId,
49
+ source: overrides.baseUrl ? "override" : readCookieValue(event, QWENPAW_COOKIE_BASE_URL) ? "cookie" : "runtimeConfig",
50
+ baseUrl: resolved.baseUrl
51
+ });
52
+ return resolved;
42
53
  };
43
54
  const hasQwenpawConnection = (event) => Boolean(resolveQwenpawConnection(event).baseUrl);
44
55
  const cmsBackendUrl = (event) => {
@@ -20,4 +20,4 @@ const QWENPAW_CONFIGURATION_ERROR_CODES = /* @__PURE__ */ new Set([
20
20
  "AI_CREDENTIAL_NOT_CONFIGURED"
21
21
  ]);
22
22
 
23
- export { QWENPAW_MAX_MESSAGE_LENGTH as Q, QWENPAW_MAX_FILES as a, QWENPAW_MAX_FILE_NAME_LENGTH as b, QWENPAW_MAX_SESSION_ID_LENGTH as c, QWENPAW_DEFAULT_AGENT_ID as d, QWENPAW_LIST_TIMEOUT_MS as e, QWENPAW_MAX_HISTORY_TURNS as f, QWENPAW_MAX_UPLOAD_BYTES as g, QWENPAW_CHANNEL as h, QWENPAW_CHAT_TIMEOUT_MS as i, QWENPAW_STOP_TIMEOUT_MS as j, QWENPAW_UPLOAD_TIMEOUT_MS as k, QWENPAW_RUNTIME_CONFIG_KEY as l, QWENPAW_EXCHANGE_ACTION_PATH as m, QWENPAW_EXCHANGE_TIMEOUT_MS as n, QWENPAW_CONFIGURATION_ERROR_CODES as o, QWENPAW_COOKIE_BASE_URL as p, QWENPAW_COOKIE_MAX_AGE as q };
23
+ export { QWENPAW_MAX_MESSAGE_LENGTH as Q, QWENPAW_MAX_FILES as a, QWENPAW_MAX_FILE_NAME_LENGTH as b, QWENPAW_MAX_SESSION_ID_LENGTH as c, QWENPAW_DEFAULT_AGENT_ID as d, QWENPAW_LIST_TIMEOUT_MS as e, QWENPAW_MAX_HISTORY_TURNS as f, QWENPAW_MAX_UPLOAD_BYTES as g, QWENPAW_CHANNEL as h, QWENPAW_CHAT_TIMEOUT_MS as i, QWENPAW_STOP_TIMEOUT_MS as j, QWENPAW_UPLOAD_TIMEOUT_MS as k, QWENPAW_RUNTIME_CONFIG_KEY as l, QWENPAW_COOKIE_BASE_URL as m, QWENPAW_EXCHANGE_ACTION_PATH as n, QWENPAW_EXCHANGE_TIMEOUT_MS as o, QWENPAW_CONFIGURATION_ERROR_CODES as p, QWENPAW_COOKIE_MAX_AGE as q };
package/dist/index.js CHANGED
@@ -9,8 +9,8 @@ import { ref, shallowRef, watch, computed, toRaw } from 'vue';
9
9
  import { W as WS_RECONNECT_INITIAL_MS, a as WS_RECONNECT_MAX_MS, b as WS_CONNECTION_STATE, c as WS_PING_INTERVAL_MS, d as WS_MESSAGE_TYPE, e as WS_CLOSE_CODE, f as WS_MAX_RECONNECT_ATTEMPTS, g as WS_AUTH_TIMEOUT_MS, h as WS_RECONNECT_JITTER_MS, i as WS_PING_WATCHDOG_CHECK_MS, j as WS_MAX_SUBSCRIPTIONS, k as WS_PING_WATCHDOG_FACTOR } from './chunks/mt5Retcode-DK9C-4Dv.js';
10
10
  export { M as MT5_RETCODE, l as WS_ACTION_ACCEPTED_ERROR_CODE, m as WS_ACTION_ERROR_CODE, n as WS_ACTION_RESULT_ERROR_CODE, o as WS_ACTION_RESULT_TTL_MS, p as WS_AUTH_ERROR_CODE, q as WS_CLOSE_REASON, r as WS_MT5_EVENT_TYPE, s as WS_TOPIC, t as WS_TOPIC_NAMESPACE, u as accountTopic, v as adminTopic, w as mt5Topic, x as streamTopic, y as symbolTopic, z as userTopic, A as viewMt5Retcode } from './chunks/mt5Retcode-DK9C-4Dv.js';
11
11
  import { defineStore, storeToRefs } from 'pinia';
12
- export { Q as QwenpawConfigError, a as QwenpawUpstreamError, b as buildConsoleChatBody, p as postConsoleChatError } from './chunks/client-Ac6qgpZ8.js';
13
- export { d as deleteQwenpawChat, e as extractChatModel, f as fetchChatHistory, g as getQwenpawChatMessages, l as listQwenpawChats, a as listQwenpawGroups, m as messagesToTurns } from './chunks/chats-BjSS83OW.js';
12
+ export { Q as QwenpawConfigError, a as QwenpawUpstreamError, b as buildConsoleChatBody, p as postConsoleChatError } from './chunks/client-DxMxkttF.js';
13
+ export { d as deleteQwenpawChat, e as extractChatModel, f as fetchChatHistory, g as getQwenpawChatMessages, l as listQwenpawChats, a as listQwenpawGroups, m as messagesToTurns } from './chunks/chats-D9FmKJNH.js';
14
14
  export { categoryLabel, computeSpread, formatPrice } from './common/helpers/format.js';
15
15
 
16
16
  const MT5_SERVER_NAME = "EAERA MT5 - Live";
@@ -1,7 +1,7 @@
1
1
  import { defineEventHandler, readBody, createError } from 'h3';
2
- import { c as qwenpawStop, p as postConsoleChatError } from '../../../../chunks/client-Ac6qgpZ8.js';
3
- import { c as QWENPAW_MAX_SESSION_ID_LENGTH } from '../../../../chunks/qwenpaw.constant-DHSj9A-0.js';
4
- import { r as requireCmsSession, a as resolveQwenpawConnection, b as resolveQwenpawServerConfig } from '../../../../chunks/connection-DhqBa4cO.js';
2
+ import { c as qwenpawStop, p as postConsoleChatError } from '../../../../chunks/client-DxMxkttF.js';
3
+ import { c as QWENPAW_MAX_SESSION_ID_LENGTH } from '../../../../chunks/qwenpaw.constant-BSzwf_Ut.js';
4
+ import { r as requireCmsSession, a as resolveQwenpawConnection, b as resolveQwenpawServerConfig } from '../../../../chunks/connection-DW52jKW-.js';
5
5
 
6
6
  const stop_post = defineEventHandler(async (event) => {
7
7
  requireCmsSession(event);
@@ -1,8 +1,8 @@
1
1
  import { Readable } from 'node:stream';
2
2
  import { defineEventHandler, readBody, createError, setResponseStatus, setResponseHeader, sendStream } from 'h3';
3
- import { q as qwenpawChat, p as postConsoleChatError } from '../../../chunks/client-Ac6qgpZ8.js';
4
- import { Q as QWENPAW_MAX_MESSAGE_LENGTH, a as QWENPAW_MAX_FILES, b as QWENPAW_MAX_FILE_NAME_LENGTH, c as QWENPAW_MAX_SESSION_ID_LENGTH } from '../../../chunks/qwenpaw.constant-DHSj9A-0.js';
5
- import { r as requireCmsSession, a as resolveQwenpawConnection, b as resolveQwenpawServerConfig } from '../../../chunks/connection-DhqBa4cO.js';
3
+ import { q as qwenpawChat, p as postConsoleChatError } from '../../../chunks/client-DxMxkttF.js';
4
+ import { Q as QWENPAW_MAX_MESSAGE_LENGTH, a as QWENPAW_MAX_FILES, b as QWENPAW_MAX_FILE_NAME_LENGTH, c as QWENPAW_MAX_SESSION_ID_LENGTH } from '../../../chunks/qwenpaw.constant-BSzwf_Ut.js';
5
+ import { r as requireCmsSession, a as resolveQwenpawConnection, b as resolveQwenpawServerConfig } from '../../../chunks/connection-DW52jKW-.js';
6
6
 
7
7
  const chat_post = defineEventHandler(async (event) => {
8
8
  requireCmsSession(event);
@@ -1,6 +1,6 @@
1
1
  import { defineEventHandler, getRouterParam, createError } from 'h3';
2
- import { d as deleteQwenpawChat } from '../../../chunks/chats-BjSS83OW.js';
3
- import { r as requireCmsSession, a as resolveQwenpawConnection } from '../../../chunks/connection-DhqBa4cO.js';
2
+ import { d as deleteQwenpawChat } from '../../../chunks/chats-D9FmKJNH.js';
3
+ import { r as requireCmsSession, a as resolveQwenpawConnection } from '../../../chunks/connection-DW52jKW-.js';
4
4
 
5
5
  const chatsId_delete = defineEventHandler(async (event) => {
6
6
  requireCmsSession(event);
@@ -1,7 +1,7 @@
1
1
  import { defineEventHandler } from 'h3';
2
- import { l as listQwenpawChats, a as listQwenpawGroups } from '../../../chunks/chats-BjSS83OW.js';
3
- import { d as QWENPAW_DEFAULT_AGENT_ID } from '../../../chunks/qwenpaw.constant-DHSj9A-0.js';
4
- import { r as requireCmsSession, a as resolveQwenpawConnection } from '../../../chunks/connection-DhqBa4cO.js';
2
+ import { l as listQwenpawChats, a as listQwenpawGroups } from '../../../chunks/chats-D9FmKJNH.js';
3
+ import { d as QWENPAW_DEFAULT_AGENT_ID } from '../../../chunks/qwenpaw.constant-BSzwf_Ut.js';
4
+ import { r as requireCmsSession, a as resolveQwenpawConnection } from '../../../chunks/connection-DW52jKW-.js';
5
5
 
6
6
  const chats_get = defineEventHandler(async (event) => {
7
7
  requireCmsSession(event);
@@ -1,6 +1,6 @@
1
1
  import { defineEventHandler, getQuery, createError } from 'h3';
2
- import { f as fetchChatHistory } from '../../../chunks/chats-BjSS83OW.js';
3
- import { r as requireCmsSession, a as resolveQwenpawConnection } from '../../../chunks/connection-DhqBa4cO.js';
2
+ import { f as fetchChatHistory } from '../../../chunks/chats-D9FmKJNH.js';
3
+ import { r as requireCmsSession, a as resolveQwenpawConnection } from '../../../chunks/connection-DW52jKW-.js';
4
4
 
5
5
  const history_get = defineEventHandler(async (event) => {
6
6
  requireCmsSession(event);
@@ -1,5 +1,5 @@
1
1
  import { defineEventHandler } from 'h3';
2
- import { r as requireCmsSession, a as resolveQwenpawConnection, h as hasQwenpawConnection } from '../../../chunks/connection-DhqBa4cO.js';
2
+ import { r as requireCmsSession, a as resolveQwenpawConnection, h as hasQwenpawConnection } from '../../../chunks/connection-DW52jKW-.js';
3
3
 
4
4
  const session_get = defineEventHandler((event) => {
5
5
  requireCmsSession(event);
@@ -1,5 +1,5 @@
1
1
  import { defineEventHandler, createError } from 'h3';
2
- import { r as requireCmsSession, e as exchangeQwenpawSession, Q as QwenpawExchangeError } from '../../../chunks/connection-DhqBa4cO.js';
2
+ import { r as requireCmsSession, e as exchangeQwenpawSession, Q as QwenpawExchangeError } from '../../../chunks/connection-DW52jKW-.js';
3
3
 
4
4
  const exchangeErrorStatus = (error) => {
5
5
  if (error.code === "AI_NOT_AUTHENTICATED") return 401;
@@ -1,7 +1,7 @@
1
1
  import { defineEventHandler, readMultipartFormData, createError } from 'h3';
2
- import { d as qwenpawUpload, p as postConsoleChatError } from '../../../chunks/client-Ac6qgpZ8.js';
3
- import { g as QWENPAW_MAX_UPLOAD_BYTES } from '../../../chunks/qwenpaw.constant-DHSj9A-0.js';
4
- import { r as requireCmsSession, a as resolveQwenpawConnection, b as resolveQwenpawServerConfig } from '../../../chunks/connection-DhqBa4cO.js';
2
+ import { d as qwenpawUpload, p as postConsoleChatError } from '../../../chunks/client-DxMxkttF.js';
3
+ import { g as QWENPAW_MAX_UPLOAD_BYTES } from '../../../chunks/qwenpaw.constant-BSzwf_Ut.js';
4
+ import { r as requireCmsSession, a as resolveQwenpawConnection, b as resolveQwenpawServerConfig } from '../../../chunks/connection-DW52jKW-.js';
5
5
 
6
6
  const upload_post = defineEventHandler(async (event) => {
7
7
  requireCmsSession(event);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eaera-com/cms-sdk",
3
- "version": "0.1.98",
3
+ "version": "0.1.99",
4
4
  "description": "EAERA CMS SDK — data access layer for Nuxt 3 apps (ofetch + Pinia + typed services)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",