@mastra/memory 1.39.1 → 1.40.0-alpha.0
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/_types/@internal_ai-sdk-v4/dist/index.d.ts +52 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/processors/index.cjs +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/observational-memory/buffering-coordinator.d.ts.map +1 -1
- package/dist/processors/observational-memory/constants.d.ts +3 -3
- package/dist/processors/observational-memory/constants.d.ts.map +1 -1
- package/dist/processors/observational-memory/error.d.ts +10 -2
- package/dist/processors/observational-memory/error.d.ts.map +1 -1
- package/dist/processors/observational-memory/extractor.d.ts.map +1 -1
- package/dist/processors/observational-memory/hooks.d.ts +1 -1
- package/dist/processors/observational-memory/hooks.d.ts.map +1 -1
- package/dist/processors/observational-memory/model-by-input-tokens.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts +2 -2
- package/dist/processors/observational-memory/observation-strategies/async-buffer.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/base.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/resource-scoped.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-strategies/sync.d.ts +2 -2
- package/dist/processors/observational-memory/observation-strategies/sync.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-turn/step.d.ts.map +1 -1
- package/dist/processors/observational-memory/observation-turn/turn.d.ts.map +1 -1
- package/dist/processors/observational-memory/observational-memory.d.ts.map +1 -1
- package/dist/processors/observational-memory/observer-runner.d.ts.map +1 -1
- package/dist/processors/observational-memory/processor.d.ts +7 -7
- package/dist/processors/observational-memory/processor.d.ts.map +1 -1
- package/dist/processors/observational-memory/reflector-runner.d.ts.map +1 -1
- package/dist/processors/observational-memory/retry.d.ts.map +1 -1
- package/dist/processors/observational-memory/subconscious/curate.d.ts.map +1 -1
- package/dist/processors/observational-memory/subconscious/index.d.ts.map +1 -1
- package/dist/processors/observational-memory/subconscious/pinned-state-processor.d.ts.map +1 -1
- package/dist/processors/observational-memory/subconscious/remind-continuation.d.ts.map +1 -1
- package/dist/processors/observational-memory/subconscious/remind.d.ts.map +1 -1
- package/dist/processors/observational-memory/subconscious/semantic-index.d.ts.map +1 -1
- package/dist/processors/observational-memory/summarize.d.ts.map +1 -1
- package/dist/processors/observational-memory/token-counter.d.ts.map +1 -1
- package/dist/processors/observational-memory/working-memory-extractor.d.ts.map +1 -1
- package/dist/processors/working-memory-state/processor.d.ts.map +1 -1
- package/dist/{src-DnCjNqwE.cjs → src-BFJ_viw1.cjs} +670 -623
- package/dist/src-BFJ_viw1.cjs.map +1 -0
- package/dist/{src-CLQXrKvR.js → src-tZXqilfm.js} +670 -623
- package/dist/src-tZXqilfm.js.map +1 -0
- package/dist/tools/om-tools.d.ts +1 -1
- package/dist/tools/om-tools.d.ts.map +1 -1
- package/dist/tools/working-memory.d.ts.map +1 -1
- package/package.json +5 -5
- package/dist/docs/SKILL.md +0 -77
- package/dist/docs/assets/SOURCE_MAP.json +0 -230
- package/dist/docs/references/docs-agents-human-in-the-loop.md +0 -748
- package/dist/docs/references/docs-agents-networks.md +0 -186
- package/dist/docs/references/docs-evals-evals-with-memory.md +0 -151
- package/dist/docs/references/docs-guides-context-engineering.md +0 -304
- package/dist/docs/references/docs-harness-background-tasks.md +0 -408
- package/dist/docs/references/docs-harness-goals.md +0 -144
- package/dist/docs/references/docs-memory-memory-processors.md +0 -396
- package/dist/docs/references/docs-memory-message-history.md +0 -424
- package/dist/docs/references/docs-memory-multi-user-threads.md +0 -210
- package/dist/docs/references/docs-memory-observational-memory.md +0 -1028
- package/dist/docs/references/docs-memory-overview.md +0 -305
- package/dist/docs/references/docs-memory-semantic-recall.md +0 -483
- package/dist/docs/references/docs-memory-working-memory.md +0 -450
- package/dist/docs/references/docs-signals-overview.md +0 -94
- package/dist/docs/references/docs-storage.md +0 -224
- package/dist/docs/references/docs-subagents.md +0 -554
- package/dist/docs/references/integrations-channels-github.md +0 -156
- package/dist/docs/references/integrations-databases-aurora-dsql.md +0 -432
- package/dist/docs/references/integrations-databases-dynamodb.md +0 -286
- package/dist/docs/references/integrations-databases-elasticsearch.md +0 -158
- package/dist/docs/references/integrations-databases-libsql.md +0 -161
- package/dist/docs/references/integrations-databases-mongodb.md +0 -269
- package/dist/docs/references/integrations-databases-oracledb.md +0 -241
- package/dist/docs/references/integrations-databases-postgresql.md +0 -561
- package/dist/docs/references/integrations-databases-redis.md +0 -250
- package/dist/docs/references/integrations-databases-upstash.md +0 -164
- package/dist/docs/references/integrations-databases-valkey.md +0 -103
- package/dist/docs/references/reference-core-getMemory.md +0 -53
- package/dist/docs/references/reference-core-listMemory.md +0 -59
- package/dist/docs/references/reference-file-based-agents-memory.md +0 -60
- package/dist/docs/references/reference-memory-clone-utilities.md +0 -205
- package/dist/docs/references/reference-memory-cloneThread.md +0 -177
- package/dist/docs/references/reference-memory-copyThread.md +0 -65
- package/dist/docs/references/reference-memory-createThread.md +0 -72
- package/dist/docs/references/reference-memory-getThreadById.md +0 -28
- package/dist/docs/references/reference-memory-listThreads.md +0 -149
- package/dist/docs/references/reference-memory-memory-class.md +0 -160
- package/dist/docs/references/reference-memory-observational-memory.md +0 -978
- package/dist/docs/references/reference-memory-settled.md +0 -67
- package/dist/docs/references/reference-memory-summarizeConversation.md +0 -101
- package/dist/docs/references/reference-memory-summarizeThread.md +0 -95
- package/dist/docs/references/reference-memory-updateThreadResourceId.md +0 -46
- package/dist/docs/references/reference-migrations-agentnetwork.md +0 -102
- package/dist/docs/references/reference-migrations-upgrade-to-v1-memory.md +0 -290
- package/dist/docs/references/reference-processors-token-limiter-processor.md +0 -169
- package/dist/docs/references/reference-vectors-libsql.md +0 -309
- package/dist/docs/references/reference-vectors-mongodb.md +0 -655
- package/dist/docs/references/reference-vectors-oracledb.md +0 -349
- package/dist/docs/references/reference-vectors-pg.md +0 -439
- package/dist/docs/references/reference-vectors-upstash.md +0 -308
- package/dist/src-CLQXrKvR.js.map +0 -1
- package/dist/src-DnCjNqwE.cjs.map +0 -1
|
@@ -38,6 +38,7 @@ let _mastra_core_error = require("@mastra/core/error");
|
|
|
38
38
|
let _mastra_core_features = require("@mastra/core/features");
|
|
39
39
|
let _mastra_core_memory = require("@mastra/core/memory");
|
|
40
40
|
let _mastra_core_observability = require("@mastra/core/observability");
|
|
41
|
+
_mastra_core_observability = __toESM$1(_mastra_core_observability, 1);
|
|
41
42
|
let _mastra_core_processors = require("@mastra/core/processors");
|
|
42
43
|
let _mastra_core_utils = require("@mastra/core/utils");
|
|
43
44
|
let _mastra_schema_compat_schema = require("@mastra/schema-compat/schema");
|
|
@@ -2184,7 +2185,7 @@ function logProxy$2(funcName, namespace, args) {
|
|
|
2184
2185
|
* of the levels are defined to match the original values from the initial LogLevel to avoid
|
|
2185
2186
|
* compatibility/migration issues for any implementation that assume the numeric ordering.
|
|
2186
2187
|
*/
|
|
2187
|
-
var DiagLogLevel$
|
|
2188
|
+
var DiagLogLevel$1;
|
|
2188
2189
|
(function(DiagLogLevel) {
|
|
2189
2190
|
/** Diagnostic Logging level setting to disable all logging (except and forced logs) */
|
|
2190
2191
|
DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
|
|
@@ -2203,10 +2204,10 @@ var DiagLogLevel$2;
|
|
|
2203
2204
|
DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
|
|
2204
2205
|
/** Used to set the logging level to include all logging */
|
|
2205
2206
|
DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
|
|
2206
|
-
})(DiagLogLevel$
|
|
2207
|
+
})(DiagLogLevel$1 || (DiagLogLevel$1 = {}));
|
|
2207
2208
|
function createLogLevelDiagLogger$2(maxLevel, logger) {
|
|
2208
|
-
if (maxLevel < DiagLogLevel$
|
|
2209
|
-
else if (maxLevel > DiagLogLevel$
|
|
2209
|
+
if (maxLevel < DiagLogLevel$1.NONE) maxLevel = DiagLogLevel$1.NONE;
|
|
2210
|
+
else if (maxLevel > DiagLogLevel$1.ALL) maxLevel = DiagLogLevel$1.ALL;
|
|
2210
2211
|
logger = logger || {};
|
|
2211
2212
|
function _filterFunc(funcName, theLevel) {
|
|
2212
2213
|
var theFunc = logger[funcName];
|
|
@@ -2214,11 +2215,11 @@ function createLogLevelDiagLogger$2(maxLevel, logger) {
|
|
|
2214
2215
|
return function() {};
|
|
2215
2216
|
}
|
|
2216
2217
|
return {
|
|
2217
|
-
error: _filterFunc("error", DiagLogLevel$
|
|
2218
|
-
warn: _filterFunc("warn", DiagLogLevel$
|
|
2219
|
-
info: _filterFunc("info", DiagLogLevel$
|
|
2220
|
-
debug: _filterFunc("debug", DiagLogLevel$
|
|
2221
|
-
verbose: _filterFunc("verbose", DiagLogLevel$
|
|
2218
|
+
error: _filterFunc("error", DiagLogLevel$1.ERROR),
|
|
2219
|
+
warn: _filterFunc("warn", DiagLogLevel$1.WARN),
|
|
2220
|
+
info: _filterFunc("info", DiagLogLevel$1.INFO),
|
|
2221
|
+
debug: _filterFunc("debug", DiagLogLevel$1.DEBUG),
|
|
2222
|
+
verbose: _filterFunc("verbose", DiagLogLevel$1.VERBOSE)
|
|
2222
2223
|
};
|
|
2223
2224
|
}
|
|
2224
2225
|
var __read$2$1 = function(o, n) {
|
|
@@ -2270,7 +2271,7 @@ var DiagAPI$2 = function() {
|
|
|
2270
2271
|
var self = this;
|
|
2271
2272
|
var setLogger = function(logger, optionsOrLogLevel) {
|
|
2272
2273
|
var _a, _b, _c;
|
|
2273
|
-
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel$
|
|
2274
|
+
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel$1.INFO };
|
|
2274
2275
|
if (logger === self) {
|
|
2275
2276
|
var err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
2276
2277
|
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
@@ -2278,7 +2279,7 @@ var DiagAPI$2 = function() {
|
|
|
2278
2279
|
}
|
|
2279
2280
|
if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
|
|
2280
2281
|
var oldLogger = getGlobal$2("diag");
|
|
2281
|
-
var newLogger = createLogLevelDiagLogger$2((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel$
|
|
2282
|
+
var newLogger = createLogLevelDiagLogger$2((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel$1.INFO, logger);
|
|
2282
2283
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
2283
2284
|
var stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
2284
2285
|
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
@@ -2473,17 +2474,17 @@ var ContextAPI$2 = function() {
|
|
|
2473
2474
|
};
|
|
2474
2475
|
return ContextAPI;
|
|
2475
2476
|
}();
|
|
2476
|
-
var TraceFlags$
|
|
2477
|
+
var TraceFlags$1;
|
|
2477
2478
|
(function(TraceFlags) {
|
|
2478
2479
|
/** Represents no flag set. */
|
|
2479
2480
|
TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
|
|
2480
2481
|
/** Bit to represent whether trace is sampled in trace flags. */
|
|
2481
2482
|
TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
|
|
2482
|
-
})(TraceFlags$
|
|
2483
|
+
})(TraceFlags$1 || (TraceFlags$1 = {}));
|
|
2483
2484
|
var INVALID_SPAN_CONTEXT$2 = {
|
|
2484
2485
|
traceId: "00000000000000000000000000000000",
|
|
2485
2486
|
spanId: "0000000000000000",
|
|
2486
|
-
traceFlags: TraceFlags$
|
|
2487
|
+
traceFlags: TraceFlags$1.NONE
|
|
2487
2488
|
};
|
|
2488
2489
|
/**
|
|
2489
2490
|
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
|
@@ -5697,7 +5698,7 @@ var { btoa: btoa$3, atob: atob$6 } = globalThis;
|
|
|
5697
5698
|
function withoutTrailingSlash$2(url) {
|
|
5698
5699
|
return url == null ? void 0 : url.replace(/\/$/, "");
|
|
5699
5700
|
}
|
|
5700
|
-
// ../_vendored/ai_v5/dist/dist-
|
|
5701
|
+
// ../_vendored/ai_v5/dist/dist-q105Fieh.js
|
|
5701
5702
|
function getContext$2() {
|
|
5702
5703
|
return { headers: {} };
|
|
5703
5704
|
}
|
|
@@ -6676,7 +6677,7 @@ async function getVercelRequestId$2() {
|
|
|
6676
6677
|
var _a10;
|
|
6677
6678
|
return (_a10 = getContext$2().headers) == null ? void 0 : _a10["x-vercel-id"];
|
|
6678
6679
|
}
|
|
6679
|
-
var VERSION$7 = "2.0.
|
|
6680
|
+
var VERSION$7 = "2.0.173";
|
|
6680
6681
|
var AI_GATEWAY_PROTOCOL_VERSION$2 = "0.0.1";
|
|
6681
6682
|
function createGatewayProvider$1(options = {}) {
|
|
6682
6683
|
var _a10, _b10;
|
|
@@ -7021,7 +7022,7 @@ function logProxy$1(funcName, namespace, args) {
|
|
|
7021
7022
|
* of the levels are defined to match the original values from the initial LogLevel to avoid
|
|
7022
7023
|
* compatibility/migration issues for any implementation that assume the numeric ordering.
|
|
7023
7024
|
*/
|
|
7024
|
-
var DiagLogLevel
|
|
7025
|
+
var DiagLogLevel;
|
|
7025
7026
|
(function(DiagLogLevel) {
|
|
7026
7027
|
/** Diagnostic Logging level setting to disable all logging (except and forced logs) */
|
|
7027
7028
|
DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
|
|
@@ -7040,10 +7041,10 @@ var DiagLogLevel$1;
|
|
|
7040
7041
|
DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
|
|
7041
7042
|
/** Used to set the logging level to include all logging */
|
|
7042
7043
|
DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
|
|
7043
|
-
})(DiagLogLevel
|
|
7044
|
+
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
7044
7045
|
function createLogLevelDiagLogger$1(maxLevel, logger) {
|
|
7045
|
-
if (maxLevel < DiagLogLevel
|
|
7046
|
-
else if (maxLevel > DiagLogLevel
|
|
7046
|
+
if (maxLevel < DiagLogLevel.NONE) maxLevel = DiagLogLevel.NONE;
|
|
7047
|
+
else if (maxLevel > DiagLogLevel.ALL) maxLevel = DiagLogLevel.ALL;
|
|
7047
7048
|
logger = logger || {};
|
|
7048
7049
|
function _filterFunc(funcName, theLevel) {
|
|
7049
7050
|
var theFunc = logger[funcName];
|
|
@@ -7051,11 +7052,11 @@ function createLogLevelDiagLogger$1(maxLevel, logger) {
|
|
|
7051
7052
|
return function() {};
|
|
7052
7053
|
}
|
|
7053
7054
|
return {
|
|
7054
|
-
error: _filterFunc("error", DiagLogLevel
|
|
7055
|
-
warn: _filterFunc("warn", DiagLogLevel
|
|
7056
|
-
info: _filterFunc("info", DiagLogLevel
|
|
7057
|
-
debug: _filterFunc("debug", DiagLogLevel
|
|
7058
|
-
verbose: _filterFunc("verbose", DiagLogLevel
|
|
7055
|
+
error: _filterFunc("error", DiagLogLevel.ERROR),
|
|
7056
|
+
warn: _filterFunc("warn", DiagLogLevel.WARN),
|
|
7057
|
+
info: _filterFunc("info", DiagLogLevel.INFO),
|
|
7058
|
+
debug: _filterFunc("debug", DiagLogLevel.DEBUG),
|
|
7059
|
+
verbose: _filterFunc("verbose", DiagLogLevel.VERBOSE)
|
|
7059
7060
|
};
|
|
7060
7061
|
}
|
|
7061
7062
|
var __read$2 = function(o, n) {
|
|
@@ -7107,7 +7108,7 @@ var DiagAPI$1 = function() {
|
|
|
7107
7108
|
var self = this;
|
|
7108
7109
|
var setLogger = function(logger, optionsOrLogLevel) {
|
|
7109
7110
|
var _a, _b, _c;
|
|
7110
|
-
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel
|
|
7111
|
+
if (optionsOrLogLevel === void 0) optionsOrLogLevel = { logLevel: DiagLogLevel.INFO };
|
|
7111
7112
|
if (logger === self) {
|
|
7112
7113
|
var err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
7113
7114
|
self.error((_a = err.stack) !== null && _a !== void 0 ? _a : err.message);
|
|
@@ -7115,7 +7116,7 @@ var DiagAPI$1 = function() {
|
|
|
7115
7116
|
}
|
|
7116
7117
|
if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
|
|
7117
7118
|
var oldLogger = getGlobal$1("diag");
|
|
7118
|
-
var newLogger = createLogLevelDiagLogger$1((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel
|
|
7119
|
+
var newLogger = createLogLevelDiagLogger$1((_b = optionsOrLogLevel.logLevel) !== null && _b !== void 0 ? _b : DiagLogLevel.INFO, logger);
|
|
7119
7120
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
7120
7121
|
var stack = (_c = (/* @__PURE__ */ new Error()).stack) !== null && _c !== void 0 ? _c : "<failed to generate stacktrace>";
|
|
7121
7122
|
oldLogger.warn("Current logger will be overwritten from " + stack);
|
|
@@ -7310,17 +7311,17 @@ var ContextAPI$1 = function() {
|
|
|
7310
7311
|
};
|
|
7311
7312
|
return ContextAPI;
|
|
7312
7313
|
}();
|
|
7313
|
-
var TraceFlags
|
|
7314
|
+
var TraceFlags;
|
|
7314
7315
|
(function(TraceFlags) {
|
|
7315
7316
|
/** Represents no flag set. */
|
|
7316
7317
|
TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
|
|
7317
7318
|
/** Bit to represent whether trace is sampled in trace flags. */
|
|
7318
7319
|
TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
|
|
7319
|
-
})(TraceFlags
|
|
7320
|
+
})(TraceFlags || (TraceFlags = {}));
|
|
7320
7321
|
var INVALID_SPAN_CONTEXT$1 = {
|
|
7321
7322
|
traceId: "00000000000000000000000000000000",
|
|
7322
7323
|
spanId: "0000000000000000",
|
|
7323
|
-
traceFlags: TraceFlags
|
|
7324
|
+
traceFlags: TraceFlags.NONE
|
|
7324
7325
|
};
|
|
7325
7326
|
/**
|
|
7326
7327
|
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
|
@@ -7711,7 +7712,7 @@ function getGlobalProvider$2() {
|
|
|
7711
7712
|
var _a17;
|
|
7712
7713
|
return (_a17 = globalThis.AI_SDK_DEFAULT_PROVIDER) != null ? _a17 : gateway$2;
|
|
7713
7714
|
}
|
|
7714
|
-
var VERSION$6 = "5.0.
|
|
7715
|
+
var VERSION$6 = "5.0.282";
|
|
7715
7716
|
var dataContentSchema$1 = zod_v4.z.union([
|
|
7716
7717
|
zod_v4.z.string(),
|
|
7717
7718
|
zod_v4.z.instanceof(Uint8Array),
|
|
@@ -10949,7 +10950,7 @@ var createJsonResponseHandler$1 = (responseSchema) => async ({ response, url, re
|
|
|
10949
10950
|
function withoutTrailingSlash$1(url) {
|
|
10950
10951
|
return url == null ? void 0 : url.replace(/\/$/, "");
|
|
10951
10952
|
}
|
|
10952
|
-
// ../_vendored/ai_v6/dist/dist-
|
|
10953
|
+
// ../_vendored/ai_v6/dist/dist-CFYPWO89.js
|
|
10953
10954
|
function getContext$1() {
|
|
10954
10955
|
return { headers: {} };
|
|
10955
10956
|
}
|
|
@@ -12869,7 +12870,7 @@ async function getVercelRequestId$1() {
|
|
|
12869
12870
|
var _a11;
|
|
12870
12871
|
return (_a11 = getContext$1().headers) == null ? void 0 : _a11["x-vercel-id"];
|
|
12871
12872
|
}
|
|
12872
|
-
var VERSION$4 = "3.0.
|
|
12873
|
+
var VERSION$4 = "3.0.223";
|
|
12873
12874
|
var AI_GATEWAY_PROTOCOL_VERSION$1 = "0.0.1";
|
|
12874
12875
|
function createGatewayProvider(options = {}) {
|
|
12875
12876
|
var _a11, _b11;
|
|
@@ -13073,7 +13074,7 @@ async function getGatewayAuthToken$1(options) {
|
|
|
13073
13074
|
};
|
|
13074
13075
|
}
|
|
13075
13076
|
// ../_vendored/ai_v6/dist/index.js
|
|
13076
|
-
const VERSION$1$1 = "1.
|
|
13077
|
+
const VERSION$1$1 = "1.10.0";
|
|
13077
13078
|
const re = /^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;
|
|
13078
13079
|
/**
|
|
13079
13080
|
* Create a function to test an API version to see if it is compatible with the provided ownVersion.
|
|
@@ -13153,15 +13154,23 @@ const isCompatible = _makeCompatibilityCheck(VERSION$1$1);
|
|
|
13153
13154
|
const major = VERSION$1$1.split(".")[0];
|
|
13154
13155
|
const GLOBAL_OPENTELEMETRY_API_KEY = Symbol.for(`opentelemetry.js.api.${major}`);
|
|
13155
13156
|
const _global = typeof globalThis === "object" ? globalThis : typeof self === "object" ? self : typeof window === "object" ? window : typeof global === "object" ? global : {};
|
|
13157
|
+
function _makeGlobalApi() {
|
|
13158
|
+
return Object.defineProperty({}, "version", {
|
|
13159
|
+
value: VERSION$1$1,
|
|
13160
|
+
enumerable: true,
|
|
13161
|
+
writable: false,
|
|
13162
|
+
configurable: false
|
|
13163
|
+
});
|
|
13164
|
+
}
|
|
13156
13165
|
function registerGlobal(type, instance, diag, allowOverride = false) {
|
|
13157
|
-
var
|
|
13158
|
-
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (
|
|
13166
|
+
var _global$GLOBAL_OPENTE;
|
|
13167
|
+
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY] = (_global$GLOBAL_OPENTE = _global[GLOBAL_OPENTELEMETRY_API_KEY]) !== null && _global$GLOBAL_OPENTE !== void 0 ? _global$GLOBAL_OPENTE : _makeGlobalApi();
|
|
13159
13168
|
if (!allowOverride && api[type]) {
|
|
13160
13169
|
const err = /* @__PURE__ */ new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${type}`);
|
|
13161
13170
|
diag.error(err.stack || err.message);
|
|
13162
13171
|
return false;
|
|
13163
13172
|
}
|
|
13164
|
-
if (api.version !== "1.
|
|
13173
|
+
if (api.version !== "1.10.0") {
|
|
13165
13174
|
const err = /* @__PURE__ */ new Error(`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION$1$1}`);
|
|
13166
13175
|
diag.error(err.stack || err.message);
|
|
13167
13176
|
return false;
|
|
@@ -13170,11 +13179,15 @@ function registerGlobal(type, instance, diag, allowOverride = false) {
|
|
|
13170
13179
|
diag.debug(`@opentelemetry/api: Registered a global for ${type} v${VERSION$1$1}.`);
|
|
13171
13180
|
return true;
|
|
13172
13181
|
}
|
|
13182
|
+
let _compatibleGlobalApi;
|
|
13173
13183
|
function getGlobal(type) {
|
|
13174
|
-
|
|
13175
|
-
|
|
13176
|
-
if (
|
|
13177
|
-
|
|
13184
|
+
const api = _global[GLOBAL_OPENTELEMETRY_API_KEY];
|
|
13185
|
+
if (api == null) return;
|
|
13186
|
+
if (api !== _compatibleGlobalApi) {
|
|
13187
|
+
if (!api.version || !isCompatible(api.version)) return;
|
|
13188
|
+
_compatibleGlobalApi = api;
|
|
13189
|
+
}
|
|
13190
|
+
return api[type];
|
|
13178
13191
|
}
|
|
13179
13192
|
function unregisterGlobal(type, diag) {
|
|
13180
13193
|
diag.debug(`@opentelemetry/api: Unregistering a global for ${type} v${VERSION$1$1}.`);
|
|
@@ -13215,34 +13228,9 @@ function logProxy(funcName, namespace, args) {
|
|
|
13215
13228
|
if (!logger) return;
|
|
13216
13229
|
return logger[funcName](namespace, ...args);
|
|
13217
13230
|
}
|
|
13218
|
-
/**
|
|
13219
|
-
* Defines the available internal logging levels for the diagnostic logger, the numeric values
|
|
13220
|
-
* of the levels are defined to match the original values from the initial LogLevel to avoid
|
|
13221
|
-
* compatibility/migration issues for any implementation that assume the numeric ordering.
|
|
13222
|
-
*/
|
|
13223
|
-
var DiagLogLevel;
|
|
13224
|
-
(function(DiagLogLevel) {
|
|
13225
|
-
/** Diagnostic Logging level setting to disable all logging (except and forced logs) */
|
|
13226
|
-
DiagLogLevel[DiagLogLevel["NONE"] = 0] = "NONE";
|
|
13227
|
-
/** Identifies an error scenario */
|
|
13228
|
-
DiagLogLevel[DiagLogLevel["ERROR"] = 30] = "ERROR";
|
|
13229
|
-
/** Identifies a warning scenario */
|
|
13230
|
-
DiagLogLevel[DiagLogLevel["WARN"] = 50] = "WARN";
|
|
13231
|
-
/** General informational log message */
|
|
13232
|
-
DiagLogLevel[DiagLogLevel["INFO"] = 60] = "INFO";
|
|
13233
|
-
/** General debug log message */
|
|
13234
|
-
DiagLogLevel[DiagLogLevel["DEBUG"] = 70] = "DEBUG";
|
|
13235
|
-
/**
|
|
13236
|
-
* Detailed trace level logging should only be used for development, should only be set
|
|
13237
|
-
* in a development environment.
|
|
13238
|
-
*/
|
|
13239
|
-
DiagLogLevel[DiagLogLevel["VERBOSE"] = 80] = "VERBOSE";
|
|
13240
|
-
/** Used to set the logging level to include all logging */
|
|
13241
|
-
DiagLogLevel[DiagLogLevel["ALL"] = 9999] = "ALL";
|
|
13242
|
-
})(DiagLogLevel || (DiagLogLevel = {}));
|
|
13243
13231
|
function createLogLevelDiagLogger(maxLevel, logger) {
|
|
13244
|
-
if (maxLevel <
|
|
13245
|
-
else if (maxLevel >
|
|
13232
|
+
if (maxLevel < 0) maxLevel = 0;
|
|
13233
|
+
else if (maxLevel > 9999) maxLevel = 9999;
|
|
13246
13234
|
logger = logger || {};
|
|
13247
13235
|
function _filterFunc(funcName, theLevel) {
|
|
13248
13236
|
const theFunc = logger[funcName];
|
|
@@ -13250,11 +13238,11 @@ function createLogLevelDiagLogger(maxLevel, logger) {
|
|
|
13250
13238
|
return function() {};
|
|
13251
13239
|
}
|
|
13252
13240
|
return {
|
|
13253
|
-
error: _filterFunc("error",
|
|
13254
|
-
warn: _filterFunc("warn",
|
|
13255
|
-
info: _filterFunc("info",
|
|
13256
|
-
debug: _filterFunc("debug",
|
|
13257
|
-
verbose: _filterFunc("verbose",
|
|
13241
|
+
error: _filterFunc("error", 30),
|
|
13242
|
+
warn: _filterFunc("warn", 50),
|
|
13243
|
+
info: _filterFunc("info", 60),
|
|
13244
|
+
debug: _filterFunc("debug", 70),
|
|
13245
|
+
verbose: _filterFunc("verbose", 80)
|
|
13258
13246
|
};
|
|
13259
13247
|
}
|
|
13260
13248
|
const API_NAME$2 = "diag";
|
|
@@ -13283,18 +13271,20 @@ var DiagAPI = class DiagAPI {
|
|
|
13283
13271
|
};
|
|
13284
13272
|
}
|
|
13285
13273
|
const self = this;
|
|
13286
|
-
const setLogger = (logger, optionsOrLogLevel = { logLevel:
|
|
13287
|
-
var
|
|
13274
|
+
const setLogger = (logger, optionsOrLogLevel = { logLevel: 60 }) => {
|
|
13275
|
+
var _optionsOrLogLevel$lo;
|
|
13288
13276
|
if (logger === self) {
|
|
13277
|
+
var _err$stack;
|
|
13289
13278
|
const err = /* @__PURE__ */ new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");
|
|
13290
|
-
self.error((
|
|
13279
|
+
self.error((_err$stack = err.stack) !== null && _err$stack !== void 0 ? _err$stack : err.message);
|
|
13291
13280
|
return false;
|
|
13292
13281
|
}
|
|
13293
13282
|
if (typeof optionsOrLogLevel === "number") optionsOrLogLevel = { logLevel: optionsOrLogLevel };
|
|
13294
13283
|
const oldLogger = getGlobal("diag");
|
|
13295
|
-
const newLogger = createLogLevelDiagLogger((
|
|
13284
|
+
const newLogger = createLogLevelDiagLogger((_optionsOrLogLevel$lo = optionsOrLogLevel.logLevel) !== null && _optionsOrLogLevel$lo !== void 0 ? _optionsOrLogLevel$lo : 60, logger);
|
|
13296
13285
|
if (oldLogger && !optionsOrLogLevel.suppressOverrideMessage) {
|
|
13297
|
-
|
|
13286
|
+
var _Error$stack;
|
|
13287
|
+
const stack = (_Error$stack = (/* @__PURE__ */ new Error()).stack) !== null && _Error$stack !== void 0 ? _Error$stack : "<failed to generate stacktrace>";
|
|
13298
13288
|
oldLogger.warn(`Current logger will be overwritten from ${stack}`);
|
|
13299
13289
|
newLogger.warn(`Current logger will overwrite one already registered from ${stack}`);
|
|
13300
13290
|
}
|
|
@@ -13349,6 +13339,194 @@ const ROOT_CONTEXT = new class BaseContext {
|
|
|
13349
13339
|
};
|
|
13350
13340
|
}
|
|
13351
13341
|
}();
|
|
13342
|
+
/**
|
|
13343
|
+
* @since 1.0.0
|
|
13344
|
+
*/
|
|
13345
|
+
const INVALID_SPAN_CONTEXT = {
|
|
13346
|
+
traceId: "00000000000000000000000000000000",
|
|
13347
|
+
spanId: "0000000000000000",
|
|
13348
|
+
traceFlags: 0
|
|
13349
|
+
};
|
|
13350
|
+
/**
|
|
13351
|
+
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
|
13352
|
+
* implementation is available. All operations are no-op including context
|
|
13353
|
+
* propagation.
|
|
13354
|
+
*/
|
|
13355
|
+
var NonRecordingSpan = class {
|
|
13356
|
+
constructor(spanContext = INVALID_SPAN_CONTEXT) {
|
|
13357
|
+
this._spanContext = spanContext;
|
|
13358
|
+
}
|
|
13359
|
+
spanContext() {
|
|
13360
|
+
return this._spanContext;
|
|
13361
|
+
}
|
|
13362
|
+
setAttribute(_key, _value) {
|
|
13363
|
+
return this;
|
|
13364
|
+
}
|
|
13365
|
+
setAttributes(_attributes) {
|
|
13366
|
+
return this;
|
|
13367
|
+
}
|
|
13368
|
+
addEvent(_name, _attributes) {
|
|
13369
|
+
return this;
|
|
13370
|
+
}
|
|
13371
|
+
addLink(_link) {
|
|
13372
|
+
return this;
|
|
13373
|
+
}
|
|
13374
|
+
addLinks(_links) {
|
|
13375
|
+
return this;
|
|
13376
|
+
}
|
|
13377
|
+
setStatus(_status) {
|
|
13378
|
+
return this;
|
|
13379
|
+
}
|
|
13380
|
+
updateName(_name) {
|
|
13381
|
+
return this;
|
|
13382
|
+
}
|
|
13383
|
+
end(_endTime) {}
|
|
13384
|
+
isRecording() {
|
|
13385
|
+
return false;
|
|
13386
|
+
}
|
|
13387
|
+
recordException(_exception, _time) {}
|
|
13388
|
+
};
|
|
13389
|
+
const isHex = new Uint8Array([
|
|
13390
|
+
0,
|
|
13391
|
+
0,
|
|
13392
|
+
0,
|
|
13393
|
+
0,
|
|
13394
|
+
0,
|
|
13395
|
+
0,
|
|
13396
|
+
0,
|
|
13397
|
+
0,
|
|
13398
|
+
0,
|
|
13399
|
+
0,
|
|
13400
|
+
0,
|
|
13401
|
+
0,
|
|
13402
|
+
0,
|
|
13403
|
+
0,
|
|
13404
|
+
0,
|
|
13405
|
+
0,
|
|
13406
|
+
0,
|
|
13407
|
+
0,
|
|
13408
|
+
0,
|
|
13409
|
+
0,
|
|
13410
|
+
0,
|
|
13411
|
+
0,
|
|
13412
|
+
0,
|
|
13413
|
+
0,
|
|
13414
|
+
0,
|
|
13415
|
+
0,
|
|
13416
|
+
0,
|
|
13417
|
+
0,
|
|
13418
|
+
0,
|
|
13419
|
+
0,
|
|
13420
|
+
0,
|
|
13421
|
+
0,
|
|
13422
|
+
0,
|
|
13423
|
+
0,
|
|
13424
|
+
0,
|
|
13425
|
+
0,
|
|
13426
|
+
0,
|
|
13427
|
+
0,
|
|
13428
|
+
0,
|
|
13429
|
+
0,
|
|
13430
|
+
0,
|
|
13431
|
+
0,
|
|
13432
|
+
0,
|
|
13433
|
+
0,
|
|
13434
|
+
0,
|
|
13435
|
+
0,
|
|
13436
|
+
0,
|
|
13437
|
+
0,
|
|
13438
|
+
1,
|
|
13439
|
+
1,
|
|
13440
|
+
1,
|
|
13441
|
+
1,
|
|
13442
|
+
1,
|
|
13443
|
+
1,
|
|
13444
|
+
1,
|
|
13445
|
+
1,
|
|
13446
|
+
1,
|
|
13447
|
+
1,
|
|
13448
|
+
0,
|
|
13449
|
+
0,
|
|
13450
|
+
0,
|
|
13451
|
+
0,
|
|
13452
|
+
0,
|
|
13453
|
+
0,
|
|
13454
|
+
0,
|
|
13455
|
+
1,
|
|
13456
|
+
1,
|
|
13457
|
+
1,
|
|
13458
|
+
1,
|
|
13459
|
+
1,
|
|
13460
|
+
1,
|
|
13461
|
+
0,
|
|
13462
|
+
0,
|
|
13463
|
+
0,
|
|
13464
|
+
0,
|
|
13465
|
+
0,
|
|
13466
|
+
0,
|
|
13467
|
+
0,
|
|
13468
|
+
0,
|
|
13469
|
+
0,
|
|
13470
|
+
0,
|
|
13471
|
+
0,
|
|
13472
|
+
0,
|
|
13473
|
+
0,
|
|
13474
|
+
0,
|
|
13475
|
+
0,
|
|
13476
|
+
0,
|
|
13477
|
+
0,
|
|
13478
|
+
0,
|
|
13479
|
+
0,
|
|
13480
|
+
0,
|
|
13481
|
+
0,
|
|
13482
|
+
0,
|
|
13483
|
+
0,
|
|
13484
|
+
0,
|
|
13485
|
+
0,
|
|
13486
|
+
0,
|
|
13487
|
+
1,
|
|
13488
|
+
1,
|
|
13489
|
+
1,
|
|
13490
|
+
1,
|
|
13491
|
+
1,
|
|
13492
|
+
1
|
|
13493
|
+
]);
|
|
13494
|
+
function isValidHex(id, length) {
|
|
13495
|
+
if (typeof id !== "string" || id.length !== length) return false;
|
|
13496
|
+
let r = 0;
|
|
13497
|
+
for (let i = 0; i < id.length; i += 4) r += (isHex[id.charCodeAt(i)] | 0) + (isHex[id.charCodeAt(i + 1)] | 0) + (isHex[id.charCodeAt(i + 2)] | 0) + (isHex[id.charCodeAt(i + 3)] | 0);
|
|
13498
|
+
return r === length;
|
|
13499
|
+
}
|
|
13500
|
+
/**
|
|
13501
|
+
* @since 1.0.0
|
|
13502
|
+
*/
|
|
13503
|
+
function isValidTraceId(traceId) {
|
|
13504
|
+
return isValidHex(traceId, 32) && traceId !== "00000000000000000000000000000000";
|
|
13505
|
+
}
|
|
13506
|
+
/**
|
|
13507
|
+
* @since 1.0.0
|
|
13508
|
+
*/
|
|
13509
|
+
function isValidSpanId(spanId) {
|
|
13510
|
+
return isValidHex(spanId, 16) && spanId !== "0000000000000000";
|
|
13511
|
+
}
|
|
13512
|
+
/**
|
|
13513
|
+
* Returns true if this {@link SpanContext} is valid.
|
|
13514
|
+
* @return true if this {@link SpanContext} is valid.
|
|
13515
|
+
*
|
|
13516
|
+
* @since 1.0.0
|
|
13517
|
+
*/
|
|
13518
|
+
function isSpanContextValid(spanContext) {
|
|
13519
|
+
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
13520
|
+
}
|
|
13521
|
+
/**
|
|
13522
|
+
* Wrap the given {@link SpanContext} in a new non-recording {@link Span}
|
|
13523
|
+
*
|
|
13524
|
+
* @param spanContext span context to be wrapped
|
|
13525
|
+
* @returns a new non-recording {@link Span} with the provided context
|
|
13526
|
+
*/
|
|
13527
|
+
function wrapSpanContext(spanContext) {
|
|
13528
|
+
return new NonRecordingSpan(spanContext);
|
|
13529
|
+
}
|
|
13352
13530
|
var NoopContextManager = class {
|
|
13353
13531
|
active() {
|
|
13354
13532
|
return ROOT_CONTEXT;
|
|
@@ -13365,9 +13543,14 @@ var NoopContextManager = class {
|
|
|
13365
13543
|
disable() {
|
|
13366
13544
|
return this;
|
|
13367
13545
|
}
|
|
13546
|
+
/** @experimental This API is experimental and may change in minor releases without prior notice. */
|
|
13547
|
+
attach(_context) {
|
|
13548
|
+
return { dispose() {} };
|
|
13549
|
+
}
|
|
13368
13550
|
};
|
|
13369
13551
|
const API_NAME$1 = "context";
|
|
13370
13552
|
const NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
13553
|
+
const NOOP_TOKEN = Object.freeze({ dispose: () => {} });
|
|
13371
13554
|
/**
|
|
13372
13555
|
* Singleton object which represents the entry point to the OpenTelemetry Context API
|
|
13373
13556
|
*
|
|
@@ -13375,7 +13558,9 @@ const NOOP_CONTEXT_MANAGER = new NoopContextManager();
|
|
|
13375
13558
|
*/
|
|
13376
13559
|
var ContextAPI = class ContextAPI {
|
|
13377
13560
|
/** Empty private constructor prevents end users from constructing a new instance of the API */
|
|
13378
|
-
constructor() {
|
|
13561
|
+
constructor() {
|
|
13562
|
+
this._attachUnsupportedWarned = false;
|
|
13563
|
+
}
|
|
13379
13564
|
/** Get the singleton instance of the Context API */
|
|
13380
13565
|
static getInstance() {
|
|
13381
13566
|
if (!this._instance) this._instance = new ContextAPI();
|
|
@@ -13415,6 +13600,37 @@ var ContextAPI = class ContextAPI {
|
|
|
13415
13600
|
bind(context, target) {
|
|
13416
13601
|
return this._getContextManager().bind(context, target);
|
|
13417
13602
|
}
|
|
13603
|
+
/**
|
|
13604
|
+
* Imperatively sets `context` as active, returning a {@link ContextManagementToken} whose
|
|
13605
|
+
* {@link ContextManagementToken.dispose} restores the previous context.
|
|
13606
|
+
*
|
|
13607
|
+
* This is a delicate, low-level API - prefer {@link with}/{@link bind}, which
|
|
13608
|
+
* restore context automatically. Use `attach` only to bridge callback
|
|
13609
|
+
* boundaries that `with` cannot wrap. Call `token.dispose()` when the
|
|
13610
|
+
* operation is done.
|
|
13611
|
+
*
|
|
13612
|
+
* **Caveat for async functions:** If called inside an async function before
|
|
13613
|
+
* the first `await`, the context change may leak into the caller's context
|
|
13614
|
+
* and remain active there. Prefer {@link with} for async code.
|
|
13615
|
+
*
|
|
13616
|
+
* Support is best-effort and varies by the active ContextManager (see
|
|
13617
|
+
* {@link ContextManager.attach}); if it does not implement `attach`, this logs
|
|
13618
|
+
* a warning and returns a no-op token.
|
|
13619
|
+
*
|
|
13620
|
+
* @param context The Context to attach
|
|
13621
|
+
* @returns A {@link ContextManagementToken} whose dispose() restores the previous Context
|
|
13622
|
+
* @since 1.10.0
|
|
13623
|
+
* @experimental This API is experimental and may change in minor releases without prior notice.
|
|
13624
|
+
*/
|
|
13625
|
+
attach(context) {
|
|
13626
|
+
const contextManager = this._getContextManager();
|
|
13627
|
+
if (contextManager.attach) return contextManager.attach(context);
|
|
13628
|
+
if (!this._attachUnsupportedWarned) {
|
|
13629
|
+
this._attachUnsupportedWarned = true;
|
|
13630
|
+
DiagAPI.instance().warn("The current ContextManager does not implement attach(). The context will not be attached. Use a ContextManager that supports attach() (e.g. AsyncLocalStorageContextManager) or use with()/bind() instead.");
|
|
13631
|
+
}
|
|
13632
|
+
return NOOP_TOKEN;
|
|
13633
|
+
}
|
|
13418
13634
|
_getContextManager() {
|
|
13419
13635
|
return getGlobal(API_NAME$1) || NOOP_CONTEXT_MANAGER;
|
|
13420
13636
|
}
|
|
@@ -13425,63 +13641,6 @@ var ContextAPI = class ContextAPI {
|
|
|
13425
13641
|
}
|
|
13426
13642
|
};
|
|
13427
13643
|
/**
|
|
13428
|
-
* @since 1.0.0
|
|
13429
|
-
*/
|
|
13430
|
-
var TraceFlags;
|
|
13431
|
-
(function(TraceFlags) {
|
|
13432
|
-
/** Represents no flag set. */
|
|
13433
|
-
TraceFlags[TraceFlags["NONE"] = 0] = "NONE";
|
|
13434
|
-
/** Bit to represent whether trace is sampled in trace flags. */
|
|
13435
|
-
TraceFlags[TraceFlags["SAMPLED"] = 1] = "SAMPLED";
|
|
13436
|
-
})(TraceFlags || (TraceFlags = {}));
|
|
13437
|
-
/**
|
|
13438
|
-
* @since 1.0.0
|
|
13439
|
-
*/
|
|
13440
|
-
const INVALID_SPAN_CONTEXT = {
|
|
13441
|
-
traceId: "00000000000000000000000000000000",
|
|
13442
|
-
spanId: "0000000000000000",
|
|
13443
|
-
traceFlags: TraceFlags.NONE
|
|
13444
|
-
};
|
|
13445
|
-
/**
|
|
13446
|
-
* The NonRecordingSpan is the default {@link Span} that is used when no Span
|
|
13447
|
-
* implementation is available. All operations are no-op including context
|
|
13448
|
-
* propagation.
|
|
13449
|
-
*/
|
|
13450
|
-
var NonRecordingSpan = class {
|
|
13451
|
-
constructor(spanContext = INVALID_SPAN_CONTEXT) {
|
|
13452
|
-
this._spanContext = spanContext;
|
|
13453
|
-
}
|
|
13454
|
-
spanContext() {
|
|
13455
|
-
return this._spanContext;
|
|
13456
|
-
}
|
|
13457
|
-
setAttribute(_key, _value) {
|
|
13458
|
-
return this;
|
|
13459
|
-
}
|
|
13460
|
-
setAttributes(_attributes) {
|
|
13461
|
-
return this;
|
|
13462
|
-
}
|
|
13463
|
-
addEvent(_name, _attributes) {
|
|
13464
|
-
return this;
|
|
13465
|
-
}
|
|
13466
|
-
addLink(_link) {
|
|
13467
|
-
return this;
|
|
13468
|
-
}
|
|
13469
|
-
addLinks(_links) {
|
|
13470
|
-
return this;
|
|
13471
|
-
}
|
|
13472
|
-
setStatus(_status) {
|
|
13473
|
-
return this;
|
|
13474
|
-
}
|
|
13475
|
-
updateName(_name) {
|
|
13476
|
-
return this;
|
|
13477
|
-
}
|
|
13478
|
-
end(_endTime) {}
|
|
13479
|
-
isRecording() {
|
|
13480
|
-
return false;
|
|
13481
|
-
}
|
|
13482
|
-
recordException(_exception, _time) {}
|
|
13483
|
-
};
|
|
13484
|
-
/**
|
|
13485
13644
|
* span key
|
|
13486
13645
|
*/
|
|
13487
13646
|
const SPAN_KEY = createContextKey("OpenTelemetry Context Key SPAN");
|
|
@@ -13532,149 +13691,8 @@ function setSpanContext(context, spanContext) {
|
|
|
13532
13691
|
* @param context context to get values from
|
|
13533
13692
|
*/
|
|
13534
13693
|
function getSpanContext(context) {
|
|
13535
|
-
var
|
|
13536
|
-
return (
|
|
13537
|
-
}
|
|
13538
|
-
const isHex = new Uint8Array([
|
|
13539
|
-
0,
|
|
13540
|
-
0,
|
|
13541
|
-
0,
|
|
13542
|
-
0,
|
|
13543
|
-
0,
|
|
13544
|
-
0,
|
|
13545
|
-
0,
|
|
13546
|
-
0,
|
|
13547
|
-
0,
|
|
13548
|
-
0,
|
|
13549
|
-
0,
|
|
13550
|
-
0,
|
|
13551
|
-
0,
|
|
13552
|
-
0,
|
|
13553
|
-
0,
|
|
13554
|
-
0,
|
|
13555
|
-
0,
|
|
13556
|
-
0,
|
|
13557
|
-
0,
|
|
13558
|
-
0,
|
|
13559
|
-
0,
|
|
13560
|
-
0,
|
|
13561
|
-
0,
|
|
13562
|
-
0,
|
|
13563
|
-
0,
|
|
13564
|
-
0,
|
|
13565
|
-
0,
|
|
13566
|
-
0,
|
|
13567
|
-
0,
|
|
13568
|
-
0,
|
|
13569
|
-
0,
|
|
13570
|
-
0,
|
|
13571
|
-
0,
|
|
13572
|
-
0,
|
|
13573
|
-
0,
|
|
13574
|
-
0,
|
|
13575
|
-
0,
|
|
13576
|
-
0,
|
|
13577
|
-
0,
|
|
13578
|
-
0,
|
|
13579
|
-
0,
|
|
13580
|
-
0,
|
|
13581
|
-
0,
|
|
13582
|
-
0,
|
|
13583
|
-
0,
|
|
13584
|
-
0,
|
|
13585
|
-
0,
|
|
13586
|
-
0,
|
|
13587
|
-
1,
|
|
13588
|
-
1,
|
|
13589
|
-
1,
|
|
13590
|
-
1,
|
|
13591
|
-
1,
|
|
13592
|
-
1,
|
|
13593
|
-
1,
|
|
13594
|
-
1,
|
|
13595
|
-
1,
|
|
13596
|
-
1,
|
|
13597
|
-
0,
|
|
13598
|
-
0,
|
|
13599
|
-
0,
|
|
13600
|
-
0,
|
|
13601
|
-
0,
|
|
13602
|
-
0,
|
|
13603
|
-
0,
|
|
13604
|
-
1,
|
|
13605
|
-
1,
|
|
13606
|
-
1,
|
|
13607
|
-
1,
|
|
13608
|
-
1,
|
|
13609
|
-
1,
|
|
13610
|
-
0,
|
|
13611
|
-
0,
|
|
13612
|
-
0,
|
|
13613
|
-
0,
|
|
13614
|
-
0,
|
|
13615
|
-
0,
|
|
13616
|
-
0,
|
|
13617
|
-
0,
|
|
13618
|
-
0,
|
|
13619
|
-
0,
|
|
13620
|
-
0,
|
|
13621
|
-
0,
|
|
13622
|
-
0,
|
|
13623
|
-
0,
|
|
13624
|
-
0,
|
|
13625
|
-
0,
|
|
13626
|
-
0,
|
|
13627
|
-
0,
|
|
13628
|
-
0,
|
|
13629
|
-
0,
|
|
13630
|
-
0,
|
|
13631
|
-
0,
|
|
13632
|
-
0,
|
|
13633
|
-
0,
|
|
13634
|
-
0,
|
|
13635
|
-
0,
|
|
13636
|
-
1,
|
|
13637
|
-
1,
|
|
13638
|
-
1,
|
|
13639
|
-
1,
|
|
13640
|
-
1,
|
|
13641
|
-
1
|
|
13642
|
-
]);
|
|
13643
|
-
function isValidHex(id, length) {
|
|
13644
|
-
if (typeof id !== "string" || id.length !== length) return false;
|
|
13645
|
-
let r = 0;
|
|
13646
|
-
for (let i = 0; i < id.length; i += 4) r += (isHex[id.charCodeAt(i)] | 0) + (isHex[id.charCodeAt(i + 1)] | 0) + (isHex[id.charCodeAt(i + 2)] | 0) + (isHex[id.charCodeAt(i + 3)] | 0);
|
|
13647
|
-
return r === length;
|
|
13648
|
-
}
|
|
13649
|
-
/**
|
|
13650
|
-
* @since 1.0.0
|
|
13651
|
-
*/
|
|
13652
|
-
function isValidTraceId(traceId) {
|
|
13653
|
-
return isValidHex(traceId, 32) && traceId !== "00000000000000000000000000000000";
|
|
13654
|
-
}
|
|
13655
|
-
/**
|
|
13656
|
-
* @since 1.0.0
|
|
13657
|
-
*/
|
|
13658
|
-
function isValidSpanId(spanId) {
|
|
13659
|
-
return isValidHex(spanId, 16) && spanId !== "0000000000000000";
|
|
13660
|
-
}
|
|
13661
|
-
/**
|
|
13662
|
-
* Returns true if this {@link SpanContext} is valid.
|
|
13663
|
-
* @return true if this {@link SpanContext} is valid.
|
|
13664
|
-
*
|
|
13665
|
-
* @since 1.0.0
|
|
13666
|
-
*/
|
|
13667
|
-
function isSpanContextValid(spanContext) {
|
|
13668
|
-
return isValidTraceId(spanContext.traceId) && isValidSpanId(spanContext.spanId);
|
|
13669
|
-
}
|
|
13670
|
-
/**
|
|
13671
|
-
* Wrap the given {@link SpanContext} in a new non-recording {@link Span}
|
|
13672
|
-
*
|
|
13673
|
-
* @param spanContext span context to be wrapped
|
|
13674
|
-
* @returns a new non-recording {@link Span} with the provided context
|
|
13675
|
-
*/
|
|
13676
|
-
function wrapSpanContext(spanContext) {
|
|
13677
|
-
return new NonRecordingSpan(spanContext);
|
|
13694
|
+
var _getSpan;
|
|
13695
|
+
return (_getSpan = getSpan(context)) === null || _getSpan === void 0 ? void 0 : _getSpan.spanContext();
|
|
13678
13696
|
}
|
|
13679
13697
|
const contextApi = ContextAPI.getInstance();
|
|
13680
13698
|
/**
|
|
@@ -13688,6 +13706,7 @@ var NoopTracer = class {
|
|
|
13688
13706
|
else return new NonRecordingSpan();
|
|
13689
13707
|
}
|
|
13690
13708
|
startActiveSpan(name, arg2, arg3, arg4) {
|
|
13709
|
+
var _ctx;
|
|
13691
13710
|
let opts;
|
|
13692
13711
|
let ctx;
|
|
13693
13712
|
let fn;
|
|
@@ -13701,7 +13720,7 @@ var NoopTracer = class {
|
|
|
13701
13720
|
ctx = arg3;
|
|
13702
13721
|
fn = arg4;
|
|
13703
13722
|
}
|
|
13704
|
-
const parentContext = ctx !== null &&
|
|
13723
|
+
const parentContext = (_ctx = ctx) !== null && _ctx !== void 0 ? _ctx : contextApi.active();
|
|
13705
13724
|
const span = this.startSpan(name, opts, parentContext);
|
|
13706
13725
|
const contextWithSpanSet = setSpan(parentContext, span);
|
|
13707
13726
|
return contextApi.with(contextWithSpanSet, fn, void 0, span);
|
|
@@ -13743,6 +13762,27 @@ var ProxyTracer = class {
|
|
|
13743
13762
|
}
|
|
13744
13763
|
};
|
|
13745
13764
|
/**
|
|
13765
|
+
* An enumeration of status codes.
|
|
13766
|
+
*
|
|
13767
|
+
* @since 1.0.0
|
|
13768
|
+
*/
|
|
13769
|
+
let SpanStatusCode = /* @__PURE__ */ function(SpanStatusCode) {
|
|
13770
|
+
/**
|
|
13771
|
+
* The default status.
|
|
13772
|
+
*/
|
|
13773
|
+
SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
|
|
13774
|
+
/**
|
|
13775
|
+
* The operation has been validated by an Application developer or
|
|
13776
|
+
* Operator to have completed successfully.
|
|
13777
|
+
*/
|
|
13778
|
+
SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
|
|
13779
|
+
/**
|
|
13780
|
+
* The operation contains an error.
|
|
13781
|
+
*/
|
|
13782
|
+
SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
|
|
13783
|
+
return SpanStatusCode;
|
|
13784
|
+
}({});
|
|
13785
|
+
/**
|
|
13746
13786
|
* An implementation of the {@link TracerProvider} which returns an impotent
|
|
13747
13787
|
* Tracer for all calls to `getTracer`.
|
|
13748
13788
|
*
|
|
@@ -13770,12 +13810,12 @@ var ProxyTracerProvider = class {
|
|
|
13770
13810
|
* Get a {@link ProxyTracer}
|
|
13771
13811
|
*/
|
|
13772
13812
|
getTracer(name, version, options) {
|
|
13773
|
-
var
|
|
13774
|
-
return (
|
|
13813
|
+
var _this$getDelegateTrac;
|
|
13814
|
+
return (_this$getDelegateTrac = this.getDelegateTracer(name, version, options)) !== null && _this$getDelegateTrac !== void 0 ? _this$getDelegateTrac : new ProxyTracer(this, name, version, options);
|
|
13775
13815
|
}
|
|
13776
13816
|
getDelegate() {
|
|
13777
|
-
var
|
|
13778
|
-
return (
|
|
13817
|
+
var _this$_delegate;
|
|
13818
|
+
return (_this$_delegate = this._delegate) !== null && _this$_delegate !== void 0 ? _this$_delegate : NOOP_TRACER_PROVIDER;
|
|
13779
13819
|
}
|
|
13780
13820
|
/**
|
|
13781
13821
|
* Set the delegate tracer provider
|
|
@@ -13784,32 +13824,11 @@ var ProxyTracerProvider = class {
|
|
|
13784
13824
|
this._delegate = delegate;
|
|
13785
13825
|
}
|
|
13786
13826
|
getDelegateTracer(name, version, options) {
|
|
13787
|
-
var
|
|
13788
|
-
return (
|
|
13827
|
+
var _this$_delegate2;
|
|
13828
|
+
return (_this$_delegate2 = this._delegate) === null || _this$_delegate2 === void 0 ? void 0 : _this$_delegate2.getTracer(name, version, options);
|
|
13789
13829
|
}
|
|
13790
13830
|
};
|
|
13791
13831
|
/**
|
|
13792
|
-
* An enumeration of status codes.
|
|
13793
|
-
*
|
|
13794
|
-
* @since 1.0.0
|
|
13795
|
-
*/
|
|
13796
|
-
var SpanStatusCode;
|
|
13797
|
-
(function(SpanStatusCode) {
|
|
13798
|
-
/**
|
|
13799
|
-
* The default status.
|
|
13800
|
-
*/
|
|
13801
|
-
SpanStatusCode[SpanStatusCode["UNSET"] = 0] = "UNSET";
|
|
13802
|
-
/**
|
|
13803
|
-
* The operation has been validated by an Application developer or
|
|
13804
|
-
* Operator to have completed successfully.
|
|
13805
|
-
*/
|
|
13806
|
-
SpanStatusCode[SpanStatusCode["OK"] = 1] = "OK";
|
|
13807
|
-
/**
|
|
13808
|
-
* The operation contains an error.
|
|
13809
|
-
*/
|
|
13810
|
-
SpanStatusCode[SpanStatusCode["ERROR"] = 2] = "ERROR";
|
|
13811
|
-
})(SpanStatusCode || (SpanStatusCode = {}));
|
|
13812
|
-
/**
|
|
13813
13832
|
* Entrypoint for context API
|
|
13814
13833
|
* @since 1.0.0
|
|
13815
13834
|
*/
|
|
@@ -14027,7 +14046,7 @@ function getTotalTimeoutMs(timeout) {
|
|
|
14027
14046
|
if (typeof timeout === "number") return timeout;
|
|
14028
14047
|
return timeout.totalMs;
|
|
14029
14048
|
}
|
|
14030
|
-
var VERSION$3 = "6.0.
|
|
14049
|
+
var VERSION$3 = "6.0.317";
|
|
14031
14050
|
var dataContentSchema = zod_v4.z.union([
|
|
14032
14051
|
zod_v4.z.string(),
|
|
14033
14052
|
zod_v4.z.instanceof(Uint8Array),
|
|
@@ -15223,7 +15242,7 @@ createIdGenerator$1({
|
|
|
15223
15242
|
prefix: "aiobj",
|
|
15224
15243
|
size: 24
|
|
15225
15244
|
});
|
|
15226
|
-
// ../_vendored/ai_v7/dist/dist-
|
|
15245
|
+
// ../_vendored/ai_v7/dist/dist-5fMURLh0.js
|
|
15227
15246
|
/**
|
|
15228
15247
|
* Symbol used for identifying AI SDK Error instances.
|
|
15229
15248
|
* Enables checking if an error is an instance of AISDKError across package versions.
|
|
@@ -15810,6 +15829,7 @@ function convertBase64ToUint8Array(base64String) {
|
|
|
15810
15829
|
return Uint8Array.from(latin1string, (byte) => byte.codePointAt(0));
|
|
15811
15830
|
}
|
|
15812
15831
|
function convertUint8ArrayToBase64(array) {
|
|
15832
|
+
if (typeof globalThis.Buffer?.from === "function") return globalThis.Buffer.from(array.buffer, array.byteOffset, array.byteLength).toString("base64");
|
|
15813
15833
|
const chunks = [];
|
|
15814
15834
|
const chunkSize = 4096;
|
|
15815
15835
|
for (let i = 0; i < array.length; i += chunkSize) chunks.push(String.fromCodePoint(...array.subarray(i, i + chunkSize)));
|
|
@@ -15892,7 +15912,7 @@ function handleFetchError({ error, url, requestBodyValues }) {
|
|
|
15892
15912
|
}
|
|
15893
15913
|
return error;
|
|
15894
15914
|
}
|
|
15895
|
-
const VERSION$2 = "5.0.
|
|
15915
|
+
const VERSION$2 = "5.0.70";
|
|
15896
15916
|
/**
|
|
15897
15917
|
* Normalizes different header inputs into a plain record with lower-case keys.
|
|
15898
15918
|
* Entries with `undefined` or `null` values are removed.
|
|
@@ -18383,7 +18403,7 @@ function isSegment(value) {
|
|
|
18383
18403
|
function withoutTrailingSlash(url) {
|
|
18384
18404
|
return url?.replace(/\/$/, "");
|
|
18385
18405
|
}
|
|
18386
|
-
// ../_vendored/ai_v7/dist/dist-
|
|
18406
|
+
// ../_vendored/ai_v7/dist/dist-DFcOzoAh.js
|
|
18387
18407
|
/**
|
|
18388
18408
|
* Symbol used to define custom serialization for user-defined class instances.
|
|
18389
18409
|
* The static method should accept an instance and return serializable data.
|
|
@@ -21559,7 +21579,7 @@ const gatewayTools = {
|
|
|
21559
21579
|
async function getVercelRequestId() {
|
|
21560
21580
|
return getContext().headers?.["x-vercel-id"];
|
|
21561
21581
|
}
|
|
21562
|
-
const VERSION$1 = "4.0.
|
|
21582
|
+
const VERSION$1 = "4.0.128";
|
|
21563
21583
|
const AI_GATEWAY_PROTOCOL_VERSION = "0.0.1";
|
|
21564
21584
|
/** Response shape of `POST /v1/realtime/client-secrets`. `expiresAt` is epoch seconds. */
|
|
21565
21585
|
const gatewayClientSecretResponseSchema = lazySchema(() => zodSchema(z$5.object({
|
|
@@ -22351,310 +22371,7 @@ function resolveEmbeddingModel(model) {
|
|
|
22351
22371
|
function getGlobalProvider() {
|
|
22352
22372
|
return asProviderV4(globalThis.AI_SDK_DEFAULT_PROVIDER ?? gateway);
|
|
22353
22373
|
}
|
|
22354
|
-
const VERSION = "7.0.
|
|
22355
|
-
const z$4 = {
|
|
22356
|
-
array: zod_v4.array,
|
|
22357
|
-
boolean: zod_v4.boolean,
|
|
22358
|
-
custom: zod_v4.custom,
|
|
22359
|
-
discriminatedUnion: zod_v4.discriminatedUnion,
|
|
22360
|
-
enum: zod_v4.enum,
|
|
22361
|
-
instanceof: zod_v4.instanceof,
|
|
22362
|
-
lazy: zod_v4.lazy,
|
|
22363
|
-
literal: zod_v4.literal,
|
|
22364
|
-
looseObject: zod_v4.looseObject,
|
|
22365
|
-
never: zod_v4.never,
|
|
22366
|
-
null: zod_v4.null,
|
|
22367
|
-
number: zod_v4.number,
|
|
22368
|
-
object: zod_v4.object,
|
|
22369
|
-
record: zod_v4.record,
|
|
22370
|
-
string: zod_v4.string,
|
|
22371
|
-
union: zod_v4.union,
|
|
22372
|
-
unknown: zod_v4.unknown
|
|
22373
|
-
};
|
|
22374
|
-
const jsonValueSchema = z$4.lazy(() => z$4.union([
|
|
22375
|
-
z$4.null(),
|
|
22376
|
-
z$4.string(),
|
|
22377
|
-
z$4.number(),
|
|
22378
|
-
z$4.boolean(),
|
|
22379
|
-
z$4.record(z$4.string(), jsonValueSchema.optional()),
|
|
22380
|
-
z$4.array(jsonValueSchema)
|
|
22381
|
-
]));
|
|
22382
|
-
const providerMetadataSchema = z$4.record(z$4.string(), z$4.record(z$4.string(), jsonValueSchema.optional()));
|
|
22383
|
-
const fileInlineDataSchema = z$4.union([
|
|
22384
|
-
z$4.string(),
|
|
22385
|
-
z$4.instanceof(Uint8Array),
|
|
22386
|
-
z$4.instanceof(ArrayBuffer),
|
|
22387
|
-
z$4.custom(isBuffer, { message: "Must be a Buffer" })
|
|
22388
|
-
]);
|
|
22389
|
-
const providerReferenceSchema$1 = z$4.record(z$4.string(), z$4.string());
|
|
22390
|
-
/**
|
|
22391
|
-
* @internal
|
|
22392
|
-
*/
|
|
22393
|
-
const textPartSchema = z$4.object({
|
|
22394
|
-
type: z$4.literal("text"),
|
|
22395
|
-
text: z$4.string(),
|
|
22396
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22397
|
-
});
|
|
22398
|
-
/**
|
|
22399
|
-
* @internal
|
|
22400
|
-
* @deprecated Use `filePartSchema` with `mediaType: 'image'` instead:
|
|
22401
|
-
* `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
|
|
22402
|
-
*/
|
|
22403
|
-
const imagePartSchema = z$4.object({
|
|
22404
|
-
type: z$4.literal("image"),
|
|
22405
|
-
image: z$4.union([
|
|
22406
|
-
fileInlineDataSchema,
|
|
22407
|
-
z$4.instanceof(URL),
|
|
22408
|
-
providerReferenceSchema$1
|
|
22409
|
-
]),
|
|
22410
|
-
mediaType: z$4.string().optional(),
|
|
22411
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22412
|
-
});
|
|
22413
|
-
const taggedFileDataSchema = z$4.discriminatedUnion("type", [
|
|
22414
|
-
z$4.object({
|
|
22415
|
-
type: z$4.literal("data"),
|
|
22416
|
-
data: fileInlineDataSchema
|
|
22417
|
-
}),
|
|
22418
|
-
z$4.object({
|
|
22419
|
-
type: z$4.literal("url"),
|
|
22420
|
-
url: z$4.instanceof(URL)
|
|
22421
|
-
}),
|
|
22422
|
-
z$4.object({
|
|
22423
|
-
type: z$4.literal("reference"),
|
|
22424
|
-
reference: providerReferenceSchema$1
|
|
22425
|
-
}),
|
|
22426
|
-
z$4.object({
|
|
22427
|
-
type: z$4.literal("text"),
|
|
22428
|
-
text: z$4.string()
|
|
22429
|
-
})
|
|
22430
|
-
]);
|
|
22431
|
-
const taggedReasoningFileDataSchema = z$4.discriminatedUnion("type", [z$4.object({
|
|
22432
|
-
type: z$4.literal("data"),
|
|
22433
|
-
data: fileInlineDataSchema
|
|
22434
|
-
}), z$4.object({
|
|
22435
|
-
type: z$4.literal("url"),
|
|
22436
|
-
url: z$4.instanceof(URL)
|
|
22437
|
-
})]);
|
|
22438
|
-
/**
|
|
22439
|
-
* @internal
|
|
22440
|
-
*/
|
|
22441
|
-
const filePartSchema = z$4.object({
|
|
22442
|
-
type: z$4.literal("file"),
|
|
22443
|
-
data: z$4.union([
|
|
22444
|
-
taggedFileDataSchema,
|
|
22445
|
-
fileInlineDataSchema,
|
|
22446
|
-
z$4.instanceof(URL),
|
|
22447
|
-
providerReferenceSchema$1
|
|
22448
|
-
]),
|
|
22449
|
-
filename: z$4.string().optional(),
|
|
22450
|
-
mediaType: z$4.string(),
|
|
22451
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22452
|
-
});
|
|
22453
|
-
/**
|
|
22454
|
-
* @internal
|
|
22455
|
-
*/
|
|
22456
|
-
const reasoningPartSchema = z$4.object({
|
|
22457
|
-
type: z$4.literal("reasoning"),
|
|
22458
|
-
text: z$4.string(),
|
|
22459
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22460
|
-
});
|
|
22461
|
-
/**
|
|
22462
|
-
* @internal
|
|
22463
|
-
*/
|
|
22464
|
-
const customPartSchema = z$4.object({
|
|
22465
|
-
type: z$4.literal("custom"),
|
|
22466
|
-
kind: z$4.string().transform((value) => value),
|
|
22467
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22468
|
-
});
|
|
22469
|
-
/**
|
|
22470
|
-
* @internal
|
|
22471
|
-
*/
|
|
22472
|
-
const reasoningFilePartSchema = z$4.object({
|
|
22473
|
-
type: z$4.literal("reasoning-file"),
|
|
22474
|
-
data: z$4.union([
|
|
22475
|
-
taggedReasoningFileDataSchema,
|
|
22476
|
-
fileInlineDataSchema,
|
|
22477
|
-
z$4.instanceof(URL)
|
|
22478
|
-
]),
|
|
22479
|
-
mediaType: z$4.string(),
|
|
22480
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22481
|
-
});
|
|
22482
|
-
/**
|
|
22483
|
-
* @internal
|
|
22484
|
-
*/
|
|
22485
|
-
const toolCallPartSchema = z$4.object({
|
|
22486
|
-
type: z$4.literal("tool-call"),
|
|
22487
|
-
toolCallId: z$4.string(),
|
|
22488
|
-
toolName: z$4.string(),
|
|
22489
|
-
input: z$4.unknown(),
|
|
22490
|
-
providerOptions: providerMetadataSchema.optional(),
|
|
22491
|
-
providerExecuted: z$4.boolean().optional()
|
|
22492
|
-
});
|
|
22493
|
-
/**
|
|
22494
|
-
* @internal
|
|
22495
|
-
*/
|
|
22496
|
-
const outputSchema = z$4.discriminatedUnion("type", [
|
|
22497
|
-
z$4.object({
|
|
22498
|
-
type: z$4.literal("text"),
|
|
22499
|
-
value: z$4.string(),
|
|
22500
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22501
|
-
}),
|
|
22502
|
-
z$4.object({
|
|
22503
|
-
type: z$4.literal("json"),
|
|
22504
|
-
value: jsonValueSchema,
|
|
22505
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22506
|
-
}),
|
|
22507
|
-
z$4.object({
|
|
22508
|
-
type: z$4.literal("execution-denied"),
|
|
22509
|
-
reason: z$4.string().optional(),
|
|
22510
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22511
|
-
}),
|
|
22512
|
-
z$4.object({
|
|
22513
|
-
type: z$4.literal("error-text"),
|
|
22514
|
-
value: z$4.string(),
|
|
22515
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22516
|
-
}),
|
|
22517
|
-
z$4.object({
|
|
22518
|
-
type: z$4.literal("error-json"),
|
|
22519
|
-
value: jsonValueSchema,
|
|
22520
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22521
|
-
}),
|
|
22522
|
-
z$4.object({
|
|
22523
|
-
type: z$4.literal("content"),
|
|
22524
|
-
value: z$4.array(z$4.union([
|
|
22525
|
-
z$4.object({
|
|
22526
|
-
type: z$4.literal("text"),
|
|
22527
|
-
text: z$4.string(),
|
|
22528
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22529
|
-
}),
|
|
22530
|
-
z$4.object({
|
|
22531
|
-
type: z$4.literal("file"),
|
|
22532
|
-
data: taggedFileDataSchema,
|
|
22533
|
-
mediaType: z$4.string(),
|
|
22534
|
-
filename: z$4.string().optional(),
|
|
22535
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22536
|
-
}),
|
|
22537
|
-
z$4.object({
|
|
22538
|
-
type: z$4.literal("file-data"),
|
|
22539
|
-
data: z$4.string(),
|
|
22540
|
-
mediaType: z$4.string(),
|
|
22541
|
-
filename: z$4.string().optional(),
|
|
22542
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22543
|
-
}),
|
|
22544
|
-
z$4.object({
|
|
22545
|
-
type: z$4.literal("file-url"),
|
|
22546
|
-
url: z$4.string(),
|
|
22547
|
-
mediaType: z$4.string().optional(),
|
|
22548
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22549
|
-
}),
|
|
22550
|
-
z$4.object({
|
|
22551
|
-
type: z$4.literal("file-id"),
|
|
22552
|
-
fileId: z$4.union([z$4.string(), z$4.record(z$4.string(), z$4.string())]),
|
|
22553
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22554
|
-
}),
|
|
22555
|
-
z$4.object({
|
|
22556
|
-
type: z$4.literal("file-reference"),
|
|
22557
|
-
providerReference: z$4.record(z$4.string(), z$4.string()),
|
|
22558
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22559
|
-
}),
|
|
22560
|
-
z$4.object({
|
|
22561
|
-
type: z$4.literal("image-data"),
|
|
22562
|
-
data: z$4.string(),
|
|
22563
|
-
mediaType: z$4.string(),
|
|
22564
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22565
|
-
}),
|
|
22566
|
-
z$4.object({
|
|
22567
|
-
type: z$4.literal("image-url"),
|
|
22568
|
-
url: z$4.string(),
|
|
22569
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22570
|
-
}),
|
|
22571
|
-
z$4.object({
|
|
22572
|
-
type: z$4.literal("image-file-id"),
|
|
22573
|
-
fileId: z$4.union([z$4.string(), z$4.record(z$4.string(), z$4.string())]),
|
|
22574
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22575
|
-
}),
|
|
22576
|
-
z$4.object({
|
|
22577
|
-
type: z$4.literal("image-file-reference"),
|
|
22578
|
-
providerReference: z$4.record(z$4.string(), z$4.string()),
|
|
22579
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22580
|
-
}),
|
|
22581
|
-
z$4.object({
|
|
22582
|
-
type: z$4.literal("custom"),
|
|
22583
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22584
|
-
})
|
|
22585
|
-
]))
|
|
22586
|
-
})
|
|
22587
|
-
]);
|
|
22588
|
-
/**
|
|
22589
|
-
* @internal
|
|
22590
|
-
*/
|
|
22591
|
-
const toolResultPartSchema = z$4.object({
|
|
22592
|
-
type: z$4.literal("tool-result"),
|
|
22593
|
-
toolCallId: z$4.string(),
|
|
22594
|
-
toolName: z$4.string(),
|
|
22595
|
-
output: outputSchema,
|
|
22596
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22597
|
-
});
|
|
22598
|
-
/**
|
|
22599
|
-
* @internal
|
|
22600
|
-
*/
|
|
22601
|
-
const toolApprovalRequestSchema = z$4.object({
|
|
22602
|
-
type: z$4.literal("tool-approval-request"),
|
|
22603
|
-
approvalId: z$4.string(),
|
|
22604
|
-
toolCallId: z$4.string(),
|
|
22605
|
-
reason: z$4.string().optional(),
|
|
22606
|
-
isAutomatic: z$4.boolean().optional(),
|
|
22607
|
-
signature: z$4.string().optional(),
|
|
22608
|
-
inputSchemaInput: z$4.unknown().optional()
|
|
22609
|
-
});
|
|
22610
|
-
/**
|
|
22611
|
-
* @internal
|
|
22612
|
-
*/
|
|
22613
|
-
const toolApprovalResponseSchema = z$4.object({
|
|
22614
|
-
type: z$4.literal("tool-approval-response"),
|
|
22615
|
-
approvalId: z$4.string(),
|
|
22616
|
-
approved: z$4.boolean(),
|
|
22617
|
-
reason: z$4.string().optional()
|
|
22618
|
-
});
|
|
22619
|
-
const systemModelMessageSchema = z$4.object({
|
|
22620
|
-
role: z$4.literal("system"),
|
|
22621
|
-
content: z$4.string(),
|
|
22622
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22623
|
-
});
|
|
22624
|
-
const userModelMessageSchema = z$4.object({
|
|
22625
|
-
role: z$4.literal("user"),
|
|
22626
|
-
content: z$4.union([z$4.string(), z$4.array(z$4.union([
|
|
22627
|
-
textPartSchema,
|
|
22628
|
-
imagePartSchema,
|
|
22629
|
-
filePartSchema
|
|
22630
|
-
]))]),
|
|
22631
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22632
|
-
});
|
|
22633
|
-
const assistantModelMessageSchema = z$4.object({
|
|
22634
|
-
role: z$4.literal("assistant"),
|
|
22635
|
-
content: z$4.union([z$4.string(), z$4.array(z$4.union([
|
|
22636
|
-
textPartSchema,
|
|
22637
|
-
customPartSchema,
|
|
22638
|
-
filePartSchema,
|
|
22639
|
-
reasoningPartSchema,
|
|
22640
|
-
reasoningFilePartSchema,
|
|
22641
|
-
toolCallPartSchema,
|
|
22642
|
-
toolResultPartSchema,
|
|
22643
|
-
toolApprovalRequestSchema
|
|
22644
|
-
]))]),
|
|
22645
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22646
|
-
});
|
|
22647
|
-
const toolModelMessageSchema = z$4.object({
|
|
22648
|
-
role: z$4.literal("tool"),
|
|
22649
|
-
content: z$4.array(z$4.union([toolResultPartSchema, toolApprovalResponseSchema])),
|
|
22650
|
-
providerOptions: providerMetadataSchema.optional()
|
|
22651
|
-
});
|
|
22652
|
-
z$4.union([
|
|
22653
|
-
systemModelMessageSchema,
|
|
22654
|
-
userModelMessageSchema,
|
|
22655
|
-
assistantModelMessageSchema,
|
|
22656
|
-
toolModelMessageSchema
|
|
22657
|
-
]);
|
|
22374
|
+
const VERSION = "7.0.155";
|
|
22658
22375
|
/**
|
|
22659
22376
|
* Reads a property by an untrusted key, ignoring inherited prototype members.
|
|
22660
22377
|
*
|
|
@@ -22900,7 +22617,8 @@ function augmentEvent(event, telemetry, filterContext = false) {
|
|
|
22900
22617
|
const augmentedEvent = Object.assign(Object.create(Object.getPrototypeOf(event)), event, {
|
|
22901
22618
|
recordInputs: telemetry.recordInputs,
|
|
22902
22619
|
recordOutputs: telemetry.recordOutputs,
|
|
22903
|
-
functionId: telemetry.functionId
|
|
22620
|
+
functionId: telemetry.functionId,
|
|
22621
|
+
aiVersion: VERSION
|
|
22904
22622
|
});
|
|
22905
22623
|
if (filterContext && event != null && typeof event === "object" && "runtimeContext" in event) augmentedEvent.runtimeContext = filterIncludedContext({
|
|
22906
22624
|
context: event.runtimeContext,
|
|
@@ -22977,6 +22695,7 @@ function createTelemetryDispatcher({ telemetry }) {
|
|
|
22977
22695
|
onToolExecutionStart: mergeTelemetryCallback("onToolExecutionStart"),
|
|
22978
22696
|
onToolExecutionEnd: mergeTelemetryCallback("onToolExecutionEnd"),
|
|
22979
22697
|
onStepEnd: onStepEnd == null && onStepFinish == null ? void 0 : mergeCallbacks(onStepEnd, onStepFinish),
|
|
22698
|
+
onStepError: mergeTelemetryCallback("onStepError"),
|
|
22980
22699
|
onObjectStepStart: mergeTelemetryCallback("onObjectStepStart"),
|
|
22981
22700
|
onObjectStepEnd: mergeTelemetryCallback("onObjectStepEnd"),
|
|
22982
22701
|
onEmbedStart: mergeTelemetryCallback("onEmbedStart"),
|
|
@@ -23031,6 +22750,10 @@ function createTelemetryDispatcher({ telemetry }) {
|
|
|
23031
22750
|
}
|
|
23032
22751
|
};
|
|
23033
22752
|
}
|
|
22753
|
+
createIdGenerator({
|
|
22754
|
+
prefix: "steer",
|
|
22755
|
+
size: 24
|
|
22756
|
+
});
|
|
23034
22757
|
new TextEncoder();
|
|
23035
22758
|
new TextEncoder();
|
|
23036
22759
|
createIdGenerator({
|
|
@@ -23042,6 +22765,34 @@ createIdGenerator({
|
|
|
23042
22765
|
size: 24
|
|
23043
22766
|
});
|
|
23044
22767
|
TransformStream;
|
|
22768
|
+
const z$4 = {
|
|
22769
|
+
array: zod_v4.array,
|
|
22770
|
+
boolean: zod_v4.boolean,
|
|
22771
|
+
custom: zod_v4.custom,
|
|
22772
|
+
discriminatedUnion: zod_v4.discriminatedUnion,
|
|
22773
|
+
enum: zod_v4.enum,
|
|
22774
|
+
instanceof: zod_v4.instanceof,
|
|
22775
|
+
lazy: zod_v4.lazy,
|
|
22776
|
+
literal: zod_v4.literal,
|
|
22777
|
+
looseObject: zod_v4.looseObject,
|
|
22778
|
+
never: zod_v4.never,
|
|
22779
|
+
null: zod_v4.null,
|
|
22780
|
+
number: zod_v4.number,
|
|
22781
|
+
object: zod_v4.object,
|
|
22782
|
+
record: zod_v4.record,
|
|
22783
|
+
string: zod_v4.string,
|
|
22784
|
+
union: zod_v4.union,
|
|
22785
|
+
unknown: zod_v4.unknown
|
|
22786
|
+
};
|
|
22787
|
+
const jsonValueSchema = z$4.lazy(() => z$4.union([
|
|
22788
|
+
z$4.null(),
|
|
22789
|
+
z$4.string(),
|
|
22790
|
+
z$4.number(),
|
|
22791
|
+
z$4.boolean(),
|
|
22792
|
+
z$4.record(z$4.string(), jsonValueSchema.optional()),
|
|
22793
|
+
z$4.array(jsonValueSchema)
|
|
22794
|
+
]));
|
|
22795
|
+
const providerMetadataSchema = z$4.record(z$4.string(), z$4.record(z$4.string(), jsonValueSchema.optional()));
|
|
23045
22796
|
z$4.object({
|
|
23046
22797
|
source: z$4.discriminatedUnion("sourceType", [z$4.object({
|
|
23047
22798
|
type: z$4.literal("source"),
|
|
@@ -23488,6 +23239,281 @@ createIdGenerator({
|
|
|
23488
23239
|
prefix: "call",
|
|
23489
23240
|
size: 24
|
|
23490
23241
|
});
|
|
23242
|
+
const fileInlineDataSchema = z$4.union([
|
|
23243
|
+
z$4.string(),
|
|
23244
|
+
z$4.instanceof(Uint8Array),
|
|
23245
|
+
z$4.instanceof(ArrayBuffer),
|
|
23246
|
+
z$4.custom(isBuffer, { message: "Must be a Buffer" })
|
|
23247
|
+
]);
|
|
23248
|
+
const providerReferenceSchema = z$4.record(z$4.string(), z$4.string());
|
|
23249
|
+
/**
|
|
23250
|
+
* @internal
|
|
23251
|
+
*/
|
|
23252
|
+
const textPartSchema = z$4.object({
|
|
23253
|
+
type: z$4.literal("text"),
|
|
23254
|
+
text: z$4.string(),
|
|
23255
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23256
|
+
});
|
|
23257
|
+
/**
|
|
23258
|
+
* @internal
|
|
23259
|
+
* @deprecated Use `filePartSchema` with `mediaType: 'image'` instead:
|
|
23260
|
+
* `{ type: 'file', mediaType: 'image', data: { type: 'data', data } }`.
|
|
23261
|
+
*/
|
|
23262
|
+
const imagePartSchema = z$4.object({
|
|
23263
|
+
type: z$4.literal("image"),
|
|
23264
|
+
image: z$4.union([
|
|
23265
|
+
fileInlineDataSchema,
|
|
23266
|
+
z$4.instanceof(URL),
|
|
23267
|
+
providerReferenceSchema
|
|
23268
|
+
]),
|
|
23269
|
+
mediaType: z$4.string().optional(),
|
|
23270
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23271
|
+
});
|
|
23272
|
+
const taggedFileDataSchema = z$4.discriminatedUnion("type", [
|
|
23273
|
+
z$4.object({
|
|
23274
|
+
type: z$4.literal("data"),
|
|
23275
|
+
data: fileInlineDataSchema
|
|
23276
|
+
}),
|
|
23277
|
+
z$4.object({
|
|
23278
|
+
type: z$4.literal("url"),
|
|
23279
|
+
url: z$4.instanceof(URL)
|
|
23280
|
+
}),
|
|
23281
|
+
z$4.object({
|
|
23282
|
+
type: z$4.literal("reference"),
|
|
23283
|
+
reference: providerReferenceSchema
|
|
23284
|
+
}),
|
|
23285
|
+
z$4.object({
|
|
23286
|
+
type: z$4.literal("text"),
|
|
23287
|
+
text: z$4.string()
|
|
23288
|
+
})
|
|
23289
|
+
]);
|
|
23290
|
+
const taggedReasoningFileDataSchema = z$4.discriminatedUnion("type", [z$4.object({
|
|
23291
|
+
type: z$4.literal("data"),
|
|
23292
|
+
data: fileInlineDataSchema
|
|
23293
|
+
}), z$4.object({
|
|
23294
|
+
type: z$4.literal("url"),
|
|
23295
|
+
url: z$4.instanceof(URL)
|
|
23296
|
+
})]);
|
|
23297
|
+
/**
|
|
23298
|
+
* @internal
|
|
23299
|
+
*/
|
|
23300
|
+
const filePartSchema = z$4.object({
|
|
23301
|
+
type: z$4.literal("file"),
|
|
23302
|
+
data: z$4.union([
|
|
23303
|
+
taggedFileDataSchema,
|
|
23304
|
+
fileInlineDataSchema,
|
|
23305
|
+
z$4.instanceof(URL),
|
|
23306
|
+
providerReferenceSchema
|
|
23307
|
+
]),
|
|
23308
|
+
filename: z$4.string().optional(),
|
|
23309
|
+
mediaType: z$4.string(),
|
|
23310
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23311
|
+
});
|
|
23312
|
+
/**
|
|
23313
|
+
* @internal
|
|
23314
|
+
*/
|
|
23315
|
+
const reasoningPartSchema = z$4.object({
|
|
23316
|
+
type: z$4.literal("reasoning"),
|
|
23317
|
+
text: z$4.string(),
|
|
23318
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23319
|
+
});
|
|
23320
|
+
/**
|
|
23321
|
+
* @internal
|
|
23322
|
+
*/
|
|
23323
|
+
const customPartSchema = z$4.object({
|
|
23324
|
+
type: z$4.literal("custom"),
|
|
23325
|
+
kind: z$4.string().transform((value) => value),
|
|
23326
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23327
|
+
});
|
|
23328
|
+
/**
|
|
23329
|
+
* @internal
|
|
23330
|
+
*/
|
|
23331
|
+
const reasoningFilePartSchema = z$4.object({
|
|
23332
|
+
type: z$4.literal("reasoning-file"),
|
|
23333
|
+
data: z$4.union([
|
|
23334
|
+
taggedReasoningFileDataSchema,
|
|
23335
|
+
fileInlineDataSchema,
|
|
23336
|
+
z$4.instanceof(URL)
|
|
23337
|
+
]),
|
|
23338
|
+
mediaType: z$4.string(),
|
|
23339
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23340
|
+
});
|
|
23341
|
+
/**
|
|
23342
|
+
* @internal
|
|
23343
|
+
*/
|
|
23344
|
+
const toolCallPartSchema = z$4.object({
|
|
23345
|
+
type: z$4.literal("tool-call"),
|
|
23346
|
+
toolCallId: z$4.string(),
|
|
23347
|
+
toolName: z$4.string(),
|
|
23348
|
+
input: z$4.unknown(),
|
|
23349
|
+
providerOptions: providerMetadataSchema.optional(),
|
|
23350
|
+
providerExecuted: z$4.boolean().optional()
|
|
23351
|
+
});
|
|
23352
|
+
/**
|
|
23353
|
+
* @internal
|
|
23354
|
+
*/
|
|
23355
|
+
const outputSchema = z$4.discriminatedUnion("type", [
|
|
23356
|
+
z$4.object({
|
|
23357
|
+
type: z$4.literal("text"),
|
|
23358
|
+
value: z$4.string(),
|
|
23359
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23360
|
+
}),
|
|
23361
|
+
z$4.object({
|
|
23362
|
+
type: z$4.literal("json"),
|
|
23363
|
+
value: jsonValueSchema,
|
|
23364
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23365
|
+
}),
|
|
23366
|
+
z$4.object({
|
|
23367
|
+
type: z$4.literal("execution-denied"),
|
|
23368
|
+
reason: z$4.string().optional(),
|
|
23369
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23370
|
+
}),
|
|
23371
|
+
z$4.object({
|
|
23372
|
+
type: z$4.literal("error-text"),
|
|
23373
|
+
value: z$4.string(),
|
|
23374
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23375
|
+
}),
|
|
23376
|
+
z$4.object({
|
|
23377
|
+
type: z$4.literal("error-json"),
|
|
23378
|
+
value: jsonValueSchema,
|
|
23379
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23380
|
+
}),
|
|
23381
|
+
z$4.object({
|
|
23382
|
+
type: z$4.literal("content"),
|
|
23383
|
+
value: z$4.array(z$4.union([
|
|
23384
|
+
z$4.object({
|
|
23385
|
+
type: z$4.literal("text"),
|
|
23386
|
+
text: z$4.string(),
|
|
23387
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23388
|
+
}),
|
|
23389
|
+
z$4.object({
|
|
23390
|
+
type: z$4.literal("file"),
|
|
23391
|
+
data: taggedFileDataSchema,
|
|
23392
|
+
mediaType: z$4.string(),
|
|
23393
|
+
filename: z$4.string().optional(),
|
|
23394
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23395
|
+
}),
|
|
23396
|
+
z$4.object({
|
|
23397
|
+
type: z$4.literal("file-data"),
|
|
23398
|
+
data: z$4.string(),
|
|
23399
|
+
mediaType: z$4.string(),
|
|
23400
|
+
filename: z$4.string().optional(),
|
|
23401
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23402
|
+
}),
|
|
23403
|
+
z$4.object({
|
|
23404
|
+
type: z$4.literal("file-url"),
|
|
23405
|
+
url: z$4.string(),
|
|
23406
|
+
mediaType: z$4.string().optional(),
|
|
23407
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23408
|
+
}),
|
|
23409
|
+
z$4.object({
|
|
23410
|
+
type: z$4.literal("file-id"),
|
|
23411
|
+
fileId: z$4.union([z$4.string(), z$4.record(z$4.string(), z$4.string())]),
|
|
23412
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23413
|
+
}),
|
|
23414
|
+
z$4.object({
|
|
23415
|
+
type: z$4.literal("file-reference"),
|
|
23416
|
+
providerReference: z$4.record(z$4.string(), z$4.string()),
|
|
23417
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23418
|
+
}),
|
|
23419
|
+
z$4.object({
|
|
23420
|
+
type: z$4.literal("image-data"),
|
|
23421
|
+
data: z$4.string(),
|
|
23422
|
+
mediaType: z$4.string(),
|
|
23423
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23424
|
+
}),
|
|
23425
|
+
z$4.object({
|
|
23426
|
+
type: z$4.literal("image-url"),
|
|
23427
|
+
url: z$4.string(),
|
|
23428
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23429
|
+
}),
|
|
23430
|
+
z$4.object({
|
|
23431
|
+
type: z$4.literal("image-file-id"),
|
|
23432
|
+
fileId: z$4.union([z$4.string(), z$4.record(z$4.string(), z$4.string())]),
|
|
23433
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23434
|
+
}),
|
|
23435
|
+
z$4.object({
|
|
23436
|
+
type: z$4.literal("image-file-reference"),
|
|
23437
|
+
providerReference: z$4.record(z$4.string(), z$4.string()),
|
|
23438
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23439
|
+
}),
|
|
23440
|
+
z$4.object({
|
|
23441
|
+
type: z$4.literal("custom"),
|
|
23442
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23443
|
+
})
|
|
23444
|
+
]))
|
|
23445
|
+
})
|
|
23446
|
+
]);
|
|
23447
|
+
/**
|
|
23448
|
+
* @internal
|
|
23449
|
+
*/
|
|
23450
|
+
const toolResultPartSchema = z$4.object({
|
|
23451
|
+
type: z$4.literal("tool-result"),
|
|
23452
|
+
toolCallId: z$4.string(),
|
|
23453
|
+
toolName: z$4.string(),
|
|
23454
|
+
output: outputSchema,
|
|
23455
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23456
|
+
});
|
|
23457
|
+
/**
|
|
23458
|
+
* @internal
|
|
23459
|
+
*/
|
|
23460
|
+
const toolApprovalRequestSchema = z$4.object({
|
|
23461
|
+
type: z$4.literal("tool-approval-request"),
|
|
23462
|
+
approvalId: z$4.string(),
|
|
23463
|
+
toolCallId: z$4.string(),
|
|
23464
|
+
reason: z$4.string().optional(),
|
|
23465
|
+
isAutomatic: z$4.boolean().optional(),
|
|
23466
|
+
signature: z$4.string().optional(),
|
|
23467
|
+
inputSchemaInput: z$4.unknown().optional()
|
|
23468
|
+
});
|
|
23469
|
+
/**
|
|
23470
|
+
* @internal
|
|
23471
|
+
*/
|
|
23472
|
+
const toolApprovalResponseSchema = z$4.object({
|
|
23473
|
+
type: z$4.literal("tool-approval-response"),
|
|
23474
|
+
approvalId: z$4.string(),
|
|
23475
|
+
approved: z$4.boolean(),
|
|
23476
|
+
reason: z$4.string().optional()
|
|
23477
|
+
});
|
|
23478
|
+
const systemModelMessageSchema = z$4.object({
|
|
23479
|
+
role: z$4.literal("system"),
|
|
23480
|
+
content: z$4.string(),
|
|
23481
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23482
|
+
});
|
|
23483
|
+
const userModelMessageSchema = z$4.object({
|
|
23484
|
+
role: z$4.literal("user"),
|
|
23485
|
+
content: z$4.union([z$4.string(), z$4.array(z$4.union([
|
|
23486
|
+
textPartSchema,
|
|
23487
|
+
imagePartSchema,
|
|
23488
|
+
filePartSchema
|
|
23489
|
+
]))]),
|
|
23490
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23491
|
+
});
|
|
23492
|
+
const assistantModelMessageSchema = z$4.object({
|
|
23493
|
+
role: z$4.literal("assistant"),
|
|
23494
|
+
content: z$4.union([z$4.string(), z$4.array(z$4.union([
|
|
23495
|
+
textPartSchema,
|
|
23496
|
+
customPartSchema,
|
|
23497
|
+
filePartSchema,
|
|
23498
|
+
reasoningPartSchema,
|
|
23499
|
+
reasoningFilePartSchema,
|
|
23500
|
+
toolCallPartSchema,
|
|
23501
|
+
toolResultPartSchema,
|
|
23502
|
+
toolApprovalRequestSchema
|
|
23503
|
+
]))]),
|
|
23504
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23505
|
+
});
|
|
23506
|
+
const toolModelMessageSchema = z$4.object({
|
|
23507
|
+
role: z$4.literal("tool"),
|
|
23508
|
+
content: z$4.array(z$4.union([toolResultPartSchema, toolApprovalResponseSchema])),
|
|
23509
|
+
providerOptions: providerMetadataSchema.optional()
|
|
23510
|
+
});
|
|
23511
|
+
z$4.union([
|
|
23512
|
+
systemModelMessageSchema,
|
|
23513
|
+
userModelMessageSchema,
|
|
23514
|
+
assistantModelMessageSchema,
|
|
23515
|
+
toolModelMessageSchema
|
|
23516
|
+
]);
|
|
23491
23517
|
z$4.object({
|
|
23492
23518
|
token: z$4.string().refine((value) => value.trim().length > 0),
|
|
23493
23519
|
url: z$4.string().refine((value) => {
|
|
@@ -27359,10 +27385,17 @@ function isOmModelExecutionFailure(error) {
|
|
|
27359
27385
|
}
|
|
27360
27386
|
var OmModelExecutionError = class extends Error {
|
|
27361
27387
|
failureKind;
|
|
27362
|
-
|
|
27388
|
+
#observerSpanId;
|
|
27389
|
+
get observerSpanId() {
|
|
27390
|
+
return this.#observerSpanId;
|
|
27391
|
+
}
|
|
27392
|
+
constructor(failureKind, cause, observerSpan) {
|
|
27363
27393
|
super(formatOmError(cause), { cause });
|
|
27364
27394
|
this.failureKind = failureKind;
|
|
27365
27395
|
this.name = "OmModelExecutionError";
|
|
27396
|
+
try {
|
|
27397
|
+
this.#observerSpanId = observerSpan && (typeof observerSpan.getExportedSpanId !== "function" || observerSpan.getExportedSpanId() === observerSpan.id) ? observerSpan.id : void 0;
|
|
27398
|
+
} catch {}
|
|
27366
27399
|
}
|
|
27367
27400
|
};
|
|
27368
27401
|
function isOmModelExecutionError(error) {
|
|
@@ -27373,8 +27406,22 @@ function isOmModelExecutionError(error) {
|
|
|
27373
27406
|
}
|
|
27374
27407
|
}
|
|
27375
27408
|
function getOmFailureMetadata(error, failurePolicy) {
|
|
27409
|
+
let observerFailure;
|
|
27410
|
+
if (typeof _mastra_core_observability.executionFailureTermination === "function") try {
|
|
27411
|
+
const modelFailure = isOmModelExecutionError(error);
|
|
27412
|
+
observerFailure = {
|
|
27413
|
+
...modelFailure && error.observerSpanId ? { observerSpanId: error.observerSpanId } : {},
|
|
27414
|
+
cause: _mastra_core_observability.executionFailureTermination(modelFailure ? error.cause : error, modelFailure ? "model_error" : "runtime_error")
|
|
27415
|
+
};
|
|
27416
|
+
} catch {
|
|
27417
|
+
observerFailure = { cause: {
|
|
27418
|
+
outcome: "error",
|
|
27419
|
+
stopReason: "runtime_error"
|
|
27420
|
+
} };
|
|
27421
|
+
}
|
|
27376
27422
|
return {
|
|
27377
27423
|
failurePolicy,
|
|
27424
|
+
...observerFailure ? { observerFailure } : {},
|
|
27378
27425
|
...isOmModelExecutionError(error) ? { failureKind: error.failureKind } : {}
|
|
27379
27426
|
};
|
|
27380
27427
|
}
|
|
@@ -30269,7 +30316,7 @@ var ObserverRunner = class {
|
|
|
30269
30316
|
aborted: abortSignal?.aborted ?? false
|
|
30270
30317
|
});
|
|
30271
30318
|
if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
|
|
30272
|
-
throw new OmModelExecutionError("observer-model", error);
|
|
30319
|
+
throw new OmModelExecutionError("observer-model", error, childObservabilityContext.tracingContext?.currentSpan);
|
|
30273
30320
|
}
|
|
30274
30321
|
}, abortSignal)
|
|
30275
30322
|
}), {
|
|
@@ -30484,7 +30531,7 @@ var ObserverRunner = class {
|
|
|
30484
30531
|
aborted: abortSignal?.aborted ?? false
|
|
30485
30532
|
});
|
|
30486
30533
|
if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
|
|
30487
|
-
throw new OmModelExecutionError("observer-model", error);
|
|
30534
|
+
throw new OmModelExecutionError("observer-model", error, childObservabilityContext.tracingContext?.currentSpan);
|
|
30488
30535
|
}
|
|
30489
30536
|
}, abortSignal)
|
|
30490
30537
|
}), {
|
|
@@ -38403,7 +38450,7 @@ var ReflectorRunner = class {
|
|
|
38403
38450
|
})).getFullOutput(), "OM reflector");
|
|
38404
38451
|
} catch (error) {
|
|
38405
38452
|
if (abortSignal?.aborted || !isOmModelExecutionFailure(error)) throw error;
|
|
38406
|
-
throw new OmModelExecutionError("reflector-model", error);
|
|
38453
|
+
throw new OmModelExecutionError("reflector-model", error, childObservabilityContext.tracingContext?.currentSpan);
|
|
38407
38454
|
}
|
|
38408
38455
|
}, abortSignal)
|
|
38409
38456
|
}), {
|
|
@@ -42450,7 +42497,7 @@ var ObservationalMemoryProcessor = class {
|
|
|
42450
42497
|
await failedTurn.end().catch(() => {});
|
|
42451
42498
|
if (this.turn === failedTurn) this.turn = void 0;
|
|
42452
42499
|
state.__omTurn = void 0;
|
|
42453
|
-
if (typeof abort === "function") abort(abortMessage);
|
|
42500
|
+
if (typeof abort === "function") abort(abortMessage, { metadata: getOmFailureMetadata(error, "abort") });
|
|
42454
42501
|
throw err;
|
|
42455
42502
|
}
|
|
42456
42503
|
injectObservationContextMessages({
|
|
@@ -45644,4 +45691,4 @@ Object.defineProperty(exports, "wrapInObservationGroup", {
|
|
|
45644
45691
|
}
|
|
45645
45692
|
});
|
|
45646
45693
|
|
|
45647
|
-
//# sourceMappingURL=src-
|
|
45694
|
+
//# sourceMappingURL=src-BFJ_viw1.cjs.map
|