This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,198 @@
// Metro module 5685 (f5686).
import FramesStore from "../../frames/FramesStore";
import VibegrationsProjectStore from "../stores/VibegrationsProjectStore";
import { Endpoints } from "../../../Constants";
import FramesActionCreators_native from "../../frames/FramesActionCreators.native";
import Dispatcher from "../../../Dispatcher";
import { HTTP } from "../../../_bundle/sendRequest";
const reloadActivityIfRunning = function reloadActivityIfRunning(a0) {
if (a0 != null && FramesStore.getConnectedFrame()?.applicationId === a0) {
FramesActionCreators_native.refreshProxyTicket({
applicationId: a0
});
}
};
export async function listProjects() {
let c25537_2 = 0;
let c29552_0;
L15: {
try {
c29552_0 = void 0;
if (VibegrationsProjectStore.getProjectsFetchState()?.type !== "loading") {
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECTS_FETCH_START"
});
c25537_2 = 1;
c29552_0 = (await HTTP.get({
url: Endpoints.VIBEGRATIONS_PROJECTS,
rejectWithError: true
})).body;
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECTS_FETCH_SUCCESS",
projects: c29552_0
});
c25537_2 = 0;
break L15;
}
} catch ($e) {
let r24 = $e;
if (c25537_2 !== 0) {
while (true) {
try {
c25537_2 = 0;
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECTS_FETCH_FAIL"
});
break L15;
} catch ($e) {
r24 = $e;
if (c25537_2 === 0) {
break;
}
}
}
}
throw r24;
}
return void 0;
}
}
export async function createProject(body) {
let c25538_2;
c25538_2 = void 0;
let c29553_0 = (await HTTP.post({
url: Endpoints.VIBEGRATIONS_PROJECTS,
body,
rejectWithError: false
})).body;
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECT_CREATE_SUCCESS",
project: c29553_0
});
return c29553_0.id;
}
export async function renameProject(c25539_0, name) {
let c25539_3;
c25539_3 = void 0;
let c29554_0 = await HTTP.patch({
url: Endpoints.VIBEGRATIONS_PROJECT(c25539_0),
body: {
name
},
rejectWithError: false
});
if (c29554_0.ok) {
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECT_UPDATE_SUCCESS",
project: c29554_0.body
});
}
return c29554_0;
}
export async function setGuildHints(c25540_0, body2) {
let c25540_3;
c25540_3 = void 0;
let c29555_0 = await HTTP.patch({
url: Endpoints.VIBEGRATIONS_PROJECT(c25540_0),
body: body2,
rejectWithError: false
});
if (c29555_0.ok) {
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECT_UPDATE_SUCCESS",
project: c29555_0.body
});
}
return c29555_0;
}
export async function deleteProject(c25541_0) {
let c25541_2;
c25541_2 = void 0;
let c29556_0 = c25541_0;
let c29556_1 = await HTTP.del({
url: Endpoints.VIBEGRATIONS_PROJECT(c25541_0),
rejectWithError: false
});
if (c29556_1.ok) {
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECT_DELETE_SUCCESS",
projectId: c29556_0
});
}
return c29556_1;
}
export function setSelectedProjectForGuild(a0, a1) {
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECT_SELECT",
guildId: a0,
projectId: a1
});
}
export async function publishProject(c25542_0) {
let c25542_2;
let c29557_1, c29557_2, c29557_3;
c25542_2 = void 0;
c29557_1 = void 0;
c29557_2 = void 0;
c29557_3 = void 0;
let c29557_0 = await HTTP.post({
url: Endpoints.VIBEGRATIONS_PROJECT_PUBLISH(c25542_0),
rejectWithError: false
});
if (c29557_0.ok) {
c29557_1 = c29557_0.body;
c29557_2 = c29557_1.application;
c29557_3 = c29557_1.project;
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECT_UPDATE_SUCCESS",
project: c29557_3
});
Dispatcher.dispatch({
type: "APPLICATION_FETCH_SUCCESS",
application: c29557_2,
isHydrated: true
});
(0, reloadActivityIfRunning)(c29557_2.id);
}
return c29557_0;
}
export async function publishPreviewProject(c25543_0) {
let c25543_2;
let c29558_1, c29558_2, c29558_3;
c25543_2 = void 0;
c29558_1 = void 0;
c29558_2 = void 0;
c29558_3 = void 0;
let c29558_0 = await HTTP.post({
url: Endpoints.VIBEGRATIONS_PROJECT_PUBLISH_PREVIEW(c25543_0),
rejectWithError: false
});
if (c29558_0.ok) {
c29558_1 = c29558_0.body;
c29558_2 = c29558_1.application;
c29558_3 = c29558_1.project;
Dispatcher.dispatch({
type: "VIBEGRATIONS_PROJECT_UPDATE_SUCCESS",
project: c29558_3
});
Dispatcher.dispatch({
type: "APPLICATION_FETCH_SUCCESS",
application: c29558_2,
isHydrated: true
});
(0, reloadActivityIfRunning)(c29558_2.id);
}
return c29558_0;
}
export function setChatSidebarWidth(a0) {
Dispatcher.dispatch({
type: "VIBEGRATIONS_CHAT_SIDEBAR_WIDTH_SET",
width: a0
});
}
export function setBuilderPreviewApplicationId(a0) {
Dispatcher.dispatch({
type: "VIBEGRATIONS_BUILDER_PREVIEW_APPLICATION_SET",
applicationId: a0
});
}
@@ -0,0 +1,35 @@
// Metro module 5684 (f5685).
import { EMPTY_STRING_SNOWFLAKE_ID } from "../../../Constants";
import { createApexExperiment } from "../../experiments/apex/index";
const apexExperiment = createApexExperiment({
name: "2026-07-vibegrations-guild",
kind: "guild",
defaultConfig: {
enabled: false
},
variations: {
0: {
enabled: false
},
1: {
enabled: true
}
}
});
export function useIsVibegrationsGuildEnabled(a0) {
let guildId = a0.guildId;
const location2 = a0.location;
if (guildId == null) {
guildId = EMPTY_STRING_SNOWFLAKE_ID;
}
return apexExperiment.useConfig({
guildId,
location: location2
}).enabled;
}
export function isVibegrationsGuildEnabled({ guildId, location: location2 }) {
return guildId != null && apexExperiment.getConfig({
guildId,
location: location2
}).enabled;
}
@@ -0,0 +1,12 @@
// Metro module 3259 (f3260).
import { loadJsonAsset } from "../../asset_json/native/AssetJsonUtils";
import * as _Module3260 from "../../../_bundle/Module3260";
import { createLoader, makeMessagesProxy } from "../../../_bundle/Module1274";
const loader = createLoader({
"en-US": () => loadJsonAsset(_Module3260).then((result) => ({
default: result
}))
}, "en-US");
const r21 = makeMessagesProxy(loader);
export default r21;
export { loader as messagesLoader };
@@ -0,0 +1,13 @@
// Metro module 12613 (f12614).
const r9 = {
openVibegrationsAppInstallModal: function openVibegrationsAppInstallModal() {
return Promise.resolve();
},
isWindowFocused: function isWindowFocused() {
return false;
},
createNotificationDeepLink: function createNotificationDeepLink(a0) {
return a0;
}
};
export default r9;
@@ -0,0 +1,151 @@
// Metro module 5682 (f5683).
import ApplicationStore from "../../applications/ApplicationStore";
import GuildStore from "../../../stores/GuildStore";
import PermissionStore from "../../../stores/PermissionStore";
import VibegrationsProjectStore from "../stores/VibegrationsProjectStore";
import { ChannelTypes, GuildFeatures, Permissions } from "../../../Constants";
import * as _VibegrationsGuildExperiment from "../experiments/VibegrationsGuildExperiment";
import { useIsVibegrationsGuildEnabled } from "../experiments/VibegrationsGuildExperiment";
import { useStateFromStores } from "../../../_bundle/Module589";
import { publishPreviewProject } from "../actions/VibegrationsActionCreators";
import VibegrationsPlatformUtils_native from "./VibegrationsPlatformUtils.native";
let c3518_11 = "vibegrations_application_id=";
let c3518_12 = /^\d{17,20}$/;
export function vibegrationsAppIdFromTopic(a0) {
if (a0 != null && a0.startsWith(c3518_11)) {
const r8 = a0.slice(28);
return c3518_12.test(r8) ? r8 : null;
}
return null;
}
export function vibegrationsTopicForApp(a0) {
return `${c3518_11}${a0}`;
}
export function canManageVibegrations(a0, a1) {
return _VibegrationsGuildExperiment.isVibegrationsGuildEnabled({
guildId: a0.id,
location: a1
}) && PermissionStore.can(Permissions.MANAGE_CHANNELS, a0) && PermissionStore.can(Permissions.MANAGE_GUILD, a0) && !a0.features.has(GuildFeatures.INTERNAL_EMPLOYEE_ONLY);
}
export function useCanManageVibegrations(a0, a1) {
const stateFromStores = useStateFromStores([PermissionStore], () => {
const MANAGE_CHANNELS = Permissions.MANAGE_CHANNELS;
return PermissionStore.can(MANAGE_CHANNELS, a0) && PermissionStore.can(Permissions.MANAGE_GUILD, a0);
}, [a0]);
let r20 = useIsVibegrationsGuildEnabled({
guildId: a0.id,
location: a1
});
const r25 = a0.features.has(GuildFeatures.INTERNAL_EMPLOYEE_ONLY);
if (r20) {
r20 = stateFromStores;
}
if (r20) {
r20 = !r25;
}
return r20;
}
export async function publishPreviewAndReauthorizeIfPermissionsChanged(c25536_0) {
let c25536_2;
let c29551_0, c29551_1, c29551_2, c29551_3, c29551_4, c29551_5, c29551_6, c29551_7;
L20: {
L19: {
c25536_2 = void 0;
c29551_0 = void 0;
c29551_1 = void 0;
c29551_2 = void 0;
c29551_3 = void 0;
c29551_4 = void 0;
c29551_5 = void 0;
c29551_6 = void 0;
c29551_7 = void 0;
c29551_0 = VibegrationsProjectStore.getProject(c25536_0)?.preview_guild_id;
c29551_1 = await publishPreviewProject(c25536_0);
if (!c29551_1.ok) {
break L20;
}
c29551_2 = c29551_1.body;
c29551_3 = c29551_2.application;
c29551_4 = c29551_2.bot_permissions_changed;
c29551_5 = c29551_2.integration_installed;
c29551_6 = c29551_2.project.preview_application_id;
if (c29551_0 == null) {
break L20;
}
if (c29551_6 == null) {
break L20;
}
if (c29551_5 && !c29551_4) {
break L20;
}
c29551_7 = ApplicationStore.getApplication(c29551_6);
if (c29551_7 != null) {
await VibegrationsPlatformUtils_native.openVibegrationsAppInstallModal({
applicationId: c29551_3.id,
application: c29551_7,
guildId: c29551_0
});
break L19;
}
break L20;
}
return void 0;
}
}
export function isVibegrationsChannelCandidate(a0, a1) {
const guild = GuildStore.getGuild(a0?.guild_id);
let r13 = a0 != null && a0.type === ChannelTypes.GUILD_TEXT;
if (r13) {
const topic = a0.topic;
const r16 = topic == null;
let r17 = null;
if (!r16) {
const r19 = topic.startsWith(c3518_11);
r17 = null;
if (r19) {
const r21 = topic.slice(28);
r17 = c3518_12.test(r21) ? r21 : null;
}
}
r13 = r17 != null;
}
if (r13) {
r13 = !(guild == null ? void 0 : guild.features.has(GuildFeatures.INTERNAL_EMPLOYEE_ONLY));
}
if (r13) {
r13 = _VibegrationsGuildExperiment.isVibegrationsGuildEnabled({
guildId: a0?.guild_id,
location: a1
});
}
return r13;
}
export function useIsVibegrationsChannelCandidate(a0, a1) {
const stateFromStores = useStateFromStores([GuildStore], () => GuildStore.getGuild(a0?.guild_id));
const isVibegrationsGuildEnabled = useIsVibegrationsGuildEnabled({
guildId: a0?.guild_id,
location: a1
});
let r23 = a0 != null && a0.type === ChannelTypes.GUILD_TEXT;
if (r23) {
const topic = a0.topic;
const r28 = topic == null;
let r29 = null;
if (!r28) {
const r32 = topic.startsWith(c3518_11);
r29 = null;
if (r32) {
const r34 = topic.slice(28);
r29 = c3518_12.test(r34) ? r34 : null;
}
}
r23 = r29 != null;
}
if (r23) {
r23 = !(stateFromStores == null ? void 0 : stateFromStores.features.has(GuildFeatures.INTERNAL_EMPLOYEE_ONLY));
}
if (r23) {
r23 = isVibegrationsGuildEnabled;
}
return r23;
}
@@ -0,0 +1,388 @@
// Metro module 15751 (f15752).
import FamilyCenterStore from "../../parent_tools/FamilyCenterStore";
import NotificationSettingsStore from "../../../stores/NotificationSettingsStore";
import SelectedChannelStore from "../../../stores/SelectedChannelStore";
import SelectedGuildStore from "../../../stores/SelectedGuildStore";
import SelfPresenceStore from "../../../stores/SelfPresenceStore";
import VibegrationsProjectStore from "./VibegrationsProjectStore";
import { DesktopNotificationTypes, Routes, StatusTypes } from "../../../Constants";
import { StaticChannelRoute } from "../../channel/ChannelConstants";
import { intl } from "../../../intl/index.native";
import VibegrationsUntranslated_messages from "../intl/VibegrationsUntranslated.messages";
import { FocusMode } from "../../user_settings/UserSettings";
import VibegrationsPlatformUtils_native from "../lib/VibegrationsPlatformUtils.native";
import { playSound } from "../../sound_playback/SoundUtils";
import NotificationActionCreators from "../../../actions/NotificationActionCreators";
import * as _Module15752 from "../../../_bundle/Module15752";
import { transitionTo } from "../../routing/router_utils";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
import { HermesBuiltin } from "../../../_hermes/prelude";
let sound, c11255_14, c11255_15, c11255_16, c11255_17, c11255_18, width, applicationId, c11255_21, c11255_22, recordThinkingTransition, purgeProject, $mk97677 = function() {
return (a0) => c11255_14.has(a0.kind);
};
const newMessageFromHistory = function newMessageFromHistory(a0) {
const { role, content, ts } = a0;
const r0 = c11255_22 + 1;
c11255_22 = r0;
const r2 = {
id: "m" + r0,
role,
content,
steps: [],
created_at: ts != null ? Date.parse(ts) : Date.now()
};
if (a0.kind != null) {
r2.kind = a0.kind;
}
if (a0.proposal != null) {
r2.proposal = a0.proposal;
}
return r2;
};
recordThinkingTransition = function recordThinkingTransition(projectId) {
let r31 = c11255_17.get(projectId);
if (r31 == null) {
r31 = false;
}
const r32 = c11255_15.get(projectId);
const r7 = r32 == null;
let r6 = false;
if (!r7) {
const length = r32.length;
r6 = false;
if (length !== 0) {
const r36 = r32[r32.length - 1];
r6 = r36.role === "assistant" && !(r36.content !== "" || r36.proposal != null || r36.steps.some($mk97677()));
}
}
if (r31 !== r6) {
c11255_17.set(projectId, r6);
if (r6) {
c11255_16.delete(projectId);
} else {
const r47 = c11255_15.get(projectId);
const r50 = r47 == null ? void 0 : r47[r47.length - 1];
if (r50?.role === "assistant" && (r50.content.trim() !== "" || r50.proposal != null || r50.steps.some((step) => c11255_14.has(step.kind) && step.kind !== "terminal_error"))) {
c11255_16.set(projectId, Date.now());
} else {
c11255_16.delete(projectId);
}
const project = VibegrationsProjectStore.getProject(projectId);
if (project != null && !(NotificationSettingsStore.getDesktopType() === DesktopNotificationTypes.NEVER || SelfPresenceStore.getStatus() === StatusTypes.DND || !!FocusMode.getSetting() || !!FamilyCenterStore.isCurrentUserInRestrictedHours())) {
const isSoundDisabled = NotificationSettingsStore.isSoundDisabled(sound);
const guildId = SelectedGuildStore.getGuildId();
let r108 = guildId != null ? VibegrationsProjectStore.getSelectedProjectId(guildId) === projectId ? guildId : null : null;
const r111 = r108 != null && SelectedChannelStore.getChannelId() === StaticChannelRoute.VIBEGRATIONS && VibegrationsPlatformUtils_native.isWindowFocused();
if (r108 == null) {
r108 = project.guild_id;
}
if (r108 == null) {
r108 = project.preview_guild_id;
}
const r123 = c11255_15.get(projectId);
const r124 = r123 == null;
let r125 = null;
if (!r124) {
const length2 = r123.length;
r125 = null;
if (length2 !== 0) {
const r129 = r123[r123.length - 1];
const role = r129.role;
r125 = null;
if (role === "assistant") {
if (r129.content.trim() !== "") {
r125 = r129.content;
} else if (r129.proposal != null) {
r125 = r129.proposal.summary;
} else {
let r137 = r129.steps.length - 1;
r125 = null;
while (0 <= r137) {
const r140 = r129.steps[r137];
const kind = r140.kind;
const r1 = r137;
if (!(kind !== "error" && (r140.kind !== "terminal_error" && (r140.kind !== "build_error" && r140.kind !== "healthcheck_failed"))) && r140.message != null && r140.message !== "") {
r125 = r140.message;
break;
}
if (r140.kind === "preview_ready") {
r125 = intl.string(VibegrationsUntranslated_messages["78YNh7"]);
break;
}
r137 = r1 - 1;
r125 = null;
}
}
}
}
}
if (r125 != null) {
if (r111) {
if (!isSoundDisabled) {
playSound(sound, 0.4);
}
} else {
const r159 = r108 == null ? null : Routes.CHANNEL(r108, StaticChannelRoute.VIBEGRATIONS, projectId);
let c22417_0 = r159;
const name = project.name;
const r179 = {
tag: `vibegrations-${projectId}`,
sound: isSoundDisabled ? void 0 : sound,
volume: 0.4,
fallbackDeepLink: r159 == null ? void 0 : VibegrationsPlatformUtils_native.createNotificationDeepLink(r159),
onClick: null,
isUserAvatar: false
};
const onClick = r159 == null ? void 0 : () => transitionTo(c22417_0);
const r26 = {
notif_type: "VIBEGRATIONS_ASSISTANT_FINISHED"
};
r179.onClick = onClick;
NotificationActionCreators.showNotification(_Module15752, name, r125, r26, r179);
}
}
}
}
}
};
purgeProject = function purgeProject(item) {
let r6 = c11255_15.delete(item);
const r8 = c11255_16.delete(item);
const r10 = c11255_17.delete(item);
const r13 = c11255_18.delete(item);
if (!r6) {
r6 = r8;
}
if (!r6) {
r6 = r10;
}
if (!r6) {
r6 = r13;
}
return r6;
};
sound = "message1";
c11255_14 = new Set(["reply", "plan_proposed", "preview_ready", "terminal_error"]);
c11255_15 = new Map();
c11255_16 = new Map();
c11255_17 = new Map();
c11255_18 = new Map();
width = 0;
applicationId = null;
c11255_21 = [];
c11255_22 = 0;
class VibegrationsChatStore extends Module589.Store {
initialize() {
this.waitFor(FamilyCenterStore, NotificationSettingsStore, SelectedChannelStore, SelectedGuildStore, SelfPresenceStore, VibegrationsProjectStore);
}
getMessages(a0) {
let r5 = c11255_15.get(a0);
if (r5 == null) {
r5 = c11255_21;
}
return r5;
}
isThinking(a0) {
const r9 = c11255_15.get(a0);
const r4 = r9 == null;
let r2 = false;
if (!r4) {
const length = r9.length;
r2 = false;
if (length !== 0) {
const r14 = r9[r9.length - 1];
r2 = r14.role === "assistant" && !(r14.content !== "" || r14.proposal != null || r14.steps.some($mk97677()));
}
}
return r2;
}
getFinishedAt(a0) {
const r11 = c11255_15.get(a0);
const r4 = r11 == null;
let r2 = false;
if (!r4) {
const length = r11.length;
r2 = false;
if (length !== 0) {
const r16 = r11[r11.length - 1];
r2 = r16.role === "assistant" && !(r16.content !== "" || r16.proposal != null || r16.steps.some($mk97677()));
}
}
let r24 = null;
if (!r2) {
let r27 = c11255_16.get(a0);
if (r27 == null) {
r27 = null;
}
r24 = r27;
}
return r24;
}
getProjectUsage(a0) {
let r5 = c11255_18.get(a0);
if (r5 == null) {
r5 = null;
}
return r5;
}
getSidebarWidth() {
return width;
}
getBuilderPreviewApplicationId() {
return applicationId;
}
isAnyThinking() {
for (const item of c11255_15.keys()) {
if (!this.isThinking(item)) {
continue;
}
return true;
}
return false;
}
}
const vibegrationsChatStore = new VibegrationsChatStore(Dispatcher, {
LOGOUT: function handleLogout() {
if (c11255_15.size === 0 && c11255_16.size === 0 && c11255_17.size === 0 && c11255_18.size === 0 && width === 0 && applicationId == null) {
return false;
}
c11255_15.clear();
c11255_16.clear();
c11255_17.clear();
c11255_18.clear();
width = 0;
applicationId = null;
},
VIBEGRATIONS_CHAT_HISTORY_SET: function handleChatHistorySet(a0) {
const projectId = a0.projectId;
c11255_15.set(projectId, a0.entries.map(newMessageFromHistory));
recordThinkingTransition(projectId);
},
VIBEGRATIONS_CHAT_MESSAGE_APPEND: function handleChatMessageAppend({ projectId, content }) {
let r9 = c11255_15.get(projectId);
if (r9 == null) {
r9 = [];
}
const r18 = [, ,];
const r2 = HermesBuiltin.arraySpread(r18, r9, 0);
const r0 = c11255_22 + 1;
c11255_22 = r0;
r18[r2] = {
id: "m" + r0,
role: "user",
content,
steps: [],
created_at: Date.now()
};
const r26 = c11255_22 + 1;
c11255_22 = r26;
r18[r2 + 1] = {
id: "m" + r26,
role: "assistant",
content: "",
steps: [],
created_at: Date.now()
};
c11255_15.set(projectId, r18);
recordThinkingTransition(projectId);
},
VIBEGRATIONS_CHAT_STEP_APPEND: function handleChatStepAppend({ projectId, step }) {
const r8 = c11255_15.get(projectId);
if (r8 != null && r8.length !== 0) {
const r9 = r8[r8.length - 1];
if (r9.role === "assistant") {
c11255_15.set(projectId, [...r8.slice(0, -1), {
...r9,
steps: [...r9.steps, step]
}]);
}
}
recordThinkingTransition(projectId);
},
VIBEGRATIONS_CHAT_USAGE_SET: function handleChatUsageSet(a0) {
c11255_18.set(a0.projectId, a0.project);
},
VIBEGRATIONS_CHAT_SIDEBAR_WIDTH_SET: function handleChatSidebarWidthSet({ width: width2 }) {
if (width === width2) {
return false;
}
width = width2;
},
VIBEGRATIONS_BUILDER_PREVIEW_APPLICATION_SET: function handleBuilderPreviewApplicationSet({ applicationId: applicationId2 }) {
if (applicationId === applicationId2) {
return false;
}
applicationId = applicationId2;
},
VIBEGRATIONS_CHAT_TURN_PATCH: function handleChatTurnPatch({ projectId, patch }) {
const r8 = c11255_15.get(projectId);
if (r8 != null && r8.length !== 0) {
const r10 = r8[r8.length - 1];
if (r10.role === "assistant") {
c11255_15.set(projectId, [...r8.slice(0, -1), {
...r10,
...patch
}]);
}
}
recordThinkingTransition(projectId);
},
VIBEGRATIONS_CHAT_CONN_STATE: function handleChatConnState({ projectId, connState }) {
if (connState !== "closed" && connState !== "failed") {
return false;
}
const r8 = c11255_15.get(projectId);
if (r8 != null && r8.some((item) => item.role === "assistant" && !(item.content !== "" || item.proposal != null || item.steps.some($mk97677())))) {
c11255_15.set(projectId, r8.map((item) => item.role === "assistant" ? item.content !== "" || item.proposal != null || item.steps.some($mk97677()) ? item : {
...item,
steps: [...item.steps, {
type: "step",
kind: "terminal_error",
message: intl.string(VibegrationsUntranslated_messages["wjWm+/"])
}]
} : item));
recordThinkingTransition(projectId);
return void 0;
}
return false;
},
VIBEGRATIONS_PROJECT_DELETE_SUCCESS: function handleProjectDeleteSuccess({ projectId }) {
let r8 = c11255_15.delete(projectId);
const r10 = c11255_16.delete(projectId);
const r12 = c11255_17.delete(projectId);
const r15 = c11255_18.delete(projectId);
if (!r8) {
r8 = r10;
}
if (!r8) {
r8 = r12;
}
if (!r8) {
r8 = r15;
}
if (r8) {
return void 0;
}
return false;
},
VIBEGRATIONS_PROJECTS_FETCH_SUCCESS: function handleProjectsFetchSuccess(a0) {
const set = new Set(a0.projects.map((project) => project.id));
const set2 = new Set([...c11255_15.keys(), ...c11255_16.keys(), ...c11255_17.keys(), ...c11255_18.keys()]);
let r55 = false;
for (const item of set2) {
const r63 = set.has(item);
if (r63 ? !r63 : purgeProject(item)) {
r55 = true;
}
}
if (r55) {
return void 0;
}
return false;
}
});
export default vibegrationsChatStore;
export function turnSettled(a0) {
return a0.content !== "" || a0.proposal != null || a0.steps.some($mk97677());
}
@@ -0,0 +1,114 @@
// Metro module 5683 (f5684).
import _slicedToArray from "../../../_bundle/_slicedToArray";
import Module589 from "../../../_bundle/Module589";
import Dispatcher from "../../../Dispatcher";
let c3519_1, c3519_2, c3519_3, c3519_4, c3519_5;
const handleProjectUpsert = function handleProjectUpsert({ project }) {
c3519_1.set(project.id, project);
};
c3519_1 = new Map();
c3519_2 = new Map();
c3519_3 = null;
c3519_4 = [];
c3519_5 = new Map();
class VibegrationsProjectStore extends Module589.Store {
getAllProjects() {
return Array.from(c3519_1.values());
}
getProject(a0) {
let r5 = c3519_1.get(a0);
if (r5 == null) {
r5 = null;
}
return r5;
}
getSelectedProjectId(a0) {
let r5 = c3519_2.get(a0);
if (r5 == null) {
r5 = null;
}
return r5;
}
getLogs(a0) {
let r5 = c3519_5.get(a0);
if (r5 == null) {
r5 = c3519_4;
}
return r5;
}
getProjectsFetchState() {
return c3519_3;
}
}
const vibegrationsProjectStore = new VibegrationsProjectStore(Dispatcher, {
LOGOUT: function handleLogout() {
if (c3519_1.size === 0 && c3519_2.size === 0 && c3519_5.size === 0 && c3519_3 == null) {
return false;
}
c3519_1.clear();
c3519_2.clear();
c3519_5.clear();
c3519_3 = null;
},
VIBEGRATIONS_PROJECTS_FETCH_START: function handleProjectsFetchStart() {
c3519_3 = {
type: "loading"
};
},
VIBEGRATIONS_PROJECTS_FETCH_SUCCESS: function handleProjectsFetchSuccess({ projects }) {
c3519_1.clear();
for (const item of projects) {
c3519_1.set(item.id, item);
}
for (const item2 of c3519_2) {
const r41 = _slicedToArray(item2, 2);
const r42 = r41[0];
if (!c3519_1.has(r41[1])) {
c3519_2.delete(r42);
}
}
c3519_3 = {
type: "success",
fetchedAt: Date.now()
};
},
VIBEGRATIONS_PROJECTS_FETCH_FAIL: function handleProjectsFetchFail() {
c3519_3 = {
type: "error",
fetchedAt: Date.now()
};
},
VIBEGRATIONS_PROJECT_CREATE_SUCCESS: handleProjectUpsert,
VIBEGRATIONS_PROJECT_UPDATE_SUCCESS: handleProjectUpsert,
VIBEGRATIONS_PROJECT_DELETE_SUCCESS: function handleProjectDeleteSuccess({ projectId }) {
c3519_1.delete(projectId);
c3519_5.delete(projectId);
for (const item of c3519_2) {
const r33 = _slicedToArray(item, 2);
const r34 = r33[0];
if (r33[1] === projectId) {
c3519_2.delete(r34);
}
}
},
VIBEGRATIONS_PROJECT_SELECT: function handleProjectSelect({ guildId, projectId }) {
let r7 = c3519_2.get(guildId);
if (r7 == null) {
r7 = null;
}
if (r7 === projectId) {
return false;
}
if (projectId == null) {
c3519_2.delete(guildId);
} else {
c3519_2.set(guildId, projectId);
}
},
VIBEGRATIONS_LOG_APPEND: function handleLogAppend({ projectId, log }) {
const r6 = c3519_5.get(projectId);
const r7 = r6 == null ? [log] : r6.concat(log);
c3519_5.set(projectId, r7.length > 500 ? r7.slice(-500) : r7);
}
});
export default vibegrationsProjectStore;