@ateam-ai-mobile/core 0.1.29 → 0.1.30
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/chat/store.ts +2 -1
- package/src/index.ts +1 -0
- 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
|
}
|
|
@@ -2206,6 +2224,7 @@ export {
|
|
|
2206
2224
|
disconnectAcsWs,
|
|
2207
2225
|
exchangeHandoff,
|
|
2208
2226
|
fetchConsumerConfig,
|
|
2227
|
+
focusPlugin,
|
|
2209
2228
|
fontSize,
|
|
2210
2229
|
getConfig,
|
|
2211
2230
|
getConsumerAuthApiUrl,
|
|
@@ -2249,6 +2268,7 @@ export {
|
|
|
2249
2268
|
recentDispatches as recentNotifDispatches,
|
|
2250
2269
|
recordEvent,
|
|
2251
2270
|
refreshToken,
|
|
2271
|
+
registerHostIntent,
|
|
2252
2272
|
registerDevice as registerPushDevice,
|
|
2253
2273
|
resolveAdasPhase,
|
|
2254
2274
|
setAcsCacheStorage,
|