Files
discord-decomp/sources/by-id/module-00985-createLangChainCallbackHandler.js
T
2026-07-28 01:06:53 +03:00

287 lines
17 KiB
JavaScript

/* Metro module 985; source: unknown; dependencies: [77, 986, 966, 874, 848, 849, 877, 987] */
import * as Module00077Module from './module-00077.js'; /* Metro dependency 77 */
import * as SEMANTIC_Module from './module-00848-SEMANTIC_.js'; /* Metro dependency 848 */
import * as moduleValue3 from './module-00874.js'; /* Metro dependency 874 */
import * as Module00966Module from './module-00966.js'; /* Metro dependency 966 */
import * as Module00986Module from './module-00986.js'; /* Metro dependency 986 */
import * as Module00987Module from './module-00987.js'; /* Metro dependency 987 */
function _fun10359(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#10359, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:6, offset: 0x00d8afed, size: 93 bytes, params: 8, frame: 18
const env0_0 = require;
const Object = global.Object;
const defineProperty = Object.defineProperty;
const Symbol = global.Symbol;
Reflect.apply(defineProperty, Object, [exports, Symbol.toStringTag, {value: 'Module'}]);
exports.createLangChainCallbackHandler = createLangChainCallbackHandler;
function createLangChainCallbackHandler() { // fn#10360, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:138, offset: 0x00d8b04a, size: 411 bytes, params: 1, frame: 14
const r2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
const recordInputs = r2.recordInputs;
const env0_0 = recordInputs != null && recordInputs;
const recordOutputs = r2.recordOutputs;
const env0_1 = recordOutputs != null && recordOutputs;
const Map = global.Map;
const map = new Map();
return {lc_serializable: false, lc_namespace: ['langchain_core', 'callbacks', 'sentry'], lc_secrets: undefined,
lc_attributes: undefined, lc_aliases: undefined, lc_serializable_keys: undefined, lc_id: ['langchain_core',
'callbacks', 'sentry'], lc_kwargs: {}, name: 'SentryCallbackHandler', ignoreLLM: false, ignoreChain: false,
ignoreAgent: false, ignoreRetriever: false, ignoreCustomEvent: false, raiseError: false, awaitHandlers: true,
handleLLMStart: handleLLMStart, handleChatModelStart: handleChatModelStart, handleLLMEnd: handleLLMEnd,
handleLLMError: handleLLMError, handleChainStart: handleChainStart, handleChainEnd: handleChainEnd,
handleChainError: handleChainError, handleToolStart: handleToolStart, handleToolEnd: handleToolEnd,
handleToolError: handleToolError, copy: copy_10376, toJSON: toJSON_10377,
toJSONNotImplemented: toJSONNotImplemented};
function exitSpan(a0) { // fn#10361, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:321, owner: createLangChainCallbackHandler.exitSpan, offset: 0x00d8b1e5, size: 69 bytes, params: 2, frame: 13
const value2 = Module00077Module.get(a0);
if (value2 != null && value2.isRecording()) {
value2.end();
Module00077Module.delete(a0);
}
}
function handleLLMStart(a0, a1, a2, a3, a4, a5, a6, a7) { // fn#10362, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:783, owner: createLangChainCallbackHandler.handleLLMStart, offset: 0x00d8b22a, size: 260 bytes, params: 9, frame: 27
var environment;
const env0_0 = a2;
const value = environment.__proto__;
const value4 = (Module00986Module).extractLLMRequestAttributes(a0, a1, env0_0,
(Module00986Module).getInvocationParams(a5), a6);
const GEN_AI_REQUEST_MODEL_ATTRIBUTE = (Module00966Module).GEN_AI_REQUEST_MODEL_ATTRIBUTE;
const property = value4[GEN_AI_REQUEST_MODEL_ATTRIBUTE];
const GEN_AI_OPERATION_NAME_ATTRIBUTE = (Module00966Module).GEN_AI_OPERATION_NAME_ATTRIBUTE;
const property2 = value4[GEN_AI_OPERATION_NAME_ATTRIBUTE];
const startSpanManual = moduleValue3.startSpanManual;
const object = {};
object.name = '' + property2 + ' ' + property;
object.op = 'gen_ai.pipeline';
const Object = global.Object;
const assign = Object.assign;
const binding = env1_2;
const SEMANTIC_ATTRIBUTE_SENTRY_OP = (SEMANTIC_Module).SEMANTIC_ATTRIBUTE_SENTRY_OP;
object.attributes = Reflect.apply(assign, Object, [{}, value4, binding({}, SEMANTIC_ATTRIBUTE_SENTRY_OP,
'gen_ai.pipeline')]);
Reflect.apply(startSpanManual, moduleValue3, [object, _fun10363]);
function _fun10363(a0) { // fn#10363, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:1156, offset: 0x00d8b32e, size: 30 bytes, params: 2, frame: 13
env1_2.set(importDefault, a0);
return a0;
}
}
function handleChatModelStart(a0, a1, a2, a3, a4, a5, a6, a7) { // fn#10364, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:1213, owner: createLangChainCallbackHandler.handleChatModelStart, offset: 0x00d8b34c, size: 260 bytes, params: 9, frame: 27
var environment;
const env0_0 = a2;
const value = environment.__proto__;
const value4 = (Module00986Module).extractChatModelRequestAttributes(a0, a1, env0_0,
(Module00986Module).getInvocationParams(a5), a6);
const GEN_AI_REQUEST_MODEL_ATTRIBUTE = (Module00966Module).GEN_AI_REQUEST_MODEL_ATTRIBUTE;
const property = value4[GEN_AI_REQUEST_MODEL_ATTRIBUTE];
const GEN_AI_OPERATION_NAME_ATTRIBUTE = (Module00966Module).GEN_AI_OPERATION_NAME_ATTRIBUTE;
const property2 = value4[GEN_AI_OPERATION_NAME_ATTRIBUTE];
const startSpanManual = moduleValue3.startSpanManual;
const object = {};
object.name = '' + property2 + ' ' + property;
object.op = 'gen_ai.chat';
const Object = global.Object;
const assign = Object.assign;
const binding = env1_2;
const SEMANTIC_ATTRIBUTE_SENTRY_OP = (SEMANTIC_Module).SEMANTIC_ATTRIBUTE_SENTRY_OP;
object.attributes = Reflect.apply(assign, Object, [{}, value4, binding({}, SEMANTIC_ATTRIBUTE_SENTRY_OP,
'gen_ai.chat')]);
Reflect.apply(startSpanManual, moduleValue3, [object, _fun10365]);
function _fun10365(a0) { // fn#10365, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:1590, offset: 0x00d8b32e, size: 30 bytes, params: 2, frame: 13
env1_2.set(importDefault, a0);
return a0;
}
}
function handleLLMEnd(a0, a1, a2, a3, a4) { // fn#10366, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:1639, owner: createLangChainCallbackHandler.handleLLMEnd, offset: 0x00d8b450, size: 110 bytes, params: 6, frame: 17
var value3;
var value4;
const value2 = Module00077Module.get(a1);
if (value2 != null) {
if (value2.isRecording()) {
value3 = environment.__proto__;
value4 = (require(986) /* metro dependency 986 */).extractLlmResponseAttributes(a0, env0_1);
if (value4) {
value2.setAttributes(value4);
}
exitSpan(a1);
}
}
}
function handleLLMError(a0, a1) { // fn#10367, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:1808, owner: createLangChainCallbackHandler.handleLLMError, offset: 0x00d8b4be, size: 218 bytes, params: 3, frame: 18
var setStatus;
var object;
var value4;
const value2 = Module00077Module.get(a1);
if (value2 != null && value2.isRecording()) {
setStatus = value2.setStatus;
object = {};
value4 = environment.__proto__;
object.code = (require(849) /* metro dependency 849 */).SPAN_STATUS_ERROR;
object.message = 'llm_error';
Reflect.apply(setStatus, value2, [object]);
exitSpan(a1);
}
let value = environment.__proto__;
value = require(877) /* metro dependency 877 */;
const captureException = value.captureException;
const LANGCHAIN_ORIGIN = (Module00987Module).LANGCHAIN_ORIGIN;
Reflect.apply(captureException, value, [a0, {mechanism: {handled: false,
type: '' + LANGCHAIN_ORIGIN + '.llm_error_handler'}}]);
}
function handleChainStart({name}, a1, a2, a3) { // fn#10368, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:2075, owner: createLangChainCallbackHandler.handleChainStart, offset: 0x00d8b598, size: 264 bytes, params: 5, frame: 24
var environment;
var JSON;
const env0_0 = a2;
name = !name ? 'unknown_chain' : name;
const value = environment.__proto__;
let binding = env1_2;
const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = (SEMANTIC_Module).SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN;
const value3 = binding(binding({}, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, 'auto.ai.langchain'), 'langchain.chain.name',
name);
if (env0_0) {
JSON = global.JSON;
value3['langchain.chain.inputs'] = JSON.stringify(a1);
}
const startSpanManual = moduleValue3.startSpanManual;
const object = {};
object.name = 'chain ' + name;
object.op = 'gen_ai.invoke_agent';
const Object = global.Object;
const assign = Object.assign;
binding = env1_2;
const SEMANTIC_ATTRIBUTE_SENTRY_OP = (SEMANTIC_Module).SEMANTIC_ATTRIBUTE_SENTRY_OP;
object.attributes = Reflect.apply(assign, Object, [{}, value3, binding({}, SEMANTIC_ATTRIBUTE_SENTRY_OP,
'gen_ai.invoke_agent')]);
Reflect.apply(startSpanManual, moduleValue3, [object, _fun10369]);
function _fun10369(a0) { // fn#10369, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:2454, offset: 0x00d8b32e, size: 30 bytes, params: 2, frame: 13
env1_2.set(importDefault, a0);
return a0;
}
}
function handleChainEnd(a0, a1) { // fn#10370, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:2505, owner: createLangChainCallbackHandler.handleChainEnd, offset: 0x00d8b6a0, size: 106 bytes, params: 3, frame: 16
var setAttributes;
var JSON;
const value2 = Module00077Module.get(a1);
if (value2 != null && value2.isRecording()) {
if (env0_1) {
setAttributes = value2.setAttributes;
JSON = global.JSON;
Reflect.apply(setAttributes, value2, [{['langchain.chain.outputs']: JSON.stringify(a0)}]);
}
exitSpan(a1);
}
}
function handleChainError(a0, a1) { // fn#10371, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:2666, owner: createLangChainCallbackHandler.handleChainError, offset: 0x00d8b70a, size: 218 bytes, params: 3, frame: 18
var setStatus;
var object;
var value4;
const value2 = Module00077Module.get(a1);
if (value2 != null && value2.isRecording()) {
setStatus = value2.setStatus;
object = {};
value4 = environment.__proto__;
object.code = (require(849) /* metro dependency 849 */).SPAN_STATUS_ERROR;
object.message = 'chain_error';
Reflect.apply(setStatus, value2, [object]);
exitSpan(a1);
}
let value = environment.__proto__;
value = require(877) /* metro dependency 877 */;
const captureException = value.captureException;
const LANGCHAIN_ORIGIN = (Module00987Module).LANGCHAIN_ORIGIN;
Reflect.apply(captureException, value, [a0, {mechanism: {handled: false,
type: '' + LANGCHAIN_ORIGIN + '.chain_error_handler'}}]);
}
function handleToolStart({name}, a1, a2, a3) { // fn#10372, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:2938, owner: createLangChainCallbackHandler.handleToolStart, offset: 0x00d8b7e4, size: 257 bytes, params: 5, frame: 24
var environment;
const env0_0 = a2;
name = !name ? 'unknown_tool' : name;
const value = environment.__proto__;
let binding = env1_2;
const SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN = (SEMANTIC_Module).SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN;
const LANGCHAIN_ORIGIN = (Module00987Module).LANGCHAIN_ORIGIN;
const value3 = binding(binding({}, SEMANTIC_ATTRIBUTE_SENTRY_ORIGIN, LANGCHAIN_ORIGIN), 'gen_ai.tool.name', name);
if (env0_0) {
value3['gen_ai.tool.input'] = a1;
}
const startSpanManual = moduleValue3.startSpanManual;
const object = {};
object.name = 'execute_tool ' + name;
object.op = 'gen_ai.execute_tool';
const Object = global.Object;
const assign = Object.assign;
binding = env1_2;
const SEMANTIC_ATTRIBUTE_SENTRY_OP = (SEMANTIC_Module).SEMANTIC_ATTRIBUTE_SENTRY_OP;
object.attributes = Reflect.apply(assign, Object, [{}, value3, binding({}, SEMANTIC_ATTRIBUTE_SENTRY_OP,
'gen_ai.execute_tool')]);
Reflect.apply(startSpanManual, moduleValue3, [object, _fun10373]);
function _fun10373(a0) { // fn#10373, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:3302, offset: 0x00d8b32e, size: 30 bytes, params: 2, frame: 13
env1_2.set(importDefault, a0);
return a0;
}
}
function handleToolEnd(a0, a1) { // fn#10374, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:3352, owner: createLangChainCallbackHandler.handleToolEnd, offset: 0x00d8b8e5, size: 106 bytes, params: 3, frame: 16
var setAttributes;
var JSON;
const value2 = Module00077Module.get(a1);
if (value2 != null && value2.isRecording()) {
if (env0_1) {
setAttributes = value2.setAttributes;
JSON = global.JSON;
Reflect.apply(setAttributes, value2, [{['gen_ai.tool.output']: JSON.stringify(a0)}]);
}
exitSpan(a1);
}
}
function handleToolError(a0, a1) { // fn#10375, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:3506, owner: createLangChainCallbackHandler.handleToolError, offset: 0x00d8b94f, size: 218 bytes, params: 3, frame: 18
var setStatus;
var object;
var value4;
const value2 = Module00077Module.get(a1);
if (value2 != null && value2.isRecording()) {
setStatus = value2.setStatus;
object = {};
value4 = environment.__proto__;
object.code = (require(849) /* metro dependency 849 */).SPAN_STATUS_ERROR;
object.message = 'tool_error';
Reflect.apply(setStatus, value2, [object]);
exitSpan(a1);
}
let value = environment.__proto__;
value = require(877) /* metro dependency 877 */;
const captureException = value.captureException;
const LANGCHAIN_ORIGIN = (Module00987Module).LANGCHAIN_ORIGIN;
Reflect.apply(captureException, value, [a0, {mechanism: {handled: false,
type: '' + LANGCHAIN_ORIGIN + '.tool_error_handler'}}]);
}
function createLangChainCallbackHandlerCopy() { // fn#10376, owner: createLangChainCallbackHandler.copy, offset: 0x00d16d26, size: 9 bytes, params: 1, frame: 1
return env0_4;
}
function createLangChainCallbackHandlerToJSON() { // fn#10377, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:3797, owner: createLangChainCallbackHandler.toJSON, offset: 0x00d8ba29, size: 29 bytes, params: 1, frame: 2
return {'lc': 1, 'type': 'not_implemented', id: env0_4.lc_id};
}
function toJSONNotImplemented() { // fn#10378, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:1112:3884, owner: createLangChainCallbackHandler.toJSONNotImplemented, offset: 0x00d8ba29, size: 29 bytes, params: 1, frame: 2
return {'lc': 1, 'type': 'not_implemented', id: env0_4.lc_id};
}
}
}
global.__d(_fun10359, 985, [77, 986, 966, 874, 848, 849, 877,
987]) /* metro module 985, dependencies: [77, 986, 966, 874, 848, 849, 877, 987] */;