@ateam-ai-mobile/core 0.1.29 → 0.1.31
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 +45 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +42 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/api/tenants.ts +37 -0
- package/src/chat/store.ts +2 -1
- package/src/index.ts +3 -2
- package/src/utils/hostIntents.ts +27 -0
package/dist/index.mjs
CHANGED
|
@@ -1329,6 +1329,24 @@ var PluginCommandEmitter = class {
|
|
|
1329
1329
|
};
|
|
1330
1330
|
var pluginCommandEmitter = new PluginCommandEmitter();
|
|
1331
1331
|
|
|
1332
|
+
// src/utils/hostIntents.ts
|
|
1333
|
+
var intents = /* @__PURE__ */ new Map();
|
|
1334
|
+
function registerHostIntent(pluginId, fn) {
|
|
1335
|
+
intents.set(pluginId, fn);
|
|
1336
|
+
}
|
|
1337
|
+
function focusPlugin(pluginId, props) {
|
|
1338
|
+
const intent = intents.get(pluginId);
|
|
1339
|
+
if (intent) {
|
|
1340
|
+
try {
|
|
1341
|
+
intent(props && typeof props === "object" ? props : {});
|
|
1342
|
+
} catch (e) {
|
|
1343
|
+
console.warn(`[hostIntent] ${pluginId} failed:`, e?.message || e);
|
|
1344
|
+
}
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
pluginCommandEmitter.emit("focus-plugin", { pluginId, props });
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1332
1350
|
// src/chat/store.ts
|
|
1333
1351
|
function coreHeaders() {
|
|
1334
1352
|
const token = getToken();
|
|
@@ -1832,7 +1850,7 @@ function dispatchPluginCommands(cmds) {
|
|
|
1832
1850
|
const pluginId = cmd?.pluginId || cmd?.plugin_id || cmd?.args?.plugin_id;
|
|
1833
1851
|
if (pluginId) {
|
|
1834
1852
|
const props = cmd?.props ?? cmd?.args?.props ?? void 0;
|
|
1835
|
-
|
|
1853
|
+
focusPlugin(pluginId, props);
|
|
1836
1854
|
}
|
|
1837
1855
|
}
|
|
1838
1856
|
}
|
|
@@ -2036,6 +2054,24 @@ async function pollJob(jobId, token) {
|
|
|
2036
2054
|
}
|
|
2037
2055
|
|
|
2038
2056
|
// src/api/tenants.ts
|
|
2057
|
+
function nestByMaster(tenants) {
|
|
2058
|
+
const ids = new Set(tenants.map((t) => t.id));
|
|
2059
|
+
const hasMaster = (t) => !!t.master && t.master !== t.id && ids.has(t.master);
|
|
2060
|
+
const kids = /* @__PURE__ */ new Map();
|
|
2061
|
+
for (const t of tenants) if (hasMaster(t)) kids.set(t.master, [...kids.get(t.master) || [], t]);
|
|
2062
|
+
const rows = [];
|
|
2063
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2064
|
+
const add = (t, depth, last) => {
|
|
2065
|
+
if (seen.has(t.id)) return;
|
|
2066
|
+
seen.add(t.id);
|
|
2067
|
+
const k = kids.get(t.id) || [];
|
|
2068
|
+
rows.push({ tenant: t, depth, last, memberCount: k.length });
|
|
2069
|
+
k.forEach((m, i) => add(m, 1, i === k.length - 1));
|
|
2070
|
+
};
|
|
2071
|
+
for (const t of tenants) if (!hasMaster(t)) add(t, 0, false);
|
|
2072
|
+
for (const t of tenants) add(t, 0, false);
|
|
2073
|
+
return rows;
|
|
2074
|
+
}
|
|
2039
2075
|
async function listMyTenants() {
|
|
2040
2076
|
const token = getToken();
|
|
2041
2077
|
if (!token) return [];
|
|
@@ -2050,7 +2086,8 @@ async function listMyTenants() {
|
|
|
2050
2086
|
// Fall back to the id rather than to an empty string: a nameless row in
|
|
2051
2087
|
// a team switcher is unpickable.
|
|
2052
2088
|
name: t.name || t.id,
|
|
2053
|
-
role: t.role ?? null
|
|
2089
|
+
role: t.role ?? null,
|
|
2090
|
+
...typeof t.master === "string" && t.master ? { master: t.master } : {}
|
|
2054
2091
|
}));
|
|
2055
2092
|
} catch {
|
|
2056
2093
|
return [];
|
|
@@ -2206,6 +2243,7 @@ export {
|
|
|
2206
2243
|
disconnectAcsWs,
|
|
2207
2244
|
exchangeHandoff,
|
|
2208
2245
|
fetchConsumerConfig,
|
|
2246
|
+
focusPlugin,
|
|
2209
2247
|
fontSize,
|
|
2210
2248
|
getConfig,
|
|
2211
2249
|
getConsumerAuthApiUrl,
|
|
@@ -2232,6 +2270,7 @@ export {
|
|
|
2232
2270
|
listSurface,
|
|
2233
2271
|
mcpFetch,
|
|
2234
2272
|
mcpToolCall,
|
|
2273
|
+
nestByMaster,
|
|
2235
2274
|
notifyAcsWsForeground,
|
|
2236
2275
|
notifyAppForeground,
|
|
2237
2276
|
onAppForeground,
|
|
@@ -2249,6 +2288,7 @@ export {
|
|
|
2249
2288
|
recentDispatches as recentNotifDispatches,
|
|
2250
2289
|
recordEvent,
|
|
2251
2290
|
refreshToken,
|
|
2291
|
+
registerHostIntent,
|
|
2252
2292
|
registerDevice as registerPushDevice,
|
|
2253
2293
|
resolveAdasPhase,
|
|
2254
2294
|
setAcsCacheStorage,
|