@ateam-ai-mobile/core 0.1.5 → 0.1.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.
- package/dist/index.d.mts +22 -1
- package/dist/index.d.ts +22 -1
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/chat/store.ts +9 -0
- package/src/index.ts +2 -0
- package/src/session.ts +62 -0
package/dist/index.mjs
CHANGED
|
@@ -170,6 +170,42 @@ function unwrapMcpResult(result) {
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
// src/session.ts
|
|
174
|
+
function hostOf(u) {
|
|
175
|
+
if (!u) return "";
|
|
176
|
+
try {
|
|
177
|
+
return new URL(u).host;
|
|
178
|
+
} catch {
|
|
179
|
+
return u;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function isDevHost(u) {
|
|
183
|
+
const h = hostOf(u);
|
|
184
|
+
return !!h && (h.includes("dev-") || /(^|\.)dev\./.test(h));
|
|
185
|
+
}
|
|
186
|
+
function getSession() {
|
|
187
|
+
let consumerUrl = "";
|
|
188
|
+
try {
|
|
189
|
+
consumerUrl = getConsumerAuthApiUrl();
|
|
190
|
+
} catch {
|
|
191
|
+
}
|
|
192
|
+
let coreUrl = "";
|
|
193
|
+
try {
|
|
194
|
+
coreUrl = getCoreApiUrl();
|
|
195
|
+
} catch {
|
|
196
|
+
}
|
|
197
|
+
const tenant = getTenant() || null;
|
|
198
|
+
const user = getUser();
|
|
199
|
+
return {
|
|
200
|
+
tenant,
|
|
201
|
+
tenantName: tenant || "\u2014",
|
|
202
|
+
env: isDevHost(consumerUrl) || isDevHost(coreUrl) ? "dev" : "prod",
|
|
203
|
+
host: hostOf(consumerUrl || coreUrl),
|
|
204
|
+
actorId: user?.actorId ?? null,
|
|
205
|
+
email: user?.email ?? null
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
173
209
|
// src/chat/store.ts
|
|
174
210
|
import { create } from "zustand";
|
|
175
211
|
|
|
@@ -320,7 +356,11 @@ function renderTableShape(content) {
|
|
|
320
356
|
}
|
|
321
357
|
function blocksToText(blocks) {
|
|
322
358
|
if (!blocks || blocks.length === 0) return "";
|
|
359
|
+
const hasTextBlock = blocks.some(
|
|
360
|
+
(b) => b.kind === "text" || b.kind === "markdown" || b.kind === "description"
|
|
361
|
+
);
|
|
323
362
|
return blocks.map((b) => {
|
|
363
|
+
if ((b.kind === "json" || b.kind === "code") && hasTextBlock) return "";
|
|
324
364
|
if (b.kind === "text" || b.kind === "markdown" || b.kind === "description") {
|
|
325
365
|
return typeof b.content === "string" ? b.content : "";
|
|
326
366
|
}
|
|
@@ -1660,12 +1700,14 @@ export {
|
|
|
1660
1700
|
getConsumerAuthApiUrl,
|
|
1661
1701
|
getCoreApiUrl,
|
|
1662
1702
|
getCoreWsUrl,
|
|
1703
|
+
getSession,
|
|
1663
1704
|
getTenant,
|
|
1664
1705
|
getToken,
|
|
1665
1706
|
getUser,
|
|
1666
1707
|
getVoiceApiUrl,
|
|
1667
1708
|
initAdas,
|
|
1668
1709
|
isAdasInitialized,
|
|
1710
|
+
isDevHost,
|
|
1669
1711
|
listHomeActions,
|
|
1670
1712
|
listMadeForYou,
|
|
1671
1713
|
listMyTenants,
|