Files
discord-decomp/_bundle/Module946.js
T
2026-11-01 12:12:55 +02:00

107 lines
3.8 KiB
JavaScript

// Metro module 946 (f947).
import { MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE, MCP_PROMPT_RESULT_MESSAGE_COUNT_ATTRIBUTE, MCP_TOOL_RESULT_CONTENT_COUNT_ATTRIBUTE, MCP_TOOL_RESULT_IS_ERROR_ATTRIBUTE } from "./Module940";
import { isValidContentItem } from "./Module936";
Object.defineProperty(exports, Symbol.toStringTag, {
value: "Module"
});
export function extractPromptResultAttributes(a0, a1) {
let messages, c12583_2, c12583_3;
const r0 = {};
let c12583_0 = r0;
if (isValidContentItem(a0)) {
if (a1 ? typeof a0.description === "string" : a1) {
r0[MCP_PROMPT_RESULT_DESCRIPTION_ATTRIBUTE] = a0.description;
}
if (Array.isArray(a0.messages)) {
r0[MCP_PROMPT_RESULT_MESSAGE_COUNT_ATTRIBUTE] = a0.messages.length;
if (a1) {
messages = a0.messages;
const _loop2 = function _loop2() {
if (isValidContentItem(c12583_3)) {
const r8 = messages.length !== 1 ? `mcp.prompt.result.${c12583_2}` : "mcp.prompt.result";
const role = c12583_3.role;
if (typeof role === "string") {
c12583_0[messages.length === 1 ? `${r8}.message_role` : `${r8}.role`] = role;
}
if (isValidContentItem(c12583_3.content)) {
const content = c12583_3.content;
if (typeof content.text === "string") {
c12583_0[messages.length === 1 ? `${r8}.message_content` : `${r8}.content`] = content.text;
}
}
return void 0;
}
return 1;
};
for (const item of messages.entries()) {
[c12583_2, c12583_3] = item;
_loop2();
}
}
}
return r0;
}
return r0;
}
export function extractToolResultAttributes(a0, a1) {
if (isValidContentItem(a0)) {
const r15 = Array.isArray(a0.content) ? (function buildAllContentItemAttributes(a0, c23915_1) {
let c23915_3, c23915_4;
const r22 = {};
r22[MCP_TOOL_RESULT_CONTENT_COUNT_ATTRIBUTE] = a0.length;
let c23915_2 = r22;
const _loop = function _loop() {
if (isValidContentItem(c23915_4)) {
const r8 = a0.length !== 1 ? `mcp.tool.result.${c23915_3}` : "mcp.tool.result";
if (typeof c23915_4.type === "string") {
c23915_2[`${r8}.content_type`] = c23915_4.type;
}
if (c23915_1) {
const mimeType = c23915_4.mimeType;
if (typeof mimeType === "string") {
c23915_2[`${r8}.mime_type`] = mimeType;
}
const uri = c23915_4.uri;
if (typeof uri === "string") {
c23915_2[`${r8}.uri`] = uri;
}
const name = c23915_4.name;
if (typeof name === "string") {
c23915_2[`${r8}.name`] = name;
}
if (typeof c23915_4.text === "string") {
c23915_2[`${r8}.content`] = c23915_4.text;
}
if (typeof c23915_4.data === "string") {
c23915_2[`${r8}.data_size`] = c23915_4.data.length;
}
const resource = c23915_4.resource;
if (isValidContentItem(resource)) {
const uri2 = resource.uri;
if (typeof uri2 === "string") {
c23915_2[`${r8}.resource_uri`] = uri2;
}
const mimeType2 = resource.mimeType;
if (typeof mimeType2 === "string") {
c23915_2[`${r8}.resource_mime_type`] = mimeType2;
}
}
}
return void 0;
}
return 1;
};
for (const item of a0.entries()) {
[c23915_3, c23915_4] = item;
_loop();
}
return r22;
})(a0.content, a1) : {};
if (typeof a0.isError === "boolean") {
r15[MCP_TOOL_RESULT_IS_ERROR_ATTRIBUTE] = a0.isError;
}
return r15;
}
return {};
}